人员、品牌活动、答题、单身教工
This commit is contained in:
@@ -58,7 +58,7 @@ public class MsgApi {
|
||||
*/
|
||||
public void sendMsg(List<String> channels, String loginNameStr, Integer mtype, String title, String content, String imageUrl,String link) {
|
||||
try {
|
||||
/*if (!Globals.MyConfig.getBoolean("SendMsg")) {
|
||||
if (!Globals.MyConfig.getBoolean("SendMsg")) {
|
||||
log.info("发送失败,消息暂未开启!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
return;
|
||||
}
|
||||
@@ -97,7 +97,7 @@ public class MsgApi {
|
||||
} else {
|
||||
log.info("发送失败>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
|
||||
throw new RuntimeException("Message sending failed with status code: " + status + ", Message: " + jsonObject.getString("message"));
|
||||
}*/
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
package io.v.nutz.task.job.trainSingUp;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import io.v.nutz.base.utils.MsgApi;
|
||||
import io.v.nutz.zhgh.trainSignUp.service.TrainSignUpActivityService;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobExecutionContext;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.List;
|
||||
|
||||
@IocBean
|
||||
public class SendMsgBeforeClassJob implements Job {
|
||||
|
||||
private static SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
@Inject
|
||||
private MsgApi msgApi;
|
||||
|
||||
@Inject
|
||||
private TrainSignUpActivityService trainSignUpActivityService;
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) {
|
||||
//获取今天有哪些课程
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.username,
|
||||
u.loginname,
|
||||
course.courseName,
|
||||
uc.courseStartTime,
|
||||
course.courseType,
|
||||
type.lxname,
|
||||
course.courseLocation,
|
||||
course.campus
|
||||
FROM train_sign_up_user_course uc
|
||||
left join sys_user u on u.id=uc.userid
|
||||
left join train_sign_up_course course on course.id=uc.courseId
|
||||
left join train_sign_up_activity ac on ac.id=uc.activityId
|
||||
left join train_sign_up_type type on type.id = course.courseType
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("ac.isDisabled", "=", false);
|
||||
cnd.and("ac.notice", "=", true);
|
||||
|
||||
// Date date = new Date();//取时间
|
||||
// Calendar calendar = Calendar.getInstance();
|
||||
// calendar.setTime(date);
|
||||
// //把日期往后增加一天.整数往后推,负数往前移动(1:表示明天、-1:表示昨天,0:表示今天)
|
||||
// calendar.add(Calendar.DATE,1);
|
||||
// //这个时间就是日期往后推一天的结果
|
||||
// date = calendar.getTime();
|
||||
|
||||
// cnd.and("LEFT ( courseStartTime, 10 )", "=", simpleDateFormat.format(date));
|
||||
|
||||
cnd.and("LEFT ( uc.courseStartTime, 10 )", "=", DateUtil.today());
|
||||
|
||||
sql.setCondition(cnd);
|
||||
|
||||
List<NutMap> list = trainSignUpActivityService.listMap(sql);
|
||||
|
||||
if (Lang.isEmpty(list)) {
|
||||
return;
|
||||
}
|
||||
|
||||
list.forEach(item -> {
|
||||
String content = "“%s”老师您好:您报名的【%s】“%s”将于“%s”开始,地点为“%s%s”,请记得准时参加,祝您工作生活愉快!——校工会"
|
||||
.formatted(
|
||||
item.getString("username"),
|
||||
item.getString("lxname"),
|
||||
item.getString("courseName"),
|
||||
item.getString("courseStartTime"),
|
||||
item.getString("campus"),
|
||||
item.getString("courseLocation")
|
||||
);
|
||||
if("心理咨询".equals(item.getString("lxname")) || "8d18afc10fb84a949f0339aa09eb202f".equals(item.getString("courseType"))) {
|
||||
content = "“%s”老师您好:您预约的“心理咨询”将于“%s”开始,地点为“%s%s”,请记得准时参加,如您因故不能参加,请于今天中午12点前在报名系统取消预约,祝您工作生活愉快!——校工会"
|
||||
.formatted(
|
||||
item.getString("username"),
|
||||
item.getString("courseStartTime"),
|
||||
item.getString("campus"),
|
||||
item.getString("courseLocation")
|
||||
);
|
||||
}
|
||||
msgApi.sendMsg(List.of("DingTalk"), item.getString("loginname"), 1, "活动开始通知", content, "", "");
|
||||
// msgApi.sendWxMsg("温馨提醒","","text",content,List.of(item.getString("loginname")),"");
|
||||
// sendMsg.pushWeChatMsg("温馨提醒", content, item.getString("loginname"));
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -153,9 +153,11 @@ public class SourceUserServiceImpl extends ViServiceImpl<UserSource> implements
|
||||
Set<String> allowChangeFieldNames = dictList.stream().map(Sys_dict::getCode).collect(Collectors.toSet());
|
||||
allowChangeFieldNames.add("member");
|
||||
allowChangeFieldNames.add("welfareMember");
|
||||
allowChangeFieldNames.add("unitid");
|
||||
Map<String, String> dictMap = dictList.stream().collect(Collectors.toMap(Sys_dict::getCode, Sys_dict::getName));
|
||||
dictMap.put("member", "会员状态");
|
||||
dictMap.put("welfareMember", "福利会员状态");
|
||||
dictMap.put("unitid", "单位");
|
||||
|
||||
// 添加会员角色
|
||||
List<String> addMemberUserIds = new CopyOnWriteArrayList<>();
|
||||
@@ -391,9 +393,8 @@ public class SourceUserServiceImpl extends ViServiceImpl<UserSource> implements
|
||||
case "personType":
|
||||
if (siftValue instanceof List<?> && source != null && source.getPersonType() != null) {
|
||||
List<String> personTypeList = (List<String>) siftValue;
|
||||
boolean personTypeConditionMet = personTypeList.contains(source.getPersonType());
|
||||
// 必须同时满足 userState 和 personType 条件
|
||||
shouldAdd = userStateConditionMet && personTypeConditionMet;
|
||||
shouldAdd = personTypeList.contains(source.getPersonType());
|
||||
shouldRemove = !shouldAdd && user != null && user.getMember() == 1;
|
||||
}
|
||||
break;
|
||||
@@ -487,11 +488,13 @@ public class SourceUserServiceImpl extends ViServiceImpl<UserSource> implements
|
||||
BeanUtil.copyProperties(source, table);
|
||||
table.setId(R.UU32());
|
||||
table.setChangeTime(DateUtil.date());
|
||||
table.setIsOperate(false);
|
||||
table.setChangeOrigin(MemberChangeOrigin.SYSTEM.name());
|
||||
// 新入职教职工
|
||||
if (user == null) {
|
||||
changeTypes.add(MemberChangeType.NEW.getType());
|
||||
table.setChangeTypes(changeTypes);
|
||||
table.setChangeInfosStr("新入职");
|
||||
return table;
|
||||
}
|
||||
|
||||
@@ -509,7 +512,7 @@ public class SourceUserServiceImpl extends ViServiceImpl<UserSource> implements
|
||||
return null;
|
||||
}
|
||||
String changeInfos = changeList.stream().map(v -> {
|
||||
return v.getString("fieldName") + ":" + HtmlUtil.cleanHtmlTag(v.getString("sourceValue")) + "->" + HtmlUtil.cleanHtmlTag(v.getString("newValue")) + ";";
|
||||
return v.getString("fieldName") + ":" + HtmlUtil.cleanHtmlTag(v.getString("sourceValue")) + "—>" + HtmlUtil.cleanHtmlTag(v.getString("newValue"));
|
||||
}).collect(Collectors.joining(";"));
|
||||
|
||||
// 比较变更数据
|
||||
@@ -518,7 +521,6 @@ public class SourceUserServiceImpl extends ViServiceImpl<UserSource> implements
|
||||
table.setChangeTypes(changeTypes);
|
||||
table.setChangeInfos(changeList);
|
||||
table.setChangeInfosStr(changeInfos);
|
||||
table.setIsOperate(false);
|
||||
return table;
|
||||
}
|
||||
|
||||
@@ -555,7 +557,7 @@ public class SourceUserServiceImpl extends ViServiceImpl<UserSource> implements
|
||||
return null;
|
||||
}
|
||||
String changeInfos = changeList.stream().map(v -> {
|
||||
return v.getString("fieldName") + ":" + HtmlUtil.cleanHtmlTag(v.getString("sourceValue")) + "->" + HtmlUtil.cleanHtmlTag(v.getString("newValue")) + ";";
|
||||
return v.getString("fieldName") + ":" + HtmlUtil.cleanHtmlTag(v.getString("sourceValue")) + "—>" + HtmlUtil.cleanHtmlTag(v.getString("newValue"));
|
||||
}).collect(Collectors.joining(";"));
|
||||
// 比较变更数据
|
||||
commonCompareChange(source, user, changeTypes);
|
||||
|
||||
@@ -5,6 +5,7 @@ import io.v.nutz.base.page.Pagination;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.zhgh.qsv.service.QsvActivityService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
@@ -25,14 +26,14 @@ public class H5QsvController {
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/mobile/qsv/index.html")
|
||||
@RequiresPermissions("h5.qsv")
|
||||
@RequiresAuthentication
|
||||
public void index() {
|
||||
|
||||
}
|
||||
|
||||
// 分页查询
|
||||
@At
|
||||
@RequiresPermissions("h5.qsv")
|
||||
@RequiresAuthentication
|
||||
public Result pageData(@Valid PageForm pageForm, @Valid String category) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("category", "=", category);
|
||||
|
||||
@@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.activity.models.ActivityUserScope;
|
||||
import io.v.nutz.zhgh.qsv.models.QsvActivity;
|
||||
import io.v.nutz.zhgh.qsv.models.QsvSubject;
|
||||
import io.v.nutz.zhgh.qsv.models.QsvUserAnswerRecord;
|
||||
@@ -42,8 +43,14 @@ public class H5QsvSurveyController {
|
||||
|
||||
@At
|
||||
@RequiresAuthentication
|
||||
public Result subjects(@Valid String activityId) {
|
||||
public Result subjects(String activityId) {
|
||||
QsvActivity activity = dao.fetch(QsvActivity.class, activityId);
|
||||
|
||||
int count = dao.count(ActivityUserScope.class, Cnd.where("groupId", "=", activity.getGroupId()).and("userId", "=", ShiroUtil.getUserId()));
|
||||
if (count != 1) {
|
||||
return Result.error("您无需参加此次投票,感谢您的关注!");
|
||||
}
|
||||
|
||||
String answerRecordId = null;
|
||||
|
||||
QsvUserAnswerRecord answerRecord = dao.fetch(QsvUserAnswerRecord.class, Cnd.where("activityId", "=", activityId)
|
||||
@@ -60,7 +67,7 @@ public class H5QsvSurveyController {
|
||||
answerRecordId = answerRecord2.getId();
|
||||
|
||||
List<QsvSubject> subjects = dao.query(QsvSubject.class, Cnd.where("id", "in", answerRecord2.getSubjectIds()));
|
||||
dao.fetchLinks(subjects, "options");
|
||||
dao.fetchLinks(subjects, "options", Cnd.NEW().asc("sortNum"));
|
||||
|
||||
for (QsvSubject subject : subjects) {
|
||||
if (subject.getUserSelectOptionIds() == null) {
|
||||
|
||||
@@ -41,6 +41,16 @@ public class QsvOption extends BaseModel {
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String imgUrl;
|
||||
|
||||
@Column
|
||||
@Comment("链接地址")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String link;
|
||||
|
||||
@Column
|
||||
@Comment("详情")
|
||||
@ColDefine(customType = "longtext")
|
||||
private String description;
|
||||
|
||||
@Column
|
||||
@Comment("排序")
|
||||
@ColDefine(type = ColType.INT)
|
||||
|
||||
@@ -52,6 +52,11 @@ public class QsvSubject extends BaseModel {
|
||||
@ColDefine(type = ColType.DATE)
|
||||
private Date displayDate;
|
||||
|
||||
@Column
|
||||
@Comment("多选,最多选几个")
|
||||
@ColDefine(type = ColType.INT, width = 1)
|
||||
private Integer maxMulti;
|
||||
|
||||
@Column
|
||||
@Comment("排序")
|
||||
@ColDefine(type = ColType.INT, width = 1)
|
||||
|
||||
+1
-1
@@ -109,7 +109,7 @@ public class MemberChangeApplyController {
|
||||
record.setChangeOrigin(MemberChangeOrigin.PERSONAL.name());
|
||||
|
||||
|
||||
if (List.of(10030, 10060).contains(record.getApplyStateId())) {
|
||||
if (record.getApplyStateId() != null && List.of(10030, 10060).contains(record.getApplyStateId())) {
|
||||
MemberChangeToDoHandler.COMPLETE_APPLY_RE_MODIFY_TASK.exec(record, NutMap.NEW().addv("nodeName", "重新修改申请"));
|
||||
}
|
||||
// 待分工会审核
|
||||
|
||||
+41
-1
@@ -27,6 +27,8 @@ import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
@@ -94,7 +96,7 @@ public class MemberChangeBranchUnionAuditController {
|
||||
audit.setLoginname(ShiroUtil.getPlatformLoginname());
|
||||
audit.setUsername(ShiroUtil.getPlatformUsername());
|
||||
audit.setAuditTime(DateUtil.date());
|
||||
audit = dao.insert(audit);
|
||||
dao.insert(audit);
|
||||
|
||||
MemberChangeRecord record = dao.fetch(MemberChangeRecord.class, id);
|
||||
if (audit.getAuditType() == 2) {
|
||||
@@ -123,6 +125,44 @@ public class MemberChangeBranchUnionAuditController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("member.change.branchUnion.audit")
|
||||
@SLog(type = "memberChange", tag = "会员变更", msg = "分工会批量审核")
|
||||
public Object doBatchApproval(@Param("data") String[] ids){
|
||||
if (ids.length == 0) {
|
||||
return Result.error("未获取到选择数据");
|
||||
}
|
||||
|
||||
// 批量审核,那就只有一条审核的记录
|
||||
Audit audit = new Audit();
|
||||
audit.setAuditor(ShiroUtil.getUserId());
|
||||
audit.setLoginname(ShiroUtil.getPlatformLoginname());
|
||||
audit.setUsername(ShiroUtil.getPlatformUsername());
|
||||
audit.setAuditTime(DateUtil.date());
|
||||
audit.setAuditOpinion("分工会批量审核通过");
|
||||
dao.insert(audit);
|
||||
|
||||
// 查询要审核的变更记录
|
||||
List<MemberChangeRecord> recordList = dao.query(MemberChangeRecord.class, Cnd.where("id", "in", ids));
|
||||
for (MemberChangeRecord record : recordList) {
|
||||
// 批量推送待办
|
||||
MemberChangeToDoHandler.COMPLETE_UNION_TASK.exec(record, NutMap.NEW().addv("nodeName", "分工会审核完成"));
|
||||
MemberChangeToDoHandler.CREATE_SCHOOL_TASK.exec(record, null);
|
||||
|
||||
// 推送短信
|
||||
}
|
||||
|
||||
dao.update(MemberChangeRecord.class,
|
||||
Chain.make("applyStateId", 10050).add("branchUnionAuditId", audit.getId()),
|
||||
Cnd.where("id", "in", ids));
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
|
||||
+14
-14
@@ -74,7 +74,7 @@ public class MemberChangeManageController {
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/member/change/manage/index.html")
|
||||
@RequiresPermissions("member.change.mange")
|
||||
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"})
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ public class MemberChangeManageController {
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.change.mange")
|
||||
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"})
|
||||
public Object pageData(@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "threeUnitId", required = false) String threeUnitId,
|
||||
@@ -277,7 +277,7 @@ public class MemberChangeManageController {
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("member.change.mange")
|
||||
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"})
|
||||
@SLog(tag = "会员高级管理-会员变更", msg = "分工会/校工会会员管理员提交变更")
|
||||
public Object doSubmitChange(MemberChangeRecord record) {
|
||||
// 检验是否有变更
|
||||
@@ -341,7 +341,7 @@ public class MemberChangeManageController {
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.change.mange")
|
||||
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"})
|
||||
public Object sendSms(String userid) {
|
||||
Sys_user user = userService.fetch(userid);
|
||||
/*if (Strings.isNotBlank(user.getMobile())) {
|
||||
@@ -357,7 +357,7 @@ public class MemberChangeManageController {
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.change.mange")
|
||||
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"})
|
||||
public Object allIsWelfareMember(PageForm pageForm,
|
||||
@Param(value = "startDate", required = false) String startDate,
|
||||
@Param(value = "endDate", required = false) String endDate,
|
||||
@@ -429,7 +429,7 @@ public class MemberChangeManageController {
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.change.mange")
|
||||
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"})
|
||||
public Object userUnitMove(String threeUnitId, String unitId, @Param("userId[]") String[] userId) {
|
||||
|
||||
Sys_unit unit = memberService.dao().fetch(Sys_unit.class, unitId);
|
||||
@@ -466,7 +466,7 @@ public class MemberChangeManageController {
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.change.mange")
|
||||
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"})
|
||||
public Object userPageData(PageForm pageForm,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@@ -505,7 +505,7 @@ public class MemberChangeManageController {
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("member.change.mange")
|
||||
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"})
|
||||
public Object joinWelfareMember(String[] userIds, String taskId,
|
||||
@Param(value = "threeUnitId", required = false) String threeUnitId,
|
||||
@Param(value = "unitId", required = false) String unitId) {
|
||||
@@ -548,7 +548,7 @@ public class MemberChangeManageController {
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.change.mange")
|
||||
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"})
|
||||
public Object units() {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("unitlevel", "=", 2);
|
||||
@@ -560,7 +560,7 @@ public class MemberChangeManageController {
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.change.mange")
|
||||
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"})
|
||||
public Object batchUpdatePersonType(@Param("users") String data) {
|
||||
List<Sys_user> users = Json.fromJsonAsList(Sys_user.class, data);
|
||||
for (Sys_user user : users) {
|
||||
@@ -571,7 +571,7 @@ public class MemberChangeManageController {
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.change.mange")
|
||||
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"})
|
||||
public Object batchUpdateUserState(@Param("users") String data) {
|
||||
List<Sys_user> users = Json.fromJsonAsList(Sys_user.class, data);
|
||||
for (Sys_user user : users) {
|
||||
@@ -583,7 +583,7 @@ public class MemberChangeManageController {
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@RequiresPermissions("member.change.mange")
|
||||
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"})
|
||||
public void downloadImport(HttpServletResponse response) {
|
||||
try {
|
||||
ViTool.excelResponse(response, "会员导入模版.xlsx");
|
||||
@@ -613,7 +613,7 @@ public class MemberChangeManageController {
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("member.change.mange")
|
||||
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"})
|
||||
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
||||
@SLog(type = "会员管理系统", tag = "信息维护-会员高级管理", msg = "导入会员", param = true, result = true)
|
||||
public Object doImport(TempFile file) {
|
||||
@@ -727,7 +727,7 @@ public class MemberChangeManageController {
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("member.change.mange")
|
||||
@RequiresPermissions(value = {"member.change.mange", "staff.member.change.mange"})
|
||||
public Object getAllChangeMemberInfo(String userId){
|
||||
List<NutMap> mapList = memberService.getAllChangeInfo(userId);
|
||||
if (Lang.isEmpty(mapList)) {
|
||||
|
||||
+41
-1
@@ -27,6 +27,8 @@ import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
@@ -116,7 +118,7 @@ public class MemberChangeSchoolUnionAuditController {
|
||||
MemberChangeToDoHandler.CREATE_APPLY_RE_MODIFY_TASK.exec(record, NutMap.NEW().addv("nodeName", "校工会退回"));
|
||||
} else if (audit.getAuditType() == 1) {
|
||||
MemberChangeToDoHandler.COMPLETE_PROCESS.exec(record, null);
|
||||
memberCommonService.compareChangeInfoAndUpdateMember(record.getId());
|
||||
memberCommonService.compareChangeInfoAndUpdateMember(record);
|
||||
} else {
|
||||
MemberChangeToDoHandler.REFUSE_UNION_TASK.exec(record, NutMap.NEW().addv("nodeName", "校工会审核拒绝"));
|
||||
}
|
||||
@@ -124,6 +126,44 @@ public class MemberChangeSchoolUnionAuditController {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("member.change.schoolUnion.audit")
|
||||
@SLog(type = "memberChange", tag = "会员变更", msg = "校工会批量审核")
|
||||
public Object doBatchApproval(@Param("data") String[] ids){
|
||||
if (ids.length == 0) {
|
||||
return Result.error("未获取到选择数据");
|
||||
}
|
||||
|
||||
// 批量审核,那就只有一条审核的记录
|
||||
Audit audit = new Audit();
|
||||
audit.setAuditor(ShiroUtil.getUserId());
|
||||
audit.setLoginname(ShiroUtil.getPlatformLoginname());
|
||||
audit.setUsername(ShiroUtil.getPlatformUsername());
|
||||
audit.setAuditTime(DateUtil.date());
|
||||
audit.setAuditOpinion("校工会批量审核通过");
|
||||
dao.insert(audit);
|
||||
|
||||
// 查询要审核的变更记录
|
||||
List<MemberChangeRecord> recordList = dao.query(MemberChangeRecord.class, Cnd.where("id", "in", ids));
|
||||
for (MemberChangeRecord record : recordList) {
|
||||
// 批量完成待办
|
||||
MemberChangeToDoHandler.COMPLETE_SCHOOL_TASK.exec(record, NutMap.NEW().addv("nodeName", "校工会审核完成"));
|
||||
MemberChangeToDoHandler.COMPLETE_PROCESS.exec(record, null);
|
||||
|
||||
memberCommonService.compareChangeInfoAndUpdateMember(record.getId());
|
||||
// 推送短信
|
||||
}
|
||||
|
||||
dao.update(MemberChangeRecord.class,
|
||||
Chain.make("applyStateId", 10080).add("schoolUnionAuditId", audit.getId()),
|
||||
Cnd.where("id", "in", ids));
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
|
||||
@@ -78,6 +78,11 @@ public interface MemberCommonService extends ViService<Sys_user> {
|
||||
* @param recordId
|
||||
*/
|
||||
void compareChangeInfoAndUpdateMember(String recordId);
|
||||
/**
|
||||
* 存储比较变更信息并更新会员信息
|
||||
* @param record
|
||||
*/
|
||||
void compareChangeInfoAndUpdateMember(MemberChangeRecord record);
|
||||
|
||||
/**
|
||||
* 获取会员的变更信息
|
||||
|
||||
+13
-5
@@ -23,10 +23,12 @@ import io.v.nutz.zhgh.staffmanage.member.service.MemberCommonService;
|
||||
import io.v.nutz.zhgh.staffmanage.specialstaff.model.SpecialStaff;
|
||||
import io.v.nutz.zhgh.welfare.model.WelfareList;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
@@ -160,9 +162,11 @@ public class MemberCommonServiceImpl extends ViServiceImpl<Sys_user> implements
|
||||
Set<String> allowChangeFieldNames = dictList.stream().map(Sys_dict::getCode).collect(Collectors.toSet());
|
||||
allowChangeFieldNames.add("member");
|
||||
allowChangeFieldNames.add("welfareMember");
|
||||
allowChangeFieldNames.add("unitid");
|
||||
Map<String, String> dictMap = dictList.stream().collect(Collectors.toMap(Sys_dict::getCode, Sys_dict::getName));
|
||||
dictMap.put("member", "会员状态");
|
||||
dictMap.put("welfareMember", "福利会员状态");
|
||||
dictMap.put("unitid", "单位");
|
||||
return NutMap.NEW().addv("allowChangeFieldNames", allowChangeFieldNames).addv("dictMap", dictMap);
|
||||
}
|
||||
|
||||
@@ -234,6 +238,12 @@ public class MemberCommonServiceImpl extends ViServiceImpl<Sys_user> implements
|
||||
@Override
|
||||
public void compareChangeInfoAndUpdateMember(String recordId) {
|
||||
MemberChangeRecord record = dao().fetch(MemberChangeRecord.class, recordId);
|
||||
compareChangeInfoAndUpdateMember(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void compareChangeInfoAndUpdateMember(MemberChangeRecord record) {
|
||||
List<NutMap> changeList = getChangeInfos(record);
|
||||
|
||||
// 如果有工会关系人员,这个user用来存储数据
|
||||
@@ -247,12 +257,11 @@ public class MemberCommonServiceImpl extends ViServiceImpl<Sys_user> implements
|
||||
}
|
||||
|
||||
if (Lang.isNotEmpty(history)) {
|
||||
history.setRecordId(recordId);
|
||||
history.setRecordId(record.getId());
|
||||
history.setChangeTime(DateUtil.date());
|
||||
history.setChangeTypes(record.getChangeTypes());
|
||||
history.setChangeOrigin(record.getChangeOrigin());
|
||||
|
||||
|
||||
// 加入会员
|
||||
if (record.getMember()) {
|
||||
int activityCount = dao().count(ActivityUserScope.class, Cnd.where("userId", "=", userId).and("groupId", "=", 1));
|
||||
@@ -340,7 +349,7 @@ public class MemberCommonServiceImpl extends ViServiceImpl<Sys_user> implements
|
||||
// 如果有工会关系变更,也需要记录变更了什么工会
|
||||
history.setChangeInfos(changeList);
|
||||
String changeInfos = changeList.stream().map(v -> {
|
||||
return v.getString("fieldName") + ":" + HtmlUtil.cleanHtmlTag(v.getString("sourceValue")) + "->" + HtmlUtil.cleanHtmlTag(v.getString("newValue")) + ";";
|
||||
return v.getString("fieldName") + ":" + HtmlUtil.cleanHtmlTag(v.getString("sourceValue")) + "->" + HtmlUtil.cleanHtmlTag(v.getString("newValue"));
|
||||
}).collect(Collectors.joining(";"));
|
||||
history.setChangeInfosStr(changeInfos);
|
||||
dao().updateIgnoreNull(info);
|
||||
@@ -351,7 +360,6 @@ public class MemberCommonServiceImpl extends ViServiceImpl<Sys_user> implements
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取所有变更记录
|
||||
* @param userId
|
||||
@@ -408,7 +416,7 @@ public class MemberCommonServiceImpl extends ViServiceImpl<Sys_user> implements
|
||||
|
||||
if (!ObjectUtil.equals(currentValue, previousValue)) {
|
||||
String name = fieldsMap.getOrDefault(fieldName, fieldName);
|
||||
if ("unitId".equals(fieldName)) {
|
||||
if ("unitId".equals(fieldName) || "unitid".equals(fieldName)) {
|
||||
List<Sys_unit> unitList = dao().query(Sys_unit.class,
|
||||
Cnd.where("id", "in", List.of(previousValue, currentValue)));
|
||||
Object finalPreviousValue = previousValue;
|
||||
|
||||
+145
@@ -0,0 +1,145 @@
|
||||
package io.v.nutz.zhgh.staffmanage.single.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.dao.CndPlus;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.staffmanage.single.model.SingleUser;
|
||||
import io.v.nutz.zhgh.staffmanage.single.service.SingleUserService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/single/myApply")
|
||||
public class SingleMyApplyController {
|
||||
|
||||
@Inject
|
||||
private SingleUserService singleUserService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/single/myApply.html")
|
||||
@RequiresPermissions("single.user.myApply")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("single.user.myApply")
|
||||
public Object pageData(PageForm pageForm,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "threeUnitId", required = false) String threeUnitId,
|
||||
@Param(value = "unionGroupId", required = false) String unionGroupId,
|
||||
@Param(value = "personType", required = false) String personType,
|
||||
@Param(value = "userState", required = false) String userState,
|
||||
@Param(value = "sex", required = false) String sex,
|
||||
@Param(value = "isJoin",required = false) Boolean isJoin) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
su.*,
|
||||
u.unionname AS unionName,
|
||||
u.unitname AS unitName,
|
||||
u.username,
|
||||
u.sex,
|
||||
u.loginname,
|
||||
u.userState,
|
||||
u.personType,
|
||||
state.stateName
|
||||
FROM
|
||||
`single_user` su
|
||||
LEFT JOIN `user` u ON u.id = su.userId
|
||||
LEFT JOIN `audit_state` state ON state.stateId = su.singleState
|
||||
$condition
|
||||
""");
|
||||
CndPlus cnd = CndPlus.create();
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("u.username", pageForm.getSearchKeyword());
|
||||
seg.orLike("u.loginname", pageForm.getSearchKeyword());
|
||||
cnd.and(seg);
|
||||
}
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06")){
|
||||
cnd.and("u.id","=",ShiroUtil.getUserId());
|
||||
}
|
||||
cnd.and("su.singleState","in",isJoin? Lang.list(8000,8010,8015,8020,8025,8030): Lang.list(8040,8045,8050,8055,8060));
|
||||
cnd.andEX("u.unionid", "=", unionId);
|
||||
cnd.andEX("u.unitid", "=", unitId);
|
||||
cnd.andEX("u.threeUnitId", "=", threeUnitId);
|
||||
cnd.andEX("u.unionGroupId", "=", unionGroupId);
|
||||
cnd.andEX("u.personType", "=", personType);
|
||||
cnd.andEX("u.userState", "=", userState);
|
||||
cnd.andEX("u.sex","=",sex);
|
||||
cnd.desc("su.applyTime");
|
||||
sql.setCondition(cnd);
|
||||
return singleUserService.listPageMap(pageForm.getPageNumber(),pageForm.getPageSize(),sql);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 退会
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("single.user.myApply")
|
||||
public Object exitSingle(String id) {
|
||||
int count = singleUserService.count(Cnd.where("id", "=", id).and("singleState", "=", "8030"));
|
||||
if (count == 1) {
|
||||
singleUserService.update(Chain.make("singleState", "8040"), Cnd.where("id", "=", id));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("single.user.myApply")
|
||||
public Object removeById(String id){
|
||||
singleUserService.delete(id);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("single.user.myApply")
|
||||
public Object doEdit(SingleUser user){
|
||||
singleUserService.updateIgnoreNull(user);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object findAuditSuccess(){
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
su.*,
|
||||
u.unionname AS unionName,
|
||||
u.unitname AS unitName,
|
||||
u.username AS userName,
|
||||
u.sex,
|
||||
u.loginname AS loginName
|
||||
FROM
|
||||
`single_user` su
|
||||
LEFT JOIN `user` u ON u.id = su.userId
|
||||
WHERE
|
||||
su.singleState = '8030'
|
||||
AND su.userId = @userId
|
||||
""").setParam("userId", ShiroUtil.getUserId());
|
||||
return singleUserService.listMap(sql).stream().findFirst().orElse(null);
|
||||
}
|
||||
}
|
||||
+137
@@ -0,0 +1,137 @@
|
||||
package io.v.nutz.zhgh.staffmanage.single.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.dao.CndPlus;
|
||||
import io.v.nutz.base.model.Audit;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.staffmanage.single.model.SingleUser;
|
||||
import io.v.nutz.zhgh.staffmanage.single.service.SingleUserService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/single/schoolAudit")
|
||||
public class SingleSchoolAuditController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private SingleUserService singleUserService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/single/schoolAudit.html")
|
||||
@RequiresPermissions("single.user.schoolAudit")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("single.user.unionAudit")
|
||||
public Object pageData(PageForm pageForm,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "threeUnitId", required = false) String threeUnitId,
|
||||
@Param(value = "unionGroupId", required = false) String unionGroupId,
|
||||
@Param(value = "personType", required = false) String personType,
|
||||
@Param(value = "userState", required = false) String userState,
|
||||
@Param(value = "isJoin", required = false) String isJoin,
|
||||
@Param(value = "isAudit", required = false) String isAudit,
|
||||
@Param(value = "sex", required = false) String sex) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
su.*,
|
||||
u.unionname AS unionName,
|
||||
u.unitname AS unitName,
|
||||
u.username,
|
||||
u.sex,
|
||||
u.loginname,
|
||||
u.userState,
|
||||
u.personType,
|
||||
state.stateName
|
||||
FROM
|
||||
`single_user` su
|
||||
LEFT JOIN `user` u ON u.id = su.userId
|
||||
LEFT JOIN `audit_state` state ON state.stateId = su.singleState
|
||||
$condition
|
||||
""");
|
||||
CndPlus cnd = CndPlus.create();
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("u.username", pageForm.getSearchKeyword());
|
||||
seg.orLike("u.loginname", pageForm.getSearchKeyword());
|
||||
cnd.and(seg);
|
||||
}
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) {
|
||||
cnd.and("u.unionid", "=", Vi.getUnionId());
|
||||
}
|
||||
cnd.andEX("u.unionid", "=", unionId);
|
||||
cnd.andEX("u.unitid", "=", unitId);
|
||||
cnd.andEX("u.threeUnitId", "=", threeUnitId);
|
||||
cnd.andEX("u.unionGroupId", "=", unionGroupId);
|
||||
cnd.andEX("u.personType", "=", personType);
|
||||
cnd.andEX("u.userState", "=", userState);
|
||||
cnd.andEX("u.sex", "=", sex);
|
||||
if ("false".equals(isJoin)) {
|
||||
cnd.and("su.singleState", ">", 8030);
|
||||
} else {
|
||||
cnd.and("su.singleState", "<=", 8030);
|
||||
}
|
||||
cnd.and("su.singleState", "true".equals(isAudit) ? ">" : "false".equals(isAudit) ? "=" : ">=", "true".equals(isJoin) ? 8020 : 8050);
|
||||
sql.setCondition(cnd);
|
||||
return singleUserService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("single.user.unionAudit")
|
||||
public Object doAudit(@Param("audit") Audit audit, String id, String isPass, String isJoin) {
|
||||
dao.insert(audit);
|
||||
dao.update(SingleUser.class, Chain.make("singleState", "1".equals(isPass) ? "true".equals(isJoin) ? 8030 : 8060 : "true".equals(isJoin) ? 8025 : 8055)
|
||||
.add("true".equals(isJoin) ? "joinTime" : "exitTime", new Date())
|
||||
.add("true".equals(isJoin) ? "schoolAuditId" : "exitSchoolAuditId", audit.getId()), Cnd.where("id", "=", id));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("single.user.unionAudit")
|
||||
public Object doRollBack(String id, String isJoin) {
|
||||
SingleUser user = singleUserService.fetch(id);
|
||||
dao.clear(Audit.class, Cnd.where("id", "=", "true".equals(isJoin) ? user.getSchoolAuditId() : user.getExitSchoolAuditId()));
|
||||
singleUserService.update(Chain.make("true".equals(isJoin) ? "schoolAuditId" : "exitSchoolAuditId", null)
|
||||
.add("true".equals(isJoin) ? "joinTime" : "exitTime", null)
|
||||
.add("singleState", "true".equals(isJoin) ? 8020 : 8050), Cnd.where("id", "=", id));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getAuditNum(String isAudit, String unionId) {
|
||||
return singleUserService.getAuditNum("school", isAudit, unionId);
|
||||
}
|
||||
}
|
||||
+130
@@ -0,0 +1,130 @@
|
||||
package io.v.nutz.zhgh.staffmanage.single.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.dao.CndPlus;
|
||||
import io.v.nutz.base.model.Audit;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.staffmanage.single.model.SingleUser;
|
||||
import io.v.nutz.zhgh.staffmanage.single.service.SingleUserService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/single/unionAudit")
|
||||
public class SingleUnionAuditController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private SingleUserService singleUserService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/single/unionAudit.html")
|
||||
@RequiresPermissions("single.user.unionAudit")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("single.user.unionAudit")
|
||||
public Object pageData(PageForm pageForm,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "threeUnitId", required = false) String threeUnitId,
|
||||
@Param(value = "unionGroupId", required = false) String unionGroupId,
|
||||
@Param(value = "personType", required = false) String personType,
|
||||
@Param(value = "userState", required = false) String userState,
|
||||
@Param(value = "isJoin", required = false) String isJoin,
|
||||
@Param(value = "isAudit", required = false) String isAudit,
|
||||
@Param(value = "sex", required = false) String sex) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
su.*,
|
||||
u.unionname AS unionName,
|
||||
u.unitname AS unitName,
|
||||
u.username,
|
||||
u.sex,
|
||||
u.loginname,
|
||||
u.userState,
|
||||
u.personType,
|
||||
state.stateName
|
||||
FROM
|
||||
`single_user` su
|
||||
LEFT JOIN `user` u ON u.id = su.userId
|
||||
LEFT JOIN `audit_state` state ON state.stateId = su.singleState
|
||||
$condition
|
||||
""");
|
||||
CndPlus cnd = CndPlus.create();
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("u.username", pageForm.getSearchKeyword());
|
||||
seg.orLike("u.loginname", pageForm.getSearchKeyword());
|
||||
cnd.and(seg);
|
||||
}
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) {
|
||||
cnd.and("u.unionid", "=", Vi.getUnionId());
|
||||
}
|
||||
cnd.andEX("u.unionid", "=", unionId);
|
||||
cnd.andEX("u.unitid", "=", unitId);
|
||||
cnd.andEX("u.threeUnitId", "=", threeUnitId);
|
||||
cnd.andEX("u.unionGroupId", "=", unionGroupId);
|
||||
cnd.andEX("u.personType", "=", personType);
|
||||
cnd.andEX("u.userState", "=", userState);
|
||||
cnd.andEX("u.sex", "=", sex);
|
||||
if ("false".equals(isJoin)) {
|
||||
cnd.and("su.singleState", ">", 8030);
|
||||
} else {
|
||||
cnd.and("su.singleState", "<=", 8030);
|
||||
}
|
||||
cnd.and("su.singleState", "true".equals(isAudit) ? ">" : "false".equals(isAudit) ? "=" : ">=", "true".equals(isJoin) ? 8010 : 8040);
|
||||
sql.setCondition(cnd);
|
||||
return singleUserService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("single.user.unionAudit")
|
||||
public Object doAudit(@Param("audit") Audit audit, String id, String isPass, String isJoin) {
|
||||
dao.insert(audit);
|
||||
dao.update(SingleUser.class, Chain.make("singleState", "1".equals(isPass) ? "true".equals(isJoin) ? 8020 : 8050 : "true".equals(isJoin) ? 8015 : 8045)
|
||||
.add("true".equals(isJoin) ? "unionAuditId" : "exitUnionAuditId", audit.getId()), Cnd.where("id", "=", id));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("single.user.unionAudit")
|
||||
public Object doRollBack(String id, String isJoin) {
|
||||
SingleUser user = singleUserService.fetch(id);
|
||||
dao.clear(Audit.class, Cnd.where("id", "=", "true".equals(isJoin) ? user.getUnionAuditId() : user.getExitUnionAuditId()));
|
||||
singleUserService.update(Chain.make("true".equals(isJoin) ? "unionAuditId" : "exitUnionAuditId", null)
|
||||
.add("singleState", "true".equals(isJoin) ? 8010 : 8040), Cnd.where("id", "=", id));
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getAuditNum(String isAudit,String unionId) {
|
||||
return singleUserService.getAuditNum("union", isAudit,unionId);
|
||||
}
|
||||
}
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
package io.v.nutz.zhgh.staffmanage.single.controller;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.staffmanage.single.model.SingleUser;
|
||||
import io.v.nutz.zhgh.staffmanage.single.service.SingleUserService;
|
||||
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.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/single/apply")
|
||||
public class SingleUserApplyController {
|
||||
|
||||
@Inject
|
||||
private SingleUserService singleUserService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/single/apply.html")
|
||||
@RequiresPermissions("single.user.apply")
|
||||
public void index() {}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("single.user.apply")
|
||||
public Object doSubmit(SingleUser user, boolean isSubmit){
|
||||
if (isSubmit) {
|
||||
user.setSingleState("8010");
|
||||
}else {
|
||||
user.setSingleState("8000");
|
||||
}
|
||||
user.setUserId(ShiroUtil.getUserId());
|
||||
user.setApplyTime(new Date());
|
||||
singleUserService.insert(user);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("single.user.apply")
|
||||
public Object findOneSingle(String id){
|
||||
return singleUserService.findOne(id);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("single.user.apply")
|
||||
public Object doModifyInfo(SingleUser user){
|
||||
return singleUserService.updateIgnoreNull(user);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("single.user.apply")
|
||||
public Object isJoinedBeforeAndIsAudit(){
|
||||
//之前是否加入过
|
||||
List<SingleUser> singleUserList = singleUserService.query(Cnd.where("userId", "=", ShiroUtil.getUserId()).and("singleState", "=", "8060"));
|
||||
SingleUser singleUser = singleUserList.stream().min(Comparator.comparing(SingleUser::getExitTime, Comparator.nullsFirst(Comparator.naturalOrder()))).orElse(null);
|
||||
//是否有审核的记录
|
||||
SingleUser user = singleUserService.fetch(Cnd.where("userId", "=", ShiroUtil.getUserId())
|
||||
.and("singleState", "is not", null).and("singleState", "!=", "")
|
||||
.and("singleState", "<", "8060").and("singleState", ">=", "8010"));
|
||||
NutMap nutMap = new NutMap();
|
||||
nutMap.setv("singleUser",singleUser);
|
||||
nutMap.setv("auditUser",user);
|
||||
return nutMap;
|
||||
}
|
||||
}
|
||||
+36
-51
@@ -4,20 +4,19 @@ import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.ExcelImportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.ImportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.result.Result;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.web.commons.slog.annotation.SLog;
|
||||
import io.v.nutz.zhgh.staffmanage.single.service.SingleUserService;
|
||||
import io.v.nutz.base.result.Result;
|
||||
import io.v.nutz.base.utils.ViTool;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.zhgh.staffmanage.single.service.SingleUserService;
|
||||
import io.v.nutz.zhgh.staffmanage.thirtyteach.template.ThirtyTeachTemp;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
@@ -50,7 +49,7 @@ import java.util.stream.Collectors;
|
||||
public class SingleUserController {
|
||||
|
||||
@Inject
|
||||
private SingleUserService userService;
|
||||
private SingleUserService singleUserService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/single/list.html")
|
||||
@@ -68,15 +67,21 @@ public class SingleUserController {
|
||||
@Param(value = "unionGroupId", required = false) String unionGroupId,
|
||||
@Param(value = "personTypes", required = false) String[] personTypes,
|
||||
@Param(value = "userStates", required = false) String[] userStates,
|
||||
@Param(value = "age", required = false) String[] age,
|
||||
@Param(value = "campus", required = false) String campus,
|
||||
@Param(value = "sex", required = false) String sex,
|
||||
@Param(value = "memberStatus", required = false) Integer memberStatus,
|
||||
@Param(value = "position", required = false) String position,
|
||||
@Param(value = "jobTitle", required = false) String jobTitle,
|
||||
@Param(value = "searchName", required = false) String searchName,
|
||||
@Param(value = "searchKeyWord", required = false) String searchKeyWord) {
|
||||
return userService.singlePageList(pageForm.getPageNumber(), pageForm.getPageSize(), unionId, unitId, threeUnitId, unionGroupId,
|
||||
personTypes, userStates, campus, sex, memberStatus, position, jobTitle, searchName, searchKeyWord);
|
||||
@Param(value = "searchKeyWord", required = false) String searchKeyWord,
|
||||
@Param(value = "isJoin", required = false) Boolean isJoin,
|
||||
@Param(value = "education", required = false) String education,
|
||||
@Param(value = "maritalStatus", required = false) String maritalStatus) {
|
||||
Sql sql = singleUserService.singlePageList(unionId, unitId, threeUnitId, unionGroupId,
|
||||
personTypes, userStates, age, campus, sex, memberStatus, position, jobTitle,
|
||||
searchName, searchKeyWord, isJoin, education, maritalStatus);
|
||||
return singleUserService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
|
||||
|
||||
@@ -91,17 +96,23 @@ public class SingleUserController {
|
||||
@Param(value = "unionGroupId", required = false) String unionGroupId,
|
||||
@Param(value = "personTypes", required = false) String personTypes,
|
||||
@Param(value = "userStates", required = false) String userStates,
|
||||
@Param(value = "age", required = false) String age,
|
||||
@Param(value = "campus", required = false) String campus,
|
||||
@Param(value = "sex", required = false) String sex,
|
||||
@Param(value = "memberStatus", required = false) Integer memberStatus,
|
||||
@Param(value = "position", required = false) String position,
|
||||
@Param(value = "jobTitle", required = false) String jobTitle,
|
||||
@Param(value = "searchName", required = false) String searchName,
|
||||
@Param(value = "searchKeyWord", required = false) String searchKeyWord) {
|
||||
@Param(value = "searchKeyWord", required = false) String searchKeyWord,
|
||||
@Param(value = "isJoin", required = false) Boolean isJoin,
|
||||
@Param(value = "education", required = false) String education,
|
||||
@Param(value = "maritalStatus", required = false) String maritalStatus) {
|
||||
try {
|
||||
ViTool.excelResponse(response, "单身教工名单.xls");
|
||||
List<NutMap> dataList = userService.singlePageList(unionId, unitId, threeUnitId, unionGroupId, Json.fromJsonAsArray(String.class, personTypes),
|
||||
Json.fromJsonAsArray(String.class, userStates), campus, sex, memberStatus, position, jobTitle, searchName, searchKeyWord);
|
||||
ViTool.excelResponse(response, "单身教工名单.xlsx");
|
||||
Sql sql = singleUserService.singlePageList(unionId, unitId, threeUnitId, unionGroupId, Json.fromJsonAsArray(String.class, personTypes),
|
||||
Json.fromJsonAsArray(String.class, userStates), Json.fromJsonAsArray(String.class, age), campus, sex, memberStatus, position,
|
||||
jobTitle, searchName, searchKeyWord, isJoin, education, maritalStatus);
|
||||
List<NutMap> dataList = singleUserService.listMap(sql);
|
||||
List<ExcelExportEntity> entityList = new ArrayList<>();
|
||||
ExcelExportEntity no = new ExcelExportEntity("序号", "no", 10);
|
||||
no.setFormat("isAddIndex");
|
||||
@@ -111,6 +122,12 @@ public class SingleUserController {
|
||||
propMap.forEach((k, v) -> {
|
||||
entityList.add(new ExcelExportEntity(v, k, 20));
|
||||
});
|
||||
entityList.add(new ExcelExportEntity("身高(cm)", "height", 10));
|
||||
entityList.add(new ExcelExportEntity("籍贯", "hometown", 20));
|
||||
entityList.add(new ExcelExportEntity("学历", "education", 20));
|
||||
entityList.add(new ExcelExportEntity("爱好", "hobby", 20));
|
||||
entityList.add(new ExcelExportEntity("交友意向", "intentionFriends", 50));
|
||||
entityList.add(new ExcelExportEntity("个人介绍", "personalIntroduction", 50));
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), entityList, dataList);
|
||||
workbook.write(response.getOutputStream());
|
||||
} catch (IOException e) {
|
||||
@@ -119,65 +136,32 @@ public class SingleUserController {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@SLog(tag = "单身教工", msg = "删除", param = true, result = true)
|
||||
public Object delete(String userId) {
|
||||
userService.update(Chain.make("marriage", "已婚"), Cnd.where("id", "=", userId));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导入模板下载
|
||||
* @param response
|
||||
*/
|
||||
@At
|
||||
@Ok("void")
|
||||
public void downloadImport(HttpServletResponse response) {
|
||||
try {
|
||||
ViTool.excelResponse(response, "单身教工导入模版.xlsx");
|
||||
ExportParams exportParams = new ExportParams();
|
||||
List<ExcelExportEntity> list = new ArrayList<>();
|
||||
list.add(new ExcelExportEntity("姓名", "userName", 20));
|
||||
list.add(new ExcelExportEntity("身份证号码", "idCard", 20));
|
||||
list.add(new ExcelExportEntity("出生年月", "birthday", 20));
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, list, new ArrayList<>());
|
||||
workbook.write(response.getOutputStream());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@At
|
||||
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
||||
public Object doImport(TempFile file, boolean isFlag) {
|
||||
try {
|
||||
List<ThirtyTeachTemp> thirtyTeachImportList = ExcelImportUtil.importExcel(file.getFile(), ThirtyTeachTemp.class, new ImportParams());
|
||||
|
||||
List<Sys_user> users = userService.query();
|
||||
List<Sys_user> users = singleUserService.dao().query(Sys_user.class, Cnd.NEW());
|
||||
List<String> allUserList = users.stream().map(Sys_user::getLoginname).collect(Collectors.toList());
|
||||
|
||||
List<ThirtyTeachTemp> errorInfos = new ArrayList<>();
|
||||
List<String> insertUserIds = new ArrayList<>();
|
||||
thirtyTeachImportList.forEach(v -> {
|
||||
if (allUserList.contains(v.getLoginName().trim())){
|
||||
if (allUserList.contains(v.getLoginName().trim())) {
|
||||
insertUserIds.add(v.getLoginName());
|
||||
}else {
|
||||
} else {
|
||||
v.setRemark("获取不到该用户的工号,请检查工号是否正确!");
|
||||
errorInfos.add(v);
|
||||
}
|
||||
});
|
||||
|
||||
int i = 0;
|
||||
if (Lang.isNotEmpty(insertUserIds)){
|
||||
if (Lang.isNotEmpty(insertUserIds)) {
|
||||
if (isFlag) {
|
||||
userService.update(Chain.make("marriage", null),Cnd.where("marriage","=","未婚"));
|
||||
singleUserService.update(Chain.make("marriage", null), Cnd.where("marriage", "=", "未婚"));
|
||||
}
|
||||
i = userService.update(Chain.make("marriage", "已婚"), Cnd.where("loginname", "in", insertUserIds));
|
||||
i = singleUserService.update(Chain.make("marriage", "已婚"), Cnd.where("loginname", "in", insertUserIds));
|
||||
}
|
||||
|
||||
if (Lang.isNotEmpty(errorInfos)) {
|
||||
@@ -196,4 +180,5 @@ public class SingleUserController {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+11
-14
@@ -37,16 +37,17 @@ public class SingleUserStatisticsController {
|
||||
@At("")
|
||||
@Ok("beetl:/platform/single/statistics.html")
|
||||
@RequiresPermissions("single.user.statistics")
|
||||
public void index() {}
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("single.user.statistics")
|
||||
public Object pageData(@Param(value = "unionId",required = false) String unionId,
|
||||
@Param(value = "unitId",required = false) String unitId,
|
||||
@Param(value = "personTypes",required = false) String[] personTypes,
|
||||
@Param(value = "analyze",required = false) String analyze) {
|
||||
public Object pageData(@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "personTypes", required = false) String[] personTypes,
|
||||
@Param(value = "analyze", required = false) String analyze) {
|
||||
return userService.singleStatisticsList(personTypes, unionId, unitId, analyze);
|
||||
}
|
||||
|
||||
@@ -57,7 +58,7 @@ public class SingleUserStatisticsController {
|
||||
List<NutMap> singleUserList = userService.singleStatisticsList(personTypes, unionId, unitId, analyze);
|
||||
List<NutMap> finalMemberList = singleUserList;
|
||||
NutMap sumMap = new NutMap() {{
|
||||
addv("0".equals(analyze)?"unionCode":"unitCode", "合计");
|
||||
addv("unCode", "合计");
|
||||
addv("totalNumber", finalMemberList.stream().mapToInt(v -> v.getInt("totalNumber")).sum());
|
||||
addv("male", finalMemberList.stream().mapToInt(v -> v.getInt("male")).sum());
|
||||
addv("female", finalMemberList.stream().mapToInt(v -> v.getInt("female")).sum());
|
||||
@@ -73,13 +74,9 @@ public class SingleUserStatisticsController {
|
||||
singleUserList.add(sumMap);
|
||||
|
||||
List<ExcelExportEntity> entityList = new ArrayList<>();
|
||||
if ("0".equals(analyze)) {
|
||||
entityList.add(new ExcelExportEntity("分工会代码", "unionCode", 20));
|
||||
entityList.add(new ExcelExportEntity("分工会名称", "unionName", 20));
|
||||
}else if("1".equals(analyze)){
|
||||
entityList.add(new ExcelExportEntity("单位代码", "unitCode", 20));
|
||||
entityList.add(new ExcelExportEntity("单位名称", "unitName", 20));
|
||||
}
|
||||
entityList.add(new ExcelExportEntity("0".equals(analyze) ? "分工会代码" : "单位代码", "unCode", 20));
|
||||
entityList.add(new ExcelExportEntity("0".equals(analyze) ? "分工会名称" : "单位名称", "unName", 20));
|
||||
|
||||
entityList.add(new ExcelExportEntity("总人数", "totalNumber", 20));
|
||||
entityList.add(new ExcelExportEntity("男", "male", 20));
|
||||
entityList.add(new ExcelExportEntity("女", "female", 20));
|
||||
@@ -94,7 +91,7 @@ public class SingleUserStatisticsController {
|
||||
|
||||
try {
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + new String(("单身教工统计表.xls").getBytes("utf-8"), "ISO8859-1"));
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + new String(("单身教工统计表.xlsx").getBytes("utf-8"), "ISO8859-1"));
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), entityList, singleUserList);
|
||||
ServletOutputStream outputStream = response.getOutputStream();
|
||||
workbook.write(outputStream);
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
package io.v.nutz.zhgh.staffmanage.single.model;
|
||||
|
||||
|
||||
import io.v.nutz.sys.models.Sys_file;
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Table
|
||||
public class SingleUser {
|
||||
|
||||
@Name
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("用户Id")
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
@Comment("出生年月")
|
||||
private String birthday;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
@Comment("联系方式")
|
||||
private String mobile;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 10)
|
||||
@Comment("身高")
|
||||
private String height;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@Comment("籍贯")
|
||||
private String hometown;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 10)
|
||||
@Comment("学历")
|
||||
private String education;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
@Comment("兴趣爱好")
|
||||
private String hobby;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
@Comment("子女情况")
|
||||
private String childrenSituation;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
@Comment("月收入")
|
||||
private String monthlyIncome;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
@Comment("住房情况")
|
||||
private String housingSituation;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
@Comment("上传照片")
|
||||
private List<Sys_file> picFiles;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 32)
|
||||
@Comment("形象照片")
|
||||
private String photo;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 10)
|
||||
@Comment("婚姻状况")
|
||||
private String maritalStatus;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
@Comment("交友意向")
|
||||
private String intentionFriends;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
@Comment("个人介绍")
|
||||
private String personalIntroduction;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 32)
|
||||
@Comment("申请分工会审核ID")
|
||||
private String unionAuditId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 32)
|
||||
@Comment("申请校工会审核ID")
|
||||
private String schoolAuditId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 32)
|
||||
@Comment("退会分工会审核ID")
|
||||
private String exitUnionAuditId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 32)
|
||||
@Comment("退会校工会审核ID")
|
||||
private String exitSchoolAuditId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 10)
|
||||
@Comment("状态")
|
||||
private String singleState;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@Comment("申请时间")
|
||||
private Date applyTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@Comment("加入时间")
|
||||
private Date joinTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@Comment("退出时间")
|
||||
private Date exitTime;
|
||||
}
|
||||
@@ -1,22 +1,22 @@
|
||||
package io.v.nutz.zhgh.staffmanage.single.service;
|
||||
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.base.service.ViService;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.zhgh.staffmanage.single.model.SingleUser;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SingleUserService extends ViService<Sys_user> {
|
||||
public interface SingleUserService extends BaseService<SingleUser> {
|
||||
|
||||
Pagination singlePageList(Integer pageNumber,Integer pageSize, String unionId, String unitId, String threeUnitId,
|
||||
String unionGroupId, String[] personTypes, String[] userStates,
|
||||
String campus, String sex, Integer memberStatus, String position,
|
||||
String jobTitle, String searchName, String searchKeyWord);
|
||||
|
||||
List<NutMap> singlePageList(String unionId, String unitId, String threeUnitId, String unionGroupId, String[] personTypes,
|
||||
String[] userStates, String campus, String sex, Integer memberStatus, String position,
|
||||
String jobTitle, String searchName, String searchKeyWord);
|
||||
Sql singlePageList(String unionId, String unitId, String threeUnitId, String unionGroupId, String[] personTypes,
|
||||
String[] userStates, String[] age, String campus, String sex, Integer memberStatus, String position,
|
||||
String jobTitle, String searchName, String searchKeyWord,Boolean isJoin,String education,String maritalStatus);
|
||||
|
||||
List<NutMap> singleStatisticsList(String[] personTypes,String unionId,String unitId,String analyze);
|
||||
|
||||
|
||||
NutMap findOne(String id);
|
||||
|
||||
Object getAuditNum(String auditType,String isAudit,String unionId);
|
||||
}
|
||||
|
||||
+182
-191
@@ -1,18 +1,22 @@
|
||||
package io.v.nutz.zhgh.staffmanage.single.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.base.dao.CndPlus;
|
||||
import io.v.nutz.base.model.Audit;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.base.service.impl.BaseServiceImpl;
|
||||
import io.v.nutz.base.service.impl.ViServiceImpl;
|
||||
import io.v.nutz.zhgh.staffmanage.single.service.SingleUserService;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.staffmanage.single.model.SingleUser;
|
||||
import io.v.nutz.zhgh.staffmanage.single.service.SingleUserService;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
@@ -21,237 +25,224 @@ import org.nutz.lang.util.NutMap;
|
||||
import java.util.List;
|
||||
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class SingleUserServiceImpl extends ViServiceImpl<Sys_user> implements SingleUserService {
|
||||
public class SingleUserServiceImpl extends BaseServiceImpl<SingleUser> implements SingleUserService {
|
||||
|
||||
public SingleUserServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
|
||||
@Override
|
||||
public Pagination singlePageList(Integer pageNumber,Integer pageSize, String unionId, String unitId, String threeUnitId,
|
||||
String unionGroupId, String[] personTypes, String[] userStates,
|
||||
String campus, String sex, Integer memberStatus, String position,
|
||||
String jobTitle, String searchName, String searchKeyWord) {
|
||||
public List<NutMap> singleStatisticsList(String[] personTypes, String unionId, String unitId, String analyze) {
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
id,
|
||||
loginname,
|
||||
username,
|
||||
sex,
|
||||
birthday,
|
||||
mobile,
|
||||
idcard,
|
||||
personType,
|
||||
userState,
|
||||
unionid,
|
||||
unioncode,
|
||||
unionname,
|
||||
unitid,
|
||||
unitname,
|
||||
unitcode,
|
||||
threeUnitName,
|
||||
threeUnitCode,
|
||||
unionGroupName,
|
||||
position,
|
||||
jobTitle,
|
||||
campusName,
|
||||
marriage,
|
||||
education,
|
||||
hometown,
|
||||
nation
|
||||
From
|
||||
user
|
||||
$condition
|
||||
""");
|
||||
SELECT
|
||||
un.id,
|
||||
$code AS unCode,
|
||||
$name AS unName,
|
||||
( $matchSql $singleCnd un.id = $unId AND TIMESTAMPDIFF (YEAR,su.birthday,CURDATE())<25 $personCnd) AS lessTwentyFive,
|
||||
( $matchSql $singleCnd un.id = $unId AND TIMESTAMPDIFF (YEAR,su.birthday,CURDATE())>=25 AND TIMESTAMPDIFF (YEAR,su.birthday,CURDATE())<=30 $personCnd) AS thirty,
|
||||
( $matchSql $singleCnd un.id = $unId AND TIMESTAMPDIFF (YEAR,su.birthday,CURDATE())>=31 AND TIMESTAMPDIFF (YEAR,su.birthday,CURDATE())<=35 $personCnd) AS thirtyFive,
|
||||
( $matchSql $singleCnd un.id = $unId AND TIMESTAMPDIFF (YEAR,su.birthday,CURDATE())>=36 AND TIMESTAMPDIFF (YEAR,su.birthday,CURDATE())<=40 $personCnd) AS forty,
|
||||
( $matchSql $singleCnd un.id = $unId AND TIMESTAMPDIFF (YEAR,su.birthday,CURDATE())>=41 AND TIMESTAMPDIFF (YEAR,su.birthday,CURDATE())<=45 $personCnd) AS fortyFive,
|
||||
( $matchSql $singleCnd un.id = $unId AND TIMESTAMPDIFF (YEAR,su.birthday,CURDATE())>=46 AND TIMESTAMPDIFF (YEAR,su.birthday,CURDATE())<=50 $personCnd) AS fifty,
|
||||
( $matchSql $singleCnd un.id = $unId AND TIMESTAMPDIFF (YEAR,su.birthday,CURDATE())>=51 AND TIMESTAMPDIFF (YEAR,su.birthday,CURDATE())<=55 $personCnd) AS fiftyFive,
|
||||
( $matchSql $singleCnd un.id = $unId AND TIMESTAMPDIFF (YEAR,su.birthday,CURDATE())>55 $personCnd $yearCnd) AS moreFiftyFive,
|
||||
( $matchSql $singleCnd un.id = $unId $personCnd) totalNumber,
|
||||
( $matchSql $singleCnd sex = '男' AND un.id = $unId $personCnd) male,
|
||||
( $matchSql $singleCnd sex = '女' AND un.id = $unId $personCnd) female
|
||||
FROM
|
||||
$table un
|
||||
$condition
|
||||
""");
|
||||
CndPlus cnd = CndPlus.create();
|
||||
cnd.and("marriage","=","未婚");
|
||||
cnd.andEX("unionid", "=", unionId);
|
||||
cnd.andEX("unitId", "=", unitId);
|
||||
cnd.andEX("threeUnitId", "=", threeUnitId);
|
||||
cnd.andEX("unionGroupId", "=", unionGroupId);
|
||||
if (StrUtil.isNotBlank(searchName) && Strings.isNotBlank(searchKeyWord)) {
|
||||
cnd.and(new SqlExpressionGroup().andLike(searchName, searchKeyWord));
|
||||
}
|
||||
sql.setVar("matchSql", " SELECT COUNT( 1 ) FROM `single_user` su left join `user` u on su.userId=u.id where ");
|
||||
sql.setVar("code", "0".equals(analyze) ? "un.unioncode" : "un.unitcode");
|
||||
sql.setVar("name", "0".equals(analyze) ? "un.unionname" : "un.`name`");
|
||||
sql.setVar("unId", "0".equals(analyze) ? "u.unionid" : "u.unitid");
|
||||
sql.setVar("table", "0".equals(analyze) ? "sys_union" : "sys_unit");
|
||||
sql.setVar("singleCnd", " su.singleState in (8030,8040,8045,8050,8055) and ");
|
||||
|
||||
if (personTypes != null && personTypes.length > 0) {
|
||||
cnd.andEX("personType", "in", personTypes);
|
||||
}
|
||||
if (userStates != null && userStates.length > 0) {
|
||||
cnd.andEX("userState", "in", userStates);
|
||||
}
|
||||
cnd.andEX("campusName", "=", campus);
|
||||
cnd.andEX("sex", "=", sex);
|
||||
|
||||
/*cnd.andEX("member", "=", 1);*/
|
||||
cnd.andEX("memberStatus", "=", memberStatus);
|
||||
|
||||
if (Strings.isNotBlank(position)) {
|
||||
cnd.where().andLike("position", position);
|
||||
}
|
||||
if (Strings.isNotBlank(jobTitle)) {
|
||||
cnd.where().andLike("jobTitle", jobTitle);
|
||||
}
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,SchoolUnionMemberAdmin,A06")) {
|
||||
if (ShiroUtil.hasRole("H04")) {
|
||||
cnd.and("unionId", "=", Vi.getUnionId());
|
||||
} else if (ShiroUtil.hasRole("ghxzzz")) {
|
||||
cnd.and("unionId", "=", Vi.getUnionId());
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.or("unionGroupId", "in", io.v.nutz.web.commons.utils.ShiroUtil.getUnionGroupIds());
|
||||
seg.or("unionGroupId", "is", null);
|
||||
cnd.and(seg);
|
||||
}
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return listPageMap(pageNumber,pageSize,sql);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<NutMap> singleStatisticsList(String[] personTypes,String unionId, String unitId,String analyze) {
|
||||
Sql sql = null;
|
||||
CndPlus cnd = CndPlus.create();
|
||||
if ("0".equals(analyze)){//按分工会统计
|
||||
sql = Sqls.create("""
|
||||
SELECT
|
||||
un.id,
|
||||
un.unioncode AS unionCode,
|
||||
unionName,
|
||||
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' and un.id = unionid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<25 $personCnd) AS lessTwentyFive,
|
||||
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' and un.id = unionid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>=25 AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<=30 $personCnd) AS thirty,
|
||||
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' and un.id = unionid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>=31 AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<=35 $personCnd) AS thirtyFive,
|
||||
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' and un.id = unionid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>=36 AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<=40 $personCnd) AS forty,
|
||||
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' and un.id = unionid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>=41 AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<=45 $personCnd) AS fortyFive,
|
||||
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' and un.id = unionid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>=46 AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<=50 $personCnd) AS fifty,
|
||||
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' and un.id = unionid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>=51 AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<=55 $personCnd) AS fiftyFive,
|
||||
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' and un.id = unionid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>55 $personCnd $yearCnd) AS moreFiftyFive,
|
||||
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' and un.id = unionid $personCnd) totalNumber,
|
||||
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' and sex = '男' AND un.id = unionid $personCnd) male,
|
||||
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' and sex = '女' AND un.id = unionid $personCnd) female
|
||||
FROM
|
||||
sys_union un
|
||||
$condition
|
||||
""");
|
||||
if (!ShiroUtil.hasAnyRoles(Lang.array("sysadmin", "A06", "SchoolUnionMemberAdmin"))) {
|
||||
cnd.and("un.id", "=", Vi.getUnionId());
|
||||
}
|
||||
if(StrUtil.isNotBlank(unionId)) {
|
||||
cnd.and("un.id", "=", unionId);
|
||||
}
|
||||
if ("0".equals(analyze)) {
|
||||
//工会
|
||||
cnd.andEX("un.id", "=", unionId);
|
||||
cnd.asc("un.unioncode");
|
||||
}else if ("1".equals(analyze)){//按单位统计
|
||||
sql = Sqls.create("""
|
||||
SELECT
|
||||
un.id,
|
||||
un.unitcode AS unitCode,
|
||||
`name` AS unitName,
|
||||
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' AND un.id = unitid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<25 $personCnd) AS lessTwentyFive,
|
||||
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' AND un.id = unitid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>=26 AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<=30 $personCnd) AS thirty,
|
||||
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' AND un.id = unitid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>=31 AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<=35 $personCnd) AS thirtyFive,
|
||||
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' AND un.id = unitid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>=36 AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<=40 $personCnd) AS forty,
|
||||
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' AND un.id = unitid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>=41 AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<=45 $personCnd) AS fortyFive,
|
||||
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' AND un.id = unitid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>=46 AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<=50 $personCnd) AS fifty,
|
||||
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' AND un.id = unitid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>=51 AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<=55 $personCnd) AS fiftyFive,
|
||||
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' AND un.id = unitid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>55 $personCnd) AS moreFiftyFive,
|
||||
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' AND un.id = unitid $personCnd) totalNumber,
|
||||
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' AND sex = '男' AND un.id = unitid $personCnd) male,
|
||||
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' AND sex = '女' AND un.id = unitid $personCnd) female
|
||||
FROM
|
||||
sys_unit un
|
||||
$condition
|
||||
""");
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles(Lang.array("sysadmin", "A06", "SchoolUnionMemberAdmin"))) {
|
||||
cnd.and("un.unionid", "=", Vi.getUnionId());
|
||||
}
|
||||
if(StrUtil.isNotBlank(unitId)) {
|
||||
} else {
|
||||
//单位
|
||||
if (StrUtil.isNotBlank(unitId)) {
|
||||
cnd.and("un.id", "=", unitId);
|
||||
}
|
||||
cnd.and("unitlevel", "=", 2).and("unitcode", "!=", "000");
|
||||
cnd.and("un.unitlevel", "=", 2).and("un.unitcode", "!=", "000");
|
||||
cnd.asc("un.unitcode");
|
||||
}
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles(Lang.array("sysadmin", "A06", "H03"))) {
|
||||
cnd.and("un.unionid", "=", Vi.getUnionId());
|
||||
}
|
||||
if (personTypes != null && personTypes.length > 0) {
|
||||
String join = StringUtils.join(personTypes, "','");
|
||||
sql.setVar("personCnd", "and personType in ('" + join + "')");
|
||||
sql.setVar("personCnd", "and u.personType in ('" + join + "')");
|
||||
}
|
||||
assert sql != null;
|
||||
cnd.groupBy("un.id");
|
||||
sql.setCondition(cnd);
|
||||
return listMap(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NutMap> singlePageList(String unionId, String unitId, String threeUnitId, String unionGroupId, String[] personTypes, String[] userStates, String campus, String sex, Integer memberStatus, String position, String jobTitle, String searchName, String searchKeyWord) {
|
||||
public Sql singlePageList(String unionId, String unitId, String threeUnitId, String unionGroupId,
|
||||
String[] personTypes, String[] userStates, String[] age, String campus, String sex,
|
||||
Integer memberStatus, String position, String jobTitle, String searchName,
|
||||
String searchKeyWord, Boolean isJoin, String education, String maritalStatus) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
id,
|
||||
loginname,
|
||||
username,
|
||||
sex,
|
||||
birthday,
|
||||
mobile,
|
||||
idcard,
|
||||
personType,
|
||||
userState,
|
||||
unionid,
|
||||
unioncode,
|
||||
unionname,
|
||||
unitid,
|
||||
unitname,
|
||||
unitcode,
|
||||
threeUnitName,
|
||||
threeUnitCode,
|
||||
unionGroupName,
|
||||
position,
|
||||
jobTitle,
|
||||
campusName,
|
||||
marriage,
|
||||
education,
|
||||
hometown,
|
||||
nation
|
||||
From
|
||||
user
|
||||
$condition
|
||||
""");
|
||||
SELECT
|
||||
su.*,
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.sex,
|
||||
u.idcard,
|
||||
u.personType,
|
||||
u.userState,
|
||||
u.unionname,
|
||||
u.unitname,
|
||||
u.threeUnitName,
|
||||
u.unionGroupName
|
||||
FROM
|
||||
`single_user` su
|
||||
LEFT JOIN `user` u ON u.id = su.userId
|
||||
$condition
|
||||
""");
|
||||
CndPlus cnd = CndPlus.create();
|
||||
cnd.and("marriage","=","未婚");
|
||||
cnd.andEX("unionid", "=", unionId);
|
||||
cnd.andEX("unitId", "=", unitId);
|
||||
cnd.andEX("threeUnitId", "=", threeUnitId);
|
||||
cnd.andEX("unionGroupId", "=", unionGroupId);
|
||||
cnd.andEX("u.unionid", "=", unionId);
|
||||
cnd.andEX("u.unitId", "=", unitId);
|
||||
cnd.andEX("u.threeUnitId", "=", threeUnitId);
|
||||
cnd.andEX("u.unionGroupId", "=", unionGroupId);
|
||||
cnd.andEX("su.education", "=", education);
|
||||
cnd.andEX("su.maritalStatus", "=", maritalStatus);
|
||||
cnd.and("su.singleState", "in", isJoin ? Lang.list(8030, 8040, 8045, 8050, 8055) : Lang.list(8060));
|
||||
if (StrUtil.isNotBlank(searchName) && Strings.isNotBlank(searchKeyWord)) {
|
||||
cnd.and(new SqlExpressionGroup().andLike(searchName, searchKeyWord));
|
||||
}
|
||||
if (personTypes != null && personTypes.length > 0) {
|
||||
cnd.andEX("personType", "in", personTypes);
|
||||
cnd.andEX("u.personType", "in", personTypes);
|
||||
}
|
||||
if (userStates != null && userStates.length > 0) {
|
||||
cnd.andEX("userState", "in", userStates);
|
||||
cnd.andEX("u.userState", "in", userStates);
|
||||
}
|
||||
cnd.andEX("campusName", "=", campus);
|
||||
cnd.andEX("sex", "=", sex);
|
||||
|
||||
if (!Lang.isEmptyArray(age)) {
|
||||
if (!age[1].equals("0")) {
|
||||
cnd.and("TIMESTAMPDIFF(YEAR, u.birthday, CURDATE())", "between", age);
|
||||
}
|
||||
}
|
||||
|
||||
cnd.andEX("u.campusName", "=", campus);
|
||||
cnd.andEX("u.sex", "=", sex);
|
||||
/*cnd.andEX("member", "=", 1);*/
|
||||
cnd.andEX("memberStatus", "=", memberStatus);
|
||||
cnd.andEX("u.memberStatus", "=", memberStatus);
|
||||
|
||||
if (Strings.isNotBlank(position)) {
|
||||
cnd.where().andLike("position", position);
|
||||
cnd.where().andLike("u.position", position);
|
||||
}
|
||||
if (Strings.isNotBlank(jobTitle)) {
|
||||
cnd.where().andLike("jobTitle", jobTitle);
|
||||
cnd.where().andLike("u.jobTitle", jobTitle);
|
||||
}
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,SchoolUnionMemberAdmin,A06")) {
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,H03,A06")) {
|
||||
if (ShiroUtil.hasRole("H04")) {
|
||||
cnd.and("unionId", "=", Vi.getUnionId());
|
||||
cnd.and("u.unionId", "=", Vi.getUnionId());
|
||||
} else if (ShiroUtil.hasRole("ghxzzz")) {
|
||||
cnd.and("unionId", "=", Vi.getUnionId());
|
||||
cnd.and("u.unionId", "=", Vi.getUnionId());
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.or("unionGroupId", "in", io.v.nutz.web.commons.utils.ShiroUtil.getUnionGroupIds());
|
||||
seg.or("unionGroupId", "is", null);
|
||||
seg.or("u.unionGroupId", "in", io.v.nutz.web.commons.utils.ShiroUtil.getUnionGroupIds());
|
||||
seg.or("u.unionGroupId", "is", null);
|
||||
cnd.and(seg);
|
||||
}
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return listMap(sql);
|
||||
return sql;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public NutMap findOne(String id) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
su.*,
|
||||
u.unionname AS unionName,
|
||||
u.unitname AS unitName,
|
||||
u.username,
|
||||
u.sex,
|
||||
u.loginname,
|
||||
u.userState,
|
||||
u.personType
|
||||
FROM
|
||||
`single_user` su
|
||||
LEFT JOIN `user` u ON u.id = su.userId
|
||||
where su.id=@id
|
||||
""").setParam("id", id);
|
||||
NutMap nutMap = (NutMap) baseService.listMap(sql).stream().findFirst().orElse(null);
|
||||
if (Strings.isNotBlank(nutMap.getString("unionAuditId"))) {
|
||||
Audit audit = baseService.dao().fetch(Audit.class, Cnd.where("id", "=", nutMap.getString("unionAuditId")));
|
||||
nutMap.setv("unionAudit", audit);
|
||||
}
|
||||
if (Strings.isNotBlank(nutMap.getString("schoolAuditId"))) {
|
||||
Audit audit = baseService.dao().fetch(Audit.class, Cnd.where("id", "=", nutMap.getString("schoolAuditId")));
|
||||
nutMap.setv("schoolAudit", audit);
|
||||
}
|
||||
if (Strings.isNotBlank(nutMap.getString("exitUnionAuditId"))) {
|
||||
Audit audit = baseService.dao().fetch(Audit.class, Cnd.where("id", "=", nutMap.getString("exitUnionAuditId")));
|
||||
nutMap.setv("exitUnionAudit", audit);
|
||||
}
|
||||
if (Strings.isNotBlank(nutMap.getString("exitSchoolAuditId"))) {
|
||||
Audit audit = baseService.dao().fetch(Audit.class, Cnd.where("id", "=", nutMap.getString("exitSchoolAuditId")));
|
||||
nutMap.setv("exitSchoolAudit", audit);
|
||||
}
|
||||
return nutMap;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object getAuditNum(String auditType, String isAudit, String unionId) {
|
||||
String sqlStr = """
|
||||
SELECT
|
||||
COUNT(*)
|
||||
FROM
|
||||
`single_user` su
|
||||
LEFT JOIN `user` u ON u.id = su.userId
|
||||
$condition
|
||||
""";
|
||||
CndPlus joinCnd = CndPlus.create();
|
||||
CndPlus exitCnd = CndPlus.create();
|
||||
String result = "true".equals(isAudit) ? ">" : "false".equals(isAudit) ? "=" : ">=";
|
||||
if ("union".equals(auditType)) {
|
||||
joinCnd.and("su.singleState", result, 8010);
|
||||
exitCnd.and("su.singleState", result, 8040);
|
||||
} else if ("school".equals(auditType)) {
|
||||
joinCnd.and("su.singleState", result, 8020);
|
||||
exitCnd.and("su.singleState", result, 8050);
|
||||
}
|
||||
joinCnd.and("su.singleState", "<=", 8030);
|
||||
exitCnd.and("su.singleState", ">", 8030);
|
||||
if (ShiroUtil.hasAnyRoles("H04")) {
|
||||
exitCnd.andEX("u.unionId", "=", Vi.getUnionId());
|
||||
joinCnd.andEX("u.unionId", "=", Vi.getUnionId());
|
||||
} else {
|
||||
exitCnd.andEX("u.unionId", "=", unionId);
|
||||
joinCnd.andEX("u.unionId", "=", unionId);
|
||||
}
|
||||
|
||||
|
||||
Sql sqlJoin = Sqls.create(sqlStr);
|
||||
sqlJoin.setCondition(joinCnd);
|
||||
Sql sqlExit = Sqls.create(sqlStr);
|
||||
sqlExit.setCondition(exitCnd);
|
||||
int joinCount = this.count(sqlJoin);
|
||||
int exitCount = this.count(sqlExit);
|
||||
NutMap nutMap = new NutMap();
|
||||
nutMap.setv("joinCount", joinCount);
|
||||
nutMap.setv("exitCount", exitCount);
|
||||
return nutMap;
|
||||
}
|
||||
}
|
||||
|
||||
+18
-4
@@ -1,15 +1,12 @@
|
||||
package io.v.nutz.zhgh.staffmanage.sourcechange.controller;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.PageUtil;
|
||||
import io.v.nutz.sys.models.Sys_dict;
|
||||
import io.v.nutz.sys.models.User;
|
||||
import io.v.nutz.sys.services.SysDictService;
|
||||
import io.v.nutz.web.commons.slog.annotation.SLog;
|
||||
import io.v.nutz.zhgh.staffmanage.member.constant.MemberChangeType;
|
||||
import io.v.nutz.zhgh.staffmanage.member.service.MemberCommonService;
|
||||
import io.v.nutz.zhgh.staffmanage.sourcechange.model.SourceChangeMiddleTable;
|
||||
import io.v.nutz.zhgh.staffmanage.sourcechange.param.pageform.SourceChangePageForm;
|
||||
@@ -28,6 +25,7 @@ import org.nutz.lang.Lang;
|
||||
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 java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -151,4 +149,20 @@ public class SourceChangeManageController {
|
||||
sourceChangeManageService.doSourceChange(middleTable);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("sourcechange.manage")
|
||||
@SLog(tag = "人员变更管理", msg = "批量确认变更")
|
||||
public Object doBatchChange(@Param("data") String[] ids) {
|
||||
if (Lang.isEmpty(ids)) {
|
||||
return Result.error("未获取到选择数据");
|
||||
}
|
||||
List<SourceChangeMiddleTable> list = dao.query(SourceChangeMiddleTable.class, Cnd.where("id", "in", ids));
|
||||
for (SourceChangeMiddleTable middleTable : list) {
|
||||
sourceChangeManageService.doSourceChange(middleTable);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
+8
@@ -3,6 +3,8 @@ package io.v.nutz.zhgh.staffmanage.sourcechange.service;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.zhgh.staffmanage.sourcechange.model.SourceChangeMiddleTable;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
@@ -17,4 +19,10 @@ public interface SourceChangeManageService extends BaseService<SourceChangeMiddl
|
||||
* @param middleTable
|
||||
*/
|
||||
void doSourceChange(SourceChangeMiddleTable middleTable);
|
||||
|
||||
|
||||
/**
|
||||
* 发送消息给新入职的老师,提醒可以入会
|
||||
*/
|
||||
void sendMsgToNewTeacher(Date date);
|
||||
}
|
||||
|
||||
+67
-25
@@ -1,10 +1,13 @@
|
||||
package io.v.nutz.zhgh.staffmanage.sourcechange.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HtmlUtil;
|
||||
import io.v.nutz.base.service.impl.BaseServiceImpl;
|
||||
import io.v.nutz.base.utils.MsgApi;
|
||||
import io.v.nutz.base.utils.Roles;
|
||||
import io.v.nutz.sys.models.Sys_union;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
@@ -12,6 +15,7 @@ import io.v.nutz.sys.models.Sys_user_role;
|
||||
import io.v.nutz.sys.models.User;
|
||||
import io.v.nutz.sys.services.SysRoleService;
|
||||
import io.v.nutz.sys.services.SysUserService;
|
||||
import io.v.nutz.web.commons.base.Globals;
|
||||
import io.v.nutz.zhgh.activity.models.ActivityUserScope;
|
||||
import io.v.nutz.zhgh.data.model.UserHistory;
|
||||
import io.v.nutz.zhgh.staffmanage.member.constant.MemberChangeOrigin;
|
||||
@@ -21,6 +25,7 @@ import io.v.nutz.zhgh.staffmanage.sourcechange.model.SourceChangeMiddleTable;
|
||||
import io.v.nutz.zhgh.staffmanage.sourcechange.service.SourceChangeManageService;
|
||||
import io.v.nutz.zhgh.staffmanage.specialstaff.model.SpecialStaff;
|
||||
import io.v.nutz.zhgh.welfare.model.WelfareList;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
@@ -42,6 +47,7 @@ import java.util.stream.Collectors;
|
||||
* @Date 2025/2/19 14:55
|
||||
* @注释
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class SourceChangeManageServiceImpl extends BaseServiceImpl<SourceChangeMiddleTable> implements SourceChangeManageService {
|
||||
public SourceChangeManageServiceImpl(Dao dao) {
|
||||
@@ -54,15 +60,20 @@ public class SourceChangeManageServiceImpl extends BaseServiceImpl<SourceChangeM
|
||||
private SysRoleService sysRoleService;
|
||||
@Inject
|
||||
private SysUserService sysUserService;
|
||||
@Inject
|
||||
private MsgApi msgApi;
|
||||
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void doSourceChange(SourceChangeMiddleTable middleTable) {
|
||||
User user = dao().fetch(User.class, Cnd.where("loginname", "=", middleTable.getLoginname()));
|
||||
// 当前工会,用于记录记录是工会关系异动的上一个工会
|
||||
String unionname = user.getUnionname();
|
||||
// 记录当前操作的时间,用于后续区分短信通知
|
||||
Date date = DateUtil.date();
|
||||
|
||||
int count = dao().count(Sys_user.class, Cnd.where("loginname", "=", middleTable.getLoginname()));
|
||||
|
||||
Sys_user info = new Sys_user();
|
||||
User user = new User();
|
||||
//获取可变更字段
|
||||
NutMap map = commonService.getDictAllowChangeFields();
|
||||
Set<String> allowChangeFieldNames = map.getAs("allowChangeFieldNames", Set.class);
|
||||
@@ -79,24 +90,34 @@ public class SourceChangeManageServiceImpl extends BaseServiceImpl<SourceChangeM
|
||||
}
|
||||
|
||||
List<String> changeTypes = new ArrayList<>();
|
||||
changeTypes.add(MemberChangeType.BASIC_CHANGE.getType());
|
||||
if (!ObjectUtil.equals(user.getUserState(), middleTable.getUserState())) {
|
||||
List<MemberChangeType> list = Arrays.stream(MemberChangeType.values())
|
||||
.filter(v -> v.getChangeTypeName().equals(middleTable.getUserState())).toList();
|
||||
if (Lang.isNotEmpty(list)) {
|
||||
changeTypes.add(list.get(0).getType());
|
||||
if (count <= 0) {
|
||||
changeTypes.add(MemberChangeType.NEW.getType());
|
||||
Sys_user sysUser = BeanUtil.copyProperties(middleTable, Sys_user.class);
|
||||
dao().insert(sysUser);
|
||||
|
||||
user = dao().fetch(User.class, Cnd.where("loginname", "=", middleTable.getLoginname()));
|
||||
} else {
|
||||
user = dao().fetch(User.class, Cnd.where("loginname", "=", middleTable.getLoginname()));
|
||||
|
||||
changeTypes.add(MemberChangeType.BASIC_CHANGE.getType());
|
||||
|
||||
if (!ObjectUtil.equals(user.getUserState(), middleTable.getUserState())) {
|
||||
List<MemberChangeType> list = Arrays.stream(MemberChangeType.values())
|
||||
.filter(v -> v.getChangeTypeName().equals(middleTable.getUserState())).toList();
|
||||
if (Lang.isNotEmpty(list)) {
|
||||
changeTypes.add(list.get(0).getType());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!ObjectUtil.equals(user.getMember(), middleTable.getMember())){
|
||||
if (middleTable.getMember() == 1) {
|
||||
changeTypes.add(MemberChangeType.RESTORE.getType());
|
||||
} else {
|
||||
changeTypes.add(MemberChangeType.WITHDRAWAL.getType());
|
||||
if (!ObjectUtil.equals(user.getMember(), middleTable.getMember())){
|
||||
if (middleTable.getMember() == 1) {
|
||||
changeTypes.add(MemberChangeType.RESTORE.getType());
|
||||
} else {
|
||||
changeTypes.add(MemberChangeType.WITHDRAWAL.getType());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Sys_user info = dao().fetch(Sys_user.class, Cnd.where("loginname", "=", middleTable.getLoginname()));
|
||||
info = dao().fetch(Sys_user.class, Cnd.where("loginname", "=", middleTable.getLoginname()));
|
||||
String userId = info.getId();
|
||||
UserHistory history = new UserHistory();
|
||||
if (Lang.isNotEmpty(changeList)) {
|
||||
@@ -104,12 +125,12 @@ public class SourceChangeManageServiceImpl extends BaseServiceImpl<SourceChangeM
|
||||
}
|
||||
|
||||
if (Lang.isNotEmpty(history)) {
|
||||
history.setChangeTime(DateUtil.date());
|
||||
history.setChangeTime(date);
|
||||
history.setChangeOrigin(MemberChangeOrigin.HAND_MOVEMENT.name());
|
||||
|
||||
|
||||
// 加入会员
|
||||
if (middleTable.getMember() == 1) {
|
||||
if (middleTable.getMember() != null && middleTable.getMember() == 1) {
|
||||
int activityCount = dao().count(ActivityUserScope.class, Cnd.where("userId", "=", userId).and("groupId", "=", 1));
|
||||
int memberCount = dao().count(Sys_user_role.class, Cnd.where("userId", "=", userId).and("roleId", "=", Roles.MEMBER));
|
||||
if (activityCount <= 0) {
|
||||
@@ -140,7 +161,7 @@ public class SourceChangeManageServiceImpl extends BaseServiceImpl<SourceChangeM
|
||||
}
|
||||
|
||||
// 加入福利会员 是否加入福利项目
|
||||
if (middleTable.getWelfareMember() == 1 && middleTable.getIsJoinWelfareProject() != null && middleTable.getIsJoinWelfareProject()) {
|
||||
if (middleTable.getWelfareMember() != null && middleTable.getWelfareMember() == 1 && middleTable.getIsJoinWelfareProject() != null && middleTable.getIsJoinWelfareProject()) {
|
||||
WelfareList welfareList = new WelfareList();
|
||||
welfareList.setId(R.UU32());
|
||||
welfareList.setProjectId(middleTable.getWelfareProjectId());
|
||||
@@ -166,12 +187,15 @@ public class SourceChangeManageServiceImpl extends BaseServiceImpl<SourceChangeM
|
||||
|
||||
// 如果工会发生变更了,就是工会关系变更,记录到特殊人员表中
|
||||
if (!ObjectUtil.equals(user.getUnionid(), middleTable.getUnionid())) {
|
||||
// 当前工会,用于记录记录是工会关系异动的上一个工会
|
||||
String unionname = user.getUnionname();
|
||||
|
||||
if (dao().count(SpecialStaff.class, Cnd.where("userId", "=", userId)) > 0) {
|
||||
dao().clear(SpecialStaff.class, Cnd.where("userId", "=", userId));
|
||||
user = dao().fetch(User.class, Cnd.where("id", "=", userId));
|
||||
}
|
||||
|
||||
if (!ObjectUtil.equals(user.getUnionid(), middleTable.getUnionid())) {
|
||||
if (StrUtil.isNotBlank(middleTable.getUnionid()) && !ObjectUtil.equals(user.getUnionid(), middleTable.getUnionid())) {
|
||||
changeTypes.add(MemberChangeType.UNION_CHANGE.getType());
|
||||
Sys_union union = dao().fetch(Sys_union.class, Cnd.where("id", "=", middleTable.getUnionid()));
|
||||
|
||||
@@ -198,10 +222,14 @@ public class SourceChangeManageServiceImpl extends BaseServiceImpl<SourceChangeM
|
||||
dao().updateIgnoreNull(info);
|
||||
|
||||
history.setChangeInfos(changeList);
|
||||
String changeInfos = changeList.stream().map(v -> {
|
||||
return v.getString("fieldName") + ":" + HtmlUtil.cleanHtmlTag(v.getString("sourceValue")) + "->" + HtmlUtil.cleanHtmlTag(v.getString("newValue")) + ";";
|
||||
}).collect(Collectors.joining(";"));
|
||||
history.setChangeInfosStr(changeInfos);
|
||||
if (count <= 0) {
|
||||
history.setChangeInfosStr("新入职");
|
||||
} else {
|
||||
String changeInfos = changeList.stream().map(v -> {
|
||||
return v.getString("fieldName") + ":" + HtmlUtil.cleanHtmlTag(v.getString("sourceValue")) + "->" + HtmlUtil.cleanHtmlTag(v.getString("newValue"));
|
||||
}).collect(Collectors.joining(";"));
|
||||
history.setChangeInfosStr(changeInfos);
|
||||
}
|
||||
history.setChangeTypes(changeTypes);
|
||||
dao().insert(history);
|
||||
|
||||
@@ -211,5 +239,19 @@ public class SourceChangeManageServiceImpl extends BaseServiceImpl<SourceChangeM
|
||||
sysRoleService.clearCache();
|
||||
}
|
||||
|
||||
sendMsgToNewTeacher(date);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void sendMsgToNewTeacher(Date date) {
|
||||
List<UserHistory> historyList = dao().query(UserHistory.class, Cnd.where("changeTypes", "like", "%" + MemberChangeType.NEW.getType() + "%")
|
||||
.and("DATE_FORMAT(changeTime,'%Y-%m-%d %H:%i')", "=", DateUtil.format(date, "yyyy-MM-dd HH:mm")));
|
||||
|
||||
// for (UserHistory history : historyList) {
|
||||
// String context = "%s老师您好,欢迎加入杭医大家庭,诚挚邀请您成为工会会员,如有意愿,请您点击此条消息或前往智慧工会平台申请入会,如无意愿请忽略此消息提醒。".formatted(history.getUsername());
|
||||
// String link = Globals.AppDomain + "/platform/member/apply/submit/h5";
|
||||
// msgApi.sendMsg(List.of("DingTalk"), history.getLoginname(), 2, "入会邀请", context, "", link);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
+2
-19
@@ -13,10 +13,8 @@ import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.POST;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
@@ -28,7 +26,7 @@ import java.util.List;
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@At("/platform/trainSingUp/manage/activity")
|
||||
@At("/platform/trainSingUp/manage/activity/add")
|
||||
public class TrainSignUpActivityAddController {
|
||||
|
||||
@Inject
|
||||
@@ -37,27 +35,12 @@ public class TrainSignUpActivityAddController {
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@At("/add")
|
||||
@At("")
|
||||
@RequiresPermissions("trainSingUp.manage.activity.add")
|
||||
@Ok("beetl:/platform/trainSingUp/manage/activity_add.html")
|
||||
public void add() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Ok("json:full")
|
||||
@POST
|
||||
@RequiresPermissions("trainSingUp.manage.activity.add")
|
||||
public Object doHandle(@Param(value = "data", required = false) String data) {
|
||||
TrainSignUpActivity activity = Json.fromJson(TrainSignUpActivity.class, data);
|
||||
if (StrUtil.isBlank(activity.getId())) {
|
||||
trainSignUpActivityManageService.add(activity, null);
|
||||
} else {
|
||||
trainSignUpActivityManageService.edit(activity);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Ok("json:full")
|
||||
|
||||
+12
-5
@@ -6,6 +6,7 @@ import io.v.nutz.base.dao.CndPlus;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.sys.models.Sys_dict;
|
||||
import io.v.nutz.sys.services.SysDictService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.trainSignUp.models.TrainSignUpActivity;
|
||||
import io.v.nutz.zhgh.trainSignUp.models.TrainSignUpActivityCourse;
|
||||
import io.v.nutz.zhgh.trainSignUp.models.TrainSignUpType;
|
||||
@@ -83,6 +84,7 @@ public class TrainSignUpActivityApplyController {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
tsuc.id,
|
||||
tsuc.assort,
|
||||
tsuc.activityId,
|
||||
tsuc.courseName,
|
||||
tsuc.coursePeopleNumber,
|
||||
@@ -108,22 +110,27 @@ public class TrainSignUpActivityApplyController {
|
||||
CndPlus cnd = CndPlus.create();
|
||||
cnd.andEX("type.id","=",courseTypeId);
|
||||
cnd.and("tsuc.activityId","=",activityId);
|
||||
cnd.asc("type.code");
|
||||
cnd.asc("tsuc.orderNum");
|
||||
sql.setCondition(cnd);
|
||||
|
||||
Pagination pagination = trainSignUpActivityService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
List<NutMap> courseList = pagination.getList();
|
||||
|
||||
List<TrainSignUpActivityCourse> activityCourseList = trainSignUpActivityService.dao().query(TrainSignUpActivityCourse.class, Cnd.where("activityId", "=", activityId));
|
||||
|
||||
Map<String, List<TrainSignUpActivityCourse>> map = activityCourseList.stream().collect(Collectors.groupingBy(TrainSignUpActivityCourse::getCourseId));
|
||||
|
||||
courseList.forEach(c -> {
|
||||
List<TrainSignUpActivityCourse> list = map.get(c.getString("id"));
|
||||
c.put("courseList", list);
|
||||
|
||||
TrainSignUpType type = trainSignUpActivityService.dao().fetch(TrainSignUpType.class, c.getString("courseType"));
|
||||
// trainSignUpActivityService.dao().fetchLinks(c, "^(courseTimeList)$", Cnd.NEW().asc("courseStartTime"));
|
||||
//已报人数
|
||||
AtomicInteger hasRegisterNum = new AtomicInteger();
|
||||
List<TrainSignUpUser> signUpUsers = trainSignUpActivityService.dao().query(TrainSignUpUser.class, Cnd.where("courseId", "=", c.getString("id")));
|
||||
signUpUsers.forEach(item -> {
|
||||
if(type.getSelfAddFamily()) {
|
||||
hasRegisterNum.getAndIncrement();
|
||||
}
|
||||
hasRegisterNum.getAndIncrement();
|
||||
if(type.getIsBringFamily() && type.getIsAddFamily()) {
|
||||
List<NutMap> mapList = item.getMobileColumnsValue();
|
||||
if(Lang.isNotEmpty(mapList)) {
|
||||
@@ -136,7 +143,7 @@ public class TrainSignUpActivityApplyController {
|
||||
});
|
||||
c.put("hasRegisterNum",hasRegisterNum.get());
|
||||
//当前用户是否报过
|
||||
c.put("isSign",trainSignUpActivityService.isSignCourseByUser(c.getString("id"), (String) io.v.nutz.web.commons.utils.ShiroUtil.getPrincipalProperty("id")));
|
||||
c.put("isSign",trainSignUpActivityService.isSignCourseByUser(c.getString("id"), (String) ShiroUtil.getPrincipalProperty("id")));
|
||||
});
|
||||
return pagination;
|
||||
}
|
||||
|
||||
+5
-3
@@ -2,18 +2,22 @@ package io.v.nutz.zhgh.trainSignUp.controller.manage;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.base.utils.MsgApi;
|
||||
import io.v.nutz.sys.models.Sys_home_activity;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.activity.models.ActivityUserScope;
|
||||
import io.v.nutz.zhgh.data.model.MatchConditionStructure;
|
||||
import io.v.nutz.zhgh.data.service.MatchConditionStructureService;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.zhgh.trainSignUp.models.*;
|
||||
import io.v.nutz.zhgh.trainSignUp.service.TrainSignUpActivityService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
@@ -167,6 +171,4 @@ public class TrainSignUpActivityController {
|
||||
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -3,11 +3,11 @@ package io.v.nutz.zhgh.trainSignUp.controller.manage;
|
||||
import cn.hutool.core.util.EnumUtil;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.dao.CndPlus;
|
||||
import io.v.nutz.base.page.Pagination;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.base.utils.PageUtil;
|
||||
import io.v.nutz.base.dao.CndPlus;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.zhgh.trainSignUp.models.TrainMobileSignColumn;
|
||||
import io.v.nutz.zhgh.trainSignUp.models.TrainSignUpType;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
+8
-8
@@ -11,11 +11,11 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.base.utils.ViTool;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.trainSignUp.models.*;
|
||||
import io.v.nutz.zhgh.trainSignUp.service.TrainSignUpActivityService;
|
||||
import io.v.nutz.zhgh.trainSignUp.service.TrainSignUpActivityStatisticsService;
|
||||
@@ -226,10 +226,10 @@ public class TrainSignUpUserAdjustController {
|
||||
|
||||
TrainSignUpActivity activity = dao.fetch(TrainSignUpActivity.class, activityId);
|
||||
|
||||
/*if(DateUtil.compare(new Date(), activity.getActivitySignUpStartTime(), "yyyy-MM-dd HH:mm:ss") < 0) {
|
||||
if(DateUtil.compare(new Date(), activity.getActivitySignUpStartTime(), "yyyy-MM-dd HH:mm:ss") < 0) {
|
||||
return Result.error("报名未开始");
|
||||
}
|
||||
if(DateUtil.compare(new Date(), activity.getActivitySignUpEndTime(), "yyyy-MM-dd HH:mm:ss") > 0) {
|
||||
/*if(DateUtil.compare(new Date(), activity.getActivitySignUpEndTime(), "yyyy-MM-dd HH:mm:ss") > 0) {
|
||||
return Result.error("报名已结束");
|
||||
}*/
|
||||
|
||||
@@ -244,11 +244,11 @@ public class TrainSignUpUserAdjustController {
|
||||
for (SignUser sign : signUser) {
|
||||
Sys_user sysUser = dao.fetch(Sys_user.class, Cnd.where("loginname", "=", sign.getLoginname()));
|
||||
if(sysUser != null) {
|
||||
/*if(!isSingle && courseMap.get(sign.getCourseName()) == null) {
|
||||
if(!isSingle && courseMap.get(sign.getCourseName()) == null) {
|
||||
sign.setErrMsg("分活动/培训班名称有误");
|
||||
continue;
|
||||
}*/
|
||||
String courseId = importCourseId;
|
||||
}
|
||||
String courseId = isSingle ? importCourseId : courseMap.get(sign.getCourseName());
|
||||
/*if(StrUtil.isNotBlank(course.getConditionStructureId())) {
|
||||
NutMap nutMap = trainSignUpActivityService.validConditionStructure(course.getConditionStructureId());
|
||||
if(!nutMap.getBoolean("flag")) {
|
||||
@@ -290,7 +290,7 @@ public class TrainSignUpUserAdjustController {
|
||||
Sys_user sysUser = dao.fetch(Sys_user.class, Cnd.where("loginname", "=", item.getLoginname()));
|
||||
TrainSignUpUser trainSignUpUser = new TrainSignUpUser();
|
||||
trainSignUpUser.setActivityId(activityId);
|
||||
trainSignUpUser.setCourseId(importCourseId);
|
||||
trainSignUpUser.setCourseId(isSingle ? importCourseId : courseMap.get(item.getCourseName()));
|
||||
trainSignUpUser.setUserId(sysUser.getId());
|
||||
trainSignUpUser.setMobile(sysUser.getMobile());
|
||||
trainSignUpUser.setSignUpTime(new Date());
|
||||
|
||||
+5
-2
@@ -6,8 +6,9 @@ import cn.afterturn.easypoi.excel.export.ExcelExportService;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.PageUtil;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.utils.PageUtil;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.trainSignUp.models.TrainSignUpActivity;
|
||||
import io.v.nutz.zhgh.trainSignUp.models.TrainSignUpCourse;
|
||||
import io.v.nutz.zhgh.trainSignUp.models.TrainSignUpUser;
|
||||
@@ -70,6 +71,9 @@ public class TrainSignUpUserBlackListManage {
|
||||
cnd.andEX("tsuu.activityId", "=", activityId);
|
||||
cnd.andEX("tsuu.courseId", "=", courseId);
|
||||
cnd.andEX("act.year", "=", year);
|
||||
if(ShiroUtil.hasRole("H04") && !ShiroUtil.hasAnyRoles("sysadmin, A06")) {
|
||||
cnd.and("activityMode", "=", 2).and("act.opBy", "=", ShiroUtil.getPlatformUid());
|
||||
}
|
||||
if (StrUtil.isNotBlank(userKeyWord)) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
cnd.and(seg.andLike("u.username", userKeyWord).orLike("u.loginname", userKeyWord));
|
||||
@@ -77,7 +81,6 @@ public class TrainSignUpUserBlackListManage {
|
||||
if(Strings.isNotBlank(pageForm.getPageOrderName()) && Strings.isNotBlank(pageForm.getPageOrderBy())){
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
}
|
||||
|
||||
return trainSignUpBlackListService.pageData(pageForm, cnd, activityId, courseId);
|
||||
}
|
||||
|
||||
|
||||
+91
-102
@@ -4,11 +4,12 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.zhgh.data.service.MatchConditionStructureService;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.activity.models.ActivityUserScope;
|
||||
import io.v.nutz.zhgh.data.service.MatchConditionStructureService;
|
||||
import io.v.nutz.zhgh.trainSignUp.models.*;
|
||||
import io.v.nutz.zhgh.trainSignUp.service.TrainSignUpActivityService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
@@ -16,12 +17,13 @@ import org.nutz.dao.Dao;
|
||||
import org.nutz.integration.jedis.RedisService;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -93,9 +95,46 @@ public class MTrainSignUpActivityController {
|
||||
List<String> mySignCourseIdList = mySignCourseList.stream().map(TrainSignUpUser::getCourseId).collect(Collectors.toList());
|
||||
cnd.and("id", "in", mySignCourseIdList);
|
||||
}
|
||||
return trainSignUpActivityService.findOne(id, cnd);
|
||||
NutMap nutMap = trainSignUpActivityService.findOne(id, cnd);
|
||||
List<TrainSignUpCourse> courseList = nutMap.getAsList("courseList", TrainSignUpCourse.class);
|
||||
courseList.forEach(v -> {
|
||||
if (v.getCourseIsLimitApply() != null && v.getCourseIsLimitApply() && v.getIsSign()) {
|
||||
TrainSignUpActivityCourse course = dao.fetch(TrainSignUpActivityCourse.class, Cnd.where("courseId", "=", v.getId()));
|
||||
v.setCourseTimeName(DateUtil.format(course.getCourseStartTime(), "HH:mm") + "至" + DateUtil.format(course.getCourseEndTime(), "HH:mm") + "段");
|
||||
}
|
||||
});
|
||||
return nutMap;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object getCourseTimeSelectList(String courseId) {
|
||||
// 查课程的时间段
|
||||
List<TrainSignUpActivityCourse> courseList = dao.query(TrainSignUpActivityCourse.class, Cnd.where("courseId", "=", courseId));
|
||||
|
||||
// 查课程的报名人数
|
||||
List<TrainSignUpUserCourse> applyUserList = dao.query(TrainSignUpUserCourse.class, Cnd.where("courseId", "=", courseId));
|
||||
// 按照课程下面时间段去分组
|
||||
Map<String, List<TrainSignUpUserCourse>> collectMap = applyUserList.stream().collect(Collectors.groupingBy(TrainSignUpUserCourse::getActivityCourseId));
|
||||
return courseList.stream().map(v -> {
|
||||
String id = v.getId();
|
||||
NutMap nutMap = NutMap.NEW();
|
||||
List<TrainSignUpUserCourse> trainSignUpUserCourses = collectMap.get(id);
|
||||
int remainingNum = v.getCourseLimitNum();
|
||||
if (Lang.isNotEmpty(trainSignUpUserCourses)) {
|
||||
remainingNum = v.getCourseLimitNum() - trainSignUpUserCourses.size();
|
||||
}
|
||||
nutMap.put("remainingNum", remainingNum);
|
||||
nutMap.put("text", DateUtil.format(v.getCourseStartTime(), "HH:mm") + "至" + DateUtil.format(v.getCourseEndTime(), "HH:mm") + "段(剩" + remainingNum + ")");
|
||||
nutMap.put("value", id);
|
||||
return nutMap;
|
||||
}).filter(v-> v.getInt("remainingNum") != 0).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@POST
|
||||
@@ -103,36 +142,6 @@ public class MTrainSignUpActivityController {
|
||||
public Object doSignUp(TrainSignUpUser trainSignUpUser) {
|
||||
try {
|
||||
lock.lock();
|
||||
boolean courseByUser = trainSignUpActivityService.isSignCourseByUser(trainSignUpUser.getCourseId(), ShiroUtil.getPlatformUid());
|
||||
if(courseByUser) {
|
||||
return Result.error("您已报过该活动");
|
||||
}
|
||||
//判断人数
|
||||
int number = 0;
|
||||
TrainSignUpCourse course = trainSignUpActivityService.dao().fetch(TrainSignUpCourse.class, trainSignUpUser.getCourseId());
|
||||
TrainSignUpType type = trainSignUpActivityService.dao().fetch(TrainSignUpType.class, course.getCourseType());
|
||||
if(type != null) {
|
||||
if(type.getIsBringFamily() && type.getIsAddFamily()) {
|
||||
List<NutMap> mobileColumnsValue = trainSignUpUser.getMobileColumnsValue();
|
||||
NutMap map = mobileColumnsValue.stream().filter(o -> "xdqsrs".equals(o.getString("columnCode"))).findAny().orElse(null);
|
||||
number = map != null ? map.getInt("columnValue") : 0;
|
||||
}
|
||||
}
|
||||
boolean signFull = trainSignUpActivityService.isSignFull(trainSignUpUser.getCourseId(), number);
|
||||
if(signFull) {
|
||||
return Result.error("当前报名人数已满");
|
||||
}
|
||||
boolean signFullByUnionId = trainSignUpActivityService.isSignFullByUnionId(trainSignUpUser.getCourseId(), number);
|
||||
if(signFullByUnionId) {
|
||||
return Result.error("该活动您所在的分工会名额已报满");
|
||||
}
|
||||
|
||||
TrainSignUpActivity activity = trainSignUpActivityService.fetch(trainSignUpUser.getActivityId());
|
||||
Map<Boolean, String> childNumber = this.getChildNumber(activity, trainSignUpUser);
|
||||
if (childNumber.containsKey(false)) {
|
||||
return Result.error(childNumber.get(false));
|
||||
}
|
||||
|
||||
trainSignUpActivityService.doSignUp(trainSignUpUser);
|
||||
return Result.success("报名成功");
|
||||
} catch (Exception e) {
|
||||
@@ -228,11 +237,17 @@ public class MTrainSignUpActivityController {
|
||||
}
|
||||
TrainSignUpCourse course = dao.fetch(TrainSignUpCourse.class, courseId);
|
||||
TrainSignUpActivity activity = dao.fetch(TrainSignUpActivity.class, course.getActivityId());
|
||||
|
||||
int count = dao.count(ActivityUserScope.class, Cnd.where("groupId", "=", activity.getActivityGroupId())
|
||||
.and("userId", "=", ShiroUtil.getUserId()));
|
||||
if (count == 0) {
|
||||
return Result.error("您不在报名人员范围内");
|
||||
}
|
||||
if(DateUtil.compare(new Date(), activity.getActivitySignUpStartTime(), "yyyy-MM-dd HH:mm:ss") < 0) {
|
||||
return Result.error("报名未开始");
|
||||
}
|
||||
if(DateUtil.compare(new Date(), activity.getActivitySignUpEndTime(), "yyyy-MM-dd HH:mm:ss") > 0) {
|
||||
return Result.error("报名已结束,请致电校工会咨询,联系电话:85913629");
|
||||
return Result.error("报名已结束");
|
||||
}
|
||||
if(StrUtil.isNotBlank(cndId)) {
|
||||
NutMap nutMap = trainSignUpActivityService.validConditionStructure(cndId);
|
||||
@@ -252,7 +267,7 @@ public class MTrainSignUpActivityController {
|
||||
boolean signCourse = trainSignUpActivityService.isSignCourse(courseId, activity.getId());
|
||||
if(!signCourse) {
|
||||
if(activity.getRestrictLimit() != 3) {
|
||||
return Result.error("您选择的类型的培训班已达上限,不能再报该类型的培训班了");
|
||||
return Result.error("您选择的类型的活动已达上限,不能再报该类型的活动了,但您仍可报名参加“美味下午茶品鉴”活动");
|
||||
} else {
|
||||
return Result.error(activity.getActivityName() + "限制报" + activity.getLimitNum() + "个活动,已达上限");
|
||||
}
|
||||
@@ -261,12 +276,6 @@ public class MTrainSignUpActivityController {
|
||||
if(signFullByUnionId) {
|
||||
return Result.error("该活动您所在的分工会名额已报满");
|
||||
}
|
||||
|
||||
Map<Boolean, String> childNumber = this.getChildNumber(activity, null);
|
||||
if (childNumber.containsKey(false)) {
|
||||
return Result.error(childNumber.get(false));
|
||||
}
|
||||
|
||||
if(course.getReserveMode() == 2 && currentFamilyNumber == null) {
|
||||
//课程已报人数
|
||||
List<TrainSignUpUser> signUpUsers = dao.query(TrainSignUpUser.class, Cnd.where("courseId", "=", courseId));
|
||||
@@ -284,76 +293,56 @@ public class MTrainSignUpActivityController {
|
||||
}
|
||||
}
|
||||
|
||||
private Map<Boolean, String> getChildNumber(TrainSignUpActivity activity, TrainSignUpUser trainSignUpUser) {
|
||||
//临时活动的逻辑
|
||||
List<String> stringList = List.of("06aaf4fd9db94bf9be2a27a1ab486a20", "6faec5acb6264bb6a4395aee03804269", "f9c532d86c89474f9d61c8374539e521");
|
||||
if(stringList.contains(activity.getId())) {
|
||||
List<TrainSignUpUser> upUsers = trainSignUpActivityService.dao().query(TrainSignUpUser.class,
|
||||
Cnd.where("activityId", "in", stringList)
|
||||
.and("userId", "=", ShiroUtil.getPlatformUid()));
|
||||
if(upUsers.size() >= 2) {
|
||||
return Map.of(false, "江小娃系列活动只能报2个班");
|
||||
}
|
||||
//孩子数量
|
||||
List<NutMap> childList = upUsers.stream()
|
||||
.flatMap(o -> o.getMobileColumnsValue().stream())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
long count = childList.stream().filter(o -> o.getString("columnCode").contains("NM") && StrUtil.isNotBlank(o.getString("columnValue"))).count();
|
||||
if(trainSignUpUser != null) {
|
||||
|
||||
//获取当前填写的孩子数量
|
||||
List<NutMap> mobileColumnsValue = trainSignUpUser.getMobileColumnsValue();
|
||||
|
||||
//判断孩子姓名有没有重复
|
||||
List<String> hasSignName = new ArrayList<>();
|
||||
childList.forEach(o -> {
|
||||
if(o.getString("columnCode").contains("NM") && StrUtil.isNotBlank(o.getString("columnValue"))) {
|
||||
hasSignName.add(o.getString("columnValue"));
|
||||
}
|
||||
});
|
||||
List<String> currentSignName = mobileColumnsValue.stream().map(o -> {
|
||||
if (o.getString("columnCode").contains("NM") && StrUtil.isNotBlank(o.getString("columnValue"))) {
|
||||
return o.getString("columnValue");
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}).filter(StrUtil::isNotBlank).collect(Collectors.toList());
|
||||
|
||||
boolean hasDuplicates = new HashSet<>(currentSignName).size() < currentSignName.size();
|
||||
if(hasDuplicates) {
|
||||
return Map.of(false, "孩子姓名不能重复");
|
||||
}
|
||||
for (String o : currentSignName) {
|
||||
if(hasSignName.contains(o)) {
|
||||
return Map.of(false, "不能报名,【" + o + "】已经在其他年级组报名了");
|
||||
}
|
||||
}
|
||||
|
||||
long currentChild = mobileColumnsValue.stream().filter(o -> o.getString("columnCode").contains("NM") && StrUtil.isNotBlank(o.getString("columnValue"))).count();
|
||||
count += currentChild;
|
||||
}
|
||||
if(count > 2) {
|
||||
return Map.of(false, "江小娃系列活动只能上报2个孩子");
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@RequiresAuthentication
|
||||
public Object validateSourceSignUp(String activityCourseId) {
|
||||
try {
|
||||
lock.lock();
|
||||
// 该时间段下已报名的人数
|
||||
int count = dao.count(TrainSignUpUserCourse.class, Cnd.where("activityCourseId", "=", activityCourseId));
|
||||
// 获取改时间段下的活动课程限制报名人数
|
||||
TrainSignUpActivityCourse course = dao.fetch(TrainSignUpActivityCourse.class, activityCourseId);
|
||||
Integer courseLimitNum = course.getCourseLimitNum();
|
||||
// 报名加上自己,如果大于了限制人数,那就无法报名
|
||||
if (count + 1 > courseLimitNum) {
|
||||
return Result.error("该时间段名额已报满,请选择其他时段报名");
|
||||
} else {
|
||||
return Result.success();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error("报名失败");
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
return Map.of(true, "");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object codeSign(String id, String codeCourseId, String clickCourseId) {
|
||||
if(StrUtil.isBlank(codeCourseId) || StrUtil.isBlank(clickCourseId)) {
|
||||
return Result.error("签到失败,没有获取到扫描信息");
|
||||
try {
|
||||
lock.lock();
|
||||
if(StrUtil.isBlank(codeCourseId) || StrUtil.isBlank(clickCourseId)) {
|
||||
return Result.error("签到失败,没有获取到扫描信息");
|
||||
}
|
||||
if(!codeCourseId.equals(clickCourseId)) {
|
||||
return Result.error("签到失败,二维码与您当前签到信息不符");
|
||||
}
|
||||
dao.update(TrainSignUpUserCourse.class, Chain.make("isAttend", true)
|
||||
.add("attendTime", new Date()), Cnd.where("id", "=", id));
|
||||
return null;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error("签到失败");
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
if(!codeCourseId.equals(clickCourseId)) {
|
||||
return Result.error("签到失败,二维码与您当前签到信息不符");
|
||||
}
|
||||
dao.update(TrainSignUpUserCourse.class, Chain.make("isAttend", true)
|
||||
.add("attendTime", new Date()), Cnd.where("id", "=", id));
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -4,9 +4,9 @@ import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.WxTokenUtil;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.trainSignUp.models.TrainSignUpUserCourse;
|
||||
import io.v.nutz.zhgh.trainSignUp.service.TrainSignUpActivityService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.nutz.dao.Chain;
|
||||
|
||||
+11
-12
@@ -31,9 +31,12 @@ import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
@@ -108,14 +111,6 @@ public class TrainSignUpActivityStatisticsController {
|
||||
return trainSignUpActivityStatisticsService.registerUserList(courseId);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Ok("json:full")
|
||||
@RequiresPermissions("trainSingUp.statistics.activity")
|
||||
public Object getTaleColumnInfo(@Param(value = "courseId") String courseId) {
|
||||
return trainSignUpActivityStatisticsService.getTaleColumnInfo(courseId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 培训班上课签到信息
|
||||
*
|
||||
@@ -141,6 +136,7 @@ public class TrainSignUpActivityStatisticsController {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
ts.*,
|
||||
CONCAT(DATE_FORMAT(ac.courseStartTime, '%H:%i:%s'),'至',DATE_FORMAT(ac.courseEndTime, '%H:%i:%s')) AS courseTime,
|
||||
u.username,
|
||||
u.loginname,
|
||||
u.unitname,
|
||||
@@ -153,6 +149,7 @@ public class TrainSignUpActivityStatisticsController {
|
||||
ts.state
|
||||
FROM
|
||||
train_sign_up_user ts
|
||||
left join train_sign_up_activity_course ac on ts.activityCourseId = ac.id
|
||||
left join `user` u on u.id = ts. userId
|
||||
left join train_sign_up_course tsc on tsc.id = ts.courseId
|
||||
WHERE
|
||||
@@ -179,7 +176,9 @@ public class TrainSignUpActivityStatisticsController {
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("分工会", "unionname", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("性别", "sex", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("手机号", "mobile", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("生日", "birthday", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("报名时间", "signUpTime", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("报名时段", "courseTime", 20));
|
||||
// excelCommonExportEntity.add(new ExcelExportEntity("生日", "birthday", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("报名状态", "stateName", 20));
|
||||
|
||||
List<TrainSignUpCourse> courseList = dao.query(TrainSignUpCourse.class, Cnd.where("activityId", "=", activityId));
|
||||
@@ -199,7 +198,7 @@ public class TrainSignUpActivityStatisticsController {
|
||||
TrainSignUpCourse course = courseMap.get(k);
|
||||
//查询课程类型
|
||||
TrainSignUpType trainSignUpType = dao.fetch(TrainSignUpType.class, Cnd.where("id", "=", course.getCourseType()));
|
||||
dao.fetchLinks(trainSignUpType, "^trainMobileSignColumnList$", Cnd.NEW().asc("columnIndex"));
|
||||
dao.fetchLinks(trainSignUpType, "^trainMobileSignColumnList$");
|
||||
|
||||
ExcelExportService service = new ExcelExportService();
|
||||
ExportParams userExportParams = new ExportParams();
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package io.v.nutz.zhgh.trainSignUp.models;
|
||||
|
||||
import cn.wizzer.framework.base.model.BaseModel;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.sys.models.Sys_file;
|
||||
import io.v.nutz.sys.models.Sys_home_activity;
|
||||
import io.v.nutz.sys.services.SysHomeConvert;
|
||||
import io.v.nutz.zhgh.data.model.MatchConditionStructure;
|
||||
import io.v.nutz.sys.models.Sys_file;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
@@ -140,7 +141,7 @@ public class TrainSignUpActivity extends BaseModel implements Serializable, SysH
|
||||
sysHomeActivity.setName(this.getActivityName());
|
||||
sysHomeActivity.setCover(this.getCover().getFilepath());
|
||||
sysHomeActivity.setUrl("/platform/trainSingUp/manage/apply");
|
||||
sysHomeActivity.setH5Url("/platform/mobile/trainSignUpActivity/trainList");
|
||||
sysHomeActivity.setH5Url("/platform/mobile/trainSignUpActivity/trainInfo?activityId=" + this.getId() + "&endTime=" + DateUtil.format(this.getActivityEndTime(), "yyyy-MM-dd HH:mm:ss"));
|
||||
if (Lang.isNotEmpty(this.getActivitySignUpStartTime())) {
|
||||
sysHomeActivity.setStartDate(this.getActivitySignUpStartTime());
|
||||
sysHomeActivity.setEndDate(this.getActivitySignUpEndTime());
|
||||
|
||||
@@ -46,5 +46,10 @@ public class TrainSignUpActivityCourse {
|
||||
@Comment("课程时间")
|
||||
private Date courseDate;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT, width = 4)
|
||||
@Comment("限制人数")
|
||||
private Integer courseLimitNum;
|
||||
|
||||
private Integer hasRegisterNum;
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ public class TrainSignUpCourse extends BaseModel implements Serializable {
|
||||
private List<Double> courseLocationCoordinates;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
@Comment("课程讲师")
|
||||
private String courseInstructor;
|
||||
|
||||
@@ -71,6 +71,11 @@ public class TrainSignUpCourse extends BaseModel implements Serializable {
|
||||
@Comment("校区")
|
||||
private String campus;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Comment("报名人数是否限制")
|
||||
private Boolean courseIsLimitApply;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Comment("序号")
|
||||
@@ -137,4 +142,7 @@ public class TrainSignUpCourse extends BaseModel implements Serializable {
|
||||
@Comment("分类标识")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String assort;
|
||||
|
||||
|
||||
private String courseTimeName;
|
||||
}
|
||||
|
||||
@@ -50,12 +50,6 @@ public class TrainSignUpType extends BaseModel implements Serializable {
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isAddFamily;
|
||||
|
||||
@Column
|
||||
@Comment("本人纳入总人数")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Default("1")
|
||||
private Boolean selfAddFamily;
|
||||
|
||||
@Many(field = "typeId")
|
||||
private List<TrainMobileSignColumn> trainMobileSignColumnList;
|
||||
}
|
||||
|
||||
@@ -50,6 +50,11 @@ public class TrainSignUpUser implements Serializable {
|
||||
@Comment("报名时间")
|
||||
private Date signUpTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("活动课程时段id")
|
||||
private String activityCourseId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
@Comment("手机端报名字段和值")
|
||||
|
||||
@@ -3,10 +3,10 @@ package io.v.nutz.zhgh.trainSignUp.service;
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.service.ViService;
|
||||
import io.v.nutz.zhgh.trainSignUp.constant.TrainCourseType;
|
||||
import io.v.nutz.zhgh.trainSignUp.models.TrainSignUpActivity;
|
||||
import io.v.nutz.zhgh.trainSignUp.models.TrainSignUpCourse;
|
||||
import io.v.nutz.zhgh.trainSignUp.models.TrainSignUpUser;
|
||||
import io.v.nutz.zhgh.trainSignUp.constant.TrainCourseType;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
|
||||
-2
@@ -33,8 +33,6 @@ public interface TrainSignUpActivityStatisticsService extends ViService<TrainSig
|
||||
*/
|
||||
List<NutMap> registerUserList(String courseId);
|
||||
|
||||
List<NutMap> getTaleColumnInfo(String courseId);
|
||||
|
||||
/**
|
||||
* 该课程下的报名人员信息
|
||||
*
|
||||
|
||||
+68
-48
@@ -2,19 +2,20 @@ package io.v.nutz.zhgh.trainSignUp.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.service.impl.ViServiceImpl;
|
||||
import io.v.nutz.base.utils.MsgApi;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.sys.models.Sys_home_activity;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.data.constant.ConditionalOperational;
|
||||
import io.v.nutz.zhgh.data.constant.MatchMethod;
|
||||
import io.v.nutz.zhgh.data.model.MatchCondition;
|
||||
import io.v.nutz.zhgh.data.model.MatchConditionStructure;
|
||||
import io.v.nutz.zhgh.data.service.MatchConditionStructureService;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.service.impl.ViServiceImpl;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.zhgh.trainSignUp.models.*;
|
||||
import io.v.nutz.zhgh.trainSignUp.service.TrainSignUpActivityService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.aop.interceptor.async.Async;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
@@ -56,6 +57,9 @@ public class TrainSignUpActivityServiceImpl extends ViServiceImpl<TrainSignUpAct
|
||||
@Inject
|
||||
private MatchConditionStructureService matchConditionStructureService;
|
||||
|
||||
@Inject
|
||||
private MsgApi msgApi;
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void add(TrainSignUpActivity activity, TrainSignUpCourse course) {
|
||||
@@ -65,6 +69,7 @@ public class TrainSignUpActivityServiceImpl extends ViServiceImpl<TrainSignUpAct
|
||||
activity.setConditionStructureId(null);
|
||||
activity.setConditionStructure(null);
|
||||
}
|
||||
|
||||
dao().insert(activity);
|
||||
List<TrainSignUpCourse> courseList = activity.getCourseList();
|
||||
courseList.forEach(v -> {
|
||||
@@ -132,7 +137,6 @@ public class TrainSignUpActivityServiceImpl extends ViServiceImpl<TrainSignUpAct
|
||||
//原来的上课时间
|
||||
List<TrainSignUpActivityCourse> oldActCourseTimeList = dao().query(TrainSignUpActivityCourse.class, Cnd.where("activityId", "=", activity.getId()));
|
||||
|
||||
|
||||
update(activity);
|
||||
|
||||
List<TrainSignUpTypeLimit> typeLimits = activity.getTypeLimits();
|
||||
@@ -155,7 +159,7 @@ public class TrainSignUpActivityServiceImpl extends ViServiceImpl<TrainSignUpAct
|
||||
dao().insertOrUpdate(v);
|
||||
|
||||
List<TrainSignUpActivityCourse> courseTimeList = v.getCourseTimeList();
|
||||
if(courseTimeList != null) {
|
||||
if (courseTimeList != null) {
|
||||
courseTimeList.forEach(x -> {
|
||||
x.setActivityId(activity.getId());
|
||||
x.setCourseId(v.getId());
|
||||
@@ -185,7 +189,7 @@ public class TrainSignUpActivityServiceImpl extends ViServiceImpl<TrainSignUpAct
|
||||
//现在的上课时间
|
||||
List<String> nowCourseTimeListId = new ArrayList<>();
|
||||
activity.getCourseList().stream().forEach(v -> {
|
||||
if(v.getCourseTimeList() != null) {
|
||||
if (v.getCourseTimeList() != null) {
|
||||
nowCourseTimeListId.addAll(v.getCourseTimeList().stream().map(x -> x.getId()).collect(Collectors.toList()));
|
||||
}
|
||||
});
|
||||
@@ -262,30 +266,26 @@ public class TrainSignUpActivityServiceImpl extends ViServiceImpl<TrainSignUpAct
|
||||
List<TrainSignUpCourse> courseList = activity.getCourseList();
|
||||
|
||||
courseList.forEach(c -> {
|
||||
if(StrUtil.isNotBlank(c.getCourseType())) {
|
||||
TrainSignUpType type = dao().fetch(TrainSignUpType.class, c.getCourseType());
|
||||
dao().fetchLinks(c, "^(courseTimeList)$", Cnd.NEW().asc("courseStartTime"));
|
||||
//已报人数
|
||||
AtomicInteger hasRegisterNum = new AtomicInteger();
|
||||
List<TrainSignUpUser> signUpUsers = dao().query(TrainSignUpUser.class, Cnd.where("courseId", "=", c.getId()));
|
||||
signUpUsers.forEach(item -> {
|
||||
if(type.getSelfAddFamily()) {
|
||||
hasRegisterNum.getAndIncrement();
|
||||
}
|
||||
if(type.getIsBringFamily() && type.getIsAddFamily()) {
|
||||
List<NutMap> mapList = item.getMobileColumnsValue();
|
||||
if(Lang.isNotEmpty(mapList)) {
|
||||
NutMap nutMap = mapList.stream().filter(o -> "xdqsrs".equals(o.getString("columnCode"))).findAny().orElse(null);
|
||||
if(nutMap != null) {
|
||||
hasRegisterNum.addAndGet(nutMap.getInt("columnValue"));
|
||||
}
|
||||
TrainSignUpType type = dao().fetch(TrainSignUpType.class, StrUtil.isNotBlank(c.getCourseType()) ? c.getCourseType() : "");
|
||||
dao().fetchLinks(c, "^(courseTimeList)$", Cnd.NEW().asc("courseStartTime"));
|
||||
//已报人数
|
||||
AtomicInteger hasRegisterNum = new AtomicInteger();
|
||||
List<TrainSignUpUser> signUpUsers = dao().query(TrainSignUpUser.class, Cnd.where("courseId", "=", c.getId()));
|
||||
signUpUsers.forEach(item -> {
|
||||
hasRegisterNum.getAndIncrement();
|
||||
if (type.getIsBringFamily() && type.getIsAddFamily()) {
|
||||
List<NutMap> mapList = item.getMobileColumnsValue();
|
||||
if (Lang.isNotEmpty(mapList)) {
|
||||
NutMap nutMap = mapList.stream().filter(o -> "xdqsrs".equals(o.getString("columnCode"))).findAny().orElse(null);
|
||||
if (nutMap != null) {
|
||||
hasRegisterNum.addAndGet(nutMap.getInt("columnValue"));
|
||||
}
|
||||
}
|
||||
});
|
||||
c.setHasRegisterNum(hasRegisterNum.get());
|
||||
//当前用户是否报过
|
||||
c.setIsSign(isSignCourseByUser(c.getId(), (String) ShiroUtil.getPrincipalProperty("id")));
|
||||
}
|
||||
}
|
||||
});
|
||||
c.setHasRegisterNum(hasRegisterNum.get());
|
||||
//当前用户是否报过
|
||||
c.setIsSign(isSignCourseByUser(c.getId(), (String) ShiroUtil.getPrincipalProperty("id")));
|
||||
});
|
||||
return Lang.obj2nutmap(activity);
|
||||
}
|
||||
@@ -319,10 +319,10 @@ public class TrainSignUpActivityServiceImpl extends ViServiceImpl<TrainSignUpAct
|
||||
// case 3 -> cnd.and(new Static(" ((activityEndTime > '%s' and activityStartTime < '%s') or (activitySignUpEndTime > '%s' and activitySignUpStartTime < '%s'))"
|
||||
// .formatted(dateTime, dateTime, dateTime, dateTime)));
|
||||
}
|
||||
if("my".equals(type)) {
|
||||
if ("my".equals(type)) {
|
||||
cnd.and(new Static("id in (select activityId from train_sign_up_user where userId = '%s')".formatted(ShiroUtil.getPrincipalProperty("id"))));
|
||||
}
|
||||
cnd.and("isDisabled","=",0);
|
||||
cnd.and("isDisabled", "=", 0);
|
||||
cnd.orderBy("activityEndTime", "desc");
|
||||
cnd.orderBy("isDisabled", "desc");
|
||||
Pagination pagination = listPage(pageForm.getPageNumber(), pageForm.getPageSize(), cnd);
|
||||
@@ -341,17 +341,19 @@ public class TrainSignUpActivityServiceImpl extends ViServiceImpl<TrainSignUpAct
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void doSignUp(TrainSignUpUser trainSignUpUser) throws Exception {
|
||||
String userId = (String) ShiroUtil.getPrincipalProperty("id");
|
||||
|
||||
//查询课程
|
||||
TrainSignUpCourse course = dao().fetch(TrainSignUpCourse.class, trainSignUpUser.getCourseId());
|
||||
//查询活动
|
||||
TrainSignUpActivity activity = dao().fetch(TrainSignUpActivity.class, Cnd.where("id", "=", course.getActivityId()));
|
||||
|
||||
//如果这个课程的预留名额方式为报名人数不变
|
||||
if(course.getReserveMode() == 2) {
|
||||
if (course.getReserveMode() == 2) {
|
||||
//如果当前报名+已报小于这个课程限制人数
|
||||
//课程已报人数
|
||||
List<TrainSignUpUser> signUpUsers = dao().query(TrainSignUpUser.class, Cnd.where("courseId", "=", trainSignUpUser.getCourseId()));
|
||||
int hasRegisterNum = signUpUsers.size() + 1;//+1是算自己
|
||||
if(hasRegisterNum > course.getCoursePeopleNumber()) {
|
||||
if (hasRegisterNum > course.getCoursePeopleNumber()) {
|
||||
trainSignUpUser.setState(2);
|
||||
} else {
|
||||
trainSignUpUser.setState(1);
|
||||
@@ -361,12 +363,31 @@ public class TrainSignUpActivityServiceImpl extends ViServiceImpl<TrainSignUpAct
|
||||
}
|
||||
|
||||
if(StrUtil.isBlank(trainSignUpUser.getUserId())) {
|
||||
trainSignUpUser.setUserId(userId);
|
||||
trainSignUpUser.setUserId((String) ShiroUtil.getPrincipalProperty("id"));
|
||||
}
|
||||
trainSignUpUser.setSignUpTime(new Date());
|
||||
|
||||
dao().insert(trainSignUpUser);
|
||||
asyncInsertUserCourse(trainSignUpUser.getActivityId(), trainSignUpUser.getCourseId(), userId);
|
||||
if (StrUtil.isNotBlank(trainSignUpUser.getActivityCourseId())) {
|
||||
TrainSignUpActivityCourse fetch = dao().fetch(TrainSignUpActivityCourse.class, trainSignUpUser.getActivityCourseId());
|
||||
TrainSignUpUserCourse userCourse = new TrainSignUpUserCourse();
|
||||
userCourse.setActivityId(trainSignUpUser.getActivityId());
|
||||
userCourse.setCourseId(trainSignUpUser.getCourseId());
|
||||
userCourse.setUserId(trainSignUpUser.getUserId());
|
||||
userCourse.setCourseStartTime(fetch.getCourseStartTime());
|
||||
userCourse.setCourseEndTime(fetch.getCourseEndTime());
|
||||
userCourse.setAttend(false);
|
||||
userCourse.setAttendTime(null);
|
||||
userCourse.setActivityCourseId(fetch.getId());
|
||||
dao().insert(userCourse);
|
||||
} else {
|
||||
asyncInsertUserCourse(trainSignUpUser.getActivityId(), trainSignUpUser.getCourseId(), trainSignUpUser.getUserId());
|
||||
}
|
||||
|
||||
String username = ShiroUtil.getPlatformUsername();
|
||||
String description = username + "老师您好,您已成功报名(" + activity.getActivityName() + course.getCourseName() +"),请您按时参加";
|
||||
// msgApi.sendWxMsg("活动报名通知", "", "text", description, List.of(ShiroUtil.getPlatformLoginname()), null);
|
||||
// msgApi.sendWxMsg("");
|
||||
}
|
||||
|
||||
@Async
|
||||
@@ -427,18 +448,18 @@ public class TrainSignUpActivityServiceImpl extends ViServiceImpl<TrainSignUpAct
|
||||
sql.setCondition(cnd);
|
||||
//已经报名人数,这是教职工的
|
||||
List<NutMap> signUpUsers = listMap(sql);
|
||||
int hasRegisterNum = signUpType.getSelfAddFamily() ? signUpUsers.size() + 1 : 0;//+1是算自己
|
||||
int hasRegisterNum = signUpUsers.size() + 1;//+1是算自己
|
||||
//课程已报人数(携带的家属)
|
||||
int hasFamilyNum = 0;
|
||||
//如果携带家属,并且纳入人数,则mdzz
|
||||
if(signUpType.getIsAddFamily() && signUpType.getIsBringFamily()) {
|
||||
if (signUpType.getIsAddFamily() && signUpType.getIsBringFamily()) {
|
||||
//如果携带家属,已报人数=教职工+每个教职工携带的家属
|
||||
AtomicInteger num = new AtomicInteger();
|
||||
signUpUsers.forEach(item -> {
|
||||
List<NutMap> mapList = item.getAsList("", NutMap.class);
|
||||
if(Lang.isNotEmpty(mapList)) {
|
||||
if (Lang.isNotEmpty(mapList)) {
|
||||
NutMap nutMap = mapList.stream().filter(o -> "xdqsrs".equals(o.getString("columnCode"))).findAny().orElse(null);
|
||||
if(nutMap != null) {
|
||||
if (nutMap != null) {
|
||||
num.addAndGet(nutMap.getInt("columnValue"));
|
||||
}
|
||||
}
|
||||
@@ -459,18 +480,17 @@ public class TrainSignUpActivityServiceImpl extends ViServiceImpl<TrainSignUpAct
|
||||
int coursePeopleNumber = course.getCoursePeopleNumber();
|
||||
//课程已报人数
|
||||
List<TrainSignUpUser> signUpUsers = dao().query(TrainSignUpUser.class, Cnd.where("courseId", "=", courseId));
|
||||
//如果本人纳入总人数,则正常,但是如果不纳入,统计报名人数的时候就不算
|
||||
int hasRegisterNum = type.getSelfAddFamily() ? signUpUsers.size() + 1 : 0;//+1是算自己
|
||||
int hasRegisterNum = signUpUsers.size() + 1;//+1是算自己
|
||||
//课程已报人数(携带的家属)
|
||||
int hasFamilyNum = 0;
|
||||
//如果这个类型携带家属并且计入总人数
|
||||
if(type.getIsBringFamily() && type.getIsAddFamily()) {
|
||||
if (type.getIsBringFamily() && type.getIsAddFamily()) {
|
||||
AtomicInteger num = new AtomicInteger();
|
||||
signUpUsers.forEach(item -> {
|
||||
List<NutMap> mapList = item.getMobileColumnsValue();
|
||||
if(Lang.isNotEmpty(mapList)) {
|
||||
if (Lang.isNotEmpty(mapList)) {
|
||||
NutMap nutMap = mapList.stream().filter(o -> "xdqsrs".equals(o.getString("columnCode"))).findAny().orElse(null);
|
||||
if(nutMap != null) {
|
||||
if (nutMap != null) {
|
||||
num.addAndGet(nutMap.getInt("columnValue"));
|
||||
}
|
||||
}
|
||||
@@ -478,10 +498,10 @@ public class TrainSignUpActivityServiceImpl extends ViServiceImpl<TrainSignUpAct
|
||||
hasFamilyNum = num.get() + (currentFamilyNumber != null ? currentFamilyNumber : 0);//currentFamilyNumber是当前报名时填的家属人数
|
||||
}
|
||||
//如果预留名额模式是报名人数减少
|
||||
if(course.getReserveMode() == 1) {
|
||||
if (course.getReserveMode() == 1) {
|
||||
//如果已报人数+预留人数+当前报名(自己)+家属 > 总人数
|
||||
return (hasRegisterNum + course.getCourseReservedNumber() + hasFamilyNum) > coursePeopleNumber;
|
||||
}else {//如果预留名额模式是报名人数不变
|
||||
} else {//如果预留名额模式是报名人数不变
|
||||
//如果已报人数+当前报名(自己)+家属 > 总人数+预留人数
|
||||
return (hasRegisterNum + hasFamilyNum) > (coursePeopleNumber + course.getCourseReservedNumber());
|
||||
}
|
||||
@@ -515,7 +535,7 @@ public class TrainSignUpActivityServiceImpl extends ViServiceImpl<TrainSignUpAct
|
||||
return true;
|
||||
} else if (activity.getRestrictLimit() == 2) {
|
||||
TrainSignUpTypeLimit trainSignUpTypeLimit = dao().fetch(TrainSignUpTypeLimit.class, Cnd.where("typeId", "=", courseType).and("activityId", "=", activityId));
|
||||
if(trainSignUpTypeLimit == null) {
|
||||
if (trainSignUpTypeLimit == null) {
|
||||
return true;
|
||||
}
|
||||
//此类型的班最多可报几项
|
||||
|
||||
+4
-63
@@ -1,31 +1,23 @@
|
||||
package io.v.nutz.zhgh.trainSignUp.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.base.dao.CndPlus;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.service.impl.ViServiceImpl;
|
||||
import io.v.nutz.zhgh.trainSignUp.models.TrainMobileSignColumn;
|
||||
import io.v.nutz.zhgh.trainSignUp.models.TrainSignUpCourse;
|
||||
import io.v.nutz.zhgh.trainSignUp.models.TrainSignUpType;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.zhgh.trainSignUp.models.TrainSignUpUser;
|
||||
import io.v.nutz.zhgh.trainSignUp.service.TrainSignUpActivityStatisticsService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -50,9 +42,6 @@ public class TrainSignUpActivityStatisticsServiceImpl extends ViServiceImpl<Trai
|
||||
tsuc.coursePeopleNumber,
|
||||
tsuc.courseReservedNumber,
|
||||
type.lxname as courseType,
|
||||
type.isBringFamily,
|
||||
type.isAddFamily,
|
||||
type.selfAddFamily,
|
||||
tsuc.courseLocation,
|
||||
tsuc.courseInstructor,
|
||||
tsuc.reserveMode,
|
||||
@@ -67,32 +56,7 @@ public class TrainSignUpActivityStatisticsServiceImpl extends ViServiceImpl<Trai
|
||||
ORDER BY tsuc.orderNum
|
||||
""");
|
||||
sql.setParam("activityId", activityId);
|
||||
|
||||
Pagination list = list(pageForm, sql);
|
||||
List<NutMap> listMap = list.getList(NutMap.class);
|
||||
|
||||
//找活动报的人
|
||||
List<TrainSignUpUser> upUsers = dao().query(TrainSignUpUser.class, Cnd.where("activityId", "=", activityId));
|
||||
Map<String, List<TrainSignUpUser>> signUsers = upUsers.stream().collect(Collectors.groupingBy(TrainSignUpUser::getCourseId));
|
||||
|
||||
for (NutMap item : listMap) {
|
||||
AtomicReference<Integer> familyCount = new AtomicReference<>(0);
|
||||
List<TrainSignUpUser> users = signUsers.get(item.getString("id"));
|
||||
if (Lang.isNotEmpty(users)) {
|
||||
users.forEach(u -> {
|
||||
List<NutMap> mobileColumnsValue = u.getMobileColumnsValue();
|
||||
if (Lang.isNotEmpty(mobileColumnsValue)) {
|
||||
NutMap nutMap = mobileColumnsValue.stream().filter(o -> "xdqsrs".equals(o.getString("columnCode"))).findFirst().orElse(null);
|
||||
if (nutMap != null) {
|
||||
familyCount.updateAndGet(v -> v + (StrUtil.isNotBlank(nutMap.getString("columnValue")) ? nutMap.getInt("columnValue") : 0));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
item.setv("familyCount", familyCount.get());
|
||||
}
|
||||
list.setList(listMap);
|
||||
return list;
|
||||
return list(pageForm, sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -106,8 +70,7 @@ public class TrainSignUpActivityStatisticsServiceImpl extends ViServiceImpl<Trai
|
||||
u.sex,
|
||||
u.mobile,
|
||||
tsuu.signUpTime,
|
||||
tsuu.state,
|
||||
tsuu.mobileColumnsValue
|
||||
tsuu.state
|
||||
FROM
|
||||
train_sign_up_user tsuu
|
||||
LEFT JOIN `user` u ON u.id = tsuu.userId
|
||||
@@ -117,29 +80,7 @@ public class TrainSignUpActivityStatisticsServiceImpl extends ViServiceImpl<Trai
|
||||
CndPlus cnd = new CndPlus();
|
||||
cnd.andEx("tsuu.courseId", "=", courseId);
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = listMap(sql);
|
||||
list.forEach(o -> {
|
||||
if(StrUtil.isNotBlank(o.getString("mobileColumnsValue"))) {
|
||||
List<NutMap> mobileColumnsValue = Json.fromJsonAsList(NutMap.class, o.getString("mobileColumnsValue"));
|
||||
if(Lang.isNotEmpty(mobileColumnsValue)) {
|
||||
mobileColumnsValue.forEach(m -> {
|
||||
o.put(m.getString("columnCode"), m.getString("columnValue"));
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NutMap> getTaleColumnInfo(String courseId) {
|
||||
TrainSignUpCourse course = dao().fetch(TrainSignUpCourse.class, courseId);
|
||||
TrainSignUpType upType = dao().fetch(TrainSignUpType.class, course.getCourseType());
|
||||
dao().fetchLinks(upType, "trainMobileSignColumnList", Cnd.NEW().asc("columnIndex"));
|
||||
|
||||
List<TrainMobileSignColumn> columnList = upType.getTrainMobileSignColumnList();
|
||||
List<NutMap> columnTableList = columnList.stream().map(o -> NutMap.NEW().setv("label", o.getColumnName()).setv("prop", o.getColumnCode())).collect(Collectors.toList());
|
||||
return columnTableList;
|
||||
return listMap(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user