diff --git a/src/main/java/io/v/nutz/base/utils/MsgApi.java b/src/main/java/io/v/nutz/base/utils/MsgApi.java index 25742bc..37890a8 100644 --- a/src/main/java/io/v/nutz/base/utils/MsgApi.java +++ b/src/main/java/io/v/nutz/base/utils/MsgApi.java @@ -87,8 +87,8 @@ public class MsgApi { log.info(Json.toJson(bodyMap)); String url = DOMAIN + SEND_URL + "?appid=%s&tokenid=%s&schoolcode=%s".formatted(APP_ID, getMsgToken(), SCHOOL_CODE); - String content = ""; -// String content = Http.post(url, Map.of("message", Json.toJson(bodyMap)), Sender.Default_Read_Timeout); + //String content = ""; + String content = Http.post(url, Map.of("message", Json.toJson(bodyMap)), Sender.Default_Read_Timeout); NutMap contentMap = Json.fromJson(NutMap.class, content); Sys_wechat_msg wechatMsg = new Sys_wechat_msg(); @@ -110,24 +110,23 @@ public class MsgApi { * @return */ public String getMsgToken() { -// String token = redisService.get(TOKEN_NAME); -// if (StrUtil.isBlank(token)) { -// Map params = new HashMap() {{ -// put("appid", APP_ID); -// put("appsecret", APP_SECRET); -// put("schoolcode", SCHOOL_CODE); -// }}; -// String content = Http.get(DOMAIN + GET_TOKEN_URL, params, Sender.Default_Conn_Timeout).getContent(); -// NutMap contentMap = Json.fromJson(NutMap.class, content); -// if (contentMap.getString("retcode").equals("0")) { -// String access_token = contentMap.getString("access_token"); -// redisService.setex(TOKEN_NAME, 3600, access_token); -// } else { -// throw new RuntimeException("获取短信接口token异常!!!"); -// } -// } -// return redisService.get(TOKEN_NAME); - return null; + String token = redisService.get(TOKEN_NAME); + if (StrUtil.isBlank(token)) { + Map params = new HashMap() {{ + put("appid", APP_ID); + put("appsecret", APP_SECRET); + put("schoolcode", SCHOOL_CODE); + }}; + String content = Http.get(DOMAIN + GET_TOKEN_URL, params, Sender.Default_Conn_Timeout).getContent(); + NutMap contentMap = Json.fromJson(NutMap.class, content); + if (contentMap.getString("retcode").equals("0")) { + String access_token = contentMap.getString("access_token"); + redisService.setex(TOKEN_NAME, 3600, access_token); + } else { + throw new RuntimeException("获取短信接口token异常!!!"); + } + } + return redisService.get(TOKEN_NAME); } diff --git a/src/main/java/io/v/nutz/lxy/controller/LxyHdCon.java b/src/main/java/io/v/nutz/lxy/controller/LxyHdCon.java index 7f7d406..e6675df 100644 --- a/src/main/java/io/v/nutz/lxy/controller/LxyHdCon.java +++ b/src/main/java/io/v/nutz/lxy/controller/LxyHdCon.java @@ -1,5 +1,7 @@ package io.v.nutz.lxy.controller; +import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONUtil; import cn.wizzer.framework.base.service.BaseService; import io.v.nutz.annontation.ViReturn; import io.v.nutz.base.utils.PageUtil; @@ -11,21 +13,25 @@ import io.v.nutz.lxy.service.LxyMefpService; import io.v.nutz.sys.models.Sys_file; import org.apache.shiro.authz.annotation.RequiresAuthentication; import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.nutz.aop.interceptor.ioc.TransAop; import org.nutz.boot.starter.ftp.FtpService; import org.nutz.dao.Chain; import org.nutz.dao.Cnd; import org.nutz.dao.Sqls; import org.nutz.dao.entity.Record; import org.nutz.dao.sql.Sql; +import org.nutz.ioc.aop.Aop; import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.lang.Strings; import org.nutz.lang.random.R; +import org.nutz.lang.util.NutMap; import org.nutz.mvc.annotation.*; import org.nutz.mvc.upload.TempFile; import org.nutz.mvc.upload.UploadAdaptor; import java.io.IOException; +import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -91,19 +97,22 @@ public class LxyHdCon { @At @POST - @AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"}) @ViReturn + @Aop(TransAop.READ_COMMITTED) @RequiresPermissions("zgfw.lxy.hdmange") - public Object doAdd(Lxy_hd hd, @Param(value = "files",required = false) TempFile[] files, Lxy_mefp[] mefp) throws IOException { + @AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"}) + public Object doAdd(Lxy_hd hd, @Param(value = "files",required = false) TempFile[] files,@Param(value = "mefp") String jsonStr) throws IOException { hd.setHdcjsj(new Date()); hd = lxyHdService.insert(hd); - for (Lxy_mefp lxyMefp : mefp) { - lxyMefp.setHdid(hd.getId()); - lxyMefp.setNumber(lxyMefp.getNumber() == null ? 0 : lxyMefp.getNumber()); - lxyMefpService.insert(lxyMefp); - } + lxyMefpService.setMefp(jsonStr, hd.getId()); + +// for (Lxy_mefp lxyMefp : mefp) { +// lxyMefp.setHdid(hd.getId()); +// lxyMefp.setNumber(lxyMefp.getNumber() == null ? 0 : lxyMefp.getNumber()); +// lxyMefpService.insert(lxyMefp); +// } for (TempFile file : files) { String rid = R.UU32(); @@ -123,19 +132,23 @@ public class LxyHdCon { @At @ViReturn + @Aop(TransAop.READ_COMMITTED) @RequiresPermissions("zgfw.lxy.hdmange") - public Object doEditMefp(Lxy_mefp[] mefp) { - for (Lxy_mefp lxyMefp : mefp) { - baseService.dao().update("lxy_mefp", Chain.make("number", lxyMefp.getNumber()), Cnd.where("ghid", "=", lxyMefp.getGhid()).and("hdid", "=", lxyMefp.getHdid())); - } + public Object doEditMefp(@Param("mefp") String jsonStr, String hdId) { + lxyMefpService.dao().clear(Lxy_mefp.class, Cnd.where("hdid","=",hdId)); + lxyMefpService.setMefp(jsonStr, hdId); +// for (Lxy_mefp lxyMefp : mefp) { +// baseService.dao().update("lxy_mefp", Chain.make("number", lxyMefp.getNumber()), Cnd.where("ghid", "=", lxyMefp.getGhid()).and("hdid", "=", lxyMefp.getHdid())); +// } return null; } @At @POST - @AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"}) @ViReturn + @Aop(TransAop.READ_COMMITTED) @RequiresPermissions("zgfw.lxy.hdmange") + @AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"}) public Object doEdit(Lxy_hd hd, @Param(value = "files",required = false) TempFile[] files, String[] delFiles) throws IOException { lxyHdService.updateIgnoreNull(hd); @@ -163,6 +176,7 @@ public class LxyHdCon { @At @ViReturn + @Aop(TransAop.READ_COMMITTED) @RequiresPermissions("zgfw.lxy.hdmange") public Object delete(String id) { List files = baseService.dao().query("sys_file", Cnd.where("reid", "=", id)); diff --git a/src/main/java/io/v/nutz/lxy/controller/LxyXghshController.java b/src/main/java/io/v/nutz/lxy/controller/LxyXghshController.java index 2b352f8..8427ad3 100644 --- a/src/main/java/io/v/nutz/lxy/controller/LxyXghshController.java +++ b/src/main/java/io/v/nutz/lxy/controller/LxyXghshController.java @@ -235,6 +235,7 @@ public class LxyXghshController { } @At + @Ok("void") @RequiresPermissions("zgfw.lxy.xghsh") public void downLoadAll(@Param(value = "year", required = false) Integer year, @Param(value = "hdid", required = false) String hdid, diff --git a/src/main/java/io/v/nutz/lxy/service/LxyMefpService.java b/src/main/java/io/v/nutz/lxy/service/LxyMefpService.java index b99703e..09ede34 100644 --- a/src/main/java/io/v/nutz/lxy/service/LxyMefpService.java +++ b/src/main/java/io/v/nutz/lxy/service/LxyMefpService.java @@ -5,4 +5,6 @@ import io.v.nutz.lxy.model.Lxy_mefp; public interface LxyMefpService extends BaseService { + + void setMefp(String jsonStr, String hdId); } diff --git a/src/main/java/io/v/nutz/lxy/service/impl/LxyMefpServiceImpl.java b/src/main/java/io/v/nutz/lxy/service/impl/LxyMefpServiceImpl.java index e7d05ab..36aee9f 100644 --- a/src/main/java/io/v/nutz/lxy/service/impl/LxyMefpServiceImpl.java +++ b/src/main/java/io/v/nutz/lxy/service/impl/LxyMefpServiceImpl.java @@ -1,10 +1,16 @@ package io.v.nutz.lxy.service.impl; +import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONUtil; import cn.wizzer.framework.base.service.BaseServiceImpl; import io.v.nutz.lxy.model.Lxy_mefp; import io.v.nutz.lxy.service.LxyMefpService; import org.nutz.dao.Dao; import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.lang.util.NutMap; + +import java.util.ArrayList; +import java.util.List; /** * @Author: 1V @@ -16,4 +22,21 @@ public class LxyMefpServiceImpl extends BaseServiceImpl implements Lxy public LxyMefpServiceImpl(Dao dao) { super(dao); } + + + @Override + public void setMefp(String jsonStr, String hdId) { + if (StrUtil.isNotBlank(jsonStr)) { + List list = JSONUtil.parseArray(jsonStr).toList(NutMap.class); + List mefpList = new ArrayList<>(); + for (NutMap map : list) { + Lxy_mefp mefp = new Lxy_mefp(); + mefp.setGhid(map.getString("id")); + mefp.setHdid(hdId); + mefp.setNumber(map.getInt("limitNum")); + mefpList.add(mefp); + } + dao().insert(mefpList); + } + } } diff --git a/src/main/java/io/v/nutz/meeting/controller/mobile/MMeetingMineController.java b/src/main/java/io/v/nutz/meeting/controller/mobile/MMeetingMineController.java index 8192f5a..f5528ff 100644 --- a/src/main/java/io/v/nutz/meeting/controller/mobile/MMeetingMineController.java +++ b/src/main/java/io/v/nutz/meeting/controller/mobile/MMeetingMineController.java @@ -13,10 +13,14 @@ 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.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.json.Json; import org.nutz.lang.Lang; +import org.nutz.lang.Strings; import org.nutz.mvc.annotation.*; import javax.servlet.http.HttpServletRequest; @@ -99,11 +103,44 @@ public class MMeetingMineController { @Ok("json:full") @ViReturn @RequiresAuthentication - public Object findMyMeetPeriod(@Param("meetingId") String meetingId) { + public Object findMyMeetPeriod(@Param("meetingId") String meetingId, + @Param("userId") String userId, + @Param("helpLeave") Boolean helpLeave) { if (StrUtil.isBlank(meetingId)) { return Result.error("参数错误"); } - return meetingMineService.findMyMeetPeriod(meetingId); + return meetingMineService.findMyMeetPeriod(meetingId, helpLeave, userId); + } + + @At("/searchUser") + @Ok("json:full") + @ViReturn + @RequiresAuthentication + public Object searchUser(@Param("query") String query, @Param("meetId") String meetId) { + Sql sql = Sqls.create(""" + SELECT + u.id, + u.username, + u.loginname, + u.sex, + u.unionname, + u.unitname + FROM + `meeting_time_period_user` pu + LEFT JOIN USER u ON pu.userId = u.id + $condition + limit 50 + """).setParam("meetId", meetId); + Cnd cnd = Cnd.NEW(); + if (Strings.isNotBlank(query)) { + SqlExpressionGroup group = new SqlExpressionGroup(); + group.orLike("u.username", query); + group.orLike("u.loginname", query); + cnd.and(group); + } + cnd.and("meetingId", "=", meetId); + sql.setCondition(cnd); + return meetingMineService.listMap(sql); } /** diff --git a/src/main/java/io/v/nutz/meeting/service/MeetingMineService.java b/src/main/java/io/v/nutz/meeting/service/MeetingMineService.java index b73609e..1bb8c5f 100644 --- a/src/main/java/io/v/nutz/meeting/service/MeetingMineService.java +++ b/src/main/java/io/v/nutz/meeting/service/MeetingMineService.java @@ -27,7 +27,7 @@ public interface MeetingMineService extends ViService { * * @return */ - List findMyMeetPeriod(String meetingId); + List findMyMeetPeriod(String meetingId, Boolean helpLeave, String userId); /** * 请假 diff --git a/src/main/java/io/v/nutz/meeting/service/impl/MeetingMineServiceImpl.java b/src/main/java/io/v/nutz/meeting/service/impl/MeetingMineServiceImpl.java index 0b11dbe..839b41b 100644 --- a/src/main/java/io/v/nutz/meeting/service/impl/MeetingMineServiceImpl.java +++ b/src/main/java/io/v/nutz/meeting/service/impl/MeetingMineServiceImpl.java @@ -75,7 +75,7 @@ public class MeetingMineServiceImpl extends ViServiceImpl implements MeetingMine } @Override - public List findMyMeetPeriod(String meetingId) { + public List findMyMeetPeriod(String meetingId, Boolean helpLeave, String userId) { Sql sql = Sqls.create(""" SELECT tp.id AS tpid, @@ -94,7 +94,7 @@ public class MeetingMineServiceImpl extends ViServiceImpl implements MeetingMine """); Cnd cnd = Cnd.NEW(); cnd.and("tp.meetingId", "=", meetingId); - cnd.and("tpu.userId", "=", ShiroUtil.getPrincipalProperty("id")); + cnd.and("tpu.userId", "=", helpLeave ? userId : ShiroUtil.getPrincipalProperty("id")); sql.setCondition(cnd); return listMap(sql); } @@ -112,7 +112,7 @@ public class MeetingMineServiceImpl extends ViServiceImpl implements MeetingMine dao().updateIgnoreNull(meetingTimePeriodUsers); List userIdMap = meetingCommonService.getNextAuditUser(stateCode, moduleName); - String userInfoStr = msgNotifyService.userData(userIdMap); + List userInfoStr = msgNotifyService.userData(userIdMap); String meetingId = meetingTimePeriodUsers.get(0).getMeetingId(); MeetingInfo meetingInfo = dao().fetch(MeetingInfo.class, meetingId); diff --git a/src/main/java/io/v/nutz/msgNotify/MsgNotifyController.java b/src/main/java/io/v/nutz/msgNotify/MsgNotifyController.java index 7448e77..36b6cce 100644 --- a/src/main/java/io/v/nutz/msgNotify/MsgNotifyController.java +++ b/src/main/java/io/v/nutz/msgNotify/MsgNotifyController.java @@ -146,7 +146,7 @@ public class MsgNotifyController { if (msgNotify.getType() != null && msgNotify.getType().equals("system")) { List list = msgNotifyService.getUserByRoleIds(msgNotify.getModule(), msgNotify.getTeacherMeetingId(), msgNotify.getRoleIds()); - String userData = msgNotifyService.userData(list); + List userData = msgNotifyService.userData(list); if (flag) { msgNotifyService.sendMsg(msgNotify.getSendTypes(), userData, msgNotify.getContent()); @@ -165,7 +165,7 @@ public class MsgNotifyController { } else if (msgNotify.getType() != null && msgNotify.getType().equals("user")) { if (flag) { List user = dao.query(User.class, Cnd.where("id", "in", users)); - String objectUserData = msgNotifyService.ObjectUserData(user); + List objectUserData = msgNotifyService.ObjectUserData(user); msgNotifyService.sendMsg(msgNotify.getSendTypes(), objectUserData, msgNotify.getContent()); } for (String u : users) { @@ -180,7 +180,7 @@ public class MsgNotifyController { } } else { List userScopes = msgNotifyService.getUserScopes(msgNotify.getActivityGroupId()); - String userData = msgNotifyService.userData(userScopes); + List userData = msgNotifyService.userData(userScopes); if (flag) { msgNotifyService.sendMsg(msgNotify.getSendTypes(), userData, msgNotify.getContent()); @@ -220,7 +220,7 @@ public class MsgNotifyController { msgNotify.setHold(flag ? true : false); if (flag) { - String userData = msgNotifyService.userData(list); + List userData = msgNotifyService.userData(list); msgNotifyService.sendMsg(msgNotify.getSendTypes(), userData, msgNotify.getContent()); } @@ -236,7 +236,7 @@ public class MsgNotifyController { } else if (msgNotify.getType() != null && msgNotify.getType().equals("user")) { if (flag) { List user = dao.query(User.class, Cnd.where("id", "in", users)); - String objectUserData = msgNotifyService.ObjectUserData(user); + List objectUserData = msgNotifyService.ObjectUserData(user); msgNotifyService.sendMsg(msgNotify.getSendTypes(), objectUserData, msgNotify.getContent()); } @@ -268,7 +268,7 @@ public class MsgNotifyController { """).setParam("groupId", msgNotify.getActivityGroupId()); List userScopes = activityBasicScopeService.listMap(sql); msgNotify.setHold(flag ? true : false); - String userData = msgNotifyService.userData(userScopes); + List userData = msgNotifyService.userData(userScopes); if (flag) { msgNotifyService.sendMsg(msgNotify.getSendTypes(), userData, msgNotify.getContent()); diff --git a/src/main/java/io/v/nutz/msgNotify/MsgNotifyTitleController.java b/src/main/java/io/v/nutz/msgNotify/MsgNotifyTitleController.java index 758b5b6..a3b371c 100644 --- a/src/main/java/io/v/nutz/msgNotify/MsgNotifyTitleController.java +++ b/src/main/java/io/v/nutz/msgNotify/MsgNotifyTitleController.java @@ -105,7 +105,7 @@ public class MsgNotifyTitleController { @RequiresAuthentication public Object doSend(String id, String[] sendTypes, String content) { List msgNotifyUser = msgNotifyService.getMsgNotifyUser(id); - String userData = msgNotifyService.userData(msgNotifyUser); + List userData = msgNotifyService.userData(msgNotifyUser); msgNotifyService.sendMsg(Arrays.asList(sendTypes), userData, content); msgNotifyUser.forEach(v -> { baseService.dao().update(MsgNotify.class, Chain.make("hold", true).add("sendTime", DateUtil.getDateTime()), Cnd.where("id", "=", v.getString("titleId"))); diff --git a/src/main/java/io/v/nutz/msgNotify/service/MsgNotifyService.java b/src/main/java/io/v/nutz/msgNotify/service/MsgNotifyService.java index ed8a335..845490f 100644 --- a/src/main/java/io/v/nutz/msgNotify/service/MsgNotifyService.java +++ b/src/main/java/io/v/nutz/msgNotify/service/MsgNotifyService.java @@ -36,9 +36,9 @@ public interface MsgNotifyService { String userData(User user); - String ObjectUserData(List userList); + List ObjectUserData(List userList); - String userData(List userListMap); + List userData(List userListMap); /** * 根据条件发送短信 @@ -49,6 +49,7 @@ public interface MsgNotifyService { */ void sendMsg(List sendTypes, String userData, String content); + void sendMsg(List sendTypes, List userData, String content); /** * 查询活动设置人员 diff --git a/src/main/java/io/v/nutz/msgNotify/service/impl/MsgNotifyServiceImpl.java b/src/main/java/io/v/nutz/msgNotify/service/impl/MsgNotifyServiceImpl.java index 18086a4..802ffd6 100644 --- a/src/main/java/io/v/nutz/msgNotify/service/impl/MsgNotifyServiceImpl.java +++ b/src/main/java/io/v/nutz/msgNotify/service/impl/MsgNotifyServiceImpl.java @@ -1,6 +1,7 @@ package io.v.nutz.msgNotify.service.impl; import io.v.nutz.base.utils.DateUtil; +import io.v.nutz.base.utils.MsgApi; import io.v.nutz.msgNotify.models.MsgNotify; import io.v.nutz.msgNotify.models.MsgNotifyUser; import io.v.nutz.msgNotify.service.MsgNotifyService; @@ -12,6 +13,7 @@ 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.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.lang.util.NutMap; @@ -64,7 +66,7 @@ public class MsgNotifyServiceImpl extends ViServiceImpl implements Ms */ @Override public String userData(NutMap v) { - List list = new ArrayList<>(); + /*List list = new ArrayList<>(); list.add(v.getString("userName")); list.add(v.getString("loginName")); list.add(v.getString("unitId")); @@ -72,13 +74,13 @@ public class MsgNotifyServiceImpl extends ViServiceImpl implements Ms list.add(v.getString("mobile") != null ? v.getString("mobile") : ""); list.add(""); list.add(""); - String collect = list.stream().collect(Collectors.joining("|")); - return collect; + String collect = list.stream().collect(Collectors.joining("|"));*/ + return v.getString("loginName"); } @Override public String userData(User user) { - List list = new ArrayList<>(); + /*List list = new ArrayList<>(); list.add(user.getUsername()); list.add(user.getLoginname()); list.add(user.getUnitid()); @@ -87,25 +89,27 @@ public class MsgNotifyServiceImpl extends ViServiceImpl implements Ms list.add(""); list.add(""); String collect = list.stream().collect(Collectors.joining("|")); - return collect; + return collect;*/ + return user.getLoginname(); } @Override - public String ObjectUserData(List userList) { + public List ObjectUserData(List userList) { List recievePersonInfo = new ArrayList<>(); for (User user : userList) { recievePersonInfo.add(userData(user)); } - return String.join("^@^", recievePersonInfo); + return recievePersonInfo; } @Override - public String userData(List userList) { + public List userData(List userList) { List recievePersonInfo = new ArrayList<>(); for (NutMap map : userList) { recievePersonInfo.add(userData(map)); } - return String.join("^@^", recievePersonInfo); + //return String.join("^@^", recievePersonInfo); + return recievePersonInfo; } /** @@ -120,14 +124,33 @@ public class MsgNotifyServiceImpl extends ViServiceImpl implements Ms @Override public void run() { if (sendTypes.contains("msg")) { + //msgApi.sendMsg(content, List.of(item.getString("loginname"))); } if (sendTypes.contains("WeChat")) { + //msgApi.sendMsg(content, List.of(item.getString("loginname"))); } } }.start(); } + public void sendMsg(List sendTypes, List receivers, String content) { + new Thread() { + @Override + public void run() { + if (sendTypes.contains("msg")) { + msgApi.sendMsg(content, receivers); + } + if (sendTypes.contains("WeChat")) { + msgApi.sendMsg(content, receivers); + } + } + }.start(); + + } + + @Inject + private MsgApi msgApi; /** * 查询活动设置人员 diff --git a/src/main/java/io/v/nutz/trainEducation/controller/statistics/TrainEduStatisticsVideoController.java b/src/main/java/io/v/nutz/trainEducation/controller/statistics/TrainEduStatisticsVideoController.java index 5e11be6..d8d9aee 100644 --- a/src/main/java/io/v/nutz/trainEducation/controller/statistics/TrainEduStatisticsVideoController.java +++ b/src/main/java/io/v/nutz/trainEducation/controller/statistics/TrainEduStatisticsVideoController.java @@ -1,11 +1,16 @@ package io.v.nutz.trainEducation.controller.statistics; +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.entity.ExportParams; +import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity; import io.v.nutz.annontation.ViReturn; import io.v.nutz.base.page.Pagination; import io.v.nutz.base.service.BaseService; import io.v.nutz.base.utils.Vi; import io.v.nutz.modules.models.PageForm; +import io.v.nutz.util.ViTool; import io.v.nutz.web.commons.utils.ShiroUtil; +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; @@ -15,11 +20,14 @@ 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.util.NutMap; import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.Ok; import org.nutz.mvc.annotation.Param; import org.springframework.web.bind.annotation.RequestParam; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; import java.util.List; @@ -137,4 +145,63 @@ public class TrainEduStatisticsVideoController { sql.setParam("albumId", albumId); return baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); } + + + @At + @Ok("void") + @RequiresPermissions("trainEdu.statistics.video") + public void exportXlsx(String albumId,HttpServletResponse response){ + Sql sql = Sqls.create(""" + SELECT + u.username, + u.loginname, + u.unitname, + u.unionname, + tev.qualifiedNum, + ( + SELECT + SUM(IF( cnt > tev.everyDayMaxWatchNum, tev.everyDayMaxWatchNum, cnt )) AS count + FROM + ( SELECT watchTime, COUNT( 1 ) AS cnt FROM train_edu_video_watch_record where userId = tevwr.userId and albumId = tevwr.albumId GROUP BY watchTime ) AS subquery + ) as watchCount + + FROM + `train_edu_video_watch_record` tevwr + LEFT JOIN train_edu_video tev ON tev.id = tevwr.videoId + LEFT JOIN train_edu_album tea on tea.id = tevwr.albumId + LEFT JOIN `user` u ON u.id = tevwr.userId + $condition + """); + Cnd cnd = Cnd.NEW(); + cnd.and("tevwr.albumId", "=", albumId); + cnd.and(new Static("IF(tea.createType = 1, u.unionId = tea.unionId , 1=1)")); + cnd.groupBy("tevwr.userId"); + sql.setCondition(cnd); + List list = baseService.listMap(sql); + + + List excelExportEntities = new ArrayList<>(); + excelExportEntities.add(new ExcelExportEntity("序号","no",10)); + excelExportEntities.add(new ExcelExportEntity("姓名","username",20)); + excelExportEntities.add(new ExcelExportEntity("工号","loginname",20)); + excelExportEntities.add(new ExcelExportEntity("单位","unitname",20)); + excelExportEntities.add(new ExcelExportEntity("分工会","unionname",20)); + excelExportEntities.add(new ExcelExportEntity("学习总次数","watchCount",20)); + excelExportEntities.add(new ExcelExportEntity("是否达标","qualifiedNum",20)); + + for (int i = 0; i < list.size(); i++) { + list.get(i).put("no",i+1); + list.get(i).put("qualifiedNum",list.get(i).getInt("qualifiedNum",0)==1?"是":"否"); + } + + try{ + ViTool.excelResponse(response, "获奖人员名单.xls"); + Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), excelExportEntities, list); + workbook.write(response.getOutputStream()); + }catch (Exception e){ + e.printStackTrace(); + } + + } + } diff --git a/src/main/java/io/v/nutz/wakershome/controller/review/AddZbController.java b/src/main/java/io/v/nutz/wakershome/controller/review/AddZbController.java index 4e13442..1923b03 100644 --- a/src/main/java/io/v/nutz/wakershome/controller/review/AddZbController.java +++ b/src/main/java/io/v/nutz/wakershome/controller/review/AddZbController.java @@ -1,18 +1,26 @@ package io.v.nutz.wakershome.controller.review; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; import io.v.nutz.annontation.ViReturn; +import io.v.nutz.sys.models.Sys_union; import io.v.nutz.wakershome.model.review.CommentNr; +import io.v.nutz.wakershome.model.review.CommentUnionGrading; import io.v.nutz.wakershome.model.review.CommentZb; import io.v.nutz.wakershome.service.review.CommentZbService; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.nutz.dao.Cnd; import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.lang.random.R; import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.Ok; import org.nutz.mvc.annotation.Param; import org.nutz.trans.Trans; +import java.util.ArrayList; +import java.util.List; + /** * @ClassName addZbController * @Description TODO @@ -44,6 +52,7 @@ public class AddZbController { nr.getBzs().forEach(v->v.setZb_id(zb.getId())); commentZbService.insertWith(nr, "bzs"); } + commentZbService.setGrading(zb); }); return null; diff --git a/src/main/java/io/v/nutz/wakershome/controller/review/StatisticsZpController.java b/src/main/java/io/v/nutz/wakershome/controller/review/StatisticsZpController.java index 1e0f344..5f8a098 100644 --- a/src/main/java/io/v/nutz/wakershome/controller/review/StatisticsZpController.java +++ b/src/main/java/io/v/nutz/wakershome/controller/review/StatisticsZpController.java @@ -1,6 +1,7 @@ package io.v.nutz.wakershome.controller.review; import cn.hutool.core.convert.Convert; +import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.StrUtil; import com.deepoove.poi.XWPFTemplate; import com.deepoove.poi.config.Configure; @@ -11,10 +12,7 @@ import io.v.nutz.base.utils.Vi; import io.v.nutz.modules.models.PageForm; import io.v.nutz.sys.models.Sys_file; import io.v.nutz.util.ShiroUtil; -import io.v.nutz.wakershome.model.review.CommentBz; -import io.v.nutz.wakershome.model.review.CommentNr; -import io.v.nutz.wakershome.model.review.CommentPeo; -import io.v.nutz.wakershome.model.review.CommentZb; +import io.v.nutz.wakershome.model.review.*; import io.v.nutz.wakershome.service.review.CommentPeoService; import io.v.nutz.wakershome.service.review.CommentStatisticsService; import io.v.nutz.wakershome.service.review.CommentZbService; @@ -24,6 +22,7 @@ import org.apache.commons.io.IOUtils; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.ddr.poi.html.HtmlRenderPolicy; import org.nutz.boot.starter.ftp.FtpService; +import org.nutz.dao.Chain; import org.nutz.dao.Cnd; import org.nutz.dao.Dao; import org.nutz.dao.Sqls; @@ -91,11 +90,14 @@ public class StatisticsZpController { SELECT un.id, un.unionname unionName, + IFNULL(grading.gradingName,'未定级') AS gradingName, + grading.isGrading, count( peo.id ) num FROM sys_union un LEFT JOIN `user` u ON u.unionId = un.id LEFT JOIN comment_peo peo ON peo.userId = u.id AND peo.zbId = @zbId + LEFT JOIN comment_union_grading grading on un.id = grading.unionId AND grading.zbId = @zbId $condition """).setParam("zbId", zbId); Cnd cnd = Cnd.NEW(); @@ -413,4 +415,17 @@ public class StatisticsZpController { // Map> collect = peoList.stream().collect(Collectors.groupingBy(CommentPeo::getUnionId)); } + + + @At + @RequiresPermissions("wakeshome.review.statistics") + public Object doGrading(CommentUnionGrading grading){ + if (StrUtil.isAllBlank(grading.getZbId(),grading.getUnionId(),grading.getGradingName())) { + return Result.error("必要参数为空"); + } + commentPeoService.dao().update(CommentUnionGrading.class, + Chain.make("isGrading",true).add("gradingName",grading.getGradingName()).add("gradingTime", DateUtil.now()), + Cnd.where("zbId","=",grading.getZbId()).and("unionId","=",grading.getUnionId())); + return Result.success(); + } } diff --git a/src/main/java/io/v/nutz/wakershome/controller/review/ViewZbController.java b/src/main/java/io/v/nutz/wakershome/controller/review/ViewZbController.java index f75b3f1..ff3f83e 100644 --- a/src/main/java/io/v/nutz/wakershome/controller/review/ViewZbController.java +++ b/src/main/java/io/v/nutz/wakershome/controller/review/ViewZbController.java @@ -151,6 +151,7 @@ public class ViewZbController { }); } + commentZbService.setGrading(commentZb); /* for (CommentNr nr : commentZb.getNrs()) { nr.setZb_id(commentZb.getId()); commentNrService.insertWith(nr, "bzs"); diff --git a/src/main/java/io/v/nutz/wakershome/model/review/CommentBz.java b/src/main/java/io/v/nutz/wakershome/model/review/CommentBz.java index 179ea37..edd4ed1 100644 --- a/src/main/java/io/v/nutz/wakershome/model/review/CommentBz.java +++ b/src/main/java/io/v/nutz/wakershome/model/review/CommentBz.java @@ -2,6 +2,7 @@ package io.v.nutz.wakershome.model.review; import cn.wizzer.framework.base.model.BaseModel; import lombok.Data; +import lombok.EqualsAndHashCode; import org.nutz.dao.DB; import org.nutz.dao.entity.annotation.*; @@ -13,6 +14,7 @@ import org.nutz.dao.entity.annotation.*; */ @Data @Table +@EqualsAndHashCode(callSuper = true) public class CommentBz extends BaseModel { @Column diff --git a/src/main/java/io/v/nutz/wakershome/model/review/CommentNr.java b/src/main/java/io/v/nutz/wakershome/model/review/CommentNr.java index 65df940..49d1509 100644 --- a/src/main/java/io/v/nutz/wakershome/model/review/CommentNr.java +++ b/src/main/java/io/v/nutz/wakershome/model/review/CommentNr.java @@ -2,6 +2,7 @@ package io.v.nutz.wakershome.model.review; import cn.wizzer.framework.base.model.BaseModel; import lombok.Data; +import lombok.EqualsAndHashCode; import org.nutz.dao.DB; import org.nutz.dao.entity.annotation.*; @@ -15,6 +16,7 @@ import java.util.List; */ @Data @Table +@EqualsAndHashCode(callSuper = true) public class CommentNr extends BaseModel { diff --git a/src/main/java/io/v/nutz/wakershome/model/review/CommentUnionGrading.java b/src/main/java/io/v/nutz/wakershome/model/review/CommentUnionGrading.java new file mode 100644 index 0000000..1a4450b --- /dev/null +++ b/src/main/java/io/v/nutz/wakershome/model/review/CommentUnionGrading.java @@ -0,0 +1,66 @@ +package io.v.nutz.wakershome.model.review; + +import io.v.nutz.base.model.BaseModel; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.nutz.dao.entity.annotation.*; + +import java.util.Date; + +/** + * @version 1.0 + * @Author zzr + * @name:CommentUnionGrading + * @Date 2024/9/19 8:48 + * @注释 校工会给分工会定级 + */ +@Data +@Table +@Comment("校工会给分工会定级表") +@EqualsAndHashCode(callSuper = true) +public class CommentUnionGrading extends BaseModel { + + @Column + @Name + @Comment("id") + @ColDefine(type = ColType.VARCHAR, width = 32) + @Prev(els = {@EL("uuid()")}) + private String id; + + @Column + @Comment("考核指标id") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String zbId; + + @Column + @Comment("定级的分工会id") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String unionId; + + @Column + @Comment("分工会名称") + @ColDefine(type = ColType.VARCHAR, width = 50) + private String unionName; + + @Column + @Comment("分工会编码") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String unionCode; + + @Column + @Comment("定级的名称") + @ColDefine(type = ColType.VARCHAR, width = 100) + private String gradingName; + + @Column + @Default("0") + @Comment("是否定级") + @ColDefine(type = ColType.BOOLEAN) + private Boolean isGrading; + + @Column + @Comment("定级时间") + @ColDefine(type = ColType.DATETIME) + private Date gradingTime; + +} diff --git a/src/main/java/io/v/nutz/wakershome/service/impl/review/CommentZbServiceImpl.java b/src/main/java/io/v/nutz/wakershome/service/impl/review/CommentZbServiceImpl.java index 75bd5df..b4a5382 100644 --- a/src/main/java/io/v/nutz/wakershome/service/impl/review/CommentZbServiceImpl.java +++ b/src/main/java/io/v/nutz/wakershome/service/impl/review/CommentZbServiceImpl.java @@ -1,9 +1,12 @@ package io.v.nutz.wakershome.service.impl.review; +import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import io.v.nutz.service.impl.ViServiceImpl; +import io.v.nutz.sys.models.Sys_union; import io.v.nutz.wakershome.model.review.CommentBz; import io.v.nutz.wakershome.model.review.CommentNr; +import io.v.nutz.wakershome.model.review.CommentUnionGrading; import io.v.nutz.wakershome.model.review.CommentZb; import io.v.nutz.wakershome.service.review.CommentNrService; import io.v.nutz.wakershome.service.review.CommentZbService; @@ -11,7 +14,9 @@ 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.random.R; +import java.util.ArrayList; import java.util.List; /** @@ -44,4 +49,34 @@ public class CommentZbServiceImpl extends ViServiceImpl implements Co return zb; } + + @Override + public void setGrading(CommentZb commentZb) { + int count = dao().count(CommentUnionGrading.class, Cnd.where("zbId", "=", commentZb.getId())); + if (count > 0) { + dao().clear(CommentUnionGrading.class, Cnd.where("zbId", "=", commentZb.getId())); + } + + if (ObjectUtil.isNotNull(commentZb.getCommentTarget()) && commentZb.getCommentTarget() != 1) { + List query = new ArrayList<>(); + if (commentZb.getCommentTarget() == 2) { + query = dao().query(Sys_union.class, Cnd.NEW()); + } else if (commentZb.getCommentTarget() == 3) { + query = dao().query(Sys_union.class, Cnd.where("id", "in", commentZb.getUnionIds())); + } + List commentUnionGradings = new ArrayList<>(); + for (Sys_union union : query) { + CommentUnionGrading unionGrading = new CommentUnionGrading(); + unionGrading.setId(R.UU32()); + unionGrading.setUnionId(union.getId()); + unionGrading.setZbId(commentZb.getId()); + unionGrading.setUnionName(union.getUnionname()); + unionGrading.setUnionCode(union.getUnioncode()); + unionGrading.setIsGrading(false); + unionGrading.setGradingTime(null); + commentUnionGradings.add(unionGrading); + } + dao().insert(commentUnionGradings); + } + } } diff --git a/src/main/java/io/v/nutz/wakershome/service/review/CommentZbService.java b/src/main/java/io/v/nutz/wakershome/service/review/CommentZbService.java index 19f50c9..c88453c 100644 --- a/src/main/java/io/v/nutz/wakershome/service/review/CommentZbService.java +++ b/src/main/java/io/v/nutz/wakershome/service/review/CommentZbService.java @@ -8,4 +8,5 @@ public interface CommentZbService extends ViService { CommentZb khzb(String zbid); + void setGrading(CommentZb zb); } diff --git a/src/main/resources/docTemplate/WakesHome.docx b/src/main/resources/docTemplate/WakesHome.docx index 42c097f..537073b 100644 Binary files a/src/main/resources/docTemplate/WakesHome.docx and b/src/main/resources/docTemplate/WakesHome.docx differ diff --git a/src/main/resources/views/mobile/meeting/myMeeting.html b/src/main/resources/views/mobile/meeting/myMeeting.html index b268373..51d36cb 100644 --- a/src/main/resources/views/mobile/meeting/myMeeting.html +++ b/src/main/resources/views/mobile/meeting/myMeeting.html @@ -237,13 +237,20 @@ layout("/mobile/platform.html"){ 已签到--> 替他人请假 + + 查看请假状态 我要请假 @@ -275,16 +282,28 @@ layout("/mobile/platform.html"){
-
+ +
-
会议名称:{{item.timePeriodName}}
+
+ 会议名称: + {{item.timePeriodName}} +
会议时间: - {{moment(item.startTime).format('YYYY-MM-DD HH:mm')}} + {{moment(item.startTime).format('YYYY-MM-DD HH:mm')}}
@@ -297,12 +316,15 @@ layout("/mobile/platform.html"){
-
审核状态:{{item.stateName}}
+
+ 审核状态: + {{item.stateName}} +
请假原因:
@@ -318,6 +340,7 @@ layout("/mobile/platform.html"){
+
@@ -330,6 +353,24 @@ layout("/mobile/platform.html"){
+ + + + + +
+ + + + + + +
+
+