commit
This commit is contained in:
+66
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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 )");
|
||||
|
||||
+41
-5
@@ -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<NutMap> list = pagination.getList();
|
||||
List<Sys_union> 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<String> 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();
|
||||
|
||||
Reference in New Issue
Block a user