init
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
package io.v.nutz.zhgh.manuscript.controller;
|
||||
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.zhgh.manuscript.models.Manuscript;
|
||||
import io.v.nutz.sys.models.Sys_menu;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
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.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/manuscript/agent")
|
||||
public class ManuscriptAgentController {
|
||||
|
||||
@Inject
|
||||
private Vi vi;
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
private static final String union = "/platform/manuscript/audit/union";
|
||||
private static final String school = "/platform/manuscript/audit/school";
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getAgenda() {
|
||||
final String title = "【新闻投稿】";
|
||||
|
||||
List<NutMap> result = new ArrayList<>();
|
||||
|
||||
result.add(new NutMap().setv("title", title).setv("url", union).setv("iconClass", vi.getIconByPath(union)).setv("label", "待院级工会审核").setv("number", getUnionCount()));
|
||||
result.add(new NutMap().setv("title", title).setv("url", school).setv("iconClass", vi.getIconByPath(school)).setv("label", "待校工会审核").setv("number", getSchoolCount()));
|
||||
|
||||
Sys_user user = (Sys_user) ShiroUtil.getPrincipal();
|
||||
List<Sys_menu> menus = Optional.ofNullable(user).orElse(new Sys_user()).getMenus();
|
||||
return result.stream().filter(v -> Strings.isNotBlank(v.getString("url")) && menus.stream().anyMatch(x -> Strings.isNotBlank(x.getHref()) && v.getString("url").contains(x.getHref()))).distinct().collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 待工会主席审核
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private Integer getUnionCount() {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT COUNT(1) FROM manuscript man LEFT JOIN `user` us ON man.userId=us.id $condition
|
||||
""");
|
||||
cnd.and("man.stateId", "=", 2000);
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin")) {
|
||||
cnd.and("us.unionid", "=", vi.getUnionId());
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return baseService.count(sql);
|
||||
}
|
||||
|
||||
private Integer getSchoolCount() {
|
||||
return baseService.dao().count(Manuscript.class, Cnd.where("stateId", "=", 2550));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package io.v.nutz.zhgh.manuscript.controller;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.zhgh.manuscript.models.Manuscript;
|
||||
import io.v.nutz.base.service.ViService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
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.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;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/12/14 11:12
|
||||
* @description
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/manuscript/apply")
|
||||
public class ManuscriptApplyController {
|
||||
|
||||
@Inject
|
||||
private Vi vi;
|
||||
|
||||
@Inject
|
||||
private ViService<Manuscript> manuscriptViService;
|
||||
|
||||
@Inject
|
||||
private ManuscriptCommonService manuscriptCommonService;
|
||||
|
||||
@At("/")
|
||||
@Ok("beetl:platform/manuscript/apply.html")
|
||||
@RequiresPermissions("manuscript.apply")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
public Object getClubByUserId() {
|
||||
return vi.getClubId();
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("manuscript.apply")
|
||||
public Object doAdd(@Param("data") Manuscript manuscript, boolean flag) {
|
||||
manuscript.setUserId(ShiroUtil.getUserId());
|
||||
manuscript.setApplyTime(DateUtil.getDate());
|
||||
if (manuscript.getType() == 2 || manuscript.getType() == 1) {
|
||||
manuscript.setStateId(flag ? 2510 : 2500);
|
||||
} else {
|
||||
manuscript.setStateId(flag ? 2550 : 2500);
|
||||
}
|
||||
|
||||
return manuscriptViService.insert(manuscript);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("manuscript.apply")
|
||||
public Object doEdit(@Param("data") Manuscript manuscript, boolean flag) {
|
||||
if (manuscript.getType() == 2 || manuscript.getType() == 1) {
|
||||
manuscript.setStateId(flag ? 2510 : 2500);
|
||||
} else {
|
||||
manuscript.setStateId(flag ? 2550 : 2500);
|
||||
}
|
||||
return manuscriptViService.updateIgnoreNull(manuscript);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("manuscript.apply")
|
||||
public Object getRoleByUserId() {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT sy.`code` FROM `sys_user_role` suy LEFT JOIN sys_role sy ON sy.id=suy.roleId WHERE suy.userId=@userId
|
||||
""").setParam("userId", ShiroUtil.getUserId());
|
||||
List<NutMap> list = manuscriptViService.listMap(sql);
|
||||
List<String> code = list.stream().map(v -> v.getString("code")).collect(Collectors.toList());
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("manuscript.apply")
|
||||
public Object findOne(String id) {
|
||||
return manuscriptCommonService.findOne(id);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
package io.v.nutz.zhgh.manuscript.controller;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.base.dao.CndPlus;
|
||||
import io.v.nutz.zhgh.manuscript.models.Manuscript;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.service.ViService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
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.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;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/12/15 10:57
|
||||
* @description
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/manuscript/apply/list")
|
||||
public class ManuscriptApplyListController {
|
||||
|
||||
@Inject("Manuscript")
|
||||
private ViService<Manuscript> manuscriptViService;
|
||||
@Inject
|
||||
private ManuscriptCommonService manuscriptCommonService;
|
||||
|
||||
|
||||
@At("/")
|
||||
@Ok("beetl:platform/manuscript/applyList.html")
|
||||
@RequiresPermissions("manuscript.apply.list")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("manuscript.apply.list")
|
||||
public Object pageData(PageForm pageForm,
|
||||
@Param(value = "year",required = false) String year) {
|
||||
CndPlus cnd = CndPlus.create();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
man.*,
|
||||
ty.manuscriptTypeName,
|
||||
us.username,
|
||||
us.loginname,
|
||||
us.unitname,
|
||||
us.unitcode,
|
||||
us.unionname,
|
||||
us.unioncode,
|
||||
state.stateName,
|
||||
state.stateColor
|
||||
FROM
|
||||
`manuscript` man
|
||||
LEFT JOIN manuscript_type ty ON man.manuscriptCode = ty.manuscriptTypeCode
|
||||
LEFT JOIN `user` us ON us.id = man.userId
|
||||
LEFT JOIN audit_state state ON state.stateId = man.stateId
|
||||
$condition
|
||||
""");
|
||||
if (Vi.isNotBlank(pageForm.getSearchName(), pageForm.getSearchKeyword())) {
|
||||
cnd.where().andLike(pageForm.getSearchName(), pageForm.getSearchKeyword());
|
||||
}
|
||||
cnd.andEX("YEAR(man.applyTime)", "=", year);
|
||||
if (!ShiroUtil.hasRole("sysadmin")) {
|
||||
cnd.and("man.userId", "=", ShiroUtil.getUserId());
|
||||
}
|
||||
cnd.desc("man.applyTime");
|
||||
sql.setCondition(cnd);
|
||||
return manuscriptViService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("manuscript.apply.list")
|
||||
public Object doDelete(String id) {
|
||||
return manuscriptViService.delete(id);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("manuscript.apply.list")
|
||||
public Object doSubmit(String id, Integer type) {
|
||||
int stateId;
|
||||
if (type == 2) {
|
||||
stateId = 2510;
|
||||
} else {
|
||||
stateId = 2550;
|
||||
}
|
||||
return manuscriptViService.update(Chain.make("stateId", stateId), Cnd.where("id", "=", id));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package io.v.nutz.zhgh.manuscript.controller;
|
||||
|
||||
import io.v.nutz.zhgh.manuscript.models.Manuscript;
|
||||
import io.v.nutz.base.service.AuditService;
|
||||
import io.v.nutz.base.service.ViService;
|
||||
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.json.Json;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/12/15 15:26
|
||||
* @description
|
||||
*/
|
||||
@IocBean
|
||||
public class ManuscriptCommonService {
|
||||
|
||||
@Inject("Manuscript")
|
||||
private ViService<Manuscript> manuscriptViService;
|
||||
|
||||
@Inject
|
||||
private AuditService auditService;
|
||||
|
||||
public NutMap findOne(String id) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
man.*,
|
||||
ty.manuscriptTypeName,
|
||||
us.username,
|
||||
us.loginname,
|
||||
us.unitname,
|
||||
us.unitcode,
|
||||
us.unionname,
|
||||
us.unioncode,
|
||||
state.stateName
|
||||
FROM
|
||||
`manuscript` man
|
||||
LEFT JOIN manuscript_type ty ON man.manuscriptCode = ty.manuscriptTypeCode
|
||||
LEFT JOIN `user` us ON us.id = man.userId
|
||||
LEFT JOIN audit_state state ON state.stateId = man.stateId
|
||||
WHERE man.id=@id
|
||||
""").setParam("id", id);
|
||||
NutMap nutMap = manuscriptViService.fetch(sql);
|
||||
if (Strings.isNotBlank(nutMap.getString("union_audit"))) {
|
||||
String[] unionAudits = Json.fromJsonAsArray(String.class, nutMap.getString("union_audit"));
|
||||
nutMap.setv("unionAudit", getAudit(unionAudits));
|
||||
}
|
||||
if (Strings.isNotBlank(nutMap.getString("school_union_audit"))) {
|
||||
String[] schoolUnionAudits = Json.fromJsonAsArray(String.class, nutMap.getString("school_union_audit"));
|
||||
nutMap.setv("schoolAudit", getAudit(schoolUnionAudits));
|
||||
}
|
||||
return nutMap;
|
||||
}
|
||||
|
||||
|
||||
private Object getAudit(String[] unionAudits) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.where().andIn("id", unionAudits);
|
||||
cnd.asc("auditTime");
|
||||
return auditService.query(cnd);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
package io.v.nutz.zhgh.manuscript.controller;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.zhgh.manuscript.models.Manuscript;
|
||||
import io.v.nutz.base.service.ViService;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/12/17 10:37
|
||||
* @description 统计表格
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/manuscript/statistics/table")
|
||||
public class ManuscriptStatisticsTableController {
|
||||
|
||||
|
||||
@Inject("Manuscript")
|
||||
private ViService<Manuscript> manuscriptViService;
|
||||
|
||||
|
||||
@At("/")
|
||||
@Ok("beetl:platform/manuscript/statisticsTable.html")
|
||||
@RequiresPermissions("manuscript.statistics.table")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("manuscript.statistics.table")
|
||||
public Object unionTableNum(Integer year) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
un.id,
|
||||
CONCAT(un.unionname,'(',un.unioncode,')') AS unionName,
|
||||
(
|
||||
SELECT
|
||||
COUNT( 1 )
|
||||
FROM
|
||||
manuscript man
|
||||
WHERE
|
||||
man.unionId = un.id
|
||||
AND man.stateId = 2570
|
||||
AND man.unionId IS NOT NULL
|
||||
and YEAR(man.applyTime)=@year
|
||||
) manuscriptNum
|
||||
FROM
|
||||
`sys_union` un
|
||||
ORDER BY un.unioncode
|
||||
""").setParam("year", year);
|
||||
return manuscriptViService.listMap(sql);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("manuscript.statistics.table")
|
||||
public Object clubTableNum(Integer year) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
cl.id,
|
||||
CONCAT( cl.`name`, '(', cl.`code`, ')' ) AS clubname,
|
||||
(
|
||||
SELECT
|
||||
COUNT( 1 )
|
||||
FROM
|
||||
manuscript man
|
||||
WHERE
|
||||
man.clubId = cl.id
|
||||
AND man.stateId = 2570
|
||||
AND man.clubId IS NOT NULL
|
||||
and YEAR(man.applyTime)=@year
|
||||
) manuscriptNum
|
||||
FROM
|
||||
`sys_club` cl
|
||||
ORDER BY
|
||||
cl.`code`
|
||||
""").setParam("year", year);
|
||||
return manuscriptViService.listMap(sql);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package io.v.nutz.zhgh.manuscript.controller;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.zhgh.manuscript.models.ManuscriptType;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.service.ViService;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/12/14 16:00
|
||||
* @description
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/manuscript/basic")
|
||||
public class ManuscriptTypeController {
|
||||
|
||||
@Inject("ManuscriptType")
|
||||
private ViService<ManuscriptType> manuscriptTypeViService;
|
||||
|
||||
@At("/")
|
||||
@Ok("beetl:platform/manuscript/basic.html")
|
||||
@RequiresPermissions("manuscript.basic")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"manuscript.basic","manuscript.apply"},logical = Logical.OR)
|
||||
public Object pageData(PageForm page) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (Strings.isNotBlank(page.getSearchName()) && Strings.isNotBlank(page.getSearchKeyword())) {
|
||||
cnd.where().andLike(page.getSearchName(), page.getSearchKeyword());
|
||||
}
|
||||
cnd.asc("manuscriptTypeCode");
|
||||
|
||||
return manuscriptTypeViService.listPage(page.getPageNumber(), page.getPageSize(), cnd);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("manuscript.basic")
|
||||
public Object doAdd(@Param("manuscriptType") ManuscriptType manuscriptType) {
|
||||
return manuscriptTypeViService.insert(manuscriptType);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("manuscript.basic")
|
||||
public Object doEdit(@Param("manuscriptType") ManuscriptType manuscriptType) {
|
||||
return manuscriptTypeViService.updateIgnoreNull(manuscriptType);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("manuscript.basic")
|
||||
public Object doDelete(String id) {
|
||||
return manuscriptTypeViService.delete(id);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"manuscript.basic","manuscript.apply"},logical = Logical.OR)
|
||||
public Object getManuscriptType() {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.asc("manuscriptTypeCode");
|
||||
return manuscriptTypeViService.query(cnd);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+126
@@ -0,0 +1,126 @@
|
||||
package io.v.nutz.zhgh.manuscript.controller.audit;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.base.dao.CndPlus;
|
||||
import io.v.nutz.zhgh.manuscript.models.Manuscript;
|
||||
import io.v.nutz.base.model.Audit;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.service.AuditService;
|
||||
import io.v.nutz.base.service.ViService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
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.lang.Strings;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/12/16 15:02
|
||||
* @description
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/manuscript/audit/school")
|
||||
public class ManuscriptSchoolController {
|
||||
|
||||
@Inject("Manuscript")
|
||||
private ViService<Manuscript> manuscriptViService;
|
||||
|
||||
@Inject
|
||||
private AuditService auditService;
|
||||
|
||||
@At("/")
|
||||
@Ok("beetl:platform/manuscript/school.html")
|
||||
@RequiresPermissions("manuscript.audit.school")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("manuscript.audit.school")
|
||||
public Object pageData(PageForm pageForm,
|
||||
@Param(value = "isManuscriptType",required = false) String isManuscriptType,
|
||||
@Param(value = "isAudit",required = false) String isAudit,
|
||||
@Param(value = "manuscriptName",required = false) String manuscriptName,
|
||||
@Param(value = "unitId",required = false) String unitId,
|
||||
@Param(value = "unionId",required = false) String unionId,
|
||||
@Param(value = "year",required = false) Integer year) {
|
||||
CndPlus cnd = CndPlus.create();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
man.*,
|
||||
ty.manuscriptTypeName,
|
||||
us.username,
|
||||
us.loginname,
|
||||
us.unitname,
|
||||
us.unitcode,
|
||||
us.unionname,
|
||||
us.unioncode,
|
||||
state.stateName,
|
||||
state.stateColor
|
||||
FROM
|
||||
`manuscript` man
|
||||
LEFT JOIN manuscript_type ty ON man.manuscriptCode = ty.manuscriptTypeCode
|
||||
LEFT JOIN `user` us ON us.id = man.userId
|
||||
LEFT JOIN audit_state state ON state.stateId = man.stateId
|
||||
$condition
|
||||
""");
|
||||
if (Vi.isNotBlank(pageForm.getSearchName(), pageForm.getSearchKeyword())) {
|
||||
cnd.where().andLike(pageForm.getSearchName(), pageForm.getSearchKeyword());
|
||||
}
|
||||
if (Strings.isNotBlank(manuscriptName)) {
|
||||
cnd.where().andLike("man.manuscriptName", manuscriptName);
|
||||
}
|
||||
if (Strings.isNotBlank(isAudit)) {
|
||||
cnd.and("man.stateId", isAudit.equals("true") ? ">" : "=", 2550);
|
||||
}
|
||||
if (Strings.isNotBlank(isManuscriptType) && isManuscriptType.equals("3")) {
|
||||
cnd.and("man.type", "=", 3);
|
||||
}
|
||||
cnd.andEX("us.unitid", "=", unitId);
|
||||
cnd.andEX("YEAR(man.applyTime)", "=", year);
|
||||
cnd.andEX("us.unionid", "=", unionId);
|
||||
|
||||
cnd.desc("man.applyTime");
|
||||
|
||||
sql.setCondition(cnd);
|
||||
return manuscriptViService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("manuscript.audit.school")
|
||||
public Object doReview(String id, Integer pass, Audit audit) {
|
||||
audit.setLoginname(ShiroUtil.getPrincipalProperty("loginname").toString());
|
||||
audit.setUsername(ShiroUtil.getPrincipalProperty("username").toString());
|
||||
audit.setAuditTime(new Date());
|
||||
audit = auditService.insert(audit);
|
||||
Manuscript manuscript = manuscriptViService.fetch(id);
|
||||
List<String> schoolUnionAudit = manuscript.getSchool_union_audit() == null ? new ArrayList<>() : manuscript.getSchool_union_audit();
|
||||
schoolUnionAudit.add(audit.getId());
|
||||
manuscript.setSchool_union_audit(schoolUnionAudit);
|
||||
if (pass == 1) {
|
||||
manuscript.setStateId(2560);
|
||||
} else if (pass == 2) {
|
||||
manuscript.setStateId(2555);
|
||||
} else {
|
||||
manuscript.setStateId(2570);
|
||||
}
|
||||
manuscriptViService.updateIgnoreNull(manuscript);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+130
@@ -0,0 +1,130 @@
|
||||
package io.v.nutz.zhgh.manuscript.controller.audit;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.base.dao.CndPlus;
|
||||
import io.v.nutz.zhgh.manuscript.models.Manuscript;
|
||||
import io.v.nutz.base.model.Audit;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.service.AuditService;
|
||||
import io.v.nutz.base.service.ViService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
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.lang.Strings;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/12/16 10:22
|
||||
* @description
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/manuscript/audit/union")
|
||||
public class ManuscriptUnionController {
|
||||
|
||||
|
||||
@Inject("Manuscript")
|
||||
private ViService<Manuscript> manuscriptViService;
|
||||
|
||||
@Inject
|
||||
private AuditService auditService;
|
||||
|
||||
@At("/")
|
||||
@Ok("beetl:platform/manuscript/union.html")
|
||||
@RequiresPermissions("manuscript.audit.union")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("manuscript.audit.union")
|
||||
public Object pageData(PageForm pageForm,
|
||||
@Param(value = "isAudit",required = false) String isAudit,
|
||||
@Param(value = "manuscriptName",required = false) String manuscriptName,
|
||||
@Param(value = "unitId",required = false) String unitId,
|
||||
@Param(value = "unionId",required = false) String unionId,
|
||||
@Param(value = "year",required = false) String year) {
|
||||
CndPlus cnd = CndPlus.create();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
man.*,
|
||||
ty.manuscriptTypeName,
|
||||
us.username,
|
||||
us.loginname,
|
||||
us.unitname,
|
||||
us.unitcode,
|
||||
us.unionname,
|
||||
us.unioncode,
|
||||
state.stateName,
|
||||
state.stateColor
|
||||
FROM
|
||||
`manuscript` man
|
||||
LEFT JOIN manuscript_type ty ON man.manuscriptCode = ty.manuscriptTypeCode
|
||||
LEFT JOIN `user` us ON us.id = man.userId
|
||||
LEFT JOIN audit_state state ON state.stateId = man.stateId
|
||||
$condition
|
||||
""");
|
||||
if (Vi.isNotBlank(pageForm.getSearchName(), pageForm.getSearchKeyword())) {
|
||||
cnd.where().andLike(pageForm.getSearchName(), pageForm.getSearchKeyword());
|
||||
}
|
||||
if (!ShiroUtil.hasRole("sysadmin")) {
|
||||
cnd.and("man.unionId", "=", Vi.getUnionId());
|
||||
}
|
||||
if (Strings.isNotBlank(manuscriptName)) {
|
||||
cnd.where().andLike("man.manuscriptName", manuscriptName);
|
||||
}
|
||||
cnd.andEX("YEAR(man.applyTime)", "=", year);
|
||||
|
||||
cnd.andEX("us.unitid", "=", unitId);
|
||||
cnd.andEX("us.unionid", "=", unionId);
|
||||
if (Strings.isNotBlank(isAudit)) {
|
||||
if (isAudit.equals("true")) {
|
||||
cnd.andEX("man.stateId", ">", "2510");
|
||||
cnd.andEX("man.stateId", "!=", "2560");
|
||||
} else {
|
||||
cnd.andEX("man.stateId", "in", "2510,2560");
|
||||
}
|
||||
}
|
||||
cnd.desc("man.applyTime");
|
||||
sql.setCondition(cnd);
|
||||
return manuscriptViService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("manuscript.audit.union")
|
||||
public Object doReview(String id, Integer pass, Audit audit) {
|
||||
audit.setLoginname(ShiroUtil.getPrincipalProperty("loginname").toString());
|
||||
audit.setUsername(ShiroUtil.getPrincipalProperty("username").toString());
|
||||
audit.setAuditTime(new Date());
|
||||
audit = auditService.insert(audit);
|
||||
Manuscript manuscript = manuscriptViService.fetch(id);
|
||||
List<String> unionAudit = manuscript.getUnion_audit() == null ? new ArrayList<>() : manuscript.getUnion_audit();
|
||||
unionAudit.add(audit.getId());
|
||||
manuscript.setUnion_audit(unionAudit);
|
||||
if (pass == 1) {
|
||||
manuscript.setStateId(2520);
|
||||
} else if (pass == 2) {
|
||||
manuscript.setStateId(2515);
|
||||
} else {
|
||||
manuscript.setStateId(2550);
|
||||
}
|
||||
manuscriptViService.updateIgnoreNull(manuscript);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package io.v.nutz.zhgh.manuscript.models;
|
||||
|
||||
import io.v.nutz.base.model.BaseModel;
|
||||
import io.v.nutz.sys.models.Sys_file;
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/12/14 10:42
|
||||
* @description 新闻投稿
|
||||
*/
|
||||
@Data
|
||||
@Table
|
||||
public class Manuscript extends BaseModel 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 = 32)
|
||||
private String userId;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("稿件名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 200)
|
||||
private String manuscriptName;
|
||||
|
||||
@Column
|
||||
@Comment("稿件类型编号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 200)
|
||||
private String manuscriptCode;
|
||||
|
||||
@Column
|
||||
@Comment("活动类型(1-协会协会、2-分工会,3校工会)")
|
||||
@ColDefine(type = ColType.INT, width = 10)
|
||||
private Integer type;
|
||||
|
||||
@Column
|
||||
@Comment("备注")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String remark;
|
||||
|
||||
@Column
|
||||
@Comment("创建人所属工会")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unionId;
|
||||
|
||||
@Column
|
||||
@Comment("创建人所属协会")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String clubId;
|
||||
|
||||
@Column
|
||||
@Comment("状态")
|
||||
@ColDefine(type = ColType.INT, width = 5)
|
||||
private int stateId;
|
||||
|
||||
@Column
|
||||
@Comment("创建时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String applyTime;
|
||||
|
||||
@Column
|
||||
@Comment("附件")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<Sys_file> files;
|
||||
|
||||
@Column
|
||||
@Comment("分工会审核记录id")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<String> union_audit;
|
||||
|
||||
@Column
|
||||
@Comment("校工会审核记录id")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<String> school_union_audit;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package io.v.nutz.zhgh.manuscript.models;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/12/14 10:57
|
||||
* @description
|
||||
*/
|
||||
@Data
|
||||
@Table()
|
||||
public class ManuscriptType {
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("稿件类型名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String manuscriptTypeName;
|
||||
|
||||
@Column
|
||||
@Comment("稿件类型编号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String manuscriptTypeCode;
|
||||
}
|
||||
Reference in New Issue
Block a user