commit
This commit is contained in:
+162
@@ -0,0 +1,162 @@
|
||||
package com.budwk.app.zhgh.democratic.teachercongress.delegate.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.sys.views.View_user;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.democratic.teachercongress.delegate.models.TeacherCongressDelegatePush;
|
||||
import com.budwk.app.zhgh.democratic.teachercongress.delegate.models.Teacher_congress_delegate;
|
||||
import io.swagger.annotations.Api;
|
||||
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.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.Period;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2025/9/22 20:41
|
||||
* @description
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/teacherCongress/delegate/push")
|
||||
@Ok("json:full")
|
||||
@Api(value = "/platform/teacherCongress/delegate/push", tags = "教代会代表推选")
|
||||
public class TeacherCongressDelegatePushController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/democratic/teachercongress/delegate/push/index.html")
|
||||
@SaCheckPermission("tc.delegate.push")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取本分工会下的非代表用户
|
||||
*
|
||||
* @param sessionId
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission("tc.delegate.push")
|
||||
@SLog(tag = "民主管理-教代会代表推选", msg = "获取本分工会下的非代表用户")
|
||||
public Result getUnionUser(String sessionId, String unionId) {
|
||||
// 查询预选中的代表
|
||||
Cnd cndx = Cnd.where("sessionId", "=", sessionId);
|
||||
cndx.andEX("unionId", "=", SecurityUtil.getUnionId());
|
||||
List<Teacher_congress_delegate> delegateList = dao.query(Teacher_congress_delegate.class, cndx);
|
||||
// u.professionalTitle,
|
||||
// u.professionalLevel,
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.id AS userId,
|
||||
u.loginname as loginName,
|
||||
u.username as userName,
|
||||
|
||||
u.sex,
|
||||
u.birthday,
|
||||
u.nation,
|
||||
TIMESTAMPDIFF(YEAR, u.birthday, CURDATE()) AS age
|
||||
FROM
|
||||
`vw_user` u
|
||||
LEFT JOIN teacher_congress_delegate tcd ON tcd.userId = u.id
|
||||
AND tcd.sessionId = @sessionId
|
||||
LEFT JOIN teacher_congress_delegate_push tcdp ON tcdp.userId = tcdp.id
|
||||
AND tcdp.sessionId = @sessionId
|
||||
$condition
|
||||
""");
|
||||
sql.setParam("sessionId", sessionId);
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("u.member", "=", 1);
|
||||
cnd.and("tcd.userId", "is", null);
|
||||
cnd.and("tcdp.id", "is", null);
|
||||
cnd.and("u.unionId", "=", SecurityUtil.getUnionId());
|
||||
sql.setCondition(cnd);
|
||||
List userList = baseService.listMap(sql);
|
||||
return Result.success(Map.of("userData", userList, "userValue", delegateList));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 推选代表
|
||||
*/
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Object addPreselectionDb(@Param("userValue") String[] userValue, String sessionId, String representativeType) {
|
||||
List<TeacherCongressDelegatePush> list = new ArrayList<>();
|
||||
for (String id : userValue) {
|
||||
View_user user = dao.fetch(View_user.class, Cnd.where("id", "=", id));
|
||||
|
||||
TeacherCongressDelegatePush tmd = new TeacherCongressDelegatePush();
|
||||
tmd.setUserId(user.getId());
|
||||
tmd.setSessionId(sessionId);
|
||||
tmd.setDelegationId(null);
|
||||
tmd.setUserName(user.getUsername());
|
||||
tmd.setLoginName(user.getLoginname());
|
||||
tmd.setSex(user.getSex());
|
||||
tmd.setNation(user.getNation());
|
||||
tmd.setEducation(user.getEducation());
|
||||
tmd.setAcademicDegree(user.getAcademicDegree());
|
||||
tmd.setPolitical(user.getPolitical());
|
||||
tmd.setProfessionalTitle(user.getProfessionalTitle());
|
||||
tmd.setProfessionalLevel(user.getProfessionalLevel());
|
||||
|
||||
tmd.setBirthday(user.getBirthday());
|
||||
tmd.setUnitId(user.getUnitId());
|
||||
tmd.setUnitName(user.getUnitName());
|
||||
tmd.setUnionId(user.getUnionId());
|
||||
tmd.setUnionName(user.getUnionName());
|
||||
|
||||
tmd.setOrdinaryTeacher(false);
|
||||
tmd.setSeniorTeacher(false);
|
||||
tmd.setSchoolLeader(false);
|
||||
tmd.setMiddleLevelLeader(false);
|
||||
|
||||
tmd.setMobile(user.getMobile());
|
||||
|
||||
tmd.setIsJdh(true);
|
||||
tmd.setIsGdh(false);
|
||||
tmd.setRepresentativeType(representativeType);
|
||||
if (ObjectUtil.isNotEmpty(user.getBirthday())) {
|
||||
Date birthdayDate = user.getBirthday();
|
||||
LocalDate birthday = birthdayDate.toInstant()
|
||||
.atZone(ZoneId.systemDefault())
|
||||
.toLocalDate();
|
||||
|
||||
LocalDate currentDate = LocalDate.now();
|
||||
int age = Period.between(birthday, currentDate).getYears();
|
||||
tmd.setAge(age);
|
||||
}
|
||||
tmd.setPushTime(new Date());
|
||||
list.add(tmd);
|
||||
}
|
||||
dao.insert(list);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+186
@@ -0,0 +1,186 @@
|
||||
package com.budwk.app.zhgh.democratic.teachercongress.delegate.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2025/9/22 20:40
|
||||
* @description 代表推选表
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("teacher_congress_delegate_push")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
@Comment("代表推选表")
|
||||
public class TeacherCongressDelegatePush extends BaseModel {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("代表用户ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@Comment("所属教代会ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String sessionId;
|
||||
|
||||
@Column
|
||||
@Comment("所属代表团 当用户为校领导是该字段不为空")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String delegationId;
|
||||
|
||||
@Column
|
||||
@Comment("姓名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String userName;
|
||||
|
||||
@Column
|
||||
@Comment("工号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String loginName;
|
||||
|
||||
@Column
|
||||
@Comment("性别")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 2)
|
||||
private String sex;
|
||||
|
||||
@Column
|
||||
@Comment("出生日期")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date birthday;
|
||||
|
||||
@Column
|
||||
@Comment("民族")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 10)
|
||||
private String nation;
|
||||
|
||||
@Column
|
||||
@Comment("政治面貌")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String political;
|
||||
|
||||
@Column
|
||||
@Comment("学历")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String education;
|
||||
|
||||
@Column
|
||||
@Comment("学位")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String academicDegree;
|
||||
|
||||
@Column
|
||||
@Comment("职称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String professionalTitle;
|
||||
|
||||
@Column
|
||||
@Comment("职级")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String professionalLevel;
|
||||
|
||||
@Column
|
||||
@Comment("是否专任教师")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Default("0")
|
||||
private Boolean ordinaryTeacher;
|
||||
|
||||
@Column
|
||||
@Comment("是否高级职称专任教师")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Default("0")
|
||||
private Boolean seniorTeacher;
|
||||
|
||||
@Column
|
||||
@Comment("是否校领导")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Default("0")
|
||||
private Boolean schoolLeader;
|
||||
|
||||
@Column
|
||||
@Comment("是否中层领导")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Default("0")
|
||||
private Boolean middleLevelLeader;
|
||||
|
||||
@Column
|
||||
@Comment("行政职称===>position")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String administrativeTitle;
|
||||
|
||||
@Column
|
||||
@Comment("年龄")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer age;
|
||||
|
||||
@Column
|
||||
@Comment("单位ID")
|
||||
@ColDefine(type = ColType.VARCHAR)
|
||||
private String unitId;
|
||||
|
||||
@Column
|
||||
@Comment("单位名称")
|
||||
@ColDefine(type = ColType.VARCHAR)
|
||||
private String unitName;
|
||||
|
||||
@Column
|
||||
@Comment("分工会ID")
|
||||
@ColDefine(type = ColType.VARCHAR)
|
||||
private String unionId;
|
||||
|
||||
@Column
|
||||
@Comment("分工会名称")
|
||||
@ColDefine(type = ColType.VARCHAR)
|
||||
private String unionName;
|
||||
|
||||
@Column
|
||||
@Comment("手机号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String mobile;
|
||||
|
||||
@Column
|
||||
@Comment("推送时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date pushTime;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("教代会代表类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String roleId;
|
||||
|
||||
@Column
|
||||
@Comment("教代会")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isJdh;
|
||||
|
||||
@Column
|
||||
@Comment("工代会")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isGdh;
|
||||
|
||||
@Column
|
||||
@Comment("备注")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String bz;
|
||||
|
||||
@Column
|
||||
@Comment("代表类型(正式代表 列席代表)")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 4)
|
||||
private String representativeType;
|
||||
}
|
||||
Reference in New Issue
Block a user