init
This commit is contained in:
@@ -0,0 +1,94 @@
|
||||
package io.v.nutz.zhgh.meeting.controller.mobile;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.result.Result;
|
||||
import io.v.nutz.zhgh.meeting.service.MeetingAuditService;
|
||||
import io.v.nutz.base.model.Audit;
|
||||
import io.v.nutz.base.query.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.zhgh.meeting.controller.mobile;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.zhgh.meeting.models.MeetingInfo;
|
||||
import io.v.nutz.zhgh.meeting.models.MeetingTimePeriodUser;
|
||||
import io.v.nutz.zhgh.meeting.service.MeetingMineService;
|
||||
import io.v.nutz.base.query.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.zhgh.meeting.controller.pc;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.zhgh.meeting.models.MeetingInfo;
|
||||
import io.v.nutz.zhgh.meeting.models.MeetingUser;
|
||||
import io.v.nutz.zhgh.meeting.service.MeetingManageService;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.zhgh.msgNotify.models.MsgNotify;
|
||||
import io.v.nutz.zhgh.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,132 @@
|
||||
package io.v.nutz.zhgh.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.base.annontation.ViReturn;
|
||||
import io.v.nutz.zhgh.meeting.models.MeetingInfo;
|
||||
import io.v.nutz.zhgh.meeting.models.MeetingTimePeriod;
|
||||
import io.v.nutz.zhgh.meeting.service.MeetingOnlineService;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.utils.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("签字", "", 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.zhgh.meeting.controller.pc;
|
||||
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.zhgh.meeting.models.MeetingType;
|
||||
import io.v.nutz.zhgh.meeting.service.MeetingCommonService;
|
||||
import io.v.nutz.zhgh.meeting.service.MeetingTypeService;
|
||||
import io.v.nutz.base.model.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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
package io.v.nutz.zhgh.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.base.annontation.ViReturn;
|
||||
import io.v.nutz.zhgh.meeting.service.MeetingBasicStatisticsService;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.utils.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();
|
||||
|
||||
String[] arr = {"应到人数", "实到人数", "请假人数", "未到人数"};
|
||||
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.zhgh.meeting.models;
|
||||
|
||||
import io.v.nutz.base.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.zhgh.meeting.models;
|
||||
|
||||
import io.v.nutz.base.annontation.SelectEnum;
|
||||
import io.v.nutz.base.utils.Roles;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.base.utils.ViResource;
|
||||
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.web.commons.utils.ShiroUtil;
|
||||
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.club01)));
|
||||
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.zhgh.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.zhgh.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.zhgh.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.zhgh.meeting.models;
|
||||
|
||||
import io.v.nutz.base.model.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.zhgh.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.zhgh.meeting.service;
|
||||
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.base.model.Audit;
|
||||
import io.v.nutz.base.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.zhgh.meeting.service;
|
||||
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.base.query.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.zhgh.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.zhgh.meeting.service;
|
||||
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.zhgh.meeting.models.MeetingInfo;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.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.zhgh.meeting.service;
|
||||
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.zhgh.meeting.models.MeetingTimePeriodUser;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.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.zhgh.meeting.service;
|
||||
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.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.zhgh.meeting.service;
|
||||
|
||||
import io.v.nutz.zhgh.meeting.models.MeetingType;
|
||||
import io.v.nutz.base.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.zhgh.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.base.enums.AuditTypeEnum;
|
||||
import io.v.nutz.base.lang.Enum;
|
||||
import io.v.nutz.zhgh.meeting.models.CustomAuditTypeHandle;
|
||||
import io.v.nutz.zhgh.meeting.models.MeetingTimePeriodUser;
|
||||
import io.v.nutz.zhgh.meeting.service.MeetingAuditService;
|
||||
import io.v.nutz.zhgh.meeting.service.MeetingCommonService;
|
||||
import io.v.nutz.base.model.Audit;
|
||||
import io.v.nutz.base.model.AuditState;
|
||||
import io.v.nutz.base.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;
|
||||
}
|
||||
}
|
||||
+164
@@ -0,0 +1,164 @@
|
||||
package io.v.nutz.zhgh.meeting.service.impl;
|
||||
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.zhgh.meeting.models.MeetingInfo;
|
||||
import io.v.nutz.zhgh.meeting.service.MeetingBasicStatisticsService;
|
||||
import io.v.nutz.zhgh.meeting.service.MeetingCommonService;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.service.impl.ViServiceImpl;
|
||||
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.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();
|
||||
listList.forEach(v -> {
|
||||
String successStateCode = meetingCommonService.findSuccessStateCode(v.getString("id")).toString();
|
||||
|
||||
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
|
||||
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
|
||||
$condition
|
||||
""").setParam("successStateCode", successStateCode);
|
||||
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();
|
||||
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)));
|
||||
}
|
||||
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();
|
||||
|
||||
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)));
|
||||
}
|
||||
|
||||
sql.setCondition(cnd);
|
||||
return listMap(sql);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
package io.v.nutz.zhgh.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.base.enums.AuditTypeEnum;
|
||||
import io.v.nutz.zhgh.meeting.models.MeetingInfo;
|
||||
import io.v.nutz.zhgh.meeting.models.MeetingType;
|
||||
import io.v.nutz.zhgh.meeting.service.MeetingCommonService;
|
||||
import io.v.nutz.base.model.AuditState;
|
||||
import io.v.nutz.base.service.impl.ViServiceImpl;
|
||||
import io.v.nutz.web.commons.utils.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.zhgh.meeting.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.zhgh.meeting.models.MeetingInfo;
|
||||
import io.v.nutz.zhgh.meeting.models.MeetingTimePeriod;
|
||||
import io.v.nutz.zhgh.meeting.models.MeetingTimePeriodUser;
|
||||
import io.v.nutz.zhgh.meeting.models.MeetingUser;
|
||||
import io.v.nutz.zhgh.meeting.service.MeetingManageService;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.zhgh.msgNotify.models.MsgNotify;
|
||||
import io.v.nutz.zhgh.msgNotify.models.MsgNotifyUser;
|
||||
import io.v.nutz.zhgh.msgNotify.service.MsgNotifyService;
|
||||
import io.v.nutz.base.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.zhgh.meeting.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.zhgh.meeting.models.MeetingInfo;
|
||||
import io.v.nutz.zhgh.meeting.models.MeetingTimePeriodUser;
|
||||
import io.v.nutz.zhgh.meeting.service.MeetingCommonService;
|
||||
import io.v.nutz.zhgh.meeting.service.MeetingMineService;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.zhgh.msgNotify.service.MsgNotifyService;
|
||||
import io.v.nutz.base.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,128 @@
|
||||
package io.v.nutz.zhgh.meeting.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.zhgh.meeting.models.MeetingTimePeriod;
|
||||
import io.v.nutz.zhgh.meeting.service.MeetingCommonService;
|
||||
import io.v.nutz.zhgh.meeting.service.MeetingOnlineService;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.service.impl.ViServiceImpl;
|
||||
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.util.NutMap;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@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,
|
||||
@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);
|
||||
return listMap(sql);
|
||||
}
|
||||
|
||||
@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)));
|
||||
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
|
||||
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
|
||||
LIMIT 0,20
|
||||
""");
|
||||
sql.setParam("timePeriodId", timePeriodId);
|
||||
return listMap(sql);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package io.v.nutz.zhgh.meeting.service.impl;
|
||||
|
||||
import io.v.nutz.zhgh.meeting.models.MeetingType;
|
||||
import io.v.nutz.zhgh.meeting.service.MeetingCommonService;
|
||||
import io.v.nutz.zhgh.meeting.service.MeetingTypeService;
|
||||
import io.v.nutz.base.model.AuditState;
|
||||
import io.v.nutz.base.model.AuditStateUser;
|
||||
import io.v.nutz.base.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.zhgh.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.zhgh.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);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user