活动申报、报销
This commit is contained in:
@@ -1,37 +1,12 @@
|
||||
package io.v.nutz.zhgh.jf.controller.Funds;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.sys.models.Sys_signature;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.sys.services.SysMsgService;
|
||||
import io.v.nutz.sys.services.SysSignatureService;
|
||||
import io.v.nutz.web.commons.slog.annotation.SLog;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.jf.handler.reimbursement.ReimbursementToDoHandler;
|
||||
import io.v.nutz.zhgh.jf.model.ActivityBx;
|
||||
import io.v.nutz.zhgh.jf.service.ActivityBxService;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
/**
|
||||
* 校工会副主席审核
|
||||
* TODO
|
||||
*
|
||||
* @Author zhf
|
||||
* @Date 2022/11/25 17:27
|
||||
@@ -41,117 +16,10 @@ import org.nutz.mvc.annotation.Param;
|
||||
@At("/platform/jf/funds/accounting")
|
||||
public class FundsAccountingController {
|
||||
|
||||
@Inject
|
||||
private Vi vi;
|
||||
@Inject
|
||||
private ActivityBxService activityBxService;
|
||||
@Inject
|
||||
private SysSignatureService sysSignatureService;
|
||||
@Inject
|
||||
private SysMsgService sysMsgService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/jf/Funds/fundsAccounting.html")
|
||||
@RequiresPermissions("sys.jf.funds.accounting")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("sys.jf.funds.accounting")
|
||||
public Object pageData(PageForm page,
|
||||
@Param(value = "apply_type", required = false) Integer apply_type,
|
||||
@Param(value = "year", required = false) Integer year,
|
||||
@Param(value = "isAudit", required = false) Integer isAudit,
|
||||
@Param(value = "deductionInt", required = false) Integer deductionInt,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "unionId", required = false) String unionId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
act.*,
|
||||
u.loginname bxr_loginname,
|
||||
u.unionname bxr_unionname,
|
||||
u.unioncode,
|
||||
s.state_name,
|
||||
s.state_color,
|
||||
abs.`name` absName
|
||||
FROM
|
||||
`activity_bx` act
|
||||
LEFT JOIN `user` u ON act.user_id = u.id
|
||||
LEFT JOIN state s ON act.state_id = s.state_id
|
||||
LEFT JOIN activity_basic_settings abs ON abs.`code` = act.projectTypeCode
|
||||
$condition
|
||||
""");
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
if (isAudit == 1) {
|
||||
cnd.and("act.state_id", ">=", 1030);
|
||||
} else {
|
||||
cnd.and("act.state_id", isAudit == 2 ? ">" : "=", 1030);
|
||||
}
|
||||
|
||||
if (deductionInt == 2) {
|
||||
cnd.and("act.isDeduction", "=", 1);
|
||||
} else if (deductionInt == 3) {
|
||||
cnd.and("act.isDeduction", "=", 0);
|
||||
}
|
||||
|
||||
|
||||
cnd.and("act.apply_type", "=", apply_type);
|
||||
Vi.cndPlus(cnd, "act.year", "=", year);
|
||||
if (Vi.isNotBlank(page.getSearchName(), page.getSearchKeyword())) {
|
||||
cnd.where().andLike(page.getSearchName(), page.getSearchKeyword());
|
||||
}
|
||||
|
||||
if (Vi.isNotBlank(page.getPageOrderName(), page.getPageOrderBy())) {
|
||||
cnd.orderBy(page.getPageOrderName(), page.getPageOrderBy());
|
||||
} 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.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("sys.jf.funds.accounting")
|
||||
@SLog(tag = "活动经费校工会副主席审核")
|
||||
public Object doReview(@Param(value = "id", required = false) String id,
|
||||
@Param(value = "idea", required = false) String idea,
|
||||
@Param(value = "sign", required = false) String sign,
|
||||
@Param(value = "flag", required = false) Boolean flag) {
|
||||
ActivityBx aid = activityBxService.fetch(id);
|
||||
aid.setState_id(flag ? "1060" : "1035");
|
||||
aid.setAccounting_name(ShiroUtil.getUserId());
|
||||
aid.setAccounting_time(DateUtil.getDate());
|
||||
aid.setAccounting_idea(idea);
|
||||
if (Strings.isNotBlank(sign)) {
|
||||
aid.setAccounting(sysSignatureService.insert(new Sys_signature(sign)).getId());
|
||||
}
|
||||
activityBxService.update(aid);
|
||||
|
||||
String nodeName = "";
|
||||
if (flag) {
|
||||
ReimbursementToDoHandler.COMPLETE_PROCESS.exec(aid.getId(), null);
|
||||
String division_chairman_name = aid.getDivision_chairman_name();
|
||||
if (StrUtil.isNotBlank(division_chairman_name)){
|
||||
Sys_user fghUser = activityBxService.dao().fetch(Sys_user.class, division_chairman_name);
|
||||
String note = """
|
||||
<p style="text-indent: 2em;">您的申报已审批通过,请导出申请表,并自行打印,连同分工会主席和经办人签字后的发票、签收清单等报销材料至财务处(行政楼财务大厅15号柜台)何铭老师办理报销。</p>
|
||||
""";
|
||||
if(ObjectUtil.isNotEmpty(fghUser)){
|
||||
sysMsgService.sendMsg(fghUser.getLoginname(), "【活动经费申报】-" + aid.getActivity_name(), note, ShiroUtil.getUserId());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
nodeName = "校工会副主席拒绝";
|
||||
ReimbursementToDoHandler.REFUSE_UNION_TASK.exec(id, new NutMap().addv("option", nodeName));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
package io.v.nutz.zhgh.jf.controller.Funds;
|
||||
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.sys.models.Sys_signature;
|
||||
import io.v.nutz.sys.services.SysSignatureService;
|
||||
import io.v.nutz.web.commons.slog.annotation.SLog;
|
||||
import io.v.nutz.zhgh.activity.models.ActivityTissue;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.zhgh.jf.handler.reimbursement.ReimbursementToDoHandler;
|
||||
import io.v.nutz.zhgh.jf.model.ActivityBx;
|
||||
import io.v.nutz.zhgh.jf.service.ActivityBxService;
|
||||
import io.v.nutz.base.service.ViService;
|
||||
@@ -16,22 +11,21 @@ import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
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.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
@@ -48,107 +42,44 @@ public class FundsApplyController {
|
||||
put("40003", "XH");
|
||||
put("40001", "GH");
|
||||
}};
|
||||
|
||||
@Inject
|
||||
private Vi vi;
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private ActivityBxService activityBxService;
|
||||
@Inject
|
||||
private SysSignatureService sysSignatureService;
|
||||
@Inject("ActivityTissue")
|
||||
private ViService<ActivityTissue> tissueViService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/jf/Funds/apply.html")
|
||||
@RequiresPermissions("sys.jf.Funds.apply")
|
||||
@RequiresPermissions(value = {"sys.jf.Funds.apply","sys.jf.Funds.apply2"},logical = Logical.OR)
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("beetl:/mobile/funds/apply.html")
|
||||
@RequiresPermissions("sys.jf.Funds.apply")
|
||||
public void mobile(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SLog(tag = "活动报销申请", msg = "添加")
|
||||
@RequiresPermissions("sys.jf.Funds.apply")
|
||||
public Object doAdd(@Param("activityBx") ActivityBx activityBx, @Param("sign") String sign) {
|
||||
activityBx.setYear(Calendar.getInstance().get(Calendar.YEAR));
|
||||
if (activityBx.getActivity_type().equals(40001)) {
|
||||
activityBx.setState_id("1030");
|
||||
} else if (activityBx.getActivity_type().equals(40003)) {
|
||||
activityBx.setState_id("1000");
|
||||
} else {
|
||||
activityBx.setFundsUnitId(vi.getUnionId());
|
||||
activityBx.setState_id("1010");
|
||||
@RequiresAuthentication
|
||||
public Object getActivity(Integer activity_type, @Param(value = "queryString", required = false) 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());
|
||||
}
|
||||
activityBx.setApply_time(DateUtil.getDate());
|
||||
activityBx.setUser_id(ShiroUtil.getUserId());
|
||||
if (Strings.isNotBlank(sign)) {
|
||||
activityBx.setUser_signature(sysSignatureService.insert(new Sys_signature(sign)).getId());
|
||||
}
|
||||
activityBxService.doAdd(activityBx);
|
||||
|
||||
NutMap map = new NutMap();
|
||||
map.put("userId", ShiroUtil.getUserId());
|
||||
ReimbursementToDoHandler.START_PROCESS.exec(activityBx.getId(), map);
|
||||
if (activityBx.getActivity_type() == 40001) {
|
||||
//校工会申请,校工会负责人审核
|
||||
ReimbursementToDoHandler.CREATE_SCHOOL_CHAIRMAN_TASK.exec(activityBx.getId(), map);
|
||||
} else if (activityBx.getActivity_type() == 40002) {
|
||||
//分工会
|
||||
ReimbursementToDoHandler.CREATE_UNION_TASK.exec(activityBx.getId(), map);
|
||||
} else if (activityBx.getActivity_type() == 40003) {
|
||||
//协会
|
||||
map.put("clubName", activityBx.getFundsUnitName());
|
||||
ReimbursementToDoHandler.CREATE_CLUB_TASK.exec(activityBx.getId(), map);
|
||||
}
|
||||
return null;
|
||||
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);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SLog(tag = "活动报销申请", msg = "编辑")
|
||||
@RequiresPermissions("sys.jf.Funds.apply")
|
||||
public Object doEdit(@Param("activityBx") ActivityBx activityBx, @Param("sign") String sign) {
|
||||
if (Strings.isNotBlank(sign)) {
|
||||
activityBx.setUser_signature(sysSignatureService.insert(new Sys_signature(sign)).getId());
|
||||
}
|
||||
if (activityBx.getActivity_type().equals(40001)) {
|
||||
activityBx.setState_id("1030");
|
||||
} else if (activityBx.getActivity_type().equals(40003)) {
|
||||
activityBx.setState_id("1000");
|
||||
} else {
|
||||
activityBx.setState_id("1010");
|
||||
}
|
||||
activityBx.setFunds_money(0d);
|
||||
dao.updateIgnoreNull(activityBx);
|
||||
|
||||
NutMap map = new NutMap();
|
||||
map.put("userId", ShiroUtil.getUserId());
|
||||
//流程开始
|
||||
ReimbursementToDoHandler.START_PROCESS.exec(activityBx.getId(), map);
|
||||
if (activityBx.getActivity_type() == 40001) {
|
||||
//校工会申请,校工会负责人审核
|
||||
ReimbursementToDoHandler.CREATE_SCHOOL_CHAIRMAN_TASK.exec(activityBx.getId(), map);
|
||||
} else if (activityBx.getActivity_type() == 40002) {
|
||||
//分工会
|
||||
ReimbursementToDoHandler.CREATE_UNION_TASK.exec(activityBx.getId(), map);
|
||||
} else if (activityBx.getActivity_type() == 40003) {
|
||||
//协会
|
||||
map.put("clubName", activityBx.getFundsUnitName());
|
||||
ReimbursementToDoHandler.CREATE_CLUB_TASK.exec(activityBx.getId(), map);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 活动编号生成
|
||||
*
|
||||
@@ -157,7 +88,7 @@ public class FundsApplyController {
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("sys.jf.Funds.apply")
|
||||
@RequiresPermissions(value = {"sys.jf.Funds.apply","sys.jf.Funds.apply2"},logical = Logical.OR)
|
||||
public Object generateProjectCode(String activity_type) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
int year = Calendar.getInstance().get(Calendar.YEAR);
|
||||
@@ -166,23 +97,39 @@ public class FundsApplyController {
|
||||
return year + projectCodeMap.getString(activity_type) + code;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取登录用户的社团信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("sys.jf.Funds.apply")
|
||||
@RequiresAuthentication
|
||||
public Object getUserClub() {
|
||||
return activityBxService.dao().query(Sys_club_user.class, Cnd.where("userid", "=", ShiroUtil.getUserId()));
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("sys.jf.Funds.apply")
|
||||
public Object findOne(String id) {
|
||||
return activityBxService.queryOne(id);
|
||||
@RequiresPermissions(value = {"sys.jf.Funds.apply","sys.jf.Funds.apply2","sys.jf.reimbursement.apply"},logical = Logical.OR)
|
||||
public Object getCardNumberByPayeeId(String username){
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
JT.bankName,
|
||||
JT.bankCardNum
|
||||
FROM
|
||||
activity_bx AS bx,
|
||||
JSON_TABLE(
|
||||
budgets,
|
||||
'$[*]' COLUMNS(
|
||||
username VARCHAR(255) PATH '$.username',
|
||||
bankName VARCHAR(255) PATH '$.bankName',
|
||||
bankCardNum VARCHAR(255) PATH '$.bankCardNum'
|
||||
)
|
||||
) AS JT
|
||||
WHERE
|
||||
JT.username = @username
|
||||
ORDER BY bx.apply_time DESC LIMIT 1
|
||||
""").setParam("username", username);
|
||||
sql.setCallback(Sqls.callback.map());
|
||||
dao.execute(sql);
|
||||
return sql.getResult();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,32 +1,12 @@
|
||||
package io.v.nutz.zhgh.jf.controller.Funds;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.sys.models.Sys_signature;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.sys.services.SysSignatureService;
|
||||
import io.v.nutz.web.commons.slog.annotation.SLog;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.jf.handler.reimbursement.ReimbursementToDoHandler;
|
||||
import io.v.nutz.zhgh.jf.model.ActivityBx;
|
||||
import io.v.nutz.zhgh.jf.service.ActivityBxService;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
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.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
/**
|
||||
* 协会审核
|
||||
* TODO
|
||||
*
|
||||
* @Author zhf
|
||||
* @Date 2022/11/25 17:17
|
||||
@@ -36,109 +16,9 @@ import org.nutz.mvc.annotation.Param;
|
||||
@At("/platform/jf/funds/association")
|
||||
public class FundsAssociationController {
|
||||
|
||||
@Inject
|
||||
private Vi vi;
|
||||
@Inject
|
||||
private ActivityBxService activityBxService;
|
||||
@Inject
|
||||
private SysSignatureService sysSignatureService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/jf/Funds/fundsAssociation.html")
|
||||
@RequiresPermissions("sys.jf.funds.association")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"sys.jf.funds.association", "sys.jf.activity_bx.association"}, logical = Logical.OR)
|
||||
public Object pageData(PageForm page,
|
||||
@Param(value = "apply_type", required = false) Integer apply_type,
|
||||
@Param(value = "year", required = false) Integer year,
|
||||
@Param(value = "deductionInt", required = false) Integer deductionInt,
|
||||
Integer isAudit,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "unionId", required = false) String unionId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
act.*,
|
||||
u.loginname bxr_loginname,
|
||||
u.unionname bxr_unionname,
|
||||
s.state_name,
|
||||
s.state_color,
|
||||
cl.fzr,
|
||||
abs.`name` absName
|
||||
FROM
|
||||
`activity_bx` act
|
||||
LEFT JOIN `user` u ON act.user_id = u.id
|
||||
LEFT JOIN sys_unit un ON u.unitid = un.id
|
||||
LEFT JOIN sys_club cl ON cl.fzr=u.id
|
||||
LEFT JOIN state s ON act.state_id = s.state_id
|
||||
LEFT JOIN activity_basic_settings abs ON abs.`code` = act.projectTypeCode
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
if (isAudit == 1) {
|
||||
cnd.and("act.state_id", ">=", 1000);
|
||||
} else {
|
||||
cnd.and("act.state_id", isAudit == 2 ? ">" : "=", 1000);
|
||||
}
|
||||
|
||||
if (deductionInt == 2) {
|
||||
cnd.and("act.isDeduction", "=", 1);
|
||||
} else if (deductionInt == 3) {
|
||||
cnd.and("act.isDeduction", "=", 0);
|
||||
}
|
||||
cnd.and("act.apply_type", "=", apply_type);
|
||||
cnd.and("act.activity_type", "=", 40003);
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin")) {
|
||||
// cnd.and("cl.fzr", "=", ShiroUtil.getPrincipalProperty("id"));
|
||||
cnd.and("act.fundsUnitId","in",Sqls.create(vi.getMangeClubStr()));
|
||||
}
|
||||
Vi.cndPlus(cnd, "act.year", "=", year);
|
||||
if (Vi.isNotBlank(page.getSearchName(), page.getSearchKeyword())) {
|
||||
cnd.where().andLike(page.getSearchName(), page.getSearchKeyword());
|
||||
}
|
||||
|
||||
if (Vi.isNotBlank(page.getPageOrderName(), page.getPageOrderBy())) {
|
||||
cnd.orderBy(page.getPageOrderName(), page.getPageOrderBy());
|
||||
} 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.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"sys.jf.funds.association", "sys.jf.activity_bx.association"}, logical = Logical.OR)
|
||||
@SLog(tag = "活动报销协会审核", msg = "审核")
|
||||
public Object doReview(String id, String idea, String sign, double funds_money, Boolean flag) {
|
||||
ActivityBx aid = activityBxService.fetch(id);
|
||||
aid.setState_id(flag ? "1030" : "1005");
|
||||
aid.setAssociation_principal_id(ShiroUtil.getPrincipalProperty("id").toString());
|
||||
aid.setAssociation_principal_time(DateUtil.getDate());
|
||||
aid.setAssociation_principal_idea(idea);
|
||||
aid.setFunds_money(funds_money);
|
||||
if (Strings.isNotBlank(sign)) {
|
||||
aid.setAssociation_principalSign_id(sysSignatureService.insert(new Sys_signature(sign)).getId());
|
||||
}
|
||||
activityBxService.doEdit(aid);
|
||||
|
||||
String nodeName = "";
|
||||
if (flag) {
|
||||
ReimbursementToDoHandler.CREATE_SCHOOL_CHAIRMAN_TASK.exec(id, new NutMap().addv("userId", aid.getUser_id()));
|
||||
nodeName = "校工会副主席审核";
|
||||
} else {
|
||||
Sys_user user = activityBxService.dao().fetch(Sys_user.class, aid.getUser_id());
|
||||
nodeName = "协会审核拒绝";
|
||||
ReimbursementToDoHandler.REFUSE_UNION_TASK.exec(id, new NutMap().addv("option", nodeName));
|
||||
}
|
||||
ReimbursementToDoHandler.COMPLETE_CLUB_TASK.exec(id, new NutMap().addv("option", nodeName));
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,31 +1,12 @@
|
||||
package io.v.nutz.zhgh.jf.controller.Funds;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.sys.models.Sys_signature;
|
||||
import io.v.nutz.sys.services.SysSignatureService;
|
||||
import io.v.nutz.web.commons.slog.annotation.SLog;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.jf.handler.reimbursement.ReimbursementToDoHandler;
|
||||
import io.v.nutz.zhgh.jf.model.ActivityBx;
|
||||
import io.v.nutz.zhgh.jf.service.ActivityBxService;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
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.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
/**
|
||||
* 分工会审核
|
||||
* TODO
|
||||
*
|
||||
* @Author zhf
|
||||
* @Date 2022/11/25 17:23
|
||||
@@ -35,12 +16,6 @@ import org.nutz.mvc.annotation.Param;
|
||||
@At("/platform/jf/funds/division")
|
||||
public class FundsDivisionController {
|
||||
|
||||
@Inject
|
||||
private Vi vi;
|
||||
@Inject
|
||||
private ActivityBxService activityBxService;
|
||||
@Inject
|
||||
private SysSignatureService sysSignatureService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/jf/Funds/fundsDivision.html")
|
||||
@@ -48,97 +23,5 @@ public class FundsDivisionController {
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("sys.jf.funds.division")
|
||||
public Object pageData(PageForm page,
|
||||
@Param(value = "apply_type", required = false) Integer apply_type,
|
||||
@Param(value = "year", required = false) Integer year,
|
||||
@Param(value = "isAudit", required = false) Integer isAudit,
|
||||
@Param(value = "deductionInt", required = false) Integer deductionInt,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "unionId", required = false) String unionId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
act.*,
|
||||
u.loginname bxr_loginname,
|
||||
u.unionname bxr_unionname,
|
||||
u.unioncode,
|
||||
s.state_name,
|
||||
s.state_color,
|
||||
abs.`name` absName
|
||||
FROM
|
||||
`activity_bx` act
|
||||
LEFT JOIN `user` u ON act.user_id = u.id
|
||||
LEFT JOIN sys_unit su ON su.id = u.unitid
|
||||
LEFT JOIN sys_union un ON su.unionid = un.id
|
||||
LEFT JOIN state s ON act.state_id = s.state_id
|
||||
LEFT JOIN activity_basic_settings abs ON abs.`code` = act.projectTypeCode
|
||||
$condition
|
||||
""");
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
if (isAudit == 1) {
|
||||
cnd.and("act.state_id", ">=", 1010);
|
||||
} else {
|
||||
cnd.and("act.state_id", isAudit == 2 ? ">" : "=", 1010);
|
||||
}
|
||||
|
||||
if (deductionInt == 2) {
|
||||
cnd.and("act.isDeduction", "=", 1);
|
||||
} else if (deductionInt == 3) {
|
||||
cnd.and("act.isDeduction", "=", 0);
|
||||
}
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin")) {
|
||||
if (ShiroUtil.hasAnyRoles(new String[]{"H04", "gh01"})) {
|
||||
cnd.and("un.id", "=", vi.getUnionId());
|
||||
}
|
||||
}
|
||||
cnd.and("act.apply_type", "=", apply_type);
|
||||
Vi.cndPlus(cnd, "act.year", "=", year);
|
||||
if (Vi.isNotBlank(page.getSearchName(), page.getSearchKeyword())) {
|
||||
cnd.where().andLike(page.getSearchName(), page.getSearchKeyword());
|
||||
}
|
||||
|
||||
if (Vi.isNotBlank(page.getPageOrderName(), page.getPageOrderBy())) {
|
||||
cnd.orderBy(page.getPageOrderName(), page.getPageOrderBy());
|
||||
} 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.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("sys.jf.funds.division")
|
||||
@SLog(tag = "活动报销分工会主席审核", msg = "审核")
|
||||
public Object doReview(String id, String idea, String sign,double funds_money, Boolean flag) {
|
||||
ActivityBx aid = activityBxService.fetch(id);
|
||||
aid.setState_id(flag ? "1030" : "1015");
|
||||
aid.setDivision_chairman_name(ShiroUtil.getPrincipalProperty("id").toString());
|
||||
aid.setDivision_chairman_time(DateUtil.getDate());
|
||||
aid.setDivision_chairman_idea(idea);
|
||||
aid.setFunds_money(funds_money);
|
||||
if (Strings.isNotBlank(sign)) {
|
||||
aid.setDivision_chairman(sysSignatureService.insert(new Sys_signature(sign)).getId());
|
||||
}
|
||||
activityBxService.doEdit(aid);
|
||||
|
||||
String nodeName = "";
|
||||
if (flag) {
|
||||
nodeName = "校工会副主席审核";
|
||||
ReimbursementToDoHandler.CREATE_SCHOOL_CHAIRMAN_TASK.exec(id, null);
|
||||
} else {
|
||||
nodeName = "基层工会主席拒绝";
|
||||
ReimbursementToDoHandler.REFUSE_UNION_TASK.exec(id, new NutMap().addv("option", nodeName));
|
||||
}
|
||||
ReimbursementToDoHandler.COMPLETE_UNION_TASK.exec(id, new NutMap().addv("option", nodeName));
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,267 +0,0 @@
|
||||
package io.v.nutz.zhgh.jf.controller.Funds;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.sys.models.Sys_log;
|
||||
import io.v.nutz.sys.models.Sys_signature;
|
||||
import io.v.nutz.sys.services.SysSignatureService;
|
||||
import io.v.nutz.web.commons.slog.annotation.SLog;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.jf.model.*;
|
||||
import io.v.nutz.zhgh.jf.service.ActivityBxService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
|
||||
/**
|
||||
* @ClassName FundsFinanceController
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2024/10/29 10:25
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json")
|
||||
@At("/platform/jf/funds/finance")
|
||||
public class FundsFinanceController {
|
||||
@At("")
|
||||
@Ok("beetl:/platform/jf/Funds/fundsFinance.html")
|
||||
@RequiresPermissions("sys.jf.funds.finance")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@Inject
|
||||
private ActivityBxService activityBxService;
|
||||
@Inject
|
||||
private SysSignatureService sysSignatureService;
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("sys.jf.funds.finance")
|
||||
public Object pageData(PageForm page,
|
||||
@Param(value = "apply_type", required = false) Integer apply_type,
|
||||
@Param(value = "year", required = false) Integer year,
|
||||
@Param(value = "deductionInt", required = false) Integer deductionInt,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "unionId", required = false) String unionId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
act.*,
|
||||
u.loginname bxr_loginname,
|
||||
u.unionname bxr_unionname,
|
||||
u.unioncode,
|
||||
s.state_name,
|
||||
s.state_color,
|
||||
abs.`name` absName
|
||||
FROM
|
||||
`activity_bx` act
|
||||
LEFT JOIN `user` u ON act.user_id = u.id
|
||||
LEFT JOIN state s ON act.state_id = s.state_id
|
||||
LEFT JOIN activity_basic_settings abs ON abs.`code` = act.projectTypeCode
|
||||
$condition
|
||||
""");
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
cnd.and("act.state_id", "=", 1060);
|
||||
|
||||
cnd.and("act.apply_type", "=", "1");
|
||||
Vi.cndPlus(cnd, "act.year", "=", year);
|
||||
if (Vi.isNotBlank(page.getSearchName(), page.getSearchKeyword())) {
|
||||
cnd.where().andLike(page.getSearchName(), page.getSearchKeyword());
|
||||
}
|
||||
|
||||
if (Vi.isNotBlank(page.getPageOrderName(), page.getPageOrderBy())) {
|
||||
cnd.orderBy(page.getPageOrderName(), page.getPageOrderBy());
|
||||
} else {
|
||||
cnd.asc("act.state_id").desc("act.apply_time");
|
||||
}
|
||||
if (deductionInt == 2) {
|
||||
cnd.and("act.isDeduction", "=", 1);
|
||||
} else if (deductionInt == 3) {
|
||||
cnd.and("act.isDeduction", "=", 0);
|
||||
}
|
||||
Vi.cndPlus(cnd, "u.unitid", "=", unitId);
|
||||
Vi.cndPlus(cnd, "u.unionid", "=", unionId);
|
||||
sql.setCondition(cnd);
|
||||
return activityBxService.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresPermissions("sys.jf.funds.finance")
|
||||
public Object getBalance(String unionId) {
|
||||
if (StrUtil.isBlank(unionId)) {
|
||||
unionId = Vi.getUnionId();
|
||||
}
|
||||
jf_yjgh yjgh = activityBxService.dao().fetch(jf_yjgh.class,
|
||||
Cnd.where("unionId", "=", unionId)
|
||||
.and("year", "=", DateUtil.getYear())
|
||||
.and("state", "=", 1));
|
||||
if (yjgh != null) {
|
||||
double balance = yjgh.getTotalQuota() - yjgh.getUsedQuota();
|
||||
BigDecimal bigDecimal = new BigDecimal(balance);
|
||||
double value = bigDecimal.setScale(2, RoundingMode.HALF_UP).doubleValue();
|
||||
return Result.success(value);
|
||||
}
|
||||
return Result.success(0f);
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresPermissions("sys.jf.funds.finance")
|
||||
public Object getSchoolBudget() {
|
||||
jf_school jfSchool = activityBxService.dao().fetch(jf_school.class, Cnd.where("year", "=", DateUtil.getYear()).and("state", "=", 1));
|
||||
if (jfSchool != null) {
|
||||
double balance = jfSchool.getTotalQuota() - jfSchool.getUsedQuota();
|
||||
BigDecimal bigDecimal = new BigDecimal(balance);
|
||||
double value = bigDecimal.setScale(2, RoundingMode.HALF_UP).doubleValue();
|
||||
return Result.success(value);
|
||||
}
|
||||
return Result.success(0f);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@RequiresPermissions("sys.jf.funds.finance")
|
||||
public Object getClubBudget(String clubId) {
|
||||
jf_club jf_club = activityBxService.dao().fetch(jf_club.class,
|
||||
Cnd.where("year", "=", DateUtil.getYear())
|
||||
.and("state", "=", 1)
|
||||
.and("club_id", "=", clubId));
|
||||
if (jf_club != null) {
|
||||
double balance = jf_club.getTotal_quota() - jf_club.getUsed_quota();
|
||||
BigDecimal bigDecimal = new BigDecimal(balance);
|
||||
double value = bigDecimal.setScale(2, RoundingMode.HALF_UP).doubleValue();
|
||||
return Result.success(value);
|
||||
}
|
||||
return Result.success(0f);
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("sys.jf.funds.finance")
|
||||
public Object doSubmit(String id, String idea, String sign) {
|
||||
Dao dao = activityBxService.dao();
|
||||
ActivityBx activityBx = activityBxService.fetch(id);
|
||||
activityBx.setUnion_cashier(dao.insert(new Sys_signature(sign)).getId());
|
||||
activityBx.setUnion_cashier_name(ShiroUtil.getUserId());
|
||||
activityBx.setUnion_cashier_time(DateUtil.getDate());
|
||||
activityBx.setUnion_cashier_idea(idea);
|
||||
activityBx.setIsDeduction(true);
|
||||
activityBxService.doEdit(activityBx);
|
||||
|
||||
if (activityBx.getActivity_type() == 40001) {
|
||||
jf_school jfSchool = dao.fetch(jf_school.class, Cnd.where("year", "=", DateUtil.getYear()).and("state", "=", 1));
|
||||
SchoolUse schoolUse = new SchoolUse();
|
||||
schoolUse.setReimbursementId(activityBx.getId());
|
||||
dao.insert(schoolUse);
|
||||
//往预算分配表减钱
|
||||
jfSchool.setUsedQuota(jfSchool.getUsedQuota() + activityBx.getFunds_money());
|
||||
dao.updateIgnoreNull(jfSchool);
|
||||
} else if (activityBx.getActivity_type() == 40002) {
|
||||
jf_yjgh yjgh = dao.fetch(jf_yjgh.class, Cnd.where("unionId", "=", activityBx.getFundsUnitId())
|
||||
.and("year", "=", DateUtil.getYear())
|
||||
.and("state", "=", 1));
|
||||
//往经费使用表中添加一条数据
|
||||
jf_use jf_use = new jf_use();
|
||||
jf_use.setAdjust_id(yjgh.getId());
|
||||
jf_use.setProject(activityBx.getActivity_name());
|
||||
jf_use.setAdjust_money(activityBx.getFunds_money());
|
||||
jf_use.setAdjust_reason(activityBx.getCause());
|
||||
jf_use.setAdjust_time(DateUtil.getDateTime());
|
||||
jf_use.setAdjust_person(ShiroUtil.getUserId());
|
||||
jf_use.setApply_id(activityBx.getId());
|
||||
jf_use.setActivitie_number(activityBx.getActivity_number());
|
||||
jf_use.setActivitie_time(activityBx.getStartPlannedDate() + "-" + activityBx.getEndPlannedDate());
|
||||
dao.insert(jf_use);
|
||||
//往预算分配表减钱
|
||||
yjgh.setUsedQuota(yjgh.getUsedQuota() + activityBx.getFunds_money());
|
||||
dao.updateIgnoreNull(yjgh);
|
||||
} else {
|
||||
jf_club jf_club = dao.fetch(jf_club.class, Cnd.where("year", "=", DateUtil.getYear())
|
||||
.and("state", "=", 1)
|
||||
.and("club_id", "=", activityBx.getFundsUnitId()));
|
||||
//往经费使用表中添加一条数据
|
||||
jf_use jf_use = new jf_use();
|
||||
jf_use.setAdjust_id(jf_club.getId());
|
||||
jf_use.setProject(activityBx.getActivity_name());
|
||||
jf_use.setAdjust_money(activityBx.getFunds_money());
|
||||
jf_use.setAdjust_reason(activityBx.getActivity_content());
|
||||
jf_use.setAdjust_time(DateUtil.getDateTime());
|
||||
jf_use.setAdjust_person(ShiroUtil.getUserId());
|
||||
jf_use.setApply_id(activityBx.getId());
|
||||
jf_use.setActivitie_number(activityBx.getActivity_number());
|
||||
jf_use.setActivitie_time(activityBx.getStartPlannedDate() + "-" + activityBx.getEndPlannedDate());
|
||||
dao.insert(jf_use);
|
||||
//往预算分配表减钱
|
||||
jf_club.setUsed_quota(jf_club.getUsed_quota() + activityBx.getFunds_money());
|
||||
dao.updateIgnoreNull(jf_club);
|
||||
}
|
||||
Sys_log log = new Sys_log();
|
||||
log.setLoginname(ShiroUtil.getPrincipalProperty("loginname").toString());
|
||||
log.setUsername(ShiroUtil.getPrincipalProperty("username").toString());
|
||||
log.setMsg("审核了一条记录" + activityBx.getFunds_money() + "_" + activityBx.getFundsUnitName());
|
||||
dao.insert(log);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SLog(tag = "工会报销", msg = "撤回了一条记录", param = true, result = true)
|
||||
@RequiresPermissions("sys.jf.funds.finance")
|
||||
public Object doRecall(String id) {
|
||||
Dao dao = activityBxService.dao();
|
||||
ActivityBx activityBx = activityBxService.fetch(id);
|
||||
activityBx.setUnion_cashier(null);
|
||||
activityBx.setUnion_cashier_name(null);
|
||||
activityBx.setUnion_cashier_time(null);
|
||||
activityBx.setUnion_cashier_idea(null);
|
||||
activityBx.setIsDeduction(false);
|
||||
activityBxService.doEdit(activityBx);
|
||||
|
||||
if (activityBx.getActivity_type() == 40001) {
|
||||
jf_school jfSchool = dao.fetch(jf_school.class, Cnd.where("year", "=", DateUtil.getYear())
|
||||
.and("state", "=", 1));
|
||||
jfSchool.setUsedQuota(jfSchool.getUsedQuota() - activityBx.getFunds_money());
|
||||
dao.updateIgnoreNull(jfSchool);
|
||||
dao.clear(SchoolUse.class, Cnd.where("reimbursementId", "=", activityBx.getId()));
|
||||
|
||||
} else if (activityBx.getActivity_type() == 40002) {
|
||||
jf_yjgh yjgh = dao.fetch(jf_yjgh.class, Cnd.where("unionId", "=", activityBx.getFundsUnitId())
|
||||
.and("year", "=", DateUtil.getYear()).and("state", "=", 1));
|
||||
yjgh.setUsedQuota(yjgh.getUsedQuota() - activityBx.getFunds_money());
|
||||
dao.updateIgnoreNull(yjgh);
|
||||
dao.clear(jf_use.class, Cnd.where("apply_id", "=", activityBx.getId()));
|
||||
|
||||
} else {
|
||||
jf_club jf_club = dao.fetch(jf_club.class, Cnd.where("year", "=", DateUtil.getYear())
|
||||
.and("state", "=", 1).and("club_id", "=", activityBx.getFundsUnitId()));
|
||||
jf_club.setUsed_quota(jf_club.getUsed_quota() - activityBx.getFunds_money());
|
||||
dao.updateIgnoreNull(jf_club);
|
||||
dao.clear(jf_use.class, Cnd.where("apply_id", "=", activityBx.getId()));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,15 +1,6 @@
|
||||
package io.v.nutz.zhgh.jf.controller.Funds;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.zhgh.jf.handler.reimbursement.ReimbursementToDoHandler;
|
||||
import io.v.nutz.zhgh.jf.model.ActivityBx;
|
||||
import io.v.nutz.zhgh.jf.service.ActivityBxService;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
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;
|
||||
@@ -25,40 +16,9 @@ import org.nutz.mvc.annotation.Ok;
|
||||
@At("/platform/jf/funds/reimbursement")
|
||||
public class FundsReimbursementController {
|
||||
|
||||
@Inject
|
||||
private ActivityBxService activityBxService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/jf/Funds/fundsReimbursement.html")
|
||||
@RequiresPermissions("sys.jf.funds.reimbursement")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("beetl:/mobile/funds/mineApply.html")
|
||||
@RequiresPermissions("sys.jf.funds.reimbursement")
|
||||
public void mobile() {
|
||||
}
|
||||
|
||||
@At("/mobileApplyInfo")
|
||||
@Ok("beetl:/mobile/funds/info.html")
|
||||
@RequiresPermissions("sys.jf.funds.reimbursement")
|
||||
public void mobileApplyInfo() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除申请记录
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("sys.jf.funds.reimbursement")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Object doDelete(String id) {
|
||||
activityBxService.delete(id);
|
||||
ReimbursementToDoHandler.DELETE_PROCESS_AND_TASK.exec(id, null);
|
||||
return activityBxService.delete(id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ import org.nutz.mvc.annotation.Ok;
|
||||
public class FundsReimbursementViewController {
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/jf/Funds/fundsReimbursementview.html")
|
||||
@Ok("beetl:/platform/jf/funds/fundsReimbursementview.html")
|
||||
@RequiresPermissions("sys.jf.funds.reimbursementview")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@@ -1,22 +1,20 @@
|
||||
package io.v.nutz.zhgh.jf.controller.activitybx;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.model.Goods;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.base.utils.MsgApi;
|
||||
import io.v.nutz.base.utils.Roles;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.sys.models.Sys_signature;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.sys.models.Sys_user_role;
|
||||
import io.v.nutz.sys.services.SysSignatureService;
|
||||
import io.v.nutz.web.commons.slog.annotation.SLog;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.jf.handler.reimbursement.ReimbursementToDoHandler;
|
||||
import io.v.nutz.zhgh.jf.handle.funds.FundsToHandler;
|
||||
import io.v.nutz.zhgh.jf.model.ActivityBx;
|
||||
import io.v.nutz.zhgh.jf.service.ActivityBxService;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
@@ -25,6 +23,7 @@ import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
@@ -51,6 +50,12 @@ public class AccountingCon {
|
||||
@Inject
|
||||
private ActivityBxService activityBxService;
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@Inject
|
||||
private MsgApi msgApi;
|
||||
|
||||
@Inject
|
||||
private SysSignatureService sysSignatureService;
|
||||
|
||||
@@ -64,19 +69,20 @@ public class AccountingCon {
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"sys.jf.activity_bx.accounting", "sys.jf.funds.accounting"}, logical = Logical.OR)
|
||||
public Object pageData(PageForm page,
|
||||
@Param(value = "apply_type", required = false) Integer apply_type,
|
||||
@Param(value = "year", required = false) Integer year,
|
||||
public Object pageData(@Param(value = "year", required = false) Integer year,
|
||||
@Param(value = "isAudit", required = false) Integer isAudit,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "unionId", required = false) String unionId) {
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "searchName", required = false) String searchName,
|
||||
@Param(value = "searchKeyword", required = false) String searchKeyword,
|
||||
@Param("pageNumber") int pageNumber, @Param("pageSize") int pageSize,
|
||||
@Param(value = "pageOrderName", required = false) String pageOrderName,
|
||||
@Param(value = "pageOrderBy", required = false) String pageOrderBy) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
act.*,
|
||||
u.loginname bxr_loginname,
|
||||
u.unionname bxr_unionname,
|
||||
u.unioncode,
|
||||
s.state_name,
|
||||
s.state_color,
|
||||
abs.`name` absName
|
||||
@@ -84,61 +90,77 @@ public class AccountingCon {
|
||||
`activity_bx` act
|
||||
LEFT JOIN `user` u ON act.user_id = u.id
|
||||
LEFT JOIN state s ON act.state_id = s.state_id
|
||||
LEFT JOIN activity_basic_settings abs ON abs.`code` = act.projectTypeCode
|
||||
LEFT JOIN activity_basic_settings abs ON abs.`code` = act.projectJfCode
|
||||
$condition
|
||||
""");
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
if (isAudit == 1) {
|
||||
cnd.and("act.state_id", ">=", 1030);
|
||||
cnd.and("act.state_id", ">=", 1020);
|
||||
} else {
|
||||
cnd.and("act.state_id", isAudit == 2 ? ">" : "=", 1030);
|
||||
cnd.and("act.state_id", isAudit == 2 ? ">" : "=", 1020);
|
||||
}
|
||||
if (ShiroUtil.hasRole("xghng")) {
|
||||
cnd.and("act.projectTypeCode", "=", 50002);
|
||||
}
|
||||
|
||||
cnd.and("act.apply_type", "=", apply_type);
|
||||
|
||||
Vi.cndPlus(cnd, "act.year", "=", year);
|
||||
if (Vi.isNotBlank(page.getSearchName(), page.getSearchKeyword())) {
|
||||
cnd.where().andLike(page.getSearchName(), page.getSearchKeyword());
|
||||
if (Vi.isNotBlank(searchName, searchKeyword)) {
|
||||
cnd.where().andLike(searchName, searchKeyword);
|
||||
}
|
||||
|
||||
if (Vi.isNotBlank(page.getPageOrderName(), page.getPageOrderBy())) {
|
||||
cnd.orderBy(page.getPageOrderName(), page.getPageOrderBy());
|
||||
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.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
return activityBxService.listPageMap(pageNumber, pageSize, sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getGoods(String activity_id) {
|
||||
return baseService.dao().query(Goods.class, Cnd.where("reid", "=", activity_id));
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions(value = {"sys.jf.activity_bx.accounting", "sys.jf.funds.accounting"}, logical = Logical.OR)
|
||||
@SLog(tag = "活动经费校工会副主席审核")
|
||||
public Object doReview(@Param(value = "id", required = false) String id,
|
||||
@Param(value = "idea", required = false) String idea,
|
||||
@Param(value = "sign", required = false) String sign,
|
||||
@Param(value = "flag", required = false) Boolean flag) {
|
||||
ActivityBx aid = activityBxService.fetch(id);
|
||||
aid.setState_id(flag ? "1060" : "1035");
|
||||
aid.setAccounting_name(ShiroUtil.getUserId());
|
||||
public Object doReview(String data) {
|
||||
NutMap nutMap = Json.fromJson(NutMap.class, data);
|
||||
ActivityBx aid = activityBxService.fetch(nutMap.getString("id"));
|
||||
aid.setState_id(nutMap.getBoolean("flag") ? "1040" : "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());
|
||||
aid.setAccounting_idea(nutMap.getString("idea"));
|
||||
|
||||
if (Strings.isNotBlank(nutMap.getString("sign"))) {
|
||||
aid.setAccounting(sysSignatureService.insert(new Sys_signature(nutMap.getString("sign"))).getId());
|
||||
}
|
||||
activityBxService.update(aid);
|
||||
|
||||
String nodeName = "";
|
||||
if (flag) {
|
||||
ReimbursementToDoHandler.COMPLETE_PROCESS.exec(aid.getId(), null);
|
||||
if (nutMap.getBoolean("flag")) {
|
||||
nodeName = "校工会主席审核";
|
||||
Sys_user_role sys_user_role = activityBxService.dao().fetch(Sys_user_role.class, Cnd.where("roleId", "=", Roles.GH_WYH_ZX));
|
||||
if (Lang.isNotEmpty(sys_user_role)) {
|
||||
Sys_user user = activityBxService.dao().fetch(Sys_user.class, sys_user_role.getUserId());
|
||||
msgApi.sendWxMsg("活动申报", "", "text", aid.getUser_name() + "申报了一条活动【" + aid.getActivity_name() + "】,请前往智慧工会进行审核。", List.of(user.getLoginname()), null);
|
||||
FundsToHandler.CREATE_SCHOOL_TASK.exec(aid.getId(), null, List.of(user.getLoginname()));
|
||||
}
|
||||
} else {
|
||||
nodeName = "校工会副主席拒绝";
|
||||
ReimbursementToDoHandler.REFUSE_UNION_TASK.exec(id, new NutMap().addv("option", nodeName));
|
||||
nodeName = "校工会负责人拒绝";
|
||||
Sys_user user = activityBxService.dao().fetch(Sys_user.class, aid.getUser_id());
|
||||
msgApi.sendWxMsg("活动申报", "", "text", "您申报的活动【" + aid.getActivity_name() + "】被校工会负责人拒绝,审核意见:" + aid.getAccounting_idea(), List.of(user.getLoginname()), null);
|
||||
FundsToHandler.REFUSE_TASK.exec(aid.getId(), new NutMap().addv("option", nodeName), null);
|
||||
}
|
||||
FundsToHandler.COMPLETE_SCHOOL_FZR_TASK.exec(aid.getId(), new NutMap().addv("option", nodeName), null);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+23
-22
@@ -28,6 +28,13 @@ import java.util.List;
|
||||
@At("/platform/activitybx/agent")
|
||||
public class ActivitybxAgentController {
|
||||
|
||||
@Inject
|
||||
private Vi vi;
|
||||
|
||||
|
||||
@Inject
|
||||
private ActivityBxService activityBxService;
|
||||
|
||||
//协会
|
||||
private static final String ASSOCIATION = "/platform/jf/activity_bx/association";
|
||||
//基层工会
|
||||
@@ -39,43 +46,37 @@ public class ActivitybxAgentController {
|
||||
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", "【活动报销系统】"));
|
||||
result.add(new NutMap().setv("url", ASSOCIATION).setv("iconClass", vi.getIconByPath(ASSOCIATION)).setv("label", "活动报销协会负责人审核").setv("number", getAssociationCount()));
|
||||
result.add(new NutMap().setv("url", DIVISION).setv("iconClass", vi.getIconByPath(DIVISION)).setv("label", "活动报销待基层工会审核").setv("number", getDivisionCount()));
|
||||
result.add(new NutMap().setv("url", ACCOUNTING).setv("iconClass", vi.getIconByPath(ACCOUNTING)).setv("label", "活动报销待负责人审核").setv("number", getAccountingCount()));
|
||||
result.add(new NutMap().setv("url", CONFIRM).setv("iconClass", vi.getIconByPath(CONFIRM)).setv("label", "活动报销待校工会副主席审核").setv("number", getConfirmCount()));
|
||||
result.add(new NutMap().setv("url", UNION).setv("iconClass", vi.getIconByPath(UNION)).setv("label", "活动报销待校工会主席审核").setv("number", getUnionCount()));
|
||||
result.add(new NutMap().setv("url", CASHIER).setv("iconClass", vi.getIconByPath(CASHIER)).setv("label", "活动报销待校工会出纳审核").setv("number", getCashierCount()));
|
||||
} else {
|
||||
if (ShiroUtil.hasAnyRoles("club01")) {
|
||||
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("H02")) {
|
||||
result.add(new NutMap().setv("url", DIVISION).setv("iconClass", vi.getIconByPath(DIVISION)).setv("label", "活动报销待基层工会审核").setv("number", getDivisionCount()));
|
||||
}
|
||||
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", "【活动报销系统】"));
|
||||
result.add(new NutMap().setv("url", DIVISION).setv("iconClass", vi.getIconByPath(DIVISION)).setv("label", "活动报销待基层工会审核").setv("number", getDivisionCount()));
|
||||
}
|
||||
if (ShiroUtil.hasAnyRoles("SchoolUnionAccountant")) {
|
||||
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("H10,xghng")) {
|
||||
result.add(new NutMap().setv("url", ACCOUNTING).setv("iconClass", vi.getIconByPath(ACCOUNTING)).setv("label", "活动报销待负责人审核").setv("number", getAccountingCount()));
|
||||
}
|
||||
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", "【活动报销系统】"));
|
||||
result.add(new NutMap().setv("url", CONFIRM).setv("iconClass", vi.getIconByPath(CONFIRM)).setv("label", "活动报销待校工会副主席审核").setv("number", getConfirmCount()));
|
||||
}
|
||||
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", "【活动报销系统】"));
|
||||
result.add(new NutMap().setv("url", UNION).setv("iconClass", vi.getIconByPath(UNION)).setv("label", "活动报销待校工会审核").setv("number", getUnionCount()));
|
||||
}
|
||||
if (ShiroUtil.hasAnyRoles("SchoolUnionCashier")) {
|
||||
result.add(new NutMap().setv("title", title).setv("url", CASHIER).setv("iconClass", vi.getIconByPath(CASHIER)).setv("label", "待校工会出纳审核").setv("number", getCashierCount()).setv("title", "【活动报销系统】"));
|
||||
if (ShiroUtil.hasAnyRoles("xghcn")) {
|
||||
result.add(new NutMap().setv("url", CASHIER).setv("iconClass", vi.getIconByPath(CASHIER)).setv("label", "活动报销待校工会出纳审核").setv("number", getCashierCount()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,34 +1,48 @@
|
||||
package io.v.nutz.zhgh.jf.controller.activitybx;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import cn.wizzer.framework.base.service.BaseService;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.base.utils.MsgApi;
|
||||
import io.v.nutz.base.utils.Roles;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.sys.models.Sys_signature;
|
||||
import io.v.nutz.sys.services.SysSignatureService;
|
||||
import io.v.nutz.web.commons.slog.annotation.SLog;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.jf.handler.reimbursement.ReimbursementToDoHandler;
|
||||
import io.v.nutz.zhgh.jf.handle.funds.FundsToHandler;
|
||||
import io.v.nutz.zhgh.jf.model.ActivityBx;
|
||||
import io.v.nutz.zhgh.jf.service.ActivityBxService;
|
||||
import io.v.nutz.sys.models.Sys_signature;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.sys.models.Sys_user_role;
|
||||
import io.v.nutz.sys.services.SysSignatureService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
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.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:xsb
|
||||
* @Description: 活动报销申请
|
||||
* @Date:Created in 14:57 2021/1/19
|
||||
*
|
||||
* 活动申报,申请
|
||||
* 校工会活动——>校工会负责人(姜学军)审核——>校工会主席审核——>流程结束
|
||||
* 基层工会活动——>基层工会主席审核——>校工会负责人(姜学军)审核——>校工会主席审核——>流程结束
|
||||
* 协会活动——>协会负责人审核——>校工会负责人(姜学军)审核——>校工会主席审核——>流程结束
|
||||
*/
|
||||
|
||||
@IocBean
|
||||
@@ -48,58 +62,172 @@ public class ApplyController {
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
@Inject
|
||||
private MsgApi msgApi;
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/jf/activitybx/apply.html")
|
||||
@RequiresPermissions(value = {"sys.jf.Funds.apply","sys.jf.activity_bx.apply"},logical = Logical.OR)
|
||||
@RequiresPermissions("sys.jf.activity_bx.apply")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("beetl:/mobile/funds/apply.html")
|
||||
@RequiresPermissions(value = {"sys.jf.Funds.apply","sys.jf.activity_bx.apply"},logical = Logical.OR)
|
||||
public void mobile(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SLog(tag = "活动报销申请", msg = "添加")
|
||||
@RequiresPermissions(value = {"sys.jf.Funds.apply","sys.jf.activity_bx.apply"},logical = Logical.OR)
|
||||
@RequiresPermissions(value = {"sys.jf.Funds.apply","sys.jf.Funds.apply2","sys.jf.reimbursement.apply","sys.jf.activity_bx.apply"},logical = Logical.OR)
|
||||
public Object doSave(@Param("activityBx") ActivityBx activityBx, @Param("sign") String sign) {
|
||||
activityBx.setState_id("999");
|
||||
activityBx.setYear(activityBx.getYear() != null ? activityBx.getYear() : DateUtil.getYear());
|
||||
activityBx.setApply_time(StrUtil.isNotBlank(activityBx.getApply_time()) ? activityBx.getApply_time() : DateUtil.getDateTime());
|
||||
activityBx.setUser_id(StrUtil.isNotBlank(activityBx.getUser_id()) ? activityBx.getUser_id() : ShiroUtil.getUserId());
|
||||
if (Strings.isNotBlank(sign)) {
|
||||
activityBx.setUser_signature(sysSignatureService.insert(new Sys_signature(sign)).getId());
|
||||
}
|
||||
if (StrUtil.isNotBlank(activityBx.getId())) {
|
||||
activityBxService.update(activityBx);
|
||||
} else {
|
||||
activityBxService.doAdd(activityBx);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions(value = {"sys.jf.Funds.apply","sys.jf.Funds.apply2","sys.jf.reimbursement.apply","sys.jf.activity_bx.apply"},logical = Logical.OR)
|
||||
public Object doAdd(@Param("activityBx") ActivityBx activityBx, @Param("sign") String sign) {
|
||||
activityBx.setYear(Calendar.getInstance().get(Calendar.YEAR));
|
||||
if (activityBx.getActivity_type().equals(40001)) {
|
||||
activityBx.setState_id("1030");
|
||||
} else if (activityBx.getActivity_type().equals(40003)) {
|
||||
List<String> loginNames = new ArrayList<>();
|
||||
activityBx.setYear(activityBx.getYear() != null ? activityBx.getYear() : DateUtil.getYear());
|
||||
if (activityBx.getActivity_type() == 40001) {
|
||||
// 校工会活动
|
||||
activityBx.setState_id("1020");
|
||||
loginNames.add("1019911404");
|
||||
} else if (activityBx.getActivity_type() == 40002) {
|
||||
// 分工会活动
|
||||
activityBx.setState_id("1010");
|
||||
Sys_user_role sys_user_role = activityBxService.dao().fetch(Sys_user_role.class, Cnd.where("roleId", "=", Roles.GH01).and("unionid", "=", Vi.getUnionId()));
|
||||
if (Lang.isNotEmpty(sys_user_role)) {
|
||||
Sys_user user = activityBxService.dao().fetch(Sys_user.class, sys_user_role.getUserId());
|
||||
loginNames.add(user.getLoginname());
|
||||
}
|
||||
} else if (activityBx.getActivity_type() == 40003) {
|
||||
// 协会活动
|
||||
Sys_user_role sys_user_role = activityBxService.dao().fetch(Sys_user_role.class, Cnd.where("roleId", "=", Roles.club01).and("stid", "=", activityBx.getClubId()));
|
||||
if (Lang.isNotEmpty(sys_user_role)) {
|
||||
Sys_user user = activityBxService.dao().fetch(Sys_user.class, sys_user_role.getUserId());
|
||||
loginNames.add(user.getLoginname());
|
||||
}
|
||||
activityBx.setState_id("1000");
|
||||
} else {
|
||||
activityBx.setState_id("1010");
|
||||
}
|
||||
activityBx.setApply_time(DateUtil.getDate());
|
||||
activityBx.setUser_id(ShiroUtil.getUserId());
|
||||
activityBx.setApply_time(StrUtil.isNotBlank(activityBx.getApply_time()) ? activityBx.getApply_time() : DateUtil.getDateTime());
|
||||
activityBx.setUser_id(StrUtil.isNotBlank(activityBx.getUser_id()) ? activityBx.getUser_id() : ShiroUtil.getUserId());
|
||||
if (Strings.isNotBlank(sign)) {
|
||||
activityBx.setUser_signature(sysSignatureService.insert(new Sys_signature(sign)).getId());
|
||||
}
|
||||
activityBxService.doAdd(activityBx);
|
||||
if (Lang.isNotEmpty(loginNames)) {
|
||||
// msgApi.sendWxMsg("活动申报", "", "text", activityBx.getUser_name() + "申请了一条活动申报【" + activityBx.getActivity_name() + "】,请前往智慧工会进行审核。", loginNames, null);
|
||||
|
||||
NutMap map = new NutMap();
|
||||
map.setv("userId",activityBx.getUser_id());
|
||||
map.setv("activityName",activityBx.getActivity_name());
|
||||
FundsToHandler.START_PROCESS.exec(activityBx.getId(),map,loginNames);
|
||||
|
||||
if (activityBx.getActivity_type() == 40001) {
|
||||
FundsToHandler.CREATE_SCHOOL_FZR_TASK.exec(activityBx.getId(),map,loginNames);
|
||||
} else if (activityBx.getActivity_type() == 40002) {
|
||||
FundsToHandler.CREATE_UNION_TASK.exec(activityBx.getId(),map,loginNames);
|
||||
} else if (activityBx.getActivity_type() == 40003) {
|
||||
FundsToHandler.CREATE_CLUB_TASK.exec(activityBx.getId(),map,loginNames);
|
||||
}
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions(value = {"sys.jf.Funds.apply","sys.jf.Funds.apply2","sys.jf.reimbursement.apply","sys.jf.activity_bx.apply"},logical = Logical.OR)
|
||||
public Object doEdit(@Param("activityBx") ActivityBx activityBx, @Param("sign") String sign) {
|
||||
List<String> loginNames = new ArrayList<>();
|
||||
ActivityBx oldActivity = activityBxService.dao().fetch(ActivityBx.class, activityBx.getId());
|
||||
activityBx.setYear(Calendar.getInstance().get(Calendar.YEAR));
|
||||
if (activityBx.getActivity_type() == 40001) {
|
||||
activityBx.setState_id("1020");
|
||||
loginNames.add("1019911404");
|
||||
} else if (activityBx.getActivity_type() == 40002) {
|
||||
activityBx.setState_id("1010");
|
||||
Sys_user_role sys_user_role = activityBxService.dao().fetch(Sys_user_role.class, Cnd.where("roleId", "=", Roles.GH01).and("unionid", "=", Vi.getUnionId()));
|
||||
if (Lang.isNotEmpty(sys_user_role)) {
|
||||
Sys_user user = activityBxService.dao().fetch(Sys_user.class, sys_user_role.getUserId());
|
||||
loginNames.add(user.getLoginname());
|
||||
}
|
||||
} else if (activityBx.getActivity_type() == 40003) {
|
||||
activityBx.setState_id("1000");
|
||||
// 协会活动
|
||||
Sys_user_role sys_user_role = activityBxService.dao().fetch(Sys_user_role.class, Cnd.where("roleId", "=", Roles.club01).and("stid", "=", activityBx.getClubId()));
|
||||
if (Lang.isNotEmpty(sys_user_role)) {
|
||||
Sys_user user = activityBxService.dao().fetch(Sys_user.class, sys_user_role.getUserId());
|
||||
loginNames.add(user.getLoginname());
|
||||
}
|
||||
} else {
|
||||
activityBx.setState_id("1010");
|
||||
}
|
||||
activityBx.setApply_time(DateUtil.getDateTime());
|
||||
activityBx.setUser_id(ShiroUtil.getPrincipalProperty("id").toString());
|
||||
if (Strings.isNotBlank(sign)) {
|
||||
activityBx.setUser_signature(sysSignatureService.insert(new Sys_signature(sign)).getId());
|
||||
}
|
||||
|
||||
if ("1025".equals(oldActivity.getState_id()) || "1045".equals(oldActivity.getState_id()) ) {
|
||||
activityBx.setState_id("1025".equals(oldActivity.getState_id()) ? "1020" : "1040");
|
||||
}
|
||||
activityBxService.doEdit(activityBx);
|
||||
|
||||
NutMap map = new NutMap();
|
||||
map.put("userId",ShiroUtil.getUserId());
|
||||
ReimbursementToDoHandler.START_PROCESS.exec(activityBx.getId(), map);
|
||||
if (activityBx.getActivity_type() == 40001) {
|
||||
//校工会申请,校工会负责人审核
|
||||
ReimbursementToDoHandler.CREATE_SCHOOL_CHAIRMAN_TASK.exec(activityBx.getId(), map);
|
||||
} else if (activityBx.getActivity_type() == 40002) {
|
||||
//分工会
|
||||
ReimbursementToDoHandler.CREATE_UNION_TASK.exec(activityBx.getId(),map);
|
||||
} else if (activityBx.getActivity_type() == 40003) {
|
||||
//协会
|
||||
ReimbursementToDoHandler.CREATE_CLUB_TASK.exec(activityBx.getId(),map);
|
||||
map.setv("userId",activityBx.getUser_id());
|
||||
map.setv("activityName",activityBx.getActivity_name());
|
||||
FundsToHandler.START_PROCESS.exec(activityBx.getId(),map,loginNames);
|
||||
|
||||
if ("999".equals(activityBx.getState_id())) {
|
||||
|
||||
if (activityBx.getActivity_type() == 40001) {
|
||||
FundsToHandler.CREATE_SCHOOL_FZR_TASK.exec(activityBx.getId(),NutMap.NEW().addv("userId",ShiroUtil.getUserId()),loginNames);
|
||||
} else if (activityBx.getActivity_type() == 40002) {
|
||||
FundsToHandler.CREATE_UNION_TASK.exec(activityBx.getId(),NutMap.NEW().addv("userId",ShiroUtil.getUserId()),List.of("1019971597"));
|
||||
} else if (activityBx.getActivity_type() == 40003) {
|
||||
FundsToHandler.CREATE_CLUB_TASK.exec(activityBx.getId(),NutMap.NEW().addv("userId",ShiroUtil.getUserId()),loginNames);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@RequiresPermissions(value = {"sys.jf.Funds.apply","sys.jf.Funds.apply2","sys.jf.reimbursement.apply","sys.jf.activity_bx.apply"},logical = Logical.OR)
|
||||
public Object checkActivity(String activityName, String activityType) {
|
||||
List<String> list = new ArrayList<>();
|
||||
list.add("999");
|
||||
switch (activityType) {
|
||||
case "40001": list.add("1020");
|
||||
case "40002": list.add("1010");
|
||||
case "40003": list.add("1000");
|
||||
}
|
||||
|
||||
ActivityBx activityBx = baseService.dao().fetch(ActivityBx.class, Cnd.where("activity_name", "=", activityName)
|
||||
.and("user_id", "=", ShiroUtil.getUserId()).and("activity_type", "=", activityType)
|
||||
.and("state_id", "in", list).desc("apply_time"));
|
||||
if (Lang.isNotEmpty(activityBx)) {
|
||||
return Result.success().addData(activityBx);
|
||||
} else {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
package io.v.nutz.zhgh.jf.controller.activitybx;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.base.utils.MsgApi;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.sys.models.Sys_signature;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.sys.services.SysSignatureService;
|
||||
import io.v.nutz.web.commons.slog.annotation.SLog;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.jf.handler.reimbursement.ReimbursementToDoHandler;
|
||||
import io.v.nutz.zhgh.jf.handle.funds.FundsToHandler;
|
||||
import io.v.nutz.zhgh.jf.model.ActivityBx;
|
||||
import io.v.nutz.zhgh.jf.service.ActivityBxService;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
@@ -46,7 +46,8 @@ public class AssociationCon {
|
||||
|
||||
@Inject
|
||||
private SysSignatureService sysSignatureService;
|
||||
|
||||
@Inject
|
||||
private MsgApi msgApi;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/jf/activitybx/association.html")
|
||||
@@ -57,12 +58,15 @@ public class AssociationCon {
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"sys.jf.funds.association", "sys.jf.activity_bx.association"}, logical = Logical.OR)
|
||||
public Object pageData(PageForm page,
|
||||
@Param(value = "apply_type", required = false) Integer apply_type,
|
||||
@Param(value = "year", required = false) Integer year, Integer isAudit,
|
||||
public Object pageData(@Param(value = "year", required = false) Integer year,
|
||||
@Param(value = "isAudit", required = false) Integer isAudit,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "unionId", required = false) String unionId) {
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "searchName", required = false) String searchName,
|
||||
@Param(value = "searchKeyword", required = false) String searchKeyword,
|
||||
@Param("pageNumber") int pageNumber, @Param("pageSize") int pageSize,
|
||||
@Param(value = "pageOrderName", required = false) String pageOrderName,
|
||||
@Param(value = "pageOrderBy", required = false) String pageOrderBy) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
act.*,
|
||||
@@ -70,15 +74,13 @@ public class AssociationCon {
|
||||
u.unionname bxr_unionname,
|
||||
s.state_name,
|
||||
s.state_color,
|
||||
cl.fzr,
|
||||
abs.`name` absName
|
||||
FROM
|
||||
`activity_bx` act
|
||||
LEFT JOIN `user` u ON act.user_id = u.id
|
||||
LEFT JOIN sys_unit un ON u.unitid = un.id
|
||||
LEFT JOIN sys_club cl ON cl.fzr=u.id
|
||||
LEFT JOIN state s ON act.state_id = s.state_id
|
||||
LEFT JOIN activity_basic_settings abs ON abs.`code` = act.projectTypeCode
|
||||
LEFT JOIN activity_basic_settings abs ON abs.`code` = act.projectJfCode
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
@@ -88,54 +90,57 @@ public class AssociationCon {
|
||||
} else {
|
||||
cnd.and("act.state_id", isAudit == 2 ? ">" : "=", 1000);
|
||||
}
|
||||
cnd.and("act.apply_type", "=", apply_type);
|
||||
|
||||
cnd.and("act.activity_type", "=", 40003);
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin")) {
|
||||
cnd.and("cl.fzr", "=", ShiroUtil.getPrincipalProperty("id"));
|
||||
cnd.and("act.clubId", "in", vi.getMangeClubStr());
|
||||
}
|
||||
Vi.cndPlus(cnd, "act.year", "=", year);
|
||||
if (Vi.isNotBlank(page.getSearchName(), page.getSearchKeyword())) {
|
||||
cnd.where().andLike(page.getSearchName(), page.getSearchKeyword());
|
||||
if (Vi.isNotBlank(searchName, searchKeyword)) {
|
||||
cnd.where().andLike(searchName, searchKeyword);
|
||||
}
|
||||
|
||||
if (Vi.isNotBlank(page.getPageOrderName(), page.getPageOrderBy())) {
|
||||
cnd.orderBy(page.getPageOrderName(), page.getPageOrderBy());
|
||||
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.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
return activityBxService.listPageMap(pageNumber, pageSize, sql);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"sys.jf.funds.association", "sys.jf.activity_bx.association"}, logical = Logical.OR)
|
||||
@SLog(tag = "活动报销协会审核", msg = "审核")
|
||||
public Object doReview(String id, String idea, String sign, double funds_money, Boolean flag) {
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Object doReview(@Param(value = "id", required = false) String id,
|
||||
@Param(value = "idea", required = false) String idea,
|
||||
@Param(value = "sign", required = false) String sign,
|
||||
@Param(value = "flag", required = false) Boolean flag) {
|
||||
ActivityBx aid = activityBxService.fetch(id);
|
||||
aid.setState_id(flag ? "1030" : "1005");
|
||||
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);
|
||||
aid.setFunds_money(funds_money);
|
||||
if (Strings.isNotBlank(sign)) {
|
||||
aid.setAssociation_principalSign_id(sysSignatureService.insert(new Sys_signature(sign)).getId());
|
||||
}
|
||||
activityBxService.doEdit(aid);
|
||||
activityBxService.update(aid);
|
||||
|
||||
String nodeName = "";
|
||||
if (flag) {
|
||||
ReimbursementToDoHandler.CREATE_SCHOOL_CHAIRMAN_TASK.exec(id, new NutMap().addv("userId", aid.getUser_id()));
|
||||
nodeName = "校工会副主席审核";
|
||||
msgApi.sendWxMsg("活动申报", "", "text", aid.getUser_name() + "申报了一条活动【" + aid.getActivity_name() + "】,请前往智慧工会进行审核。", List.of("1019911404"), null);
|
||||
FundsToHandler.CREATE_SCHOOL_FZR_TASK.exec(id, new NutMap().addv("userId", aid.getUser_id()), List.of("1019911404"));
|
||||
nodeName = "校工会负责人审核";
|
||||
} else {
|
||||
Sys_user user = activityBxService.dao().fetch(Sys_user.class, aid.getUser_id());
|
||||
msgApi.sendWxMsg("活动申报", "", "text", "您申报的活动【" + aid.getActivity_name() + "】被协会拒绝,审核意见:" + aid.getAssociation_principal_idea(), List.of(user.getLoginname()), null);
|
||||
nodeName = "协会审核拒绝";
|
||||
ReimbursementToDoHandler.REFUSE_UNION_TASK.exec(id, new NutMap().addv("option", nodeName));
|
||||
FundsToHandler.REFUSE_TASK.exec(id, new NutMap().addv("option", nodeName), null);
|
||||
}
|
||||
ReimbursementToDoHandler.COMPLETE_CLUB_TASK.exec(id, new NutMap().addv("option", nodeName));
|
||||
FundsToHandler.COMPLETE_CLUB_TASK.exec(id, new NutMap().addv("option", nodeName), null);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ public class CashierCon {
|
||||
private SysSignatureService sysSignatureService;
|
||||
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/jf/activitybx/cashier.html")
|
||||
@RequiresPermissions("sys.jf.activity_bx.cashier")
|
||||
@@ -48,19 +49,21 @@ public class CashierCon {
|
||||
|
||||
@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) {
|
||||
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" +
|
||||
"\ts.state_color , " +
|
||||
"abs.`name` absName\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");
|
||||
"\tLEFT JOIN state s ON act.state_id = s.state_id " +
|
||||
"LEFT JOIN activity_basic_settings abs ON abs.`code` = bx.projectTypeCode" +
|
||||
"$condition");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
if (isAudit == 1) {
|
||||
@@ -70,6 +73,7 @@ public class CashierCon {
|
||||
}
|
||||
|
||||
|
||||
|
||||
Vi.cndPlus(cnd, "act.year", "=", year);
|
||||
if (Vi.isNotBlank(searchName, searchKeyword)) {
|
||||
cnd.where().andLike(searchName, searchKeyword);
|
||||
|
||||
@@ -46,21 +46,25 @@ public class ConfirmCon {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@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) {
|
||||
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" +
|
||||
"\ts.state_color , " +
|
||||
"abs.`name` absName\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");
|
||||
"\tLEFT JOIN state s ON act.state_id = s.state_id " +
|
||||
"LEFT JOIN activity_basic_settings abs ON abs.`code` = bx.projectTypeCode" +
|
||||
"$condition");
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
|
||||
@@ -2,23 +2,26 @@ package io.v.nutz.zhgh.jf.controller.activitybx;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.base.utils.MsgApi;
|
||||
import io.v.nutz.base.utils.Roles;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.web.commons.slog.annotation.SLog;
|
||||
import io.v.nutz.zhgh.jf.handler.reimbursement.ReimbursementToDoHandler;
|
||||
import io.v.nutz.zhgh.jf.model.ActivityBx;
|
||||
import io.v.nutz.zhgh.jf.service.ActivityBxService;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.sys.models.Sys_signature;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.sys.models.Sys_user_role;
|
||||
import io.v.nutz.sys.services.SysSignatureService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import io.v.nutz.zhgh.jf.handle.funds.FundsToHandler;
|
||||
import io.v.nutz.zhgh.jf.model.ActivityBx;
|
||||
import io.v.nutz.zhgh.jf.service.ActivityBxService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
@@ -41,6 +44,9 @@ public class DivisionCon {
|
||||
@Inject
|
||||
private Vi vi;
|
||||
|
||||
@Inject
|
||||
private MsgApi msgApi;
|
||||
|
||||
@Inject
|
||||
private ActivityBxService activityBxService;
|
||||
|
||||
@@ -56,19 +62,20 @@ public class DivisionCon {
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"sys.jf.activity_bx.division", "sys.jf.funds.division"}, logical = Logical.OR)
|
||||
public Object pageData(PageForm page,
|
||||
@Param(value = "apply_type", required = false) Integer apply_type,
|
||||
@Param(value = "year", required = false) Integer year,
|
||||
public Object pageData(@Param(value = "year", required = false) Integer year,
|
||||
@Param(value = "isAudit", required = false) Integer isAudit,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "unionId", required = false) String unionId) {
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "searchName", required = false) String searchName,
|
||||
@Param(value = "searchKeyword", required = false) String searchKeyword,
|
||||
@Param("pageNumber") int pageNumber, @Param("pageSize") int pageSize,
|
||||
@Param(value = "pageOrderName", required = false) String pageOrderName,
|
||||
@Param(value = "pageOrderBy", required = false) String pageOrderBy) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
act.*,
|
||||
u.loginname bxr_loginname,
|
||||
u.unionname bxr_unionname,
|
||||
u.unioncode,
|
||||
s.state_name,
|
||||
s.state_color,
|
||||
abs.`name` absName
|
||||
@@ -78,7 +85,7 @@ public class DivisionCon {
|
||||
LEFT JOIN sys_unit su ON su.id = u.unitid
|
||||
LEFT JOIN sys_union un ON su.unionid = un.id
|
||||
LEFT JOIN state s ON act.state_id = s.state_id
|
||||
LEFT JOIN activity_basic_settings abs ON abs.`code` = act.projectTypeCode
|
||||
LEFT JOIN activity_basic_settings abs ON abs.`code` = act.projectJfCode
|
||||
$condition
|
||||
""");
|
||||
|
||||
@@ -90,53 +97,61 @@ public class DivisionCon {
|
||||
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());
|
||||
}
|
||||
}
|
||||
cnd.and("act.apply_type", "=", apply_type);
|
||||
Vi.cndPlus(cnd, "act.year", "=", year);
|
||||
if (Vi.isNotBlank(page.getSearchName(), page.getSearchKeyword())) {
|
||||
cnd.where().andLike(page.getSearchName(), page.getSearchKeyword());
|
||||
if (Vi.isNotBlank(searchName, searchKeyword)) {
|
||||
cnd.where().andLike(searchName, searchKeyword);
|
||||
}
|
||||
|
||||
if (Vi.isNotBlank(page.getPageOrderName(), page.getPageOrderBy())) {
|
||||
cnd.orderBy(page.getPageOrderName(), page.getPageOrderBy());
|
||||
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.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
return activityBxService.listPageMap(pageNumber, pageSize, sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"sys.jf.activity_bx.division", "sys.jf.funds.division"}, logical = Logical.OR)
|
||||
@SLog(tag = "活动报销分工会主席审核", msg = "审核")
|
||||
public Object doReview(String id, String idea, String sign,double funds_money, Boolean flag) {
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Object doReview(@Param(value = "id", required = false) String id,
|
||||
@Param(value = "idea", required = false) String idea,
|
||||
@Param(value = "sign", required = false) String sign,
|
||||
@Param(value = "flag", required = false) Boolean flag) {
|
||||
ActivityBx aid = activityBxService.fetch(id);
|
||||
aid.setState_id(flag ? "1030" : "1015");
|
||||
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);
|
||||
aid.setFunds_money(funds_money);
|
||||
if (Strings.isNotBlank(sign)) {
|
||||
aid.setDivision_chairman(sysSignatureService.insert(new Sys_signature(sign)).getId());
|
||||
}
|
||||
activityBxService.doEdit(aid);
|
||||
|
||||
activityBxService.update(aid);
|
||||
String nodeName = "";
|
||||
if (flag) {
|
||||
nodeName = "校工会副主席审核";
|
||||
ReimbursementToDoHandler.CREATE_SCHOOL_CHAIRMAN_TASK.exec(id, null);
|
||||
nodeName = "校工会负责人审核";
|
||||
// Sys_user_role sys_user_role = activityBxService.dao().fetch(Sys_user_role.class, Cnd.where("roleId", "=", Roles.GH_WYH_ZX));
|
||||
// if (Lang.isNotEmpty(sys_user_role)) {
|
||||
// Sys_user user = activityBxService.dao().fetch(Sys_user.class, sys_user_role.getUserId());
|
||||
Sys_user user = activityBxService.dao().fetch(Sys_user.class, Cnd.where("loginname","=","1019911404"));
|
||||
msgApi.sendWxMsg("活动申报", "", "text", aid.getUser_name() + "申报了一条活动【" + aid.getActivity_name() + "】,请前往智慧工会进行审核。", List.of(user.getLoginname()), null);
|
||||
FundsToHandler.CREATE_SCHOOL_FZR_TASK.exec(id, null, List.of(user.getLoginname()));
|
||||
// }
|
||||
} else {
|
||||
nodeName = "基层工会主席拒绝";
|
||||
ReimbursementToDoHandler.REFUSE_UNION_TASK.exec(id, new NutMap().addv("option", nodeName));
|
||||
Sys_user user = activityBxService.dao().fetch(Sys_user.class, aid.getUser_id());
|
||||
msgApi.sendWxMsg("活动申报", "", "text", "您申报的活动【" + aid.getActivity_name() + "】被基层工会主席拒绝,审核意见:" + aid.getDivision_chairman_idea(), List.of(user.getLoginname()), null);
|
||||
FundsToHandler.REFUSE_TASK.exec(id, new NutMap().addv("option", nodeName), null);
|
||||
}
|
||||
ReimbursementToDoHandler.COMPLETE_UNION_TASK.exec(id, new NutMap().addv("option", nodeName));
|
||||
FundsToHandler.COMPLETE_UNION_TASK.exec(id, new NutMap().addv("option", nodeName), null);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,52 +3,53 @@ package io.v.nutz.zhgh.jf.controller.activitybx;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HtmlUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
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.data.PictureType;
|
||||
import com.deepoove.poi.policy.HackLoopTableRenderPolicy;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.model.Goods;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.base.utils.Html2Text;
|
||||
import io.v.nutz.base.utils.OfficeTemplateUtil;
|
||||
import io.v.nutz.base.utils.Roles;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.sys.models.Sys_signature;
|
||||
import io.v.nutz.sys.services.SysSignatureService;
|
||||
import io.v.nutz.web.commons.base.Globals;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.jf.handler.reimbursement.ReimbursementToDoHandler;
|
||||
import io.v.nutz.zhgh.jf.handle.funds.FundsToHandler;
|
||||
import io.v.nutz.zhgh.jf.model.ActivityBx;
|
||||
import io.v.nutz.zhgh.jf.service.ActivityBxService;
|
||||
import io.v.nutz.zhgh.jf.service.ActivityFileService;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.boot.starter.ftp.FtpService;
|
||||
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.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
import org.nutz.trans.Trans;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.Base64;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
@@ -60,18 +61,22 @@ import java.util.Objects;
|
||||
@At("/platform/jf/activity_bx/reimbursement")
|
||||
public class ReimbursementCon {
|
||||
|
||||
|
||||
@Inject
|
||||
private Vi vi;
|
||||
|
||||
@Inject
|
||||
private ActivityBxService activityBxService;
|
||||
|
||||
@Inject
|
||||
private SysSignatureService sysSignatureService;
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@Inject
|
||||
private ActivityFileService activityFileService;
|
||||
@Inject
|
||||
private OfficeTemplateUtil officeTemplateUtil;
|
||||
private FtpService ftpService;
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/jf/activitybx/reimbursement.html")
|
||||
@@ -79,31 +84,28 @@ public class ReimbursementCon {
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"sys.jf.activity_bx.reimbursement", "sys.jf.funds.reimbursement"}, logical = Logical.OR)
|
||||
public Object doAdd(@Param("activityBx") ActivityBx activityBx, @Param(value = "sign", required = false) String sign) {
|
||||
public Object doAdd(@Param(value = "activityBx", required = false) ActivityBx activityBx, @Param(value = "sign", required = false) String sign) {
|
||||
activityBx.setYear(Calendar.getInstance().get(Calendar.YEAR));
|
||||
if (ShiroUtil.hasAnyRoles(new String[]{"xghhdwy", "SchoolUnionAdmin"}) && activityBx.getActivity_type().equals(2)) {
|
||||
if (ShiroUtil.hasAnyRoles(new String[]{"xghhdwy", "A06"}) && activityBx.getActivity_type().equals(3)) {
|
||||
activityBx.setState_id("1020");
|
||||
} else if (ShiroUtil.hasAnyRoles(new String[]{"club01"}) && activityBx.getActivity_type().equals(3)) {
|
||||
activityBx.setActivity_type(3);
|
||||
} else if (ShiroUtil.hasAnyRoles(new String[]{"H02"}) && activityBx.getActivity_type().equals(2)) {
|
||||
activityBx.setState_id("1000");
|
||||
activityBx.setActivity_type(2);
|
||||
} else {
|
||||
activityBx.setState_id("1010");
|
||||
activityBx.setActivity_type(1);
|
||||
}
|
||||
activityBx.setApply_time(DateUtil.getDate());
|
||||
activityBx.setUser_id(ShiroUtil.getUserId());
|
||||
activityBx.setUser_id(ShiroUtil.getPrincipalProperty("id").toString());
|
||||
if (Strings.isNotBlank(sign)) {
|
||||
activityBx.setUser_signature(sysSignatureService.insert(new Sys_signature(sign)).getId());
|
||||
}
|
||||
activityBxService.doAdd(activityBx);
|
||||
|
||||
ReimbursementToDoHandler.START_PROCESS.exec(activityBx.getId(), null);
|
||||
if (activityBx.getActivity_type().equals(3)) {
|
||||
ReimbursementToDoHandler.CREATE_CLUB_TASK.exec(activityBx.getId(), null);
|
||||
} else {
|
||||
ReimbursementToDoHandler.CREATE_UNION_TASK.exec(activityBx.getId(), null);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -111,58 +113,62 @@ public class ReimbursementCon {
|
||||
/**
|
||||
* 多功能查询
|
||||
*
|
||||
* @param year 根据年查
|
||||
* @param year 根据年查
|
||||
* @param searchName 根据名查
|
||||
* @param searchKeyword
|
||||
* @param pageNumber
|
||||
* @param pageSize
|
||||
* @param pageOrderName
|
||||
* @param pageOrderBy
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"sys.jf.activity_bx.reimbursement", "sys.jf.funds.reimbursement"}, logical = Logical.OR)
|
||||
public Object pageData(PageForm page,
|
||||
@Param(value = "apply_type", required = false) Integer apply_type,
|
||||
@Param(value = "deductionInt", required = false) Integer deductionInt,
|
||||
@Param(value = "year", required = false) Integer year,
|
||||
public Object pageData(@Param(value = "year", required = false) Integer year,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "unionId", required = false) String unionId) {
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "searchName", required = false) String searchName,
|
||||
@Param(value = "apply_type", required = false) Integer apply_type,
|
||||
@Param(value = "searchKeyword", required = false) String searchKeyword,
|
||||
@Param("pageNumber") int pageNumber, @Param("pageSize") int pageSize,
|
||||
@Param(value = "pageOrderName", required = false) String pageOrderName,
|
||||
@Param(value = "pageOrderBy", required = false) String pageOrderBy) {
|
||||
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
abs.`name` absName,
|
||||
bx.*,
|
||||
u.loginname bxr_loginname,
|
||||
u.unionname bxr_unionname,
|
||||
u.unioncode,
|
||||
bxr.loginname bxr_loginname,
|
||||
bxr.unionname bxr_unionname,
|
||||
state.state_name,
|
||||
state.state_color,
|
||||
abs.`name` absName
|
||||
state.state_color
|
||||
FROM
|
||||
activity_bx bx
|
||||
LEFT JOIN `user` u ON bx.user_id = u.id
|
||||
LEFT JOIN `user` bxr ON bx.user_id = bxr.id
|
||||
LEFT JOIN state state ON state.state_id = bx.state_id
|
||||
LEFT JOIN activity_basic_settings abs ON abs.`code` = bx.projectTypeCode
|
||||
$condition
|
||||
LEFT JOIN activity_basic_settings abs ON abs.`code` = bx.projectJfCode
|
||||
$condition
|
||||
""");
|
||||
|
||||
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(page.getSearchName(), page.getSearchKeyword())) {
|
||||
cnd.where().andLike(page.getSearchName(), page.getSearchKeyword());
|
||||
if (Vi.isNotBlank(searchName, searchKeyword)) {
|
||||
cnd.where().andLike(searchName, searchKeyword);
|
||||
}
|
||||
if (deductionInt != null && deductionInt == 2) {
|
||||
cnd.and("bx.isDeduction", "=", 1);
|
||||
} else if (deductionInt != null && deductionInt == 3) {
|
||||
cnd.and("bx.isDeduction", "=", 0);
|
||||
}
|
||||
cnd.and("bx.apply_type", "=", apply_type);
|
||||
|
||||
if (Vi.isNotBlank(page.getPageOrderName(), page.getPageOrderBy())) {
|
||||
cnd.orderBy(page.getPageOrderName(), page.getPageOrderBy());
|
||||
if (Vi.isNotBlank(pageOrderName, pageOrderBy)) {
|
||||
cnd.orderBy(pageOrderName, pageOrderBy);
|
||||
} else {
|
||||
cnd.asc("bx.state_id").desc("bx.apply_time");
|
||||
}
|
||||
Vi.cndPlus(cnd, "u.unitid", "=", unitId);
|
||||
Vi.cndPlus(cnd, "u.unionid", "=", unionId);
|
||||
Vi.cndPlus(cnd, "bxr.unitid", "=", unitId);
|
||||
Vi.cndPlus(cnd, "bxr.unionid", "=", unionId);
|
||||
sql.setCondition(cnd);
|
||||
return activityBxService.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
return activityBxService.listPageMap(pageNumber, pageSize, sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@@ -172,29 +178,44 @@ public class ReimbursementCon {
|
||||
}
|
||||
|
||||
|
||||
@Inject
|
||||
private ActivityFileService activityFileService;
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"sys.jf.activity_bx.reimbursement", "sys.jf.funds.reimbursement"}, logical = Logical.OR)
|
||||
public Object doEdit(@Param("activityBx") ActivityBx activityBx, @Param(value = "sign", required = false) String sign) {
|
||||
|
||||
if (StrUtil.isNotBlank(activityBx.getId())) {
|
||||
baseService.clear("goods", Cnd.where("reid", "=", activityBx.getId()));
|
||||
}
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Object doEdit(@Param(value = "activityBx", required = false) ActivityBx activityBx,
|
||||
@Param(value = "sign", required = false) String sign,
|
||||
@Param(value = "delNotesList", required = false) String[] delNotesList) {
|
||||
if (Strings.isNotBlank(sign)) {
|
||||
activityBx.setUser_signature(sysSignatureService.insert(new Sys_signature(sign)).getId());
|
||||
}
|
||||
activityBxService.doEdit(activityBx);
|
||||
|
||||
activityBxService.update(activityBx);
|
||||
|
||||
if (Lang.isNotEmpty(activityBx.getGoods())) {
|
||||
baseService.dao().clear(Goods.class, Cnd.where("reid", "=", activityBx.getActivity_id()));
|
||||
activityBx.getGoods().forEach(v -> {
|
||||
v.setReid(activityBx.getActivity_id());
|
||||
});
|
||||
baseService.dao().insert(activityBx.getGoods());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"sys.jf.activity_bx.reimbursement", "sys.jf.funds.reimbursement"}, logical = Logical.OR)
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
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);
|
||||
vi.deleteSysFiles(activityBx.getBillFiles());
|
||||
vi.deleteSysFiles(activityBx.getOtherFiles());
|
||||
vi.deleteSysFiles(activityBx.getPhotoFiles());
|
||||
baseService.clear("goods", Cnd.where("reid", "=", activityBx.getActivity_id()));
|
||||
activityBxService.delete(id);
|
||||
FundsToHandler.DELETE_PROCESS_AND_TASK.exec(id, null, null);
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
@@ -202,308 +223,128 @@ public class ReimbursementCon {
|
||||
@At
|
||||
@Ok("void")
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"sys.jf.activity_bx.reimbursement", "sys.jf.funds.reimbursement"}, logical = Logical.OR)
|
||||
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);
|
||||
NutMap one = activityBxService.queryOne(id);
|
||||
if (StrUtil.isNotBlank(one.getString("activity_content"))) {
|
||||
one.setv("activity_content", Html2Text.getContent(one.getString("activity_content")));
|
||||
}
|
||||
one.setv("money_big", Convert.digitToChinese(one.getDouble("activity_money")));
|
||||
one.setv("apply_time", one.getString("apply_time").substring(0, 10));
|
||||
|
||||
List<Record> query = baseService.dao().query("goods", Cnd.where("reid", "=", id));
|
||||
o.set("activity_content", Html2Text.getContent(o.getString("activity_content")));
|
||||
String budgets = one.getString("budgets");
|
||||
List<NutMap> goods = JSONUtil.parseArray(budgets).toList(NutMap.class);
|
||||
|
||||
o.set("activity_money_big", Convert.digitToChinese(o.getDouble("activity_money")));
|
||||
one.put("goods",goods);
|
||||
|
||||
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 (one.getString("activity_type").equals("40001")) {
|
||||
one.setv("jfName", "校工会");
|
||||
} else if (one.getString("activity_type").equals("40002")) {
|
||||
one.setv("jfName", "分工会");
|
||||
} else if (one.getString("activity_type").equals("40003")) {
|
||||
one.setv("jfName", "协会");
|
||||
}
|
||||
|
||||
/*自己签字*/
|
||||
if (o.get("my_sign") != null) {
|
||||
o.set("my_sign", getImage((String) o.get("my_sign")));
|
||||
}
|
||||
double price = one.getDouble("activity_money");
|
||||
int money_int = (int) price;
|
||||
|
||||
BigDecimal priceBigDecimal = new BigDecimal(price);
|
||||
BigDecimal moneyDecimal = priceBigDecimal.subtract(new BigDecimal(money_int));
|
||||
|
||||
one.setv("one", money_int >= 1000000 ? (money_int / 1000000) % 10 : null);
|
||||
one.setv("two", money_int >= 100000 ? (money_int / 100000) % 10 : null);
|
||||
one.setv("three", money_int >= 10000 ? (money_int / 10000) % 10 : null);
|
||||
one.setv("four", money_int >= 1000 ? (money_int / 1000) % 10 : null);
|
||||
one.setv("five", money_int >= 100 ? (money_int / 100) % 10 : null);
|
||||
one.setv("six", money_int >= 10 ? (money_int / 10) % 10 : null);
|
||||
one.setv("seven", money_int >= 1 ? money_int % 10 : null);
|
||||
|
||||
// 提取小数部分的各个位上的数值
|
||||
BigDecimal tenthsPart = moneyDecimal.multiply(BigDecimal.TEN).setScale(0, RoundingMode.DOWN);
|
||||
int tenths = tenthsPart.intValue();
|
||||
BigDecimal hundredthsPart = moneyDecimal.multiply(BigDecimal.valueOf(100)).setScale(0, RoundingMode.DOWN);
|
||||
int hundredths = hundredthsPart.intValue();
|
||||
|
||||
// BigDecimal decimalPart1 = moneyDecimal.divide(new BigDecimal("1"), 1, RoundingMode.HALF_UP);
|
||||
// BigDecimal decimalPart2 = moneyDecimal.divide(new BigDecimal("0.1"), 1, RoundingMode.HALF_UP);
|
||||
one.setv("eight", (tenths % 10));
|
||||
one.setv("nine", (hundredths % 10) + 1);
|
||||
|
||||
|
||||
/*基层工会主席签字*/
|
||||
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 (one.get("dc_s") != null) {
|
||||
one.setv("dc_sign", getImage((String) one.get("dc_s")));
|
||||
}
|
||||
|
||||
/*协会负责人*/
|
||||
if (o.get("ap_sign") != null) {
|
||||
o.set("ap_sign", getImage((String) o.get("ap_sign")));
|
||||
if (one.get("ap_c") != null) {
|
||||
one.setv("ap_sign", getImage((String) one.get("ap_c")));
|
||||
}
|
||||
/*校工会副主席*/
|
||||
if (o.get("ct_sign") != null) {
|
||||
o.set("ct_sign", getImage((String) o.get("ct_sign")));
|
||||
|
||||
/*校工会主席签字*/
|
||||
if (one.get("ucc_s") != null) {
|
||||
one.setv("ucc_sign", getImage((String) one.get("ucc_s")));
|
||||
}
|
||||
|
||||
|
||||
/*会计*/
|
||||
if (o.get("kj_sign") != null) {
|
||||
o.set("kj_sign", getImage((String) o.get("kj_sign")));
|
||||
if (one.get("a_s") != null) {
|
||||
one.setv("a_sign", getImage((String) one.get("a_s")));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
// 基层工会活动
|
||||
if (one.getString("activity_type").equals("1")) {
|
||||
one.setv("suffix", "基层工会主席签字");
|
||||
inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("docTemplate/funds.docx");
|
||||
}
|
||||
// 校工会活动
|
||||
else if (one.getString("activity_type").equals("2")) {
|
||||
one.setv("suffix", "校工会主席签字");
|
||||
inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("docTemplate/school.docx");
|
||||
}
|
||||
// 协会负责人
|
||||
else if (one.getString("activity_type").equals("3")) {
|
||||
one.setv("suffix", "协会负责人签字");
|
||||
inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("docTemplate/association.docx");
|
||||
}
|
||||
*/
|
||||
|
||||
String fileName = Globals.schoolName + "【" + one.getString("activity_name") + "】报销凭证";
|
||||
|
||||
HackLoopTableRenderPolicy policy = new HackLoopTableRenderPolicy();
|
||||
Configure config = Configure.newBuilder().bind("goods", policy).build();
|
||||
o.set("goods", query);
|
||||
o.set("schoolName", Globals.schoolName);
|
||||
|
||||
|
||||
String templateUrl = null;
|
||||
|
||||
// 基层工会活动
|
||||
if (o.getString("activity_type").equals("40002")) {
|
||||
o.set("suffix", "基层工会主席签字");
|
||||
templateUrl = officeTemplateUtil.getPath("activityBx_funds");
|
||||
}
|
||||
// 校工会活动
|
||||
else if (o.getString("activity_type").equals("40001")) {
|
||||
o.set("suffix", "校工会主席签字");
|
||||
templateUrl = officeTemplateUtil.getPath("activityBx_school");
|
||||
}
|
||||
// 协会负责人
|
||||
else if (o.getString("activity_type").equals("40003")) {
|
||||
o.set("suffix", "协会负责人签字");
|
||||
templateUrl = officeTemplateUtil.getPath("activityBx_association");
|
||||
}
|
||||
InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("docTemplate/funds3.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(templateUrl, config).render(o).writeAndClose(response.getOutputStream());
|
||||
;
|
||||
response.addHeader("Content-Disposition", "attachment; filename=\"" + new String(fileName.getBytes("UTF-8"), "ISO-8859-1") + "\".docx");
|
||||
XWPFTemplate.compile(inputStream, config).render(one, 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);
|
||||
if (base64.startsWith("data")) {
|
||||
String s = base64.split(",")[1];
|
||||
byte[] bytes = Base64.getDecoder().decode(s);
|
||||
return new PictureRenderData(70, 30, ".png", bytes);
|
||||
} else {
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
ftpService.download(base64, os);
|
||||
os.close();
|
||||
return new PictureRenderData(70, 30, PictureType.PNG, os.toByteArray());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@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");
|
||||
public Object getActivity(String type) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT * FROM activity_tissue where type=@type
|
||||
""").setParam("type", type);
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
return activityBxService.listPageMap(1, 50, sql).getList();
|
||||
|
||||
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("SchoolUnionAdmin,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("club01")) {
|
||||
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();
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@RequiresPermissions("sys.jf.funds")
|
||||
public void exportApply(String id, HttpServletResponse response) {
|
||||
try {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
t1.fundsUnitName,
|
||||
t1.activity_name,
|
||||
t1.activity_content,
|
||||
t1.budgets,
|
||||
t1.funds_money,
|
||||
t1.activity_type,
|
||||
t1.division_chairman_idea,
|
||||
t1.division_chairman_time,
|
||||
fghqz.`data` AS fghqz,
|
||||
t1.association_principal_time,
|
||||
t1.association_principal_idea,
|
||||
xhqz.`data` AS xhqz,
|
||||
t1.accounting_name,
|
||||
t1.accounting_time,
|
||||
t1.accounting_idea,
|
||||
xghqz.`data` AS xghqz
|
||||
FROM
|
||||
`activity_bx` t1
|
||||
LEFT JOIN sys_signature fghqz ON fghqz.id = t1.division_chairman
|
||||
LEFT JOIN sys_signature xhqz ON xhqz.id = t1.association_principalSign_id
|
||||
LEFT JOIN sys_signature xghqz ON xghqz.id = t1.accounting
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("t1.id", "=", id);
|
||||
sql.setCondition(cnd);
|
||||
NutMap infoData = activityBxService.fetch(sql);
|
||||
|
||||
//活动费用预算
|
||||
String budgets = infoData.getString("budgets");
|
||||
if (StrUtil.isNotBlank(budgets)) {
|
||||
List<NutMap> list = Json.fromJsonAsList(NutMap.class, budgets);
|
||||
infoData.put("budgets", list);
|
||||
}
|
||||
//活动内容
|
||||
infoData.put("activity_content", HtmlUtil.unescape(HtmlUtil.cleanHtmlTag(infoData.getString("activity_content"))));
|
||||
//分工会签字
|
||||
if (StrUtil.isNotBlank(infoData.getString("fghqz"))) {
|
||||
infoData.put("fghqz", Vi.getImg(infoData.getString("fghqz")));
|
||||
}
|
||||
//协会签字
|
||||
if (StrUtil.isNotBlank(infoData.getString("xhqz"))) {
|
||||
infoData.put("xhqz", Vi.getImg(infoData.getString("xhqz")));
|
||||
}
|
||||
//校工会签字
|
||||
if (StrUtil.isNotBlank(infoData.getString("xghqz"))) {
|
||||
infoData.put("xghqz", Vi.getImg(infoData.getString("xghqz")));
|
||||
}
|
||||
|
||||
InputStream is = null;
|
||||
String path = "C:\\Users\\jug\\Desktop\\branchUnionReimburse.docx";
|
||||
String activityType = infoData.getString("activity_type");
|
||||
if (Objects.equals("40003", activityType)) {
|
||||
path = "C:\\Users\\jug\\Desktop\\clubReimburse.docx";
|
||||
is = officeTemplateUtil.getInputStream("clubReimburse");
|
||||
} else if (Objects.equals("40002", activityType)) {
|
||||
path = "C:\\Users\\jug\\Desktop\\branchUnionReimburse.docx";
|
||||
is = officeTemplateUtil.getInputStream("branchUnionReimburse");
|
||||
} else {
|
||||
is = officeTemplateUtil.getInputStream("branchUnionReimburse");
|
||||
}
|
||||
|
||||
String docxName = infoData.getString("fundsUnitName") + infoData.getString("activity_name") + "经费报销申请" + ".docx";
|
||||
response.addHeader("Content-Type", "application/octet-stream");
|
||||
response.addHeader("Content-Disposition", "attachment; filename=\"" + new String(docxName.getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1) + "\".docx");
|
||||
ServletOutputStream outputStream = response.getOutputStream();
|
||||
|
||||
HackLoopTableRenderPolicy policy = new HackLoopTableRenderPolicy();
|
||||
|
||||
Configure config = Configure.builder()
|
||||
.bind("budgets", policy)
|
||||
.build();
|
||||
XWPFTemplate.compile(is, config)
|
||||
.render(infoData)
|
||||
.write(outputStream);
|
||||
outputStream.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,27 +1,24 @@
|
||||
package io.v.nutz.zhgh.jf.controller.activitybx;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.deepoove.poi.XWPFTemplate;
|
||||
import com.deepoove.poi.config.Configure;
|
||||
import com.deepoove.poi.data.PictureRenderData;
|
||||
import com.deepoove.poi.data.PictureType;
|
||||
import com.deepoove.poi.policy.HackLoopTableRenderPolicy;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.Html2Text;
|
||||
import io.v.nutz.base.utils.OfficeTemplateUtil;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.zhgh.jf.model.ActivityBx;
|
||||
import io.v.nutz.zhgh.jf.service.ActivityBxService;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.sys.services.SysUnionService;
|
||||
import io.v.nutz.web.commons.base.Globals;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.boot.starter.ftp.FtpService;
|
||||
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;
|
||||
@@ -32,10 +29,16 @@ import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.io.InputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.Base64;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
@@ -43,24 +46,21 @@ import java.util.List;
|
||||
* @description 活动报销查看
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json")
|
||||
@Ok("json:full")
|
||||
@At("/platform/jf/activity_bx/reimbursementview")
|
||||
public class ReimbursementViewCon {
|
||||
|
||||
|
||||
@Inject
|
||||
private Vi vi;
|
||||
|
||||
@Inject
|
||||
private ActivityBxService activityBxService;
|
||||
@Inject
|
||||
private FtpService ftpService;
|
||||
|
||||
private SysUnionService sysUnionService;
|
||||
|
||||
|
||||
@Inject
|
||||
private OfficeTemplateUtil officeTemplateUtil;
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/jf/activitybx/reimbursementview.html")
|
||||
@RequiresPermissions("sys.jf.activity_bx.reimbursementview")
|
||||
@@ -70,182 +70,266 @@ public class ReimbursementViewCon {
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"sys.jf.activity_bx.reimbursementview", "sys.jf.funds.reimbursementview"}, logical = Logical.OR)
|
||||
public Object pageData(PageForm page,
|
||||
@Param(value = "apply_type", required = false) Integer apply_type,
|
||||
@Param(value = "year", required = false) Integer year,
|
||||
@Param(value = "deductionInt", required = false) Integer deductionInt,
|
||||
public Object pageData(@Param(value = "year", required = false) Integer year,
|
||||
@Param(value = "isAudit", required = false) Integer isAudit,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "unionId", required = false) String unionId) {
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "apply_type", required = false) Integer apply_type,
|
||||
@Param(value = "searchName", required = false) String searchName,
|
||||
@Param(value = "searchKeyword", required = false) String searchKeyword,
|
||||
@Param("pageNumber") int pageNumber, @Param("pageSize") int pageSize,
|
||||
@Param(value = "pageOrderName", required = false) String pageOrderName,
|
||||
@Param(value = "pageOrderBy", required = false) String pageOrderBy) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
act.*,
|
||||
u.loginname bxr_loginname,
|
||||
u.unionname bxr_unionname,
|
||||
u.unioncode,
|
||||
un.unionname,
|
||||
s.state_name,
|
||||
s.state_color,
|
||||
abs.`name` absName
|
||||
FROM
|
||||
`activity_bx` act
|
||||
LEFT JOIN `user` u ON act.user_id = u.id
|
||||
LEFT JOIN sys_unit su ON su.id = u.unitid
|
||||
LEFT JOIN sys_union un ON su.unionid = un.id
|
||||
LEFT JOIN state s ON act.state_id = s.state_id
|
||||
LEFT JOIN activity_basic_settings abs ON abs.`code` = act.projectTypeCode
|
||||
LEFT JOIN activity_basic_settings abs ON abs.`code` = act.projectJfCode
|
||||
LEFT JOIN sys_club_user scu ON scu.userid=act.user_id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,wyh02")) {
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,wyh02,H10,xghng")) {
|
||||
SqlExpressionGroup group2 = new SqlExpressionGroup();
|
||||
if (ShiroUtil.hasAnyRoles("gh01,H04")) {
|
||||
group2.or("u.unionid", "=", vi.getUnionId());
|
||||
} else if (ShiroUtil.hasRole("H02")) {
|
||||
group2.or("scu.clubid", "=", vi.getClubId());
|
||||
} else {
|
||||
group2.or("act.user_id", "=", ShiroUtil.getPrincipalProperty("id").toString());
|
||||
}
|
||||
cnd.and(group2);
|
||||
}
|
||||
|
||||
cnd.and("act.apply_type", "=", apply_type);
|
||||
|
||||
Vi.cndPlus(cnd, "act.year", "=", year);
|
||||
if (Vi.isNotBlank(page.getSearchName(), page.getSearchKeyword())) {
|
||||
cnd.where().andLike(page.getSearchName(), page.getSearchKeyword());
|
||||
if (Vi.isNotBlank(searchName, searchKeyword)) {
|
||||
cnd.where().andLike(searchName, searchKeyword);
|
||||
}
|
||||
|
||||
if (deductionInt == 2) {
|
||||
cnd.and("act.isDeduction", "=", 1);
|
||||
} else if (deductionInt == 3) {
|
||||
cnd.and("act.isDeduction", "=", 0);
|
||||
}
|
||||
|
||||
|
||||
Vi.cndPlus(cnd, "u.unitid", "=", unitId);
|
||||
Vi.cndPlus(cnd, "u.unionid", "=", unionId);
|
||||
|
||||
if (Vi.isNotBlank(page.getPageOrderName(), page.getPageOrderBy())) {
|
||||
cnd.orderBy(page.getPageOrderName(), page.getPageOrderBy());
|
||||
Vi.cndPlus(cnd, "act.apply_type", "=", apply_type);
|
||||
cnd.groupBy("act.id");
|
||||
if (Vi.isNotBlank(pageOrderName, pageOrderBy)) {
|
||||
cnd.orderBy(pageOrderName, pageOrderBy);
|
||||
} else {
|
||||
cnd.asc("act.state_id").desc("act.apply_time");
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return activityBxService.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
return activityBxService.listPageMap(pageNumber, pageSize, sql);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 下载名单
|
||||
*/
|
||||
@At
|
||||
@RequiresPermissions(value = {"sys.jf.activity_bx.reimbursementview", "sys.jf.funds.reimbursementview"}, logical = Logical.OR)
|
||||
public void download(Integer year, @Param(value = "deductionInt", required = false) Integer deductionInt, HttpServletResponse response) throws IOException {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
act.*,
|
||||
u.loginname ,
|
||||
u.unionname ,
|
||||
u.unioncode,
|
||||
abs.`name` absName,
|
||||
abs2.`name` activityTypeName
|
||||
FROM
|
||||
`activity_bx` act
|
||||
LEFT JOIN `user` u ON act.user_id = u.id
|
||||
LEFT JOIN state s ON act.state_id = s.state_id
|
||||
LEFT JOIN activity_basic_settings abs ON abs.`code` = act.projectTypeCode
|
||||
LEFT JOIN activity_basic_settings abs2 ON abs2.`code` = act.activity_type
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Vi.cndPlus(cnd, "act.year", "=", year);
|
||||
Vi.cndPlus(cnd, "act.state_id", "=", 1060);
|
||||
|
||||
if (deductionInt == 2) {
|
||||
cnd.and("act.isDeduction", "=", 1);
|
||||
} else if (deductionInt == 3) {
|
||||
cnd.and("act.isDeduction", "=", 0);
|
||||
private PictureRenderData getImage(String base64) throws IOException {
|
||||
if (base64.startsWith("data:")) {
|
||||
String s = base64.split(",")[1];
|
||||
byte[] bytes = Base64.getDecoder().decode(s);
|
||||
return new PictureRenderData(70, 30, ".png", bytes);
|
||||
} else {
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
ftpService.download(base64, os);
|
||||
os.close();
|
||||
return new PictureRenderData(70, 30, PictureType.PNG, os.toByteArray());
|
||||
}
|
||||
cnd.asc("u.unitid").asc("user_id");
|
||||
sql.setCondition(cnd);
|
||||
List<Record> list = activityBxService.list(sql);
|
||||
|
||||
int i = 0;
|
||||
for (Record record : list) {
|
||||
i++;
|
||||
record.set("index", i);
|
||||
record.set("activity_content", Html2Text.toPlainText(record.getString("activity_content")));
|
||||
}
|
||||
|
||||
List<ExcelExportEntity> entities = new ArrayList<>();
|
||||
entities.add(new ExcelExportEntity("序号", "index", 20));
|
||||
entities.add(new ExcelExportEntity("申请人姓名", "user_name", 20));
|
||||
entities.add(new ExcelExportEntity("所属工会", "unionname", 20));
|
||||
entities.add(new ExcelExportEntity("活动时间", "activity_time", 20));
|
||||
entities.add(new ExcelExportEntity("地点", "venue", 20));
|
||||
entities.add(new ExcelExportEntity("活动项目类型", "absName", 20));
|
||||
entities.add(new ExcelExportEntity("活动主体类型", "activityTypeName", 20));
|
||||
entities.add(new ExcelExportEntity("活动方案及简介", "activity_content", 50));
|
||||
entities.add(new ExcelExportEntity("申请时间", "apply_time", 50));
|
||||
|
||||
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + new String((Globals.schoolName + year + "活动经费报销表.xls").getBytes("utf-8"), "ISO8859-1"));
|
||||
|
||||
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), entities, list);
|
||||
workbook.write(response.getOutputStream());
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
public void doExport(String id, HttpServletResponse response) throws Exception {
|
||||
NutMap nutMap = activityBxService.queryOne(id);
|
||||
nutMap.setv("activity_content", Html2Text.toPlainText(nutMap.getString("activity_content")));
|
||||
nutMap.setv("apply_time", nutMap.getString("apply_time").substring(0, 10));
|
||||
List<NutMap> goods = nutMap.getAsList("goods", NutMap.class);
|
||||
|
||||
String budgets = nutMap.getString("budgets");
|
||||
List<NutMap> goods = JSONUtil.parseArray(budgets).toList(NutMap.class);
|
||||
|
||||
// List<NutMap> goods = nutMap.getAsList("budgets", NutMap.class);
|
||||
|
||||
for (int i = 0; i < goods.size(); i++) {
|
||||
goods.get(i).put("ranking", i + 1);
|
||||
}
|
||||
|
||||
|
||||
if (nutMap.get("dc_s") != null) {
|
||||
nutMap.setv("fgh_sign", Vi.getImg(nutMap.getString("dc_s")));
|
||||
nutMap.setv("fgh_sign", getImage((String) nutMap.get("dc_s")));
|
||||
}
|
||||
|
||||
if (nutMap.get("ap_s") != null) {
|
||||
nutMap.setv("ap_sign", Vi.getImg(nutMap.getString("ap_s")));
|
||||
nutMap.setv("ap_sign", getImage((String) nutMap.get("ap_s")));
|
||||
}
|
||||
if (nutMap.get("dc_s") == null && nutMap.get("ap_s") == null && !nutMap.getString("activity_type").equals("40001")) {
|
||||
if (nutMap.get("us_s") != null) {
|
||||
nutMap.setv("us_sign", Vi.getImg(nutMap.getString("us_s")));
|
||||
nutMap.setv("us_sign", getImage((String) nutMap.get("us_s")));
|
||||
nutMap.setv("division_chairman_time", nutMap.getString("apply_time"));
|
||||
}
|
||||
}
|
||||
|
||||
if (nutMap.get("a_s") != null) {
|
||||
nutMap.setv("a_sign", Vi.getImg(nutMap.getString("a_s")));
|
||||
nutMap.setv("a_sign", getImage((String) nutMap.get("a_s")));
|
||||
}
|
||||
|
||||
if (nutMap.get("a_s") == null && nutMap.getString("activity_type").equals("40001")) {
|
||||
if (nutMap.get("us_s") != null) {
|
||||
nutMap.setv("a_sign", Vi.getImg(nutMap.getString("us_s")));
|
||||
nutMap.setv("a_sign", getImage((String) nutMap.get("us_s")));
|
||||
nutMap.setv("accounting_time", nutMap.getString("apply_time"));
|
||||
}
|
||||
}
|
||||
|
||||
if (nutMap.get("ucc_s") != null) {
|
||||
nutMap.setv("xgh_sign", Vi.getImg(nutMap.getString("ucc_s")));
|
||||
nutMap.setv("xgh_sign", getImage((String) nutMap.get("ucc_s")));
|
||||
}
|
||||
|
||||
|
||||
HackLoopTableRenderPolicy policy = new HackLoopTableRenderPolicy();
|
||||
Configure config = Configure.newBuilder().bind("goods", policy).build();
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("goods", goods);
|
||||
map.put("n", nutMap);
|
||||
map.put("schoolName", Globals.schoolName);
|
||||
String fileName = Globals.schoolName + "工会活动申报登记表";
|
||||
String fileName = Globals.schoolName + "【" + nutMap.getString("activity_name") + "】申报表";
|
||||
|
||||
response.addHeader("Content-Type", "application/octet-stream");
|
||||
response.addHeader("Content-Disposition", "attachment; filename=\"" + new String(fileName.getBytes("UTF-8"), "ISO-8859-1") + "\".docx");
|
||||
XWPFTemplate.compile(officeTemplateUtil.getPath("activityBx_funds2"), config).render(map).writeAndClose(response.getOutputStream());
|
||||
InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("docTemplate/funds2.docx");
|
||||
assert inputStream != null;
|
||||
XWPFTemplate.compile(inputStream, config).render(map, response.getOutputStream());
|
||||
inputStream.close();
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
public void doExportZip(String id, HttpServletResponse response) {
|
||||
ActivityBx activityBx = activityBxService.fetch(id);
|
||||
String activityName = activityBx.getActivity_name();
|
||||
try {
|
||||
String zipName = Globals.schoolName + activityName + "申请表报销凭证.zip".replace("+","");
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("content-disposition", "attachment;filename="
|
||||
+ URLEncoder.encode(zipName, "UTF-8"));
|
||||
|
||||
ZipOutputStream zipOutputStream = new ZipOutputStream(new BufferedOutputStream(response.getOutputStream()));
|
||||
|
||||
String fileNameView = "申报表.docx";
|
||||
zipOutputStream.putNextEntry(new ZipEntry(fileNameView));
|
||||
activityBxService.exportByView(id,zipOutputStream);
|
||||
zipOutputStream.closeEntry();
|
||||
response.flushBuffer();
|
||||
|
||||
String fileNameCon = "报销凭证.docx";
|
||||
zipOutputStream.putNextEntry(new ZipEntry(fileNameCon));
|
||||
activityBxService.exportByCon(id,zipOutputStream);
|
||||
zipOutputStream.closeEntry();
|
||||
response.flushBuffer();
|
||||
|
||||
zipOutputStream.flush();
|
||||
zipOutputStream.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,27 +1,37 @@
|
||||
package io.v.nutz.zhgh.jf.controller.activitybx;
|
||||
|
||||
import io.v.nutz.zhgh.activity.services.ActivityTissueService;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.model.Goods;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.base.utils.MsgApi;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.zhgh.jf.model.ActivityBx;
|
||||
import io.v.nutz.zhgh.jf.service.ActivityBxService;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.sys.models.Sys_signature;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.sys.models.User;
|
||||
import io.v.nutz.sys.services.SysSignatureService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import io.v.nutz.zhgh.activity.models.ActivityTissue;
|
||||
import io.v.nutz.zhgh.activity.services.ActivityTissueService;
|
||||
import io.v.nutz.zhgh.jf.handle.funds.FundsToHandler;
|
||||
import io.v.nutz.zhgh.jf.model.ActivityBx;
|
||||
import io.v.nutz.zhgh.jf.service.ActivityBxService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2020/11/14 16:03
|
||||
@@ -36,19 +46,15 @@ public class UnionCon {
|
||||
@Inject
|
||||
private Vi vi;
|
||||
|
||||
@Inject
|
||||
private MsgApi msgApi;
|
||||
|
||||
@Inject
|
||||
private ActivityBxService activityBxService;
|
||||
|
||||
@Inject
|
||||
private SysSignatureService sysSignatureService;
|
||||
@Inject
|
||||
private io.v.nutz.zhgh.jf.service.jfUseService jfUseService;
|
||||
@Inject
|
||||
private io.v.nutz.zhgh.jf.service.jfYjghService jfYjghService;
|
||||
@Inject
|
||||
private ActivityTissueService activityTissueService;
|
||||
@Inject
|
||||
private io.v.nutz.zhgh.jf.service.jfClubService jfClubService;
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/jf/activitybx/union.html")
|
||||
@@ -56,21 +62,23 @@ public class UnionCon {
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"sys.jf.activity_bx.union","sys.jf.funds.union"},logical = Logical.OR)
|
||||
public Object pageData(PageForm page,
|
||||
@Param(value = "apply_type", required = false) Integer apply_type,
|
||||
@Param(value = "year", required = false) Integer year,
|
||||
public Object pageData(@Param(value = "year", required = false) Integer year,
|
||||
@Param(value = "isAudit", required = false) Integer isAudit,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "unionId", required = false) String unionId) {
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "searchName", required = false) String searchName,
|
||||
@Param(value = "searchKeyword", required = false) String searchKeyword,
|
||||
@Param("pageNumber") int pageNumber, @Param("pageSize") int pageSize,
|
||||
@Param(value = "pageOrderName", required = false) String pageOrderName,
|
||||
@Param(value = "pageOrderBy", required = false) String pageOrderBy) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
act.*,
|
||||
u.loginname bxr_loginname,
|
||||
u.unionname bxr_unionname,
|
||||
u.unioncode,
|
||||
s.state_name,
|
||||
s.state_color,
|
||||
abs.`name` absName
|
||||
@@ -78,7 +86,7 @@ public class UnionCon {
|
||||
`activity_bx` act
|
||||
LEFT JOIN `user` u ON act.user_id = u.id
|
||||
LEFT JOIN state s ON act.state_id = s.state_id
|
||||
LEFT JOIN activity_basic_settings abs ON abs.`code` = act.projectTypeCode
|
||||
LEFT JOIN activity_basic_settings abs ON abs.`code` = act.projectJfCode
|
||||
$condition
|
||||
""");
|
||||
|
||||
@@ -90,14 +98,14 @@ public class UnionCon {
|
||||
cnd.and("act.state_id", isAudit == 2 ? ">" : "=", 1040);
|
||||
}
|
||||
|
||||
cnd.and("act.apply_type", "=", apply_type);
|
||||
|
||||
Vi.cndPlus(cnd, "act.year", "=", year);
|
||||
if (Vi.isNotBlank(page.getSearchName(), page.getSearchKeyword())) {
|
||||
cnd.where().andLike(page.getSearchName(), page.getSearchKeyword());
|
||||
if (Vi.isNotBlank(searchName, searchKeyword)) {
|
||||
cnd.where().andLike(searchName, searchKeyword);
|
||||
}
|
||||
|
||||
if (Vi.isNotBlank(page.getPageOrderName(), page.getPageOrderBy())) {
|
||||
cnd.orderBy(page.getPageOrderName(), page.getPageOrderBy());
|
||||
if (Vi.isNotBlank(pageOrderName, pageOrderBy)) {
|
||||
cnd.orderBy(pageOrderName, pageOrderBy);
|
||||
} else {
|
||||
cnd.asc("act.state_id").desc("act.apply_time");
|
||||
}
|
||||
@@ -105,30 +113,85 @@ public class UnionCon {
|
||||
Vi.cndPlus(cnd, "u.unitid", "=", unitId);
|
||||
Vi.cndPlus(cnd, "u.unionid", "=", unionId);
|
||||
sql.setCondition(cnd);
|
||||
return activityBxService.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
return activityBxService.listPageMap(pageNumber, pageSize, sql);
|
||||
}
|
||||
|
||||
|
||||
@Inject
|
||||
private io.v.nutz.zhgh.jf.service.jfUseService jfUseService;
|
||||
|
||||
@Inject
|
||||
private io.v.nutz.zhgh.jf.service.jfYjghService jfYjghService;
|
||||
|
||||
@Inject
|
||||
private ActivityTissueService activityTissueService;
|
||||
@Inject
|
||||
private io.v.nutz.zhgh.jf.service.jfClubService jfClubService;
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"sys.jf.activity_bx.union","sys.jf.funds.union"},logical = Logical.OR)
|
||||
public Object doReview(String id, String idea, String sign, Boolean flag) {
|
||||
ActivityBx aid = activityBxService.fetch(id);
|
||||
aid.setState_id(flag ? "1060" : "1045");
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Object doReview(String data) {
|
||||
NutMap nutMap = Json.fromJson(NutMap.class, data);
|
||||
|
||||
ActivityBx aid = activityBxService.fetch(nutMap.getString("id"));
|
||||
aid.setState_id(nutMap.getBoolean("flag") ? "1060" : "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);
|
||||
aid.setUnion_chairman_idea(nutMap.getString("idea"));
|
||||
aid.setActivity_money(nutMap.getDouble("activity_money"));
|
||||
List<Goods> goods = nutMap.getAsList("goods", Goods.class);
|
||||
aid.setGoods(goods);
|
||||
|
||||
/* jf_yjgh jfYjgh = jfYjghService.fetch(Cnd.where("unionId", "=", vi.getUnionId(aid.getUser_id())).and("year", "=", Calendar.getInstance().get(Calendar.YEAR)));
|
||||
if (Strings.isNotBlank(nutMap.getString("sign"))) {
|
||||
aid.setUnion_chairman(sysSignatureService.insert(new Sys_signature(nutMap.getString("sign"))).getId());
|
||||
}
|
||||
|
||||
String nodeName = "";
|
||||
if (nutMap.getBoolean("flag")) {
|
||||
User user = activityBxService.dao().fetch(User.class, Cnd.where("id", "=", aid.getUser_id()));
|
||||
msgApi.sendWxMsg("活动申报", "", "text", "您申报的活动【" + aid.getActivity_name() + "】已审核通过,请前往智慧工会进行查看。", List.of(user.getLoginname()), null);
|
||||
|
||||
|
||||
if (aid.getActivity_id() == null) {
|
||||
ActivityTissue activityTissue = new ActivityTissue();
|
||||
activityTissue.setId(aid.getId());
|
||||
activityTissue.setApplyTime(DateUtil.getDate());
|
||||
activityTissue.setType(aid.getActivity_type());
|
||||
activityTissue.setActivityCode(aid.getProjectCode());
|
||||
activityTissue.setName(aid.getActivity_name());
|
||||
activityTissue.setUserId(aid.getUser_id());
|
||||
activityTissue.setStartPlannedDate(aid.getStartPlannedDate());
|
||||
activityTissue.setEndPlannedDate(aid.getEndPlannedDate());
|
||||
activityTissue.setStartTime(aid.getStartTime());
|
||||
activityTissue.setEndTime(aid.getEndTime());
|
||||
activityTissue.setAddress(aid.getAddress());
|
||||
if (aid.getActivity_type() == 40002) {
|
||||
activityTissue.setUnionId(user.getUnionid());
|
||||
} else if (aid.getActivity_type() == 40003) {
|
||||
activityTissue.setClubId(aid.getClubId());
|
||||
}
|
||||
activityTissue.setProjectTypeCode("50006");
|
||||
activityBxService.insert(activityTissue);
|
||||
aid.setActivity_id(activityTissue.getId());
|
||||
}
|
||||
nodeName = "审核通过";
|
||||
} else {
|
||||
Sys_user user = activityBxService.dao().fetch(Sys_user.class, aid.getUser_id());
|
||||
msgApi.sendWxMsg("活动申报", "", "text", "您申报的活动【" + aid.getActivity_name() + "】被校工会主席拒绝,审核意见:" + aid.getUnion_chairman_idea(), List.of(user.getLoginname()), null);
|
||||
FundsToHandler.REFUSE_TASK.exec(aid.getId(), new NutMap().addv("option", nodeName), null);
|
||||
}
|
||||
activityBxService.update(aid);
|
||||
FundsToHandler.COMPLETE_SCHOOL_TASK.exec(aid.getId(), new NutMap().addv("option", nodeName), null);
|
||||
|
||||
/*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(aid.getActivity_money());
|
||||
use.setAdjust_money((double) Math.round(aid.getActivity_money()));
|
||||
use.setAdjust_person(ShiroUtil.getPrincipalProperty("id").toString());
|
||||
use.setAdjust_time(DateUtil.getDate());
|
||||
jfUseService.addUse(use, false);
|
||||
|
||||
@@ -119,7 +119,7 @@ public class clubTzController {
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (ShiroUtil.hasRole("sysadmin") || ShiroUtil.hasRole("SchoolUnionAdmin")) {
|
||||
if (ShiroUtil.hasRole("sysadmin") || ShiroUtil.hasRole("A06")) {
|
||||
|
||||
} else {
|
||||
List<Sys_user_role> roleids = jfClubService.dao().query(Sys_user_role.class, Cnd.where("roleId", "=", Roles.club01));
|
||||
|
||||
@@ -19,6 +19,7 @@ import io.v.nutz.base.utils.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;
|
||||
|
||||
+145
@@ -0,0 +1,145 @@
|
||||
package io.v.nutz.zhgh.jf.controller.reimbursement;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.zhgh.jf.handle.reimbursement.ReimbursementToHandler;
|
||||
import io.v.nutz.zhgh.jf.model.ActivityBx;
|
||||
import io.v.nutz.zhgh.jf.service.ActivityBxService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:ActivityReimbursementApplyController
|
||||
* @Date 2024/4/26 14:58
|
||||
* @注释 活动报销,报销申请
|
||||
* 校工会活动——>校工会负责人(姜学军)审核——>校工会主席审核——>流程结束
|
||||
* 基层工会活动——>基层工会主席审核——>校工会负责人(姜学军)审核——>校工会主席审核——>流程结束
|
||||
* 协会活动——>协会负责人审核——>校工会负责人(姜学军)审核——>校工会主席审核——>流程结束
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/jf/reimbursement/apply")
|
||||
public class ActivityReimbursementApplyController {
|
||||
|
||||
@Inject
|
||||
private ActivityBxService activityBxService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/jf/reimbursement/apply.html")
|
||||
@RequiresPermissions("sys.jf.reimbursement.apply")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("sys.jf.reimbursement.apply")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Object doSave(@Param("activityBx") ActivityBx activityBx) {
|
||||
List<ActivityBx.Budget> budgets = activityBx.getBudgets();
|
||||
if (ArrayUtil.isNotEmpty(budgets)) {
|
||||
double sum = budgets.stream().mapToDouble(ActivityBx.Budget::getActualPrice).sum();
|
||||
activityBx.setActivity_money(sum);
|
||||
activityBx.setReimbursement_apply_time(DateUtil.today());
|
||||
}
|
||||
|
||||
activityBx.setFiles(null);
|
||||
activityBx.setActivity_content(null);
|
||||
activityBx.setReimbursement_state_id(999);
|
||||
activityBxService.updateIgnoreNull(activityBx);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("sys.jf.reimbursement.apply")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Object doEdit(@Param("activityBx") ActivityBx activityBx, @Param(value = "sign", required = false) String sign) {
|
||||
int count = activityBxService.count(Cnd.where("id", "=", activityBx.getId()));
|
||||
|
||||
switch (activityBx.getActivity_type()) {
|
||||
case 40001 -> activityBx.setReimbursement_state_id(1020);
|
||||
case 40002 -> activityBx.setReimbursement_state_id(1010);
|
||||
case 40003 -> activityBx.setReimbursement_state_id(1000);
|
||||
}
|
||||
|
||||
List<ActivityBx.Budget> budgets = activityBx.getBudgets();
|
||||
double sum = budgets.stream().mapToDouble(ActivityBx.Budget::getActualPrice).sum();
|
||||
activityBx.setActivity_money(sum);
|
||||
if (activityBx.getReimbursement_apply_time() == null){
|
||||
activityBx.setReimbursement_apply_time(DateUtil.today());
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(activityBx.getId()) && count > 0) {
|
||||
activityBx.setFiles(null);
|
||||
activityBx.setActivity_content(null);
|
||||
activityBxService.updateIgnoreNull(activityBx);
|
||||
} else {
|
||||
// activityBxService.doAdd(activityBx);
|
||||
}
|
||||
|
||||
NutMap map = new NutMap();
|
||||
map.put("userId", ShiroUtil.getUserId());
|
||||
//流程开始
|
||||
ReimbursementToHandler.START_PROCESS.exec(activityBx.getId(), map);
|
||||
if (activityBx.getActivity_type() == 40001) {
|
||||
//校工会申请,校工会负责人审核
|
||||
ReimbursementToHandler.CREATE_SCHOOL_DIRECTOR_TASK.exec(activityBx.getId(), map);
|
||||
} else if (activityBx.getActivity_type() == 40002) {
|
||||
//分工会
|
||||
ReimbursementToHandler.CREATE_UNION_TASK.exec(activityBx.getId(), map);
|
||||
} else if (activityBx.getActivity_type() == 40003) {
|
||||
//协会
|
||||
ReimbursementToHandler.CREATE_CLUB_TASK.exec(activityBx.getId(), map);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("sys.jf.reimbursement.apply")
|
||||
public Object getActivityReimbursementByUser() {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("state_id", "=", 1060);
|
||||
cnd.andEX("`year`", "=", DateUtil.thisYear());
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.or("reimbursement_state_id", "in", List.of(1005, 1015, 1025, 1045));
|
||||
seg.or("reimbursement_union_audit_id", "is", null);
|
||||
cnd.and(seg);
|
||||
// cnd.and("reimbursement_unit_secretary_audit_id", "is", null);
|
||||
// cnd.and("reimbursement_finance_audit_id", "is", null);
|
||||
// cnd.and("reimbursement_school_director_id", "is", null);
|
||||
// cnd.and("reimbursement_school_chairman_id", "is", null);
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin")) {
|
||||
cnd.and("user_id", "=", ShiroUtil.getUserId());
|
||||
}
|
||||
return activityBxService.query(cnd);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("sys.jf.reimbursement.apply")
|
||||
public Object findOne(String id) {
|
||||
return activityBxService.queryOne(id);
|
||||
}
|
||||
}
|
||||
+307
@@ -0,0 +1,307 @@
|
||||
package io.v.nutz.zhgh.jf.controller.reimbursement;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.jf.service.ActivityBxService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Dao;
|
||||
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 org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:ActivityReimbursementBoardController
|
||||
* @Date 2024/5/14 14:48
|
||||
* @注释 活动报销图表展示
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/jf/reimbursement/board")
|
||||
@Slf4j
|
||||
public class ActivityReimbursementBoardController {
|
||||
|
||||
@Inject
|
||||
private Vi vi;
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private ActivityBxService activityBxService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/jf/reimbursement/board.html")
|
||||
@RequiresPermissions("sys.jf.reimbursement.board")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
public Sql activityNum(Integer startYear, Integer endYear, Boolean isActivityMoney) {
|
||||
if (isActivityMoney) {
|
||||
return Sqls.create("SELECT SUM(activity_money) FROM activity_bx where activity_type = @type and `year`>=@startYear and `year`<=@endYear")
|
||||
.setParam("startYear", startYear).setParam("endYear", endYear);
|
||||
} else {
|
||||
return Sqls.create("""
|
||||
SELECT
|
||||
IF(
|
||||
abx.activity_number > 0 and abx.activity_number is not null,
|
||||
abx.activity_number,
|
||||
( SELECT count( userId ) FROM activity_tissue_person WHERE tissueId = abx.activity_id )) AS activityNum
|
||||
FROM
|
||||
activity_bx abx
|
||||
WHERE
|
||||
abx.activity_type = @type AND abx.`year` >= @startYear
|
||||
AND abx.`year` <= @endYear
|
||||
""").setParam("startYear", startYear).setParam("endYear", endYear);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@RequiresPermissions("sys.jf.reimbursement.board")
|
||||
public Object getNumData(@Param(value = "startYear", required = false) Integer startYear,
|
||||
@Param(value = "endYear", required = false) Integer endYear) {
|
||||
try {
|
||||
Sql schoolSignNum = activityNum(startYear, endYear, false).setParam("type", 40001);
|
||||
Sql unionSignNum = activityNum(startYear, endYear, false).setParam("type", 40002);
|
||||
Sql clubSignNum = activityNum(startYear, endYear, false).setParam("type", 40003);
|
||||
|
||||
Sql schoolActivityMoney = activityNum(startYear, endYear, true).setParam("type", 40001);
|
||||
Sql unionActivityMoney = activityNum(startYear, endYear, true).setParam("type", 40002);
|
||||
Sql clubActivityMoney = activityNum(startYear, endYear, true).setParam("type", 40003);
|
||||
Map result = new HashMap() {{
|
||||
put("schoolSignNum", activityBxService.listMap(schoolSignNum).stream().mapToInt(v->v.getInt("activityNum")).sum());
|
||||
put("unionSignNum", activityBxService.listMap(unionSignNum).stream().mapToInt(v->v.getInt("activityNum")).sum());
|
||||
put("clubSignNum", activityBxService.listMap(clubSignNum).stream().mapToInt(v->v.getInt("activityNum")).sum());
|
||||
put("schoolActivityMoney", activityBxService.count(schoolActivityMoney));
|
||||
put("unionActivityMoney", activityBxService.count(unionActivityMoney));
|
||||
put("clubActivityMoney", activityBxService.count(clubActivityMoney));
|
||||
}};
|
||||
|
||||
return Result.success().addData(result);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@RequiresPermissions("sys.jf.reimbursement.board")
|
||||
public Object getActivityTypeChart(@Param(value = "startYear", required = false) Integer startYear,
|
||||
@Param(value = "endYear", required = false) Integer endYear) {
|
||||
try {
|
||||
Sql sql1 = Sqls.create("SELECT count(1) FROM activity_bx WHERE activity_type=40001 and `year` = @year");
|
||||
Sql sql2 = Sqls.create("SELECT count(1) FROM activity_bx WHERE activity_type=40002 and `year` = @year");
|
||||
Sql sql3 = Sqls.create("SELECT count(1) FROM activity_bx WHERE activity_type=40003 and `year` = @year");
|
||||
|
||||
List<NutMap> list = new ArrayList<>();
|
||||
if (startYear == null || endYear == null) {
|
||||
int nowYear = DateUtil.thisYear();
|
||||
startYear = nowYear - 9;
|
||||
endYear = nowYear;
|
||||
}
|
||||
|
||||
for (int i = startYear; i <= endYear; i++) {
|
||||
final int year = i;
|
||||
list.add(new NutMap() {{
|
||||
put("year", year);
|
||||
put("type", "校工会活动");
|
||||
put("num", activityBxService.count(sql1.setParam("year", year)));
|
||||
}});
|
||||
|
||||
list.add(new NutMap() {{
|
||||
put("year", year);
|
||||
put("type", "分工会活动");
|
||||
put("num", activityBxService.count(sql2.setParam("year", year)));
|
||||
}});
|
||||
|
||||
list.add(new NutMap() {{
|
||||
put("year", year);
|
||||
put("type", "社团活动");
|
||||
put("num", activityBxService.count(sql3.setParam("year", year)));
|
||||
}});
|
||||
}
|
||||
return Result.success().addData(list);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@RequiresPermissions("sys.jf.reimbursement.board")
|
||||
public Object getActivityTypePieNum(@Param(value = "startYear", required = false) Integer startYear,
|
||||
@Param(value = "endYear", required = false) Integer endYear) {
|
||||
try {
|
||||
Sql sql1 = Sqls.create("SELECT count(1) from activity_bx where activity_type = 40001 and `year`<=@startYear and `year`>=@endYear").setParam("startYear", startYear).setParam("endYear", endYear);
|
||||
Sql sql2 = Sqls.create("SELECT count(1) from activity_bx where activity_type = 40002 and `year`<=@startYear and `year`>=@endYear").setParam("startYear", startYear).setParam("endYear", endYear);
|
||||
Sql sql3 = Sqls.create("SELECT count(1) from activity_bx where activity_type = 40003 and `year`<=@startYear and `year`>=@endYear").setParam("startYear", startYear).setParam("endYear", endYear);
|
||||
|
||||
List<NutMap> list = new ArrayList<>();
|
||||
list.add(new NutMap() {{
|
||||
put("type", "校工会活动");
|
||||
put("num", activityBxService.count(sql1));
|
||||
}});
|
||||
list.add(new NutMap() {{
|
||||
put("type", "分工会活动");
|
||||
put("num", activityBxService.count(sql2));
|
||||
}});
|
||||
list.add(new NutMap() {{
|
||||
put("type", "社团活动");
|
||||
put("num", activityBxService.count(sql3));
|
||||
}});
|
||||
return Result.success().addData(list);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@RequiresPermissions("sys.jf.reimbursement.board")
|
||||
public Object getActivityJfChart(@Param(value = "startYear", required = false) Integer startYear,
|
||||
@Param(value = "endYear", required = false) Integer endYear) {
|
||||
try {
|
||||
Sql sql1 = Sqls.create("SELECT IFNULL(sum(activity_money),0) jf FROM activity_bx WHERE activity_type=40001 and `year` = @year");
|
||||
Sql sql2 = Sqls.create("SELECT IFNULL(sum(activity_money),0) jf FROM activity_bx WHERE activity_type=40002 and `year` = @year");
|
||||
Sql sql3 = Sqls.create("SELECT IFNULL(sum(activity_money),0) jf FROM activity_bx WHERE activity_type=40003 and `year` = @year");
|
||||
|
||||
List<NutMap> list = new ArrayList<>();
|
||||
if (startYear == null || endYear == null) {
|
||||
int nowYear = DateUtil.thisYear();
|
||||
startYear = nowYear - 9;
|
||||
endYear = nowYear;
|
||||
}
|
||||
|
||||
for (int i = startYear; i <= endYear; i++) {
|
||||
final int year = i;
|
||||
list.add(new NutMap() {{
|
||||
put("year", year);
|
||||
put("type", "校工会经费");
|
||||
put("num", activityBxService.list(sql1.setParam("year", year)).get(0).getDouble("jf"));
|
||||
}});
|
||||
|
||||
list.add(new NutMap() {{
|
||||
put("year", year);
|
||||
put("type", "分工会经费");
|
||||
put("num", activityBxService.list(sql2.setParam("year", year)).get(0).getDouble("jf"));
|
||||
}});
|
||||
|
||||
list.add(new NutMap() {{
|
||||
put("year", year);
|
||||
put("type", "社团经费");
|
||||
put("num", activityBxService.list(sql3.setParam("year", year)).get(0).getDouble("jf"));
|
||||
}});
|
||||
}
|
||||
return Result.success().addData(list);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@RequiresPermissions("sys.jf.reimbursement.board")
|
||||
public Object getActivityJfPieNum(@Param(value = "startYear", required = false) Integer startYear,
|
||||
@Param(value = "endYear", required = false) Integer endYear) {
|
||||
try {
|
||||
Sql schoolSql = activityNum(startYear, endYear, true).setParam("type", 40001);
|
||||
Sql unionSql = activityNum(startYear, endYear, true).setParam("type", 40002);
|
||||
Sql clubSql = activityNum(startYear, endYear, true).setParam("type", 40003);
|
||||
List<NutMap> list = new ArrayList<>();
|
||||
list.add(new NutMap() {{
|
||||
put("type", "校工会经费");
|
||||
put("num", activityBxService.count(schoolSql));
|
||||
}});
|
||||
list.add(new NutMap() {{
|
||||
put("type", "分工会经费");
|
||||
put("num", activityBxService.count(unionSql));
|
||||
}});
|
||||
list.add(new NutMap() {{
|
||||
put("type", "社团经费");
|
||||
put("num", activityBxService.count(clubSql));
|
||||
}});
|
||||
return Result.success().addData(list);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@RequiresPermissions("sys.jf.reimbursement.board")
|
||||
public Object allUnionActivityAndJf(@Param(value = "year", required = false) Integer year,
|
||||
@Param(value = "isUnionJf", required = false) Boolean isUnionJf) {
|
||||
try {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
su.unionname,
|
||||
$unionSql
|
||||
FROM
|
||||
sys_union su
|
||||
LEFT JOIN `user` u ON u.unionid = su.id
|
||||
LEFT JOIN activity_bx bx ON u.id = bx.user_id AND bx.activity_type = 40002 AND bx.`year` = @year
|
||||
GROUP BY
|
||||
su.unionname
|
||||
ORDER BY
|
||||
su.unionname
|
||||
""").setParam("year", year);
|
||||
|
||||
sql.setVar("unionSql", isUnionJf ? new Static(" COALESCE(SUM(bx.activity_money), 0) AS money ") : new Static(" count(bx.id) as money "));
|
||||
List<NutMap> list = activityBxService.listMap(sql);
|
||||
return Result.success().addData(list);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@RequiresPermissions("sys.jf.reimbursement.board")
|
||||
public Object allClubActivityAndJf(@Param(value = "year", required = false) Integer year,
|
||||
@Param(value = "isClubJf", required = false) Boolean isClubJf) {
|
||||
try {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
sc.`name` AS clubName,
|
||||
$clubSql
|
||||
FROM
|
||||
sys_club sc
|
||||
LEFT JOIN activity_bx bx ON bx.user_id = sc.fzr
|
||||
AND bx.`year` = @year
|
||||
AND bx.activity_type = 40003
|
||||
GROUP BY
|
||||
sc.id
|
||||
ORDER BY
|
||||
sc.`name`
|
||||
""").setParam("year", year);
|
||||
sql.setVar("clubSql", isClubJf ? new Static(" COALESCE(SUM(bx.activity_money), 0) AS money ") : new Static(" count(bx.id) as money "));
|
||||
List<NutMap> list = activityBxService.listMap(sql);
|
||||
return Result.success().addData(list);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
}
|
||||
+118
@@ -0,0 +1,118 @@
|
||||
package io.v.nutz.zhgh.jf.controller.reimbursement;
|
||||
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.zhgh.jf.handle.reimbursement.ReimbursementToHandler;
|
||||
import io.v.nutz.zhgh.jf.service.ActivityBxService;
|
||||
import io.v.nutz.base.model.Audit;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.web.commons.slog.annotation.SLog;
|
||||
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.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:ActivityReimbursementClubChairmanController
|
||||
* @Date 2024/4/26 14:58
|
||||
* @注释 活动报销,协会负责人审核
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/jf/reimbursement/clubChairman")
|
||||
public class ActivityReimbursementClubChairmanController {
|
||||
|
||||
@Inject
|
||||
private Vi vi;
|
||||
|
||||
@Inject
|
||||
private ActivityBxService activityBxService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/jf/reimbursement/clubChairman.html")
|
||||
@RequiresPermissions("sys.jf.reimbursement.clubChairman")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 活动报销协会审核
|
||||
* @param pageForm
|
||||
* @param year
|
||||
* @param clubId
|
||||
* @param activityName
|
||||
* @param isAudit 0,全部;1,已审核;2,未审核
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("sys.jf.reimbursement.clubChairman")
|
||||
public Object pageData(PageForm pageForm,
|
||||
@Param(value = "year", required = false) Integer year,
|
||||
@Param(value = "clubId", required = false) String clubId,
|
||||
@Param(value = "activityName", required = false) String activityName,
|
||||
@Param(value = "isAudit", required = false) String isAudit) {
|
||||
Sql sql = activityBxService.activityReimbursementSql();
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("act.`year`","=",year);
|
||||
if (StrUtil.isNotBlank(activityName)) {
|
||||
cnd.and(Cnd.likeEX("act.activity_name", activityName));
|
||||
}
|
||||
|
||||
cnd.and("act.reimbursement_state_id","is not",null);
|
||||
|
||||
//1已审核;2未审核;0全部
|
||||
cnd.and("act.reimbursement_state_id", "1".equals(isAudit) ? ">" : "2".equals(isAudit) ? "=" : ">=", 1000);
|
||||
|
||||
if (ShiroUtil.hasAnyRoles("sysadmin,A06")){
|
||||
cnd.andEX("act.clubId","=",clubId);
|
||||
} else {
|
||||
cnd.and("act.clubId","=",vi.getClubId());
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return activityBxService.listPageMap(pageForm.getPageNumber(),pageForm.getPageSize(),sql);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("sys.jf.reimbursement.clubChairman")
|
||||
@SLog(type = "文体活动", tag = "活动报销", msg = "协会负责人审核", param = true, result = true)
|
||||
public Object doAuditing(@Param("id") String id,@Param("audit") Audit audit){
|
||||
audit.setAuditor(ShiroUtil.getPrincipalProperty("id").toString());
|
||||
audit.setUsername(ShiroUtil.getPrincipalProperty("username").toString());
|
||||
audit.setLoginname(ShiroUtil.getPrincipalProperty("loginname").toString());
|
||||
audit.setAuditTime(new Date());
|
||||
activityBxService.dao().insert(audit);
|
||||
|
||||
Chain chain = Chain.make("reimbursement_club_audit_id", audit.getId());
|
||||
chain.add("reimbursement_state_id", audit.getAuditPass() ? 1020 : 1005);
|
||||
activityBxService.update(chain,Cnd.where("id","=",id));
|
||||
|
||||
ReimbursementToHandler.COMPLETE_CLUB_TASK.exec(id, NutMap.NEW().addv("nodeName",audit.getAuditPass() ? "协会负责人通过" : "协会负责人拒绝"));
|
||||
if (audit.getAuditPass()) {
|
||||
ReimbursementToHandler.CREATE_SCHOOL_DIRECTOR_TASK.exec(id,null);
|
||||
} else {
|
||||
ReimbursementToHandler.REFUSE_UNION_TASK.exec(id,NutMap.NEW().addv("nodeName","协会负责人拒绝"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+255
@@ -0,0 +1,255 @@
|
||||
package io.v.nutz.zhgh.jf.controller.reimbursement;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.v.nutz.zhgh.activity.models.ActivityTissuePerson;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.zhgh.jf.handle.reimbursement.ReimbursementToHandler;
|
||||
import io.v.nutz.zhgh.jf.model.ActivityBx;
|
||||
import io.v.nutz.zhgh.jf.service.ActivityBxService;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.sys.models.Sys_file;
|
||||
import io.v.nutz.sys.models.Sys_union;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.base.utils.ViTool;
|
||||
import io.v.nutz.web.commons.utils.FileUtil;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.boot.starter.ftp.FtpService;
|
||||
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.cri.SqlExpressionGroup;
|
||||
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.random.R;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:ActivityReimbursementMineController
|
||||
* @Date 2024/4/26 14:58
|
||||
* @注释 活动报销,我的报销
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/jf/reimbursement/mine")
|
||||
public class ActivityReimbursementMineController {
|
||||
|
||||
|
||||
@Inject
|
||||
private Vi vi;
|
||||
|
||||
@Inject
|
||||
private ActivityBxService activityBxService;
|
||||
|
||||
@Inject
|
||||
private FtpService ftpService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/jf/reimbursement/mine.html")
|
||||
@RequiresPermissions("sys.jf.reimbursement.mine")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("sys.jf.reimbursement.mine")
|
||||
public Object pageData(PageForm pageForm,
|
||||
@Param(value = "year", required = false) Integer year,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "activityName", required = false) String activityName) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
act.*,
|
||||
u.loginname bxr_loginname,
|
||||
u.unionname bxr_unionname,
|
||||
un.unionname,
|
||||
s.state_name,
|
||||
s.state_color,
|
||||
abs.`name` absName
|
||||
FROM
|
||||
`activity_bx` act
|
||||
LEFT JOIN `user` u ON act.user_id = u.id
|
||||
LEFT JOIN sys_unit su ON su.id = u.unitid
|
||||
LEFT JOIN sys_union un ON su.unionid = un.id
|
||||
LEFT JOIN state s ON act.reimbursement_state_id = s.state_id
|
||||
LEFT JOIN activity_basic_settings abs ON abs.`code` = act.projectTypeCode
|
||||
LEFT JOIN sys_club_user scu ON scu.userid=act.user_id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) {
|
||||
SqlExpressionGroup group2 = new SqlExpressionGroup();
|
||||
if (ShiroUtil.hasAnyRoles("gh01,H04")) {
|
||||
group2.or("u.unionid", "=", vi.getUnionId());
|
||||
} else if (ShiroUtil.hasRole("H02")) {
|
||||
group2.or("scu.clubid", "=", vi.getClubId());
|
||||
} else {
|
||||
group2.or("act.user_id", "=", ShiroUtil.getUserId());
|
||||
}
|
||||
cnd.and(group2);
|
||||
}
|
||||
|
||||
cnd.andEX("act.`year`", "=", year);
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchName()) && StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.where().andLike(pageForm.getSearchName(), pageForm.getSearchKeyword());
|
||||
}
|
||||
cnd.andEX("u.unitid", "=", unitId);
|
||||
cnd.andEX("u.unionid", "=", unionId);
|
||||
cnd.andEX("act.activity_name", "=", activityName);
|
||||
cnd.and("reimbursement_state_id", "is not", null);
|
||||
cnd.and("reimbursement_state_id", "!=", "");
|
||||
|
||||
cnd.groupBy("act.id");
|
||||
if (StrUtil.isNotBlank(pageForm.getPageOrderName()) && StrUtil.isNotBlank(pageForm.getPageOrderBy())) {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), pageForm.getPageOrderBy());
|
||||
} else {
|
||||
cnd.asc("act.reimbursement_state_id").desc("act.apply_time");
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return activityBxService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("sys.jf.reimbursement.mine")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Object doDelete(String id) {
|
||||
activityBxService.update(Chain.make("reimbursement_state_id", null)
|
||||
.add("reimbursement_apply_time", null).add("reimbursement_state_id",null),
|
||||
Cnd.where("id", "=", id));
|
||||
ReimbursementToHandler.DELETE_PROCESS_AND_TASK.exec(id,null);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@RequiresPermissions("sys.jf.reimbursement.mine")
|
||||
public void exportAllFiles(String id, String exportType, HttpServletResponse response) {
|
||||
|
||||
response.reset();
|
||||
response.setContentType("application/x-msdownload;charset=utf-8");
|
||||
|
||||
/**
|
||||
* 创建临时文件夹
|
||||
*/
|
||||
String tmpPath = "tmp/" + R.UU32();
|
||||
File tmpDir = new File(tmpPath + "/活动报销附件汇总");
|
||||
tmpDir.mkdirs();
|
||||
|
||||
|
||||
List<Sys_file> allFiles = new ArrayList<>();
|
||||
|
||||
NutMap nutMap = activityBxService.queryOne(id);
|
||||
List<Sys_file> billFiles = JSONObject.parseArray(nutMap.getString("billFiles"), Sys_file.class);
|
||||
List<Sys_file> photoFiles = JSONObject.parseArray(nutMap.getString("photoFiles"), Sys_file.class);
|
||||
List<Sys_file> otherFiles = JSONObject.parseArray(nutMap.getString("otherFiles"), Sys_file.class);
|
||||
|
||||
|
||||
if ("all".equals(exportType)) {
|
||||
if (Lang.isNotEmpty(billFiles)) allFiles.addAll(billFiles);
|
||||
if (Lang.isNotEmpty(photoFiles)) allFiles.addAll(photoFiles);
|
||||
if (Lang.isNotEmpty(otherFiles)) allFiles.addAll(otherFiles);
|
||||
} else if ("billFiles".equals(exportType)) {
|
||||
allFiles.addAll(billFiles);
|
||||
} else if ("photoFiles".equals(exportType)) {
|
||||
if (Lang.isNotEmpty(photoFiles)) allFiles.addAll(photoFiles);
|
||||
} else if ("otherFiles".equals(exportType)) {
|
||||
if (Lang.isNotEmpty(otherFiles)) allFiles.addAll(otherFiles);
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
/**
|
||||
* 创建临时文件夹
|
||||
*/
|
||||
String fileName = nutMap.getString("activity_name");
|
||||
|
||||
File tDir = new File(tmpDir + "/" + fileName);
|
||||
tDir.mkdirs();
|
||||
|
||||
for (Sys_file file : allFiles) {
|
||||
if (Lang.isNotEmpty(file)) {
|
||||
FileOutputStream outputStream = new FileOutputStream(tDir.getPath() + "/" + file.getFilename());
|
||||
ftpService.download(file.getFilepath(), outputStream);
|
||||
outputStream.close();
|
||||
}
|
||||
}
|
||||
|
||||
String aimsDir = "zipTmp/" + R.UU32();
|
||||
String aimsName = "活动报销附件汇总.zip";
|
||||
String aimsPath = aimsDir + "/" + aimsName;
|
||||
FileUtil.compressToZip(tmpDir.getPath(), aimsDir, aimsName);
|
||||
|
||||
response.setHeader("content-disposition", "attachment;filename="
|
||||
+ URLEncoder.encode(aimsName, "UTF-8"));
|
||||
|
||||
File aimsFile = new File(aimsPath);
|
||||
FileInputStream inputStream = new FileInputStream(aimsFile);
|
||||
IOUtils.copy(inputStream, response.getOutputStream());
|
||||
inputStream.close();
|
||||
aimsFile.delete();
|
||||
|
||||
FileUtil.deleteDir(new File(tmpPath));
|
||||
FileUtil.deleteDir(new File(aimsDir));
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@RequiresPermissions("sys.jf.reimbursement.mine")
|
||||
public void exportActivityJoinUser(String id, HttpServletResponse response) {
|
||||
List<ActivityTissuePerson> tissueUserList = activityBxService.dao().query(ActivityTissuePerson.class, Cnd.where("tissueId", "=", id));
|
||||
ActivityBx activityBx = activityBxService.fetch(id);
|
||||
List<ExcelExportEntity> exportEntities = new ArrayList<>();
|
||||
exportEntities.add(new ExcelExportEntity("工号", "loginName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("姓名", "userName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("性别", "sex", 20));
|
||||
exportEntities.add(new ExcelExportEntity("联系电话", "mobile", 20));
|
||||
exportEntities.add(new ExcelExportEntity("所属工会", "unionName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("所属单位", "unitName", 20));
|
||||
|
||||
try {
|
||||
ViTool.excelResponse(response, activityBx.getActivity_name() + "活动报名人员.xls");
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), exportEntities, tissueUserList);
|
||||
workbook.write(response.getOutputStream());
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
package io.v.nutz.zhgh.jf.controller.reimbursement;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.zhgh.jf.handle.reimbursement.ReimbursementToHandler;
|
||||
import io.v.nutz.zhgh.jf.service.ActivityBxService;
|
||||
import io.v.nutz.base.model.Audit;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.web.commons.slog.annotation.SLog;
|
||||
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.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:ActivityReimbursementSchoolChairmanController
|
||||
* @Date 2024/4/26 14:58
|
||||
* @注释 报销,校工会主席审核
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/jf/reimbursement/schoolChairman")
|
||||
public class ActivityReimbursementSchoolChairmanController {
|
||||
|
||||
@Inject
|
||||
private ActivityBxService activityBxService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/jf/reimbursement/schoolChairman.html")
|
||||
@RequiresPermissions("sys.jf.reimbursement.schoolChairman")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("sys.jf.reimbursement.schoolChairman")
|
||||
public Object pageData(PageForm pageForm,
|
||||
@Param(value = "year", required = false) Integer year,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "clubId",required = false) String clubId,
|
||||
@Param(value = "activityName", required = false) String activityName,
|
||||
@Param(value = "isAudit", required = false) String isAudit) {
|
||||
Sql sql = activityBxService.activityReimbursementSql();
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("act.`year`","=",year);
|
||||
if (StrUtil.isNotBlank(activityName)) {
|
||||
cnd.and(Cnd.likeEX("act.activity_name", activityName));
|
||||
}
|
||||
|
||||
//1已审核;2未审核;0全部
|
||||
cnd.and("act.reimbursement_state_id", "1".equals(isAudit) ? ">" : "2".equals(isAudit) ? "=" : ">=", 1040);
|
||||
|
||||
cnd.andEX("u.unionid","=",unionId);
|
||||
cnd.andEX("u.unitId","=",unitId);
|
||||
cnd.andEX("act.clubId","=",clubId);
|
||||
sql.setCondition(cnd);
|
||||
return activityBxService.listPageMap(pageForm.getPageNumber(),pageForm.getPageSize(),sql);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("sys.jf.reimbursement.schoolChairman")
|
||||
@SLog(type = "文体活动", tag = "活动报销", msg = "校工会主席审核", param = true, result = true)
|
||||
public Object doAuditing(@Param("id") String id,@Param("audit") Audit audit){
|
||||
audit.setAuditor(ShiroUtil.getPrincipalProperty("id").toString());
|
||||
audit.setUsername(ShiroUtil.getPrincipalProperty("username").toString());
|
||||
audit.setLoginname(ShiroUtil.getPrincipalProperty("loginname").toString());
|
||||
audit.setAuditTime(new Date());
|
||||
activityBxService.dao().insert(audit);
|
||||
|
||||
Chain chain = Chain.make("reimbursement_school_chairman_id", audit.getId());
|
||||
chain.add("reimbursement_state_id", audit.getAuditPass() ? 1061 : 1045);
|
||||
activityBxService.update(chain,Cnd.where("id","=",id));
|
||||
|
||||
ReimbursementToHandler.COMPLETE_SCHOOL_CHAIRMAN_TASK.exec(id, NutMap.NEW().addv("nodeName",audit.getAuditPass() ? "校工会主席通过" : "校工会主席拒绝"));
|
||||
if (audit.getAuditPass()) {
|
||||
ReimbursementToHandler.COMPLETE_PROCESS.exec(id,null);
|
||||
} else {
|
||||
ReimbursementToHandler.REFUSE_UNION_TASK.exec(id,NutMap.NEW().addv("nodeName","校工会主席拒绝"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
package io.v.nutz.zhgh.jf.controller.reimbursement;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.zhgh.jf.handle.reimbursement.ReimbursementToHandler;
|
||||
import io.v.nutz.zhgh.jf.service.ActivityBxService;
|
||||
import io.v.nutz.base.model.Audit;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.web.commons.slog.annotation.SLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:ActivityReimbursementSchoolDirectorController
|
||||
* @Date 2024/4/26 14:58
|
||||
* @注释 报销校工会负责人审核
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/jf/reimbursement/schoolDirector")
|
||||
public class ActivityReimbursementSchoolDirectorController {
|
||||
|
||||
@Inject
|
||||
private ActivityBxService activityBxService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/jf/reimbursement/schoolDirector.html")
|
||||
@RequiresPermissions("sys.jf.reimbursement.schoolDirector")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("sys.jf.reimbursement.schoolDirector")
|
||||
public Object pageData(PageForm pageForm,
|
||||
@Param(value = "year", required = false) Integer year,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "clubId",required = false) String clubId,
|
||||
@Param(value = "activityName", required = false) String activityName,
|
||||
@Param(value = "isAudit", required = false) String isAudit) {
|
||||
Sql sql = activityBxService.activityReimbursementSql();
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("act.`year`","=",year);
|
||||
if (StrUtil.isNotBlank(activityName)) {
|
||||
cnd.and(Cnd.likeEX("act.activity_name", activityName));
|
||||
}
|
||||
|
||||
//1已审核;2未审核;0全部
|
||||
cnd.and("act.reimbursement_state_id", "1".equals(isAudit) ? ">" : "2".equals(isAudit) ? "=" : ">=", 1020);
|
||||
|
||||
cnd.andEX("u.unionid","=",unionId);
|
||||
cnd.andEX("u.unitId","=",unitId);
|
||||
cnd.andEX("act.clubId","=",clubId);
|
||||
sql.setCondition(cnd);
|
||||
return activityBxService.listPageMap(pageForm.getPageNumber(),pageForm.getPageSize(),sql);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("sys.jf.reimbursement.schoolDirector")
|
||||
@SLog(type = "文体活动", tag = "活动报销", msg = "校工会负责人审核", param = true, result = true)
|
||||
public Object doAuditing(@Param("id") String id,@Param("audit") Audit audit){
|
||||
audit.setAuditor(ShiroUtil.getPrincipalProperty("id").toString());
|
||||
audit.setUsername(ShiroUtil.getPrincipalProperty("username").toString());
|
||||
audit.setLoginname(ShiroUtil.getPrincipalProperty("loginname").toString());
|
||||
audit.setAuditTime(new Date());
|
||||
activityBxService.dao().insert(audit);
|
||||
|
||||
Chain chain = Chain.make("reimbursement_school_director_id", audit.getId());
|
||||
//通过,校工会主席审核
|
||||
chain.add("reimbursement_state_id", audit.getAuditPass() ? 1040 : 1025);
|
||||
activityBxService.update(chain,Cnd.where("id","=",id));
|
||||
|
||||
ReimbursementToHandler.COMPLETE_SCHOOL_DIRECTOR_TASK.exec(id, NutMap.NEW().addv("nodeName",audit.getAuditPass() ? "校工会负责人通过" : "校工会负责人拒绝"));
|
||||
if (audit.getAuditPass()) {
|
||||
ReimbursementToHandler.CREATE_SCHOOL_CHAIRMAN_TASK.exec(id,null);
|
||||
} else {
|
||||
ReimbursementToHandler.REFUSE_UNION_TASK.exec(id,NutMap.NEW().addv("nodeName","校工会负责人拒绝"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
package io.v.nutz.zhgh.jf.controller.reimbursement;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.zhgh.jf.model.ActivityBx;
|
||||
import io.v.nutz.zhgh.jf.service.ActivityBxService;
|
||||
import io.v.nutz.base.model.Audit;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.web.commons.slog.annotation.SLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:ActivityReimbursementStatisticsController
|
||||
* @Date 2024/4/26 14:58
|
||||
* @注释 活动报销,汇总统计
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/jf/reimbursement/statistics")
|
||||
public class ActivityReimbursementStatisticsController {
|
||||
|
||||
@Inject
|
||||
private ActivityBxService activityBxService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/jf/reimbursement/statistics.html")
|
||||
@RequiresPermissions("sys.jf.reimbursement.statistics")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("sys.jf.reimbursement.statistics")
|
||||
public Object pageData(PageForm pageForm,
|
||||
@Param(value = "year", required = false) Integer year,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "clubId", required = false) String clubId,
|
||||
@Param(value = "activityType",required = false) String activityType,
|
||||
@Param(value = "activityName", required = false) String activityName) {
|
||||
Sql sql = activityBxService.activityReimbursementSql();
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("act.`year`","=",year);
|
||||
if (StrUtil.isNotBlank(activityName)) {
|
||||
cnd.and(Cnd.likeEX("act.activity_name", activityName));
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(activityType) && !"0".equals(activityType)){
|
||||
cnd.and("act.activity_type","=",activityType);
|
||||
}
|
||||
|
||||
cnd.andEX("u.unionid","=",unionId);
|
||||
cnd.andEX("u.unitId","=",unitId);
|
||||
cnd.andEX("act.clubId","=",clubId);
|
||||
cnd.andEX("act.reimbursement_state_id","=",1061);
|
||||
sql.setCondition(cnd);
|
||||
return activityBxService.listPageMap(pageForm.getPageNumber(),pageForm.getPageSize(),sql);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("sys.jf.reimbursement.statistics")
|
||||
public Object getActivityTypeNum(Integer year){
|
||||
List<ActivityBx> list = activityBxService.query(Cnd.where("`year`", "=", year).and("reimbursement_state_id","=",1061));
|
||||
Integer schoolNum = (int) list.stream().filter(v -> v.getActivity_type() == 40001).count();
|
||||
Integer unionNum = (int) list.stream().filter(v -> v.getActivity_type() == 40002).count();
|
||||
Integer clubNum = (int) list.stream().filter(v -> v.getActivity_type() == 40003).count();
|
||||
NutMap map = new NutMap();
|
||||
return map.addv("all",list.size()).addv("school",schoolNum).addv("union",unionNum).addv("club",clubNum);
|
||||
}
|
||||
|
||||
}
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
package io.v.nutz.zhgh.jf.controller.reimbursement;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.zhgh.jf.handle.reimbursement.ReimbursementToHandler;
|
||||
import io.v.nutz.zhgh.jf.service.ActivityBxService;
|
||||
import io.v.nutz.base.model.Audit;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.web.commons.slog.annotation.SLog;
|
||||
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.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:ActivityReimbursementUnionChairmanController
|
||||
* @Date 2024/4/26 14:58
|
||||
* @注释 活动报销,分工会主席审核
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/jf/reimbursement/unionChairman")
|
||||
public class ActivityReimbursementUnionChairmanController {
|
||||
|
||||
@Inject
|
||||
private ActivityBxService activityBxService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/jf/reimbursement/unionChairman.html")
|
||||
@RequiresPermissions("sys.jf.reimbursement.unionChairman")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("sys.jf.reimbursement.unionChairman")
|
||||
public Object pageData(PageForm pageForm,
|
||||
@Param(value = "year", required = false) Integer year,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "activityName", required = false) String activityName,
|
||||
@Param(value = "isAudit", required = false) String isAudit) {
|
||||
Sql sql = activityBxService.activityReimbursementSql();
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("act.`year`","=",year);
|
||||
if (StrUtil.isNotBlank(activityName)) {
|
||||
cnd.and(Cnd.likeEX("act.activity_name", activityName));
|
||||
}
|
||||
|
||||
//1已审核;2未审核;0全部
|
||||
cnd.and("act.reimbursement_state_id", "1".equals(isAudit) ? ">" : "2".equals(isAudit) ? "=" : ">=", 1010);
|
||||
|
||||
if (ShiroUtil.hasAnyRoles("sysadmin,A06")){
|
||||
cnd.andEX("u.unionid","=",unionId);
|
||||
} else {
|
||||
cnd.and("u.unionid","=", Vi.getUnionId());
|
||||
}
|
||||
cnd.andEX("u.unitId","=",unitId);
|
||||
sql.setCondition(cnd);
|
||||
return activityBxService.listPageMap(pageForm.getPageNumber(),pageForm.getPageSize(),sql);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 基层工会活动报销
|
||||
* 基层工会活动——>基层工会主席审核——>校工会主席审核——>流程结束
|
||||
* @param id
|
||||
* @param audit
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("sys.jf.reimbursement.unionChairman")
|
||||
@SLog(type = "文体活动", tag = "活动报销", msg = "分工会主席审核", param = true, result = true)
|
||||
public Object doAuditing(@Param("id") String id,@Param("audit") Audit audit){
|
||||
audit.setAuditor(ShiroUtil.getPrincipalProperty("id").toString());
|
||||
audit.setUsername(ShiroUtil.getPrincipalProperty("username").toString());
|
||||
audit.setLoginname(ShiroUtil.getPrincipalProperty("loginname").toString());
|
||||
audit.setAuditTime(new Date());
|
||||
activityBxService.dao().insert(audit);
|
||||
|
||||
Chain chain = Chain.make("reimbursement_union_audit_id", audit.getId());
|
||||
//通过,校工会主席审核
|
||||
chain.add("reimbursement_state_id", audit.getAuditPass() ? 1020 : 1015);
|
||||
activityBxService.update(chain,Cnd.where("id","=",id));
|
||||
|
||||
ReimbursementToHandler.COMPLETE_UNION_TASK.exec(id, NutMap.NEW().addv("nodeName",audit.getAuditPass() ? "基层工会通过" : "基层工会拒绝"));
|
||||
if (audit.getAuditPass()) {
|
||||
ReimbursementToHandler.CREATE_SCHOOL_DIRECTOR_TASK.exec(id,null);
|
||||
} else {
|
||||
ReimbursementToHandler.REFUSE_UNION_TASK.exec(id,NutMap.NEW().addv("nodeName","基层工会拒绝"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ 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;
|
||||
@@ -73,7 +74,7 @@ public class jfsyController {
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (ShiroUtil.hasRole("sysadmin") || ShiroUtil.hasRole("SchoolUnionAdmin")) {
|
||||
if (ShiroUtil.hasRole("sysadmin") || ShiroUtil.hasRole("A06")) {
|
||||
cnd.andEX("yjgh.id", "=", unionId);
|
||||
} else if (ShiroUtil.hasRole("H04")) {
|
||||
//基层工会管理员
|
||||
@@ -119,7 +120,7 @@ public class jfsyController {
|
||||
"ON jf.unionId = yjgh.id \n" +
|
||||
"AND jf.`year` = @year $condition");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (ShiroUtil.hasRole("sysadmin") || ShiroUtil.hasRole("SchoolUnionAdmin")) {
|
||||
if (ShiroUtil.hasRole("sysadmin") || ShiroUtil.hasRole("A06")) {
|
||||
|
||||
} else if (ShiroUtil.hasRole("H04")) {
|
||||
//基层工会管理员
|
||||
|
||||
@@ -10,6 +10,7 @@ import io.v.nutz.zhgh.jf.model.jf_yjgh;
|
||||
import io.v.nutz.zhgh.jf.service.CostsSetService;
|
||||
import io.v.nutz.zhgh.jf.service.jfYjghService;
|
||||
import io.v.nutz.base.service.AsyncService;
|
||||
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;
|
||||
|
||||
@@ -0,0 +1,269 @@
|
||||
package io.v.nutz.zhgh.jf.handle.funds;
|
||||
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.base.utils.ViResource;
|
||||
import io.v.nutz.sys.services.SysLocalProcessService;
|
||||
import io.v.nutz.sys.services.impl.SysLocalProcessServiceImpl;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import lombok.Getter;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName FundsToHandler
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2024/5/20 14:41
|
||||
*/
|
||||
@Getter
|
||||
public enum FundsToHandler {
|
||||
|
||||
/**
|
||||
* 流程开始
|
||||
*/
|
||||
START_PROCESS() {
|
||||
@Override
|
||||
public void exec(String reimbursementId, NutMap extra, List<String> loginNames) {
|
||||
Sql sql = Sqls.fetchString(Sqls.create("select username from sys_user where id = @id").setParam("id", extra.getString("userId")).toString());
|
||||
dao.execute(sql);
|
||||
String username = sql.getString();
|
||||
|
||||
localProcessService.startProcess(
|
||||
"【活动申报】申报人:" + username + ",活动名称:" + extra.getString("activityName"),
|
||||
"funds_apply@" + reimbursementId,
|
||||
"",
|
||||
extra.getString("userId"),
|
||||
"/platform/jf/activity_bx/reimbursement",
|
||||
"/platform/jf/activity_bx/reimbursement"
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 审核拒绝
|
||||
*/
|
||||
REFUSE_TASK() {
|
||||
@Override
|
||||
public void exec(String reimbursementId, NutMap extra, List<String> loginNames) {
|
||||
localProcessService.refuseProcess("funds_apply@" + reimbursementId, extra.getString("nodeName"));
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 审核退回,重新修改申请
|
||||
*/
|
||||
CREATE_APPLY_RE_MODIFY_TASK() {
|
||||
@Override
|
||||
public void exec(String reimbursementId, NutMap extra, List<String> loginNames) {
|
||||
Sql sql = Sqls.fetchString(Sqls.create("select loginname from sys_user where id = @id").setParam("id", extra.getString("userId")).toString());
|
||||
dao.execute(sql);
|
||||
String loginname = sql.getString();
|
||||
localProcessService.createTask(
|
||||
"funds_apply@" + reimbursementId,
|
||||
"back",
|
||||
"退回重新修改",
|
||||
ShiroUtil.getUserId(),
|
||||
List.of(loginname),
|
||||
"/platform/fw/singleChild/report",
|
||||
"/platform/fw/singleChild/report",
|
||||
"/platform/fw/singleChild/report",
|
||||
"/platform/fw/singleChild/report"
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 退回后完成
|
||||
*/
|
||||
COMPLETE_APPLY_RE_MODIFY_TASK() {
|
||||
@Override
|
||||
public void exec(String reimbursementId, NutMap extra, List<String> loginNames) {
|
||||
localProcessService.completeTask(
|
||||
"back",
|
||||
"funds_apply@" + reimbursementId,
|
||||
ShiroUtil.getUserId(),
|
||||
extra.getString("option")
|
||||
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 创建协会任务
|
||||
*/
|
||||
CREATE_CLUB_TASK() {
|
||||
@Override
|
||||
public void exec(String reimbursementId, NutMap extra, List<String> loginNames) {
|
||||
localProcessService.createTask(
|
||||
"funds_apply@" + reimbursementId,
|
||||
"funds_association",
|
||||
"协会负责人审核",
|
||||
ShiroUtil.getUserId(),
|
||||
loginNames,
|
||||
"/platform/jf/activity_bx/association",
|
||||
"/platform/jf/activity_bx/association",
|
||||
"/platform/jf/activity_bx/association",
|
||||
"/platform/jf/activity_bx/association"
|
||||
);
|
||||
|
||||
localProcessService.updateProcessNodeName("activity_reimbursement@" + reimbursementId, "协会负责人审核");
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 协会完成
|
||||
*/
|
||||
COMPLETE_CLUB_TASK() {
|
||||
@Override
|
||||
public void exec(String reimbursementId, NutMap extra, List<String> loginNames) {
|
||||
localProcessService.completeTask(
|
||||
"funds_association",
|
||||
"funds_apply@" + reimbursementId,
|
||||
ShiroUtil.getUserId(),
|
||||
extra.getString("option")
|
||||
);
|
||||
localProcessService.updateProcessNodeName("funds_apply@" + reimbursementId, extra.getString("option"));
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 创建分工会任务
|
||||
*/
|
||||
CREATE_UNION_TASK() {
|
||||
@Override
|
||||
public void exec(String reimbursementId, NutMap extra, List<String> loginNames) {
|
||||
localProcessService.createTask(
|
||||
"funds_apply@" + reimbursementId,
|
||||
"funds_division",
|
||||
"基层工会审核",
|
||||
ShiroUtil.getUserId(),
|
||||
loginNames,
|
||||
"/platform/jf/activity_bx/division",
|
||||
"/platform/jf/activity_bx/division",
|
||||
"/platform/jf/activity_bx/division",
|
||||
"/platform/jf/activity_bx/division"
|
||||
);
|
||||
|
||||
localProcessService.updateProcessNodeName("funds_apply@" + reimbursementId, "基层工会审核");
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 分工会完成
|
||||
*/
|
||||
COMPLETE_UNION_TASK() {
|
||||
@Override
|
||||
public void exec(String reimbursementId, NutMap extra, List<String> loginNames) {
|
||||
localProcessService.completeTask(
|
||||
"funds_division",
|
||||
"funds_apply@" + reimbursementId,
|
||||
ShiroUtil.getUserId(),
|
||||
extra.getString("option")
|
||||
);
|
||||
localProcessService.updateProcessNodeName("funds_apply@" + reimbursementId, extra.getString("option"));
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 创建校工会负责人任务
|
||||
*/
|
||||
CREATE_SCHOOL_FZR_TASK() {
|
||||
@Override
|
||||
public void exec(String reimbursementId, NutMap extra, List<String> loginNames) {
|
||||
localProcessService.createTask(
|
||||
"funds_apply@" + reimbursementId,
|
||||
"funds_accounting",
|
||||
"校工会负责人审核",
|
||||
ShiroUtil.getUserId(),
|
||||
loginNames,
|
||||
"/platform/jf/activity_bx/accounting",
|
||||
"/platform/jf/activity_bx/accounting",
|
||||
"/platform/jf/activity_bx/accounting",
|
||||
"/platform/jf/activity_bx/accounting"
|
||||
);
|
||||
|
||||
localProcessService.updateProcessNodeName("funds_apply@" + reimbursementId, "校工会负责人审核");
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 校工会负责人完成
|
||||
*/
|
||||
COMPLETE_SCHOOL_FZR_TASK() {
|
||||
@Override
|
||||
public void exec(String reimbursementId, NutMap extra, List<String> loginNames) {
|
||||
localProcessService.completeTask(
|
||||
"funds_accounting",
|
||||
"funds_apply@" + reimbursementId,
|
||||
ShiroUtil.getUserId(),
|
||||
extra.getString("option")
|
||||
);
|
||||
localProcessService.updateProcessNodeName("funds_apply@" + reimbursementId, extra.getString("option"));
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 创建校工会任务
|
||||
*/
|
||||
CREATE_SCHOOL_TASK() {
|
||||
@Override
|
||||
public void exec(String reimbursementId, NutMap extra, List<String> loginNames) {
|
||||
localProcessService.createTask(
|
||||
"funds_apply@" + reimbursementId,
|
||||
"funds_union",
|
||||
"校工会主席审核",
|
||||
ShiroUtil.getUserId(),
|
||||
loginNames,
|
||||
"/platform/jf/activity_bx/union",
|
||||
"/platform/jf/activity_bx/union",
|
||||
"/platform/jf/activity_bx/union",
|
||||
"/platform/jf/activity_bx/union"
|
||||
);
|
||||
|
||||
localProcessService.updateProcessNodeName("funds_apply@" + reimbursementId, "校工会主席审核");
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 校工会完成
|
||||
*/
|
||||
COMPLETE_SCHOOL_TASK() {
|
||||
@Override
|
||||
public void exec(String reimbursementId, NutMap extra, List<String> loginNames) {
|
||||
localProcessService.completeTask(
|
||||
"funds_union",
|
||||
"funds_apply@" + reimbursementId,
|
||||
ShiroUtil.getUserId(),
|
||||
extra.getString("option")
|
||||
);
|
||||
localProcessService.updateProcessNodeName("funds_apply@" + reimbursementId, extra.getString("option"));
|
||||
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 流程结束
|
||||
*/
|
||||
COMPLETE_PROCESS() {
|
||||
@Override
|
||||
public void exec(String reimbursementId, NutMap extra, List<String> loginNames) {
|
||||
localProcessService.completeProcess("funds_apply@" + reimbursementId);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 删除流程及任务
|
||||
*/
|
||||
DELETE_PROCESS_AND_TASK() {
|
||||
@Override
|
||||
public void exec (String reimbursementId, NutMap extra, List<String> loginNames){
|
||||
localProcessService.deleteProcessInstance("funds_apply@" + reimbursementId);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public abstract void exec(String reimbursementId, NutMap extra, List<String> loginNames);
|
||||
|
||||
public Dao dao = ViResource.dao;
|
||||
public Vi vi = ViResource.ioc.get(Vi.class);
|
||||
public SysLocalProcessService localProcessService = ViResource.ioc.get(SysLocalProcessServiceImpl.class);
|
||||
}
|
||||
+61
-53
@@ -1,10 +1,7 @@
|
||||
package io.v.nutz.zhgh.jf.handler.reimbursement;
|
||||
package io.v.nutz.zhgh.jf.handle.reimbursement;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import io.v.nutz.base.utils.Roles;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.base.utils.ViResource;
|
||||
import io.v.nutz.sys.models.Sys_club;
|
||||
import io.v.nutz.sys.models.User;
|
||||
import io.v.nutz.sys.services.SysLocalProcessService;
|
||||
import io.v.nutz.sys.services.impl.SysLocalProcessServiceImpl;
|
||||
@@ -14,11 +11,8 @@ import io.v.nutz.zhgh.zgfw.service.impl.CondolenceServiceImpl;
|
||||
import lombok.Getter;
|
||||
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.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -30,7 +24,7 @@ import java.util.stream.Collectors;
|
||||
* @注释 活动报销待办
|
||||
*/
|
||||
@Getter
|
||||
public enum ReimbursementToDoHandler {
|
||||
public enum ReimbursementToHandler {
|
||||
|
||||
/**
|
||||
* 流程开始
|
||||
@@ -42,12 +36,12 @@ public enum ReimbursementToDoHandler {
|
||||
User user = dao.fetch(User.class, Cnd.where("id", "=", userId));
|
||||
|
||||
localProcessService.startProcess(
|
||||
user.getUnionname() + "(" + user.getUsername() + ")【活动报销】申请",
|
||||
"【活动报销】" + user.getUnionname() + "(" + user.getUsername() + ")",
|
||||
"activity_reimbursement@" + reimbursementId,
|
||||
"",
|
||||
userId,
|
||||
"/platform/jf/funds/reimbursement",
|
||||
"/platform/jf/funds/reimbursement/mobile"
|
||||
"/platform/jf/reimbursement/mine",
|
||||
"/platform/jf/reimbursement/mine"
|
||||
);
|
||||
}
|
||||
},
|
||||
@@ -114,13 +108,13 @@ public enum ReimbursementToDoHandler {
|
||||
localProcessService.createTask(
|
||||
"activity_reimbursement@" + reimbursementId,
|
||||
"activity_reimbursement_union_audit",
|
||||
"分工会审核",
|
||||
"基层工会审核",
|
||||
ShiroUtil.getUserId(),
|
||||
unionLeader,
|
||||
"/platform/jf/funds/division",
|
||||
"/platform/jf/funds/division",
|
||||
"/platform/jf/funds/division",
|
||||
"/platform/jf/funds/division"
|
||||
"/platform/jf/reimbursement/unionChairman",
|
||||
"/platform/jf/reimbursement/unionChairman",
|
||||
"/platform/jf/reimbursement/unionChairman",
|
||||
"/platform/jf/reimbursement/unionChairman"
|
||||
);
|
||||
|
||||
localProcessService.updateProcessNodeName("activity_reimbursement@" + reimbursementId, "基层工会审核");
|
||||
@@ -152,35 +146,8 @@ public enum ReimbursementToDoHandler {
|
||||
CREATE_CLUB_TASK() {
|
||||
@Override
|
||||
public void exec(String reimbursementId, NutMap extra) {
|
||||
//先获取当前登录用户的协会信息
|
||||
String clubName = extra.getString("clubName");
|
||||
Sys_club club = dao.fetch(Sys_club.class, Cnd.where("name", "=", clubName));
|
||||
if(ObjectUtil.isEmpty(club)){
|
||||
throw new RuntimeException("协会负责人未设置,请联系管理员。");
|
||||
}
|
||||
//获取协会负责人的工号
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.loginname as loginName,
|
||||
u.username as userName,
|
||||
u.unitid as unitId,
|
||||
u.unitname as unitName,
|
||||
u.mobile,
|
||||
c.`name`
|
||||
FROM
|
||||
sys_user_role r
|
||||
LEFT JOIN
|
||||
`user` u ON r.userId = u.id
|
||||
LEFT JOIN
|
||||
sys_club c ON c.id = r.stid
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("stid", "=", club.getId());
|
||||
cnd.and("roleId", "in", Lang.array(Roles.club01));
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> clubManage = (List<NutMap>) Daos.query(dao, sql.toString(), Sqls.callback.maps());
|
||||
List<NutMap> clubManage = Vi.getClubManage(vi.getClubId());
|
||||
List<String> clubLeader = clubManage.stream().map(v -> v.getString("loginName")).collect(Collectors.toList());
|
||||
localProcessService.createTask(
|
||||
"activity_reimbursement@" + reimbursementId,
|
||||
@@ -188,10 +155,10 @@ public enum ReimbursementToDoHandler {
|
||||
"协会负责人审核",
|
||||
ShiroUtil.getUserId(),
|
||||
clubLeader,
|
||||
"/platform/jf/funds/association",
|
||||
"/platform/jf/funds/association",
|
||||
"/platform/jf/funds/association",
|
||||
"/platform/jf/funds/association"
|
||||
"/platform/jf/reimbursement/clubChairman",
|
||||
"/platform/jf/reimbursement/clubChairman",
|
||||
"/platform/jf/reimbursement/clubChairman",
|
||||
"/platform/jf/reimbursement/clubChairman"
|
||||
);
|
||||
|
||||
localProcessService.updateProcessNodeName("activity_reimbursement@" + reimbursementId, "协会负责人审核");
|
||||
@@ -216,6 +183,47 @@ public enum ReimbursementToDoHandler {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 创建校工会负责人任务
|
||||
*/
|
||||
CREATE_SCHOOL_DIRECTOR_TASK() {
|
||||
@Override
|
||||
public void exec(String reimbursementId, NutMap extra) {
|
||||
//校工会负责人;暂时只有一人、姜学军:1019911404(工号)
|
||||
localProcessService.createTask(
|
||||
"activity_reimbursement@" + reimbursementId,
|
||||
"activity_reimbursement_school_director_audit",
|
||||
"校工会负责人审核",
|
||||
ShiroUtil.getUserId(),
|
||||
List.of("1019911404"),
|
||||
"/platform/jf/reimbursement/schoolDirector",
|
||||
"/platform/jf/reimbursement/schoolDirector",
|
||||
"/platform/jf/reimbursement/schoolDirector",
|
||||
"/platform/jf/reimbursement/schoolDirector"
|
||||
);
|
||||
|
||||
localProcessService.updateProcessNodeName("activity_reimbursement@" + reimbursementId, "校工会负责人审核");
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 校工会负责人完成
|
||||
*/
|
||||
COMPLETE_SCHOOL_DIRECTOR_TASK() {
|
||||
@Override
|
||||
public void exec(String reimbursementId, NutMap extra) {
|
||||
String nodeName = extra.getString("nodeName");
|
||||
localProcessService.completeTask(
|
||||
"activity_reimbursement_school_director_audit",
|
||||
"activity_reimbursement@" + reimbursementId,
|
||||
ShiroUtil.getUserId(),
|
||||
nodeName
|
||||
);
|
||||
|
||||
localProcessService.updateProcessNodeName("activity_reimbursement@" + reimbursementId, nodeName);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 创建校工会主席任务
|
||||
*/
|
||||
@@ -231,10 +239,10 @@ public enum ReimbursementToDoHandler {
|
||||
"校工会主席审核",
|
||||
ShiroUtil.getUserId(),
|
||||
schoolChairmanLeader,
|
||||
"/platform/jf/funds/accounting",
|
||||
"/platform/jf/funds/accounting",
|
||||
"/platform/jf/funds/accounting",
|
||||
"/platform/jf/funds/accounting"
|
||||
"/platform/jf/reimbursement/schoolChairman",
|
||||
"/platform/jf/reimbursement/schoolChairman",
|
||||
"/platform/jf/reimbursement/schoolChairman",
|
||||
"/platform/jf/reimbursement/schoolChairman"
|
||||
);
|
||||
|
||||
localProcessService.updateProcessNodeName("activity_reimbursement@" + reimbursementId, "校工会主席审核");
|
||||
@@ -6,7 +6,6 @@ import lombok.Data;
|
||||
import org.nutz.dao.DB;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -40,11 +39,10 @@ public class ActivityBx {
|
||||
@Comment("申报(承办)单位")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 200)
|
||||
private String fundsUnitName;
|
||||
|
||||
@Column
|
||||
@Comment("申报(承办)单位ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 200)
|
||||
private String fundsUnitId;
|
||||
@Comment("协会id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String clubId;
|
||||
|
||||
@Column
|
||||
@Comment("申请时间")
|
||||
@@ -71,18 +69,42 @@ public class ActivityBx {
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String activity_time;
|
||||
|
||||
@Column
|
||||
@Comment("项目编号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String projectCode;
|
||||
|
||||
@Column
|
||||
@Comment("活动地点")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String venue;
|
||||
|
||||
@Column
|
||||
@Comment("活动地点")
|
||||
@Comment("项目编号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String projectCode;
|
||||
|
||||
@Column
|
||||
@Comment("活动计划开始时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String startPlannedDate;
|
||||
|
||||
@Column
|
||||
@Comment("活动计划结束时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String endPlannedDate;
|
||||
@Column
|
||||
@Comment("活动开始时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String startTime;
|
||||
|
||||
@Column
|
||||
@Comment("活动结束时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String endTime;
|
||||
|
||||
@Column
|
||||
@Comment("活动名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String activity_name;
|
||||
|
||||
@Column
|
||||
@Comment("活动地址")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String address;
|
||||
|
||||
@@ -92,9 +114,9 @@ public class ActivityBx {
|
||||
private String projectTypeCode;
|
||||
|
||||
@Column
|
||||
@Comment("活动名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String activity_name;
|
||||
@Comment("活动经费类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String projectJfCode;
|
||||
|
||||
@Column
|
||||
@Comment("活动id (未必有)")
|
||||
@@ -106,11 +128,6 @@ public class ActivityBx {
|
||||
@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)
|
||||
@@ -126,36 +143,77 @@ public class ActivityBx {
|
||||
@ColDefine(type = ColType.FLOAT, width = 10, precision = 2)
|
||||
private Double funds_money;
|
||||
|
||||
@Column
|
||||
@Comment("收款人")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String payeeId;
|
||||
|
||||
@Column
|
||||
@Comment("支行名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String activity_card_name;
|
||||
|
||||
@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("申请类型(1.经费申报2.报销申请)")
|
||||
@ColDefine(type = ColType.INT)
|
||||
@ColDefine(type = ColType.INT, width = 2)
|
||||
private Integer apply_type;
|
||||
|
||||
@Column
|
||||
@Comment("活动计划开始时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String startPlannedDate;
|
||||
@Comment("活动类型(1.基层工会,3.校工会,2.社团)")
|
||||
@ColDefine(type = ColType.INT, width = 10)
|
||||
private Integer activity_type;
|
||||
|
||||
@Column
|
||||
@Comment("活动计划结束时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String endPlannedDate;
|
||||
|
||||
@Column
|
||||
@Comment("状态id")
|
||||
@Comment("申报状态Id")
|
||||
@ColDefine(type = ColType.INT, width = 8)
|
||||
private String state_id;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("报销状态ID")
|
||||
@ColDefine(type = ColType.INT, width = 8)
|
||||
private Integer reimbursement_state_id;
|
||||
|
||||
@Column
|
||||
@Comment("报销工会审核Id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String reimbursement_union_audit_id;
|
||||
|
||||
@Column
|
||||
@Comment("报销协会审核Id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String reimbursement_club_audit_id;
|
||||
|
||||
@Column
|
||||
@Comment("报销单位书记审核Id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String reimbursement_unit_secretary_audit_id;
|
||||
|
||||
@Column
|
||||
@Comment("报销财务审核Id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String reimbursement_finance_audit_id;
|
||||
|
||||
@Column
|
||||
@Comment("报销校工会负责人审核Id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String reimbursement_school_director_id;
|
||||
|
||||
@Column
|
||||
@Comment("报销校工会主席审核Id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String reimbursement_school_chairman_id;
|
||||
|
||||
@Column
|
||||
@Comment("报销申请时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String reimbursement_apply_time;
|
||||
|
||||
@Column
|
||||
@Comment("基层工会主席审核id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@@ -311,26 +369,70 @@ public class ActivityBx {
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String files_num;
|
||||
|
||||
@Column
|
||||
@Comment("申报经费预算")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<Budget> budgets;
|
||||
@Many(field = "reid")
|
||||
private List<Goods> goods;
|
||||
|
||||
|
||||
@Column
|
||||
@Default("0")
|
||||
@Comment("是否已经扣款")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isDeduction;
|
||||
@Comment("发票")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<Sys_file> billFiles;
|
||||
|
||||
@Column
|
||||
@Comment("照片")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<Sys_file> photoFiles;
|
||||
|
||||
@Column
|
||||
@Comment("其他")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<Sys_file> otherFiles;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("新闻稿件说明")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String newsRemark;
|
||||
|
||||
@Column
|
||||
@Comment("图片附件")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<Sys_file> picFiles;
|
||||
|
||||
@Column
|
||||
@Comment("新闻附件")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<Sys_file> newsFiles;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("活动经费预算")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<Budget> budgets;
|
||||
|
||||
/**
|
||||
* 活动费用预算
|
||||
*/
|
||||
@Data
|
||||
public static class Budget{
|
||||
// 名称
|
||||
private String name;
|
||||
private double unitPrice;
|
||||
private int num;
|
||||
private double total;
|
||||
// 预算费用
|
||||
private Double budgetPrice;
|
||||
// 实际费用
|
||||
private Double actualPrice;
|
||||
// 收款人id
|
||||
private String payeeId;
|
||||
// 收款人姓名
|
||||
private String username;
|
||||
// 收款人工号
|
||||
private String loginName;
|
||||
// 支行名称
|
||||
private String bankName;
|
||||
// 报销卡号
|
||||
private String bankCardNum;
|
||||
// 备注
|
||||
private String remark;
|
||||
}
|
||||
|
||||
@Column
|
||||
@@ -339,5 +441,4 @@ public class ActivityBx {
|
||||
@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;
|
||||
|
||||
}
|
||||
|
||||
@@ -2,8 +2,12 @@ package io.v.nutz.zhgh.jf.service;
|
||||
|
||||
import io.v.nutz.zhgh.jf.model.ActivityBx;
|
||||
import io.v.nutz.base.service.ViService;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.io.OutputStream;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2020/11/13 10:37
|
||||
@@ -15,4 +19,31 @@ public interface ActivityBxService extends ViService<ActivityBx> {
|
||||
void doEdit(ActivityBx activityBx);
|
||||
|
||||
NutMap queryOne(String id);
|
||||
|
||||
void exportByView(String id, OutputStream outputStream);
|
||||
|
||||
void exportByCon(String id, OutputStream outputStream);
|
||||
|
||||
default Sql activityReimbursementSql(){
|
||||
return Sqls.create("""
|
||||
SELECT
|
||||
act.*,
|
||||
u.loginname bxr_loginname,
|
||||
u.unionname bxr_unionname,
|
||||
s.state_name,
|
||||
s.state_color,
|
||||
abs.`name` absName,
|
||||
u.unionname,
|
||||
u.unitname,
|
||||
sc.`name` AS clubName
|
||||
FROM
|
||||
`activity_bx` act
|
||||
LEFT JOIN `user` u ON act.user_id = u.id
|
||||
LEFT JOIN sys_unit un ON u.unitid = un.id
|
||||
LEFT JOIN state s ON act.reimbursement_state_id = s.state_id
|
||||
LEFT JOIN activity_basic_settings abs ON abs.`code` = act.projectJfCode
|
||||
LEFT JOIN sys_club sc on act.clubId = sc.id
|
||||
$condition
|
||||
""");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,28 @@
|
||||
package io.v.nutz.zhgh.jf.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.base.service.impl.ViServiceImpl;
|
||||
import io.v.nutz.sys.models.Sys_signature;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.deepoove.poi.XWPFTemplate;
|
||||
import com.deepoove.poi.config.Configure;
|
||||
import com.deepoove.poi.data.PictureRenderData;
|
||||
import com.deepoove.poi.data.PictureType;
|
||||
import com.deepoove.poi.policy.HackLoopTableRenderPolicy;
|
||||
import io.v.nutz.zhgh.activity.models.ActivityTissue;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.base.utils.Html2Text;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.base.model.Goods;
|
||||
import io.v.nutz.zhgh.jf.model.ActivityBx;
|
||||
import io.v.nutz.zhgh.jf.model.ActivityFile;
|
||||
import io.v.nutz.zhgh.jf.service.ActivityBxService;
|
||||
import io.v.nutz.zhgh.jf.service.ActivityFileService;
|
||||
import io.v.nutz.base.model.Audit;
|
||||
import io.v.nutz.base.service.impl.ViServiceImpl;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.web.commons.base.Globals;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.boot.starter.ftp.FtpService;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
@@ -19,6 +33,14 @@ import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.Base64;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -34,33 +56,44 @@ public class ActivityBxServiceImpl extends ViServiceImpl<ActivityBx> implements
|
||||
super(dao);
|
||||
}
|
||||
|
||||
|
||||
@Inject
|
||||
private ActivityFileService activityFileService;
|
||||
private Vi vi;
|
||||
@Inject
|
||||
private FtpService ftpService;
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void doAdd(ActivityBx activityBx) {
|
||||
insertWith(activityBx, "goods");
|
||||
insert(activityBx);
|
||||
activityBx.getGoods().forEach(v -> {
|
||||
v.setReid(activityBx.getId());
|
||||
});
|
||||
this.dao().insert(activityBx.getGoods());
|
||||
// insertWith(activityBx, "goods");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void doEdit(ActivityBx activityBx) {
|
||||
updateWith(activityBx, "goods");
|
||||
|
||||
/*activityBx.getGoods().forEach(v -> {
|
||||
v.setReid(activityBx.getId());
|
||||
});
|
||||
dao().clear(Goods.class,Cnd.where("reid","=",activityBx.getId()));
|
||||
insert(activityBx.getGoods());*/
|
||||
update(activityBx);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NutMap queryOne(String id) {
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
act.*,
|
||||
`user`.loginname,
|
||||
s.state_name,
|
||||
s.state_color,
|
||||
a_p.username as ap_username,
|
||||
a_p.loginname as ap_loginname,
|
||||
payee.username payee_username,
|
||||
payee.loginname payee_loginname,
|
||||
d_c.username dc_username,
|
||||
d_c.loginname dc_loginname,
|
||||
a.username a_username,
|
||||
@@ -71,52 +104,42 @@ public class ActivityBxServiceImpl extends ViServiceImpl<ActivityBx> implements
|
||||
u_c.loginname uc_loginname,
|
||||
ucc_c.username ucc_username,
|
||||
ucc_c.loginname ucc_loginname,
|
||||
absType.`name` projectTypeName,
|
||||
absat.`name` activityTypeName
|
||||
ap_c.username ap_username,
|
||||
ap_c.loginname ap_loginname,
|
||||
dc_s.`data` dc_s,
|
||||
a_s.`data` a_s,
|
||||
ct_s.`data` ct_s,
|
||||
uc_s.`data` uc_s,
|
||||
ucc_s.`data` ucc_s,
|
||||
us_s.`data` us_s,
|
||||
ap_s.`data` ap_s,
|
||||
abs.`name` projectJfName
|
||||
FROM
|
||||
activity_bx act
|
||||
LEFT JOIN sys_user `user` ON act.user_id = `user`.id
|
||||
LEFT JOIN state s ON act.state_id = s.state_id
|
||||
LEFT JOIN sys_user a_p ON a_p.id = act.association_principal_id
|
||||
LEFT JOIN sys_user payee ON payee.id = act.payeeId
|
||||
LEFT JOIN sys_user d_c ON d_c.id = act.division_chairman_name
|
||||
LEFT JOIN sys_user a ON a.id = act.accounting_name
|
||||
LEFT JOIN sys_user c_t ON c_t.id = act.confirm_trade_name
|
||||
LEFT JOIN sys_user u_c ON u_c.id = act.union_cashier_name
|
||||
LEFT JOIN sys_user ucc_c ON ucc_c.id = act.union_chairman_name
|
||||
LEFT JOIN activity_basic_settings absType ON absType.`code` = act.projectTypeCode
|
||||
LEFT JOIN activity_basic_settings absat ON absat.`code` = act.activity_type
|
||||
LEFT JOIN sys_user ap_c ON ap_c.id = act.association_principal_id
|
||||
LEFT JOIN sys_signature dc_s ON dc_s.id = act.division_chairman
|
||||
LEFT JOIN sys_signature a_s ON a_s.id = act.accounting
|
||||
LEFT JOIN sys_signature ct_s ON ct_s.id = act.confirm_trade
|
||||
LEFT JOIN sys_signature uc_s ON uc_s.id = act.union_cashier
|
||||
LEFT JOIN sys_signature ucc_s ON ucc_s.id = act.union_chairman
|
||||
LEFT JOIN sys_signature us_s ON us_s.id = act.user_signature
|
||||
LEFT JOIN sys_signature ap_s ON ap_s.id = act.association_principalSign_id
|
||||
LEFT JOIN activity_basic_settings abs ON abs.`code`=act.projectJfCode
|
||||
WHERE
|
||||
act.id = @id
|
||||
act.id = @id
|
||||
""").setParam("id", id);
|
||||
NutMap record = fetch(sql);
|
||||
|
||||
if(StrUtil.isNotBlank(record.getString("association_principalSign_id"))){
|
||||
record.setv("ap_s", dao().fetch(Sys_signature.class, record.getString("association_principalSign_id")).getData());
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(record.getString("division_chairman"))) {
|
||||
record.setv("dc_s", dao().fetch(Sys_signature.class, record.getString("division_chairman")).getData());
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(record.getString("accounting"))) {
|
||||
record.setv("a_s", dao().fetch(Sys_signature.class, record.getString("accounting")).getData());
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(record.getString("confirm_trade"))) {
|
||||
record.setv("ct_s", dao().fetch(Sys_signature.class, record.getString("confirm_trade")).getData());
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(record.getString("union_cashier"))) {
|
||||
record.setv("uc_s", dao().fetch(Sys_signature.class, record.getString("union_cashier")).getData());
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(record.getString("union_chairman"))) {
|
||||
record.setv("ucc_s", dao().fetch(Sys_signature.class, record.getString("union_chairman")).getData());
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(record.getString("user_signature"))) {
|
||||
record.setv("us_s", dao().fetch(Sys_signature.class, record.getString("user_signature")).getData());
|
||||
}
|
||||
sql.setCallback(Sqls.callback.map());
|
||||
dao().execute(sql);
|
||||
NutMap record = (NutMap) sql.getResult();
|
||||
// record.setv("Goods", dao().query("Goods", Cnd.where("reid", "=", record.getString("id"))));
|
||||
|
||||
if (record.size() == 0) {
|
||||
return null;
|
||||
@@ -124,11 +147,195 @@ public class ActivityBxServiceImpl extends ViServiceImpl<ActivityBx> implements
|
||||
|
||||
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"));
|
||||
List<ActivityFile> files = dao().query(ActivityFile.class, 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.setv("activity_files", collect);
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(record.getString("reimbursement_club_audit_id"))){
|
||||
Audit audit = dao().fetch(Audit.class, Cnd.where("id", "=", record.getString("reimbursement_club_audit_id")));
|
||||
record.setv("reimbursement_club_audit",audit);
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(record.getString("reimbursement_union_audit_id"))){
|
||||
Audit audit = dao().fetch(Audit.class, Cnd.where("id", "=", record.getString("reimbursement_union_audit_id")));
|
||||
record.setv("reimbursement_union_audit",audit);
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(record.getString("reimbursement_school_director_id"))){
|
||||
Audit audit = dao().fetch(Audit.class, Cnd.where("id", "=", record.getString("reimbursement_school_director_id")));
|
||||
record.setv("reimbursement_school_director",audit);
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(record.getString("reimbursement_school_chairman_id"))){
|
||||
Audit audit = dao().fetch(Audit.class, Cnd.where("id", "=", record.getString("reimbursement_school_chairman_id")));
|
||||
record.setv("reimbursement_school_chairman",audit);
|
||||
}
|
||||
return record;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void exportByView(String id, OutputStream outputStream) {
|
||||
NutMap nutMap = queryOne(id);
|
||||
nutMap.setv("activity_content", Html2Text.toPlainText(nutMap.getString("activity_content")));
|
||||
nutMap.setv("apply_time", nutMap.getString("apply_time").substring(0, 10));
|
||||
|
||||
String budgets = nutMap.getString("budgets");
|
||||
List<NutMap> goods = JSONUtil.parseArray(budgets).toList(NutMap.class);
|
||||
|
||||
for (int i = 0; i < goods.size(); i++) {
|
||||
goods.get(i).put("ranking", i + 1);
|
||||
}
|
||||
|
||||
if (nutMap.get("dc_s") != null) {
|
||||
nutMap.setv("fgh_sign", getImage((String) nutMap.get("dc_s")));
|
||||
}
|
||||
|
||||
if (nutMap.get("ap_s") != null) {
|
||||
nutMap.setv("ap_sign", getImage((String) nutMap.get("ap_s")));
|
||||
}
|
||||
if (nutMap.get("dc_s") == null && nutMap.get("ap_s") == null && !nutMap.getString("activity_type").equals("40001")) {
|
||||
if (nutMap.get("us_s") != null) {
|
||||
nutMap.setv("us_sign", getImage((String) nutMap.get("us_s")));
|
||||
nutMap.setv("division_chairman_time", nutMap.getString("apply_time"));
|
||||
}
|
||||
}
|
||||
|
||||
if (nutMap.get("a_s") != null) {
|
||||
nutMap.setv("a_sign", getImage((String) nutMap.get("a_s")));
|
||||
}
|
||||
|
||||
if (nutMap.get("a_s") == null && nutMap.getString("activity_type").equals("40001")) {
|
||||
if (nutMap.get("us_s") != null) {
|
||||
nutMap.setv("a_sign", getImage((String) nutMap.get("us_s")));
|
||||
nutMap.setv("accounting_time", nutMap.getString("apply_time"));
|
||||
}
|
||||
}
|
||||
|
||||
if (nutMap.get("ucc_s") != null) {
|
||||
nutMap.setv("xgh_sign", getImage((String) nutMap.get("ucc_s")));
|
||||
}
|
||||
|
||||
HackLoopTableRenderPolicy policy = new HackLoopTableRenderPolicy();
|
||||
Configure config = Configure.newBuilder().bind("goods", policy).build();
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("goods", goods);
|
||||
map.put("n", nutMap);
|
||||
|
||||
// String fileName = Globals.schoolName + "【" + nutMap.getString("activity_name") + "】申报表";
|
||||
// response.addHeader("Content-Type", "application/octet-stream");
|
||||
// response.addHeader("Content-Disposition", "attachment; filename=\"" + new String(fileName.getBytes("UTF-8"), "ISO-8859-1") + "\".docx");
|
||||
|
||||
try {
|
||||
InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("docTemplate/funds2.docx");
|
||||
assert inputStream != null;
|
||||
XWPFTemplate.compile(inputStream, config).render(map, outputStream);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exportByCon(String id, OutputStream outputStream) {
|
||||
try {
|
||||
NutMap one = queryOne(id);
|
||||
if (StrUtil.isNotBlank(one.getString("activity_content"))) {
|
||||
one.setv("activity_content", Html2Text.getContent(one.getString("activity_content")));
|
||||
}
|
||||
one.setv("money_big", Convert.digitToChinese(one.getDouble("activity_money")));
|
||||
one.setv("apply_time", one.getString("apply_time").substring(0, 10));
|
||||
|
||||
String budgets = one.getString("budgets");
|
||||
List<NutMap> goods = JSONUtil.parseArray(budgets).toList(NutMap.class);
|
||||
|
||||
one.put("goods",goods);
|
||||
|
||||
switch (one.getString("activity_type")) {
|
||||
case "40001" -> one.setv("jfName", "校工会");
|
||||
case "40002" -> one.setv("jfName", "分工会");
|
||||
case "40003" -> one.setv("jfName", "协会");
|
||||
}
|
||||
|
||||
double price = one.getDouble("activity_money");
|
||||
int money_int = (int) price;
|
||||
|
||||
BigDecimal priceBigDecimal = new BigDecimal(price);
|
||||
BigDecimal moneyDecimal = priceBigDecimal.subtract(new BigDecimal(money_int));
|
||||
|
||||
one.setv("one", money_int >= 1000000 ? (money_int / 1000000) % 10 : null);
|
||||
one.setv("two", money_int >= 100000 ? (money_int / 100000) % 10 : null);
|
||||
one.setv("three", money_int >= 10000 ? (money_int / 10000) % 10 : null);
|
||||
one.setv("four", money_int >= 1000 ? (money_int / 1000) % 10 : null);
|
||||
one.setv("five", money_int >= 100 ? (money_int / 100) % 10 : null);
|
||||
one.setv("six", money_int >= 10 ? (money_int / 10) % 10 : null);
|
||||
one.setv("seven", money_int >= 1 ? money_int % 10 : null);
|
||||
|
||||
// 提取小数部分的各个位上的数值
|
||||
BigDecimal tenthsPart = moneyDecimal.multiply(BigDecimal.TEN).setScale(0, RoundingMode.DOWN);
|
||||
int tenths = tenthsPart.intValue();
|
||||
BigDecimal hundredthsPart = moneyDecimal.multiply(BigDecimal.valueOf(100)).setScale(0, RoundingMode.DOWN);
|
||||
int hundredths = hundredthsPart.intValue();
|
||||
|
||||
// BigDecimal decimalPart1 = moneyDecimal.divide(new BigDecimal("1"), 1, RoundingMode.HALF_UP);
|
||||
// BigDecimal decimalPart2 = moneyDecimal.divide(new BigDecimal("0.1"), 1, RoundingMode.HALF_UP);
|
||||
one.setv("eight", (tenths % 10));
|
||||
one.setv("nine", (hundredths % 10) + 1);
|
||||
|
||||
|
||||
/*基层工会主席签字*/
|
||||
if (one.get("dc_s") != null) {
|
||||
one.setv("dc_sign", getImage((String) one.get("dc_s")));
|
||||
}
|
||||
|
||||
/*协会负责人*/
|
||||
if (one.get("ap_c") != null) {
|
||||
one.setv("ap_sign", getImage((String) one.get("ap_c")));
|
||||
}
|
||||
|
||||
/*校工会主席签字*/
|
||||
if (one.get("ucc_s") != null) {
|
||||
one.setv("ucc_sign", getImage((String) one.get("ucc_s")));
|
||||
}
|
||||
|
||||
/*会计*/
|
||||
if (one.get("a_s") != null) {
|
||||
one.setv("a_sign", getImage((String) one.get("a_s")));
|
||||
}
|
||||
// String fileName = Globals.schoolName + "【" + one.getString("activity_name") + "】报销凭证";
|
||||
|
||||
HackLoopTableRenderPolicy policy = new HackLoopTableRenderPolicy();
|
||||
Configure config = Configure.newBuilder().bind("goods", policy).build();
|
||||
|
||||
InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("docTemplate/funds3.docx");
|
||||
// response.addHeader("Content-Type", "application/octet-stream");
|
||||
// response.addHeader("Content-Disposition", "attachment; filename=\"" + new String(fileName.getBytes("UTF-8"), "ISO-8859-1") + "\".docx");
|
||||
assert inputStream != null;
|
||||
XWPFTemplate.compile(inputStream, config).render(one, outputStream);
|
||||
// inputStream.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private PictureRenderData getImage(String base64) {
|
||||
try {
|
||||
if (base64.startsWith("data")) {
|
||||
String s = base64.split(",")[1];
|
||||
byte[] bytes = Base64.getDecoder().decode(s);
|
||||
return new PictureRenderData(70, 30, ".png", bytes);
|
||||
} else {
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
ftpService.download(base64, os);
|
||||
os.close();
|
||||
return new PictureRenderData(70, 30, PictureType.PNG, os.toByteArray());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("转换失败------");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user