first commit

This commit is contained in:
zhaoxinyu
2024-04-10 15:19:47 +08:00
commit f857065a3a
2884 changed files with 683559 additions and 0 deletions
@@ -0,0 +1,97 @@
package io.v.nutz.jf.controller.Funds;
import io.v.nutz.activity.models.ActivityTissue;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.jf.service.ActivityBxService;
import io.v.nutz.service.ViService;
import io.v.nutz.sys.models.Sys_club_user;
import io.v.nutz.util.ShiroUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.dao.util.cri.Static;
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 java.util.Calendar;
/**
* @author zhf
* @date 2021/10/28 11:30
* @description
*/
@IocBean
@Ok("json:full")
@At("/platform/jf/Funds/apply")
public class FundsApplyController {
private static final NutMap projectCodeMap = new NutMap() {{
put("40002", "JC");
put("40003", "XH");
put("40001", "GH");
}};
@Inject
private Vi vi;
@Inject
private ActivityBxService activityBxService;
@Inject("ActivityTissue")
private ViService<ActivityTissue> tissueViService;
@At("")
@Ok("beetl:/platform/jf/Funds/apply.html")
@RequiresPermissions("sys.jf.Funds.apply")
public void index() {
}
@At
@ViReturn
public Object getActivity(Integer activity_type, String queryString) {
Sql sql = Sqls.create("""
SELECT
*
FROM
activity_tissue actt $condition
""");
Cnd cnd = Cnd.NEW();
cnd.and("type", "=", activity_type);
if (activity_type == 40002) {
cnd.and("unionId", "=", vi.getUnionId());
} else if (activity_type == 40003) {
cnd.and("clubId", "=", vi.getClubId());
}
cnd.and(Cnd.likeEX("actt.name", queryString));
cnd.and(new Static("( SELECT COUNT(*) FROM activity_bx ab WHERE ab.activity_id = actt.id )=0"));
sql.setCondition(cnd);
return tissueViService.listMap(sql);
}
/**
* 活动编号生成
*
* @param activity_type
* @return
*/
@At
@ViReturn
public Object generateProjectCode(String activity_type) {
Cnd cnd = Cnd.NEW();
int year = Calendar.getInstance().get(Calendar.YEAR);
cnd.and("LEFT(activityCode,6)", "=", year + projectCodeMap.getString(activity_type));
String code = String.format("%03d", activityBxService.dao().count(ActivityTissue.class, cnd) + 1);
return year + projectCodeMap.getString(activity_type) + code;
}
@At
@ViReturn
public Object getUserClub() {
return activityBxService.dao().query(Sys_club_user.class, Cnd.where("userid", "=", ShiroUtil.getUserId()));
}
}
@@ -0,0 +1,106 @@
package io.v.nutz.jf.controller.activitybx;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.utils.DateUtil;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.jf.model.ActivityBx;
import io.v.nutz.jf.service.ActivityBxService;
import io.v.nutz.sys.models.Sys_signature;
import io.v.nutz.sys.services.SysSignatureService;
import io.v.nutz.web.commons.utils.ShiroUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
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.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
/**
* @author zhf
* @date 2020/11/14 14:55
* @description 校工会会计核报
*/
@IocBean
@Ok("json")
@At("/platform/jf/activity_bx/accounting")
public class AccountingCon {
@Inject
private Vi vi;
@Inject
private ActivityBxService activityBxService;
@Inject
private SysSignatureService sysSignatureService;
@At("")
@Ok("beetl:/platform/jf/activitybx/accounting.html")
@RequiresPermissions("sys.jf.activity_bx.accounting")
public void index() {
}
@At
@ViReturn
public Object pageData(Integer year, Integer isAudit, String unitId, String unionId, String searchName, String searchKeyword, int pageNumber, int pageSize, String pageOrderName, String pageOrderBy) {
Sql sql = Sqls.create("\t\n" +
"SELECT\n" +
"\tact.*,\n" +
"\tu.loginname bxr_loginname,\n" +
"\tu.unionname bxr_unionname,\n" +
"\tu.unioncode,\n" +
"\ts.state_name,\n" +
"\ts.state_color \n" +
"FROM\n" +
"\t`activity_bx` act\n" +
"\tLEFT JOIN `user` u ON act.user_id = u.id\n" +
"\tLEFT JOIN state s ON act.state_id = s.state_id $condition");
Cnd cnd = Cnd.NEW();
if (isAudit == 1) {
cnd.and("act.state_id", ">=", 1020);
} else {
cnd.and("act.state_id", isAudit == 2 ? ">" : "=", 1020);
}
Vi.cndPlus(cnd, "act.year", "=", year);
if (Vi.isNotBlank(searchName, searchKeyword)) {
cnd.where().andLike(searchName, searchKeyword);
}
if (Vi.isNotBlank(pageOrderName, pageOrderBy)) {
cnd.orderBy(pageOrderName, pageOrderBy);
} else {
cnd.asc("act.state_id").desc("act.apply_time");
}
Vi.cndPlus(cnd, "u.unitid", "=", unitId);
Vi.cndPlus(cnd, "u.unionid", "=", unionId);
sql.setCondition(cnd);
return activityBxService.listPage(pageNumber, pageSize, sql);
}
@At
@ViReturn
public Object doReview(String id, String idea, String sign, Boolean flag) {
ActivityBx aid = activityBxService.fetch(id);
aid.setState_id(flag ? "1030" : "1025");
aid.setAccounting_name(ShiroUtil.getPrincipalProperty("id").toString());
aid.setAccounting_time(DateUtil.getDate());
aid.setAccounting_idea(idea);
if (Strings.isNotBlank(sign)) {
aid.setAccounting(sysSignatureService.insert(new Sys_signature(sign)).getId());
}
activityBxService.doEdit(aid);
return null;
}
}
@@ -0,0 +1,160 @@
package io.v.nutz.jf.controller.activitybx;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.jf.service.ActivityBxService;
import io.v.nutz.util.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.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import java.util.ArrayList;
import java.util.List;
/**
* @author zhf
* @date 2021/3/29 11:06
* @description
*/
@IocBean
@Ok("json:full")
@At("/platform/activitybx/agent")
public class ActivitybxAgentController {
//协会
private static final String ASSOCIATION = "/platform/jf/activity_bx/association";
//基层工会
private static final String DIVISION = "/platform/jf/activity_bx/division";
//会计
private static final String ACCOUNTING = "/platform/jf/activity_bx/accounting";
//校工会副主席
private static final String CONFIRM = "/platform/jf/activity_bx/confirm";
private static final String UNION = "/platform/jf/activity_bx/union";
//出纳
private static final String CASHIER = "/platform/jf/activity_bx/cashier";
@Inject
private Vi vi;
@Inject
private ActivityBxService activityBxService;
@At
@ViReturn
public Object getAgenda() {
final String title = "【活动报销】";
List<NutMap> result = new ArrayList<>();
if (ShiroUtil.hasAnyRoles("sysadmin")) {
result.add(new NutMap().setv("title", title).setv("url", ASSOCIATION).setv("iconClass", vi.getIconByPath(ASSOCIATION)).setv("label", "协会负责人审核").setv("number", getAssociationCount()).setv("title", "【活动报销系统】"));
result.add(new NutMap().setv("title", title).setv("url", DIVISION).setv("iconClass", vi.getIconByPath(DIVISION)).setv("label", "待分工会审核").setv("number", getDivisionCount()).setv("title", "【活动报销系统】"));
result.add(new NutMap().setv("title", title).setv("url", ACCOUNTING).setv("iconClass", vi.getIconByPath(ACCOUNTING)).setv("label", "待会计审核").setv("number", getAccountingCount()).setv("title", "【活动报销系统】"));
result.add(new NutMap().setv("title", title).setv("url", CONFIRM).setv("iconClass", vi.getIconByPath(CONFIRM)).setv("label", "待校工会副主席审核").setv("number", getConfirmCount()).setv("title", "【活动报销系统】"));
result.add(new NutMap().setv("title", title).setv("url", UNION).setv("iconClass", vi.getIconByPath(UNION)).setv("label", "待校工会主席审核").setv("number", getUnionCount()).setv("title", "【活动报销系统】"));
result.add(new NutMap().setv("title", title).setv("url", CASHIER).setv("iconClass", vi.getIconByPath(CASHIER)).setv("label", "待校工会出纳审核").setv("number", getCashierCount()).setv("title", "【活动报销系统】"));
} else {
if (ShiroUtil.hasAnyRoles("H02")) {
result.add(new NutMap().setv("title", title).setv("url", DIVISION).setv("iconClass", vi.getIconByPath(DIVISION)).setv("label", "待协会负责人审核").setv("number", getDivisionCount()).setv("title", "【活动报销系统】"));
}
if (ShiroUtil.hasAnyRoles("H04,gh01")) {
result.add(new NutMap().setv("title", title).setv("url", DIVISION).setv("iconClass", vi.getIconByPath(DIVISION)).setv("label", "待分工会审核").setv("number", getDivisionCount()).setv("title", "【活动报销系统】"));
}
if (ShiroUtil.hasAnyRoles("xghkj")) {
result.add(new NutMap().setv("title", title).setv("url", ACCOUNTING).setv("iconClass", vi.getIconByPath(ACCOUNTING)).setv("label", "待会计审核").setv("number", getAccountingCount()).setv("title", "【活动报销系统】"));
}
if (ShiroUtil.hasAnyRoles("wyh03")) {
result.add(new NutMap().setv("title", title).setv("url", CONFIRM).setv("iconClass", vi.getIconByPath(CONFIRM)).setv("label", "待校工会副主席审核").setv("number", getConfirmCount()).setv("title", "【活动报销系统】"));
}
if (ShiroUtil.hasAnyRoles("wyh02")) {
result.add(new NutMap().setv("title", title).setv("url", UNION).setv("iconClass", vi.getIconByPath(UNION)).setv("label", "待校工会审核").setv("number", getUnionCount()).setv("title", "【活动报销系统】"));
}
if (ShiroUtil.hasAnyRoles("xghcn")) {
result.add(new NutMap().setv("title", title).setv("url", CASHIER).setv("iconClass", vi.getIconByPath(CASHIER)).setv("label", "待校工会出纳审核").setv("number", getCashierCount()).setv("title", "【活动报销系统】"));
}
}
return result;
}
/**
* 待协会
*
* @return
*/
private Integer getAssociationCount() {
Cnd cnd = Cnd.NEW();
Sql sql = Sqls.create("""
SELECT COUNT(1) FROM `activity_bx` act LEFT JOIN sys_club cl ON cl.fzr=act.user_id $condition
""");
cnd.and("act.state_id", "=", 1000);
if (!ShiroUtil.hasAnyRoles("sysadmin")) {
cnd.and("cl.fzr", "=", ShiroUtil.getPrincipalProperty("id"));
}
sql.setCondition(cnd);
return activityBxService.count(sql);
}
/**
* 待工会主席审核
*
* @return
*/
private Integer getDivisionCount() {
Cnd cnd = Cnd.NEW();
Sql sql = Sqls.create("""
SELECT COUNT(1) FROM `activity_bx` act LEFT JOIN `user` us ON act.user_id=us.id $condition
""");
cnd.and("act.state_id", "=", 1010);
if (!ShiroUtil.hasAnyRoles("sysadmin")) {
cnd.and("us.unionid", "=", vi.getUnionId());
}
sql.setCondition(cnd);
return activityBxService.count(sql);
}
/**
* 待工会会计审核
*
* @return
*/
private Integer getAccountingCount() {
return activityBxService.count(Cnd.where("state_id", "=", 1020));
}
/**
* 校工会副主席审核
*
* @return
*/
private Integer getConfirmCount() {
return activityBxService.count(Cnd.where("state_id", "=", 1030));
}
/**
* 校工会主席审核
*
* @return
*/
private Integer getUnionCount() {
return activityBxService.count(Cnd.where("state_id", "=", 1040));
}
/**
* 校工会出纳审核
*
* @return
*/
private Integer getCashierCount() {
return activityBxService.count(Cnd.where("state_id", "=", 1050));
}
}
@@ -0,0 +1,77 @@
package io.v.nutz.jf.controller.activitybx;
import cn.wizzer.framework.base.service.BaseService;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.utils.DateUtil;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.jf.model.ActivityBx;
import io.v.nutz.jf.service.ActivityBxService;
import io.v.nutz.sys.models.Sys_signature;
import io.v.nutz.sys.services.SysSignatureService;
import io.v.nutz.web.commons.utils.ShiroUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
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.Calendar;
/**
* @Author:xsb
* @Description: 活动报销申请
* @Date:Created in 14:57 2021/1/19
*/
@IocBean
@Ok("json")
@At("/platform/jf/activity_bx/apply")
public class ApplyController {
@Inject
private Vi vi;
@Inject
private ActivityBxService activityBxService;
@Inject
private SysSignatureService sysSignatureService;
@Inject
private BaseService baseService;
@At("")
@Ok("beetl:/platform/jf/activitybx/apply.html")
@RequiresPermissions("sys.jf.activity_bx.apply")
public void index() {
}
@At
@ViReturn
public Object doAdd(@Param("activityBx") ActivityBx activityBx, @Param("sign") String sign) {
activityBx.setYear(Calendar.getInstance().get(Calendar.YEAR));
if (ShiroUtil.hasAnyRoles(new String[]{"xghhdwy", "A06"}) && activityBx.getActivity_type().equals(2)) {
activityBx.setState_id("1020");
activityBx.setActivity_type(2);
} else if (ShiroUtil.hasAnyRoles(new String[]{"H02"}) && activityBx.getActivity_type().equals(3)) {
activityBx.setState_id("1020");
activityBx.setActivity_type(3);
} else {
activityBx.setState_id("1010");
activityBx.setActivity_type(1);
}
activityBx.setApply_time(DateUtil.getDate());
activityBx.setUser_id(ShiroUtil.getPrincipalProperty("id").toString());
if (Strings.isNotBlank(sign)) {
activityBx.setUser_signature(sysSignatureService.insert(new Sys_signature(sign)).getId());
}
activityBxService.doAdd(activityBx);
return null;
}
}
@@ -0,0 +1,111 @@
package io.v.nutz.jf.controller.activitybx;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.utils.DateUtil;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.jf.model.ActivityBx;
import io.v.nutz.jf.service.ActivityBxService;
import io.v.nutz.sys.models.Sys_signature;
import io.v.nutz.sys.services.SysSignatureService;
import io.v.nutz.web.commons.utils.ShiroUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
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.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
/**
* @author zhf
* @date 2020/12/6 15:23
* @description 协会负责人审核
*/
@IocBean
@Ok("json")
@At("/platform/jf/activity_bx/association")
public class AssociationCon {
@Inject
private Vi vi;
@Inject
private ActivityBxService activityBxService;
@Inject
private SysSignatureService sysSignatureService;
@At("")
@Ok("beetl:/platform/jf/activitybx/association.html")
@RequiresPermissions("sys.jf.activity_bx.association")
public void index() {
}
@At
@ViReturn
public Object pageData(Integer year, Integer isAudit, String unitId, String unionId, String searchName, String searchKeyword, int pageNumber, int pageSize, String pageOrderName, String pageOrderBy) {
Sql sql = Sqls.create("SELECT\n" +
"\tact.*,\n" +
"\tu.loginname bxr_loginname,\n" +
"\tu.unionname bxr_unionname,\n" +
"\ts.state_name,\n" +
"\ts.state_color,\n" +
"\tcl.fzr\n" +
"FROM\n" +
"\t`activity_bx` act\n" +
"\tLEFT JOIN `user` u ON act.user_id = u.id\n" +
"\tLEFT JOIN sys_unit un ON u.unitid = un.id\n" +
"\tLEFT JOIN sys_club cl ON cl.fzr=u.id\n" +
"\tLEFT JOIN state s ON act.state_id = s.state_id $condition");
Cnd cnd = Cnd.NEW();
if (isAudit == 1) {
cnd.and("act.state_id", ">=", 1000);
} else {
cnd.and("act.state_id", isAudit == 2 ? ">" : "=", 1000);
}
cnd.and("act.activity_type", "=", 3);
if (!ShiroUtil.hasAnyRoles("sysadmin")) {
cnd.and("cl.fzr", "=", ShiroUtil.getPrincipalProperty("id"));
}
Vi.cndPlus(cnd, "act.year", "=", year);
if (Vi.isNotBlank(searchName, searchKeyword)) {
cnd.where().andLike(searchName, searchKeyword);
}
if (Vi.isNotBlank(pageOrderName, pageOrderBy)) {
cnd.orderBy(pageOrderName, pageOrderBy);
} else {
cnd.asc("act.state_id").desc("act.apply_time");
}
Vi.cndPlus(cnd, "u.unitid", "=", unitId);
Vi.cndPlus(cnd, "u.unionid", "=", unionId);
sql.setCondition(cnd);
return activityBxService.listPage(pageNumber, pageSize, sql);
}
@At
@ViReturn
public Object doReview(String id, String idea, String sign, Boolean flag) {
ActivityBx aid = activityBxService.fetch(id);
aid.setState_id(flag ? "1020" : "1005");
aid.setAssociation_principal_id(ShiroUtil.getPrincipalProperty("id").toString());
aid.setAssociation_principal_time(DateUtil.getDate());
aid.setAssociation_principal_idea(idea);
if (Strings.isNotBlank(sign)) {
aid.setAssociation_principalSign_id(sysSignatureService.insert(new Sys_signature(sign)).getId());
}
activityBxService.doEdit(aid);
return null;
}
}
@@ -0,0 +1,105 @@
package io.v.nutz.jf.controller.activitybx;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.utils.DateUtil;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.jf.model.ActivityBx;
import io.v.nutz.jf.service.ActivityBxService;
import io.v.nutz.sys.models.Sys_signature;
import io.v.nutz.sys.services.SysSignatureService;
import io.v.nutz.web.commons.utils.ShiroUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
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.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
/**
* @author zhf
* @date 2020/11/14 16:57
* @description 工会出纳转账报销
*/
@IocBean
@Ok("json")
@At("/platform/jf/activity_bx/cashier")
public class CashierCon {
@Inject
private Vi vi;
@Inject
private ActivityBxService activityBxService;
@Inject
private SysSignatureService sysSignatureService;
@At("")
@Ok("beetl:/platform/jf/activitybx/cashier.html")
@RequiresPermissions("sys.jf.activity_bx.cashier")
public void index() {
}
@At
@ViReturn
public Object pageData(Integer year, Integer isAudit, String unitId, String unionId, String searchName, String searchKeyword, int pageNumber, int pageSize, String pageOrderName, String pageOrderBy) {
Sql sql = Sqls.create("\t\n" +
"SELECT\n" +
"\tact.*,\n" +
"\tu.loginname bxr_loginname,\n" +
"\tu.unionname bxr_unionname,\n" +
"\tu.unioncode,\n" +
"\ts.state_name,\n" +
"\ts.state_color \n" +
"FROM\n" +
"\t`activity_bx` act\n" +
"\tLEFT JOIN `user` u ON act.user_id = u.id\n" +
"\tLEFT JOIN state s ON act.state_id = s.state_id $condition");
Cnd cnd = Cnd.NEW();
if (isAudit == 1) {
cnd.and("act.state_id", ">=", 1050);
} else {
cnd.and("act.state_id", isAudit == 2 ? ">" : "=", 1050);
}
Vi.cndPlus(cnd, "act.year", "=", year);
if (Vi.isNotBlank(searchName, searchKeyword)) {
cnd.where().andLike(searchName, searchKeyword);
}
if (Vi.isNotBlank(pageOrderName, pageOrderBy)) {
cnd.orderBy(pageOrderName, pageOrderBy);
} else {
cnd.asc("act.state_id").desc("act.apply_time");
}
Vi.cndPlus(cnd, "u.unitid", "=", unitId);
Vi.cndPlus(cnd, "u.unionid", "=", unionId);
sql.setCondition(cnd);
return activityBxService.listPage(pageNumber, pageSize, sql);
}
@At
@ViReturn
public Object doReview(String id, String idea, String sign, Boolean flag) {
ActivityBx aid = activityBxService.fetch(id);
aid.setState_id(flag ? "1060" : "1055");
aid.setUnion_cashier_name(ShiroUtil.getPrincipalProperty("id").toString());
aid.setUnion_cashier_time(DateUtil.getDate());
aid.setUnion_cashier_idea(idea);
if (Strings.isNotBlank(sign)) {
aid.setUnion_cashier(sysSignatureService.insert(new Sys_signature(sign)).getId());
}
activityBxService.doEdit(aid);
return null;
}
}
@@ -0,0 +1,106 @@
package io.v.nutz.jf.controller.activitybx;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.utils.DateUtil;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.jf.model.ActivityBx;
import io.v.nutz.jf.service.ActivityBxService;
import io.v.nutz.sys.models.Sys_signature;
import io.v.nutz.sys.services.SysSignatureService;
import io.v.nutz.web.commons.utils.ShiroUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
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.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
/**
* @author zhf
* @date 2020/11/14 15:46
* @description 校工会副主席审核
*/
@IocBean
@Ok("json")
@At("/platform/jf/activity_bx/confirm")
public class ConfirmCon {
@Inject
private Vi vi;
@Inject
private ActivityBxService activityBxService;
@Inject
private SysSignatureService sysSignatureService;
@At("")
@Ok("beetl:/platform/jf/activitybx/confirm.html")
@RequiresPermissions("sys.jf.activity_bx.confirm")
public void index() {
}
@At
@ViReturn
public Object pageData(Integer year, Integer isAudit, String unitId, String unionId, String searchName, String searchKeyword, int pageNumber, int pageSize, String pageOrderName, String pageOrderBy) {
Sql sql = Sqls.create("\t\n" +
"SELECT\n" +
"\tact.*,\n" +
"\tu.loginname bxr_loginname,\n" +
"\tu.unionname bxr_unionname,\n" +
"\tu.unioncode,\n" +
"\ts.state_name,\n" +
"\ts.state_color \n" +
"FROM\n" +
"\t`activity_bx` act\n" +
"\tLEFT JOIN `user` u ON act.user_id = u.id\n" +
"\tLEFT JOIN state s ON act.state_id = s.state_id $condition");
Cnd cnd = Cnd.NEW();
if (isAudit == 1) {
cnd.and("act.state_id", ">=", 1030);
} else {
cnd.and("act.state_id", isAudit == 2 ? ">" : "=", 1030);
}
Vi.cndPlus(cnd, "act.year", "=", year);
if (Vi.isNotBlank(searchName, searchKeyword)) {
cnd.where().andLike(searchName, searchKeyword);
}
if (Vi.isNotBlank(pageOrderName, pageOrderBy)) {
cnd.orderBy(pageOrderName, pageOrderBy);
} else {
cnd.asc("act.state_id").desc("act.apply_time");
}
Vi.cndPlus(cnd, "u.unitid", "=", unitId);
Vi.cndPlus(cnd, "u.unionid", "=", unionId);
sql.setCondition(cnd);
return activityBxService.listPage(pageNumber, pageSize, sql);
}
@At
@ViReturn
public Object doReview(String id, String idea, String sign, Boolean flag) {
ActivityBx aid = activityBxService.fetch(id);
aid.setState_id(flag ? "1040" : "1035");
aid.setConfirm_trade_name(ShiroUtil.getPrincipalProperty("id").toString());
aid.setConfirm_trade_time(DateUtil.getDate());
aid.setConfirm_trade_idea(idea);
if (Strings.isNotBlank(sign)) {
aid.setConfirm_trade(sysSignatureService.insert(new Sys_signature(sign)).getId());
}
activityBxService.doEdit(aid);
return null;
}
}
@@ -0,0 +1,111 @@
package io.v.nutz.jf.controller.activitybx;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.utils.DateUtil;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.jf.model.ActivityBx;
import io.v.nutz.jf.service.ActivityBxService;
import io.v.nutz.sys.models.Sys_signature;
import io.v.nutz.sys.services.SysSignatureService;
import io.v.nutz.util.ShiroUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
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.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
/**
* @author zhf
* @date 2020/11/14 10:17
* @description 基层工会核批
*/
@IocBean
@Ok("json")
@At("/platform/jf/activity_bx/division")
public class DivisionCon {
@Inject
private Vi vi;
@Inject
private ActivityBxService activityBxService;
@Inject
private SysSignatureService sysSignatureService;
@At("")
@Ok("beetl:/platform/jf/activitybx/division.html")
@RequiresPermissions("sys.jf.activity_bx.division")
public void index() {
}
@At
@ViReturn
public Object pageData(Integer year, Integer isAudit, String unitId, String unionId, String searchName, String searchKeyword, int pageNumber, int pageSize, String pageOrderName, String pageOrderBy) {
Sql sql = Sqls.create("SELECT\n" +
"\tact.*,\n" +
"\tu.loginname bxr_loginname,\n" +
"\tu.unionname bxr_unionname,\n" +
"\tu.unioncode,\n" +
"\ts.state_name,\n" +
"\ts.state_color \n" +
"FROM\n" +
"\t`activity_bx` act\n" +
"\tLEFT JOIN `user` u ON act.user_id = u.id\n" +
"\tLEFT JOIN sys_unit su ON su.id = u.unitid\n" +
"\tLEFT JOIN sys_union un ON su.unionid = un.id\n" +
"\tLEFT JOIN state s ON act.state_id = s.state_id $condition");
Cnd cnd = Cnd.NEW();
if (isAudit == 1) {
cnd.and("act.state_id", ">=", 1010);
} else {
cnd.and("act.state_id", isAudit == 2 ? ">" : "=", 1010);
}
if (!ShiroUtil.hasAnyRoles("sysadmin")) {
if (ShiroUtil.hasAnyRoles(new String[]{"H04", "gh01"})) {
cnd.and("un.id", "=", vi.getUnionId());
}
}
Vi.cndPlus(cnd, "act.year", "=", year);
if (Vi.isNotBlank(searchName, searchKeyword)) {
cnd.where().andLike(searchName, searchKeyword);
}
if (Vi.isNotBlank(pageOrderName, pageOrderBy)) {
cnd.orderBy(pageOrderName, pageOrderBy);
} else {
cnd.asc("act.state_id").desc("act.apply_time");
}
Vi.cndPlus(cnd, "u.unitid", "=", unitId);
Vi.cndPlus(cnd, "u.unionid", "=", unionId);
sql.setCondition(cnd);
return activityBxService.listPage(pageNumber, pageSize, sql);
}
@At
@ViReturn
public Object doReview(String id, String idea, String sign, Boolean flag) {
ActivityBx aid = activityBxService.fetch(id);
aid.setState_id(flag ? "1020" : "1015");
aid.setDivision_chairman_name(ShiroUtil.getPrincipalProperty("id").toString());
aid.setDivision_chairman_time(DateUtil.getDate());
aid.setDivision_chairman_idea(idea);
if (Strings.isNotBlank(sign)) {
aid.setDivision_chairman(sysSignatureService.insert(new Sys_signature(sign)).getId());
}
activityBxService.doEdit(aid);
return null;
}
}
@@ -0,0 +1,558 @@
package io.v.nutz.jf.controller.activitybx;
import cn.wizzer.framework.base.service.BaseService;
import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.config.Configure;
import com.deepoove.poi.data.PictureRenderData;
import com.deepoove.poi.policy.HackLoopTableRenderPolicy;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.utils.DateUtil;
import io.v.nutz.base.utils.Html2Text;
import io.v.nutz.base.utils.Roles;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.jf.model.ActivityBx;
import io.v.nutz.jf.model.ActivityFile;
import io.v.nutz.jf.service.ActivityBxService;
import io.v.nutz.jf.service.ActivityFileService;
import io.v.nutz.sys.models.Sys_signature;
import io.v.nutz.sys.services.SysSignatureService;
import io.v.nutz.util.MoneyUtil;
import io.v.nutz.web.commons.utils.ShiroUtil;
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.dao.util.cri.SqlExpressionGroup;
import org.nutz.dao.util.cri.Static;
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 javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.util.Base64;
import java.util.Calendar;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author zhf
* @date 2020/11/13 10:45
* @description 活动报销记录
*/
@IocBean
@Ok("json")
@At("/platform/jf/activity_bx/recording")
public class ReimbursementCon {
@Inject
private Vi vi;
@Inject
private ActivityBxService activityBxService;
@Inject
private SysSignatureService sysSignatureService;
@Inject
private BaseService baseService;
@Inject
private ActivityFileService activityFileService;
@At("")
@Ok("beetl:/platform/jf/activitybx/recording.html")
@RequiresPermissions("sys.jf.activity_bx.recording")
public void index() {
}
@At
@ViReturn
public Object doAdd(@Param("activityBx") ActivityBx activityBx, @Param("sign") String sign) {
activityBx.setYear(Calendar.getInstance().get(Calendar.YEAR));
if (ShiroUtil.hasAnyRoles(new String[]{"xghhdwy", "A06"}) && activityBx.getActivity_type().equals(2)) {
activityBx.setState_id("1020");
activityBx.setActivity_type(2);
} else if (ShiroUtil.hasAnyRoles(new String[]{"H02"}) && activityBx.getActivity_type().equals(3)) {
activityBx.setState_id("1000");
activityBx.setActivity_type(3);
} else {
activityBx.setState_id("1010");
activityBx.setActivity_type(1);
}
activityBx.setApply_time(DateUtil.getDate());
activityBx.setUser_id(ShiroUtil.getPrincipalProperty("id").toString());
if (Strings.isNotBlank(sign)) {
activityBx.setUser_signature(sysSignatureService.insert(new Sys_signature(sign)).getId());
}
activityBxService.doAdd(activityBx);
return null;
}
/**
* 多功能查询
*
* @param year 根据年查
* @param searchName 根据名查
* @param searchKeyword
* @param pageNumber
* @param pageSize
* @param pageOrderName
* @param pageOrderBy
* @return
*/
@At
@ViReturn
public Object pageData(Integer year, String unitId, String unionId, String searchName, String searchKeyword, int pageNumber, int pageSize, String pageOrderName, String pageOrderBy) {
Sql sql = Sqls.create("""
SELECT
bx.*,
bxr.loginname bxr_loginname,
bxr.unionname bxr_unionname,
bxr.unioncode,
state.state_name,
state.state_color,(
CASE
state.state_id
WHEN @state1 THEN
(
SELECT
GROUP_CONCAT( u.username )
FROM
sys_user_role sur
LEFT JOIN sys_user u ON sur.userId = u.id
WHERE
sur.roleId = @role1
)
WHEN @state2 THEN
(
SELECT
GROUP_CONCAT( u.username )
FROM
sys_user_role sur
LEFT JOIN sys_user u ON sur.userId = u.id
WHERE
sur.unionid = bxr.unionid
AND sur.roleId = @role2
)
WHEN @state3 THEN
(
SELECT
GROUP_CONCAT( u.username )
FROM
sys_user_role sur
LEFT JOIN sys_user u ON sur.userId = u.id
WHERE
sur.roleId = @role3
)
WHEN @state4 THEN
(
SELECT
GROUP_CONCAT( u.username )
FROM
sys_user_role sur
LEFT JOIN sys_user u ON sur.userId = u.id
WHERE
sur.roleId = @role4
)
WHEN @state5 THEN
(
SELECT
GROUP_CONCAT( u.username )
FROM
sys_user_role sur
LEFT JOIN sys_user u ON sur.userId = u.id
WHERE
sur.roleId = @role5
)
WHEN @state6 THEN
(
SELECT
GROUP_CONCAT( u.username )
FROM
sys_user_role sur
LEFT JOIN sys_user u ON sur.userId = u.id
WHERE
sur.roleId = @role6
) ELSE NULL
END
) shrname
FROM
activity_bx bx
LEFT JOIN `user` bxr ON bx.user_id = bxr.id
LEFT JOIN state state ON state.state_id = bx.state_id $condition
""");
sql.setParam("role1", Roles.CLUB_FZR);
sql.setParam("role2", Roles.UNION_MANGER);
sql.setParam("role3", Roles.XGHKJ);
sql.setParam("role4", Roles.GH_WYH_FZX);
sql.setParam("role5", Roles.GH_WYH_CWFZX);
sql.setParam("role6", Roles.XGHCN);
sql.setParam("state1", 1000);
sql.setParam("state2", 1010);
sql.setParam("state3", 1020);
sql.setParam("state4", 1030);
sql.setParam("state5", 1040);
sql.setParam("state6", 1050);
Cnd cnd = Cnd.NEW();
if (!ShiroUtil.hasAnyRoles("sysadmin")) {
cnd.and("bx.user_id", "=", ShiroUtil.getPrincipalProperty("id"));
}
Vi.cndPlus(cnd, "bx.year", "=", year);
if (Vi.isNotBlank(searchName, searchKeyword)) {
cnd.where().andLike(searchName, searchKeyword);
}
if (Vi.isNotBlank(pageOrderName, pageOrderBy)) {
cnd.orderBy(pageOrderName, pageOrderBy);
} else {
cnd.asc("bx.state_id").desc("bx.apply_time");
}
Vi.cndPlus(cnd, "bxr.unitid", "=", unitId);
Vi.cndPlus(cnd, "bxr.unionid", "=", unionId);
sql.setCondition(cnd);
return activityBxService.listPage(pageNumber, pageSize, sql);
}
@At
@ViReturn
public Object findOne(String id) {
return queryOne(id);
}
private Record queryOne(String id) {
Sql sql = Sqls.create("SELECT\n" +
"\tact.*,\n" +
"\t`user`.loginname,\n" +
"\ts.state_name,\n" +
"\ts.state_color,\n" +
"\td_c.username dc_username,\n" +
"\td_c.loginname dc_loginname,\n" +
"\ta.username a_username,\n" +
"\ta.loginname a_loginname,\n" +
"\tc_t.username ct_username,\n" +
"\tc_t.loginname ct_loginname,\n" +
"\tu_c.username uc_username,\n" +
"\tu_c.loginname uc_loginname,\n" +
"\tucc_c.username ucc_username,\n" +
"\tucc_c.loginname ucc_loginname,\n" +
"\tdc_s.`data` dc_s,\n" +
"\ta_s.`data` a_s,\n" +
"\tct_s.`data` ct_s,\n" +
"\tuc_s.`data` uc_s,\n" +
"\tucc_s.`data` ucc_s,\n" +
"\tus_s.`data` us_s\n" +
"FROM\n" +
"\tactivity_bx act\n" +
"\tLEFT JOIN sys_user `user` ON act.user_id = `user`.id\n" +
"\tLEFT JOIN state s ON act.state_id = s.state_id\n" +
"\tLEFT JOIN sys_user d_c ON d_c.id = act.division_chairman_name\n" +
"\tLEFT JOIN sys_user a ON a.id = act.accounting_name\n" +
"\tLEFT JOIN sys_user c_t ON c_t.id = act.confirm_trade_name\n" +
"\tLEFT JOIN sys_user u_c ON u_c.id = act.union_cashier_name\n" +
"\tLEFT JOIN sys_user ucc_c ON ucc_c.id = act.union_chairman_name\n" +
"\tLEFT JOIN sys_signature dc_s ON dc_s.id = act.division_chairman\n" +
"\tLEFT JOIN sys_signature a_s ON a_s.id = act.accounting\n" +
"\tLEFT JOIN sys_signature ct_s ON ct_s.id = act.confirm_trade\n" +
"\tLEFT JOIN sys_signature uc_s ON uc_s.id = act.union_cashier\n" +
"\tLEFT JOIN sys_signature ucc_s ON ucc_s.id = act.union_chairman\n" +
"\tLEFT JOIN sys_signature us_s ON us_s.id = act.user_signature \n" +
"WHERE\n" +
"\tact.id = @id").setParam("id", id);
Record record = activityBxService.list(sql).get(0);
record.set("Goods", baseService.dao().query("Goods", Cnd.where("reid", "=", id)));
if (record.size() == 0) {
return null;
}
String activity_id = record.getString("activity_id");
if (Strings.isNotBlank(activity_id)) {
List<ActivityFile> files = activityFileService.query(Cnd.where("activity_id", "=", activity_id).desc("time"));
LinkedHashMap<String, List<ActivityFile>> collect = files.stream().collect(Collectors.groupingBy(ActivityFile::getTime, LinkedHashMap::new, Collectors.toList()));
record.set("activity_files", collect);
}
return record;
}
@At
@ViReturn
public Object doEdit(@Param("activityBx") ActivityBx activityBx, @Param("sign") String sign, String[] delNotesList) {
if (delNotesList != null && delNotesList.length > 0) {
for (String s : delNotesList) {
if (Strings.isNotBlank(s)) {
baseService.clear("goods", Cnd.where("id", "=", s));
}
}
}
if (!activityBx.getGoods().isEmpty()) {
activityBx.getGoods().forEach(goods -> {
if (Strings.isBlank(goods.getId())) {
goods.setReid(activityBx.getId());
baseService.insert(goods);
}
});
}
if (Strings.isNotBlank(sign)) {
activityBx.setUser_signature(sysSignatureService.insert(new Sys_signature(sign)).getId());
}
activityBxService.doEdit(activityBx);
return null;
}
@At
@ViReturn
public Object doDelete(String id) {
ActivityBx activityBx = activityBxService.fetch(id);
vi.deleteSysFiles(activityBx.getFiles());
baseService.clear("goods", Cnd.where("reid", "=", id));
return activityBxService.delete(id);
}
@At
@Ok("void")
@ViReturn
public void doExport(String id, HttpServletResponse response) throws Exception {
Sql sql = Sqls.create("SELECT\n" +
"\tbx.user_name,\n" +
"\tbx.apply_time,\n" +
"\tbx.activity_name,\n" +
"\tbx.activity_time,\n" +
"\tbx.activity_number,\n" +
"\tbx.activity_money,\n" +
"\tbx.activity_card_number,\n" +
"\tbx.venue,\n" +
"\tbx.activity_content,\n" +
"\tbx.activity_type,\n" +
"\tun.`name` unitname,\n" +
"\tms.`data` my_sign,\n" +
"\tfzs.`data` fgh_zx_sign,\n" +
"\tfks.`data` fgh_kj_sign,\n" +
"\txzs.`data` xgh_zx_sign,\n" +
"\tap.`data` ap_sign,\n" +
"\tkj.`data` kj_sign,\n" +
"\tct.`data` ct_sign\n" +
"FROM\n" +
"\tactivity_bx bx\n" +
"\tLEFT JOIN sys_user us ON us.id=bx.user_id\n" +
"\tLEFT JOIN sys_unit un ON un.id=us.unitid\n" +
"\tLEFT JOIN sys_signature ms ON ms.id = bx.user_signature\n" +
"\tLEFT JOIN sys_signature fzs ON fzs.id = bx.division_chairman\n" +
"\tLEFT JOIN sys_signature fks ON fks.id = bx.accounting\n" +
"\tLEFT JOIN sys_signature xzs ON xzs.id = bx.union_chairman\n" +
"\tLEFT JOIN sys_signature ap ON ap.id = bx.association_principalSign_id \n" +
"\tLEFT JOIN sys_signature kj on kj.id=bx.accounting \n" +
"\tLEFT JOIN sys_signature ct on ct.id=bx.confirm_trade \n" +
"\tWHERE bx.id = @id").setParam("id", id);
Record o = activityBxService.list(sql).get(0);
List<Record> query = baseService.dao().query("goods", Cnd.where("reid", "=", id));
o.set("activity_content", Html2Text.getContent(o.getString("activity_content")));
o.set("activity_money_big", MoneyUtil.toRMBUpper(String.valueOf(o.getDouble("activity_money"))));
for (int i = 0; i < query.size(); i++) {
double price = query.get(i).getDouble("price");
int money_int = (int) price;
double money_decimal = money_int - price;
query.get(0).set("activity_name", o.get("activity_name"));
query.get(i).set("one", money_int > 1000000 ? (money_int / 1000000) % 10 : null);
query.get(i).set("two", money_int > 100000 ? (money_int / 100000) % 10 : null);
query.get(i).set("three", money_int > 10000 ? (money_int / 10000) % 10 : null);
query.get(i).set("four", money_int > 1000 ? (money_int / 1000) % 10 : null);
query.get(i).set("five", money_int > 100 ? (money_int / 100) % 10 : null);
query.get(i).set("six", money_int > 10 ? (money_int / 10) % 10 : null);
query.get(i).set("seven", money_int > 10 ? money_int % 10 : null);
query.get(i).set("eight", (int) (money_decimal / 1) * 10);
query.get(i).set("nine", (int) (money_decimal / 0.1) * 100);
}
/*自己签字*/
if (o.get("my_sign") != null) {
o.set("my_sign", getImage((String) o.get("my_sign")));
}
/*基层工会主席签字*/
if (o.get("fgh_zx_sign") != null) {
o.set("fgh_zx_sign", getImage((String) o.get("fgh_zx_sign")));
}
/*校工会主席签字*/
if (o.get("xgh_zx_sign") != null) {
o.set("xgh_zx_sign", getImage((String) o.get("xgh_zx_sign")));
}
/*协会负责人*/
if (o.get("ap_sign") != null) {
o.set("ap_sign", getImage((String) o.get("ap_sign")));
}
/*校工会副主席*/
if (o.get("ct_sign") != null) {
o.set("ct_sign", getImage((String) o.get("ct_sign")));
}
/*会计*/
if (o.get("kj_sign") != null) {
o.set("kj_sign", getImage((String) o.get("kj_sign")));
}
HackLoopTableRenderPolicy policy = new HackLoopTableRenderPolicy();
Configure config = Configure.newBuilder().bind("goods", policy).build();
o.set("goods", query);
InputStream inputStream = null;
// 基层工会活动
if (o.getString("activity_type").equals("1")) {
o.set("suffix", "基层工会主席签字");
inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("docTemplate/funds.docx");
}
// 校工会活动
else if (o.getString("activity_type").equals("2")) {
o.set("suffix", "校工会主席签字");
inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("docTemplate/school.docx");
}
// 协会负责人
else if (o.getString("activity_type").equals("3")) {
o.set("suffix", "协会负责人签字");
inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("docTemplate/association.docx");
}
response.addHeader("Content-Type", "application/octet-stream");
response.addHeader("Content-Disposition", "attachment; filename=\"" + new String("活动费用报销单".getBytes("UTF-8"), "ISO-8859-1") + "\".docx");
XWPFTemplate.compile(inputStream, config).render(o, response.getOutputStream());
inputStream.close();
}
private PictureRenderData getImage(String base64) throws IOException {
String s = base64.split(",")[1];
byte[] bytes = Base64.getDecoder().decode(s);
return new PictureRenderData(70, 30, ".png", bytes);
}
@At
@ViReturn
public Object getActivity(String query) {
Sql sql = Sqls.create("SELECT YEAR\n" +
"\t( hd.be_time ) YEAR,\n" +
"\thd.*,\n" +
"\ttype.`name` style,\n" +
"\tproject.`name` project,\n" +
"\tun.unionname,\n" +
"\tclub.`name` clubname \n" +
"FROM\n" +
"\t(\n" +
"\tSELECT\n" +
"\t\t1 type,\n" +
"\t\thd.id,\n" +
"\t\thd.hdlxid style_id,\n" +
"\t\thd.hdxmid project_id,\n" +
"\t\thd.xhdmc `name`,\n" +
"\t\thd.hddz address,\n" +
"\t\t(SELECT count(1) from hd_xhdbm bm WHERE bm.hdid = hd.id) number,\n" +
"\t\thd.bmkssj apply_be_time,\n" +
"\t\thd.bmjssj apply_end_time,\n" +
"\t\thd.hdkssj be_time,\n" +
"\t\thd.hdjssj end_time,\n" +
"\t\tNULL reid \n" +
"\tFROM\n" +
"\t\thd_xhd hd UNION ALL\n" +
"\tSELECT\n" +
"\t\t2 type,\n" +
"\t\thd.id,\n" +
"\t\thd.hdlxid style_id,\n" +
"\t\thd.hdxmid project_id,\n" +
"\t\thd.fhdmc `name`,\n" +
"\t\thd.hddz address,\n" +
"\t\t(SELECT count(1) from hd_fhdbm bm WHERE bm.hdid = hd.id) number,\n" +
"\t\thd.bmkssj apply_be_time,\n" +
"\t\thd.bmjssj apply_end_time,\n" +
"\t\thd.hdkssj be_time,\n" +
"\t\thd.hdjssj end_time,\n" +
"\t\thd.unionid reid \n" +
"\tFROM\n" +
"\t\thd_fhhd hd UNION ALL\n" +
"\tSELECT\n" +
"\t\t3 type,\n" +
"\t\thd.id,\n" +
"\t\thd.hdlxid style_id,\n" +
"\t\thd.hdxmid project_id,\n" +
"\t\thd.hdmc `name`,\n" +
"\t\thd.hddz address,\n" +
"\t\t(SELECT count(1) from hd_sthdbm bm WHERE bm.sthdid = hd.id) number,\n" +
"\t\thd.bmkssj apply_be_time,\n" +
"\t\thd.bmjssj apply_end_time,\n" +
"\t\thd.hdkssj be_time,\n" +
"\t\thd.hdjssj end_time,\n" +
"\t\thd.stid reid \n" +
"\tFROM\n" +
"\t\thd_sthd hd \n" +
"\t) hd\n" +
"\tLEFT JOIN hd_type type ON hd.style_id = type.id\n" +
"\tLEFT JOIN hd_type project ON hd.project_id = project.id\n" +
"\tLEFT JOIN sys_union un ON hd.reid = un.id\n" +
"\tLEFT JOIN sys_club club ON hd.reid = club.id $condition");
Cnd cnd = Cnd.NEW();
cnd.and(new Static("(SELECT count(1) from activity_bx bx WHERE bx.activity_id = hd.id) = 0 "));
SqlExpressionGroup exps1 = Cnd.exps(new Static("false"));
SqlExpressionGroup exps2 = Cnd.exps(new Static("false"));
SqlExpressionGroup exps3 = Cnd.exps(new Static("false"));
if (!ShiroUtil.hasAnyRoles("sysadmin")) {
if (ShiroUtil.hasAnyRoles("A06,xghhdwy")) {
exps1 = new SqlExpressionGroup();
exps1.and("hd.type", "=", 1);
}
if (ShiroUtil.hasAnyRoles("H04,gh08")) {
exps2 = new SqlExpressionGroup();
exps2.and("hd.type", "=", 2);
exps2.and("hd.reid", "=", vi.getUnionId());
}
if (ShiroUtil.hasAnyRoles("H02")) {
exps3 = new SqlExpressionGroup();
exps3.and("hd.type", "=", 3);
exps3.and(new Static(String.format("hd.reid in (SELECT club.id from sys_club club WHERE club.fzr = '%s')", ShiroUtil.getPrincipalProperty("id"))));
}
cnd.and(Cnd.NEW().where().or(exps1).or(exps2).or(exps3));
}
sql.setCondition(cnd);
return activityBxService.listPage(1, 50, sql).getList();
}
}
@@ -0,0 +1,244 @@
package io.v.nutz.jf.controller.activitybx;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.jf.service.ActivityBxService;
import io.v.nutz.sys.services.SysUnionService;
import io.v.nutz.web.commons.utils.ShiroUtil;
import org.apache.poi.ss.usermodel.Workbook;
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.dao.util.cri.SqlExpressionGroup;
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 javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
* @author zhf
* @date 2020/11/15 14:05
* @description 活动报销查看
*/
@IocBean
@Ok("json")
@At("/platform/jf/activity_bx/reimbursementview")
public class ReimbursementViewCon {
@Inject
private Vi vi;
@Inject
private ActivityBxService activityBxService;
private SysUnionService sysUnionService;
@At("")
@Ok("beetl:/platform/jf/activitybx/reimbursementview.html")
@RequiresPermissions("sys.jf.activity_bx.reimbursementview")
public void index() {
}
@At
@ViReturn
public Object pageData(Integer year, String searchName, String unitId, String unionId, String searchKeyword, int pageNumber, int pageSize, String pageOrderName, String pageOrderBy) {
Sql sql = Sqls.create("SELECT\n" +
"\tact.*,\n" +
"\tu.loginname,\n" +
"\tun.unionname,\n" +
"\tun.unioncode,\n" +
"\ts.state_name,\n" +
"\ts.state_color \n" +
"FROM\n" +
"\t`activity_bx` act\n" +
"\tLEFT JOIN `user` u ON act.user_id = u.id\n" +
"\tLEFT JOIN sys_unit su ON su.id = u.unitid\n" +
"\tLEFT JOIN sys_union un ON su.unionid = un.id\n" +
"\tLEFT JOIN state s ON act.state_id = s.state_id $condition");
Cnd cnd = Cnd.NEW();
if (!ShiroUtil.hasAnyRoles("sysadmin,wyh02")) {
SqlExpressionGroup group2 = new SqlExpressionGroup();
if (ShiroUtil.hasAnyRoles("gh01,H04")) {
group2.or("u.unionid", "=", vi.getUnionId());
} else {
group2.or("act.user_id", "=", ShiroUtil.getPrincipalProperty("id").toString());
}
cnd.and(group2);
}
Vi.cndPlus(cnd, "act.year", "=", year);
if (Vi.isNotBlank(searchName, searchKeyword)) {
cnd.where().andLike(searchName, searchKeyword);
}
Vi.cndPlus(cnd, "u.unitid", "=", unitId);
Vi.cndPlus(cnd, "u.unionid", "=", unionId);
if (Vi.isNotBlank(pageOrderName, pageOrderBy)) {
cnd.orderBy(pageOrderName, pageOrderBy);
} else {
cnd.asc("act.state_id").desc("act.apply_time");
}
sql.setCondition(cnd);
return activityBxService.listPage(pageNumber, pageSize, sql);
}
/**
* 下载名单
*/
@At
public void download(Integer year, HttpServletResponse response) throws IOException {
Sql sql = Sqls.create("SELECT\n" +
"\tact.*,\n" +
"\tu.loginname,\n" +
"\tu.unionname unionname,\n" +
"\ts.state_name,\n" +
"\ts.state_color ,\n" +
"\tun.unionname\n" +
"FROM\n" +
"\tactivity_bx act\n" +
"\tLEFT JOIN `user` u ON act.user_id = u.id\n" +
"\tLEFT JOIN state s ON act.state_id = s.state_id\n" +
"\tLEFT JOIN sys_union un ON un.id=u.unionid $condition");
Cnd cnd = Cnd.NEW();
Vi.cndPlus(cnd, "act.year", "=", year);
cnd.asc("u.unitid").asc("user_id");
sql.setCondition(cnd);
List<Record> list = activityBxService.list(sql);
List<E> re = new ArrayList<>();
int i = 0;
for (Record record : list) {
i++;
E e = new E();
e.setIndex(i);
e.setUser(record.getString("user_name"));
e.setUnionname(record.getString("unionname"));
e.setActivity_time(record.getString("activity_time"));
e.setNumber(record.getString("activity_number"));
e.setPlace(record.getString("venue"));
e.setContent(record.getString("activity_content"));
e.setReimbursement_time(record.getString("apply_time"));
re.add(e);
}
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment;filename=" + new String(("中国药科大学" + year + "活动经费报销表.xls").getBytes("utf-8"), "ISO8859-1"));
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), E.class, re);
workbook.write(response.getOutputStream());
}
/**
* 导出Excel类要用
*/
public class E {
@Excel(name = "序号", width = 10d)
private int index;
@Excel(name = "申请人姓名", width = 20d)
private String user;
@Excel(name = "基层工会", width = 25d)
private String unionname;
@Excel(name = "活动时间", width = 25d)
private String activity_time;
@Excel(name = "会员人数", width = 25d)
private String number;
@Excel(name = "地点", width = 25d)
private String place;
@Excel(name = "内容", width = 25d)
private String content;
@Excel(name = "申请时间", width = 20d)
private String reimbursement_time;
public int getIndex() {
return index;
}
public void setIndex(int index) {
this.index = index;
}
public String getUser() {
return user;
}
public void setUser(String user) {
this.user = user;
}
public String getUnionname() {
return unionname;
}
public void setUnionname(String unionname) {
this.unionname = unionname;
}
public String getActivity_time() {
return activity_time;
}
public void setActivity_time(String activity_time) {
this.activity_time = activity_time;
}
public String getNumber() {
return number;
}
public void setNumber(String number) {
this.number = number;
}
public String getPlace() {
return place;
}
public void setPlace(String place) {
this.place = place;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getReimbursement_time() {
return reimbursement_time;
}
public void setReimbursement_time(String reimbursement_time) {
this.reimbursement_time = reimbursement_time;
}
}
}
@@ -0,0 +1,131 @@
package io.v.nutz.jf.controller.activitybx;
import io.v.nutz.activity.services.ActivityTissueService;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.utils.DateUtil;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.jf.model.ActivityBx;
import io.v.nutz.jf.model.jf_use;
import io.v.nutz.jf.model.jf_yjgh;
import io.v.nutz.jf.service.ActivityBxService;
import io.v.nutz.sys.models.Sys_signature;
import io.v.nutz.sys.services.SysSignatureService;
import io.v.nutz.web.commons.utils.ShiroUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
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.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import java.util.Calendar;
/**
* @author zhf
* @date 2020/11/14 16:03
* @description 校工会主席审核
*/
@IocBean
@Ok("json")
@At("/platform/jf/activity_bx/union")
public class UnionCon {
@Inject
private Vi vi;
@Inject
private ActivityBxService activityBxService;
@Inject
private SysSignatureService sysSignatureService;
@Inject
private io.v.nutz.jf.service.jfUseService jfUseService;
@Inject
private io.v.nutz.jf.service.jfYjghService jfYjghService;
@Inject
private ActivityTissueService activityTissueService;
@Inject
private io.v.nutz.jf.service.jfClubService jfClubService;
@At("")
@Ok("beetl:/platform/jf/activitybx/union.html")
@RequiresPermissions("sys.jf.activity_bx.union")
public void index() {
}
@At
@ViReturn
public Object pageData(Integer year, Integer isAudit, String unitId, String unionId, String searchName, String searchKeyword, int pageNumber, int pageSize, String pageOrderName, String pageOrderBy) {
Sql sql = Sqls.create("\t\n" +
"SELECT\n" +
"\tact.*,\n" +
"\tu.loginname bxr_loginname,\n" +
"\tu.unionname bxr_unionname,\n" +
"\tu.unioncode,\n" +
"\ts.state_name,\n" +
"\ts.state_color \n" +
"FROM\n" +
"\t`activity_bx` act\n" +
"\tLEFT JOIN `user` u ON act.user_id = u.id\n" +
"\tLEFT JOIN state s ON act.state_id = s.state_id $condition");
Cnd cnd = Cnd.NEW();
if (isAudit == 1) {
cnd.and("act.state_id", ">=", 1040);
} else {
cnd.and("act.state_id", isAudit == 2 ? ">" : "=", 1040);
}
Vi.cndPlus(cnd, "act.year", "=", year);
if (Vi.isNotBlank(searchName, searchKeyword)) {
cnd.where().andLike(searchName, searchKeyword);
}
if (Vi.isNotBlank(pageOrderName, pageOrderBy)) {
cnd.orderBy(pageOrderName, pageOrderBy);
} else {
cnd.asc("act.state_id").desc("act.apply_time");
}
Vi.cndPlus(cnd, "u.unitid", "=", unitId);
Vi.cndPlus(cnd, "u.unionid", "=", unionId);
sql.setCondition(cnd);
return activityBxService.listPage(pageNumber, pageSize, sql);
}
@At
@ViReturn
public Object doReview(String id, String idea, String sign, Boolean flag) {
ActivityBx aid = activityBxService.fetch(id);
aid.setState_id(flag ? "1050" : "1045");
aid.setUnion_chairman_name(ShiroUtil.getPrincipalProperty("id").toString());
aid.setUnion_chairman_time(DateUtil.getDate());
aid.setUnion_chairman_idea(idea);
if (Strings.isNotBlank(sign)) {
aid.setUnion_chairman(sysSignatureService.insert(new Sys_signature(sign)).getId());
}
activityBxService.doEdit(aid);
jf_yjgh jfYjgh = jfYjghService.fetch(Cnd.where("unionId", "=", vi.getUnionId(aid.getUser_id())).and("year", "=", Calendar.getInstance().get(Calendar.YEAR)));
if (jfYjgh != null) {
jf_use use = new jf_use();
use.setAdjust_id(jfYjgh.getId());
use.setApply_id(aid.getId());
use.setProject(aid.getActivity_name());
use.setAdjust_money((int) Math.round(aid.getActivity_money()));
use.setAdjust_person(ShiroUtil.getPrincipalProperty("id").toString());
use.setAdjust_time(DateUtil.getDate());
jfUseService.addUse(use, false);
}
return null;
}
}
@@ -0,0 +1,142 @@
package io.v.nutz.jf.controller.club;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.wizzer.framework.base.Result;
import io.v.nutz.jf.model.jf_club;
import io.v.nutz.jf.service.jfClubService;
import io.v.nutz.sys.models.Sys_club;
import io.v.nutz.sys.services.SysClubService;
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.AdaptBy;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.POST;
import org.nutz.mvc.upload.TempFile;
import org.nutz.mvc.upload.UploadAdaptor;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @Author:xsb
* @Description: 社团模板数据导入
* @Date:Created in 19:45 2021/2/1
*/
@IocBean
@Ok("json")
@At("/platform/jf/club/dataInput")
public class ClubDataInputController {
@Inject // 已交社团
private jfClubService jfClubService;
@Inject // 系统原本社团
private SysClubService sysClubService;
// 模板下载
/**
* 下载摸板
*
* @param response
* @throws IOException
*/
@At
public void downLoadTemp(HttpServletResponse response) throws IOException {
File file = null;
InputStream fin = null;
ServletOutputStream out = null;
try {
file = new File("src/main/resources/docTemplate/clubQuota.xlsx");
fin = new FileInputStream(file);
// 设置浏览器以下载的方式处理该文件名
String fileName = "批量导入社团预算分配" + ".xlsx";
response.setHeader("Content-Disposition", "attachment;filename="
.concat(String.valueOf(URLEncoder.encode(fileName, "UTF-8"))));
out = response.getOutputStream();
byte[] buffer = new byte[512]; // 缓冲区
int bytesToRead = -1;
// 通过循环将读入的Word文件的内容输出到浏览器中
while ((bytesToRead = fin.read(buffer)) != -1) {
out.write(buffer, 0, bytesToRead);
}
out.flush();
} finally {
if (fin != null) fin.close();
if (out != null) out.close();
}
}
// 把exsl数据
@At
@POST
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
public Object doExport(TempFile file, String park_id) {
int count = 0;
int success_count = 0;
try {
// 查出现在已交社团表中的已交社团
List<jf_club> jf_clubs = jfClubService.query();
// 查出所有系统社团
List<Sys_club> sysClubs = sysClubService.query();
Map<String, String> collect = sysClubs.stream().collect(Collectors.toMap(v -> v.getName(), v -> v.getId()));
//获得excel表格中的数据并封装成一个个对象
List<jf_club> list = ExcelImportUtil.importExcel(file.getFile(), jf_club.class, new ImportParams());
count = list.size();
//遍历excel表格中的一个个对象
for (jf_club obj : list) {
try {
//状态设为1,默认为下发状态
obj.setState(1);
obj.setClub_id(collect.get(obj.getHistory_clubname()));
jf_club yj_club = jf_clubs.stream().filter(v -> v.getYear().equals(obj.getYear()) && v.getClub_id().equals(obj.getClub_id())).findFirst().orElse(null);
// 遍历所有的已交社团
boolean has = jf_clubs.stream().anyMatch(v -> v.getYear().equals(obj.getYear()) && v.getClub_id().equals(obj.getClub_id()));
if (has) {
yj_club.setClub_id(obj.getClub_id()); //社团id
yj_club.setState(1); //状态1
yj_club.setHistory_member(obj.getHistory_member()); //历史会员人数
yj_club.setHistory_club_avg(obj.getHistory_club_avg()); //历史品均值
yj_club.setTotal_quota(obj.getTotal_quota()); // 总金额
jfClubService.update(yj_club); // 直接跟新这个对象,自动根据id修改
// 返回给前台的显示向数据库成功添加了几条数据的数量
success_count++;
} else {
// 向已交工会表中添加一条记录
jfClubService.insert(obj);
// 返回给前台的显示向数据库成功添加了几条数据的数量
success_count++;
}
} catch (Exception e) {
e.printStackTrace();
}
}
} catch (Exception e) {
} finally {
return Result.success().addData(NutMap.NEW().setv("count", count).setv("success_count", success_count));
}
}
}
@@ -0,0 +1,160 @@
package io.v.nutz.jf.controller.club;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.utils.PageUtil;
import io.v.nutz.jf.model.CostsSet;
import io.v.nutz.jf.model.jf_club;
import io.v.nutz.jf.service.CostsSetService;
import io.v.nutz.jf.service.jfClubService;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
import org.nutz.dao.entity.Record;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Strings;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import java.util.Calendar;
import java.util.List;
/**
* @author zhf
* @date 2020/11/5 10:24
* @description 社团活动经费分配
*/
@IocBean
@At("/platform/jf/st/fp")
@Ok("json:full")
@RequiresAuthentication
public class clubController {
@Inject
private jfClubService jfClubService;
@Inject
private CostsSetService costsSetService;
private int year = Calendar.getInstance().get(Calendar.YEAR);
@At("")
@Ok("beetl:/platform/jf/club/clubys.html")
@RequiresPermissions("sys.jf.st.fp")
public void index() {
}
// 获取最近的一年
@At
@ViReturn
public Object lastYear() {
Sql sql = Sqls.create("""
select max(year) year from jf_club where state=1
""");
return jfClubService.fetch(sql);
}
// 重置本年
@At
@ViReturn
public Object reset() {
return jfClubService.update(Chain.make("state", 0), Cnd.where("year", "=", year).and("state", "=", 1));
}
//查询是否已下发
@At
@ViReturn
public Object isSet() {
return jfClubService.count(Cnd.where("state", "=", 1).and("year", "=", year));
}
//下发
@At
@ViReturn
public Object issue() {
//本年
Sql sql = Sqls.create("""
SELECT
jf.club_id,
club.id cid,( SELECT count( 1 ) FROM sys_club_user scu WHERE scu.clubid = club.id AND scu.`status` = 5 ) cynum
FROM
`sys_club` club
LEFT JOIN jf_club jf ON jf.club_id = club.id
AND jf.`year` = @year
""");
sql.setParam("year", year);
CostsSet costsSet = costsSetService.fetch(Cnd.where("year", "=", this.year));
Float club_avg = costsSet.getClub_avg();
List<Record> list = jfClubService.list(sql);
list.forEach(record -> {
String cid = (String) record.get("cid");
Object hyzs = record.get("cynum");
Float count = Float.parseFloat(hyzs.toString());
jfClubService.update(Chain.make("total_quota", club_avg * count).add("state", 1).add("history_club_avg", club_avg).add("history_member", count), Cnd.where("year", "=", year).and("state", "<", 1).and("club_id", "=", cid));
});
return null;
}
@At
public Object pageData(int pageNumber, int pageSize, Integer year, String pageOrderName, String pageOrderBy, String club_id) {
try {
Sql sql = Sqls.create("SELECT\n" +
"\tjf.* ,club.`name`,club.`code`,club.id cid,( SELECT count( 1 ) FROM sys_club_user scu WHERE scu.clubid = club.id AND scu.`status` = 3 ) cynum\n" +
"FROM\n" +
"`sys_club` club\n" +
"LEFT JOIN jf_club jf ON jf.club_id = club.id\n" +
"AND jf.`year` = @year $condition");
Cnd cnd = Cnd.NEW();
if (Strings.isNotBlank(pageOrderBy) && Strings.isNotBlank(pageOrderName)) {
cnd.orderBy(pageOrderName, PageUtil.getOrder(pageOrderBy));
} else if (Strings.isNotBlank(club_id)) {
cnd.and("club_id", "=", club_id);
} else {
cnd.asc("club.`name`");
}
cnd.and("state", "=", 1);
sql.setParam("year", year);
sql.setCondition(cnd);
Pagination listPage = jfClubService.listPage(pageNumber, pageSize, sql);
return Result.success().addData(listPage);
} catch (Exception e) {
return Result.error();
}
}
@At
public Object changeYs(String club_id, Integer year, Float total_quota) {
try {
total_quota = total_quota == null ? 0 : total_quota;
jf_club jf_club = jfClubService.fetch(Cnd.where("club_id", "=", club_id).and("year", "=", year));
if (jf_club != null) {
jf_club.setTotal_quota(total_quota);
jfClubService.updateIgnoreNull(jf_club);
} else {
jf_club = new jf_club();
jf_club.setClub_id(club_id);
jf_club.setYear(year);
jf_club.setTotal_quota(total_quota);
jfClubService.insert(jf_club);
}
return Result.success();
} catch (Exception e) {
return Result.error();
}
}
}
@@ -0,0 +1,148 @@
package io.v.nutz.jf.controller.club;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.utils.ExcelUtil;
import io.v.nutz.base.utils.PageUtil;
import io.v.nutz.jf.service.jfClubService;
import io.v.nutz.web.commons.utils.ShiroUtil;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
import org.nutz.dao.entity.Record;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Strings;
import org.nutz.log.Log;
import org.nutz.log.Logs;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.util.List;
/**
* @author zhf
* @date 2020/11/5 14:18
* @description 分工会经费使用情况
*/
@IocBean
@At("/platform/jf/club/tz")
@Ok("json:full")
@RequiresAuthentication
public class clubTzController {
private static final Log log = Logs.get();
@Inject
private jfClubService jfClubService;
@At("")
@Ok("beetl:/platform/jf/club/clubtz.html")
@RequiresPermissions("sys.jf.st.tz")
public void index() {
}
@At
public Object data(int pageNumber, int pageSize, Integer year, String pageOrderName, String pageOrderBy) {
try {
Sql sql = Sqls.create("SELECT\n" +
"\tjf.* ,club.`name`,club.`code`,club.id cid\n" +
"FROM\n" +
"`sys_club` club\n" +
"LEFT JOIN jf_club jf ON jf.club_id = club.id\n" +
"AND jf.`year` = @year $condition");
Cnd cnd = Cnd.NEW();
if (ShiroUtil.hasRole("sysadmin") || ShiroUtil.hasRole("A06")) {
} else if (ShiroUtil.hasRole("H02")) {
//基层工会管理员
cnd.and("club.fzr", "=", ShiroUtil.getPrincipalProperty("id"));
}
cnd.and("jf.total_quota", "IS NOT", null);
if (Strings.isNotBlank(pageOrderBy) && Strings.isNotBlank(pageOrderName)) {
cnd.orderBy(pageOrderName, PageUtil.getOrder(pageOrderBy));
} else {
cnd.asc("club.`name`");
}
sql.setParam("year", year);
sql.setCondition(cnd);
Pagination listPage = jfClubService.listPage(pageNumber, pageSize, sql);
return Result.success().addData(listPage);
} catch (Exception e) {
return Result.error();
}
}
@At
public Object modifyJf(String id, Integer usedQuota, String reason) {
try {
Chain chain = Chain.make("usedQuota", usedQuota).add("reason", reason);
jfClubService.update(chain, Cnd.where("id", "=", id));
return Result.success();
} catch (Exception e) {
log.error(e);
return Result.error();
}
}
@At
public void exportExcel(HttpServletResponse response, Integer year) {
Sql sql = Sqls.create("SELECT\n" +
"\tjf.* ,club.`name`,club.id cid\n" +
"FROM\n" +
"`sys_club` club\n" +
"LEFT JOIN jf_club jf ON jf.club_id = club.id\n" +
"AND jf.`year` = @year $condition");
Cnd cnd = Cnd.NEW();
if (ShiroUtil.hasRole("sysadmin") || ShiroUtil.hasRole("A06")) {
} else if (ShiroUtil.hasRole("D02")) {
//基层工会管理员
cnd.and("club.fzr", "=", ShiroUtil.getPrincipalProperty("id"));
}
cnd.asc("club.name");
sql.setParam("year", year);
sql.setCondition(cnd);
List<Record> list = jfClubService.list(sql);
//excel标题
String[] title = {"年度", "协会名称", "分配总额度(元)", "已使用额度(元)", "剩余额度(元)"};
//excel文件名
String fileName = year + "年协会经费使用情况表.xls";
//sheet名
String sheetName = year + "年协会经费使用情况表";
String[][] content = new String[list.size()][title.length];
for (int i = 0; i < list.size(); i++) {
Float zed = Strings.isBlank(list.get(i).getString("total_quota")) ? 0 : Float.parseFloat(list.get(i).getString("total_quota"));
int ysyed = Strings.isBlank(list.get(i).getString("used_quota")) ? 0 : Integer.parseInt(list.get(i).getString("used_quota"));
content[i][0] = list.get(i).getString("year");
content[i][1] = list.get(i).getString("name");
content[i][2] = String.valueOf(zed);
content[i][3] = String.valueOf(ysyed);
content[i][4] = String.valueOf(zed - ysyed);
}
HSSFWorkbook wb = ExcelUtil.getHSSFWorkbook(sheetName, title, content, null);
try {
OutputStream os = response.getOutputStream();
response.setHeader("Content-disposition",
"attachment; filename=" + new String(fileName.getBytes("GB2312"), "8859_1"));
response.setContentType("application/msexcel");
wb.write(os);
os.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
@@ -0,0 +1,293 @@
package io.v.nutz.jf.controller.costsSet;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.utils.DateUtil;
import io.v.nutz.jf.model.CostsSet;
import io.v.nutz.jf.model.jf_club;
import io.v.nutz.jf.model.jf_school;
import io.v.nutz.jf.model.jf_yjgh;
import io.v.nutz.jf.service.CostsSetService;
import io.v.nutz.sys.models.Sys_club;
import io.v.nutz.sys.models.Sys_union;
import io.v.nutz.sys.services.SysClubService;
import io.v.nutz.sys.services.SysUnionService;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
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.Calendar;
import java.util.List;
/**
* @Author:xsb
* @Description: 费用设置
* @Date:Created in 9:25 2021/1/23
*/
@IocBean
@At("/platform/jf/costsSet/costsSet")
@Ok("json:full")
public class CostsSetController {
@Inject
private io.v.nutz.jf.service.jfYjghService jfYjghService;
@Inject
private SysUnionService sysUnionService;
@Inject
private io.v.nutz.jf.service.jfClubService jfClubService;
@Inject
private SysClubService sysClubService;
@Inject // 经费设置
private CostsSetService costsSetService;
private int year = Calendar.getInstance().get(Calendar.YEAR);
@At("")
@Ok("beetl:/platform/jf/costsSet/costsSet.html")
public void index() {
}
// 设置人均额度
@At
@ViReturn
public Object set(Float avglocalUnion, Float avgAssociation, Float schoolMoney) {
// 查询是否已经设置本年,没有就添加
int costsSet = costsSetService.count(Cnd.where("year", "=", DateUtil.getYear()));
if (costsSet == 0) {
CostsSet costsSet1 = new CostsSet();
costsSet1.setYear(DateUtil.getYear());
costsSetService.insert(costsSet1);
}
if (schoolMoney != null) {
jf_school jfSchools = jfClubService.dao().fetch(jf_school.class, Cnd.where("year", "=", this.year));
if (jfSchools != null) {
jfSchools.setTotalQuota(schoolMoney);
jfSchools.setState(1);
jfYjghService.update(jfSchools);
} else {
jf_school jf_school = new jf_school();
jf_school.setYear(this.year);
jf_school.setTotalQuota(schoolMoney);
jf_school.setState(1);
jfYjghService.insert(jf_school);
}
costsSetService.update(Chain.make("schoolMoney", schoolMoney), Cnd.where("year", "=", this.year));
}
// 设置基层工会会员年度人均费用额度
if (avglocalUnion != null) {
//向已交工会表中添加本年的所有工会
List<jf_yjgh> count = jfYjghService.query(Cnd.where("year", "=", this.year));
//判断是否已经添加过了
if (count.size() == 0) {
List<Sys_union> query = sysUnionService.query();
jf_yjgh jf_yjgh = new jf_yjgh();
for (Sys_union sys_union : query) {
jf_yjgh.setUnionId(sys_union.getId());
jf_yjgh.setYear(this.year);
jfYjghService.insert(jf_yjgh);
}
}
costsSetService.update(Chain.make("union_avg", avglocalUnion), Cnd.where("year", "=", this.year));
}
if (avgAssociation != null) {
// 查询工会表中是否有今年的记录 没有就向表中添加记录
List<jf_club> count = jfClubService.query(Cnd.where("year", "=", this.year));
if (count.size() == 0) {
List<Sys_club> Sys_clubs = sysClubService.query();
jf_club jf_club = new jf_club();
Sys_clubs.forEach(s -> {
jf_club.setClub_id(s.getId());
jf_club.setYear(this.year);
jfClubService.insert(jf_club);
});
}
// 修改费用表中今年的社团人均额度
costsSetService.update(Chain.make("club_avg", avgAssociation), Cnd.where("year", "=", this.year));
}
return null;
}
// 回显额度
@At
@ViReturn
public Object echo() {
return costsSetService.fetch(Cnd.where("year", "=", year));
}
// //设置基层工会会员年度人均费用额度
// @At
// @ViReturn
// public Object localUnion(Float avglocalUnion) {
//
// if (avglocalUnion==null) {
// return null;
// }
//
// //向已交工会表中添加本年的所有工会
// List<jf_yjgh> count = jfYjghService.query(Cnd.where("year", "=", this.year));
// //判断是否已经添加过了
// if (count.size() == 0) {
// List<Sys_union> query = sysUnionService.query();
// jf_yjgh jf_yjgh = new jf_yjgh();
// for (Sys_union sys_union : query) {
// jf_yjgh.setUnionId(sys_union.getId());
// jf_yjgh.setYear(year);
// jfYjghService.insert(jf_yjgh);
// }
// }
//
// costsSetService.update(Chain.make("union_avg",avglocalUnion), Cnd.where("year", "=", year));
// return null;
// }
//
//
//
// //设置协会会员年度人均费用额度
// @At
// @ViReturn
// public Object association(Float avgAssociation) {
// if (avgAssociation==null) {
// return null;
// }
//
// // 查询工会表中是否有今年的记录 没有就向表中添加记录
// List<jf_club> count = jfClubService.query(Cnd.where("year", "=", this.year));
// if (count.size() == 0) {
// List<Sys_club> Sys_clubs = sysClubService.query();
// jf_club jf_club = new jf_club();
// Sys_clubs.forEach(s -> {
// jf_club.setClub_id(s.getId());
// jf_club.setYear(year);
// jfClubService.insert(jf_club);
// });
//
// }
// // 修改费用表中今年的社团人均额度
// costsSetService.update(Chain.make("club_avg",avgAssociation), Cnd.where("year", "=", year));
// return null;
// }
//
//
//
// // 回显
// @At
// @ViReturn
// public Object echo() {
// Record[] abjs = new Record[2];
// // 查询工会
// Sql sql = Sqls.create("""
// select jf.avgQuota from jf_yjgh jf where year=@year
// """);
// sql.setParam("year", year);
// List<Record> list = jfYjghService.list(sql);
// abjs[0] = list.get(0);
//
// // 查询社团
// Sql sql1 = Sqls.create("""
// select jf.avgQuota from jf_club jf where year=@year
// """);
// sql1.setParam("year", year);
// List<Record> list1 = jfClubService.list(sql1);
// abjs[1] = list1.get(0);
//
// return abjs;
// }
//
//
// //重置工会年度下发 resetUnionIssues
// @At
// @ViReturn
// public Object resetUnionIssues() {
// return jfYjghService.clear(Cnd.where("year", "=", year).and("state", "=", 1));
// }
//
//
// //重置社团年度下发 resetUnionIssues
// @At
// @ViReturn
// public Object resetClubIssues() {
// return jfClubService.clear(Cnd.where("year", "=", year).and("state", "=", 1));
// }
//
//
// // 是否设置 查询状态
// @At
// @ViReturn
// public Object isSet() {
//
// int[] state = new int[3]; // 默认值0 是未下发
// // 查询工会设置状态已下发
// int jf_yjghs = jfYjghService.count(Cnd.where("state", "=", 1).and("year", "=", year));
//
//
// //查询协会已下发
// int count = jfClubService.count(Cnd.where("state", "=", 1).and("year", "=", year));
//
// if (jf_yjghs > 0) {
// state[0] = 200; // 说明工会已下发
// }
// if (count > 0) {
// state[1] = 201; // 说明社团已下发
// }
// return state;
// }
//
//
// //设置基层工会会员年度人均费用额度
// @At
// @ViReturn
// public Object localUnion(Float avglocalUnion) {
//
// //向已交工会表中添加本年的所有工会
// List<jf_yjgh> count = jfYjghService.query(Cnd.where("year", "=", this.year));
// //判断是否已经添加过了
// if (count.size() == 0) {
// List<Sys_union> query = sysUnionService.query();
// jf_yjgh jf_yjgh = new jf_yjgh();
// for (Sys_union sys_union : query) {
// jf_yjgh.setUnionId(sys_union.getId());
// jf_yjgh.setYear(year);
// jfYjghService.insert(jf_yjgh);
// }
// }
// //设置基层工会会员年度人均费用额度
// return jfYjghService.update(Chain.make("avgQuota", avglocalUnion), Cnd.where("year", "=", year).and("state", "<", 1));
// }
//
//
// //设置协会会员年度人均费用额度
// @At
// @ViReturn
// public Object association(Float avgAssociation) {
// List<jf_club> count = jfClubService.query(Cnd.where("year", "=", this.year));
// if (count.size() == 0) {
// List<Sys_club> Sys_clubs = sysClubService.query();
// jf_club jf_club = new jf_club();
// Sys_clubs.forEach(s -> {
// jf_club.setClub_id(s.getId());
// jf_club.setYear(year);
// jfClubService.insert(jf_club);
// });
//
// }
//
// return jfClubService.update(Chain.make("avgQuota", avgAssociation), Cnd.where("year", "=", this.year).and("state", "<", 1));
// }
}
@@ -0,0 +1,236 @@
package io.v.nutz.jf.controller.financial;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import cn.hutool.core.date.DateUtil;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.result.Result;
import io.v.nutz.base.service.BaseService;
import io.v.nutz.jf.mode.FinancialImportExcelMode;
import io.v.nutz.jf.model.jf_club;
import io.v.nutz.jf.model.jf_use;
import io.v.nutz.jf.model.jf_yjgh;
import io.v.nutz.sys.models.Sys_club;
import io.v.nutz.sys.models.Sys_union;
import io.v.nutz.util.ViTool;
import io.v.nutz.web.commons.utils.ShiroUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.dao.util.Daos;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Lang;
import org.nutz.lang.Strings;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.*;
import org.nutz.mvc.upload.TempFile;
import org.nutz.mvc.upload.UploadAdaptor;
import org.nutz.trans.Trans;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
* 导入财务数据
*
* @Author zzr
* @Date 2023/6/12 10:45
*/
@IocBean
@Ok("json:full")
@At("/platform/jf/financial/import")
@Slf4j
public class FinancialImportController {
@Inject
private Dao dao;
@Inject
private BaseService baseService;
@At("")
@Ok("beetl:/platform/jf/financial/import.html")
@RequiresPermissions("sys.jf.financial.import")
public void index() {
}
/**
* 财务数据导入模版
* @param response
*/
@At
@Ok("void")
@RequiresPermissions("sys.jf.financial.import")
public void exportTemplate(HttpServletResponse response){
//设置导入模式
ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF);
try {
ViTool.excelResponse(response, "财务数据导入模版.xls");
Workbook sheets = ExcelExportUtil.exportExcel(exportParams, FinancialImportExcelMode.class, Collections.emptyList());
ServletOutputStream outputStream = response.getOutputStream();
sheets.write(outputStream);
outputStream.close();
}catch (Exception e){
log.error(e.getMessage());
}
}
/**
* 读取excel数据
*
* @param tempFile 临时文件
* @return {@link Object}
*/
@At
@ViReturn
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
@Ok("json:full")
@RequiresAuthentication
public Object readExcelData(@Param("file") TempFile tempFile) {
ImportParams importParams = new ImportParams();
List<FinancialImportExcelMode> list = ExcelImportUtil.importExcel(tempFile.getFile(), FinancialImportExcelMode.class, importParams);
//
// Sql sql = Sqls.create("""
// SELECT
// ju.project,
// su.unionname,
// sc.`name`,
// ju.activitie_time
// FROM
// `jf_use` ju
// LEFT JOIN `jf_yjgh` jy ON jy.id = ju.adjust_id
// LEFT JOIN `sys_union` su ON jy.unionId = su.id
// LEFT JOIN `jf_club` jc ON jc.id = ju.adjust_id
// LEFT JOIN `sys_club` sc ON jc.club_id = sc.id
// """);
// List<NutMap> listMap = baseService.listMap(sql);
//
// //读取Excel中的项目名称和工会名称成Map集合
// Map<String, String> map = new HashMap<>();
//
// //读取Excel数据中的项目名称
// List<String> projectList = list.stream().map(v -> v.getProject()).collect(Collectors.toList());
// //读取Excel数据中的工会/协会名称
// List<String> unionOrClubList = list.stream().map(v -> v.getUnionId()).collect(Collectors.toList());
//
// //通过Excel的工会/协会名称获取工会id
// List<Sys_union> unions = dao.query(Sys_union.class, Cnd.where("unionname", "in", unionOrClubList));
// //获取协会id
// List<Sys_club> clubs = dao.query(Sys_club.class, Cnd.where("name", "in", unionOrClubList));
return list;
}
/**
* 数据导入
* @param excelModeArr
* @return
*/
@At
@Ok("json:full")
@RequiresPermissions("sys.jf.financial.import")
@Aop(TransAop.READ_COMMITTED)
public Object doImport(@Param("data") FinancialImportExcelMode[] excelModeArr) throws Exception {
List<FinancialImportExcelMode> excelModes = Arrays.stream(excelModeArr).collect(Collectors.toList());
try {
Trans.begin();
//工会
List<Sys_union> unions = dao.query(Sys_union.class, Cnd.NEW().desc("unioncode"));
//协会
List<Sys_club> clubs = dao.query(Sys_club.class, Cnd.NEW().desc("code"));
//存放工会/协会的名称和id
Map<String, String> map = unions.stream().collect(Collectors.toMap(v -> v.getUnionname(), v -> v.getId()));
clubs.forEach(v -> map.put(v.getName(),v.getId()));
//存放导入到数据库的数据
List<jf_use> uses = new ArrayList<>();
//错误信息
List<String> errorInfos = new ArrayList<>();
//导入数据遍历需要的结果
excelModes.forEach(v->{
String s = map.get(v.getUnionId());
jf_use jf_use = new jf_use();
if (Strings.isNotBlank(s)) {
String str = "";
jf_yjgh yjgh = dao.fetch(jf_yjgh.class, Cnd.where("unionId", "=", s).and("`year`","like", v.getYear()));
if (!StringUtils.isEmpty(yjgh)){
str=yjgh.getId();
BigDecimal residueQuota = new BigDecimal(yjgh.getTotalQuota()).subtract(new BigDecimal(yjgh.getUsedQuota()));
if (residueQuota.compareTo(new BigDecimal(v.getAdjust_money())) > 0) {
dao.update(jf_yjgh.class, Chain.make("usedQuota", yjgh.getUsedQuota() + v.getAdjust_money()), Cnd.where("id", "=", str));
} else {
errorInfos.add(v.getNum()+"的费用超出剩余额度");
}
}
jf_club club = dao.fetch(jf_club.class, Cnd.where("club_id", "=", s).and("`year`","like", v.getYear()));
if (!StringUtils.isEmpty(club)){
str=club.getId();
BigDecimal residueQuota = new BigDecimal(club.getTotal_quota()).subtract(new BigDecimal(club.getUsed_quota()));
if(residueQuota.compareTo(new BigDecimal(v.getAdjust_money())) > 0) {
dao.update(jf_club.class, Chain.make("used_quota", club.getUsed_quota() + v.getAdjust_money()), Cnd.where("id", "=", str));
} else {
errorInfos.add(v.getNum()+"的费用超出剩余额度");
}
}
jf_use.setAdjust_id(str);
jf_use.setProject(v.getProject().trim());
jf_use.setMonth(v.getMonth());
jf_use.setAdjust_time(new SimpleDateFormat("yyyy-MM-dd").format(new Date()));
jf_use.setActivitie_time(new SimpleDateFormat("yyyy-MM-dd").format(v.getActivitie_time()));
jf_use.setAdjust_person((String) ShiroUtil.getPrincipalProperty("id"));
jf_use.setAdjust_money(v.getAdjust_money());
jf_use.setAdjust_reason(v.getAdjust_reason());
uses.add(jf_use);
}else{
errorInfos.add(v.getNum());
}
});
dao.insert(uses);
Trans.commit();
if (!CollectionUtils.isEmpty(errorInfos)) {
String[] errorArr = errorInfos.toArray(new String[errorInfos.size()]);
StringBuffer str = new StringBuffer();
for (String s : errorArr) {
str.append(s + ",");
}
String stringBuffer = new String();
stringBuffer=str.substring(0,str.length()-1);
return Result.error("以下数据导入失败:序号为"+stringBuffer);
}
return Result.success("财务数据导入成功");
}catch (Exception e){
log.error(e.getMessage());
Trans.rollback();
return Result.error("财务数据导入失败");
}
}
}
@@ -0,0 +1,190 @@
package io.v.nutz.jf.controller.jfbx;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.utils.DateUtil;
import io.v.nutz.jf.model.jf_bxyy;
import io.v.nutz.jf.service.jfBxYyFjService;
import io.v.nutz.sys.models.Sys_user;
import io.v.nutz.sys.services.SysUserService;
import io.v.nutz.web.commons.utils.ShiroUtil;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
import org.nutz.dao.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.log.Log;
import org.nutz.log.Logs;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
/**
* @author 1V
* @date 2020/11/5 14:21
* @description 经费报销审核
*/
@IocBean
@At("/platform/jf/jfbx/bxsh")
@Ok("json:full")
@RequiresAuthentication
public class bxshController {
private static final Log log = Logs.get();
@Inject
public jfBxYyFjService jfBxYyFjService;
@Inject
private io.v.nutz.jf.service.jfBxyyService jfBxyyService;
@Inject
private io.v.nutz.jf.service.jfYjghService jfYjghService;
@Inject
private SysUserService sysUserService;
@At("")
@Ok("beetl:/platform/jf/bxyy/bxsh.html")
@RequiresPermissions("sys.jf.bx.sh")
public void index() {
}
//获取预约报销列表
@At
public Object data(String startTime, String endTime, String saerchsfsh, String searchName,
String searchKeyword, int pageNumber, int pageSize) {
Cnd cnd = Cnd.NEW();
Sys_user user = (Sys_user) ShiroUtil.getPrincipal();
int identity = 0;
//07193 杜达金
if (ShiroUtil.hasRole("gh01")) {
identity = 1;
int audit_status[] = {1, 2, 3, 4, 5};
cnd.and("audit_status", "in", audit_status);
}
//07001 谢群泽
else if (ShiroUtil.hasRole("gh12")) {
identity = 2;
int audit_status[] = {2, 3, 4, 5};
cnd.and("audit_status", "in", audit_status);
} else if (ShiroUtil.hasRole("sysadmin")) {
identity = 3;
int audit_status[] = {1, 2, 3, 4, 5};
cnd.and("audit_status", "in", audit_status);
}
//查询
if (Strings.isNotBlank(saerchsfsh)) {
if (identity == 1 && saerchsfsh.equals("1")) {
cnd.and("audit_status", "=", "2");
}
if (identity == 1 && saerchsfsh.equals("2")) {
int audit_status[] = {3, 4, 5};
cnd.and("audit_status", "in", audit_status);
}
if (identity == 2 && saerchsfsh.equals("1")) {
cnd.and("audit_status", "=", "1");
}
if (identity == 2 && saerchsfsh.equals("2")) {
int audit_status[] = {2, 3, 4, 5};
cnd.and("audit_status", "in", audit_status);
}
if (identity == 3 && saerchsfsh.equals("1")) {
int audit_status[] = {1, 2};
cnd.and("audit_status", "in", audit_status);
}
if (identity == 3 && saerchsfsh.equals("2")) {
int audit_status[] = {3, 4, 5};
cnd.and("audit_status", "in", audit_status);
}
}
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
cnd.and(searchName, "like", "%" + searchKeyword + "%");
}
if (Strings.isNotBlank(startTime)) {
cnd.and("booking_time", ">=", startTime);
}
if (Strings.isNotBlank(endTime)) {
cnd.and("booking_time", "<=", endTime);
}
//只查询需要审核的预约报销
Sql sql = Sqls.create("SELECT\n" +
"\tbu.username userName,\n" +
"\tch.username chName,\n" +
"\tfi.username fiName,\n" +
"\tbu.loginname,\n" +
"\tbn.`name` unit,\n" +
"\tb.* \n" +
"FROM\n" +
"\tjf_bxyy b\n" +
"\tLEFT JOIN sys_user bu ON bu.id = b.booking_person_id\n" +
"\tLEFT JOIN sys_user ch ON ch.id = b.chairman_id\n" +
"\tLEFT JOIN sys_user fi ON fi.id = b.finance_id\n" +
"\tLEFT JOIN sys_unit bn ON bn.id = bu.unitid $condition");
cnd.asc("audit_status").desc("booking_time");
sql.setCondition(cnd);
Pagination yybxlist = jfBxyyService.listPage(pageNumber, pageSize, sql);
NutMap map = new NutMap();
map.put("bxShList", yybxlist);
map.put("user", user);
map.put("identity", identity);
return Result.success().addData(map);
}
/**
* 报销审核
*
* @param identity
* @param audit_status
* @param opinion
* @param id
* @return
*/
@At
@Ok("json")
public Object bxSh(Integer identity, Integer audit_status, String opinion, String id) {
try {
//获取当前用户信息
Sys_user user = (Sys_user) ShiroUtil.getPrincipal();
jf_bxyy bxyy = jfBxyyService.fetch(id);
bxyy.setAudit_status(audit_status);
//主席审核
if (identity == 1) {
bxyy.setChairman_id(user.getId());
bxyy.setChairman_opinion(opinion);
bxyy.setChairman_time(DateUtil.getDate());
}
//财务审核
if (identity == 2) {
bxyy.setFinance_id(user.getId());
bxyy.setFinance_opinion(opinion);
bxyy.setFinance_time(DateUtil.getDate());
}
jfBxyyService.updateIgnoreNull(bxyy);
// if (audit_status.equals(3)) {
// if (bxyy.getActivity_type().equals("基层工会活动")) {
// String unionid = sysUserService.fetch(bxyy.getBooking_person_id()).getUnionid();
// jf_yjgh jf_yjgh = jfYjghService.fetch(Cnd.where("unionId", "=", unionid).and("year", "=", new SimpleDateFormat("yyyy").format(new Date())));
//
// jf_yjgh.setUsedQuota(jf_yjgh.getUsedQuota() == null ? 0 : jf_yjgh.getUsedQuota() + (int) Float.parseFloat(bxyy.getRei_money()));
// jfYjghService.updateIgnoreNull(jf_yjgh);
// }
// }
return Result.success().addMsg("审核完毕");
} catch (Exception e) {
log.error(e);
return Result.error().addMsg("审核失败!");
}
}
}
@@ -0,0 +1,223 @@
package io.v.nutz.jf.controller.jfbx;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.sys.models.Sys_user;
import io.v.nutz.web.commons.utils.ShiroUtil;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.VerticalAlignment;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
import org.nutz.dao.entity.Record;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Strings;
import org.nutz.lang.util.NutMap;
import org.nutz.log.Log;
import org.nutz.log.Logs;
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.OutputStream;
import java.util.List;
/**
* @author 1V
* @date 2020/11/5 14:23
* @description 经费报销预览
*/
@IocBean
@At("/platform/jf/jfbx/bxyl")
@Ok("json:full")
@RequiresAuthentication
public class bxylController {
private static final Log log = Logs.get();
@Inject
private io.v.nutz.jf.service.jfBxyyService jfBxyyService;
@At("")
@Ok("beetl:/platform/jf/bxyy/bxyl.html")
@RequiresPermissions("sys.jf.bx.ck")
public void index() {
}
@At
public Object data(String startTime, String endTime, String searchName,
String searchKeyword, int pageNumber, int pageSize) {
try {
Cnd cnd = Cnd.NEW();
Sys_user user = (Sys_user) ShiroUtil.getPrincipal();
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
cnd.and(searchName, "like", "%" + searchKeyword + "%");
}
if (Strings.isNotBlank(startTime)) {
cnd.and("booking_time", ">=", startTime);
}
if (Strings.isNotBlank(endTime)) {
cnd.and("booking_time", "<=", endTime);
}
cnd.and("audit_status", "=", 3);
//只查询需要审核的预约报销
Sql sql = Sqls.create("SELECT\n" +
"\tbu.username userName,\n" +
"\tch.username chName,\n" +
"\tfi.username fiName,\n" +
"\tbu.loginname,\n" +
"\tbn.`name` unit,\n" +
"\tb.* \n" +
"FROM\n" +
"\tjf_bxyy b\n" +
"\tLEFT JOIN sys_user bu ON bu.id = b.booking_person_id\n" +
"\tLEFT JOIN sys_user ch ON ch.id = b.chairman_id\n" +
"\tLEFT JOIN sys_user fi ON fi.id = b.finance_id\n" +
"\tLEFT JOIN sys_unit bn ON bn.id = bu.unitid $condition");
cnd.asc("audit_status").desc("booking_time");
sql.setCondition(cnd);
Pagination bxylList = jfBxyyService.listPage(pageNumber, pageSize, sql);
NutMap map = new NutMap();
map.put("bxylList", bxylList);
map.put("user", user);
return Result.success().addData(map);
} catch (Exception e) {
log.error(e);
return Result.error().addMsg("查询失败!");
}
}
//导出预约报销表
@At
public void export(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("searchName") String searchName, String searchKeyword, HttpServletResponse response) {
try {
Cnd cnd = Cnd.NEW();//查询代表条件
cnd.and("audit_status", "=", 3);
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
cnd.and(searchName, "like", "%" + searchKeyword + "%");
}
if (Strings.isNotBlank(startTime)) {
cnd.and("booking_time", ">=", startTime);
}
if (Strings.isNotBlank(endTime)) {
cnd.and("booking_time", "<=", endTime);
}
//只查询需要审核的预约报销
Sql sqlc = Sqls.create("SELECT\n" +
"\tbu.username userName,\n" +
"\tbu.loginname,\n" +
"\tbn.`name` unit,\n" +
"\tb.* \n" +
"FROM\n" +
"\tjf_bxyy b\n" +
"\tLEFT JOIN sys_user bu ON bu.id = b.booking_person_id\n" +
"\tLEFT JOIN sys_unit bn ON bn.id = bu.unitid $condition");
cnd.desc("booking_time");
sqlc.setCondition(cnd);
List<Record> records = jfBxyyService.list(sqlc);
//创建HSSFWorkbook对象(excel的文档对象)
HSSFWorkbook wb = new HSSFWorkbook();
//建立新的sheet对象(excel的表单)
HSSFSheet sheet = wb.createSheet("经费报销预约名单");
sheet.setDefaultColumnWidth(20);
sheet.setColumnWidth(4, 265 * 36);
//sheet.setColumnWidth(5,265*38);
//在sheet里创建第一行,参数为行索引(excel的行),可以是0~65535之间的任何一个
HSSFRow row1 = sheet.createRow(0);
row1.setHeight((short) 500);
HSSFCellStyle cellStyle = wb.createCellStyle();
cellStyle.setAlignment(HorizontalAlignment.CENTER);
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
HSSFFont fontStyle = wb.createFont();
//fontStyle.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
fontStyle.setFontHeightInPoints((short) 12);
cellStyle.setFont(fontStyle);
//创建单元格(excel的单元格,参数为列索引,可以是0~255之间的任何一个
HSSFCell cell1 = row1.createCell(0);
cell1.setCellStyle(cellStyle);
cell1.setCellValue("申请工号");
HSSFCell cell2 = row1.createCell(1);
cell2.setCellStyle(cellStyle);
cell2.setCellValue("申请人");
HSSFCell cell3 = row1.createCell(2);
cell3.setCellStyle(cellStyle);
cell3.setCellValue("联系电话");
HSSFCell cell4 = row1.createCell(3);
cell4.setCellStyle(cellStyle);
cell4.setCellValue("预约时间");
HSSFCell cell5 = row1.createCell(4);
cell5.setCellStyle(cellStyle);
cell5.setCellValue("报销事项");
HSSFCell cell6 = row1.createCell(5);
cell6.setCellStyle(cellStyle);
cell6.setCellValue("报销金额");
HSSFCell cell7 = row1.createCell(6);
cell7.setCellStyle(cellStyle);
cell7.setCellValue("报销卡号");
HSSFCellStyle cellStyle1 = wb.createCellStyle();
cellStyle1.setAlignment(HorizontalAlignment.CENTER);
//在sheet里创建第二行
for (int i = 0; i < records.size(); i++) {
HSSFRow row = sheet.createRow(i + 1);
HSSFCell cella = row.createCell(0);
cella.setCellStyle(cellStyle1);
cella.setCellValue(records.get(i).getString("loginname"));
HSSFCell cellb = row.createCell(1);
cellb.setCellStyle(cellStyle1);
cellb.setCellValue(records.get(i).getString("userName"));
HSSFCell cellc = row.createCell(2);
cellc.setCellStyle(cellStyle1);
cellc.setCellValue(records.get(i).getString("booking_person_phone"));
HSSFCell celld = row.createCell(3);
celld.setCellStyle(cellStyle1);
celld.setCellValue(records.get(i).getString("booking_time"));
HSSFCell celle = row.createCell(4);
celle.setCellStyle(cellStyle1);
celle.setCellValue(records.get(i).getString("rei_matter"));
HSSFCell cellf = row.createCell(5);
cellf.setCellStyle(cellStyle1);
cellf.setCellValue(records.get(i).getString("rei_money"));
HSSFCell cellh = row.createCell(6);
cellh.setCellStyle(cellStyle1);
cellh.setCellValue(records.get(i).getString("rei_card_number"));
}
String formFileName = "经费报销预约名单";
// 针对IE或者以IE为内核的浏览器:
formFileName = java.net.URLEncoder.encode(formFileName, "UTF-8");
// formFileName = new String(formFileName.getBytes("UTF-8"), "ISO-8859-1");
//输出Excel文件
OutputStream output = response.getOutputStream();
response.reset();
response.setHeader("Content-disposition", "attachment; filename=" + formFileName + ".xls");
response.setContentType("application/msexcel;charset=utf-8");
response.setCharacterEncoding("UTF-8");
wb.write(output);
output.close();
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
}
@@ -0,0 +1,387 @@
package io.v.nutz.jf.controller.jfbx;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.base.service.BaseService;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.utils.DateUtil;
import io.v.nutz.jf.model.jf_bxyy;
import io.v.nutz.jf.model.jf_bxyy_fj;
import io.v.nutz.sys.models.Sys_file;
import io.v.nutz.sys.models.Sys_user;
import io.v.nutz.web.commons.utils.DocConverter;
import io.v.nutz.web.commons.utils.ShiroUtil;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.boot.starter.ftp.FtpService;
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.random.R;
import org.nutz.lang.util.NutMap;
import org.nutz.log.Log;
import org.nutz.log.Logs;
import org.nutz.mvc.annotation.AdaptBy;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import org.nutz.mvc.upload.TempFile;
import org.nutz.mvc.upload.UploadAdaptor;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.util.List;
import java.util.Map;
/**
* @author 1V
* @date 2020/11/5 14:24
* @description 经费报销预约
*/
@IocBean
@At("/platform/jf/jfbx/bxyy")
@Ok("json:full")
@RequiresAuthentication
public class bxyyController {
private static final Log log = Logs.get();
@Inject
public io.v.nutz.jf.service.jfBxYyFjService jfBxYyFjService;
@Inject
private io.v.nutz.jf.service.jfBxyyService jfBxyyService;
@Inject
private FtpService ftpService;
@Inject
private BaseService baseService;
@At("")
@Ok("beetl:/platform/jf/bxyy/bxyy.html")
@RequiresPermissions("sys.jf.bx.yy")
public void index() {
}
@At
public Object data(int pageNumber, int pageSize, String searchName, String searchKeyword) {
try {
Sql sql = Sqls.create("SELECT\n" +
"\tbu.username userName,\n" +
"\tch.username chName,\n" +
"\tfi.username fiName,\n" +
"\tbu.loginname,\n" +
"\tbn.`name` unit,\n" +
"\tb.* \n" +
"FROM\n" +
"\tjf_bxyy b\n" +
"\tLEFT JOIN sys_user bu ON bu.id = b.booking_person_id\n" +
"\tLEFT JOIN sys_user ch ON ch.id = b.chairman_id\n" +
"\tLEFT JOIN sys_user fi ON fi.id = b.finance_id\n" +
"\tLEFT JOIN sys_unit bn ON bn.id = bu.unitid $condition");
Cnd cnd = Cnd.NEW();
Sys_user user = (Sys_user) ShiroUtil.getPrincipal();
cnd.and("booking_person_id", "=", user.getId());
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
cnd.and(searchName, "like", "%" + searchKeyword + "%");
}
cnd.desc("booking_time");
sql.setCondition(cnd);
Pagination pagination = jfBxyyService.listPage(pageNumber, pageSize, sql);
NutMap nutMap = new NutMap();
nutMap.put("list", pagination);
nutMap.put("user", user);
return Result.success().addData(nutMap);
} catch (Exception e) {
log.error(e);
return Result.error();
}
}
@At
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
public Object add(jf_bxyy jf_bxyy, @Param("files") TempFile[] files) {
try {
//新增预约报销
jf_bxyy.setBooking_time(DateUtil.getDate());
jf_bxyy.setAudit_status(1);
jf_bxyy.setBooking_person_id(ShiroUtil.getPrincipalProperty("id").toString());
jf_bxyy insert = jfBxyyService.insert(jf_bxyy);
for (TempFile file : files) {
String rid = R.UU32();
String suffixName = file.getSubmittedFileName().substring(file.getSubmittedFileName().lastIndexOf(".")).toLowerCase();
String savepath = "jfbxyy";
ftpService.upload(savepath, rid + suffixName, file.getInputStream());
Sys_file sys_file = new Sys_file();
sys_file.setId(R.UU32());
sys_file.setReid(insert.getId());
sys_file.setFilename(file.getSubmittedFileName());
sys_file.setFilepath("/" + savepath + "/" + rid + suffixName);
baseService.insert("sys_file", Chain.from(sys_file));
}
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error().addMsg("提交失败!");
}
}
@At
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
public Object editYyBx(jf_bxyy jf_bxyy, @Param("files") TempFile[] files, String[] delFiles) {
try {
jf_bxyy.setAudit_status(1);
jfBxyyService.updateIgnoreNull(jf_bxyy);
for (TempFile file : files) {
String rid = R.UU32();
String suffixName = file.getSubmittedFileName().substring(file.getSubmittedFileName().lastIndexOf(".")).toLowerCase();
String savepath = "jfbxyy";
ftpService.upload(savepath, rid + suffixName, file.getInputStream());
Sys_file sys_file = new Sys_file();
sys_file.setId(R.UU32());
sys_file.setReid(jf_bxyy.getId());
sys_file.setFilename(file.getSubmittedFileName());
sys_file.setFilepath("/" + savepath + "/" + rid + suffixName);
baseService.insert("sys_file", Chain.from(sys_file));
}
for (String s : delFiles) {
Sys_file file = baseService.dao().fetch(Sys_file.class, Cnd.where("id", "=", s));
ftpService.delete(file.getFilepath());
baseService.dao().delete(Sys_file.class, s);
}
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
public Object delYyBx(String id) {
try {
List<Record> files = baseService.dao().query("sys_file", Cnd.where("reid", "=", id));
files.forEach(file -> {
ftpService.delete(file.getString("filepath"));
baseService.dao().delete(Sys_file.class, file.getString("id"));
});
jfBxyyService.clear(Cnd.where("id", "=", id));
return Result.success().addMsg("成功删除预约报销申请!");
} catch (Exception e) {
e.printStackTrace();
return Result.error().addMsg("删除失败!");
}
}
/**
* 上传附件
*
* @param map
*/
@At("/uploadFiles")
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
@Ok("json:full")
public Object uploadFiles(Map map) {
try {
TempFile tempFile = (TempFile) map.get("file");
String booking_id = map.get("id").toString();//预约报销id
String fileLocalName = ((TempFile) map.get("file")).getMeta().getFileLocalName();//原文件名
String fjid = R.UU32();//附件ID
String wjkzm = fileLocalName.substring(fileLocalName.lastIndexOf(".")); //文件扩展名
String filepath = "upload/yybx/";
savePic(tempFile.getInputStream(), fjid + wjkzm, filepath);
/*Files.write(new File(filepath),tempFile.getInputStream());*/
jfBxYyFjService.insert("jf_bxyy_fj", Chain.make("id", fjid).add("booking_id", booking_id)
.add("name", fileLocalName).add("url", filepath + "/" + fjid + wjkzm).add("time", DateUtil.getDate()));
//数据库的路径 为 FJID+文件名 防止重复
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
//保存文件
private void savePic(InputStream inputStream, String fileName, String path) {
OutputStream os = null;
try {
//String path = "D:\\testFile\\";
// 2、保存到临时文件
// 1K的数据缓冲
byte[] bs = new byte[1024];
// 读取到的数据长度
int len;
// 输出的文件流保存到本地文件
File tempFile = new File(path);
if (!tempFile.exists()) {
tempFile.mkdirs();
}
os = new FileOutputStream(tempFile.getPath() + File.separator + fileName);
// 开始读取
while ((len = inputStream.read(bs)) != -1) {
os.write(bs, 0, len);
}
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
} finally {
// 完毕,关闭所有链接
try {
os.close();
inputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
//获取当前选择预约单的附件列表
@At
public Object ViewFjList(String booking_id) {
try {
return Result.success(baseService.dao().query("sys_file", Cnd.where("reid", "=", booking_id)));
} catch (Exception e) {
e.printStackTrace();
return Result.error("文件列表加载失败!");
}
}
/**
* 删除已上传的附件
*/
@At
public Object delFjById(@Param("fjid") String fjid) {
try {
int num = 0;
String[] ids = fjid.split(",");
for (int i = 0; i < ids.length; i++) {
jf_bxyy_fj jfBxyyFj = jfBxYyFjService.fetch(ids[i]);
String url = jfBxyyFj.getUrl(); //附件存放位置
File file = new File("");
String path = file.getCanonicalPath();
File delfile = new File(path + "/" + url);
if (delfile.exists() && delfile.isFile()) {
if (delfile.delete()) {
num++;
}
}
jfBxYyFjService.clear("jf_bxyy_fj", Cnd.where("id", "=", ids[i]));
}
if (num == ids.length) {
return Result.success();
} else {
return Result.error();
}
} catch (Exception e) {
return Result.error();
}
}
//获取当前预约报销的所有附件信息
@At
public Object viewFjInfoById(String booking_id) {
try {
return Result.success(baseService.dao().query("sys_file", Cnd.where("reid", "=", booking_id)));
} catch (Exception e) {
return Result.error("获取附件失败");
}
}
/**
* 将图片以文件流的形式在页面显示
*/
@At
@Ok("void")
public void showPic(String url, HttpServletResponse response) throws Exception {
response.setContentType("image/jpeg");
//获取路径
File directory = new File("");// 参数为空
String courseFile = directory.getCanonicalPath();
// 获取图片
File file = new File(courseFile + "\\" + url);
//创建文件输入流
FileInputStream is = new FileInputStream(file);
// 响应输出流
ServletOutputStream out = response.getOutputStream();
// 创建缓冲区
byte[] buffer = new byte[1024];
int len = 0;
while ((len = is.read(buffer)) != -1) {
out.write(buffer, 0, len);
}
is.close();
out.flush();
out.close();
}
@At
public void preview(HttpServletRequest request, HttpServletResponse response, @Param("filePath") String filePath) throws IOException {
//获取路径
File directory = new File("");// 参数为空
String courseFile = directory.getCanonicalPath();
filePath = courseFile + "\\" + filePath;
DocConverter doc = new DocConverter(filePath);
doc.conver();
String newUrl = doc.getswfPath();
File file = new File(newUrl);
//创建文件输入流
FileInputStream is = new FileInputStream(file);
// 响应输出流
ServletOutputStream out = response.getOutputStream();
// 创建缓冲区
byte[] buffer = new byte[1024];
int len = 0;
while ((len = is.read(buffer)) != -1) {
out.write(buffer, 0, len);
}
new File(newUrl).delete();
is.close();
out.flush();
out.close();
}
//下载附件
@At
public void download(String path, String filename, String fname, HttpServletResponse response) {
//取得文件
try {
//获取路径
File directory = new File("");// 参数为空
String courseFile = directory.getCanonicalPath();
File file = new File(courseFile + "\\" + path);
if (file.exists()) {
response.setHeader("content-disposition", "attachment;filename=" + new String(fname.getBytes("utf-8"), "ISO8859-1"));
FileInputStream fis = new FileInputStream(file);
OutputStream os = response.getOutputStream();
int len = -1;
byte[] b = new byte[1024 * 100];
while ((len = fis.read(b)) != -1) {
os.write(b, 0, len);
}
os.flush();
os.close();
fis.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
@@ -0,0 +1,142 @@
package io.v.nutz.jf.controller;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.utils.DateUtil;
import io.v.nutz.base.utils.PageUtil;
import io.v.nutz.jf.model.jf_club;
import io.v.nutz.jf.model.jf_use;
import io.v.nutz.jf.model.jf_yjgh;
import io.v.nutz.jf.service.ActivityBxService;
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.log.Log;
import org.nutz.log.Logs;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
/**
* @author zhf
* @date 2020/11/5 14:28
* @description 经费调整详情
*/
@IocBean
@At("/platform/jf/tz")
@Ok("json:full")
public class jsTzController {
private static final Log log = Logs.get();
@Inject
private io.v.nutz.jf.service.jfUseService jfUseService;
@Inject
private io.v.nutz.jf.service.jfYjghService jfYjghService;
@Inject
private io.v.nutz.jf.service.jfClubService jfClubService;
@Inject
private ActivityBxService activityBxService;
@At
public Object data(int pageNumber, int pageSize, Integer year, String pageOrderName, String pageOrderBy, String adjust_id) {
try {
Sql sql = Sqls.create("""
SELECT
ju.*,
re.userId ,
re.activity_number,
su.username,
YEAR(re.applyTime) `year`,
us.unionname
FROM
`jf_use` ju
LEFT JOIN jf_yjgh jf ON ju.adjust_id = jf.id
LEFT JOIN sys_user su ON su.id = ju.adjust_person
LEFT JOIN reimbursement_new re ON re.id = ju.apply_id
LEFT JOIN `user` us ON us.id = re.userId
$condition
""");
Cnd cnd = Cnd.NEW();
if (Strings.isNotBlank(pageOrderBy) && Strings.isNotBlank(pageOrderName)) {
cnd.orderBy(pageOrderName, PageUtil.getOrder(pageOrderBy));
} else {
cnd.desc("ju.adjust_time");
}
cnd.and("adjust_id", "=", adjust_id);
cnd.and("adjust_time", "like", year + "%");
sql.setCondition(cnd);
Pagination list = jfUseService.listPage(pageNumber, pageSize, sql);
return Result.success().addData(list);
} catch (Exception e) {
return Result.error();
}
}
@At //新增使用记录
public Object addUse(jf_use jf_use, boolean isClub) {
try {
Sys_user user = (Sys_user) ShiroUtil.getPrincipal();
jf_use.setAdjust_time(DateUtil.getDate());
jf_use.setAdjust_person(user.getId());
jfUseService.addUse(jf_use, isClub);
return Result.success();
} catch (Exception e) {
log.error(e);
return Result.error();
}
}
@At
public Object delUse(String id, boolean isClub) {
try {
jf_use use = jfUseService.fetch(id);
jfUseService.delete(id);
flushMoney(use.getAdjust_id(), isClub);
return Result.success();
} catch (Exception e) {
log.error(e);
return Result.error();
}
}
@At
@ViReturn
public Object doEdit(jf_use jf_use, boolean isClub) {
jfUseService.update(jf_use);
flushMoney(jf_use.getAdjust_id(), isClub);
return null;
}
private void flushMoney(String id, boolean isClub) {
Sql sql = Sqls.create("SELECT IFNULL(SUM(u.adjust_money),0) money from jf_use u WHERE u.adjust_id = @id").setParam("id", id);
int money = jfUseService.list(sql).get(0).getInt("money");
if (!isClub) {
jf_yjgh yjgh = jfYjghService.fetch(id);
yjgh.setUsedQuota(money);
jfYjghService.update(yjgh);
} else {
jf_club club = jfClubService.fetch(id);
club.setUsed_quota(money);
jfClubService.update(club);
}
}
}
@@ -0,0 +1,70 @@
package io.v.nutz.jf.controller.school;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.service.BaseService;
import io.v.nutz.base.utils.DateUtil;
import io.v.nutz.jf.model.CostsSet;
import io.v.nutz.jf.model.jf_school;
import io.v.nutz.modules.models.PageForm;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
import org.nutz.dao.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;
/**
* TODO
* 校工会预算列表
*
* @Author zhf
* @Date 2022/10/13 11:22
*/
@IocBean
@Ok("json:full")
@At("/platform/jf/schoolBudget/list")
public class schoolBudgetController {
@At("")
@Ok("beetl:/platform/jf/school/schoolBudgetList.html")
@RequiresPermissions("sys.jf.school.schoolBudgetList")
public void index() {
}
@Inject
private BaseService baseService;
@At
@ViReturn
@RequiresAuthentication
public Object pageData(PageForm pageForm, Integer year) {
Cnd cnd = Cnd.NEW();
Sql sql = Sqls.create("""
SELECT * FROM `jf_school` $condition
""");
cnd.andEX("year", "=", year);
sql.setCondition(cnd);
return baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
}
@At
@ViReturn
@RequiresAuthentication
public Object doChangeYs(Float totalQuota2, String id) {
jf_school jf_school = baseService.dao().fetch(jf_school.class, id);
jf_school.setTotalQuota(totalQuota2);
baseService.updateIgnoreNull(jf_school);
baseService.dao().update(CostsSet.class, Chain.make("schoolMoney", totalQuota2), Cnd.where("year", "=", DateUtil.getYear()));
return null;
}
}
@@ -0,0 +1,60 @@
package io.v.nutz.jf.controller.school;
import cn.wizzer.framework.base.service.BaseService;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.modules.models.PageForm;
import org.apache.shiro.authz.annotation.RequiresPermissions;
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.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
/**
* TODO
*预算使用情况
* @Author zhf
* @Date 2022/10/13 16:14
*/
@IocBean
@Ok("json:full")
@At("/platform/jf/schoolBudget/use/list")
public class schoolBudgetUseController {
@At("")
@Ok("beetl:/platform/jf/school/schoolBudgetUseList.html")
@RequiresPermissions("sys.jf.school.schoolBudgetUseList")
public void index() {
}
@Inject
private BaseService baseService;
@At
@ViReturn
public Object pageData(PageForm page, Integer year, String activity_name) {
Cnd cnd = Cnd.NEW();
Sql sql = Sqls.create("""
SELECT
YEAR(rei.applyTime) year,
rei.*
FROM
`school_use` suse
LEFT JOIN reimbursement_new rei ON rei.id = suse.reimbursementId
$condition
""");
cnd.andEX("YEAR ( rei.applyTime )", "=", year);
if (Strings.isNotBlank(activity_name)) {
cnd.where().andLike("rei.activity_name", activity_name);
}
cnd.desc("rei.applyTime");
sql.setCondition(cnd);
return baseService.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
}
}
@@ -0,0 +1,143 @@
package io.v.nutz.jf.controller.yjgh;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.wizzer.framework.base.Result;
import io.v.nutz.jf.model.jf_yjgh;
import io.v.nutz.sys.models.Sys_union;
import io.v.nutz.sys.services.SysUnionService;
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.AdaptBy;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.POST;
import org.nutz.mvc.upload.TempFile;
import org.nutz.mvc.upload.UploadAdaptor;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @Author:xsb
* @Description: 工会模板数据导入
* @Date:Created in 10:12 2021/1/30
*/
@IocBean
@Ok("json")
@At("/platform/jf/yjgh/dataInput")
public class DataInputController {
@Inject // 操作已交工会
private io.v.nutz.jf.service.jfYjghService jfYjghService;
@Inject //系统原本工会
private SysUnionService sysUnionService;
// 模板下载
/**
* 下载摸板
*
* @param response
* @throws IOException
*/
@At
public void downLoadTemp(HttpServletResponse response) throws IOException {
File file = null;
InputStream fin = null;
ServletOutputStream out = null;
try {
file = new File("src/main/resources/docTemplate/unionQuota.xlsx");
fin = new FileInputStream(file);
// 设置浏览器以下载的方式处理该文件名
String fileName = "批量导入工会预算分配" + ".xlsx";
response.setHeader("Content-Disposition", "attachment;filename="
.concat(String.valueOf(URLEncoder.encode(fileName, "UTF-8"))));
out = response.getOutputStream();
byte[] buffer = new byte[512]; // 缓冲区
int bytesToRead = -1;
// 通过循环将读入的Word文件的内容输出到浏览器中
while ((bytesToRead = fin.read(buffer)) != -1) {
out.write(buffer, 0, bytesToRead);
}
out.flush();
} finally {
if (fin != null) fin.close();
if (out != null) out.close();
}
}
// 把exsl数据
@At
@POST
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
public Object doExport(TempFile file, String park_id) {
int count = 0;
int success_count = 0;
try {
// 查出现在已交工会表中的已交工会
List<jf_yjgh> jf_yjghs = jfYjghService.query();
// 查出所有的系统工会
List<Sys_union> sysUnions = sysUnionService.query();
Map<String, String> collect = sysUnions.stream().collect(Collectors.toMap(Sys_union::getUnionname, Sys_union::getId));
//获得excel表格中的数据并封装成一个个对象
List<jf_yjgh> list = ExcelImportUtil.importExcel(file.getFile(), jf_yjgh.class, new ImportParams());
count = list.size();
//遍历excel表格中的一个个对象
for (jf_yjgh obj : list) {
try {
//状态设为1,默认为下发状态
obj.setState(1);
obj.setUnionId(collect.get(obj.getHistory_unionname()));
jf_yjgh yjgh = jf_yjghs.stream().filter(v -> v.getYear().equals(obj.getYear()) && v.getUnionId().equals(obj.getUnionId())).findFirst().orElse(null);
// 遍历所有的已交工会
boolean has = jf_yjghs.stream().anyMatch(v -> v.getYear().equals(obj.getYear()) && v.getUnionId().equals(obj.getUnionId()));
if (has) {
yjgh.setUnionId(obj.getUnionId()); //工会id
yjgh.setState(1); //状态1
yjgh.setHistory_member(obj.getHistory_member()); //历史会员人数
yjgh.setHistory_union_avg(obj.getHistory_union_avg()); //历史品均值
yjgh.setTotalQuota(obj.getTotalQuota()); // 总金额
jfYjghService.update(yjgh); // 直接跟新这个对象,自动根据id修改
// 返回给前台的显示向数据库成功添加了几条数据的数量
success_count++;
} else {
// 向已交工会表中添加一条记录
jfYjghService.insert(obj);
// 返回给前台的显示向数据库成功添加了几条数据的数量
success_count++;
}
} catch (Exception e) {
e.printStackTrace();
}
}
} catch (Exception e) {
} finally {
return Result.success().addData(NutMap.NEW().setv("count", count).setv("success_count", success_count));
}
}
}
@@ -0,0 +1,156 @@
package io.v.nutz.jf.controller.yjgh;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.utils.ExcelUtil;
import io.v.nutz.base.utils.PageUtil;
import io.v.nutz.base.utils.Roles;
import io.v.nutz.web.commons.utils.ShiroUtil;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
import org.nutz.dao.entity.Record;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Strings;
import org.nutz.log.Log;
import org.nutz.log.Logs;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.util.List;
/**
* @author zhf
* @date 2020/11/5 14:25
* @description 分工会经费使用情况
*/
@IocBean
@At("/platform/jf/yjgh/jfsy")
@Ok("json:full")
@RequiresAuthentication
public class jfsyController {
private static final Log log = Logs.get();
@Inject
private io.v.nutz.jf.service.jfYjghService jfYjghService;
@At("")
@Ok("beetl:/platform/jf/yjgh/jfsy.html")
@RequiresPermissions("sys.jf.gh.tz")
public void index() {
}
@At
public Object data(int pageNumber, int pageSize, Integer year, String pageOrderName, String pageOrderBy, String unionId) {
try {
Sql sql = Sqls.create("""
SELECT
jf.*,
yjgh.id unid,
yjgh.unionname,
yjgh.unioncode
FROM
`sys_union` yjgh
LEFT JOIN jf_yjgh jf ON jf.unionId = yjgh.id
AND jf.`year` = @year
$condition
""");
Cnd cnd = Cnd.NEW();
if (ShiroUtil.hasRole("sysadmin") || ShiroUtil.hasRole("A06")) {
cnd.andEX("yjgh.id", "=", unionId);
} else if (ShiroUtil.hasRole("H04")) {
//基层工会管理员
cnd.and("yjgh.id", "in", "(SELECT sur.`unionid` FROM sys_user_role AS sur WHERE sur.`userId`= '" + ShiroUtil.getPrincipalProperty("id") + "' AND sur.`roleId`= '" + Roles.UNION_MANGER + "')");
}
cnd.and("jf.totalQuota", "IS NOT", null);
if (Strings.isNotBlank(pageOrderBy) && Strings.isNotBlank(pageOrderName)) {
cnd.orderBy(pageOrderName, PageUtil.getOrder(pageOrderBy));
} else {
cnd.asc("yjgh.unionname");
}
sql.setParam("year", year);
sql.setCondition(cnd);
Pagination listPage = jfYjghService.listPage(pageNumber, pageSize, sql);
return Result.success().addData(listPage);
} catch (Exception e) {
return Result.error();
}
}
@At
public Object modifyJf(String id, Integer usedQuota, String reason) {
try {
Chain chain = Chain.make("usedQuota", usedQuota).add("reason", reason);
jfYjghService.update(chain, Cnd.where("id", "=", id));
return Result.success();
} catch (Exception e) {
log.error(e);
return Result.error();
}
}
// 导出
@At
public void exportExcel(HttpServletResponse response, Integer year) {
Sql sql = Sqls.create("SELECT jf.*, yjgh.id unid, yjgh.unionname \n" +
"FROM `sys_union` yjgh\n" +
"LEFT JOIN jf_yjgh jf \n" +
"ON jf.unionId = yjgh.id \n" +
"AND jf.`year` = @year $condition");
Cnd cnd = Cnd.NEW();
if (ShiroUtil.hasRole("sysadmin") || ShiroUtil.hasRole("A06")) {
} else if (ShiroUtil.hasRole("H04")) {
//基层工会管理员
cnd.and("yjgh.id", "in", "(SELECT sur.`unionid` FROM sys_user_role AS sur WHERE sur.`userId`= '" + ShiroUtil.getPrincipalProperty("id") + "' AND sur.`roleId`= '" + Roles.UNION_MANGER + "')");
}
cnd.asc("yjgh.unionname");
sql.setParam("year", year);
sql.setCondition(cnd);
List<Record> list = jfYjghService.list(sql);
//excel标题
String[] title = {"年度", "院级工会名称", "分配总额度(元)", "已使用额度(元)", "剩余额度(元)"};
//excel文件名
String fileName = year + "年院级工会经费使用情况表.xls";
//sheet名
String sheetName = year + "年院级工会经费使用情况表";
String[][] content = new String[list.size()][title.length];
for (int i = 0; i < list.size(); i++) {
Float zed = Strings.isBlank(list.get(i).getString("totalquota")) ? 0 : Float.parseFloat(list.get(i).getString("totalquota"));
int ysyed = Strings.isBlank(list.get(i).getString("usedquota")) ? 0 : Integer.parseInt(list.get(i).getString("usedquota"));
content[i][0] = list.get(i).getString("year");
content[i][1] = list.get(i).getString("unionname");
content[i][2] = String.valueOf(zed);
content[i][3] = String.valueOf(ysyed);
content[i][4] = String.valueOf(zed - ysyed);
}
HSSFWorkbook wb = ExcelUtil.getHSSFWorkbook(sheetName, title, content, null);
try {
OutputStream os = response.getOutputStream();
response.setHeader("Content-disposition",
"attachment; filename=" + new String(fileName.getBytes("GB2312"), "8859_1"));
response.setContentType("application/msexcel");
wb.write(os);
os.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
@@ -0,0 +1,180 @@
package io.v.nutz.jf.controller.yjgh;
import cn.wizzer.framework.base.Result;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.page.Pagination;
import io.v.nutz.base.service.BaseService;
import io.v.nutz.base.utils.DateUtil;
import io.v.nutz.jf.model.CostsSet;
import io.v.nutz.jf.model.jf_yjgh;
import io.v.nutz.jf.service.CostsSetService;
import io.v.nutz.jf.service.jfYjghService;
import io.v.nutz.service.AsyncService;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
import org.nutz.dao.entity.Record;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Strings;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import java.util.List;
/**
* @author zhf
* @date 2020/11/5 14:27
* @description 院级工会预算管理
*/
@IocBean
@At("/platform/jf/yjgh/ghys")
@Ok("json:full")
@RequiresAuthentication
public class yjghController {
@Inject
private jfYjghService jfYjghService;
@Inject
private BaseService baseService;
@Inject // 费用设置
private CostsSetService costsSetService;
@Inject
private AsyncService asyncService;
@At("")
@Ok("beetl:/platform/jf/yjgh/ghys.html")
@RequiresPermissions("sys.jf.gh.fp")
public void index() {
}
// 查询是否已经设置了值 设置值时才会向表中添加工会的记录和现在的年
@At
@ViReturn
public Object isSetUnionAvg() {
return jfYjghService.count(Cnd.where("year", "=", DateUtil.getYear()));
}
// 获取最近的一年
@At
@ViReturn
public Object lastYear() {
Sql sql = Sqls.create("""
select max(year) year from jf_yjgh where state=1
""");
return jfYjghService.fetch(sql);
}
// 重置本年
@At
@ViReturn
public Object reset() {
return jfYjghService.update(Chain.make("state", 0), Cnd.where("year", "=", DateUtil.getYear()).and("state", "=", 1));
}
//查询是否已下发
@At
@ViReturn
public Object isSet() {
return jfYjghService.count(Cnd.where("state", "=", 1).and("year", "=", DateUtil.getYear()));
}
//下发
@At
@ViReturn
public Object issue() {
Sql sql = Sqls.create("\tSELECT\n" +
"\tjf.unionId,\n" +
"\t\n" +
"\t(\n" +
"\tSELECT\n" +
"\t\tCOUNT( 1 ) \n" +
"\tFROM\n" +
"\t\tsys_user u\n" +
"\t\tLEFT JOIN sys_unit unit ON u.unitid = unit.id\n" +
"\t\tLEFT JOIN sys_union hu ON hu.id = unit.unionid \n" +
"\tWHERE\n" +
"\t\tu.member = '1' \n" +
"\t\tAND hu.id = un.id \n" +
"\t) hyzs \n" +
"FROM\n" +
"\tsys_union un\n" +
"\tLEFT JOIN jf_yjgh jf ON jf.unionId = un.id \n" +
"\tAND jf.`year` =@year");
sql.setParam("year", DateUtil.getYear());
// 经费设置
CostsSet costsSet = costsSetService.fetch(Cnd.where("year", "=", DateUtil.getYear()));
List<Record> list = jfYjghService.list(sql);
asyncService.exe2(list, record -> {
String unionid = (String) record.get("unionid");
Float union_avg = costsSet.getUnion_avg();
Object hyzs = record.get("hyzs");
Float count = Float.parseFloat(hyzs.toString());
jfYjghService.update(Chain.make("totalquota", union_avg * count).add("state", 1).add("history_member", count).add("history_union_avg", union_avg), Cnd.where("year", "=", DateUtil.getYear()).and("state", "<", 1).and("unionid", "=", unionid));
});
return Result.success();
}
@At
public Object changeYs(String unionId, String project, Integer year, Float totalQuota) {
try {
totalQuota = totalQuota == null ? 0 : totalQuota;
jf_yjgh ghys = jfYjghService.fetch(Cnd.where("unionId", "=", unionId).and("year", "=", year));
if (ghys != null) {
ghys.setTotalQuota(totalQuota);
jfYjghService.updateIgnoreNull(ghys);
} else {
ghys = new jf_yjgh();
ghys.setUnionId(unionId);
ghys.setYear(year);
ghys.setTotalQuota(totalQuota);
jfYjghService.insert(ghys);
}
return Result.success();
} catch (Exception e) {
return Result.error();
}
}
@At
@ViReturn
public Object pageData(Integer pageNumber, Integer pageSize, Integer year, String union_id) {
Sql sql = Sqls.create(
"""
SELECT
jf.*,
un.id unid,
un.unionname,
un.unioncode
FROM
sys_union un
LEFT JOIN jf_yjgh jf ON jf.unionId = un.id
$condition
"""
);
Cnd cnd = Cnd.NEW();
if (Strings.isNotBlank(union_id)) {
cnd.and("jf.unionId", "=", union_id);
}
cnd.and("jf.year", "=", year);
cnd.and("jf.state", "=", 1);
cnd.asc("un.unioncode");
sql.setCondition(cnd);
Pagination pagination = baseService.listPage(pageNumber, pageSize, sql);
return pagination;
}
}
@@ -0,0 +1,34 @@
package io.v.nutz.jf.mode;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.util.Date;
@Data
public class FinancialImportExcelMode {
@Excel(name = "序号")
private String num;
@Excel(name = "年度")
private String year;
@Excel(name = "月份")
private Integer month;
@Excel(name = "所属工会/协会")
private String unionId;
@Excel(name = "活动名称")
private String project;
@Excel(name = "活动时间")
private Date activitie_time;
@Excel(name = "费用")
private Double adjust_money;
@Excel(name = "事由")
private String adjust_reason;
}
@@ -0,0 +1,273 @@
package io.v.nutz.jf.model;
import io.v.nutz.common.models.Goods;
import io.v.nutz.sys.models.Sys_file;
import lombok.Data;
import org.nutz.dao.DB;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.util.List;
/**
* @author zhf
* @date 2020/11/13 10:15
* @description 活动报销
*/
@Data
@Table("Activity_Bx")
public class ActivityBx {
@Column
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@Comment("姓名")
@ColDefine(type = ColType.VARCHAR, width = 200)
private String user_name;
@Column
@Comment("申请时间")
@ColDefine(type = ColType.VARCHAR, width = 30)
private String apply_time;
@Column
@Comment("用户id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String user_id;
@Column
@Comment("用户签字id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String user_signature;
@Column
@Comment("年份")
@ColDefine(type = ColType.INT, width = 4)
private Integer year;
@Column
@Comment("活动时间")
@ColDefine(type = ColType.VARCHAR, width = 30)
private String activity_time;
@Column
@Comment("活动地点")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String venue;
@Column
@Comment("活动名称")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String activity_name;
@Column
@Comment("活动id (未必有)")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String activity_id;
@Column
@Comment("活动内容")
@ColDefine(type = ColType.TEXT)
private String activity_content;
@Column
@Comment("报销事由")
@ColDefine(type = ColType.TEXT)
private String cause;
@Column
@Comment("活动人数")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String activity_number;
@Column
@Comment("报销金额")
@ColDefine(type = ColType.FLOAT, width = 10, precision = 2)
private Double activity_money;
@Column
@Comment("报销卡号")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String activity_card_number;
@Column
@Comment("活动类型(1.基层工会,2.校工会,3.社团)")
@ColDefine(type = ColType.INT, width = 2)
private Integer activity_type;
@Column
@Comment("状态id")
@ColDefine(type = ColType.INT, width = 8)
private String state_id;
@Column
@Comment("基层工会主席审核id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String union_audit_id;
@Column
@Comment("单位书记审核id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String unit_secretary_audit_id;
@Column
@Comment("财务审核id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String finance_audit_id;
@Column
@Comment("分管副主席审核id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String vice_chairman_audit_id;
@Column
@Comment("常务副主席审核id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String standing_vice_chairman_audit_id;
@Column
@Comment("基层工会主席签字id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String division_chairman;
@Column
@Comment("基层工会主席id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String division_chairman_name;
@Column
@Comment("基层工会审核时间")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String division_chairman_time;
@Column
@Comment("基层工会审核意见")
@ColDefine(type = ColType.VARCHAR, width = 500)
private String division_chairman_idea;
@Column
@Comment("工会会计签字id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String accounting;
@Column
@Comment("工会会计id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String accounting_name;
@Column
@Comment("工会会计审核时间")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String accounting_time;
@Column
@Comment("工会会计审核意见")
@ColDefine(type = ColType.VARCHAR, width = 500)
private String accounting_idea;
@Column
@Comment("工会副主席签字id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String confirm_trade;
@Column
@Comment("工会副主席id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String confirm_trade_name;
@Column
@Comment("工会副主席审核时间")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String confirm_trade_time;
@Column
@Comment("工会副主席审核意见")
@ColDefine(type = ColType.VARCHAR, width = 500)
private String confirm_trade_idea;
@Column
@Comment("工会主席签字id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String union_chairman;
@Column
@Comment("工会主席")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String union_chairman_name;
@Column
@Comment("工会主席审核时间")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String union_chairman_time;
@Column
@Comment("工会主席审核意见")
@ColDefine(type = ColType.VARCHAR, width = 500)
private String union_chairman_idea;
@Column
@Comment("工会出纳转账签字id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String union_cashier;
@Column
@Comment("工会出纳转账")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String union_cashier_name;
@Column
@Comment("工会出纳审核时间")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String union_cashier_time;
@Column
@Comment("工会出纳审核意见")
@ColDefine(type = ColType.VARCHAR, width = 500)
private String union_cashier_idea;
@Column
@Comment("协会负责人id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String association_principal_id;
@Column
@Comment("协会负责人签字id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String association_principalSign_id;
@Column
@Comment("协会负责人审核时间")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String association_principal_time;
@Column
@Comment("协会负责人审核意见")
@ColDefine(type = ColType.VARCHAR, width = 500)
private String association_principal_idea;
@Column
@Comment("附件")
@ColDefine(type = ColType.MYSQL_JSON)
private List<Sys_file> files;
@Column
@Comment("附件数量")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String files_num;
@Many(field = "reid")
private List<Goods> goods;
@Column
@Comment("单据号")
@Prev({
@SQL(db = DB.MYSQL, value = "SELECT CONCAT(YEAR(NOW()),LPAD(RIGHT((SELECT IFNULL(MAX(document_no),0) from activity_bx WHERE LEFT(document_no,4) = YEAR(NOW())),5)+1, 5, 0) )"),
})
private Integer document_no;
}
@@ -0,0 +1,121 @@
package io.v.nutz.jf.model;
import cn.wizzer.framework.base.model.BaseModel;
import io.v.nutz.sys.models.Sys_file;
import org.nutz.dao.entity.annotation.*;
import java.util.List;
/**
* @Author: 1V
* @DateTime: 2020/11/25 9:11
* @Description: TODO
*/
@Table("Activity_File")
public class ActivityFile extends BaseModel {
@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 user_id;
@Column
@Comment("上传人姓名")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String user_name;
@Column
@Comment("上传日期")
@ColDefine(type = ColType.VARCHAR, width = 30)
private String time;
@Column
@Comment("活动id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String activity_id;
@Column
@Comment("资料名称")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String name;
@Column
@Comment("资料类型")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String type;
@Column
@Comment("文件")
@ColDefine(type = ColType.MYSQL_JSON)
private List<Sys_file> files;
public String getUser_name() {
return user_name;
}
public void setUser_name(String user_name) {
this.user_name = user_name;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUser_id() {
return user_id;
}
public void setUser_id(String user_id) {
this.user_id = user_id;
}
public String getActivity_id() {
return activity_id;
}
public void setActivity_id(String activity_id) {
this.activity_id = activity_id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public List<Sys_file> getFiles() {
return files;
}
public void setFiles(List<Sys_file> files) {
this.files = files;
}
}
@@ -0,0 +1,46 @@
package io.v.nutz.jf.model;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
import java.io.Serializable;
/**
* @Author:xsb
* @Description: 每年的费用设置表实体类
* @Date:Created in 9:04 2021/1/28
*/
@Table("costs_set")
@Data
public class CostsSet implements Serializable {
private static final long serialVersionUID = 1L;
// 年度
@Column
@Comment("年度")
@ColDefine(type = ColType.INT)
private Integer year;
// 工会人均额度
@Column
@Comment("工会人均额度")
@ColDefine(type = ColType.FLOAT)
private Float union_avg;
// 社团人均额度
@Column
@Comment("社团人均额度")
@ColDefine(type = ColType.FLOAT)
private Float club_avg;
// 校工会额度
@Column
@Comment("校工会额度")
@ColDefine(type = ColType.FLOAT)
private Float schoolMoney;
}
@@ -0,0 +1,34 @@
package io.v.nutz.jf.model;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
/**
* TODO
*
* @Author zhf
* @Date 2022/10/13 17:14
*/
@Table
@Data
public class SchoolUse {
@Column
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@Comment("报销Id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String reimbursementId;
}
@@ -0,0 +1,272 @@
package io.v.nutz.jf.model;
import org.nutz.dao.entity.annotation.*;
import org.nutz.integration.json4excel.annotation.J4EName;
import java.io.Serializable;
/**
* @author: Aaron
* @create: 2020-08-15 13:58
* @description: 经费报销预约
**/
@Table("jf_bxyy")
public class jf_bxyy implements Serializable {
private static final long serialVersionUID = 1L;
@Column
@Name
@Comment("主键id")
@Prev(els = {@EL("uuid()")})
@ColDefine(type = ColType.VARCHAR, width = 32)
private String id;
@Column
@Comment("预约人ID")
@J4EName("预约人id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String booking_person_id;
@Column
@Comment("预约人电话")
@J4EName("预约人电话")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String booking_person_phone;
@Column
@Comment("预约时间")
@J4EName("预约时间")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String booking_time;
@Column
@Comment("报销金额")
@J4EName("报销金额")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String rei_money;
@Column
@Comment("活动类型")
@J4EName("活动类型")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String activity_type;
@Column
@Comment("报销事项")
@J4EName("报销事项")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String rei_matter;
@Column
@Comment("报销说明")
@J4EName("报销说明")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String rei_explain;
@Column
@Comment("报销人卡号")
@J4EName("报销人卡号")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String rei_card_number;
@Column
@Comment("报销人工资号")
@J4EName("报销人工资号")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String rei_wages_number;
@Column
@Comment("财务审核人ID")
@J4EName("财务审核人ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String finance_id;
@Column
@Comment("财务审核时间")
@J4EName("财务审核时间")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String finance_time;
@Column
@Comment("财务审核意见")
@J4EName("财务审核意见")
@ColDefine(type = ColType.VARCHAR, width = 300)
private String finance_opinion;
@Column
@Comment("主席审核人ID")
@J4EName("主席审核人ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String chairman_id;
@Column
@Comment("主席审核时间")
@J4EName("主席审核时间")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String chairman_time;
@Column
@Comment("主席审核意见")
@J4EName("主席审核意见")
@ColDefine(type = ColType.VARCHAR, width = 30)
private String chairman_opinion;
@Column
@Comment("审核状态:1.待主席审核、2.待财务审核、3.审核通过、4.主席审核不通过、5.财务审核不通过")
@J4EName("审核状态")
@ColDefine(type = ColType.INT, width = 30)
private Integer audit_status;
@Column
@Comment("是否为活动经费报销")
@J4EName("是否为活动经费报销")
@ColDefine(type = ColType.VARCHAR, width = 30)
private String is_activity;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getBooking_person_id() {
return booking_person_id;
}
public void setBooking_person_id(String booking_person_id) {
this.booking_person_id = booking_person_id;
}
public String getBooking_person_phone() {
return booking_person_phone;
}
public void setBooking_person_phone(String booking_person_phone) {
this.booking_person_phone = booking_person_phone;
}
public String getBooking_time() {
return booking_time;
}
public void setBooking_time(String booking_time) {
this.booking_time = booking_time;
}
public String getRei_money() {
return rei_money;
}
public void setRei_money(String rei_money) {
this.rei_money = rei_money;
}
public String getActivity_type() {
return activity_type;
}
public void setActivity_type(String activity_type) {
this.activity_type = activity_type;
}
public String getRei_matter() {
return rei_matter;
}
public void setRei_matter(String rei_matter) {
this.rei_matter = rei_matter;
}
public String getRei_explain() {
return rei_explain;
}
public void setRei_explain(String rei_explain) {
this.rei_explain = rei_explain;
}
public String getRei_card_number() {
return rei_card_number;
}
public void setRei_card_number(String rei_card_number) {
this.rei_card_number = rei_card_number;
}
public String getRei_wages_number() {
return rei_wages_number;
}
public void setRei_wages_number(String rei_wages_number) {
this.rei_wages_number = rei_wages_number;
}
public String getFinance_id() {
return finance_id;
}
public void setFinance_id(String finance_id) {
this.finance_id = finance_id;
}
public String getFinance_time() {
return finance_time;
}
public void setFinance_time(String finance_time) {
this.finance_time = finance_time;
}
public String getFinance_opinion() {
return finance_opinion;
}
public void setFinance_opinion(String finance_opinion) {
this.finance_opinion = finance_opinion;
}
public String getChairman_id() {
return chairman_id;
}
public void setChairman_id(String chairman_id) {
this.chairman_id = chairman_id;
}
public String getChairman_time() {
return chairman_time;
}
public void setChairman_time(String chairman_time) {
this.chairman_time = chairman_time;
}
public String getChairman_opinion() {
return chairman_opinion;
}
public void setChairman_opinion(String chairman_opinion) {
this.chairman_opinion = chairman_opinion;
}
public Integer getAudit_status() {
return audit_status;
}
public void setAudit_status(Integer audit_status) {
this.audit_status = audit_status;
}
public String getIs_activity() {
return is_activity;
}
public void setIs_activity(String is_activity) {
this.is_activity = is_activity;
}
}
@@ -0,0 +1,93 @@
package io.v.nutz.jf.model;
import cn.wizzer.framework.base.model.BaseModel;
import org.nutz.dao.entity.annotation.*;
import org.nutz.integration.json4excel.annotation.J4EIgnore;
import org.nutz.integration.json4excel.annotation.J4EName;
import java.io.Serializable;
/**
* @author: Aaron
* @create: 2020-08-17 14:09
* @description:
**/
@Table("jf_bxyy_fj")
@J4EName("经费预约附件表")
public class jf_bxyy_fj extends BaseModel implements Serializable {
private static final long serialVersionUID = 1L;
@Column
@Name
@Comment("ID")
@J4EIgnore
@ColDefine(type = ColType.VARCHAR, width = 32)
private String id;
@Column
@Comment("经费预约id")
@J4EIgnore
@ColDefine(type = ColType.VARCHAR, width = 32)
private String booking_id;
@Column
@Comment("附件url")
@J4EName("附件url")
@ColDefine(type = ColType.VARCHAR, width = 200)
private String url;
@Column
@Comment("附件名称")
@J4EName("附件名称")
@ColDefine(type = ColType.VARCHAR, width = 80)
private String name;
@Column
@Comment("上传时间")
@J4EName("上传时间")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String time;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getBooking_id() {
return booking_id;
}
public void setBooking_id(String booking_id) {
this.booking_id = booking_id;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
}
@@ -0,0 +1,85 @@
package io.v.nutz.jf.model;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
import java.io.Serializable;
/**
* @author: Aaron
* @create: 2020-08-18 15:01
* @description: 社团预算管理
**/
@Table("jf_club")
@Data
public class jf_club implements Serializable {
private static final long serialVersionUID = 1L;
@Column
@Name
@Comment("主键ID")
@Prev(els = {@EL("uuid()")})
@ColDefine(type = ColType.VARCHAR, width = 32)
private String id;
@Column
@Comment("社团ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String club_id;
@Excel(name = "年度")
@Column
@Comment("年份")
@ColDefine(type = ColType.INT, width = 4)
private Integer year;
@Column
@Comment("社团活动费")
@ColDefine(type = ColType.INT)
private Integer club_activity_cost;
@Column
@Comment("六必访经费")
@ColDefine(type = ColType.INT)
private Integer lbf_cost;
@Excel(name = "总额度")
@Column
@Comment("总额度")
@ColDefine(type = ColType.FLOAT)
private Float total_quota;
@Excel(name = "协会人数")
@Column
@Comment("历史会员人数")
@ColDefine(type = ColType.INT)
private Integer history_member;
@Excel(name = "标准")
@Column
@Comment("历史人均额度")
@ColDefine(type = ColType.FLOAT)
private Float history_club_avg;
@Excel(name = "协会名称")
@Column
@Comment("历史协会名称")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String history_clubname;
@Column
@Comment("状态(>=1代表今年已经设置过,<1代表今年未设置,默认值是0)")
@Default("0")
@ColDefine(type = ColType.INT)
private Integer state;
@Column
@Comment("已使用额度")
@ColDefine(type = ColType.FLOAT, width = 10, precision = 2)
private double used_quota;
}
@@ -0,0 +1,54 @@
package io.v.nutz.jf.model;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
/**
* TODO
*
* @Author zhf
* @Date 2022/10/13 10:31
*/
@Table
@Data
public class jf_school {
@Column
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Excel(name = "年度")
@Column
@Comment("年份")
@ColDefine(type = ColType.INT, width = 4)
private Integer year;
@Excel(name = "总额度")
@Column
@Comment("总额度")
@ColDefine(type = ColType.FLOAT)
private Float totalQuota;
@Column
@Comment("已使用额度")
@ColDefine(type = ColType.FLOAT, width = 10, precision = 2)
private double usedQuota;
@Column
@Comment("状态(>=1代表今年已经设置过,<1代表今年未设置,默认值是0)")
@Default("0")
@ColDefine(type = ColType.INT)
private Integer state;
}
@@ -0,0 +1,75 @@
package io.v.nutz.jf.model;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
import java.io.Serializable;
/**
* @author: Aaron
* @create: 2020-08-18 09:30
* @description: 预算使用详情
**/
@Table("jf_use")
@Data
public class jf_use implements Serializable {
private static final long serialVersionUID = 1L;
@Column
@Name
@Comment("主键ID")
@Prev(els = {@EL("uuid()")})
@ColDefine(type = ColType.VARCHAR, width = 32)
private String id;
@Column
@Comment("被调整经费ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String adjust_id;
@Column
@Comment("项目")
@ColDefine(type = ColType.VARCHAR, width = 255)
private String project;
@Column
@Comment("调整金额")
@ColDefine(type = ColType.FLOAT, width = 10, precision = 2)
private double adjust_money;
@Column
@Comment("调整事由")
@ColDefine(type = ColType.VARCHAR, width = 500)
private String adjust_reason;
@Column
@Comment("调整时间")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String adjust_time;
@Column
@Comment("调整人")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String adjust_person;
@Column
@Comment("报销id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String apply_id;
@Column
@Comment("活动人数")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String activitie_number;
@Column
@Comment("活动时间")
@ColDefine(type = ColType.VARCHAR)
@JsonFormat(pattern = "yyyy-MM-dd")
private String activitie_time;
@Column
@Comment("月份")
@ColDefine(type = ColType.INT, width = 2)
private Integer month;
}
@@ -0,0 +1,112 @@
package io.v.nutz.jf.model;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
import java.io.Serializable;
/**
* @author: Aaron
* @create: 2020-08-14 10:30
* @description: 院级工会经费管理
**/
@Table("jf_yjgh")
@Data
public class jf_yjgh implements Serializable {
private static final long serialVersionUID = 1L;
@Column
@Name
@Comment("主键ID")
@Prev(els = {@EL("uuid()")})
@ColDefine(type = ColType.VARCHAR, width = 32)
private String id;
@Column
@Comment("院级工会ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String unionId;
@Excel(name = "年度")
@Column
@Comment("年份")
@ColDefine(type = ColType.INT, width = 4)
private Integer year;
@Column
@Comment("院级工会活动费")
@ColDefine(type = ColType.INT)
private Integer unionActivityCost;
@Column
@Comment("六必访经费")
@ColDefine(type = ColType.INT)
private Integer lbfCost;
@Excel(name = "总额度")
@Column
@Comment("总额度")
@ColDefine(type = ColType.FLOAT)
private Float totalQuota;
@Column
@Comment("已使用额度")
@ColDefine(type = ColType.FLOAT, width = 10, precision = 2)
private double usedQuota;
@Column
@Comment("状态(>=1代表今年已经设置过,<1代表今年未设置,默认值是0)")
@Default("0")
@ColDefine(type = ColType.INT)
private Integer state;
@Excel(name = "会员人数")
@Column
@Comment("历史会员人数")
@ColDefine(type = ColType.INT)
private Integer history_member;
@Excel(name = "标准")
@Column
@Comment("历史人均额度")
@ColDefine(type = ColType.FLOAT)
private Float history_union_avg;
@Excel(name = "院级工会名称")
@Column
@Comment("历史院级工会名称")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String history_unionname;
@Column
@Comment("调整事由")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String reason;
public Float getTotalQuota() {
return totalQuota;
}
public void setTotalQuota(Float totalQuota) {
this.totalQuota = totalQuota;
}
//
// @Excel(name = "年度")
// @Column
// @Comment("历史年度")
// @ColDefine(type = ColType.INT,width = 4)
// private Integer history_year;
public Integer getState() {
return state;
}
public void setState(Integer state) {
this.state = state;
}
}
@@ -0,0 +1,15 @@
package io.v.nutz.jf.service;
import cn.wizzer.framework.base.service.BaseService;
import io.v.nutz.jf.model.ActivityBx;
/**
* @author zhf
* @date 2020/11/13 10:37
* @description 活动报销
*/
public interface ActivityBxService extends BaseService<ActivityBx> {
void doAdd(ActivityBx activityBx);
void doEdit(ActivityBx activityBx);
}
@@ -0,0 +1,8 @@
package io.v.nutz.jf.service;
import cn.wizzer.framework.base.service.BaseService;
import io.v.nutz.jf.model.ActivityFile;
public interface ActivityFileService extends BaseService<ActivityFile> {
}
@@ -0,0 +1,12 @@
package io.v.nutz.jf.service;
import cn.wizzer.framework.base.service.BaseService;
import io.v.nutz.jf.model.CostsSet;
/**
* @Author:xsb
* @Description: 费用设置
* @Date:Created in 9:37 2021/1/28
*/
public interface CostsSetService extends BaseService<CostsSet> {
}
@@ -0,0 +1,35 @@
package io.v.nutz.jf.service.impl;
import cn.wizzer.framework.base.service.BaseServiceImpl;
import io.v.nutz.jf.model.ActivityBx;
import io.v.nutz.jf.service.ActivityBxService;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Dao;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.IocBean;
/**
* @author zhf
* @date 2020/11/13 10:38
* @description 活动报销
*/
@IocBean(args = {"refer:dao"})
public class ActivityBxServiceImpl extends BaseServiceImpl<ActivityBx> implements ActivityBxService {
public ActivityBxServiceImpl(Dao dao) {
super(dao);
}
@Override
@Aop(TransAop.READ_COMMITTED)
public void doAdd(ActivityBx activityBx) {
insertWith(activityBx, "goods");
}
@Override
@Aop(TransAop.READ_COMMITTED)
public void doEdit(ActivityBx activityBx) {
updateWith(activityBx, "goods");
}
}
@@ -0,0 +1,14 @@
package io.v.nutz.jf.service.impl;
import cn.wizzer.framework.base.service.BaseServiceImpl;
import io.v.nutz.jf.model.ActivityFile;
import io.v.nutz.jf.service.ActivityFileService;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.IocBean;
@IocBean(args = {"refer:dao"})
public class ActivityFileServiceImpl extends BaseServiceImpl<ActivityFile> implements ActivityFileService {
public ActivityFileServiceImpl(Dao dao) {
super(dao);
}
}
@@ -0,0 +1,19 @@
package io.v.nutz.jf.service.impl;
import cn.wizzer.framework.base.service.BaseServiceImpl;
import io.v.nutz.jf.model.CostsSet;
import io.v.nutz.jf.service.CostsSetService;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.IocBean;
/**
* @Author:xsb
* @Description: 费用设置
* @Date:Created in 9:40 2021/1/28
*/
@IocBean(args = {"refer:dao"})
public class CostsSetServiceImpl extends BaseServiceImpl<CostsSet> implements CostsSetService {
public CostsSetServiceImpl(Dao dao) {
super(dao);
}
}
@@ -0,0 +1,19 @@
package io.v.nutz.jf.service.impl;
import cn.wizzer.framework.base.service.BaseServiceImpl;
import io.v.nutz.jf.model.jf_bxyy;
import io.v.nutz.jf.service.jfBxyyService;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.IocBean;
/**
* @author: Aaron
* @create: 2020-08-14 10:42
* @description:
**/
@IocBean(args = {"refer:dao"})
public class jfBxyyServiceImpl extends BaseServiceImpl<jf_bxyy> implements jfBxyyService {
public jfBxyyServiceImpl(Dao dao) {
super(dao);
}
}
@@ -0,0 +1,19 @@
package io.v.nutz.jf.service.impl;
import io.v.nutz.jf.model.jf_club;
import io.v.nutz.jf.service.jfClubService;
import io.v.nutz.service.impl.ViServiceImpl;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.IocBean;
/**
* @author: Aaron
* @create: 2020-08-14 10:42
* @description:
**/
@IocBean(args = {"refer:dao"})
public class jfClubServiceImpl extends ViServiceImpl<jf_club> implements jfClubService {
public jfClubServiceImpl(Dao dao) {
super(dao);
}
}
@@ -0,0 +1,43 @@
package io.v.nutz.jf.service.impl;
import cn.wizzer.framework.base.service.BaseServiceImpl;
import io.v.nutz.jf.model.jf_club;
import io.v.nutz.jf.model.jf_use;
import io.v.nutz.jf.model.jf_yjgh;
import io.v.nutz.jf.service.jfUseService;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
/**
* @author: Aaron
* @create: 2020-08-18 09:38
* @description:
**/
@IocBean(args = {"refer:dao"})
public class jfUseServiceImpl extends BaseServiceImpl<jf_use> implements jfUseService {
@Inject
private jfClubServiceImpl jfClubService;
@Inject
private jfYjghServiceImpl jfYjghService;
public jfUseServiceImpl(Dao dao) {
super(dao);
}
@Override
public void addUse(jf_use jf_use, boolean isClub) {
insert(jf_use); // 向经费使用表中添加一条记录
if (isClub) {
jf_club jf_club = jfClubService.fetch(jf_use.getAdjust_id()); //根据调整经费id查询
jf_club.setUsed_quota(jf_club.getUsed_quota() + jf_use.getAdjust_money());
update(jf_club);
} else {
jf_yjgh jf_yjgh = jfYjghService.fetch(jf_use.getAdjust_id());
jf_yjgh.setUsedQuota(jf_yjgh.getUsedQuota() + jf_use.getAdjust_money());
update(jf_yjgh);
}
}
}
@@ -0,0 +1,19 @@
package io.v.nutz.jf.service.impl;
import io.v.nutz.jf.model.jf_yjgh;
import io.v.nutz.jf.service.jfYjghService;
import io.v.nutz.service.impl.ViServiceImpl;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.IocBean;
/**
* @author: Aaron
* @create: 2020-08-14 10:42
* @description:
**/
@IocBean(args = {"refer:dao"})
public class jfYjghServiceImpl extends ViServiceImpl<jf_yjgh> implements jfYjghService {
public jfYjghServiceImpl(Dao dao) {
super(dao);
}
}
@@ -0,0 +1,19 @@
package io.v.nutz.jf.service.impl;
import cn.wizzer.framework.base.service.BaseServiceImpl;
import io.v.nutz.jf.model.jf_bxyy_fj;
import io.v.nutz.jf.service.jfBxYyFjService;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.IocBean;
/**
* @author: Aaron
* @create: 2020-08-14 10:42
* @description:
**/
@IocBean(args = {"refer:dao"})
public class jfYyBxFjServiceImpl extends BaseServiceImpl<jf_bxyy_fj> implements jfBxYyFjService {
public jfYyBxFjServiceImpl(Dao dao) {
super(dao);
}
}
@@ -0,0 +1,7 @@
package io.v.nutz.jf.service;
import cn.wizzer.framework.base.service.BaseService;
import io.v.nutz.jf.model.jf_bxyy_fj;
public interface jfBxYyFjService extends BaseService<jf_bxyy_fj> {
}
@@ -0,0 +1,7 @@
package io.v.nutz.jf.service;
import cn.wizzer.framework.base.service.BaseService;
import io.v.nutz.jf.model.jf_bxyy;
public interface jfBxyyService extends BaseService<jf_bxyy> {
}
@@ -0,0 +1,7 @@
package io.v.nutz.jf.service;
import io.v.nutz.jf.model.jf_club;
import io.v.nutz.service.ViService;
public interface jfClubService extends ViService<jf_club> {
}
@@ -0,0 +1,8 @@
package io.v.nutz.jf.service;
import cn.wizzer.framework.base.service.BaseService;
import io.v.nutz.jf.model.jf_use;
public interface jfUseService extends BaseService<jf_use> {
void addUse(jf_use jf_use, boolean isClub);
}
@@ -0,0 +1,7 @@
package io.v.nutz.jf.service;
import io.v.nutz.jf.model.jf_yjgh;
import io.v.nutz.service.ViService;
public interface jfYjghService extends ViService<jf_yjgh> {
}