commit
This commit is contained in:
@@ -67,60 +67,60 @@ public class SysMsgServiceImpl extends BaseServiceImpl<Sys_msg> implements SysMs
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Sys_msg saveMsg(Sys_msg sysMsg, String[] users, boolean isExternal) {
|
||||
this.insert(sysMsg);
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.groupBy("loginname");
|
||||
FieldFilter fieldFilter = FieldFilter.create(View_user.class, "loginname|username|unitId|unitName|unionId|unionName");
|
||||
if ("user".equals(sysMsg.getType())) {
|
||||
cnd.and(View_user::getLoginname, "in", users);
|
||||
}
|
||||
List<View_user> viewUsers = Daos.ext(dao(), fieldFilter).query(View_user.class, cnd);
|
||||
List<Sys_msg_user> list = new CopyOnWriteArrayList<>();
|
||||
for (View_user viewUser : viewUsers) {
|
||||
Sys_msg_user sys_msg_user = new Sys_msg_user();
|
||||
sys_msg_user.setId(R.UU32());
|
||||
sys_msg_user.setMsgId(sysMsg.getId());
|
||||
sys_msg_user.setStatus(0);
|
||||
sys_msg_user.setLoginname(viewUser.getLoginname());
|
||||
sys_msg_user.setUserName(viewUser.getUsername());
|
||||
sys_msg_user.setUnitId(viewUser.getUnitId());
|
||||
sys_msg_user.setUnitName(viewUser.getUnitName());
|
||||
sys_msg_user.setUnionId(viewUser.getUnionId());
|
||||
sys_msg_user.setUnionName(viewUser.getUnionName());
|
||||
list.add(sys_msg_user);
|
||||
}
|
||||
dao().fastInsert(list);
|
||||
sysMsgUserService.clearCache();
|
||||
|
||||
List<String> loginNames = viewUsers.stream().map(View_user::getLoginname).distinct().toList();
|
||||
//发送站内消息
|
||||
ThreadUtil.execute(() -> {
|
||||
for (String loginName : loginNames) {
|
||||
getMsg(loginName);
|
||||
}
|
||||
});
|
||||
|
||||
//发送学校平台消息
|
||||
// for (String loginName : loginNames) {
|
||||
// smsService.send(loginName, sysMsg.getTitle(), sysMsg.getNote());
|
||||
// this.insert(sysMsg);
|
||||
//
|
||||
// Cnd cnd = Cnd.NEW();
|
||||
// cnd.groupBy("loginname");
|
||||
// FieldFilter fieldFilter = FieldFilter.create(View_user.class, "loginname|username|unitId|unitName|unionId|unionName");
|
||||
// if ("user".equals(sysMsg.getType())) {
|
||||
// cnd.and(View_user::getLoginname, "in", users);
|
||||
// }
|
||||
ThreadUtil.execute(() -> {
|
||||
smsService.massSend(loginNames, sysMsg.getTitle(), HtmlUtil.cleanHtmlTag(StrUtil.blankToDefault(sysMsg.getNote(),"")), sysMsg.getUrl());
|
||||
});
|
||||
// List<View_user> viewUsers = Daos.ext(dao(), fieldFilter).query(View_user.class, cnd);
|
||||
// List<Sys_msg_user> list = new CopyOnWriteArrayList<>();
|
||||
// for (View_user viewUser : viewUsers) {
|
||||
// Sys_msg_user sys_msg_user = new Sys_msg_user();
|
||||
// sys_msg_user.setId(R.UU32());
|
||||
// sys_msg_user.setMsgId(sysMsg.getId());
|
||||
// sys_msg_user.setStatus(0);
|
||||
// sys_msg_user.setLoginname(viewUser.getLoginname());
|
||||
// sys_msg_user.setUserName(viewUser.getUsername());
|
||||
// sys_msg_user.setUnitId(viewUser.getUnitId());
|
||||
// sys_msg_user.setUnitName(viewUser.getUnitName());
|
||||
// sys_msg_user.setUnionId(viewUser.getUnionId());
|
||||
// sys_msg_user.setUnionName(viewUser.getUnionName());
|
||||
// list.add(sys_msg_user);
|
||||
// }
|
||||
// dao().fastInsert(list);
|
||||
// sysMsgUserService.clearCache();
|
||||
//
|
||||
// List<String> loginNames = viewUsers.stream().map(View_user::getLoginname).distinct().toList();
|
||||
// //发送站内消息
|
||||
// ThreadUtil.execute(() -> {
|
||||
// for (String loginName : loginNames) {
|
||||
// getMsg(loginName);
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// //发送学校平台消息
|
||||
//// for (String loginName : loginNames) {
|
||||
//// smsService.send(loginName, sysMsg.getTitle(), sysMsg.getNote());
|
||||
//// }
|
||||
// ThreadUtil.execute(() -> {
|
||||
// smsService.massSend(loginNames, sysMsg.getTitle(), HtmlUtil.cleanHtmlTag(StrUtil.blankToDefault(sysMsg.getNote(),"")), sysMsg.getUrl());
|
||||
// });
|
||||
|
||||
return sysMsg;
|
||||
}
|
||||
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void deleteMsg(String id) {
|
||||
this.delete(id);
|
||||
List<Sys_msg_user> msgUsers = sysMsgUserService.query(Cnd.where(Sys_msg_user::getMsgId, "=", id));
|
||||
sysMsgUserService.clear(Cnd.where("msgId", "=", id));
|
||||
sysMsgUserService.clearCache();
|
||||
for (Sys_msg_user msgUser : msgUsers) {
|
||||
getMsg(msgUser.getLoginname());
|
||||
}
|
||||
// this.delete(id);
|
||||
// List<Sys_msg_user> msgUsers = sysMsgUserService.query(Cnd.where(Sys_msg_user::getMsgId, "=", id));
|
||||
// sysMsgUserService.clear(Cnd.where("msgId", "=", id));
|
||||
// sysMsgUserService.clearCache();
|
||||
// for (Sys_msg_user msgUser : msgUsers) {
|
||||
// getMsg(msgUser.getLoginname());
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -206,36 +206,36 @@ public class SysMsgServiceImpl extends BaseServiceImpl<Sys_msg> implements SysMs
|
||||
@Override
|
||||
@Async
|
||||
public void innerMsg(String room, int size, List<NutMap> list) {
|
||||
NutMap map = new NutMap();
|
||||
map.put("action", "innerMsg");
|
||||
map.put("size", size);//未读消息数
|
||||
map.put("list", list);//最新5条消息列表 type--系统消息/用户消息 title--标题 time--时间戳
|
||||
String msg = Json.toJson(map, JsonFormat.compact());
|
||||
log.debug("msg::::" + msg);
|
||||
if (jedisAgent.isClusterMode()) {
|
||||
JedisCluster jedisCluster = jedisAgent.getJedisClusterWrapper().getJedisCluster();
|
||||
for (JedisPool pool : jedisCluster.getClusterNodes().values()) {
|
||||
try (Jedis jedis = pool.getResource()) {
|
||||
ScanParams match = new ScanParams().match(RedisConstant.REDIS_KEY_WSROOM + room + ":*");
|
||||
ScanResult<String> scan = null;
|
||||
do {
|
||||
scan = jedis.scan(scan == null ? ScanParams.SCAN_POINTER_START : scan.getStringCursor(), match);
|
||||
for (String key : scan.getResult()) {
|
||||
pubSubService.fire(key, msg);
|
||||
}
|
||||
} while (!scan.isCompleteIteration());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ScanParams match = new ScanParams().match(RedisConstant.REDIS_KEY_WSROOM + room + ":*");
|
||||
ScanResult<String> scan = null;
|
||||
do {
|
||||
scan = redisService.scan(scan == null ? ScanParams.SCAN_POINTER_START : scan.getStringCursor(), match);
|
||||
for (String key : scan.getResult()) {
|
||||
pubSubService.fire(key, msg);
|
||||
}
|
||||
} while (!scan.isCompleteIteration());
|
||||
}
|
||||
// NutMap map = new NutMap();
|
||||
// map.put("action", "innerMsg");
|
||||
// map.put("size", size);//未读消息数
|
||||
// map.put("list", list);//最新5条消息列表 type--系统消息/用户消息 title--标题 time--时间戳
|
||||
// String msg = Json.toJson(map, JsonFormat.compact());
|
||||
// log.debug("msg::::" + msg);
|
||||
// if (jedisAgent.isClusterMode()) {
|
||||
// JedisCluster jedisCluster = jedisAgent.getJedisClusterWrapper().getJedisCluster();
|
||||
// for (JedisPool pool : jedisCluster.getClusterNodes().values()) {
|
||||
// try (Jedis jedis = pool.getResource()) {
|
||||
// ScanParams match = new ScanParams().match(RedisConstant.REDIS_KEY_WSROOM + room + ":*");
|
||||
// ScanResult<String> scan = null;
|
||||
// do {
|
||||
// scan = jedis.scan(scan == null ? ScanParams.SCAN_POINTER_START : scan.getStringCursor(), match);
|
||||
// for (String key : scan.getResult()) {
|
||||
// pubSubService.fire(key, msg);
|
||||
// }
|
||||
// } while (!scan.isCompleteIteration());
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// ScanParams match = new ScanParams().match(RedisConstant.REDIS_KEY_WSROOM + room + ":*");
|
||||
// ScanResult<String> scan = null;
|
||||
// do {
|
||||
// scan = redisService.scan(scan == null ? ScanParams.SCAN_POINTER_START : scan.getStringCursor(), match);
|
||||
// for (String key : scan.getResult()) {
|
||||
// pubSubService.fire(key, msg);
|
||||
// }
|
||||
// } while (!scan.isCompleteIteration());
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
@@ -247,71 +247,71 @@ public class SysMsgServiceImpl extends BaseServiceImpl<Sys_msg> implements SysMs
|
||||
@Override
|
||||
// @Async
|
||||
public void getMsg(String loginname) {
|
||||
try {
|
||||
//通过用户名查询未读消息
|
||||
int size = sysMsgUserService.getUnreadNum(loginname);
|
||||
List<Sys_msg_user> list = sysMsgUserService.getUnreadList(loginname, 1, 5);
|
||||
List<NutMap> mapList = new ArrayList<>();
|
||||
for (Sys_msg_user msgUser : list) {
|
||||
String url = "/platform/sys/msg/user/all/detail/" + msgUser.getMsgId();
|
||||
if (Strings.isNotBlank(msgUser.getMsg().getUrl())) {
|
||||
url = msgUser.getMsg().getUrl();
|
||||
}
|
||||
mapList.add(NutMap.NEW()
|
||||
.addv("msgId", msgUser.getMsgId())
|
||||
.addv("type", typeMap.getString(msgUser.getMsg().getType()))
|
||||
.addv("title", msgUser.getMsg().getTitle())
|
||||
.addv("url", url)
|
||||
.addv("time", Times.format("yyyy-MM-dd HH:mm", Times.D(1000 * msgUser.getMsg().getSendAt()))));
|
||||
}
|
||||
innerMsg(loginname, size, mapList);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
// try {
|
||||
// //通过用户名查询未读消息
|
||||
// int size = sysMsgUserService.getUnreadNum(loginname);
|
||||
// List<Sys_msg_user> list = sysMsgUserService.getUnreadList(loginname, 1, 5);
|
||||
// List<NutMap> mapList = new ArrayList<>();
|
||||
// for (Sys_msg_user msgUser : list) {
|
||||
// String url = "/platform/sys/msg/user/all/detail/" + msgUser.getMsgId();
|
||||
// if (Strings.isNotBlank(msgUser.getMsg().getUrl())) {
|
||||
// url = msgUser.getMsg().getUrl();
|
||||
// }
|
||||
// mapList.add(NutMap.NEW()
|
||||
// .addv("msgId", msgUser.getMsgId())
|
||||
// .addv("type", typeMap.getString(msgUser.getMsg().getType()))
|
||||
// .addv("title", msgUser.getMsg().getTitle())
|
||||
// .addv("url", url)
|
||||
// .addv("time", Times.format("yyyy-MM-dd HH:mm", Times.D(1000 * msgUser.getMsg().getSendAt()))));
|
||||
// }
|
||||
// innerMsg(loginname, size, mapList);
|
||||
// } catch (Exception e) {
|
||||
// log.error(e.getMessage(), e);
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
@Async
|
||||
public void offline(String room, String userToken) {
|
||||
NutMap map = new NutMap();
|
||||
map.put("action", "offline");
|
||||
String msg = Json.toJson(map, JsonFormat.compact());
|
||||
try {
|
||||
room = RedisConstant.REDIS_KEY_WSROOM + room + ":" + userToken;
|
||||
log.debugf("offline room(name=%s)", room);
|
||||
pubSubService.fire(room, msg);
|
||||
redisService.expire(room, 60 * 3);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
// NutMap map = new NutMap();
|
||||
// map.put("action", "offline");
|
||||
// String msg = Json.toJson(map, JsonFormat.compact());
|
||||
// try {
|
||||
// room = RedisConstant.REDIS_KEY_WSROOM + room + ":" + userToken;
|
||||
// log.debugf("offline room(name=%s)", room);
|
||||
// pubSubService.fire(room, msg);
|
||||
// redisService.expire(room, 60 * 3);
|
||||
// } catch (Exception e) {
|
||||
// log.error(e.getMessage(), e);
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMsg(String loginname, String title, String body, String sender) {
|
||||
sendMsg(List.of(loginname), title, body, SecurityUtil.getUserId());
|
||||
// sendMsg(List.of(loginname), title, body, SecurityUtil.getUserId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMsg(List<String> loginNames, String title, String body, String sender) {
|
||||
Sys_msg sysMsg = new Sys_msg();
|
||||
sysMsg.setTitle(title);
|
||||
sysMsg.setNote(body);
|
||||
sysMsg.setSendType("hide");
|
||||
sysMsg.setType("user");
|
||||
sysMsg.setSendAt(Times.getTS());
|
||||
sysMsg.setCreatedBy(sender);
|
||||
this.saveMsg(sysMsg, loginNames.toArray(new String[]{}), true);
|
||||
// Sys_msg sysMsg = new Sys_msg();
|
||||
// sysMsg.setTitle(title);
|
||||
// sysMsg.setNote(body);
|
||||
// sysMsg.setSendType("hide");
|
||||
// sysMsg.setType("user");
|
||||
// sysMsg.setSendAt(Times.getTS());
|
||||
// sysMsg.setCreatedBy(sender);
|
||||
// this.saveMsg(sysMsg, loginNames.toArray(new String[]{}), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMsgInSys(List<String> loginNames, String title, String body, String sender) {
|
||||
Sys_msg sysMsg = new Sys_msg();
|
||||
sysMsg.setTitle(title);
|
||||
sysMsg.setNote(body);
|
||||
sysMsg.setSendType("hide");
|
||||
sysMsg.setType("user");
|
||||
sysMsg.setSendAt(Times.getTS());
|
||||
sysMsg.setCreatedBy(sender);
|
||||
this.saveMsg(sysMsg, loginNames.toArray(new String[]{}), false);
|
||||
// Sys_msg sysMsg = new Sys_msg();
|
||||
// sysMsg.setTitle(title);
|
||||
// sysMsg.setNote(body);
|
||||
// sysMsg.setSendType("hide");
|
||||
// sysMsg.setType("user");
|
||||
// sysMsg.setSendAt(Times.getTS());
|
||||
// sysMsg.setCreatedBy(sender);
|
||||
// this.saveMsg(sysMsg, loginNames.toArray(new String[]{}), false);
|
||||
}
|
||||
}
|
||||
|
||||
+12
-3
@@ -87,14 +87,23 @@ public class ClubUserJoinApplyController {
|
||||
@SaCheckPermission("club.join.apply")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Result submit(ClubUserApply clubUserApply) {
|
||||
Sys_user user = dao.fetch(Sys_user.class, Cnd.where("id", "=", clubUserApply.getUserId()));
|
||||
if (!user.getMember() && !("劳务派遣一类".equals(user.getPreparedBy()) || "劳务派遣二类".equals(user.getPreparedBy()))) return Result.error("暂无申请加入协会资格!");
|
||||
|
||||
ClubUserApply userApply = dao.fetch(ClubUserApply.class, Cnd.where("userId", "=", clubUserApply.getUserId()).and("clubId", "=", clubUserApply.getClubId()).and("mode", "=", 1).desc(ClubUserApply::getApplyDate));
|
||||
if (ObjectUtil.isNotEmpty(userApply) && StrUtil.isBlank(userApply.getId())) {
|
||||
if (ObjectUtil.isNotEmpty(userApply) && StrUtil.isNotBlank(userApply.getId())) {
|
||||
BpmProcessInstance processInstance = dao.fetch(BpmProcessInstance.class, Cnd.where(BpmProcessInstance::getProcessInstanceBusinessId, "=", userApply.getId()));
|
||||
if (!processInstance.getProcessInstanceStatus().equals(BpmProcessInstanceStatusEnum.COMPLETED.name())) {
|
||||
return Result.error("您有该协会的申请记录尚未完成,请到我的申请里查看!");
|
||||
}
|
||||
}
|
||||
|
||||
ClubUser clubUser = dao.fetch(ClubUser.class, Cnd.where("userId", "=", clubUserApply.getUserId())
|
||||
.and("clubId", "=", clubUserApply.getClubId()));
|
||||
if (ObjectUtil.isNotEmpty(clubUser)) {
|
||||
return Result.error("您已经是该协会成员,无需重复申请!");
|
||||
}
|
||||
|
||||
//查询协会操作员
|
||||
String operatorLoginName = commonService.findUserLoginNameByRoleCode(RoleConstant.CLUB_OPERATOR, Cnd.where(Sys_user_role::getClubId, "=", clubUserApply.getClubId()));
|
||||
String presidentLoginName = commonService.findUserLoginNameByRoleCode(RoleConstant.CLUB_PRESIDENT, Cnd.where(Sys_user_role::getClubId, "=", clubUserApply.getClubId()));
|
||||
@@ -112,11 +121,11 @@ public class ClubUserJoinApplyController {
|
||||
if (StrUtil.isNotBlank(operatorLoginName)) {
|
||||
bpmService.startSubmitProcessInstance(BpmProcessConstant.CLUB_JOIN.name(), applyUser.getUsername() + "的申请", clubUserApply.getId(), List.of(operatorLoginName), null);
|
||||
// 发送消息
|
||||
sysMsgService.sendMsg(operatorLoginName, "协会入会审核", "您有一条新的协会入会申请待处理,请登录暖心工会进行审批。", SecurityUtil.getUserId());
|
||||
// sysMsgService.sendMsg(operatorLoginName, "协会入会审核", "您有一条新的协会入会申请待处理,请登录暖心工会进行审批。", SecurityUtil.getUserId());
|
||||
}else{
|
||||
bpmService.startSubmitProcessInstance(BpmProcessConstant.CLUB_JOIN.name(), applyUser.getUsername() + "的申请", clubUserApply.getId(), List.of(presidentLoginName), null);
|
||||
// 发送消息
|
||||
sysMsgService.sendMsg(presidentLoginName, "协会入会审核", "您有一条新的协会入会申请待处理,请登录暖心工会进行审批。", SecurityUtil.getUserId());
|
||||
// sysMsgService.sendMsg(presidentLoginName, "协会入会审核", "您有一条新的协会入会申请待处理,请登录暖心工会进行审批。", SecurityUtil.getUserId());
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
+38
-5
@@ -7,17 +7,22 @@ import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.bpm.enums.BpmProcessTaskStatusEnum;
|
||||
import com.budwk.app.bpm.enums.BpmTaskApprovalTypeEnum;
|
||||
import com.budwk.app.bpm.models.BpmProcessInstance;
|
||||
import com.budwk.app.bpm.models.BpmProcessTask;
|
||||
import com.budwk.app.bpm.param.BpmTaskApprovalParam;
|
||||
import com.budwk.app.bpm.service.BpmService;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.web.controllers.open.commons.service.CommonService;
|
||||
import com.budwk.app.zhgh.club.model.ClubUser;
|
||||
import com.budwk.app.zhgh.club.model.ClubUserApply;
|
||||
import com.budwk.app.zhgh.club.param.ClubUserJoinPageForm;
|
||||
import com.budwk.app.zhgh.club.service.ClubUserJoinService;
|
||||
import com.budwk.app.zhgh.club.vo.ClubUserJoinPageVo;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
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.Static;
|
||||
@@ -44,6 +49,8 @@ public class ClubUserJoinApprovalController {
|
||||
private BpmService bpmService;
|
||||
@Inject
|
||||
private ClubUserJoinService clubUserJoinService;
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("club.join.clubApproval")
|
||||
@@ -111,14 +118,31 @@ public class ClubUserJoinApprovalController {
|
||||
@ApiOperation("审核")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Result approval(@Valid @Param("approval") BpmTaskApprovalParam approvalParam){
|
||||
approvalParam.getBpmTaskApprovalTypeEnum();
|
||||
// approvalParam.getBpmTaskApprovalTypeEnum();
|
||||
// Map<String, Object> variables = BeanUtil.beanToMap(approvalParam);
|
||||
// List<String> assignments = new ArrayList<>();
|
||||
// if(approvalParam.getBpmTaskApprovalTypeEnum().equals(BpmTaskApprovalTypeEnum.PASS)){
|
||||
// String approvalLoginName = commonService.findUserLoginNameByRoleCode(RoleConstant.SCHOOL_UNION_CLUB_ADMIN);
|
||||
// assignments.add(approvalLoginName);
|
||||
// }
|
||||
// bpmService.completeTask(approvalParam.getProcessInstanceTaskId(), approvalParam.getBpmTaskApprovalTypeEnum(), variables, assignments);
|
||||
|
||||
|
||||
Map<String, Object> variables = BeanUtil.beanToMap(approvalParam);
|
||||
List<String> assignments = new ArrayList<>();
|
||||
if(approvalParam.getBpmTaskApprovalTypeEnum().equals(BpmTaskApprovalTypeEnum.PASS)){
|
||||
String approvalLoginName = commonService.findUserLoginNameByRoleCode(RoleConstant.SCHOOL_UNION_CLUB_ADMIN);
|
||||
assignments.add(approvalLoginName);
|
||||
}
|
||||
bpmService.completeTask(approvalParam.getProcessInstanceTaskId(), approvalParam.getBpmTaskApprovalTypeEnum(), variables, assignments);
|
||||
|
||||
if (approvalParam.getBpmTaskApprovalTypeEnum() == BpmTaskApprovalTypeEnum.PASS) {
|
||||
String processInstanceBusinessId = approvalParam.getProcessInstanceBusinessId();
|
||||
ClubUserApply clubUserApply = dao.fetch(ClubUserApply.class, processInstanceBusinessId);
|
||||
if (clubUserApply != null) {
|
||||
ClubUser existUser = dao.fetch(ClubUser.class, Cnd.where("userId", "=", clubUserApply.getUserId()).and("clubId", "=", clubUserApply.getClubId()));
|
||||
if (existUser == null) {
|
||||
ClubUser clubUser = BeanUtil.copyProperties(clubUserApply, ClubUser.class);
|
||||
dao.insert(clubUser);
|
||||
}
|
||||
}
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@@ -128,6 +152,15 @@ public class ClubUserJoinApprovalController {
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Result revoke(@Valid String taskId){
|
||||
bpmService.revokeTask(taskId);
|
||||
|
||||
BpmProcessTask task = dao.fetch(BpmProcessTask.class, taskId);
|
||||
String processInstanceId = task.getProcessInstanceId();
|
||||
BpmProcessInstance processInstance = dao.fetch(BpmProcessInstance.class, processInstanceId);
|
||||
String businessId = processInstance.getProcessInstanceBusinessId();
|
||||
|
||||
ClubUserApply clubUserApply = dao.fetch(ClubUserApply.class, businessId);
|
||||
dao.clear(ClubUser.class, Cnd.where(ClubUser::getUserId, "=", clubUserApply.getUserId())
|
||||
.and(ClubUser::getClubId, "=", clubUserApply.getClubId()));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
+4
-1
@@ -11,6 +11,7 @@ import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.club.model.ClubUser;
|
||||
import com.budwk.app.zhgh.club.model.ClubUserApply;
|
||||
import com.budwk.app.zhgh.club.param.ClubUserJoinPageForm;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
@@ -47,7 +48,7 @@ public class ClubUserJoinMineController {
|
||||
|
||||
@At
|
||||
@SaCheckPermission("club.join.mine")
|
||||
public Result pageData(@Valid PageForm pageForm,
|
||||
public Result pageData(@Valid ClubUserJoinPageForm pageForm,
|
||||
@Param("year") Integer year){
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
@@ -81,6 +82,8 @@ public class ClubUserJoinMineController {
|
||||
cnd.and("inst.processInstanceInitiatorLoginName", "=", SecurityUtil.getUserLoginname());
|
||||
}
|
||||
cnd.andEX("year(info.applyDate)", "=", year);
|
||||
cnd.and(Cnd.likeEX("u.userName", pageForm.getUserName()));
|
||||
cnd.and(Cnd.likeEX("u.loginName", pageForm.getLoginName()));
|
||||
cnd.groupBy("info.id");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
|
||||
+82
@@ -6,8 +6,10 @@ import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.core.util.URLUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
@@ -45,6 +47,7 @@ import javax.validation.Valid;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
@@ -227,6 +230,85 @@ public class ClubStatisticsController {
|
||||
zipOutputStream.close();
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@SaCheckPermission("club.statistics")
|
||||
public void exportExcel(String clubId,
|
||||
String userState,
|
||||
String sex,
|
||||
HttpServletResponse response) throws IOException {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.username as userName,
|
||||
u.loginname as loginName,
|
||||
u.sex,
|
||||
u.mobile,
|
||||
u.unitname as unitName,
|
||||
u.userstate as userState,
|
||||
c.*,
|
||||
sc.clubName as clubName
|
||||
FROM
|
||||
club_user c
|
||||
INNER JOIN `vw_user` u ON u.id = c.userId
|
||||
LEFT JOIN sys_club sc ON c.clubId = sc.id
|
||||
$condition
|
||||
ORDER BY
|
||||
sc.clubName,
|
||||
CASE
|
||||
WHEN JSON_CONTAINS(c.roleCode, '"CLUB_PRESIDENT"') THEN 1
|
||||
WHEN JSON_CONTAINS(c.roleCode, '"CLUB_VICE_PRESIDENT"') THEN 2
|
||||
WHEN JSON_CONTAINS(c.roleCode, '"CLUB_SECRETARY"') THEN 3
|
||||
WHEN JSON_CONTAINS(c.roleCode, '"CLUB_VICE_SECRETARY"') THEN 4
|
||||
WHEN JSON_CONTAINS(c.roleCode, '"CLUB_MEMBER"') THEN 5
|
||||
ELSE 99
|
||||
END
|
||||
""");
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(),
|
||||
RoleConstant.SCHOOL_UNION_ADMIN.name(),
|
||||
RoleConstant.SCHOOL_UNION_CLUB_ADMIN.name())) {
|
||||
Sys_role sysRole = sysRoleService.getByCode(RoleConstant.CLUB_PRESIDENT);
|
||||
List<Sys_user_role> userRoles = sysClubService.dao().query(Sys_user_role.class,
|
||||
Cnd.where("userId", "=", SecurityUtil.getUserId())
|
||||
.and("roleId", "=", sysRole.getId()));
|
||||
List<String> myClubId = userRoles.stream().map(Sys_user_role::getClubId).toList();
|
||||
cnd.and("c.clubId", "in", myClubId);
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(clubId)) {
|
||||
cnd.andEX("c.clubId", "=", clubId);
|
||||
}
|
||||
cnd.andEX("u.userState", "=", userState);
|
||||
cnd.andEX("u.sex", "=", sex);
|
||||
|
||||
sql.setCondition(cnd);
|
||||
|
||||
List<NutMap> listMap = sysClubService.listMap(sql);
|
||||
for (NutMap nutMap : listMap) {
|
||||
List<String> list = JSONUtil.toList(nutMap.getString("roleCode"), String.class);
|
||||
String roleName = SysClubUserServiceImpl.convertRoleName(list);
|
||||
nutMap.put("roleName", roleName);
|
||||
nutMap.put("roleCode", list);
|
||||
|
||||
}
|
||||
|
||||
List<ExcelExportEntity> exportEntities = new ArrayList<>();
|
||||
exportEntities.add(new ExcelExportEntity("协会名称", "clubName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("姓名", "userName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("工号", "loginName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("性别", "sex", 20));
|
||||
exportEntities.add(new ExcelExportEntity("联系方式", "mobile", 20));
|
||||
exportEntities.add(new ExcelExportEntity("所在单位", "unitName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("在职状态", "userState", 20));
|
||||
exportEntities.add(new ExcelExportEntity("职务", "roleName", 20));
|
||||
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, exportEntities, listMap);
|
||||
CommonDownloadUtil.download("社团人员明细.xlsx", workbook, response);
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@SaCheckPermission("club.statistics")
|
||||
|
||||
@@ -153,6 +153,8 @@ layout("/layouts/platform.html"){
|
||||
this.$axios.post("/platform/club/join/apply/checkApplyClub", { clubId: row.id }).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$store.dispatch("pjaxRoute", "/platform/club/join/apply?clubId=" + row.id)
|
||||
} else {
|
||||
this.$message.warning(res.msg || "网络请求失败,请稍后重试!");
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -15,6 +15,12 @@ layout("/layouts/platform.html"){
|
||||
style="width: 100%"
|
||||
></el-date-picker>
|
||||
</search-item>
|
||||
<search-item label="姓名:">
|
||||
<el-input placeholder="请输入姓名查询" clearable v-model="pageForm.userName"></el-input>
|
||||
</search-item>
|
||||
<search-item label="工号:">
|
||||
<el-input placeholder="请输入工号查询" clearable v-model="pageForm.loginName"></el-input>
|
||||
</search-item>
|
||||
</search>
|
||||
</el-card>
|
||||
|
||||
@@ -46,7 +52,8 @@ layout("/layouts/platform.html"){
|
||||
>
|
||||
撤销
|
||||
</el-button>
|
||||
<el-button v-if="[10].includes(row.processInstanceNodeCode)" size="mini" type="danger" @click="doDelete(row)">删除</el-button>
|
||||
<el-button size="mini" type="danger" @click="doDelete(row)">删除</el-button>
|
||||
<!-- <el-button v-if="[10].includes(row.processInstanceNodeCode)" size="mini" type="danger" @click="doDelete(row)">删除</el-button>-->
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
@@ -35,7 +35,10 @@ layout("/layouts/platform.html"){
|
||||
<table-tool label="协会统计">
|
||||
<el-button @click="exportData" type="primary" size="small">导出全部统计数据</el-button>
|
||||
<el-button @click="exportUserData(null)" v-if="$auth.hasRoleOr(['SYSADMIN', 'SCHOOL_UNION_ADMIN'])" type="primary" size="small">
|
||||
导出全部人员明细
|
||||
导出全部人员明细(zip)
|
||||
</el-button>
|
||||
<el-button @click="exportExcel(null)" v-if="$auth.hasRoleOr(['SYSADMIN', 'SCHOOL_UNION_ADMIN'])" type="primary" size="small">
|
||||
导出全部人员明细(EXCEL)
|
||||
</el-button>
|
||||
<el-button @click="exportFiles(null)" v-if="$auth.hasRoleOr(['SYSADMIN', 'SCHOOL_UNION_ADMIN'])" type="primary" size="small">
|
||||
导出全部上传资料
|
||||
@@ -159,6 +162,14 @@ layout("/layouts/platform.html"){
|
||||
const id = row === null ? "" : row.id
|
||||
this.$downLoad("/platform/club/statistics/exportFiles", { clubId: id })
|
||||
},
|
||||
exportExcel(){
|
||||
let params = {
|
||||
clubId: this.pageForm.clubId,
|
||||
userState: this.pageForm.userState,
|
||||
sex: this.pageForm.sex
|
||||
}
|
||||
this.$downLoad("/platform/club/statistics/exportExcel", params)
|
||||
},
|
||||
async openView(row) {
|
||||
this.clickRow = row
|
||||
await this.userPageData()
|
||||
|
||||
Reference in New Issue
Block a user