场地预约整改:审核默认同意

拉取数据筛选在职状态,不拉退休人员
选择福利界面增加已选择未选择
手机端主页活动回显
This commit is contained in:
2026-09-11 16:02:26 +08:00
parent 1906371506
commit b6a4a50e10
8 changed files with 95 additions and 43 deletions
@@ -104,6 +104,11 @@ public interface SourceData {
// checkSuccess(map); // checkSuccess(map);
List<NutMap> data = map.getAsList("data", NutMap.class); List<NutMap> data = map.getAsList("data", NutMap.class);
for (NutMap row : data) { for (NutMap row : data) {
// 手动及定时拉取只保留源字段 ZZZTM 为 100 的人员,缺失或其他值均跳过。
// 分页仍按源接口 totalCount 推进,当前页全部被过滤也必须继续读取后续页。
if (!"100".equals(row.getString("ZZZTM"))) {
continue;
}
Map entity = new HashMap(500); Map entity = new HashMap(500);
row.forEach((k, v) -> { row.forEach((k, v) -> {
@@ -1,7 +1,6 @@
package io.v.nutz.zhgh.welfare.controller; package io.v.nutz.zhgh.welfare.controller;
import cn.wizzer.framework.base.Result; import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.annontation.ViReturn; import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.query.PageForm; import io.v.nutz.base.query.PageForm;
import io.v.nutz.base.service.SimpleService; import io.v.nutz.base.service.SimpleService;
@@ -15,13 +14,10 @@ import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Chain; import org.nutz.dao.Chain;
import org.nutz.dao.Cnd; import org.nutz.dao.Cnd;
import org.nutz.dao.Dao; import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.aop.Aop; import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.json.Json; import org.nutz.json.Json;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok; import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param; import org.nutz.mvc.annotation.Param;
@@ -57,43 +53,25 @@ public class WelfareUserChooseController {
public void index() { public void index() {
} }
/**
* 当前用户福利项目分页查询。
*
* @param pageForm 分页参数,pageNumber 为页码,pageSize 为每页条数
* @param year 选择开始时间所属年度,为空时不限制年度
* @param isChoose 选择状态:1 为已选择,2 为未选择;未传时默认未选择
* @return Pagination 分页对象;list 为项目列表,totalCount 为总条数,
* 列表中 isChoose 为 1 表示已选择、0 表示未选择,gist_list 为所选福利说明
*/
@At @At
@ViReturn @ViReturn
@RequiresPermissions("welfare.user.choose") @RequiresPermissions("welfare.user.choose")
public Object pageData(PageForm pageForm, Integer year) { public Object pageData(PageForm pageForm, Integer year, Integer isChoose) {
Sql sql = Sqls.create(""" if (isChoose != null && !Integer.valueOf(1).equals(isChoose) && !Integer.valueOf(2).equals(isChoose)) {
SELECT return Result.error("选择状态只能为已选择或未选择");
wp.*, }
CASE return welfareProjectService.userChoosePage(pageForm, year, isChoose, ShiroUtil.getUserId());
WHEN wus.selectUserId IS NOT NULL THEN 1
ELSE 0
END AS isChoose,
wus.selectTime,
GROUP_CONCAT( DISTINCT wuso.optionName, IF(wus.selectSpecs is not null, (CONCAT('—规格:', wus.selectSpecs)), ''), '', wus.selectNum, '份)' ) AS gist_list,
wus.receiveAddress
FROM
welfare_project wp
LEFT JOIN welfare_project_user_selection wus ON wp.id = wus.welfareId AND wus.selectUserId = @selectUserId
LEFT JOIN welfare_list wl ON wp.id = wl.projectId AND wl.userId = @selectUserId
LEFT JOIN welfare_project_subject_option wuso ON wus.selectOptionId = wuso.id
$condition
""");
sql.setParam("selectUserId", ShiroUtil.getUserId());
Cnd cnd = Cnd.NEW();
cnd.and("wp.provideMode", "in", "2,3");
cnd.and("wl.userId", "=", ShiroUtil.getUserId());
cnd.andEX("YEAR(wp.choiceTimeStart)", "in", year);
cnd.and("wp.isDisabled", "=", 0);
cnd.groupBy("wp.id");
cnd.desc("YEAR(wp.choiceTimeStart)");
sql.setCondition(cnd);
Pagination pagination = simpleService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
return pagination;
} }
@At @At
@ViReturn @ViReturn
@Aop(TransAop.READ_COMMITTED) @Aop(TransAop.READ_COMMITTED)
@@ -1,5 +1,7 @@
package io.v.nutz.zhgh.welfare.service; package io.v.nutz.zhgh.welfare.service;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.base.service.ViService; import io.v.nutz.base.service.ViService;
import io.v.nutz.zhgh.welfare.model.WelfareProject; import io.v.nutz.zhgh.welfare.model.WelfareProject;
@@ -22,6 +24,18 @@ public interface WelfareProjectService extends ViService<WelfareProject> {
*/ */
WelfareProject projectInfo(String projectId); WelfareProject projectInfo(String projectId);
/**
* 按选择状态查询用户有资格选择的福利项目。
*
* @param pageForm 分页参数,pageNumber 为页码,pageSize 为每页条数
* @param year 选择开始时间所属年度,为空时不限制年度
* @param isChoose 1 为已选择,2 或 null 为未选择;调用方须校验其他值
* @param userId 当前登录用户 ID,由服务端获取
* @return Paginationlist 为项目列表,totalCount 为总条数;
* list 中 isChoose 为 1/0,分别表示已选择/未选择,gist_list 为所选福利说明
*/
Pagination userChoosePage(PageForm pageForm, Integer year, Integer isChoose, String userId);
List<WelfareProject> getIngWelfareProject(); List<WelfareProject> getIngWelfareProject();
} }
@@ -1,6 +1,8 @@
package io.v.nutz.zhgh.welfare.service.impl; package io.v.nutz.zhgh.welfare.service.impl;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.base.service.BaseService; import io.v.nutz.base.service.BaseService;
import io.v.nutz.zhgh.data.model.MatchConditionStructure; import io.v.nutz.zhgh.data.model.MatchConditionStructure;
import io.v.nutz.base.service.impl.ViServiceImpl; import io.v.nutz.base.service.impl.ViServiceImpl;
@@ -110,6 +112,48 @@ public class WelfareProjectServiceImpl extends ViServiceImpl<WelfareProject> imp
return project; return project;
} }
/**
* {@inheritDoc}
*/
@Override
public Pagination userChoosePage(PageForm pageForm, Integer year, Integer isChoose, String userId) {
Sql sql = Sqls.create("""
SELECT
wp.*,
CASE
WHEN wus.selectUserId IS NOT NULL THEN 1
ELSE 0
END AS isChoose,
wus.selectTime,
GROUP_CONCAT( DISTINCT wuso.optionName, IF(wus.selectSpecs is not null, (CONCAT('—规格:', wus.selectSpecs)), ''), '', wus.selectNum, '份)' ) AS gist_list,
wus.receiveAddress
FROM
welfare_project wp
LEFT JOIN welfare_project_user_selection wus ON wp.id = wus.welfareId AND wus.selectUserId = @selectUserId
LEFT JOIN welfare_list wl ON wp.id = wl.projectId AND wl.userId = @selectUserId
LEFT JOIN welfare_project_subject_option wuso ON wus.selectOptionId = wuso.id
$condition
""");
sql.setParam("selectUserId", userId);
Cnd cnd = Cnd.NEW();
cnd.and("wp.provideMode", "in", "2,3");
cnd.and("wl.userId", "=", userId);
cnd.andEX("YEAR(wp.choiceTimeStart)", "in", year);
cnd.and("wp.isDisabled", "=", 0);
// 与列表状态一致:存在当前用户的选择记录为已选择,否则为未选择。
if (Integer.valueOf(1).equals(isChoose)) {
cnd.and("wus.selectUserId", "is not", null);
} else {
cnd.and("wus.selectUserId", "is", null);
}
cnd.groupBy("wp.id");
cnd.desc("YEAR(wp.choiceTimeStart)");
sql.setCondition(cnd);
Pagination pagination = listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
return pagination;
}
@Override @Override
public List<WelfareProject> getIngWelfareProject() { public List<WelfareProject> getIngWelfareProject() {
return dao().query(WelfareProject.class, Cnd.where("choiceTimeStart", "<=", DateUtil.date()) return dao().query(WelfareProject.class, Cnd.where("choiceTimeStart", "<=", DateUtil.date())
@@ -194,12 +194,13 @@
} }
}) })
}, },
// 进入审核时默认同意;仅查看时不填意见,切换申请不保留上一条输入。
openDetail(row, approval) { openDetail(row, approval) {
this.$set(this, 'auditReady', false) this.$set(this, 'auditReady', false)
this.$set(this, 'showApprovalForm', approval) this.$set(this, 'showApprovalForm', approval)
this.$set(this, 'formData', { this.$set(this, 'formData', {
id: row.id, username: "${@shiro.getPrincipalProperty('username')}", id: row.id, username: "${@shiro.getPrincipalProperty('username')}",
auditTime: moment().format('YYYY-MM-DD HH:mm:ss'), auditOpinion: '' auditTime: moment().format('YYYY-MM-DD HH:mm:ss'), auditOpinion: approval ? '同意' : ''
}) })
this.$set(this, 'detailShow', true) this.$set(this, 'detailShow', true)
this.$nextTick(() => this.$refs.infoRef.onOpen(row.id)) this.$nextTick(() => this.$refs.infoRef.onOpen(row.id))
+7 -3
View File
@@ -688,20 +688,24 @@ layout("/mobile/platform.html"){
}); });
}, },
initData() { initData() {
// 活动独立启动,返回其完成状态供首页选择默认栏目,不等待待办加载。
const activityRequest = this.listActivity().catch(() => {});
this.loadLocalTasks(); this.loadLocalTasks();
// 保留原有业务待办;重复点击不并发追加旧接口的汇总记录。 // 保留原有业务待办;重复点击不并发追加旧接口的汇总记录。
if (!this.legacyTaskLoading) { if (!this.legacyTaskLoading) {
this.$set(this, 'legacyTaskLoading', true); this.$set(this, 'legacyTaskLoading', true);
this.$set(this, 'legacyTaskError', false); this.$set(this, 'legacyTaskError', false);
this.getNeedItems().then(() => this.getMemberCheckSelfAgenda()) // jQuery 1.11 的请求链不支持catch/finally;先由原生Promise接管,并等待各待办请求依次完成。
Promise.resolve().then(() => this.getNeedItems())
.then(() => this.getMemberCheckSelfAgenda())
.then(() => this.getWelfareCheckSelfAgenda()) .then(() => this.getWelfareCheckSelfAgenda())
.then(() => this.getCompletes()) .then(() => this.getCompletes())
.catch(() => this.$set(this, 'legacyTaskError', true)) .catch(() => this.$set(this, 'legacyTaskError', true))
.finally(() => this.$set(this, 'legacyTaskLoading', false)); .finally(() => this.$set(this, 'legacyTaskLoading', false));
} }
// 首页消息、活动请求不阻塞办理事项展示。 // 消息独立加载,不阻塞活动和办理事项展示。
this.getMsg().catch(() => {}); this.getMsg().catch(() => {});
return this.listActivity().catch(() => {}); return activityRequest;
}, },
setNeedItems() { setNeedItems() {
return $.get('/platform/needItems/getNeedItems', {mobile: true}).then(res => { return $.get('/platform/needItems/getNeedItems', {mobile: true}).then(res => {
@@ -161,13 +161,14 @@
this.$refs.guava.view() this.$refs.guava.view()
this.$refs.viewInfoRef.onOpen(row.id) this.$refs.viewInfoRef.onOpen(row.id)
}, },
// 每次打开审核都重置意见,默认同意,避免沿用上一条申请填写的内容。
openReview(row) { openReview(row) {
this.$set(this, 'auditReady', false) this.$set(this, 'auditReady', false)
this.$set(this, 'formData', { this.$set(this, 'formData', {
id: row.id, id: row.id,
username: "${@shiro.getPrincipalProperty('username')}", username: "${@shiro.getPrincipalProperty('username')}",
auditTime: moment().format('YYYY-MM-DD HH:mm:ss'), auditTime: moment().format('YYYY-MM-DD HH:mm:ss'),
auditOpinion: '' auditOpinion: '同意'
}) })
this.$refs.guava.edit() this.$refs.guava.edit()
this.$nextTick(() => this.$refs.form.clearValidate()) this.$nextTick(() => this.$refs.form.clearValidate())
@@ -78,7 +78,11 @@ layout("/layouts/platform.html"){
<el-card class="mt10" shadow="never"> <el-card class="mt10" shadow="never">
<table-tool :app="this" label="福利项目"> <table-tool :app="this" label="福利项目">
<template #func> <template #func>
<!-- 仅提供已选择、未选择两种状态,切换时复用公共查询并回到第一页。 -->
<el-radio-group @change="doSearch" class="mr10" size="small" v-model="pageForm.isChoose">
<el-radio-button :label="1">已选择</el-radio-button>
<el-radio-button :label="2">未选择</el-radio-button>
</el-radio-group>
</template> </template>
</table-tool> </table-tool>
@@ -475,7 +479,8 @@ layout("/layouts/platform.html"){
projectInfo: {}, projectInfo: {},
welfareSubject: {}, welfareSubject: {},
pageForm: { pageForm: {
isChoose: false, // 与筛选按钮取值一致,首次进入默认查询未选择项目。
isChoose: 2,
year: moment().format('YYYY') year: moment().format('YYYY')
}, },
tableColumns: [ tableColumns: [