diff --git a/src/main/java/io/v/nutz/base/utils/Roles.java b/src/main/java/io/v/nutz/base/utils/Roles.java index c8fe351..ec8834b 100644 --- a/src/main/java/io/v/nutz/base/utils/Roles.java +++ b/src/main/java/io/v/nutz/base/utils/Roles.java @@ -211,6 +211,18 @@ public interface Roles { * 工代会特邀 */ String GDHTY = "15b2c2beb9e34c96bd30730ad383cde3"; + /** + * 妇代会代表 + */ + String FDHDB = "997cd4107448415aba51f5f8fecaa46e"; + /** + * 妇代会列席 + */ + String FDHLX = "1440f73be5ab4373b5fa06e1f6407cab"; + /** + * 妇代会特邀 + */ + String FDHTY = "7d11fab8f1c04a069ba5358076eba39c"; /** * 校活动管理员 */ diff --git a/src/main/java/io/v/nutz/sys/models/Sys_user_role.java b/src/main/java/io/v/nutz/sys/models/Sys_user_role.java index 72f549d..4d23179 100644 --- a/src/main/java/io/v/nutz/sys/models/Sys_user_role.java +++ b/src/main/java/io/v/nutz/sys/models/Sys_user_role.java @@ -35,6 +35,11 @@ public class Sys_user_role implements Serializable { @Comment("工代会id") private String gdhid; + @Column + @ColDefine(type = ColType.VARCHAR, width = 32) + @Comment("妇代会id") + private String fdhid; + @Column @ColDefine(type = ColType.VARCHAR, width = 32) @Comment("单位id") diff --git a/src/main/java/io/v/nutz/web/commons/controller/ViCommonCon.java b/src/main/java/io/v/nutz/web/commons/controller/ViCommonCon.java index 2ef3432..c4314d5 100644 --- a/src/main/java/io/v/nutz/web/commons/controller/ViCommonCon.java +++ b/src/main/java/io/v/nutz/web/commons/controller/ViCommonCon.java @@ -17,6 +17,7 @@ import io.v.nutz.web.commons.utils.ShiroUtil; import io.v.nutz.zhgh.activity.models.ActivityBasicUnit; import io.v.nutz.zhgh.jdh.model.zzjg.Jdh_dbt; import io.v.nutz.zhgh.jdh.model.zzjg.Jdh_dbt_zcdw; +import io.v.nutz.zhgh.womanCongress.model.WomanCongressSession; import io.v.nutz.zhgh.workersCongress.model.workersCongressSession; import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.IOUtils; @@ -747,6 +748,22 @@ public class ViCommonCon { return Result.success(query); } + /* + * 获取妇代会 + * + * @param open + * @return + */ + @At + @ViReturn + @RequiresAuthentication + public Object getFdh(Boolean open) { + Cnd cnd = Cnd.NEW(); + cnd.and("startState", "=", open).desc("year"); + List query = dao.query(WomanCongressSession.class, cnd); + return Result.success(query); + } + /** * 根据code查看字典选项信息 * diff --git a/src/main/java/io/v/nutz/zhgh/qsv/controller/QsvActivityController.java b/src/main/java/io/v/nutz/zhgh/qsv/controller/QsvActivityController.java index af0476a..c5310b8 100644 --- a/src/main/java/io/v/nutz/zhgh/qsv/controller/QsvActivityController.java +++ b/src/main/java/io/v/nutz/zhgh/qsv/controller/QsvActivityController.java @@ -1,12 +1,14 @@ package io.v.nutz.zhgh.qsv.controller; import cn.wizzer.framework.base.Result; +import io.v.nutz.base.annontation.ViReturn; import io.v.nutz.base.page.Pagination; import io.v.nutz.base.query.PageForm; import io.v.nutz.zhgh.qsv.models.QsvActivity; import io.v.nutz.zhgh.qsv.models.QsvOption; import io.v.nutz.zhgh.qsv.models.QsvSubject; import io.v.nutz.zhgh.qsv.service.QsvActivityService; +import io.v.nutz.zhgh.trainSignUp.models.TrainSignUpActivity; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.nutz.aop.interceptor.ioc.TransAop; import org.nutz.dao.Cnd; @@ -14,6 +16,7 @@ import org.nutz.dao.Dao; 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.mvc.annotation.At; import org.nutz.mvc.annotation.Ok; import org.nutz.mvc.annotation.Param; @@ -56,14 +59,51 @@ public class QsvActivityController { @At @RequiresPermissions("qsv.activity") public Result save(QsvActivity qsvActivity) { - if (qsvActivity.getCategory().equals("QUIZ")) { - if (qsvActivity.getMode().equals("SCHEDULED")) { + // 保存问卷基础信息 + if ("QUIZ".equals(qsvActivity.getCategory())) { + if ("SCHEDULED".equals(qsvActivity.getMode())) { qsvActivity.setRepeatMode("DAILY"); - } else if (qsvActivity.getMode().equals("REGULAR")) { + } else if ("REGULAR".equals(qsvActivity.getMode())) { qsvActivity.setRepeatMode("TOTAL"); } } dao.insertOrUpdate(qsvActivity); + + if (Strings.isNotBlank(qsvActivity.getActivityId())) { + + List oldSubjects = dao.query(QsvSubject.class, Cnd.where("activityId", "=", qsvActivity.getActivityId())); + + // 遍历旧题目,复制并关联到新活动 + for (QsvSubject oldSubject : oldSubjects) { + QsvSubject newSubject = new QsvSubject(); + newSubject.setTitle(oldSubject.getTitle()); + newSubject.setType(oldSubject.getType()); + newSubject.setSortNum(oldSubject.getSortNum()); + newSubject.setScore(oldSubject.getScore()); + newSubject.setMaxMulti(oldSubject.getMaxMulti()); + newSubject.setDisplayDate(oldSubject.getDisplayDate()); + newSubject.setActivityId(qsvActivity.getId()); + + dao.insertOrUpdate(newSubject); + + List oldOptions = dao.query(QsvOption.class, Cnd.where("subjectId", "=", oldSubject.getId())); + + // 复制选项并关联到新题目 + for (QsvOption oldOption : oldOptions) { + QsvOption newOption = new QsvOption(); + newOption.setText(oldOption.getText()); + newOption.setIsCorrect(oldOption.getIsCorrect()); + newOption.setImgUrl(oldOption.getImgUrl()); + newOption.setLink(oldOption.getLink()); + newOption.setDescription(oldOption.getDescription()); + newOption.setSortNum(oldOption.getSortNum()); + newOption.setSubjectId(newSubject.getId()); + + dao.insertOrUpdate(newOption); + } + } + } + return Result.success(); } @@ -143,4 +183,13 @@ public class QsvActivityController { return Result.success(subjects); } + @At + @ViReturn + @Ok("json:full") + @RequiresPermissions("qsv.activity") + public Result getHistoricalQsvList() { + List query = dao.query(QsvActivity.class, Cnd.NEW().desc("startTime")); + return Result.success(query); + } + } diff --git a/src/main/java/io/v/nutz/zhgh/qsv/models/QsvActivity.java b/src/main/java/io/v/nutz/zhgh/qsv/models/QsvActivity.java index 35c2cb8..a247679 100644 --- a/src/main/java/io/v/nutz/zhgh/qsv/models/QsvActivity.java +++ b/src/main/java/io/v/nutz/zhgh/qsv/models/QsvActivity.java @@ -25,6 +25,11 @@ public class QsvActivity extends BaseModel { @ColDefine(type = ColType.VARCHAR, width = 50) private String title; + @Column + @Comment("往期活动id") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String activityId; + @Column @Comment("活动描述") @ColDefine(type = ColType.TEXT) diff --git a/src/main/java/io/v/nutz/zhgh/womanCongress/controller/WomanCongressDelegateController.java b/src/main/java/io/v/nutz/zhgh/womanCongress/controller/WomanCongressDelegateController.java new file mode 100644 index 0000000..b9e7b3f --- /dev/null +++ b/src/main/java/io/v/nutz/zhgh/womanCongress/controller/WomanCongressDelegateController.java @@ -0,0 +1,249 @@ +package io.v.nutz.zhgh.womanCongress.controller; + +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.entity.ExportParams; +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.base.service.ViService; +import io.v.nutz.base.utils.Roles; +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.zhgh.jdh.model.db.Jdh_db; +import io.v.nutz.zhgh.womanCongress.model.WomanCongressDelegation; +import io.v.nutz.zhgh.womanCongress.model.WomanCongressRepresentative; +import io.v.nutz.zhgh.womanCongress.services.WomanCongressRepresentativeService; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.nutz.aop.interceptor.ioc.TransAop; +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 javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; + +/** + * @author zhf + * @date 2021/7/30 11:20 + * @description 妇代会代表 + */ +@IocBean +@Ok("json:full") +@At("/platform/womanCongress/delegate") +public class WomanCongressDelegateController { + + + @At("") + @Ok("beetl:platform/womanCongress/Delegate.html") + @RequiresPermissions("sys.womanCongress.delegate") + public void index() { + } + + @Inject + private WomanCongressRepresentativeService womanCongressRepresentativeService; + + @Inject("WomanCongressDelegation") + private ViService delegationViService; + + @Inject("Jdh_db") + private ViService jdhDbViService; + + @Inject + private SysUserService sysUserService; + + @Inject + private SysUserRoleService sysUserRoleService; + + @At + @ViReturn + @RequiresPermissions("sys.womanCongress.delegate") + public Object pageData(PageForm page,@Param(value = "fdh_id",required = false) String fdh_id, + @Param(value = "dbt_id",required = false) String dbt_id, + @Param(value = "unionId",required = false) String unionId, + @Param(value = "unitId",required = false) String unitId) { + CndPlus cnd = CndPlus.create(); + if (Strings.isNotBlank(page.getSearchName()) && Strings.isNotBlank(page.getSearchKeyword())) { + cnd.and(page.getSearchName(), "like", "%" + page.getSearchKeyword() + "%"); + } + cnd.andEx("wo.fdh_id", "=", fdh_id); + cnd.andEx("wo.dbt_id", "=", dbt_id); + cnd.andEx("u.unionid", "=", unionId); + cnd.andEx("u.unitId", "=", unitId); + cnd.asc("u.unionid"); + return womanCongressRepresentativeService.queryData(cnd, page, true); + } + + + @At + @ViReturn + @RequiresPermissions("sys.womanCongress.delegate") + public Object doAdd(@Param("userData") String[] userData, String fdh_id, String dbt_id, int identity) { + for (String userId : userData) { + WomanCongressRepresentative woman = new WomanCongressRepresentative(); + woman.setUserId(userId); + woman.setDbt_id(dbt_id); + woman.setFdh_id(fdh_id); + woman.setRoleId(identity == 1 ? Roles.FDHDB : identity == 2 ? Roles.FDHLX : Roles.FDHTY); + womanCongressRepresentativeService.insert(woman); + Sys_user_role sys_user_role = new Sys_user_role(); + sys_user_role.setUserId(userId); + sys_user_role.setRoleId(identity == 1 ? Roles.FDHDB : identity == 2 ? Roles.FDHLX : Roles.FDHTY); + sys_user_role.setDbtid(dbt_id); + sys_user_role.setJdhid(fdh_id); + sysUserRoleService.insert(sys_user_role); + sysUserService.clearCache(); + } + return null; + } + + + @At + @RequiresPermissions("sys.womanCongress.delegate") + public void doExcel(String fdhId, String fdhAllName, String dbtId, HttpServletResponse response) throws IOException { + CndPlus cnd = CndPlus.create(); + + cnd.andEx("wo.fdh_id", "=", fdhId); + cnd.andEx("wo.dbt_id", "=", dbtId); + + cnd.asc("u.unionid"); + List dbList = (List) womanCongressRepresentativeService.queryData(cnd, null, true); + response.setContentType("application/octet-stream"); + response.setHeader("Content-Disposition", "attachment;filename=" + new String((fdhAllName + "代表名单.xls").getBytes("utf-8"), "ISO8859-1")); + Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), WomanCongressRepresentativeService.db_excel_data.class, dbList); + workbook.write(response.getOutputStream()); + } + + + @At + @ViReturn + @RequiresPermissions("sys.womanCongress.delegate") + public Object userDoDelete(String userId, String dbt_id, String fdh_id) { + sysUserRoleService.clear(Cnd.where("userid", "=", userId) + .and("dbtid", "=", dbt_id) + .and("jdhid", "=", fdh_id) + .and("roleid", "=", Roles.FDHDB)); + womanCongressRepresentativeService.clear(Cnd.where("userId", "=", userId).and("dbt_id", "=", dbt_id).and("fdh_id", "=", fdh_id)); + sysUserService.clearCache(); + + return null; + } + + @At + @ViReturn + @RequiresPermissions("sys.womanCongress.delegate") + public Object doDeleteUserList(String[] userData, String dbt_id, String fdh_id) { + for (String userId : userData) { + CndPlus cnd = CndPlus.create(); + CndPlus cnd2 = CndPlus.create(); + cnd.andEx("dbt_id", "=", dbt_id); + cnd.andEx("userid", "=", userId); + cnd.andEx("fdh_id", "=", fdh_id); + cnd.andEx("roleid", "=", Roles.FDHDB); + cnd2.andEx("dbtid", "=", dbt_id); + cnd2.andEx("userid", "=", userId); + cnd2.andEx("jdhid", "=", fdh_id); + cnd2.andEx("roleid", "=", Roles.FDHDB); + sysUserRoleService.clear(cnd2); + womanCongressRepresentativeService.clear(cnd); + sysUserService.clearCache(); + } + return null; + } + + + /** + * 可选代表 + * + * @param dbt_id + * @param fdh_id + * @return + */ + @At + @ViReturn + @RequiresPermissions("sys.womanCongress.delegate") + public Object getUserDbChange(String dbt_id, String fdh_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 woman_congress_delegation_make_up_union upunion WHERE fdh_id = @fdh_id AND dbt_id = @dbt_id ) + AND u.id NOT IN ( SELECT userId FROM woman_congress_representative ) + + """).setParam("dbt_id", dbt_id).setParam("fdh_id", fdh_id); + return delegationViService.list(sql); + + } + + + @At + @ViReturn + @RequiresPermissions("sys.womanCongress.delegate") + public Object queryXldUser(String query, String fdhid) { + 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 + `woman_congress_representative` wcr + LEFT JOIN `user` u ON u.id = wcr.userId WHERE wcr.fdh_id=@fdhid AND (u.username LIKE @query OR u.loginname LIKE @query + )) + AND (u.username LIKE @query OR u.loginname LIKE @query) + + + """).setParam("fdhid", fdhid).setParam("query", "%" + query + "%"); + return sysUserService.listMap(sql); + } + + @At + @ViReturn + @Aop(TransAop.READ_COMMITTED) + @RequiresPermissions("sys.womanCongress.delegate") + public Object fpXldToDbt(@Param("::user") List userMapList, String fdhid) { + userMapList.forEach(v -> { + WomanCongressRepresentative woman = new WomanCongressRepresentative(); + woman.setUserId(v.getString("id")); + woman.setDbt_id(v.getString("dbtid")); + woman.setFdh_id(fdhid); + woman.setRoleId(Roles.FDHDB); + womanCongressRepresentativeService.insert(woman); + Sys_user_role sys_user_role = new Sys_user_role(); + sys_user_role.setUserId(v.getString("id")); + sys_user_role.setRoleId(Roles.FDHDB); + sys_user_role.setDbtid(v.getString("dbtid")); + sys_user_role.setJdhid(fdhid); + sysUserRoleService.insert(sys_user_role); + sysUserService.clearCache(); + }); + return null; + } + + +} diff --git a/src/main/java/io/v/nutz/zhgh/womanCongress/controller/WomanCongressFdhCommonController.java b/src/main/java/io/v/nutz/zhgh/womanCongress/controller/WomanCongressFdhCommonController.java new file mode 100644 index 0000000..1f5e6e5 --- /dev/null +++ b/src/main/java/io/v/nutz/zhgh/womanCongress/controller/WomanCongressFdhCommonController.java @@ -0,0 +1,66 @@ +package io.v.nutz.zhgh.womanCongress.controller; + +import cn.wizzer.framework.base.Result; +import io.v.nutz.base.annontation.ViReturn; +import io.v.nutz.base.service.ViService; +import io.v.nutz.zhgh.womanCongress.model.WomanCongressDelegation; +import io.v.nutz.zhgh.womanCongress.model.WomanCongressSession; +import org.nutz.dao.Cnd; +import org.nutz.dao.Sqls; +import org.nutz.dao.sql.Sql; +import org.nutz.ioc.loader.annotation.Inject; +import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.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/fdh/Common") +@Ok("json:full") +public class WomanCongressFdhCommonController { + + @Inject("WomanCongressSession") + private ViService sessionViService; + + @Inject("WomanCongressDelegation") + private ViService delegationViService; + + @At + public Object getOpenFdh() { + Cnd cnd = Cnd.NEW(); + cnd.and("startState", "=", true).desc("year"); + List query = sessionViService.query(cnd); + return Result.success(query); + } + + /** + * 获取妇代会代表团 + * + * @param jdhId + * @return + */ + @At + @ViReturn + public Object getDbt(String jdhId) { + Sql sql = Sqls.create(""" + SELECT + dbt.* + FROM + woman_congress_delegation dbt + LEFT JOIN sys_dict dict ON dict.`name` = dbt.dbt_name + WHERE + dbt.fdh_id = @fdh_id + ORDER BY + dict.`code` + """).setParam("fdh_id", jdhId); + return delegationViService.list(sql); + } + + +} diff --git a/src/main/java/io/v/nutz/zhgh/womanCongress/controller/WomanCongressFdhDelegationController.java b/src/main/java/io/v/nutz/zhgh/womanCongress/controller/WomanCongressFdhDelegationController.java new file mode 100644 index 0000000..3e018ed --- /dev/null +++ b/src/main/java/io/v/nutz/zhgh/womanCongress/controller/WomanCongressFdhDelegationController.java @@ -0,0 +1,358 @@ +package io.v.nutz.zhgh.womanCongress.controller; + +import cn.wizzer.framework.base.Result; +import cn.wizzer.framework.page.Pagination; +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.base.service.ViService; +import io.v.nutz.base.utils.DateUtil; +import io.v.nutz.base.utils.Roles; +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.zhgh.womanCongress.model.WomanCongressDelegation; +import io.v.nutz.zhgh.womanCongress.model.WomanCongressDelegationMakeUpUnion; +import io.v.nutz.zhgh.womanCongress.model.WomanCongressRepresentative; +import io.v.nutz.zhgh.womanCongress.services.WomanCongressRepresentativeService; +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 org.nutz.mvc.annotation.Param; + +import java.util.List; + +/** + * @author zhf + * @date 2021/8/2 11:14 + * @description 代表团管理 + */ +@IocBean +@Ok("json:full") +@At("/platform/womanCongress/delegation") +public class WomanCongressFdhDelegationController { + + 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("WomanCongressDelegation") + private ViService delegationViService; + + @Inject("WomanCongressRepresentative") + private ViService representativeViService; + + @Inject("WomanCongressDelegationMakeUpUnion") + private ViService makeUpUnionViService; + + @Inject + private WomanCongressRepresentativeService womanCongressRepresentativeService; + + @Inject + private SysDictService sysDictService; + + @Inject + private SysRoleService sysRoleService; + @Inject + private SysUserRoleService sysUserRoleService; + + + @At("") + @Ok("beetl:platform/womanCongress/Delegation.html") + @RequiresPermissions("sys.womanCongress.delegation") + public void index() { + } + + @At + @RequiresPermissions("sys.womanCongress.delegation") + public Object getDbtFind(String fdh_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 woman_congress_delegation dbt WHERE dbt.`fdh_id` = @fdh_id ) + ORDER BY + `code` + """); + sql.setParam("dbt_id", SYS_DICT_DBT_ID); + sql.setParam("fdh_id", fdh_id); + return delegationViService.list(sql); + } + + @At + @ViReturn + @RequiresPermissions("sys.womanCongress.delegation") + public Object doAddDbt(String fdh_id, String[] dbtList) { + + Cnd cnd = Cnd.NEW(); + List dictList = sysDictService.query(cnd.and("id", "in", dbtList)); + dictList.forEach(v -> { + WomanCongressDelegation dbt = new WomanCongressDelegation(); + dbt.setFdh_id(fdh_id); + dbt.setDbt_name(v.getName()); + dbt.setCode(v.getCode()); + dbt.setFound_time(DateUtil.getDate()); + delegationViService.insert(dbt); + }); + + return null; + + } + + + @At + @ViReturn + @RequiresPermissions("sys.womanCongress.delegation") + public Object pageData(PageForm page, @Param(value = "fdh_id",required = false) String fdh_id, + @Param(value = "dbt_id",required = false) String dbt_id) { + Sql sql = Sqls.create(""" + SELECT + dbt.*,fdh.fdhAllName + FROM + `woman_congress_delegation` dbt + LEFT JOIN woman_congress_session fdh ON fdh.id = dbt.fdh_id $condition + """); + CndPlus cnd = CndPlus.create(); + cnd.andEx("dbt.fdh_id", "=", fdh_id); + cnd.andEx("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 + @RequiresPermissions("sys.womanCongress.delegation") + public Object undertakeUnionTree(String fdh_id) { + Record record = new Record(); + record.set("dbt_name", "妇代会代表团"); + Cnd cnd = Cnd.NEW(); + Sql sql = Sqls.create(""" + SELECT + dbt.*,fdh.fdhAllName + FROM + `woman_congress_delegation` dbt + LEFT JOIN woman_congress_session fdh ON fdh.id = dbt.fdh_id $condition + """); + cnd.and("dbt.fdh_id", "=", fdh_id); + cnd.asc("dbt.`code`"); + sql.setCondition(cnd); + record.set("childrens", delegationViService.list(sql)); + return record; + } + + + @At + @RequiresPermissions("sys.womanCongress.delegation") + public Object delDbt(String dbt_id, String fdh_id) { + try { + Cnd cnd = Cnd.NEW(); + cnd.and("id", "=", dbt_id).and("fdh_id", "=", fdh_id); + delegationViService.clear(cnd); + //删除组成基层工会 + makeUpUnionViService.clear(cnd); + //删除团长 副团长 操作员的权限 + sysUserRoleService.clear(Cnd.where("dbtid", "=", dbt_id).and("jdhid", "=", fdh_id).and("roleid", "in", "'" + Roles.DBT_TZ + "','" + Roles.DBT_FTZ + "'")); + //删除正式代表权限 + sysUserRoleService.clear(Cnd.where("dbtid", "=", dbt_id).and("jdhid", "=", fdh_id).and("roleid", "=", Roles.ZSDB)); + //删除代表 表用户 + representativeViService.clear(cnd); + return Result.success(); + } catch (Exception e) { + e.printStackTrace(); + return Result.error(); + } + + + } + + @At + @RequiresPermissions("sys.womanCongress.delegation") + public Object getDbTableData(String fdh_id, String dbt_id) { + CndPlus cnd = CndPlus.create(); + cnd.andEx("wo.fdh_id", "=", fdh_id); + cnd.andEx("wo.dbt_id", "=", dbt_id); + return womanCongressRepresentativeService.queryData(cnd, null, false); + } + + /** + * 查询未组成的分工会 + * + * @param fdh_id + * @param dbt_id + * @return + */ + @At + @ViReturn + @RequiresPermissions("sys.womanCongress.delegation") + public Object unionOpenAddList(String fdh_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 + woman_congress_delegation_make_up_union upunion + WHERE + upunion.fdh_id = @fdh_id + AND upunion.dbt_id != @dbt_id) + """).setParam("fdh_id", fdh_id).setParam("dbt_id", dbt_id); + return Record.create().set("data", delegationViService.list(sql)).set("value", findUnionList(dbt_id, fdh_id)); + + } + + private List findUnionList(String dbt_id, String fdh_id) { + Sql sql = Sqls.create(""" + SELECT + upunion.*, + un.unionname + FROM + woman_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.fdh_id =@fdh_id + """).setParam("dbt_id", dbt_id).setParam("fdh_id", fdh_id); + return delegationViService.list(sql); + } + + @At + public Object doUnion(String[] unionValue, String fdh_id, String dbt_id) { + makeUpUnionViService.clear(Cnd.where("fdh_id", "=", fdh_id).and("dbt_id", "=", dbt_id)); + for (String unionId : unionValue) { + WomanCongressDelegationMakeUpUnion makeUpUnion = new WomanCongressDelegationMakeUpUnion(); + makeUpUnion.setUnion_id(unionId); + makeUpUnion.setDbt_id(dbt_id); + makeUpUnion.setFdh_id(fdh_id); + makeUpUnionViService.insert(makeUpUnion); + } + return Result.success(); + } + + + /** + * 查询代表团组成工会 + * + * @param dbt_id + * @param fdh_id + * @return + */ + @At + @RequiresPermissions("sys.womanCongress.delegation") + public Object unionPageData(String dbt_id, String fdh_id) { + return findUnionList(dbt_id, fdh_id); + } + + + @At + @RequiresPermissions("sys.womanCongress.delegation") + public Object queryUser(String dbt_id, String fdh_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=@fdh_id + AND ur.userid NOT IN + (SELECT + userid + FROM + sys_user_role + WHERE + roleid IN ( '6445f21685c5489aa212a986cfbeecce', 'c1765c03459840c2b621d140f575c869' ) + AND jdhid=@fdh_id + ) + """).setParam("roleid", Roles.FDHDB).setParam("dbt_id", dbt_id).setParam("fdh_id", fdh_id); + return sysUserRoleService.list(sql); + + } + + @At + @RequiresPermissions("sys.womanCongress.delegation") + public Object doAddTz(String dbt_id, String fdh_id, String userid, Integer sf) { + + if (sf == 2) { + int count = sysUserRoleService.count(Cnd.where("jdhid", "=", fdh_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(fdh_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 + @RequiresPermissions("sys.womanCongress.delegation") + public Object getTzList(String dbt_id, String fdh_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 = @fdh_id + AND ur.roleid IN (@TZROLEID, @FTZROLEID) + ORDER BY roleId DESC + """).setParam("dbtid", dbt_id).setParam("fdh_id", fdh_id).setParam("TZROLEID", JDH_DBT_TZ_ROLE_ID).setParam("FTZROLEID", JDH_DBT_FTZ_ROLE_ID); + return sysUserRoleService.list(sql); + + } + + @At + @RequiresPermissions("sys.womanCongress.delegation") + public Object delUser(String fdh_id, String userId, String roleId) { + sysUserRoleService.clear(Cnd.where("userid", "=", userId).and("roleid", "=", roleId).and("jdhid", "=", fdh_id)); + return Result.success(); + } + + +} diff --git a/src/main/java/io/v/nutz/zhgh/womanCongress/controller/WomanCongressOrganizationController.java b/src/main/java/io/v/nutz/zhgh/womanCongress/controller/WomanCongressOrganizationController.java new file mode 100644 index 0000000..d4a8f80 --- /dev/null +++ b/src/main/java/io/v/nutz/zhgh/womanCongress/controller/WomanCongressOrganizationController.java @@ -0,0 +1,190 @@ +package io.v.nutz.zhgh.womanCongress.controller; + +import cn.wizzer.framework.base.Result; +import io.v.nutz.base.annontation.ViReturn; +import io.v.nutz.base.dao.CndPlus; +import io.v.nutz.base.query.PageForm; +import io.v.nutz.base.service.ViService; +import io.v.nutz.base.utils.Roles; +import io.v.nutz.sys.models.Sys_user_role; +import io.v.nutz.sys.services.SysDictService; +import io.v.nutz.zhgh.womanCongress.model.WomanCongressOrganizationUser; +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.lang.util.NutMap; +import org.nutz.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; +import org.nutz.mvc.annotation.Param; + +import java.util.List; + +/** + * @author zhf + * @date 2021/7/31 14:30 + * @description 妇代会组织机构 + */ +@IocBean +@Ok("json:full") +@At("/platform/womanCongress/Organization") +public class WomanCongressOrganizationController { + + private static String FDH_WYH_PARENT_ID = "d2f16a3cbb154866adaa99bfab8d79a1"; + + @At("") + @Ok("beetl:platform/womanCongress/Organization.html") + @RequiresPermissions("sys.womanCongress.organization") + public void index() { + } + + @Inject("WomanCongressOrganizationUser") + private ViService organizationViService; + + @Inject + private SysDictService sysDictService; + + @At + @RequiresPermissions("sys.womanCongress.organization") + public Object getTreeData() { + List dictList = sysDictService.listMap(Sqls.create("select * from sys_dict where parentid='%s'".formatted(FDH_WYH_PARENT_ID))); + Record record = new Record(); + record.set("name", "妇代会机构设置"); + dictList.forEach(v -> { + v.setv("childrens", child(v.getString("id"))); + }); + record.set("childrens", dictList); + return record; + } + + + private List child(String parentid) { + List dictList = sysDictService.listMap(Sqls.create("select * from sys_dict where parentid='%s'".formatted(parentid))); + dictList.forEach(v -> { + v.setv("childrens", child(v.getString("id"))); + }); + return dictList; + } + + @At + @RequiresPermissions("sys.womanCongress.organization") + public Object getUserList(String fdh_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 + woman_congress_organization_user + WHERE + fdh_id= @fdh_id + AND organization_id= @organization_id) + """).setParam("organization_id", organization_id).setParam("fdh_id", fdh_id).setParam("key", "%" + key + "%"); + return organizationViService.listPage(1, 20, sql); + } + + + @At + @ViReturn + @RequiresPermissions("sys.womanCongress.organization") + public Object doAdd(WomanCongressOrganizationUser organizationUser) { + int count = organizationViService.count(Cnd.where("user_id", "=", organizationUser.getUser_id()) + .and("organization_id", "=", organizationUser.getOrganization_id()).and("fdh_id", "=", organizationUser.getFdh_id())); + if (count > 0) { + return Result.error("人员已存在,请勿重复录入"); + } + Sys_user_role sysRole = new Sys_user_role(); + sysRole.setUserId(organizationUser.getUser_id()); + sysRole.setFdhid(organizationUser.getFdh_id()); + if (organizationUser.getOrganization_code().equals("fdhwyh1")) { + 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 + @RequiresPermissions("sys.womanCongress.organization") + public Object pageData(PageForm page, @Param(value = "fdh_id",required = false) String fdh_id, + @Param(value = "organization_id",required = false) 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.fdhAllName fdh_name, + role.`name` role_name + FROM + woman_congress_organization_user wo + LEFT JOIN woman_congress_session se ON se.id = wo.fdh_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.andEx("wo.fdh_id", "=", fdh_id); + cnd.andEx("wo.organization_id", "=", organization_id); + cnd.desc("wo.status"); + sql.setCondition(cnd); + return organizationViService.list(page, sql); + } + + + @At + @RequiresPermissions("sys.womanCongress.organization") + public Object delUser(String id) { + return organizationViService.clear(Cnd.where("id", "=", id)); + } + + + @At + @ViReturn + @RequiresPermissions("sys.womanCongress.organization") + public Object updateStatus(String fdh_id, String user_id, String status, String organization_id) { + organizationViService.update(Chain.make("status", status), Cnd.where("fdh_id", "=", fdh_id).and("organization_id", "=", organization_id).and("user_id", "=", user_id)); + return null; + } + + +} diff --git a/src/main/java/io/v/nutz/zhgh/womanCongress/controller/WomanCongressSessionController.java b/src/main/java/io/v/nutz/zhgh/womanCongress/controller/WomanCongressSessionController.java new file mode 100644 index 0000000..c4937ed --- /dev/null +++ b/src/main/java/io/v/nutz/zhgh/womanCongress/controller/WomanCongressSessionController.java @@ -0,0 +1,238 @@ +package io.v.nutz.zhgh.womanCongress.controller; + +import cn.hutool.core.util.StrUtil; +import cn.wizzer.framework.base.Result; +import io.v.nutz.base.annontation.ViReturn; +import io.v.nutz.base.dao.CndPlus; +import io.v.nutz.base.query.PageForm; +import io.v.nutz.base.service.BaseService; +import io.v.nutz.base.service.ViService; +import io.v.nutz.base.utils.DateUtil; +import io.v.nutz.base.utils.PageUtil; +import io.v.nutz.base.utils.Roles; +import io.v.nutz.base.utils.Vi; +import io.v.nutz.sys.models.Sys_user_role; +import io.v.nutz.sys.services.SysUserRoleService; +import io.v.nutz.zhgh.jdh.model.cb.Jdh_jdhxx; +import io.v.nutz.zhgh.womanCongress.model.*; +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.mvc.annotation.Param; +import org.nutz.trans.Trans; + +import java.util.List; + +/** + * @author zhf + * @date 2021/7/30 10:02 + * @description 妇代会届次管理 + */ +@IocBean +@Ok("json:full") +@At("/platform/womanCongress/Session") +public class WomanCongressSessionController { + + @Inject("Jdh_jdhxx") + private ViService jdhJdhxxViService; + + @Inject("WomanCongressSession") + private ViService fdhsessionViService; + + @Inject("WomanCongressDelegation") + private ViService delegationViService; + + @Inject("WomanCongressDelegationMakeUpUnion") + private ViService makeUpUnionViService; + + @Inject("WomanCongressRepresentative") + private ViService representativeViService; + + @Inject("WomanCongressOrganizationUser") + private ViService organizationUserViService; + + @Inject + private SysUserRoleService sysUserRoleService; + + @Inject + private BaseService baseService; + + @At("") + @Ok("beetl:platform/womanCongress/SessionCon.html") + @RequiresPermissions("sys.womanCongress.Session") + public void index() { + } + + + @At + @ViReturn + @RequiresPermissions("sys.womanCongress.Session") + public Object pageData(PageForm page, @Param(value = "year",required = false) Integer year, + @Param(value = "fdhJs",required = false) String fdhJs, + @Param(value = "fdhCs",required = false) String fdhCs) { + Cnd cnd = CndPlus.create(); + Sql sql = Sqls.create("select * from woman_congress_session $condition"); + Vi.cndPlus(cnd, "year", "=", year); + Vi.cndPlus(cnd, "fdhJs", "=", fdhJs); + Vi.cndPlus(cnd, "fdhCs", "=", fdhCs); + if (StrUtil.isAllNotBlank(page.getPageOrderName(), page.getPageOrderBy())) { + if ("fdhJs".equals(page.getPageOrderName())) { + page.setPageOrderName("year"); + } else if ("fdhCs".equals(page.getPageOrderName())) { + page.setPageOrderName("startTime"); + } + cnd.orderBy(page.getPageOrderName(), PageUtil.getOrder(page.getPageOrderBy())); + } else { + cnd.desc("startTime"); + } + sql.setCondition(cnd); + return fdhsessionViService.listPageMap(page.getPageNumber(), page.getPageSize(), sql); + } + + @At + @ViReturn + @RequiresPermissions("sys.womanCongress.Session") + public Object doAdd(WomanCongressSession womanCongressSession, boolean isExtend) { + //判断新建的教代会届次是否存在 + int count = fdhsessionViService.count(Cnd.where("fdhJs", "=", womanCongressSession.getFdhJs()).and("fdhCs", "=", womanCongressSession.getFdhCs())); + if (count > 0) { + return Result.error().addMsg("当前届次的妇代会已存在,无法重复创建!"); + } + womanCongressSession.setStartState(true); + womanCongressSession.setStartTime(DateUtil.getDate()); + WomanCongressSession insert = fdhsessionViService.insert(womanCongressSession); + if (isExtend) { + Cnd preJdh = Cnd.NEW(); + preJdh.and("fdhJs", "=", womanCongressSession.getFdhJs()).and("fdhCs", "=", getCs(womanCongressSession.getFdhCs())); + List preFdhxxList = baseService.dao().query("woman_congress_session", preJdh); + //存在上一次教代会信息才能延用 + Trans.exec(() -> { + if (preFdhxxList.size() > 0) { + String fdhId = preFdhxxList.get(0).getString("id"); + //代表团 + List dbtList = delegationViService.query(Cnd.where("fdh_id", "=", fdhId)); + dbtList.forEach(z -> { + WomanCongressDelegation delegation = new WomanCongressDelegation(); + delegation.setFdh_id(insert.getId()); + delegation.setDbt_name(z.getDbt_name()); + delegation.setCode(z.getCode()); + delegation.setFound_time(DateUtil.getDate()); + WomanCongressDelegation dbtListNew = delegationViService.insert(delegation); + //组成基层工会 + List zcfghList = makeUpUnionViService.query(Cnd.where("dbt_id", "=", z.getId())); + zcfghList.forEach(zz -> { + WomanCongressDelegationMakeUpUnion upUnion = new WomanCongressDelegationMakeUpUnion(); + upUnion.setDbt_id(dbtListNew.getId()); + upUnion.setFdh_id(insert.getId()); + upUnion.setUnion_id(zz.getUnion_id()); + makeUpUnionViService.insert(upUnion); + }); + //团长 副团长 + List ftzList = sysUserRoleService.query(Cnd.where("dbtid", "=", z.getId()).and("jdhid", "=", fdhId).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 dbList = representativeViService.query(Cnd.where("fdh_id", "=", fdhId).and("dbt_id", "=", z.getId())); + dbList.forEach(zzz -> { + Sys_user_role userRole = new Sys_user_role(); + userRole.setRoleId(Roles.FDHDB); + userRole.setJdhid(zzz.getFdh_id()); + userRole.setUserId(zzz.getUserId()); + userRole.setDbtid(dbtListNew.getId()); + sysUserRoleService.insert(userRole); + + WomanCongressRepresentative womanCongressRepresentative = new WomanCongressRepresentative(); + womanCongressRepresentative.setFdh_id(insert.getId()); + womanCongressRepresentative.setUserId(zzz.getUserId()); + womanCongressRepresentative.setRoleId(Roles.FDHDB); + womanCongressRepresentative.setDbt_id(dbtListNew.getId()); + representativeViService.insert(womanCongressRepresentative); + }); + }); + + //组织机构 + List zzjgList = organizationUserViService.query(Cnd.where("fdh_id", "=", fdhId)); + + zzjgList.forEach(jg -> { + WomanCongressOrganizationUser organizationUser = new WomanCongressOrganizationUser(); + 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.setFdh_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 + @RequiresPermissions("sys.womanCongress.Session") + public Object startStateChange(boolean startState, String id) { + boolean aa = startState ? false : true; + return fdhsessionViService.update(Chain.make("startState", aa), CndPlus.where("id", "=", id)); + } + + + @At + @RequiresPermissions("sys.womanCongress.Session") + public Object doDelete(String id) { + Trans.exec(() -> { + fdhsessionViService.clear(CndPlus.where("id", "=", id)); + delegationViService.clear(CndPlus.where("fdh_id", "=", id)); + organizationUserViService.clear(CndPlus.where("fdh_id", "=", id)); + makeUpUnionViService.clear(CndPlus.where("fdh_id", "=", id)); + representativeViService.clear(CndPlus.where("fdh_id", "=", id)); + sysUserRoleService.clear(CndPlus.where("jdhid", "=", id)); + }); + + return null; + } + + @At + @RequiresPermissions("sys.womanCongress.Session") + public Object doEdit(WomanCongressSession womanCongressSession, boolean isExtend) { + if (!isExtend) { + womanCongressSession.setStartTime(DateUtil.getDate()); + fdhsessionViService.updateIgnoreNull(womanCongressSession); + } + return null; + } + + +} diff --git a/src/main/java/io/v/nutz/zhgh/womanCongress/model/WomanCongressDelegation.java b/src/main/java/io/v/nutz/zhgh/womanCongress/model/WomanCongressDelegation.java new file mode 100644 index 0000000..67a1241 --- /dev/null +++ b/src/main/java/io/v/nutz/zhgh/womanCongress/model/WomanCongressDelegation.java @@ -0,0 +1,47 @@ +package io.v.nutz.zhgh.womanCongress.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("woman_congress_delegation") +public class WomanCongressDelegation 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 fdh_id; + + @Column + @Comment("创建时间") + @ColDefine(type = ColType.VARCHAR, width = 50) + private String found_time; + + @Column + @Comment("代表团编码") + @ColDefine(type = ColType.VARCHAR, width = 50) + private String code; + + +} diff --git a/src/main/java/io/v/nutz/zhgh/womanCongress/model/WomanCongressDelegationMakeUpUnion.java b/src/main/java/io/v/nutz/zhgh/womanCongress/model/WomanCongressDelegationMakeUpUnion.java new file mode 100644 index 0000000..e65929c4 --- /dev/null +++ b/src/main/java/io/v/nutz/zhgh/womanCongress/model/WomanCongressDelegationMakeUpUnion.java @@ -0,0 +1,38 @@ +package io.v.nutz.zhgh.womanCongress.model; + +import lombok.Data; +import org.nutz.dao.entity.annotation.*; + +/** + * @author zhf + * @date 2021/8/3 9:15 + * @description 组成分工会 + */ +@Data +@Table("woman_congress_delegation_make_up_union") +public class WomanCongressDelegationMakeUpUnion { + + + @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 fdh_id; + +} diff --git a/src/main/java/io/v/nutz/zhgh/womanCongress/model/WomanCongressOrganizationUser.java b/src/main/java/io/v/nutz/zhgh/womanCongress/model/WomanCongressOrganizationUser.java new file mode 100644 index 0000000..7cf0f00 --- /dev/null +++ b/src/main/java/io/v/nutz/zhgh/womanCongress/model/WomanCongressOrganizationUser.java @@ -0,0 +1,62 @@ +package io.v.nutz.zhgh.womanCongress.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("woman_congress_organization_user") +public class WomanCongressOrganizationUser 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 fdh_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; + + +} diff --git a/src/main/java/io/v/nutz/zhgh/womanCongress/model/WomanCongressRepresentative.java b/src/main/java/io/v/nutz/zhgh/womanCongress/model/WomanCongressRepresentative.java new file mode 100644 index 0000000..bc12af2 --- /dev/null +++ b/src/main/java/io/v/nutz/zhgh/womanCongress/model/WomanCongressRepresentative.java @@ -0,0 +1,46 @@ +package io.v.nutz.zhgh.womanCongress.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("woman_congress_representative") +public class WomanCongressRepresentative 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 fdh_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; + +} diff --git a/src/main/java/io/v/nutz/zhgh/womanCongress/model/WomanCongressSession.java b/src/main/java/io/v/nutz/zhgh/womanCongress/model/WomanCongressSession.java new file mode 100644 index 0000000..9d873e4 --- /dev/null +++ b/src/main/java/io/v/nutz/zhgh/womanCongress/model/WomanCongressSession.java @@ -0,0 +1,55 @@ +package io.v.nutz.zhgh.womanCongress.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("woman_congress_session") +public class WomanCongressSession 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 fdhJs; + + @Column + @Comment("次") + @ColDefine(type = ColType.VARCHAR, width = 10) + private String fdhCs; + + @Column + @Comment("全称") + @ColDefine(type = ColType.VARCHAR, width = 50) + private String fdhAllName; + + @Column + @Comment("开启时间") + @ColDefine(type = ColType.VARCHAR, width = 50) + private String startTime; + + @Column + @Comment("开启状态") + @ColDefine(type = ColType.BOOLEAN) + private boolean startState; + +} diff --git a/src/main/java/io/v/nutz/zhgh/womanCongress/services/WomanCongressRepresentativeService.java b/src/main/java/io/v/nutz/zhgh/womanCongress/services/WomanCongressRepresentativeService.java new file mode 100644 index 0000000..b47bde1 --- /dev/null +++ b/src/main/java/io/v/nutz/zhgh/womanCongress/services/WomanCongressRepresentativeService.java @@ -0,0 +1,50 @@ +package io.v.nutz.zhgh.womanCongress.services; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import io.v.nutz.base.query.PageForm; +import io.v.nutz.base.service.ViService; +import io.v.nutz.zhgh.womanCongress.model.WomanCongressRepresentative; +import lombok.Data; +import org.nutz.dao.Cnd; + +import java.io.Serializable; + +/** + * @author zhf + * @date 2021/7/30 13:59 + * @description + */ +public interface WomanCongressRepresentativeService extends ViService { + + /** + * 返回自定义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; + } + + + +} diff --git a/src/main/java/io/v/nutz/zhgh/womanCongress/services/impl/WomanCongressRepresentativeServiceImpl.java b/src/main/java/io/v/nutz/zhgh/womanCongress/services/impl/WomanCongressRepresentativeServiceImpl.java new file mode 100644 index 0000000..b5c6b0d --- /dev/null +++ b/src/main/java/io/v/nutz/zhgh/womanCongress/services/impl/WomanCongressRepresentativeServiceImpl.java @@ -0,0 +1,53 @@ +package io.v.nutz.zhgh.womanCongress.services.impl; + +import io.v.nutz.base.query.PageForm; +import io.v.nutz.base.service.impl.ViServiceImpl; +import io.v.nutz.zhgh.womanCongress.model.WomanCongressRepresentative; +import io.v.nutz.zhgh.womanCongress.services.WomanCongressRepresentativeService; +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; + +/** + * @author zhf + * @date 2021/7/30 14:00 + * @description + */ +@IocBean(args = {"refer:dao"}) +public class WomanCongressRepresentativeServiceImpl extends ViServiceImpl implements WomanCongressRepresentativeService { + public WomanCongressRepresentativeServiceImpl(Dao dao) { + super(dao); + } + + @Override + public Object queryData(Cnd cnd, PageForm pageForm, boolean isPage) { + Sql sql = Sqls.create(""" + SELECT + wo.*, + u.username, + u.loginname, + u.sex, + u.mobile, + u.unionname, + u.unitname, + dbt.dbt_name, + role.`name` roleName + FROM + `woman_congress_representative` wo + LEFT JOIN `user` u ON wo.userId = u.id + LEFT JOIN woman_congress_delegation dbt ON dbt.id = wo.dbt_id + LEFT JOIN sys_role role ON role.id = wo.roleId + $condition + """); + sql.setCondition(cnd); + if (pageForm == null && isPage) { + return listEntity(sql, db_excel_data.class); + } + if (!isPage) { + return list(sql); + } + return list(pageForm, sql); + } +} diff --git a/src/main/resources/static/assets/platform/js/v.js b/src/main/resources/static/assets/platform/js/v.js index f71864d..798d474 100644 --- a/src/main/resources/static/assets/platform/js/v.js +++ b/src/main/resources/static/assets/platform/js/v.js @@ -238,6 +238,24 @@ const getGdhDbt = async (jdhId) => { return data } +/** + * 获取妇代会 + * @returns {Promise<*>} + */ +const getFdh = async (open = true) => { + const {data} = await $.get("/platform/vi/common/getFdh", {open}) + return data +} + +/** + * 获取妇代会代表团 + * @returns {Promise<*>} + */ +const getFdhDbt = async (jdhId) => { + const {data} = await $.get("/platform/fdh/common/getDbt", {jdhId}) + return data +} + /** * 根据id查用户 * @returns {Promise<*>} diff --git a/src/main/resources/views/platform/qsv/activity/basicForm.js b/src/main/resources/views/platform/qsv/activity/basicForm.js index f939d53..e6276a8 100644 --- a/src/main/resources/views/platform/qsv/activity/basicForm.js +++ b/src/main/resources/views/platform/qsv/activity/basicForm.js @@ -3,6 +3,30 @@ const basicForm = {
+ + + + + 沿用 + 不沿用 + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 正式代表 + 列席代表 + 特邀代表 + + + + + 取 消 + 确 定 + + + + + + + +
+ + + + + 添加人员 + +
+ + + + + + + + + + + + + 取 消 + 确 定 + +
+ + +
+ + + + + diff --git a/src/main/resources/views/platform/womanCongress/Delegation.html b/src/main/resources/views/platform/womanCongress/Delegation.html new file mode 100644 index 0000000..4e7acf5 --- /dev/null +++ b/src/main/resources/views/platform/womanCongress/Delegation.html @@ -0,0 +1,579 @@ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + 取 消 + 确 定 + + + + +
+ + +
+ + + 取 消 + 确 定 + +
+ + + + + + + + + + + + + + + + + + + + + + + + + 团 长 + 副团长 + + + + + + + 取 消 + 确 定 + + +
+ + + + + diff --git a/src/main/resources/views/platform/womanCongress/Organization.html b/src/main/resources/views/platform/womanCongress/Organization.html new file mode 100644 index 0000000..ce66752 --- /dev/null +++ b/src/main/resources/views/platform/womanCongress/Organization.html @@ -0,0 +1,428 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 委 员 + 副主席 + 常务副主席 + 主 席 + + + + + + 委 员 + 副主任 + 主 任 + + + + + + + 确 定 + + + + +
+ + + + diff --git a/src/main/resources/views/platform/womanCongress/SessionCon.html b/src/main/resources/views/platform/womanCongress/SessionCon.html new file mode 100644 index 0000000..9ef2e64 --- /dev/null +++ b/src/main/resources/views/platform/womanCongress/SessionCon.html @@ -0,0 +1,304 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + 延用上一次妇代会的组织机构及代表信息,包含【女教职工委员会;经费审查委员会;工会委员会;人事(劳动)争议调解委员会;代表团;妇代会代表】。 + + + + + + + + 取 消 + 确 定 + + + + +
+ + + + +