diff --git a/src/main/java/io/v/nutz/wakershome/controller/declaration/WakesHomeDeclarationStatisticsController.java b/src/main/java/io/v/nutz/wakershome/controller/declaration/WakesHomeDeclarationStatisticsController.java new file mode 100644 index 0000000..d311127 --- /dev/null +++ b/src/main/java/io/v/nutz/wakershome/controller/declaration/WakesHomeDeclarationStatisticsController.java @@ -0,0 +1,66 @@ +package io.v.nutz.wakershome.controller.declaration; + +import io.v.nutz.annontation.ViReturn; +import io.v.nutz.base.utils.Vi; +import io.v.nutz.dao.CndPlus; +import io.v.nutz.modules.models.PageForm; +import io.v.nutz.util.ShiroUtil; +import io.v.nutz.wakershome.service.IWakesHomeApplyService; +import org.apache.shiro.authz.annotation.RequiresPermissions; +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 org.nutz.mvc.annotation.Param; + +/** + * @version 1.0 + * @Author zzr + * @name:WakesHomeDeclarationStatisticsController + * @Date 2024/8/2 15:00 + * @注释 申报,查询统计 + */ +@IocBean +@Ok("json:full") +@At("/platform/wakeshome/declaration/statistics") +public class WakesHomeDeclarationStatisticsController { + + @Inject + private IWakesHomeApplyService wakesHomeApplyService; + + @At("") + @Ok("beetl:/platform/wakeshome/declaration/statistics.html") + @RequiresPermissions("wakeshome.declaration.statistics") + public void index() {} + + + @At + @ViReturn + @RequiresPermissions("wakeshome.declaration.statistics") + public Object pageData(PageForm pageForm, + @Param(value = "year", required = false) Integer year, + @Param(value = "unionId", required = false) String unionId){ + Sql sql = Sqls.create(""" + SELECT + wh.*, + audit.stateName + FROM + `wakes_home_apply` wh + LEFT JOIN audit_state audit ON wh.state = audit.stateId + AND audit.module = 'WakesHome' + $condition + """); + CndPlus cnd = CndPlus.create(); + if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) { + cnd.and("wh.unionId", "=", Vi.getUnionId()); + } else { + cnd.andEX("wh.unionId", "=", unionId); + } + cnd.andEX("YEAR(wh.applyDate)", "=", year); + cnd.and("wh.state", "=" , 10030); + sql.setCondition(cnd); + return wakesHomeApplyService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + } +} diff --git a/src/main/java/io/v/nutz/wakershome/controller/review/StatisticsZpController.java b/src/main/java/io/v/nutz/wakershome/controller/review/StatisticsZpController.java index 3da5c7e..b306e00 100644 --- a/src/main/java/io/v/nutz/wakershome/controller/review/StatisticsZpController.java +++ b/src/main/java/io/v/nutz/wakershome/controller/review/StatisticsZpController.java @@ -2,7 +2,10 @@ package io.v.nutz.wakershome.controller.review; import cn.hutool.core.util.StrUtil; import io.v.nutz.annontation.ViReturn; +import io.v.nutz.base.utils.Vi; import io.v.nutz.modules.models.PageForm; +import io.v.nutz.util.ShiroUtil; +import io.v.nutz.wakershome.model.review.CommentZb; import io.v.nutz.wakershome.service.review.CommentPeoService; import io.v.nutz.wakershome.service.review.CommentZbService; import org.apache.shiro.authz.annotation.RequiresPermissions; @@ -12,6 +15,7 @@ import org.nutz.dao.sql.Sql; import org.nutz.dao.util.cri.SqlExpressionGroup; import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.lang.Lang; import org.nutz.lang.util.NutMap; import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.Ok; @@ -39,7 +43,6 @@ public class StatisticsZpController { @Ok("beetl:/platform/wakeshome/review/statistics.html") @RequiresPermissions("wakeshome.review.statistics") public void index() { - } @At @@ -48,6 +51,8 @@ public class StatisticsZpController { public Object pageData(PageForm page, @Param(value = "zbId", required = false) String zbId, @Param(value = "unionId", required = false) String unionId) { + + CommentZb zb = commentPeoService.dao().fetch(CommentZb.class, Cnd.where("id", "=", zbId)); Sql sql = Sqls.create(""" SELECT un.id, @@ -60,7 +65,16 @@ public class StatisticsZpController { $condition """).setParam("zbId", zbId); Cnd cnd = Cnd.NEW(); - cnd.andEX("un.id", "=", unionId); + + if (Lang.isNotEmpty(zb.getUnionIds())) { + cnd.and("un.id", "in", zb.getUnionIds()); + } else { + if (ShiroUtil.hasAnyRoles("sysadmin,A06")) { + cnd.andEX("un.id", "=", unionId); + } else { + cnd.and("un.id", "=", Vi.getUnionId()); + } + } cnd.groupBy("un.id"); cnd.desc("count( peo.id )"); diff --git a/src/main/java/io/v/nutz/wakershome/controller/review/WakesHomeReviewController.java b/src/main/java/io/v/nutz/wakershome/controller/review/WakesHomeReviewController.java index 53d2849..7b3e29c 100644 --- a/src/main/java/io/v/nutz/wakershome/controller/review/WakesHomeReviewController.java +++ b/src/main/java/io/v/nutz/wakershome/controller/review/WakesHomeReviewController.java @@ -1,22 +1,30 @@ package io.v.nutz.wakershome.controller.review; +import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONUtil; +import cn.wizzer.framework.page.Pagination; import io.v.nutz.annontation.ViReturn; +import io.v.nutz.base.utils.Vi; import io.v.nutz.modules.models.PageForm; +import io.v.nutz.sys.models.Sys_union; import io.v.nutz.wakershome.model.review.CommentPeo; import io.v.nutz.wakershome.service.review.CommentZbService; import io.v.nutz.web.commons.utils.ShiroUtil; 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.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; +import java.util.stream.Collectors; + /** * @version 1.0 * @Author zzr @@ -34,13 +42,13 @@ public class WakesHomeReviewController { @At("") @Ok("beetl:/platform/wakeshome/review/doReview.html") -// @RequiresPermissions("wakeshome.review.doReview") + @RequiresPermissions("wakeshome.review.doReview") public void index() { } @At @ViReturn -// @RequiresPermissions("wakeshome.review.doReview") + @RequiresPermissions("wakeshome.review.doReview") public Object pageData(PageForm pageForm, @Param(value = "annual", required = false) String annual, @Param(value = "assessment", required = false) String assessment){ @@ -62,13 +70,41 @@ public class WakesHomeReviewController { cnd.desc("zb.annual"); } sql.setCondition(cnd); - return commentZbService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + Pagination pagination = commentZbService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + List list = pagination.getList(); + List unionList = commentZbService.dao().query(Sys_union.class, Cnd.NEW()); + list.forEach(v -> { + //自评模式 + boolean reviewMode = v.getInt("reviewMode") == 1; + if (reviewMode && v.getInt("commentTarget") == 1) { + //校工会自评,判断有没有校工会管理员的权限 + v.put("canJoin", ShiroUtil.hasRole("A06")); + } else if (reviewMode && v.getInt("commentTarget") == 2){ + //分工会自评,判断有没有分工会管理员 + v.put("canJoin", ShiroUtil.hasRole("H04")); + } + + //自选分工会的模式 + if (StrUtil.isNotBlank(v.getString("unionIds"))) { + List unionIdList = JSONUtil.parseArray(v.getString("unionIds")).toList(String.class); + String string = unionList.stream().filter(item -> unionIdList.contains(item.getId())) + .map(Sys_union::getUnionname).collect(Collectors.joining(",")); + v.put("unionNames", string); + //如果是自评,只有分工会主席才能自评 + if (reviewMode) { + v.put("canJoin", (unionIdList.contains(Vi.getUnionId()) && ShiroUtil.hasRole("H04"))); + } else { + v.put("canJoin", unionIdList.contains(Vi.getUnionId())); + } + } + }); + return pagination; } @At @ViReturn -// @RequiresPermissions("wakeshome.review.doReview") + @RequiresPermissions("wakeshome.review.doReview") public Object getPeoId(String id){ CommentPeo peo = commentZbService.dao().fetch(CommentPeo.class, Cnd.where("zbId", "=", id).and("userId", "=", ShiroUtil.getUserId())); return peo.getId(); diff --git a/src/main/resources/static/components/wakeshome/review/UnionCommentZb.vue b/src/main/resources/static/components/wakeshome/review/UnionCommentZb.vue index f6b25ac..adc638b 100644 --- a/src/main/resources/static/components/wakeshome/review/UnionCommentZb.vue +++ b/src/main/resources/static/components/wakeshome/review/UnionCommentZb.vue @@ -126,6 +126,7 @@ diff --git a/src/main/resources/views/platform/wakeshome/declaration/statistics.html b/src/main/resources/views/platform/wakeshome/declaration/statistics.html new file mode 100644 index 0000000..45d6592 --- /dev/null +++ b/src/main/resources/views/platform/wakeshome/declaration/statistics.html @@ -0,0 +1,143 @@ + +
+ + + + + +
+ + + diff --git a/src/main/resources/views/platform/wakeshome/review/doReview.html b/src/main/resources/views/platform/wakeshome/review/doReview.html index cff5dfd..7894abf 100644 --- a/src/main/resources/views/platform/wakeshome/review/doReview.html +++ b/src/main/resources/views/platform/wakeshome/review/doReview.html @@ -32,6 +32,7 @@ layout("/layouts/platform.html"){ :picker-options="pickerOptions" v-model="pageForm.annual" type="year" + style="width: 100%" value-format="yyyy" placeholder="选择年度"> @@ -357,9 +358,10 @@ layout("/layouts/platform.html"){ async openView(id) { this.$refs.guava.view() this.loading = true; - const {code, data, msg} = await $.get(loc() + '/edit', {id}) + const {code, data, msg} = await $.get('/platform/wakeshome/review/khzb/edit', {id}) if (code === 0) { this.viewData = data + this.viewData.applyTime = [this.viewData.startTime,this.viewData.endTime] } this.loading = false; }, diff --git a/src/main/resources/views/platform/wakeshome/review/statistics.html b/src/main/resources/views/platform/wakeshome/review/statistics.html index 744d37d..17fb720 100644 --- a/src/main/resources/views/platform/wakeshome/review/statistics.html +++ b/src/main/resources/views/platform/wakeshome/review/statistics.html @@ -79,12 +79,11 @@ layout("/layouts/platform.html"){ :prop="column.prop" :width="column.width" min-width="100px"> @@ -309,7 +308,6 @@ layout("/layouts/platform.html"){ } this.doSearch() }, - }, async created() { await this.getZbList()