From 568dc5e1697f23e85fd69f7dc5f7bcc18a5c3ac4 Mon Sep 17 00:00:00 2001 From: zhouhefeng Date: Sat, 25 Apr 2026 18:20:04 +0800 Subject: [PATCH] commit --- .../ActivitySportsInfoManageController.java | 30 +- .../ActivitySportsResultsController.java | 90 +++- .../sports/models/ActivitySchool.java | 5 - .../ActivitySportsApplyUserService.java | 2 - .../sports/service/ActivitySportsService.java | 6 +- .../ActivitySportsApplyUserServiceImpl.java | 105 +---- .../impl/ActivitySportsServiceImpl.java | 88 +--- .../common/ClubCommonController.java | 12 +- .../OutlayManageUnionAllocateService.java | 63 ++- .../OutlayManageUnionAllocateServiceImpl.java | 258 ++++++++++- .../impl/OutlayUseDetailServiceImpl.java | 61 ++- .../OutlayManageUnionAllocateController.java | 136 +++--- .../UnionReimburseApplyController.java | 11 +- .../UnionReimburseReviewController.java | 34 +- .../service/UnionReimburseService.java | 17 +- .../impl/UnionReimburseServiceImpl.java | 254 ++++++++++- .../DifficultHelpApplyController.java | 19 +- .../service/DifficultHelpCommonService.java | 18 + .../impl/DifficultHelpCommonServiceImpl.java | 32 ++ .../components/module/userInfo/index.vue | 1 - .../views/platform/sys/data/user/pull.html | 8 +- .../views/platform/sys/data/user/update.html | 14 +- .../sys/msg/msgManage/msgManageForm.js | 7 +- .../activity/sports/applyUser/applyUser.js | 16 +- .../activity/sports/infoManage/addActivity.js | 108 ++--- .../zhgh/activity/sports/infoManage/info.js | 9 - .../platform/zhgh/benefit/userList/index.html | 7 +- .../zhgh/benefit/userSelectionList/index.html | 7 +- .../zhgh/club/examine/common/examineInfo.js | 5 +- .../club/infoManage/exitManage/index.html | 5 +- .../club/infoManage/manage/clubInfoManage.js | 5 +- .../fund/member/batchJoin/index.html | 12 +- .../fund/member/query/index.html | 12 +- .../healthCheckup/projectMange/index.html | 4 +- .../dayofficework/integral/manage/index.html | 9 +- .../meeting/common/meetingInfo.js | 4 +- .../dayofficework/meeting/manage/basicForm.js | 7 +- .../outlay/activityBudget/apply/index.html | 8 +- .../outlayManage/union/allocate/index.html | 206 ++++++++- .../unionReimburse/apply/index.html | 207 +++++---- .../zhgh/dayofficework/unionReimburse/info.js | 399 +++++++++++------- .../difficulthelp/apply/form.html | 2 +- .../difficulthelp/apply/index.html | 13 +- .../schoolunionapproval/index.html | 2 +- .../unionLeaderApproval/index.html | 19 +- .../maternityLeave/apply/index.html | 22 +- .../maternityLeave/common/info.js | 12 +- .../apply/branchunionapproval/index.html | 5 +- .../member/apply/common/commonQuery.js | 7 +- .../staffmanage/member/apply/common/info.js | 4 +- .../apply/common/memberApplyAuditInfo.js | 5 +- .../staffmanage/member/apply/mine/index.html | 5 +- .../apply/schoolunionapproval/index.html | 5 +- .../staffmanage/member/apply/submit/form.html | 5 +- .../member/apply/submit/index.html | 5 +- .../apply/uniongroupapproval/index.html | 4 +- .../staffmanage/member/apply/view/index.html | 5 +- .../branch/verification/check/index.html | 10 +- .../member/change/branchunionaudit/index.html | 5 +- .../member/change/common/commonQuery.js | 7 +- .../staffmanage/member/change/common/info.js | 4 +- .../change/common/memberAllChangeInfo.js | 4 +- .../member/change/common/memberChange.js | 9 +- .../member/change/manage/index.html | 9 +- .../staffmanage/member/change/mine/index.html | 5 +- .../member/change/record/index.html | 9 +- .../member/change/schoolunionaudit/index.html | 5 +- .../member/change/submit/form.html | 5 +- .../member/change/submit/index.html | 5 +- .../member/change/uniongroupaudit/index.html | 4 +- .../staffmanage/member/change/view/index.html | 5 +- .../member/common/info/memberInfo.js | 4 +- .../member/common/manage/memberManageQuery.js | 9 +- .../member/common/manage/memberManageTable.js | 4 +- .../verification/memberVerificationChange.js | 5 +- .../member/info/batchmake/index.html | 5 +- .../staffmanage/member/info/board/index1.html | 5 +- .../member/info/common/commonQuery.js | 7 +- .../member/info/common/memberAddForm.js | 3 +- .../member/info/datamanage/index.html | 7 +- .../staffmanage/member/info/group/index.html | 5 +- .../member/info/history/index.html | 15 +- .../staffmanage/member/info/input/index.html | 7 +- .../member/modelworker/manage/index.html | 9 +- .../verification/check/schoolViewAndHandle.js | 12 +- .../verification/check/viewChangeTypeUser.js | 12 +- .../verification/manage/verificationQuery.js | 7 +- .../manage/verificationSetUserList.js | 9 +- .../manage/verificationShowSelectionUsers.js | 12 +- .../statistics/comprehensive/index.html | 5 +- .../statistics/comprehensive/queryForm.js | 31 +- .../zhgh/staffmanage/membercost/config.html | 5 +- .../membercost/mine/minePayInfo.js | 5 +- .../zhgh/staffmanage/membercost/summary.html | 9 +- .../zhgh/staffmanage/membercost/user.html | 7 +- .../personnelcheck/common/commonQuery.js | 9 +- .../personnelcheck/manage/add/importAndMap.js | 4 +- .../singleTeacher/ledger/index.html | 9 +- .../sourcechange/manage/index.html | 9 +- .../specialstaff/manage/index.html | 9 +- .../staffmanage/thirtyTeach/manage/index.html | 11 +- .../zhgh/welfare/projectMange/filterUser.js | 8 - .../zhgh/welfare/statistics/selectedUser.js | 4 +- .../zhgh/welfare/statistics/unSelectedUser.js | 4 +- .../zhgh/welfare/welfareUser/addUser.js | 8 - .../zhgh/welfare/welfareUser/index.html | 11 - .../difficulthelp/apply/index.html | 2 +- .../maternityLeave/apply/index.html | 34 +- .../maternityLeave/common/info.js | 12 +- .../staffmanage/member/apply/common/info.js | 1 - .../member/apply/submit/index.html | 11 +- .../member/common/mobileMemberChangeInfo.js | 4 +- .../member/common/mobileMemberInfo.js | 5 +- .../staffmanage/memberCost/summary.html | 5 +- .../views/platform/zhghh5/sys/home/mine.js | 8 +- 115 files changed, 1781 insertions(+), 1093 deletions(-) diff --git a/src/main/java/com/budwk/app/zhgh/activity/sports/controller/ActivitySportsInfoManageController.java b/src/main/java/com/budwk/app/zhgh/activity/sports/controller/ActivitySportsInfoManageController.java index 98b6c9dc..0892ef8c 100644 --- a/src/main/java/com/budwk/app/zhgh/activity/sports/controller/ActivitySportsInfoManageController.java +++ b/src/main/java/com/budwk/app/zhgh/activity/sports/controller/ActivitySportsInfoManageController.java @@ -27,7 +27,6 @@ import org.nutz.mvc.annotation.Ok; import org.nutz.mvc.annotation.Param; import javax.servlet.http.HttpServletResponse; -import java.util.List; /** * @ClassName ActivitySportsInfoManageController @@ -152,37 +151,12 @@ public class ActivitySportsInfoManageController { @SLog(tag = "体育活动", msg = "修改活动") @SaCheckPermission("activity.sports.info") public Result doEdit(@Param(value = "data") ActivitySchool activitySchool, - @Param(value = "events") ActivitySchoolEvent[] events, - @Param(value = "forceReduceTeam") boolean forceReduceTeam) { - // 编辑活动减少队伍时,先把即将删除且已有报名人员的队伍返回给前端二次确认;确认后由 service 继续保存。 - List teamApplyList = activitySportsService.checkTeamReduceApply(activitySchool.getId(), events); - if (!forceReduceTeam && teamApplyList.size() > 0) { - return Result.NEW().addCode(2).addMsg(buildTeamReduceMsg(teamApplyList)).addData(teamApplyList); - } - activitySportsService.doEdit(activitySchool, events, forceReduceTeam); + @Param(value = "events") ActivitySchoolEvent[] events) { + activitySportsService.doEdit(activitySchool, events); return Result.success(); } - private String buildTeamReduceMsg(List teamApplyList) { - // 返回给前端确认框的报名占用说明:包含项目名称、队伍名称、报名人数,便于用户判断是否强制删除。 - StringBuilder msg = new StringBuilder(); - for (NutMap teamApply : teamApplyList) { - if (msg.length() > 0) { - msg.append(";"); - } - msg.append("项目【") - .append(teamApply.getString("eventName")) - .append("】的【") - .append(teamApply.getString("teamName")) - .append("】已有") - .append(teamApply.getInt("applyNum")) - .append("名报名人员"); - } - msg.append(",确认删除这些队伍并保存吗?"); - return msg.toString(); - } - @At @SLog(tag = "体育活动", msg = "添加活动") diff --git a/src/main/java/com/budwk/app/zhgh/activity/sports/controller/ActivitySportsResultsController.java b/src/main/java/com/budwk/app/zhgh/activity/sports/controller/ActivitySportsResultsController.java index 0f823734..91d193a4 100644 --- a/src/main/java/com/budwk/app/zhgh/activity/sports/controller/ActivitySportsResultsController.java +++ b/src/main/java/com/budwk/app/zhgh/activity/sports/controller/ActivitySportsResultsController.java @@ -5,21 +5,28 @@ import cn.dev33.satoken.annotation.SaCheckPermission; import com.budwk.app.base.param.PageForm; import com.budwk.app.base.result.Result; import com.budwk.app.base.service.BaseService; +import com.budwk.app.base.utils.DateUtil; +import com.budwk.app.base.utils.PwdUtil; +import com.budwk.app.sys.models.Sys_user; +import com.budwk.app.web.commons.auth.utils.SecurityUtil; import com.budwk.app.zhgh.activity.basic.models.ActivityBasicUnion; import com.budwk.app.zhgh.activity.basic.models.ActivityBasicUnit; import com.budwk.app.zhgh.activity.sports.models.ActivityResults; import com.budwk.app.zhgh.activity.sports.models.ActivitySchoolApply; -import com.budwk.app.zhgh.activity.sports.models.ActivitySchoolEvent; import com.budwk.app.zhgh.activity.sports.service.ActivitySportsApplyUserService; 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.random.R; import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.Ok; import org.nutz.mvc.annotation.Param; +import org.nutz.trans.Trans; +import java.util.Arrays; /** * @author zhf @@ -46,12 +53,11 @@ public class ActivitySportsResultsController { @At @SaCheckPermission("activity.results.input") - public Result pageData(PageForm page, + public Result pageData(String groupName, + PageForm page, String activityId, String eventId, - Integer isMenWomen, - String projectType, - String competitionCategory) { + String[] isMenWomen) { Cnd cnd = Cnd.NEW(); Sql sql = Sqls.create(""" SELECT @@ -71,10 +77,24 @@ public class ActivitySportsResultsController { $condition """); cnd.and("ase.activityId", "=", activityId); + cnd.andEX("abs.`name`", "=", groupName); cnd.andEX("ae.`id`", "=", eventId); - cnd.andEX("ae.isMenWomen", "=", isMenWomen); - cnd.andEX("ae.projectType", "=", projectType); - cnd.andEX("ae.competitionCategory", "=", competitionCategory); + SqlExpressionGroup sqlExpressionGroup = new SqlExpressionGroup(); + if (Arrays.stream(isMenWomen).anyMatch(a -> a.equals("2"))) { + sqlExpressionGroup.and("ae.isMenWomen", "=", 1); + } + if (Arrays.stream(isMenWomen).anyMatch(a -> a.equals("3"))) { + sqlExpressionGroup.or("ae.isMenWomen", "=", 2); + } + if (Arrays.stream(isMenWomen).anyMatch(a -> a.equals("4"))) { + sqlExpressionGroup.and("ae.projectType", "=", 1); + } + if (Arrays.stream(isMenWomen).anyMatch(a -> a.equals("5"))) { + sqlExpressionGroup.or("ae.projectType", "=", 2); + } + if (sqlExpressionGroup.getExps().size() > 0) { + cnd.and(sqlExpressionGroup); + } cnd.desc("allName"); sql.setCondition(cnd); return Result.success(baseService.listPageMap(page.getPageNumber(), page.getPageSize(), sql)); @@ -94,7 +114,53 @@ public class ActivitySportsResultsController { @At @SaCheckPermission("activity.results.input") public Result doAddUser(ActivitySchoolApply activitySchoolApply) { - activitySchoolApplyViService.doAddTemporaryApplyUser(activitySchoolApply); + + + Sys_user sysUser = baseService.dao().fetch(Sys_user.class, Cnd.where("loginname", "=", activitySchoolApply.getLoginname())); + + + if (sysUser != null && sysUser.getLoginname().equals(activitySchoolApply.getLoginname()) && !sysUser.getUsername().equals(activitySchoolApply.getUsername())) { + return Result.error("工号已存在,请检查姓名和工号是否一致!"); + } + if (sysUser == null) { + Trans.exec(() -> { + String pwd = "@dd3s#3618!"; + String salt = R.UU32(); + Sys_user user = new Sys_user(); + user.setId(R.UU32()); + user.setSalt(R.UU32()); + user.setPassword(PwdUtil.getPassword(pwd, salt)); + user.setUsername(activitySchoolApply.getUsername()); + user.setLoginname(activitySchoolApply.getLoginname()); + user.setSex(activitySchoolApply.getSex()); + user.setUnitId(activitySchoolApply.getUnitId()); + user.setMobile(activitySchoolApply.getMobile()); + baseService.insert(user); + ActivityBasicUnit activityBasicUnit = activitySchoolApplyViService.dao().fetch(ActivityBasicUnit.class, Cnd.where("id", "=", user.getUnitId())); + ActivityBasicUnion basicUnion = activitySchoolApplyViService.dao().fetch(ActivityBasicUnion.class, Cnd.where("id", "=", activityBasicUnit.getUnionId())); + + activitySchoolApply.setUserId(user.getId()); + activitySchoolApply.setApplyDate(DateUtil.getDate()); + activitySchoolApply.setSex(user.getSex()); + activitySchoolApply.setUnitId(user.getUnitId()); + activitySchoolApply.setActivityUnionId(basicUnion.getId()); + activitySchoolApply.setActivityUnionName(basicUnion.getName()); + activitySchoolApplyViService.insert(activitySchoolApply); + }); + return null; + } + sysUser.setSex(activitySchoolApply.getSex()); + baseService.update(sysUser); + ActivityBasicUnit activityBasicUnit = activitySchoolApplyViService.dao().fetch(ActivityBasicUnit.class, Cnd.where("id", "=", sysUser.getUnitId())); + ActivityBasicUnion basicUnion = activitySchoolApplyViService.dao().fetch(ActivityBasicUnion.class, Cnd.where("id", "=", activityBasicUnit.getUnionId())); + activitySchoolApply.setUserId(sysUser.getId()); + activitySchoolApply.setApplyUser(SecurityUtil.getUserId()); + activitySchoolApply.setApplyDate(DateUtil.getDate()); + activitySchoolApply.setUnitId(sysUser.getUnitId()); + activitySchoolApply.setActivityUnionId(basicUnion.getId()); + activitySchoolApply.setActivityUnionName(basicUnion.getName()); + activitySchoolApplyViService.insert(activitySchoolApply); + return Result.success(); } @@ -135,10 +201,8 @@ public class ActivitySportsResultsController { @At @SaCheckPermission("activity.results.input") public Result getUnionDetails(String activityId, String eventId, String unionId) { - // 团体成绩录入的人数按活动项目配置的“每队(项)运动员人数”展示,不再按该分工会实际报名人数统计。 - ActivitySchoolEvent schoolEvent = activitySchoolApplyViService.dao().fetch(ActivitySchoolEvent.class, - Cnd.where("activityId", "=", activityId).and("eventId", "=", eventId)); - return Result.success(schoolEvent == null || schoolEvent.getAthletesMaxNum() == null ? 0 : schoolEvent.getAthletesMaxNum()); + int count = activitySchoolApplyViService.count(Cnd.where("activityId", "=", activityId).and("eventId", "=", eventId).and("unionId", "=", unionId)); + return Result.success(count); } diff --git a/src/main/java/com/budwk/app/zhgh/activity/sports/models/ActivitySchool.java b/src/main/java/com/budwk/app/zhgh/activity/sports/models/ActivitySchool.java index b5b4d84a..e576d77b 100644 --- a/src/main/java/com/budwk/app/zhgh/activity/sports/models/ActivitySchool.java +++ b/src/main/java/com/budwk/app/zhgh/activity/sports/models/ActivitySchool.java @@ -188,11 +188,6 @@ public class ActivitySchool extends BaseModel implements Serializable , SysHomeC @ColDefine(type = ColType.VARCHAR, width = 32) private String belongClubId; - @Column - @Comment("报多队工会") - @ColDefine(type = ColType.MYSQL_JSON) - private List moreTeamUnionIds; - @Column @Comment("创建时间") @ColDefine(type = ColType.VARCHAR, width = 30) diff --git a/src/main/java/com/budwk/app/zhgh/activity/sports/service/ActivitySportsApplyUserService.java b/src/main/java/com/budwk/app/zhgh/activity/sports/service/ActivitySportsApplyUserService.java index e5c865cf..694d2e1a 100644 --- a/src/main/java/com/budwk/app/zhgh/activity/sports/service/ActivitySportsApplyUserService.java +++ b/src/main/java/com/budwk/app/zhgh/activity/sports/service/ActivitySportsApplyUserService.java @@ -23,8 +23,6 @@ public interface ActivitySportsApplyUserService extends BaseService { String doAdd(ActivitySchool activitySchool, ActivitySchoolEvent[] events); - void doEdit(ActivitySchool activitySchool, ActivitySchoolEvent[] events, boolean forceReduceTeam); - - List checkTeamReduceApply(String activityId, ActivitySchoolEvent[] events); + void doEdit(ActivitySchool activitySchool, ActivitySchoolEvent[] events); void doDelete(String id); diff --git a/src/main/java/com/budwk/app/zhgh/activity/sports/service/impl/ActivitySportsApplyUserServiceImpl.java b/src/main/java/com/budwk/app/zhgh/activity/sports/service/impl/ActivitySportsApplyUserServiceImpl.java index 64120a58..748018ff 100644 --- a/src/main/java/com/budwk/app/zhgh/activity/sports/service/impl/ActivitySportsApplyUserServiceImpl.java +++ b/src/main/java/com/budwk/app/zhgh/activity/sports/service/impl/ActivitySportsApplyUserServiceImpl.java @@ -6,7 +6,6 @@ import com.budwk.app.base.constant.RoleConstant; import com.budwk.app.base.page.Pagination; import com.budwk.app.base.param.PageForm; import com.budwk.app.base.service.impl.BaseServiceImpl; -import com.budwk.app.base.utils.PwdUtil; import com.budwk.app.sys.models.Sys_user; import com.budwk.app.web.commons.auth.utils.AuthUtil; import com.budwk.app.web.commons.auth.utils.SecurityUtil; @@ -31,7 +30,6 @@ 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 java.util.ArrayList; @@ -367,10 +365,9 @@ public class ActivitySportsApplyUserServiceImpl extends BaseServiceImpl events = getEvents(applyUserPageParam.getActivityId()); @@ -380,80 +377,12 @@ public class ActivitySportsApplyUserServiceImpl extends BaseServiceImpl teams = getApplyTeamList(activityId, eventId, false); - return teams.size() > 0 ? teams.get(0) : null; - } - @Override public Pagination applyPageData(PageForm page, String activityId, String eventId, String unionId) { Cnd cnd = Cnd.NEW(); diff --git a/src/main/java/com/budwk/app/zhgh/activity/sports/service/impl/ActivitySportsServiceImpl.java b/src/main/java/com/budwk/app/zhgh/activity/sports/service/impl/ActivitySportsServiceImpl.java index 73710e0e..fa8161a6 100644 --- a/src/main/java/com/budwk/app/zhgh/activity/sports/service/impl/ActivitySportsServiceImpl.java +++ b/src/main/java/com/budwk/app/zhgh/activity/sports/service/impl/ActivitySportsServiceImpl.java @@ -9,7 +9,6 @@ import com.budwk.app.base.utils.CommonDownloadUtil; import com.budwk.app.base.utils.DateUtil; import com.budwk.app.sys.models.Sys_home_activity; import com.budwk.app.web.commons.auth.utils.SecurityUtil; -import com.budwk.app.zhgh.activity.basic.models.ActivityEvent; import com.budwk.app.zhgh.activity.basic.models.ActivityBasicUnit; import com.budwk.app.zhgh.activity.culture.models.ActivityTissue; import com.budwk.app.zhgh.activity.sports.models.ActivitySchool; @@ -29,7 +28,6 @@ import org.nutz.ioc.aop.Aop; import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.lang.Lang; import org.nutz.lang.Strings; -import org.nutz.lang.util.NutMap; import javax.servlet.http.HttpServletResponse; import java.util.ArrayList; @@ -98,11 +96,7 @@ public class ActivitySportsServiceImpl extends BaseServiceImpl i @Override @Aop(TransAop.READ_COMMITTED) - public void doEdit(ActivitySchool activitySchool, ActivitySchoolEvent[] events, boolean forceReduceTeam) { - // 防止绕过 controller 直接调用编辑逻辑时误删已有报名人员使用的队伍,未确认时直接中断本次保存。 - if (!forceReduceTeam && checkTeamReduceApply(activitySchool.getId(), events).size() > 0) { - throw Lang.makeThrow("减少队伍时存在已报名人员,请确认后再保存"); - } + public void doEdit(ActivitySchool activitySchool, ActivitySchoolEvent[] events) { ActivitySchool school = dao().fetch(ActivitySchool.class, activitySchool.getId()); if (school.getActivityLevel() == 40002) { school.setBelongUnionId(SecurityUtil.getUnionId()); @@ -132,7 +126,6 @@ public class ActivitySportsServiceImpl extends BaseServiceImpl i } for (ActivitySchoolEvent event : events) { update(event); - syncTeam(activitySchool.getId(), event); } dao().delete(ActivityTissue.class, activitySchool.getId()); ActivityTissue activityTissue = new ActivityTissue(); @@ -164,85 +157,6 @@ public class ActivitySportsServiceImpl extends BaseServiceImpl i dao().insertOrUpdate(sysHomeActivity); } - @Override - public List checkTeamReduceApply(String activityId, ActivitySchoolEvent[] events) { - // 检查“最多创建几队”减少后将被删除的队伍,返回仍有报名人员占用的队伍清单给前端确认。 - List result = new ArrayList<>(); - if (Strings.isBlank(activityId) || events == null || events.length == 0) { - return result; - } - for (ActivitySchoolEvent event : events) { - if (event == null || Strings.isBlank(event.getEventId()) || "allItems".equals(event.getEventId()) || event.getRestrictTotalTeam() == null) { - continue; - } - List reduceTeams = getReduceTeams(activityId, event); - if (reduceTeams.size() == 0) { - continue; - } - ActivityEvent activityEvent = dao().fetch(ActivityEvent.class, event.getEventId()); - for (ActivitySchoolTeam team : reduceTeams) { - int applyNum = dao().count(ActivitySchoolApply.class, Cnd.where("activityId", "=", activityId) - .and("eventId", "=", event.getEventId()) - .and("teamId", "=", team.getId())); - if (applyNum > 0) { - result.add(NutMap.NEW() - .setv("eventId", event.getEventId()) - .setv("eventName", activityEvent == null ? "" : activityEvent.getAllName()) - .setv("teamId", team.getId()) - .setv("teamName", team.getName()) - .setv("applyNum", applyNum)); - } - } - } - return result; - } - - private List getReduceTeams(String activityId, ActivitySchoolEvent event) { - // 按队伍位置保留前 N 队,超过目标队伍数的部分就是本次减少队伍时需要删除的队伍。 - List teams = dao().query(ActivitySchoolTeam.class, Cnd.where("activityId", "=", activityId) - .and("eventId", "=", event.getEventId()) - .asc("location")); - int targetTotalTeam = event.getRestrictTotalTeam() == null ? 0 : Math.max(event.getRestrictTotalTeam(), 0); - List reduceTeams = new ArrayList<>(); - for (int i = targetTotalTeam; i < teams.size(); i++) { - reduceTeams.add(teams.get(i)); - } - return reduceTeams; - } - - private void syncTeam(String schoolId, ActivitySchoolEvent event) { - // 保存项目时同步 activity_school_team:增加队伍只补插缺少的队伍,减少队伍只删除超过目标数量的后续队伍。 - if (event == null || Strings.isBlank(event.getEventId()) || "allItems".equals(event.getEventId()) || event.getRestrictTotalTeam() == null) { - return; - } - List teams = dao().query(ActivitySchoolTeam.class, Cnd.where("activityId", "=", schoolId) - .and("eventId", "=", event.getEventId()) - .asc("location")); - int currentTotalTeam = teams.size(); - int targetTotalTeam = Math.max(event.getRestrictTotalTeam(), 0); - for (int i = 0; i < teams.size(); i++) { - ActivitySchoolTeam team = teams.get(i); - team.setMinNum(event.getRestrictMinNum()); - team.setMaxNum(event.getRestrictMaxNum()); - dao().updateIgnoreNull(team); - } - if (targetTotalTeam > currentTotalTeam) { - for (int i = currentTotalTeam + 1; i <= targetTotalTeam; i++) { - ActivitySchoolTeam team = new ActivitySchoolTeam(); - team.setActivityId(schoolId); - team.setEventId(event.getEventId()); - team.setName(String.format("第%d队", i)); - team.setMinNum(event.getRestrictMinNum()); - team.setMaxNum(event.getRestrictMaxNum()); - dao().insert(team); - } - } else if (targetTotalTeam < currentTotalTeam) { - for (int i = targetTotalTeam; i < teams.size(); i++) { - dao().delete(ActivitySchoolTeam.class, teams.get(i).getId()); - } - } - } - @Aop(TransAop.READ_COMMITTED) private void addTeam(String schoolId, ActivitySchoolEvent[] events) { if (events.length > 0) { diff --git a/src/main/java/com/budwk/app/zhgh/club/controller/common/ClubCommonController.java b/src/main/java/com/budwk/app/zhgh/club/controller/common/ClubCommonController.java index b54162f6..5708655a 100644 --- a/src/main/java/com/budwk/app/zhgh/club/controller/common/ClubCommonController.java +++ b/src/main/java/com/budwk/app/zhgh/club/controller/common/ClubCommonController.java @@ -8,11 +8,9 @@ import com.budwk.app.base.service.BaseService; import com.budwk.app.bpm.enums.BpmProcessInstanceStatusEnum; import com.budwk.app.bpm.enums.BpmProcessTaskStatusEnum; import com.budwk.app.flow.enums.ProcessInstanceStateEnum; -import com.budwk.app.sys.models.Sys_role; -import com.budwk.app.sys.models.Sys_user_role; -import com.budwk.app.sys.services.SysRoleService; import com.budwk.app.web.commons.auth.utils.AuthUtil; import com.budwk.app.web.commons.auth.utils.SecurityUtil; +import com.budwk.app.zhgh.club.model.ClubUser; import com.budwk.app.zhgh.club.model.SysClub; import com.budwk.app.zhgh.club.service.SysClubService; import org.nutz.dao.Cnd; @@ -38,8 +36,6 @@ public class ClubCommonController { @Inject private SysClubService sysClubService; - @Inject - private SysRoleService sysRoleService; @At @SaCheckLogin @@ -62,9 +58,9 @@ public class ClubCommonController { public Result listClubByRole() { Cnd cnd = Cnd.NEW(); if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) { - Sys_role sysRole = sysRoleService.getByCode(RoleConstant.CLUB_PRESIDENT); - List userRoles = sysClubService.dao().query(Sys_user_role.class, Cnd.where("userId", "=", SecurityUtil.getUserId()).and("roleId", "=", sysRole.getId())); - List myClubId = userRoles.stream().map(Sys_user_role::getClubId).toList(); + // 报销申请只允许选择当前用户已加入的协会,避免看到未加入的协会数据。 + List clubUsers = sysClubService.dao().query(ClubUser.class, Cnd.where("userId", "=", SecurityUtil.getUserId())); + List myClubId = clubUsers.stream().map(ClubUser::getClubId).distinct().toList(); cnd.and("c.id", "in", myClubId); } cnd.and("inst.state","=",ProcessInstanceStateEnum.FINISHED.getCode()); diff --git a/src/main/java/com/budwk/app/zhgh/dayofficework/outlay/outlayManage/service/OutlayManageUnionAllocateService.java b/src/main/java/com/budwk/app/zhgh/dayofficework/outlay/outlayManage/service/OutlayManageUnionAllocateService.java index e9daa959..986186d8 100644 --- a/src/main/java/com/budwk/app/zhgh/dayofficework/outlay/outlayManage/service/OutlayManageUnionAllocateService.java +++ b/src/main/java/com/budwk/app/zhgh/dayofficework/outlay/outlayManage/service/OutlayManageUnionAllocateService.java @@ -3,8 +3,12 @@ package com.budwk.app.zhgh.dayofficework.outlay.outlayManage.service; import com.budwk.app.base.result.Result; import com.budwk.app.base.service.BaseService; import com.budwk.app.zhgh.dayofficework.outlay.outlayManage.union.model.OutLayAllocateUnion; +import com.budwk.app.zhgh.dayofficework.outlay.outlayManage.union.vo.OutlayUnionAllocateImportVo; +import org.apache.poi.ss.usermodel.Workbook; +import org.nutz.mvc.upload.TempFile; import java.math.BigDecimal; +import java.util.List; /** * 分工会季度额度分配服务。 @@ -36,12 +40,63 @@ public interface OutlayManageUnionAllocateService extends BaseService重置时会先回滚 outlay_manage_union.totalQuota, - * 再将当前季度的 outlay_allocate_union 记录标记删除。

+ *

只要当前季度记录中存在分配额度大于 0 的有效记录, + * 就认为该季度已经分配过额度,前端据此决定是否提示再次分配。

* + * @param quarterly 要检查的季度,例如 1/2/3/4 + * @param year 要检查的年份 + * @return true 已分配过;false 未分配 + */ + boolean hasAllocated(Integer quarterly, Integer year); + + /** + * 解析导入文件并返回预览数据。 + * + * @param file Excel 文件 + * @return 解析后的预览数据 + */ + List readImportExcel(TempFile file); + + /** + * 根据导入数据按分工会逐条分配季度额度。 + * + * @param importList 导入预览数据 + * @param quarterly 当前季度 + * @param year 当前年度 + * @return 导入分配结果 + */ + Result doImportAllocate(List importList, Integer quarterly, Integer year); + + /** + * 导出分工会额度导入模板。 + * + * @return 模板工作簿 + */ + Workbook exportImportTemplate(); + + /** + * 重置指定年度季度的分配记录。 + * + *

页面支持切换年度和季度,所以重置动作必须严格使用前端当前选择值, + * 不能再按系统当前自然季度处理,否则会出现页面筛选季度和实际重置季度不一致的问题。

+ * + * @param quarterly 要重置的季度,例如 1/2/3/4 + * @param year 要重置的年份 * @return Result 成功时返回 success;失败时返回错误信息 */ - Result deleteAllocateRecord(); + Result deleteAllocateRecord(Integer quarterly, Integer year); + + /** + * 按指定年度季度生成分工会预算记录。 + * + *

生成前会先校验该年度季度是否已存在有效记录; + * 若已存在,则直接提示前端需要先重置后再重新生成。

+ * + * @param quarterly 要生成的季度,例如 1/2/3/4 + * @param year 要生成的年份 + * @return Result 成功时返回 success;失败时返回错误信息 + */ + Result doAllocateRecord(Integer quarterly, Integer year); } diff --git a/src/main/java/com/budwk/app/zhgh/dayofficework/outlay/outlayManage/service/impl/OutlayManageUnionAllocateServiceImpl.java b/src/main/java/com/budwk/app/zhgh/dayofficework/outlay/outlayManage/service/impl/OutlayManageUnionAllocateServiceImpl.java index e4dcee80..ae2a70b1 100644 --- a/src/main/java/com/budwk/app/zhgh/dayofficework/outlay/outlayManage/service/impl/OutlayManageUnionAllocateServiceImpl.java +++ b/src/main/java/com/budwk/app/zhgh/dayofficework/outlay/outlayManage/service/impl/OutlayManageUnionAllocateServiceImpl.java @@ -1,20 +1,36 @@ package com.budwk.app.zhgh.dayofficework.outlay.outlayManage.service.impl; +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.ExcelImportUtil; +import cn.afterturn.easypoi.excel.entity.ExportParams; +import cn.afterturn.easypoi.excel.entity.ImportParams; +import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity; +import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; +import cn.hutool.core.io.FileUtil; import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; import com.budwk.app.base.result.Result; import com.budwk.app.base.service.impl.BaseServiceImpl; import com.budwk.app.sys.models.Sys_union; import com.budwk.app.zhgh.dayofficework.outlay.outlayManage.service.OutlayManageUnionAllocateService; import com.budwk.app.zhgh.dayofficework.outlay.outlayManage.union.model.OutLayAllocateUnion; import com.budwk.app.zhgh.dayofficework.outlay.outlayManage.union.model.OutlayManageUnion; +import com.budwk.app.zhgh.dayofficework.outlay.outlayManage.union.vo.OutlayUnionAllocateImportVo; +import org.apache.poi.ss.usermodel.Workbook; import org.nutz.dao.Chain; import org.nutz.dao.Cnd; import org.nutz.dao.Dao; import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.lang.Lang; +import org.nutz.mvc.upload.TempFile; import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashSet; import java.util.List; +import java.util.Map; +import java.util.Set; /** * 分工会季度额度分配实现。 @@ -44,6 +60,10 @@ public class OutlayManageUnionAllocateServiceImpl extends BaseServiceImpl allocateUnionList = dao().query(OutLayAllocateUnion.class, Cnd.where(OutLayAllocateUnion::getQuarterly, "=", quarterly) .and(OutLayAllocateUnion::getYear, "=", year) @@ -58,11 +78,155 @@ public class OutlayManageUnionAllocateServiceImpl extends BaseServiceImpl", BigDecimal.ZERO)); + return count > 0; + } + + @Override + public List readImportExcel(TempFile file) { + String extName = FileUtil.extName(file.getFile()); + if (!"xlsx".equalsIgnoreCase(extName) && !"xls".equalsIgnoreCase(extName)) { + throw Lang.makeThrow("请上传xlsx或xls格式文件"); + } + List importList = ExcelImportUtil.importExcel(file.getFile(), + OutlayUnionAllocateImportVo.class, new ImportParams()); + List unionList = dao().query(Sys_union.class, Cnd.NEW()); + Map unionMap = new HashMap<>(); + for (Sys_union union : unionList) { + unionMap.put(union.getUnionCode(), union); + } + Set duplicateUnionCodeSet = new LinkedHashSet<>(); + Set existUnionCodeSet = new LinkedHashSet<>(); + for (OutlayUnionAllocateImportVo item : importList) { + if (StrUtil.isBlank(item.getUnionCode())) { + continue; + } + if (!existUnionCodeSet.add(item.getUnionCode())) { + duplicateUnionCodeSet.add(item.getUnionCode()); + } + } + for (int i = 0; i < importList.size(); i++) { + OutlayUnionAllocateImportVo item = importList.get(i); + item.setRowNum(i + 2); + if (StrUtil.isBlank(item.getUnionCode())) { + item.setErrMsg("工会编码不能为空"); + continue; + } + if (item.getAllocateMoney() == null) { + item.setErrMsg("分配额度不能为空"); + continue; + } + if (item.getAllocateMoney().compareTo(BigDecimal.ZERO) < 0) { + item.setErrMsg("分配额度不能小于0"); + continue; + } + Sys_union union = unionMap.get(item.getUnionCode()); + if (Lang.isEmpty(union)) { + item.setErrMsg("工会编码不存在"); + continue; + } + item.setUnionName(union.getName()); + if (duplicateUnionCodeSet.contains(item.getUnionCode())) { + item.setErrMsg("工会编码重复"); + } + } + return importList; + } + + @Override + public Result doImportAllocate(List importList, Integer quarterly, Integer year) { + Result validateResult = validateCurrentQuarterOperation(quarterly); + if (validateResult != null) { + return validateResult; + } + if (importList == null || importList.isEmpty()) { + return Result.error("请先上传导入数据"); + } List allocateUnionList = dao().query(OutLayAllocateUnion.class, - Cnd.where(OutLayAllocateUnion::getQuarterly, "=", currentQuarter) - .and(OutLayAllocateUnion::getYear, "=", DateUtil.thisYear()) + Cnd.where(OutLayAllocateUnion::getQuarterly, "=", quarterly) + .and(OutLayAllocateUnion::getYear, "=", year) + .and(OutLayAllocateUnion::getDelFlag, "=", false)); + if (allocateUnionList == null || allocateUnionList.isEmpty()) { + return Result.error("当前季度没有分配记录!"); + } + List unionList = dao().query(Sys_union.class, Cnd.NEW()); + Map unionMap = new HashMap<>(); + for (Sys_union union : unionList) { + unionMap.put(union.getUnionCode(), union); + } + Map allocateUnionMap = new HashMap<>(); + for (OutLayAllocateUnion allocateUnion : allocateUnionList) { + allocateUnionMap.put(allocateUnion.getUnionId(), allocateUnion); + } + List errorList = new ArrayList<>(); + for (OutlayUnionAllocateImportVo item : importList) { + if (StrUtil.isBlank(item.getUnionCode())) { + errorList.add("第" + item.getRowNum() + "行:工会编码不能为空"); + continue; + } + if (item.getAllocateMoney() == null) { + errorList.add("第" + item.getRowNum() + "行:分配额度不能为空"); + continue; + } + if (item.getAllocateMoney().compareTo(BigDecimal.ZERO) < 0) { + errorList.add("第" + item.getRowNum() + "行:分配额度不能小于0"); + continue; + } + if (StrUtil.isNotBlank(item.getErrMsg())) { + errorList.add("第" + item.getRowNum() + "行:" + item.getErrMsg()); + continue; + } + Sys_union union = unionMap.get(item.getUnionCode()); + if (Lang.isEmpty(union)) { + errorList.add("第" + item.getRowNum() + "行:工会编码不存在"); + continue; + } + if (!allocateUnionMap.containsKey(union.getId())) { + errorList.add("第" + item.getRowNum() + "行:当前季度未生成该分工会分配记录"); + } + } + if (!errorList.isEmpty()) { + return Result.error(String.join(";", errorList)); + } + for (OutlayUnionAllocateImportVo item : importList) { + Sys_union union = unionMap.get(item.getUnionCode()); + OutLayAllocateUnion allocateUnion = allocateUnionMap.get(union.getId()); + // 导入分配与手工分配保持同一套金额同步规则,确保季度表和年度预算表数据一致。 + applyAllocateMoney(allocateUnion, item.getAllocateMoney()); + } + return Result.success("导入分配成功"); + } + + @Override + public Workbook exportImportTemplate() { + List entityList = new ArrayList<>(); + entityList.add(new ExcelExportEntity("工会编码", "unionCode", 20)); + entityList.add(new ExcelExportEntity("分配额度", "allocateMoney", 20)); + ExportParams exportParams = new ExportParams(); + exportParams.setType(ExcelType.XSSF); + return ExcelExportUtil.exportExcel(exportParams, entityList, new ArrayList<>()); + } + + @Override + public Result deleteAllocateRecord(Integer quarterly, Integer year) { + if (quarterly == null || year == null) { + return Result.error("参数错误!"); + } + Result validateResult = validateCurrentQuarterOperation(quarterly); + if (validateResult != null) { + return validateResult; + } + List allocateUnionList = dao().query(OutLayAllocateUnion.class, + Cnd.where(OutLayAllocateUnion::getQuarterly, "=", quarterly) + .and(OutLayAllocateUnion::getYear, "=", year) .and(OutLayAllocateUnion::getDelFlag, "=", false)); if (allocateUnionList == null || allocateUnionList.isEmpty()) { return Result.error("当前季度还未分配,无法重置!"); @@ -73,12 +237,38 @@ public class OutlayManageUnionAllocateServiceImpl extends BaseServiceImpl outlayManageUnionList = dao().query(OutlayManageUnion.class, + Cnd.where(OutlayManageUnion::getYear, "=", sourceYear)); + List insertList = buildAllocateUnionList(outlayManageUnionList, quarterly, year); + insert(insertList); + return Result.success(); + } + /** * 按“先回退旧额度,再写入新额度”的方式同步季度记录和年度预算表。 * @@ -89,7 +279,7 @@ public class OutlayManageUnionAllocateServiceImpl extends BaseServiceImpl 待插入的季度分配记录 + */ + private List buildAllocateUnionList(List outlayManageUnionList, Integer quarterly, Integer year) { + List unionList = dao().query(Sys_union.class, Cnd.NEW()); + List insertList = new ArrayList<>(); + for (Sys_union union : unionList) { + OutLayAllocateUnion allocateUnion = new OutLayAllocateUnion(); + allocateUnion.setYear(year); + allocateUnion.setQuarterly(quarterly); + allocateUnion.setUnionId(union.getId()); + allocateUnion.setAllocateMoney(BigDecimal.ZERO); + OutlayManageUnion outlayManageUnion = outlayManageUnionList.stream() + .filter(o -> o.getUnionId().equals(union.getId())) + .findFirst() + .orElse(null); + if (Lang.isNotEmpty(outlayManageUnion)) { + BigDecimal surplusMoney = defaultValue(outlayManageUnion.getTotalQuota()) + .subtract(defaultValue(outlayManageUnion.getUsedQuota())); + allocateUnion.setAllocateHeadMoney(surplusMoney); + } else { + allocateUnion.setAllocateHeadMoney(BigDecimal.ZERO); + } + insertList.add(allocateUnion); + } + return insertList; + } } diff --git a/src/main/java/com/budwk/app/zhgh/dayofficework/outlay/outlayManage/service/impl/OutlayUseDetailServiceImpl.java b/src/main/java/com/budwk/app/zhgh/dayofficework/outlay/outlayManage/service/impl/OutlayUseDetailServiceImpl.java index 9ff8382d..bc5e46d2 100644 --- a/src/main/java/com/budwk/app/zhgh/dayofficework/outlay/outlayManage/service/impl/OutlayUseDetailServiceImpl.java +++ b/src/main/java/com/budwk/app/zhgh/dayofficework/outlay/outlayManage/service/impl/OutlayUseDetailServiceImpl.java @@ -1,6 +1,7 @@ package com.budwk.app.zhgh.dayofficework.outlay.outlayManage.service.impl; import com.budwk.app.base.service.impl.BaseServiceImpl; +import com.budwk.app.zhgh.dayofficework.outlay.outlayManage.club.model.OutlayManageClub; import com.budwk.app.zhgh.dayofficework.outlay.outlayManage.model.OutlayUseDetail; import com.budwk.app.zhgh.dayofficework.outlay.outlayManage.school.model.OutlayManageSchool; import com.budwk.app.zhgh.dayofficework.outlay.outlayManage.service.OutlayUseDetailService; @@ -21,49 +22,65 @@ public class OutlayUseDetailServiceImpl extends BaseServiceImpl @Override public void doDeleteDetail(String id, String outlayType) { - //更新预算表的金额 - updateOutlayManage(id, null,outlayType,false); - //更新完删除 + // 先回滚对应预算的已使用额度,再删除详情记录。 + updateOutlayManage(id, null, outlayType, false); delete(id); } @Override - public void doEditDetail(OutlayUseDetail outlayUseDetail,String outlayType) { - updateOutlayManage(outlayUseDetail.getId(), outlayUseDetail,outlayType,true); + public void doEditDetail(OutlayUseDetail outlayUseDetail, String outlayType) { + // 编辑详情时需要先回退旧金额,再叠加新金额,保证预算台账准确。 + updateOutlayManage(outlayUseDetail.getId(), outlayUseDetail, outlayType, true); update(outlayUseDetail); - } - /** - * 更新预算表 + * 同步预算主表的已使用额度,保证校工会、分工会、协会三类台账口径一致。 * - * @param id - * @param outlayType + * @param id 详情主键 + * @param outlayUseDetail 编辑后的详情对象,删除场景可为空 + * @param outlayType 预算类型:school/union/club + * @param isEdit 是否为编辑场景 */ - private void updateOutlayManage(String id, OutlayUseDetail outlayUseDetail,String outlayType,Boolean isEdit) { - //找到是哪一条的预算详情 + private void updateOutlayManage(String id, OutlayUseDetail outlayUseDetail, String outlayType, Boolean isEdit) { OutlayUseDetail detail = fetch(id); - //拿到预算详情的调整金额 - if (outlayType.equals("school")) { - //找到预算分配的记录 + if (detail == null) { + return; + } + if ("school".equals(outlayType)) { OutlayManageSchool manageSchool = dao().fetch(OutlayManageSchool.class, detail.getOutlayManageId()); + if (manageSchool == null) { + return; + } manageSchool.setUsedQuota(manageSchool.getUsedQuota().subtract(detail.getAdjustMoney())); - if (isEdit){ - //如果是修改,就先减去原来的值在加上现在新的值 + if (Boolean.TRUE.equals(isEdit) && outlayUseDetail != null) { manageSchool.setUsedQuota(manageSchool.getUsedQuota().add(outlayUseDetail.getAdjustMoney())); } update(manageSchool); - } else if (outlayType.equals("union")) { + return; + } + if ("union".equals(outlayType)) { OutlayManageUnion manageUnion = dao().fetch(OutlayManageUnion.class, detail.getOutlayManageId()); + if (manageUnion == null) { + return; + } manageUnion.setUsedQuota(manageUnion.getUsedQuota().subtract(detail.getAdjustMoney())); - if (isEdit){ - //如果是修改,就先减去原来的值在加上现在新的值 + if (Boolean.TRUE.equals(isEdit) && outlayUseDetail != null) { manageUnion.setUsedQuota(manageUnion.getUsedQuota().add(outlayUseDetail.getAdjustMoney())); } update(manageUnion); + return; + } + if ("club".equals(outlayType)) { + OutlayManageClub manageClub = dao().fetch(OutlayManageClub.class, detail.getOutlayManageId()); + if (manageClub == null) { + return; + } + manageClub.setUsedQuota(manageClub.getUsedQuota().subtract(detail.getAdjustMoney())); + if (Boolean.TRUE.equals(isEdit) && outlayUseDetail != null) { + manageClub.setUsedQuota(manageClub.getUsedQuota().add(outlayUseDetail.getAdjustMoney())); + } + update(manageClub); } } - - } diff --git a/src/main/java/com/budwk/app/zhgh/dayofficework/outlay/outlayManage/union/controller/OutlayManageUnionAllocateController.java b/src/main/java/com/budwk/app/zhgh/dayofficework/outlay/outlayManage/union/controller/OutlayManageUnionAllocateController.java index 9112d0fe..7ffa4b90 100644 --- a/src/main/java/com/budwk/app/zhgh/dayofficework/outlay/outlayManage/union/controller/OutlayManageUnionAllocateController.java +++ b/src/main/java/com/budwk/app/zhgh/dayofficework/outlay/outlayManage/union/controller/OutlayManageUnionAllocateController.java @@ -1,20 +1,19 @@ package com.budwk.app.zhgh.dayofficework.outlay.outlayManage.union.controller; +import com.budwk.app.base.utils.CommonDownloadUtil; import cn.dev33.satoken.annotation.SaCheckPermission; -import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.StrUtil; import com.budwk.app.base.annotation.SLog; import com.budwk.app.base.page.Pagination; import com.budwk.app.base.param.PageForm; import com.budwk.app.base.result.Result; import com.budwk.app.base.service.BaseService; -import com.budwk.app.sys.models.Sys_union; import com.budwk.app.zhgh.dayofficework.outlay.outlayManage.service.OutlayManageUnionAllocateService; -import com.budwk.app.zhgh.dayofficework.outlay.outlayManage.union.model.OutLayAllocateUnion; -import com.budwk.app.zhgh.dayofficework.outlay.outlayManage.union.model.OutlayManageUnion; +import com.budwk.app.zhgh.dayofficework.outlay.outlayManage.union.vo.OutlayUnionAllocateImportVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; +import org.apache.poi.ss.usermodel.Workbook; import org.nutz.aop.interceptor.ioc.TransAop; import org.nutz.dao.Cnd; import org.nutz.dao.Sqls; @@ -22,13 +21,18 @@ 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.mvc.annotation.At; import org.nutz.mvc.annotation.Ok; import org.nutz.mvc.annotation.Param; +import org.nutz.mvc.annotation.POST; +import org.nutz.mvc.upload.TempFile; +import org.nutz.mvc.upload.UploadAdaptor; +import org.nutz.mvc.annotation.AdaptBy; +import javax.servlet.http.HttpServletResponse; import java.math.BigDecimal; -import java.util.ArrayList; import java.util.List; /** @@ -107,76 +111,82 @@ public class OutlayManageUnionAllocateController { return outlayManageUnionAllocateService.doBatchAllocate(allocateMoney, quarterly, year); } + @At + @ApiOperation("校验当前季度是否已分配额度") + @SaCheckPermission("outlay.outlayManage.union.allocate") + public Result hasAllocated(@Param("quarterly") Integer quarterly, + @Param("year") Integer year) { + if (quarterly == null || year == null) { + return Result.error("参数错误!"); + } + return Result.success(outlayManageUnionAllocateService.hasAllocated(quarterly, year)); + } + + @At + @POST + @AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"}) + @ApiOperation("读取导入分配Excel") + @SaCheckPermission("outlay.outlayManage.union.allocate") + public Result readImportExcel(TempFile file) { + try { + return Result.success(outlayManageUnionAllocateService.readImportExcel(file)); + } catch (Exception e) { + log.error("读取分工会额度导入文件失败", e); + return Result.error(e.getMessage()); + } + } + + @At + @ApiOperation("导入分配分工会额度") + @Aop(TransAop.READ_COMMITTED) + @SLog(tag = "分工会预算-季度预算分配", msg = "导入分配分工会额度") + @SaCheckPermission("outlay.outlayManage.union.allocate") + public Result doImportAllocate(String data, + @Param("quarterly") Integer quarterly, + @Param("year") Integer year) { + if (StrUtil.isBlank(data) || quarterly == null || year == null) { + return Result.error("参数错误!"); + } + List importList = Json.fromJsonAsList(OutlayUnionAllocateImportVo.class, data); + return outlayManageUnionAllocateService.doImportAllocate(importList, quarterly, year); + } + + @At + @Ok("void") + @ApiOperation("下载导入分配模板") + @SaCheckPermission("outlay.outlayManage.union.allocate") + public void downloadImportTemplate(HttpServletResponse response) { + try { + Workbook workbook = outlayManageUnionAllocateService.exportImportTemplate(); + CommonDownloadUtil.download("分工会额度导入模板.xlsx", workbook, response); + } catch (Exception e) { + log.error("下载分工会额度导入模板失败", e); + } + } + @At @ApiOperation("重置预算季度记录") @Aop(TransAop.READ_COMMITTED) @SLog(tag = "分工会预算-季度预算分配", msg = "重置预算季度记录") @SaCheckPermission("outlay.outlayManage.union.allocate") - public Result deleteAllocateRecord() { - return outlayManageUnionAllocateService.deleteAllocateRecord(); + public Result deleteAllocateRecord(@Param("quarterly") Integer quarterly, + @Param("year") Integer year) { + if (quarterly == null || year == null) { + return Result.error("参数错误!"); + } + return outlayManageUnionAllocateService.deleteAllocateRecord(quarterly, year); } @At @ApiOperation("预算季度记录生成") @SLog(tag = "分工会预算-季度预算分配", msg = "生成了预算分配记录") @SaCheckPermission("outlay.outlayManage.union.allocate") - public Result doAllocateRecord() { - int quarter = DateUtil.month(DateUtil.date()) / 3 + 1; - // 查询当前季度 - int count = baseService.dao().count(OutLayAllocateUnion.class, Cnd.where(OutLayAllocateUnion::getQuarterly, "=", quarter) - .and(OutLayAllocateUnion::getYear, "=", DateUtil.thisYear()) - .and(OutLayAllocateUnion::getDelFlag, "=", 0)); - if (count > 0) { - return Result.error("当前季度已分配,如需重新分配请点击重置分配记录!"); + public Result doAllocateRecord(@Param("quarterly") Integer quarterly, + @Param("year") Integer year) { + if (quarterly == null || year == null) { + return Result.error("参数错误!"); } - - List outlayManageUnionList; - if (quarter == 1) { - //如果是第一季度,查询去年剩余额度 - outlayManageUnionList = baseService.dao().query(OutlayManageUnion.class, - Cnd.where(OutlayManageUnion::getYear, "=", DateUtil.thisYear() - 1)); - } else { - //非第一季度 - outlayManageUnionList = baseService.dao().query(OutlayManageUnion.class, - Cnd.where(OutlayManageUnion::getYear, "=", DateUtil.thisYear())); - } - List insertList = this.initOutLayAllocateUnion(outlayManageUnionList); - baseService.insert(insertList); - return Result.success(); + return outlayManageUnionAllocateService.doAllocateRecord(quarterly, year); } - - - /** - * 初始化需要添加的数据 - * - * @param outlayManageUnionList - * @return - */ - public List initOutLayAllocateUnion(List outlayManageUnionList) { - int quarter = DateUtil.month(DateUtil.date()) / 3 + 1; - - List unionList = baseService.dao().query(Sys_union.class, Cnd.NEW()); - List insertList = new ArrayList<>(); - for (Sys_union union : unionList) { - OutLayAllocateUnion allocateUnion = new OutLayAllocateUnion(); - allocateUnion.setYear(DateUtil.thisYear()); - allocateUnion.setQuarterly(quarter); - allocateUnion.setUnionId(union.getId()); - allocateUnion.setAllocateMoney(BigDecimal.ZERO); - //根据院级工会ID查询 - OutlayManageUnion outlayManageUnion = outlayManageUnionList.stream().filter(o -> o.getUnionId().equals(union.getId())).findFirst().orElse(null); - if (Lang.isNotEmpty(outlayManageUnion)) { - BigDecimal surplusMoney = outlayManageUnion.getTotalQuota().subtract(outlayManageUnion.getUsedQuota()); - allocateUnion.setAllocateHeadMoney(surplusMoney); - } else { - allocateUnion.setAllocateHeadMoney(BigDecimal.ZERO); - } - insertList.add(allocateUnion); - - } - return insertList; - } - - } diff --git a/src/main/java/com/budwk/app/zhgh/dayofficework/unionReimburse/controller/UnionReimburseApplyController.java b/src/main/java/com/budwk/app/zhgh/dayofficework/unionReimburse/controller/UnionReimburseApplyController.java index b53b50b6..7a799ff1 100644 --- a/src/main/java/com/budwk/app/zhgh/dayofficework/unionReimburse/controller/UnionReimburseApplyController.java +++ b/src/main/java/com/budwk/app/zhgh/dayofficework/unionReimburse/controller/UnionReimburseApplyController.java @@ -259,7 +259,14 @@ public class UnionReimburseApplyController { return Result.success(value); } - // 如果没有找到该社团的经费记录,返回0 - return Result.success(0.0); + // 协会在年度预算分配之后才创建时,不会自动生成当年预算记录,这里给出明确提示。 + return Result.error("该协会本年度未生成预算记录,请先在协会预算分配中补分配"); + } + + @At + @ApiOperation("统一查询经费余额") + @SaCheckPermission(value = {"unionReimburse.apply", "h5.unionReimburse.apply"}, mode = SaMode.OR) + public Result getBudgetBalance(String reimburseFundSource, String clubId) { + return unionReimburseService.getBudgetBalance(reimburseFundSource, clubId); } } diff --git a/src/main/java/com/budwk/app/zhgh/dayofficework/unionReimburse/controller/UnionReimburseReviewController.java b/src/main/java/com/budwk/app/zhgh/dayofficework/unionReimburse/controller/UnionReimburseReviewController.java index 5f3fa5f9..a6d6de41 100644 --- a/src/main/java/com/budwk/app/zhgh/dayofficework/unionReimburse/controller/UnionReimburseReviewController.java +++ b/src/main/java/com/budwk/app/zhgh/dayofficework/unionReimburse/controller/UnionReimburseReviewController.java @@ -15,7 +15,6 @@ import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; 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.SqlExpressionGroup; @@ -27,18 +26,15 @@ import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.Ok; import org.nutz.mvc.annotation.Param; -import java.util.Date; import java.util.List; @IocBean @At("/platform/unionReimburse/review") @Ok("json:full") -@Api("审核报销") +@Api("工会报销审核") @Slf4j public class UnionReimburseReviewController { - @Inject - private Dao dao; @Inject private UnionReimburseService unionReimburseService; @@ -98,42 +94,34 @@ public class UnionReimburseReviewController { } @At - @ApiOperation("审核") + @ApiOperation("审核报销") @Aop(TransAop.READ_COMMITTED) @SaCheckPermission(value = {"unionReimburse.review", "h5.unionReimburse.review"}, mode = SaMode.OR) - @SLog(tag = "审核工会报销", msg = "审核工会报销") + @SLog(tag = "工会报销审核", msg = "审核工会报销") public Result reviewTask(@Param("data") UnionReimburse unionReimburse, String submitType) { if (submitType == null || !List.of("3", "4", "5").contains(submitType)) { return Result.error("无效的审核操作类型"); } - UnionReimburse dbRecord = dao.fetch(UnionReimburse.class, unionReimburse.getId()); - if (dbRecord == null) { - return Result.error("记录不存在"); - } - dbRecord.setReviewTime(new Date()); - dbRecord.setStateId(Integer.parseInt(submitType)); - dbRecord.setReviewOpinion(unionReimburse.getReviewOpinion()); - dao.update(dbRecord); - return Result.success(); + return unionReimburseService.reviewApply(unionReimburse.getId(), unionReimburse.getReviewOpinion(), Integer.parseInt(submitType)); } @At @ApiOperation("一键审核") @Aop(TransAop.READ_COMMITTED) @SaCheckPermission(value = {"unionReimburse.review", "h5.unionReimburse.review"}, mode = SaMode.OR) - @SLog(tag = "一键审核", msg = "一键审核") + @SLog(tag = "工会报销审核", msg = "一键审核工会报销") public Result allReview() { try { List reimbursements = unionReimburseService.query(Cnd.where("stateId", "=", 2)); for (UnionReimburse reimbursement : reimbursements) { - reimbursement.setStateId(3); - reimbursement.setReviewTime(new Date()); - reimbursement.setReviewOpinion("通过"); - dao.update(reimbursement); + Result result = unionReimburseService.reviewApply(reimbursement.getId(), "通过", 3); + if (result.getCode() != 0) { + return result; + } } - return Result.success("一键审核完成,共处理 " + reimbursements.size() + " 条记录"); + return Result.success("一键审核完成,共处理" + reimbursements.size() + "条记录"); } catch (Exception e) { - log.error("一键审核失败"); + log.error("一键审核失败", e); return Result.error("一键审核失败: " + e.getMessage()); } } diff --git a/src/main/java/com/budwk/app/zhgh/dayofficework/unionReimburse/service/UnionReimburseService.java b/src/main/java/com/budwk/app/zhgh/dayofficework/unionReimburse/service/UnionReimburseService.java index 546506e9..db5efe78 100644 --- a/src/main/java/com/budwk/app/zhgh/dayofficework/unionReimburse/service/UnionReimburseService.java +++ b/src/main/java/com/budwk/app/zhgh/dayofficework/unionReimburse/service/UnionReimburseService.java @@ -1,7 +1,7 @@ package com.budwk.app.zhgh.dayofficework.unionReimburse.service; -import com.budwk.app.base.service.BaseService; import com.budwk.app.base.result.Result; +import com.budwk.app.base.service.BaseService; import com.budwk.app.zhgh.dayofficework.unionReimburse.model.UnionReimburse; import com.budwk.app.zhgh.dayofficework.unionReimburse.param.UnionReimbursePageForm; import com.budwk.app.zhgh.dayofficework.unionReimburse.vo.UnionReimburseBankHistoryVO; @@ -9,7 +9,7 @@ import org.nutz.dao.sql.Sql; import java.util.List; -public interface UnionReimburseService extends BaseService { +public interface UnionReimburseService extends BaseService { Sql getSql(UnionReimbursePageForm pageForm); @@ -19,7 +19,7 @@ public interface UnionReimburseService extends BaseService { Result saveApply(UnionReimburse unionReimburse, int stateId); /** - * 查询申请表单详情,补齐发票明细回显数据。 + * 查询申请表单详情,并补齐发票明细回显数据。 */ UnionReimburse getApplyForm(String id); @@ -34,8 +34,17 @@ public interface UnionReimburseService extends BaseService { Result checkInvoiceDuplicate(String invoiceNo, String reimburseId); /** - * 识别单张发票文件,并在需要时调用腾讯云验真接口补齐票面信息。 + * 识别单张发票文件,并在需要时调用验真接口补齐票面信息。 */ Result recognizeInvoice(String fileId, Boolean verifySwitch); + /** + * 查询报销可用经费余额,同时校验是否已分配以及协会归属权限。 + */ + Result getBudgetBalance(String reimburseFundSource, String clubId); + + /** + * 审核报销,审核通过时扣减对应预算并新增预算使用详情。 + */ + Result reviewApply(String reimburseId, String reviewOpinion, int submitType); } diff --git a/src/main/java/com/budwk/app/zhgh/dayofficework/unionReimburse/service/impl/UnionReimburseServiceImpl.java b/src/main/java/com/budwk/app/zhgh/dayofficework/unionReimburse/service/impl/UnionReimburseServiceImpl.java index 32f2c050..6d42fe24 100644 --- a/src/main/java/com/budwk/app/zhgh/dayofficework/unionReimburse/service/impl/UnionReimburseServiceImpl.java +++ b/src/main/java/com/budwk/app/zhgh/dayofficework/unionReimburse/service/impl/UnionReimburseServiceImpl.java @@ -8,6 +8,11 @@ import com.budwk.app.base.result.Result; import com.budwk.app.base.service.impl.BaseServiceImpl; import com.budwk.app.sys.models.Sys_file; import com.budwk.app.sys.services.SysFileService; +import com.budwk.app.zhgh.club.model.ClubUser; +import com.budwk.app.zhgh.dayofficework.outlay.outlayManage.club.model.OutlayManageClub; +import com.budwk.app.zhgh.dayofficework.outlay.outlayManage.model.OutlayUseDetail; +import com.budwk.app.zhgh.dayofficework.outlay.outlayManage.school.model.OutlayManageSchool; +import com.budwk.app.zhgh.dayofficework.outlay.outlayManage.union.model.OutlayManageUnion; import com.budwk.app.zhgh.dayofficework.unionReimburse.model.UnionReimburse; import com.budwk.app.zhgh.dayofficework.unionReimburse.model.UnionReimburseInvoiceDetail; import com.budwk.app.zhgh.dayofficework.unionReimburse.param.UnionReimbursePageForm; @@ -123,6 +128,10 @@ public class UnionReimburseServiceImpl extends BaseServiceImpl i if (validateResult != null) { return validateResult; } + Result fundValidateResult = validateFundSourceBeforeSubmit(unionReimburse); + if (fundValidateResult != null) { + return fundValidateResult; + } Result duplicateResult = validateInvoiceDuplicate(unionReimburse); if (duplicateResult != null) { return duplicateResult; @@ -232,8 +241,80 @@ public class UnionReimburseServiceImpl extends BaseServiceImpl i } /** - * 统一规整发票明细中的文本和金额,避免空格、空数组等脏数据进入库表。 + * 按经费来源统一查询当前可用余额,未分配或权限不匹配时直接拦截。 */ + @Override + public Result getBudgetBalance(String reimburseFundSource, String clubId) { + if (StrUtil.isBlank(reimburseFundSource)) { + return Result.error("请选择经费来源"); + } + if ("UNION_REIMBURSE_FUND_SOURCE_1".equals(reimburseFundSource)) { + OutlayManageSchool outlayManageSchool = dao().fetch(OutlayManageSchool.class, + Cnd.where("year", "=", DateUtil.thisYear())); + if (outlayManageSchool == null) { + return Result.error("校工会经费未分配"); + } + return Result.success(formatMoney(outlayManageSchool.getTotalQuota().subtract(outlayManageSchool.getUsedQuota()))); + } + if ("UNION_REIMBURSE_FUND_SOURCE_2".equals(reimburseFundSource)) { + OutlayManageUnion outlayManageUnion = dao().fetch(OutlayManageUnion.class, + Cnd.where("unionId", "=", SecurityUtil.getUnionId()).and("year", "=", DateUtil.thisYear())); + if (outlayManageUnion == null) { + return Result.error("分工会经费未分配"); + } + return Result.success(formatMoney(outlayManageUnion.getTotalQuota().subtract(outlayManageUnion.getUsedQuota()))); + } + if ("UNION_REIMBURSE_FUND_SOURCE_3".equals(reimburseFundSource)) { + if (StrUtil.isBlank(clubId)) { + return Result.error("请选择协会"); + } + List myClubIds = getCurrentUserClubIds(); + if (!isAdmin() && !myClubIds.contains(clubId)) { + return Result.error("当前用户无权使用该协会经费"); + } + OutlayManageClub outlayManageClub = dao().fetch(OutlayManageClub.class, + Cnd.where("clubId", "=", clubId).and("year", "=", DateUtil.thisYear())); + if (outlayManageClub == null) { + return Result.error("该协会本年度未生成预算记录,请先在协会预算分配中补分配"); + } + return Result.success(formatMoney(outlayManageClub.getTotalQuota().subtract(outlayManageClub.getUsedQuota()))); + } + return Result.error("不支持的经费来源"); + } + + /** + * 审核通过时统一校验余额、扣减预算并写入预算使用详情,避免控制器分散业务逻辑。 + */ + @Override + public Result reviewApply(String reimburseId, String reviewOpinion, int submitType) { + if (!List.of(3, 4, 5).contains(submitType)) { + return Result.error("无效的审核操作类型"); + } + UnionReimburse dbRecord = this.fetch(reimburseId); + if (dbRecord == null) { + return Result.error("记录不存在"); + } + if (submitType == 3) { + // 已通过的单据再次触发通过时直接返回,避免重复扣减预算。 + if (Integer.valueOf(3).equals(dbRecord.getStateId())) { + return Result.success(); + } + Result validateResult = validateFundSourceBeforeSubmit(dbRecord); + if (validateResult != null) { + return validateResult; + } + Result deductResult = deductBudgetAndSaveUseDetail(dbRecord); + if (deductResult != null && deductResult.getCode() != 0) { + return deductResult; + } + } + dbRecord.setReviewTime(new Date()); + dbRecord.setStateId(submitType); + dbRecord.setReviewOpinion(reviewOpinion); + dao().update(dbRecord); + return Result.success(); + } + private void normalizeInvoiceDetails(UnionReimburse unionReimburse) { if (unionReimburse.getInvoiceDetails() == null) { unionReimburse.setInvoiceDetails(new ArrayList<>()); @@ -289,15 +370,15 @@ public class UnionReimburseServiceImpl extends BaseServiceImpl i if (!isValidContact(unionReimburse.getMobile())) { return Result.error("请输入正确的联系方式"); } - if (StrUtil.isBlank(unionReimburse.getBankUserName())) { - return Result.error("请填写户名"); - } - if (StrUtil.isBlank(unionReimburse.getBankCardNumber())) { - return Result.error("请填写银行账号"); - } - if (StrUtil.isBlank(unionReimburse.getBankOfDeposit())) { - return Result.error("请填写开户行"); - } +// if (StrUtil.isBlank(unionReimburse.getBankUserName())) { +// return Result.error("请填写户名"); +// } +// if (StrUtil.isBlank(unionReimburse.getBankCardNumber())) { +// return Result.error("请填写银行账号"); +// } +// if (StrUtil.isBlank(unionReimburse.getBankOfDeposit())) { +// return Result.error("请填写开户行"); +// } if (StrUtil.isBlank(unionReimburse.getPaymentNotes())) { return Result.error("请填写支付内容"); } @@ -342,8 +423,159 @@ public class UnionReimburseServiceImpl extends BaseServiceImpl i } /** - * 同次提交和历史记录都要拦截重复发票,避免重复报销。 + * 提交和审核前统一校验预算是否已分配、余额是否充足。 */ + private Result validateFundSourceBeforeSubmit(UnionReimburse unionReimburse) { + Result balanceResult = getBudgetBalance(unionReimburse.getReimburseFundSource(), unionReimburse.getClubId()); + if (balanceResult == null || balanceResult.getCode() != 0) { + return balanceResult == null ? Result.error("经费余额校验失败") : balanceResult; + } + BigDecimal applyMoney = getApplyMoney(unionReimburse); + if (applyMoney.compareTo(BigDecimal.ZERO) <= 0) { + return Result.error("报销金额必须大于0"); + } + BigDecimal balance = new BigDecimal(String.valueOf(balanceResult.getData())); + if (balance.compareTo(applyMoney) < 0) { + return Result.error("经费余额不足,当前余额:" + formatMoney(balance)); + } + unionReimburse.setFundBalance(balance.doubleValue()); + return null; + } + + /** + * 审核通过后按经费来源扣减预算,并补写预算使用详情,便于后续台账追踪。 + */ + private Result deductBudgetAndSaveUseDetail(UnionReimburse unionReimburse) { + BigDecimal applyMoney = getApplyMoney(unionReimburse); + String reimburseFundSource = unionReimburse.getReimburseFundSource(); + if ("UNION_REIMBURSE_FUND_SOURCE_1".equals(reimburseFundSource)) { + OutlayManageSchool outlayManageSchool = dao().fetch(OutlayManageSchool.class, + Cnd.where("year", "=", DateUtil.thisYear())); + if (outlayManageSchool == null) { + return Result.error("校工会经费未分配"); + } + if (outlayManageSchool.getTotalQuota().subtract(outlayManageSchool.getUsedQuota()).compareTo(applyMoney) < 0) { + return Result.error("校工会经费余额不足"); + } + outlayManageSchool.setUsedQuota(outlayManageSchool.getUsedQuota().add(applyMoney)); + dao().updateIgnoreNull(outlayManageSchool); + insertUseDetail(unionReimburse, outlayManageSchool.getId(), applyMoney); + return Result.success(); + } + if ("UNION_REIMBURSE_FUND_SOURCE_2".equals(reimburseFundSource)) { + OutlayManageUnion outlayManageUnion = dao().fetch(OutlayManageUnion.class, + Cnd.where("unionId", "=", unionReimburse.getUnionId()).and("year", "=", DateUtil.thisYear())); + if (outlayManageUnion == null) { + return Result.error("分工会经费未分配"); + } + if (outlayManageUnion.getTotalQuota().subtract(outlayManageUnion.getUsedQuota()).compareTo(applyMoney) < 0) { + return Result.error("分工会经费余额不足"); + } + outlayManageUnion.setUsedQuota(outlayManageUnion.getUsedQuota().add(applyMoney)); + dao().updateIgnoreNull(outlayManageUnion); + insertUseDetail(unionReimburse, outlayManageUnion.getId(), applyMoney); + return Result.success(); + } + if ("UNION_REIMBURSE_FUND_SOURCE_3".equals(reimburseFundSource)) { + OutlayManageClub outlayManageClub = dao().fetch(OutlayManageClub.class, + Cnd.where("clubId", "=", unionReimburse.getClubId()).and("year", "=", DateUtil.thisYear())); + if (outlayManageClub == null) { + return Result.error("该协会本年度未生成预算记录,请先在协会预算分配中补分配"); + } + if (outlayManageClub.getTotalQuota().subtract(outlayManageClub.getUsedQuota()).compareTo(applyMoney) < 0) { + return Result.error("协会经费余额不足"); + } + outlayManageClub.setUsedQuota(outlayManageClub.getUsedQuota().add(applyMoney)); + dao().updateIgnoreNull(outlayManageClub); + insertUseDetail(unionReimburse, outlayManageClub.getId(), applyMoney); + return Result.success(); + } + return Result.error("不支持的经费来源"); + } + + /** + * 一张报销单只写入一条预算使用详情,避免重复通过或重复点击造成重复明细。 + */ + private void insertUseDetail(UnionReimburse unionReimburse, String outlayManageId, BigDecimal applyMoney) { + OutlayUseDetail oldDetail = dao().fetch(OutlayUseDetail.class, Cnd.where("outlayReimburseId", "=", unionReimburse.getId())); + if (oldDetail != null) { + return; + } + OutlayUseDetail detail = new OutlayUseDetail(); + detail.setOutlayManageId(outlayManageId); + detail.setOutlayReimburseId(unionReimburse.getId()); + detail.setAdjustMoney(applyMoney); + detail.setAdjustReason(StrUtil.blankToDefault(unionReimburse.getPaymentNotes(), getReimburseProjectName(unionReimburse.getReimburseProject()))); + detail.setAdjustUserId(SecurityUtil.getUserId()); + detail.setAdjustUserName(SecurityUtil.getUserUsername()); + detail.setAdjustLoginName(SecurityUtil.getUserLoginname()); + detail.setProjectName(buildUseDetailProjectName(unionReimburse)); + detail.setActivityNumber(unionReimburse.getActivityNumber()); + detail.setActivityTime(buildUseDetailTime(unionReimburse)); + dao().insert(detail); + } + + private BigDecimal getApplyMoney(UnionReimburse unionReimburse) { + Double money = "UNION_REIMBURSE_PROJECT_1".equals(unionReimburse.getReimburseProject()) + ? unionReimburse.getCondolenceMoney() : unionReimburse.getMoney(); + return BigDecimal.valueOf(money == null ? 0D : money).setScale(2, RoundingMode.HALF_UP); + } + + private String buildUseDetailProjectName(UnionReimburse unionReimburse) { + if (StrUtil.isNotBlank(unionReimburse.getActivityName())) { + return unionReimburse.getActivityName(); + } + if (StrUtil.isNotBlank(unionReimburse.getCondolenceUserName())) { + return getReimburseProjectName(unionReimburse.getReimburseProject()) + "-" + unionReimburse.getCondolenceUserName(); + } + return StrUtil.blankToDefault(unionReimburse.getDocumentNo(), getReimburseProjectName(unionReimburse.getReimburseProject())); + } + + private String buildUseDetailTime(UnionReimburse unionReimburse) { + if (unionReimburse.getActivityTime() != null) { + return DateUtil.formatDate(unionReimburse.getActivityTime()); + } + if (unionReimburse.getCondolenceTime() != null) { + return DateUtil.formatDate(unionReimburse.getCondolenceTime()); + } + if (unionReimburse.getCreateTime() != null) { + return DateUtil.formatDate(unionReimburse.getCreateTime()); + } + return ""; + } + + private String getReimburseProjectName(String reimburseProject) { + if ("UNION_REIMBURSE_PROJECT_1".equals(reimburseProject)) { + return "慰问申请"; + } + if ("UNION_REIMBURSE_PROJECT_2".equals(reimburseProject)) { + return "文体活动申请"; + } + if ("UNION_REIMBURSE_PROJECT_3".equals(reimburseProject)) { + return "日常活动申请"; + } + if ("UNION_REIMBURSE_PROJECT_4".equals(reimburseProject)) { + return "专项活动申请"; + } + return "报销申请"; + } + + private Double formatMoney(BigDecimal money) { + return money == null ? 0D : money.setScale(2, RoundingMode.HALF_UP).doubleValue(); + } + + private List getCurrentUserClubIds() { + if (isAdmin()) { + return new ArrayList<>(); + } + List clubUsers = dao().query(ClubUser.class, Cnd.where("userId", "=", SecurityUtil.getUserId())); + return clubUsers.stream() + .map(ClubUser::getClubId) + .filter(StrUtil::isNotBlank) + .distinct() + .collect(Collectors.toList()); + } + private Result validateInvoiceDuplicate(UnionReimburse unionReimburse) { Map> currentInvoiceMap = new LinkedHashMap<>(); List details = unionReimburse.getInvoiceDetails(); diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/difficulthelp/controller/DifficultHelpApplyController.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/difficulthelp/controller/DifficultHelpApplyController.java index 9172c36e..c003d660 100644 --- a/src/main/java/com/budwk/app/zhgh/staffbenefit/difficulthelp/controller/DifficultHelpApplyController.java +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/difficulthelp/controller/DifficultHelpApplyController.java @@ -84,6 +84,9 @@ public class DifficultHelpApplyController { public Result getIsCanPlay() { //获取申请次数,不想再写一个接口, are you ok? .and("zt", "=", 600) int applyCount = dao.count(DifficultHelpInfo.class, Cnd.where("proxyUserId", "=", SecurityUtil.getUserId())); + // 页面初始化时需要先判断当前登录人本年度是否已经申请过,避免重复进入新增申请。 + boolean hasCurrentYearApply = dao.count(DifficultHelpInfo.class, Cnd.where("userId", "=", SecurityUtil.getUserId()) + .and("YEAR(applyTime)", "=", DateUtil.getYear())) > 0; Sys_config startConfig = dao.fetch(Sys_config.class, Cnd.where("configKey", "=", "DifficultyApplyStartTime")); Sys_config endConfig = dao.fetch(Sys_config.class, Cnd.where("configKey", "=", "DifficultyApplyEndTime")); if(startConfig != null && endConfig != null) { @@ -98,9 +101,9 @@ public class DifficultHelpApplyController { int endResult = cn.hutool.core.date.DateUtil.compare(cn.hutool.core.date.DateUtil.parse(today), cn.hutool.core.date.DateUtil.parse(end)); String time = startConfig.getConfigValue().replace("-", "月") + "日-" + endConfig.getConfigValue().replace("-", "月") + "日"; - return Result.success(Map.of("applyCount", applyCount,"time", time, "result", startResult >=0 && endResult <= 0)); + return Result.success(Map.of("applyCount", applyCount,"time", time, "result", startResult >=0 && endResult <= 0, "hasCurrentYearApply", hasCurrentYearApply)); } else { - return Result.success(Map.of("applyCount", applyCount,"time", "", "result", false)); + return Result.success(Map.of("applyCount", applyCount,"time", "", "result", false, "hasCurrentYearApply", hasCurrentYearApply)); } } @@ -110,6 +113,10 @@ public class DifficultHelpApplyController { @SLog(tag = "困难补助申请", msg = "保存申请,填写人: ${args[0].proxyUserName}") public Result save(@Param("data") DifficultHelpInfo difficultHelpInfo) { difficultHelpInfo.setApplyTime(ObjectUtil.defaultIfNull(difficultHelpInfo.getApplyTime(), new Date())); + difficultHelpCommonService.refreshApplyCount(difficultHelpInfo); + if (difficultHelpCommonService.hasAppliedInYear(difficultHelpInfo.getUserId(), difficultHelpInfo.getApplyTime(), difficultHelpInfo.getId())) { + return Result.error("该人员本年度已申请困难帮扶,不能重复申请"); + } dao.insertOrUpdate(difficultHelpInfo); return Result.success(); } @@ -122,6 +129,10 @@ public class DifficultHelpApplyController { @SLog(tag = "困难补助申请", msg = "提交申请,填写人: ${args[0].proxyUserName}") public Result submit(@Param("data") DifficultHelpInfo difficultHelpInfo){ difficultHelpInfo.setApplyTime(new Date()); + difficultHelpCommonService.refreshApplyCount(difficultHelpInfo); + if (difficultHelpCommonService.hasAppliedInYear(difficultHelpInfo.getUserId(), difficultHelpInfo.getApplyTime(), difficultHelpInfo.getId())) { + return Result.error("该人员本年度已申请困难帮扶,不能重复申请"); + } dao.insertOrUpdate(difficultHelpInfo); // 开启流程实例 @@ -146,6 +157,10 @@ public class DifficultHelpApplyController { @SLog(tag = "困难补助申请", msg = "重新提交申请,填写人: ${args[0].proxyUserName}") public Result submitAgain(@Param("data") DifficultHelpInfo difficultHelpInfo, @Param("taskId") Long taskId) { difficultHelpInfo.setApplyTime(ObjectUtil.defaultIfNull(difficultHelpInfo.getApplyTime(), new Date())); + difficultHelpCommonService.refreshApplyCount(difficultHelpInfo); + if (difficultHelpCommonService.hasAppliedInYear(difficultHelpInfo.getUserId(), difficultHelpInfo.getApplyTime(), difficultHelpInfo.getId())) { + return Result.error("该人员本年度已申请困难帮扶,不能重复申请"); + } dao.insertOrUpdate(difficultHelpInfo); Dict dict = Dict.create(); diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/difficulthelp/service/DifficultHelpCommonService.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/difficulthelp/service/DifficultHelpCommonService.java index 81fa16be..dfa46c34 100644 --- a/src/main/java/com/budwk/app/zhgh/staffbenefit/difficulthelp/service/DifficultHelpCommonService.java +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/difficulthelp/service/DifficultHelpCommonService.java @@ -7,6 +7,7 @@ import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.aidFund.param.AidFundPag import org.nutz.lang.util.NutMap; import org.nutz.mvc.upload.TempFile; +import java.util.Date; import java.util.List; /** @@ -26,4 +27,21 @@ public interface DifficultHelpCommonService extends BaseService getYearPayList(DifficultHelpPageParam pageForm); + + /** + * 校验同一受补助人同一年是否已存在申请记录。 + * + * @param userId 受补助人id + * @param applyTime 申请时间 + * @param excludeRecordId 排除的当前记录id,编辑/重新提交时使用 + * @return true 已存在同年申请记录 + */ + boolean hasAppliedInYear(String userId, Date applyTime, String excludeRecordId); + + /** + * 新申请时按历史总申请次数重新计算申请次数字段,已有记录则保留原值。 + * + * @param difficultHelpInfo 申请信息 + */ + void refreshApplyCount(DifficultHelpInfo difficultHelpInfo); } diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/difficulthelp/service/impl/DifficultHelpCommonServiceImpl.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/difficulthelp/service/impl/DifficultHelpCommonServiceImpl.java index 49e126c2..0ef9198b 100644 --- a/src/main/java/com/budwk/app/zhgh/staffbenefit/difficulthelp/service/impl/DifficultHelpCommonServiceImpl.java +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/difficulthelp/service/impl/DifficultHelpCommonServiceImpl.java @@ -50,6 +50,38 @@ public class DifficultHelpCommonServiceImpl extends BaseServiceImpl", excludeRecordId); + } + // 按受补助人和申请年份校验,确保同一个人每年只能保留一条申请记录。 + return dao().count(DifficultHelpInfo.class, cnd) > 0; + } + + @Override + public void refreshApplyCount(DifficultHelpInfo difficultHelpInfo) { + if (difficultHelpInfo == null || StrUtil.isBlank(difficultHelpInfo.getUserId())) { + return; + } + if (StrUtil.isNotBlank(difficultHelpInfo.getId())) { + DifficultHelpInfo dbInfo = dao().fetch(DifficultHelpInfo.class, difficultHelpInfo.getId()); + if (dbInfo != null) { + // 已存在的申请记录沿用原申请次数,避免编辑或重新提交时重复累加。 + difficultHelpInfo.setApplyCount(dbInfo.getApplyCount()); + return; + } + } + int historyApplyCount = dao().count(DifficultHelpInfo.class, Cnd.where("userId", "=", difficultHelpInfo.getUserId())); + // 新申请记录按历史总申请次数 + 1 重新计算申请次数,不使用前端传入值。 + difficultHelpInfo.setApplyCount(historyApplyCount + 1); + } + @Override public List getYearPayList(DifficultHelpPageParam pageForm) { // 1. 生成年份列表 diff --git a/src/main/resources/static/components/module/userInfo/index.vue b/src/main/resources/static/components/module/userInfo/index.vue index 1e96106e..0c61870a 100644 --- a/src/main/resources/static/components/module/userInfo/index.vue +++ b/src/main/resources/static/components/module/userInfo/index.vue @@ -22,7 +22,6 @@ {{ viewData.arrivalAtSchoolDate ? $moment(viewData.arrivalAtSchoolDate).format("YYYY-MM-DD") : null }} {{ viewData.identityType }} - {{ viewData.preparedBy }} {{ viewData.personType }} {{ viewData.userState }} diff --git a/src/main/resources/views/platform/sys/data/user/pull.html b/src/main/resources/views/platform/sys/data/user/pull.html index df21324a..12780ca3 100644 --- a/src/main/resources/views/platform/sys/data/user/pull.html +++ b/src/main/resources/views/platform/sys/data/user/pull.html @@ -1,4 +1,4 @@ - @@ -52,7 +52,7 @@ layout("/layouts/platform.html"){ - + @@ -77,8 +77,7 @@ layout("/layouts/platform.html"){ - - + @@ -209,3 +208,4 @@ layout("/layouts/platform.html"){ + diff --git a/src/main/resources/views/platform/sys/data/user/update.html b/src/main/resources/views/platform/sys/data/user/update.html index 5f394ac2..2f416a86 100644 --- a/src/main/resources/views/platform/sys/data/user/update.html +++ b/src/main/resources/views/platform/sys/data/user/update.html @@ -1,4 +1,4 @@ - @@ -39,10 +39,7 @@ layout("/layouts/platform.html"){ - - - - + @@ -72,8 +69,7 @@ layout("/layouts/platform.html"){ - - + @@ -162,9 +158,8 @@ layout("/layouts/platform.html"){ { label: "生日", value: "birthday" }, { label: "手机号", value: "mobile" }, { label: "在职状态", value: "userState" }, - { label: "编制类别", value: "preparedBy" }, { label: "进站时间", value: "postDoctoralJoinDate" }, - { label: "教职工类别", value: "personType" }, + { label: "人员类型", value: "personType" }, { label: "来校年月", value: "arrivalAtSchoolDate" }, { label: "单位", value: "unitName" }, { label: "单位编码", value: "unitId" }, @@ -314,3 +309,4 @@ layout("/layouts/platform.html"){ + diff --git a/src/main/resources/views/platform/sys/msg/msgManage/msgManageForm.js b/src/main/resources/views/platform/sys/msg/msgManage/msgManageForm.js index c7fab10f..560ed3b7 100644 --- a/src/main/resources/views/platform/sys/msg/msgManage/msgManageForm.js +++ b/src/main/resources/views/platform/sys/msg/msgManage/msgManageForm.js @@ -30,8 +30,7 @@ const MSG_FORM_TEMPLATE = { - - + @@ -93,8 +92,7 @@ const MSG_FORM_TEMPLATE = { - - + @@ -262,3 +260,4 @@ const MSG_FORM_TEMPLATE = { this.roleList = await this.getRoleList() } } + diff --git a/src/main/resources/views/platform/zhgh/activity/sports/applyUser/applyUser.js b/src/main/resources/views/platform/zhgh/activity/sports/applyUser/applyUser.js index c0244065..07824bf4 100644 --- a/src/main/resources/views/platform/zhgh/activity/sports/applyUser/applyUser.js +++ b/src/main/resources/views/platform/zhgh/activity/sports/applyUser/applyUser.js @@ -29,7 +29,6 @@ var ACTIVITY_SPORTS_APPLY_USER = {
+ v-if="activityTableData.eveProjectType==2&&teamList.length>1"> 修改小队 @@ -355,7 +354,6 @@ var ACTIVITY_SPORTS_APPLY_USER = { eventList: [], eventData: {}, teamList: [], - allowMoreTeam: false, applyFromData: {}, leftApplyUserList: [], @@ -488,10 +486,9 @@ var ACTIVITY_SPORTS_APPLY_USER = { isMenWomenTwo: data.isMenWomen }) if (resp.code === 0) { - const {users, awardsModeT, awardsModeG, team, activity, getEvent, allowMoreTeam} = resp.data + const {users, awardsModeT, awardsModeG, team, activity, getEvent} = resp.data this.activityData = activity this.eventData = getEvent - this.allowMoreTeam = allowMoreTeam === true this.teamList = team if (this.teamList && this.teamList.length > 0) { this.applyFromData.teamName = this.teamList[0].name @@ -589,13 +586,13 @@ var ACTIVITY_SPORTS_APPLY_USER = { message = teamName + "替补最多设置" + substituteNum + "人" break } - const womanYdyNum = teamApplyData[i].filter((v) => ["女", "女性"].includes(v.sex) && v.identity.includes("1")).length + const womanYdyNum = teamApplyData[i].filter((v) => ["女"].includes(v.sex) && v.identity.includes("1")).length if (restrictGirlNum > 0 && womanYdyNum < restrictGirlNum) { msgFlag = false message = teamName + "女运动员至少设置" + restrictGirlNum + "人" break } - const manYdyNum = teamApplyData[i].filter((v) => ["男", "男性"].includes(v.sex) && v.identity.includes("1")).length + const manYdyNum = teamApplyData[i].filter((v) => ["男"].includes(v.sex) && v.identity.includes("1")).length if (restrictBoyNum > 0 && manYdyNum < restrictBoyNum) { msgFlag = false message = teamName + "男运动员至少设置" + restrictBoyNum + "人" @@ -678,7 +675,7 @@ var ACTIVITY_SPORTS_APPLY_USER = { ) { this.$notify({ title: "警告", - message: "该项目暂不支持男性运动员报名", + message: "该项目暂不支持男运动员报名", type: "warning" }) return @@ -692,7 +689,7 @@ var ACTIVITY_SPORTS_APPLY_USER = { ) { this.$notify({ title: "警告", - message: "该项目暂不支持女性运动员报名", + message: "该项目暂不支持女运动员报名", type: "warning" }) return @@ -881,7 +878,6 @@ var ACTIVITY_SPORTS_APPLY_USER = { }, uniteApplyReset() { this.teamList = [] - this.allowMoreTeam = false this.eventData = {} this.activityData = {} this.applyFromData = {} diff --git a/src/main/resources/views/platform/zhgh/activity/sports/infoManage/addActivity.js b/src/main/resources/views/platform/zhgh/activity/sports/infoManage/addActivity.js index cfee3021..5afc5062 100644 --- a/src/main/resources/views/platform/zhgh/activity/sports/infoManage/addActivity.js +++ b/src/main/resources/views/platform/zhgh/activity/sports/infoManage/addActivity.js @@ -1,4 +1,4 @@ -let ACTIVITY_SPORTS_ADD_ACTIVITY = { +let ACTIVITY_SPORTS_ADD_ACTIVITY = { template: `
@@ -191,19 +191,6 @@ let ACTIVITY_SPORTS_ADD_ACTIVITY = { - - - - - - - - @@ -446,7 +433,7 @@ let ACTIVITY_SPORTS_ADD_ACTIVITY = { - { - submit() - }) - .catch(() => { - }) - }, - doOperate(forceReduceTeam) { + async doOperate() { const method = this.formData.id ? "/doEdit" : "/doAdd" const formData = clone(this.formData) const events = clone(this.checkedEventInfo) @@ -1058,23 +1030,16 @@ let ACTIVITY_SPORTS_ADD_ACTIVITY = { spinner: "el-icon-loading", background: "rgba(0,0,0,.45)" }) - return this.$axios.post(base + "/platform/activity/sports/info/mange" + method, { + const resp = await this.$axios.post(base + "/platform/activity/sports/info/mange" + method, { data: JSON.stringify(formData), - events: JSON.stringify(events), - forceReduceTeam: forceReduceTeam === true - }).then((resp) => { - if (resp.code === 0) { - this.$emit("flip") - } else if (resp.code === 2) { - this.confirmReduceTeam(resp, () => { - this.doOperate(true) - }) - } else { - this.$notify.error({ title: "错误", message: resp.msg }) - } - }).finally(() => { - loading.close() + events: JSON.stringify(events) }) + if (resp.code === 0) { + this.$emit("flip") + } else { + this.$notify.error({ title: "错误", message: resp.msg }) + } + loading.close() }, async operate() { const deleteEventIds = this.eventsIds.filter((v) => !this.formData.eventsIds.includes(v)) @@ -1095,7 +1060,7 @@ let ACTIVITY_SPORTS_ADD_ACTIVITY = { await this.doOperate() } }, - doSave(forceReduceTeam) { + async doSave() { let url = this.formData.id ? "/doEdit" : "/doAdd" this.checkedEventInfo.forEach((v) => { @@ -1150,27 +1115,19 @@ let ACTIVITY_SPORTS_ADD_ACTIVITY = { background: "rgba(0,0,0,.45)" }) - return this.$axios.post("/platform/activity/sports/info/mange" + url, { + const resp = await this.$axios.post("/platform/activity/sports/info/mange" + url, { data: JSON.stringify(formData), - events: JSON.stringify(events), - forceReduceTeam: forceReduceTeam === true - }).then((resp) => { - if (resp.code === 0) { - this.$emit("flush") - if (!this.formData.id) formData.id = resp.data - return this.openEdit(formData, false).then(() => { - this.$message.success(resp.msg) - }) - } else if (resp.code === 2) { - this.confirmReduceTeam(resp, () => { - this.doSave(true) - }) - } else { - this.$message.error(resp.msg) - } - }).finally(() => { - loading.close() + events: JSON.stringify(events) }) + if (resp.code === 0) { + this.$emit("flush") + if (!this.formData.id) formData.id = resp.data + await this.openEdit(formData, false) + this.$message.success(resp.msg) + } else { + this.$message.error(resp.msg) + } + loading.close() }, examineTrans(formData) { const { unitJointly, unitSponsor, time, applyTime, applyWay, image } = formData @@ -1236,18 +1193,17 @@ let ACTIVITY_SPORTS_ADD_ACTIVITY = { options: [{label: '男', value: '男'}, {label: '女', value: '女'}] }, {label: '在职状态', value: 'userState', type: "select", options: userStateOptions}, - {label: '教职工类别', value: 'personType', type: "select", options: personTypeOptions}, + {label: '人员类型', value: 'personType', type: "select", options: personTypeOptions}, ]*/ } }, - created() { - Promise.all([this.getClubsByRole(), this.$businessTool.listUnit(), this.$businessTool.listUnion()]).then(([clubs, units, unions]) => { - this.clubOptions = clubs - this.clubOptions.map((v) => { - v.name = v.clubName - }) - this.unionOptions = unions - this.unitOptions = this.clubOptions.concat(units) + async created() { + this.clubOptions = await this.getClubsByRole() + this.clubOptions.map((v) => { + v.name = v.clubName }) + const units = await this.$businessTool.listUnit() + this.unitOptions = this.clubOptions.concat(units) } } + diff --git a/src/main/resources/views/platform/zhgh/activity/sports/infoManage/info.js b/src/main/resources/views/platform/zhgh/activity/sports/infoManage/info.js index eab98466..27cb99b5 100644 --- a/src/main/resources/views/platform/zhgh/activity/sports/infoManage/info.js +++ b/src/main/resources/views/platform/zhgh/activity/sports/infoManage/info.js @@ -150,15 +150,6 @@ var ACTIVITY_SPORTS_INFO = { - - - - {{ app.startAgeDate }} - {{ app.endAgeDate }} - - 暂无 - - - {{ app.leanderNum | money }} 人 diff --git a/src/main/resources/views/platform/zhgh/benefit/userList/index.html b/src/main/resources/views/platform/zhgh/benefit/userList/index.html index 007f24d0..dbae3545 100644 --- a/src/main/resources/views/platform/zhgh/benefit/userList/index.html +++ b/src/main/resources/views/platform/zhgh/benefit/userList/index.html @@ -1,4 +1,4 @@ - @@ -52,7 +52,7 @@ layout("/layouts/platform.html"){ - + @@ -124,7 +124,7 @@ layout("/layouts/platform.html"){ { prop: "userName", label: "姓名" }, { prop: "sex", label: "性别", sortable: true }, { prop: "mobile", label: "联系方式" }, - { prop: "personType", label: "教职工类别", sortable: true }, + { prop: "personType", label: "人员类型", sortable: true }, { prop: "userState", label: "在职状态", sortable: true }, { prop: "unionName", label: "所属工会", sortable: true }, { prop: "unitName", label: "所属单位", sortable: true } @@ -218,3 +218,4 @@ layout("/layouts/platform.html"){ + diff --git a/src/main/resources/views/platform/zhgh/benefit/userSelectionList/index.html b/src/main/resources/views/platform/zhgh/benefit/userSelectionList/index.html index 4c898d44..a93f760f 100644 --- a/src/main/resources/views/platform/zhgh/benefit/userSelectionList/index.html +++ b/src/main/resources/views/platform/zhgh/benefit/userSelectionList/index.html @@ -1,4 +1,4 @@ - @@ -59,7 +59,7 @@ layout("/layouts/platform.html"){ - + @@ -192,7 +192,7 @@ layout("/layouts/platform.html"){ { prop: "loginName", label: "工号" }, { prop: "userName", label: "姓名" }, { prop: "sex", label: "性别", sortable: true }, - { prop: "personType", label: "教职工类别", sortable: true }, + { prop: "personType", label: "人员类型", sortable: true }, { prop: "userState", label: "在职状态", sortable: true }, { prop: "unionName", label: "所属工会", sortable: true }, { prop: "unitName", label: "所属单位", sortable: true }, @@ -258,3 +258,4 @@ layout("/layouts/platform.html"){ + diff --git a/src/main/resources/views/platform/zhgh/club/examine/common/examineInfo.js b/src/main/resources/views/platform/zhgh/club/examine/common/examineInfo.js index d7b94457..cf32b907 100644 --- a/src/main/resources/views/platform/zhgh/club/examine/common/examineInfo.js +++ b/src/main/resources/views/platform/zhgh/club/examine/common/examineInfo.js @@ -1,4 +1,4 @@ -const EXAMINE_INFO_COMPONENT = { +const EXAMINE_INFO_COMPONENT = { template: `
@@ -19,7 +19,7 @@ const EXAMINE_INFO_COMPONENT = {
社团成员变化情况
- + @@ -196,3 +196,4 @@ const EXAMINE_INFO_COMPONENT = { } ` } + diff --git a/src/main/resources/views/platform/zhgh/club/infoManage/exitManage/index.html b/src/main/resources/views/platform/zhgh/club/infoManage/exitManage/index.html index eb0994fd..5ab88f44 100644 --- a/src/main/resources/views/platform/zhgh/club/infoManage/exitManage/index.html +++ b/src/main/resources/views/platform/zhgh/club/infoManage/exitManage/index.html @@ -1,4 +1,4 @@ - @@ -16,7 +16,7 @@ layout("/layouts/platform.html"){ - + @@ -98,3 +98,4 @@ layout("/layouts/platform.html"){ + diff --git a/src/main/resources/views/platform/zhgh/club/infoManage/manage/clubInfoManage.js b/src/main/resources/views/platform/zhgh/club/infoManage/manage/clubInfoManage.js index 7630b591..9ce01b83 100644 --- a/src/main/resources/views/platform/zhgh/club/infoManage/manage/clubInfoManage.js +++ b/src/main/resources/views/platform/zhgh/club/infoManage/manage/clubInfoManage.js @@ -1,4 +1,4 @@ -const CLUB_INFO_MANAGE_TEMPLATE = { +const CLUB_INFO_MANAGE_TEMPLATE = { template: `
@@ -6,7 +6,7 @@ const CLUB_INFO_MANAGE_TEMPLATE = { - + @@ -353,3 +353,4 @@ const CLUB_INFO_MANAGE_TEMPLATE = { await this.pageData() } } + diff --git a/src/main/resources/views/platform/zhgh/dayofficework/fund/member/batchJoin/index.html b/src/main/resources/views/platform/zhgh/dayofficework/fund/member/batchJoin/index.html index 327267d6..37dd83db 100644 --- a/src/main/resources/views/platform/zhgh/dayofficework/fund/member/batchJoin/index.html +++ b/src/main/resources/views/platform/zhgh/dayofficework/fund/member/batchJoin/index.html @@ -35,14 +35,10 @@ layout("/layouts/platform.html"){ - - + - - - @@ -105,8 +101,7 @@ layout("/layouts/platform.html"){ { label: "性别", prop: "sex" }, { label: "出生年月", prop: "birthday" }, { label: "在职状态", prop: "userState", sortable: true }, - { label: "教职工类别", prop: "personType", sortable: true }, - { label: '编制类别', prop: 'preparedBy', sortable: true }, + { label: "人员类型", prop: "personType", sortable: true }, { label: "所属工会", prop: "unionName" }, { label: "所属单位", prop: "unitName" }, ], @@ -183,3 +178,4 @@ layout("/layouts/platform.html"){ + diff --git a/src/main/resources/views/platform/zhgh/dayofficework/fund/member/query/index.html b/src/main/resources/views/platform/zhgh/dayofficework/fund/member/query/index.html index 71d31ac5..7e99325e 100644 --- a/src/main/resources/views/platform/zhgh/dayofficework/fund/member/query/index.html +++ b/src/main/resources/views/platform/zhgh/dayofficework/fund/member/query/index.html @@ -39,14 +39,10 @@ layout("/layouts/platform.html"){ - - + - - - @@ -113,8 +109,7 @@ layout("/layouts/platform.html"){ { label: "性别", prop: "sex" }, { label: "出生年月", prop: "birthday" }, { label: "在职状态", prop: "userState", sortable: true }, - { label: "教职工类别", prop: "personType", sortable: true }, - { label: '编制类别', prop: 'preparedBy', sortable: true }, + { label: "人员类型", prop: "personType", sortable: true }, { label: "所属工会", prop: "unionName" }, { label: "所属单位", prop: "unitName" }, { label: "加入时间", prop: "joinTime" }, @@ -219,3 +214,4 @@ layout("/layouts/platform.html"){ + diff --git a/src/main/resources/views/platform/zhgh/dayofficework/healthCheckup/projectMange/index.html b/src/main/resources/views/platform/zhgh/dayofficework/healthCheckup/projectMange/index.html index 1283eaae..25343df5 100644 --- a/src/main/resources/views/platform/zhgh/dayofficework/healthCheckup/projectMange/index.html +++ b/src/main/resources/views/platform/zhgh/dayofficework/healthCheckup/projectMange/index.html @@ -436,8 +436,7 @@ layout("/layouts/platform.html"){ {label: "年龄", value: "age"}, {label: "婚姻状况", value: "marriage"}, {label: "在职状态", value: "userState"}, - {label: "编制类别", value: "preparedBy"}, - {label: "教职工类别", value: "personType"}, + {label: "人员类型", value: "personType"}, ], conditionGroup: { logic: "AND", @@ -701,3 +700,4 @@ layout("/layouts/platform.html"){ + diff --git a/src/main/resources/views/platform/zhgh/dayofficework/integral/manage/index.html b/src/main/resources/views/platform/zhgh/dayofficework/integral/manage/index.html index 52baa0d4..f7239082 100644 --- a/src/main/resources/views/platform/zhgh/dayofficework/integral/manage/index.html +++ b/src/main/resources/views/platform/zhgh/dayofficework/integral/manage/index.html @@ -1,4 +1,4 @@ -
@@ -43,8 +43,8 @@ layout("/layouts/platform.html"){ - - + @@ -249,7 +249,7 @@ layout("/layouts/platform.html"){ {prop: 'username', label: '姓名', sortable: true}, {prop: 'sex', label: '性别'}, {prop: 'mobile', label: '联系电话'}, - {prop: 'personType', label: '教职工类别', sortable: true}, + {prop: 'personType', label: '人员类型', sortable: true}, {prop: 'userState', label: '在职状态', sortable: true}, {prop: 'unionName', label: '所属工会', sortable: true}, {prop: 'unitName', label: '所属单位', sortable: true}, @@ -460,3 +460,4 @@ layout("/layouts/platform.html"){ + diff --git a/src/main/resources/views/platform/zhgh/dayofficework/meeting/common/meetingInfo.js b/src/main/resources/views/platform/zhgh/dayofficework/meeting/common/meetingInfo.js index 8cc0636b..3b2405ce 100644 --- a/src/main/resources/views/platform/zhgh/dayofficework/meeting/common/meetingInfo.js +++ b/src/main/resources/views/platform/zhgh/dayofficework/meeting/common/meetingInfo.js @@ -31,8 +31,7 @@ const meetingInfo = { - - + @@ -68,3 +67,4 @@ const meetingInfo = { } ` } + diff --git a/src/main/resources/views/platform/zhgh/dayofficework/meeting/manage/basicForm.js b/src/main/resources/views/platform/zhgh/dayofficework/meeting/manage/basicForm.js index 79f9352d..e80dee10 100644 --- a/src/main/resources/views/platform/zhgh/dayofficework/meeting/manage/basicForm.js +++ b/src/main/resources/views/platform/zhgh/dayofficework/meeting/manage/basicForm.js @@ -114,8 +114,7 @@ const basicForm = { - - + @@ -178,8 +177,7 @@ const basicForm = { - - + @@ -394,3 +392,4 @@ const basicForm = { ` } + diff --git a/src/main/resources/views/platform/zhgh/dayofficework/outlay/activityBudget/apply/index.html b/src/main/resources/views/platform/zhgh/dayofficework/outlay/activityBudget/apply/index.html index 2806c48f..8de3835d 100644 --- a/src/main/resources/views/platform/zhgh/dayofficework/outlay/activityBudget/apply/index.html +++ b/src/main/resources/views/platform/zhgh/dayofficework/outlay/activityBudget/apply/index.html @@ -249,24 +249,24 @@ layout("/layouts/platform.html"){ async getActivityBudgetType() { const data = await this.$businessTool.getDictOptions("ACTIVITY_BUDGET_TYPE") let budgetTypeOption = [] - if (this.$auth.hasRoleOr(['SYSADMIN'])) { + if (this.$auth.hasPermission(['activity.budget.apply.system'])) { this.budgetTypeOption = data } else { - if (this.$auth.hasRoleOr(['SCHOOL_UNION_ADMIN'])) { + if (this.$auth.hasPermission(['activity.budget.apply.schoolAdmin'])) { data.map(v => { if (["ACTIVITY_BUDGET_TYPE_ONE"].includes(v.code)) { budgetTypeOption.push(v) } }) } - if (this.$auth.hasRoleOr(['BRANCH_UNION_ADMIN', 'BRANCH_UNION_CHAIRMAN'])) { + if (this.$auth.hasPermission(['activity.budget.apply.branchAdmin'])) { data.map(v => { if (["ACTIVITY_BUDGET_TYPE_TWO"].includes(v.code)) { budgetTypeOption.push(v) } }) } - if (this.$auth.hasRoleOr(['CLUB_PRESIDENT'])) { + if (this.$auth.hasPermission(['activity.budget.apply.clubPresident'])) { data.map(v => { if (["ACTIVITY_BUDGET_TYPE_THREE"].includes(v.code)) { budgetTypeOption.push(v) diff --git a/src/main/resources/views/platform/zhgh/dayofficework/outlay/outlayManage/union/allocate/index.html b/src/main/resources/views/platform/zhgh/dayofficework/outlay/outlayManage/union/allocate/index.html index 370df3b5..9ea27294 100644 --- a/src/main/resources/views/platform/zhgh/dayofficework/outlay/outlayManage/union/allocate/index.html +++ b/src/main/resources/views/platform/zhgh/dayofficework/outlay/outlayManage/union/allocate/index.html @@ -98,13 +98,54 @@ layout("/layouts/platform.html"){ - + - + + + 统一分配 + 导入分配 + + + + 取 消 @@ -137,11 +178,44 @@ layout("/layouts/platform.html"){ quarterlyList: [], batchAllocateDialogVisible: false, batchAllocateForm: { - allocateMoney: 0 - } + allocateMode: "uniform", + allocateMoney: 0, + importPreviewList: [] + }, + importFileList: [] } }, methods: { + /** + * 确认提示文案优先展示页面当前筛选季度。 + * 未选择季度时再回退到系统当前自然季度,避免提示文案与用户当前查看条件不一致。 + */ + getPromptQuarter() { + return this.pageForm.quarterly || this.$moment().quarter() + }, + /** + * 季度记录生成、重置记录都要按页面当前筛选的年度和季度执行。 + * 这里统一封装请求参数,避免前后端再次出现“提示季度”和“实际执行季度”不一致的问题。 + */ + getCurrentQuarterParams() { + return { + quarterly: this.pageForm.quarterly || this.$moment().quarter(), + year: this.pageForm.year + } + }, + /** + * 生成、重置、一键分配都只允许操作当前自然季度。 + * 这里统一做前端入口校验,避免同类判断分散在多个按钮方法里难维护。 + */ + validateCurrentQuarterAction(actionName) { + const currentQuarter = this.$moment().quarter() + const selectedQuarter = Number(this.getCurrentQuarterParams().quarterly) + if (selectedQuarter !== currentQuarter) { + this.$message.warning('当前仅允许操作第' + currentQuarter + '季度' + actionName + ',请切换后再操作') + return false + } + return true + }, doEdit(row) { this.$confirm('确定要给【' + row.unionName + '】分配预算吗?', '提示', { confirmButtonText: '确定', @@ -163,13 +237,21 @@ layout("/layouts/platform.html"){ }) }, deleteAllocateRecord() { - this.$confirm('确定要重置【第' + this.$moment().quarter() + '季度】的预算记录吗?', '提示', { + if (!this.validateCurrentQuarterAction('记录重置')) { + return + } + // 重置动作以当前列表是否已有记录为前置条件,避免用户在空列表场景下误操作。 + if (this.tableData.length === 0) { + this.$message.warning('当前列表无可重置记录') + return + } + this.$confirm('确定要重置【第' + this.getPromptQuarter() + '季度】的预算记录吗?', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => { this.formLoading = true - this.$axios.post("/platform/outlay/outlayManage/unionAllocate/deleteAllocateRecord").then((resp) => { + this.$axios.post("/platform/outlay/outlayManage/unionAllocate/deleteAllocateRecord", this.getCurrentQuarterParams()).then((resp) => { if (resp.code === 0) { this.$message.success(resp.msg) this.doSearch() @@ -180,13 +262,16 @@ layout("/layouts/platform.html"){ }) }, doAllocateRecord() { - this.$confirm('确定要生成【第' + this.$moment().quarter() + '季度】的预算记录吗?', '提示', { + if (!this.validateCurrentQuarterAction('记录生成')) { + return + } + this.$confirm('确定要生成【第' + this.getPromptQuarter() + '季度】的预算记录吗?', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => { this.formLoading = true - this.$axios.post("/platform/outlay/outlayManage/unionAllocate/doAllocateRecord").then((resp) => { + this.$axios.post("/platform/outlay/outlayManage/unionAllocate/doAllocateRecord", this.getCurrentQuarterParams()).then((resp) => { if (resp.code === 0) { this.$message.success(resp.msg) this.doSearch() @@ -197,28 +282,109 @@ layout("/layouts/platform.html"){ }) }, showBatchAllocateDialog() { + if (!this.validateCurrentQuarterAction('一键分配')) { + return + } if (this.tableData.length === 0) { this.$message.warning('当前没有可分配的工会记录,请先生成季度记录') return } - this.batchAllocateForm = { - allocateMoney: 0 + const currentParams = this.getCurrentQuarterParams() + const openDialog = () => { + this.resetBatchAllocateForm() + this.batchAllocateDialogVisible = true } - this.batchAllocateDialogVisible = true + this.$axios.post("/platform/outlay/outlayManage/unionAllocate/hasAllocated", { + quarterly: currentParams.quarterly, + year: currentParams.year + }).then((resp) => { + if (resp.code !== 0) { + return + } + if (resp.data) { + this.$confirm('温馨提示:当前季度已分配过额度,再次分配将覆盖本季度原有分配结果,是否继续?', '温馨提示', { + confirmButtonText: '继续', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + openDialog() + }).catch(() => { + }) + } else { + openDialog() + } + }) + }, + resetBatchAllocateForm() { + this.batchAllocateForm = { + allocateMode: "uniform", + allocateMoney: 0, + importPreviewList: [] + } + this.importFileList = [] + }, + downloadImportTemplate() { + this.$downLoad("/platform/outlay/outlayManage/unionAllocate/downloadImportTemplate") + }, + beforeImportUpload(file) { + const suffix = file.name.split(".").pop() + if (["xls", "xlsx"].indexOf(suffix) === -1) { + this.$message.warning("请上传xls或xlsx格式文件") + return false + } + return true + }, + onImportSuccess(resp, file, fileList) { + this.importFileList = fileList.slice(-1) + if (resp.code === 0) { + this.$set(this.batchAllocateForm, "importPreviewList", resp.data || []) + } else { + this.$message.error(resp.msg) + this.importFileList = [] + this.$set(this.batchAllocateForm, "importPreviewList", []) + } + }, + onImportRemove() { + this.importFileList = [] + this.$set(this.batchAllocateForm, "importPreviewList", []) }, doBatchAllocate() { - if (!this.batchAllocateForm.allocateMoney || this.batchAllocateForm.allocateMoney <= 0) { - this.$message.warning('请输入有效的分配额度') + const currentParams = this.getCurrentQuarterParams() + if (this.batchAllocateForm.allocateMode === "uniform") { + if (!this.batchAllocateForm.allocateMoney || this.batchAllocateForm.allocateMoney <= 0) { + this.$message.warning('请输入有效的分配额度') + return + } + this.formLoading = true + this.$axios.post("/platform/outlay/outlayManage/unionAllocate/doBatchAllocate", { + allocateMoney: this.batchAllocateForm.allocateMoney, + quarterly: currentParams.quarterly, + year: currentParams.year + }).then((resp) => { + if (resp.code === 0) { + this.$message.success(resp.msg) + this.batchAllocateDialogVisible = false + this.doSearch() + } + }).finally(() => { + this.formLoading = false + }) + return + } + if (this.batchAllocateForm.importPreviewList.length === 0) { + this.$message.warning("请先上传导入文件") + return + } + const hasErrorRow = this.batchAllocateForm.importPreviewList.some((item) => item.errMsg) + if (hasErrorRow) { + this.$message.warning("导入数据存在校验未通过的记录,请修正后重新上传") return } - - const quarter = this.$moment().quarter() - this.formLoading = true - this.$axios.post("/platform/outlay/outlayManage/unionAllocate/doBatchAllocate", { - allocateMoney: this.batchAllocateForm.allocateMoney, - quarterly: quarter, - year: this.pageForm.year + this.$axios.post("/platform/outlay/outlayManage/unionAllocate/doImportAllocate", { + data: JSON.stringify(this.batchAllocateForm.importPreviewList), + quarterly: currentParams.quarterly, + year: currentParams.year }).then((resp) => { if (resp.code === 0) { this.$message.success(resp.msg) diff --git a/src/main/resources/views/platform/zhgh/dayofficework/unionReimburse/apply/index.html b/src/main/resources/views/platform/zhgh/dayofficework/unionReimburse/apply/index.html index 40ddabc5..b1a3e1a3 100644 --- a/src/main/resources/views/platform/zhgh/dayofficework/unionReimburse/apply/index.html +++ b/src/main/resources/views/platform/zhgh/dayofficework/unionReimburse/apply/index.html @@ -51,8 +51,66 @@ layout("/layouts/platform.html"){ - {{formData.userName}} + + + + + 校工会经费 + 分工会经费 + 协会经费 + + + + + + + + + + {{item.name}} + + + + + + + + + {{item.name}} + + + + {{formData.loginName}} + {{formData.userName}} + + + + + + + + + + + + + + @@ -62,24 +120,8 @@ layout("/layouts/platform.html"){ - - - - - {{item.name}} - - - - - - - - - {{item.name}} - - - - + + - - {{ viewData.condolenceUserName }}({{ viewData.condolenceLoginName }})({{ viewData.condolenceUnitName }}) - + + {{ viewData.mobile }} + - - {{ viewData.condolenceSex }} - + + {{ viewData.payerName }} + - - {{ viewData.condolenceBirthday && $moment(viewData.condolenceBirthday).isValid() ? $moment(viewData.condolenceBirthday).format('YYYY-MM-DD') : '' }} - + + {{ viewData.bankUserName }} + - - {{ viewData.condolenceIdCard }} - + + {{ viewData.bankOfDeposit }} + - - {{ viewData.condolenceMobile }} - + + {{ viewData.bankCardNumber }} + - - {{ viewData.typeName }} - + + {{ viewData.condolenceUserName }}({{ viewData.condolenceLoginName }})({{ viewData.condolenceUnitName }}) + - - {{ viewData.way }} - + + {{ viewData.condolenceSex }} + - - {{ viewData.condolenceMoney }} - - - - {{ viewData.realMoney }} - + + {{ viewData.condolenceBirthday && $moment(viewData.condolenceBirthday).isValid() ? $moment(viewData.condolenceBirthday).format('YYYY-MM-DD') : '' }} + - - - {{ viewData.activityName }} - + + {{ viewData.condolenceIdCard }} + - - {{ viewData.activityType }} - + + {{ viewData.condolenceMobile }} + - - {{ viewData.activityNumber }} - + + {{ viewData.typeName }} + - - {{ viewData.activityPlace }} - + + {{ viewData.way }} + - - {{ viewData.money }} - + + {{ formatMoney(viewData.condolenceMoney) }} + - - {{ viewData.realMoney }} - + + {{ formatMoney(viewData.realMoney) }} + - - {{ viewData.activityTime | dateFormat }} - + + {{ viewData.activityName }} + - - {{ viewData.invoiceNumber }} - + + {{ viewData.activityNumber }} + - - {{ viewData.condolenceTime | dateFormat }} - + + {{ viewData.activityPlace }} + - - {{ viewData.marryTime | dateFormat }} - + + {{ formatMoney(viewData.money) }} + - - {{ viewData.fertilityTime | dateFormat }} - + + {{ formatMoney(viewData.realMoney) }} + - - {{ viewData.hospitalCausation }} - + + {{ viewData.activityTime | dateFormat }} + - - - {{ $moment(viewData.hospitalizationStartTime).format('YYYY-MM-DD') }} 至 {{ $moment(viewData.hospitalizationEndTime).format('YYYY-MM-DD') }} - - 暂无住院时间 - + + {{ viewData.condolenceTime | dateFormat }} + - - {{ viewData.hospital }} - + + {{ viewData.marryTime | dateFormat }} + - - {{ viewData.hospitalCount }} - + + {{ viewData.fertilityTime | dateFormat }} + - - {{ viewData.deathTime | dateFormat }} - + + {{ viewData.hospitalCausation }} + - - {{ viewData.condolenceRelationship }} - + + + {{ $moment(viewData.hospitalizationStartTime).format('YYYY-MM-DD') }} 至 {{ $moment(viewData.hospitalizationEndTime).format('YYYY-MM-DD') }} + + 暂无住院时间 + - - {{ viewData.participants }} - + + {{ viewData.hospital }} + - - {{ viewData.paymentNotes }} - + + {{ viewData.hospitalCount }} + - - {{ viewData.notes }} - + + {{ viewData.deathTime | dateFormat }} + - - - 暂无附件 - - + + {{ viewData.condolenceRelationship }} + + + + {{ viewData.participants }} + + + + {{ viewData.paymentNotes }} + + + + {{ viewData.notes }} + + + + + 暂无附件 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
发票明细列表
+
+ 查看页按申请页结构展示发票明细,仅用于查看,不提供编辑操作。 +
+
+
+ + + + + + + + + + + + + + +
+
+
+
- +
`, @@ -201,42 +281,69 @@ const unionReimburseInfo = { }, data() { return { + activeTabName: "basic", visible: false, - viewData: {}, + viewData: { + files: [], + invoiceDetails: [] + }, typeName: '', row: null } }, + computed: { + showInvoiceTab() { + return this.viewData.reimburseProject !== "UNION_REIMBURSE_PROJECT_1" + } + }, methods: { // 打开 onOpen(row) { this.row = row this.visible = true + this.activeTabName = "basic" this.getInfo() }, // 获取申请信息 getInfo() { this.$axios.post('/platform/unionReimburse/apply/info', {id: this.row.id}).then((res) => { if (res.code === 0) { - this.viewData = res.data + this.viewData = this.buildViewData(res.data) this.typeName = res.data.typeName || '' } }) }, - - // // 获取已办任务审批记录 - // getDoneTasks() { - // this.$axios.post("/flow/common/doneTasks", {bizId: this.row.id}).then((res) => { - // if (res.code === 0) { - // this.doneTasks = res.data - // } - // }) - // }, - // - // // 查看流程图 - // openChart(){ - // this.$refs.snakerChartRef.onOpenFull(this.row.instanceProcessDefineId,this.row.instanceId) - // } - + // 查看页面需要给附件和发票明细补默认值,避免空数据时组件渲染异常。 + buildViewData(data) { + const viewData = Object.assign({ + files: [], + invoiceDetails: [] + }, data || {}) + if (!Array.isArray(viewData.files)) { + viewData.files = [] + } + if (!Array.isArray(viewData.invoiceDetails)) { + viewData.invoiceDetails = [] + } + return viewData + }, + // 查看页金额统一保留两位小数,和申请页展示口径保持一致。 + formatMoney(value) { + if (value === null || value === undefined || value === "") { + return "" + } + const numberValue = Number(value) + if (Number.isNaN(numberValue)) { + return value + } + return numberValue.toFixed(2) + }, + // 查看流程图 + openChart() { + if (!this.row || !this.$refs.snakerChartRef) { + return + } + this.$refs.snakerChartRef.onOpenFull(this.row.instanceProcessDefineId, this.row.instanceId) + } } } diff --git a/src/main/resources/views/platform/zhgh/staffbenefit/difficulthelp/apply/form.html b/src/main/resources/views/platform/zhgh/staffbenefit/difficulthelp/apply/form.html index e2a24d15..b504b0e5 100644 --- a/src/main/resources/views/platform/zhgh/staffbenefit/difficulthelp/apply/form.html +++ b/src/main/resources/views/platform/zhgh/staffbenefit/difficulthelp/apply/form.html @@ -44,7 +44,7 @@ - + diff --git a/src/main/resources/views/platform/zhgh/staffbenefit/difficulthelp/apply/index.html b/src/main/resources/views/platform/zhgh/staffbenefit/difficulthelp/apply/index.html index 3f9704b5..e1191a6d 100644 --- a/src/main/resources/views/platform/zhgh/staffbenefit/difficulthelp/apply/index.html +++ b/src/main/resources/views/platform/zhgh/staffbenefit/difficulthelp/apply/index.html @@ -294,7 +294,8 @@ layout("/layouts/platform.html"){ @@ -312,6 +313,7 @@ layout("/layouts/platform.html"){ taskId: GetQueryString("taskId"), isShow: false, time: '', + blockMessage: '', formData: { id: GetQueryString("bizId"), mode: '1', @@ -602,7 +604,14 @@ layout("/layouts/platform.html"){ async getIsCanPlay() { this.$axios.post('/platform/difficultHelp/apply/getIsCanPlay').then(res => { if (res.code === 0) { - this.isShow = res.data.result + // 新增申请进入页面时,优先校验当前登录人本年度是否已经申请过,已申请则直接拦截新增。 + if (!this.bizId && res.data.hasCurrentYearApply) { + this.isShow = false + this.$set(this, 'blockMessage', '抱歉,您本年度已申请困难帮扶,不能重复申请。') + } else { + this.isShow = res.data.result + this.$set(this, 'blockMessage', '') + } this.$set(this, 'time', res.data.time); if (res.data.applyCount !== null && res.data.applyCount !== undefined && res.data.applyCount !== 0) { this.$set(this.formData, 'applyCount', res.data.applyCount) diff --git a/src/main/resources/views/platform/zhgh/staffbenefit/difficulthelp/schoolunionapproval/index.html b/src/main/resources/views/platform/zhgh/staffbenefit/difficulthelp/schoolunionapproval/index.html index 49741e5c..b4c30f92 100644 --- a/src/main/resources/views/platform/zhgh/staffbenefit/difficulthelp/schoolunionapproval/index.html +++ b/src/main/resources/views/platform/zhgh/staffbenefit/difficulthelp/schoolunionapproval/index.html @@ -159,7 +159,7 @@ layout("/layouts/platform.html"){ { prop: "subsidyStandards", label: "困难类型", sortable: true }, { prop: "applyTime", label: "申请时间", sortable: true }, { prop: "applyCount", label: "申请次数", sortable: true }, - { prop: "taskName", label: "当前节点" }, + { prop: "curTaskName", label: "当前节点" }, { prop: "instanceState", label: "流程状态" } ], unions: [], diff --git a/src/main/resources/views/platform/zhgh/staffbenefit/difficulthelp/unionLeaderApproval/index.html b/src/main/resources/views/platform/zhgh/staffbenefit/difficulthelp/unionLeaderApproval/index.html index 7a5174ae..a6507700 100644 --- a/src/main/resources/views/platform/zhgh/staffbenefit/difficulthelp/unionLeaderApproval/index.html +++ b/src/main/resources/views/platform/zhgh/staffbenefit/difficulthelp/unionLeaderApproval/index.html @@ -48,8 +48,9 @@ layout("/layouts/platform.html"){ 未审核 - + { - this.batchApprove(this.tableData); + this.batchApprove(this.selectData); }).catch(() => { }); @@ -279,6 +285,9 @@ layout("/layouts/platform.html"){ this.units = await this.$businessTool.listUnit(this.$store.state.user.union.id) } }, + handleSelectionChange: function (val) { + this.selectData = val + }, }, async created() { this.pageData() diff --git a/src/main/resources/views/platform/zhgh/staffbenefit/maternityLeave/apply/index.html b/src/main/resources/views/platform/zhgh/staffbenefit/maternityLeave/apply/index.html index 6724776c..8f4748f0 100644 --- a/src/main/resources/views/platform/zhgh/staffbenefit/maternityLeave/apply/index.html +++ b/src/main/resources/views/platform/zhgh/staffbenefit/maternityLeave/apply/index.html @@ -215,13 +215,13 @@ layout("/layouts/platform.html"){ return total; }, - // 是否为男性 + // 是否为男 isMale() { - return this.formData.sex === '男性' || this.formData.sex === '男'; + return this.formData.sex === '男'; }, - // 是否为女性 + // 是否为女 isFemale() { - return this.formData.sex === '女性' || this.formData.sex === '女'; + return this.formData.sex === '女'; }, }, watch: { @@ -237,7 +237,7 @@ layout("/layouts/platform.html"){ // 监听性别变化,设置默认值 isMale(newVal) { if (newVal) { - // 男性默认设置 + // 男默认设置 this.$set(this.formData, 'loverSex', '女'); this.$set(this.formData, 'withLeave', 15); this.$set(this.formData, 'parentalLeave', 10); @@ -245,7 +245,7 @@ layout("/layouts/platform.html"){ }, isFemale(newVal) { if (newVal) { - // 女性默认设置 + // 女默认设置 this.$set(this.formData, 'loverSex', '男'); this.$set(this.formData, 'maternityLeave', 98); this.$set(this.formData, 'extendLeave', 60); @@ -255,7 +255,7 @@ layout("/layouts/platform.html"){ methods: { // 计算休假时间止 calculateEndTime() { - // 如果是男性,则不自动计算结束时间 + // 如果是男,则不自动计算结束时间 if (this.isMale) { return; } @@ -372,19 +372,19 @@ layout("/layouts/platform.html"){ } // 根据性别设置默认值 if (this.isMale) { - // 男性默认设置 + // 男默认设置 this.$set(this.formData, 'loverSex', '女'); this.$set(this.formData, 'withLeave', 15); this.$set(this.formData, 'parentalLeave', 10); - // 男性默认产假和延长假为0,因为男性不休产假 + // 男默认产假和延长假为0,因为男不休产假 this.$set(this.formData, 'maternityLeave', 0); this.$set(this.formData, 'extendLeave', 0); } else if (this.isFemale) { - // 女性默认设置 + // 女默认设置 this.$set(this.formData, 'loverSex', '男'); this.$set(this.formData, 'maternityLeave', 98); this.$set(this.formData, 'extendLeave', 60); - // 女性默认陪产假和育儿假为0 + // 女默认陪产假和育儿假为0 this.$set(this.formData, 'withLeave', 0); this.$set(this.formData, 'parentalLeave', 0); } diff --git a/src/main/resources/views/platform/zhgh/staffbenefit/maternityLeave/common/info.js b/src/main/resources/views/platform/zhgh/staffbenefit/maternityLeave/common/info.js index fd48b9db..4c092b4f 100644 --- a/src/main/resources/views/platform/zhgh/staffbenefit/maternityLeave/common/info.js +++ b/src/main/resources/views/platform/zhgh/staffbenefit/maternityLeave/common/info.js @@ -21,22 +21,22 @@ const maternityLeaveInfo = { - + {{viewData.withLeave}} - + {{viewData.parentalLeave}} - + {{viewData.maternityLeave}} - + {{viewData.extendLeave}} - + {{viewData.birthsLeave}} - + {{viewData.difficultLeave}} {{viewData.winterLeave}} diff --git a/src/main/resources/views/platform/zhgh/staffmanage/member/apply/branchunionapproval/index.html b/src/main/resources/views/platform/zhgh/staffmanage/member/apply/branchunionapproval/index.html index fcd83796..d3b4563f 100644 --- a/src/main/resources/views/platform/zhgh/staffmanage/member/apply/branchunionapproval/index.html +++ b/src/main/resources/views/platform/zhgh/staffmanage/member/apply/branchunionapproval/index.html @@ -1,4 +1,4 @@ -
@@ -102,7 +102,7 @@ layout("/layouts/platform.html"){ { prop: "loginName", label: "工号", sortable: true }, { prop: "userName", label: "姓名", sortable: true }, { prop: "userState", label: "在职状态", sortable: true }, - // { prop: "personType", label: "教职工类别", sortable: true }, + // { prop: "personType", label: "人员类型", sortable: true }, // { prop: "preparedBy", label: "编制类别", sortable: true }, { prop: "unionName", label: "所属工会", sortable: true }, { prop: "unitName", label: "所属单位", sortable: true }, @@ -194,3 +194,4 @@ layout("/layouts/platform.html"){ + diff --git a/src/main/resources/views/platform/zhgh/staffmanage/member/apply/common/commonQuery.js b/src/main/resources/views/platform/zhgh/staffmanage/member/apply/common/commonQuery.js index da81b45e..586cb59c 100644 --- a/src/main/resources/views/platform/zhgh/staffmanage/member/apply/common/commonQuery.js +++ b/src/main/resources/views/platform/zhgh/staffmanage/member/apply/common/commonQuery.js @@ -1,4 +1,4 @@ -const COMMON_QUERY = { +const COMMON_QUERY = { template: /*language=HTML*/ ` @@ -27,8 +27,8 @@ const COMMON_QUERY = { - - + @@ -99,3 +99,4 @@ const COMMON_QUERY = { this.initData() } } + diff --git a/src/main/resources/views/platform/zhgh/staffmanage/member/apply/common/info.js b/src/main/resources/views/platform/zhgh/staffmanage/member/apply/common/info.js index 653ebb8e..a5b34ce3 100644 --- a/src/main/resources/views/platform/zhgh/staffmanage/member/apply/common/info.js +++ b/src/main/resources/views/platform/zhgh/staffmanage/member/apply/common/info.js @@ -27,8 +27,7 @@ const INFO = { {{ viewData.userState }} - - {{ viewData.preparedBy }} + {{ viewData.marriage }} {{ viewData.arrivalAtSchoolDate }} @@ -147,3 +146,4 @@ const INFO = { } } } + diff --git a/src/main/resources/views/platform/zhgh/staffmanage/member/apply/common/memberApplyAuditInfo.js b/src/main/resources/views/platform/zhgh/staffmanage/member/apply/common/memberApplyAuditInfo.js index 3f316c99..46d8c947 100644 --- a/src/main/resources/views/platform/zhgh/staffmanage/member/apply/common/memberApplyAuditInfo.js +++ b/src/main/resources/views/platform/zhgh/staffmanage/member/apply/common/memberApplyAuditInfo.js @@ -1,4 +1,4 @@ -const MEMBER_APPLY_AUDIT_INFO = { +const MEMBER_APPLY_AUDIT_INFO = { template: /*language=HTML*/ `
@@ -25,7 +25,7 @@ const MEMBER_APPLY_AUDIT_INFO = { {{ viewData.email }} {{ viewData.userState }} - {{ viewData.personType }} + {{ viewData.personType }} @@ -125,3 +125,4 @@ const MEMBER_APPLY_AUDIT_INFO = { } } } + diff --git a/src/main/resources/views/platform/zhgh/staffmanage/member/apply/mine/index.html b/src/main/resources/views/platform/zhgh/staffmanage/member/apply/mine/index.html index c15b5a63..02450bbb 100644 --- a/src/main/resources/views/platform/zhgh/staffmanage/member/apply/mine/index.html +++ b/src/main/resources/views/platform/zhgh/staffmanage/member/apply/mine/index.html @@ -1,4 +1,4 @@ -
@@ -85,7 +85,7 @@ layout("/layouts/platform.html"){ { prop: "loginName", label: "工号", sortable: true }, { prop: "userName", label: "姓名", sortable: true }, { prop: "userState", label: "在职状态", sortable: true }, - // { prop: "personType", label: "教职工类别", sortable: true }, + // { prop: "personType", label: "人员类型", sortable: true }, // { prop: "preparedBy", label: "编制类别", sortable: true }, { prop: "unionName", label: "所属工会", sortable: true }, { prop: "unitName", label: "所属单位", sortable: true }, @@ -161,3 +161,4 @@ layout("/layouts/platform.html"){ + diff --git a/src/main/resources/views/platform/zhgh/staffmanage/member/apply/schoolunionapproval/index.html b/src/main/resources/views/platform/zhgh/staffmanage/member/apply/schoolunionapproval/index.html index f8db9ec9..876d9d4b 100644 --- a/src/main/resources/views/platform/zhgh/staffmanage/member/apply/schoolunionapproval/index.html +++ b/src/main/resources/views/platform/zhgh/staffmanage/member/apply/schoolunionapproval/index.html @@ -1,4 +1,4 @@ -
@@ -120,7 +120,7 @@ layout("/layouts/platform.html"){ { prop: "loginName", label: "工号", sortable: true }, { prop: "userName", label: "姓名", sortable: true }, { prop: "userState", label: "在职状态", sortable: true }, - { prop: "personType", label: "教职工类别", sortable: true }, + { prop: "personType", label: "人员类型", sortable: true }, // { prop: "preparedBy", label: "编制类别", sortable: true }, { prop: "unionName", label: "所属工会", sortable: true }, { prop: "unitName", label: "所属单位", sortable: true }, @@ -225,3 +225,4 @@ layout("/layouts/platform.html"){ + diff --git a/src/main/resources/views/platform/zhgh/staffmanage/member/apply/submit/form.html b/src/main/resources/views/platform/zhgh/staffmanage/member/apply/submit/form.html index fc190816..0c7ad0b1 100644 --- a/src/main/resources/views/platform/zhgh/staffmanage/member/apply/submit/form.html +++ b/src/main/resources/views/platform/zhgh/staffmanage/member/apply/submit/form.html @@ -1,4 +1,4 @@ -
+
@@ -90,7 +90,7 @@ disabled style="width: 100%"> - + @@ -464,3 +464,4 @@ } }) + diff --git a/src/main/resources/views/platform/zhgh/staffmanage/member/apply/submit/index.html b/src/main/resources/views/platform/zhgh/staffmanage/member/apply/submit/index.html index 59935dc6..9e0bbe7f 100644 --- a/src/main/resources/views/platform/zhgh/staffmanage/member/apply/submit/index.html +++ b/src/main/resources/views/platform/zhgh/staffmanage/member/apply/submit/index.html @@ -1,4 +1,4 @@ -
@@ -96,7 +96,7 @@ layout("/layouts/platform.html"){ disabled style="width: 100%"> - + diff --git a/src/main/resources/views/platform/zhgh/staffmanage/member/apply/uniongroupapproval/index.html b/src/main/resources/views/platform/zhgh/staffmanage/member/apply/uniongroupapproval/index.html index 67c7e7b9..a7d5edbb 100644 --- a/src/main/resources/views/platform/zhgh/staffmanage/member/apply/uniongroupapproval/index.html +++ b/src/main/resources/views/platform/zhgh/staffmanage/member/apply/uniongroupapproval/index.html @@ -104,8 +104,7 @@ layout("/layouts/platform.html"){ { prop: "loginName", label: "工号", sortable: true }, { prop: "userName", label: "姓名", sortable: true }, { prop: "userState", label: "在职状态", sortable: true }, - { prop: "personType", label: "教职工类别", sortable: true }, - { prop: "preparedBy", label: "编制类别", sortable: true }, + { prop: "personType", label: "人员类型", sortable: true }, { prop: "unionName", label: "所属工会", sortable: true }, { prop: "unitName", label: "所属单位", sortable: true }, { prop: "sign", label: "签字" }, @@ -196,3 +195,4 @@ layout("/layouts/platform.html"){ + diff --git a/src/main/resources/views/platform/zhgh/staffmanage/member/apply/view/index.html b/src/main/resources/views/platform/zhgh/staffmanage/member/apply/view/index.html index 8f8b6c57..7bb2f66c 100644 --- a/src/main/resources/views/platform/zhgh/staffmanage/member/apply/view/index.html +++ b/src/main/resources/views/platform/zhgh/staffmanage/member/apply/view/index.html @@ -1,4 +1,4 @@ -
+
{{ viewData.loginname }} {{ viewData.username }} @@ -21,7 +21,7 @@ {{ viewData.email }} {{ viewData.userState }} - {{ viewData.personType }} + {{ viewData.personType }} @@ -142,3 +142,4 @@ width: 15%; } + diff --git a/src/main/resources/views/platform/zhgh/staffmanage/member/branch/verification/check/index.html b/src/main/resources/views/platform/zhgh/staffmanage/member/branch/verification/check/index.html index e6c7cbcc..d9ac057d 100644 --- a/src/main/resources/views/platform/zhgh/staffmanage/member/branch/verification/check/index.html +++ b/src/main/resources/views/platform/zhgh/staffmanage/member/branch/verification/check/index.html @@ -42,11 +42,8 @@ layout("/layouts/platform.html"){ - - - - - + + @@ -246,7 +243,7 @@ layout("/layouts/platform.html"){ { prop: "sex", label: "性别", sortable: true, width: "100px" }, { prop: "userState", label: "在职状态", sortable: true }, // {prop: "preparedBy", label: "编制类别", sortable: true}, - // {prop: 'personType', label: '教职工类别', sortable: true}, + // {prop: 'personType', label: '人员类型', sortable: true}, { prop: "unionName", label: "所属工会", sortable: true }, { prop: "unitName", label: "所属单位", sortable: true }, { prop: "isChanged", label: "变更状态", sortable: true }, @@ -549,3 +546,4 @@ layout("/layouts/platform.html"){ + diff --git a/src/main/resources/views/platform/zhgh/staffmanage/member/change/branchunionaudit/index.html b/src/main/resources/views/platform/zhgh/staffmanage/member/change/branchunionaudit/index.html index 641ab471..34c8f7b3 100644 --- a/src/main/resources/views/platform/zhgh/staffmanage/member/change/branchunionaudit/index.html +++ b/src/main/resources/views/platform/zhgh/staffmanage/member/change/branchunionaudit/index.html @@ -1,4 +1,4 @@ - @@ -94,7 +94,7 @@ layout("/layouts/platform.html"){ { prop: "userName", label: "姓名", sortable: true }, { prop: "sex", label: "性别", sortable: true }, { prop: "userState", label: "在职状态", sortable: true }, - { prop: "personType", label: "教职工类别", sortable: true }, + { prop: "personType", label: "人员类型", sortable: true }, // { prop: 'preparedBy', label: '编制类别', sortable: true }, { prop: "unionName", label: "所属工会", sortable: true }, { prop: "unitName", label: "所属单位", sortable: true }, @@ -204,3 +204,4 @@ layout("/layouts/platform.html"){ + diff --git a/src/main/resources/views/platform/zhgh/staffmanage/member/change/common/commonQuery.js b/src/main/resources/views/platform/zhgh/staffmanage/member/change/common/commonQuery.js index 21269146..b52712c9 100644 --- a/src/main/resources/views/platform/zhgh/staffmanage/member/change/common/commonQuery.js +++ b/src/main/resources/views/platform/zhgh/staffmanage/member/change/common/commonQuery.js @@ -1,4 +1,4 @@ -const COMMON_QUERY = { +const COMMON_QUERY = { template: /*language=HTML*/ ` @@ -22,8 +22,8 @@ const COMMON_QUERY = { - - + @@ -97,3 +97,4 @@ const COMMON_QUERY = { this.initData() } } + diff --git a/src/main/resources/views/platform/zhgh/staffmanage/member/change/common/info.js b/src/main/resources/views/platform/zhgh/staffmanage/member/change/common/info.js index d258e01b..ac36ca6f 100644 --- a/src/main/resources/views/platform/zhgh/staffmanage/member/change/common/info.js +++ b/src/main/resources/views/platform/zhgh/staffmanage/member/change/common/info.js @@ -30,8 +30,7 @@ const INFO = { {{ viewData.email }} {{ viewData.userState }} - {{ viewData.personType }} - {{ viewData.preparedBy }} + {{ viewData.personType }}