init
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
package io.v.nutz.zhgh.reimbursement.constants;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/6/1 14:11
|
||||
* @description 报销状态
|
||||
*/
|
||||
public interface ReimbursementState {
|
||||
|
||||
|
||||
/**
|
||||
* 待申请人修改
|
||||
*/
|
||||
Integer MODIFY = 3040;
|
||||
|
||||
/**
|
||||
* 待审核确认
|
||||
*/
|
||||
Integer AUDIT_CONFIRM = 3043;
|
||||
|
||||
/**
|
||||
* 待慰问人签字
|
||||
*/
|
||||
Integer SIGNATURE = 3045;
|
||||
|
||||
/**
|
||||
* 待分工会审核
|
||||
*/
|
||||
Integer UNION = 3050;
|
||||
|
||||
/**
|
||||
* 分工会审核不通过
|
||||
*/
|
||||
Integer UNION_FAIL = 3055;
|
||||
/**
|
||||
* 单位书记
|
||||
*/
|
||||
Integer UNIT_SECRETARY = 3060;
|
||||
|
||||
|
||||
/**
|
||||
* 单位书记审核不通过
|
||||
*/
|
||||
Integer UNIT_SECRETARY_FAIL = 3065;
|
||||
|
||||
|
||||
/**
|
||||
* 待财务审核
|
||||
*/
|
||||
Integer FINANCE = 3070;
|
||||
|
||||
/**
|
||||
* 财务审核不通过
|
||||
*/
|
||||
Integer FINANCE_FAIL = 3075;
|
||||
|
||||
/**
|
||||
* 待分管副主席审核
|
||||
*/
|
||||
Integer VICE_CHAIRMAN = 3080;
|
||||
|
||||
/**
|
||||
* 分管副主席审核不通过
|
||||
*/
|
||||
Integer VICE_CHAIRMAN_FAIL = 3085;
|
||||
|
||||
/**
|
||||
* 待常务副主席审核
|
||||
*/
|
||||
Integer STANDING_VICE_CHAIRMAN = 3090;
|
||||
|
||||
/**
|
||||
* 常务副主席审核不通过
|
||||
*/
|
||||
Integer STANDING_VICE_CHAIRMAN_FAIL = 3095;
|
||||
|
||||
/**
|
||||
* 报销成功
|
||||
*/
|
||||
Integer SUCCESSFUL_REIMBURSEMENT = 3100;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,207 @@
|
||||
package io.v.nutz.zhgh.reimbursement.controller;
|
||||
|
||||
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.Vi;
|
||||
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.zhgh.reimbursement.constants.ReimbursementState;
|
||||
import io.v.nutz.zhgh.reimbursement.models.ReimbursementNew;
|
||||
import io.v.nutz.base.service.ViService;
|
||||
import io.v.nutz.sys.models.Sys_club_user;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.web.commons.slog.annotation.SLog;
|
||||
import io.v.nutz.zhgh.jf.model.*;
|
||||
import io.v.nutz.zhgh.zgfw.service.CondolenceService;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
import org.nutz.trans.Trans;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/10/15 10:47
|
||||
* @description
|
||||
*/
|
||||
@At("/reimbursement/audit/confirm")
|
||||
@Ok("json:full")
|
||||
@IocBean
|
||||
@RequiresAuthentication
|
||||
public class AuditConfirmController {
|
||||
|
||||
|
||||
@Inject("ReimbursementNew")
|
||||
private ViService<ReimbursementNew> reimbursementNewViService;
|
||||
@Inject
|
||||
private ActivityBxService activityBxService;
|
||||
@Inject
|
||||
private CondolenceService condolenceService;
|
||||
|
||||
@Inject
|
||||
private MsgApi msgApi;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/reimbursement/AuditConfirm.html")
|
||||
@RequiresPermissions("reimbursement.audit.confirm")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("reimbursement.audit.confirm")
|
||||
public Object pageData(PageForm page,
|
||||
@Param(value = "isAudit", required = false) Boolean isAudit,
|
||||
@Param(value = "year", required = false) Integer year,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "reiItemId", required = false) String reiItemId) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
rei.*,
|
||||
be.username be_username,
|
||||
state.stateName,
|
||||
state.stateColor
|
||||
FROM
|
||||
`reimbursement_new` rei
|
||||
LEFT JOIN sys_user be ON be.id = rei.be_user
|
||||
LEFT JOIN audit_state state ON state.stateId = rei.state
|
||||
$condition
|
||||
""");
|
||||
cnd.andEX("YEAR ( rei.applyTime )", "=", year);
|
||||
cnd.andEX("rei.unitId", "=", unitId);
|
||||
cnd.andEX("rei.unionId", "=", unionId);
|
||||
if (Strings.isNotBlank(reiItemId) && reiItemId.equals("ww")) {
|
||||
cnd.and("rei.reimbursementItemId", "in", "'fyww','zfww'");
|
||||
} else {
|
||||
cnd.andEX("rei.reimbursementItemId", "=", reiItemId);
|
||||
}
|
||||
if (isAudit != null) {
|
||||
cnd.and("rei.State", isAudit ? ">" : "=", ReimbursementState.AUDIT_CONFIRM);
|
||||
}
|
||||
|
||||
if (Vi.isNotBlank(page.getSearchName(), page.getSearchKeyword())) {
|
||||
cnd.where().andLike(page.getSearchName(), page.getSearchKeyword());
|
||||
}
|
||||
cnd.desc("rei.applyTime");
|
||||
sql.setCondition(cnd);
|
||||
return reimbursementNewViService.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("reimbursement.audit.confirm")
|
||||
@SLog(tag = "工会报销", msg = "审核了一条记录", param = true, result = true)
|
||||
public Object doSubmit(String id, int flag, Audit audit) {
|
||||
ReimbursementNew reimbursementNew = reimbursementNewViService.fetch(id);
|
||||
audit.setAuditor(io.v.nutz.web.commons.utils.ShiroUtil.getPrincipalProperty("id").toString());
|
||||
audit.setLoginname(ShiroUtil.getPrincipalProperty("loginname").toString());
|
||||
audit = reimbursementNewViService.insert(audit);
|
||||
String content = flag == 3 ? "您的报销已审核完毕,请前往智慧工会工会报销系统中的我的报销导出" : flag == 2 ? ("您的报销已被退回," + audit.getAuditOpinion() + "请前往智慧工会查看") : ("您的报销已被拒绝," + audit.getAuditOpinion() + "请前往智慧工会查看");
|
||||
Audit finalAudit = audit;
|
||||
Trans.exec(() -> {
|
||||
reimbursementNewViService.update(Chain.make("State", flag == 3 ? ReimbursementState.SUCCESSFUL_REIMBURSEMENT : flag == 2 ? ReimbursementState.MODIFY : ReimbursementState.FINANCE_FAIL).add("accountingAuditId", finalAudit.getId()), Cnd.where("id", "=", id));
|
||||
if (flag == 3) {
|
||||
if (reimbursementNew.getJf_source().equals("1")) {
|
||||
jf_school jfSchool = reimbursementNewViService.dao().fetch(jf_school.class, Cnd.where("year", "=", DateUtil.getYear()).and("state", "=", 1));
|
||||
SchoolUse schoolUse = new SchoolUse();
|
||||
schoolUse.setReimbursementId(reimbursementNew.getId());
|
||||
reimbursementNewViService.insert(schoolUse);
|
||||
//往预算分配表减钱
|
||||
jfSchool.setUsedQuota(jfSchool.getUsedQuota() + reimbursementNew.getMoney());
|
||||
reimbursementNewViService.updateIgnoreNull(jfSchool);
|
||||
} else if (reimbursementNew.getJf_source().equals("2")) {
|
||||
jf_yjgh yjgh = reimbursementNewViService.dao().fetch(jf_yjgh.class, Cnd.where("unionId", "=", reimbursementNew.getUnionId()).and("year", "=", DateUtil.getYear()).and("state", "=", 1));
|
||||
//往经费使用表中添加一条数据
|
||||
jf_use jf_use = new jf_use();
|
||||
jf_use.setAdjust_id(yjgh.getId());
|
||||
jf_use.setProject(reimbursementNew.getReimbursementItemName());
|
||||
jf_use.setAdjust_money(reimbursementNew.getMoney());
|
||||
jf_use.setAdjust_reason(reimbursementNew.getCause());
|
||||
jf_use.setAdjust_time(DateUtil.getDateTime());
|
||||
jf_use.setAdjust_person(ShiroUtil.getUserId());
|
||||
jf_use.setApply_id(reimbursementNew.getId());
|
||||
jf_use.setActivitie_number(reimbursementNew.getActivity_number());
|
||||
jf_use.setActivitie_time(Strings.isNotBlank(reimbursementNew.getActivity_time()) ? reimbursementNew.getActivity_time() : reimbursementNew.getOccur_time());
|
||||
reimbursementNewViService.insert(jf_use);
|
||||
//往预算分配表减钱
|
||||
yjgh.setUsedQuota((yjgh.getUsedQuota() != null ? yjgh.getUsedQuota() : 0) + reimbursementNew.getMoney());
|
||||
reimbursementNewViService.updateIgnoreNull(yjgh);
|
||||
} else {
|
||||
Sys_club_user clubUser = reimbursementNewViService.dao().fetch(Sys_club_user.class, Cnd.where("userid", "=", reimbursementNew.getUserId()));
|
||||
|
||||
jf_club jf_club = reimbursementNewViService.dao().fetch(jf_club.class, Cnd.where("year", "=", DateUtil.getYear()).and("state", "=", 1).and("club_id", "=", clubUser.getClubid()));
|
||||
//往经费使用表中添加一条数据
|
||||
jf_use jf_use = new jf_use();
|
||||
jf_use.setAdjust_id(jf_club.getId());
|
||||
jf_use.setProject(reimbursementNew.getReimbursementItemName());
|
||||
jf_use.setAdjust_money(reimbursementNew.getMoney());
|
||||
jf_use.setAdjust_reason(reimbursementNew.getCause());
|
||||
jf_use.setAdjust_time(DateUtil.getDateTime());
|
||||
jf_use.setAdjust_person(ShiroUtil.getUserId());
|
||||
jf_use.setApply_id(reimbursementNew.getId());
|
||||
jf_use.setActivitie_number(reimbursementNew.getActivity_number());
|
||||
jf_use.setActivitie_time(Strings.isNotBlank(reimbursementNew.getActivity_time()) ? reimbursementNew.getActivity_time() : reimbursementNew.getOccur_time());
|
||||
reimbursementNewViService.insert(jf_use);
|
||||
//往预算分配表减钱
|
||||
jf_club.setUsed_quota(jf_club.getUsed_quota() + reimbursementNew.getMoney());
|
||||
reimbursementNewViService.updateIgnoreNull(jf_club);
|
||||
}
|
||||
}
|
||||
|
||||
//msgApi.sendWxMsg(content, reimbursementNew.getLoginName());
|
||||
});
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("reimbursement.audit.confirm")
|
||||
@SLog(tag = "工会报销", msg = "撤回了一条记录", param = true, result = true)
|
||||
public Object doRecall(String id) {
|
||||
Trans.exec(() -> {
|
||||
ReimbursementNew reimbursementNew = reimbursementNewViService.fetch(id);
|
||||
reimbursementNew.setState(ReimbursementState.AUDIT_CONFIRM);
|
||||
reimbursementNew.setAccountingAuditId(null);
|
||||
reimbursementNewViService.update(reimbursementNew);
|
||||
|
||||
if (reimbursementNew.getJf_source().equals("1")) {
|
||||
jf_school jfSchool = reimbursementNewViService.dao().fetch(jf_school.class, Cnd.where("year", "=", DateUtil.getYear()).and("state", "=", 1));
|
||||
jfSchool.setUsedQuota((jfSchool.getUsedQuota() != null ? jfSchool.getUsedQuota() : 0) - reimbursementNew.getMoney());
|
||||
reimbursementNewViService.updateIgnoreNull(jfSchool);
|
||||
reimbursementNewViService.dao().clear(SchoolUse.class, Cnd.where("reimbursementId", "=", reimbursementNew.getId()));
|
||||
|
||||
} else if (reimbursementNew.getJf_source().equals("2")) {
|
||||
jf_yjgh yjgh = reimbursementNewViService.dao().fetch(jf_yjgh.class, Cnd.where("unionId", "=", reimbursementNew.getUnionId()).and("year", "=", DateUtil.getYear()).and("state", "=", 1));
|
||||
yjgh.setUsedQuota(yjgh.getUsedQuota() - reimbursementNew.getMoney());
|
||||
reimbursementNewViService.updateIgnoreNull(yjgh);
|
||||
reimbursementNewViService.dao().clear(jf_use.class, Cnd.where("apply_id", "=", reimbursementNew.getId()));
|
||||
|
||||
} else {
|
||||
Sys_club_user clubUser = reimbursementNewViService.dao().fetch(Sys_club_user.class, Cnd.where("userid", "=", reimbursementNew.getUserId()));
|
||||
|
||||
jf_club jf_club = reimbursementNewViService.dao().fetch(jf_club.class, Cnd.where("year", "=", DateUtil.getYear()).and("state", "=", 1).and("club_id", "=", clubUser.getClubid()));
|
||||
jf_club.setUsed_quota(jf_club.getUsed_quota() - reimbursementNew.getMoney());
|
||||
reimbursementNewViService.updateIgnoreNull(jf_club);
|
||||
reimbursementNewViService.dao().clear(jf_use.class, Cnd.where("apply_id", "=", reimbursementNew.getId()));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
package io.v.nutz.zhgh.reimbursement.controller;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.model.Review;
|
||||
import io.v.nutz.base.service.ReviewService;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.base.dao.CndPlus;
|
||||
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.base.service.AuditService;
|
||||
import io.v.nutz.zhgh.reimbursement.constants.ReimbursementState;
|
||||
import io.v.nutz.zhgh.reimbursement.models.Reimbursement;
|
||||
import io.v.nutz.base.service.ViService;
|
||||
import io.v.nutz.sys.services.SysSignatureService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.zgfw.model.condolence.Condolence;
|
||||
import io.v.nutz.zhgh.zgfw.service.CondolenceService;
|
||||
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.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@At("/platform/reimbursement/dma")
|
||||
@IocBean
|
||||
@Ok("json")
|
||||
public class DmaController {
|
||||
|
||||
@Inject("Reimbursement")
|
||||
private ViService<Reimbursement> reimbursementViService;
|
||||
|
||||
@Inject
|
||||
private ActivityBxService activityBxService;
|
||||
|
||||
@Inject
|
||||
private SysSignatureService sysSignatureService;
|
||||
|
||||
@Inject
|
||||
private AuditService auditService;
|
||||
|
||||
@Inject
|
||||
private ReviewService reviewService;
|
||||
|
||||
@Inject
|
||||
private CondolenceService condolenceService;
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/reimbursement/dma.html")
|
||||
@RequiresPermissions("rei.dma")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("rei.dma")
|
||||
public Object pageData(PageForm page,
|
||||
@Param(value = "isAudit", required = false) boolean isAudit,
|
||||
@Param(value = "year", required = false) Integer year,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "reiItemId", required = false) Integer reiItemId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
rei.*,
|
||||
us.unionname,
|
||||
us.unioncode,
|
||||
us.unitcode,
|
||||
state.stateId,
|
||||
state.stateColor,
|
||||
state.stateName,
|
||||
con_user.username be_username,
|
||||
bx.activity_name
|
||||
FROM
|
||||
`reimbursement` rei
|
||||
LEFT JOIN `user` us ON us.id = rei.userid
|
||||
LEFT JOIN audit_state state ON rei.State = state.stateId
|
||||
LEFT JOIN condolence con ON con.id = rei.reimbursementId
|
||||
LEFT JOIN activity_bx bx ON rei.reimbursementId = bx.id
|
||||
LEFT JOIN `user` con_user ON con_user.id=con.be_user
|
||||
$condition
|
||||
""");
|
||||
CndPlus cnd = CndPlus.create();
|
||||
cnd.and("rei.State", isAudit ? ">" : "=", ReimbursementState.UNION);
|
||||
Vi.cndPlus(cnd, "rei.reimbursementItemId", "=", reiItemId);
|
||||
Vi.cndPlus(cnd, "YEAR(rei.applyTime)", "=", year);
|
||||
Vi.cndPlus(cnd, "us.unitid", "=", unitId);
|
||||
Vi.cndPlus(cnd, "us.unionid", "=", unionId);
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin")) {
|
||||
cnd.and("us.unionid", "=", Vi.getUnionId());
|
||||
}
|
||||
cnd.desc("rei.applyTime");
|
||||
sql.setCondition(cnd);
|
||||
return reimbursementViService.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("rei.dma")
|
||||
public Object doReview(String id, Boolean flag, double money, Audit audit, Review review, Integer reimbursementItemId) {
|
||||
double Amount = 2000;
|
||||
Reimbursement reimbursementId = reimbursementViService.fetch(Cnd.where("reimbursementId", "=", id));
|
||||
|
||||
|
||||
if (reimbursementItemId != 4) {
|
||||
audit.setLoginname(ShiroUtil.getPrincipalProperty("loginname").toString());
|
||||
audit.setUsername(ShiroUtil.getPrincipalProperty("username").toString());
|
||||
audit.setAuditTime(new Date());
|
||||
audit = auditService.insert(audit);
|
||||
ActivityBx aid = activityBxService.fetch(id);
|
||||
aid.setUnion_audit_id(audit.getId());
|
||||
if (money >= Amount) {
|
||||
aid.setState_id(flag ? "3060" : "3055");
|
||||
} else {
|
||||
aid.setState_id(flag ? "3070" : "3055");
|
||||
}
|
||||
activityBxService.updateIgnoreNull(aid);
|
||||
|
||||
} else {
|
||||
|
||||
review.setLoginname(ShiroUtil.getPrincipalProperty("loginname").toString());
|
||||
review.setUsername(ShiroUtil.getPrincipalProperty("username").toString());
|
||||
review.setTime(DateUtil.getDate());
|
||||
review = reviewService.insert(review);
|
||||
Condolence condolence = condolenceService.fetch(id);
|
||||
condolence.setUnion_chairman_review(review.getId());
|
||||
|
||||
if (money >= Amount) {
|
||||
condolence.setState_id(flag ? "3060" : "3055");
|
||||
} else {
|
||||
condolence.setState_id(flag ? "3070" : "3055");
|
||||
}
|
||||
|
||||
condolenceService.updateIgnoreNull(condolence);
|
||||
|
||||
}
|
||||
|
||||
if (money >= Amount) {
|
||||
reimbursementId.setState(flag ? ReimbursementState.UNIT_SECRETARY : ReimbursementState.UNION_FAIL);
|
||||
} else {
|
||||
reimbursementId.setState(flag ? ReimbursementState.FINANCE : ReimbursementState.UNION_FAIL);
|
||||
}
|
||||
reimbursementViService.updateIgnoreNull(reimbursementId);
|
||||
return null;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
package io.v.nutz.zhgh.reimbursement.controller;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.base.dao.CndPlus;
|
||||
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.base.model.Review;
|
||||
import io.v.nutz.base.service.AuditService;
|
||||
import io.v.nutz.base.service.ReviewService;
|
||||
import io.v.nutz.zhgh.reimbursement.constants.ReimbursementState;
|
||||
import io.v.nutz.zhgh.reimbursement.models.Reimbursement;
|
||||
import io.v.nutz.base.service.ViService;
|
||||
import io.v.nutz.sys.services.SysSignatureService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.zgfw.model.condolence.Condolence;
|
||||
import io.v.nutz.zhgh.zgfw.service.CondolenceService;
|
||||
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.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/6/7 14:23
|
||||
* @description 财务审核
|
||||
*/
|
||||
|
||||
@At("/platform/reimbursement/finance")
|
||||
@IocBean
|
||||
@Ok("json")
|
||||
public class FinanceController {
|
||||
|
||||
|
||||
@Inject("Reimbursement")
|
||||
private ViService<Reimbursement> reimbursementViService;
|
||||
|
||||
@Inject
|
||||
private ActivityBxService activityBxService;
|
||||
|
||||
@Inject
|
||||
private SysSignatureService sysSignatureService;
|
||||
|
||||
@Inject
|
||||
private AuditService auditService;
|
||||
|
||||
@Inject
|
||||
private ReviewService reviewService;
|
||||
|
||||
@Inject
|
||||
private CondolenceService condolenceService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/reimbursement/finance.html")
|
||||
@RequiresPermissions("reimbursement.finance")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("reimbursement.finance")
|
||||
public Object pageData(PageForm page,
|
||||
@Param(value = "isAudit", required = false) boolean isAudit,
|
||||
@Param(value = "year", required = false) Integer year,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "reiItemId", required = false) Integer reiItemId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
rei.*,
|
||||
us.unionname,
|
||||
state.stateColor,
|
||||
state.stateName,
|
||||
bx.activity_money,
|
||||
con.money
|
||||
FROM
|
||||
`reimbursement` rei
|
||||
LEFT JOIN `user` us ON us.id = rei.userid
|
||||
LEFT JOIN condolence con ON con.id = rei.reimbursementId
|
||||
LEFT JOIN activity_bx bx ON bx.id = rei.reimbursementId
|
||||
LEFT JOIN audit_state state ON rei.State = state.stateId $condition
|
||||
""");
|
||||
CndPlus cnd = CndPlus.create();
|
||||
cnd.and("rei.State", isAudit ? ">" : "=", ReimbursementState.FINANCE);
|
||||
|
||||
Vi.cndPlus(cnd, "rei.reimbursementItemId", "=", reiItemId);
|
||||
Vi.cndPlus(cnd, "YEAR(rei.applyTime)", "=", year);
|
||||
Vi.cndPlus(cnd, "us.unitid", "=", unitId);
|
||||
Vi.cndPlus(cnd, "us.unionid", "=", unionId);
|
||||
cnd.desc("rei.applyTime");
|
||||
sql.setCondition(cnd);
|
||||
return reimbursementViService.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("reimbursement.finance")
|
||||
public Object doReview(String id, Boolean flag, Audit audit, Review review, Integer reimbursementItemId, double money) {
|
||||
if (reimbursementItemId != 4) {
|
||||
audit.setLoginname(ShiroUtil.getPrincipalProperty("loginname").toString());
|
||||
audit.setUsername(ShiroUtil.getPrincipalProperty("username").toString());
|
||||
audit.setAuditTime(new Date());
|
||||
audit = auditService.insert(audit);
|
||||
ActivityBx aid = activityBxService.fetch(id);
|
||||
aid.setFinance_audit_id(audit.getId());
|
||||
aid.setState_id(flag ? "3080" : "3075");
|
||||
aid.setActivity_money(money);
|
||||
activityBxService.updateIgnoreNull(aid);
|
||||
} else {
|
||||
review.setLoginname(ShiroUtil.getPrincipalProperty("loginname").toString());
|
||||
review.setUsername(ShiroUtil.getPrincipalProperty("username").toString());
|
||||
review.setTime(DateUtil.getDate());
|
||||
review = reviewService.insert(review);
|
||||
Condolence condolence = condolenceService.fetch(id);
|
||||
condolence.setFinance_review(review.getId());
|
||||
condolence.setState_id(flag ? "3080" : "3075");
|
||||
condolence.setMoney(money);
|
||||
condolenceService.updateIgnoreNull(condolence);
|
||||
}
|
||||
Reimbursement reimbursement = reimbursementViService.fetch(Cnd.where("reimbursementId", "=", id));
|
||||
reimbursement.setState(flag ? ReimbursementState.VICE_CHAIRMAN : ReimbursementState.FINANCE_FAIL);
|
||||
|
||||
reimbursementViService.updateIgnoreNull(reimbursement);
|
||||
return null;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
package io.v.nutz.zhgh.reimbursement.controller;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.base.dao.CndPlus;
|
||||
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.base.model.Review;
|
||||
import io.v.nutz.base.service.AuditService;
|
||||
import io.v.nutz.base.service.ReviewService;
|
||||
import io.v.nutz.zhgh.reimbursement.constants.ReimbursementState;
|
||||
import io.v.nutz.zhgh.reimbursement.models.Reimbursement;
|
||||
import io.v.nutz.base.service.ViService;
|
||||
import io.v.nutz.sys.services.SysSignatureService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.zgfw.model.condolence.Condolence;
|
||||
import io.v.nutz.zhgh.zgfw.service.CondolenceService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/6/7 10:24
|
||||
* @description 单位书记
|
||||
*/
|
||||
@At("/platform/reimbursement/secretary")
|
||||
@IocBean
|
||||
@Ok("json")
|
||||
public class ReiSecretaryController {
|
||||
|
||||
@Inject("Reimbursement")
|
||||
private ViService<Reimbursement> reimbursementViService;
|
||||
|
||||
@Inject
|
||||
private ActivityBxService activityBxService;
|
||||
|
||||
@Inject
|
||||
private SysSignatureService sysSignatureService;
|
||||
|
||||
@Inject
|
||||
private AuditService auditService;
|
||||
|
||||
@Inject
|
||||
private ReviewService reviewService;
|
||||
|
||||
@Inject
|
||||
private CondolenceService condolenceService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/reimbursement/secretary.html")
|
||||
@RequiresPermissions("reimbursement.secretary")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("reimbursement.secretary")
|
||||
public Object pageData(PageForm page,
|
||||
@Param(value = "isAudit", required = false) boolean isAudit,
|
||||
@Param(value = "year", required = false) Integer year,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "reiItemId", required = false) Integer reiItemId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
rei.*,
|
||||
us.unionname,
|
||||
state.stateColor,
|
||||
state.stateName
|
||||
FROM
|
||||
`reimbursement` rei
|
||||
LEFT JOIN `user` us ON us.id = rei.userid
|
||||
LEFT JOIN condolence con ON con.id = rei.reimbursementId
|
||||
LEFT JOIN activity_bx bx ON bx.id = rei.reimbursementId
|
||||
LEFT JOIN audit_state state ON rei.State = state.stateId $condition
|
||||
""");
|
||||
CndPlus cnd = CndPlus.create();
|
||||
if (isAudit) {
|
||||
cnd.and(new Static("""
|
||||
(con.unit_secretary_review IS NOT NULL
|
||||
OR bx.unit_secretary_audit_id IS NOT NULL)
|
||||
"""));
|
||||
} else {
|
||||
cnd.and("rei.State", "=", ReimbursementState.UNIT_SECRETARY);
|
||||
}
|
||||
Vi.cndPlus(cnd, "rei.reimbursementItemId", "=", reiItemId);
|
||||
Vi.cndPlus(cnd, "YEAR(rei.applyTime)", "=", year);
|
||||
Vi.cndPlus(cnd, "us.unitid", "=", unitId);
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin")) {
|
||||
cnd.and("us.unionid", "=", Vi.getUnionId());
|
||||
}
|
||||
cnd.desc("rei.applyTime");
|
||||
sql.setCondition(cnd);
|
||||
return reimbursementViService.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("reimbursement.secretary")
|
||||
public Object doReview(String id, Boolean flag, Audit audit, Review review, Integer reimbursementItemId) {
|
||||
|
||||
|
||||
if (reimbursementItemId != 4) {
|
||||
audit.setLoginname(ShiroUtil.getPrincipalProperty("loginname").toString());
|
||||
audit.setUsername(ShiroUtil.getPrincipalProperty("username").toString());
|
||||
audit.setAuditTime(new Date());
|
||||
audit = auditService.insert(audit);
|
||||
ActivityBx aid = activityBxService.fetch(id);
|
||||
aid.setUnit_secretary_audit_id(audit.getId());
|
||||
aid.setState_id(flag ? "3070" : "3065");
|
||||
activityBxService.updateIgnoreNull(aid);
|
||||
} else {
|
||||
review.setLoginname(ShiroUtil.getPrincipalProperty("loginname").toString());
|
||||
review.setUsername(ShiroUtil.getPrincipalProperty("username").toString());
|
||||
review.setTime(DateUtil.getDate());
|
||||
review = reviewService.insert(review);
|
||||
Condolence condolence = condolenceService.fetch(id);
|
||||
condolence.setUnit_secretary_review(review.getId());
|
||||
condolence.setState_id(flag ? "3070" : "3065");
|
||||
condolenceService.updateIgnoreNull(condolence);
|
||||
}
|
||||
Reimbursement reimbursement = reimbursementViService.fetch(Cnd.where("reimbursementId", "=", id));
|
||||
reimbursement.setState(flag ? ReimbursementState.FINANCE : ReimbursementState.UNIT_SECRETARY_FAIL);
|
||||
|
||||
reimbursementViService.updateIgnoreNull(reimbursement);
|
||||
return null;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+180
@@ -0,0 +1,180 @@
|
||||
package io.v.nutz.zhgh.reimbursement.controller;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.zhgh.reimbursement.constants.ReimbursementState;
|
||||
import io.v.nutz.zhgh.reimbursement.services.ReimbursementService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/6/16 8:55
|
||||
* @description 报销待办
|
||||
*/
|
||||
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/Reimbursement/Agent")
|
||||
public class ReimbursementAgentController {
|
||||
|
||||
private static final String MODIFY = "/activity/reimbursement/list";
|
||||
private static final String SIGNATURE = "/platform/fw/condolence/be";
|
||||
private static final String UNION = "/platform/reimbursement/dma";
|
||||
private static final String UNIT_SECRETARY = "/platform/reimbursement/secretary";
|
||||
private static final String FINANCE = "/platform/reimbursement/finance";
|
||||
private static final String VICE_CHAIRMAN = "/platform/reimbursement/ViceChairman";
|
||||
private static final String STANDING_VICE_CHAIRMAN = "/platform/reimbursement/StandingViceChairman";
|
||||
@Inject
|
||||
private Vi vi;
|
||||
@Inject
|
||||
private ReimbursementService reimbursementService;
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object getAgenda() {
|
||||
final String title = "【职工报销】";
|
||||
|
||||
List<NutMap> result = new ArrayList<>();
|
||||
|
||||
if (ShiroUtil.hasAnyRoles("sysadmin")) {
|
||||
result.add(new NutMap().setv("title", title).setv("url", MODIFY).setv("iconClass", vi.getIconByPath(MODIFY)).setv("label", "待经办人修改").setv("number", getModifyCount()));
|
||||
result.add(new NutMap().setv("title", title).setv("url", SIGNATURE).setv("iconClass", vi.getIconByPath(SIGNATURE)).setv("label", "待慰问人签字").setv("number", getSignatureCount()));
|
||||
result.add(new NutMap().setv("title", title).setv("url", UNION).setv("iconClass", vi.getIconByPath(UNION)).setv("label", "待分工会审核").setv("number", getUcrCount()));
|
||||
result.add(new NutMap().setv("title", title).setv("url", UNIT_SECRETARY).setv("iconClass", vi.getIconByPath(UNIT_SECRETARY)).setv("label", "待单位书记审核").setv("number", getUnit_secretaryCount()));
|
||||
result.add(new NutMap().setv("title", title).setv("url", FINANCE).setv("iconClass", vi.getIconByPath(FINANCE)).setv("label", "待财务审核").setv("number", getFinanceCount()));
|
||||
result.add(new NutMap().setv("title", title).setv("url", VICE_CHAIRMAN).setv("iconClass", vi.getIconByPath(VICE_CHAIRMAN)).setv("label", "待分管副主席审核").setv("number", getVice_chairmanCount()));
|
||||
result.add(new NutMap().setv("title", title).setv("url", STANDING_VICE_CHAIRMAN).setv("iconClass", vi.getIconByPath(STANDING_VICE_CHAIRMAN)).setv("label", "待分管副主席审核").setv("number", getStanding_vice_chairmanCount()));
|
||||
} else {
|
||||
if (ShiroUtil.hasAnyRoles("gh03")) {
|
||||
result.add(new NutMap().setv("title", title).setv("url", UNIT_SECRETARY).setv("iconClass", vi.getIconByPath(UNIT_SECRETARY)).setv("label", "待单位书记审核").setv("number", getUnit_secretaryCount()));
|
||||
}
|
||||
if (ShiroUtil.hasAnyRoles("SchoolUnionAccountant")) {
|
||||
result.add(new NutMap().setv("title", title).setv("url", FINANCE).setv("iconClass", vi.getIconByPath(FINANCE)).setv("label", "待财务审核").setv("number", getFinanceCount()));
|
||||
}
|
||||
if (ShiroUtil.hasAnyRoles("wyh03")) {
|
||||
result.add(new NutMap().setv("title", title).setv("url", VICE_CHAIRMAN).setv("iconClass", vi.getIconByPath(VICE_CHAIRMAN)).setv("label", "待分管副主席审核").setv("number", getVice_chairmanCount()));
|
||||
}
|
||||
if (ShiroUtil.hasAnyRoles("wyh02")) {
|
||||
result.add(new NutMap().setv("title", title).setv("url", STANDING_VICE_CHAIRMAN).setv("iconClass", vi.getIconByPath(STANDING_VICE_CHAIRMAN)).setv("label", "待分管副主席审核").setv("number", getStanding_vice_chairmanCount()));
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 待申请人修改
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Object getModifyCount() {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT COUNT(1) FROM reimbursement $condition
|
||||
""");
|
||||
cnd.and("State", "=", ReimbursementState.MODIFY);
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin")) {
|
||||
cnd.and("userId", "=", ShiroUtil.getPrincipalProperty("id"));
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return reimbursementService.count(sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* 待慰问人签字
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Object getSignatureCount() {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT COUNT(1) FROM reimbursement $condition
|
||||
""");
|
||||
cnd.and("State", "=", ReimbursementState.SIGNATURE);
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin")) {
|
||||
cnd.and("userId", "=", ShiroUtil.getPrincipalProperty("id"));
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return reimbursementService.count(sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* 待工会主席审核
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private Integer getUcrCount() {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT COUNT(1) FROM reimbursement re LEFT JOIN `user` us ON re.userId=us.id $condition
|
||||
""");
|
||||
cnd.and("re.State", "=", ReimbursementState.UNION);
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin")) {
|
||||
cnd.and("us.unionid", "=", vi.getUnionId());
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return reimbursementService.count(sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* 待单位书记审核
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private Integer getUnit_secretaryCount() {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT COUNT(1) FROM reimbursement re LEFT JOIN `user` us ON re.userId=us.id $condition
|
||||
""");
|
||||
cnd.and("re.State", "=", ReimbursementState.UNIT_SECRETARY);
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin")) {
|
||||
cnd.and("us.unionid", "=", vi.getUnionId());
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return reimbursementService.count(sql);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 待财务审核
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Object getFinanceCount() {
|
||||
return reimbursementService.count(Cnd.where("State", "=", ReimbursementState.FINANCE));
|
||||
}
|
||||
|
||||
/**
|
||||
* 待分管副主席审核
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Object getVice_chairmanCount() {
|
||||
return reimbursementService.count(Cnd.where("State", "=", ReimbursementState.VICE_CHAIRMAN));
|
||||
}
|
||||
|
||||
/**
|
||||
* 待常务副主席审核
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Object getStanding_vice_chairmanCount() {
|
||||
return reimbursementService.count(Cnd.where("State", "=", ReimbursementState.STANDING_VICE_CHAIRMAN));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+131
@@ -0,0 +1,131 @@
|
||||
package io.v.nutz.zhgh.reimbursement.controller;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.base.utils.PageUtil;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.zhgh.jf.model.ActivityBx;
|
||||
import io.v.nutz.zhgh.jf.model.jf_use;
|
||||
import io.v.nutz.zhgh.jf.model.jf_yjgh;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.zhgh.reimbursement.models.ReimbursementNew;
|
||||
import io.v.nutz.zhgh.reimbursement.services.ReimbursementService;
|
||||
import io.v.nutz.base.service.ViService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.web.commons.slog.annotation.SLog;
|
||||
import io.v.nutz.zhgh.zgfw.service.CondolenceService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/6/2 18:09
|
||||
* @description 报销列表
|
||||
*/
|
||||
@At("/activity/reimbursement/list")
|
||||
@Ok("json:full")
|
||||
@IocBean
|
||||
public class ReimbursementListController {
|
||||
|
||||
@Inject
|
||||
private ReimbursementService reimbursementService;
|
||||
|
||||
@Inject("ActivityBx")
|
||||
private ViService<ActivityBx> activityBxViService;
|
||||
|
||||
@Inject("ReimbursementNew")
|
||||
private ViService<ReimbursementNew> reimbursementNewViService;
|
||||
|
||||
@Inject
|
||||
private CondolenceService condolenceService;
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/reimbursement/ReimbursementList.html")
|
||||
@RequiresPermissions("reimbursement.list")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("reimbursement.list")
|
||||
public Object pageData(PageForm page,
|
||||
@Param(value = "year", required = false) Integer year,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "reiItemId", required = false) String reiItemId,
|
||||
@Param(value = "person", required = false) String person) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
rei.*,
|
||||
be.username be_username,
|
||||
state.stateName,
|
||||
state.stateColor
|
||||
FROM
|
||||
`reimbursement_new` rei
|
||||
LEFT JOIN sys_user be ON be.id = rei.be_user
|
||||
LEFT JOIN audit_state state ON state.stateId = rei.state
|
||||
$condition
|
||||
""");
|
||||
cnd.andEX("YEAR ( rei.applyTime )", "=", year);
|
||||
cnd.andEX("rei.unitId", "=", unitId);
|
||||
cnd.andEX("rei.unionId", "=", unionId);
|
||||
if (Strings.isNotBlank(person)) {
|
||||
SqlExpressionGroup sqlExpressionGroup = new SqlExpressionGroup();
|
||||
sqlExpressionGroup.andLike("rei.loginName", person);
|
||||
sqlExpressionGroup.orLike("rei.userName", person);
|
||||
cnd.and(sqlExpressionGroup);
|
||||
}
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin")) {
|
||||
cnd.and("rei.userId", "=", ShiroUtil.getUserId());
|
||||
}
|
||||
if (Strings.isNotBlank(reiItemId) && reiItemId.equals("ww")) {
|
||||
cnd.and("rei.reimbursementItemId", "in", "'fyww','zfww'");
|
||||
} else {
|
||||
cnd.andEX("rei.reimbursementItemId", "=", reiItemId);
|
||||
}
|
||||
if (Strings.isNotBlank(page.getPageOrderName()) && Strings.isNotBlank(page.getPageOrderBy())) {
|
||||
cnd.orderBy(page.getPageOrderName(), PageUtil.getOrder(page.getPageOrderBy()));
|
||||
} else {
|
||||
cnd.desc("rei.applyTime");
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return reimbursementNewViService.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("reimbursement.list")
|
||||
public Object findOne(String id) {
|
||||
return reimbursementService.findOne(id);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("reimbursement.list")
|
||||
@SLog(tag = "工会报销", msg = "删除了一条记录", param = true, result = true)
|
||||
public Object doDelete(String id) {
|
||||
ReimbursementNew reimbursementNew = reimbursementNewViService.fetch(id);
|
||||
jf_yjgh yjgh = reimbursementNewViService.dao().fetch(jf_yjgh.class, Cnd.where("unionId", "=", Vi.getUnionId()).and("year", "=", DateUtil.getYear()).and("state", "=", 1));
|
||||
yjgh.setUsedQuota(yjgh.getUsedQuota() - reimbursementNew.getMoney());
|
||||
reimbursementNewViService.updateIgnoreNull(yjgh);
|
||||
reimbursementNewViService.dao().clear(jf_use.class, Cnd.where("apply_id", "=", reimbursementNew.getId()));
|
||||
|
||||
reimbursementNewViService.dao().clear(ReimbursementNew.class, Cnd.where("id", "=", id));
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+342
@@ -0,0 +1,342 @@
|
||||
package io.v.nutz.zhgh.reimbursement.controller;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.artofsolving.jodconverter.DocumentConverter;
|
||||
import com.artofsolving.jodconverter.openoffice.connection.OpenOfficeConnection;
|
||||
import com.artofsolving.jodconverter.openoffice.connection.SocketOpenOfficeConnection;
|
||||
import com.artofsolving.jodconverter.openoffice.converter.OpenOfficeDocumentConverter;
|
||||
import com.deepoove.poi.XWPFTemplate;
|
||||
import com.deepoove.poi.config.Configure;
|
||||
import com.deepoove.poi.data.PictureRenderData;
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.client.j2se.MatrixToImageWriter;
|
||||
import com.google.zxing.common.BitMatrix;
|
||||
import com.google.zxing.qrcode.QRCodeWriter;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.OfficeTemplateUtil;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.base.dao.CndPlus;
|
||||
import io.v.nutz.base.model.Audit;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.zhgh.reimbursement.services.ReimbursementService;
|
||||
import io.v.nutz.base.utils.ViTool;
|
||||
import io.v.nutz.web.commons.base.Globals;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.zgfw.service.CondolenceService;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.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.awt.image.BufferedImage;
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Base64;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/6/8 8:56
|
||||
* @description 报销汇总
|
||||
*/
|
||||
|
||||
@At("/platform/reimbursement/Summary")
|
||||
@IocBean
|
||||
@Ok("json")
|
||||
public class ReimbursementSummaryController {
|
||||
|
||||
@Inject
|
||||
private ReimbursementService reimbursementViService;
|
||||
|
||||
@Inject
|
||||
private CondolenceService condolenceService;
|
||||
|
||||
|
||||
@Inject
|
||||
private OfficeTemplateUtil officeTemplateUtil;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/reimbursement/Summary.html")
|
||||
@RequiresPermissions("reimbursement.Summary")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("reimbursement.Summary")
|
||||
public Object pageData(PageForm page,
|
||||
@Param(value = "jf_source", required = false) String jf_source,
|
||||
@Param(value = "reimbursementDate", required = false) String[] reimbursementDate,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "reiItemId", required = false) String reiItemId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
rei.*,
|
||||
be.username be_username,
|
||||
state.stateName,
|
||||
state.stateColor
|
||||
FROM
|
||||
`reimbursement_new` rei
|
||||
LEFT JOIN sys_user be ON be.id = rei.be_user
|
||||
LEFT JOIN audit_state state ON state.stateId = rei.state
|
||||
$condition
|
||||
""");
|
||||
CndPlus cnd = CndPlus.create();
|
||||
|
||||
Vi.cndPlus(cnd, "rei.jf_source", "=", jf_source);
|
||||
if (reimbursementDate.length > 0) {
|
||||
cnd.and("rei.applyTime", ">=", reimbursementDate[0]);
|
||||
cnd.and("rei.applyTime", "<=", reimbursementDate[1]);
|
||||
}
|
||||
Vi.cndPlus(cnd, "rei.unitId", "=", unitId);
|
||||
Vi.cndPlus(cnd, "rei.unionId", "=", unionId);
|
||||
if (Vi.isNotBlank(page.getSearchName(), page.getSearchKeyword())) {
|
||||
cnd.where().andLike(page.getSearchName(), page.getSearchKeyword());
|
||||
}
|
||||
if (Strings.isNotBlank(reiItemId) && reiItemId.equals("ww")) {
|
||||
cnd.and("rei.reimbursementItemId", "in", "'fyww','zfww'");
|
||||
} else {
|
||||
cnd.andEX("rei.reimbursementItemId", "=", reiItemId);
|
||||
}
|
||||
/* Vi.cndPlus(cnd, "rei.State", "=", ReimbursementState.SUCCESSFUL_REIMBURSEMENT);*/
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06,gh12,wyh02,wyh03")) {
|
||||
SqlExpressionGroup group = new SqlExpressionGroup();
|
||||
if (ShiroUtil.hasAnyRoles("gh01,H04")) {
|
||||
group.or("rei.unionId", "=", Vi.getUnionId());
|
||||
} else {
|
||||
group.or("rei.userId", "=", ShiroUtil.getPrincipalProperty("id"));
|
||||
}
|
||||
cnd.and(group);
|
||||
}
|
||||
cnd.desc("rei.applyTime");
|
||||
sql.setCondition(cnd);
|
||||
return reimbursementViService.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
}
|
||||
|
||||
private PictureRenderData getImg(String base64) throws IOException {
|
||||
String s = base64.split(",")[1];
|
||||
byte[] bytes = Base64.getDecoder().decode(s);
|
||||
return new PictureRenderData(70, 30, ".png", bytes);
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@RequiresPermissions("reimbursement.Summary")
|
||||
public void reiExport(String id, HttpServletResponse response, boolean Print) throws Exception {
|
||||
NutMap record = reimbursementViService.findOne(id);
|
||||
if ("3".equals(record.getString("jf_source"))) {
|
||||
Sql clubSql = Sqls.create("""
|
||||
SELECT
|
||||
cu.*,
|
||||
c.NAME as clubName
|
||||
FROM
|
||||
sys_club_user cu
|
||||
LEFT JOIN sys_club c ON c.id = cu.clubid
|
||||
$condition
|
||||
""");
|
||||
Cnd clubCnd = Cnd.NEW();
|
||||
clubCnd.and("userid", "=", record.getString("userId"));
|
||||
clubCnd.and("clubid", "=", record.getString("clubId"));
|
||||
clubSql.setCondition(clubCnd);
|
||||
List<NutMap> list = reimbursementViService.listMap(clubSql);
|
||||
if (Lang.isNotEmpty(list)) {
|
||||
String name = list.stream().map(o -> o.getString("clubName")).collect(Collectors.joining(","));
|
||||
record.put("unitName", name);
|
||||
}
|
||||
}
|
||||
QRCodeWriter qrCodeWriter = new QRCodeWriter();
|
||||
BitMatrix bitMatrix = qrCodeWriter.encode(record.getString("document_no"), BarcodeFormat.QR_CODE, 80, 80);
|
||||
BufferedImage bufferedImage = MatrixToImageWriter.toBufferedImage(bitMatrix);
|
||||
PictureRenderData pictureRenderData = new PictureRenderData(80, 80, ".png", bufferedImage);
|
||||
record.setv("qrcode", pictureRenderData);
|
||||
record.setv("applyTime", record.getString("applyTime").substring(0, 10));
|
||||
record.setv("money_big", Convert.digitToChinese(record.getDouble("money")));
|
||||
|
||||
String wtAct = "□慰问 □活动 □建家 □日常 □劳务 □专家";
|
||||
if (record.getString("reimbursementItemId").equals("fyww") || record.getString("reimbursementItemId").equals("zfww")) {
|
||||
wtAct = wtAct.replace("□慰问", "√慰问");
|
||||
} else if (record.getString("reimbursementItemId").equals("fyhd")) {
|
||||
wtAct = wtAct.replace("□活动", "√活动");
|
||||
} else if (record.getString("reimbursementItemId").equals("fyjj")) {
|
||||
wtAct = wtAct.replace("□建家", "√建家");
|
||||
} else if (record.getString("reimbursementItemId").equals("fyrc")) {
|
||||
wtAct = wtAct.replace("□日常", "√日常");
|
||||
} else if (record.getString("reimbursementItemId").equals("zflw")) {
|
||||
wtAct = wtAct.replace("□劳务", "√劳务");
|
||||
} else if (record.getString("reimbursementItemId").equals("zfzj")) {
|
||||
wtAct = wtAct.replace("□专家", "√专家");
|
||||
}
|
||||
|
||||
record.setv("bxxm", wtAct);
|
||||
|
||||
//经办人签字
|
||||
String us = record.getString("jbrSignData");
|
||||
if (Strings.isNotBlank(us)) {
|
||||
record.setv("us", getImg(us));
|
||||
}
|
||||
|
||||
//工会副主席
|
||||
Object accounting = record.get("accounting");
|
||||
if (accounting != null) {
|
||||
Audit audit = (Audit) accounting;
|
||||
record.setv("accSign", audit.getAuditSign() != null ? getImg(audit.getAuditSign()) : null);
|
||||
record.setv("accUserName", StrUtil.isBlank(audit.getUsername()) ? audit.getUsername() : "");
|
||||
record.setv("accTime", audit.getAuditTime() != null ? DateUtil.formatDate(audit.getAuditTime()) : null);
|
||||
record.setv("accOpinion", audit.getAuditOpinion());
|
||||
}
|
||||
record.setv("schoolName", Globals.schoolName);
|
||||
Configure config = Configure.newBuilder().build();
|
||||
String templateUrl;
|
||||
if (record.getString("reimbursementItemSort").equals("zf")) {
|
||||
templateUrl = officeTemplateUtil.getPath("reimbursementMoney");
|
||||
} else {
|
||||
templateUrl = officeTemplateUtil.getPath("reimbursement");
|
||||
}
|
||||
if (Print) {
|
||||
String uuid = R.UU32();
|
||||
|
||||
File docx = new File(uuid + ".docx");
|
||||
File pdf = new File(uuid + ".pdf");
|
||||
|
||||
OutputStream outputStream = new FileOutputStream(docx);
|
||||
|
||||
XWPFTemplate.compile(templateUrl, config).render(record).writeAndClose(outputStream);
|
||||
outputStream.close();
|
||||
|
||||
//打开连接
|
||||
OpenOfficeConnection connection = new SocketOpenOfficeConnection("127.0.0.1", 8100);
|
||||
connection.connect();
|
||||
DocumentConverter converter = new OpenOfficeDocumentConverter(connection);
|
||||
//执行转换
|
||||
converter.convert(docx, pdf);
|
||||
connection.disconnect();
|
||||
|
||||
|
||||
InputStream pdfStream = new FileInputStream(pdf);
|
||||
|
||||
IOUtils.copy(pdfStream, response.getOutputStream());
|
||||
|
||||
pdfStream.close();
|
||||
docx.delete();
|
||||
pdf.delete();
|
||||
} else {
|
||||
String fileName = "";
|
||||
if (record.getString("reimbursementItemSort").equals("zf")) {
|
||||
fileName = Globals.schoolName + "支付凭证";
|
||||
} else {
|
||||
fileName = Globals.schoolName + "工会凭证报销单";
|
||||
}
|
||||
|
||||
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(templateUrl, config).render(record).writeAndClose(response.getOutputStream());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@At()
|
||||
@Ok("void")
|
||||
@RequiresPermissions("reimbursement.Summary")
|
||||
public void doExportUserExcel(HttpServletResponse response,
|
||||
@Param(value = "reiItemId", required = false) String reiItemId,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "searchKeyword", required = false) String searchKeyword,
|
||||
@Param(value = "searchName", required = false) String searchName,
|
||||
@Param(value = "reimbursementDate", required = false) String[] reimbursementDate) {
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
rei.*,
|
||||
be.username be_username,
|
||||
state.stateName,
|
||||
state.stateColor
|
||||
FROM
|
||||
`reimbursement_new` rei
|
||||
LEFT JOIN sys_user be ON be.id = rei.be_user
|
||||
LEFT JOIN audit_state state ON state.stateId = rei.state
|
||||
$condition
|
||||
""");
|
||||
CndPlus cnd = CndPlus.create();
|
||||
|
||||
Vi.cndPlus(cnd, "rei.reimbursementItemId", "=", reiItemId);
|
||||
if (reimbursementDate != null && reimbursementDate.length > 0) {
|
||||
Vi.cndPlus(cnd, "rei.applyTime", ">=", reimbursementDate[0]);
|
||||
Vi.cndPlus(cnd, "rei.applyTime", "<=", reimbursementDate[1]);
|
||||
}
|
||||
Vi.cndPlus(cnd, "rei.unitId", "=", unitId);
|
||||
Vi.cndPlus(cnd, "rei.unionId", "=", unionId);
|
||||
if (Vi.isNotBlank(searchName, searchKeyword)) {
|
||||
cnd.where().andLike(searchName, searchKeyword);
|
||||
}
|
||||
cnd.desc("rei.applyTime");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> mapList = reimbursementViService.listMap(sql);
|
||||
mapList.forEach(v -> {
|
||||
v.setv("description", Strings.isNotBlank(v.getString("activity_name")) ? ("活动名称:" + v.getString("activity_name")) : ("被慰问人:" + v.getString("be_username")));
|
||||
if ("3".equals(v.getString("jf_source"))) {
|
||||
Sql clubSql = Sqls.create("""
|
||||
SELECT
|
||||
cu.*,
|
||||
c.NAME as clubName
|
||||
FROM
|
||||
sys_club_user cu
|
||||
LEFT JOIN sys_club c ON c.id = cu.clubid
|
||||
$condition
|
||||
""");
|
||||
Cnd clubCnd = Cnd.NEW();
|
||||
clubCnd.and("userid", "=", v.getString("userId"));
|
||||
clubCnd.and("clubid", "=", v.getString("clubId"));
|
||||
clubSql.setCondition(clubCnd);
|
||||
List<NutMap> list = reimbursementViService.listMap(clubSql);
|
||||
if (Lang.isNotEmpty(list)) {
|
||||
String name = list.stream().map(o -> o.getString("clubName")).collect(Collectors.joining(","));
|
||||
v.put("unitName", name);
|
||||
}
|
||||
}
|
||||
});
|
||||
List<ExcelExportEntity> exportEntities = new ArrayList<>();
|
||||
exportEntities.add(new ExcelExportEntity("经办人工号", "loginName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("姓名", "userName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("所属工会", "unionName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("所属单位", "unitName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("申请时间", "applyTime", 20));
|
||||
exportEntities.add(new ExcelExportEntity("报销项目", "reimbursementItemName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("备注", "description", 20));
|
||||
exportEntities.add(new ExcelExportEntity("金额(元)", "money", 20));
|
||||
|
||||
try {
|
||||
ViTool.excelResponse(response, "报销汇总表.xlsx");
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, exportEntities, mapList);
|
||||
workbook.write(response.getOutputStream());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+142
@@ -0,0 +1,142 @@
|
||||
package io.v.nutz.zhgh.reimbursement.controller;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.base.dao.CndPlus;
|
||||
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.base.model.Review;
|
||||
import io.v.nutz.base.service.AuditService;
|
||||
import io.v.nutz.base.service.ReviewService;
|
||||
import io.v.nutz.zhgh.reimbursement.constants.ReimbursementState;
|
||||
import io.v.nutz.zhgh.reimbursement.models.Reimbursement;
|
||||
import io.v.nutz.base.service.ViService;
|
||||
import io.v.nutz.sys.services.SysSignatureService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.zgfw.model.condolence.Condolence;
|
||||
import io.v.nutz.zhgh.zgfw.service.CondolenceService;
|
||||
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.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/6/7 16:58
|
||||
* @description 常务副主席审核
|
||||
*/
|
||||
|
||||
@At("/platform/reimbursement/StandingViceChairman")
|
||||
@IocBean
|
||||
@Ok("json")
|
||||
public class StandingViceChairmanController {
|
||||
|
||||
@Inject("Reimbursement")
|
||||
private ViService<Reimbursement> reimbursementViService;
|
||||
|
||||
@Inject
|
||||
private ActivityBxService activityBxService;
|
||||
|
||||
@Inject
|
||||
private SysSignatureService sysSignatureService;
|
||||
|
||||
@Inject
|
||||
private AuditService auditService;
|
||||
|
||||
@Inject
|
||||
private ReviewService reviewService;
|
||||
|
||||
@Inject
|
||||
private CondolenceService condolenceService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/reimbursement/StandingViceChairman.html")
|
||||
@RequiresPermissions("reimbursement.StandingViceChairman")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("reimbursement.StandingViceChairman")
|
||||
public Object pageData(PageForm page,
|
||||
@Param(value = "isAudit", required = false) boolean isAudit,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "year", required = false) Integer year,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "reiItemId", required = false) Integer reiItemId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
rei.*,
|
||||
us.unionname,
|
||||
state.stateColor,
|
||||
state.stateName
|
||||
FROM
|
||||
`reimbursement` rei
|
||||
LEFT JOIN `user` us ON us.id = rei.userid
|
||||
LEFT JOIN condolence con ON con.id = rei.reimbursementId
|
||||
LEFT JOIN activity_bx bx ON bx.id = rei.reimbursementId
|
||||
LEFT JOIN audit_state state ON rei.State = state.stateId $condition
|
||||
""");
|
||||
CndPlus cnd = CndPlus.create();
|
||||
cnd.and("rei.State", isAudit ? ">" : "=", ReimbursementState.STANDING_VICE_CHAIRMAN);
|
||||
|
||||
Vi.cndPlus(cnd, "rei.reimbursementItemId", "=", reiItemId);
|
||||
Vi.cndPlus(cnd, "YEAR(rei.applyTime)", "=", year);
|
||||
Vi.cndPlus(cnd, "us.unitid", "=", unitId);
|
||||
Vi.cndPlus(cnd, "us.unionid", "=", unionId);
|
||||
|
||||
if (Vi.isNotBlank(page.getSearchName(), page.getSearchKeyword())) {
|
||||
cnd.where().andLike(page.getSearchName(), page.getSearchKeyword());
|
||||
}
|
||||
cnd.desc("rei.applyTime");
|
||||
sql.setCondition(cnd);
|
||||
return reimbursementViService.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("reimbursement.StandingViceChairman")
|
||||
public Object doReview(String id, Boolean flag, Audit audit, Review review, Integer reimbursementItemId) {
|
||||
|
||||
|
||||
if (reimbursementItemId != 4) {
|
||||
audit.setLoginname(ShiroUtil.getPrincipalProperty("loginname").toString());
|
||||
audit.setUsername(ShiroUtil.getPrincipalProperty("username").toString());
|
||||
audit.setAuditTime(new Date());
|
||||
audit = auditService.insert(audit);
|
||||
ActivityBx aid = activityBxService.fetch(id);
|
||||
aid.setStanding_vice_chairman_audit_id(audit.getId());
|
||||
aid.setState_id(flag ? "3100" : "3095");
|
||||
activityBxService.updateIgnoreNull(aid);
|
||||
} else {
|
||||
review.setLoginname(ShiroUtil.getPrincipalProperty("loginname").toString());
|
||||
review.setUsername(ShiroUtil.getPrincipalProperty("username").toString());
|
||||
review.setTime(DateUtil.getDate());
|
||||
review = reviewService.insert(review);
|
||||
Condolence condolence = condolenceService.fetch(id);
|
||||
condolence.setExecutive_chairman_review(review.getId());
|
||||
condolence.setState_id(flag ? "3100" : "3095");
|
||||
condolenceService.updateIgnoreNull(condolence);
|
||||
}
|
||||
Reimbursement reimbursement = reimbursementViService.fetch(Cnd.where("reimbursementId", "=", id));
|
||||
reimbursement.setState(flag ? ReimbursementState.SUCCESSFUL_REIMBURSEMENT : ReimbursementState.STANDING_VICE_CHAIRMAN_FAIL);
|
||||
|
||||
reimbursementViService.updateIgnoreNull(reimbursement);
|
||||
return null;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
package io.v.nutz.zhgh.reimbursement.controller;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.base.dao.CndPlus;
|
||||
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.base.model.Review;
|
||||
import io.v.nutz.base.service.AuditService;
|
||||
import io.v.nutz.base.service.ReviewService;
|
||||
import io.v.nutz.zhgh.reimbursement.constants.ReimbursementState;
|
||||
import io.v.nutz.zhgh.reimbursement.models.Reimbursement;
|
||||
import io.v.nutz.base.service.ViService;
|
||||
import io.v.nutz.sys.services.SysSignatureService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.zgfw.model.condolence.Condolence;
|
||||
import io.v.nutz.zhgh.zgfw.service.CondolenceService;
|
||||
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.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/6/7 15:27
|
||||
* @description 分管副主席
|
||||
*/
|
||||
@At("/platform/reimbursement/ViceChairman")
|
||||
@IocBean
|
||||
@Ok("json")
|
||||
public class ViceChairmanController {
|
||||
|
||||
@Inject("Reimbursement")
|
||||
private ViService<Reimbursement> reimbursementViService;
|
||||
|
||||
@Inject
|
||||
private ActivityBxService activityBxService;
|
||||
|
||||
@Inject
|
||||
private SysSignatureService sysSignatureService;
|
||||
|
||||
@Inject
|
||||
private AuditService auditService;
|
||||
|
||||
@Inject
|
||||
private ReviewService reviewService;
|
||||
|
||||
@Inject
|
||||
private CondolenceService condolenceService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/reimbursement/ViceChairman.html")
|
||||
@RequiresPermissions("reimbursement.ViceChairman")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("reimbursement.ViceChairman")
|
||||
public Object pageData(PageForm page,
|
||||
@Param(value = "isAudit", required = false) boolean isAudit,
|
||||
@Param(value = "year", required = false) Integer year,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "reiItemId", required = false) Integer reiItemId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
rei.*,
|
||||
us.unionname,
|
||||
state.stateColor,
|
||||
state.stateName
|
||||
FROM
|
||||
`reimbursement` rei
|
||||
LEFT JOIN `user` us ON us.id = rei.userid
|
||||
LEFT JOIN condolence con ON con.id = rei.reimbursementId
|
||||
LEFT JOIN activity_bx bx ON bx.id = rei.reimbursementId
|
||||
LEFT JOIN audit_state state ON rei.State = state.stateId $condition
|
||||
""");
|
||||
CndPlus cnd = CndPlus.create();
|
||||
cnd.and("rei.State", isAudit ? ">" : "=", ReimbursementState.VICE_CHAIRMAN);
|
||||
|
||||
Vi.cndPlus(cnd, "rei.reimbursementItemId", "=", reiItemId);
|
||||
Vi.cndPlus(cnd, "YEAR(rei.applyTime)", "=", year);
|
||||
Vi.cndPlus(cnd, "us.unitid", "=", unitId);
|
||||
Vi.cndPlus(cnd, "us.unionid", "=", unionId);
|
||||
cnd.desc("rei.applyTime");
|
||||
sql.setCondition(cnd);
|
||||
return reimbursementViService.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("reimbursement.ViceChairman")
|
||||
public Object doReview(String id, Boolean flag, Audit audit, Review review, Integer reimbursementItemId) {
|
||||
|
||||
|
||||
if (reimbursementItemId != 4) {
|
||||
audit.setLoginname(ShiroUtil.getPrincipalProperty("loginname").toString());
|
||||
audit.setUsername(ShiroUtil.getPrincipalProperty("username").toString());
|
||||
audit.setAuditTime(new Date());
|
||||
audit = auditService.insert(audit);
|
||||
ActivityBx aid = activityBxService.fetch(id);
|
||||
aid.setVice_chairman_audit_id(audit.getId());
|
||||
aid.setState_id(flag ? "3090" : "3085");
|
||||
activityBxService.updateIgnoreNull(aid);
|
||||
} else {
|
||||
review.setLoginname(ShiroUtil.getPrincipalProperty("loginname").toString());
|
||||
review.setUsername(ShiroUtil.getPrincipalProperty("username").toString());
|
||||
review.setTime(DateUtil.getDate());
|
||||
review = reviewService.insert(review);
|
||||
Condolence condolence = condolenceService.fetch(id);
|
||||
condolence.setVice_chairman_review(review.getId());
|
||||
condolence.setState_id(flag ? "3090" : "3085");
|
||||
condolenceService.updateIgnoreNull(condolence);
|
||||
}
|
||||
Reimbursement reimbursement = reimbursementViService.fetch(Cnd.where("reimbursementId", "=", id));
|
||||
reimbursement.setState(flag ? ReimbursementState.STANDING_VICE_CHAIRMAN : ReimbursementState.VICE_CHAIRMAN_FAIL);
|
||||
|
||||
reimbursementViService.updateIgnoreNull(reimbursement);
|
||||
return null;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,236 @@
|
||||
package io.v.nutz.zhgh.reimbursement.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
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.zhgh.jf.model.jf_club;
|
||||
import io.v.nutz.zhgh.jf.model.jf_school;
|
||||
import io.v.nutz.zhgh.jf.model.jf_yjgh;
|
||||
import io.v.nutz.zhgh.reimbursement.constants.ReimbursementState;
|
||||
import io.v.nutz.zhgh.reimbursement.models.ReimbursementNew;
|
||||
import io.v.nutz.sys.models.Sys_club_user;
|
||||
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.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
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;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*
|
||||
* @Author zhf 报销新
|
||||
* @Date 2022/7/21 9:20
|
||||
*/
|
||||
|
||||
@At("/platform/reimbursement/applyNew")
|
||||
@Ok("json:full")
|
||||
@IocBean
|
||||
public class applyNewController {
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private MsgApi msgApi;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/reimbursement/applyNew.html")
|
||||
@RequiresPermissions("reimbursement.applyNew")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("reimbursement.applyNew")
|
||||
@SLog(tag = "工会报销", msg = "新增一条记录", param = true, result = true)
|
||||
public Object doAdd(@Param("data") ReimbursementNew reimbursementNew) {
|
||||
//查询发票号码有没有重复的
|
||||
String billNumber = reimbursementNew.getBillNumber();
|
||||
if (StrUtil.isNotBlank(billNumber)) {
|
||||
String str = billNumber.contains(",") ? "," : ",";
|
||||
String[] split = billNumber.split(str);
|
||||
for (String s : split) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.where().andLike("billNumber", s);
|
||||
int billNumberCount = dao.count(ReimbursementNew.class, cnd);
|
||||
if (billNumberCount > 0) {
|
||||
return Result.error("发票号码【%s】已存在".formatted(s));
|
||||
}
|
||||
}
|
||||
}
|
||||
reimbursementNew.setUserId(ShiroUtil.getUserId());
|
||||
reimbursementNew.setUnitId(ShiroUtil.getUnitId());
|
||||
reimbursementNew.setUnionId(Vi.getUnionId());
|
||||
reimbursementNew.setState(ReimbursementState.AUDIT_CONFIRM);
|
||||
reimbursementNew.setApplyTime(DateUtil.getDateTime());
|
||||
baseService.insert(reimbursementNew);
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.loginname
|
||||
FROM
|
||||
sys_user_role role
|
||||
LEFT JOIN sys_user u ON u.id = role.userId
|
||||
WHERE
|
||||
role.roleId = @kj
|
||||
""").setParam("kj", Roles.XGHKJ);
|
||||
List<NutMap> list = baseService.listMap(sql);
|
||||
list.forEach(v -> {
|
||||
//msgApi.sendWxMsg("%s(%s)提交了一条报销申请待您审核,请前往智慧工会查看!".formatted(reimbursementNew.getUserName(), reimbursementNew.getLoginName()), v.getString("loginname"));
|
||||
});
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("reimbursement.applyNew")
|
||||
public Object findOne(String id) {
|
||||
ReimbursementNew fetch = baseService.dao().fetch(ReimbursementNew.class, id);
|
||||
return fetch;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("reimbursement.applyNew")
|
||||
@SLog(tag = "工会报销", msg = "编辑一条记录", param = true, result = true)
|
||||
public Object doEdit(@Param("data") ReimbursementNew reimbursementNew) {
|
||||
//查询发票号码有没有重复的
|
||||
String billNumber = reimbursementNew.getBillNumber();
|
||||
if (StrUtil.isNotBlank(billNumber)) {
|
||||
String str = billNumber.contains(",") ? "," : ",";
|
||||
String[] split = billNumber.split(str);
|
||||
for (String s : split) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("id", "!=", reimbursementNew.getId());
|
||||
cnd.where().andLike("billNumber", s);
|
||||
int billNumberCount = dao.count(ReimbursementNew.class, cnd);
|
||||
if (billNumberCount > 0) {
|
||||
return Result.error("发票号码【%s】已存在".formatted(s));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (reimbursementNew.getState().equals(ReimbursementState.MODIFY)) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.loginname
|
||||
FROM
|
||||
sys_user_role role
|
||||
LEFT JOIN sys_user u ON u.id = role.userId
|
||||
WHERE
|
||||
role.roleId = @kj
|
||||
""").setParam("kj", Roles.XGHKJ);
|
||||
List<NutMap> list = baseService.listMap(sql);
|
||||
list.forEach(v -> {
|
||||
//msgApi.sendWxMsg("%s(%s)提交了一条报销申请待您审核,请前往智慧工会查看!".formatted(reimbursementNew.getUserName(), reimbursementNew.getLoginName()), v.getString("loginname"));
|
||||
});
|
||||
}
|
||||
reimbursementNew.setState(ReimbursementState.AUDIT_CONFIRM);
|
||||
baseService.updateIgnoreNull(reimbursementNew);
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresPermissions("reimbursement.applyNew")
|
||||
public Object getBalance() {
|
||||
jf_yjgh yjgh = baseService.dao().fetch(jf_yjgh.class, Cnd.where("unionId", "=", Vi.getUnionId()).and("year", "=", DateUtil.getYear()).and("state", "=", 1));
|
||||
if (yjgh != null) {
|
||||
double balance = yjgh.getTotalQuota() - (yjgh.getUsedQuota() != null ? yjgh.getUsedQuota() : 0);
|
||||
BigDecimal bigDecimal = new BigDecimal(balance);
|
||||
double value = bigDecimal.setScale(2, RoundingMode.HALF_UP).doubleValue();
|
||||
return Result.success(value);
|
||||
}
|
||||
return Result.success(0f);
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresPermissions("reimbursement.applyNew")
|
||||
public Object getSchoolBudget() {
|
||||
jf_school jfSchool = baseService.dao().fetch(jf_school.class, Cnd.where("year", "=", DateUtil.getYear()).and("state", "=", 1));
|
||||
if (jfSchool != null) {
|
||||
double balance = jfSchool.getTotalQuota() - (jfSchool.getUsedQuota() != null ? jfSchool.getUsedQuota() : 0);
|
||||
BigDecimal bigDecimal = new BigDecimal(balance);
|
||||
double value = bigDecimal.setScale(2, RoundingMode.HALF_UP).doubleValue();
|
||||
return Result.success(value);
|
||||
}
|
||||
return Result.success(0f);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@RequiresPermissions("reimbursement.applyNew")
|
||||
public Object getClubBudget(@Param(value = "clubId", required = false) String clubId) {
|
||||
jf_club jf_club = baseService.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
|
||||
@RequiresPermissions("reimbursement.applyNew")
|
||||
public Object getLastData(@Param(value = "queryString", required = false) String queryString) {
|
||||
Sql sql = Sqls.create("""
|
||||
select
|
||||
bankUserName,
|
||||
bankCardNumber,
|
||||
bankOfDeposit,
|
||||
applyTime,
|
||||
CONCAT(bankUserName,'(',bankCardNumber,')') as value
|
||||
from
|
||||
reimbursement_new
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.where().andLike("bankUserName", queryString);
|
||||
cnd.and("userId", "=", ShiroUtil.getPrincipalProperty("id"));
|
||||
cnd.desc("applyTime");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = baseService.listMap(sql);
|
||||
return list;
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresPermissions("reimbursement.applyNew")
|
||||
public Object validRole(String val) {
|
||||
if (ShiroUtil.hasAnyRoles("sysadmin")) {
|
||||
return Result.success();
|
||||
}
|
||||
if ("2".equals(val)) {
|
||||
if (!ShiroUtil.hasAnyRoles("gh01, H04")) {
|
||||
return Result.error("分工会报销只能由分工会主席操作");
|
||||
}
|
||||
} else if ("3".equals(val)) {
|
||||
int count = baseService.dao().count(Sys_club_user.class, Cnd.where("userid", "=", ShiroUtil.getPrincipalProperty("id"))
|
||||
.and("sf", "=", 1));
|
||||
if (count == 0) {
|
||||
return Result.error("协会/社团报销只能由会长操作");
|
||||
}
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
package io.v.nutz.zhgh.reimbursement.models;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/5/31 15:32
|
||||
* @description 工会报销
|
||||
*/
|
||||
@Data
|
||||
@Table("reimbursement")
|
||||
public class Reimbursement {
|
||||
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("对应报销项目id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String reimbursementId;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("经办人id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String userId;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("经办人姓名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String userName;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("工号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String loginName;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("单位")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String unitName;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("电话")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String mobile;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("报销项目Id(1.文体活动,2.日常活动,3.其它活动,4.慰问,5困难帮扶)")
|
||||
@ColDefine(type = ColType.INT, width = 2)
|
||||
private Integer reimbursementItemId;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("报销项目名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 10)
|
||||
private String reimbursementItemName;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("状态")
|
||||
@ColDefine(type = ColType.INT, width = 10)
|
||||
private Integer State;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("申请时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String applyTime;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("付款人Id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String payerId;
|
||||
|
||||
@Column
|
||||
@Comment("支付方式Id")
|
||||
@ColDefine(type = ColType.INT, width = 2)
|
||||
private Integer paymentMethodId;
|
||||
|
||||
@Column
|
||||
@Comment("支付方式名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String paymentMethodName;
|
||||
|
||||
@Column
|
||||
@Comment("户名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String bankUserName;
|
||||
|
||||
@Column
|
||||
@Comment("账号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String bankCardNumber;
|
||||
|
||||
@Column
|
||||
@Comment("开户行")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String bankOfDeposit;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,310 @@
|
||||
package io.v.nutz.zhgh.reimbursement.models;
|
||||
|
||||
import io.v.nutz.sys.models.Sys_file;
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.DB;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
import org.nutz.integration.json4excel.annotation.J4EIgnore;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*
|
||||
* @Author zhf 报销新表
|
||||
* @Date 2022/7/21 11:29
|
||||
*/
|
||||
|
||||
@Data
|
||||
@Table
|
||||
public class ReimbursementNew {
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("经办人id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String userId;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("经办人姓名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String userName;
|
||||
|
||||
@Column
|
||||
@Comment("经办人电话")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String mobile;
|
||||
|
||||
@Column
|
||||
@Comment("工号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String loginName;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("单位")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String unitName;
|
||||
|
||||
@Column
|
||||
@Comment("单位id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unitId;
|
||||
|
||||
@Column
|
||||
@Comment("社团id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String clubId;
|
||||
|
||||
@Column
|
||||
@Comment("工会")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String unionName;
|
||||
|
||||
@Column
|
||||
@Comment("工会id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unionId;
|
||||
|
||||
@Column
|
||||
@Comment("报销经费来源")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String jf_source;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("慰问人电话")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String conMobile;
|
||||
|
||||
@Column
|
||||
@Comment("报销类别")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 10)
|
||||
private String reimbursementItemSort;
|
||||
|
||||
@Column
|
||||
@Comment("报销项目")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 10)
|
||||
private String reimbursementItemId;
|
||||
|
||||
@Column
|
||||
@Comment("报销项目名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 10)
|
||||
private String reimbursementItemName;
|
||||
|
||||
@Column
|
||||
@Comment("状态")
|
||||
@ColDefine(type = ColType.INT, width = 10)
|
||||
private Integer State;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("申请时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String applyTime;
|
||||
|
||||
@Column
|
||||
@Comment("支付方式Id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 10)
|
||||
private String paymentMethodId;
|
||||
|
||||
@Column
|
||||
@Comment("支付方式名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String paymentMethodName;
|
||||
|
||||
@Column
|
||||
@Comment("户名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String bankUserName;
|
||||
|
||||
@Column
|
||||
@Comment("账号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String bankCardNumber;
|
||||
|
||||
@Column
|
||||
@Comment("开户行")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String bankOfDeposit;
|
||||
|
||||
@Column
|
||||
@Comment("参加慰问人员")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String personnel;
|
||||
|
||||
@Column
|
||||
@Comment("附件数量")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String files_num;
|
||||
|
||||
@Column
|
||||
@Comment("备注")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 500)
|
||||
private String remark;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("报销事由")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String cause;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("附件")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<Sys_file> files;
|
||||
|
||||
@Column
|
||||
@Comment("经办人签字id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String signId;
|
||||
|
||||
@Column
|
||||
@Comment("会计审核id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String accountingAuditId;
|
||||
|
||||
@Column
|
||||
@Comment("单据号")
|
||||
@Prev({
|
||||
@SQL(db = DB.MYSQL, value = "SELECT CONCAT(YEAR(NOW()),LPAD(RIGHT((SELECT IFNULL(MAX(document_no),0) from Condolence WHERE LEFT(document_no,4) = YEAR(NOW())),5)+1, 5, 0) )"),
|
||||
})
|
||||
private Integer document_no;
|
||||
|
||||
|
||||
/**
|
||||
* 慰问
|
||||
*/
|
||||
|
||||
@Column
|
||||
@Comment("被慰问人")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String be_user;
|
||||
|
||||
@Column
|
||||
@Comment("慰问类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String type;
|
||||
|
||||
@Column
|
||||
@Comment("性别")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String sex;
|
||||
|
||||
@Column
|
||||
@Comment("生日")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String birthday;
|
||||
|
||||
@Column
|
||||
@Comment("身份证号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String idCard;
|
||||
|
||||
@Column
|
||||
@Comment("慰问方式")
|
||||
@J4EIgnore
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String way;
|
||||
|
||||
@Column
|
||||
@Comment("发生时间")
|
||||
@J4EIgnore
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String occur_time;
|
||||
|
||||
@Column
|
||||
@Comment("慰问金额")
|
||||
@J4EIgnore
|
||||
@ColDefine(type = ColType.FLOAT, width = 10, precision = 2)
|
||||
private Double money;
|
||||
|
||||
@Column
|
||||
@Comment("住院开始时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String starting_time;
|
||||
|
||||
@Column
|
||||
@Comment("住院结束时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String end_time;
|
||||
|
||||
@Column
|
||||
@Comment("所在医院")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String the_hospital;
|
||||
|
||||
@Column
|
||||
@Comment("住院病由")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String hospital_by;
|
||||
|
||||
@Column
|
||||
@Comment("当年次数")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String hospital_yearnum;
|
||||
|
||||
@Column
|
||||
@Comment("结婚时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String marry_time;
|
||||
|
||||
@Column
|
||||
@Comment("去逝时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String dead_time;
|
||||
|
||||
@Column
|
||||
@Comment("生育时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String birth_time;
|
||||
|
||||
@Column
|
||||
@Comment("去逝与被慰问人关系")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String dead_gx;
|
||||
|
||||
|
||||
/**
|
||||
* 活动
|
||||
*/
|
||||
|
||||
@Column
|
||||
@Comment("活动时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String activity_time;
|
||||
|
||||
@Column
|
||||
@Comment("活动地点")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String venue;
|
||||
|
||||
@Column
|
||||
@Comment("活动名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String activity_name;
|
||||
|
||||
@Column
|
||||
@Comment("活动人数")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String activity_number;
|
||||
|
||||
@Column
|
||||
@Comment("活动类型(1.基层工会,2.校工会,3.社团)")
|
||||
@ColDefine(type = ColType.INT, width = 2)
|
||||
private Integer activity_type;
|
||||
|
||||
@Column
|
||||
@Comment("发票号码")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 300)
|
||||
private String billNumber;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package io.v.nutz.zhgh.reimbursement.services;
|
||||
|
||||
import io.v.nutz.zhgh.reimbursement.models.Reimbursement;
|
||||
import io.v.nutz.base.service.ViService;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/6/3 10:16
|
||||
* @description
|
||||
*/
|
||||
public interface ReimbursementService extends ViService<Reimbursement> {
|
||||
|
||||
NutMap findOne(String id);
|
||||
|
||||
}
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
package io.v.nutz.zhgh.reimbursement.services.impl;
|
||||
|
||||
import io.v.nutz.base.service.AuditService;
|
||||
import io.v.nutz.zhgh.reimbursement.models.Reimbursement;
|
||||
import io.v.nutz.zhgh.reimbursement.services.ReimbursementService;
|
||||
import io.v.nutz.base.service.impl.ViServiceImpl;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/6/3 10:17
|
||||
* @description
|
||||
*/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class ReimbursementServiceImpl extends ViServiceImpl<Reimbursement> implements ReimbursementService {
|
||||
@Inject
|
||||
private AuditService auditService;
|
||||
|
||||
public ReimbursementServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NutMap findOne(String id) {
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
rei.*,
|
||||
be.username be_username,
|
||||
be.loginname be_loginname,
|
||||
state.stateName,
|
||||
state.stateColor,
|
||||
type.`name` typeName,
|
||||
type.`code` typeCode,
|
||||
sign.`data` jbrSignData
|
||||
FROM
|
||||
`reimbursement_new` rei
|
||||
LEFT JOIN sys_user be ON be.id = rei.be_user
|
||||
LEFT JOIN audit_state state ON state.stateId = rei.state
|
||||
LEFT JOIN sys_signature sign ON sign.id = rei.signId
|
||||
LEFT JOIN condolence_type type ON type.id=rei.type
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("rei.id", "=", id);
|
||||
sql.setCondition(cnd);
|
||||
NutMap record = listMap(sql).get(0);
|
||||
|
||||
if (Strings.isNotBlank(record.getString("accountingAuditId"))) {
|
||||
record.setv("accounting", auditService.fetch(record.getString("accountingAuditId")));
|
||||
}
|
||||
|
||||
|
||||
return record;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user