人员、品牌活动、答题、单身教工
This commit is contained in:
+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);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user