提交
This commit is contained in:
@@ -0,0 +1,94 @@
|
||||
package io.v.nutz.meeting.controller.mobile;
|
||||
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.result.Result;
|
||||
import io.v.nutz.meeting.service.MeetingAuditService;
|
||||
import io.v.nutz.modules.models.Audit;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* 会议手机端审核
|
||||
*/
|
||||
@IocBean
|
||||
@Slf4j
|
||||
@At("/mobile/meeting/audit")
|
||||
public class MMeetingAuditController {
|
||||
|
||||
@Inject
|
||||
private MeetingAuditService meetingAuditService;
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
/**
|
||||
* 跳转审核页面
|
||||
*
|
||||
* @param request
|
||||
*/
|
||||
@At("")
|
||||
@Ok("beetl:/mobile/meeting/audit.html")
|
||||
@RequiresAuthentication
|
||||
public void index(HttpServletRequest request) {
|
||||
|
||||
}
|
||||
|
||||
@At("/pageData")
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object pageData(PageForm pageForm,
|
||||
@Param(value = "typeId", required = false) String typeId,
|
||||
@Param(value = "meetingTime", required = false) Integer meetingTime) {
|
||||
|
||||
return meetingAuditService.myMeetingPageData(pageForm.getPageNumber(), pageForm.getPageSize(), pageForm.getSearchKeyword(), typeId, meetingTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询会议提交了请假的人员
|
||||
* 这里需要根据当前登录用户去过滤他能审核的 are you ok?
|
||||
*/
|
||||
@At("/getLeaveUser")
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object getLeaveUser(@Param(value = "meetingId", required = false) String meetingId,
|
||||
@Param(value = "moduleName", required = false) String moduleName,
|
||||
@Param(value = "auditType", required = false) String auditType) {
|
||||
if (StringUtils.isBlank(meetingId)) {
|
||||
log.error("getUserByLoginUser()参数为空");
|
||||
return Result.error("参数为空");
|
||||
}
|
||||
return meetingAuditService.getLeaveUser(meetingId, moduleName, auditType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 会议审核
|
||||
*
|
||||
* @param tpuIds 审核记录Ids
|
||||
* @param audit 审核
|
||||
* @param isPass 是否通过
|
||||
* @return
|
||||
*/
|
||||
@At("/audit")
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object audit(@Param("tpuIds") String[] tpuIds, Audit audit,
|
||||
@Param("isPass") boolean isPass) {
|
||||
meetingAuditService.audit(tpuIds, audit, isPass);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,222 @@
|
||||
package io.v.nutz.meeting.controller.mobile;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.meeting.models.MeetingInfo;
|
||||
import io.v.nutz.meeting.models.MeetingTimePeriodUser;
|
||||
import io.v.nutz.meeting.service.MeetingMineService;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
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.mvc.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 会议手机端签到
|
||||
*/
|
||||
@IocBean
|
||||
@At("/mobile/meeting/mine")
|
||||
public class MMeetingMineController {
|
||||
|
||||
@Inject
|
||||
private MeetingMineService meetingMineService;
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
/**
|
||||
* 跳转签到页面
|
||||
*
|
||||
* @param request
|
||||
*/
|
||||
@At("/go_sign")
|
||||
@RequiresAuthentication
|
||||
@Ok("beetl:/mobile/meeting/sign_in.html")
|
||||
public void goSign(HttpServletRequest request) {
|
||||
}
|
||||
|
||||
@At("/myMeeting")
|
||||
@RequiresAuthentication
|
||||
@Ok("beetl:/mobile/meeting/myMeeting.html")
|
||||
public void myMeeting(HttpServletRequest request) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 我的会议
|
||||
*
|
||||
* @param pageForm 分页
|
||||
* @param tabNameIndex tab页下标
|
||||
* @return
|
||||
*/
|
||||
@At("/pageData")
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object pageData(PageForm pageForm,
|
||||
@Param(value = "tabNameIndex", required = false) Integer tabNameIndex,
|
||||
@Param(value = "typeId", required = false) String typeId,
|
||||
@Param(value = "meetingTime", required = false) Integer meetingTime) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (StrUtil.isNotBlank(typeId)) {
|
||||
cnd.andEX("info.typeId", "=", typeId);
|
||||
}
|
||||
if (meetingTime != null) {
|
||||
if (meetingTime == 0) {
|
||||
cnd.andEX("info.startTime", ">=", DateUtil.getDateTime());
|
||||
} else {
|
||||
cnd.andEX("info.startTime", "<", DateUtil.getDateTime());
|
||||
}
|
||||
}
|
||||
switch (tabNameIndex) {
|
||||
case 1 -> cnd.and("mu.isJoin", "is", null);
|
||||
case 2 -> cnd.and("mu.isJoin", "=", 0);
|
||||
default -> {
|
||||
}
|
||||
}
|
||||
|
||||
return meetingMineService.myMeetingPageData(pageForm, cnd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 我的会议时间段信息
|
||||
*
|
||||
* @param meetingId
|
||||
* @return
|
||||
*/
|
||||
@At("/findMyMeetPeriod")
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object findMyMeetPeriod(@Param("meetingId") String meetingId) {
|
||||
if (StrUtil.isBlank(meetingId)) {
|
||||
return Result.error("参数错误");
|
||||
}
|
||||
return meetingMineService.findMyMeetPeriod(meetingId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 请假
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@At("/askForLeave")
|
||||
@POST
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object askForLeave(@Param("data") String meetingTimePeriodUsers) {
|
||||
//先清空,因为可能会涉及到修改
|
||||
/*org.nutz.dao.Chain clearChain = Chain.make("isJoin", null);
|
||||
clearChain.add("stateCode", null);
|
||||
clearChain.add("leaveReason", "");
|
||||
clearChain.add("auditIdList", null);
|
||||
Cnd clearCnd = Cnd.where("meetingId", "=", meetingId)
|
||||
.and("userId", "=", ShiroUtil.getPrincipalProperty("id"));
|
||||
dao.update(MeetingTimePeriodUser.class, clearChain, clearCnd);*/
|
||||
|
||||
List<MeetingTimePeriodUser> meetingTimePeriod = Json.fromJsonAsList(MeetingTimePeriodUser.class, meetingTimePeriodUsers);
|
||||
if (Lang.isEmpty(meetingTimePeriod)) {
|
||||
return null;
|
||||
}
|
||||
meetingMineService.askForLeave(meetingTimePeriod);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 确认参加会议
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@At("/confirmMeeting")
|
||||
@POST
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object confirmMeeting(@Param("tpuIds") List<String> tpuIds) {
|
||||
meetingMineService.confirmMeeting(tpuIds);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param meetingId 会议id
|
||||
* @param mtpId 时间段id
|
||||
* @return
|
||||
*/
|
||||
@At("/getMeetingInfo")
|
||||
@GET
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object getMeetingInfo(@Param("meetingId") String meetingId, @Param("mtpId") String mtpId) {
|
||||
MeetingInfo meetingInfo = dao.fetch(MeetingInfo.class, meetingId);
|
||||
dao.fetchLinks(meetingInfo, "meetingTimePeriods", Cnd.NEW().asc("startTime"));
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("meetingTimePeriodId", "=", mtpId);
|
||||
cnd.and("userId", "=", ShiroUtil.getPrincipalProperty("id"));
|
||||
MeetingTimePeriodUser mtPu = dao.fetch(MeetingTimePeriodUser.class, cnd);
|
||||
|
||||
if (Lang.isEmpty(meetingInfo)) {
|
||||
return Result.error("参数错误");
|
||||
}
|
||||
if (Lang.isEmpty(mtPu)) {
|
||||
return Result.error("你不是当前会议人员");
|
||||
}
|
||||
|
||||
return Map.of("meetingInfo", meetingInfo, "signInfo", mtPu);
|
||||
}
|
||||
|
||||
/**
|
||||
* 签到
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@At("/signIn")
|
||||
@POST
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object signIn(@Param("mtpId") String mtpId) {
|
||||
if (StrUtil.isBlank(mtpId)) {
|
||||
return Result.error("参数错误");
|
||||
}
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("meetingTimePeriodId", "=", mtpId);
|
||||
cnd.and("userId", "=", ShiroUtil.getPrincipalProperty("id"));
|
||||
MeetingTimePeriodUser mtpu = dao.fetch(MeetingTimePeriodUser.class, cnd);
|
||||
if (Lang.isEmpty(mtpu)) {
|
||||
return Result.error("参数错误");
|
||||
}
|
||||
if (Lang.isNotEmpty(mtpu.getIsJoin()) && !mtpu.getIsJoin()) {
|
||||
return Result.error("您已请假,不能签到喔");
|
||||
}
|
||||
if (Lang.isNotEmpty(mtpu.getIsSignIn()) && mtpu.getIsSignIn()) {
|
||||
return Result.error("您已签到,不要重复签到喔");
|
||||
}
|
||||
meetingMineService.signIn(mtpu);
|
||||
return Result.success().addMsg("签到成功");
|
||||
}
|
||||
|
||||
@At
|
||||
@POST
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object cancelLeave(String id) {
|
||||
dao.update(MeetingTimePeriodUser.class, Chain.make("isJoin", null).add("leaveReason", null).add("stateCode", null)
|
||||
, Cnd.where("id", "=", id));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
package io.v.nutz.meeting.controller.pc;
|
||||
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.meeting.models.MeetingInfo;
|
||||
import io.v.nutz.meeting.models.MeetingUser;
|
||||
import io.v.nutz.meeting.service.MeetingManageService;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.msgNotify.models.MsgNotify;
|
||||
import io.v.nutz.msgNotify.service.MsgNotifyService;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.POST;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/meeting/manage")
|
||||
public class MeetingManageController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private MeetingManageService meetingManageService;
|
||||
|
||||
@Inject
|
||||
private MsgNotifyService msgNotifyService;
|
||||
|
||||
@At("/createMeeting")
|
||||
@Ok("beetl:/platform/meeting/manage/add.html")
|
||||
@RequiresPermissions("meeting.manage.add")
|
||||
public void createMeeting(HttpServletRequest request) {
|
||||
|
||||
}
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/meeting/index.html")
|
||||
@RequiresPermissions("meeting.manage.search")
|
||||
public void index(HttpServletRequest request) {
|
||||
|
||||
}
|
||||
|
||||
@At("/pageData")
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresPermissions("meeting.manage.search")
|
||||
public Object pageData(PageForm pageForm,
|
||||
@Param(value = "year", required = false) Integer year,
|
||||
@Param(value = "typeId", required = false) String typeId) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("YEAR(info.startTime)", "=", year);
|
||||
cnd.andEX("info.typeId", "=", typeId);
|
||||
return meetingManageService.pageData(pageForm, cnd);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加会议
|
||||
*
|
||||
* @param meetingInfo 会议信息
|
||||
* @return
|
||||
*/
|
||||
@At("/doAdd")
|
||||
@POST
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresPermissions("meeting.manage.add")
|
||||
public Object doAdd(@Param("meetingInfo") MeetingInfo meetingInfo,
|
||||
@Param("msgNotify") MsgNotify msgNotify, String[] users) {
|
||||
|
||||
|
||||
NutMap nutMap = msgNotifyService.addMsgNotify(msgNotify, users);
|
||||
meetingInfo.setNotifyId(nutMap.getString("id"));
|
||||
List<String> userIdList = nutMap.getList("userIdList", String.class);
|
||||
List<MeetingUser> meetingUserList = new ArrayList<>();
|
||||
for (String id : userIdList) {
|
||||
MeetingUser meetingUser = new MeetingUser();
|
||||
meetingUser.setUserId(id);
|
||||
meetingUserList.add(meetingUser);
|
||||
}
|
||||
meetingInfo.setMeetingUserList(meetingUserList);
|
||||
|
||||
meetingManageService.doAdd(meetingInfo);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑会议
|
||||
*
|
||||
* @param meetingInfo 会议信息
|
||||
* @return
|
||||
*/
|
||||
@At("/doEdit")
|
||||
@POST
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresPermissions("meeting.manage.add")
|
||||
public Object doEdit(@Param("meetingInfo") MeetingInfo meetingInfo,
|
||||
@Param("msgNotify") MsgNotify msgNotify, String[] users) {
|
||||
|
||||
NutMap msgMap = msgNotifyService.editMsgNotify(msgNotify, users);
|
||||
List<String> userIdList = msgMap.getList("userIdList", String.class);
|
||||
|
||||
// Cnd muCnd = Cnd.where("meetingId", "=", meetingInfo.getId());
|
||||
// List<MeetingUser> muList = dao.query(MeetingUser.class, muCnd);
|
||||
//
|
||||
// List<MeetingUser> meetingUserList = new ArrayList<>();
|
||||
// for (String userId : userIdList) {
|
||||
// MeetingUser insertMu = new MeetingUser();
|
||||
// Optional<MeetingUser> optionalMeetingUser = muList.stream().filter(v -> v.getUserId().equals(userId)).findFirst();
|
||||
// MeetingUser mu = optionalMeetingUser.orElse(null);
|
||||
// if (Lang.isNotEmpty(mu)) {
|
||||
// insertMu.setId(mu.getId());
|
||||
// }
|
||||
// insertMu.setMeetingId(meetingInfo.getId());
|
||||
// insertMu.setUserId(userId);
|
||||
// meetingUserList.add(insertMu);
|
||||
// }
|
||||
// meetingInfo.setMeetingUserList(meetingUserList);
|
||||
meetingManageService.doEdit(meetingInfo, userIdList);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"meeting.manage.search", "meeting.manage.add"}, logical = Logical.OR)
|
||||
public Object findOne(String id) {
|
||||
return dao.fetchLinks(dao.fetch(MeetingInfo.class, id), "^meetingTimePeriods$", Cnd.NEW().asc("startTime"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除会议
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresPermissions("meeting.manage.search")
|
||||
public Object doDelete(String id) {
|
||||
meetingManageService.doDelete(id);
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
package io.v.nutz.meeting.controller.pc;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
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.service.MeetingOnlineService;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.util.ViTool;
|
||||
import io.v.nutz.web.commons.base.Globals;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/meeting/online")
|
||||
public class MeetingOnlineController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private MeetingOnlineService meetingOnlineService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/meeting/online.html")
|
||||
@RequiresPermissions("meeting.online")
|
||||
public void index(HttpServletRequest request) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param pageForm
|
||||
* @param year
|
||||
* @param typeId
|
||||
* @return
|
||||
*/
|
||||
@At("/pageData")
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresPermissions("meeting.online")
|
||||
public Object pageData(PageForm pageForm,
|
||||
@Param(value = "year", required = false) Integer year,
|
||||
@Param(value = "typeId", required = false) String typeId) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("YEAR(info.startTime)", "=", year);
|
||||
cnd.andEX("info.typeId", "=", typeId);
|
||||
return meetingOnlineService.pageData(pageForm, cnd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出签字表
|
||||
*
|
||||
* @param timePeriodId
|
||||
* @param response
|
||||
*/
|
||||
@At("/exportSignature/?")
|
||||
@Ok("void")
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public void exportSignature(@Param(value = "timePeriodId", required = false) String timePeriodId, HttpServletResponse response) {
|
||||
MeetingTimePeriod timePeriod = dao.fetch(MeetingTimePeriod.class, timePeriodId);
|
||||
MeetingInfo meetingInfo = dao.fetch(MeetingInfo.class, timePeriod.getMeetingId());
|
||||
String fileName = meetingInfo.getMeetingName() + "(" + timePeriod.getTimePeriodName() + ")签字表";
|
||||
|
||||
List<ExcelExportEntity> entityArrayList = new ArrayList<>();
|
||||
entityArrayList.add(new ExcelExportEntity("姓名", "username", 20));
|
||||
entityArrayList.add(new ExcelExportEntity("工号", "loginname", 20));
|
||||
entityArrayList.add(new ExcelExportEntity("单位", "unitname", 20));
|
||||
entityArrayList.add(new ExcelExportEntity("分工会", "unionname", 20));
|
||||
entityArrayList.add(new ExcelExportEntity("角色", "roleName", 20));
|
||||
entityArrayList.add(new ExcelExportEntity("签字", "", 20));
|
||||
try {
|
||||
ViTool.excelResponse(response, fileName + ".xlsx");
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setTitle(timePeriod.getTimePeriodName() + "签字表");
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entityArrayList, meetingOnlineService.exportSignature(timePeriodId));
|
||||
workbook.write(response.getOutputStream());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@At("/generateQrCodeUrl")
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object generateQrCodeUrl(@Param(value = "tpId", required = false) String tpId,
|
||||
@Param(value = "meetingId", required = false) String meetingId,
|
||||
HttpServletRequest request) {
|
||||
StringBuffer redirect = new StringBuffer();
|
||||
redirect.append(Globals.AppDomain);
|
||||
|
||||
redirect.append("/mobile/meeting/mine/go_sign?");
|
||||
redirect.append("mtpId=").append(tpId);
|
||||
redirect.append("&");
|
||||
redirect.append("meetingId=").append(meetingId);
|
||||
return redirect.toString();
|
||||
}
|
||||
|
||||
@At("/getRealTimeData/?")
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresPermissions("meeting.online")
|
||||
public Object getRealTimeData(String timePeriodId) {
|
||||
List<NutMap> signInUser = meetingOnlineService.getSignInUser(timePeriodId);
|
||||
List<Map<String, Object>> countData = meetingOnlineService.getRealTimeData(timePeriodId);
|
||||
return Map.of("countData", countData, "userData", signInUser);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
package io.v.nutz.meeting.controller.pc;
|
||||
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.meeting.models.MeetingType;
|
||||
import io.v.nutz.meeting.service.MeetingCommonService;
|
||||
import io.v.nutz.meeting.service.MeetingTypeService;
|
||||
import io.v.nutz.modules.models.AuditState;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.Daos;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/meeting/basic/type")
|
||||
public class MeetingTypeController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private MeetingTypeService meetingTypeService;
|
||||
|
||||
@Inject
|
||||
private MeetingCommonService meetingCommonService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/meeting/basic/type.html")
|
||||
@RequiresPermissions("meeting.basic.type")
|
||||
public void index(HttpServletRequest request) {
|
||||
|
||||
}
|
||||
|
||||
@At("/findAll")
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object findAll() {
|
||||
List<MeetingType> meetingTypeList = dao.query(MeetingType.class, Cnd.NEW().asc("sortNum"));
|
||||
dao.fetchLinks(meetingTypeList, "^auditStateList$");
|
||||
for (MeetingType meetingType : meetingTypeList) {
|
||||
meetingType.setAuditStateList(dao.query(AuditState.class, Cnd.where("meetingTypeId", "=", meetingType.getId()).and("module", "=", meetingType.getModuleName())));
|
||||
List<AuditState> auditStateList = meetingType.getAuditStateList();
|
||||
dao.fetchLinks(auditStateList, "^auditStateUserList$");
|
||||
}
|
||||
return meetingTypeList;
|
||||
}
|
||||
|
||||
@At("/doHandle")
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresPermissions("meeting.basic.type")
|
||||
public Object doHandle(@Param("data") String data) {
|
||||
MeetingType meetingType = Json.fromJson(MeetingType.class, data);
|
||||
|
||||
if (null == meetingType.getId()) {
|
||||
int typeCount = dao.count(MeetingType.class, Cnd.where("moduleName", "=", meetingType.getModuleName()));
|
||||
int count = dao.count(AuditState.class, Cnd.where("module", "=", meetingType.getModuleName()));
|
||||
if (typeCount > 0 || count > 0) {
|
||||
return Result.error("模块名称已存在,换一个试试");
|
||||
}
|
||||
meetingTypeService.add(meetingType);
|
||||
} else {
|
||||
meetingTypeService.edit(meetingType);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@At("/delete/?")
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresPermissions("meeting.basic.type")
|
||||
public Object delete(Integer id) {
|
||||
MeetingType meetingType = dao.fetch(MeetingType.class, id);
|
||||
dao.clear(AuditState.class, Cnd.where("module", "=", meetingType.getModuleName()));
|
||||
dao.clear(MeetingType.class, Cnd.where("id", "=", id));
|
||||
return null;
|
||||
}
|
||||
|
||||
@At("/findUserList")
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresPermissions("meeting.basic.type")
|
||||
public Object findUserList(@Param("keyWords") String[] keyWords) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
id,
|
||||
username,
|
||||
loginname,
|
||||
mobile,
|
||||
sex,
|
||||
unitname,
|
||||
unionname,
|
||||
unionid,
|
||||
unitid
|
||||
FROM
|
||||
`user`
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
for (String keyWord : keyWords) {
|
||||
seg.andLike("loginname", keyWord);
|
||||
seg.orLike("username", keyWord);
|
||||
}
|
||||
cnd.and(seg);
|
||||
sql.setCondition(cnd);
|
||||
return Daos.query(dao, sql.toString(), Sqls.callback.maps());
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresPermissions("meeting.basic.type")
|
||||
public Object findMaxStateId() {
|
||||
return meetingTypeService.findMaxStateId();
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresPermissions("meeting.basic.type")
|
||||
public Object checkStateId(@Param("stateId") Integer stateId, @Param("stateIndex") Integer stateIndex) {
|
||||
if (stateId == null) {
|
||||
return Result.error("参数错误");
|
||||
}
|
||||
int count = dao.count(AuditState.class, Cnd.where("stateId", "=", stateId));
|
||||
if (count == 0) {
|
||||
return Result.success().addData(stateId);
|
||||
} else {
|
||||
return Result.success(meetingTypeService.findMaxStateId() + 10 * stateIndex);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+126
@@ -0,0 +1,126 @@
|
||||
package io.v.nutz.meeting.controller.pc.statistics;
|
||||
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.afterturn.easypoi.excel.export.ExcelExportService;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.meeting.models.MeetingInfo;
|
||||
import io.v.nutz.meeting.models.MeetingType;
|
||||
import io.v.nutz.meeting.service.MeetingBasicStatisticsService;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.util.ViTool;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/meeting/statistics/basic")
|
||||
public class MeetingBasicStatisticsController {
|
||||
|
||||
@Inject
|
||||
private MeetingBasicStatisticsService meetingBasicStatisticsService;
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/meeting/statistics/basic.html")
|
||||
@RequiresPermissions("meeting.statistics.basic")
|
||||
public void index(HttpServletRequest request) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据会议id查询会议时间段及对应人数
|
||||
*
|
||||
* @param pageForm
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("meeting.statistics.basic")
|
||||
public Object pageData(PageForm pageForm,
|
||||
@Param(value = "meetingId", required = false) String meetingId,
|
||||
@Param(value = "meetingTime", required = false) String[] meetingTime,
|
||||
@Param(value = "typeId", required = false) String typeId) {
|
||||
return meetingBasicStatisticsService.pageData(pageForm, meetingId, meetingTime, typeId);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("meeting.statistics.basic")
|
||||
public Object getMeetingList(String[] meetingTime) {
|
||||
return meetingBasicStatisticsService.getMeetingList(meetingTime);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("meeting.statistics.basic")
|
||||
public Object getUserData(PageForm pageForm,
|
||||
@Param(value = "id", required = false) String id,
|
||||
@Param(value = "meetingId", required = false) String meetingId,
|
||||
@Param(value = "type", required = false) String type,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "unionId", required = false) String unionId) {
|
||||
return meetingBasicStatisticsService.getUserData(pageForm, id, meetingId, type, unitId, unionId);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@RequiresAuthentication
|
||||
public void exportUser(@Param(value = "id", required = false) String id,
|
||||
@Param(value = "meetingId", required = false) String meetingId,
|
||||
HttpServletResponse response) {
|
||||
List<ExcelExportEntity> entityList = new ArrayList<>();
|
||||
entityList.add(new ExcelExportEntity("姓名", "userName", 20));
|
||||
entityList.add(new ExcelExportEntity("工号", "loginName", 20));
|
||||
entityList.add(new ExcelExportEntity("单位", "unitName", 30));
|
||||
entityList.add(new ExcelExportEntity("分工会", "unionName", 35));
|
||||
|
||||
Workbook workbook = new XSSFWorkbook();
|
||||
|
||||
MeetingInfo meetingInfo = dao.fetch(MeetingInfo.class, meetingId);
|
||||
MeetingType meetingType = dao.fetch(MeetingType.class, meetingInfo.getTypeId());
|
||||
String[] arr = null;
|
||||
if(List.of("teacherMeeting","gdh").contains(meetingType.getModuleName())) {
|
||||
arr = new String[]{"应到人数", "实到人数", "正式代表", "列席代表", "请假人数", "未到人数"};
|
||||
} else {
|
||||
arr = new String[]{"应到人数", "实到人数", "请假人数", "未到人数"};
|
||||
}
|
||||
for (String a : arr) {
|
||||
List<NutMap> userData = meetingBasicStatisticsService.getUserData(id, meetingId, a);
|
||||
ExcelExportService service = new ExcelExportService();
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setTitle(a);
|
||||
exportParams.setSheetName(a);
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
service.createSheetForMap(workbook, exportParams, entityList, userData);
|
||||
}
|
||||
try {
|
||||
ViTool.excelResponse(response, "人员列表.xlsx");
|
||||
ServletOutputStream outputStream = response.getOutputStream();
|
||||
workbook.write(outputStream);
|
||||
outputStream.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package io.v.nutz.meeting.models;
|
||||
|
||||
import io.v.nutz.annontation.SelectEnum;
|
||||
|
||||
@SelectEnum
|
||||
public enum CustomAuditTypeEnum {
|
||||
|
||||
CLUB("CLUB", "审核本协会"),
|
||||
DW("DW", "审核本单位"),
|
||||
FGH("FGH", "审核本分工会"),
|
||||
TZ("TZ", "审核本代表团");
|
||||
|
||||
public String value;
|
||||
public String desc;
|
||||
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return this.desc;
|
||||
}
|
||||
|
||||
private CustomAuditTypeEnum(String value, String desc) {
|
||||
this.value = value;
|
||||
this.desc = desc;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package io.v.nutz.meeting.models;
|
||||
|
||||
import io.v.nutz.annontation.SelectEnum;
|
||||
import io.v.nutz.base.utils.Roles;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.sys.models.Sys_club_user;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.sys.models.Sys_user_role;
|
||||
import io.v.nutz.util.ShiroUtil;
|
||||
import io.v.nutz.util.ViResource;
|
||||
import lombok.Getter;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.lang.Lang;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2023/3/30
|
||||
* @Description
|
||||
*/
|
||||
@Getter
|
||||
@SelectEnum
|
||||
public enum CustomAuditTypeHandle {
|
||||
|
||||
|
||||
DW(CustomAuditTypeEnum.DW.getValue()) {
|
||||
@Override
|
||||
public SqlExpressionGroup next(SqlExpressionGroup sqlExpressionGroup) {
|
||||
Sys_user user = dao.fetch(Sys_user.class, Cnd.where("id", "=", ShiroUtil.getPrincipalProperty("id")));
|
||||
sqlExpressionGroup.or("u.unitid", "in", user.getUnitid());
|
||||
return sqlExpressionGroup;
|
||||
}
|
||||
},
|
||||
FGH(CustomAuditTypeEnum.FGH.getValue()) {
|
||||
@Override
|
||||
public SqlExpressionGroup next(SqlExpressionGroup sqlExpressionGroup) {
|
||||
//查询当前登录用户管理的工会
|
||||
List<Sys_user_role> userRoles = dao.query(Sys_user_role.class, Cnd.where("userid", "=", ShiroUtil.getPrincipalProperty("id"))
|
||||
.and("roleid", "in", Lang.array(Roles.UNION_MANGER)));
|
||||
List<String> unionIds = userRoles.stream().map(Sys_user_role::getUnionid).collect(Collectors.toList());
|
||||
sqlExpressionGroup.or("u.unionid", "in", unionIds);
|
||||
return sqlExpressionGroup;
|
||||
}
|
||||
},
|
||||
CLUB(CustomAuditTypeEnum.CLUB.getValue()) {
|
||||
@Override
|
||||
public SqlExpressionGroup next(SqlExpressionGroup sqlExpressionGroup) {
|
||||
//查询当前登录用户管理的协会
|
||||
List<Sys_user_role> userRoles = dao.query(Sys_user_role.class, Cnd.where("userid", "=", ShiroUtil.getPrincipalProperty("id"))
|
||||
.and("roleid", "in", Lang.array(Roles.CLUB_FZR)));
|
||||
List<String> clubIds = userRoles.stream().map(Sys_user_role::getStid).collect(Collectors.toList());
|
||||
List<Sys_club_user> clubUsers = dao.query(Sys_club_user.class, Cnd.where("stid", "in", clubIds));
|
||||
if (Lang.isNotEmpty(clubUsers)) {
|
||||
sqlExpressionGroup.or("u.id", "in", clubUsers.stream().map(v -> v.getUserid()).collect(Collectors.toList()));
|
||||
}
|
||||
return sqlExpressionGroup;
|
||||
}
|
||||
},
|
||||
TZ(CustomAuditTypeEnum.TZ.getValue()) {
|
||||
@Override
|
||||
public SqlExpressionGroup next(SqlExpressionGroup sqlExpressionGroup) {
|
||||
String dbtId = vi.getLastDelegationId((String) ShiroUtil.getPrincipalProperty("id"));
|
||||
sqlExpressionGroup.or("u.id", "in", Sqls.createf("select DISTINCT dbid from jdh_db where dbtid = '%s'", dbtId));
|
||||
return sqlExpressionGroup;
|
||||
}
|
||||
};
|
||||
|
||||
private final String name;
|
||||
|
||||
public Dao dao = ViResource.ioc.getByType(Dao.class);
|
||||
public Vi vi = ViResource.ioc.getByType(Vi.class);
|
||||
|
||||
CustomAuditTypeHandle(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public abstract SqlExpressionGroup next(SqlExpressionGroup sqlExpressionGroup);
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package io.v.nutz.meeting.models;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Table
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class MeetingInfo {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String meetingName;
|
||||
|
||||
@Column
|
||||
@Comment("地点")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String location;
|
||||
|
||||
@Column
|
||||
@Comment("会议类型")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer typeId;
|
||||
|
||||
@Column
|
||||
@Comment("开始时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
private Date startTime;
|
||||
|
||||
@Column
|
||||
@Comment("结束时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
private Date endTime;
|
||||
|
||||
@Column
|
||||
@Comment("是否可以请假")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isCanLeave;
|
||||
|
||||
@Column
|
||||
@Comment("是否多次签到")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean manySign;
|
||||
|
||||
@Column
|
||||
@Comment("请假截至时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
private Date leaveDeadline;
|
||||
|
||||
@Column
|
||||
@Comment("会议描述")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 2000)
|
||||
private String meetingDescription;
|
||||
|
||||
@Column
|
||||
@Comment("关联会议id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String notifyId;
|
||||
|
||||
/**
|
||||
* 会议时间段
|
||||
*/
|
||||
@Many(field = "meetingId")
|
||||
private List<MeetingTimePeriod> meetingTimePeriods;
|
||||
|
||||
/**
|
||||
* 会议参加人员
|
||||
*/
|
||||
@Many(field = "meetingId")
|
||||
private List<MeetingUser> meetingUserList;
|
||||
|
||||
/**
|
||||
* 消息对象
|
||||
*/
|
||||
// @One(field = "")
|
||||
// private MsgNotify msgNotify;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package io.v.nutz.meeting.models;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 会议时间段
|
||||
*/
|
||||
@Table
|
||||
@Data
|
||||
@TableIndexes({
|
||||
@Index(name = "INDEX_MEETINGTIMEPERIOD_MEETING_ID", fields = {"meetingId"}, unique = false),})
|
||||
public class MeetingTimePeriod {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("会议id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String meetingId;
|
||||
|
||||
@Column
|
||||
@Comment("时间段会议名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String timePeriodName;
|
||||
|
||||
@Column
|
||||
@Comment("开始时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
private Date startTime;
|
||||
|
||||
@Column
|
||||
@Comment("结束时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
private Date endTime;
|
||||
|
||||
@Many(field = "meetingTimePeriodId")
|
||||
private List<MeetingTimePeriodUser> meetingTimePeriodUserList;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package io.v.nutz.meeting.models;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Table
|
||||
@Data
|
||||
@TableIndexes({
|
||||
@Index(name = "INDEX_MEETINGTIMEPERIODUSER_MEETING_TIME_PERIOD_ID", fields = {"meetingTimePeriodId"}, unique = false),
|
||||
@Index(name = "INDEX_MEETINGTIMEPERIODUSER_MEETING_ID", fields = {"meetingId"}, unique = false)})
|
||||
public class MeetingTimePeriodUser {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("会议id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String meetingId;
|
||||
|
||||
@Column
|
||||
@Comment("会议时间段id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String meetingTimePeriodId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("用户id")
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Comment("是否参加")
|
||||
private Boolean isJoin;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
@Comment("请假理由")
|
||||
private String leaveReason;
|
||||
|
||||
@Column
|
||||
@Comment("用户请假开始时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
private Date userLeaveStartTime;
|
||||
|
||||
@Column
|
||||
@Comment("用户请假结束时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
private Date userLeaveEndTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Comment("请假当前状态")
|
||||
private Integer stateCode;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Comment("是否签到")
|
||||
private Boolean isSignIn;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@Comment("签到时间")
|
||||
private Date signInDateTime;
|
||||
|
||||
/**
|
||||
* 审核记录
|
||||
*/
|
||||
@Column
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
@Comment("审核记录ID")
|
||||
private List<NutMap> auditIdList;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package io.v.nutz.meeting.models;
|
||||
|
||||
import io.v.nutz.modules.models.AuditState;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Table
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class MeetingType {
|
||||
|
||||
@Id
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer id;
|
||||
|
||||
@Column
|
||||
@Comment("名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String meetingTypeName;
|
||||
|
||||
@Column
|
||||
@Comment("模块名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String moduleName;
|
||||
|
||||
@Column
|
||||
@Comment("排序")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private int sortNum;
|
||||
|
||||
@Many(field = "meetingTypeId")
|
||||
private List<AuditState> auditStateList;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package io.v.nutz.meeting.models;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 参会人员表
|
||||
*/
|
||||
@Table
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class MeetingUser {
|
||||
|
||||
@Name
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("会议ID")
|
||||
private String meetingId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("用户id")
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Comment("是否参加")
|
||||
private Boolean isJoin;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
@Comment("请假理由")
|
||||
private String leaveReason;
|
||||
|
||||
@Column
|
||||
@Comment("用户请假开始时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
private Date userLeaveStartTime;
|
||||
|
||||
@Column
|
||||
@Comment("用户请假结束时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
private Date userLeaveEndTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Comment("请假当前状态")
|
||||
private Integer stateCode;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Comment("是否签到")
|
||||
private Boolean isSignIn;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@Comment("签到时间")
|
||||
private Date signInDateTime;
|
||||
|
||||
/**
|
||||
* 审核记录
|
||||
*/
|
||||
@Column
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
@Comment("审核记录ID")
|
||||
private List<NutMap> auditIdList;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package io.v.nutz.meeting.service;
|
||||
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.modules.models.Audit;
|
||||
import io.v.nutz.service.ViService;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 会议审核接口
|
||||
*/
|
||||
public interface MeetingAuditService extends ViService {
|
||||
|
||||
/**
|
||||
* 会议审核分页数据
|
||||
*
|
||||
* @param pageNumber
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
Pagination myMeetingPageData(int pageNumber, int pageSize, String keySearchWord, String typeId, Integer meetingTime);
|
||||
|
||||
/**
|
||||
* 查询会议提交了请假的人员
|
||||
*
|
||||
* @param meetingId 会议id
|
||||
*/
|
||||
List<NutMap> getLeaveUser(String meetingId, String moduleName, String auditType);
|
||||
|
||||
|
||||
/**
|
||||
* 会议审核
|
||||
*
|
||||
* @param tpuIds 记录id
|
||||
* @param audit 审核对象
|
||||
* @param isPass isPass
|
||||
*/
|
||||
void audit(String[] tpuIds, Audit audit, boolean isPass);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package io.v.nutz.meeting.service;
|
||||
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 会议基本统计service
|
||||
*/
|
||||
public interface MeetingBasicStatisticsService {
|
||||
|
||||
Pagination pageData(PageForm pageForm, String meetingId, String[] meetingTime, String typeId);
|
||||
|
||||
|
||||
/**
|
||||
* 根据时间段查询会议列表
|
||||
*
|
||||
* @param meetingTime
|
||||
* @return
|
||||
*/
|
||||
Object getMeetingList(String[] meetingTime);
|
||||
|
||||
Object getUserData(PageForm pageForm, String id, String meetingId, String type, String unitId, String unionId);
|
||||
|
||||
List<NutMap> getUserData(String id, String meetingId, String type);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package io.v.nutz.meeting.service;
|
||||
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 会议通用方法
|
||||
*/
|
||||
@IocBean
|
||||
public interface MeetingCommonService {
|
||||
|
||||
/**
|
||||
* 根据typeId查询所属模块名称
|
||||
*
|
||||
* @param typeId
|
||||
* @return
|
||||
*/
|
||||
String findModuleNameByTypeId(Integer typeId);
|
||||
|
||||
/**
|
||||
* 根据MeetId查询所属模块名称
|
||||
*
|
||||
* @param meetingId
|
||||
* @return
|
||||
*/
|
||||
String findModuleNameByMeetingId(String meetingId);
|
||||
|
||||
/**
|
||||
* 根据模块名称查找对应stateCode 最开始的那个
|
||||
*
|
||||
* @param moduleName
|
||||
* @return
|
||||
*/
|
||||
Integer findStartStateCodeByModuleName(String moduleName);
|
||||
|
||||
Integer findAfterStateCode(Integer stateCode, boolean isPass);
|
||||
|
||||
Integer findAfterStateCodeByModuleName(Integer stateCode, String moduleName);
|
||||
|
||||
/**
|
||||
* 根据会议id查询请假成功的code
|
||||
*
|
||||
* @param meetingId
|
||||
* @return
|
||||
*/
|
||||
Integer findSuccessStateCode(String meetingId);
|
||||
|
||||
/**
|
||||
* 获取当前用户关联哪些会议
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Object find();
|
||||
|
||||
/**
|
||||
* 查询当前登录用户能审核的状态Id
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<Integer> findStateIdForMeCanAudit();
|
||||
|
||||
List<NutMap> getNextAuditUser(Integer stateCode, String moduleName);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package io.v.nutz.meeting.service;
|
||||
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.meeting.models.MeetingInfo;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.service.ViService;
|
||||
import org.nutz.dao.Cnd;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 会议管理service
|
||||
*/
|
||||
public interface MeetingManageService extends ViService<MeetingInfo> {
|
||||
|
||||
/**
|
||||
* 模块名字
|
||||
*/
|
||||
String MODULE_NAME = "";
|
||||
|
||||
/**
|
||||
* 分页数据
|
||||
*
|
||||
* @param pageForm
|
||||
* @param cnd
|
||||
* @return
|
||||
*/
|
||||
Pagination pageData(PageForm pageForm, Cnd cnd);
|
||||
|
||||
/**
|
||||
* 添加会议及审核流程
|
||||
*
|
||||
* @param meetingInfo 会议信息
|
||||
*/
|
||||
void doAdd(MeetingInfo meetingInfo);
|
||||
|
||||
/**
|
||||
* 编辑会议及审核流程
|
||||
*
|
||||
* @param meetingInfo 会议信息
|
||||
*/
|
||||
void doEdit(MeetingInfo meetingInfo, List<String> userIds);
|
||||
|
||||
/**
|
||||
* 删除会议
|
||||
*
|
||||
* @param id 会议id
|
||||
*/
|
||||
void doDelete(String id);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package io.v.nutz.meeting.service;
|
||||
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.meeting.models.MeetingTimePeriodUser;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.service.ViService;
|
||||
import org.nutz.dao.Cnd;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 会议通用service
|
||||
*/
|
||||
public interface MeetingMineService extends ViService {
|
||||
|
||||
/**
|
||||
* 我的会议分页数据
|
||||
*
|
||||
* @param pageForm
|
||||
* @param cnd
|
||||
* @return
|
||||
*/
|
||||
Pagination myMeetingPageData(PageForm pageForm, Cnd cnd);
|
||||
|
||||
/**
|
||||
* 查询我的会议时间段
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<Object> findMyMeetPeriod(String meetingId);
|
||||
|
||||
/**
|
||||
* 请假
|
||||
*
|
||||
* @param meetingId 会议id
|
||||
* @param tpuIds tpuId 不解释
|
||||
* @param leaveReason 请假理由
|
||||
*/
|
||||
void askForLeave(List<MeetingTimePeriodUser> meetingTimePeriodUsers);
|
||||
|
||||
/**
|
||||
* 参加会议确认
|
||||
*
|
||||
* @param tpuIds
|
||||
*/
|
||||
void confirmMeeting(List<String> tpuIds);
|
||||
|
||||
/**
|
||||
* 签到
|
||||
*
|
||||
* @param timePeriodUser
|
||||
*/
|
||||
void signIn(MeetingTimePeriodUser timePeriodUser);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package io.v.nutz.meeting.service;
|
||||
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.service.ViService;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface MeetingOnlineService extends ViService {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param pageForm
|
||||
* @param cnd
|
||||
* @return
|
||||
*/
|
||||
Pagination pageData(PageForm pageForm, Cnd cnd);
|
||||
|
||||
/**
|
||||
* 导出签字表
|
||||
*
|
||||
* @param timePeriodId 时间段id
|
||||
* @return
|
||||
*/
|
||||
List<NutMap> exportSignature(String timePeriodId);
|
||||
|
||||
/**
|
||||
* 在线数据
|
||||
*
|
||||
* @param timePeriodId
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> getRealTimeData(String timePeriodId);
|
||||
|
||||
/**
|
||||
* 获取签到人员
|
||||
*
|
||||
* @param timePeriodId
|
||||
* @return
|
||||
*/
|
||||
List<NutMap> getSignInUser(String timePeriodId);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package io.v.nutz.meeting.service;
|
||||
|
||||
import io.v.nutz.meeting.models.MeetingType;
|
||||
import io.v.nutz.service.ViService;
|
||||
|
||||
/**
|
||||
* 会议类型 流程 service
|
||||
*/
|
||||
public interface MeetingTypeService extends ViService<MeetingType> {
|
||||
|
||||
/**
|
||||
* 找出最大的那行stateId
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int findMaxStateId();
|
||||
|
||||
void add(MeetingType meetingType);
|
||||
|
||||
void edit(MeetingType meetingType);
|
||||
|
||||
void delete(MeetingType meetingTyp);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,238 @@
|
||||
package io.v.nutz.meeting.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.constant.AuditTypeEnum;
|
||||
import io.v.nutz.lang.Enum;
|
||||
import io.v.nutz.meeting.models.CustomAuditTypeHandle;
|
||||
import io.v.nutz.meeting.models.MeetingTimePeriodUser;
|
||||
import io.v.nutz.meeting.service.MeetingAuditService;
|
||||
import io.v.nutz.meeting.service.MeetingCommonService;
|
||||
import io.v.nutz.modules.models.Audit;
|
||||
import io.v.nutz.modules.models.AuditState;
|
||||
import io.v.nutz.service.impl.ViServiceImpl;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
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;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class MeetingAuditServiceImpl extends ViServiceImpl implements MeetingAuditService {
|
||||
|
||||
@Inject
|
||||
private MeetingCommonService meetingCommonService;
|
||||
@Inject
|
||||
private Vi vi;
|
||||
|
||||
public MeetingAuditServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination myMeetingPageData(int pageNumber, int pageSize, String keySearchWord, String typeId, Integer meetingTime) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
type.meetingTypeName,
|
||||
type.moduleName,
|
||||
(select count(*) from meeting_time_period_user where meetingId=info.id and JSON_CONTAINS(auditIdList, JSON_OBJECT('auditUser', @userid))) as audit
|
||||
FROM
|
||||
meeting_info info
|
||||
LEFT JOIN meeting_type type ON type.id = info.typeId
|
||||
LEFT JOIN audit_state state ON state.module = type.moduleName
|
||||
$condition
|
||||
""").setParam("userid", ShiroUtil.getPrincipalProperty("id"));
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("info.isCanLeave", "=", 1);
|
||||
List<Integer> stateIdForMeCanAudit = meetingCommonService.findStateIdForMeCanAudit();
|
||||
cnd.and("state.stateId", "in", stateIdForMeCanAudit);
|
||||
if (StringUtils.isNotBlank(keySearchWord)) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("mi.meetingName", keySearchWord);
|
||||
seg.orLike("mi.location", keySearchWord);
|
||||
cnd.and(seg);
|
||||
}
|
||||
if (StrUtil.isNotBlank(typeId)) {
|
||||
cnd.andEX("info.typeId", "=", typeId);
|
||||
}
|
||||
if (meetingTime != null) {
|
||||
if (meetingTime == 0) {
|
||||
cnd.andEX("info.startTime", ">=", DateUtil.getDateTime());
|
||||
} else {
|
||||
cnd.andEX("info.startTime", "<", DateUtil.getDateTime());
|
||||
}
|
||||
}
|
||||
cnd.groupBy("info.id");
|
||||
cnd.desc("startTime");
|
||||
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = listPage(pageNumber, pageSize, sql);
|
||||
List<Object> list = pagination.getList();
|
||||
list.forEach(item -> {
|
||||
Record map = (Record) item;
|
||||
List<NutMap> canAuditUserByLoginUser = this.getCanAuditUserByLoginUser(map.getString("id"), stateIdForMeCanAudit);
|
||||
map.put("no_audit", canAuditUserByLoginUser.size());
|
||||
});
|
||||
return pagination;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NutMap> getLeaveUser(String meetingId, String moduleName, String auditType) {
|
||||
Sql sqlMeeting = Sqls.create("""
|
||||
select
|
||||
id,
|
||||
startTime,
|
||||
endTime,
|
||||
timePeriodName
|
||||
from
|
||||
meeting_time_period
|
||||
$condition
|
||||
""");
|
||||
Cnd cndMeeting = Cnd.NEW();
|
||||
cndMeeting.and("meetingId", "=", meetingId);
|
||||
sqlMeeting.setCondition(cndMeeting);
|
||||
List<NutMap> meetingList = listMap(sqlMeeting);
|
||||
|
||||
List<NutMap> list = "canAudit".equals(auditType) ? this.getCanAuditUserByLoginUser(meetingId, meetingCommonService.findStateIdForMeCanAudit()) : this.getHasAuditUserByLoginUser(meetingId);
|
||||
|
||||
//将list分组
|
||||
LinkedHashMap<String, List<NutMap>> map = new LinkedHashMap<>();
|
||||
list.forEach(item -> {
|
||||
String meetingTimePeriodId = item.getString("meetingTimePeriodId");
|
||||
if (map.containsKey(meetingTimePeriodId)) {
|
||||
map.get(meetingTimePeriodId).add(item);
|
||||
} else {
|
||||
List<NutMap> listMap = new ArrayList<>();
|
||||
listMap.add(item);
|
||||
map.put(meetingTimePeriodId, listMap);
|
||||
}
|
||||
});
|
||||
|
||||
//汇总数据
|
||||
meetingList.forEach(item -> {
|
||||
String id = item.getString("id");
|
||||
item.put("users", map.get(id));
|
||||
});
|
||||
return meetingList;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void audit(String[] tpuIds, Audit audit, boolean isPass) {
|
||||
dao().insert(audit);
|
||||
for (String tp_id : tpuIds) {
|
||||
MeetingTimePeriodUser periodUser = dao().fetch(MeetingTimePeriodUser.class, tp_id);
|
||||
Integer stateCode = periodUser.getStateCode();
|
||||
|
||||
Integer afterStateCode = meetingCommonService.findAfterStateCode(stateCode, isPass);
|
||||
periodUser.setStateCode(afterStateCode);
|
||||
|
||||
List<NutMap> auditIdList = periodUser.getAuditIdList();
|
||||
if (Lang.isEmpty(auditIdList)) {
|
||||
auditIdList = new ArrayList<>();
|
||||
}
|
||||
auditIdList.add(NutMap.NEW().addv("stateCode", stateCode).addv("auditId", audit.getId()).addv("auditUser", ShiroUtil.getPrincipalProperty("id")).addv("auditState", isPass));
|
||||
periodUser.setAuditIdList(auditIdList);
|
||||
|
||||
if (!isPass) {
|
||||
periodUser.setIsJoin(null);
|
||||
periodUser.setLeaveReason(null);
|
||||
}
|
||||
dao().update(periodUser);
|
||||
}
|
||||
}
|
||||
|
||||
/*根据当前登录用户获取可以审核的用户*/
|
||||
public List<NutMap> getCanAuditUserByLoginUser(String meetingId, List<Integer> stateIdForMeCanAudit) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
mu.*,
|
||||
u.username,
|
||||
u.loginname,
|
||||
u.sex,
|
||||
u.unionid,
|
||||
u.unitid,
|
||||
u.unitname,
|
||||
state.auditAfterType
|
||||
FROM
|
||||
meeting_time_period_user mu
|
||||
left join `user` u on mu.userId=u.id
|
||||
LEFT JOIN audit_state state on state.stateId = mu.stateCode
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("mu.meetingId", "=", meetingId);
|
||||
cnd.and("u.username", "is not", null);
|
||||
cnd.and("u.username", "!=", "");
|
||||
cnd.and("mu.stateCode", "in", Sqls.createf("SELECT stateId FROM audit_state_user WHERE userid = '%s'", ShiroUtil.getPrincipalProperty("id")));
|
||||
cnd.and("state.stateAuditType", "in", Lang.list(AuditTypeEnum.AUDIT.getValue()));
|
||||
|
||||
List<AuditState> audit = dao().query(AuditState.class, Cnd.where("stateId", "in", stateIdForMeCanAudit));
|
||||
SqlExpressionGroup sqlExpressionGroup = new SqlExpressionGroup();
|
||||
audit.forEach(v -> {
|
||||
if (StrUtil.isNotBlank(v.getAuditAfterType())) {
|
||||
CustomAuditTypeHandle instance = Enum.instance(CustomAuditTypeHandle.class, v.getAuditAfterType());
|
||||
if(instance != null) {
|
||||
instance.next(sqlExpressionGroup);
|
||||
}
|
||||
}
|
||||
});
|
||||
if (!sqlExpressionGroup.isEmpty()) {
|
||||
cnd.and(sqlExpressionGroup);
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return listMap(sql);
|
||||
}
|
||||
|
||||
/*根据当前登录用户获取已经审核的用户*/
|
||||
public List<NutMap> getHasAuditUserByLoginUser(String meetingId) {
|
||||
Sql sql = Sqls.create("""
|
||||
select
|
||||
mu.*,
|
||||
u.username,
|
||||
u.loginname,
|
||||
u.unitname
|
||||
from
|
||||
meeting_time_period_user mu
|
||||
left join
|
||||
`user` u on mu.userid=u.id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("meetingId", "=", meetingId);
|
||||
cnd.and(new Static("JSON_CONTAINS(auditIdList, JSON_OBJECT('auditUser', '" + ShiroUtil.getPrincipalProperty("id") + "'))"));
|
||||
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = listMap(sql);
|
||||
list.forEach(item -> {
|
||||
List<NutMap> listMap = Json.fromJsonAsList(NutMap.class, item.getString("auditIdList"));
|
||||
Boolean auditState = false;
|
||||
for (NutMap map : listMap) {
|
||||
if (map.getString("auditUser").equals(ShiroUtil.getPrincipalProperty("id"))) {
|
||||
auditState = map.get("auditState") == null ? null : map.getBoolean("auditState");
|
||||
break;
|
||||
}
|
||||
}
|
||||
item.put("auditState", auditState);
|
||||
});
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,265 @@
|
||||
package io.v.nutz.meeting.service.impl;
|
||||
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.base.utils.Roles;
|
||||
import io.v.nutz.jdh.model.cb.Jdh_jdhxx;
|
||||
import io.v.nutz.meeting.models.MeetingInfo;
|
||||
import io.v.nutz.meeting.models.MeetingType;
|
||||
import io.v.nutz.meeting.service.MeetingBasicStatisticsService;
|
||||
import io.v.nutz.meeting.service.MeetingCommonService;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.service.impl.ViServiceImpl;
|
||||
import io.v.nutz.workersCongress.model.WorkersCongressSession;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class MeetingBasicStatisticsServiceImpl extends ViServiceImpl implements MeetingBasicStatisticsService {
|
||||
|
||||
@Inject
|
||||
private MeetingCommonService meetingCommonService;
|
||||
|
||||
|
||||
public MeetingBasicStatisticsServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination pageData(PageForm pageForm, String meetingId, String[] meetingTime, String typeId) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.* ,
|
||||
type.moduleName,
|
||||
type.meetingTypeName
|
||||
FROM
|
||||
meeting_info info
|
||||
LEFT JOIN meeting_type type ON type.id = info.typeId
|
||||
$condition
|
||||
""");
|
||||
if (meetingTime != null && meetingTime.length == 2) {
|
||||
cnd.and("info.startTime", ">=", meetingTime[0]);
|
||||
cnd.and("info.startTime", "<=", meetingTime[1]);
|
||||
}
|
||||
cnd.andEX("info.id", "=", meetingId);
|
||||
cnd.andEX("type.id", "=", typeId);
|
||||
cnd.desc("startTime");
|
||||
sql.setCondition(cnd);
|
||||
Pagination list = list(pageForm, sql);
|
||||
List<NutMap> listList = list.getList();
|
||||
//获取教代会最新届次
|
||||
Jdh_jdhxx jdh = dao().fetch(Jdh_jdhxx.class, Cnd.where("jdhkqzt", "=", 1).desc("jdhkqsj"));
|
||||
//获取教代会最新届次
|
||||
WorkersCongressSession gdh = dao().fetch(WorkersCongressSession.class, Cnd.where("startState", "=", 1).desc("startTime"));
|
||||
|
||||
listList.forEach(v -> {
|
||||
MeetingType meetingType = dao().fetch(MeetingType.class, v.getInt("typeId"));
|
||||
String successStateCode = meetingCommonService.findSuccessStateCode(v.getString("id")).toString();
|
||||
if ("teacherMeeting".equals(meetingType.getModuleName())) {
|
||||
Cnd cndChild = Cnd.NEW();
|
||||
Sql sqlChild = Sqls.create("""
|
||||
SELECT
|
||||
mtp.*,
|
||||
info.meetingName,
|
||||
type.meetingTypeName,
|
||||
count( mtpu.id ) AS total,
|
||||
sum( CASE WHEN mtpu.isJoin IS null OR (mtpu.isJoin is NOT null AND mtpu.stateCode != @successStateCode) THEN 1 ELSE 0 END ) AS joinNum,
|
||||
sum( CASE WHEN mtpu.isJoin = 0 AND mtpu.stateCode = @successStateCode THEN 1 ELSE 0 END ) AS notJoinNum,
|
||||
sum( CASE WHEN mtpu.isSignIn = 1 THEN 1 ELSE 0 END ) AS signJoinNum,
|
||||
sum( CASE WHEN (mtpu.isJoin IS null AND mtpu.isSignIn is null) OR (mtpu.isJoin is NOT null AND mtpu.stateCode !=@successStateCode AND mtpu.isSignIn is null) THEN 1 ELSE 0 END ) AS notJoinNullNum,
|
||||
sum( CASE WHEN (mtpu.isSignIn = 1) AND (d.roleid = @zsdb) AND d.jdhid = @jdhId THEN 1 ELSE 0 END) as zsdbNum,
|
||||
sum( CASE WHEN (mtpu.isSignIn = 1) AND (d.roleid = @lxdb) AND d.jdhid = @jdhId THEN 1 ELSE 0 END) as lxdbNum
|
||||
FROM
|
||||
meeting_time_period mtp
|
||||
LEFT JOIN meeting_info info ON mtp.meetingId = info.id
|
||||
LEFT JOIN meeting_type type ON type.id = info.typeId
|
||||
LEFT JOIN meeting_time_period_user mtpu ON mtpu.meetingTimePeriodId = mtp.id
|
||||
LEFT JOIN jdh_db d on d.dbid = mtpu.userId and jdhid=@jdhId
|
||||
$condition
|
||||
""").setParam("successStateCode", successStateCode)
|
||||
.setParam("zsdb", Roles.ZSDB)
|
||||
.setParam("lxdb", Roles.LXDB)
|
||||
.setParam("jdhId", jdh.getId());
|
||||
cndChild.and("mtp.meetingId", "=", v.getString("id"));
|
||||
cndChild.desc("mtp.startTime");
|
||||
cndChild.groupBy("mtp.id");
|
||||
sqlChild.setCondition(cndChild);
|
||||
List<NutMap> childList = listMap(sqlChild);
|
||||
v.put("meetingTimeData", childList);
|
||||
|
||||
}else if ("gdh".equals(meetingType.getModuleName())) {
|
||||
Cnd cndChild = Cnd.NEW();
|
||||
Sql sqlChild = Sqls.create("""
|
||||
SELECT
|
||||
mtp.*,
|
||||
info.meetingName,
|
||||
type.meetingTypeName,
|
||||
count( mtpu.id ) AS total,
|
||||
sum( CASE WHEN mtpu.isJoin IS null OR (mtpu.isJoin is NOT null AND mtpu.stateCode != @successStateCode) THEN 1 ELSE 0 END ) AS joinNum,
|
||||
sum( CASE WHEN mtpu.isJoin = 0 AND mtpu.stateCode = @successStateCode THEN 1 ELSE 0 END ) AS notJoinNum,
|
||||
sum( CASE WHEN mtpu.isSignIn = 1 THEN 1 ELSE 0 END ) AS signJoinNum,
|
||||
sum( CASE WHEN (mtpu.isJoin IS null AND mtpu.isSignIn is null) OR (mtpu.isJoin is NOT null AND mtpu.stateCode !=@successStateCode AND mtpu.isSignIn is null) THEN 1 ELSE 0 END ) AS notJoinNullNum,
|
||||
sum( CASE WHEN (mtpu.isSignIn = 1) AND (d.roleId = @zsdb) AND d.gdh_id = @gdhId THEN 1 ELSE 0 END) as zsdbNum,
|
||||
sum( CASE WHEN (mtpu.isSignIn = 1) AND (d.roleId = @lxdb) AND d.gdh_id = @gdhId THEN 1 ELSE 0 END) as lxdbNum
|
||||
FROM
|
||||
meeting_time_period mtp
|
||||
LEFT JOIN meeting_info info ON mtp.meetingId = info.id
|
||||
LEFT JOIN meeting_type type ON type.id = info.typeId
|
||||
LEFT JOIN meeting_time_period_user mtpu ON mtpu.meetingTimePeriodId = mtp.id
|
||||
LEFT JOIN workers_congress_representative d on d.userId = mtpu.userId and gdh_id=@gdhId
|
||||
$condition
|
||||
""").setParam("successStateCode", successStateCode)
|
||||
.setParam("zsdb", Roles.GDHDB)
|
||||
.setParam("lxdb", Roles.GDHLX)
|
||||
.setParam("gdhId", gdh.getId());
|
||||
cndChild.and("mtp.meetingId", "=", v.getString("id"));
|
||||
cndChild.desc("mtp.startTime");
|
||||
cndChild.groupBy("mtp.id");
|
||||
sqlChild.setCondition(cndChild);
|
||||
List<NutMap> childList = listMap(sqlChild);
|
||||
v.put("meetingTimeData", childList);
|
||||
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getMeetingList(String[] meetingTime) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (meetingTime != null && meetingTime.length == 2) {
|
||||
cnd.and("startTime", ">=", meetingTime[0]);
|
||||
cnd.and("startTime", "<=", meetingTime[1]);
|
||||
|
||||
}
|
||||
cnd.desc("startTime");
|
||||
return dao().query(MeetingInfo.class, cnd);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getUserData(PageForm pageForm, String id, String meetingId, String type, String unitId, String unionId) {
|
||||
String successStateCode = meetingCommonService.findSuccessStateCode(meetingId).toString();
|
||||
MeetingInfo meetingInfo = dao().fetch(MeetingInfo.class, meetingId);
|
||||
MeetingType meetingType = dao().fetch(MeetingType.class, meetingInfo.getTypeId());
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
mtp.*,
|
||||
u.loginname AS loginName,
|
||||
u.username AS userName,
|
||||
u.unitname AS unitName,
|
||||
u.unionname AS unionName
|
||||
FROM
|
||||
meeting_time_period_user mtp
|
||||
LEFT JOIN `user` u ON mtp.userId = u.id
|
||||
$condition
|
||||
""");
|
||||
if (type.equals("notJoinNum")) {
|
||||
cnd.and("mtp.isJoin", "=", 0);
|
||||
} else if (type.equals("signJoinNum")) {
|
||||
cnd.and("mtp.isSignIn", "=", 1);
|
||||
} else if (type.equals("notJoinNullNum")) {
|
||||
cnd.and(new Static("(mtp.isJoin IS null AND mtp.isSignIn is null AND mtp.meetingTimePeriodId = '%s') OR (mtp.isJoin is NOT null AND mtp.stateCode !='%s' AND mtp.isSignIn is null AND mtp.meetingTimePeriodId = '%s')".formatted(id, successStateCode, id)));
|
||||
}
|
||||
if ("teacherMeeting".equals(meetingType.getModuleName())) {
|
||||
//获取教代会最新届次
|
||||
Jdh_jdhxx jdh = dao().fetch(Jdh_jdhxx.class, Cnd.where("jdhkqzt", "=", 1).desc("jdhkqsj"));
|
||||
if (type.equals("zsdbNum")) {
|
||||
cnd.and("mtp.isSignIn", "=", 1);
|
||||
cnd.and(new Static(" mtp.userId in (select dbid from jdh_db where jdhid='%s' and roleid='%s')".formatted(jdh.getId(), Roles.ZSDB)));
|
||||
} else if (type.equals("lxdbNum")) {
|
||||
cnd.and("mtp.isSignIn", "=", 1);
|
||||
cnd.and(new Static(" mtp.userId in (select dbid from jdh_db where jdhid='%s' and roleid='%s')".formatted(jdh.getId(), Roles.LXDB)));
|
||||
}
|
||||
} else if ("gdh".equals(meetingType.getModuleName())) {
|
||||
//获取教代会最新届次
|
||||
WorkersCongressSession jdh = dao().fetch(WorkersCongressSession.class, Cnd.where("startState", "=", 1).desc("startTime"));
|
||||
if (type.equals("zsdbNum")) {
|
||||
cnd.and("mtp.isSignIn", "=", 1);
|
||||
cnd.and(new Static(" mtp.userId in (select userId from workers_congress_representative where gdh_id='%s' and roleId='%s')".formatted(jdh.getId(), Roles.GDHDB)));
|
||||
} else if (type.equals("lxdbNum")) {
|
||||
cnd.and("mtp.isSignIn", "=", 1);
|
||||
cnd.and(new Static(" mtp.userId in (select userId from workers_congress_representative where gdh_id='%s' and roleId='%s')".formatted(jdh.getId(), Roles.GDHLX)));
|
||||
}
|
||||
}
|
||||
|
||||
cnd.andEX("u.unitid", "=", unitId);
|
||||
cnd.andEX("u.unionid", "=", unionId);
|
||||
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.where().andLike(pageForm.getSearchName(), pageForm.getSearchKeyword());
|
||||
}
|
||||
cnd.and("mtp.meetingTimePeriodId", "=", id);
|
||||
cnd.desc("u.unitid");
|
||||
sql.setCondition(cnd);
|
||||
|
||||
return list(pageForm, sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NutMap> getUserData(String id, String meetingId, String type) {
|
||||
String successStateCode = meetingCommonService.findSuccessStateCode(meetingId).toString();
|
||||
MeetingInfo meetingInfo = dao().fetch(MeetingInfo.class, meetingId);
|
||||
MeetingType meetingType = dao().fetch(MeetingType.class, meetingInfo.getTypeId());
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
mtp.*,
|
||||
u.loginname AS loginName,
|
||||
u.username AS userName,
|
||||
u.unitname AS unitName,
|
||||
u.unionname AS unionName
|
||||
FROM
|
||||
meeting_time_period_user mtp
|
||||
LEFT JOIN `user` u ON mtp.userId = u.id
|
||||
$condition
|
||||
""");
|
||||
cnd.and("mtp.meetingTimePeriodId", "=", id);
|
||||
if (type.equals("请假人数")) {
|
||||
cnd.and("mtp.isJoin", "=", 0).and("mtp.stateCode", "=", successStateCode);
|
||||
} else if (type.equals("实到人数")) {
|
||||
cnd.and("mtp.isSignIn", "=", 1);
|
||||
} else if (type.equals("未到人数")) {
|
||||
cnd.and(new Static("(mtp.isJoin IS null AND mtp.isSignIn is null and mtp.meetingTimePeriodId ='%s') OR (mtp.isJoin is NOT null AND mtp.stateCode !='%s' AND mtp.isSignIn is null and mtp.meetingTimePeriodId ='%s')".formatted(id, successStateCode, id)));
|
||||
}
|
||||
if ("teacherMeeting".equals(meetingType.getModuleName())) {
|
||||
//获取教代会最新届次
|
||||
Jdh_jdhxx jdh = dao().fetch(Jdh_jdhxx.class, Cnd.where("jdhkqzt", "=", 1).desc("jdhkqsj"));
|
||||
if (type.equals("正式代表")) {
|
||||
cnd.and("mtp.isSignIn", "=", 1);
|
||||
cnd.and(new Static(" mtp.userId in (select dbid from jdh_db where jdhid='%s' and roleid='%s')".formatted(jdh.getId(), Roles.ZSDB)));
|
||||
} else if (type.equals("列席代表")) {
|
||||
cnd.and("mtp.isSignIn", "=", 1);
|
||||
cnd.and(new Static(" mtp.userId in (select dbid from jdh_db where jdhid='%s' and roleid='%s')".formatted(jdh.getId(), Roles.LXDB)));
|
||||
}
|
||||
} else if ("gdh".equals(meetingType.getModuleName())) {
|
||||
//获取教代会最新届次
|
||||
WorkersCongressSession jdh = dao().fetch(WorkersCongressSession.class, Cnd.where("startState", "=", 1).desc("startTime"));
|
||||
if (type.equals("正式代表")) {
|
||||
cnd.and("mtp.isSignIn", "=", 1);
|
||||
cnd.and(new Static(" mtp.userId in (select userId from workers_congress_representative where gdh_id='%s' and roleId='%s')".formatted(jdh.getId(), Roles.GDHDB)));
|
||||
} else if (type.equals("列席代表")) {
|
||||
cnd.and("mtp.isSignIn", "=", 1);
|
||||
cnd.and(new Static(" mtp.userId in (select userId from workers_congress_representative where gdh_id='%s' and roleId='%s')".formatted(jdh.getId(), Roles.GDHLX)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sql.setCondition(cnd);
|
||||
return listMap(sql);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
package io.v.nutz.meeting.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.base.utils.Roles;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.constant.AuditTypeEnum;
|
||||
import io.v.nutz.meeting.models.MeetingInfo;
|
||||
import io.v.nutz.meeting.models.MeetingType;
|
||||
import io.v.nutz.meeting.service.MeetingCommonService;
|
||||
import io.v.nutz.modules.models.AuditState;
|
||||
import io.v.nutz.service.impl.ViServiceImpl;
|
||||
import io.v.nutz.util.ShiroUtil;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
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.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class MeetingCommonServiceImpl extends ViServiceImpl implements MeetingCommonService {
|
||||
|
||||
@Inject
|
||||
private Vi vi;
|
||||
|
||||
public MeetingCommonServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String findModuleNameByTypeId(Integer typeId) {
|
||||
MeetingType meetingType = dao().fetch(MeetingType.class, Cnd.where("id", "=", typeId));
|
||||
if (Lang.isNotEmpty(meetingType)) {
|
||||
return meetingType.getModuleName();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String findModuleNameByMeetingId(String meetingId) {
|
||||
MeetingInfo meetingInfo = dao().fetch(MeetingInfo.class, meetingId);
|
||||
if (Lang.isNotEmpty(meetingInfo) && null != meetingInfo.getTypeId()) {
|
||||
return findModuleNameByTypeId(meetingInfo.getTypeId());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer findStartStateCodeByModuleName(String moduleName) {
|
||||
List<AuditState> auditStateList = dao().query(AuditState.class, Cnd.where("module", "=", moduleName).asc("stateId"));
|
||||
Optional<Integer> minOptional = auditStateList.stream().map(v -> v.getStateId()).min(Comparator.comparingInt(a -> a)).stream().findFirst();
|
||||
return minOptional.orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer findAfterStateCode(Integer stateCode, boolean isPass) {
|
||||
AuditState auditState = dao().fetch(AuditState.class, stateCode);
|
||||
return isPass ? auditState.getAfterPassStateId() : auditState.getAfterRejectStateId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer findSuccessStateCode(String meetingId) {
|
||||
String moduleName = findModuleNameByMeetingId(meetingId);
|
||||
Cnd cnd = Cnd.where("module", "=", moduleName).and("stateAuditType", "=", AuditTypeEnum.PROCESS_PASS.getValue());
|
||||
AuditState auditState = dao().fetch(AuditState.class, cnd);
|
||||
return auditState.getStateId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer findAfterStateCodeByModuleName(Integer stateCode, String moduleName) {
|
||||
AuditState auditState = dao().fetch(AuditState.class, Cnd.where("stateId", "=", stateCode));
|
||||
if (Lang.isNotEmpty(auditState)) {
|
||||
return auditState.getAfterStateId();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object find() {
|
||||
List<MeetingType> typeList = dao().query(MeetingType.class, null);
|
||||
List<String> typeModuleNameList = typeList.stream().map(MeetingType::getModuleName).collect(Collectors.toList());
|
||||
|
||||
List<AuditState> auditStateList = dao().query(AuditState.class, Cnd.where("module", "in", typeModuleNameList));
|
||||
|
||||
for (AuditState state : auditStateList) {
|
||||
dao().fetchLinks(state, "auditStateUserList");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Integer> findStateIdForMeCanAudit() {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("stateId", "in", Sqls.create("select stateId from audit_state_user where userId = @userid").setParam("userid", ShiroUtil.getPrincipalProperty("id")));
|
||||
List<AuditState> auditStateList = dao().query(AuditState.class, cnd);
|
||||
return auditStateList.stream().map(v -> v.getStateId()).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/*根据状态码获取下一节点审核人*/
|
||||
@Override
|
||||
public List<NutMap> getNextAuditUser(Integer stateCode, String moduleName) {
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
select
|
||||
au.userId as userId,
|
||||
u.username as userName,
|
||||
u.loginname as loginName,
|
||||
u.unitname as unitName,
|
||||
u.mobile as mobile
|
||||
from
|
||||
audit_state_user au
|
||||
left join
|
||||
`user` u on au.userid = u.id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
cnd.and("stateId", "=", stateCode);
|
||||
|
||||
if (StrUtil.isNotBlank(moduleName) && "teacherMeeting".equals(moduleName) && stateCode == 4910) {
|
||||
String jdhid = vi.getLastTeacherMeetingId();
|
||||
String dbtId = vi.getLastDelegationId(ShiroUtil.getPrincipalProperty("id").toString());
|
||||
cnd.and("userId", "in", Sqls.createf("select userid from sys_user_role where jdhid='%s' and roleid='%s' and dbtId='%s'", jdhid, Roles.DBT_TZ, dbtId));
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
|
||||
return listMap(sql);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,241 @@
|
||||
package io.v.nutz.meeting.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
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.meeting.service.MeetingManageService;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.msgNotify.models.MsgNotify;
|
||||
import io.v.nutz.msgNotify.models.MsgNotifyUser;
|
||||
import io.v.nutz.msgNotify.service.MsgNotifyService;
|
||||
import io.v.nutz.service.impl.ViServiceImpl;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class MeetingManageServiceImpl extends ViServiceImpl<MeetingInfo> implements MeetingManageService {
|
||||
|
||||
@Inject
|
||||
private MsgNotifyService msgNotifyService;
|
||||
|
||||
|
||||
public MeetingManageServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination pageData(PageForm pageForm, Cnd cnd) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
type.meetingTypeName
|
||||
FROM
|
||||
meeting_info info
|
||||
LEFT JOIN meeting_type type ON type.id = info.typeId
|
||||
$condition
|
||||
""");
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("info.meetingName", pageForm.getSearchKeyword());
|
||||
seg.orLike("info.location", pageForm.getSearchKeyword());
|
||||
cnd.and(seg);
|
||||
}
|
||||
cnd.desc("info.startTime");
|
||||
sql.setCondition(cnd);
|
||||
return list(pageForm, sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void doAdd(MeetingInfo meetingInfo) {
|
||||
dao().insertWith(meetingInfo, "^meetingUserList|meetingTimePeriods$");
|
||||
|
||||
insertMeetingTimePeriodUser(meetingInfo.getId(), meetingInfo.getMeetingTimePeriods(), meetingInfo.getMeetingUserList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入会议时间段 - 用户 数据
|
||||
*
|
||||
* @param meetingId 会议id
|
||||
* @param meetingTimePeriods 时间段
|
||||
* @param meetingUserList 人员
|
||||
*/
|
||||
private void insertMeetingTimePeriodUser(String meetingId, List<MeetingTimePeriod> meetingTimePeriods, List<MeetingUser> meetingUserList) {
|
||||
if (Lang.isNotEmpty(meetingTimePeriods) && Lang.isNotEmpty(meetingUserList)) {
|
||||
ArrayList<MeetingTimePeriodUser> insertList = new ArrayList<>();
|
||||
for (MeetingTimePeriod timePeriod : meetingTimePeriods) {
|
||||
for (MeetingUser meetingUser : meetingUserList) {
|
||||
MeetingTimePeriodUser timePeriodUser = new MeetingTimePeriodUser();
|
||||
timePeriodUser.setMeetingId(meetingId);
|
||||
timePeriodUser.setMeetingTimePeriodId(timePeriod.getId());
|
||||
timePeriodUser.setUserId(meetingUser.getUserId());
|
||||
insertList.add(timePeriodUser);
|
||||
}
|
||||
}
|
||||
dao().insert(insertList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void doEdit(MeetingInfo meetingInfo, List<String> userIds) {
|
||||
//原来的人
|
||||
List<MeetingUser> oldMus = dao().query(MeetingUser.class, Cnd.where("meetingId", "=", meetingInfo.getId()));
|
||||
List<String> oldMuIds = oldMus.stream().map(v -> v.getUserId()).collect(Collectors.toList());
|
||||
|
||||
//新增的人
|
||||
List<String> newMuIds = userIds.stream().filter(v -> !oldMuIds.contains(v)).collect(Collectors.toList());
|
||||
|
||||
|
||||
//新增的人
|
||||
// List<MeetingUser> newMus = dao().query(MeetingUser.class, Cnd.where("userid", "not in", userIds).and("meetingId","=",meetingInfo.getId()));
|
||||
// List<String> newMuIds = newMus.stream().map(v -> v.getUserId()).collect(Collectors.toList());
|
||||
|
||||
//新增的时间段
|
||||
List<MeetingTimePeriod> newTps = meetingInfo.getMeetingTimePeriods().stream().filter(v -> StrUtil.isBlank(v.getId())).collect(Collectors.toList());
|
||||
|
||||
//原来的用户
|
||||
// List<MeetingUser> oldMus = dao().query(MeetingUser.class, Cnd.where("meetingId", "=", meetingInfo.getId()));
|
||||
// List<String> oldMuIds = oldMus.stream().map(v -> v.getUserId()).collect(Collectors.toList());
|
||||
|
||||
dao().update(meetingInfo);
|
||||
|
||||
//删除改删得记录
|
||||
dao().clear(MeetingUser.class, Cnd.where("userid", "not in", userIds).and("meetingId", "=", meetingInfo.getId()));
|
||||
dao().clear(MeetingTimePeriodUser.class, Cnd.where("userid", "not in", userIds).and("meetingId", "=", meetingInfo.getId()));
|
||||
List<MeetingTimePeriod> meetingTimePeriods = meetingInfo.getMeetingTimePeriods();
|
||||
List<String> meetingTimePeriodIds = meetingTimePeriods.stream().map(v -> v.getId()).collect(Collectors.toList());
|
||||
dao().clear(MeetingTimePeriod.class, Cnd.where("id", "not in", meetingTimePeriodIds).and("meetingId", "=", meetingInfo.getId()));
|
||||
// dao().clear(MeetingTimePeriodUser.class, Cnd.where("meetingTimePeriodId", "not in", meetingTimePeriodIds));
|
||||
|
||||
dao().clear(MeetingUser.class, Cnd.where("meetingId", "=", meetingInfo.getId()));
|
||||
ArrayList<MeetingUser> insertMuList = new ArrayList<>();
|
||||
userIds.forEach(v -> {
|
||||
MeetingUser meetingUser = new MeetingUser();
|
||||
meetingUser.setMeetingId(meetingInfo.getId());
|
||||
meetingUser.setUserId(v);
|
||||
insertMuList.add(meetingUser);
|
||||
});
|
||||
dao().insert(insertMuList);
|
||||
|
||||
List<MeetingTimePeriod> mTps = meetingInfo.getMeetingTimePeriods();
|
||||
for (MeetingTimePeriod mTp : mTps) {
|
||||
if (StrUtil.isNotBlank(mTp.getId())) {
|
||||
dao().update(mTp);
|
||||
List<MeetingTimePeriodUser> mtpus = new ArrayList<>();
|
||||
if (Lang.isNotEmpty(newMuIds)) {
|
||||
//旧时间段 并且 有新增的人员
|
||||
for (String newMuId : newMuIds) {
|
||||
MeetingTimePeriodUser mtpu = new MeetingTimePeriodUser();
|
||||
mtpu.setMeetingId(meetingInfo.getId());
|
||||
mtpu.setUserId(newMuId);
|
||||
mtpu.setMeetingTimePeriodId(mTp.getId());
|
||||
mtpus.add(mtpu);
|
||||
}
|
||||
dao().insert(mtpus);
|
||||
} else {
|
||||
//旧时间段 并且 没有新增的人员 不用管
|
||||
}
|
||||
} else {
|
||||
//有新增的时间段
|
||||
mTp.setMeetingId(meetingInfo.getId());
|
||||
dao().insert(mTp);
|
||||
List<MeetingTimePeriodUser> mtpus = new ArrayList<>();
|
||||
for (String userId : userIds) {
|
||||
MeetingTimePeriodUser mtpu = new MeetingTimePeriodUser();
|
||||
mtpu.setMeetingId(meetingInfo.getId());
|
||||
mtpu.setUserId(userId);
|
||||
mtpu.setMeetingTimePeriodId(mTp.getId());
|
||||
mtpus.add(mtpu);
|
||||
}
|
||||
dao().insert(mtpus);
|
||||
|
||||
|
||||
/*if (Lang.isEmpty(newMus)) {
|
||||
//有新增的时间段 但是 没有新增的人员
|
||||
for (String oldMuUserId : oldMuIds) {
|
||||
MeetingTimePeriodUser mtpu = new MeetingTimePeriodUser();
|
||||
mtpu.setMeetingId(meetingInfo.getId());
|
||||
mtpu.setUserId(oldMuUserId);
|
||||
mtpu.setMeetingTimePeriodId(mTp.getId());
|
||||
mtpus.add(mtpu);
|
||||
}
|
||||
dao().insert(mtpus);
|
||||
} else {
|
||||
//有新增的时间段 并且 有新增的人员
|
||||
for (String userId : userIds) {
|
||||
MeetingTimePeriodUser mtpu = new MeetingTimePeriodUser();
|
||||
mtpu.setMeetingId(meetingInfo.getId());
|
||||
mtpu.setUserId(userId);
|
||||
mtpu.setMeetingTimePeriodId(mTp.getId());
|
||||
mtpus.add(mtpu);
|
||||
}
|
||||
dao().insert(mtpus);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// //更新会议
|
||||
// dao().update(meetingInfo);
|
||||
//
|
||||
// //新会议人员
|
||||
// List<MeetingUser> meetingUserList = meetingInfo.getMeetingUserList();
|
||||
// List<String> meetingUserIdList = meetingUserList.stream().map(MeetingUser::getId).collect(Collectors.toList());
|
||||
// //删除不在新会议人员里面的数据
|
||||
// dao().clear(MeetingUser.class, Cnd.where("id", "not in", meetingUserIdList));
|
||||
// //批量更新 效率更高
|
||||
// for (MeetingUser meetingUser : meetingUserList) {
|
||||
// meetingUser.setMeetingId(meetingInfo.getId());
|
||||
// }
|
||||
// dao().insertOrUpdate(meetingUserList);
|
||||
//
|
||||
//
|
||||
// //会议时间段
|
||||
// List<MeetingTimePeriod> meetingTimePeriods = meetingInfo.getMeetingTimePeriods();
|
||||
// List<String> meetingTimePeriodIds = meetingTimePeriods.stream().map(MeetingTimePeriod::getId).collect(Collectors.toList());
|
||||
// //删除会议时间段 - 用户 记录
|
||||
// dao().clear(MeetingTimePeriodUser.class, Cnd.where("meetingTimePeriodId", "not in", meetingTimePeriodIds));
|
||||
// dao().clear(MeetingTimePeriodUser.class, Cnd.where("userId", "not in", meetingUserList.stream().map(v -> v.getUserId()).collect(Collectors.toList())));
|
||||
//
|
||||
// //新增的时间段
|
||||
// List<MeetingTimePeriod> newTimePeriod = meetingInfo.getMeetingTimePeriods().stream().filter(v -> StrUtil.isBlank(v.getId())).collect(Collectors.toList());
|
||||
// insertMeetingTimePeriodUser(meetingInfo.getId(), newTimePeriod, meetingInfo.getMeetingUserList());
|
||||
//
|
||||
// //需要编辑的时间段
|
||||
// List<MeetingTimePeriod> editTimePeriod = meetingInfo.getMeetingTimePeriods().stream().filter(v -> StrUtil.isBlank(v.getId())).collect(Collectors.toList());
|
||||
// dao().update(editTimePeriod);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void doDelete(String id) {
|
||||
MeetingInfo meetingInfo = dao().fetch(MeetingInfo.class, id);
|
||||
dao().clear(MeetingUser.class, Cnd.where("meetingId", "=", id));
|
||||
dao().clear(MeetingTimePeriod.class, Cnd.where("meetingId", "=", id));
|
||||
dao().clear(MeetingTimePeriodUser.class, Cnd.where("meetingId", "=", id));
|
||||
dao().clear(MsgNotify.class, Cnd.where("id", "=", meetingInfo.getNotifyId()));
|
||||
dao().clear(MsgNotifyUser.class, Cnd.where("titleId", "=", meetingInfo.getNotifyId()));
|
||||
dao().delete(meetingInfo);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
package io.v.nutz.meeting.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.meeting.models.MeetingInfo;
|
||||
import io.v.nutz.meeting.models.MeetingTimePeriodUser;
|
||||
import io.v.nutz.meeting.service.MeetingCommonService;
|
||||
import io.v.nutz.meeting.service.MeetingMineService;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.msgNotify.service.MsgNotifyService;
|
||||
import io.v.nutz.service.impl.ViServiceImpl;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class MeetingMineServiceImpl extends ViServiceImpl implements MeetingMineService {
|
||||
|
||||
@Inject
|
||||
private MeetingCommonService meetingCommonService;
|
||||
|
||||
@Inject
|
||||
private MsgNotifyService msgNotifyService;
|
||||
|
||||
public MeetingMineServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination myMeetingPageData(PageForm pageForm, Cnd cnd) {
|
||||
String userId = (String) ShiroUtil.getPrincipalProperty("id");
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
type.meetingTypeName,
|
||||
mu.isJoin,
|
||||
state.stateName,
|
||||
state.stateColor,
|
||||
mu.stateCode,
|
||||
(select stateId from audit_state where module = type.moduleName order by stateId asc limit 1) firstState
|
||||
FROM
|
||||
meeting_info info
|
||||
LEFT JOIN meeting_type type ON type.id = info.typeId
|
||||
LEFT JOIN meeting_time_period_user mu ON mu.meetingId = info.id
|
||||
LEFT JOIN audit_state state on state.stateId = mu.stateCode
|
||||
$condition
|
||||
""");
|
||||
Sql userSql = Sqls.create("select meetingId from meeting_time_period_user where userId = @userId").setParam("userId", userId);
|
||||
cnd.and("info.id", "in", userSql);
|
||||
|
||||
cnd.and("mu.userid", "=", userId);
|
||||
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("meetingName", pageForm.getSearchKeyword());
|
||||
seg.orLike("location", pageForm.getSearchKeyword());
|
||||
cnd.and(seg);
|
||||
}
|
||||
|
||||
cnd.groupBy("info.id");
|
||||
cnd.desc("info.startTime");
|
||||
sql.setCondition(cnd);
|
||||
Pagination list = list(pageForm, sql);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Object> findMyMeetPeriod(String meetingId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
tp.id AS tpid,
|
||||
tp.startTime,
|
||||
tp.endTime,
|
||||
tp.timePeriodName,
|
||||
tpu.*,
|
||||
tpu.id as tpuId,
|
||||
state.stateName,
|
||||
state.stateAuditType
|
||||
FROM
|
||||
meeting_time_period tp
|
||||
LEFT JOIN meeting_time_period_user tpu ON tpu.meetingTimePeriodId = tp.id
|
||||
LEFT JOIN audit_state state on state.stateId = tpu.stateCode
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("tp.meetingId", "=", meetingId);
|
||||
cnd.and("tpu.userId", "=", ShiroUtil.getPrincipalProperty("id"));
|
||||
sql.setCondition(cnd);
|
||||
return listMap(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void askForLeave(List<MeetingTimePeriodUser> meetingTimePeriodUsers) {
|
||||
String moduleName = meetingCommonService.findModuleNameByMeetingId(meetingTimePeriodUsers.get(0).getMeetingId());
|
||||
Integer stateCode = meetingCommonService.findStartStateCodeByModuleName(moduleName);
|
||||
if (stateCode != null) {
|
||||
|
||||
meetingTimePeriodUsers.forEach(item -> {
|
||||
item.setIsJoin(false);
|
||||
item.setStateCode(stateCode);
|
||||
});
|
||||
dao().updateIgnoreNull(meetingTimePeriodUsers);
|
||||
|
||||
List<NutMap> userIdMap = meetingCommonService.getNextAuditUser(stateCode, moduleName);
|
||||
String userInfoStr = msgNotifyService.userData(userIdMap);
|
||||
|
||||
String meetingId = meetingTimePeriodUsers.get(0).getMeetingId();
|
||||
MeetingInfo meetingInfo = dao().fetch(MeetingInfo.class, meetingId);
|
||||
|
||||
String loginname = ShiroUtil.getPlatformUsername();
|
||||
String msgStr = String.format("%s针对%s提交了请假申请,请您审批!", loginname, meetingInfo.getMeetingName());
|
||||
//msgApi.sendSmsMsg(userInfoStr, msgStr);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void confirmMeeting(List<String> tpuIds) {
|
||||
// meetingUser.setIsJoin(true);
|
||||
// dao().updateIgnoreNull(meetingUser);
|
||||
Chain chain = Chain.make("isJoin", true);
|
||||
Cnd cnd = Cnd.where("id", "in", tpuIds);
|
||||
dao().update(MeetingTimePeriodUser.class, chain, cnd);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void signIn(MeetingTimePeriodUser timePeriodUser) {
|
||||
timePeriodUser.setIsSignIn(true);
|
||||
timePeriodUser.setSignInDateTime(new Date());
|
||||
dao().updateIgnoreNull(timePeriodUser);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,219 @@
|
||||
package io.v.nutz.meeting.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.base.utils.Roles;
|
||||
import io.v.nutz.jdh.model.cb.Jdh_jdhxx;
|
||||
import io.v.nutz.jdh.model.db.Jdh_db;
|
||||
import io.v.nutz.meeting.models.MeetingInfo;
|
||||
import io.v.nutz.meeting.models.MeetingTimePeriod;
|
||||
import io.v.nutz.meeting.models.MeetingType;
|
||||
import io.v.nutz.meeting.service.MeetingCommonService;
|
||||
import io.v.nutz.meeting.service.MeetingOnlineService;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.msgNotify.models.MsgNotify;
|
||||
import io.v.nutz.service.impl.ViServiceImpl;
|
||||
import io.v.nutz.workersCongress.model.WorkersCongressRepresentative;
|
||||
import io.v.nutz.workersCongress.model.WorkersCongressSession;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.Daos;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
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 java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class MeetingOnlineServiceImpl extends ViServiceImpl implements MeetingOnlineService {
|
||||
|
||||
@Inject
|
||||
private MeetingCommonService meetingCommonService;
|
||||
|
||||
public MeetingOnlineServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination pageData(PageForm pageForm, Cnd cnd) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
type.meetingTypeName,
|
||||
type.moduleName,
|
||||
@qrCodeUrl as qrCodeUrl
|
||||
FROM
|
||||
meeting_info info
|
||||
LEFT JOIN meeting_type type ON type.id = info.typeId
|
||||
$condition
|
||||
""");
|
||||
sql.setParam("qrCodeUrl", "");
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("info.meetingName", pageForm.getSearchKeyword());
|
||||
seg.orLike("info.location", pageForm.getSearchKeyword());
|
||||
cnd.and(seg);
|
||||
}
|
||||
cnd.desc("info.startTime");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = list(pageForm, sql);
|
||||
List<NutMap> list = pagination.getList();
|
||||
for (NutMap map : list) {
|
||||
List<MeetingTimePeriod> timePeriods = dao().query(MeetingTimePeriod.class, Cnd.where("meetingId", "=", map.getString("id", "")).asc("startTime"));
|
||||
map.setv("timePeriods", timePeriods);
|
||||
}
|
||||
pagination.setList(list);
|
||||
return pagination;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NutMap> exportSignature(String timePeriodId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.username,
|
||||
u.loginname,
|
||||
u.unitname,
|
||||
u.unionname,
|
||||
u.mobile
|
||||
FROM
|
||||
`meeting_time_period_user` tpu
|
||||
RIGHT JOIN `user` u ON u.id = tpu.userId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("tpu.meetingTimePeriodId", "=", timePeriodId);
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> map = listMap(sql);
|
||||
|
||||
MeetingTimePeriod period = dao().fetch(MeetingTimePeriod.class, timePeriodId);
|
||||
MeetingInfo meetingInfo = dao().fetch(MeetingInfo.class, period.getMeetingId());
|
||||
MeetingType meetingType = dao().fetch(MeetingType.class, meetingInfo.getTypeId());
|
||||
|
||||
|
||||
List<String> userIds = map.stream().map(m -> m.getString("loginname")).collect(Collectors.toList());
|
||||
List<NutMap> roleNameList=new ArrayList<>();
|
||||
//如果是教代会会议
|
||||
if (meetingType.getModuleName().equals("teacherMeeting")) {
|
||||
MsgNotify notify = dao().fetch(MsgNotify.class, meetingInfo.getNotifyId());
|
||||
Sql SqlRoleName = Sqls.create("""
|
||||
SELECT
|
||||
us.loginname,
|
||||
sr.`name`
|
||||
FROM
|
||||
`jdh_db` db
|
||||
LEFT JOIN sys_user us ON us.id=db.dbid
|
||||
LEFT JOIN sys_role sr ON sr.id = db.roleid
|
||||
where db.jdhid=@jdhid and us.loginname in (@userIds)
|
||||
""").setParam("jdhid", notify.getTeacherMeetingId()).setParam("userIds", userIds);
|
||||
roleNameList = listMap(SqlRoleName);
|
||||
|
||||
}else if (meetingType.getModuleName().equals("gdh")){
|
||||
MsgNotify notify = dao().fetch(MsgNotify.class, meetingInfo.getNotifyId());
|
||||
Sql SqlRoleName = Sqls.create("""
|
||||
SELECT
|
||||
us.loginname,
|
||||
sr.`name`
|
||||
FROM
|
||||
`workers_congress_representative` db
|
||||
LEFT JOIN sys_user us ON us.id = db.userId
|
||||
LEFT JOIN sys_role sr ON sr.id = db.roleId
|
||||
WHERE
|
||||
db.gdh_id = @jdhid and us.loginname in (@userIds)
|
||||
""").setParam("jdhid", notify.getTeacherMeetingId()).setParam("userIds", userIds);
|
||||
roleNameList = listMap(SqlRoleName);
|
||||
}
|
||||
|
||||
if (Lang.isNotEmpty(roleNameList)){
|
||||
List<NutMap> finalRoleNameList = roleNameList;
|
||||
map.forEach(m -> {
|
||||
NutMap roleNameMap = finalRoleNameList.stream().filter(r -> r.getString("loginname").equals(m.getString("loginname"))).findFirst().orElse(null);
|
||||
if (Lang.isNotEmpty(roleNameMap)) {
|
||||
m.setv("roleName", roleNameMap.getString("name"));
|
||||
} else {
|
||||
m.setv("roleName", null);
|
||||
}
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getRealTimeData(String timePeriodId) {
|
||||
MeetingTimePeriod timePeriod = dao().fetch(MeetingTimePeriod.class, timePeriodId);
|
||||
Integer stateCode = meetingCommonService.findSuccessStateCode(timePeriod.getMeetingId());
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
(select count(1) from meeting_time_period_user where meetingTimePeriodId = @timePeriodId) as shouldComeNumber,
|
||||
(select count(1) from meeting_time_period_user where meetingTimePeriodId = @timePeriodId and (isJoin is null or (isJoin is not null and stateCode != @stateCode)) and isSignIn is null) as actualComeNumber,
|
||||
(select count(1) from meeting_time_period_user where meetingTimePeriodId = @timePeriodId and isSignIn = 1) as signInNumber,
|
||||
(select count(1) from meeting_time_period_user where meetingTimePeriodId = @timePeriodId and isJoin = 0 and stateCode = @stateCode) as leaveNumber
|
||||
""");
|
||||
sql.setParam("stateCode", stateCode).setParam("timePeriodId", timePeriodId);
|
||||
NutMap dataMap = (NutMap) Daos.query(dao(), sql.toString(), Sqls.callback.map());
|
||||
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
list.add(Map.of("label", "应到人数", "key", "shouldComeNumber", "value", dataMap.getInt("shouldComeNumber", 0)));
|
||||
list.add(Map.of("label", "未到人数", "key", "actualComeNumber", "value", dataMap.getInt("actualComeNumber", 0)));
|
||||
list.add(Map.of("label", "签到人数", "key", "signInNumber", "value", dataMap.getInt("signInNumber", 0)));
|
||||
|
||||
//如果是教代会,就查询签到的正式代表和列席代表各多少人
|
||||
MeetingInfo meetingInfo = dao().fetch(MeetingInfo.class, timePeriod.getMeetingId());
|
||||
MeetingType meetingType = dao().fetch(MeetingType.class, meetingInfo.getTypeId());
|
||||
if ("teacherMeeting".equals(meetingType.getModuleName())) {
|
||||
//获取教代会最新届次
|
||||
Jdh_jdhxx jdh = dao().fetch(Jdh_jdhxx.class, Cnd.where("jdhkqzt", "=", 1).desc("jdhkqsj"));
|
||||
//查询签到人员
|
||||
List<NutMap> signInUser = getSignInUser(timePeriodId);
|
||||
List<String> userList = signInUser.stream().map(o -> o.getString("userId")).collect(Collectors.toList());
|
||||
//查询代表
|
||||
List<Jdh_db> dbList = dao().query(Jdh_db.class, Cnd.where("jdhid", "=", jdh.getId()));
|
||||
long zsdb = dbList.stream().filter(o -> o.getRoleid().equals(Roles.ZSDB) && userList.contains(o.getDbid())).count();
|
||||
long lxdb = dbList.stream().filter(o -> o.getRoleid().equals(Roles.LXDB) && userList.contains(o.getDbid())).count();
|
||||
list.add(Map.of("label", "正式代表", "key", "zsdbNumber", "value", zsdb));
|
||||
list.add(Map.of("label", "列席代表", "key", "lxdbNumber", "value", lxdb));
|
||||
} else if ("gdh".equals(meetingType.getModuleName())) {
|
||||
//获取教代会最新届次
|
||||
WorkersCongressSession jdh = dao().fetch(WorkersCongressSession.class, Cnd.where("startState", "=", 1).desc("startTime"));
|
||||
//查询签到人员
|
||||
List<NutMap> signInUser = getSignInUser(timePeriodId);
|
||||
List<String> userList = signInUser.stream().map(o -> o.getString("userId")).collect(Collectors.toList());
|
||||
//查询代表
|
||||
List<WorkersCongressRepresentative> dbList = dao().query(WorkersCongressRepresentative.class, Cnd.where("gdh_id", "=", jdh.getId()));
|
||||
long zsdb = dbList.stream().filter(o -> o.getRoleId().equals(Roles.GDHDB) && userList.contains(o.getUserId())).count();
|
||||
long lxdb = dbList.stream().filter(o -> o.getRoleId().equals(Roles.GDHLX) && userList.contains(o.getUserId())).count();
|
||||
list.add(Map.of("label", "正式代表", "key", "zsdbNumber", "value", zsdb));
|
||||
list.add(Map.of("label", "列席代表", "key", "lxdbNumber", "value", lxdb));
|
||||
}
|
||||
list.add(Map.of("label", "请假人数", "key", "leaveNumber", "value", dataMap.getInt("leaveNumber", 0)));
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NutMap> getSignInUser(String timePeriodId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
tpu.userId,
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.sex,
|
||||
u.unitname,
|
||||
tpu.signInDateTime
|
||||
FROM
|
||||
`meeting_time_period_user` tpu
|
||||
LEFT JOIN `user` u ON u.id = tpu.userId
|
||||
WHERE
|
||||
tpu.meetingTimePeriodId = @timePeriodId
|
||||
AND tpu.isSignIn = 1
|
||||
ORDER BY tpu.signInDateTime desc
|
||||
""");
|
||||
sql.setParam("timePeriodId", timePeriodId);
|
||||
return listMap(sql);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package io.v.nutz.meeting.service.impl;
|
||||
|
||||
import io.v.nutz.meeting.models.MeetingType;
|
||||
import io.v.nutz.meeting.service.MeetingCommonService;
|
||||
import io.v.nutz.meeting.service.MeetingTypeService;
|
||||
import io.v.nutz.modules.models.AuditState;
|
||||
import io.v.nutz.modules.models.AuditStateUser;
|
||||
import io.v.nutz.service.impl.ViServiceImpl;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.Daos;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class MeetingTypeServiceImpl extends ViServiceImpl<MeetingType> implements MeetingTypeService {
|
||||
|
||||
@Inject
|
||||
private MeetingCommonService meetingCommonService;
|
||||
|
||||
public MeetingTypeServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int findMaxStateId() {
|
||||
return dao().func(AuditState.class, "max", "stateId");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据模块名称查找stateId
|
||||
*
|
||||
* @param moduleName
|
||||
* @return
|
||||
*/
|
||||
private String[] findStateIdArray(String moduleName) {
|
||||
//查询该类型原来关联的stateId
|
||||
Sql stateSql = Sqls.create("select stateId from audit_state where module = @moduleName").setParam("moduleName", moduleName);
|
||||
return (String[]) Daos.query(dao(), stateSql.toString(), Sqls.callback.strs());
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加流程信息
|
||||
*
|
||||
* @param meetingType
|
||||
*/
|
||||
private void insertAuditInfo(MeetingType meetingType) {
|
||||
List<AuditState> auditStateList = meetingType.getAuditStateList();
|
||||
if (Lang.isNotEmpty(auditStateList)) {
|
||||
for (int i = 0; i < auditStateList.size(); i++) {
|
||||
AuditState state = auditStateList.get(i);
|
||||
state.setModule(meetingType.getModuleName());
|
||||
state.setMeetingTypeId(meetingType.getId());
|
||||
dao().insertWith(state, "^auditStateUserList$");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void add(MeetingType meetingType) {
|
||||
dao().insert(meetingType);
|
||||
insertAuditInfo(meetingType);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void edit(MeetingType meetingType) {
|
||||
dao().update(meetingType);
|
||||
|
||||
//查询该类型原来关联的stateId
|
||||
String[] stateIdStr = findStateIdArray(meetingType.getModuleName());
|
||||
|
||||
//删除原来审核状态下的审核人员
|
||||
dao().clear(AuditStateUser.class, Cnd.where("stateId", "in", stateIdStr));
|
||||
//删除原来的审核状态
|
||||
dao().clear(AuditState.class, Cnd.where("stateId", "in", stateIdStr));
|
||||
|
||||
//添加新的审核流程
|
||||
insertAuditInfo(meetingType);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void delete(MeetingType meetingType) {
|
||||
//查询该类型原来关联的stateId
|
||||
String[] stateIdStr = findStateIdArray(meetingType.getModuleName());
|
||||
|
||||
//删除原来审核状态下的审核人员
|
||||
dao().clear(AuditStateUser.class, Cnd.where("stateId", "in", stateIdStr));
|
||||
//删除原来的审核状态
|
||||
dao().clear(AuditState.class, Cnd.where("stateId", "in", stateIdStr));
|
||||
|
||||
dao().delete(meetingType);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package io.v.nutz.meeting.ws;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.plugins.mvc.websocket.AbstractWsEndpoint;
|
||||
import org.nutz.plugins.mvc.websocket.NutWsConfigurator;
|
||||
import org.nutz.plugins.mvc.websocket.WsHandler;
|
||||
|
||||
import javax.websocket.EndpointConfig;
|
||||
import javax.websocket.Session;
|
||||
import javax.websocket.server.ServerEndpoint;
|
||||
|
||||
@ServerEndpoint(value = "/websocket/meeting", configurator = NutWsConfigurator.class)
|
||||
@IocBean
|
||||
@Slf4j
|
||||
public class MeetingWebsocket extends AbstractWsEndpoint {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Override
|
||||
public WsHandler createHandler(Session session, EndpointConfig config) {
|
||||
// 是的,返回你自己的实现类就可以了,需要每次新建哦
|
||||
return new MeetingWsHandler(dao);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package io.v.nutz.meeting.ws;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.Mvcs;
|
||||
import org.nutz.plugins.mvc.websocket.handler.AbstractWsHandler;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
@Slf4j
|
||||
public class MeetingWsHandler extends AbstractWsHandler {
|
||||
|
||||
private Dao dao;
|
||||
|
||||
public MeetingWsHandler(Dao dao) {
|
||||
// 覆盖默认前缀
|
||||
super("");
|
||||
this.dao = dao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
// 必须调用超类的init,除非直接实现WsHandler接口
|
||||
super.init();
|
||||
if (this.httpSession != null) {
|
||||
// 其他业务代码只需要从HttpSession取出wsid,即可调用AbstractWsEndpoint的api发送消息
|
||||
this.httpSession.setAttribute("wsid", session.getId());
|
||||
}
|
||||
|
||||
HttpServletRequest req = Mvcs.getReq();
|
||||
log.debug("req={}", req);
|
||||
}
|
||||
|
||||
/**
|
||||
* 对应js端的action名称,方法参数必须是NutMap哦
|
||||
* 通过endpoint可以发生给任何你想发生的对象, session就是当前WebSocket的会话.
|
||||
*
|
||||
* @param req
|
||||
*/
|
||||
public void getSignData(NutMap req) {
|
||||
NutMap resp = NutMap.NEW();
|
||||
resp.setv("?????", "?????????");
|
||||
endpoint.sendJson(session.getId(), resp);
|
||||
}
|
||||
|
||||
/**
|
||||
* 这里不知道为什么拿不到httpsession
|
||||
*
|
||||
* @param httpSession
|
||||
*/
|
||||
@Override
|
||||
public void setHttpSession(HttpSession httpSession) {
|
||||
log.debug("http session = " + httpSession);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,203 @@
|
||||
|
||||
|
||||
package io.v.nutz.modules.models;
|
||||
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Table("audit_state")
|
||||
public class AuditState {
|
||||
@Column
|
||||
@Id(
|
||||
auto = false
|
||||
)
|
||||
@Comment("ID")
|
||||
@ColDefine(
|
||||
type = ColType.INT,
|
||||
width = 8
|
||||
)
|
||||
private Integer stateId;
|
||||
@Column
|
||||
@Comment("状态名")
|
||||
@ColDefine(
|
||||
type = ColType.VARCHAR,
|
||||
width = 50
|
||||
)
|
||||
private String stateName;
|
||||
@Column
|
||||
@Comment("强调色")
|
||||
@ColDefine(
|
||||
type = ColType.VARCHAR,
|
||||
width = 20
|
||||
)
|
||||
private String stateColor;
|
||||
@Column
|
||||
@Comment("隶属(***模块)")
|
||||
@ColDefine(
|
||||
type = ColType.VARCHAR,
|
||||
width = 50
|
||||
)
|
||||
private String module;
|
||||
@Column
|
||||
@Comment("下个审核节点代码")
|
||||
@ColDefine(
|
||||
type = ColType.INT,
|
||||
width = 8
|
||||
)
|
||||
private Integer afterStateId;
|
||||
@Column
|
||||
@Comment("通过下个审核节点代码")
|
||||
@ColDefine(
|
||||
type = ColType.INT,
|
||||
width = 8
|
||||
)
|
||||
private Integer afterPassStateId;
|
||||
@Column
|
||||
@Comment("拒绝后下个节点代码")
|
||||
@ColDefine(
|
||||
type = ColType.INT,
|
||||
width = 8
|
||||
)
|
||||
private Integer afterRejectStateId;
|
||||
@Column
|
||||
@Comment("会议类型id 属于那个会议类型的流程")
|
||||
@ColDefine(
|
||||
type = ColType.INT
|
||||
)
|
||||
private Integer meetingTypeId;
|
||||
@Column
|
||||
@Comment("会议审核类型")
|
||||
@ColDefine(
|
||||
type = ColType.VARCHAR
|
||||
)
|
||||
private String auditAfterType;
|
||||
@Column
|
||||
@Comment("审核节点类型")
|
||||
@ColDefine(
|
||||
type = ColType.INT
|
||||
)
|
||||
private Integer stateAuditType;
|
||||
@Column
|
||||
@Comment("审核人员匹配条件")
|
||||
@ColDefine(
|
||||
type = ColType.VARCHAR
|
||||
)
|
||||
private String matchCnd;
|
||||
@Many(
|
||||
field = "stateId"
|
||||
)
|
||||
private List<AuditStateUser> auditStateUserList;
|
||||
|
||||
public AuditState() {
|
||||
}
|
||||
|
||||
public Integer getStateId() {
|
||||
return this.stateId;
|
||||
}
|
||||
|
||||
public String getStateName() {
|
||||
return this.stateName;
|
||||
}
|
||||
|
||||
public String getStateColor() {
|
||||
return this.stateColor;
|
||||
}
|
||||
|
||||
public String getModule() {
|
||||
return this.module;
|
||||
}
|
||||
|
||||
public Integer getAfterStateId() {
|
||||
return this.afterStateId;
|
||||
}
|
||||
|
||||
public Integer getAfterPassStateId() {
|
||||
return this.afterPassStateId;
|
||||
}
|
||||
|
||||
public Integer getAfterRejectStateId() {
|
||||
return this.afterRejectStateId;
|
||||
}
|
||||
|
||||
public Integer getMeetingTypeId() {
|
||||
return this.meetingTypeId;
|
||||
}
|
||||
|
||||
public Integer getStateAuditType() {
|
||||
return this.stateAuditType;
|
||||
}
|
||||
|
||||
public String getMatchCnd() {
|
||||
return this.matchCnd;
|
||||
}
|
||||
|
||||
public List<AuditStateUser> getAuditStateUserList() {
|
||||
return this.auditStateUserList;
|
||||
}
|
||||
|
||||
public AuditState setStateId(Integer stateId) {
|
||||
this.stateId = stateId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AuditState setStateName(String stateName) {
|
||||
this.stateName = stateName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AuditState setStateColor(String stateColor) {
|
||||
this.stateColor = stateColor;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AuditState setModule(String module) {
|
||||
this.module = module;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AuditState setAfterStateId(Integer afterStateId) {
|
||||
this.afterStateId = afterStateId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AuditState setAfterPassStateId(Integer afterPassStateId) {
|
||||
this.afterPassStateId = afterPassStateId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AuditState setAfterRejectStateId(Integer afterRejectStateId) {
|
||||
this.afterRejectStateId = afterRejectStateId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AuditState setMeetingTypeId(Integer meetingTypeId) {
|
||||
this.meetingTypeId = meetingTypeId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AuditState setStateAuditType(Integer stateAuditType) {
|
||||
this.stateAuditType = stateAuditType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getAuditAfterType() {
|
||||
return auditAfterType;
|
||||
}
|
||||
|
||||
public void setAuditAfterType(String auditAfterType) {
|
||||
this.auditAfterType = auditAfterType;
|
||||
}
|
||||
|
||||
public AuditState setMatchCnd(String matchCnd) {
|
||||
this.matchCnd = matchCnd;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AuditState setAuditStateUserList(List<AuditStateUser> auditStateUserList) {
|
||||
this.auditStateUserList = auditStateUserList;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -4,12 +4,13 @@ import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.page.Pagination;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.question.service.QuestionAnswerRankingService;
|
||||
import io.v.nutz.question.service.QuestionService;
|
||||
import io.v.nutz.sys.services.SysUnionService;
|
||||
import io.v.nutz.util.ShiroUtil;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
@@ -40,6 +41,9 @@ public class QuestionAnswerRankingController {
|
||||
@Inject
|
||||
private SysUnionService sysUnionService;
|
||||
|
||||
@Inject
|
||||
private QuestionAnswerRankingService questionAnswerRankingService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/question/ranking.html")
|
||||
@RequiresPermissions("question.answer.ranking")
|
||||
@@ -49,96 +53,25 @@ public class QuestionAnswerRankingController {
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("question.answer.ranking")
|
||||
public Object pageData(PageForm pageForm, @Param(value = "questionId",required = false) String questionId,
|
||||
@Param(value = "unionId",required = false) String unionId,
|
||||
@Param(value = "unitId",required = false) String unitId,
|
||||
@Param(value = "answerDate",required = false) String answerDate) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
qus.userId,
|
||||
DATE_FORMAT( qus.answerDate, '%Y-%m-%d' ) as answerDate,
|
||||
MAX( score ) AS max_score,
|
||||
qus.answerNum,
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.sex,
|
||||
u.unitname,
|
||||
u.unionname,
|
||||
u.mobile
|
||||
FROM
|
||||
question_user_score qus
|
||||
LEFT JOIN `user` u ON u.id = qus.userId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.groupBy("qus.userId", "qus.answerDate");
|
||||
cnd.desc("qus.userId").desc("max_score");
|
||||
cnd.andEX("u.unionid", "=", unionId);
|
||||
cnd.andEX("u.unitid", "=", unitId);
|
||||
cnd.andEX("qus.answerDate", "=", answerDate);
|
||||
cnd.and("qus.questionId", "=", questionId);
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(Cnd.exps("u.loginname", "like", "%" + pageForm.getSearchKeyword() + "%").or("u.username", "like", "%" + pageForm.getSearchKeyword() + "%"));
|
||||
}
|
||||
cnd.asc("qus.answerDate").asc("u.unionid").asc("u.id");
|
||||
sql.setCondition(cnd);
|
||||
return questionService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
public Object pageData(PageForm pageForm, @Param(value = "questionId", required = false) String questionId,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "answerDate", required = false) String answerDate) {
|
||||
Pagination pagination = questionAnswerRankingService.pageData(pageForm, questionId, unionId, unitId, answerDate);
|
||||
return pagination;
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@RequiresPermissions("question.answer.ranking")
|
||||
public void doExport(@Param(value = "questionId",required = false) String questionId,
|
||||
@Param(value = "unionId",required = false) String unionId,
|
||||
@Param(value = "unitId",required = false) String unitId,
|
||||
@Param(value = "answerDate",required = false) String answerDate, HttpServletResponse response) {
|
||||
public void doExport(@Param(value = "questionId", required = false) String questionId,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "answerDate", required = false) String answerDate, HttpServletResponse response) {
|
||||
try {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
qus.userId,
|
||||
DATE_FORMAT( qus.answerDate, '%Y-%m-%d' ) as answerDate,
|
||||
MAX( score ) AS max_score,
|
||||
qus.answerNum,
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.sex,
|
||||
u.unitname,
|
||||
u.unionname,
|
||||
u.mobile
|
||||
FROM
|
||||
question_user_score qus
|
||||
LEFT JOIN `user` u ON u.id = qus.userId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.groupBy("qus.userId", "qus.answerDate");
|
||||
cnd.desc("qus.userId").desc("max_score");
|
||||
cnd.andEX("u.unionid", "=", unionId);
|
||||
cnd.andEX("u.unitid", "=", unitId);
|
||||
cnd.andEX("qus.answerDate", "=", answerDate);
|
||||
cnd.and("qus.questionId", "=", questionId);
|
||||
cnd.asc("qus.answerDate").asc("u.unionid").asc("u.id");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> dataList = questionService.listMap(sql);
|
||||
|
||||
List<ExcelExportEntity> exportEntities = new ArrayList<>();
|
||||
exportEntities.add(new ExcelExportEntity("工号", "loginname", 20));
|
||||
exportEntities.add(new ExcelExportEntity("姓名", "username", 20));
|
||||
exportEntities.add(new ExcelExportEntity("性别", "sex", 20));
|
||||
exportEntities.add(new ExcelExportEntity("所属单位", "unitname", 20));
|
||||
exportEntities.add(new ExcelExportEntity("所属工会", "unionname", 20));
|
||||
exportEntities.add(new ExcelExportEntity("联系方式", "mobile", 20));
|
||||
exportEntities.add(new ExcelExportEntity("分数", "max_score", 20));
|
||||
exportEntities.add(new ExcelExportEntity("答题日期", "answerDate", 20));
|
||||
|
||||
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + new String(("得分名单.xlsx").getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1));
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, exportEntities, dataList);
|
||||
workbook.write(response.getOutputStream());
|
||||
|
||||
questionAnswerRankingService.exportXlsx(questionId, response.getOutputStream());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -147,7 +80,7 @@ public class QuestionAnswerRankingController {
|
||||
@At
|
||||
@Ok("void")
|
||||
@RequiresPermissions("question.answer.ranking")
|
||||
public void doExportAll(@Param(value = "questionId",required = false) String questionId, HttpServletResponse response) {
|
||||
public void doExportAll(@Param(value = "questionId", required = false) String questionId, HttpServletResponse response) {
|
||||
try {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
|
||||
@@ -1,156 +0,0 @@
|
||||
package io.v.nutz.question.controller;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.question.model.Question;
|
||||
import io.v.nutz.question.model.QuestionWinner;
|
||||
import io.v.nutz.question.service.QuestionService;
|
||||
import io.v.nutz.util.ViTool;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
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.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@At("/platform/question/answer/statistics")
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
public class QuestionAnswerStatisticsController {
|
||||
|
||||
@Inject
|
||||
private QuestionService questionService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/question/statistics.html")
|
||||
@RequiresPermissions("question.answer.statistics")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("question.answer.statistics")
|
||||
public Object pageData(PageForm pageForm, @Param(value = "questionId", required = false) String questionId,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId) {
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
qus.userId,
|
||||
MAX( qus.score ) AS max_score,
|
||||
u.username,
|
||||
u.loginname,
|
||||
u.unitname,
|
||||
u.unionname,
|
||||
u.sex,
|
||||
u.mobile
|
||||
FROM
|
||||
question_user_score qus
|
||||
LEFT JOIN `user` u ON u.id = qus.userId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.groupBy("qus.userId");
|
||||
cnd.and("qus.questionId", "=", questionId);
|
||||
cnd.andEX("u.unitid", "=", unitId);
|
||||
cnd.andEX("u.unionid", "=", unionId);
|
||||
sql.setCondition(cnd);
|
||||
return questionService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("question.answer.statistics")
|
||||
public Object doRaffle(String questionId) {
|
||||
questionService.dao().clear(QuestionWinner.class, Cnd.where("questionId", "=", questionId));
|
||||
|
||||
Question question = questionService.fetch(questionId);
|
||||
Integer raffleScore = question.getRaffleScore();
|
||||
Integer raffleWinnerUserNum = question.getRaffleWinnerUserNum();
|
||||
|
||||
Sql sql = Sqls.create("SELECT userId FROM `question_user_score` where score >= @score order by RAND() limit @num");
|
||||
sql.setParam("score", raffleScore);
|
||||
sql.setParam("num", raffleWinnerUserNum);
|
||||
List<NutMap> list = questionService.listMap(sql);
|
||||
|
||||
List<String> userIds = list.stream().map(v -> v.getString("userId")).collect(Collectors.toList());
|
||||
|
||||
List<QuestionWinner> winners = new ArrayList<>();
|
||||
for (String userId : userIds) {
|
||||
QuestionWinner questionWinner = new QuestionWinner();
|
||||
questionWinner.setQuestionId(questionId);
|
||||
questionWinner.setUserId(userId);
|
||||
winners.add(questionWinner);
|
||||
}
|
||||
questionService.dao().insert(winners);
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@RequiresPermissions("question.answer.statistics")
|
||||
public void export(@Param(value = "questionId", required = false) String questionId,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
HttpServletResponse response) {
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
qus.userId,
|
||||
MAX( qus.score ) AS max_score,
|
||||
u.username,
|
||||
u.loginname,
|
||||
u.unitname,
|
||||
u.unionname,
|
||||
u.sex,
|
||||
u.mobile
|
||||
FROM
|
||||
question_user_score qus
|
||||
LEFT JOIN `user` u ON u.id = qus.userId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.groupBy("qus.userId");
|
||||
cnd.and("qus.questionId", "=", questionId);
|
||||
cnd.andEX("u.unitid", "=", unitId);
|
||||
cnd.andEX("u.unionid", "=", unionId);
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = questionService.listMap(sql);
|
||||
|
||||
List<ExcelExportEntity> exportEntities = new ArrayList<>();
|
||||
exportEntities.add(new ExcelExportEntity("姓名", "username", 20));
|
||||
exportEntities.add(new ExcelExportEntity("工号", "loginname", 20));
|
||||
exportEntities.add(new ExcelExportEntity("单位", "unitname", 20));
|
||||
exportEntities.add(new ExcelExportEntity("分工会", "unionname", 20));
|
||||
exportEntities.add(new ExcelExportEntity("得分", "max_score", 20));
|
||||
|
||||
try (ServletOutputStream outputStream = response.getOutputStream()) {
|
||||
ViTool.excelResponse(response, "参加人员.xlsx");
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
Workbook work = ExcelExportUtil.exportExcel(exportParams, exportEntities, list);
|
||||
work.write(outputStream);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -51,10 +51,10 @@ public class QuestionAnswerWinnerController {
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("question.answer.winners")
|
||||
public Object pageData(PageForm pageForm, @Param(value = "questionId", required = false) String questionId,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "winDate", required = false) String winDate) {
|
||||
public Object pageData(PageForm pageForm, @Param(value = "questionId",required = false) String questionId,
|
||||
@Param(value = "unionId",required = false) String unionId,
|
||||
@Param(value = "unitId",required = false) String unitId,
|
||||
@Param(value = "winDate",required = false) String winDate) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.loginname,
|
||||
@@ -63,15 +63,13 @@ public class QuestionAnswerWinnerController {
|
||||
u.unitname,
|
||||
u.unionname,
|
||||
u.mobile,
|
||||
qus.score
|
||||
DATE_FORMAT( qw.winDate, '%Y-%m-%d' ) as winDate,
|
||||
qw.score
|
||||
FROM
|
||||
question_winner qw
|
||||
LEFT JOIN `user` u ON u.id = qw.userId
|
||||
LEFT JOIN question_user_score qus on qus.userId = qw.userId and qus.questionId = @questionId
|
||||
$condition
|
||||
""");
|
||||
sql.setParam("questionId", questionId);
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("u.unionid", "=", unionId);
|
||||
cnd.andEX("u.unitid", "=", unitId);
|
||||
@@ -80,7 +78,6 @@ public class QuestionAnswerWinnerController {
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(Cnd.exps("u.loginname", "like", "%" + pageForm.getSearchKeyword() + "%").or("u.username", "like", "%" + pageForm.getSearchKeyword() + "%"));
|
||||
}
|
||||
cnd.groupBy("u.loginname");
|
||||
cnd.desc("qw.winDate");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = questionService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
@@ -98,33 +95,31 @@ public class QuestionAnswerWinnerController {
|
||||
@At
|
||||
@Ok("void")
|
||||
@RequiresPermissions("question.answer.winners")
|
||||
public void exportWinners(@Param(value = "questionId", required = false) String questionId,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "winDate", required = false) String winDate, HttpServletResponse response) {
|
||||
public void exportWinners(@Param(value = "questionId",required = false) String questionId,
|
||||
@Param(value = "unionId",required = false) String unionId,
|
||||
@Param(value = "unitId",required = false) String unitId,
|
||||
@Param(value = "winDate",required = false) String winDate, HttpServletResponse response) {
|
||||
try {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.sex,
|
||||
u.unitname,
|
||||
u.unionname,
|
||||
qus.score
|
||||
SELECT
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.sex,
|
||||
u.unitname,
|
||||
u.unionname,
|
||||
u.mobile,
|
||||
DATE_FORMAT( qw.winDate, '%Y-%m-%d' ) as winDate,
|
||||
qw.score
|
||||
FROM
|
||||
question_winner qw
|
||||
LEFT JOIN `user` u ON u.id = qw.userId
|
||||
LEFT JOIN question_user_score qus on qus.userId = qw.userId and qus.questionId = @questionId
|
||||
$condition
|
||||
""");
|
||||
sql.setParam("questionId", questionId);
|
||||
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("u.unionid", "=", unionId);
|
||||
cnd.andEX("u.unitid", "=", unitId);
|
||||
cnd.andEX("qw.winDate", "=", winDate);
|
||||
cnd.and("qw.questionId", "=", questionId);
|
||||
cnd.groupBy("u.loginname");
|
||||
cnd.desc("qw.winDate");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> dataList = questionService.listMap(sql);
|
||||
@@ -136,9 +131,8 @@ public class QuestionAnswerWinnerController {
|
||||
exportEntities.add(new ExcelExportEntity("所属单位", "unitname", 20));
|
||||
exportEntities.add(new ExcelExportEntity("所属工会", "unionname", 20));
|
||||
exportEntities.add(new ExcelExportEntity("联系方式", "mobile", 20));
|
||||
exportEntities.add(new ExcelExportEntity("得分", "score", 20));
|
||||
// exportEntities.add(new ExcelExportEntity("中奖日期", "winDate", 20));
|
||||
// exportEntities.add(new ExcelExportEntity("抽奖分数(最高分)", "maxScore", 20));
|
||||
exportEntities.add(new ExcelExportEntity("中奖日期", "winDate", 20));
|
||||
exportEntities.add(new ExcelExportEntity("抽奖分数", "score", 20));
|
||||
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + new String(("中奖名单.xlsx").getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1));
|
||||
@@ -154,7 +148,7 @@ public class QuestionAnswerWinnerController {
|
||||
@At
|
||||
@RequiresPermissions("question.answer.winners")
|
||||
public Object getQuestion(Integer year) {
|
||||
List<Question> list = questionService.query(Cnd.NEW().andEX("YEAR(qctime)", "=", year).and("qlx", "=", 2).and("isRaffle", "=", 1));
|
||||
List<Question> list = questionService.query(Cnd.NEW().andEX("YEAR(qctime)", "=", year).and("qlx", "=", 2).and("isRaffle","=",1));
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,23 @@ public class QuestionCakeController {
|
||||
un.unionName,
|
||||
(select count(1) from user where member = 1 and unionid = un.id) AS teacherSum,
|
||||
(
|
||||
select
|
||||
count(1)
|
||||
from
|
||||
activity_user_scope aus
|
||||
left join "user" u on u.id = aus.userId
|
||||
where
|
||||
groupId in (
|
||||
select
|
||||
activityUserScopeId
|
||||
from
|
||||
question
|
||||
where
|
||||
qid = @questionId
|
||||
)
|
||||
and u.unionId = un.id
|
||||
) as teacherSum,
|
||||
(
|
||||
SELECT
|
||||
count( DISTINCT r.userId )
|
||||
FROM
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.v.nutz.question.controller;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
@@ -8,7 +9,7 @@ import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.question.model.*;
|
||||
import io.v.nutz.question.service.QuestionService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
@@ -23,8 +24,10 @@ import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -46,6 +49,7 @@ public class QuestionH5Controller {
|
||||
|
||||
@At("/list")
|
||||
@Ok("beetl:/mobile/question/list.html")
|
||||
@RequiresAuthentication
|
||||
public void list() {
|
||||
|
||||
}
|
||||
@@ -70,16 +74,11 @@ public class QuestionH5Controller {
|
||||
|
||||
@At("/answer/index")
|
||||
@Ok("beetl:/mobile/question/answer.html")
|
||||
@RequiresAuthentication
|
||||
public void answerIndex() {
|
||||
|
||||
}
|
||||
|
||||
@At("/answer/index_ctgu")
|
||||
@Ok("beetl:/mobile/question/answer_ctgu.html")
|
||||
public void answerIndex2() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 页面数据
|
||||
@@ -93,13 +92,12 @@ public class QuestionH5Controller {
|
||||
public Object pageData(PageForm pageForm, int status, int type) {
|
||||
Sql sql = Sqls.create("""
|
||||
select
|
||||
q.*,
|
||||
(select count(1) from question_issue where iqid = q.qid) as topicTotal
|
||||
from
|
||||
q.*
|
||||
from
|
||||
question q
|
||||
$condition
|
||||
""");
|
||||
// sql.setParam("today", DateUtil.today());
|
||||
sql.setParam("today", DateUtil.today());
|
||||
Cnd cnd = Cnd.NEW();
|
||||
long now = System.currentTimeMillis();
|
||||
if (status == 1) {
|
||||
@@ -133,171 +131,203 @@ public class QuestionH5Controller {
|
||||
/**
|
||||
* 问卷信息
|
||||
*
|
||||
* @param id id
|
||||
* @param id id
|
||||
* @param currentDate 日期
|
||||
* @param randomCount 轮数
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At("/questionInfo/{id}")
|
||||
public Object questionInfo(@PathVariable String id) {
|
||||
public Object questionInfo(@PathVariable String id,
|
||||
@Param(required = false, value = "currentDate") String currentDate,
|
||||
@Param(required = false, value = "randomCount") Integer randomCount) {
|
||||
Question question = questionService.fetch(id);
|
||||
|
||||
Cnd issueCnd = Cnd.NEW();
|
||||
|
||||
//出题模式
|
||||
// mode==1 定时定题 直接查询
|
||||
// mode==2 先查询今天的随机题目有没有设置好 设置好了直接查询今天的题目 没有的话查询displayDate为null的题目然后取题目再设置时间进行查询
|
||||
Integer ctMode = question.getCtMode();
|
||||
if (ctMode == 2) {
|
||||
//单次出题的数量
|
||||
Integer ctNum = question.getCtNum();
|
||||
int todayIssueCount = dao.count(Question_issue.class, Cnd.where("displayDate", "=", DateUtil.format(new Date(), "yyyy-MM-dd"))
|
||||
.and("iqid", "=", id));
|
||||
if (todayIssueCount == 0) {
|
||||
Sql randIssueSql = Sqls.create("SELECT iid FROM question_issue WHERE iqid = @qid AND displayDate IS NULL ORDER BY RAND() LIMIT @ctNum");
|
||||
randIssueSql.setParam("qid", id);
|
||||
randIssueSql.setParam("ctNum", ctNum);
|
||||
String[] randIssueIds = (String[]) Daos.query(dao, randIssueSql.toString(), Sqls.callback.strs());
|
||||
dao.update(Question_issue.class, Chain.make("displayDate", new Date()), Cnd.where("iid", "in", randIssueIds));
|
||||
|
||||
if (ctMode == 1) {
|
||||
//定时定题
|
||||
|
||||
//判断传入的日期是否已经加入到表里
|
||||
QuestionRandomIssue randomIssue = dao.fetch(QuestionRandomIssue.class, Cnd.where("questionId", "=", question.getQid()).and("userId", "=", ShiroUtil.getUserId())
|
||||
.and("displayDate", "=", currentDate));
|
||||
if (Lang.isEmpty(randomIssue)) {
|
||||
Sql issueSql = Sqls.queryString(" SELECT iid FROM `question_issue` where iqid = @qid AND displayDate = @displayDate");
|
||||
issueSql.setParam("qid", id);
|
||||
issueSql.setParam("displayDate", currentDate);
|
||||
dao.execute(issueSql);
|
||||
String[] randomIssueIds = (String[]) issueSql.getResult();
|
||||
QuestionRandomIssue questionRandomIssue = new QuestionRandomIssue();
|
||||
questionRandomIssue.setQuestionId(id);
|
||||
questionRandomIssue.setUserId(ShiroUtil.getUserId());
|
||||
questionRandomIssue.setIssueIds(Arrays.asList(randomIssueIds));
|
||||
questionRandomIssue.setNum(null);
|
||||
questionRandomIssue.setIsFinish(false);
|
||||
questionRandomIssue.setDisplayDate(DateUtil.parseDate(currentDate));
|
||||
dao.insert(questionRandomIssue);
|
||||
issueCnd.and("iid", "in", randomIssueIds);
|
||||
} else {
|
||||
issueCnd.and("iid", "in", randomIssue.getIssueIds());
|
||||
}
|
||||
} else if (ctMode == 2) {
|
||||
//随机模式
|
||||
|
||||
//判断是否为一天答题
|
||||
DateTime startTime = DateUtil.date(question.getStartTime());
|
||||
DateTime endTime = DateUtil.date(question.getEndTime());
|
||||
long betweenDay = DateUtil.betweenDay(startTime, endTime, true);
|
||||
|
||||
//每次随机的题目数量
|
||||
Integer ranDomSingleIssueNum = question.getRanDomSingleIssueNum();
|
||||
//总共随机几次
|
||||
Integer ranDomSum = question.getRanDomSum();
|
||||
|
||||
if (betweenDay == 0) {
|
||||
//同一天 一天随机多次
|
||||
|
||||
if (randomCount != null) {
|
||||
QuestionRandomIssue randomIssues = dao.fetch(QuestionRandomIssue.class, Cnd.where("questionId", "=", question.getQid()).and("userId", "=", ShiroUtil.getUserId()).and("num", "=", randomCount));
|
||||
issueCnd.andEX("iid", "in", randomIssues.getIssueIds());
|
||||
} else {
|
||||
//用户的随机题目
|
||||
List<QuestionRandomIssue> randomIssues = dao.query(QuestionRandomIssue.class, Cnd.where("questionId", "=", question.getQid()).and("userId", "=", ShiroUtil.getUserId()));
|
||||
|
||||
//查询已经随机但是并没有答题完成的题目
|
||||
List<String> notFinishIssueIds = randomIssues.stream().filter(v -> v.getIsFinish() != null && !v.getIsFinish()).findFirst().map(QuestionRandomIssue::getIssueIds).orElseGet(Collections::emptyList);
|
||||
|
||||
if (Lang.isNotEmpty(notFinishIssueIds)) {
|
||||
//就查询没答完的题目
|
||||
issueCnd.and("iid", "in", notFinishIssueIds);
|
||||
} else {
|
||||
//进行下一次随机 然后加入到随机题目表里
|
||||
//已经答了的题目
|
||||
List<String> hasAnswerIssueIds = randomIssues.stream().flatMap(v -> v.getIssueIds().stream()).collect(Collectors.toList());
|
||||
//已经随机几次了
|
||||
int maxAnswerNum = randomIssues.stream().mapToInt(QuestionRandomIssue::getNum).max().orElse(0);
|
||||
|
||||
Sql issueSql = null;
|
||||
if (maxAnswerNum == ranDomSum) {
|
||||
//随机完了 没有题目了 默认去最后一轮
|
||||
// issueCnd.andEX("iid", "in", hasAnswerIssueIds);
|
||||
List<String> lastRanDomIssueIds = randomIssues.stream().filter(v -> v.getNum() == maxAnswerNum).flatMap(v -> v.getIssueIds().stream()).collect(Collectors.toList());
|
||||
issueCnd.andEX("iid", "in", lastRanDomIssueIds);
|
||||
} else {
|
||||
if (maxAnswerNum == 0) {
|
||||
//从没有随即过
|
||||
issueSql = Sqls.queryString(" SELECT iid FROM `question_issue` where iqid = @qid ORDER BY RAND() LIMIT @num");
|
||||
} else {
|
||||
//之前随机过
|
||||
issueSql = Sqls.queryString(" SELECT iid FROM `question_issue` where iqid = @qid and iid not in (@issueIds) ORDER BY RAND() LIMIT @num");
|
||||
issueSql.setParam("issueIds", hasAnswerIssueIds);
|
||||
}
|
||||
issueSql.setParam("qid", id);
|
||||
issueSql.setParam("num", ranDomSingleIssueNum);
|
||||
dao.execute(issueSql);
|
||||
String[] randomIssueIds = (String[]) issueSql.getResult();
|
||||
|
||||
if (Lang.isNotEmpty(randomIssueIds)) {
|
||||
QuestionRandomIssue questionRandomIssue = new QuestionRandomIssue();
|
||||
questionRandomIssue.setQuestionId(id);
|
||||
questionRandomIssue.setUserId(ShiroUtil.getUserId());
|
||||
questionRandomIssue.setIssueIds(Arrays.asList(randomIssueIds));
|
||||
questionRandomIssue.setNum(maxAnswerNum + 1);
|
||||
questionRandomIssue.setIsFinish(false);
|
||||
questionRandomIssue.setDisplayDate(DateUtil.parseDate(DateUtil.today()));
|
||||
dao.insert(questionRandomIssue);
|
||||
}
|
||||
//获取本次的随机题目
|
||||
issueCnd.andEX("iid", "in", randomIssueIds);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//不是一天 那就一天随机一次
|
||||
|
||||
//用户的随机题目记录
|
||||
List<QuestionRandomIssue> randomIssues = dao.query(QuestionRandomIssue.class, Cnd.where("questionId", "=", question.getQid()).and("userId", "=", ShiroUtil.getUserId()));
|
||||
//已经随机的题目
|
||||
List<String> hasRanDomIssueIds = randomIssues.stream().flatMap(v -> v.getIssueIds().stream()).collect(Collectors.toList());
|
||||
|
||||
//判断传入的日期是否已经加入到表里
|
||||
QuestionRandomIssue currentDateRandomIssue = dao.fetch(QuestionRandomIssue.class, Cnd.where("questionId", "=", question.getQid()).and("userId", "=", ShiroUtil.getUserId())
|
||||
.and("displayDate", "=", currentDate));
|
||||
if (Lang.isEmpty(currentDateRandomIssue)) {
|
||||
Sql issueSql = null;
|
||||
if (Lang.isEmpty(hasRanDomIssueIds)) {
|
||||
issueSql = Sqls.queryString(" SELECT iid FROM `question_issue` where iqid = @qid ORDER BY RAND() LIMIT @num");
|
||||
} else {
|
||||
//之前随机过
|
||||
issueSql = Sqls.queryString(" SELECT iid FROM `question_issue` where iqid = @qid and iid not in (@issueIds) ORDER BY RAND() LIMIT @num");
|
||||
issueSql.setParam("issueIds", hasRanDomIssueIds);
|
||||
}
|
||||
issueSql.setParam("num", ranDomSingleIssueNum);
|
||||
issueSql.setParam("qid", id);
|
||||
dao.execute(issueSql);
|
||||
String[] randomIssueIds = (String[]) issueSql.getResult();
|
||||
QuestionRandomIssue questionRandomIssue = new QuestionRandomIssue();
|
||||
questionRandomIssue.setQuestionId(id);
|
||||
questionRandomIssue.setUserId(ShiroUtil.getUserId());
|
||||
questionRandomIssue.setIssueIds(Arrays.asList(randomIssueIds));
|
||||
questionRandomIssue.setNum(null);
|
||||
questionRandomIssue.setIsFinish(false);
|
||||
questionRandomIssue.setDisplayDate(DateUtil.parseDate(currentDate));
|
||||
dao.insert(questionRandomIssue);
|
||||
issueCnd.and("iid", "in", randomIssueIds);
|
||||
} else {
|
||||
issueCnd.and("iid", "in", currentDateRandomIssue.getIssueIds());
|
||||
}
|
||||
}
|
||||
} else if (ctMode == 3) {
|
||||
//常规模式
|
||||
//判断是否将题目加进去了
|
||||
QuestionRandomIssue randomIssue = dao.fetch(QuestionRandomIssue.class, Cnd.where("questionId", "=", question.getQid()).and("userId", "=", ShiroUtil.getUserId()));
|
||||
if (Lang.isEmpty(randomIssue)) {
|
||||
Sql issueSql = Sqls.create(" SELECT iid FROM `question_issue` where iqid = @qid");
|
||||
issueSql.setParam("qid", id);
|
||||
issueSql.setCallback(Sqls.callback.strList());
|
||||
dao.execute(issueSql);
|
||||
List<String> randomIssueIds = (List<String>) issueSql.getResult();
|
||||
Collections.shuffle(randomIssueIds);
|
||||
QuestionRandomIssue questionRandomIssue = new QuestionRandomIssue();
|
||||
questionRandomIssue.setQuestionId(id);
|
||||
questionRandomIssue.setUserId(ShiroUtil.getUserId());
|
||||
questionRandomIssue.setIssueIds(randomIssueIds);
|
||||
questionRandomIssue.setNum(null);
|
||||
questionRandomIssue.setIsFinish(false);
|
||||
dao.insert(questionRandomIssue);
|
||||
issueCnd.and("iid", "in", randomIssueIds);
|
||||
} else {
|
||||
issueCnd.and("iid", "in", randomIssue.getIssueIds());
|
||||
}
|
||||
// issueCnd.and("displayDate", "=", DateUtil.format(new Date(), "yyyy-MM-dd"));
|
||||
}
|
||||
|
||||
issueCnd.asc("ipxbh");
|
||||
// issueCnd.asc("ipxbh");
|
||||
questionService.fetchLinks(question, "issues", issueCnd);
|
||||
for (Question_issue issue : question.getIssues()) {
|
||||
questionService.fetchLinks(issue, "wors", Cnd.NEW().asc("wpxbh"));
|
||||
}
|
||||
|
||||
if (question.getDisruptingOrder()) {
|
||||
Collections.shuffle(question.getIssues());
|
||||
}
|
||||
|
||||
return Result.success(question);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存答案
|
||||
*
|
||||
* @param repliesArray 回复
|
||||
* @param repliesArray 答复记录
|
||||
* @param questionId 问卷ID
|
||||
* @param isSave 是否保存
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At("/saveAnswer")
|
||||
public Object saveAnswer(@Param("repliesArray") Question_reply[] repliesArray) {
|
||||
if (Lang.isNotEmpty(repliesArray)) {
|
||||
List<Question_reply> replies = Arrays.asList(repliesArray);
|
||||
if (Lang.isNotEmpty(replies)) {
|
||||
String qid = replies.get(0).getQid();
|
||||
questionService.dao().clear(Question_reply.class, Cnd.where("qid", "=", qid).and("userId", "=", ShiroUtil.getPrincipalProperty("id")));
|
||||
replies.forEach(v -> {
|
||||
v.setUserId(String.valueOf(ShiroUtil.getPrincipalProperty("id")));
|
||||
v.setRtime(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
|
||||
});
|
||||
questionService.insert(replies);
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
public Object saveAnswer(@Param("replies") Question_reply[] repliesArray, String questionId, Boolean isSave) {
|
||||
questionService.saveAnswer(repliesArray, questionId, isSave);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存答案 只针对答题模式
|
||||
*
|
||||
* @param replies 问题回复
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At("/saveAnswer2")
|
||||
public Object saveAnswer2(Question_reply[] replies) {
|
||||
if (Lang.isNotEmpty(replies)) {
|
||||
Arrays.asList(replies).forEach(v -> {
|
||||
v.setUserId(String.valueOf(ShiroUtil.getPrincipalProperty("id")));
|
||||
v.setRtime(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
|
||||
});
|
||||
questionService.insert(replies);
|
||||
insertQuestionAnswerScore(Arrays.asList(replies));
|
||||
insertQuestionAnswerScore2(Arrays.asList(replies));
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
public void insertQuestionAnswerScore(List<Question_reply> replyList) {
|
||||
//用户id
|
||||
String userId = (String) ShiroUtil.getPrincipalProperty("id");
|
||||
//问卷id
|
||||
String questionId = replyList.get(0).getQid();
|
||||
//题目id
|
||||
String issueId = replyList.get(0).getIssueId();
|
||||
|
||||
Question_issue issue = dao.fetch(Question_issue.class, Cnd.where("iid", "=", issueId));
|
||||
Float fraction = issue.getFraction();
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT wid FROM question_wor qw WHERE qw.correct = 1 AND qw.wiid = @wiid
|
||||
""").setParam("wiid", issueId);
|
||||
//正确的选项
|
||||
Set<String> correctOptionIdList = new HashSet<>((List<String>) Daos.query(dao, sql.toString(), Sqls.callback.strList()));
|
||||
//用户选的选项
|
||||
Set<String> userSelectedOptionIdList = replyList.stream().map(v -> v.getRwid()).collect(Collectors.toSet());
|
||||
|
||||
int count = dao.count(QuestionAnswerUserScore.class, Cnd.where("questionId", "=", questionId).and("subjectId", "=", issueId).and("answerDate", "=", DateUtil.format(new Date(), "yyyy-MM-dd")).and("userId", "=", userId));
|
||||
|
||||
QuestionAnswerUserScore answerUserScore = new QuestionAnswerUserScore();
|
||||
answerUserScore.setQuestionId(questionId);
|
||||
answerUserScore.setSubjectId(issueId);
|
||||
answerUserScore.setUserId(userId);
|
||||
answerUserScore.setAnswerDate(new Date());
|
||||
answerUserScore.setAnswerNum(count + 1);
|
||||
|
||||
if (correctOptionIdList.equals(userSelectedOptionIdList)) {
|
||||
answerUserScore.setSubjectScore(fraction);
|
||||
} else {
|
||||
answerUserScore.setSubjectScore(0f);
|
||||
}
|
||||
dao.insert(answerUserScore);
|
||||
}
|
||||
|
||||
public void insertQuestionAnswerScore2(List<Question_reply> replyList) {
|
||||
//问卷id
|
||||
String questionId = replyList.get(0).getQid();
|
||||
//查询今天的题目
|
||||
List<Question_issue> todayIssues = dao.query(Question_issue.class, Cnd.where("displayDate", "=", DateUtil.today())
|
||||
.and("iqid", "=", questionId));
|
||||
if (todayIssues != null && todayIssues.size() > 0) {
|
||||
Set<String> todayIssueIds = todayIssues.stream().map(v -> v.getIid()).collect(Collectors.toSet());
|
||||
//判断今天的题目是否已答完
|
||||
List<Question_reply> replyIssues = dao.query(Question_reply.class, Cnd.where("userId", "=", ShiroUtil.getPrincipalProperty("id")).and("qid", "=", questionId));
|
||||
Set<String> replyIssueIds = replyIssues.stream().map(v -> v.getIssueId()).collect(Collectors.toSet());
|
||||
if (todayIssueIds.equals(replyIssueIds)) {
|
||||
//答完了 去看看今天有没有答过
|
||||
int count = dao.count(QuestionUserScore.class, Cnd.where("questionId", "=", questionId).and("userId", "=", ShiroUtil.getPrincipalProperty("id")).and("answerDate", "=", DateUtil.today()));
|
||||
|
||||
// AtomicInteger sum = new AtomicInteger();
|
||||
AtomicReference<Float> sum = new AtomicReference<>(0f);
|
||||
|
||||
//每题的回答记录
|
||||
Map<String, List<Question_reply>> issueReplies = replyIssues.stream().collect(Collectors.groupingBy(v -> v.getIssueId()));
|
||||
|
||||
//查出选项信息
|
||||
dao.fetchLinks(todayIssues, "wors");
|
||||
|
||||
issueReplies.forEach((k, v) -> {
|
||||
//用户回答的选项
|
||||
Set<String> userReplyOptionIds = v.stream().map(x -> x.getRwid()).collect(Collectors.toSet());
|
||||
|
||||
Optional<Question_issue> issueOptional = todayIssues.stream().filter(x -> x.getIid().equals(k)).findFirst();
|
||||
|
||||
//正确答案
|
||||
Set<String> correctOptionIds = issueOptional.map(x -> x.getWors().stream().filter(c -> c.getCorrect() != null && c.getCorrect()).map(z -> z.getWid()).collect(Collectors.toSet())).orElse(null);
|
||||
if (userReplyOptionIds.equals(correctOptionIds)) {
|
||||
// sum.addAndGet(issueOptional.map(i -> i.getFraction()).orElse(0f));
|
||||
sum.updateAndGet(v1 -> v1 + issueOptional.map(i -> i.getFraction()).orElse(0f));
|
||||
}
|
||||
});
|
||||
|
||||
QuestionUserScore questionUserScore = new QuestionUserScore();
|
||||
questionUserScore.setQuestionId(questionId);
|
||||
questionUserScore.setUserId((String) ShiroUtil.getPrincipalProperty("id"));
|
||||
questionUserScore.setAnswerDate(new Date());
|
||||
questionUserScore.setAnswerNum(count + 1);
|
||||
questionUserScore.setScore(sum.get());
|
||||
dao.insert(questionUserScore);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 答题信息
|
||||
@@ -306,8 +336,25 @@ public class QuestionH5Controller {
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At("/answerInfo/?")
|
||||
public Object answerInfo(String id) {
|
||||
List<Question_reply> replies = questionService.dao().query(Question_reply.class, Cnd.where("qid", "=", id).and("userId", "=", ShiroUtil.getPrincipalProperty("id")));
|
||||
public Object answerInfo(String id,
|
||||
@Param(required = false, value = "currentDate") String currentDate,
|
||||
@Param(required = false, value = "randomCount") Integer randomCount) {
|
||||
Cnd cnd = Cnd.where("qid", "=", id).and("userId", "=", ShiroUtil.getPrincipalProperty("id"));
|
||||
|
||||
Question question = dao.fetch(Question.class, id);
|
||||
if (question.getCtMode() == 1) {
|
||||
cnd.and("DATE(rtime)", "=", currentDate);
|
||||
} else if (question.getCtMode() == 2) {
|
||||
if (questionService.isSameDay(question.getStartTime(), question.getEndTime())) {
|
||||
|
||||
} else {
|
||||
cnd.and("DATE(rtime)", "=", currentDate);
|
||||
}
|
||||
} else if (question.getCtMode() == 3) {
|
||||
|
||||
}
|
||||
|
||||
List<Question_reply> replies = questionService.dao().query(Question_reply.class, cnd);
|
||||
return Result.success(replies);
|
||||
}
|
||||
|
||||
@@ -346,74 +393,156 @@ public class QuestionH5Controller {
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@At("/canAnswer")
|
||||
public Object canAnswer(String questionId) {
|
||||
/**
|
||||
* 判断用户是否答完
|
||||
*
|
||||
* @param questionId 问卷ID
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
public Object checkUserFinishAnswer(String questionId,
|
||||
@Param(required = false, value = "currentDate") String currentDate,
|
||||
@Param(required = false, value = "randomCount") Integer randomCount) {
|
||||
Question question = dao.fetch(Question.class, questionId);
|
||||
if (question.getCtMode() == 3) {
|
||||
QuestionRandomIssue randomIssue = dao.fetch(QuestionRandomIssue.class, Cnd.where("questionId", "=", questionId).and("userId", "=", ShiroUtil.getUserId()));
|
||||
return Result.success(randomIssue.getIsFinish());
|
||||
} else if (question.getCtMode() == 2) {
|
||||
//判断是否为一天答题
|
||||
DateTime startTime = DateUtil.date(question.getStartTime());
|
||||
DateTime endTime = DateUtil.date(question.getEndTime());
|
||||
long betweenDay = DateUtil.betweenDay(startTime, endTime, true);
|
||||
|
||||
if (betweenDay == 0) {
|
||||
//同一天
|
||||
if (randomCount != null) {
|
||||
QuestionRandomIssue randomIssue = dao.fetch(QuestionRandomIssue.class, Cnd.where("questionId", "=", questionId).and("userId", "=", ShiroUtil.getUserId()).and("num", "=", randomCount));
|
||||
return Result.success(randomIssue.getIsFinish());
|
||||
}
|
||||
return Result.success(false);
|
||||
} else {
|
||||
//不是同一天 判断今天是否答完就行了
|
||||
QuestionRandomIssue randomIssue = dao.fetch(QuestionRandomIssue.class, Cnd.where("questionId", "=", questionId).and("userId", "=", ShiroUtil.getUserId()).and("displayDate", "=", DateUtil.today()));
|
||||
//时间过了
|
||||
if (DateUtil.parseDate(currentDate).isBefore(DateUtil.parseDate(DateUtil.today()))) {
|
||||
return Result.success(true);
|
||||
}
|
||||
return Result.success(randomIssue.getIsFinish());
|
||||
}
|
||||
} else if (question.getCtMode() == 1) {
|
||||
QuestionRandomIssue randomIssue = dao.fetch(QuestionRandomIssue.class, Cnd.where("questionId", "=", questionId).and("userId", "=", ShiroUtil.getUserId()).and("displayDate", "=", currentDate));
|
||||
//时间过了
|
||||
if (DateUtil.parseDate(currentDate).isBefore(DateUtil.parseDate(DateUtil.today()))) {
|
||||
return Result.success(true);
|
||||
}
|
||||
return Result.success(randomIssue.getIsFinish());
|
||||
}
|
||||
return Result.success(false);
|
||||
}
|
||||
|
||||
@At
|
||||
public Object checkCanAnswerAgain(String questionId,
|
||||
@Param(required = false, value = "currentDate") String currentDate,
|
||||
@Param(required = false, value = "randomCount") Integer randomCount) {
|
||||
Question question = dao.fetch(Question.class, questionId);
|
||||
if (question.getCanRepeatedAnswer()) {
|
||||
//0次则不限制
|
||||
if (question.getCanRepeatedAnswerNum() == 0) {
|
||||
return Result.success(true);
|
||||
}
|
||||
|
||||
if (question.getCtMode() == 3) {
|
||||
int count = dao.count(QuestionUserScore.class, Cnd.where("questionId", "=", questionId).and("userId", "=", ShiroUtil.getUserId()));
|
||||
return Result.success(count < question.getCanRepeatedAnswerNum());
|
||||
} else if (question.getCtMode() == 2) {
|
||||
//判断是否为一天答题
|
||||
DateTime startTime = DateUtil.date(question.getStartTime());
|
||||
DateTime endTime = DateUtil.date(question.getEndTime());
|
||||
long betweenDay = DateUtil.betweenDay(startTime, endTime, true);
|
||||
if (betweenDay == 0) {
|
||||
return Result.success(false);
|
||||
} else {
|
||||
int count = dao.count(QuestionUserScore.class, Cnd.where("questionId", "=", questionId).and("userId", "=", ShiroUtil.getUserId()).and("answerDate", "=", DateUtil.today()));
|
||||
return Result.success(count < question.getCanRepeatedAnswerNum());
|
||||
}
|
||||
} else if (question.getCtMode() == 1) {
|
||||
int count = dao.count(QuestionUserScore.class, Cnd.where("questionId", "=", questionId).and("userId", "=", ShiroUtil.getUserId()).and("answerDate", "=", currentDate));
|
||||
//时间过了
|
||||
if (Lang.isNotEmpty(currentDate) && DateUtil.parseDate(currentDate).isBefore(DateUtil.parseDate(DateUtil.today()))) {
|
||||
return Result.success(false);
|
||||
}
|
||||
return Result.success(count < question.getCanRepeatedAnswerNum());
|
||||
}
|
||||
}
|
||||
return Result.success(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取得分
|
||||
*
|
||||
* @param questionId
|
||||
* @param currentDate
|
||||
* @param randomCount
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
public Object getScore(String questionId,
|
||||
@Param(required = false, value = "currentDate") String currentDate,
|
||||
@Param(required = false, value = "randomCount") Integer randomCount) {
|
||||
Question question = dao.fetch(Question.class, questionId);
|
||||
|
||||
//每天的题目数量
|
||||
int issueCount = dao.count(Question_issue.class, Cnd.where("iqid", "=", questionId).and("displayDate", "=", DateUtil.format(new Date(), "yyyy-MM-dd")));
|
||||
if (question.getCtMode() == 1) {
|
||||
QuestionUserScore userScore = dao.fetch(QuestionUserScore.class, Cnd.where("questionId", "=", questionId)
|
||||
.and("userId", "=", ShiroUtil.getUserId())
|
||||
.and("displayDate", "=", currentDate)
|
||||
.desc(question.getCalcScoreMode() == 1 ? "score" : "answerNum"));
|
||||
return Result.success().addData(Optional.ofNullable(userScore).map(v -> v.getScore()).orElse(0));
|
||||
} else if (question.getCtMode() == 2) {
|
||||
DateTime startTime = DateUtil.date(question.getStartTime());
|
||||
DateTime endTime = DateUtil.date(question.getEndTime());
|
||||
long betweenDay = DateUtil.betweenDay(startTime, endTime, true);
|
||||
|
||||
//当前最大答题次数
|
||||
int maxCount = dao.func(QuestionAnswerUserScore.class, "max", "answerNum", Cnd.where("questionId", "=", questionId).and("userId", "=", ShiroUtil.getPrincipalProperty("id")));
|
||||
|
||||
//最大答题次数已经答了多少题
|
||||
int answerIssue = dao.count(QuestionAnswerUserScore.class, Cnd.where("questionId", "=", questionId).and("userId", "=", ShiroUtil.getPrincipalProperty("id")).and("answerNum", "=", maxCount));
|
||||
|
||||
//今天的题目已经答了几次
|
||||
int todayMaxCount = dao.func(QuestionAnswerUserScore.class, "max", "answerNum",
|
||||
Cnd.where("questionId", "=", questionId)
|
||||
.and("userId", "=", ShiroUtil.getPrincipalProperty("id"))
|
||||
.and("answerDate", "=", DateUtil.format(new Date(), "yyyy-MM-dd"))
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
if (question.getAnswerTotalSum() != 0 && maxCount < question.getAnswerTotalSum()) {
|
||||
//今天的题目需要全部答完
|
||||
|
||||
// //今天所有的题目
|
||||
// int todayAllIssues = dao.count(Question_issue.class, Cnd.where("iqid", "=", questionId).and("displayDate", "=", DateUtil.format(new Date(), "yyyy-MM-dd")));
|
||||
// //今天已经答了的题目
|
||||
// int todayHasAnswerIssues = dao.count(QuestionAnswerUserScore.class, Cnd.where("questionId", "=", questionId)
|
||||
// .and("userId", "=", ShiroUtil.getPrincipalProperty("id"))
|
||||
// .and("answerDate", "=", DateUtil.format(new Date(), "yyyy-MM-dd"))
|
||||
// .and("answerNum", "=", todayMaxCount)
|
||||
//
|
||||
// );
|
||||
|
||||
return Result.success(true);
|
||||
if (betweenDay == 0) {
|
||||
QuestionUserScore userScore = dao.fetch(QuestionUserScore.class, Cnd.where("questionId", "=", questionId)
|
||||
.and("userId", "=", ShiroUtil.getUserId())
|
||||
// .and("displayDate", "=", currentDate)
|
||||
.and("answerNum", "=", randomCount)
|
||||
.desc("answerNum"));
|
||||
return Result.success().addData(Optional.ofNullable(userScore).map(v -> v.getScore()).orElse(0));
|
||||
} else {
|
||||
QuestionUserScore userScore = dao.fetch(QuestionUserScore.class, Cnd.where("questionId", "=", questionId)
|
||||
.and("userId", "=", ShiroUtil.getUserId())
|
||||
.and("displayDate", "=", currentDate)
|
||||
.desc(question.getCalcScoreMode() == 1 ? "score" : "answerNum"));
|
||||
return Result.success().addData(Optional.ofNullable(userScore).map(v -> v.getScore()).orElse(0));
|
||||
}
|
||||
} else if (question.getCtMode() == 3) {
|
||||
QuestionUserScore userScore = dao.fetch(QuestionUserScore.class, Cnd.where("questionId", "=", questionId)
|
||||
.and("userId", "=", ShiroUtil.getUserId())
|
||||
.desc(question.getCalcScoreMode() == 1 ? "score" : "answerNum"));
|
||||
return Result.success().addData(Optional.ofNullable(userScore).map(v -> v.getScore()).orElse(0));
|
||||
}
|
||||
|
||||
if (question.getQrkdcs() != 0 && question.getQrkdcs() > todayMaxCount) {
|
||||
return Result.success(true);
|
||||
}
|
||||
|
||||
if (answerIssue < issueCount) {
|
||||
return Result.success(true);
|
||||
}
|
||||
|
||||
return Result.success(false);
|
||||
|
||||
// return Result.success(answerIssue < issueCount || (question.getQrkdcs() > 0 && question.getQrkdcs() > todayMaxCount));
|
||||
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At("/todayMaxScore")
|
||||
public Object todayMaxScore(String questionId) {
|
||||
List<QuestionUserScore> userScores = dao.query(QuestionUserScore.class, Cnd.where("questionId", "=", questionId)
|
||||
.and("userId", "=", ShiroUtil.getPrincipalProperty("id"))
|
||||
.and("answerDate", "=", DateUtil.format(new Date(), "yyyy-MM-dd")));
|
||||
|
||||
Map<Integer, Float> numScoreMap = userScores.stream().collect(Collectors.toMap(v -> v.getAnswerNum(), v -> v.getScore()));
|
||||
|
||||
// List<QuestionAnswerUserScore> list = dao.query(QuestionAnswerUserScore.class, Cnd.where("questionId", "=", questionId)
|
||||
// .and("userId", "=", ShiroUtil.getPrincipalProperty("id"))
|
||||
// .and("answerDate", "=", DateUtil.format(new Date(), "yyyy-MM-dd")));
|
||||
//
|
||||
// Map<Integer, Integer> numScoreMap = list.stream().collect(Collectors.groupingBy(v -> v.getAnswerNum(), Collectors.summingInt(v -> v.getSubjectScore())));
|
||||
return Result.success(numScoreMap);
|
||||
/**
|
||||
* 获取用户已回答的轮数 针对单天随机
|
||||
*
|
||||
* @param questionId 问卷ID
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
public Object getUserHasAnswerRandomNum(String questionId) {
|
||||
Question question = dao.fetch(Question.class, questionId);
|
||||
//判断是否为一天答题
|
||||
DateTime startTime = DateUtil.date(question.getStartTime());
|
||||
DateTime endTime = DateUtil.date(question.getEndTime());
|
||||
long betweenDay = DateUtil.betweenDay(startTime, endTime, true);
|
||||
if (question.getCtMode() == 2 && betweenDay == 0) {
|
||||
int count = dao.count(QuestionRandomIssue.class, Cnd.where("questionId", "=", questionId)
|
||||
.and("userId", "=", ShiroUtil.getUserId()));
|
||||
return Result.success().addData(count);
|
||||
}
|
||||
return Result.success().addData(0);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,273 +0,0 @@
|
||||
package io.v.nutz.question.controller;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.dao.CndPlus;
|
||||
import io.v.nutz.question.model.*;
|
||||
import io.v.nutz.question.service.QuestionService;
|
||||
import io.v.nutz.util.ShiroUtil;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.Daos;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 三峡答题
|
||||
*
|
||||
* @author jug
|
||||
* @date 2023/10/20
|
||||
*/
|
||||
@IocBean
|
||||
@At("/mobile/question/h5ctgu")
|
||||
@Ok("json:full")
|
||||
public class QuestionH5CtguController {
|
||||
|
||||
@Inject
|
||||
private QuestionService questionService;
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@At("/score")
|
||||
@Ok("beetl:/mobile/question/ctgu_answer/score.html")
|
||||
public void score() {
|
||||
|
||||
}
|
||||
|
||||
@At("/answerSheet")
|
||||
@Ok("beetl:/mobile/question/ctgu_answer/answerSheet.html")
|
||||
public void answerSheet(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 问卷信息
|
||||
*
|
||||
* @param id id
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At("/questionInfo/{id}")
|
||||
public Object questionInfo(@PathVariable String id) {
|
||||
Question question = questionService.fetch(id);
|
||||
dao.fetchLinks(question, "issues", Cnd.NEW().asc("ipxbh"));
|
||||
for (Question_issue issue : question.getIssues()) {
|
||||
questionService.fetchLinks(issue, "wors", Cnd.NEW().asc("wpxbh"));
|
||||
}
|
||||
// List<Question_issue> issues = question.getIssues();
|
||||
// Collections.shuffle(issues.subList(0,issues.size()));
|
||||
// Collections.shuffle(issues.subList(22,issues.size()));
|
||||
return Result.success(question);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存、提交答案
|
||||
*
|
||||
* @param replies
|
||||
* @param questionId
|
||||
* @param isSave
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Object saveAnswer(@Param("replies") NutMap[] replies, String questionId, Boolean isSave) {
|
||||
|
||||
dao.clear(Question_reply.class, Cnd.where("userId", "=", ShiroUtil.getUserId()).and("qid", "=", questionId));
|
||||
|
||||
List<Question_reply> replyList = new ArrayList<>();
|
||||
for (NutMap reply : replies) {
|
||||
for (String userSelect : reply.getList("userSelect", String.class)) {
|
||||
Question_reply questionReply = new Question_reply();
|
||||
questionReply.setRwid(userSelect);
|
||||
questionReply.setIssueId(reply.getString("issueId"));
|
||||
replyList.add(questionReply);
|
||||
}
|
||||
}
|
||||
|
||||
for (Question_reply questionReply : replyList) {
|
||||
questionReply.setQid(questionId);
|
||||
questionReply.setRtime(DateUtil.now());
|
||||
questionReply.setUserId(ShiroUtil.getUserId());
|
||||
questionReply.setSave(isSave);
|
||||
}
|
||||
|
||||
dao.insert(replyList);
|
||||
|
||||
if (!isSave) {
|
||||
//全部答完提交计算分数
|
||||
Sql answerSql = Sqls.create("SELECT count(DISTINCT issueId) as count FROM Question_reply WHERE qid=@questionId AND userId=@userId AND save=0");
|
||||
answerSql.setParam("questionId", questionId);
|
||||
answerSql.setParam("userId", ShiroUtil.getUserId());
|
||||
NutMap answerCountMap = (NutMap) Daos.query(dao, answerSql.toString(), Sqls.callback.map());
|
||||
int answerCount = answerCountMap.getInt("count", 0);
|
||||
|
||||
int issueCount = dao.count(Question_issue.class, Cnd.where("iqid", "=", questionId));
|
||||
|
||||
if (answerCount == issueCount) {
|
||||
insertQuestionAnswerScore2(null, questionId);
|
||||
}
|
||||
}
|
||||
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 回答信息
|
||||
*
|
||||
* @param id
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At("/answerInfo/?")
|
||||
public Object answerInfo(String id) {
|
||||
List<Question_reply> replies = questionService.dao().query(Question_reply.class, Cnd.where("qid", "=", id).and("userId", "=", ShiroUtil.getUserId()));
|
||||
return Result.success(replies);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查用户是否答完
|
||||
*
|
||||
* @param questionId
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At
|
||||
public Object checkUserFinishAnswer(String questionId) {
|
||||
Sql answerSql = Sqls.create("SELECT count(DISTINCT issueId) as count FROM Question_reply WHERE qid=@questionId AND userId=@userId AND save=0");
|
||||
answerSql.setParam("questionId", questionId);
|
||||
answerSql.setParam("userId", ShiroUtil.getUserId());
|
||||
NutMap answerCountMap = (NutMap) Daos.query(dao, answerSql.toString(), Sqls.callback.map());
|
||||
int answerCount = answerCountMap.getInt("count", 0);
|
||||
|
||||
// int answerCount = dao.count(Question_reply.class, Cnd.where("userId", "=", ShiroUtil.getUserId()).and("qid", "=", questionId).and("save", "=", 0));
|
||||
int issueCount = dao.count(Question_issue.class, Cnd.where("iqid", "=", questionId));
|
||||
return Result.success(answerCount == issueCount);
|
||||
}
|
||||
|
||||
@At
|
||||
public Object getScore(String questionId) {
|
||||
int fullScore = dao.func(Question_issue.class, "sum", "fraction", Cnd.where("iqid", "=", questionId));
|
||||
|
||||
//历史最高分
|
||||
Integer maxScore = dao.func(QuestionUserScore.class, "max", "score", Cnd.where("questionId", "=", questionId).and("userId", "=", ShiroUtil.getUserId()));
|
||||
|
||||
//当前得分
|
||||
Float score = dao.fetch(QuestionUserScore.class, Cnd.where("questionId", "=", questionId).and("userId", "=", ShiroUtil.getUserId()).desc("answerNum")).getScore();
|
||||
|
||||
//回答次数
|
||||
int answerCount = dao.count(QuestionUserScore.class, Cnd.where("questionId", "=", questionId).and("userId", "=", ShiroUtil.getUserId()));
|
||||
|
||||
String qtitle = dao.fetch(Question.class, questionId).getQtitle();
|
||||
Sql sql = Sqls.create("select username,loginname,sex,unitname,unionname from `user` where id = @id").setParam("id", ShiroUtil.getUserId());
|
||||
NutMap userMap = (NutMap) Daos.query(dao, sql.toString(), Sqls.callback.map());
|
||||
|
||||
NutMap map = NutMap.NEW();
|
||||
map.put("maxScore", maxScore);
|
||||
map.put("score", score);
|
||||
map.put("title", qtitle);
|
||||
map.put("user", userMap);
|
||||
map.put("answerCount", answerCount);
|
||||
|
||||
double percentage = (double) score / fullScore * 100;
|
||||
String message;
|
||||
|
||||
if (percentage >= 90) {
|
||||
message = "你真棒!这是一个优秀的成绩!";
|
||||
} else if (percentage >= 80) {
|
||||
message = "不错哦!你取得了一个良好的成绩!";
|
||||
} else if (percentage >= 70) {
|
||||
message = "还不错,继续努力,你可以取得更好的成绩!";
|
||||
} else if (percentage >= 60) {
|
||||
message = "及格了,但还有进步的空间,请继续努力!";
|
||||
} else {
|
||||
message = "很遗憾,你没有及格,但别灰心,下次会更好的!";
|
||||
}
|
||||
|
||||
map.put("message", message);
|
||||
return Result.success(map);
|
||||
}
|
||||
|
||||
@At("/canAnswer")
|
||||
public Object canAnswer(String questionId) {
|
||||
Question question = dao.fetch(Question.class, questionId);
|
||||
|
||||
//题目数量
|
||||
int issueCount = dao.count(Question_issue.class, Cnd.where("iqid", "=", questionId));
|
||||
|
||||
//当前最大答题次数
|
||||
int maxCount = dao.func(QuestionAnswerUserScore.class, "max", "answerNum", Cnd.where("questionId", "=", questionId).and("userId", "=", ShiroUtil.getUserId()));
|
||||
|
||||
//最大答题次数已经答了多少题
|
||||
int answerIssue = dao.count(QuestionAnswerUserScore.class, Cnd.where("questionId", "=", questionId).and("userId", "=", ShiroUtil.getUserId()).and("answerNum", "=", maxCount));
|
||||
|
||||
//今天的题目已经答了几次
|
||||
int todayMaxCount = dao.func(QuestionAnswerUserScore.class, "max", "answerNum", Cnd.where("questionId", "=", questionId).and("userId", "=", io.v.nutz.web.commons.utils.ShiroUtil.getPrincipalProperty("id")).and("answerDate", "=", DateUtil.format(new Date(), "yyyy-MM-dd")));
|
||||
|
||||
|
||||
if (question.getAnswerTotalSum() != 0 && maxCount < question.getAnswerTotalSum()) {
|
||||
return Result.success(true);
|
||||
}
|
||||
|
||||
if (question.getQrkdcs() != 0 && question.getQrkdcs() > todayMaxCount) {
|
||||
return Result.success(true);
|
||||
}
|
||||
|
||||
if (answerIssue < issueCount) {
|
||||
return Result.success(true);
|
||||
}
|
||||
return Result.success(false);
|
||||
}
|
||||
|
||||
private void insertQuestionAnswerScore2(List<Question_reply> replyList, String questionId) {
|
||||
int answerNum = dao.func(QuestionUserScore.class, "max", "answerNum", Cnd.where("questionId", "=", questionId).and("userId", "=", ShiroUtil.getUserId()));
|
||||
|
||||
//查询题目及选项信息
|
||||
List<Question_issue> issues = dao.query(Question_issue.class, Cnd.where("iqid", "=", questionId));
|
||||
dao.fetchLinks(issues, "wors");
|
||||
|
||||
// AtomicReference<Float> score = new AtomicReference<>();
|
||||
AtomicReference<Float> score = new AtomicReference<>((float) 0);
|
||||
|
||||
|
||||
List<Question_reply> replyIssues = dao.query(Question_reply.class, Cnd.where("userId", "=", io.v.nutz.web.commons.utils.ShiroUtil.getPrincipalProperty("id")).and("qid", "=", questionId));
|
||||
|
||||
//每题的回答记录
|
||||
Map<String, List<Question_reply>> issueReplies = replyIssues.stream().collect(Collectors.groupingBy(v -> v.getIssueId()));
|
||||
|
||||
issueReplies.forEach((k, v) -> {
|
||||
//用户回答的选项
|
||||
Set<String> userReplyOptionIds = v.stream().map(x -> x.getRwid()).collect(Collectors.toSet());
|
||||
|
||||
//正确的选项
|
||||
Set<String> correctOptionIds = issues.stream().filter(x -> x.getIid().equals(k)).findFirst().map(x -> x.getWors().stream().filter(c -> c.getCorrect() != null && c.getCorrect()).map(c -> c.getWid()).collect(Collectors.toSet())).orElse(null);
|
||||
|
||||
if (userReplyOptionIds.equals(correctOptionIds)) {
|
||||
//该题的分数
|
||||
double sum = issues.stream().filter(x -> x.getIid().equals(k)).mapToDouble(x -> x.getFraction() == null ? 0 : x.getFraction()).sum();
|
||||
// score.addAndGet(sum);
|
||||
score.updateAndGet(v1 -> (float) (v1 + sum));
|
||||
}
|
||||
});
|
||||
|
||||
QuestionUserScore questionUserScore = new QuestionUserScore();
|
||||
questionUserScore.setQuestionId(questionId);
|
||||
questionUserScore.setUserId(ShiroUtil.getUserId());
|
||||
questionUserScore.setAnswerDate(new Date());
|
||||
questionUserScore.setAnswerNum(answerNum + 1);
|
||||
questionUserScore.setScore(score.get());
|
||||
dao.insert(questionUserScore);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
package io.v.nutz.question.controller;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HtmlUtil;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.question.model.Question;
|
||||
import io.v.nutz.question.model.Question_issue;
|
||||
@@ -18,7 +19,7 @@ import io.v.nutz.question.service.QuestionWorService;
|
||||
import io.v.nutz.sys.models.Sys_task;
|
||||
import io.v.nutz.sys.services.SysTaskService;
|
||||
import io.v.nutz.task.services.TaskPlatformService;
|
||||
import io.v.nutz.util.ShiroUtil;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
@@ -30,18 +31,18 @@ import org.nutz.ioc.aop.Aop;
|
||||
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.Strings;
|
||||
import org.nutz.lang.random.R;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.POST;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -98,6 +99,7 @@ public class QuestionMangeController {
|
||||
sql.setCondition(cnd);
|
||||
return Result.success().addData(questionService.listPage(pageForm.getPageNumber(), pageForm.getPageSize(), sql));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
@@ -114,8 +116,6 @@ public class QuestionMangeController {
|
||||
@RequiresPermissions("question.mange")
|
||||
public Object upStatus(String qid, Integer flag) {
|
||||
try {
|
||||
Assert.notBlank(qid);
|
||||
Assert.notNull(flag);
|
||||
dao.update(Question.class, Chain.make("qflag", flag), Cnd.where("qid", "=", qid));
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
@@ -131,13 +131,23 @@ public class QuestionMangeController {
|
||||
public Object doAdd(@Param("question") Question question) {
|
||||
try {
|
||||
question.setQflag(1);
|
||||
question.setQctime(DateUtil.getDate());
|
||||
question.setQctime(DateUtil.now());
|
||||
question.setQcreator(ShiroUtil.getPrincipalProperty("id").toString());
|
||||
|
||||
//这里要额外判断下随机模式下的答题天数
|
||||
if (question.getQlx() == 2) {
|
||||
DateTime startTime = DateUtil.date(question.getStartTime());
|
||||
DateTime endTime = DateUtil.date(question.getEndTime());
|
||||
long betweenDay = DateUtil.betweenDay(startTime, endTime, true);
|
||||
if (betweenDay < 1) {
|
||||
//同一天
|
||||
question.setCanRepeatedAnswer(false);
|
||||
question.setCanRepeatedAnswerNum(null);
|
||||
}
|
||||
}
|
||||
|
||||
Question insert = questionService.insert(question);
|
||||
|
||||
int i = 1;
|
||||
|
||||
for (Question_issue issue : question.getIssues()) {
|
||||
issue.setIid(Strings.isNotBlank(issue.getIid()) ? issue.getIid() : R.UU32());
|
||||
issue.setIqid(insert.getQid());
|
||||
@@ -145,7 +155,6 @@ public class QuestionMangeController {
|
||||
if (question.getCtMode() == 2) {
|
||||
issue.setIpxbh(i);
|
||||
}
|
||||
|
||||
Question_issue issueInsert = questionIssueService.insert(issue);
|
||||
int j = 1;
|
||||
for (Question_wor wor : issue.getWors()) {
|
||||
@@ -157,9 +166,7 @@ public class QuestionMangeController {
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
raffleTask(question.getQid());
|
||||
|
||||
// raffleTask(question.getQid());
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -173,6 +180,17 @@ public class QuestionMangeController {
|
||||
@ViReturn
|
||||
@RequiresPermissions("question.mange")
|
||||
public Object doEdit(@Param("question") Question question) {
|
||||
//这里要额外判断下随机模式下的答题天数
|
||||
if (question.getQlx() == 2) {
|
||||
DateTime startTime = DateUtil.date(question.getStartTime());
|
||||
DateTime endTime = DateUtil.date(question.getEndTime());
|
||||
long betweenDay = DateUtil.betweenDay(startTime, endTime, true);
|
||||
if (betweenDay < 1) {
|
||||
//同一天
|
||||
question.setCanRepeatedAnswer(false);
|
||||
question.setCanRepeatedAnswerNum(null);
|
||||
}
|
||||
}
|
||||
questionService.update(question);
|
||||
|
||||
List<Question_issue> oldIssues = dao.query(Question_issue.class, Cnd.where("iqid", "=", question.getQid()));
|
||||
@@ -182,11 +200,9 @@ public class QuestionMangeController {
|
||||
for (int i = 0; i < issues.size(); i++) {
|
||||
Question_issue issue = issues.get(i);
|
||||
issue.setIqid(question.getQid());
|
||||
// if (question.getCtMode() == 2) {
|
||||
issue.setIpxbh(i + 1);
|
||||
// }
|
||||
System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
|
||||
System.out.println(Json.toJson(issue));
|
||||
if (question.getCtMode() == 2) {
|
||||
issue.setIpxbh(i + 1);
|
||||
}
|
||||
dao.insertOrUpdate(issue);
|
||||
List<Question_wor> wors = issue.getWors();
|
||||
for (int i1 = 0; i1 < wors.size(); i1++) {
|
||||
@@ -241,7 +257,7 @@ public class QuestionMangeController {
|
||||
|
||||
|
||||
/**
|
||||
* 删除文具按
|
||||
* 删除问卷
|
||||
*
|
||||
* @param qid qid
|
||||
* @return {@link Object}
|
||||
@@ -311,13 +327,23 @@ public class QuestionMangeController {
|
||||
@At("/modifyBasicInfo")
|
||||
@RequiresPermissions("question.mange")
|
||||
@ViReturn
|
||||
public Object modifyBasicInfo(Question question) {
|
||||
public Object modifyBasicInfo(@Param("question") Question question) {
|
||||
try {
|
||||
Assert.notNull(question);
|
||||
if (question.getQlx() == 2) {
|
||||
DateTime startTime = DateUtil.date(question.getStartTime());
|
||||
DateTime endTime = DateUtil.date(question.getEndTime());
|
||||
long betweenDay = DateUtil.betweenDay(startTime, endTime, true);
|
||||
if (betweenDay < 1) {
|
||||
//同一天
|
||||
question.setCanRepeatedAnswer(false);
|
||||
question.setCanRepeatedAnswerNum(null);
|
||||
}
|
||||
}
|
||||
if (StrUtil.isNotBlank(question.getQid())) {
|
||||
dao.updateIgnoreNull(question);
|
||||
} else {
|
||||
question.setQctime(cn.hutool.core.date.DateUtil.today());
|
||||
question.setQctime(DateUtil.today());
|
||||
question.setQcreator(ShiroUtil.getUserId());
|
||||
question.setQflag(1);
|
||||
dao.insert(question);
|
||||
@@ -373,7 +399,7 @@ public class QuestionMangeController {
|
||||
Question_issue issue = issueList.get(i);
|
||||
issue.setIqid(questionId);
|
||||
// if (question.getCtMode() == 2) {
|
||||
issue.setIpxbh(i + 1);
|
||||
issue.setIpxbh(i + 1);
|
||||
// }
|
||||
dao.insertOrUpdate(issue);
|
||||
List<Question_wor> wors = issue.getWors();
|
||||
@@ -418,41 +444,41 @@ public class QuestionMangeController {
|
||||
* @param questionId 问题id
|
||||
*/
|
||||
private void raffleTask(String questionId) {
|
||||
Question question = dao.fetch(Question.class, questionId);
|
||||
|
||||
//每天凌晨一点执行
|
||||
String cron = "0 0 1 * * ?";
|
||||
cron = "30 * * * * ? ";
|
||||
String cronData = Json.toJson(Map.of("questionId", questionId));
|
||||
//删除之前的任务再添加
|
||||
List<Sys_task> oldTasks = dao.query(Sys_task.class, Cnd.where("data", "like", "%" + questionId + "%"));
|
||||
for (Sys_task task : oldTasks) {
|
||||
taskPlatformService.delete(task.getId(), task.getId());
|
||||
sysTaskService.delete(task.getId());
|
||||
}
|
||||
|
||||
String jobClass = "io.v.nutz.task.job.question.QuestionRaffleJob";
|
||||
Sys_task task = sysTaskService.fetch(Cnd.where("jobClass", "=", jobClass).and("data", "=", cronData));
|
||||
|
||||
Question question = dao.fetch(Question.class, questionId);
|
||||
//需要抽奖
|
||||
if (question.getIsRaffle() != null && question.getIsRaffle()) {
|
||||
if (task != null) {
|
||||
|
||||
String dateFormat = "ss mm HH dd MM ? yyyy";
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
|
||||
|
||||
List<Question.RaffleRule> raffleRules = question.getRaffleRule();
|
||||
for (Question.RaffleRule raffleRule : raffleRules) {
|
||||
Date raffleTime = raffleRule.getRaffleTime();
|
||||
String formatTimeStr = sdf.format(raffleTime);
|
||||
|
||||
NutMap raffleRuleMap = Lang.obj2nutmap(raffleRule);
|
||||
raffleRuleMap.put("questionId", questionId);
|
||||
|
||||
String cronData = Json.toJson(raffleRuleMap);
|
||||
|
||||
Sys_task task = new Sys_task();
|
||||
task.setName(HtmlUtil.cleanHtmlTag(question.getQtitle()) + "问卷调查抽奖任务");
|
||||
task.setCron(cron);
|
||||
sysTaskService.updateIgnoreNull(task);
|
||||
if (taskPlatformService.isExist(task.getId(), task.getId())) {
|
||||
taskPlatformService.delete(task.getId(), task.getId());
|
||||
}
|
||||
} else {
|
||||
task = new Sys_task();
|
||||
task.setName(HtmlUtil.cleanHtmlTag(question.getQsm()) + "问卷调查抽奖任务");
|
||||
task.setJobClass(jobClass);
|
||||
task.setNote("问卷调查抽奖任务");
|
||||
task.setCron(cron);
|
||||
task.setCron(formatTimeStr);
|
||||
task.setData(cronData);
|
||||
task.setDisabled(false);
|
||||
sysTaskService.insert(task);
|
||||
}
|
||||
taskPlatformService.add(task.getId(), task.getId(), task.getJobClass(), task.getCron(),
|
||||
task.getNote(), task.getData());
|
||||
} else {
|
||||
if (task != null) {
|
||||
taskPlatformService.delete(task.getId(), task.getId());
|
||||
sysTaskService.delete(task.getId());
|
||||
taskPlatformService.add(task.getId(), task.getId(), task.getJobClass(), task.getCron(),
|
||||
task.getNote(), task.getData());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,6 @@ package io.v.nutz.question.controller;
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.hutool.http.HtmlUtil;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.base.utils.Html2Text;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
@@ -14,7 +12,6 @@ import io.v.nutz.question.service.QuestionIssueService;
|
||||
import io.v.nutz.question.service.QuestionReplyService;
|
||||
import io.v.nutz.question.service.QuestionService;
|
||||
import io.v.nutz.question.service.QuestionWorService;
|
||||
import io.v.nutz.sys.models.Sys_union;
|
||||
import lombok.Data;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
@@ -25,15 +22,12 @@ import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -75,17 +69,13 @@ public class QuestionPollAnalysisController {
|
||||
@Param("pageNumber") int pageNumber,
|
||||
@Param("pageSize") int pageSize) {
|
||||
try {
|
||||
Sql sql = Sqls.create("""
|
||||
select r.*,u.username,u.unionname,u.unitname,u.mobile from question_reply r left join `user` u on r.userId = u.id $condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("rwid", "=", wid);
|
||||
if (Strings.isNotBlank(searchKeyword)) {
|
||||
cnd.where().andLike("rval", searchKeyword);
|
||||
}
|
||||
cnd.desc("rtime");
|
||||
sql.setCondition(cnd);
|
||||
return Result.success().addData(questionReplyService.listPage(pageNumber, pageSize, sql));
|
||||
return Result.success().addData(questionReplyService.listPage(pageNumber, pageSize, cnd));
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
@@ -166,7 +156,6 @@ public class QuestionPollAnalysisController {
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@RequiresPermissions("question.pollAnalysis")
|
||||
public void doExport(@Param(value = "questionId",required = false) String questionId, HttpServletResponse response) {
|
||||
try {
|
||||
@@ -211,52 +200,6 @@ public class QuestionPollAnalysisController {
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@RequiresPermissions("question.pollAnalysis")
|
||||
public void doExportByUnion(@Param(value = "questionId",required = false) String questionId, HttpServletResponse response) throws IOException {
|
||||
//查询所有工会
|
||||
List<Sys_union> unionList = questionService.dao().query(Sys_union.class, Cnd.NEW());
|
||||
//查询所有答复
|
||||
Sql sql = Sqls.create("""
|
||||
select r.*,u.unionId,u.username,u.mobile from question_reply r left join `user` u on r.userId = u.id where r.qid = @qid and unionId is not null
|
||||
""").setParam("qid", questionId);
|
||||
List<NutMap> replyList = questionService.listMap(sql);
|
||||
//查询所有题目
|
||||
List<Question_issue> issueList = questionService.dao().query(Question_issue.class, Cnd.where("iqid", "=", questionId).asc("ipxbh"));
|
||||
|
||||
//设置第一行
|
||||
List<ExcelExportEntity> exportEntities = new ArrayList<>();
|
||||
exportEntities.add(new ExcelExportEntity("", "unionname", 30));
|
||||
for (int i = 0; i < issueList.size(); i++) {
|
||||
exportEntities.add(new ExcelExportEntity(HtmlUtil.cleanHtmlTag(issueList.get(i).getIname()), i + "", 30));
|
||||
}
|
||||
exportEntities.add(new ExcelExportEntity("填报人姓名", "username", 30));
|
||||
exportEntities.add(new ExcelExportEntity("填报人电话", "mobile", 30));
|
||||
|
||||
List<NutMap> result = new ArrayList<>();
|
||||
unionList.forEach(item -> {
|
||||
NutMap nutMap = new NutMap();
|
||||
nutMap.put("unionname", item.getUnionname());
|
||||
for (int i = 0; i < issueList.size(); i++) {
|
||||
int finalI = i;
|
||||
NutMap map = replyList.stream().filter(o -> o.getString("unionid").equals(item.getId()) && o.getString("issueId").equals(issueList.get(finalI).getIid())).findFirst().orElse(null);
|
||||
nutMap.put(i + "", map != null ? map.getString("rval") : "");
|
||||
nutMap.put("username", map != null ? map.getString("username") : "");
|
||||
nutMap.put("mobile", map != null ? map.getString("mobile") : "");
|
||||
}
|
||||
result.add(nutMap);
|
||||
});
|
||||
|
||||
Question question = questionService.fetch(questionId);
|
||||
String fileName = question.getQtitle() + "按分工会导出";
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + new String((fileName + ".xls").getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1));
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), exportEntities, result);
|
||||
workbook.write(response.getOutputStream());
|
||||
workbook.close();
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class ExportEntity {
|
||||
@Excel(name = "序号")
|
||||
|
||||
+20
-3
@@ -75,7 +75,24 @@ public class QuestionUnionIntentionalChoiceController {
|
||||
SELECT
|
||||
un.id unionId,
|
||||
un.unionName,
|
||||
(select count(1) from user where member = 1 and unionid = un.id) AS teacherSum,
|
||||
(select count(1) from "user" where member = 1 and unionid = un.id) AS teacherSum1,
|
||||
(
|
||||
select
|
||||
count(1)
|
||||
from
|
||||
activity_user_scope aus
|
||||
left join "user" u on u.id = aus.userId
|
||||
where
|
||||
groupId in (
|
||||
select
|
||||
activityUserScopeId
|
||||
from
|
||||
question
|
||||
where
|
||||
qid = @questionId
|
||||
)
|
||||
and u.unionId = un.id
|
||||
) as teacherSum,
|
||||
(
|
||||
SELECT
|
||||
count( DISTINCT r.userId )
|
||||
@@ -92,7 +109,7 @@ public class QuestionUnionIntentionalChoiceController {
|
||||
""").setParam("questionId", questionId);
|
||||
|
||||
CndPlus cndPlus = CndPlus.create();
|
||||
cndPlus.andExcludeEmpty("un.id", "=", unionId);
|
||||
cndPlus.andEX("un.id", "=", unionId);
|
||||
sql.setCondition(cndPlus);
|
||||
List<NutMap> unionList = questionService.listMap(sql);
|
||||
|
||||
@@ -253,7 +270,7 @@ public class QuestionUnionIntentionalChoiceController {
|
||||
$condition
|
||||
""").setParam("questionId", questionId);
|
||||
|
||||
cnd.andExcludeEmpty("u.unionid", "=", unionId);
|
||||
cnd.andEX("u.unionid", "=", unionId);
|
||||
cnd.groupBy("u.id");
|
||||
cnd.desc("u.unioncode");
|
||||
sql.setCondition(cnd);
|
||||
|
||||
@@ -4,6 +4,7 @@ import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -51,7 +52,7 @@ public class Question implements Serializable {
|
||||
|
||||
@Column
|
||||
@Comment("说明")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 2000)
|
||||
@ColDefine(customType = "text")
|
||||
private String qsm;
|
||||
|
||||
@Column
|
||||
@@ -69,11 +70,6 @@ public class Question implements Serializable {
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String qdtjssj;
|
||||
|
||||
@Column
|
||||
@Comment("活动时间内可答题总次数")
|
||||
@ColDefine(type = ColType.INT, width = 2)
|
||||
private Integer answerTotalSum;
|
||||
|
||||
@Many(field = "iqid")
|
||||
private List<Question_issue> issues;
|
||||
|
||||
@@ -100,16 +96,16 @@ public class Question implements Serializable {
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer ctMode;
|
||||
|
||||
@Column
|
||||
@Comment("单次出题数量")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer ctNum;
|
||||
|
||||
@Column
|
||||
@Comment("是否抽奖")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isRaffle;
|
||||
|
||||
@Column
|
||||
@Comment("抽奖时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
private Date raffleTime;
|
||||
|
||||
@Column
|
||||
@Comment("多少分可以抽奖")
|
||||
@ColDefine(type = ColType.INT)
|
||||
@@ -120,5 +116,59 @@ public class Question implements Serializable {
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer raffleWinnerUserNum;
|
||||
|
||||
@Column
|
||||
@Comment("题目顺序打乱")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean disruptingOrder;
|
||||
|
||||
@Column
|
||||
@Comment("随机单次出题数量")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer ranDomSingleIssueNum;
|
||||
|
||||
@Column
|
||||
@Comment("总共随机次数")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer ranDomSum;
|
||||
|
||||
@Column
|
||||
@Comment("是否多次答")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean canRepeatedAnswer;
|
||||
|
||||
@Column
|
||||
@Comment("多次答数")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer canRepeatedAnswerNum;
|
||||
|
||||
@Column
|
||||
@Comment("得分统计(重复答题允许下 1.保存最高分 2.保存最新得分)")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer calcScoreMode;
|
||||
|
||||
@Column
|
||||
@Comment("抽奖规则")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<RaffleRule> raffleRule;
|
||||
|
||||
/**
|
||||
* 抽奖规则
|
||||
*/
|
||||
@Data
|
||||
public static class RaffleRule {
|
||||
//开始答题时间
|
||||
private Date startAnswerDate;
|
||||
|
||||
//结束答题时间
|
||||
private Date endAnswerDate;
|
||||
|
||||
//抽奖时间
|
||||
private Date raffleTime;
|
||||
|
||||
//抽奖分数
|
||||
private Integer raffleScore;
|
||||
|
||||
//抽奖人数
|
||||
private Integer raffleWinnerUserNum;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,8 +34,8 @@ public class QuestionAnswerUserScore {
|
||||
|
||||
@Column
|
||||
@Comment("该题得分")
|
||||
@ColDefine(type = ColType.FLOAT)
|
||||
private Float subjectScore;
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer subjectScore;
|
||||
|
||||
@Column
|
||||
@Comment("用户id")
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
package io.v.nutz.question.model;
|
||||
|
||||
import io.v.nutz.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Comment("问卷随机题目")
|
||||
@Table
|
||||
public class QuestionRandomIssue extends BaseModel {
|
||||
|
||||
@Name
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("问卷的id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String questionId;
|
||||
|
||||
@Column
|
||||
@Comment("用户id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@Comment("题目")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<String> issueIds;
|
||||
|
||||
@Column
|
||||
@Comment("回答次数")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer num;
|
||||
|
||||
@Column
|
||||
@Comment("是否回答完成")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isFinish;
|
||||
|
||||
@Column
|
||||
@Comment("显示日期")
|
||||
@ColDefine(type = ColType.DATE)
|
||||
private Date displayDate;
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package io.v.nutz.question.model;
|
||||
|
||||
import io.v.nutz.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
@@ -12,9 +14,10 @@ import java.util.Date;
|
||||
* @author jug
|
||||
* @date 2023/06/20
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Table
|
||||
public class QuestionUserScore {
|
||||
public class QuestionUserScore extends BaseModel {
|
||||
|
||||
@Name
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@@ -28,8 +31,8 @@ public class QuestionUserScore {
|
||||
|
||||
@Column
|
||||
@Comment("得分")
|
||||
@ColDefine(type = ColType.FLOAT)
|
||||
private Float score;
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer score;
|
||||
|
||||
@Column
|
||||
@Comment("用户id")
|
||||
@@ -46,4 +49,13 @@ public class QuestionUserScore {
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer answerNum;
|
||||
|
||||
@Column
|
||||
@Comment("随机次数")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer randomNum;
|
||||
|
||||
@Column
|
||||
@Comment("显示日期(只针对定时定题)")
|
||||
@ColDefine(type = ColType.DATE)
|
||||
private Date displayDate;
|
||||
}
|
||||
|
||||
@@ -37,4 +37,9 @@ public class QuestionWinner {
|
||||
@ColDefine(type = ColType.DATE)
|
||||
private Date winDate;
|
||||
|
||||
@Column
|
||||
@Comment("分数")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer score;
|
||||
|
||||
}
|
||||
|
||||
@@ -101,8 +101,8 @@ public class Question_issue implements Serializable {
|
||||
@Column
|
||||
@Comment("该题分数")
|
||||
@J4EIgnore
|
||||
@ColDefine(type = ColType.FLOAT, width = 4, precision = 1)
|
||||
private Float fraction;
|
||||
@ColDefine(type = ColType.INT, width = 4)
|
||||
private Integer fraction;
|
||||
|
||||
@Column
|
||||
@Comment("显示日期")
|
||||
|
||||
@@ -5,6 +5,7 @@ import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.integration.json4excel.annotation.J4EIgnore;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
@@ -85,4 +86,6 @@ public class Question_reply implements Serializable {
|
||||
|
||||
@One(field = "rwid", key = "wid")
|
||||
private Question_wor wor;
|
||||
|
||||
private List<String> userSelect;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package io.v.nutz.question.service;
|
||||
|
||||
import io.v.nutz.base.page.Pagination;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.question.model.QuestionUserScore;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
/**
|
||||
* 得分
|
||||
*/
|
||||
public interface QuestionAnswerRankingService extends BaseService<QuestionUserScore> {
|
||||
|
||||
Pagination pageData(PageForm pageForm,
|
||||
String questionId,
|
||||
String unionId,
|
||||
String unitId,
|
||||
String answerDate);
|
||||
|
||||
void exportXlsx(String questionId, OutputStream os) throws IOException;
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package io.v.nutz.question.service;
|
||||
|
||||
|
||||
|
||||
import io.v.nutz.question.model.Question;
|
||||
import io.v.nutz.question.model.Question_reply;
|
||||
import io.v.nutz.service.ViService;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package io.v.nutz.question.service;
|
||||
|
||||
import io.v.nutz.question.model.Question;
|
||||
import io.v.nutz.question.model.Question_reply;
|
||||
import io.v.nutz.service.ViService;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
@@ -15,4 +16,29 @@ public interface QuestionService extends ViService<Question> {
|
||||
|
||||
NutMap getRankData(String qid);
|
||||
|
||||
|
||||
/**
|
||||
* 答题
|
||||
*
|
||||
* @param repliesArray 记录
|
||||
* @param questionId 问卷ID
|
||||
* @param isSave 是否保存
|
||||
*/
|
||||
void saveAnswer(Question_reply[] repliesArray, String questionId, Boolean isSave);
|
||||
|
||||
|
||||
/**
|
||||
* 是否同天 仅限随机
|
||||
* @param questionId 问卷ID
|
||||
* @return
|
||||
*/
|
||||
boolean isSameDay(String questionId);
|
||||
|
||||
/**
|
||||
* 是否同天 仅限随机
|
||||
* @param startTimeTs 开始时间
|
||||
* @param endTimeTs 结束时间
|
||||
* @return
|
||||
*/
|
||||
boolean isSameDay(long startTimeTs,long endTimeTs);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,422 @@
|
||||
package io.v.nutz.question.service.impl;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.base.page.Pagination;
|
||||
import io.v.nutz.base.service.impl.BaseServiceImpl;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.question.model.Question;
|
||||
import io.v.nutz.question.model.QuestionUserScore;
|
||||
import io.v.nutz.question.service.QuestionAnswerRankingService;
|
||||
import io.v.nutz.question.service.QuestionService;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
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.lang.util.NutMap;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class QuestionAnswerRankingServiceImpl extends BaseServiceImpl<QuestionUserScore> implements QuestionAnswerRankingService {
|
||||
public QuestionAnswerRankingServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Inject
|
||||
private QuestionService questionService;
|
||||
|
||||
@Override
|
||||
public Pagination pageData(PageForm pageForm, String questionId, String unionId, String unitId, String answerDate) {
|
||||
Question question = dao().fetch(Question.class, questionId);
|
||||
|
||||
if (question.getCtMode() == 1) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
qus.userId,
|
||||
DATE_FORMAT( qus.answerDate, '%Y-%m-%d' ) as answerDate,
|
||||
qus.score,
|
||||
qus.answerNum,
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.sex,
|
||||
u.unitname,
|
||||
u.unionname,
|
||||
u.mobile
|
||||
FROM
|
||||
question_user_score qus
|
||||
LEFT JOIN `user` u ON u.id = qus.userId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("qus.questionId", "=", questionId);
|
||||
cnd.andEX("u.unionid", "=", unionId);
|
||||
cnd.andEX("u.unitid", "=", unitId);
|
||||
cnd.andEX("qus.answerDate", "=", answerDate);
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(Cnd.exps("u.loginname", "like", "%" + pageForm.getSearchKeyword() + "%").or("u.username", "like", "%" + pageForm.getSearchKeyword() + "%"));
|
||||
}
|
||||
cnd.groupBy("qus.answerDate", "qus.userId");
|
||||
cnd.asc("qus.answerDate").asc("u.unionid").asc("u.id");
|
||||
if (question.getCalcScoreMode() == 1) {
|
||||
cnd.and("qus.score", "in", Sqls.create("select max(score) from question_user_score where userId = qus.userId and questionId = qus.questionId and answerDate = qus.answerDate"));
|
||||
} else if (question.getCalcScoreMode() == 2) {
|
||||
cnd.and("qus.answerNum", "in", Sqls.create("select max(answerNum) from question_user_score where userId = qus.userId and questionId = qus.questionId and answerDate = qus.answerDate"));
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
} else if (question.getCtMode() == 2) {
|
||||
if (questionService.isSameDay(question.getStartTime(), question.getEndTime())) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
GROUP_CONCAT( qus.answerNum, '(', qus.score, ')' ORDER BY qus.answerNum SEPARATOR ', ' ) AS everyRandomScore,
|
||||
sum( score ) AS score,
|
||||
qus.userId,
|
||||
DATE_FORMAT( qus.answerDate, '%Y-%m-%d' ) AS answerDate,
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.sex,
|
||||
u.unitname,
|
||||
u.unionname,
|
||||
u.mobile,
|
||||
q.ctMode,
|
||||
q.calcScoreMode
|
||||
FROM
|
||||
`question_user_score` qus
|
||||
LEFT JOIN `user` u ON u.id = qus.userId
|
||||
LEFT JOIN question q ON q.qid = qus.questionId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("qus.questionId", "=", questionId);
|
||||
cnd.andEX("u.unionid", "=", unionId);
|
||||
cnd.andEX("u.unitid", "=", unitId);
|
||||
cnd.andEX("qus.answerDate", "=", answerDate);
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(Cnd.exps("u.loginname", "like", "%" + pageForm.getSearchKeyword() + "%").or("u.username", "like", "%" + pageForm.getSearchKeyword() + "%"));
|
||||
}
|
||||
cnd.groupBy("qus.answerDate", "qus.userId");
|
||||
cnd.asc("qus.answerDate").asc("u.unionid").asc("u.id");
|
||||
sql.setCondition(cnd);
|
||||
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
} else {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
(
|
||||
SELECT
|
||||
score\s
|
||||
FROM
|
||||
question_user_score\s
|
||||
WHERE
|
||||
userId = qus.userId\s
|
||||
AND answerDate = qus.answerDate\s
|
||||
AND answerNum = max( qus.answerNum )\s
|
||||
AND questionId = qus.questionId
|
||||
) as lastAnswerNumScore,
|
||||
(
|
||||
SELECT
|
||||
score\s
|
||||
FROM
|
||||
question_user_score\s
|
||||
WHERE
|
||||
userId = qus.userId\s
|
||||
AND answerDate = qus.answerDate\s
|
||||
AND score = max( qus.score )\s
|
||||
AND questionId = qus.questionId
|
||||
) as maxAnswerScore,
|
||||
qus.userId,
|
||||
DATE_FORMAT( qus.answerDate, '%Y-%m-%d' ) AS answerDate,
|
||||
qus.answerNum,
|
||||
max( qus.answerNum ),
|
||||
min( qus.answerNum ),
|
||||
qus.score,
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.sex,
|
||||
u.unitname,
|
||||
u.unionname,
|
||||
u.mobile,
|
||||
q.ctMode,
|
||||
q.calcScoreMode
|
||||
FROM
|
||||
`question_user_score` qus
|
||||
LEFT JOIN `user` u ON u.id = qus.userId
|
||||
LEFT JOIN question q ON q.qid = qus.questionId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("qus.questionId", "=", questionId);
|
||||
cnd.andEX("u.unionid", "=", unionId);
|
||||
cnd.andEX("u.unitid", "=", unitId);
|
||||
cnd.andEX("qus.answerDate", "=", answerDate);
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(Cnd.exps("u.loginname", "like", "%" + pageForm.getSearchKeyword() + "%").or("u.username", "like", "%" + pageForm.getSearchKeyword() + "%"));
|
||||
}
|
||||
cnd.groupBy("qus.answerDate", "qus.userId");
|
||||
cnd.asc("qus.answerDate").asc("u.unionid").asc("u.id");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
List<NutMap> list = pagination.getList();
|
||||
for (NutMap map : list) {
|
||||
map.put("score", map.getInt(question.getCalcScoreMode() == 1 ? "maxAnswerScore" : "lastAnswerNumScore"));
|
||||
}
|
||||
return pagination;
|
||||
}
|
||||
} else if (question.getCtMode() == 3) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
qus.userId,
|
||||
DATE_FORMAT( qus.answerDate, '%Y-%m-%d' ) as answerDate,
|
||||
qus.score,
|
||||
qus.answerNum,
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.sex,
|
||||
u.unitname,
|
||||
u.unionname,
|
||||
u.mobile
|
||||
FROM
|
||||
question_user_score qus
|
||||
LEFT JOIN `user` u ON u.id = qus.userId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("qus.questionId", "=", questionId);
|
||||
cnd.andEX("u.unionid", "=", unionId);
|
||||
cnd.andEX("u.unitid", "=", unitId);
|
||||
cnd.andEX("qus.answerDate", "=", answerDate);
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(Cnd.exps("u.loginname", "like", "%" + pageForm.getSearchKeyword() + "%").or("u.username", "like", "%" + pageForm.getSearchKeyword() + "%"));
|
||||
}
|
||||
cnd.groupBy("qus.answerDate", "qus.userId");
|
||||
cnd.asc("qus.answerDate").asc("u.unionid").asc("u.id");
|
||||
if (question.getCalcScoreMode() == 1) {
|
||||
cnd.and("qus.score", "in", Sqls.create("select max(score) from question_user_score where userId = qus.userId and questionId = qus.questionId and answerDate = qus.answerDate"));
|
||||
} else if (question.getCalcScoreMode() == 2) {
|
||||
cnd.and("qus.answerNum", "in", Sqls.create("select max(answerNum) from question_user_score where userId = qus.userId and questionId = qus.questionId and answerDate = qus.answerDate"));
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
return new Pagination();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exportXlsx(String questionId, OutputStream os) throws IOException {
|
||||
Question question = dao().fetch(Question.class, questionId);
|
||||
|
||||
if (question.getCtMode() == 1) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
qus.userId,
|
||||
DATE_FORMAT( qus.answerDate, '%Y-%m-%d' ) as answerDate,
|
||||
qus.score,
|
||||
qus.answerNum,
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.sex,
|
||||
u.unitname,
|
||||
u.unionname,
|
||||
u.mobile
|
||||
FROM
|
||||
question_user_score qus
|
||||
LEFT JOIN `user` u ON u.id = qus.userId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("qus.questionId", "=", questionId);
|
||||
cnd.groupBy("qus.answerDate", "qus.userId");
|
||||
cnd.asc("qus.answerDate").asc("u.unionid").asc("u.id");
|
||||
if (question.getCalcScoreMode() == 1) {
|
||||
cnd.and("qus.score", "in", Sqls.create("select max(score) from question_user_score where userId = qus.userId and questionId = qus.questionId and answerDate = qus.answerDate"));
|
||||
} else if (question.getCalcScoreMode() == 2) {
|
||||
cnd.and("qus.answerNum", "in", Sqls.create("select max(answerNum) from question_user_score where userId = qus.userId and questionId = qus.questionId and answerDate = qus.answerDate"));
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = listMap(sql);
|
||||
List<ExcelExportEntity> exportEntities = new ArrayList<>();
|
||||
exportEntities.add(new ExcelExportEntity("工号", "loginname", 20));
|
||||
exportEntities.add(new ExcelExportEntity("姓名", "username", 20));
|
||||
exportEntities.add(new ExcelExportEntity("性别", "sex", 20));
|
||||
exportEntities.add(new ExcelExportEntity("所属单位", "unitname", 20));
|
||||
exportEntities.add(new ExcelExportEntity("所属工会", "unionname", 20));
|
||||
exportEntities.add(new ExcelExportEntity("联系方式", "mobile", 20));
|
||||
exportEntities.add(new ExcelExportEntity("分数", "score", 20));
|
||||
exportEntities.add(new ExcelExportEntity("答题日期", "answerDate", 20));
|
||||
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, exportEntities, list);
|
||||
workbook.write(os);
|
||||
|
||||
} else if (question.getCtMode() == 2) {
|
||||
if (questionService.isSameDay(question.getStartTime(), question.getEndTime())) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
GROUP_CONCAT( qus.answerNum, '(', qus.score, ')' ORDER BY qus.answerNum SEPARATOR ', ' ) AS everyRandomScore,
|
||||
sum( score ) AS score,
|
||||
qus.userId,
|
||||
DATE_FORMAT( qus.answerDate, '%Y-%m-%d' ) AS answerDate,
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.sex,
|
||||
u.unitname,
|
||||
u.unionname,
|
||||
u.mobile,
|
||||
q.ctMode,
|
||||
q.calcScoreMode
|
||||
FROM
|
||||
`question_user_score` qus
|
||||
LEFT JOIN `user` u ON u.id = qus.userId
|
||||
LEFT JOIN question q ON q.qid = qus.questionId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("qus.questionId", "=", questionId);
|
||||
cnd.groupBy("qus.answerDate", "qus.userId");
|
||||
cnd.asc("qus.answerDate").asc("u.unionid").asc("u.id");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = listMap(sql);
|
||||
|
||||
List<ExcelExportEntity> exportEntities = new ArrayList<>();
|
||||
exportEntities.add(new ExcelExportEntity("工号", "loginname", 20));
|
||||
exportEntities.add(new ExcelExportEntity("姓名", "username", 20));
|
||||
exportEntities.add(new ExcelExportEntity("性别", "sex", 20));
|
||||
exportEntities.add(new ExcelExportEntity("所属单位", "unitname", 20));
|
||||
exportEntities.add(new ExcelExportEntity("所属工会", "unionname", 20));
|
||||
exportEntities.add(new ExcelExportEntity("联系方式", "mobile", 20));
|
||||
exportEntities.add(new ExcelExportEntity("分数", "score", 20));
|
||||
exportEntities.add(new ExcelExportEntity("每轮分数", "everyRandomScore", 20));
|
||||
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, exportEntities, list);
|
||||
workbook.write(os);
|
||||
|
||||
} else {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
(
|
||||
SELECT
|
||||
score\s
|
||||
FROM
|
||||
question_user_score\s
|
||||
WHERE
|
||||
userId = qus.userId\s
|
||||
AND answerDate = qus.answerDate\s
|
||||
AND answerNum = max( qus.answerNum )\s
|
||||
AND questionId = qus.questionId
|
||||
) as lastAnswerNumScore,
|
||||
(
|
||||
SELECT
|
||||
score\s
|
||||
FROM
|
||||
question_user_score\s
|
||||
WHERE
|
||||
userId = qus.userId\s
|
||||
AND answerDate = qus.answerDate\s
|
||||
AND score = max( qus.score )\s
|
||||
AND questionId = qus.questionId
|
||||
) as maxAnswerScore,
|
||||
qus.userId,
|
||||
DATE_FORMAT( qus.answerDate, '%Y-%m-%d' ) AS answerDate,
|
||||
qus.answerNum,
|
||||
max( qus.answerNum ),
|
||||
min( qus.answerNum ),
|
||||
qus.score,
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.sex,
|
||||
u.unitname,
|
||||
u.unionname,
|
||||
u.mobile,
|
||||
q.ctMode,
|
||||
q.calcScoreMode
|
||||
FROM
|
||||
`question_user_score` qus
|
||||
LEFT JOIN `user` u ON u.id = qus.userId
|
||||
LEFT JOIN question q ON q.qid = qus.questionId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("qus.questionId", "=", questionId);
|
||||
|
||||
cnd.groupBy("qus.answerDate", "qus.userId");
|
||||
cnd.asc("qus.answerDate").asc("u.unionid").asc("u.id");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = listMap(sql);
|
||||
for (NutMap map : list) {
|
||||
map.put("score", map.getInt(question.getCalcScoreMode() == 1 ? "maxAnswerScore" : "lastAnswerNumScore"));
|
||||
}
|
||||
|
||||
List<ExcelExportEntity> exportEntities = new ArrayList<>();
|
||||
exportEntities.add(new ExcelExportEntity("工号", "loginname", 20));
|
||||
exportEntities.add(new ExcelExportEntity("姓名", "username", 20));
|
||||
exportEntities.add(new ExcelExportEntity("性别", "sex", 20));
|
||||
exportEntities.add(new ExcelExportEntity("所属单位", "unitname", 20));
|
||||
exportEntities.add(new ExcelExportEntity("所属工会", "unionname", 20));
|
||||
exportEntities.add(new ExcelExportEntity("联系方式", "mobile", 20));
|
||||
exportEntities.add(new ExcelExportEntity("分数", "score", 20));
|
||||
exportEntities.add(new ExcelExportEntity("答题日期", "answerDate", 20));
|
||||
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, exportEntities, list);
|
||||
workbook.write(os);
|
||||
}
|
||||
} else if (question.getCtMode() == 3) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
qus.userId,
|
||||
DATE_FORMAT( qus.answerDate, '%Y-%m-%d' ) as answerDate,
|
||||
qus.score,
|
||||
qus.answerNum,
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.sex,
|
||||
u.unitname,
|
||||
u.unionname,
|
||||
u.mobile
|
||||
FROM
|
||||
question_user_score qus
|
||||
LEFT JOIN `user` u ON u.id = qus.userId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("qus.questionId", "=", questionId);
|
||||
|
||||
cnd.groupBy("qus.answerDate", "qus.userId");
|
||||
cnd.asc("qus.answerDate").asc("u.unionid").asc("u.id");
|
||||
if (question.getCalcScoreMode() == 1) {
|
||||
cnd.and("qus.score", "in", Sqls.create("select max(score) from question_user_score where userId = qus.userId and questionId = qus.questionId and answerDate = qus.answerDate"));
|
||||
} else if (question.getCalcScoreMode() == 2) {
|
||||
cnd.and("qus.answerNum", "in", Sqls.create("select max(answerNum) from question_user_score where userId = qus.userId and questionId = qus.questionId and answerDate = qus.answerDate"));
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = listMap(sql);
|
||||
|
||||
List<ExcelExportEntity> exportEntities = new ArrayList<>();
|
||||
exportEntities.add(new ExcelExportEntity("工号", "loginname", 20));
|
||||
exportEntities.add(new ExcelExportEntity("姓名", "username", 20));
|
||||
exportEntities.add(new ExcelExportEntity("性别", "sex", 20));
|
||||
exportEntities.add(new ExcelExportEntity("所属单位", "unitname", 20));
|
||||
exportEntities.add(new ExcelExportEntity("所属工会", "unionname", 20));
|
||||
exportEntities.add(new ExcelExportEntity("联系方式", "mobile", 20));
|
||||
exportEntities.add(new ExcelExportEntity("分数", "score", 20));
|
||||
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, exportEntities, list);
|
||||
workbook.write(os);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -76,7 +76,7 @@ public class QuestionReplyServiceImpl extends ViServiceImpl<Question_reply> impl
|
||||
String wiid = questionWor.getWiid();
|
||||
|
||||
Question_issue subject = dao().fetch(Question_issue.class, Cnd.where("iid", "=", wiid));
|
||||
Float fraction = subject.getFraction();
|
||||
Integer fraction = subject.getFraction();
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
@@ -108,7 +108,7 @@ public class QuestionReplyServiceImpl extends ViServiceImpl<Question_reply> impl
|
||||
if (Arrays.equals(correctOptionIdArray, userSelectedOptionIdArray)) {
|
||||
answerUserScore.setSubjectScore(fraction);
|
||||
} else {
|
||||
answerUserScore.setSubjectScore(0f);
|
||||
answerUserScore.setSubjectScore(0);
|
||||
}
|
||||
dao().insert(answerUserScore);
|
||||
|
||||
|
||||
@@ -1,23 +1,33 @@
|
||||
package io.v.nutz.question.service.impl;
|
||||
|
||||
import io.v.nutz.question.model.Question;
|
||||
import io.v.nutz.question.model.Question_issue;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import io.v.nutz.question.model.*;
|
||||
import io.v.nutz.question.service.QuestionIssueService;
|
||||
import io.v.nutz.question.service.QuestionReplyService;
|
||||
import io.v.nutz.question.service.QuestionService;
|
||||
import io.v.nutz.question.service.QuestionWorService;
|
||||
import io.v.nutz.service.impl.ViServiceImpl;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.integration.jedis.RedisService;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
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.plugins.wkcache.annotation.CacheDefaults;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@IocBean(args = {"refer:dao"})
|
||||
@CacheDefaults(cacheName = "Zgfw_question")
|
||||
public class QuestionServiceImpl extends ViServiceImpl<Question> implements QuestionService {
|
||||
@@ -81,4 +91,176 @@ public class QuestionServiceImpl extends ViServiceImpl<Question> implements Ques
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void saveAnswer(Question_reply[] repliesArray, String questionId, Boolean isSave) {
|
||||
//删除上一次的答题记录
|
||||
//此处需判断 如果是有分多天 随机多次就要按条件删除
|
||||
|
||||
//问卷信息包含题目选项
|
||||
Question question = getQuestion(questionId);
|
||||
|
||||
if (question.getCtMode() == 1) {
|
||||
//删除今天的之前的答题记录
|
||||
dao().clear(Question_reply.class, Cnd.where("qid", "=", questionId).and("userId", "=", ShiroUtil.getUserId()).and("DATE(rtime)", "=", DateUtil.today()));
|
||||
} else if (question.getCtMode() == 2) {
|
||||
DateTime startTime = DateUtil.date(question.getStartTime());
|
||||
DateTime endTime = DateUtil.date(question.getEndTime());
|
||||
long betweenDay = DateUtil.betweenDay(startTime, endTime, true);
|
||||
if (betweenDay > 0) {
|
||||
//多天随机
|
||||
dao().clear(Question_reply.class, Cnd.where("qid", "=", questionId).and("userId", "=", ShiroUtil.getUserId()).and("DATE(rtime)", "=", DateUtil.today()));
|
||||
} else {
|
||||
//一天多次随机 删除保存的
|
||||
dao().clear(Question_reply.class, Cnd.where("qid", "=", questionId).and("userId", "=", ShiroUtil.getUserId()).and("DATE(rtime)", "=", DateUtil.today()).and("save", "=", 1));
|
||||
}
|
||||
} else if (question.getCtMode() == 3) {
|
||||
dao().clear(Question_reply.class, Cnd.where("qid", "=", questionId).and("userId", "=", ShiroUtil.getUserId()));
|
||||
}
|
||||
|
||||
List<Question_reply> replyList = new ArrayList<>();
|
||||
for (Question_reply reply : repliesArray) {
|
||||
if (Lang.isNotEmpty(reply.getUserSelect())) {
|
||||
for (String userSelect : reply.getUserSelect()) {
|
||||
Question_reply questionReply = new Question_reply();
|
||||
questionReply.setRwid(userSelect);
|
||||
questionReply.setIssueId(reply.getIssueId());
|
||||
questionReply.setUserId(ShiroUtil.getUserId());
|
||||
questionReply.setRtime(DateUtil.now());
|
||||
questionReply.setRwid(userSelect);
|
||||
questionReply.setQid(questionId);
|
||||
questionReply.setSave(isSave);
|
||||
replyList.add(questionReply);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
insert(replyList);
|
||||
|
||||
//判断是否提交 提交则计算此次分数
|
||||
|
||||
if (!isSave) {
|
||||
|
||||
//得分
|
||||
AtomicInteger sum = new AtomicInteger();
|
||||
|
||||
//常规模式计算全部题目的分数
|
||||
if (question.getCtMode() == 3) {
|
||||
//每题的回答记录
|
||||
List<Question_reply> replies = dao().query(Question_reply.class, Cnd.where("qid", "=", questionId).and("userId", "=", ShiroUtil.getUserId()).and("userId", "=", ShiroUtil.getUserId()));
|
||||
Map<String, List<Question_reply>> issueReplies = replies.stream().collect(Collectors.groupingBy(Question_reply::getIssueId));
|
||||
|
||||
issueReplies.forEach((k, v) -> {
|
||||
//用户回答的选项
|
||||
Set<String> userReplyOptionIds = v.stream().map(Question_reply::getRwid).collect(Collectors.toSet());
|
||||
//正确答案
|
||||
Optional<Question_issue> issueOptional = question.getIssues().stream().filter(x -> x.getIid().equals(k)).findFirst();
|
||||
Set<String> correctOptionIds = issueOptional.map(x -> x.getWors().stream().filter(c -> c.getCorrect() != null && c.getCorrect()).map(z -> z.getWid()).collect(Collectors.toSet())).orElse(null);
|
||||
if (userReplyOptionIds.equals(correctOptionIds)) {
|
||||
sum.addAndGet(issueOptional.map(i -> i.getFraction()).orElse(0));
|
||||
}
|
||||
});
|
||||
|
||||
//查询之前的回答记录
|
||||
int count = dao().count(QuestionUserScore.class, Cnd.where("questionId", "=", questionId).and("userId", "=", ShiroUtil.getUserId()));
|
||||
|
||||
QuestionUserScore questionUserScore = new QuestionUserScore();
|
||||
questionUserScore.setQuestionId(questionId);
|
||||
questionUserScore.setUserId(ShiroUtil.getUserId());
|
||||
questionUserScore.setAnswerDate(new Date());
|
||||
questionUserScore.setAnswerNum(count + 1);
|
||||
questionUserScore.setScore(sum.get());
|
||||
dao().insert(questionUserScore);
|
||||
} else if (question.getCtMode() == 1) {
|
||||
//每题的回答记录
|
||||
QuestionRandomIssue randomIssue = dao().fetch(QuestionRandomIssue.class, Cnd.where("questionId", "=", questionId).and("userId", "=", ShiroUtil.getUserId()).and("displayDate", "=", DateUtil.today()));
|
||||
List<String> issueIds = randomIssue.getIssueIds();
|
||||
List<Question_reply> replies = dao().query(Question_reply.class, Cnd.where("issueId", "in", issueIds).and("qid", "=", questionId).and("userId", "=", ShiroUtil.getUserId()));
|
||||
Map<String, List<Question_reply>> issueReplies = replies.stream().collect(Collectors.groupingBy(Question_reply::getIssueId));
|
||||
issueReplies.forEach((k, v) -> {
|
||||
//用户回答的选项
|
||||
Set<String> userReplyOptionIds = v.stream().map(Question_reply::getRwid).collect(Collectors.toSet());
|
||||
//正确答案
|
||||
Optional<Question_issue> issueOptional = question.getIssues().stream().filter(x -> x.getIid().equals(k)).findFirst();
|
||||
Set<String> correctOptionIds = issueOptional.map(x -> x.getWors().stream().filter(c -> c.getCorrect() != null && c.getCorrect()).map(z -> z.getWid()).collect(Collectors.toSet())).orElse(null);
|
||||
if (userReplyOptionIds.equals(correctOptionIds)) {
|
||||
sum.addAndGet(issueOptional.map(i -> i.getFraction()).orElse(0));
|
||||
}
|
||||
});
|
||||
|
||||
//查询之前的回答记录
|
||||
int count = dao().count(QuestionUserScore.class, Cnd.where("questionId", "=", questionId).and("userId", "=", ShiroUtil.getUserId()).and("displayDate", "=", DateUtil.today()));
|
||||
|
||||
QuestionUserScore questionUserScore = new QuestionUserScore();
|
||||
questionUserScore.setQuestionId(questionId);
|
||||
questionUserScore.setUserId(ShiroUtil.getUserId());
|
||||
questionUserScore.setAnswerDate(new Date());
|
||||
questionUserScore.setAnswerNum(count + 1);
|
||||
questionUserScore.setScore(sum.get());
|
||||
questionUserScore.setDisplayDate(DateUtil.parseDate(DateUtil.today()));
|
||||
dao().insert(questionUserScore);
|
||||
} else if (question.getCtMode() == 2) {
|
||||
|
||||
//每题的回答记录
|
||||
QuestionRandomIssue randomIssue = dao().fetch(QuestionRandomIssue.class, Cnd.where("questionId", "=", questionId).and("userId", "=", ShiroUtil.getUserId()).and("displayDate", "=", DateUtil.today()).desc("num"));
|
||||
List<String> issueIds = randomIssue.getIssueIds();
|
||||
List<Question_reply> replies = dao().query(Question_reply.class, Cnd.where("issueId", "in", issueIds).and("qid", "=", questionId).and("userId", "=", ShiroUtil.getUserId()));
|
||||
Map<String, List<Question_reply>> issueReplies = replies.stream().collect(Collectors.groupingBy(Question_reply::getIssueId));
|
||||
issueReplies.forEach((k, v) -> {
|
||||
//用户回答的选项
|
||||
Set<String> userReplyOptionIds = v.stream().map(Question_reply::getRwid).collect(Collectors.toSet());
|
||||
//正确答案
|
||||
Optional<Question_issue> issueOptional = question.getIssues().stream().filter(x -> x.getIid().equals(k)).findFirst();
|
||||
Set<String> correctOptionIds = issueOptional.map(x -> x.getWors().stream().filter(c -> c.getCorrect() != null && c.getCorrect()).map(z -> z.getWid()).collect(Collectors.toSet())).orElse(null);
|
||||
if (userReplyOptionIds.equals(correctOptionIds)) {
|
||||
sum.addAndGet(issueOptional.map(i -> i.getFraction()).orElse(0));
|
||||
}
|
||||
});
|
||||
|
||||
//同一天
|
||||
//查询之前的回答记录
|
||||
int count = dao().count(QuestionUserScore.class, Cnd.where("questionId", "=", questionId).and("userId", "=", ShiroUtil.getUserId()).and("displayDate", "=", DateUtil.today()));
|
||||
|
||||
QuestionUserScore questionUserScore = new QuestionUserScore();
|
||||
questionUserScore.setQuestionId(questionId);
|
||||
questionUserScore.setUserId(ShiroUtil.getUserId());
|
||||
questionUserScore.setAnswerDate(new Date());
|
||||
questionUserScore.setAnswerNum(count + 1);
|
||||
questionUserScore.setScore(sum.get());
|
||||
questionUserScore.setDisplayDate(DateUtil.parseDate(DateUtil.today()));
|
||||
dao().insert(questionUserScore);
|
||||
}
|
||||
|
||||
//随机题库设为已完成
|
||||
if (question.getCtMode() == 3) {
|
||||
//常规模式下不需要判断次数
|
||||
dao().update(QuestionRandomIssue.class, Chain.make("isFinish", 1), Cnd.where("questionId", "=", questionId).and("userId", "=", ShiroUtil.getUserId()));
|
||||
} else if (question.getCtMode() == 1) {
|
||||
//定时定题需要加上日期的条件
|
||||
dao().update(QuestionRandomIssue.class, Chain.make("isFinish", 1), Cnd.where("questionId", "=", questionId).and("userId", "=", ShiroUtil.getUserId()).and("displayDate", "=", DateUtil.today()));
|
||||
} else if (question.getCtMode() == 2) {
|
||||
//随机模式 要判断是否为同一天
|
||||
|
||||
QuestionRandomIssue randomIssue = dao().fetch(QuestionRandomIssue.class, Cnd.where("questionId", "=", questionId).and("userId", "=", ShiroUtil.getUserId()).and("displayDate", "=", DateUtil.today()).desc("num"));
|
||||
randomIssue.setIsFinish(true);
|
||||
dao().update(randomIssue, "isFinish");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSameDay(String questionId) {
|
||||
Question question = dao().fetch(Question.class, questionId);
|
||||
return isSameDay(question.getStartTime(), question.getEndTime());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSameDay(long startTimeTs, long endTimeTs) {
|
||||
DateTime startTime = DateUtil.date(startTimeTs);
|
||||
DateTime endTime = DateUtil.date(endTimeTs);
|
||||
long betweenDay = DateUtil.betweenDay(startTime, endTime, true);
|
||||
return betweenDay == 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,154 @@
|
||||
package io.v.nutz.task.question;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import io.v.nutz.question.model.Question;
|
||||
import io.v.nutz.question.model.QuestionUserScore;
|
||||
import io.v.nutz.question.model.QuestionWinner;
|
||||
import io.v.nutz.question.service.QuestionService;
|
||||
import io.v.nutz.sys.models.Sys_task;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobDataMap;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 问卷抽奖定时任务
|
||||
*
|
||||
* @author jug
|
||||
* @date 2023/06/12
|
||||
*/
|
||||
@IocBean
|
||||
public class QuestionRaffleJob implements Job {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private QuestionService questionService;
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||
JobDataMap data = context.getJobDetail().getJobDataMap();
|
||||
DateTime startAnswerDate = DateUtil.parseDateTime(data.getString("startAnswerDate"));
|
||||
DateTime endAnswerDate = DateUtil.parseDateTime(data.getString("endAnswerDate"));
|
||||
DateTime raffleTime = DateUtil.parseDate(data.getString("raffleTime"));
|
||||
//抽奖分数
|
||||
int raffleScore = data.getInt("raffleScore");
|
||||
//中奖者人数
|
||||
int raffleWinnerUserNum = data.getInt("raffleWinnerUserNum");
|
||||
//问卷id
|
||||
String questionId = data.getString("questionId");
|
||||
|
||||
Question question = dao.fetch(Question.class, questionId);
|
||||
|
||||
|
||||
//已中奖的用户
|
||||
List<QuestionWinner> winners = dao.query(QuestionWinner.class, Cnd.where("questionId", "=", questionId));
|
||||
List<String> hasWinnUserIds = winners.stream().map(v -> v.getUserId()).collect(Collectors.toList());
|
||||
|
||||
//得分记录
|
||||
List<QuestionUserScore> questionUserScores = dao.query(QuestionUserScore.class, Cnd.where("questionId", "=", questionId).andEX("userId", "not in", hasWinnUserIds));
|
||||
|
||||
//抽奖规则时间范围内的记录
|
||||
List<QuestionUserScore> thisTimeQuestionUserScores = questionUserScores.stream().filter(s -> startAnswerDate.isBeforeOrEquals(DateUtil.date(s.getCreatedAt())) && endAnswerDate.isAfter(DateUtil.date(s.getCreatedAt()))).collect(Collectors.toList());
|
||||
|
||||
//本次中奖用户
|
||||
List<String> winnerUserIds = new ArrayList<>();
|
||||
|
||||
//每个用户的分数
|
||||
List<NutMap> userScoreMap = new ArrayList<>();
|
||||
|
||||
if (question.getCtMode() == 1) {
|
||||
Map<String, List<QuestionUserScore>> userScoreListMap = thisTimeQuestionUserScores.stream().collect(Collectors.groupingBy(v -> v.getUserId()));
|
||||
userScoreListMap.forEach((userId, v) -> {
|
||||
Map<Date, List<QuestionUserScore>> userDayScoreListMap = v.stream().collect(Collectors.groupingBy(x -> x.getAnswerDate()));
|
||||
AtomicInteger sumScore = new AtomicInteger();
|
||||
userDayScoreListMap.forEach((day, v1) -> {
|
||||
if (question.getCalcScoreMode() == 1) {
|
||||
int score = v1.stream().mapToInt(s -> s.getScore()).max().orElse(0);
|
||||
sumScore.addAndGet(score);
|
||||
} else if (question.getCalcScoreMode() == 2) {
|
||||
int maxAnswerNum = v1.stream().mapToInt(s -> s.getAnswerNum()).max().orElse(1);
|
||||
Integer score = v1.stream().filter(s -> s.getAnswerNum() == maxAnswerNum).findFirst().map(s -> s.getScore()).orElse(0);
|
||||
sumScore.addAndGet(score);
|
||||
}
|
||||
});
|
||||
userScoreMap.add(NutMap.NEW().addv("userId", userId).addv("score", sumScore.get()));
|
||||
});
|
||||
} else if (question.getCtMode() == 2) {
|
||||
if (questionService.isSameDay(question.getStartTime(), question.getEndTime())) {
|
||||
thisTimeQuestionUserScores.stream().collect(Collectors.groupingBy(v -> v.getUserId(), Collectors.summingInt(v -> v.getScore()))).forEach((k, v) -> {
|
||||
userScoreMap.add(NutMap.NEW().addv("userId", k).addv("score", v));
|
||||
});
|
||||
} else {
|
||||
Map<String, List<QuestionUserScore>> userScoreListMap = thisTimeQuestionUserScores.stream().collect(Collectors.groupingBy(v -> v.getUserId()));
|
||||
userScoreListMap.forEach((userId, v) -> {
|
||||
Map<Date, List<QuestionUserScore>> userDayScoreListMap = v.stream().collect(Collectors.groupingBy(x -> x.getAnswerDate()));
|
||||
AtomicInteger sumScore = new AtomicInteger();
|
||||
userDayScoreListMap.forEach((day, v1) -> {
|
||||
if (question.getCalcScoreMode() == 1) {
|
||||
int score = v1.stream().mapToInt(s -> s.getScore()).max().orElse(0);
|
||||
sumScore.addAndGet(score);
|
||||
} else if (question.getCalcScoreMode() == 2) {
|
||||
int maxAnswerNum = v1.stream().mapToInt(s -> s.getAnswerNum()).max().orElse(1);
|
||||
Integer score = v1.stream().filter(s -> s.getAnswerNum() == maxAnswerNum).findFirst().map(s -> s.getScore()).orElse(0);
|
||||
sumScore.addAndGet(score);
|
||||
}
|
||||
});
|
||||
userScoreMap.add(NutMap.NEW().addv("userId", userId).addv("score", sumScore.get()));
|
||||
});
|
||||
}
|
||||
} else if (question.getCtMode() == 3) {
|
||||
Map<String, List<QuestionUserScore>> userScoreListMap = thisTimeQuestionUserScores.stream().collect(Collectors.groupingBy(v -> v.getUserId()));
|
||||
userScoreListMap.forEach((userId, v) -> {
|
||||
AtomicInteger sumScore = new AtomicInteger();
|
||||
if (question.getCalcScoreMode() == 1) {
|
||||
int score = v.stream().mapToInt(s -> s.getScore()).max().orElse(0);
|
||||
sumScore.addAndGet(score);
|
||||
} else if (question.getCalcScoreMode() == 2) {
|
||||
int maxAnswerNum = v.stream().mapToInt(s -> s.getAnswerNum()).max().orElse(1);
|
||||
Integer score = v.stream().filter(s -> s.getAnswerNum() == maxAnswerNum).findFirst().map(s -> s.getScore()).orElse(0);
|
||||
sumScore.addAndGet(score);
|
||||
}
|
||||
userScoreMap.add(NutMap.NEW().addv("userId", userId).addv("score", sumScore.get()));
|
||||
});
|
||||
}
|
||||
|
||||
//待抽奖用户
|
||||
List<String> readyRaffleUserId = userScoreMap.stream().filter(x -> x.getInt("score") >= raffleScore).map(v -> v.getString("userId")).collect(Collectors.toList());
|
||||
|
||||
// 随机打乱用户ID列表
|
||||
Collections.shuffle(readyRaffleUserId);
|
||||
|
||||
if (readyRaffleUserId.size() >= raffleWinnerUserNum) {
|
||||
winnerUserIds = readyRaffleUserId.subList(0, raffleWinnerUserNum);
|
||||
} else {
|
||||
winnerUserIds = readyRaffleUserId.subList(0, readyRaffleUserId.size());
|
||||
}
|
||||
|
||||
List<QuestionWinner> questionWinners = winnerUserIds.stream().map(v -> {
|
||||
QuestionWinner winner = new QuestionWinner();
|
||||
winner.setQuestionId(questionId);
|
||||
winner.setUserId(v);
|
||||
winner.setWinDate(new Date());
|
||||
Integer score = userScoreMap.stream().filter(x -> x.getString("userId").equals(v)).findFirst().map(x -> x.getInt("score", 0)).orElse(0);
|
||||
winner.setScore(score);
|
||||
return winner;
|
||||
}).collect(Collectors.toList());
|
||||
dao.insert(questionWinners);
|
||||
|
||||
dao.update(Sys_task.class, Chain.make("disabled", 1), Cnd.where("data", "like", "%" + raffleTime + "%").and("data", "like", "%" + questionId + "%"));
|
||||
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 86 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 68 KiB |
@@ -19,7 +19,8 @@ const initTableMixins = {
|
||||
totalCount: 0,
|
||||
pageOrderName: "",
|
||||
pageOrderBy: ""
|
||||
}
|
||||
},
|
||||
guavaIndex: 'index',
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
@@ -121,6 +122,15 @@ const initTableMixins = {
|
||||
title: '错误',
|
||||
message: msg
|
||||
});
|
||||
},
|
||||
toggleFullScreen() {
|
||||
if (!document.fullscreenElement) {
|
||||
document.documentElement.requestFullscreen();
|
||||
} else {
|
||||
if (document.exitFullscreen) {
|
||||
document.exitFullscreen();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,19 +75,19 @@ layout("/mobile/platform.html"){
|
||||
<div class="user_info">
|
||||
<van-row style="height: 200px">
|
||||
<van-image
|
||||
width="100%"
|
||||
height="200px"
|
||||
src="/back2.png"
|
||||
width="100%"
|
||||
></van-image>
|
||||
</van-row>
|
||||
|
||||
<van-row class="user_avatar" style="height: 80px">
|
||||
<van-col span="6" class="text-center">
|
||||
<van-col class="text-center" span="6">
|
||||
<van-image
|
||||
:src="avatar"
|
||||
height="70"
|
||||
round
|
||||
width="70"
|
||||
height="70"
|
||||
:src="avatar"
|
||||
></van-image>
|
||||
</van-col>
|
||||
<van-col span="18">
|
||||
@@ -99,7 +99,8 @@ layout("/mobile/platform.html"){
|
||||
${@shiro.getPrincipalProperty('loginname')}
|
||||
</span>
|
||||
</div>
|
||||
<div class="van-ellipsis" style="height: 40px;line-height: 40px;font-size: 14px;color: #969799">
|
||||
<div class="van-ellipsis"
|
||||
style="height: 40px;line-height: 40px;font-size: 14px;color: #969799">
|
||||
<!--#if(@shiro.getPrincipalProperty('union')!=null){#-->
|
||||
${@shiro.getPrincipalProperty('union').getUnionname()}
|
||||
<!--#}#-->
|
||||
@@ -109,23 +110,24 @@ layout("/mobile/platform.html"){
|
||||
</div>
|
||||
|
||||
<div v-if="paramType === '会员管理'">
|
||||
<div v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('public')||@shiro.hasRole('H01')}"
|
||||
class="van-sidebar-item van-sidebar-item--select">
|
||||
<div class="van-sidebar-item van-sidebar-item--select"
|
||||
v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('public')||@shiro.hasRole('H01')}">
|
||||
会员管理
|
||||
</div>
|
||||
<van-grid :column-num="3" :border="false">
|
||||
<van-grid-item v-if="${@shiro.hasRole('H01')}" url="/mobile/member/detail">
|
||||
<van-grid :border="false" :column-num="3">
|
||||
<van-grid-item url="/mobile/member/detail" v-if="${@shiro.hasRole('H01')}">
|
||||
<image src="/assets/mobile/icon/member/da.png"></image>
|
||||
<span class="icon_text"> 会员档案</span>
|
||||
</van-grid-item>
|
||||
|
||||
<van-grid-item v-if="${@shiro.lacksRole('H01')}" url="/mobile/member/apply">
|
||||
<van-grid-item url="/mobile/member/apply" v-if="${@shiro.lacksRole('H01')}">
|
||||
<image src="/assets/mobile/icon/member/apply.png"></image>
|
||||
<span class="icon_text"> 申请入会</span>
|
||||
</van-grid-item>
|
||||
|
||||
<van-grid-item v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('H04')||@shiro.hasRole('A06')}"
|
||||
url="/mobile/member/audit">
|
||||
<van-grid-item
|
||||
url="/mobile/member/audit"
|
||||
v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('H04')||@shiro.hasRole('A06')}">
|
||||
<image src="/assets/mobile/icon/member/audit.png"></image>
|
||||
<span class="icon_text"> 会员审核</span>
|
||||
</van-grid-item>
|
||||
@@ -145,32 +147,33 @@ layout("/mobile/platform.html"){
|
||||
民主管理
|
||||
</div>
|
||||
<van-grid
|
||||
v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('tamange')||@shiro.hasRole('jdhdbt01')||@shiro.hasRole('jdhdb01') || @shiro.hasRole('jdh12')}"
|
||||
:border="false" :column-num="3">
|
||||
<van-grid-item v-if="${@shiro.hasRole('jdhdb01')}"
|
||||
url="/platform/mobile/proposal/compose">
|
||||
:border="false"
|
||||
:column-num="3"
|
||||
v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('tamange')||@shiro.hasRole('jdhdbt01')||@shiro.hasRole('jdhdb01') || @shiro.hasRole('jdh12')}">
|
||||
<van-grid-item url="/platform/mobile/proposal/compose"
|
||||
v-if="${@shiro.hasRole('jdhdb01')}">
|
||||
<image src="/assets/mobile/icon/proposal/myProposal.png"></image>
|
||||
<span class="icon_text">个人提案阅览</span>
|
||||
</van-grid-item>
|
||||
<van-grid-item v-if="${@shiro.hasRole('jdhdb01')}"
|
||||
url="/platform/mobile/proposal/seconded">
|
||||
<van-grid-item url="/platform/mobile/proposal/seconded"
|
||||
v-if="${@shiro.hasRole('jdhdb01')}">
|
||||
<image src="/assets/mobile/icon/proposal/fy.png"></image>
|
||||
<span class="icon_text">附议提案</span>
|
||||
</van-grid-item>
|
||||
<van-grid-item
|
||||
v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('tamange')||@shiro.hasRole('jdhdbt01')}"
|
||||
url="/platform/mobile/proposal/delegation">
|
||||
<image style="width: 59px" src="/assets/mobile/icon/proposal/tz.png"></image>
|
||||
url="/platform/mobile/proposal/delegation"
|
||||
v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('tamange')||@shiro.hasRole('jdhdbt01')}">
|
||||
<image src="/assets/mobile/icon/proposal/tz.png" style="width: 59px"></image>
|
||||
<span class="icon_text">团长审议</span>
|
||||
</van-grid-item>
|
||||
<van-grid-item v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('tamange')}"
|
||||
url="/platform/mobile/proposal/integrated">
|
||||
<van-grid-item url="/platform/mobile/proposal/integrated"
|
||||
v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('tamange')}">
|
||||
<image src="/assets/mobile/icon/proposal/search.png"></image>
|
||||
<span class="icon_text">提案查询</span>
|
||||
</van-grid-item>
|
||||
|
||||
<van-grid-item v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('tamange')}"
|
||||
url="/mobile/proposal/delegate/index">
|
||||
<van-grid-item url="/mobile/proposal/delegate/index"
|
||||
v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('tamange')}">
|
||||
<image src="/assets/mobile/icon/proposal/cx.png"></image>
|
||||
<span class="icon_text">代表查询</span>
|
||||
</van-grid-item>
|
||||
@@ -284,6 +287,26 @@ layout("/mobile/platform.html"){
|
||||
</van-grid-item>
|
||||
</van-grid>
|
||||
</van-row>
|
||||
|
||||
<van-row v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('H01')}">
|
||||
<div class="van-sidebar-item van-sidebar-item--select">
|
||||
会议管理
|
||||
</div>
|
||||
<van-grid :border="false" :column-num="3">
|
||||
<van-grid-item url="/mobile/meeting/mine/myMeeting"
|
||||
v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('jdhdb01')||@shiro.hasRole('H01')}">
|
||||
<image src="/assets/mobile/icon/meeting/会议(我的会议).png"></image>
|
||||
<span class="icon_text">我的会议</span>
|
||||
</van-grid-item>
|
||||
<van-grid-item url="/mobile/meeting/audit"
|
||||
v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('jdhdbt01')}">
|
||||
<image src="/assets/mobile/icon/meeting/会议(会议审核).png"></image>
|
||||
<span class="icon_text">会议审核</span>
|
||||
</van-grid-item>
|
||||
</van-grid>
|
||||
</van-row>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div v-if="paramType === '福利慰问'">
|
||||
@@ -291,7 +314,8 @@ layout("/mobile/platform.html"){
|
||||
职工慰问
|
||||
</div>
|
||||
<van-grid :border="false" :column-num="3">
|
||||
<template v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('H04')||@shiro.hasRole('H01')}">
|
||||
<template
|
||||
v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('H04')||@shiro.hasRole('H01')}">
|
||||
<van-grid-item url="/mobile/condolence/apply/for">
|
||||
<image src="/assets/mobile/icon/condolence/apply.png"></image>
|
||||
<span class="icon_text">慰问申请</span>
|
||||
@@ -303,8 +327,8 @@ layout("/mobile/platform.html"){
|
||||
</van-grid-item>
|
||||
</template>
|
||||
<van-grid-item
|
||||
v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('H04')||@shiro.hasRole('A06')||@shiro.hasRole('xghkj')}"
|
||||
url="/mobile/condolence/audit">
|
||||
url="/mobile/condolence/audit"
|
||||
v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('H04')||@shiro.hasRole('A06')||@shiro.hasRole('xghkj')}">
|
||||
<image src="/assets/mobile/icon/condolence/audit.png"></image>
|
||||
<span class="icon_text">慰问审核</span>
|
||||
</van-grid-item>
|
||||
|
||||
@@ -0,0 +1,504 @@
|
||||
<!--#
|
||||
layout("/mobile/platform.html"){
|
||||
#-->
|
||||
|
||||
<style>
|
||||
|
||||
.van-index-bar__sidebar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.van-doc-card {
|
||||
margin: 14px;
|
||||
padding: 12px 12px 12px 12px;
|
||||
background-color: #fff;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 8px 12px #ebedf0;
|
||||
line-height: 20px;
|
||||
font-size: 13px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.van-divider {
|
||||
margin: 6px 0 6px 0px;
|
||||
border-color: lightgray;
|
||||
}
|
||||
|
||||
.van-button--small {
|
||||
border-radius: revert;
|
||||
width: 40%;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
.van-col {
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
.title_span {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
position: absolute;
|
||||
left: -1px;
|
||||
top: 11px;
|
||||
color: #1867b0;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 13px;
|
||||
font-weight: bold;
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.cus_overflow {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.showMore {
|
||||
color: #1867b0;
|
||||
}
|
||||
|
||||
.cus_popup {
|
||||
width: 70%;
|
||||
height: 50%;
|
||||
/*border-radius: 10px;*/
|
||||
padding: 10px 14px;
|
||||
font-size: 15px;
|
||||
/*background-color: #E5E7E9;
|
||||
background-image: url("https://www.transparenttextures.com/patterns/green-cup.png");*/
|
||||
}
|
||||
|
||||
.cus_icon {
|
||||
z-index: 10000;
|
||||
color: white;
|
||||
font-size: 35px;
|
||||
position: fixed;
|
||||
top: 81%;
|
||||
left: 44%;
|
||||
}
|
||||
|
||||
.userPopup {
|
||||
height: 80%;
|
||||
background-color: #f6f7f9;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.van-row div {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.firstName {
|
||||
width: 45px;
|
||||
background-color: lightgrey;
|
||||
border-radius: 45px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 24px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.content {
|
||||
height: 84%;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.van-dialog__header {
|
||||
padding-top: 8px;
|
||||
}
|
||||
|
||||
.van-dialog__confirm {
|
||||
color: #1867b0;
|
||||
}
|
||||
|
||||
.van-field__label {
|
||||
width: 5em;
|
||||
}
|
||||
|
||||
.cus_cell {
|
||||
padding: 4px 0px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.van-checkbox-group {
|
||||
max-height: 260px;
|
||||
overflow-y: auto;
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
.unit {
|
||||
display: inline-block;
|
||||
max-width: 160px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.cus_button {
|
||||
border-top-right-radius: 16px;
|
||||
border-bottom-left-radius: 16px;
|
||||
height: 26px;
|
||||
}
|
||||
|
||||
.audit_icon {
|
||||
font-size: 24px;
|
||||
position: absolute;
|
||||
font-weight: bolder;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.van-dropdown-menu__item {
|
||||
flex: auto;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="app" v-cloak>
|
||||
|
||||
<m-page-loading v-if="mLoading"></m-page-loading>
|
||||
|
||||
<!--top栏-->
|
||||
<van-nav-bar
|
||||
@click-left="history.go(-1)"
|
||||
fixed
|
||||
left-arrow
|
||||
placeholder
|
||||
safe-area-inset-top
|
||||
title="会议请假审核"
|
||||
></van-nav-bar>
|
||||
|
||||
<!--筛选框-->
|
||||
<div class="search-fixed">
|
||||
<van-search
|
||||
@search="doSearch"
|
||||
maxlength="10"
|
||||
placeholder="请输入会议名称、会议地点进行查询"
|
||||
shape="round"
|
||||
v-model="pageForm.searchKeyword"
|
||||
>
|
||||
</van-search>
|
||||
<van-dropdown-menu>
|
||||
<van-dropdown-item :options="meetingTimeList" @change="doSearch"
|
||||
v-model="pageForm.meetingTime"></van-dropdown-item>
|
||||
<van-dropdown-item :options="typeList" @change="doSearch"
|
||||
v-model="pageForm.typeId"></van-dropdown-item>
|
||||
</van-dropdown-menu>
|
||||
</div>
|
||||
|
||||
<!--列表-->
|
||||
<div style="margin-top: 116px">
|
||||
<van-list
|
||||
:finished="finished"
|
||||
:finished-text="tableData.length>0?'没有更多了':''" :immediate-check="false"
|
||||
@load="onLoad"
|
||||
v-model="loading">
|
||||
|
||||
<div class="van-doc-card" v-for="o in tableData">
|
||||
<div @click="openView(o.id, o.modulename)">
|
||||
|
||||
<div style="display: flex; justify-content: space-between">
|
||||
<div style="width: 70%">
|
||||
<div class="van-ellipsis title">
|
||||
<span class="title_span">|</span>
|
||||
<span>{{o.meetingname}}</span>
|
||||
</div>
|
||||
<div style="color: grey">{{o.location}}</div>
|
||||
</div>
|
||||
<div style="color: #1867b0;">
|
||||
{{o.meetingtypename}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="margin-top: 10px">
|
||||
<van-row>
|
||||
<span style="color: grey">会议时间:</span>
|
||||
{{o.starttime}}
|
||||
<!--<van-col span="12"><span style="color: grey">结束时间:</span></van-col>-->
|
||||
</van-row>
|
||||
<van-row>
|
||||
|
||||
<!--<van-col span="12">{{o.endtime}}</van-col>-->
|
||||
</van-row>
|
||||
</div>
|
||||
|
||||
<div style="display: flex; justify-content: space-between; margin-top: 8px;">
|
||||
<div class="cus_overflow" style="line-height: 20px; width: 83%">
|
||||
<span style="color: grey">会议描述:</span>
|
||||
{{o.meetingdescription}}
|
||||
</div>
|
||||
<span @click.stop="desc = o.meetingdescription; popupShow = true" class="showMore">查看更多</span>
|
||||
</div>
|
||||
|
||||
<van-divider></van-divider>
|
||||
|
||||
<div style="display: flex; justify-content: flex-end; margin-top: 4px">
|
||||
<div>
|
||||
<van-button @click.stop="getAuditList(o)" class="cus_button"
|
||||
color="#1867b0" size="small" style="margin-right: 8px; width: auto;"
|
||||
type="primary">已审{{o.audit}}
|
||||
</van-button>
|
||||
<van-button @click.stop="openView(o.id, o.modulename)" class="cus_button"
|
||||
color="#1867b0" size="small" style="margin-right: 8px; width: auto;"
|
||||
type="primary">未审{{o.no_audit}}
|
||||
</van-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</van-list>
|
||||
<van-empty
|
||||
class="custom-image"
|
||||
description="暂无数据"
|
||||
image="/none.svg"
|
||||
v-if="mLoading==false&&tableData.length==0"
|
||||
></van-empty>
|
||||
</div>
|
||||
|
||||
<!--弹出框-->
|
||||
<van-popup class="cus_popup" v-model:show="popupShow">
|
||||
<pre style="margin: 0; white-space: break-spaces">{{desc}}</pre>
|
||||
</van-popup>
|
||||
|
||||
<van-icon @click="popupShow = false" class="cus_icon" name="close" v-if="popupShow"></van-icon>
|
||||
|
||||
<!--审核人员-->
|
||||
<van-action-sheet :title="queryType === 'notAudit' ? '请假人员列表' : '请假人员列表'" @close="popClose" class="userPopup"
|
||||
v-model:show="userShow">
|
||||
<div class="content">
|
||||
<div class="van-doc-card" v-for="(item, i) in userList">
|
||||
<div style="display: flex; justify-content: space-between">
|
||||
<div style="width: 80%">
|
||||
<!--<span>{{moment(item.startTime).format('YYYY-MM-DD HH:mm') + ' ~ ' + moment(item.endTime).format('YYYY-MM-DD HH:mm')}}</span>-->
|
||||
<span>{{'会议时间:' + moment(item.startTime).format('YYYY-MM-DD HH:mm')}}</span>
|
||||
</div>
|
||||
<div v-if="queryType === 'notAudit'">
|
||||
<span @click="checkAll(i)">全选</span>
|
||||
<span @click="toggleAll(i)" style="margin-left: 4px">反选</span>
|
||||
</div>
|
||||
</div>
|
||||
<div style="margin-top: 4px">
|
||||
<van-row>
|
||||
<van-col span="24">
|
||||
会议名称:
|
||||
<van-tag size="medium" type="primary">{{item.timePeriodName}}</van-tag>
|
||||
</van-col>
|
||||
</van-row>
|
||||
</div>
|
||||
<van-checkbox-group ref="checkboxGroup" v-if="item.users !== null" v-model="result">
|
||||
<van-cell-group>
|
||||
<van-cell
|
||||
:key="obj.id"
|
||||
@click="toggle(i, index)" class="cus_cell"
|
||||
clickable
|
||||
v-for="(obj, index) in item.users">
|
||||
<span style="display: inline-block; width: 40px">{{obj.username}}</span>
|
||||
<span style="display: inline-block; width: 20px">{{obj.sex}}</span>
|
||||
<span style="display: inline-block; width: 60px">{{obj.loginname}}</span>
|
||||
<span class="unit">{{obj.unitname}}</span>
|
||||
<van-icon class="audit_icon" color="green" name="passed"
|
||||
v-if="queryType === 'hasAudit' && obj.auditState === true"></van-icon>
|
||||
<van-icon class="audit_icon" color="grey" name="close"
|
||||
v-if="queryType === 'hasAudit' && obj.auditState === false"></van-icon>
|
||||
<template #right-icon v-if="queryType === 'notAudit'">
|
||||
<van-checkbox :name="obj.id" ref="checkboxes"></van-checkbox>
|
||||
</template>
|
||||
</van-cell>
|
||||
</van-cell-group>
|
||||
</van-checkbox-group>
|
||||
<div style="margin-top: 4px; text-align: center" v-else>暂无请假人员</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div style="display: flex; justify-content: space-evenly; position: fixed; bottom: 56px; width: 95%"
|
||||
v-if="queryType === 'notAudit'">
|
||||
<van-button @click="audit('many', 'reject')" color="#ff976a" size="small" style="height: 38px">驳回
|
||||
</van-button>
|
||||
<van-button @click="audit('many', 'pass')" color="#1867b0" size="small" style="height: 38px">通过
|
||||
</van-button>
|
||||
</div>
|
||||
<div style="display: flex; justify-content: space-evenly; position: fixed; bottom: 10px; width: 95%"
|
||||
v-if="queryType === 'notAudit'">
|
||||
<van-button @click="audit('all', 'reject')" color="#ff976a" size="small" style="height: 38px">一键全部驳回
|
||||
</van-button>
|
||||
<van-button @click="audit('all', 'pass')" color="#1867b0" size="small" style="height: 38px">一键全部通过
|
||||
</van-button>
|
||||
</div>
|
||||
</div>
|
||||
</van-action-sheet>
|
||||
|
||||
<!--审核弹框-->
|
||||
<van-dialog @confirm="auditDo" show-cancel-button title="温馨提示" v-model:show="auditShow">
|
||||
<div style="padding-top: 8px; text-align: center; font-size: 14px; color: #646566">{{str}}</div>
|
||||
<van-divider style="margin: 12px 0 1px 0px;"></van-divider>
|
||||
<van-field
|
||||
autosize
|
||||
label="审核意见:"
|
||||
maxlength="50"
|
||||
placeholder="请输入审核意见"
|
||||
rows="2"
|
||||
show-word-limit
|
||||
type="textarea"
|
||||
v-model="reason"
|
||||
></van-field>
|
||||
</van-dialog>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<!--# include("/platform/meeting/includeJs/meetingUtil.js"){} #-->
|
||||
const meetUtil = new meetingUtil()
|
||||
const vue = new Vue({
|
||||
el: '#app',
|
||||
mixins: [mobileMixins],
|
||||
data() {
|
||||
return {
|
||||
desc: '',
|
||||
list: ['a', 'b'],
|
||||
result: [],
|
||||
reason: '',
|
||||
auditShow: false,
|
||||
popupShow: false,
|
||||
userShow: false,
|
||||
userList: [],
|
||||
userClickList: [],
|
||||
str: '',
|
||||
type: '',
|
||||
auditType: '',
|
||||
queryType: '',
|
||||
typeList: [],
|
||||
meetingTimeList: [{text: '全部时间', value: null}, {text: '即将开始', value: 0}, {text: '已结束', value: 1}],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async getAuditList(o) {
|
||||
this.queryType = 'hasAudit'
|
||||
const resp = await $.post('/mobile/meeting/audit/getLeaveUser', {
|
||||
meetingId: o.id,
|
||||
auditType: 'hasAudit',
|
||||
})
|
||||
if (resp.code === 0) {
|
||||
this.userList = resp.data
|
||||
this.userList.forEach(item => {
|
||||
if (item.users && item.users.length > 1) {
|
||||
item.users.sort((a, b) => {
|
||||
return b.auditState - a.auditState
|
||||
})
|
||||
}
|
||||
})
|
||||
this.userShow = true
|
||||
}
|
||||
},
|
||||
checkAll(i) {
|
||||
this.$refs.checkboxGroup[i].children.forEach(item => item.toggle(true))
|
||||
},
|
||||
toggleAll(i) {
|
||||
this.$refs.checkboxGroup[i].children.forEach(item => item.toggle())
|
||||
},
|
||||
toggle(i, index) {
|
||||
if (i > 0) {
|
||||
let length = 0
|
||||
for (let m = 0; m < i; m++) {
|
||||
length += this.userList[m].users.length
|
||||
}
|
||||
index = length + index
|
||||
}
|
||||
this.$refs.checkboxes[index].toggle();
|
||||
},
|
||||
async auditDo() {
|
||||
let idList = this.result
|
||||
if (this.type === 'all') {
|
||||
this.userList.forEach(item => {
|
||||
if (item.users !== null && item.users !== undefined) {
|
||||
idList = idList.concat(item.users.map(o => o.id))
|
||||
}
|
||||
})
|
||||
}
|
||||
const resp = await $.post('/mobile/meeting/audit/audit', {
|
||||
tpuIds: JSON.stringify(idList),
|
||||
auditOpinion: this.reason,
|
||||
isPass: this.auditType === 'pass'
|
||||
})
|
||||
if (resp.code === 0) {
|
||||
this.doSearch()
|
||||
}
|
||||
vant.Toast(resp.msg)
|
||||
this.userShow = false
|
||||
},
|
||||
audit(type, auditType) {
|
||||
this.type = type
|
||||
this.auditType = auditType
|
||||
if (type === 'many' && this.result.length === 0) {
|
||||
vant.Toast('请先选择人员')
|
||||
return
|
||||
}
|
||||
this.str = type === 'many' ? '您选择了' + this.result.length + '个人,请确认您的选择' : '您确定要一键全部审核吗?'
|
||||
this.reason = auditType === 'pass' ? '同意' : '拒绝'
|
||||
this.auditShow = true
|
||||
},
|
||||
async openView(id, modulename) {
|
||||
this.queryType = 'notAudit'
|
||||
this.userList = []
|
||||
const resp = await $.post('/mobile/meeting/audit/getLeaveUser', {
|
||||
meetingId: id,
|
||||
moduleName: modulename,
|
||||
auditType: 'canAudit',
|
||||
})
|
||||
if (resp.code === 0) {
|
||||
this.userList = resp.data
|
||||
this.userClickList = []
|
||||
if (this.userList.length === 0) {
|
||||
vant.Toast('暂无请假人员')
|
||||
} else {
|
||||
this.userShow = true
|
||||
}
|
||||
return
|
||||
}
|
||||
vant.Toast('系统错误,请联系管理员')
|
||||
},
|
||||
popClose() {
|
||||
this.$nextTick(function () {
|
||||
if (this.$refs.checkboxes !== undefined) {
|
||||
this.$refs.checkboxes.forEach(item => item.toggle(false));
|
||||
}
|
||||
})
|
||||
},
|
||||
doSearch() {
|
||||
this.pageForm.pageNumber = 1
|
||||
this.tableData = []
|
||||
this.finished = false
|
||||
this.onLoad()
|
||||
},
|
||||
async onLoad() {
|
||||
this.loading = true
|
||||
$.post('/mobile/meeting/audit/pageData', this.pageForm).then(res => {
|
||||
if (res.code === 0) {
|
||||
this.tableData = this.tableData.concat(res.data.list)
|
||||
if (this.tableData.length === res.data.totalCount) {
|
||||
this.finished = true
|
||||
} else {
|
||||
this.pageForm.pageNumber++
|
||||
}
|
||||
}
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
},
|
||||
async created() {
|
||||
this.typeList = await meetUtil.getAllMeetingType()
|
||||
this.typeList.unshift({text: '全部会议类型'})
|
||||
if (this.typeList && this.typeList.length > 0) {
|
||||
this.$set(this.pageForm, "typeId", this.typeList[0].value)
|
||||
}
|
||||
this.$set(this.pageForm, "meetingTime", this.meetingTimeList[1].value)
|
||||
this.onLoad()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -0,0 +1,532 @@
|
||||
<!--#
|
||||
layout("/mobile/platform.html"){
|
||||
#-->
|
||||
|
||||
<style>
|
||||
|
||||
.van-index-bar__sidebar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.van-doc-card {
|
||||
margin: 14px;
|
||||
padding: 12px 12px 12px 12px;
|
||||
background-color: #fff;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 8px 12px #ebedf0;
|
||||
line-height: 20px;
|
||||
font-size: 13px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.van-divider {
|
||||
margin: 6px 0 6px 0px;
|
||||
border-color: lightgray;
|
||||
}
|
||||
|
||||
.van-button--small {
|
||||
border-top-right-radius: 16px;
|
||||
border-bottom-left-radius: 16px;
|
||||
height: 26px;
|
||||
}
|
||||
|
||||
.van-col {
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
.title_span {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
position: absolute;
|
||||
left: -1px;
|
||||
top: 11px;
|
||||
color: #1867b0;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 13px;
|
||||
font-weight: bold;
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.cus_overflow {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.showMore {
|
||||
color: #1867b0;
|
||||
}
|
||||
|
||||
.cus_popup {
|
||||
width: 70%;
|
||||
height: 50%;
|
||||
/*border-radius: 10px;*/
|
||||
padding: 10px 14px;
|
||||
font-size: 15px;
|
||||
/*background-color: #E5E7E9;
|
||||
background-image: url("https://www.transparenttextures.com/patterns/green-cup.png");*/
|
||||
}
|
||||
|
||||
.cus_icon {
|
||||
z-index: 10000;
|
||||
color: white;
|
||||
font-size: 35px;
|
||||
position: fixed;
|
||||
top: 81%;
|
||||
left: 44%;
|
||||
}
|
||||
|
||||
.van-dropdown-menu__item {
|
||||
flex: auto;
|
||||
}
|
||||
|
||||
.leave_pop {
|
||||
height: 80%;
|
||||
background-color: #f6f7f9;
|
||||
}
|
||||
|
||||
.content {
|
||||
height: 82%;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.van-field__label {
|
||||
width: 4.6em;
|
||||
}
|
||||
|
||||
.checkDiv {
|
||||
font-size: 33px;
|
||||
color: #1867b0;
|
||||
position: absolute;
|
||||
right: 4px;
|
||||
top: 30px;
|
||||
}
|
||||
|
||||
.auditState {
|
||||
position: absolute;
|
||||
right: -10px;
|
||||
top: -3px;
|
||||
border-radius: 4px;
|
||||
padding: 1px 8px;
|
||||
border: 1px #1867b0 solid;
|
||||
background: #1867b0;
|
||||
opacity: 0.6;
|
||||
color: white;
|
||||
transform: skewY(5deg);
|
||||
}
|
||||
|
||||
.van-field--min-height .van-field__control {
|
||||
min-height: auto;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.border_div {
|
||||
width: 33px;
|
||||
height: 33px;
|
||||
border: 1px lightgrey solid;
|
||||
border-radius: 14px;
|
||||
position: absolute;
|
||||
right: 4px;
|
||||
top: 28px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div id="app" v-cloak>
|
||||
|
||||
<m-page-loading v-if="mLoading"></m-page-loading>
|
||||
|
||||
<!--top栏-->
|
||||
<van-nav-bar
|
||||
@click-left="history.go(-1)"
|
||||
fixed
|
||||
left-arrow
|
||||
placeholder
|
||||
safe-area-inset-top
|
||||
title="我的会议"
|
||||
></van-nav-bar>
|
||||
|
||||
<!--筛选框-->
|
||||
<div class="search-fixed">
|
||||
<van-search
|
||||
@search="doSearch"
|
||||
maxlength="10"
|
||||
placeholder="请输入会议名称、会议地点进行查询"
|
||||
shape="round"
|
||||
v-model="pageForm.searchKeyWord"
|
||||
>
|
||||
</van-search>
|
||||
|
||||
<van-dropdown-menu>
|
||||
<van-dropdown-item :options="meetingList" @change="doSearch"
|
||||
v-model="pageForm.tabNameIndex"></van-dropdown-item>
|
||||
<van-dropdown-item :options="meetingTimeList" @change="doSearch"
|
||||
v-model="pageForm.meetingTime"></van-dropdown-item>
|
||||
<van-dropdown-item :options="typeList" @change="doSearch"
|
||||
v-model="pageForm.typeId"></van-dropdown-item>
|
||||
</van-dropdown-menu>
|
||||
</div>
|
||||
|
||||
<!--列表-->
|
||||
<div style="margin-top: 116px">
|
||||
<van-list
|
||||
:finished="finished"
|
||||
:finished-text="tableData.length>0?'没有更多了':''" :immediate-check="false"
|
||||
@load="onLoad"
|
||||
v-model="loading"
|
||||
>
|
||||
|
||||
<div class="van-doc-card" v-for="o in tableData">
|
||||
<div @click="openView(o.id)">
|
||||
|
||||
<div style="display: flex; justify-content: space-between">
|
||||
<div style="width: 74%">
|
||||
<div class="van-ellipsis title">
|
||||
<span class="title_span">|</span>
|
||||
<span>{{o.meetingName}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div style="color: #1867b0; white-space: nowrap;">
|
||||
{{o.meetingTypeName}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="margin-top: 10px">
|
||||
<van-row>
|
||||
<span style="color: grey">会议地点:</span>
|
||||
{{o.location}}
|
||||
</van-row>
|
||||
</div>
|
||||
|
||||
<div style="margin-top: 10px">
|
||||
<van-row>
|
||||
<span style="color: grey">会议时间:</span>
|
||||
{{o.startTime}}
|
||||
<!--<van-col span="12"><span style="color: grey">结束时间:</span></van-col>-->
|
||||
</van-row>
|
||||
<van-row>
|
||||
<!--<van-col span="12">{{o.endTime}}</van-col>-->
|
||||
</van-row>
|
||||
</div>
|
||||
|
||||
<div style="display: flex; justify-content: space-between; margin-top: 8px">
|
||||
<div class="cus_overflow" style="line-height: 20px; width: 83%">
|
||||
<span style="color: grey">会议描述:</span>
|
||||
{{o.meetingDescription}}
|
||||
</div>
|
||||
<span @click.stop="popupShow = true; clickRow = o"
|
||||
class="showMore">查看更多</span>
|
||||
</div>
|
||||
|
||||
<van-divider></van-divider>
|
||||
|
||||
<div style="display: flex; justify-content: flex-end">
|
||||
<!--<div style="display: flex; align-items: center">
|
||||
<span style="color: grey">审核状态:</span>
|
||||
<span :style="'color: ' + o.stateColor">{{o.stateName}}</span>
|
||||
</div>-->
|
||||
<div>
|
||||
<!--<van-button @click="needLeave(o)" v-if="o.isCanLeave === null && o.isJoin === null"
|
||||
type="primary" size="small" color="#1867b0" style="margin-right: 8px">我要请假</van-button>
|
||||
<van-button v-if="o.isJoin === false" size="small" disabled color="grey" style="margin-right: 8px">已请假</van-button>
|
||||
<van-button type="primary" v-if="o.isJoin !== false" size="small" color="#1867b0">我要签到</van-button>
|
||||
<van-button v-if="o.isJoin === true" size="small" disabled color="grey">已签到</van-button>-->
|
||||
<van-button
|
||||
:disabled="moment().valueOf() > moment(o.leaveDeadline).valueOf() || o.isCanLeave === false"
|
||||
@click="needLeave(o, false)"
|
||||
color="#1867b0" size="small" style="margin-right: 8px"
|
||||
type="primary">查看请假状态
|
||||
</van-button>
|
||||
<van-button
|
||||
:disabled="moment().valueOf() > moment(o.leaveDeadline).valueOf() || o.isCanLeave === false"
|
||||
@click="needLeave(o, true)"
|
||||
color="#1867b0" size="small" style="margin-right: 8px"
|
||||
type="primary">我要请假
|
||||
</van-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</van-list>
|
||||
<van-empty
|
||||
class="custom-image"
|
||||
description="暂无数据"
|
||||
image="/none.svg"
|
||||
v-if="mLoading==false&&tableData.length==0"
|
||||
></van-empty>
|
||||
</div>
|
||||
|
||||
<!--弹出框-->
|
||||
<van-popup class="cus_popup" v-model:show="popupShow">
|
||||
<pre style="margin: 0; white-space: break-spaces; line-height: 28px">{{clickRow.meetingDescription}}</pre>
|
||||
</van-popup>
|
||||
|
||||
<van-icon @click="popupShow = false" class="cus_icon" name="close" v-if="popupShow"></van-icon>
|
||||
|
||||
<!--请假弹框-->
|
||||
<van-action-sheet class="leave_pop" title="会议信息" v-model="leaveShow">
|
||||
<div v-if="flag === true"
|
||||
style="padding: 0px 0px 10px 0px; text-align: center; font-size: 14px; color: #646566">
|
||||
请<span style="color: red">点击选择</span>请假时间段,填写请假原因
|
||||
</div>
|
||||
<div class="content">
|
||||
|
||||
<div class="van-doc-card" v-for="(item, index) in timeList">
|
||||
<div>
|
||||
<div><span style="color: grey">会议名称:</span>{{item.timePeriodName}}</div>
|
||||
</div>
|
||||
<div @click="leaveClick(item, index)"
|
||||
style="display: flex; justify-content: space-between">
|
||||
<div>
|
||||
<div>
|
||||
<span style="color: grey">会议时间:</span>
|
||||
{{moment(item.startTime).format('YYYY-MM-DD HH:mm')}}
|
||||
</div>
|
||||
<!--<div><span style="color: grey">结束时间:</span>{{moment(item.endTime).format('YYYY-MM-DD HH:mm')}}</div>-->
|
||||
</div>
|
||||
<div>
|
||||
<div v-if="flag === true" class="border_div"></div>
|
||||
<van-icon v-if="flag === true" :class="'checkDiv checkDiv' + index"
|
||||
name="success" style="display: none;"></van-icon>
|
||||
<span class="auditState"
|
||||
v-if="item.isJoin === false">{{item.stateName}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="item.isJoin === false">
|
||||
<div><span style="color: grey">审核状态:</span>{{item.stateName}}</div>
|
||||
</div>
|
||||
<div>
|
||||
<span style="float: left; color: grey">请假原因:</span>
|
||||
<van-field :disabled="item.isJoin === false" placeholder="请输入请假原因" rows="1"
|
||||
style="font-size: 12px; padding: 0; width: 70%; line-height: 20px"
|
||||
type="textarea" autosize
|
||||
v-model="item.leaveReason"></van-field>
|
||||
</div>
|
||||
<div v-if="flag === false && item.stateCode === clickRow.firstState && item.stateAuditType !== 1"
|
||||
style="text-align: right">
|
||||
<van-button @click.stop="cancelLeave(item)" border color="#1867b0" size="small">
|
||||
取消请假
|
||||
</van-button>
|
||||
</div>
|
||||
<div v-if="flag === false && item.stateAuditType === 1" style="text-align: right">
|
||||
<van-button @click.stop="refreshApply(item)" border color="#1867b0"
|
||||
size="small">重新申请
|
||||
</van-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="flag === true">
|
||||
<div style="display: flex; justify-content: space-evenly; position: fixed; bottom: 20px; width: 100%">
|
||||
<van-button @click="leaveShow = false" color="lightgrey" size="small"
|
||||
style="width: 40%; border-radius: revert; height: 38px">取消
|
||||
</van-button>
|
||||
<van-button @click="leave" color="#1867b0" size="small"
|
||||
style="width: 40%; border-radius: revert; height: 38px">确定
|
||||
</van-button>
|
||||
</div>
|
||||
</div>
|
||||
</van-action-sheet>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<!--# include("/platform/meeting/includeJs/meetingUtil.js"){} #-->
|
||||
const meetUtil = new meetingUtil()
|
||||
const vue = new Vue({
|
||||
el: '#app',
|
||||
mixins: [mobileMixins],
|
||||
data() {
|
||||
return {
|
||||
timeList: [],
|
||||
checked: [],
|
||||
checkboxRefs: [],
|
||||
leaveReason: '',
|
||||
leaveShow: false,
|
||||
popupShow: false,
|
||||
tabNameIndex: 0,
|
||||
clickRow: {},
|
||||
meetingList: [{text: '全部', value: '0'}, {text: '我参与的', value: '1'}, {
|
||||
text: '我请假的',
|
||||
value: '2'
|
||||
}],
|
||||
typeList: [],
|
||||
meetingTimeList: [{text: '全部时间', value: null}, {
|
||||
text: '即将开始',
|
||||
value: 0
|
||||
}, {text: '已结束', value: 1}],
|
||||
flag: true,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
refreshApply(o) {
|
||||
vant.Dialog.confirm({
|
||||
title: '温馨提示',
|
||||
message: '您确定要重新申请吗?',
|
||||
}).then(async () => {
|
||||
await this.needLeave(this.clickRow, true)
|
||||
this.timeList.forEach((re, index) => {
|
||||
if (re.stateAuditType === 1) {
|
||||
re.isJoin = null
|
||||
re.stateCode = null
|
||||
re.leaveReason = null
|
||||
$('.checkDiv' + index).css('display', 'none')
|
||||
this.checked = this.checked.filter(function (item, index) {
|
||||
return item.id !== re.id
|
||||
})
|
||||
}
|
||||
})
|
||||
}).catch(() => {
|
||||
})
|
||||
|
||||
},
|
||||
cancelLeave(o) {
|
||||
vant.Dialog.confirm({
|
||||
title: '温馨提示',
|
||||
message: '您确定要取消请假吗?',
|
||||
}).then(async () => {
|
||||
const res = await $.post('/mobile/meeting/mine/cancelLeave', {id: o.id})
|
||||
if (res.code === 0) {
|
||||
vant.Toast('操作成功')
|
||||
this.doSearch()
|
||||
this.leaveShow = false
|
||||
}
|
||||
}).catch(() => {
|
||||
})
|
||||
},
|
||||
leaveClick(item, index) {
|
||||
if (item.isJoin === false) {
|
||||
return
|
||||
}
|
||||
const isExist = this.checked.some(o => o.tpuId === item.tpuId)
|
||||
if (!isExist) {
|
||||
$('.checkDiv' + index).css('display', '')
|
||||
this.checked.push(item)
|
||||
} else {
|
||||
$('.checkDiv' + index).css('display', 'none')
|
||||
this.checked = this.checked.filter(o => o.tpuId !== item.tpuId)
|
||||
}
|
||||
},
|
||||
toggle(item, index) {
|
||||
if (item.auditIdList === null) {
|
||||
this.$refs.checkboxes[index].toggle();
|
||||
}
|
||||
},
|
||||
openView(id) {
|
||||
|
||||
},
|
||||
doSearch() {
|
||||
this.pageForm.pageNumber = 1
|
||||
this.tableData = []
|
||||
this.finished = false
|
||||
this.onLoad()
|
||||
},
|
||||
async onLoad() {
|
||||
this.loading = true
|
||||
$.post('/mobile/meeting/mine/pageData', this.pageForm).then(res => {
|
||||
if (res.code === 0) {
|
||||
this.tableData = this.tableData.concat(res.data.list)
|
||||
if (this.tableData.length === res.data.totalCount) {
|
||||
this.finished = true
|
||||
} else {
|
||||
this.pageForm.pageNumber++
|
||||
}
|
||||
}
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
async needLeave(o, flag) {
|
||||
this.flag = flag
|
||||
this.clickRow = o
|
||||
if (moment().valueOf() > moment(o.leaveDeadline).valueOf() || o.isCanLeave === false) {
|
||||
vant.Toast('抱歉,已过请假截止时间');
|
||||
return
|
||||
}
|
||||
this.leaveReason = ''
|
||||
this.checked = []
|
||||
const res = await $.post('/mobile/meeting/mine/findMyMeetPeriod', {meetingId: o.id})
|
||||
if (res.code === 0) {
|
||||
this.timeList = res.data
|
||||
if (this.timeList.length === 0) {
|
||||
vant.Toast('您暂无可请假的假时间段');
|
||||
return
|
||||
}
|
||||
|
||||
this.leaveShow = true
|
||||
this.$nextTick(function () {
|
||||
this.timeList.forEach((re, index) => {
|
||||
if (re.isJoin === false) {
|
||||
this.checked.push(re)
|
||||
$('.checkDiv' + index).css('display', '')
|
||||
}
|
||||
})
|
||||
})
|
||||
return
|
||||
}
|
||||
vant.Toast('系统错误,请联系管理员');
|
||||
},
|
||||
async leave() {
|
||||
if (this.checked.length === 0) {
|
||||
vant.Toast('请选择请假时间段');
|
||||
return
|
||||
}
|
||||
const array = this.timeList.find(o => o.stateCode === null || o.stateCode < this.clickRow.firstState)
|
||||
if (array === undefined) {
|
||||
vant.Toast('您的所有请假均已处于审核阶段');
|
||||
return
|
||||
}
|
||||
const paramArray = []
|
||||
let valid = false
|
||||
this.checked.forEach(item => {
|
||||
if (item.leaveReason === '' || item.leaveReason === undefined) {
|
||||
vant.Toast('请填写请假原因');
|
||||
valid = true
|
||||
return
|
||||
}
|
||||
if (!item.stateCode) {
|
||||
paramArray.push(
|
||||
{
|
||||
id: item.tpuId,
|
||||
meetingId: this.clickRow.id,
|
||||
leaveReason: item.leaveReason
|
||||
}
|
||||
)
|
||||
}
|
||||
})
|
||||
if (paramArray.length === 0) {
|
||||
vant.Toast('请选择请假时间段');
|
||||
return
|
||||
}
|
||||
if (valid) {
|
||||
return
|
||||
}
|
||||
const resp = await $.post('/mobile/meeting/mine/askForLeave', {
|
||||
meetingId: this.clickRow.id,
|
||||
data: JSON.stringify(paramArray)
|
||||
})
|
||||
if (resp.code === 0) {
|
||||
vant.Toast('操作成功');
|
||||
this.doSearch()
|
||||
this.leaveShow = false
|
||||
}
|
||||
$('.checkDiv').css('display', 'none')
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
this.typeList = await meetUtil.getAllMeetingType()
|
||||
this.typeList.unshift({'text': '全部会议类型'})
|
||||
if (this.typeList && this.typeList.length > 0) {
|
||||
this.$set(this.pageForm, "typeId", this.typeList[0].value)
|
||||
}
|
||||
this.$set(this.pageForm, "tabNameIndex", this.meetingList[0].value)
|
||||
this.$set(this.pageForm, "meetingTime", this.meetingTimeList[1].value)
|
||||
this.onLoad()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -0,0 +1,320 @@
|
||||
<!--#
|
||||
layout("/mobile/platform.html"){
|
||||
#-->
|
||||
<style>
|
||||
[v-cloak] {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
#app {
|
||||
max-height: 100vh;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.header {
|
||||
height: 400px;
|
||||
max-height: 400px;
|
||||
background-color: white
|
||||
}
|
||||
|
||||
.body {
|
||||
background-color: white;
|
||||
margin-top: 6px;
|
||||
height: calc(100vh - (400px + 6px + 26px + 70px));
|
||||
max-height: calc(100vh - (400px + 6px + 26px + 70px));
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.footer {
|
||||
background-color: white;
|
||||
margin-top: 6px;
|
||||
width: 100%;
|
||||
height: 70px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.meeting_info {
|
||||
height: 200px;
|
||||
width: 86%;
|
||||
margin: 0 auto;
|
||||
transform: translateY(-60%);
|
||||
background-color: white;
|
||||
box-shadow: 0 8px 12px #ebedf0;
|
||||
padding: 10px 10px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.header .text {
|
||||
color: white;
|
||||
text-align: center;
|
||||
letter-spacing: 3px;
|
||||
line-height: 40px;
|
||||
}
|
||||
|
||||
.meeting_info .meeting_name {
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.meeting_info .meeting_address {
|
||||
text-align: center;
|
||||
color: grey;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.van-button--block {
|
||||
margin: 0 auto;
|
||||
width: 92%;
|
||||
}
|
||||
|
||||
.tag {
|
||||
color: #1867b0;
|
||||
font-weight: bold;
|
||||
font-size: 20px;
|
||||
margin-right: 6px;
|
||||
}
|
||||
|
||||
.span_text {
|
||||
color: grey;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.van-col {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.van-col span {
|
||||
color: grey;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.icon {
|
||||
width: 6.4em;
|
||||
height: 6.4em;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
font-size: 10px;
|
||||
-webkit-mask-size: 100%;
|
||||
-webkit-mask-position: 50% 50%;
|
||||
background-color: currentColor;
|
||||
}
|
||||
|
||||
.icon_ok {
|
||||
-webkit-mask-image: url(data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M12%2022C6.477%2022%202%2017.523%202%2012S6.477%202%2012%202s10%204.477%2010%2010-4.477%2010-10%2010zm-1.177-7.86l-2.765-2.767L7%2012.431l3.119%203.121a1%201%200%20001.414%200l5.952-5.95-1.062-1.062-5.6%205.6z%22%2F%3E%3C%2Fsvg%3E);
|
||||
color: #07c160;
|
||||
}
|
||||
|
||||
.icon_no {
|
||||
-webkit-mask-image: url(data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M12%2022C6.477%2022%202%2017.523%202%2012S6.477%202%2012%202s10%204.477%2010%2010-4.477%2010-10%2010zm-.763-15.864l.11%207.596h1.305l.11-7.596h-1.525zm.759%2010.967c.512%200%20.902-.383.902-.882%200-.5-.39-.882-.902-.882a.878.878%200%2000-.896.882c0%20.499.396.882.896.882z%22%2F%3E%3C%2Fsvg%3E);
|
||||
color: #fa5151;
|
||||
}
|
||||
|
||||
.weui-msg__text-area {
|
||||
margin-bottom: 32px;
|
||||
padding: 0 32px;
|
||||
-webkit-box-flex: 1;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.weui-msg__text-area .weui-msg__title {
|
||||
margin-bottom: 16px;
|
||||
font-weight: 500;
|
||||
font-size: 22px;
|
||||
color: rgba(0, 0, 0, 0.9);
|
||||
}
|
||||
|
||||
.weui-msg__desc {
|
||||
font-size: 17px;
|
||||
font-weight: 400;
|
||||
color: rgba(0, 0, 0, 0.9);
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.meeting_index {
|
||||
width: 40px;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: lightgrey;
|
||||
color: white;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.meeting_peri {
|
||||
width: 90%;
|
||||
line-height: 19px;
|
||||
margin-left: 10px
|
||||
}
|
||||
|
||||
.meeting_primary {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 10px
|
||||
}
|
||||
|
||||
.weui-btn_primary:not(.weui-btn_disabled):visited {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.weui-btn_primary {
|
||||
background-color: #1867b0;
|
||||
}
|
||||
|
||||
.weui-btn {
|
||||
position: relative;
|
||||
display: block;
|
||||
width: 184px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
padding: 8px 24px;
|
||||
box-sizing: border-box;
|
||||
font-weight: 700;
|
||||
font-size: 17px;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
color: #fff;
|
||||
line-height: 1.88235294;
|
||||
border-radius: 8px;
|
||||
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="app">
|
||||
<div v-if="isCanAudit">
|
||||
<div class="header">
|
||||
<div style="height: 300px; background-color: #1867b0; border-radius: 0 0 16% 16%;">
|
||||
<div class="text">会议签到</div>
|
||||
</div>
|
||||
<div class="meeting_info">
|
||||
<div class="meeting_name">{{meetingInfo.meetingName}}</div>
|
||||
<div class="meeting_address">{{meetingInfo.location}}</div>
|
||||
<div style="position: relative; top: 55px">
|
||||
<van-row>
|
||||
<van-col span="24"><span>会议类型:</span>{{typeName}}</van-col>
|
||||
</van-row>
|
||||
<div style="position: relative; top: 30px">
|
||||
<van-row>
|
||||
<van-col span="24">
|
||||
<span style="color: grey; font-size: 14px;">会议时间:</span>
|
||||
{{moment(meetingInfo.startTime).format('YYYY-MM-DD HH:mm')}}
|
||||
</van-col>
|
||||
</van-row>
|
||||
<van-row>
|
||||
<van-col span="24">
|
||||
<span style="color: grey; font-size: 14px;">结束时间:</span>
|
||||
{{moment(meetingInfo.endTime).format('YYYY-MM-DD HH:mm')}}
|
||||
</van-col>
|
||||
</van-row>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="body">
|
||||
<div><span class="tag">|</span>会议名称</div>
|
||||
<div style="overflow-y: auto; height: 100%; font-size: 13px;margin-top: 16px">
|
||||
<div class="meeting_primary" v-for="(item,index) in meetingInfo.meetingTimePeriods">
|
||||
<div :style="item.id === mtpId ? 'background-color: #43b26a; font-size: 15px' : ''"
|
||||
class="meeting_index" v-if="item.id === mtpId">
|
||||
当前
|
||||
</div>
|
||||
<div class="meeting_index" style="font-weight: normal" v-else>
|
||||
{{index + 1}}
|
||||
</div>
|
||||
<div class="meeting_peri">
|
||||
<div>{{item.timePeriodName}}</div>
|
||||
<div>{{moment(item.startTime).format('YYYY-MM-DD HH:mm')}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<van-button :disabled="signInfo.isSignIn" @click="signIn" block color="#1867b0" round type="primary">
|
||||
{{signInfo.isSignIn ? '您已签到' : '点击签到'}}
|
||||
</van-button>
|
||||
</div>
|
||||
</div>
|
||||
<div style="text-align: center; padding-top: calc(100% - 50%)" v-cloak v-else>
|
||||
<div style="margin-bottom: 32px;">
|
||||
<span :class="isIncorrect === true ? 'icon icon_ok' : 'icon icon_no'"></span>
|
||||
</div>
|
||||
<div class="weui-msg__text-area">
|
||||
<h2 class="weui-msg__title">{{isIncorrect === true ? '操作成功' : '温馨提示'}}</h2>
|
||||
<p class=".weui-msg__desc">{{incorrectMag}}</p>
|
||||
</div>
|
||||
<p style="margin-top: 190px">
|
||||
<span @click="back" class="weui-btn weui-btn_primary" role="button">点击返回</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<!--# include("/platform/meeting/includeJs/meetingUtil.js"){} #-->
|
||||
const meetUtil = new meetingUtil()
|
||||
|
||||
function getQueryString(name) {
|
||||
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
|
||||
var r = window.location.search.substr(1).match(reg);
|
||||
if (r != null) return decodeURI(r[2]);
|
||||
return null;
|
||||
}
|
||||
|
||||
const vue = new Vue({
|
||||
el: '#app',
|
||||
data() {
|
||||
return {
|
||||
meetingInfo: {},
|
||||
signInfo: {},
|
||||
isCanAudit: true,
|
||||
incorrectMag: '',
|
||||
meetingId: '',
|
||||
mtpId: '',
|
||||
isIncorrect: true,
|
||||
typeName: '',
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async pageData() {
|
||||
const res = await $.get('/mobile/meeting/mine/getMeetingInfo', {
|
||||
meetingId: this.meetingId,
|
||||
mtpId: this.mtpId,
|
||||
})
|
||||
if (res.code === 0) {
|
||||
this.meetingInfo = res.data.meetingInfo
|
||||
this.signInfo = res.data.signInfo
|
||||
const typeList = await meetUtil.getAllMeetingType()
|
||||
const type = typeList.find(o => o.id === this.meetingInfo.typeId)
|
||||
this.typeName = type !== undefined ? type.meetingTypeName : ''
|
||||
} else {
|
||||
this.isCanAudit = false
|
||||
this.incorrectMag = res.msg
|
||||
this.isIncorrect = false
|
||||
}
|
||||
$('#app').css('opacity', '1')
|
||||
},
|
||||
async signIn() {
|
||||
const res = await $.post('/mobile/meeting/mine/signIn', {
|
||||
mtpId: this.mtpId,
|
||||
})
|
||||
this.isIncorrect = res.code === 0
|
||||
this.isCanAudit = false
|
||||
this.incorrectMag = res.msg
|
||||
},
|
||||
back() {
|
||||
const str = this.incorrectMag === '你不是当前会议人员' ? 'http://' + window.location.host : '/mobile/meeting/mine/go_sign?meetingId=' + this.meetingId + '&mtpId=' + this.mtpId
|
||||
location.href = str
|
||||
},
|
||||
},
|
||||
async created() {
|
||||
this.meetingId = getQueryString('meetingId')
|
||||
this.mtpId = getQueryString('mtpId')
|
||||
await this.pageData()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,391 +0,0 @@
|
||||
<!--#
|
||||
layout("/mobile/platform.html"){
|
||||
#-->
|
||||
|
||||
<style>
|
||||
.page-survey {
|
||||
background-color: rgba(242, 242, 242, 1);
|
||||
}
|
||||
|
||||
.page-survey .survey-container {
|
||||
height: 100%;
|
||||
overflow: visible;
|
||||
padding-top: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.survey-container .question-list {
|
||||
flex: auto;
|
||||
padding-bottom: 84px;
|
||||
}
|
||||
|
||||
.question {
|
||||
position: relative;
|
||||
margin-bottom: 20px;
|
||||
background: rgba(255, 255, 255, 1);
|
||||
}
|
||||
|
||||
.question-head {
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
padding: 20px;
|
||||
background: rgba(255, 255, 255, 1);
|
||||
}
|
||||
|
||||
.question-tags {
|
||||
position: absolute;
|
||||
top: -2px;
|
||||
}
|
||||
|
||||
.question-title {
|
||||
position: relative;
|
||||
font-size: 1.125em;
|
||||
font-weight: normal;
|
||||
word-wrap: break-word;
|
||||
word-break: break-word;
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
.question-seq {
|
||||
display: block;
|
||||
margin-right: 8px;
|
||||
font-size: 18px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.question-title .text {
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
.question-body {
|
||||
background-color: rgba(255, 255, 255, 1);
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.van-checkbox {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.van-cell__title {
|
||||
font-size: 16px;
|
||||
color: rgba(0, 0, 0, 1);
|
||||
}
|
||||
|
||||
.page-control {
|
||||
padding: 20px;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
grid-gap: 20px;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.survey-head {
|
||||
padding: 20px;
|
||||
background: #fff;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.survey-head .title {
|
||||
font-size: 22px;
|
||||
font-weight: 600;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.survey-head .desc {
|
||||
padding: 10px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<div class="root">
|
||||
<m-page-loading v-if="mLoading"></m-page-loading>
|
||||
<van-nav-bar title="知识竞答" left-arrow placeholder fixed
|
||||
@click-left="history.go(-1)"></van-nav-bar>
|
||||
<template v-if="!mLoading">
|
||||
<div v-if="finishAnswer">
|
||||
{{finishAnswer}}
|
||||
<van-empty description="您已经答完该问卷">
|
||||
<div>
|
||||
<van-button type="info" @click="viewScore">查看成绩</van-button>
|
||||
<van-button type="info" @click="viewAnswerSheet">查看答卷</van-button>
|
||||
<!-- <van-button type="info" @click="answerAgain">再答一次</van-button>-->
|
||||
</div>
|
||||
</van-empty>
|
||||
</div>
|
||||
<div v-else class="page-survey" style="touch-action: manipulation;min-height: 100vh;">
|
||||
<div class="survey-container">
|
||||
|
||||
<div class="survey-head">
|
||||
<div class="title">
|
||||
{{questionData.qtitle}}
|
||||
</div>
|
||||
<div class="desc">
|
||||
{{titleMsg}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="question-list">
|
||||
<section v-for="(issue,issueIdx) in issueList" :key="issue.iid" class="question"
|
||||
:id="'issue'+issue.iid">
|
||||
<div class="question-head">
|
||||
<div class="question-tags">
|
||||
<template v-if="issue.itx===1">
|
||||
<van-tag :type="issue.iisdx?'primary':'warning'">{{issue.iisdx?'单选':'多选'}}
|
||||
</van-tag>
|
||||
</template>
|
||||
<van-tag v-if="issue.fraction" type="primary">{{issue.fraction}}分</van-tag>
|
||||
</div>
|
||||
<h2 class="question-title">
|
||||
<span class="question-seq">
|
||||
<b>
|
||||
{{issueIdx+1}}
|
||||
</b>
|
||||
</span>
|
||||
<div class="text" v-html="issue.iname"></div>
|
||||
</h2>
|
||||
|
||||
</div>
|
||||
<div class="question-body">
|
||||
<van-checkbox-group v-model="issue.userSelect" :ref="'checkboxGroup'+issue.iid">
|
||||
<van-cell-group>
|
||||
<van-cell
|
||||
v-for="(item,index) in issue.wors"
|
||||
clickable
|
||||
:key="item"
|
||||
:title="item.wtxt"
|
||||
@click="toggle(issue,item.wid)"
|
||||
>
|
||||
<template #icon>
|
||||
<van-checkbox :name="item.wid" :ref="'checkboxes'+item.wid"
|
||||
:shape="issue.iisdx?'round':'square'"></van-checkbox>
|
||||
</template>
|
||||
</van-cell>
|
||||
</van-cell-group>
|
||||
</van-checkbox-group>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
<div class="page-control">
|
||||
<van-button type="info" block @click="save()">保存</van-button>
|
||||
<van-button type="info" block @click="submit()">提交</van-button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const BASE_URL = '/mobile/question/h5ctgu'
|
||||
const vue = new Vue({
|
||||
el: '#app',
|
||||
data() {
|
||||
return {
|
||||
questionData: {
|
||||
issues: []
|
||||
},
|
||||
currentIssueIndex: 0,
|
||||
replyInfo: [],
|
||||
finishAnswer: false,
|
||||
mLoading: true
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
issueList() {
|
||||
return this.questionData.issues
|
||||
},
|
||||
titleMsg() {
|
||||
debugger
|
||||
const radios = this.issueList.filter(v => v.itx === 1 && v.iisdx)
|
||||
const checkBoxes = this.issueList.filter(v => v.itx === 1 && !v.iisdx)
|
||||
|
||||
const radioScore = radios.length > 0 ? radios[0].fraction : 0
|
||||
const checkBoxesScore = checkBoxes.length > 0 ? checkBoxes[0].fraction : 0
|
||||
|
||||
const radioScoreSum = radios.map(v => v.fraction ? v.fraction : 0).reduce((a, b) => a + b, 0)
|
||||
const checkBoxesScoreSum = checkBoxes.map(v => v.fraction ? v.fraction : 0).reduce((a, b) => a + b, 0)
|
||||
|
||||
const sumScore = radioScoreSum + checkBoxesScoreSum
|
||||
|
||||
return "说明:单选题" + radios.length + "题,每题" + radioScore + "分,合计" + radioScoreSum + "分;多选题" + checkBoxes.length + "题,每题" + checkBoxesScore + "分,合计" + checkBoxesScoreSum + "分;总分" + sumScore + "分。"
|
||||
|
||||
},
|
||||
|
||||
fullScore() {
|
||||
return this.issueList.map(v => v.fraction ? v.fraction : 0).reduce((a, b) => a + b)
|
||||
},
|
||||
radioNum() {
|
||||
return this.issueList.filter(v => v.idx === 1 && v.iisdx).map(v => v.fraction ? v.fraction : 0).reduce((a, b) => a + b)
|
||||
},
|
||||
checkBoxNum() {
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
async getQuestionData() {
|
||||
const resp = await $.get(BASE_URL + '/questionInfo/' + this.id)
|
||||
this.questionData = resp.data
|
||||
this.questionData.issues.forEach(i => {
|
||||
// i.userSelect = null
|
||||
})
|
||||
|
||||
},
|
||||
toggle(issue, worId) {
|
||||
//单选
|
||||
if (issue.iisdx) {
|
||||
vue.$refs['checkboxGroup' + issue.iid][0].toggleAll(false)
|
||||
} else {
|
||||
|
||||
}
|
||||
console.log(issue.userSelect)
|
||||
this.$refs['checkboxes' + worId][0].toggle()
|
||||
setTimeout(() => {
|
||||
console.log(issue.userSelect)
|
||||
})
|
||||
},
|
||||
|
||||
save() {
|
||||
this.$modal.confirm('保存后下次可继续做答,您确定要保存吗?').then(async () => {
|
||||
const replies = this.questionData.issues.map(v => {
|
||||
return {
|
||||
qid: v.iid,
|
||||
issueId: v.iid,
|
||||
userSelect: v.userSelect,
|
||||
}
|
||||
})
|
||||
|
||||
const {code} = await $.post(BASE_URL + '/saveAnswer', {
|
||||
replies: JSON.stringify(replies),
|
||||
questionId: this.questionData.qid,
|
||||
isSave: true
|
||||
})
|
||||
this.$modal.closeLoading()
|
||||
if (code === 0) {
|
||||
this.$modal.msg('保存成功')
|
||||
} else {
|
||||
this.$modal.msg('保存失败')
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
submit() {
|
||||
const iids = this.questionData.issues.filter(v => !v.userSelect).map(v => v.iid)
|
||||
|
||||
if (iids.length > 0) {
|
||||
vant.Toast('您还有' + iids.length + '题未作答,请答完后再提交!')
|
||||
document.getElementById('issue' + iids[0]).scrollIntoView({behavior: 'smooth', block: 'center','inline':'start'});
|
||||
return
|
||||
}
|
||||
|
||||
const msg = '一旦提交不可修改,您确定要提交吗?'
|
||||
|
||||
this.$modal.confirm(msg).then(async () => {
|
||||
const replies = this.questionData.issues.map(v => {
|
||||
return {
|
||||
qid: v.iid,
|
||||
issueId: v.iid,
|
||||
userSelect: v.userSelect,
|
||||
}
|
||||
})
|
||||
|
||||
const {code} = await $.post(BASE_URL + '/saveAnswer', {
|
||||
replies: JSON.stringify(replies),
|
||||
questionId: this.questionData.qid,
|
||||
isSave: false
|
||||
})
|
||||
this.$modal.closeLoading()
|
||||
if (code === 0) {
|
||||
this.$modal.msg('提交成功')
|
||||
await this.checkUserFinishAnswer()
|
||||
if (this.finishAnswer) {
|
||||
//查看分数
|
||||
this.viewScore()
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
//获取回答信息
|
||||
async getReply() {
|
||||
const resp = await $.get(BASE_URL + '/answerInfo/' + this.id)
|
||||
this.replyInfo = resp.data
|
||||
},
|
||||
//用户是否全部答完提交
|
||||
async checkUserFinishAnswer() {
|
||||
this.mLoading = true
|
||||
const resp = await $.get(BASE_URL + '/checkUserFinishAnswer', {questionId: this.id})
|
||||
setTimeout(async () => {
|
||||
this.mLoading = false
|
||||
this.finishAnswer = resp.data
|
||||
if (resp.data) {
|
||||
|
||||
} else {
|
||||
await this.getReply()
|
||||
await this.assignmentAnswer()
|
||||
}
|
||||
}, 1000)
|
||||
},
|
||||
|
||||
//答案赋值
|
||||
assignmentAnswer() {
|
||||
this.questionData.issues.forEach(issue => {
|
||||
const rwids = this.replyInfo.filter(v => v.issueId === issue.iid).map(v => v.rwid)
|
||||
rwids.forEach(rwid => {
|
||||
this.toggle(issue, rwid)
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
answerAgain() {
|
||||
this.finishAnswer = false
|
||||
setTimeout(() => {
|
||||
this.questionData.issues.forEach(issue => {
|
||||
issue.wors.forEach(wor => {
|
||||
this.$refs['checkboxes' + wor.wid][0].toggle(false)
|
||||
})
|
||||
})
|
||||
}, 0)
|
||||
},
|
||||
|
||||
viewScore() {
|
||||
window.location.href = BASE_URL + '/score?id=' + this.id
|
||||
},
|
||||
viewAnswerSheet(){
|
||||
window.location.href = BASE_URL + '/answerSheet?id=' + this.id
|
||||
}
|
||||
|
||||
},
|
||||
async created() {
|
||||
this.id = GetQueryString("id")
|
||||
await this.getQuestionData()
|
||||
await this.checkUserFinishAnswer()
|
||||
// await this.getReply()
|
||||
// this.assignmentAnswer()
|
||||
}
|
||||
})
|
||||
|
||||
window.addEventListener('pageshow', async e => {
|
||||
if (e.persisted || (window.performance && window.performance.navigation.type === 2)) {
|
||||
vue.id = GetQueryString("id")
|
||||
await vue.getQuestionData()
|
||||
await vue.checkUserFinishAnswer()
|
||||
}
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -1,323 +0,0 @@
|
||||
<!--#
|
||||
layout("/mobile/platform.html"){
|
||||
#-->
|
||||
|
||||
<style>
|
||||
.page-survey {
|
||||
background-color: rgba(242, 242, 242, 1);
|
||||
}
|
||||
|
||||
.page-survey .survey-container {
|
||||
height: 100%;
|
||||
overflow: visible;
|
||||
padding-top: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.survey-container .question-list {
|
||||
flex: auto;
|
||||
padding-bottom: 84px;
|
||||
}
|
||||
|
||||
.question {
|
||||
position: relative;
|
||||
margin-bottom: 20px;
|
||||
background: rgba(255, 255, 255, 1);
|
||||
}
|
||||
|
||||
.question-head {
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
padding: 20px;
|
||||
background: rgba(255, 255, 255, 1);
|
||||
}
|
||||
|
||||
.question-tags {
|
||||
position: absolute;
|
||||
top: -2px;
|
||||
}
|
||||
|
||||
.question-title {
|
||||
position: relative;
|
||||
font-size: 1.125em;
|
||||
font-weight: normal;
|
||||
word-wrap: break-word;
|
||||
word-break: break-word;
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
.question-seq {
|
||||
display: block;
|
||||
margin-right: 8px;
|
||||
font-size: 18px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.question-title .text {
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
.question-body {
|
||||
background-color: rgba(255, 255, 255, 1);
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.van-checkbox {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.van-cell__title {
|
||||
font-size: 16px;
|
||||
color: rgba(0, 0, 0, 1);
|
||||
}
|
||||
|
||||
.page-control {
|
||||
padding: 20px;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
grid-gap: 20px;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.survey-head {
|
||||
padding: 20px;
|
||||
background: #fff;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.survey-head .title {
|
||||
font-size: 22px;
|
||||
font-weight: 600;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.survey-head .desc {
|
||||
padding: 10px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Indie Flower';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: url(/assets/platform/fonts/m8JVjfNVeKWVnh3QMuKkFcZVaUuH.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
|
||||
.survey-head .score{
|
||||
color: red;
|
||||
font-family: 'Indie Flower', cursive;
|
||||
font-size: 30px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.question-footer {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.van-checkbox--disabled .van-checkbox__icon--checked .van-icon {
|
||||
color: #fff;
|
||||
background-color: #1989fa;
|
||||
border-color: #1989fa;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<div class="page-survey" style="touch-action: manipulation;min-height: 100vh;">
|
||||
<div class="survey-container">
|
||||
|
||||
<div class="survey-head">
|
||||
<div class="title">
|
||||
{{questionData.qtitle}}
|
||||
</div>
|
||||
<div class="desc">
|
||||
{{titleMsg}}
|
||||
</div>
|
||||
<div class="score">
|
||||
{{score}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="question-list">
|
||||
<section v-for="(issue,issueIdx) in issueList" :key="issue.iid" class="question"
|
||||
:id="'issue'+issue.iid">
|
||||
<div class="question-head">
|
||||
<div class="question-tags">
|
||||
<template v-if="issue.itx===1">
|
||||
<van-tag :type="issue.iisdx?'primary':'warning'">{{issue.iisdx?'单选':'多选'}}
|
||||
</van-tag>
|
||||
</template>
|
||||
<van-tag v-if="issue.fraction" type="primary">{{issue.fraction}}分</van-tag>
|
||||
</div>
|
||||
<h2 class="question-title">
|
||||
<span class="question-seq">
|
||||
<b>
|
||||
{{issueIdx+1}}
|
||||
</b>
|
||||
</span>
|
||||
<div class="text" v-html="issue.iname"></div>
|
||||
</h2>
|
||||
|
||||
</div>
|
||||
<div class="question-body">
|
||||
<van-checkbox-group v-model="issue.userSelect" :ref="'checkboxGroup'+issue.iid" disabled>
|
||||
<van-cell-group>
|
||||
<van-cell
|
||||
v-for="(item,index) in issue.wors"
|
||||
clickable
|
||||
:key="item"
|
||||
:title="item.wtxt"
|
||||
>
|
||||
<template #label>
|
||||
<div>
|
||||
{{item.correct?'正确答案':''}}
|
||||
</div>
|
||||
</template>
|
||||
<template #icon>
|
||||
<van-checkbox :name="item.wid" :ref="'checkboxes'+item.wid"
|
||||
:shape="issue.iisdx?'round':'square'"></van-checkbox>
|
||||
</template>
|
||||
</van-cell>
|
||||
</van-cell-group>
|
||||
</van-checkbox-group>
|
||||
</div>
|
||||
<div class="question-footer" v-if="replyInfo">
|
||||
<div>
|
||||
<div style="display: flex;align-items: center;"
|
||||
:style="{color:(issue.isEqual?'#15db81':'red')}">
|
||||
{{issue.isEqual?'回答正确':'回答错误'}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
const BASE_URL = '/mobile/question/h5ctgu'
|
||||
const vue = new Vue({
|
||||
el: '#app',
|
||||
data() {
|
||||
return {
|
||||
questionData: {
|
||||
issues: []
|
||||
},
|
||||
currentIssueIndex: 0,
|
||||
replyInfo: [],
|
||||
finishAnswer: false,
|
||||
mLoading: true,
|
||||
score: 0
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
issueList() {
|
||||
return this.questionData.issues
|
||||
},
|
||||
titleMsg() {
|
||||
// const radios = this.issueList.filter(v => v.itx === 1 && v.iisdx)
|
||||
// const checkBoxes = this.issueList.filter(v => v.itx === 1 && !v.iisdx)
|
||||
//
|
||||
// const radioScore = radios ? radios[0].fraction : 0
|
||||
// const checkBoxesScore = checkBoxes ? checkBoxes[0].fraction : 0
|
||||
//
|
||||
// const radioScoreSum = radios.map(v => v.fraction ? v.fraction : 0).reduce((a, b) => a + b, 0)
|
||||
// const checkBoxesScoreSum = checkBoxes.map(v => v.fraction ? v.fraction : 0).reduce((a, b) => a + b, 0)
|
||||
//
|
||||
// const sumScore = radioScoreSum + checkBoxesScoreSum
|
||||
//
|
||||
// return "说明:单选题" + radios.length + "题,每题" + radioScore + "分,合计" + radioScoreSum + "分;多选题" + checkBoxes.length + "题,每题" + checkBoxesScore + "分,合计" + checkBoxesScoreSum + "分;总分" + sumScore + "分。"
|
||||
return null
|
||||
},
|
||||
|
||||
fullScore() {
|
||||
return this.issueList.map(v => v.fraction ? v.fraction : 0).reduce((a, b) => a + b)
|
||||
},
|
||||
radioNum() {
|
||||
return this.issueList.filter(v => v.idx === 1 && v.iisdx).map(v => v.fraction ? v.fraction : 0).reduce((a, b) => a + b)
|
||||
},
|
||||
checkBoxNum() {
|
||||
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async getQuestionData() {
|
||||
const resp = await $.get(BASE_URL + '/questionInfo/' + this.id)
|
||||
this.questionData = resp.data
|
||||
},
|
||||
toggle(issue, worId) {
|
||||
//单选
|
||||
if (issue.iisdx) {
|
||||
vue.$refs['checkboxGroup' + issue.iid][0].toggleAll(false)
|
||||
} else {
|
||||
|
||||
}
|
||||
this.$refs['checkboxes' + worId][0].toggle()
|
||||
},
|
||||
async getReply() {
|
||||
const resp = await $.get(BASE_URL + '/answerInfo/' + this.id)
|
||||
this.replyInfo = resp.data
|
||||
},
|
||||
//用户是否全部答完提交
|
||||
async checkUserFinishAnswer() {
|
||||
this.mLoading = true
|
||||
const resp = await $.get(BASE_URL + '/checkUserFinishAnswer', {questionId: this.id})
|
||||
this.finishAnswer = resp.data
|
||||
if (resp.data) {
|
||||
await this.getReply()
|
||||
await this.assignmentAnswer()
|
||||
} else {
|
||||
// await this.getReply()
|
||||
// await this.assignmentAnswer()
|
||||
}
|
||||
},
|
||||
//答案赋值
|
||||
assignmentAnswer() {
|
||||
this.questionData.issues.forEach(issue => {
|
||||
const rwids = this.replyInfo.filter(v => v.issueId === issue.iid).map(v => v.rwid)
|
||||
rwids.forEach(rwid => {
|
||||
this.toggle(issue, rwid)
|
||||
})
|
||||
|
||||
const wids = issue.wors.filter(v => v.correct).map(v => v.wid)
|
||||
const userSelects = this.replyInfo.filter(v => v.issueId === issue.iid).map(v => v.rwid)
|
||||
const isEqual = wids.length === userSelects.length && wids.every(value => userSelects.includes(value))
|
||||
issue.isEqual = isEqual
|
||||
|
||||
})
|
||||
},
|
||||
checkIsCorrect(issue) {
|
||||
const wids = issue.wors.filter(v => v.correct).map(v => v.wid)
|
||||
const userSelects = this.replyInfo.filter(v => v.issueId === issue.iid).map(v => v.rwid)
|
||||
const isEqual = wids.length === userSelects.length && wids.every(value => userSelects.includes(value))
|
||||
return isEqual
|
||||
},
|
||||
async getScore() {
|
||||
const resp = await $.get(BASE_URL + '/getScore', {questionId: this.id})
|
||||
this.score = resp.data.score
|
||||
},
|
||||
|
||||
},
|
||||
async created() {
|
||||
this.id = GetQueryString("id")
|
||||
await this.getScore()
|
||||
await this.getQuestionData()
|
||||
await this.checkUserFinishAnswer()
|
||||
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -1,163 +0,0 @@
|
||||
<!--#
|
||||
layout("/mobile/platform.html"){
|
||||
#-->
|
||||
|
||||
<style>
|
||||
.transcript-container {
|
||||
background-image: url(/assets/mobile/img/question/score.jpg);
|
||||
background-size: 100% 100%;
|
||||
min-height: 100%;
|
||||
padding: 15px;
|
||||
width: 100%;
|
||||
max-width: 1128px;
|
||||
box-sizing: border-box;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.transcript-header {
|
||||
margin-bottom: 15px;
|
||||
flex-direction: column;
|
||||
text-align: center;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.score-detail-group {
|
||||
align-self: stretch;
|
||||
background: rgba(255, 255, 255, 0.01);
|
||||
-webkit-backdrop-filter: blur(50px);
|
||||
backdrop-filter: blur(50px);
|
||||
border-radius: 20px;
|
||||
padding: 20px 0;
|
||||
margin: 20px 0 0 0 !important;
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
flex: none;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.score-total {
|
||||
margin: 40px 0;
|
||||
transform: translate3d(0px, 0px, 0px);
|
||||
display: flex;
|
||||
align-items: stretch;
|
||||
justify-content: center;
|
||||
height: 120px;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.score-number {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
margin: 0 20px;
|
||||
}
|
||||
|
||||
.score-text-title {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
line-height: 32px;
|
||||
margin-bottom: 30px;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.score-text-info {
|
||||
font-size: 32px;
|
||||
font-weight: 600;
|
||||
line-height: 50px;
|
||||
}
|
||||
|
||||
.total-number {
|
||||
font-size: 64px;
|
||||
min-width: 100px;
|
||||
}
|
||||
|
||||
.total-percent {
|
||||
margin-top: 10px;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div id="app">
|
||||
<van-nav-bar title="知识竞答分数" left-arrow placeholder fixed
|
||||
@click-left="history.go(-1)"></van-nav-bar>
|
||||
<div class="transcript-container">
|
||||
<div class="transcript-header transcript-header-mobile">
|
||||
<div class="score-text-container">
|
||||
<div class="score-text-title">
|
||||
{{title}}
|
||||
</div>
|
||||
<div class="score-text-info">
|
||||
{{message}}
|
||||
<!-- <ul>-->
|
||||
<!-- <li>姓名:{{user.username}}</li>-->
|
||||
<!-- <li>工号:{{user.loginname}}</li>-->
|
||||
<!-- <li>单位:{{user.unitname}}</li>-->
|
||||
<!-- <li>工会:{{user.unionname}}</li>-->
|
||||
<!-- </ul>-->
|
||||
</div>
|
||||
</div>
|
||||
<div class="score-detail-group">
|
||||
<div class="score-total" style="transform: translate3d(0px, 0px, 0px);">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 88 188">
|
||||
<path fill="#fff"
|
||||
d="M41.035 41.216c1.313-.407 2.5-.657 3.844-.875 2.812-.438 5.687-.438 8.437-.094a21.44 21.44 0 01-3.188 5.25s-.125.125-.125.156c-5.468 6.062-11.999 8.78-20.123 8.75-.625-7.25 4.968-11.125 11.155-13.187zM25.63 76.244c-2.281-8.999 5.062-14.561 12.562-17.436 2.75-.937 5.655-1.437 8.53-1.625C44.38 66.87 35.223 74.682 25.63 76.244zm1.844 9.562c2.218-3.25 4.562-5.25 7.905-7.28 2.594-1.532 5.406-2.657 8.312-3.406-.656 10.53-7.78 19.998-17.623 24.06-2.375-4.75-1.25-9.03 1.406-13.374zm3.687 35.06c-5.75-7.843-.531-16.311 5.53-22.06 2.313-2.032 4.907-3.72 7.688-5.063 1.28 10.499-4.344 21.717-13.218 27.123zm9.28 19.717c-7.218-6.718-3.468-16.155 1.532-22.935 1.968-2.438 4.28-4.594 6.812-6.5 3.156 10.124-.656 22.467-8.343 29.435zm7.781.438c.625-2.406 1.406-4.312 2.563-6.5 1.5-2.812 3.437-5.406 5.624-7.749a24.494 24.494 0 012.25 6.249c1.937 8.75.125 17.812-4.906 25.186-6.25-3.906-6.874-10.499-5.53-17.186zm22.218 31.748c-9.75-3.969-9.906-14.562-7.594-23.374.969-3.187 2.375-6.187 4.125-8.968 6.718 8.656 8.093 22.592 3.468 32.342zM38.504 34.216c.938-8.655 9.437-10.999 16.936-11.03 2.782.093 5.5.625 8.156 1.437a22.477 22.477 0 01-3.968 4.469c-5.656 4.843-13.874 6.78-21.124 5.124zm7.031-16.155c7.562.219 12.687-4.874 15.686-11.343 1-2.125 1.75-4.406 2.313-6.718-2.438.062-4.844.469-7.156 1.281-6.937 2.437-12.937 9-10.843 16.78zM25.63 33.591c-.406-1.375-.812-2.718-1.312-4.062-1.032-2.906-2.313-5.75-3.719-8.468a28.868 28.868 0 00-3.843 7.812c-2.813 8.968-.531 18.123 7.218 23.686 4.593-5.75 3.468-12.343 1.656-18.968zm-6.25 42.091c3.969-7.562-.718-17.28-4.874-23.717a63.492 63.492 0 00-5.656-7.562C4.257 55.653 6.975 71.12 19.38 75.682zm-2.687 10.124c-2.156-3.53-4.437-6.25-7.312-9.218-2.28-2.312-4.718-4.5-7.312-6.468-.812 5.03-.375 10.905 1.469 15.686 3.156 7.75 7.812 12.75 16.28 14.155 1.125-5.374-.5-9.53-3.125-14.155zm8.5 37.154c.156-8.843-9.03-16.155-15.718-20.436a73.267 73.267 0 00-8.812-4.875 33.031 33.031 0 002.125 9.624c3.594 9.281 11.937 16.874 22.405 15.687zm9.843 20.904c-1.844-8.78-12.656-13.842-20.249-16.53a77.954 77.954 0 00-9.843-2.749 32.908 32.908 0 004.281 8.968c5.718 8.405 15.718 13.874 25.81 10.311zm-2.626 7.656c-2.53-.594-4.936-1-7.53-1.312-3.468-.407-6.968-.563-10.405-.532a33.547 33.547 0 006.25 7.969c.124.125.937.906 1.03.937 8.437 6.75 17.437 9.437 27.342 3.937-3.5-6.655-9.75-9.093-16.686-10.999zm34.373 26.436c-5.937-7.469-18.53-7.781-27.185-7.031a72.233 72.233 0 00-10.624 1.656 36.742 36.742 0 008.249 6.812c9.187 5.468 21.436 6.562 29.56-1.437zM33.067 31.216c6.593-4.593 6.468-14.811 5.53-21.904A60.312 60.312 0 0036.818.5c-8.75 7.843-12.25 21.905-3.75 30.717z"></path>
|
||||
<path fill="#fff"
|
||||
d="M33.629 37.56c3.5-7.219 7.062-13 11.843-19.405-5.031 6.28-8.718 11.968-12.468 19.123-8.124 16.5-11.405 30.154-11.905 48.56.312 23.748 5.374 41.184 17.967 61.276 13.062 18.999 26.654 30.592 47.528 40.435.469-1.063.937-2.125 1.406-3.156-20.342-9.437-33.623-20.561-46.528-38.904-12.561-19.53-17.748-36.497-18.467-59.683.125-18.186 3.093-31.716 10.624-48.246z"></path>
|
||||
</svg>
|
||||
<div class="score-number">
|
||||
<div class="total-number">{{score}}分</div>
|
||||
<div v-if="answerCount>1" class="total-percent">历史最高分:{{maxScore}}</div>
|
||||
</div>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 88 188"
|
||||
style="transform: rotateY(180deg);">
|
||||
<path fill="#fff"
|
||||
d="M41.035 41.216c1.313-.407 2.5-.657 3.844-.875 2.812-.438 5.687-.438 8.437-.094a21.44 21.44 0 01-3.188 5.25s-.125.125-.125.156c-5.468 6.062-11.999 8.78-20.123 8.75-.625-7.25 4.968-11.125 11.155-13.187zM25.63 76.244c-2.281-8.999 5.062-14.561 12.562-17.436 2.75-.937 5.655-1.437 8.53-1.625C44.38 66.87 35.223 74.682 25.63 76.244zm1.844 9.562c2.218-3.25 4.562-5.25 7.905-7.28 2.594-1.532 5.406-2.657 8.312-3.406-.656 10.53-7.78 19.998-17.623 24.06-2.375-4.75-1.25-9.03 1.406-13.374zm3.687 35.06c-5.75-7.843-.531-16.311 5.53-22.06 2.313-2.032 4.907-3.72 7.688-5.063 1.28 10.499-4.344 21.717-13.218 27.123zm9.28 19.717c-7.218-6.718-3.468-16.155 1.532-22.935 1.968-2.438 4.28-4.594 6.812-6.5 3.156 10.124-.656 22.467-8.343 29.435zm7.781.438c.625-2.406 1.406-4.312 2.563-6.5 1.5-2.812 3.437-5.406 5.624-7.749a24.494 24.494 0 012.25 6.249c1.937 8.75.125 17.812-4.906 25.186-6.25-3.906-6.874-10.499-5.53-17.186zm22.218 31.748c-9.75-3.969-9.906-14.562-7.594-23.374.969-3.187 2.375-6.187 4.125-8.968 6.718 8.656 8.093 22.592 3.468 32.342zM38.504 34.216c.938-8.655 9.437-10.999 16.936-11.03 2.782.093 5.5.625 8.156 1.437a22.477 22.477 0 01-3.968 4.469c-5.656 4.843-13.874 6.78-21.124 5.124zm7.031-16.155c7.562.219 12.687-4.874 15.686-11.343 1-2.125 1.75-4.406 2.313-6.718-2.438.062-4.844.469-7.156 1.281-6.937 2.437-12.937 9-10.843 16.78zM25.63 33.591c-.406-1.375-.812-2.718-1.312-4.062-1.032-2.906-2.313-5.75-3.719-8.468a28.868 28.868 0 00-3.843 7.812c-2.813 8.968-.531 18.123 7.218 23.686 4.593-5.75 3.468-12.343 1.656-18.968zm-6.25 42.091c3.969-7.562-.718-17.28-4.874-23.717a63.492 63.492 0 00-5.656-7.562C4.257 55.653 6.975 71.12 19.38 75.682zm-2.687 10.124c-2.156-3.53-4.437-6.25-7.312-9.218-2.28-2.312-4.718-4.5-7.312-6.468-.812 5.03-.375 10.905 1.469 15.686 3.156 7.75 7.812 12.75 16.28 14.155 1.125-5.374-.5-9.53-3.125-14.155zm8.5 37.154c.156-8.843-9.03-16.155-15.718-20.436a73.267 73.267 0 00-8.812-4.875 33.031 33.031 0 002.125 9.624c3.594 9.281 11.937 16.874 22.405 15.687zm9.843 20.904c-1.844-8.78-12.656-13.842-20.249-16.53a77.954 77.954 0 00-9.843-2.749 32.908 32.908 0 004.281 8.968c5.718 8.405 15.718 13.874 25.81 10.311zm-2.626 7.656c-2.53-.594-4.936-1-7.53-1.312-3.468-.407-6.968-.563-10.405-.532a33.547 33.547 0 006.25 7.969c.124.125.937.906 1.03.937 8.437 6.75 17.437 9.437 27.342 3.937-3.5-6.655-9.75-9.093-16.686-10.999zm34.373 26.436c-5.937-7.469-18.53-7.781-27.185-7.031a72.233 72.233 0 00-10.624 1.656 36.742 36.742 0 008.249 6.812c9.187 5.468 21.436 6.562 29.56-1.437zM33.067 31.216c6.593-4.593 6.468-14.811 5.53-21.904A60.312 60.312 0 0036.818.5c-8.75 7.843-12.25 21.905-3.75 30.717z"></path>
|
||||
<path fill="#fff"
|
||||
d="M33.629 37.56c3.5-7.219 7.062-13 11.843-19.405-5.031 6.28-8.718 11.968-12.468 19.123-8.124 16.5-11.405 30.154-11.905 48.56.312 23.748 5.374 41.184 17.967 61.276 13.062 18.999 26.654 30.592 47.528 40.435.469-1.063.937-2.125 1.406-3.156-20.342-9.437-33.623-20.561-46.528-38.904-12.561-19.53-17.748-36.497-18.467-59.683.125-18.186 3.093-31.716 10.624-48.246z"></path>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const BASE_URL = '/mobile/question/h5ctgu'
|
||||
const vue = new Vue({
|
||||
el: '#app',
|
||||
data() {
|
||||
return {
|
||||
score: 0,
|
||||
maxScore: 0,
|
||||
title: null,
|
||||
user: {},
|
||||
message: null,
|
||||
answerCount: 0,
|
||||
questionId: null,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async getScore() {
|
||||
const resp = await $.get(BASE_URL + '/getScore', {questionId: this.questionId})
|
||||
this.score = resp.data.score
|
||||
this.maxScore = resp.data.maxScore
|
||||
this.title = resp.data.title
|
||||
this.user = resp.data.user
|
||||
this.answerCount = resp.data.answerCount
|
||||
this.message = resp.data.message
|
||||
},
|
||||
|
||||
},
|
||||
created() {
|
||||
this.questionId = GetQueryString("id")
|
||||
this.getScore()
|
||||
}
|
||||
|
||||
})
|
||||
</script>
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -86,13 +86,14 @@ layout("/mobile/platform.html"){
|
||||
width: 100%;
|
||||
background: transparent;
|
||||
}
|
||||
.winPopup img{
|
||||
|
||||
.winPopup img {
|
||||
transform: translateY(-50%);
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
}
|
||||
|
||||
.winPopup .van-popup__close-icon{
|
||||
.winPopup .van-popup__close-icon {
|
||||
|
||||
}
|
||||
|
||||
@@ -107,7 +108,7 @@ layout("/mobile/platform.html"){
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.win_tag{
|
||||
.win_tag {
|
||||
position: relative;
|
||||
top: 16px;
|
||||
left: 5px;
|
||||
@@ -138,19 +139,25 @@ layout("/mobile/platform.html"){
|
||||
<div class="quizzes-item-info-v">
|
||||
<div class="quizzes-item-info-title">{{ item.qtitle }}</div>
|
||||
<div class="quizzes-item-info-right">
|
||||
<span class="quizzes-item-info-tip">创建时间:</span>
|
||||
<span class="quizzes-item-info-tip">活动开始时间:</span>
|
||||
<span class="quizzes-item-info-text">
|
||||
{{ moment(item.createTime).format('YYYY年MM月DD日') }}
|
||||
{{ moment(item.startTime).format('YYYY年MM月DD日') }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="quizzes-item-info-right" v-if="item.qlx!==4">
|
||||
<span class="quizzes-item-info-tip">题目数量:</span>
|
||||
<div class="quizzes-item-info-right">
|
||||
<span class="quizzes-item-info-tip">活动结束时间:</span>
|
||||
<span class="quizzes-item-info-text">
|
||||
{{item.ctMode === 1 ? item.topicTotal : item.ctNum }}
|
||||
</span>
|
||||
<span class="quizzes-item-info-text" style="position: absolute;right: 0" >
|
||||
<van-tag @click.stop="showWinInfo(item)" type="primary" class="win_tag" v-if="item.qlx===2 && item.isRaffle && moment(item.startTime).diff(moment(new Date().getTime()),'days') < 0">获奖信息</van-tag>
|
||||
<!-- v-if="moment(item.startTime).diff(moment(new Date().getTime()),'days') < 0"-->
|
||||
{{ moment(item.endTime).format('YYYY年MM月DD日') }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="quizzes-item-info-right" v-if="item.isRaffle">
|
||||
<!-- <span class="quizzes-item-info-tip">题目数量:</span>-->
|
||||
<!-- <span class="quizzes-item-info-text">-->
|
||||
<!-- {{item.ctMode === 1 ? item.topicTotal : item.ctNum }}-->
|
||||
<!-- </span>-->
|
||||
<span class="quizzes-item-info-text" style="position: absolute;right: 0;bottom: 0">
|
||||
<van-tag @click.stop="showWinInfo(item)" type="primary" class="win_tag"
|
||||
v-if="item.qlx===2 && item.isRaffle && moment().isAfter(moment('2024-06-18 00:05:00'))">获奖信息</van-tag>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -166,17 +173,22 @@ layout("/mobile/platform.html"){
|
||||
|
||||
<van-popup v-model="winPopupShow" class="winPopup"
|
||||
:style="{ height: '100%' }"
|
||||
>
|
||||
>
|
||||
<div style="display: flex;align-items: center">
|
||||
<img v-if="isWin" width="100%" height="60%" src="/assets/mobile/img/question/win.png"/>
|
||||
<!-- <img v-if="!isWin" width="100%" height="50%" src="/assets/mobile/img/question/noWin1.png"/>-->
|
||||
<img v-if="!isWin" width="100%" height="50%" src="https://img1.baidu.com/it/u=3192248910,26901819&fm=253&fmt=auto&app=138&f=JPEG?w=403&h=500"/>
|
||||
<img v-if="!isWin" width="100%" height="50%"
|
||||
src="/assets/mobile/img/question/noWin1-removebg-preview.png"/>
|
||||
</div>
|
||||
<div class="iconDiv">
|
||||
<div v-if="isWin" style="font-size: 14px;!important;">恭喜您中奖了,本次活动中奖机会只有一次喔!</div>
|
||||
<van-icon @click="winPopupShow = false" name="close"></van-icon>
|
||||
</div>
|
||||
</van-popup>
|
||||
|
||||
<van-dialog v-model="tipShow" title="提示">
|
||||
<div>活动期间,每天答题次数不限,每天答题的最终成绩取最高分。每天答题得90分(含)以上者,可参加线上抽奖活动。</div>
|
||||
<div>6月17日至6月23日每天线上抽取“幸运奖”100名'。</div>
|
||||
</van-dialog>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -193,8 +205,10 @@ layout("/mobile/platform.html"){
|
||||
queryForm: {
|
||||
status: '1'
|
||||
},
|
||||
winPopupShow:false,
|
||||
isWin:false
|
||||
winPopupShow: false,
|
||||
isWin: false,
|
||||
|
||||
tipShow:false
|
||||
}
|
||||
},
|
||||
created() {
|
||||
@@ -270,6 +284,7 @@ layout("/mobile/platform.html"){
|
||||
|
||||
async openAnswer(item) {
|
||||
const {qid, qlx, qflag, activityUserScopeId} = item
|
||||
|
||||
if (qflag !== 2) {
|
||||
this.$modal.msg('该问卷未发布')
|
||||
return
|
||||
@@ -289,12 +304,38 @@ layout("/mobile/platform.html"){
|
||||
}
|
||||
}
|
||||
|
||||
if (qid === '827cc4ef9cde47ed97bc21f6be75f91a') {
|
||||
this.$dialog.alert({
|
||||
title:'提示',
|
||||
messageAlign:'left',
|
||||
message: '<div style="text-indent: 2em;">活动期间,每天答题次数不限,每天答题的最终成绩取最高分。每天答题得90分(含)以上者,可参加线上抽奖活动。<div>' +
|
||||
'<div style="text-indent: 2em;">6月17日至6月23日每天线上抽取“幸运奖”100名。</div>'+
|
||||
'<div style="text-indent: 2em;">答题并提交成功后,可于次日查看获奖信息。</div>'
|
||||
,
|
||||
}).then(()=>{
|
||||
if (qlx === 1) {
|
||||
//调查
|
||||
location.href = '/mobile/question/h5/poll/index?id=' + qid
|
||||
} else if (qlx === 2) {
|
||||
//答题
|
||||
location.href = '/mobile/question/h5/answer/index?id=' + qid
|
||||
} else if (qlx === 3) {
|
||||
//购物
|
||||
location.href = '/mobile/question/h5/shop/index?id=' + qid
|
||||
} else if (qlx === 4) {
|
||||
//蛋糕卡
|
||||
location.href = '/mobile/question/h5/cake/index?id=' + qid
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (qlx === 1) {
|
||||
//调查
|
||||
location.href = '/mobile/question/h5/poll/index?id=' + qid
|
||||
} else if (qlx === 2) {
|
||||
//答题
|
||||
location.href = '/mobile/question/h5/answer/index_ctgu?id=' + qid
|
||||
location.href = '/mobile/question/h5/answer/index?id=' + qid
|
||||
} else if (qlx === 3) {
|
||||
//购物
|
||||
location.href = '/mobile/question/h5/shop/index?id=' + qid
|
||||
@@ -344,4 +385,4 @@ layout("/mobile/platform.html"){
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
#-->
|
||||
@@ -58,7 +58,7 @@ layout("/mobile/platform.html"){
|
||||
margin-bottom: 1rem;
|
||||
padding: 10px;
|
||||
border-radius: 10px;
|
||||
/*box-shadow: 2px 2px 12px 4px rgba(0, 0, 0, 0.1);*/
|
||||
box-shadow: 2px 2px 12px 4px rgba(0, 0, 0, 0.1);
|
||||
position: relative;
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ layout("/mobile/platform.html"){
|
||||
right: 0;
|
||||
max-height: 64px;
|
||||
background-color: #FFF;
|
||||
/*box-shadow: 0 0 20px rgb(230, 230, 230);*/
|
||||
box-shadow: 0 0 20px rgb(230, 230, 230);
|
||||
z-index: 999;
|
||||
padding: 10px 20px;
|
||||
display: flex;
|
||||
@@ -324,17 +324,6 @@ layout("/mobile/platform.html"){
|
||||
})
|
||||
},
|
||||
submitAnswer() {
|
||||
const v1 = this.issueList.some(v => v.itx === 1 && v.iisbd && v.rwid == null)
|
||||
if (v1) {
|
||||
this.$modal.msg('请选择后再提交')
|
||||
return
|
||||
}
|
||||
const v2 = this.issueList.some(v => v.itx === 2 && v.iisbd && (v.rval == null || v.rval === ''))
|
||||
if (v2) {
|
||||
this.$modal.msg('请填写后再提交')
|
||||
return
|
||||
}
|
||||
|
||||
const formData = this.formatFormData()
|
||||
formData.forEach(v => v.save = false)
|
||||
this.$modal.confirm('您确定要提交吗?提交后不能修改!').then(() => {
|
||||
|
||||
@@ -0,0 +1,502 @@
|
||||
<!--#
|
||||
layout("/mobile/platform.html"){
|
||||
#-->
|
||||
|
||||
<style>
|
||||
.middle-subject {
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
background-color: #f6f7f9;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.middle-subject-info-padding {
|
||||
padding: 10px;
|
||||
background-color: #f6f7f9;
|
||||
}
|
||||
|
||||
.middle-subject-info-scroll {
|
||||
/*height: 100%;*/
|
||||
height: calc(100vh - 110px);
|
||||
max-height: calc(100vh - 110px);
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
.middle-subject-info-head {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.middle-subject-topic-icon {
|
||||
width: 30px;
|
||||
padding: 2px;
|
||||
font-size: 10px;
|
||||
background-color: #1678ff;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
border-radius: 0 0 5px 5px;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 10px;
|
||||
}
|
||||
|
||||
.middle-subject-title {
|
||||
margin-bottom: 1rem;
|
||||
font-weight: bolder;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.middle-subject-other {
|
||||
color: #909399;
|
||||
font-size: 13px;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.middle-subject-topic {
|
||||
background-color: #FFFFFF;
|
||||
margin-bottom: 1rem;
|
||||
padding: 10px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 2px 2px 12px 4px rgba(0, 0, 0, 0.1);
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.middle-subject-topic-title {
|
||||
font-weight: bolder;
|
||||
}
|
||||
|
||||
.middle-subject-topic-submit {
|
||||
margin-top: 30px;
|
||||
margin-bottom: 30px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.middle-subject-topic-desc {
|
||||
color: rgb(160, 160, 160);
|
||||
text-align: left;
|
||||
margin-left: 20px;
|
||||
font-size: 12px;
|
||||
margin-bottom: 10px;
|
||||
padding: 20px 0;
|
||||
}
|
||||
|
||||
.itx_field {
|
||||
background-color: #fff;
|
||||
background-image: none;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #dcdfe6;
|
||||
box-sizing: border-box;
|
||||
color: #606266;
|
||||
display: inline-block;
|
||||
font-size: inherit;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
outline: none;
|
||||
padding: 0 15px;
|
||||
transition: border-color .2s cubic-bezier(.645, .045, .355, 1);
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
||||
.middle-subject-topic-submit .u-btn {
|
||||
width: 60%;
|
||||
}
|
||||
|
||||
.middle-subject-info-search {
|
||||
position: absolute;
|
||||
bottom: 45%;
|
||||
right: 0;
|
||||
height: 40px;
|
||||
z-index: 999;
|
||||
background-color: #FFF;
|
||||
box-shadow: 0 0 20px rgb(230, 230, 230);
|
||||
border-radius: 20px 0 0 20px;
|
||||
}
|
||||
|
||||
.middle-subject-info-search-icon {
|
||||
height: 40px;
|
||||
width: 40px;
|
||||
box-shadow: 0 0 10px #1678ff;
|
||||
border-radius: 20px 0 0 20px;
|
||||
background-color: #FFF;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.middle-subject-info-search-info {
|
||||
padding: 0 10px;
|
||||
display: flex;
|
||||
height: inherit;
|
||||
z-index: 999;
|
||||
align-items: center;
|
||||
box-shadow: 0 0 10px #1678ff;
|
||||
border-radius: 20px 0 0 20px;
|
||||
background-color: #FFF;
|
||||
}
|
||||
|
||||
.middle-subject-info-footer {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
max-height: 64px;
|
||||
background-color: #FFF;
|
||||
box-shadow: 0 0 20px rgb(230, 230, 230);
|
||||
z-index: 999;
|
||||
padding: 10px 20px;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.middle-subject-info-footer-save {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.middle-subject-info-footer-save .van-button {
|
||||
/*width: 40%;*/
|
||||
width: calc((100% - 100px) / 2);
|
||||
}
|
||||
|
||||
.middle-subject-info-footer-pagination {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
width: 70%;
|
||||
}
|
||||
|
||||
.van-radio__label {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.totalMoney {
|
||||
width: 80px;
|
||||
max-width: 80px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
overflow-x: scroll;
|
||||
color: red;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<div class="middle-subject">
|
||||
<van-nav-bar title="在线调查" left-arrow
|
||||
@click-left="history.back()"></van-nav-bar>
|
||||
|
||||
<div class="middle-subject-info">
|
||||
<div class="middle-subject-info-scroll">
|
||||
<div class="middle-subject-info-padding">
|
||||
<div class="middle-subject-info-head">
|
||||
<div class="middle-subject-title">{{ questionData.qtitle }}</div>
|
||||
<div class="middle-subject-other">
|
||||
<template v-if="questionData.qlx!==3">
|
||||
<!-- <span>创建人:{{ questionData.username }}</span>-->
|
||||
<!-- <span>总题数:{{ issueList.length }}</span>-->
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="middle-subject-info-body">
|
||||
<div class="middle-subject-topic" v-for="(issue,issueIndex) in issueList" :key="issue.qid">
|
||||
<div v-if="!issue.iisdx" class="middle-subject-topic-icon">
|
||||
<span>多选</span>
|
||||
</div>
|
||||
<div style="margin-bottom: 10px">
|
||||
<span v-if="issue.iisbd" style="color: red;">*</span>
|
||||
<span class="middle-subject-topic-title">
|
||||
{{ issueIndex + 1 }}.
|
||||
{{ removeHTMLTag(issue.iname) }}
|
||||
<span v-if="issue.iminselect">(最少选择:{{issue.iminselect}})</span>
|
||||
<span v-if="issue.imaxselect">(最多选择:{{issue.imaxselect}})</span>
|
||||
<div v-if="issue.its" class="middle-subject-topic-desc"
|
||||
style="margin-left: 17px;font-size: 12px;font-weight: 500;">
|
||||
{{ issue.its }}
|
||||
</div>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<!-- 选择题 -->
|
||||
<template v-if="issue.itx===1">
|
||||
<!-- 单选题 -->
|
||||
<van-radio-group v-if="issue.iisdx" v-model="issue.rwid" :disabled="replyFinish">
|
||||
<div v-for="(wor,worIndex) in issue.wors" :key="wor.wid">
|
||||
<van-radio :ref="wor.wid" :name="wor.wid">
|
||||
{{ letterList[worIndex] }}. {{ wor.wtxt }}
|
||||
</van-radio>
|
||||
<div class="middle-subject-topic-desc">
|
||||
<van-row gutter="16">
|
||||
<van-col span="8" v-if="wor.wimg">
|
||||
<image style="height: 80px;width: 80px" :src="wor.wimg"
|
||||
mode="aspectFit">
|
||||
</image>
|
||||
</van-col>
|
||||
<van-col span="16" v-if="wor.wsm">
|
||||
{{ wor.wsm }}
|
||||
</van-col>
|
||||
</van-row>
|
||||
<van-row style="margin-top: 10px;">
|
||||
<van-col :span="8"
|
||||
style="height: 28px;line-height: 28px;font-size: 14px;color: #d16565">
|
||||
单价:¥{{ wor.price }}
|
||||
</van-col>
|
||||
<van-col :span="16" style="display: flex;justify-content: right"
|
||||
v-if="issue.rwid === wor.wid">
|
||||
<view style="height: 28px;line-height: 28px;font-size: 14px;color: #d16565;">
|
||||
数量:
|
||||
</view>
|
||||
<van-stepper v-model="wor.number" :disabled="replyFinish" integer
|
||||
disable-input :default-value="0"
|
||||
:min="0"></van-stepper>
|
||||
</van-col>
|
||||
</van-row>
|
||||
</div>
|
||||
</div>
|
||||
</van-radio-group>
|
||||
|
||||
<!-- 多选题 -->
|
||||
<van-checkbox-group v-else-if="!issue.iisdx" v-model="issue.rwid"
|
||||
:disabled="replyFinish"
|
||||
:max="issue.imaxselect ? issue.imaxselect:0">
|
||||
<div v-for="(wor,worIndex) in issue.wors" :key="wor.wid">
|
||||
<van-checkbox :ref="wor.wid" :name="wor.wid" shape="square">
|
||||
{{ letterList[worIndex] }}. {{ wor.wtxt }}
|
||||
</van-checkbox>
|
||||
<div class="middle-subject-topic-desc">
|
||||
<van-row gutter="16">
|
||||
<van-col span="8" v-if="wor.wimg">
|
||||
<image style="height: 80px;width: 80px" :src="wor.wimg"
|
||||
mode="aspectFit">
|
||||
</image>
|
||||
</van-col>
|
||||
<van-col span="16" v-if="wor.wsm">
|
||||
{{ wor.wsm }}
|
||||
</van-col>
|
||||
</van-row>
|
||||
<van-row style="margin-top: 10px;">
|
||||
<van-col :span="8"
|
||||
style="height: 28px;line-height: 28px;font-size: 14px;color: #d16565">
|
||||
单价:¥{{ wor.price }}
|
||||
</van-col>
|
||||
<van-col :span="16" style="display: flex;justify-content: right"
|
||||
v-if="issue.rwid && issue.rwid.includes(wor.wid)">
|
||||
<view style="height: 28px;line-height: 28px;font-size: 14px;color: #d16565;">
|
||||
数量:
|
||||
</view>
|
||||
<van-stepper v-model="wor.number" :disabled="replyFinish" integer
|
||||
disable-input :default-value="0"
|
||||
:min="0"></van-stepper>
|
||||
</van-col>
|
||||
</van-row>
|
||||
</div>
|
||||
</div>
|
||||
</van-checkbox-group>
|
||||
</template>
|
||||
|
||||
<!-- 填空题 -->
|
||||
<template v-if="issue.itx===2">
|
||||
<van-field v-model="issue.rval" type="text" border
|
||||
class="itx_field"
|
||||
cursor-spacing="100"
|
||||
:show-confirmbar="false"
|
||||
:disabled="replyFinish" :auto-height="true" maxlength="2000"></van-field>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="middle-subject-info-footer">
|
||||
<div class="middle-subject-info-footer-save">
|
||||
<div class="totalMoney">
|
||||
¥{{ totalMoney }}
|
||||
</div>
|
||||
<van-button size="medium" type="primary" @click="saveAnswer" :disabled="replyFinish">
|
||||
保存
|
||||
</van-button>
|
||||
<van-button size="medium" type="info" :disabled="replyFinish" @click="submitAnswer">
|
||||
提交
|
||||
</van-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const vue = new Vue({
|
||||
el: '#app',
|
||||
mixins: [mobileMixins],
|
||||
data() {
|
||||
return {
|
||||
id: null,
|
||||
questionData: {},
|
||||
issueList: [],
|
||||
replyInfo: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
letterList() {
|
||||
const alphabet = Array.from(new Array(26), (ele, index) => {
|
||||
return String.fromCharCode(65 + index);
|
||||
})
|
||||
return alphabet
|
||||
},
|
||||
replyFinish() {
|
||||
return this.replyInfo.some(v => !v.save)
|
||||
},
|
||||
totalMoney() {
|
||||
let sum = 0
|
||||
this.issueList.forEach(v => {
|
||||
if (v.itx === 1 && v.iisdx && v.rwid) {
|
||||
//单选
|
||||
const sel = v.wors.find(w => w.wid === v.rwid)
|
||||
sum += sel.number * sel.price
|
||||
} else if (v.itx === 1 && !v.iisdx && v.rwid) {
|
||||
//多选
|
||||
sum += v.wors.filter(w => v.rwid.includes(w.wid)).map(w => isNaN(w.price * w.number) ? 0 : w.price * w.number).reduce((a, b) => a + b, 0)
|
||||
}
|
||||
})
|
||||
return sum
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async getQuestionData() {
|
||||
const resp = await $.get('/mobile/question/h5/questionInfo/' + this.id)
|
||||
this.questionData = resp.data
|
||||
this.issueList = this.questionData && this.questionData.issues
|
||||
},
|
||||
saveAnswer() {
|
||||
const formData = this.formatFormData(true)
|
||||
if (formData.length === 0) {
|
||||
this.$modal.msg('请先选择后再保存')
|
||||
return
|
||||
}
|
||||
if (formData.some(v => v.number === 0)) {
|
||||
this.$modal.msg('最少选择一项')
|
||||
return
|
||||
}
|
||||
|
||||
this.$modal.loading('保存中')
|
||||
$.post('/mobile/question/h5/saveAnswer', {repliesArray: JSON.stringify(formData)}).then(res => {
|
||||
this.$modal.closeLoading()
|
||||
if (res.code === 0) {
|
||||
this.$modal.msg('保存成功')
|
||||
this.getReply()
|
||||
} else {
|
||||
this.$modal.msg('保存失败')
|
||||
}
|
||||
})
|
||||
},
|
||||
submitAnswer() {
|
||||
const formData = this.formatFormData(false)
|
||||
if (formData.length === 0) {
|
||||
this.$modal.msg('请先选择后再提交')
|
||||
return
|
||||
}
|
||||
if (formData.some(v => v.number === 0)) {
|
||||
this.$modal.msg('最少选择一项')
|
||||
return
|
||||
}
|
||||
this.$modal.confirm('您确定要提交吗?提交后不能修改!').then(() => {
|
||||
this.$modal.loading('提交中')
|
||||
$.post('/mobile/question/h5/saveAnswer', {repliesArray: JSON.stringify(formData)}).then(res => {
|
||||
this.$modal.closeLoading()
|
||||
if (res.code === 0) {
|
||||
this.$modal.msg('提交成功')
|
||||
this.getReply()
|
||||
} else {
|
||||
this.$modal.msg('提交失败')
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
//格式化提交数据
|
||||
formatFormData(save) {
|
||||
const formData = []
|
||||
this.issueList.forEach(v => {
|
||||
if (v.itx === 1 && v.iisdx) {
|
||||
//单选
|
||||
if (v.rwid) {
|
||||
formData.push({
|
||||
"rwid": v.rwid,
|
||||
"qid": this.questionData.qid,
|
||||
"issueId": v.iid,
|
||||
"number": v.wors.find(w => w.wid === v.rwid).number,
|
||||
"save": save
|
||||
})
|
||||
}
|
||||
} else if (v.itx === 1 && !v.iisdx) {
|
||||
//多选
|
||||
if (v.rwid) {
|
||||
v.rwid.forEach(r => {
|
||||
formData.push({
|
||||
"rwid": r,
|
||||
"qid": this.questionData.qid,
|
||||
"issueId": v.iid,
|
||||
"number": v.wors.find(w => w.wid === r).number,
|
||||
"save": save
|
||||
})
|
||||
})
|
||||
}
|
||||
} else if (v.itx === 2) {
|
||||
if (v.rval) {
|
||||
formData.push({
|
||||
"rval": v.rval,
|
||||
"qid": this.questionData.qid,
|
||||
"issueId": v.iid,
|
||||
"save": save
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
return formData
|
||||
},
|
||||
//获取回答信息并赋值
|
||||
async getReply() {
|
||||
const resp = await $.get('/mobile/question/h5/answerInfo/' + this.id)
|
||||
this.replyInfo = resp.data
|
||||
this.issueList.forEach((issue, issueIndex) => {
|
||||
if (issue.itx === 1 && issue.iisdx) {
|
||||
//单选
|
||||
const rw = this.replyInfo.find(answer => answer.issueId === issue.iid)
|
||||
this.$set(this.issueList[issueIndex], 'rwid', rw ? rw.rwid : null)
|
||||
if (rw) {
|
||||
const worIndex = issue.wors.findIndex(v => v.wid === rw.rwid)
|
||||
this.$set(this.issueList[issueIndex]['wors'][worIndex], 'number', rw ? rw.number : 0)
|
||||
}
|
||||
} else if (issue.itx === 1 && !issue.iisdx) {
|
||||
//多选
|
||||
const rws = this.replyInfo.filter(answer => answer.issueId === issue.iid)
|
||||
this.$set(this.issueList[issueIndex], 'rwid', rws ? rws.map(v => v.rwid) : [])
|
||||
if (rws) {
|
||||
rws.forEach(rw => {
|
||||
const worIndex = issue.wors.findIndex(v => v.wid === rw.rwid)
|
||||
this.$set(issue.wors[worIndex], 'number', rw ? rw.number : 0)
|
||||
})
|
||||
}
|
||||
} else if (issue.itx === 2) {
|
||||
//填空题
|
||||
const rw = this.replyInfo.find(answer => answer.issueId === issue.iid)
|
||||
this.$set(this.issueList[issueIndex], 'rval', rw ? rw.rval : null)
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
this.id = GetQueryString("id")
|
||||
await this.getQuestionData()
|
||||
await this.getReply()
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -0,0 +1,229 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<style>
|
||||
.cus_icon {
|
||||
font-size: 34px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.el-icon-circle-plus {
|
||||
color: #236eb4;
|
||||
}
|
||||
|
||||
.el-icon-remove {
|
||||
color: #f56c6c;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<guava>
|
||||
<el-card shadow="never">
|
||||
|
||||
<template #header>
|
||||
<h3 style="color: #1867b0">发起会议</h3>
|
||||
</template>
|
||||
|
||||
<el-tabs type="card" v-model="activeName">
|
||||
|
||||
<el-tab-pane label="会议基础信息" name="first">
|
||||
<template>
|
||||
<vi-title title="会议基础信息"></vi-title>
|
||||
<el-form :model="formData" :rules="formRules" label-width="120px" ref="addForm">
|
||||
<el-row :gutter="20" type="flex">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="会议名称" prop="meetingName">
|
||||
<el-input placeholder="请填写会议名称" type="text"
|
||||
v-model.trim="formData.meetingName"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="会议地点" prop="meetingAddress">
|
||||
<el-input placeholder="请填写会议地点" type="text"
|
||||
v-model.trim="formData.meetingAddress"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="20" type="flex">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="会议类型" prop="typeId">
|
||||
<el-select filterable placeholder="请选择会议类型" style="width: 100%"
|
||||
v-model="formData.typeId">
|
||||
<el-option :label="item.meetingTypeName" :value="item.id"
|
||||
v-for="item in meetingTypeList"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="会议时间" prop="meetingTime">
|
||||
<el-date-picker end-placeholder="结束日期"
|
||||
format="yyyy-MM-dd"
|
||||
range-separator="至" start-placeholder="开始日期" style="width: 100%"
|
||||
type="daterange"
|
||||
v-model="formData.meetingTime"
|
||||
value-format="yyyy-MM-dd HH:mm:ss">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="20" type="flex">
|
||||
<el-col :span="formData.isMsgNotify === '1' ? '6' : '12'">
|
||||
<el-form-item label="是否消息通知" prop="isMsgNotify">
|
||||
<el-radio border label="1" size="medium" v-model="formData.isMsgNotify">是
|
||||
</el-radio>
|
||||
<el-radio border label="2" size="medium" v-model="formData.isMsgNotify">否
|
||||
</el-radio>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6" v-if="formData.isMsgNotify === '1'">
|
||||
<el-form-item label="发送方式" prop="sendType">
|
||||
<el-checkbox-group size="medium" v-model="formData.sendType">
|
||||
<el-checkbox border label="msg">短信发送</el-checkbox>
|
||||
<el-checkbox border label="WeChat">微信发送</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="是否可以请假" prop="isCanLeave">
|
||||
<el-radio border label="yes" size="medium" v-model="formData.isCanLeave">允许
|
||||
</el-radio>
|
||||
<el-radio border label="no" size="medium" v-model="formData.isCanLeave">不允许
|
||||
</el-radio>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6" v-if="formData.isCanLeave === 'yes'">
|
||||
<el-form-item label="请假截止时间" prop="leaveDeadline">
|
||||
<el-date-picker format="yyyy-MM-dd" placeholder="请选择日期" style="width: 100%"
|
||||
type="date"
|
||||
v-model="formData.leaveDeadline"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="20" type="flex" v-if="formData.isMsgNotify === '1'">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="消息内容" prop="msgContent">
|
||||
<el-input :rows="4" placeholder="请输入消息内容" type="textarea"
|
||||
v-model="formData.msgContent"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="20" type="flex">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="会议描述" prop="meetingDescribe">
|
||||
<el-input :rows="4" placeholder="请输入会议描述" type="textarea"
|
||||
v-model="formData.meetingDescribe"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
</el-form>
|
||||
</template>
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane label="参与人员信息" name="second">
|
||||
<template>
|
||||
<vi-title title="参与人员信息"></vi-title>
|
||||
<el-table :data="userTableData" style="width: 100%; margin-bottom: 20px">
|
||||
<el-table-column label="用户名" prop="stateName"></el-table-column>
|
||||
<el-table-column label="姓名" prop="reviewer"></el-table-column>
|
||||
<el-table-column label="性别" prop="reviewer"></el-table-column>
|
||||
<el-table-column label="所属单位" prop="reviewer"></el-table-column>
|
||||
<el-table-column label="院级工会" prop="reviewer"></el-table-column>
|
||||
</el-table>
|
||||
</template>
|
||||
</el-tab-pane>
|
||||
|
||||
</el-tabs>
|
||||
|
||||
<el-row justify="end" style="margin-top: 20px" type="flex">
|
||||
<el-button @click="doSubmit" type="primary">提交</el-button>
|
||||
</el-row>
|
||||
|
||||
</el-card>
|
||||
</guava>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<!--# include("/platform/meeting/includeJs/meetingUtil.js"){} #-->
|
||||
const meetUtil = new meetingUtil()
|
||||
const vue = new Vue({
|
||||
el: '#app',
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {
|
||||
meetingTypeList: [],
|
||||
activeName: 'first',
|
||||
formData: {isMsgNotify: '2', sendType: [], isCanLeave: 'no'},
|
||||
userTableData: [],
|
||||
tableData: [{stateName: '', auditStateUserList: []}],
|
||||
formRules: {
|
||||
meetingName: [{required: true, message: '请填写会议名称', trigger: ['blur', 'change']}],
|
||||
meetingAddress: [{required: true, message: '请填写会议地点', trigger: ['blur', 'change']}],
|
||||
typeId: [{required: true, message: '请选择会议类型', trigger: ['blur', 'change']}],
|
||||
meetingTime: [{required: true, message: '请选择会议时间', trigger: ['blur', 'change']}],
|
||||
sendType: [{required: true, message: '请选择发送方式', trigger: ['blur', 'change']}],
|
||||
msgContent: [{required: true, message: '请填写消息内容', trigger: ['blur', 'change']}],
|
||||
leaveDeadline: [{required: true, message: '请选择请假截止时间', trigger: ['blur', 'change']}],
|
||||
},
|
||||
userList: [],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async doSubmit() {
|
||||
const valid = await this.$refs["addForm"].validate()
|
||||
if (valid) {
|
||||
if (this.formData.isCanLeave === 'yes') {
|
||||
for (const [index, item] of this.tableData.entries()) {
|
||||
if (item.stateName === '' || item.stateName === undefined) {
|
||||
this.$notify({title: '警告', message: '第' + (index + 1) + '条审核节点名称不能为空', type: 'warning'})
|
||||
return
|
||||
}
|
||||
if (item.auditStateUserList.length === 0) {
|
||||
console.log(item.auditStateUserList)
|
||||
this.$notify({title: '警告', message: '第' + (index + 1) + '条审核人不能为空', type: 'warning'})
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//开始提交
|
||||
const submitFormData = clone(this.formData)
|
||||
submitFormData.startTime = this.formData.meetingTime && this.formData.meetingTime.length > 0 ? this.formData.meetingTime[0] : ''
|
||||
submitFormData.endTime = this.formData.meetingTime && this.formData.meetingTime.length > 1 ? this.formData.meetingTime[1] : ''
|
||||
delete submitFormData.meetingTime
|
||||
|
||||
submitFormData.meetingUserList = this.userTableData
|
||||
|
||||
const {code} = await $.post(loc() + "/doAdd", {
|
||||
meetingInfo: JSON.stringify(submitFormData)
|
||||
})
|
||||
if (code === 0) {
|
||||
this.$notify({title: '成功', message: '提交成功', type: 'success'})
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
async created() {
|
||||
this.meetingTypeList = await meetUtil.getAllMeetingType()
|
||||
},
|
||||
watch: {
|
||||
'tableData': {
|
||||
handler: function (newValue, oldValue) {
|
||||
|
||||
},
|
||||
deep: true,
|
||||
}
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -0,0 +1,422 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<style>
|
||||
.audit-userids-select .el-select__tags {
|
||||
flex-wrap: unset;
|
||||
overflow: auto;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<guava ref="guava">
|
||||
<el-card shadow="never">
|
||||
<table-tool :app="this" label="类型列表">
|
||||
<template #func>
|
||||
<el-button @click="openAdd" size="small" type="primary">新增类型</el-button>
|
||||
</template>
|
||||
</table-tool>
|
||||
<el-table :data="tableData" :size="tableSize"
|
||||
@sort-change="pageOrder" class="vi-table"
|
||||
row-key="id" style="width: 100%">
|
||||
|
||||
<el-table-column align="center" header-align="center" label="序号" type="index"
|
||||
width="80px"></el-table-column>
|
||||
|
||||
<el-table-column
|
||||
:label="column.label"
|
||||
:prop="column.prop"
|
||||
:sortable="column.sortable"
|
||||
:width="column.width"
|
||||
align="center"
|
||||
header-align="center"
|
||||
min-width="50"
|
||||
show-overflow-tooltip
|
||||
v-for="column in tableColumns"
|
||||
>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="操作">
|
||||
<template scope="{row}">
|
||||
<el-button @click="openEdit(row)" size="mini" type="primary">编辑</el-button>
|
||||
<el-button @click="doDelete(row.id)" size="mini" type="danger">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
</el-table>
|
||||
</el-card>
|
||||
|
||||
<template #edit>
|
||||
<vi-title title="基础信息"></vi-title>
|
||||
<el-form :model="formData" :rules="formRules" label-width="80px" ref="form">
|
||||
<el-form-item label="名称" prop="meetingTypeName">
|
||||
<el-input v-model="formData.meetingTypeName"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="模块名称" prop="moduleName">
|
||||
<el-input v-model="formData.moduleName"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="序号" prop="sortNum">
|
||||
<el-input-number :max="tableData.length + 1" :min="1" :precision="0"
|
||||
v-model="formData.sortNum"></el-input-number>
|
||||
</el-form-item>
|
||||
|
||||
<vi-title title="审核节点信息(温馨提醒:如审核节点没有限制,审核节点类型不选即可)"></vi-title>
|
||||
<el-table :data="formData.auditStateList">
|
||||
<el-table-column label="节点ID" prop="stateId" width="100px">
|
||||
<template slot-scope="scope">
|
||||
<el-input readonly v-model="scope.row.stateId"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="审核节点名称" prop="stateName">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.stateName"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="审核节点类型" prop="auditAfterType" width="150px">
|
||||
<template slot-scope="scope">
|
||||
<el-select v-model="scope.row.auditAfterType" clearable>
|
||||
<el-option :label="item.desc"
|
||||
:value="item.value"
|
||||
v-for="item in customAuditTypeList"></el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="审核人" prop="selectUserId">
|
||||
<template slot-scope="scope">
|
||||
<el-select :remote-method="userRemoteMethod"
|
||||
class="audit-userids-select" filterable
|
||||
multiple placeholder="请输入姓名或工号查找"
|
||||
remote style="width: 100%"
|
||||
v-model="scope.row.selectUserId">
|
||||
<el-option :key="item.id"
|
||||
:label="item.username + '(' + item.loginname + ')'"
|
||||
:value="item.id"
|
||||
v-for="item in userList"></el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="筛选审核人" width="100px">
|
||||
<template scope="scope">
|
||||
<el-button @click="openUserSelect(scope.$index)" type="text">筛选用户</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="通过下个节点" pro="afterPassStateId" width="120px">
|
||||
<template slot-scope="scope">
|
||||
<el-select v-model="scope.row.afterPassStateId">
|
||||
<el-option :label="item"
|
||||
:value="item"
|
||||
v-for="item in stateIdList"></el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="拒绝下个节点" pro="afterRejectStateId" width="120px">
|
||||
<template slot-scope="scope">
|
||||
<el-select v-model="scope.row.afterRejectStateId">
|
||||
<el-option :label="item"
|
||||
:value="item"
|
||||
v-for="item in stateIdList"></el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="审核类型" prop="stateAuditType" width="150px">
|
||||
<template slot-scope="scope">
|
||||
<el-select v-model="scope.row.stateAuditType">
|
||||
<el-option :label="item.desc"
|
||||
:value="item.value"
|
||||
v-for="item in stateAuditTypeList"></el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column width="100px">
|
||||
<template scope="scope" slot="header">
|
||||
<el-button @click="addState"
|
||||
icon="el-icon-circle-plus-outline"
|
||||
size="mini"
|
||||
type="primary"></el-button>
|
||||
</template>
|
||||
<template scope="scope">
|
||||
<el-button @click="formData.auditStateList.splice(scope.$index, 1)"
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
type="danger"></el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-form>
|
||||
<el-row class="mt10" justify="end" type="flex">
|
||||
<el-button @click="$refs.guava.index()">取消</el-button>
|
||||
<el-button @click="doConfirm" type="primary">确定</el-button>
|
||||
</el-row>
|
||||
</template>
|
||||
</guava>
|
||||
|
||||
<condition :fields="fields"
|
||||
:show_filter_result="true"
|
||||
@confirm="cndConfirm"
|
||||
ref="cnd"
|
||||
v-model="cnd"></condition>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<!--# include("/platform/meeting/includeJs/meetingUtil.js"){} #-->
|
||||
const meetUtil = new meetingUtil()
|
||||
const vue = new Vue({
|
||||
el: '#app',
|
||||
mixins: [initTableMixins],
|
||||
components: {
|
||||
'condition': httpVueLoader('/components/plugins/ConditionStructure.vue?v=1.0.0'),
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tableColumns: [
|
||||
{prop: 'meetingTypeName', label: '类型名称'},
|
||||
{prop: 'moduleName', label: '模块名称'},
|
||||
{prop: 'sortNum', label: '排序编号'}],
|
||||
stateAuditTypeList: [],
|
||||
customAuditTypeList: [],
|
||||
formData: {
|
||||
auditStateList: []
|
||||
},
|
||||
formRules: {
|
||||
meetingTypeName: [{
|
||||
required: true,
|
||||
message: '请输入类型名称',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
moduleName: [{
|
||||
required: true,
|
||||
message: '请输入模块名称,英文命名',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
sortNum: [{required: true, message: '请输入排序编号', trigger: ['blur', 'change']}]
|
||||
},
|
||||
userList: [],
|
||||
maxStateId: 0,
|
||||
userSelectDialogVisible: false,
|
||||
cnd: {},
|
||||
fields: [],
|
||||
nodeIndex: null
|
||||
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
async 'formData.auditStateList'(val) {
|
||||
const {id} = this.formData
|
||||
for (let i = 0; i < val.length; i++) {
|
||||
let item = val[i]
|
||||
if (id) {
|
||||
if (item.isAddRow) {
|
||||
//当前行是新增的第几行
|
||||
const addIndex = i + 1 - val.filter(v => !v.isAddRow).length
|
||||
|
||||
const stateId = val[0].stateId + i * 10
|
||||
const licitStateCode = await this.checkStateId(stateId, addIndex)
|
||||
item['stateId'] = licitStateCode
|
||||
}
|
||||
} else {
|
||||
item['stateId'] = this.maxStateId + (i + 1) * 10
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// this.$set(this.formData,'auditStateList',val)
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
dialogTitle() {
|
||||
if (this.formData.id) {
|
||||
return '编辑'
|
||||
}
|
||||
return '新增'
|
||||
},
|
||||
stateIdList() {
|
||||
return this.formData.auditStateList.map(v => v.stateId)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async checkStateId(stateId, stateIndex) {
|
||||
const resp = await $.get(loc() + '/checkStateId', {stateId, stateIndex})
|
||||
if (resp.code === 0) {
|
||||
return resp.data
|
||||
} else {
|
||||
this.notifyError(resp.msg)
|
||||
}
|
||||
},
|
||||
|
||||
addState() {
|
||||
this.formData.auditStateList.push({
|
||||
stateId: null,
|
||||
stateName: null,
|
||||
selectUserId: [],
|
||||
auditStateUserList: [],
|
||||
afterPassStateId: null,
|
||||
afterRejectStateId: null,
|
||||
isAddRow: true
|
||||
})
|
||||
},
|
||||
|
||||
async findAll() {
|
||||
const resp_data = await $.get(loc() + '/findAll')
|
||||
if (resp_data.code === 0) {
|
||||
resp_data.data.forEach(v => {
|
||||
v.auditStateList.forEach(x => {
|
||||
if (x.matchCnd) {
|
||||
x.matchCnd = JSON.parse(x.matchCnd)
|
||||
}
|
||||
})
|
||||
})
|
||||
this.tableData = resp_data.data
|
||||
}
|
||||
},
|
||||
openAdd() {
|
||||
this.formData = {
|
||||
meetingName: null,
|
||||
sortNum: this.tableData.length + 1,
|
||||
auditStateList: [{}]
|
||||
}
|
||||
this.$refs.guava.edit()
|
||||
},
|
||||
async doConfirm() {
|
||||
try {
|
||||
const valid = await this.$refs['form'].validate()
|
||||
if (valid) {
|
||||
this.formData.auditStateList.forEach(v => {
|
||||
v['auditStateUserList'] = v.selectUserId.map(x => {
|
||||
return {userId: x}
|
||||
})
|
||||
v['matchCnd'] = JSON.stringify(v['matchCnd'])
|
||||
})
|
||||
const resp = await $.post(loc() + '/doHandle', {data: JSON.stringify(this.formData)})
|
||||
if (resp.code === 0) {
|
||||
this.$refs.guava.index()
|
||||
this.notifySuccess(resp.msg)
|
||||
this.findAll()
|
||||
} else {
|
||||
this.notifyError(resp.msg)
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
}
|
||||
},
|
||||
async openEdit(row) {
|
||||
const d = clone(row)
|
||||
let u = []
|
||||
d.auditStateList.forEach(v => {
|
||||
v['selectUserId'] = v.auditStateUserList.map(x => x.userId)
|
||||
u = u.concat(v['selectUserId'])
|
||||
})
|
||||
this.userList = await queryUserByIds(u)
|
||||
|
||||
this.formData = d
|
||||
this.$refs.guava.edit()
|
||||
},
|
||||
async doDelete(id) {
|
||||
try {
|
||||
const confirm = await this.$confirm('您确定要删除吗', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
if (confirm === 'confirm') {
|
||||
const resp = await $.post(loc() + '/delete/' + id)
|
||||
if (resp.code === 0) {
|
||||
this.notifySuccess(resp.msg)
|
||||
this.findAll()
|
||||
} else {
|
||||
this.notifyError(resp.msg)
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async userRemoteMethod(query) {
|
||||
if (query) {
|
||||
this.userList = await searchUser(query)
|
||||
}
|
||||
},
|
||||
openUserSelect(node_index) {
|
||||
this.nodeIndex = node_index
|
||||
const node = this.formData.auditStateList[node_index]
|
||||
if (node.matchCnd) {
|
||||
this.cnd = node.matchCnd
|
||||
console.log('......')
|
||||
} else {
|
||||
this.cnd = {method: "AND", conditions: [{}]}
|
||||
}
|
||||
this.$refs.cnd.open(false)
|
||||
},
|
||||
async initCndFields() {
|
||||
this.cnd = {
|
||||
method: "AND",
|
||||
conditions: [{}],
|
||||
}
|
||||
const meet_data = await getOpenMeeting()
|
||||
const meet_options = meet_data.map(v => {
|
||||
return {"label": v.jdhallname, "value": v.id}
|
||||
})
|
||||
this.fields.push(
|
||||
{label: '教代会', value: 'jdhid', type: "select", options: meet_options}
|
||||
)
|
||||
const {data: role_data} = await $.get('/platform/sys/role/getAllRoles')
|
||||
const role_options = role_data.map(v => {
|
||||
return {"label": v.name, "value": v.id}
|
||||
})
|
||||
this.fields.push(
|
||||
{label: '角色', value: 'roleId', type: "select", options: role_options}
|
||||
)
|
||||
this.fields.push(
|
||||
{label: '姓名', value: 'username', options: null}
|
||||
)
|
||||
|
||||
|
||||
},
|
||||
async cndConfirm(val) {
|
||||
if (val) {
|
||||
const matchCnd = clone(val)
|
||||
if (matchCnd.conditions && matchCnd.conditions.length > 0) {
|
||||
this.formData.auditStateList[this.nodeIndex].matchCnd = matchCnd
|
||||
const resp = await $.post('/platform/userFilter/findUserByCnd', {cnd: JSON.stringify(matchCnd)})
|
||||
if (resp.code === 0) {
|
||||
if (resp.data) {
|
||||
const d = this.formData.auditStateList[this.nodeIndex]
|
||||
d.matchCnd = matchCnd
|
||||
d.selectUserId = [...new Set(d.selectUserId.concat(resp.data.map(v => v.id)))]
|
||||
|
||||
this.$set(this.formData.auditStateList, this.nodeIndex, d)
|
||||
let u = []
|
||||
this.formData.auditStateList.forEach(v => {
|
||||
u = u.concat(v.selectUserId.map(x => x))
|
||||
})
|
||||
this.userList = await queryUserByIds([...new Set(u)])
|
||||
}
|
||||
}
|
||||
console.log(resp)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
this.findAll()
|
||||
this.initCndFields()
|
||||
this.maxStateId = await meetUtil.findMaxStateId()
|
||||
this.stateAuditTypeList = await getEnumOptions('AuditTypeEnum')
|
||||
this.customAuditTypeList = await getEnumOptions('CustomAuditTypeEnum')
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -0,0 +1,40 @@
|
||||
// const meetingUtil = {
|
||||
//
|
||||
//
|
||||
//
|
||||
// async getMeetingType(){
|
||||
// $.get()
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
class meetingUtil {
|
||||
|
||||
constructor() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取全部会议类型
|
||||
* @returns {Promise<*[]|*>}
|
||||
*/
|
||||
async getAllMeetingType() {
|
||||
const resp = await $.get('/platform/meeting/basic/type/findAll')
|
||||
if (resp.code === 0) {
|
||||
resp.data.forEach(v => {
|
||||
v['text'] = v['meetingTypeName']
|
||||
v['value'] = v['id']
|
||||
})
|
||||
return resp.data
|
||||
}
|
||||
return []
|
||||
}
|
||||
|
||||
async findMaxStateId() {
|
||||
const resp = await $.get('/platform/meeting/basic/type/findMaxStateId')
|
||||
if (resp.code === 0) {
|
||||
return resp.data
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<guava>
|
||||
<el-card shadow="never">
|
||||
<div class="search">
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">年度:</div>
|
||||
<div class="search-item-option">
|
||||
<el-date-picker
|
||||
placeholder="选择年份"
|
||||
style="width: 100%" type="year"
|
||||
v-model="pageForm.year"
|
||||
value-format="yyyy">
|
||||
</el-date-picker>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">会议名称:</div>
|
||||
<div class="search-item-option">
|
||||
<el-input clearable
|
||||
placeholder="可输入会议名称、地点进行查询"
|
||||
v-model="pageForm.searchKeyword"></el-input>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-query">
|
||||
<el-button @click="doSearch" icon="el-icon-search" type="primary">搜索</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<el-card class="mt10" shadow="never">
|
||||
<table-tool :app="this" label="会议信息">
|
||||
<template #func>
|
||||
</template>
|
||||
</table-tool>
|
||||
<el-table :data="tableData" :size="tableSize" @sort-change="pageOrder"
|
||||
align="center" header-align="center">
|
||||
<el-table-column align="center" header-align="center" label="序号" type="index" width="80">
|
||||
<template scope="scope">
|
||||
<span>{{ scope.$index + (pageForm.pageNumber - 1) * pageForm.pageSize + 1 }} </span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
:label="column.label"
|
||||
:prop="column.prop"
|
||||
:sortable="column.sortable"
|
||||
:width="column.width"
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
v-for="column in tableColumns"
|
||||
>
|
||||
<template scope="{row}" v-if="column.prop=='isCanLeave'">
|
||||
<span class="text-muted" v-if="row.isCanLeave==null">未设置</span>
|
||||
<span class="text-success" v-if="row.isCanLeave==true">能</span>
|
||||
<span class="text-danger" v-if="row.isCanLeave==false">否</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="操作" width="300px">
|
||||
<template scope="{row}">
|
||||
<el-button @click="openView(row)" size="mini">查看</el-button>
|
||||
<el-button @click="openEdit(row)" size="mini" type="primary">编辑</el-button>
|
||||
<el-button @click="doDelete(row.id)" size="mini" type="danger">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
</el-table>
|
||||
</el-card>
|
||||
</guava>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<!--# include("/platform/meeting/includeJs/meetingUtil.js"){} #-->
|
||||
const meetUtil = new meetingUtil()
|
||||
window['vue'] = new Vue({
|
||||
el: '#app',
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {
|
||||
hold: false,
|
||||
tableColumns: [
|
||||
{prop: 'meetingName', label: '会议名称', sortable: true},
|
||||
{prop: 'meetingTypeName', label: '会议类型', sortable: true},
|
||||
{prop: 'startTime', label: '会议时间', sortable: true},
|
||||
/*{prop: 'endTime', label: '结束时间', sortable: true},*/
|
||||
{prop: 'location', label: '会议地点', sortable: true},
|
||||
{prop: 'isCanLeave', label: '能否请假', sortable: true},
|
||||
],
|
||||
pageForm: {
|
||||
year: new Date().getFullYear().toString()
|
||||
},
|
||||
meetingTypeList: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
openView(row) {
|
||||
const {id, notifyId, hold} = row
|
||||
window.location.href = '/platform/meeting/manage/createMeeting?notifyId=' + notifyId + "&hold=" + true + "&id=" + id
|
||||
},
|
||||
openEdit(row) {
|
||||
const {id, notifyId, hold} = row
|
||||
window.location.href = '/platform/meeting/manage/createMeeting?notifyId=' + notifyId + "&hold=" + false + "&id=" + id
|
||||
},
|
||||
async doDelete(id) {
|
||||
try {
|
||||
const confirm = await this.$confirm('您确定要删除吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
if (confirm === 'confirm') {
|
||||
const resp = await $.post(loc() + '/doDelete', {id})
|
||||
if (resp.code === 0) {
|
||||
this.notifySuccess(resp.msg)
|
||||
this.doSearch()
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
this.meetingTypeList = await meetUtil.getAllMeetingType()
|
||||
this.pageData()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -0,0 +1,263 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<guava>
|
||||
<el-card shadow="never">
|
||||
<template #header>
|
||||
<el-row type="flex">
|
||||
<el-col :span="12" v-if="id">
|
||||
<el-button @click="location.replace('/platform/meeting/manage')"
|
||||
icon="el-icon-back"
|
||||
style="font-size: 16px" type="text">返回
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="12" class="text-right">
|
||||
<h3 style="color: rgb(24, 103, 176);">{{h3Title}}</h3>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
<!--<template #header>
|
||||
<h3 style="color: #1867b0">发起会议</h3>
|
||||
</template>-->
|
||||
|
||||
<el-form :model="formData" :rules="formRules" label-width="120px" ref="addForm">
|
||||
<vi-title title="会议基础信息"></vi-title>
|
||||
|
||||
<el-row :gutter="20" type="flex">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="会议名称" prop="meetingName">
|
||||
<el-input :disabled="hold" @input="meetingNameInput"
|
||||
placeholder="请填写会议名称" type="text"
|
||||
v-model.trim="formData.meetingName"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="会议地点" prop="location">
|
||||
<el-input :disabled="hold" placeholder="请填写会议地点"
|
||||
type="text" v-model.trim="formData.location"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="20" type="flex">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="会议类型" prop="typeId">
|
||||
<el-select :disabled="hold" filterable placeholder="请选择会议类型"
|
||||
style="width: 100%" v-model="formData.typeId">
|
||||
<el-option :label="item.meetingTypeName" :value="item.id"
|
||||
v-for="item in meetingTypeList"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<!--<el-form-item label="会议时间" prop="meetingTime">
|
||||
<el-date-picker end-placeholder="结束日期"
|
||||
format="yyyy-MM-dd HH:mm:ss"
|
||||
range-separator="至" start-placeholder="开始日期"
|
||||
style="width: 100%"
|
||||
:disabled="hold"
|
||||
type="datetimerange"
|
||||
v-model="formData.meetingTime"
|
||||
value-format="yyyy-MM-dd HH:mm:ss">
|
||||
</el-date-picker>
|
||||
</el-form-item>-->
|
||||
<el-form-item label="会议时间" prop="meetTime">
|
||||
<el-date-picker :disabled="hold"
|
||||
format="yyyy-MM-dd HH:mm:ss"
|
||||
placeholder="请选择会议时间"
|
||||
style="width: 100%"
|
||||
type="datetime"
|
||||
v-model="formData.meetTime"
|
||||
value-format="yyyy-MM-dd HH:mm:ss">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="20" type="flex">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="是否可以请假" prop="isCanLeave">
|
||||
<el-radio :disabled="hold" :label="true" border size="medium" v-model="formData.isCanLeave">
|
||||
允许
|
||||
</el-radio>
|
||||
<el-radio :disabled="hold" :label="false" border size="medium"
|
||||
v-model="formData.isCanLeave">不允许
|
||||
</el-radio>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-form-item label="是否多次签到">
|
||||
<el-checkbox v-model="formData.manySign"></el-checkbox>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" v-if="formData.isCanLeave">
|
||||
<el-form-item label="请假截止时间" prop="leaveDeadline">
|
||||
<el-date-picker :disabled="hold" format="yyyy-MM-dd HH:mm:ss"
|
||||
placeholder="请选择日期" style="width: 100%"
|
||||
type="datetime"
|
||||
v-model="formData.leaveDeadline"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="20" type="flex">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="会议描述" prop="meetingDescription">
|
||||
<el-input :disabled="hold" :rows="4" maxlength="400" placeholder="请输入会议描述"
|
||||
type="textarea" v-model="formData.meetingDescription"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="20" type="flex" v-show="formData.manySign">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="场次">
|
||||
<!--# include("/platform/meeting/manage/add_time_period.html"){} #-->
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<!--# include("/platform/meeting/manage/add_users.html"){} #-->
|
||||
|
||||
</el-form>
|
||||
|
||||
<el-row justify="end" style="margin-top: 20px" type="flex" v-if="!hold">
|
||||
<el-button @click="doSubmit" type="primary">提交</el-button>
|
||||
</el-row>
|
||||
|
||||
</el-card>
|
||||
</guava>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
<!--# include("/platform/meeting/includeJs/meetingUtil.js"){} #-->
|
||||
const meetUtil = new meetingUtil()
|
||||
const vue = new Vue({
|
||||
el: '#app',
|
||||
mixins: [initTableMixins],
|
||||
components: {
|
||||
'msg-notify': httpVueLoader('/components/msgNotify/msgNotify.vue'),
|
||||
},
|
||||
data() {
|
||||
const that = this
|
||||
return {
|
||||
h3Title: "发起会议",
|
||||
id: "",
|
||||
notify_id: "",
|
||||
hold: false,
|
||||
meetingTypeList: [],
|
||||
formData: {
|
||||
isCanLeave: false,
|
||||
meetingTimePeriods: [{timePeriodName: '', startTime: '', endTime: ''}],
|
||||
sendTypes: [],
|
||||
meetingTime: [],
|
||||
meetTime: '',
|
||||
},
|
||||
pickerOptions: {
|
||||
disabledDate(time) {
|
||||
return (
|
||||
moment(time.getTime()).format("YYYY-MM-DD HH:mm:ss") > that.formData.meetingTime[1] || moment(time.getTime()).format("YYYY-MM-DD HH:mm:ss") < that.formData.meetingTime[0]
|
||||
);
|
||||
}
|
||||
},
|
||||
formRules: {
|
||||
meetingName: [{required: true, message: '请填写会议名称', trigger: ['blur', 'change']}],
|
||||
location: [{required: true, message: '请填写会议地点', trigger: ['blur', 'change']}],
|
||||
typeId: [{required: true, message: '请选择会议类型', trigger: ['blur', 'change']}],
|
||||
meetingTime: [{required: true, message: '请选择会议时间', trigger: ['blur', 'change']}],
|
||||
meetTime: [{required: true, message: '请选择会议时间', trigger: ['blur', 'change']}],
|
||||
sendType: [{required: true, message: '请选择发送方式', trigger: ['blur', 'change']}],
|
||||
msgContent: [{required: true, message: '请填写消息内容', trigger: ['blur', 'change']}],
|
||||
leaveDeadline: [{required: true, message: '请选择请假截止时间', trigger: ['blur', 'change']}],
|
||||
isCanLeave: [{required: true, message: '请选择', trigger: ['blur', 'change']}],
|
||||
},
|
||||
msgData: {
|
||||
type: "",
|
||||
sendTypes: []
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
meetingNameInput(val) {
|
||||
this.$set(this.msgData, "title", val)
|
||||
this.formData.meetingTimePeriods[0].timePeriodName = val
|
||||
},
|
||||
async doSubmit() {
|
||||
|
||||
const valid = await this.$refs["addForm"].validate()
|
||||
if (valid) {
|
||||
const submitFormData = clone(this.formData)
|
||||
submitFormData.startTime = this.formData.meetingTime && this.formData.meetingTime.length > 0 ? this.formData.meetingTime[0] : ''
|
||||
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('下一步需要到消息管理系统中择机发送短信通知', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
showCancelButton: false,
|
||||
type: 'warning'
|
||||
})
|
||||
}
|
||||
const resp = await $.post("/platform/meeting/manage" + (this.formData.id ? "/doEdit" : "/doAdd"), {
|
||||
meetingInfo: JSON.stringify(submitFormData),
|
||||
msgNotify: JSON.stringify(this.msgData),
|
||||
users: JSON.stringify(this.msgData.users.length > 0 ? this.msgData.users.map(v => v.id) : this.msgData.users),
|
||||
})
|
||||
if (resp.code === 0) {
|
||||
this.notifySuccess(resp.msg)
|
||||
sublime.jumpPagePjax('/platform/meeting/manage')
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
async findOne(id) {
|
||||
const {data} = await $.post("/platform/meeting/manage/findOne", {id})
|
||||
data.meetingTime = [data.startTime, data.endTime]
|
||||
data.meetTime = data.startTime
|
||||
this.formData = data
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
this.meetingTypeList = await meetUtil.getAllMeetingType()
|
||||
this.id = GetQueryString("id")
|
||||
|
||||
this.notify_id = GetQueryString("notifyId")
|
||||
if (this.id) {
|
||||
this.hold = GetQueryString("hold")
|
||||
this.findOne(this.id)
|
||||
this.h3Title = this.hold === "true" ? "查看会议" : "编辑会议"
|
||||
this.hold = this.hold !== 'false'
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'formData.meetingTime'(val) {
|
||||
if (val) {
|
||||
this.formData.meetingTimePeriods[0].startTime = val[0]
|
||||
this.formData.meetingTimePeriods[0].endTime = val[1]
|
||||
}
|
||||
},
|
||||
'formData.meetTime'(val) {
|
||||
if (val) {
|
||||
//结束时间往后加30分钟
|
||||
const endTime = moment(val).add(30, 'm').format('YYYY-MM-DD HH:mm:ss')
|
||||
this.formData.meetingTime = [val, endTime]
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -0,0 +1,49 @@
|
||||
<!-- 会议时间段 -->
|
||||
|
||||
<el-table :data="formData.meetingTimePeriods" border style="width: 100%">
|
||||
<el-table-column label="名称" prop="timePeriodName">
|
||||
<template slot-scope="scope">
|
||||
<el-input :disabled="hold" maxlength="20" v-model="scope.row.timePeriodName"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="开始时间" prop="startTime" sortable>
|
||||
<template slot-scope="scope">
|
||||
<el-date-picker
|
||||
:disabled="hold"
|
||||
:picker-options="pickerOptions"
|
||||
placeholder="选择开始时间"
|
||||
type="datetime"
|
||||
v-model="scope.row.startTime"
|
||||
value-format="yyyy-MM-dd HH:mm">
|
||||
</el-date-picker>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="结束时间" prop="endTime">
|
||||
<template slot-scope="scope">
|
||||
<el-date-picker
|
||||
:disabled="hold"
|
||||
:picker-options="pickerOptions"
|
||||
placeholder="选择结束时间"
|
||||
type="datetime"
|
||||
v-model="scope.row.endTime"
|
||||
value-format="yyyy-MM-dd HH:mm">
|
||||
</el-date-picker>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="100px">
|
||||
<template scope="scope" slot="header">
|
||||
<el-button :disabled="hold"
|
||||
@click="formData.meetingTimePeriods.push({timePeriodName:null,startTime:null,endTime:null})"
|
||||
icon="el-icon-circle-plus-outline"
|
||||
size="small"
|
||||
type="primary"></el-button>
|
||||
</template>
|
||||
<template scope="scope">
|
||||
<el-button :disabled="hold"
|
||||
@click="formData.meetingTimePeriods.splice(scope.$index, 1)"
|
||||
icon="el-icon-delete"
|
||||
size="small"
|
||||
type="danger"></el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -0,0 +1,3 @@
|
||||
<vi-title title="参与人员信息"></vi-title>
|
||||
|
||||
<msg-notify :hold="hold" :notify_id="notify_id" :title_disabled="true" v-model="msgData"></msg-notify>
|
||||
@@ -0,0 +1,128 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<guava>
|
||||
<el-card shadow="never">
|
||||
<div class="search">
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">年度:</div>
|
||||
<div class="search-item-option">
|
||||
<el-date-picker
|
||||
placeholder="选择年份"
|
||||
type="year"
|
||||
v-model="pageForm.year"
|
||||
value-format="yyyy">
|
||||
</el-date-picker>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">会议名称:</div>
|
||||
<div class="search-item-option">
|
||||
<el-input clearable
|
||||
placeholder="可输入会议名称、地点进行查询"
|
||||
v-model="pageForm.searchKeyword"></el-input>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-query">
|
||||
<el-button @click="doSearch" icon="el-icon-search" type="primary">搜索</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<el-card class="mt10" shadow="never">
|
||||
<table-tool :app="this" label="会议信息">
|
||||
<template #func>
|
||||
</template>
|
||||
</table-tool>
|
||||
<el-table :data="tableData" :size="tableSize" @sort-change="pageOrder"
|
||||
align="center" header-align="center">
|
||||
<el-table-column align="center" header-align="center" label="序号" type="index" width="80">
|
||||
<template scope="scope">
|
||||
<span>{{ scope.$index + (pageForm.pageNumber - 1) * pageForm.pageSize + 1 }} </span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
:label="column.label"
|
||||
:prop="column.prop"
|
||||
:sortable="column.sortable"
|
||||
:width="column.width"
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
v-for="column in tableColumns"
|
||||
>
|
||||
<template scope="{row}" v-if="column.prop=='isCanLeave'">
|
||||
<span class="text-muted" v-if="row.isCanLeave==null">未设置</span>
|
||||
<span class="text-success" v-if="row.isCanLeave==true">能</span>
|
||||
<span class="text-danger" v-if="row.isCanLeave==false">否</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="操作" width="200px">
|
||||
<template scope="{row}">
|
||||
<el-button size="mini" type="primary">编辑</el-button>
|
||||
<el-button @click="doDelete(row.id)" size="mini" type="danger">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
</el-table>
|
||||
</el-card>
|
||||
</guava>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<!--# include("/platform/meeting/includeJs/meetingUtil.js"){} #-->
|
||||
const meetUtil = new meetingUtil()
|
||||
window['vue'] = new Vue({
|
||||
el: '#app',
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {
|
||||
tableColumns: [
|
||||
{prop: 'meetingName', label: '会议名称', sortable: true},
|
||||
{prop: 'meetingTypeName', label: '会议类型', sortable: true},
|
||||
{prop: 'startTime', label: '开始时间', sortable: true},
|
||||
{prop: 'endTime', label: '结束时间', sortable: true},
|
||||
{prop: 'location', label: '会议地点', sortable: true},
|
||||
{prop: 'isCanLeave', label: '能否请假', sortable: true},
|
||||
],
|
||||
pageForm: {
|
||||
year: new Date().getFullYear().toString()
|
||||
},
|
||||
meetingTypeList: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async doDelete(id) {
|
||||
try {
|
||||
const confirm = await this.$confirm('您确定要删除吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
if (confirm === 'confirm') {
|
||||
const resp = await $.post(loc() + '/doDelete', {id: id})
|
||||
if (resp.code === 0) {
|
||||
this.notifySuccess(resp.msg)
|
||||
this.doSearch()
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
this.meetingTypeList = await meetUtil.getAllMeetingType()
|
||||
this.pageData()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -0,0 +1,377 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<style>
|
||||
.qrcode {
|
||||
min-width: 240px;
|
||||
text-align: center;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.real-data {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.real-data .data-card {
|
||||
border-radius: 10px;
|
||||
width: calc((100% - 80px) / 4);
|
||||
min-width: 100px;
|
||||
/*height: 150px;*/
|
||||
/*min-height: 100px;*/
|
||||
/*max-height: 150px;*/
|
||||
/*background: #3CB371;*/
|
||||
/*background: #000;*/
|
||||
background-image: linear-gradient(141deg, #9fb8ad 0%, #1fc8db 51%, #2cb5e8 75%);
|
||||
margin: 10px 0 10px 20px;
|
||||
padding: 10px;
|
||||
color: #ffffff;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.real-data .data-card .data-card-title {
|
||||
font-size: 20px;
|
||||
max-width: 100%;
|
||||
text-overflow: ellipsis;
|
||||
word-break: keep-all;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
flex: 1;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.real-data .data-card .data-card-num {
|
||||
font-size: 90px;
|
||||
flex: auto;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.real-data .data-card .flow-border {
|
||||
position: absolute;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.timePeriod_card {
|
||||
border-top: 5px solid #106898;
|
||||
}
|
||||
|
||||
.timePeriod_card .el-form-item {
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
|
||||
img {
|
||||
height: 100% !important;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.operation {
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
left: 0;
|
||||
top: 0;
|
||||
z-index: 1111;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<guava ref="guava" v-model="guavaIndex">
|
||||
<el-card shadow="never">
|
||||
<div class="search">
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">年度:</div>
|
||||
<div class="search-item-option">
|
||||
<el-date-picker
|
||||
placeholder="选择年份"
|
||||
style="width: 100%" type="year"
|
||||
v-model="pageForm.year"
|
||||
value-format="yyyy">
|
||||
</el-date-picker>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">会议名称:</div>
|
||||
<div class="search-item-option">
|
||||
<el-input clearable
|
||||
placeholder="可输入会议名称、地点进行查询"
|
||||
v-model="pageForm.searchKeyword"></el-input>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">会议类型:</div>
|
||||
<div class="search-item-option">
|
||||
<el-select clearable style="width: 100%" v-model="pageForm.typeId">
|
||||
<el-option :label="item.meetingTypeName"
|
||||
:value="item.id"
|
||||
v-for="item in meetingTypeList"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="search-query">
|
||||
<el-button @click="doSearch" icon="el-icon-search" type="primary">搜索</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<el-card class="mt10" shadow="never">
|
||||
<table-tool :app="this" label="会议信息">
|
||||
<template #func>
|
||||
</template>
|
||||
</table-tool>
|
||||
<el-table :data="tableData" :size="tableSize" @sort-change="pageOrder"
|
||||
align="center"
|
||||
header-align="center" ref="meetingTable">
|
||||
<el-table-column type="expand">
|
||||
<template scope="scope">
|
||||
<el-row :gutter="20" justify="start" style="flex-wrap: wrap" type="flex"
|
||||
v-if="scope.row.timePeriods && scope.row.timePeriods.length>0">
|
||||
<el-col span="5" v-for="tp in scope.row.timePeriods">
|
||||
<el-card class="mb10 timePeriod_card" shadow="hover">
|
||||
<el-form label-width="80px">
|
||||
<el-form-item label="名称">{{tp.timePeriodName}}</el-form-item>
|
||||
<el-form-item label="会议时间">{{tp.startTime}}</el-form-item>
|
||||
<!--<el-form-item label="结束时间">{{tp.endTime}}</el-form-item>-->
|
||||
</el-form>
|
||||
<el-row justify="space-around"
|
||||
style="border-top: 1px solid #ebeef5;padding: 20px 0 0 0"
|
||||
type="flex">
|
||||
<el-button @click="exportSignature(tp.id)" size="medium" type="text">
|
||||
导出签字表
|
||||
</el-button>
|
||||
<el-button @click="title = tp.timePeriodName; openOnline(tp.id,scope.row.id)"
|
||||
size="medium" type="text">
|
||||
扫描二维码
|
||||
</el-button>
|
||||
</el-row>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row v-else>
|
||||
<el-empty description="没有时间段"></el-empty>
|
||||
</el-row>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column align="center" header-align="center" label="序号" type="index" width="80">
|
||||
<template scope="scope">
|
||||
<span>{{ scope.$index + (pageForm.pageNumber - 1) * pageForm.pageSize + 1 }} </span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
:label="column.label"
|
||||
:prop="column.prop"
|
||||
:sortable="column.sortable"
|
||||
:width="column.width"
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
v-for="column in tableColumns"
|
||||
>
|
||||
<template scope="{row}" v-if="column.prop=='isCanLeave'">
|
||||
<span class="text-muted" v-if="row.isCanLeave==null">未设置</span>
|
||||
<span class="text-success" v-if="row.isCanLeave==true">能</span>
|
||||
<span class="text-danger" v-if="row.isCanLeave==false">否</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="操作" width="200px">
|
||||
<template scope="{row}">
|
||||
<el-button @click="toggleRowTimePeriod(row)" size="mini" type="primary">展开</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
|
||||
<template #view>
|
||||
<div style="min-width: 500px;height: 100%;position: relative">
|
||||
<el-row type="flex">
|
||||
<el-col :span="4" class="qrcode">
|
||||
<div @click="downLoadQrCode" title="点击二维码可下载">
|
||||
<qrcode :value="qrCodeUrl" ref="qrCode"
|
||||
tag="img"></qrcode>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="20" class="real-data">
|
||||
<template v-for="rd of realTimeData">
|
||||
<div class="data-card">
|
||||
<div class="data-card-title">
|
||||
{{rd.label}}
|
||||
</div>
|
||||
<div class="data-card-num">
|
||||
<count-to :end-val="rd.value"
|
||||
:start-val="getLastValue(rd.key)"></count-to>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<!-- <el-row class="mt20">-->
|
||||
<el-table :data="userData" :max-height="signTableHeight" class="mt20" ref="signTable">
|
||||
<el-table-column label="姓名" prop="username"></el-table-column>
|
||||
<el-table-column label="工号" prop="loginname"></el-table-column>
|
||||
<el-table-column label="性别" prop="sex"></el-table-column>
|
||||
<el-table-column label="单位" prop="unitname"></el-table-column>
|
||||
<el-table-column label="签到时间" prop="signInDateTime"></el-table-column>
|
||||
<el-table-column label="签到名次">
|
||||
<template scope="scope">
|
||||
{{userData.length - scope.$index}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- </el-row>-->
|
||||
</div>
|
||||
</template>
|
||||
</guava>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<!--# include("/platform/meeting/includeJs/meetingUtil.js"){} #-->
|
||||
const meetUtil = new meetingUtil()
|
||||
let pollingInterval = null
|
||||
const intervalTime = 3500
|
||||
window['vue'] = new Vue({
|
||||
el: '#app',
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {
|
||||
title: '',
|
||||
tableColumns: [
|
||||
{prop: 'meetingName', label: '会议名称', sortable: true},
|
||||
{prop: 'meetingTypeName', label: '会议类型', sortable: true},
|
||||
{prop: 'startTime', label: '会议时间', sortable: true},
|
||||
/*{prop: 'endTime', label: '结束时间', sortable: true},*/
|
||||
{prop: 'location', label: '会议地点', sortable: true},
|
||||
{prop: 'isCanLeave', label: '能否请假', sortable: true},
|
||||
],
|
||||
pageForm: {
|
||||
year: new Date().getFullYear().toString()
|
||||
},
|
||||
meetingTypeList: [],
|
||||
lastTimeData: [],
|
||||
realTimeData: [],
|
||||
userData: [],
|
||||
meetingId: null,
|
||||
timePeriodId: null,
|
||||
qrcodeVisible: false,
|
||||
qrCodeUrl: null,
|
||||
signTableHeight: 600
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
guavaIndex(val) {
|
||||
if (val === 'index') {
|
||||
this.toggleFullScreen()
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
//导出签字表
|
||||
exportSignature(timePeriodId) {
|
||||
window.open(loc() + '/exportSignature/' + timePeriodId)
|
||||
},
|
||||
//打开在线
|
||||
async openOnline(timePeriodId, meetingId) {
|
||||
this.meetingId = meetingId
|
||||
this.timePeriodId = timePeriodId
|
||||
this.$refs.guava.view()
|
||||
this.toggleFullScreen()
|
||||
this.calcSignTableHeight()
|
||||
this.generateQrCodeUrl(timePeriodId, meetingId)
|
||||
this.stopInterval()
|
||||
pollingInterval = this.startPolling(this.getRealTimeData)
|
||||
},
|
||||
calcSignTableHeight() {
|
||||
this.$nextTick(() => {
|
||||
setTimeout(() => {
|
||||
console.log(window.innerHeight)
|
||||
const offsetTop = this.$refs.signTable.$el.offsetTop
|
||||
const th = window.innerHeight - 54 - 40 - offsetTop
|
||||
console.log(th)
|
||||
this.$set(this, 'signTableHeight', th)
|
||||
})
|
||||
})
|
||||
},
|
||||
async generateQrCodeUrl(tpId, meetingId) {
|
||||
const resp = await $.get(loc() + '/generateQrCodeUrl', {tpId, meetingId})
|
||||
if (resp.code === 0) {
|
||||
this.qrCodeUrl = resp.data
|
||||
} else {
|
||||
this.notifyError(resp.msg)
|
||||
}
|
||||
},
|
||||
async getRealTimeData() {
|
||||
this.lastTimeData = clone(this.realTimeData)
|
||||
const resp = await $.get(loc() + '/getRealTimeData/' + this.timePeriodId)
|
||||
if (resp.code === 0) {
|
||||
this.lastTimeData = clone(this.realTimeData)
|
||||
this.$set(this, 'realTimeData', resp.data.countData)
|
||||
//去重
|
||||
let ud = clone(this.userData)
|
||||
ud.unshift(...resp.data.userData)
|
||||
let uMap = new Map()
|
||||
for (let u of ud) {
|
||||
if (!uMap.has(u.loginname)) {
|
||||
uMap.set(u.loginname, u)
|
||||
}
|
||||
}
|
||||
this.$set(this, 'userData', [...uMap.values()])
|
||||
} else {
|
||||
|
||||
}
|
||||
},
|
||||
startPolling(func) {
|
||||
this.lastTimeData = []
|
||||
this.realTimeData = []
|
||||
this.userData = []
|
||||
func()
|
||||
return setInterval(func, intervalTime)
|
||||
},
|
||||
stopInterval() {
|
||||
if (pollingInterval) {
|
||||
clearInterval(pollingInterval)
|
||||
}
|
||||
},
|
||||
getLastValue(key) {
|
||||
if (this.lastTimeData && this.lastTimeData.length > 0) {
|
||||
return this.lastTimeData.find(v => v.key === key).value
|
||||
} else {
|
||||
return 0
|
||||
}
|
||||
},
|
||||
downLoadQrCode() {
|
||||
if (this.$refs['qrCode']) {
|
||||
const src = this.$refs['qrCode'].$el.currentSrc
|
||||
const aEle = document.createElement('a')
|
||||
aEle.setAttribute("download", '签到二维码')
|
||||
aEle.setAttribute("href", src)
|
||||
aEle.click()
|
||||
}
|
||||
},
|
||||
toggleRowTimePeriod(row) {
|
||||
this.$refs['meetingTable'].toggleRowExpansion(row)
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
this.meetingTypeList = await meetUtil.getAllMeetingType()
|
||||
this.pageData()
|
||||
// this.openOnline('2bb2b18a053b4c8ca00e27d30e8f4573')
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.stopInterval()
|
||||
}
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -0,0 +1,321 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
<style>
|
||||
.timeTable {
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<guava>
|
||||
<template>
|
||||
<el-card class="mt10" shadow="never">
|
||||
<div class="btn-group tool-button mr10">
|
||||
<el-date-picker @change="getMeetingList(pageForm.meetingTime)" clearable
|
||||
end-placeholder="结束日期"
|
||||
range-separator="-"
|
||||
start-placeholder="开始日期"
|
||||
type="daterange"
|
||||
v-model="pageForm.meetingTime"
|
||||
value-format="yyyy-MM-dd HH:mm:ss">
|
||||
</el-date-picker>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="btn-group tool-button mr10">
|
||||
<el-select @change="doSearch" clearable
|
||||
filterable="true"
|
||||
placeholder="请输入会议名称"
|
||||
style="width: 100%;" v-model="pageForm.meetingId">
|
||||
<el-option :label="item.meetingName" :value="item.id" v-for="item in meetingList"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
|
||||
<div class="btn-group tool-button mr10">
|
||||
<el-select @change="doSearch" clearable placeholder="请选择会议类型" v-model="pageForm.typeId">
|
||||
<el-option :label="item.meetingTypeName"
|
||||
:value="item.id"
|
||||
v-for="item in meetingTypeList"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
|
||||
</el-card>
|
||||
<el-card class="mt10" shadow="never">
|
||||
<table-tool :app="this" label="会议时间段列表">
|
||||
<template #func>
|
||||
</template>
|
||||
</table-tool>
|
||||
<el-table :data="tableData" :size="tableSize"
|
||||
@sort-change="pageOrder"
|
||||
row-key="id">
|
||||
<el-table-column label="序号" type="index" width="80">
|
||||
<template scope="scope">
|
||||
<span>{{ scope.$index + (pageForm.pageNumber - 1) * pageForm.pageSize + 1 }} </span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column type="expand">
|
||||
<template scope="{row}">
|
||||
<el-table :data="row.meetingTimeData" :header-cell-style="{color:'#1867b0'}" row-key="id">
|
||||
<el-table-column
|
||||
:label="column.label"
|
||||
:prop="column.prop"
|
||||
:sortable="column.sortable"
|
||||
:width="column.width"
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
v-for="column in ((row.moduleName === 'teacherMeeting'||row.moduleName === 'gdh') ? jdhTimeTableColumns : timeTableColumns)">
|
||||
|
||||
<template scope="{row}" v-if="column.prop==='total'">
|
||||
<el-link @click="openView(row,'total')" type="primary">{{row.total}}</el-link>
|
||||
</template>
|
||||
<template scope="{row}" v-else-if="column.prop==='signJoinNum'">
|
||||
<el-link @click="openView(row,'signJoinNum')" type="primary">
|
||||
{{row.signJoinNum}}
|
||||
</el-link>
|
||||
</template>
|
||||
<template scope="{row}" v-else-if="column.prop==='notJoinNum'">
|
||||
<el-link @click="openView(row,'notJoinNum')" type="primary">{{row.notJoinNum}}
|
||||
</el-link>
|
||||
</template>
|
||||
<template scope="{row}" v-else-if="column.prop==='notJoinNullNum'">
|
||||
<el-link @click="openView(row,'notJoinNullNum')" type="primary">
|
||||
{{row.notJoinNullNum}}
|
||||
</el-link>
|
||||
</template>
|
||||
<template scope="{row}" v-else-if="column.prop==='zsdbNum'">
|
||||
<el-link @click="openView(row,'zsdbNum')" type="primary">
|
||||
{{row.zsdbNum}}
|
||||
</el-link>
|
||||
</template>
|
||||
<template scope="{row}" v-else-if="column.prop==='lxdbNum'">
|
||||
<el-link @click="openView(row,'lxdbNum')" type="primary">
|
||||
{{row.lxdbNum}}
|
||||
</el-link>
|
||||
</template>
|
||||
<template scope="{row}" v-else-if="column.prop==='proportionNum'">
|
||||
{{proportionNum(row.joinNum,row.total)}}
|
||||
</template>
|
||||
|
||||
</el-table-column>
|
||||
<el-table-column align="center" fixed="right" header-align="center" label="操作">
|
||||
<template scope="{row}">
|
||||
<el-button @click="exportUser(row)" size="mini" type="primary">导出人员</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
:label="column.label"
|
||||
:prop="column.prop"
|
||||
:sortable="column.sortable"
|
||||
:width="column.width"
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
v-for="column in tableColumns">
|
||||
</el-table-column>
|
||||
|
||||
</el-table>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
|
||||
<el-dialog :close-on-click-modal="false" :visible.sync="dialogTableVisible" title="人数详情">
|
||||
<div class="btn-group tool-button mr10">
|
||||
<el-input @keyup.enter.native="doSearch" clearable placeholder="请输入内容"
|
||||
style="width: 100%"
|
||||
v-model="pageFormUser.searchKeyword">
|
||||
<el-select placeholder="查询类型" slot="prepend" style="width: 80px;"
|
||||
v-model="pageFormUser.searchName">
|
||||
<el-option label="姓名" value="u.username"></el-option>
|
||||
<el-option label="工号" value="u.loginname"></el-option>
|
||||
</el-select>
|
||||
</el-input>
|
||||
|
||||
</div>
|
||||
<div class="btn-group tool-button mr10"
|
||||
v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H03')}">
|
||||
<el-select @change="flushUnits" @clear="flushUnits" clearable="true"
|
||||
filterable="true"
|
||||
placeholder="所属工会" style="width: 100%;"
|
||||
v-model="pageFormUser.unionId">
|
||||
<el-option :label="item.unionname" :value="item.id" v-for="item in unions"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
|
||||
<div class="btn-group tool-button mr10">
|
||||
<el-select clearable="true" filterable="true" placeholder="所属单位"
|
||||
style="width: 100%;"
|
||||
v-model="pageFormUser.unitId">
|
||||
<el-option :label="item.name" :value="item.id" v-for="item in units"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="btn-group tool-button ">
|
||||
<el-button @click="doSearchUser" icon="el-icon-search" type="primary">搜索</el-button>
|
||||
</div>
|
||||
<el-table :data="userTableData" :row-key="(row)=>{row.id}"
|
||||
:size="tableSize">
|
||||
<el-table-column label="序号" type="index" width="80">
|
||||
<template scope="scope">
|
||||
<span>{{ scope.$index + (pageFormUser.pageNumber - 1) * pageFormUser.pageSize + 1 }} </span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="用户名" prop="loginName"></el-table-column>
|
||||
<el-table-column label="姓名" prop="userName"></el-table-column>
|
||||
<el-table-column label="所属单位" prop="unitName"></el-table-column>
|
||||
<el-table-column label="院级工会" prop="unionName"></el-table-column>
|
||||
</el-table>
|
||||
<el-pagination
|
||||
:current-page="pageFormUser.pageNumber"
|
||||
:page-size="pageFormUser.pageSize"
|
||||
:page-sizes="[5,10, 20, 30, 50]"
|
||||
:total="pageFormUser.totalCount"
|
||||
@current-change="pageNumberUserChange"
|
||||
@size-change="pageSizeUserChange"
|
||||
layout="total, sizes, prev, pager, next">
|
||||
</el-pagination>
|
||||
|
||||
</el-dialog>
|
||||
|
||||
</guava>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<!--# include("/platform/meeting/includeJs/meetingUtil.js"){} #-->
|
||||
const meetUtil = new meetingUtil()
|
||||
window.vue = new Vue({
|
||||
el: '#app',
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {
|
||||
meetingTypeList: [],
|
||||
unions: [],
|
||||
units: [],
|
||||
pageFormUser: {
|
||||
searchName: "u.username",
|
||||
searchKeyword: "",
|
||||
pageNumber: 1,
|
||||
pageSize: 10,
|
||||
totalCount: 0,
|
||||
pageOrderName: "",
|
||||
pageOrderBy: ""
|
||||
},
|
||||
meetingTimeData: {},
|
||||
meetingNumType: "",
|
||||
userTableData: [],
|
||||
meetingList: [],
|
||||
dialogTableVisible: false,
|
||||
oldSignNum: 0,
|
||||
newSignNum: 0,
|
||||
timeTableColumns: [
|
||||
{prop: 'timePeriodName', label: '时间段名称'},
|
||||
{prop: 'startTime', label: '会议时间'},
|
||||
/*{prop: 'endTime', label: '结束时间'},*/
|
||||
{prop: 'total', label: '应到人数'},
|
||||
{prop: 'signJoinNum', label: '实到人数'},
|
||||
{prop: 'notJoinNum', label: '请假人数'},
|
||||
{prop: 'notJoinNullNum', label: '未到人数'},
|
||||
{prop: 'proportionNum', label: '人数比例'},
|
||||
],
|
||||
jdhTimeTableColumns: [
|
||||
{prop: 'timePeriodName', label: '时间段名称'},
|
||||
{prop: 'startTime', label: '会议时间'},
|
||||
/*{prop: 'endTime', label: '结束时间'},*/
|
||||
{prop: 'total', label: '应到人数'},
|
||||
{prop: 'signJoinNum', label: '实到人数'},
|
||||
{prop: 'zsdbNum', label: '正式代表'},
|
||||
{prop: 'lxdbNum', label: '列席代表'},
|
||||
{prop: 'notJoinNum', label: '请假人数'},
|
||||
{prop: 'notJoinNullNum', label: '未到人数'},
|
||||
{prop: 'proportionNum', label: '人数比例'},
|
||||
],
|
||||
tableColumns: [
|
||||
{prop: 'meetingName', label: '会议名称'},
|
||||
{prop: 'meetingTypeName', label: '会议类型'},
|
||||
{prop: 'startTime', label: '会议时间'},
|
||||
/*{prop: 'endTime', label: '结束时间'},*/
|
||||
{prop: 'leaveDeadline', label: '请假截至时间'},
|
||||
]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
proportionNum(joinNum, total) {
|
||||
console.log(joinNum, total)
|
||||
return ((joinNum ? joinNum : 0) / total * 100).toFixed(2) + "%"
|
||||
},
|
||||
exportUser(row) {
|
||||
|
||||
window.open(loc() + '/exportUser?id=' + row.id + "&meetingId=" + row.meetingId)
|
||||
},
|
||||
doSearchUser() {
|
||||
this.pageFormUser.pageNumber = 1
|
||||
this.getUserData(this.meetingTimeData, this.meetingNumType)
|
||||
},
|
||||
pageNumberUserChange(val) {
|
||||
this.pageFormUser.pageNumber = val;
|
||||
this.getUserData(this.meetingTimeData, this.meetingNumType)
|
||||
},
|
||||
pageSizeUserChange(val) {
|
||||
this.pageFormUser.pageSize = val;
|
||||
this.getUserData(this.meetingTimeData, this.meetingNumType)
|
||||
},
|
||||
async getMeetingList(meetingTime) {
|
||||
const {data} = await $.post(loc() + "/getMeetingList", {meetingTime: JSON.stringify(meetingTime)})
|
||||
this.meetingList = data
|
||||
/*if (this.meetingList.length > 0) {
|
||||
this.$set(this.pageForm, "meetingId", this.meetingList[0].id)
|
||||
this.pageData()
|
||||
}*/
|
||||
},
|
||||
async openView(row, type) {
|
||||
this.meetingTimeData = row
|
||||
this.meetingNumType = type
|
||||
await this.getUserData(row, type)
|
||||
this.unions = await getUnions(null)
|
||||
await this.flushUnits()
|
||||
this.dialogTableVisible = true
|
||||
},
|
||||
async flushUnits() {
|
||||
this.$set(this.pageForm, "unitId", "")
|
||||
if ("${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H03')}" === 'true') {
|
||||
this.units = await getUnits(this.pageForm.unionId)
|
||||
} else {
|
||||
this.units = await getUnits("${@shiro.getPrincipalProperty('unit').getUnionid()}")
|
||||
}
|
||||
},
|
||||
async getUserData(row, type) {
|
||||
const {id, meetingId} = row
|
||||
const pageForm = clone(this.pageFormUser)
|
||||
pageForm.id = id
|
||||
pageForm.meetingId = meetingId
|
||||
pageForm.type = type
|
||||
const resp = await $.post(loc() + "/getUserData", pageForm)
|
||||
if (resp.code === 0) {
|
||||
this.userTableData = resp.data.list
|
||||
this.pageFormUser.totalCount = resp.data.totalCount
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
async created() {
|
||||
this.meetingTypeList = await meetUtil.getAllMeetingType()
|
||||
let format = moment().add(-1, 'year').format('YYYY-MM-DD HH:mm:ss');
|
||||
let format1 = moment().format('YYYY-MM-DD HH:mm:ss');
|
||||
this.$set(this.pageForm, "meetingTime", [format, format1])
|
||||
await this.getMeetingList(this.pageForm.meetingTime)
|
||||
await this.pageData()
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -51,10 +51,10 @@ layout("/layouts/platform.html"){
|
||||
<el-card shadow="never" class="mt20">
|
||||
<el-table :data="tableData" header-align="center" style="width: 100%">
|
||||
<el-table-column align="center" label="序号" type="index" :index="indexMethod"></el-table-column>
|
||||
<el-table-column align="center" label="标题" prop="qtitle" show-overflow-tooltip="true"></el-table-column>
|
||||
<el-table-column align="center" label="标题" prop="qtitle"></el-table-column>
|
||||
<el-table-column align="center" label="说明" prop="qsm" show-overflow-tooltip="true">
|
||||
<template scope="scope">
|
||||
<div v-if="scope.row.qsm">{{removeHTMLTag(scope.row.qsm)}}</div>
|
||||
<div v-html="scope.row.qsm" v-if="scope.row.qsm">{{scope.row.qsm}}</div>
|
||||
<span v-else>暂无</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -90,14 +90,13 @@ layout("/layouts/platform.html"){
|
||||
|
||||
<template #edit_func>
|
||||
<el-button @click="doExport" icon="el-icon-printer" type="primary">导出</el-button>
|
||||
<el-button @click="doExportByUnion" icon="el-icon-printer" type="primary">按分工会导出</el-button>
|
||||
</template>
|
||||
<template #edit>
|
||||
<div class="pl10 pr10">
|
||||
<el-row class="text-center">
|
||||
<h2 style="margin: 0">{{viewData.q.qtitle}}</h2>
|
||||
</el-row>
|
||||
<el-row class="mb20" style="width: 96%; margin: 20px auto 0;">
|
||||
<el-row class="mb20">
|
||||
<div v-html="viewData.q.qsm"></div>
|
||||
</el-row>
|
||||
|
||||
@@ -165,7 +164,7 @@ layout("/layouts/platform.html"){
|
||||
:visible.sync="tkViewDialogVisible"
|
||||
custom-class="ViewDialogClass"
|
||||
title="详细信息"
|
||||
width="60%"
|
||||
width="50%"
|
||||
>
|
||||
<el-row>
|
||||
<div class="btn-group tool-button mt5">
|
||||
@@ -178,56 +177,43 @@ layout("/layouts/platform.html"){
|
||||
</div>
|
||||
</el-row>
|
||||
|
||||
<el-table
|
||||
:data="tkTableData"
|
||||
header-align="center"
|
||||
size="medium"
|
||||
style="width: 100%; margin-top: 20px"
|
||||
>
|
||||
<el-table-column
|
||||
align="center"
|
||||
<el-row class="el-table-container" style="margin-top: 20px;">
|
||||
<el-table
|
||||
:data="tkTableData"
|
||||
header-align="center"
|
||||
label="序号"
|
||||
type="index"
|
||||
size="medium"
|
||||
style="width: 100%"
|
||||
>
|
||||
<template scope="scope">
|
||||
<span>{{scope.$index+(tkPageForm.pageNumber - 1) * tkPageForm.pageSize + 1}} </span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
header-align="center"
|
||||
label="提交时间"
|
||||
prop="rtime"
|
||||
width="180px">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
header-align="center"
|
||||
label="提交人"
|
||||
show-overflow-tooltip
|
||||
prop="username">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
header-align="center"
|
||||
label="所属工会"
|
||||
show-overflow-tooltip
|
||||
prop="unionname">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
header-align="center"
|
||||
label="文本"
|
||||
prop="rval"
|
||||
width="600px">
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-table-column
|
||||
align="center"
|
||||
header-align="center"
|
||||
label="序号"
|
||||
type="index"
|
||||
>
|
||||
<template scope="scope">
|
||||
<span>{{scope.$index+(tkPageForm.pageNumber - 1) * tkPageForm.pageSize + 1}} </span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
header-align="center"
|
||||
label="提交时间"
|
||||
prop="rtime"
|
||||
width="200px">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
header-align="center"
|
||||
label="文本"
|
||||
prop="rval">
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-row>
|
||||
<el-row class="el-pagination-container">
|
||||
<el-pagination
|
||||
:current-page="tkPageForm.pageNumber"
|
||||
:page-size="tkPageForm.pageSize"
|
||||
:page-sizes="[10, 20, 30, 50]"
|
||||
:total="tkPageForm.totalCount"
|
||||
:total="pageForm.totalCount"
|
||||
@current-change="(val)=>{tkPageForm.pageNumber = val;tkPageData();}"
|
||||
@size-change="(val)=>{tkPageForm.pageSize = val;tkPageData();}"
|
||||
layout="total, prev, pager, next">
|
||||
@@ -271,9 +257,6 @@ layout("/layouts/platform.html"){
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
doExportByUnion() {
|
||||
location.href = loc() + '/doExportByUnion?questionId=' + this.questionId
|
||||
},
|
||||
doExport() {
|
||||
location.href = loc() + '/doExport?questionId=' + this.questionId
|
||||
},
|
||||
|
||||
@@ -34,10 +34,6 @@ layout("/layouts/platform.html"){
|
||||
color: red;
|
||||
}
|
||||
|
||||
#qsmEditor .w-e-text-container {
|
||||
height: 200px !important;
|
||||
}
|
||||
|
||||
.btDiv {
|
||||
cursor: pointer;
|
||||
}
|
||||
@@ -158,11 +154,13 @@ layout("/layouts/platform.html"){
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" header-align="center" label="标题"
|
||||
show-overflow-tooltip prop="qtitle"></el-table-column>
|
||||
prop="qtitle"></el-table-column>
|
||||
<el-table-column align="center" header-align="center" label="说明" prop="qsm"
|
||||
show-overflow-tooltip>
|
||||
<template scope="scope">
|
||||
<div v-if="scope.row.qsm">{{removeHTMLTag(scope.row.qsm)}}</div>
|
||||
<div v-html="scope.row.qsm" v-if="!isNull(scope.row.qsm)">
|
||||
{{scope.row.qsm}}
|
||||
</div>
|
||||
<span v-else>暂无</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -223,7 +221,7 @@ layout("/layouts/platform.html"){
|
||||
<template #edit>
|
||||
<div v-if="editMode==='basicInfo'">
|
||||
<el-form :model="formData" :rules="formRules" label-position="right"
|
||||
label-width="120px" ref="addform">
|
||||
label-width="120px" ref="addForm">
|
||||
<vi-title2 title="基础设置"></vi-title2>
|
||||
|
||||
<el-form-item label="问卷类型" prop="qlx">
|
||||
@@ -232,90 +230,12 @@ layout("/layouts/platform.html"){
|
||||
<el-radio :label="1" border>投票调查</el-radio>
|
||||
<el-radio :label="2" border>答题</el-radio>
|
||||
<!-- <el-radio :label="3" border>购物调查</el-radio>-->
|
||||
<el-radio :label="4" border>意向选择</el-radio>
|
||||
<!-- <el-radio :label="4" border>意向选择</el-radio>-->
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item class="is-required" label="标题" prop="qtitle">
|
||||
<el-input placeholder="请填写标题" v-model="formData.qtitle"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-row v-show="![1,3,4].includes(formData.qlx)" :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item class="is-required" label="每日可答次数" label-width="120px"
|
||||
prop="qrkdcs">
|
||||
<el-input-number :max="100" :min="0"
|
||||
controls-position="right"
|
||||
placeholder="设0则不限制次数"
|
||||
style="width: 100%"
|
||||
v-model="formData.qrkdcs"></el-input-number>
|
||||
<div class="text-primary">设0则不限制次数</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="每日答题时间" prop="qdtkssj">
|
||||
<el-time-picker
|
||||
end-placeholder="结束时间"
|
||||
is-range
|
||||
placeholder="选择时间范围"
|
||||
range-separator="-"
|
||||
start-placeholder="开始时间"
|
||||
style="width: 100%"
|
||||
v-model="formData.qdtsj"
|
||||
value-format="HH:mm:ss">
|
||||
</el-time-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row v-show="![1,3,4].includes(formData.qlx)" :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item class="is-required" label="回答总次数" label-width="120px"
|
||||
prop="answerTotalSum">
|
||||
<el-input-number :max="100" :min="0"
|
||||
controls-position="right"
|
||||
placeholder="设0则不限制次数"
|
||||
style="width: 100%"
|
||||
v-model="formData.answerTotalSum"></el-input-number>
|
||||
<div class="text-primary">设0则不限制次数</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="开始时间" prop="startTime">
|
||||
<el-date-picker
|
||||
style="width: 100%"
|
||||
type="datetime"
|
||||
v-model="formData.startTime"
|
||||
value-format="timestamp">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="结束时间" prop="endTime">
|
||||
<el-date-picker
|
||||
:picker-options="endTimeOptions"
|
||||
style="width: 100%"
|
||||
type="datetime"
|
||||
v-model="formData.endTime"
|
||||
value-format="timestamp">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8" v-show="formData.qlx===4">
|
||||
<el-form-item label="自动选择默认项" label-width="150px" prop="autoSelect">
|
||||
<el-switch
|
||||
v-model="formData.autoSelect"
|
||||
>
|
||||
</el-switch>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-form-item label="说明" prop="qsm">
|
||||
<div id="qsmEditor"></div>
|
||||
<el-input placeholder="请填写标题" v-model="formData.qtitle" maxlength="200"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="参加人员" prop="activityUserScopeId">
|
||||
@@ -334,52 +254,236 @@ layout("/layouts/platform.html"){
|
||||
</el-form-item>
|
||||
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="6">
|
||||
<el-form-item label="出题模式" prop="ctMode">
|
||||
<el-radio-group v-model="formData.ctMode" size="small">
|
||||
<el-radio :label="1" border>定时定题</el-radio>
|
||||
<el-radio :label="2" border>随机题目</el-radio>
|
||||
</el-radio-group>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="开始时间" prop="startTime"
|
||||
:rules="[{required: true, message: '必填', trigger: ['blur', 'change']}]">
|
||||
<el-date-picker
|
||||
style="width: 100%"
|
||||
type="datetime"
|
||||
v-model="formData.startTime"
|
||||
value-format="timestamp">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6" v-if="formData.ctMode===2">
|
||||
<el-form-item label="单次出题数量" prop="ctNum">
|
||||
<!--:max="formData.issues.length"-->
|
||||
<el-input-number :min="1"
|
||||
controls-position="right"
|
||||
style="width: 100%"
|
||||
v-model="formData.ctNum"></el-input-number>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="结束时间" prop="endTime"
|
||||
:rules="[{required: true, message: '必填', trigger: ['blur', 'change']}]">
|
||||
<el-date-picker
|
||||
:picker-options="endTimeOptions"
|
||||
style="width: 100%"
|
||||
type="datetime"
|
||||
v-model="formData.endTime"
|
||||
value-format="timestamp">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="20">
|
||||
<el-form-item label="说明" prop="qsm">
|
||||
<text-editor v-model="formData.qsm"></text-editor>
|
||||
</el-form-item>
|
||||
|
||||
<vi-title2 title="出题设置"></vi-title2>
|
||||
|
||||
<el-form-item label="出题模式" prop="ctMode"
|
||||
:rules="[{required: true, message: '必填', trigger: ['blur', 'change']}]">
|
||||
<el-radio-group v-model="formData.ctMode" size="small">
|
||||
<el-radio :label="1" border>定时定题</el-radio>
|
||||
<el-radio :label="2" border>随机题目</el-radio>
|
||||
<el-radio :label="3" border>常规模式</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="题目顺序打乱" prop="disruptingOrder"
|
||||
:rules="[{required: true, message: '必填', trigger: ['blur', 'change']}]">
|
||||
<el-radio-group v-model="formData.disruptingOrder" size="small">
|
||||
<el-radio :label="true" border>打乱</el-radio>
|
||||
<el-radio :label="false" border>不变</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
|
||||
<el-row :gutter="20" v-if="formData.ctMode==2">
|
||||
<el-col :span="6">
|
||||
<el-form-item label="是否抽奖" prop="isRaffle">
|
||||
<el-radio-group v-model="formData.isRaffle" size="small">
|
||||
<el-form-item label="单次随机题数" prop="ranDomSingleIssueNum"
|
||||
:rules="[{required: true, message: '必填', trigger: ['blur', 'change']}]">
|
||||
<el-input-number :min="1"
|
||||
controls-position="right"
|
||||
style="width: 100%"
|
||||
v-model="formData.ranDomSingleIssueNum"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="总共随机数" prop="ranDomSum"
|
||||
:rules="[{required: true, message: '必填', trigger: ['blur', 'change']}]">
|
||||
<el-input-number :min="1"
|
||||
controls-position="right"
|
||||
style="width: 100%"
|
||||
v-model="formData.ranDomSum"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="20"
|
||||
v-if="formData.ctMode!=2 || (formData.ctMode==2 && formData.startTime && formData.endTime && moment(formData.endTime).diff(formData.startTime,'days') >= 1)">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="是否可重复答" prop="canRepeatedAnswer"
|
||||
:rules="[{required: true, message: '必填', trigger: ['blur', 'change']}]">
|
||||
<el-radio-group v-model="formData.canRepeatedAnswer" size="small">
|
||||
<el-radio :label="true" border>是</el-radio>
|
||||
<el-radio :label="false" border>否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6" v-if="formData.isRaffle">
|
||||
<el-form-item label="抽奖分数" prop="raffleScore">
|
||||
<el-input-number :min="1"
|
||||
<el-col :span="24">
|
||||
<el-form-item label="可重复答次数"
|
||||
prop="canRepeatedAnswerNum"
|
||||
:rules="[{required: true, message: '必填', trigger: ['blur', 'change']}]"
|
||||
v-if="formData.canRepeatedAnswer">
|
||||
<el-input-number :min="0"
|
||||
controls-position="right"
|
||||
style="width: 100%"
|
||||
v-model="formData.raffleScore"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6" v-if="formData.isRaffle">
|
||||
<el-form-item label="获奖人数" prop="raffleWinnerUserNum">
|
||||
<el-input-number :max="10000" :min="1"
|
||||
controls-position="right"
|
||||
style="width: 100%"
|
||||
v-model="formData.raffleWinnerUserNum"></el-input-number>
|
||||
style="width: 300px"
|
||||
v-model="formData.canRepeatedAnswerNum"></el-input-number>
|
||||
<div class="text-primary">设0则为不限制</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<template>
|
||||
<vi-title2 title="分数统计设置"></vi-title2>
|
||||
<el-form-item label="分数统计" prop="calcScoreMode"
|
||||
:rules="[{required: true, message: '必填', trigger: ['blur', 'change']}]">
|
||||
<el-radio-group v-model="formData.calcScoreMode" size="small">
|
||||
<el-radio :label="1" border>最高得分</el-radio>
|
||||
<el-radio :label="2" border>最新得分</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</template>
|
||||
|
||||
<vi-title2 title="抽奖设置"></vi-title2>
|
||||
<el-form-item label="是否抽奖" prop="isRaffle"
|
||||
:rules="[{required: true, message: '必填', trigger: ['blur', 'change']}]">
|
||||
<el-radio-group v-model="formData.isRaffle" size="small">
|
||||
<el-radio :label="true" border>是</el-radio>
|
||||
<el-radio :label="false" border>否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
|
||||
|
||||
<el-form-item label="抽奖规则" prop="raffleRule" v-if="formData.isRaffle">
|
||||
<el-table :data="formData.raffleRule" border size="small">
|
||||
<el-table-column label="开始答题时间" prop="startAnswerDate">
|
||||
<template scope="{row,$index}">
|
||||
<el-form-item label-width="0"
|
||||
:prop="'raffleRule.'+$index+'.startAnswerDate'"
|
||||
:rules="[{required:true,message:'必填',trigger:['change','blur']}]">
|
||||
<el-date-picker
|
||||
v-model="row.startAnswerDate"
|
||||
type="datetime"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
placeholder="选择开始答题时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="结束答题时间" prop="endAnswerDate">
|
||||
<template scope="{row,$index}">
|
||||
<el-form-item label-width="0"
|
||||
:prop="'raffleRule.'+$index+'.endAnswerDate'"
|
||||
:rules="[{required:true,message:'必填',trigger:['change','blur']}]">
|
||||
<el-date-picker
|
||||
v-model="row.endAnswerDate"
|
||||
type="datetime"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
placeholder="选择结束答题时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="抽奖时间" prop="raffleTime">
|
||||
<template scope="{row,$index}">
|
||||
<el-form-item label-width="0"
|
||||
:prop="'raffleRule.'+$index+'.raffleTime'"
|
||||
:rules="[{required:true,message:'必填',trigger:['change','blur']}]">
|
||||
<el-date-picker
|
||||
v-model="row.raffleTime"
|
||||
type="datetime"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
placeholder="选择抽奖时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="抽奖分数" prop="raffleScore">
|
||||
<template scope="{row,$index}">
|
||||
<el-form-item label-width="0"
|
||||
:prop="'raffleRule.'+$index+'.raffleScore'"
|
||||
:rules="[{required:true,message:'必填',trigger:['change','blur']}]">
|
||||
<el-input-number :min="1"
|
||||
controls-position="right"
|
||||
style="width: 300px"
|
||||
placeholder="抽奖分数"
|
||||
v-model="row.raffleScore"></el-input-number>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="获奖人数" prop="raffleWinnerUserNum">
|
||||
<template scope="{row,$index}">
|
||||
<el-form-item label-width="0"
|
||||
:prop="'raffleRule.'+$index+'.raffleWinnerUserNum'"
|
||||
:rules="[{required:true,message:'必填',trigger:['change','blur']}]">
|
||||
<el-input-number :min="1"
|
||||
controls-position="right"
|
||||
style="width: 300px"
|
||||
placeholder="获奖人数"
|
||||
v-model="row.raffleWinnerUserNum"></el-input-number>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="100px">
|
||||
<template scope="{row}" slot="header">
|
||||
<el-button icon="el-icon-plus"
|
||||
size="mini"
|
||||
type="primary"
|
||||
@click="formData.raffleRule.push({})"
|
||||
></el-button>
|
||||
</template>
|
||||
<template scope="{$index}">
|
||||
<el-button size="mini"
|
||||
icon="el-icon-delete"
|
||||
type="danger"
|
||||
@click="formData.raffleRule.splice($index,1)"></el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-form-item>
|
||||
|
||||
<!-- <el-form-item label="抽奖时间" prop="raffleTime"-->
|
||||
<!-- v-if="formData.isRaffle"-->
|
||||
<!-- :rules="[{required: true, message: '必填', trigger: ['blur', 'change']}]">-->
|
||||
<!-- <el-date-picker-->
|
||||
<!-- v-model="formData.raffleTime"-->
|
||||
<!-- type="datetime"-->
|
||||
<!-- value-format="yyyy-MM-dd HH:mm:ss"-->
|
||||
<!-- placeholder="选择抽奖时间">-->
|
||||
<!-- </el-date-picker>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="抽奖分数" prop="raffleScore"-->
|
||||
<!-- v-if="formData.isRaffle"-->
|
||||
<!-- :rules="[{required: true, message: '必填', trigger: ['blur', 'change']}]">-->
|
||||
<!-- <el-input-number :min="1"-->
|
||||
<!-- controls-position="right"-->
|
||||
<!-- style="width: 300px"-->
|
||||
<!-- v-model="formData.raffleScore"></el-input-number>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="获奖人数" prop="raffleWinnerUserNum"-->
|
||||
<!-- v-if="formData.isRaffle"-->
|
||||
<!-- :rules="[{required: true, message: '必填', trigger: ['blur', 'change']}]">-->
|
||||
<!-- <el-input-number :max="10000" :min="1"-->
|
||||
<!-- controls-position="right"-->
|
||||
<!-- style="width: 300px"-->
|
||||
<!-- v-model="formData.raffleWinnerUserNum"></el-input-number>-->
|
||||
<!-- </el-form-item>-->
|
||||
|
||||
<el-row type="flex" justify="end">
|
||||
<el-button @click="$refs.guava.index()" size="medium">取消</el-button>
|
||||
<el-button @click="modifyBasicInfo" type="primary">确定</el-button>
|
||||
@@ -718,7 +822,7 @@ layout("/layouts/platform.html"){
|
||||
|
||||
<el-row>
|
||||
<span>
|
||||
标题、提示
|
||||
标题提示:
|
||||
</span>
|
||||
|
||||
<el-button @click="openIssueName('iname')" plain size="small">
|
||||
@@ -732,7 +836,7 @@ layout("/layouts/platform.html"){
|
||||
|
||||
<el-row type="flex" style="flex-flow: row wrap;column-gap: 10px;margin:20px 0">
|
||||
<div>
|
||||
<span>题目类型</span>
|
||||
<span>题目类型:</span>
|
||||
<el-select
|
||||
@change="if(currentModifyIssue.itx==2){issueData[currentModifyIssueIndex].iplfs=1;issueData[currentModifyIssueIndex].iisdx=true;issueData[currentModifyIssueIndex].wors=[{}]}else{issueData[currentModifyIssueIndex].wors=[{wtxt:'选项1'},{wtxt:'选项2'}]}"
|
||||
placeholder="题型" size="small"
|
||||
@@ -795,8 +899,9 @@ layout("/layouts/platform.html"){
|
||||
</div>
|
||||
</el-row>
|
||||
|
||||
<el-row class="mb20">
|
||||
<span>显示日期</span>
|
||||
<!--定时定题模式下才需要设置显示日期-->
|
||||
<el-row class="mb20" v-if="questionData.ctMode==1">
|
||||
<span>显示日期:</span>
|
||||
<el-date-picker placeholder="请选择显示日期"
|
||||
size="small"
|
||||
type="date"
|
||||
@@ -806,16 +911,6 @@ layout("/layouts/platform.html"){
|
||||
</el-date-picker>
|
||||
</el-row>
|
||||
|
||||
<el-row class="mb20">
|
||||
<span>排序编号</span>
|
||||
<el-input
|
||||
v-if="questionData.ctMode==1"
|
||||
v-model="issueData[currentModifyIssueIndex].ipxbh"
|
||||
place="请输入排序编号"
|
||||
style="width: 80px"
|
||||
size="small"></el-input>
|
||||
</el-row>
|
||||
|
||||
<template v-if="issueData[currentModifyIssueIndex].itx===1">
|
||||
<vi-title2 title="选项设置"></vi-title2>
|
||||
<el-row v-if="currentModifyIssue.itx==1">
|
||||
@@ -958,7 +1053,6 @@ layout("/layouts/platform.html"){
|
||||
|
||||
</div>
|
||||
<script>
|
||||
let qsmEditor
|
||||
let upTxtEditor
|
||||
let cakeEditor
|
||||
let vue = new Vue({
|
||||
@@ -983,7 +1077,7 @@ layout("/layouts/platform.html"){
|
||||
year: new Date().getFullYear() + ''
|
||||
},
|
||||
viewData: {issue: [{word: []}]},
|
||||
formData: {issues: [{wors: [{}]}]},
|
||||
formData: {issues: [{wors: [{}]}], raffleRule: []},
|
||||
setTitleDialogVisible: false,
|
||||
formRules: {
|
||||
qtitle: [{required: true, message: '请填写标题', trigger: ['blur', 'change']}],
|
||||
@@ -1217,14 +1311,7 @@ layout("/layouts/platform.html"){
|
||||
this.$refs.guava.edit()
|
||||
this.editMode = 'basicInfo'
|
||||
setTimeout(() => {
|
||||
$('#qsmEditor').html("")
|
||||
qsmEditor = new wangEditor('#qsmEditor')
|
||||
qsmEditor.config.uploadImgShowBase64 = true
|
||||
qsmEditor.config.onchange = (html) => {
|
||||
this.$set(this.formData, "qsm", html)
|
||||
}
|
||||
qsmEditor.create()
|
||||
this.formData = {issues: [], qlx: 2, qrkdcs: 0}
|
||||
this.formData = {issues: [], qlx: 2, qrkdcs: 0, raffleRule: []}
|
||||
}, 300)
|
||||
|
||||
},
|
||||
@@ -1233,18 +1320,15 @@ layout("/layouts/platform.html"){
|
||||
async openEditBasicInfo(qid) {
|
||||
const {code, data, msg} = await $.get(loc() + "/findBasicInfo", {qid: qid})
|
||||
if (code === 0) {
|
||||
this.$nextTick(() => {
|
||||
$('#qsmEditor').html(data.qsm)
|
||||
qsmEditor = new wangEditor('#qsmEditor')
|
||||
qsmEditor.config.onchange = (html) => {
|
||||
this.$set(this.formData, "qsm", html)
|
||||
setTimeout(() => {
|
||||
if (data.raffleRule == null) {
|
||||
data.raffleRule = []
|
||||
}
|
||||
qsmEditor.create()
|
||||
this.formData = data
|
||||
if (!this.isNull(this.formData.qdtkssj) && !this.isNull(this.formData.qdtjssj)) {
|
||||
this.$set(this.formData, 'qdtsj', [this.formData.qdtkssj, this.formData.qdtjssj])
|
||||
}
|
||||
})
|
||||
}, 300)
|
||||
this.editMode = 'basicInfo'
|
||||
this.$refs.guava.edit()
|
||||
} else {
|
||||
@@ -1252,6 +1336,7 @@ layout("/layouts/platform.html"){
|
||||
}
|
||||
},
|
||||
async modifyBasicInfo() {
|
||||
|
||||
if (this.formData.qlx === 4) {
|
||||
if (this.formData.autoSelect && this.formData.endTime < new Date().getTime()) {
|
||||
this.$message.warning('结束时间必须要大于当前时间')
|
||||
@@ -1259,22 +1344,25 @@ layout("/layouts/platform.html"){
|
||||
}
|
||||
}
|
||||
|
||||
//答题 并且是 定时定题
|
||||
// if (this.formData.qlx === 2 && this.formData.ctMode === 1) {
|
||||
// if (this.formData.issues.some(v => v.displayDate != null) && this.formData.issues.some(v => v.displayDate == null)) {
|
||||
// this.$message.warning('显示日期只能全为空或者全不为空')
|
||||
// return
|
||||
// }
|
||||
// }
|
||||
this.$refs['addForm'].validate(async valid => {
|
||||
if (valid) {
|
||||
// if (this.formData.isRaffle && moment(this.formData.raffleTime).isBefore(moment(this.formData.endTime))) {
|
||||
// this.$message.warning('抽奖时间必须要大于活动结束时间')
|
||||
// return
|
||||
// }
|
||||
|
||||
const {code, msg} = await $.post(loc() + '/modifyBasicInfo', this.formData)
|
||||
if (code === 0) {
|
||||
this.notifySuccess(msg)
|
||||
this.$refs.guava.index()
|
||||
this.pageData()
|
||||
} else {
|
||||
this.notifyWarning(msg)
|
||||
}
|
||||
const {code, msg} = await $.post(loc() + '/modifyBasicInfo', {
|
||||
question: JSON.stringify(this.formData)
|
||||
})
|
||||
if (code === 0) {
|
||||
this.$message.success(msg)
|
||||
this.$refs.guava.index()
|
||||
this.pageData()
|
||||
} else {
|
||||
this.$message.warning(msg)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
//打开题目设置
|
||||
@@ -1303,14 +1391,23 @@ layout("/layouts/platform.html"){
|
||||
|
||||
//修改题目
|
||||
async doModifyIssues() {
|
||||
//答题 并且是 定时定题
|
||||
if (this.questionData.qlx === 2 && this.questionData.ctMode === 1) {
|
||||
if (this.issueData.some(v => v.displayDate != null) && this.issueData.some(v => v.displayDate == null)) {
|
||||
this.notifyWarning('显示日期只能全为空或者全不为空')
|
||||
//答题
|
||||
if (this.questionData.qlx === 2) {
|
||||
if (this.issueData.some(v => v.fraction == null || v.fraction === '')) {
|
||||
this.$message.warning('每题都需要设置分数')
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
//定时定题需要设置时间
|
||||
if (this.questionData.ctMode === 1) {
|
||||
if (this.issueData.some(v => v.displayDate == null || v.displayDate === '')) {
|
||||
this.$message.warning('每题都需要设置显示日期')
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const confirm = await this.$confirm('您确定要提交吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
|
||||
@@ -40,7 +40,8 @@ layout("/layouts/platform.html"){
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">工号姓名:</div>
|
||||
<div class="search-item-option">
|
||||
<el-input placeholder="输入关键字" v-model="pageForm.searchKeyword" maxlength="10"></el-input>
|
||||
<el-input placeholder="输入关键字" v-model="pageForm.searchKeyword"
|
||||
maxlength="10"></el-input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -113,6 +114,7 @@ layout("/layouts/platform.html"){
|
||||
<el-table-column
|
||||
:label="column.label"
|
||||
:prop="column.prop"
|
||||
:key="column.key"
|
||||
:sortable="column.sortable"
|
||||
align="center"
|
||||
header-align="center"
|
||||
@@ -122,6 +124,10 @@ layout("/layouts/platform.html"){
|
||||
<span @click="showDays(row)" style="color: #236eb4; cursor: pointer">{{ row.dayCount ? row.dayCount : 0 }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="每轮得分" prop="everyRandomScore"
|
||||
v-if="questionCtMode==2 && isSameDay"></el-table-column>
|
||||
|
||||
</el-table>
|
||||
|
||||
<!--# include("/layouts/pagination.html"){}#-->
|
||||
@@ -167,8 +173,8 @@ layout("/layouts/platform.html"){
|
||||
{prop: 'unionname', label: '工会'},
|
||||
{prop: 'mobile', label: '联系方式'},
|
||||
// {prop: 'answerTotal', label: '答题次数(第几回答题)', sortable: true},
|
||||
{prop: 'max_score', label: '得分'},
|
||||
{prop: 'answerDate', label: '答题日期'},
|
||||
{prop: 'score', label: '得分'},
|
||||
],
|
||||
pageForm: {
|
||||
unionId: '',
|
||||
@@ -179,8 +185,29 @@ layout("/layouts/platform.html"){
|
||||
}
|
||||
}
|
||||
},
|
||||
components: {
|
||||
'guava': httpVueLoader('/components/plugins/Guava.vue')
|
||||
computed: {
|
||||
//判断是否为同一天
|
||||
isSameDay() {
|
||||
if (this.pageForm.questionId) {
|
||||
const currentQuestion = this.questions.find(v => v.qid === this.pageForm.questionId)
|
||||
if (currentQuestion) {
|
||||
const {startTime, endTime} = currentQuestion
|
||||
return moment(startTime).isSame(moment(endTime), 'day')
|
||||
}
|
||||
return false
|
||||
}
|
||||
return false
|
||||
},
|
||||
questionCtMode(){
|
||||
if (this.pageForm.questionId) {
|
||||
const currentQuestion = this.questions.find(v => v.qid === this.pageForm.questionId)
|
||||
if (currentQuestion) {
|
||||
return currentQuestion.ctMode
|
||||
}
|
||||
return null
|
||||
}
|
||||
return null
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
showDays(row) {
|
||||
@@ -209,7 +236,7 @@ layout("/layouts/platform.html"){
|
||||
this.doSearch()
|
||||
},
|
||||
async getQuestion() {
|
||||
const {data} = await $.get(loc()+"/getQuestion", {year: this.pageForm.year})
|
||||
const {data} = await $.get(loc() + "/getQuestion", {year: this.pageForm.year})
|
||||
return data
|
||||
},
|
||||
async flushUnits() {
|
||||
|
||||
@@ -1,222 +0,0 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
<style>
|
||||
.el-tabs__content {
|
||||
padding-top: 20px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<guava ref="guava">
|
||||
<template>
|
||||
<el-card shadow="never">
|
||||
<div class="search">
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">年度:</div>
|
||||
<div class="search-item-option">
|
||||
<el-date-picker
|
||||
:clearable="false"
|
||||
@change="yearChange"
|
||||
placeholder="选择年"
|
||||
style="width: 100%"
|
||||
type="year"
|
||||
v-model="pageForm.year"
|
||||
value-format="yyyy">
|
||||
</el-date-picker>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">所属问卷:</div>
|
||||
<div class="search-item-option">
|
||||
<el-select filterable="true" placeholder="所属问卷" style="width: 100%;" @change="doSearch"
|
||||
v-model="pageForm.questionId">
|
||||
<el-option :label="item.qtitle" :value="item.qid" v-for="item in questions"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">工号姓名:</div>
|
||||
<div class="search-item-option">
|
||||
<el-input placeholder="输入关键字" v-model="pageForm.searchKeyword" maxlength="10"></el-input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="search-item"
|
||||
v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H03')}">
|
||||
<div class="search-item-label">所属工会:</div>
|
||||
<div class="search-item-option">
|
||||
<el-select @change="flushUnits" @clear="flushUnits" clearable="true"
|
||||
filterable="true"
|
||||
placeholder="所属工会" style="width: 100%;"
|
||||
v-model="pageForm.unionId">
|
||||
<el-option :label="item.unionname" :value="item.id" v-for="item in unions"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">所属单位:</div>
|
||||
<div class="search-item-option">
|
||||
<el-select clearable="true" filterable="true" placeholder="所属单位"
|
||||
style="width: 100%;"
|
||||
v-model="pageForm.unitId">
|
||||
<el-option :label="item.name" :value="item.id" v-for="item in units"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="search-query">
|
||||
<el-button @click="doSearch" icon="el-icon-search" type="primary">搜索</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<el-card class="mt10" shadow="never">
|
||||
<table-tool :app="this" label="参加人员">
|
||||
<template #func>
|
||||
<el-button :disabled="!pageForm.questionId" @click="doExportInventory" icon="el-icon-printer"
|
||||
size="small"
|
||||
type="primary">导出名单
|
||||
</el-button>
|
||||
<!--<el-button :disabled="!pageForm.questionId" @click="doExportAll" icon="el-icon-printer"
|
||||
size="small"
|
||||
type="primary">导出分工会阶段得分
|
||||
</el-button>-->
|
||||
</template>
|
||||
</table-tool>
|
||||
|
||||
<el-table :data="tableData" :size="tableSize" @sort-change="pageOrder" class="vi-table"
|
||||
ref="table" row-key="id" style="width: 100%" v-loading="tableLoading">
|
||||
<el-table-column
|
||||
align="center" header-align="center" label="名次" type="index">
|
||||
<template scope="scope">
|
||||
<span>{{scope.$index+(pageForm.pageNumber - 1) * pageForm.pageSize + 1}} </span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
:label="column.label"
|
||||
:prop="column.prop"
|
||||
:sortable="column.sortable"
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
v-for="column in tableColumns">
|
||||
<template v-if="column.prop=='dayCount'" scope="{row}">
|
||||
<span @click="showDays(row)" style="color: #236eb4; cursor: pointer">{{ row.dayCount ? row.dayCount : 0 }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!--# include("/layouts/pagination.html"){}#-->
|
||||
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
</guava>
|
||||
|
||||
<!-- <el-dialog title="答题次数" :visible.sync="dayDialogVisible" width="40%">-->
|
||||
<!-- <el-table :data="dayTableData" style="width: 100%;" max-height="400">-->
|
||||
<!-- <el-table-column align="center" header-align="center" show-overflow-tooltip label="姓名"-->
|
||||
<!-- prop="username"></el-table-column>-->
|
||||
<!-- <el-table-column align="center" header-align="center" show-overflow-tooltip label="工号"-->
|
||||
<!-- prop="loginname"></el-table-column>-->
|
||||
<!-- <el-table-column align="center" header-align="center" show-overflow-tooltip label="答题时间"-->
|
||||
<!-- prop="day"></el-table-column>-->
|
||||
<!-- </el-table>-->
|
||||
<!-- <span slot="footer" class="dialog-footer">-->
|
||||
<!-- <el-button type="primary" @click="dayDialogVisible = false">确 定</el-button>-->
|
||||
<!-- </span>-->
|
||||
<!-- </el-dialog>-->
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const vue = new Vue({
|
||||
el: '#app',
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {
|
||||
dayDialogVisible: false,
|
||||
dayTableData: [],
|
||||
unions: [],
|
||||
units: [],
|
||||
questions: [],
|
||||
tableLoading: false,
|
||||
tableKey: '',
|
||||
tableColumns: [
|
||||
{prop: 'username', label: '姓名'},
|
||||
{prop: 'loginname', label: '工号'},
|
||||
{prop: 'sex', label: '性别'},
|
||||
{prop: 'unitname', label: '单位'},
|
||||
{prop: 'unionname', label: '工会'},
|
||||
{prop: 'mobile', label: '联系方式'},
|
||||
// {prop: 'answerTotal', label: '答题次数(第几回答题)', sortable: true},
|
||||
{prop: 'max_score', label: '得分'},
|
||||
// {prop: 'answerDate', label: '答题日期'},
|
||||
],
|
||||
pageForm: {
|
||||
unionId: '',
|
||||
unitId: '',
|
||||
year: new Date().getFullYear() + '',
|
||||
keyWord: '',
|
||||
answerDate: moment().format("YYYY-MM-DD")
|
||||
}
|
||||
}
|
||||
},
|
||||
components: {
|
||||
'guava': httpVueLoader('/components/plugins/Guava.vue')
|
||||
},
|
||||
methods: {
|
||||
showDays(row) {
|
||||
if (!row.days || row.dayCount === 0) {
|
||||
return
|
||||
}
|
||||
this.dayTableData = []
|
||||
row.days.split(',').map(o => {
|
||||
this.dayTableData.push({username: row.username, loginname: row.loginname, day: o})
|
||||
})
|
||||
this.dayDialogVisible = true
|
||||
},
|
||||
doExportInventory() {
|
||||
let {questionId, unionId, unitId, answerDate} = this.pageForm
|
||||
answerDate = answerDate == null ? '' : answerDate
|
||||
window.open(loc() + "/export?questionId=" + questionId + "&unionId=" + unionId + "&unitId=" + unitId + "&answerDate=" + answerDate)
|
||||
},
|
||||
doExportAll() {
|
||||
const {questionId, unionId, unitId} = this.pageForm
|
||||
window.open(loc() + "/doExportAll?questionId=" + questionId)
|
||||
},
|
||||
async yearChange() {
|
||||
this.questions = await this.getQuestion()
|
||||
this.questions = this.questions.filter(v => v.qlx === 2)
|
||||
this.$set(this.pageForm, "questionId", this.questions.length > 0 ? this.questions[0].qid : '')
|
||||
this.doSearch()
|
||||
},
|
||||
async getQuestion() {
|
||||
const {data} = await $.get("/platform/question/answer/ranking/getQuestion", {year: this.pageForm.year})
|
||||
return data
|
||||
},
|
||||
async flushUnits() {
|
||||
this.$set(this.pageForm, "unitId", "")
|
||||
if ("${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H03')}" === 'true') {
|
||||
this.units = await getUnits(this.pageForm.unionId)
|
||||
} else {
|
||||
this.units = await getUnits("${@shiro.getPrincipalProperty('unit').getUnionid()}")
|
||||
}
|
||||
},
|
||||
},
|
||||
async created() {
|
||||
this.questions = await this.getQuestion()
|
||||
this.questions = this.questions.filter(v => v.qlx === 2)
|
||||
this.$set(this.pageForm, "questionId", this.questions.length > 0 ? this.questions[0].qid : '')
|
||||
this.pageData();
|
||||
this.unions = await getUnions(null)
|
||||
this.flushUnits();
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -91,11 +91,6 @@ layout("/layouts/platform.html"){
|
||||
<el-card class="mt10" shadow="never">
|
||||
<table-tool :app="this" label="中奖名单">
|
||||
<template #func>
|
||||
<el-button :disabled="!pageForm.questionId" @click="doRaffle" icon="el-icon-printer"
|
||||
size="small"
|
||||
type="primary">立即抽奖
|
||||
</el-button>
|
||||
|
||||
<el-button :disabled="!pageForm.questionId" @click="exportWinners" icon="el-icon-printer"
|
||||
size="small"
|
||||
type="primary">导出中奖名单
|
||||
@@ -152,9 +147,8 @@ layout("/layouts/platform.html"){
|
||||
{prop: 'unitname', label: '单位'},
|
||||
{prop: 'unionname', label: '工会'},
|
||||
{prop: 'mobile', label: '联系方式'},
|
||||
{prop: 'score', label: '得分'},
|
||||
// {prop: 'winDate', label: '中奖日期'},
|
||||
// {prop: 'maxScore', label: '抽奖分数(最高分)'},
|
||||
{prop: 'winDate', label: '中奖日期'},
|
||||
{prop: 'score', label: '抽奖分数'},
|
||||
],
|
||||
pageForm: {
|
||||
unionId: '',
|
||||
@@ -188,12 +182,6 @@ layout("/layouts/platform.html"){
|
||||
this.units = await getUnits("${@shiro.getPrincipalProperty('unit').getUnionid()}")
|
||||
}
|
||||
},
|
||||
async doRaffle() {
|
||||
const {code} = await $.get('/platform/question/answer/statistics/doRaffle', {questionId: this.pageForm.questionId})
|
||||
if (code === 0) {
|
||||
this.doSearch()
|
||||
}
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
this.questions = await this.getQuestion()
|
||||
|
||||
Reference in New Issue
Block a user