first commit
This commit is contained in:
@@ -0,0 +1,288 @@
|
||||
package io.v.nutz.workersCongress.controller;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.Roles;
|
||||
import io.v.nutz.dao.CndPlus;
|
||||
import io.v.nutz.jdh.model.db.Jdh_db;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.service.ViService;
|
||||
import io.v.nutz.sys.models.Sys_user_role;
|
||||
import io.v.nutz.sys.services.SysUserRoleService;
|
||||
import io.v.nutz.sys.services.SysUserService;
|
||||
import io.v.nutz.workersCongress.model.Delegation;
|
||||
import io.v.nutz.workersCongress.model.WorkersCongressRepresentative;
|
||||
import io.v.nutz.workersCongress.services.WorkersCongressRepresentativeService;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
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.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.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
import org.nutz.trans.Trans;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/7/30 11:20
|
||||
* @description 工代会代表
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/workersCongress/delegate")
|
||||
@RequiresAuthentication
|
||||
public class DelegateController {
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:platform/workersCongress/Delegate.html")
|
||||
@RequiresPermissions("sys.workersCongress.delegate")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@Inject
|
||||
private WorkersCongressRepresentativeService workersCongressRepresentativeService;
|
||||
|
||||
@Inject("Delegation")
|
||||
private ViService<Delegation> delegationViService;
|
||||
|
||||
@Inject("Jdh_db")
|
||||
private ViService<Jdh_db> jdhDbViService;
|
||||
|
||||
@Inject
|
||||
private SysUserService sysUserService;
|
||||
|
||||
|
||||
@Inject
|
||||
private SysUserRoleService sysUserRoleService;
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object pageData(PageForm page, String gdh_id, String dbt_id, String unionId, String unitId, String dbsf) {
|
||||
CndPlus cnd = CndPlus.create();
|
||||
if (Strings.isNotBlank(page.getSearchName()) && Strings.isNotBlank(page.getSearchKeyword())) {
|
||||
cnd.and(page.getSearchName(), "like", "%" + page.getSearchKeyword() + "%");
|
||||
}
|
||||
cnd.andExcludeEmpty("wo.gdh_id", "=", gdh_id);
|
||||
cnd.andExcludeEmpty("wo.roleId", "=", dbsf);
|
||||
cnd.andExcludeEmpty("wo.dbt_id", "=", dbt_id);
|
||||
cnd.andExcludeEmpty("u.unionid", "=", unionId);
|
||||
cnd.andExcludeEmpty("u.unitId", "=", unitId);
|
||||
cnd.asc("u.unionid");
|
||||
return workersCongressRepresentativeService.queryData(cnd, page, true);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doAdd(@Param("userData") String[] userData, String gdh_id, String dbt_id, String roleId) {
|
||||
|
||||
for (String userId : userData) {
|
||||
WorkersCongressRepresentative workers = new WorkersCongressRepresentative();
|
||||
workers.setUserId(userId);
|
||||
workers.setDbt_id(dbt_id);
|
||||
workers.setGdh_id(gdh_id);
|
||||
workers.setRoleId(roleId);
|
||||
workersCongressRepresentativeService.insert(workers);
|
||||
Sys_user_role sys_user_role = new Sys_user_role();
|
||||
sys_user_role.setUserId(userId);
|
||||
sys_user_role.setRoleId(roleId);
|
||||
sys_user_role.setDbtid(dbt_id);
|
||||
sys_user_role.setJdhid(gdh_id);
|
||||
sysUserRoleService.insert(sys_user_role);
|
||||
sysUserService.clearCache();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
public void doExcel(String gdhId, String gdhAllName, String dbtId, HttpServletResponse response) throws IOException {
|
||||
CndPlus cnd = CndPlus.create();
|
||||
|
||||
cnd.andExcludeEmpty("wo.gdh_id", "=", gdhId);
|
||||
cnd.andExcludeEmpty("wo.dbt_id", "=", dbtId);
|
||||
|
||||
cnd.asc("u.unionid");
|
||||
List<WorkersCongressRepresentativeService.db_excel_data> dbList = (List<WorkersCongressRepresentativeService.db_excel_data>) workersCongressRepresentativeService.queryData(cnd, null, true);
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + new String((gdhAllName + "代表名单.xls").getBytes("utf-8"), "ISO8859-1"));
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), WorkersCongressRepresentativeService.db_excel_data.class, dbList);
|
||||
workbook.write(response.getOutputStream());
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object userDoDelete(String userId, String dbt_id, String gdh_id, String roleId) {
|
||||
Trans.exec(() -> {
|
||||
sysUserRoleService.clear(Cnd.where("userid", "=", userId)
|
||||
.and("dbtid", "=", dbt_id)
|
||||
.and("jdhid", "=", gdh_id)
|
||||
.and("roleid", "=", roleId));
|
||||
workersCongressRepresentativeService.clear(Cnd.where("userId", "=", userId).and("dbt_id", "=", dbt_id).and("gdh_id", "=", gdh_id));
|
||||
sysUserService.clearCache();
|
||||
});
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doDeleteUserList(String[] userData, String dbt_id, String gdh_id) {
|
||||
Trans.exec(() -> {
|
||||
for (String userId : userData) {
|
||||
CndPlus cnd = CndPlus.create();
|
||||
CndPlus cnd2 = CndPlus.create();
|
||||
cnd.andExcludeEmpty("dbt_id", "=", dbt_id);
|
||||
cnd.andExcludeEmpty("userid", "=", userId);
|
||||
cnd.andExcludeEmpty("gdh_id", "=", gdh_id);
|
||||
cnd.andExcludeEmpty("roleid", "=", Roles.GDHDB);
|
||||
cnd2.andExcludeEmpty("dbtid", "=", dbt_id);
|
||||
cnd2.andExcludeEmpty("userid", "=", userId);
|
||||
cnd2.andExcludeEmpty("jdhid", "=", gdh_id);
|
||||
cnd2.andExcludeEmpty("roleid", "=", Roles.GDHDB);
|
||||
sysUserRoleService.clear(cnd2);
|
||||
workersCongressRepresentativeService.clear(cnd);
|
||||
sysUserService.clearCache();
|
||||
}
|
||||
});
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 可选代表
|
||||
*
|
||||
* @param dbt_id
|
||||
* @param gdh_id
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getUserDbChange(String dbt_id, String gdh_id) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.id,
|
||||
u.username,
|
||||
u.loginname,
|
||||
u.unionname,
|
||||
u.unitname
|
||||
FROM
|
||||
`user` u
|
||||
WHERE
|
||||
u.unionid IN ( SELECT union_id FROM workers_congress_delegation_make_up_union upunion WHERE gdh_id = @gdh_id AND dbt_id = @dbt_id )
|
||||
AND u.id NOT IN ( SELECT userId FROM workers_congress_representative )
|
||||
|
||||
""").setParam("dbt_id", dbt_id).setParam("gdh_id", gdh_id);
|
||||
return delegationViService.list(sql);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object queryXldUser(String query, String gdhid) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.id,
|
||||
u.username,
|
||||
u.loginname,
|
||||
u.unionname,
|
||||
u.unitname,
|
||||
u.sex
|
||||
FROM
|
||||
`user` u
|
||||
WHERE
|
||||
id NOT IN
|
||||
(
|
||||
SELECT
|
||||
wcr.userId
|
||||
FROM
|
||||
`workers_congress_representative` wcr
|
||||
LEFT JOIN `user` u ON u.id = wcr.userId WHERE wcr.gdh_id=@gdhid AND (u.username LIKE @query OR u.loginname LIKE @query
|
||||
))
|
||||
AND (u.username LIKE @query OR u.loginname LIKE @query)
|
||||
|
||||
|
||||
""").setParam("gdhid", gdhid).setParam("query", "%" + query + "%");
|
||||
return sysUserService.listMap(sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Object fpXldToDbt(@Param("::user") List<NutMap> userMapList, String gdhid) {
|
||||
userMapList.forEach(v -> {
|
||||
WorkersCongressRepresentative workers = new WorkersCongressRepresentative();
|
||||
workers.setUserId(v.getString("id"));
|
||||
workers.setDbt_id(v.getString("dbtid"));
|
||||
workers.setGdh_id(gdhid);
|
||||
workers.setRoleId(Roles.GDHDB);
|
||||
workersCongressRepresentativeService.insert(workers);
|
||||
Sys_user_role sys_user_role = new Sys_user_role();
|
||||
sys_user_role.setUserId(v.getString("id"));
|
||||
sys_user_role.setRoleId(Roles.GDHDB);
|
||||
sys_user_role.setDbtid(v.getString("dbtid"));
|
||||
sys_user_role.setJdhid(gdhid);
|
||||
sysUserRoleService.insert(sys_user_role);
|
||||
sysUserService.clearCache();
|
||||
});
|
||||
return null;
|
||||
}
|
||||
|
||||
@At("/representativeInfo/?")
|
||||
@ViReturn
|
||||
public Object representativeInfo(String id) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
db.*,
|
||||
u.username,
|
||||
u.loginname
|
||||
FROM
|
||||
workers_congress_representative db
|
||||
left join sys_user u on db.userId = u.id
|
||||
WHERE
|
||||
db.id = @id
|
||||
""").setParam("id", id);
|
||||
return workersCongressRepresentativeService.fetch(sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object representativeRoleOptions() {
|
||||
return List.of(
|
||||
Map.of("label", "正式代表", "value", Roles.GDHDB),
|
||||
Map.of("label", "列席代表", "value", Roles.GDHLX),
|
||||
Map.of("label", "特邀代表", "value", Roles.GDHTY)
|
||||
);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object modifyRepresentativeInfo(WorkersCongressRepresentative db) {
|
||||
WorkersCongressRepresentative workersCongressRepresentative = workersCongressRepresentativeService.fetch(Cnd.where("userId", "=", db.getUserId()).and("gdh_id", "=", db.getGdh_id()));
|
||||
sysUserRoleService.update(Chain.make("roleId", db.getRoleId()), Cnd.where("jdhid", "=", db.getGdh_id()).and("userId", "=", db.getUserId()).and("roleid", "=", workersCongressRepresentative.getRoleId()));
|
||||
workersCongressRepresentativeService.updateIgnoreNull(db);
|
||||
sysUserService.deleteCache(db.getUserId());
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package io.v.nutz.workersCongress.controller;
|
||||
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.service.ViService;
|
||||
import io.v.nutz.workersCongress.model.Delegation;
|
||||
import io.v.nutz.workersCongress.model.WorkersCongressSession;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/8/2 11:47
|
||||
* @description
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/gdh/Common")
|
||||
@Ok("json:full")
|
||||
public class GdhCommonController {
|
||||
|
||||
@Inject("Delegation")
|
||||
private ViService<Delegation> delegationViService;
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@At
|
||||
public Object getOpenGdh() {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("startState", "=", true).desc("year");
|
||||
List<WorkersCongressSession> query = dao.query(WorkersCongressSession.class,cnd);
|
||||
return Result.success(query);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取工代会代表团
|
||||
*
|
||||
* @param jdhId
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getDbt(String jdhId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
dbt.*
|
||||
FROM
|
||||
workers_congress_delegation dbt
|
||||
LEFT JOIN sys_dict dict ON dict.`name` = dbt.dbt_name
|
||||
WHERE
|
||||
dbt.gdh_id = @gdh_id
|
||||
ORDER BY
|
||||
dict.`code`
|
||||
""").setParam("gdh_id", jdhId);
|
||||
return delegationViService.list(sql);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,370 @@
|
||||
package io.v.nutz.workersCongress.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.base.utils.Roles;
|
||||
import io.v.nutz.dao.CndPlus;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.service.ViService;
|
||||
import io.v.nutz.sys.models.Sys_dict;
|
||||
import io.v.nutz.sys.models.Sys_user_role;
|
||||
import io.v.nutz.sys.services.SysDictService;
|
||||
import io.v.nutz.sys.services.SysRoleService;
|
||||
import io.v.nutz.sys.services.SysUserRoleService;
|
||||
import io.v.nutz.workersCongress.model.Delegation;
|
||||
import io.v.nutz.workersCongress.model.WorkersCongressDelegationMakeUpUnion;
|
||||
import io.v.nutz.workersCongress.model.WorkersCongressRepresentative;
|
||||
import io.v.nutz.workersCongress.services.WorkersCongressRepresentativeService;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/8/2 11:14
|
||||
* @description 代表团管理
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/workersCongress/delegation")
|
||||
@RequiresAuthentication
|
||||
public class GdhDelegationController {
|
||||
|
||||
private static final String SYS_DICT_DBT_ID = "9373a8db35ca428f9b24d7ceac96a550";
|
||||
private static final String JDH_DBT_TZ_ROLE_ID = "c1765c03459840c2b621d140f575c869";
|
||||
private static final String JDH_DBT_FTZ_ROLE_ID = "6445f21685c5489aa212a986cfbeecce";
|
||||
|
||||
@Inject("Delegation")
|
||||
private ViService<Delegation> delegationViService;
|
||||
|
||||
@Inject("WorkersCongressRepresentative")
|
||||
private ViService<WorkersCongressRepresentative> representativeViService;
|
||||
|
||||
@Inject("WorkersCongressDelegationMakeUpUnion")
|
||||
private ViService<WorkersCongressDelegationMakeUpUnion> makeUpUnionViService;
|
||||
|
||||
|
||||
@Inject
|
||||
private WorkersCongressRepresentativeService workersCongressRepresentativeService;
|
||||
|
||||
@Inject
|
||||
private SysDictService sysDictService;
|
||||
|
||||
@Inject
|
||||
private SysRoleService sysRoleService;
|
||||
@Inject
|
||||
private SysUserRoleService sysUserRoleService;
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:platform/workersCongress/Delegation.html")
|
||||
@RequiresPermissions("sys.workersCongress.delegation")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
public Object getDbtFind(String gdh_id) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
dict.id,
|
||||
dict.`name`,
|
||||
dict.code
|
||||
FROM
|
||||
sys_dict dict
|
||||
WHERE
|
||||
dict.`parentId` = @dbt_id
|
||||
AND dict.`name` NOT IN ( SELECT dbt.dbt_name FROM workers_congress_delegation dbt WHERE dbt.`gdh_id` = @gdh_id )
|
||||
ORDER BY
|
||||
`code`
|
||||
""");
|
||||
sql.setParam("dbt_id", SYS_DICT_DBT_ID);
|
||||
sql.setParam("gdh_id", gdh_id);
|
||||
return delegationViService.list(sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doAddDbt(String gdh_id, String[] dbtList) {
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
List<Sys_dict> dictList = sysDictService.query(cnd.and("id", "in", dbtList));
|
||||
dictList.forEach(v -> {
|
||||
Delegation dbt = new Delegation();
|
||||
dbt.setGdh_id(gdh_id);
|
||||
dbt.setDbt_name(v.getName());
|
||||
dbt.setCode(v.getCode());
|
||||
dbt.setFound_time(DateUtil.getDate());
|
||||
delegationViService.insert(dbt);
|
||||
});
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object pageData(PageForm page, String gdh_id, String dbt_id) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
dbt.*,
|
||||
gdh.gdhAllName,
|
||||
tzu.username tzUserName,
|
||||
(
|
||||
SELECT
|
||||
GROUP_CONCAT( ftzu.username )
|
||||
FROM
|
||||
sys_user_role ftzr
|
||||
LEFT JOIN sys_user ftzu ON ftzu.id = ftzr.userId
|
||||
WHERE
|
||||
ftzr.dbtid = dbt.id
|
||||
AND ftzr.roleId = @ftzRoleId
|
||||
) ftzUserName
|
||||
FROM
|
||||
`workers_congress_delegation` dbt
|
||||
LEFT JOIN workers_congress_session gdh ON gdh.id = dbt.gdh_id
|
||||
LEFT JOIN sys_user_role tzr ON tzr.dbtid = dbt.id
|
||||
AND tzr.roleId = @tzRoleId
|
||||
LEFT JOIN sys_user tzu ON tzu.id = tzr.userId
|
||||
$condition
|
||||
""").setParam("ftzRoleId", Roles.DBT_FTZ).setParam("tzRoleId", Roles.DBT_TZ);
|
||||
CndPlus cnd = CndPlus.create();
|
||||
cnd.andExcludeEmpty("dbt.gdh_id", "=", gdh_id);
|
||||
cnd.andExcludeEmpty("dbt.id", "=", dbt_id);
|
||||
cnd.asc("dbt.code");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = delegationViService.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
return Result.success().addData(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object undertakeUnionTree(String gdh_id) {
|
||||
Record record = new Record();
|
||||
record.set("dbt_name", "工代会代表团");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
dbt.*,gdh.gdhAllName
|
||||
FROM
|
||||
`workers_congress_delegation` dbt
|
||||
LEFT JOIN workers_congress_session gdh ON gdh.id = dbt.gdh_id $condition
|
||||
""");
|
||||
cnd.and("dbt.gdh_id", "=", gdh_id);
|
||||
cnd.asc("dbt.`code`");
|
||||
sql.setCondition(cnd);
|
||||
record.set("childrens", delegationViService.list(sql));
|
||||
return record;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
public Object delDbt(String dbt_id, String gdh_id) {
|
||||
try {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("id", "=", dbt_id).and("gdh_id", "=", gdh_id);
|
||||
delegationViService.clear(cnd);
|
||||
//删除组成基层工会
|
||||
makeUpUnionViService.clear(cnd);
|
||||
//删除团长 副团长 操作员的权限
|
||||
sysUserRoleService.clear(Cnd.where("dbtid", "=", dbt_id).and("jdhid", "=", gdh_id).and("roleid", "in", "'" + Roles.DBT_TZ + "','" + Roles.DBT_FTZ + "'"));
|
||||
//删除正式代表权限
|
||||
sysUserRoleService.clear(Cnd.where("dbtid", "=", dbt_id).and("jdhid", "=", gdh_id).and("roleid", "=", Roles.ZSDB));
|
||||
//删除代表 表用户
|
||||
representativeViService.clear(cnd);
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
public Object getDbTableData(String gdh_id, String dbt_id, String searchKeyword,
|
||||
String searchName, String unitid, String unionid) {
|
||||
CndPlus cnd = CndPlus.create();
|
||||
if (StrUtil.isNotBlank(searchName) && StrUtil.isNotBlank(searchKeyword)) {
|
||||
cnd.and(Cnd.likeEX(searchName, searchKeyword));
|
||||
}
|
||||
cnd.andExcludeEmpty("u.unitid", "=", unitid);
|
||||
cnd.andExcludeEmpty("u.unionid", "=", unionid);
|
||||
cnd.andExcludeEmpty("wo.gdh_id", "=", gdh_id);
|
||||
cnd.andExcludeEmpty("wo.dbt_id", "=", dbt_id);
|
||||
return workersCongressRepresentativeService.queryData(cnd, null, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询未组成的分工会
|
||||
*
|
||||
* @param gdh_id
|
||||
* @param dbt_id
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object unionOpenAddList(String gdh_id, String dbt_id) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
un.id,
|
||||
un.unionname
|
||||
FROM
|
||||
sys_union un
|
||||
WHERE
|
||||
un.id NOT IN (
|
||||
SELECT
|
||||
union_id
|
||||
FROM
|
||||
workers_congress_delegation_make_up_union upunion
|
||||
WHERE
|
||||
upunion.gdh_id = @gdh_id
|
||||
AND upunion.dbt_id != @dbt_id)
|
||||
""").setParam("gdh_id", gdh_id).setParam("dbt_id", dbt_id);
|
||||
return Record.create().set("data", delegationViService.list(sql)).set("value", findUnionList(dbt_id, gdh_id));
|
||||
|
||||
}
|
||||
|
||||
private List<Record> findUnionList(String dbt_id, String gdh_id) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
upunion.*,
|
||||
un.unionname
|
||||
FROM
|
||||
workers_congress_delegation_make_up_union upunion
|
||||
LEFT JOIN sys_union un ON un.id = upunion.union_id
|
||||
WHERE
|
||||
upunion.dbt_id =@dbt_id and
|
||||
upunion.gdh_id =@gdh_id
|
||||
""").setParam("dbt_id", dbt_id).setParam("gdh_id", gdh_id);
|
||||
return delegationViService.list(sql);
|
||||
}
|
||||
|
||||
@At
|
||||
public Object doUnion(String[] unionValue, String gdh_id, String dbt_id) {
|
||||
makeUpUnionViService.clear(Cnd.where("gdh_id", "=", gdh_id).and("dbt_id", "=", dbt_id));
|
||||
for (String unionId : unionValue) {
|
||||
WorkersCongressDelegationMakeUpUnion makeUpUnion = new WorkersCongressDelegationMakeUpUnion();
|
||||
makeUpUnion.setUnion_id(unionId);
|
||||
makeUpUnion.setDbt_id(dbt_id);
|
||||
makeUpUnion.setGdh_id(gdh_id);
|
||||
makeUpUnionViService.insert(makeUpUnion);
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询代表团组成工会
|
||||
*
|
||||
* @param dbt_id
|
||||
* @param gdh_id
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
public Object unionPageData(String dbt_id, String gdh_id) {
|
||||
return findUnionList(dbt_id, gdh_id);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
public Object queryUser(String dbt_id, String gdh_id) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.id,
|
||||
u.username,
|
||||
u.loginname,
|
||||
u.mobile,
|
||||
u.sex,
|
||||
dw.NAME AS unitname
|
||||
FROM
|
||||
sys_user_role ur
|
||||
LEFT JOIN sys_user u ON u.id = ur.userid
|
||||
LEFT JOIN sys_unit dw ON dw.id = u.unitid
|
||||
WHERE
|
||||
ur.roleid = @roleid
|
||||
AND ur.dbtid = @dbt_id
|
||||
and jdhid=@gdh_id
|
||||
AND ur.userid NOT IN
|
||||
(SELECT
|
||||
userid
|
||||
FROM
|
||||
sys_user_role
|
||||
WHERE
|
||||
roleid IN ( '6445f21685c5489aa212a986cfbeecce', 'c1765c03459840c2b621d140f575c869' )
|
||||
AND jdhid=@gdh_id
|
||||
)
|
||||
""").setParam("roleid", Roles.GDHDB).setParam("dbt_id", dbt_id).setParam("gdh_id", gdh_id);
|
||||
return sysUserRoleService.list(sql);
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
public Object doAddTz(String dbt_id, String gdh_id, String userid, Integer sf) {
|
||||
|
||||
if (sf == 2) {
|
||||
int count = sysUserRoleService.count(Cnd.where("jdhid", "=", gdh_id)
|
||||
.and("dbtid", "=", dbt_id).and("roleid", "=", JDH_DBT_TZ_ROLE_ID));
|
||||
if (count > 0) {
|
||||
return Result.error().addMsg("团长只能设置一位!");
|
||||
}
|
||||
}
|
||||
Sys_user_role userRole = new Sys_user_role();
|
||||
userRole.setUserId(userid);
|
||||
userRole.setJdhid(gdh_id);
|
||||
userRole.setDbtid(dbt_id);
|
||||
userRole.setRoleId(sf == 1 ? JDH_DBT_FTZ_ROLE_ID : JDH_DBT_TZ_ROLE_ID);
|
||||
sysUserRoleService.insert(userRole);
|
||||
sysRoleService.clearCache();
|
||||
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getTzList(String dbt_id, String gdh_id) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.id,
|
||||
u.username,
|
||||
u.loginname,
|
||||
u.mobile,
|
||||
u.sex,
|
||||
r.id AS roleid,
|
||||
r.NAME AS rolename,
|
||||
dw.NAME AS unitname
|
||||
FROM
|
||||
sys_user_role ur
|
||||
LEFT JOIN sys_role r ON r.id = ur.roleid
|
||||
LEFT JOIN sys_user u ON u.id = ur.userid
|
||||
LEFT JOIN sys_unit dw ON dw.id = u.unitid
|
||||
WHERE
|
||||
ur.dbtid = @dbtid
|
||||
and ur.jdhid = @gdh_id
|
||||
AND ur.roleid IN (@TZROLEID, @FTZROLEID)
|
||||
ORDER BY roleId DESC
|
||||
""").setParam("dbtid", dbt_id).setParam("gdh_id", gdh_id).setParam("TZROLEID", JDH_DBT_TZ_ROLE_ID).setParam("FTZROLEID", JDH_DBT_FTZ_ROLE_ID);
|
||||
return sysUserRoleService.list(sql);
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
public Object delUser(String gdh_id, String userId, String roleId) {
|
||||
sysUserRoleService.clear(Cnd.where("userid", "=", userId).and("roleid", "=", roleId).and("jdhid", "=", gdh_id));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
package io.v.nutz.workersCongress.controller;
|
||||
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.Roles;
|
||||
import io.v.nutz.dao.CndPlus;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.service.ViService;
|
||||
import io.v.nutz.sys.models.Sys_user_role;
|
||||
import io.v.nutz.sys.services.SysDictService;
|
||||
import io.v.nutz.workersCongress.model.OrganizationUser;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
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.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/7/31 14:30
|
||||
* @description 工代会组织机构
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/workersCongress/Organization")
|
||||
@RequiresAuthentication
|
||||
public class OrganizationController {
|
||||
|
||||
private static String GDH_WYH_PARENT_ID = "d5b450bb98dc45dc9579652499c64ce7";
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:platform/workersCongress/Organization.html")
|
||||
@RequiresPermissions("sys.workersCongress.organization")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@Inject("OrganizationUser")
|
||||
private ViService<OrganizationUser> organizationViService;
|
||||
|
||||
@Inject
|
||||
private SysDictService sysDictService;
|
||||
|
||||
@At
|
||||
public Object getTreeData() {
|
||||
Record record = new Record();
|
||||
record.set("name", "工代会机构设置");
|
||||
record.set("childrens", sysDictService.query(Cnd.where("parentid", "=", GDH_WYH_PARENT_ID)));
|
||||
return record;
|
||||
}
|
||||
|
||||
@At
|
||||
public Object getUserList(String gdh_id, String organization_id, String key) {
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
id,username,loginname,unionname,mobile,unitname
|
||||
FROM
|
||||
`user`
|
||||
WHERE
|
||||
member IS TRUE
|
||||
AND (username like @key or loginname like @key)
|
||||
AND id NOT IN (
|
||||
SELECT
|
||||
user_id
|
||||
FROM
|
||||
workers_congress_organization_user
|
||||
WHERE
|
||||
gdh_id= @gdh_id
|
||||
AND organization_id= @organization_id)
|
||||
""").setParam("organization_id", organization_id).setParam("gdh_id", gdh_id).setParam("key", "%" + key + "%");
|
||||
return organizationViService.listPage(1, 20, sql);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doAdd(OrganizationUser organizationUser) {
|
||||
int count = organizationViService.count(Cnd.where("user_id", "=", organizationUser.getUser_id())
|
||||
.and("organization_id", "=", organizationUser.getOrganization_id()).and("gdh_id", "=", organizationUser.getGdh_id()));
|
||||
if (count > 0) {
|
||||
return Result.error("人员已存在,请勿重复录入");
|
||||
}
|
||||
Sys_user_role sysRole = new Sys_user_role();
|
||||
sysRole.setUserId(organizationUser.getUser_id());
|
||||
sysRole.setGdhid(organizationUser.getGdh_id());
|
||||
if (organizationUser.getOrganization_code().equals("gdhwyh1")) {
|
||||
switch (organizationUser.getStatus()) {
|
||||
case 1:
|
||||
organizationUser.setRole_id(Roles.GH_WYH_CY);
|
||||
sysRole.setRoleId(Roles.GH_WYH_CY);
|
||||
break;
|
||||
case 2:
|
||||
organizationUser.setRole_id(Roles.GH_WYH_FZX);
|
||||
sysRole.setRoleId(Roles.GH_WYH_FZX);
|
||||
break;
|
||||
case 3:
|
||||
organizationUser.setRole_id(Roles.GH_WYH_CWFZX);
|
||||
sysRole.setRoleId(Roles.GH_WYH_CWFZX);
|
||||
break;
|
||||
case 4:
|
||||
organizationUser.setRole_id(Roles.GH_WYH_ZX);
|
||||
sysRole.setRoleId(Roles.GH_WYH_ZX);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
organizationViService.insert(sysRole);
|
||||
organizationViService.insert(organizationUser);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object pageData(PageForm page, String gdh_id, String organization_id) {
|
||||
CndPlus cnd = CndPlus.create();
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
wo.*,
|
||||
u.username,
|
||||
u.loginname,
|
||||
u.sex,
|
||||
u.mobile,
|
||||
u.unionname,
|
||||
u.unitname,
|
||||
se.gdhAllName gdh_name,
|
||||
role.`name` role_name
|
||||
FROM
|
||||
workers_congress_organization_user wo
|
||||
LEFT JOIN workers_congress_session se ON se.id = wo.gdh_id
|
||||
LEFT JOIN `user` u ON u.id = wo.user_id
|
||||
LEFT JOIN sys_role role ON wo.role_id = role.id
|
||||
$condition
|
||||
""");
|
||||
if (Strings.isNotBlank(page.getSearchName()) && Strings.isNotBlank(page.getSearchKeyword())) {
|
||||
cnd.and(page.getSearchName(), "like", "%" + page.getSearchKeyword() + "%");
|
||||
}
|
||||
cnd.andExcludeEmpty("wo.gdh_id", "=", gdh_id);
|
||||
cnd.andExcludeEmpty("wo.organization_id", "=", organization_id);
|
||||
cnd.desc("wo.status");
|
||||
sql.setCondition(cnd);
|
||||
return organizationViService.list(page, sql);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
public Object delUser(String id) {
|
||||
return organizationViService.clear(Cnd.where("id", "=", id));
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object updateStatus(String gdh_id, String user_id, String status, String organization_id) {
|
||||
organizationViService.update(Chain.make("status", status), Cnd.where("gdh_id", "=", gdh_id).and("organization_id", "=", organization_id).and("user_id", "=", user_id));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,229 @@
|
||||
package io.v.nutz.workersCongress.controller;
|
||||
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.base.utils.Roles;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.dao.CndPlus;
|
||||
import io.v.nutz.jdh.model.cb.Jdh_jdhxx;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.service.ViService;
|
||||
import io.v.nutz.sys.models.Sys_user_role;
|
||||
import io.v.nutz.sys.services.SysUserRoleService;
|
||||
import io.v.nutz.workersCongress.model.*;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
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.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.trans.Trans;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/7/30 10:02
|
||||
* @description 工代会届次管理
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/workersCongress/Session")
|
||||
public class SessionController {
|
||||
|
||||
@Inject("Jdh_jdhxx")
|
||||
private ViService<Jdh_jdhxx> jdhJdhxxViService;
|
||||
|
||||
@Inject("WorkersCongressSession")
|
||||
private ViService<WorkersCongressSession> sessionViService;
|
||||
|
||||
@Inject("Delegation")
|
||||
private ViService<Delegation> delegationViService;
|
||||
|
||||
@Inject("WorkersCongressDelegationMakeUpUnion")
|
||||
private ViService<WorkersCongressDelegationMakeUpUnion> makeUpUnionViService;
|
||||
|
||||
@Inject("WorkersCongressRepresentative")
|
||||
private ViService<WorkersCongressRepresentative> representativeViService;
|
||||
|
||||
@Inject("OrganizationUser")
|
||||
private ViService<OrganizationUser> organizationUserViService;
|
||||
|
||||
@Inject
|
||||
private SysUserRoleService sysUserRoleService;
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:platform/workersCongress/SessionCon.html")
|
||||
@RequiresPermissions("sys.workersCongress.Session")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object pageData(PageForm page, Integer year, String gdhJs, String gdhCs) {
|
||||
Cnd cnd = CndPlus.create();
|
||||
Sql sql = Sqls.create("select * from workers_congress_session $condition");
|
||||
Vi.cndPlus(cnd, "year", "=", year);
|
||||
Vi.cndPlus(cnd, "gdhJs", "=", gdhJs);
|
||||
Vi.cndPlus(cnd, "gdhCs", "=", gdhCs);
|
||||
cnd.desc("startTime");
|
||||
sql.setCondition(cnd);
|
||||
return sessionViService.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doAdd(WorkersCongressSession workersCongressSession, boolean isExtend) {
|
||||
//判断新建的教代会届次是否存在
|
||||
int count = sessionViService.count(Cnd.where("gdhJs", "=", workersCongressSession.getGdhJs()).and("gdhCs", "=", workersCongressSession.getGdhCs()));
|
||||
if (count > 0) {
|
||||
return Result.error().addMsg("当前届次的工代会已存在,无法重复创建!");
|
||||
}
|
||||
workersCongressSession.setStartState(true);
|
||||
workersCongressSession.setStartTime(DateUtil.getDate());
|
||||
WorkersCongressSession insert = sessionViService.insert(workersCongressSession);
|
||||
if (isExtend) {
|
||||
|
||||
Cnd preJdh = Cnd.NEW();
|
||||
preJdh.and("gdhJs", "=", workersCongressSession.getGdhJs()).and("gdhCs", "=", getCs(workersCongressSession.getGdhCs()));
|
||||
List<Record> preGdhxxList = baseService.dao().query("workers_congress_session", preJdh);
|
||||
//存在上一次教代会信息才能延用
|
||||
Trans.exec(() -> {
|
||||
if (preGdhxxList.size() > 0) {
|
||||
String gdhId = preGdhxxList.get(0).getString("id");
|
||||
|
||||
//代表团
|
||||
List<Delegation> dbtList = delegationViService.query(Cnd.where("gdh_id", "=", gdhId));
|
||||
dbtList.forEach(z -> {
|
||||
Delegation delegation = new Delegation();
|
||||
delegation.setGdh_id(insert.getId());
|
||||
delegation.setDbt_name(z.getDbt_name());
|
||||
delegation.setCode(z.getCode());
|
||||
delegation.setFound_time(DateUtil.getDate());
|
||||
Delegation dbtListNew = delegationViService.insert(delegation);
|
||||
|
||||
//组成基层工会
|
||||
List<WorkersCongressDelegationMakeUpUnion> zcfghList = makeUpUnionViService.query(Cnd.where("dbt_id", "=", z.getId()));
|
||||
zcfghList.forEach(zz -> {
|
||||
WorkersCongressDelegationMakeUpUnion upUnion = new WorkersCongressDelegationMakeUpUnion();
|
||||
upUnion.setDbt_id(dbtListNew.getId());
|
||||
upUnion.setGdh_id(insert.getId());
|
||||
upUnion.setUnion_id(zz.getUnion_id());
|
||||
makeUpUnionViService.insert(upUnion);
|
||||
});
|
||||
//团长 副团长
|
||||
List<Sys_user_role> ftzList = sysUserRoleService.query(Cnd.where("dbtid", "=", z.getId()).and("jdhid", "=", gdhId).and("roleid", "in", Lang.array(Roles.DBT_TZ, Roles.DBT_FTZ)));
|
||||
ftzList.forEach(tzftz -> {
|
||||
Sys_user_role user_role = new Sys_user_role();
|
||||
user_role.setUserId(tzftz.getUserId());
|
||||
user_role.setJdhid(insert.getId());
|
||||
user_role.setDbtid(dbtListNew.getId());
|
||||
user_role.setRoleId(tzftz.getRoleId());
|
||||
sysUserRoleService.insert(user_role);
|
||||
});
|
||||
|
||||
//正式代表
|
||||
List<WorkersCongressRepresentative> dbList = representativeViService.query(Cnd.where("gdh_id", "=", gdhId).and("dbt_id", "=", z.getId()));
|
||||
dbList.forEach(zzz -> {
|
||||
Sys_user_role userRole = new Sys_user_role();
|
||||
userRole.setRoleId(Roles.GDHDB);
|
||||
userRole.setJdhid(zzz.getGdh_id());
|
||||
userRole.setUserId(zzz.getUserId());
|
||||
userRole.setDbtid(dbtListNew.getId());
|
||||
sysUserRoleService.insert(userRole);
|
||||
|
||||
WorkersCongressRepresentative workersCongressRepresentative = new WorkersCongressRepresentative();
|
||||
workersCongressRepresentative.setGdh_id(insert.getId());
|
||||
workersCongressRepresentative.setUserId(zzz.getUserId());
|
||||
workersCongressRepresentative.setRoleId(Roles.GDHDB);
|
||||
workersCongressRepresentative.setDbt_id(dbtListNew.getId());
|
||||
representativeViService.insert(workersCongressRepresentative);
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
//组织机构
|
||||
List<OrganizationUser> zzjgList = organizationUserViService.query(Cnd.where("gdh_id", "=", gdhId));
|
||||
|
||||
zzjgList.forEach(jg -> {
|
||||
OrganizationUser organizationUser = new OrganizationUser();
|
||||
organizationUser.setUser_id(jg.getUser_id());
|
||||
organizationUser.setStatus(jg.getStatus());
|
||||
organizationUser.setOrganization_id(jg.getOrganization_id());
|
||||
organizationUser.setOrganization_name(jg.getOrganization_name());
|
||||
organizationUser.setOrganization_code(jg.getOrganization_code());
|
||||
organizationUser.setGdh_id(insert.getId());
|
||||
organizationUserViService.insert(organizationUser);
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
public static String getCs(String cs) {
|
||||
if (cs.equals("六次")) {
|
||||
return "五次";
|
||||
} else if (cs.equals("五次")) {
|
||||
return "四次";
|
||||
} else if (cs.equals("四次")) {
|
||||
return "三次";
|
||||
} else if (cs.equals("三次")) {
|
||||
return "二次";
|
||||
} else if (cs.equals("二次")) {
|
||||
return "一次";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object startStateChange(boolean startState, String id) {
|
||||
boolean aa = startState ? false : true;
|
||||
return sessionViService.update(Chain.make("startState", aa), CndPlus.where("id", "=", id));
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
public Object doDelete(String id) {
|
||||
Trans.exec(() -> {
|
||||
sessionViService.clear(CndPlus.where("id", "=", id));
|
||||
delegationViService.clear(CndPlus.where("gdh_id", "=", id));
|
||||
organizationUserViService.clear(CndPlus.where("gdh_id", "=", id));
|
||||
makeUpUnionViService.clear(CndPlus.where("gdh_id", "=", id));
|
||||
representativeViService.clear(CndPlus.where("gdh_id", "=", id));
|
||||
sysUserRoleService.clear(CndPlus.where("jdhid", "=", id));
|
||||
});
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
public Object doEdit(WorkersCongressSession workersCongressSession, boolean isExtend) {
|
||||
if (!isExtend) {
|
||||
workersCongressSession.setStartTime(DateUtil.getDate());
|
||||
sessionViService.updateIgnoreNull(workersCongressSession);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+165
@@ -0,0 +1,165 @@
|
||||
package io.v.nutz.workersCongress.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.base.utils.Roles;
|
||||
import io.v.nutz.jdh.model.db.Jdh_db;
|
||||
import io.v.nutz.jdh.model.db.TeacherMeetDelegate;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.sys.models.Sys_user_role;
|
||||
import io.v.nutz.workersCongress.model.WorkersCongressRepresentative;
|
||||
import io.v.nutz.workersCongress.model.WorkersCongressSession;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.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 org.nutz.trans.Trans;
|
||||
|
||||
/**
|
||||
* 代表资格审查
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/workersCongress/delegate/audit")
|
||||
@Ok("json:full")
|
||||
public class WorkersCongressAuditController {
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/workersCongress/representative/audit.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询待校工会审核的代表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
public Object pageData(PageForm pageForm, String isAudit, String teacherMeetId, String unionId, String unitId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT tmd.*,
|
||||
u.unionname,
|
||||
CASE tmd.stateCode
|
||||
when 0 then '未上报'
|
||||
when 100 then '待审查'
|
||||
when 200 then '未通过'
|
||||
when 300 then '审查通过'
|
||||
ELSE '未知' END stateName
|
||||
FROM teacher_meet_delegate tmd
|
||||
LEFT JOIN `USER` u ON u.id = tmd.userId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("tmd.mode", "=", 2);
|
||||
if (isAudit.equals("true")) {
|
||||
cnd.and("tmd.stateCode", "in", Lang.array(200, 300));
|
||||
} else if (isAudit.equals("false")) {
|
||||
cnd.and("tmd.stateCode", "in", Lang.array(100));
|
||||
} else if (isAudit.equals("all")) {
|
||||
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchName()) && StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(Cnd.likeEX(pageForm.getSearchName(), pageForm.getSearchKeyword()));
|
||||
}
|
||||
if (StrUtil.isNotBlank(teacherMeetId)) {
|
||||
cnd.and("tmd.teacherMeetId", "=", teacherMeetId);
|
||||
}
|
||||
if (StrUtil.isNotBlank(unionId)) {
|
||||
cnd.and("u.unionId", "=", unionId);
|
||||
}
|
||||
if (StrUtil.isNotBlank(unitId)) {
|
||||
cnd.and("u.unitId", "=", unitId);
|
||||
}
|
||||
cnd.asc("tmd.stateCode").asc("u.unionname");
|
||||
sql.setCondition(cnd);
|
||||
return baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doAudit(@Param("ids[]") String[] ids, Boolean result) {
|
||||
Trans.exec(() -> {
|
||||
for (String id : ids) {
|
||||
TeacherMeetDelegate delegate = dao.fetch(TeacherMeetDelegate.class, id);
|
||||
Sql sql = Sqls.create("""
|
||||
select * from `user` where id = @id
|
||||
""").setParam("id", delegate.getUserId());
|
||||
sql.setCallback(Sqls.callback.map());
|
||||
dao.execute(sql);
|
||||
NutMap user = (NutMap) sql.getResult();
|
||||
|
||||
if (result) {
|
||||
if (delegate.getIsJdh()) {
|
||||
Jdh_db db = new Jdh_db();
|
||||
db.setDbid(delegate.getUserId());
|
||||
db.setJdhid(delegate.getTeacherMeetId());
|
||||
db.setDbunitid(user.getString("unitid"));
|
||||
db.setDbunitname(user.getString("unitname"));
|
||||
db.setDbfghid(user.getString("unionid"));
|
||||
db.setDbfghname(user.getString("unionname"));
|
||||
db.setRoleid(Roles.ZSDB);
|
||||
db.setDbzt(2);
|
||||
db.setDbtid(delegate.getDelegationId());
|
||||
dao.insert(db);
|
||||
|
||||
Sys_user_role userRole = new Sys_user_role();
|
||||
userRole.setUserId(delegate.getUserId());
|
||||
userRole.setRoleId(Roles.ZSDB);
|
||||
userRole.setJdhid(delegate.getTeacherMeetId());
|
||||
dao.insert(userRole);
|
||||
|
||||
}
|
||||
if (delegate.getIsGdh()) {
|
||||
WorkersCongressSession workersCongressSession = dao.fetch(WorkersCongressSession.class, Cnd.where("1", "=", 1).desc("startTime"));
|
||||
|
||||
WorkersCongressRepresentative workersCongressRepresentative = new WorkersCongressRepresentative();
|
||||
workersCongressRepresentative.setGdh_id(workersCongressSession.getId());
|
||||
workersCongressRepresentative.setUserId(delegate.getUserId());
|
||||
workersCongressRepresentative.setRoleId(Roles.GDHDB);
|
||||
dao.insert(workersCongressRepresentative);
|
||||
|
||||
Sys_user_role userRole = new Sys_user_role();
|
||||
userRole.setUserId(delegate.getUserId());
|
||||
userRole.setRoleId(Roles.GDHDB);
|
||||
userRole.setGdhid(workersCongressSession.getId());
|
||||
dao.insert(userRole);
|
||||
}
|
||||
delegate.setStateCode(300);
|
||||
} else {
|
||||
delegate.setStateCode(200);
|
||||
}
|
||||
|
||||
dao.updateIgnoreNull(delegate);
|
||||
|
||||
}
|
||||
});
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@RequiresAuthentication
|
||||
@ViReturn
|
||||
public Object doEditTeacher(TeacherMeetDelegate teacherMeetDelegate) {
|
||||
dao.updateIgnoreNull(teacherMeetDelegate);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+232
@@ -0,0 +1,232 @@
|
||||
package io.v.nutz.workersCongress.controller;
|
||||
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.dao.CndPlus;
|
||||
import io.v.nutz.jdh.model.db.TeacherMeetDelegate;
|
||||
import io.v.nutz.jdh.model.zzjg.Jdh_dbt_zcfgh;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.sys.models.Sys_dict;
|
||||
import io.v.nutz.sys.services.SysDictService;
|
||||
import io.v.nutz.sys.services.SysUserService;
|
||||
import io.v.nutz.workersCongress.model.WorkersCongressDelegationMakeUpUnion;
|
||||
import io.v.nutz.workersCongress.model.WorkersCongressRepresentative;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
import org.nutz.trans.Trans;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 院级工会推选代表
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/workersCongress/push")
|
||||
@Ok("json:full")
|
||||
public class WorkersCongressPushController {
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/workersCongress/representative/push.html")
|
||||
@RequiresPermissions("workersCongress.push")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@Inject
|
||||
private SysUserService sysUserService;
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("workersCongress.push")
|
||||
public Object pageData(PageForm pageForm, String teacherMeetId) {
|
||||
CndPlus cnd = CndPlus.create();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
db.*,
|
||||
case db.stateCode
|
||||
when 0 then '未上报'
|
||||
when 100 then '待审查'
|
||||
when 200 then '未通过'
|
||||
when 300 then '审查通过'
|
||||
ELSE '未知' END stateName
|
||||
FROM
|
||||
`teacher_meet_delegate` db
|
||||
LEFT JOIN `user` u on u.id = db.userId
|
||||
$condition
|
||||
""");
|
||||
cnd.and("db.mode", "=", 2);
|
||||
cnd.and("u.unionid", "=", Vi.getUnionId());
|
||||
cnd.andExcludeEmpty("db.teacherMeetId", "=", teacherMeetId);
|
||||
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(pageForm.getSearchName(), "LIKE", "%" + pageForm.getSearchKeyword() + "%");
|
||||
}
|
||||
cnd.asc("db.stateCode");
|
||||
sql.setCondition(cnd);
|
||||
return baseService.listMap(sql);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("workersCongress.push")
|
||||
public Object getUnionUser(String teacherMeetId) {
|
||||
CndPlus cnd1 = CndPlus.create();
|
||||
Sql sql1 = Sqls.create("""
|
||||
SELECT
|
||||
db.*,u.username
|
||||
FROM
|
||||
`teacher_meet_delegate` db
|
||||
LEFT JOIN `user` u ON db.userId = u.id
|
||||
$condition
|
||||
""");
|
||||
cnd1.andExcludeEmpty("db.teacherMeetId", "=", teacherMeetId);
|
||||
cnd1.and("u.unionid", "=", Vi.getUnionId());
|
||||
sql1.setCondition(cnd1);
|
||||
List<NutMap> userValue = baseService.listMap(sql1);
|
||||
|
||||
CndPlus cnd = CndPlus.create();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT * FROM `user` u $condition
|
||||
""");
|
||||
cnd.and("unionid", "=", Vi.getUnionId());
|
||||
/* if (ShiroUtil.hasRole("H04")) {
|
||||
cnd.and("u.unionid", "=", Vi.getUnionId());
|
||||
}*/
|
||||
|
||||
|
||||
List<WorkersCongressRepresentative> zsdbList = sysUserService.dao().query(WorkersCongressRepresentative.class, Cnd.where("gdh_id", "=", teacherMeetId));
|
||||
|
||||
if (userValue.size() > 0) {
|
||||
cnd.and("u.id", "NOT IN", userValue.stream().map(v -> v.getString("userId")).collect(Collectors.toList()));
|
||||
}
|
||||
cnd.andEX("u.id", "NOT IN", zsdbList.stream().map(v -> v.getUserId()).collect(Collectors.toList()));
|
||||
cnd.and(Cnd.exps("u.personType", "IS NOT", null).or("u.personType", "!=", ""));
|
||||
sql.setCondition(cnd);
|
||||
List userData = baseService.listMap(sql);
|
||||
|
||||
return Result.success().addData(Map.of("userData", userData, "userValue", userValue));
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("workersCongress.push")
|
||||
public Object addPreselectionDb(@Param("userValue") String[] userValue, String teacherMeetId) {
|
||||
Dao dao = baseService.dao();
|
||||
Trans.exec(() -> {
|
||||
for (String id : userValue) {
|
||||
Sql sql = Sqls.create("select * from `user` where id = @id").setParam("id", id);
|
||||
sql.setCallback(Sqls.callback.map());
|
||||
dao.execute(sql);
|
||||
NutMap user = (NutMap) sql.getResult();
|
||||
|
||||
String unionid = user.getString("unionid");
|
||||
WorkersCongressDelegationMakeUpUnion zcfgh = dao.fetch(WorkersCongressDelegationMakeUpUnion.class, Cnd.where("gdh_id", "=", teacherMeetId)
|
||||
.and("union_id", "=", unionid));
|
||||
|
||||
TeacherMeetDelegate tmd = new TeacherMeetDelegate();
|
||||
tmd.setUserId(user.getString("id"));
|
||||
tmd.setTeacherMeetId(teacherMeetId);
|
||||
tmd.setDelegationId(zcfgh != null ? zcfgh.getDbt_id() : null);
|
||||
tmd.setUserName(user.getString("username"));
|
||||
tmd.setLoginName(user.getString("loginname"));
|
||||
tmd.setSex(user.getString("sex"));
|
||||
tmd.setNation(user.getString("nation"));
|
||||
tmd.setPoliticalOutlook(user.getString("political"));
|
||||
tmd.setEducation(user.getString("education"));
|
||||
tmd.setTechnicalTitle(user.getString("jobTitle"));
|
||||
tmd.setAdministrativeTitle(user.getString("position", "无"));
|
||||
tmd.setIsJdh(false);
|
||||
tmd.setIsGdh(false);
|
||||
tmd.setMode(2);
|
||||
if (Strings.isNotBlank(user.getString("birthday"))) {
|
||||
Integer age = DateUtil.getYear() - Integer.parseInt(user.getString("birthday").substring(0, 4));
|
||||
tmd.setAge(age);
|
||||
}
|
||||
tmd.setStateCode(0);
|
||||
baseService.dao().insert(tmd);
|
||||
}
|
||||
});
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("workersCongress.push")
|
||||
public Object doCofirmMany(String data) {
|
||||
List<TeacherMeetDelegate> delegateList = Json.fromJsonAsList(TeacherMeetDelegate.class, data);
|
||||
Trans.exec(() -> {
|
||||
delegateList.forEach(v -> {
|
||||
v.setStateCode(100);
|
||||
baseService.dao().updateIgnoreNull(v);
|
||||
});
|
||||
});
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("workersCongress.push")
|
||||
public Object doUpdate(TeacherMeetDelegate delegate) {
|
||||
delegate.setStateCode(100);
|
||||
baseService.dao().updateIgnoreNull(delegate);
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("workersCongress.push")
|
||||
public Object doRevoke(TeacherMeetDelegate delegate) {
|
||||
delegate.setStateCode(0);
|
||||
baseService.dao().updateIgnoreNull(delegate);
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("workersCongress.push")
|
||||
public Object doDelete(String id) {
|
||||
baseService.dao().clear(TeacherMeetDelegate.class, Cnd.where("id", "=", id));
|
||||
return null;
|
||||
}
|
||||
|
||||
@Inject
|
||||
private SysDictService sysDictService;
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("workersCongress.push")
|
||||
public Object getTechnicalTitleOptions() {
|
||||
List<Sys_dict> firstOptions = sysDictService.getSubListByCode("JobTitle");
|
||||
List<NutMap> hasChildrenFirstOptions = firstOptions.stream().filter(Sys_dict::isHasChildren)
|
||||
.map(v -> NutMap.NEW().addv("label", v.getName()).addv("code", v.getCode())).collect(Collectors.toList());
|
||||
|
||||
for (NutMap option : hasChildrenFirstOptions) {
|
||||
List<Sys_dict> childrens = sysDictService.getSubListByCode((String) option.get("code"));
|
||||
List<Map<String, String>> filterChildrens = childrens.stream().map(v -> Map.of("label", v.getName(), "value", v.getCode())).collect(Collectors.toList());
|
||||
option.put("options", filterChildrens);
|
||||
}
|
||||
return hasChildrenFirstOptions;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package io.v.nutz.workersCongress.model;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/8/2 11:38
|
||||
* @description
|
||||
*/
|
||||
@Data
|
||||
@Table("workers_congress_delegation")
|
||||
public class Delegation implements Serializable {
|
||||
|
||||
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("代表团名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String dbt_name;
|
||||
|
||||
@Column
|
||||
@Comment("所属工代会id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String gdh_id;
|
||||
|
||||
@Column
|
||||
@Comment("创建时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String found_time;
|
||||
|
||||
@Column
|
||||
@Comment("代表团编码")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String code;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package io.v.nutz.workersCongress.model;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/7/31 15:32
|
||||
* @description
|
||||
*/
|
||||
@Data
|
||||
@Table("workers_congress_organization_user")
|
||||
public class OrganizationUser implements Serializable {
|
||||
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("用户id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String user_id;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("用户身份1。组员2.副主任3,主任")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer status;
|
||||
|
||||
@Column
|
||||
@Comment("所属工代会")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String gdh_id;
|
||||
|
||||
@Column
|
||||
@Comment("角色id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String role_id;
|
||||
|
||||
@Column
|
||||
@Comment("机构id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String organization_id;
|
||||
|
||||
@Column
|
||||
@Comment("机构名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String organization_name;
|
||||
|
||||
@Column
|
||||
@Comment("机构编码")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String organization_code;
|
||||
|
||||
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package io.v.nutz.workersCongress.model;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/8/3 9:15
|
||||
* @description 组成分工会
|
||||
*/
|
||||
@Data
|
||||
@Table("workers_congress_delegation_make_up_union")
|
||||
public class WorkersCongressDelegationMakeUpUnion {
|
||||
|
||||
|
||||
@Name
|
||||
@Comment("id")
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("代表团id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String dbt_id;
|
||||
|
||||
@Column
|
||||
@Comment("基层工会id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String union_id;
|
||||
|
||||
@Column
|
||||
@Comment("所属工代会id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String gdh_id;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package io.v.nutz.workersCongress.model;
|
||||
|
||||
import cn.wizzer.framework.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/7/30 9:52
|
||||
* @description 职工代表大会代表
|
||||
*/
|
||||
@Data
|
||||
@Table("workers_congress_representative")
|
||||
public class WorkersCongressRepresentative extends BaseModel implements Serializable {
|
||||
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("代表用户ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@Comment("所属教代会ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String gdh_id;
|
||||
|
||||
@Column
|
||||
@Comment("所属角色ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String roleId;
|
||||
|
||||
@Column
|
||||
@Comment("所属代表团")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String dbt_id;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package io.v.nutz.workersCongress.model;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/8/2 9:04
|
||||
* @description 工代会届次
|
||||
*/
|
||||
@Data
|
||||
@Table("workers_congress_session")
|
||||
public class WorkersCongressSession implements Serializable {
|
||||
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("年度")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer year;
|
||||
|
||||
@Column
|
||||
@Comment("届")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 10)
|
||||
private String gdhJs;
|
||||
|
||||
@Column
|
||||
@Comment("次")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 10)
|
||||
private String gdhCs;
|
||||
|
||||
@Column
|
||||
@Comment("全称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String gdhAllName;
|
||||
|
||||
@Column
|
||||
@Comment("开启时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String startTime;
|
||||
|
||||
@Column
|
||||
@Comment("开启状态")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private boolean startState;
|
||||
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
package io.v.nutz.workersCongress.services;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.service.ViService;
|
||||
import io.v.nutz.workersCongress.model.WorkersCongressRepresentative;
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.Cnd;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/7/30 13:59
|
||||
* @description
|
||||
*/
|
||||
public interface WorkersCongressRepresentativeService extends ViService<WorkersCongressRepresentative> {
|
||||
|
||||
/**
|
||||
* 返回自定义sql
|
||||
* @param cnd
|
||||
* @return
|
||||
*/
|
||||
Object queryData(Cnd cnd, PageForm pageForm,boolean isPage);
|
||||
|
||||
|
||||
/**
|
||||
* 导出代表实体类
|
||||
*/
|
||||
@Data
|
||||
public static class db_excel_data implements Serializable {
|
||||
@Excel(name = "工号", width = 20)
|
||||
private String loginname;
|
||||
@Excel(name = "姓名", width = 20)
|
||||
private String username;
|
||||
@Excel(name = "性别", width = 10)
|
||||
private String sex;
|
||||
@Excel(name = "联系方式", width = 20)
|
||||
private String mobile;
|
||||
@Excel(name = "所属代表团", width = 30)
|
||||
private String dbt_name;
|
||||
@Excel(name = "所属工会", width = 30)
|
||||
private String unionname;
|
||||
@Excel(name = "所属单位", width = 30)
|
||||
private String unitname;
|
||||
private String roleId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
package io.v.nutz.workersCongress.services.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.service.impl.ViServiceImpl;
|
||||
import io.v.nutz.workersCongress.model.WorkersCongressRepresentative;
|
||||
import io.v.nutz.workersCongress.services.WorkersCongressRepresentativeService;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/7/30 14:00
|
||||
* @description
|
||||
*/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class WorkersCongressRepresentativeServiceImpl extends ViServiceImpl<WorkersCongressRepresentative> implements WorkersCongressRepresentativeService {
|
||||
public WorkersCongressRepresentativeServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object queryData(Cnd cnd, PageForm pageForm, boolean isPage) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
wo.*,
|
||||
TIMESTAMPDIFF(YEAR, u.birthday,CURDATE()) as age,
|
||||
u.username,
|
||||
u.loginname,
|
||||
u.sex,
|
||||
u.mobile,
|
||||
u.unionname,
|
||||
u.unitname,
|
||||
dbt.dbt_name,
|
||||
role.`name` roleName,
|
||||
wcs.gdhAllName
|
||||
FROM
|
||||
`workers_congress_representative` wo
|
||||
LEFT JOIN `user` u ON wo.userId = u.id
|
||||
LEFT JOIN workers_congress_delegation dbt ON dbt.id = wo.dbt_id
|
||||
LEFT JOIN workers_congress_session wcs ON wcs.id=dbt.gdh_id
|
||||
LEFT JOIN sys_role role ON role.id = wo.roleId
|
||||
$condition
|
||||
""");
|
||||
if (Lang.isNotEmpty(pageForm) && StrUtil.isNotBlank(pageForm.getSearchName()) && StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(Cnd.likeEX(pageForm.getSearchName(), pageForm.getSearchKeyword()));
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
if (pageForm == null && isPage) {
|
||||
return listEntity(sql, db_excel_data.class);
|
||||
}
|
||||
if (!isPage) {
|
||||
return list(sql);
|
||||
}
|
||||
|
||||
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user