Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -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<String, Object> params = new HashMap<String, Object>() {{
|
||||
// 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<String, Object> params = new HashMap<String, Object>() {{
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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<Record> files = baseService.dao().query("sys_file", Cnd.where("reid", "=", id));
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -5,4 +5,6 @@ import io.v.nutz.lxy.model.Lxy_mefp;
|
||||
|
||||
|
||||
public interface LxyMefpService extends BaseService<Lxy_mefp> {
|
||||
|
||||
void setMefp(String jsonStr, String hdId);
|
||||
}
|
||||
|
||||
@@ -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<Lxy_mefp> implements Lxy
|
||||
public LxyMefpServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setMefp(String jsonStr, String hdId) {
|
||||
if (StrUtil.isNotBlank(jsonStr)) {
|
||||
List<NutMap> list = JSONUtil.parseArray(jsonStr).toList(NutMap.class);
|
||||
List<Lxy_mefp> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,7 +27,7 @@ public interface MeetingMineService extends ViService {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<Object> findMyMeetPeriod(String meetingId);
|
||||
List<Object> findMyMeetPeriod(String meetingId, Boolean helpLeave, String userId);
|
||||
|
||||
/**
|
||||
* 请假
|
||||
|
||||
@@ -75,7 +75,7 @@ public class MeetingMineServiceImpl extends ViServiceImpl implements MeetingMine
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Object> findMyMeetPeriod(String meetingId) {
|
||||
public List<Object> 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<NutMap> userIdMap = meetingCommonService.getNextAuditUser(stateCode, moduleName);
|
||||
String userInfoStr = msgNotifyService.userData(userIdMap);
|
||||
List<String> userInfoStr = msgNotifyService.userData(userIdMap);
|
||||
|
||||
String meetingId = meetingTimePeriodUsers.get(0).getMeetingId();
|
||||
MeetingInfo meetingInfo = dao().fetch(MeetingInfo.class, meetingId);
|
||||
|
||||
@@ -146,7 +146,7 @@ public class MsgNotifyController {
|
||||
|
||||
if (msgNotify.getType() != null && msgNotify.getType().equals("system")) {
|
||||
List<NutMap> list = msgNotifyService.getUserByRoleIds(msgNotify.getModule(), msgNotify.getTeacherMeetingId(), msgNotify.getRoleIds());
|
||||
String userData = msgNotifyService.userData(list);
|
||||
List<String> 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> user = dao.query(User.class, Cnd.where("id", "in", users));
|
||||
String objectUserData = msgNotifyService.ObjectUserData(user);
|
||||
List<String> objectUserData = msgNotifyService.ObjectUserData(user);
|
||||
msgNotifyService.sendMsg(msgNotify.getSendTypes(), objectUserData, msgNotify.getContent());
|
||||
}
|
||||
for (String u : users) {
|
||||
@@ -180,7 +180,7 @@ public class MsgNotifyController {
|
||||
}
|
||||
} else {
|
||||
List<NutMap> userScopes = msgNotifyService.getUserScopes(msgNotify.getActivityGroupId());
|
||||
String userData = msgNotifyService.userData(userScopes);
|
||||
List<String> 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<String> 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> user = dao.query(User.class, Cnd.where("id", "in", users));
|
||||
String objectUserData = msgNotifyService.ObjectUserData(user);
|
||||
List<String> objectUserData = msgNotifyService.ObjectUserData(user);
|
||||
msgNotifyService.sendMsg(msgNotify.getSendTypes(), objectUserData, msgNotify.getContent());
|
||||
|
||||
}
|
||||
@@ -268,7 +268,7 @@ public class MsgNotifyController {
|
||||
""").setParam("groupId", msgNotify.getActivityGroupId());
|
||||
List<NutMap> userScopes = activityBasicScopeService.listMap(sql);
|
||||
msgNotify.setHold(flag ? true : false);
|
||||
String userData = msgNotifyService.userData(userScopes);
|
||||
List<String> userData = msgNotifyService.userData(userScopes);
|
||||
if (flag) {
|
||||
msgNotifyService.sendMsg(msgNotify.getSendTypes(), userData, msgNotify.getContent());
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ public class MsgNotifyTitleController {
|
||||
@RequiresAuthentication
|
||||
public Object doSend(String id, String[] sendTypes, String content) {
|
||||
List<NutMap> msgNotifyUser = msgNotifyService.getMsgNotifyUser(id);
|
||||
String userData = msgNotifyService.userData(msgNotifyUser);
|
||||
List<String> 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")));
|
||||
|
||||
@@ -36,9 +36,9 @@ public interface MsgNotifyService {
|
||||
|
||||
String userData(User user);
|
||||
|
||||
String ObjectUserData(List<User> userList);
|
||||
List<String> ObjectUserData(List<User> userList);
|
||||
|
||||
String userData(List<NutMap> userListMap);
|
||||
List<String> userData(List<NutMap> userListMap);
|
||||
|
||||
/**
|
||||
* 根据条件发送短信
|
||||
@@ -49,6 +49,7 @@ public interface MsgNotifyService {
|
||||
*/
|
||||
void sendMsg(List<String> sendTypes, String userData, String content);
|
||||
|
||||
void sendMsg(List<String> sendTypes, List<String> userData, String content);
|
||||
|
||||
/**
|
||||
* 查询活动设置人员
|
||||
|
||||
@@ -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<MsgNotify> implements Ms
|
||||
*/
|
||||
@Override
|
||||
public String userData(NutMap v) {
|
||||
List<String> list = new ArrayList<>();
|
||||
/*List<String> 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<MsgNotify> 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<String> list = new ArrayList<>();
|
||||
/*List<String> list = new ArrayList<>();
|
||||
list.add(user.getUsername());
|
||||
list.add(user.getLoginname());
|
||||
list.add(user.getUnitid());
|
||||
@@ -87,25 +89,27 @@ public class MsgNotifyServiceImpl extends ViServiceImpl<MsgNotify> 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<User> userList) {
|
||||
public List<String> ObjectUserData(List<User> userList) {
|
||||
List<String> recievePersonInfo = new ArrayList<>();
|
||||
for (User user : userList) {
|
||||
recievePersonInfo.add(userData(user));
|
||||
}
|
||||
return String.join("^@^", recievePersonInfo);
|
||||
return recievePersonInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String userData(List<NutMap> userList) {
|
||||
public List<String> userData(List<NutMap> userList) {
|
||||
List<String> 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<MsgNotify> 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<String> sendTypes, List<String> 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;
|
||||
|
||||
/**
|
||||
* 查询活动设置人员
|
||||
|
||||
+67
@@ -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<NutMap> list = baseService.listMap(sql);
|
||||
|
||||
|
||||
List<ExcelExportEntity> 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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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<String, List<CommentPeo>> 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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,6 +151,7 @@ public class ViewZbController {
|
||||
});
|
||||
|
||||
}
|
||||
commentZbService.setGrading(commentZb);
|
||||
/* for (CommentNr nr : commentZb.getNrs()) {
|
||||
nr.setZb_id(commentZb.getId());
|
||||
commentNrService.insertWith(nr, "bzs");
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -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<CommentZb> 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<Sys_union> 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<CommentUnionGrading> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,4 +8,5 @@ public interface CommentZbService extends ViService<CommentZb> {
|
||||
|
||||
CommentZb khzb(String zbid);
|
||||
|
||||
void setGrading(CommentZb zb);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user