体检统计报错
This commit is contained in:
+11
-1
@@ -20,6 +20,7 @@ import org.nutz.lang.random.R;
|
|||||||
import org.nutz.lang.util.NutMap;
|
import org.nutz.lang.util.NutMap;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -48,7 +49,16 @@ public class HealthCheckupProjectServiceImpl extends BaseServiceImpl<HealthCheck
|
|||||||
if (Strings.isBlank(id)){
|
if (Strings.isBlank(id)){
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
HealthCheckupProject project = fetchLinks(fetch(id), "healthCheckupProjectSubjects", Cnd.NEW().asc("optionSort"));
|
HealthCheckupProject project = fetch(id);
|
||||||
|
// 项目可能已被删除,详情查询保持与空 ID 相同的返回约定。
|
||||||
|
if (project == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
project = fetchLinks(project, "healthCheckupProjectSubjects", Cnd.NEW().asc("optionSort"));
|
||||||
|
// 尚未配置套餐的项目仍可查看详情和统计基础人数。
|
||||||
|
if (project.getHealthCheckupProjectSubjects() == null) {
|
||||||
|
project.setHealthCheckupProjectSubjects(new ArrayList<>());
|
||||||
|
}
|
||||||
project.getHealthCheckupProjectSubjects().forEach(v -> {
|
project.getHealthCheckupProjectSubjects().forEach(v -> {
|
||||||
v.setSubjectMoneys(dao().query(HealthCheckupProjectSubjectMoney.class, Cnd.where("subjectId", "=", v.getId())));
|
v.setSubjectMoneys(dao().query(HealthCheckupProjectSubjectMoney.class, Cnd.where("subjectId", "=", v.getId())));
|
||||||
});
|
});
|
||||||
|
|||||||
+8
@@ -29,9 +29,17 @@ public class HealthCheckupSingleServiceImpl extends BaseServiceImpl<HealthChecku
|
|||||||
@Inject
|
@Inject
|
||||||
private HealthCheckupProjectService healthCheckupProjectService;
|
private HealthCheckupProjectService healthCheckupProjectService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按体检项目和可选分工会统计人数;projectId 为项目 ID,unionId 为空时统计所有工会。
|
||||||
|
* 返回 tableList 统计行、tableColumn 动态列;未指定项目或项目已删除时两者为空列表。
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public NutMap pageData(String projectId, String unionId) {
|
public NutMap pageData(String projectId, String unionId) {
|
||||||
HealthCheckupProject project = healthCheckupProjectService.findOne(projectId);
|
HealthCheckupProject project = healthCheckupProjectService.findOne(projectId);
|
||||||
|
// 无有效项目时不执行统计 SQL,避免空指针及无项目条件的查询。
|
||||||
|
if (project == null) {
|
||||||
|
return NutMap.NEW().addv("tableList", new ArrayList<>()).addv("tableColumn", new ArrayList<>());
|
||||||
|
}
|
||||||
Sql sql = Sqls.create("""
|
Sql sql = Sqls.create("""
|
||||||
SELECT
|
SELECT
|
||||||
su.id,
|
su.id,
|
||||||
|
|||||||
+47
-31
@@ -341,32 +341,42 @@ layout("/layouts/platform.html"){
|
|||||||
this.noSelectOptionId = null
|
this.noSelectOptionId = null
|
||||||
this.selectByAdminDialogVisible = true
|
this.selectByAdminDialogVisible = true
|
||||||
},
|
},
|
||||||
async yearChange() {
|
yearChange() {
|
||||||
const resp = await this.$axios.post("/platform/healthCheckup/project/mange/getHealthCheckupProject", {year: this.pageForm.year})
|
// 年度切换时先清理旧项目,避免无项目年度继续显示上一年度的数据。
|
||||||
|
this.$set(this.pageForm, "projectId", null)
|
||||||
|
this.$set(this, "projectOptions", [])
|
||||||
|
this.getHealthCheckupSubject()
|
||||||
|
return this.$axios.post("/platform/healthCheckup/project/mange/getHealthCheckupProject", {year: this.pageForm.year}).then((resp) => {
|
||||||
if (resp.code === 0) {
|
if (resp.code === 0) {
|
||||||
this.projectOptions = resp.data
|
this.$set(this, "projectOptions", resp.data || [])
|
||||||
if (resp.data && resp.data.length > 0) {
|
if (this.projectOptions.length > 0) {
|
||||||
this.$set(this.pageForm, "projectId", resp.data[0].id)
|
this.$set(this.pageForm, "projectId", this.projectOptions[0].id)
|
||||||
|
}
|
||||||
|
return this.getHealthCheckupSubject()
|
||||||
|
}
|
||||||
|
this.notifyError(resp.msg)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getHealthCheckupSubject() {
|
||||||
|
this.$set(this, "projectInfo", {})
|
||||||
|
this.$set(this, "projectSubjectOptions", [])
|
||||||
|
this.$set(this, "tableData", [])
|
||||||
|
// 未选项目时只刷新空表结构,不请求项目详情或人数统计。
|
||||||
|
if (!this.pageForm.projectId) {
|
||||||
|
return this.pageData()
|
||||||
|
}
|
||||||
|
return this.$axios.post("/platform/healthCheckup/project/mange/findOne", {id: this.pageForm.projectId}).then((resp) => {
|
||||||
|
if (resp.code === 0) {
|
||||||
|
if (resp.data) {
|
||||||
|
this.$set(this, "projectInfo", resp.data)
|
||||||
|
this.$set(this, "projectSubjectOptions", resp.data.healthCheckupProjectSubjects || [])
|
||||||
} else {
|
} else {
|
||||||
this.$set(this.pageForm, "projectId", null)
|
this.$set(this.pageForm, "projectId", null)
|
||||||
}
|
}
|
||||||
await this.getHealthCheckupSubject()
|
return this.pageData()
|
||||||
} else {
|
}
|
||||||
this.notifyError(resp.msg)
|
this.notifyError(resp.msg)
|
||||||
}
|
})
|
||||||
},
|
|
||||||
async getHealthCheckupSubject() {
|
|
||||||
this.projectSubjectOptions = []
|
|
||||||
const resp = await this.$axios.post("/platform/healthCheckup/project/mange/findOne", {id: this.pageForm.projectId})
|
|
||||||
if (resp.code === 0) {
|
|
||||||
if (resp.data) {
|
|
||||||
this.projectInfo = resp.data
|
|
||||||
this.projectSubjectOptions = resp.data.healthCheckupProjectSubjects
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.notifyError(resp.msg)
|
|
||||||
}
|
|
||||||
this.doSearch()
|
|
||||||
},
|
},
|
||||||
async queryCampus() {
|
async queryCampus() {
|
||||||
const resp = await this.$axios.post("/platform/healthCheckup/campus/queryCampus")
|
const resp = await this.$axios.post("/platform/healthCheckup/campus/queryCampus")
|
||||||
@@ -377,14 +387,8 @@ layout("/layouts/platform.html"){
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async pageData() {
|
pageData() {
|
||||||
this.tableColumns = []
|
this.tableColumns = []
|
||||||
const loading = this.$loading({
|
|
||||||
lock: true,
|
|
||||||
text: '努力加载中。。。',
|
|
||||||
spinner: 'el-icon-loading',
|
|
||||||
background: 'rgba(0, 0, 0, 0.7)'
|
|
||||||
});
|
|
||||||
|
|
||||||
this.tableColumns.push(
|
this.tableColumns.push(
|
||||||
{prop: 'unionName', label: '所属工会'},
|
{prop: 'unionName', label: '所属工会'},
|
||||||
@@ -400,14 +404,26 @@ layout("/layouts/platform.html"){
|
|||||||
{prop: "unselectedTeacherSum", label: "未选人数"}
|
{prop: "unselectedTeacherSum", label: "未选人数"}
|
||||||
)
|
)
|
||||||
if (!this.pageForm.projectId) {
|
if (!this.pageForm.projectId) {
|
||||||
this.tableData = []
|
this.$set(this, "tableData", [])
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const resp = await this.$axios.post(loc() + '/pageData', this.pageForm)
|
this.tableLoading = true
|
||||||
|
const loading = this.$loading({
|
||||||
|
lock: true,
|
||||||
|
text: '努力加载中。。。',
|
||||||
|
spinner: 'el-icon-loading',
|
||||||
|
background: 'rgba(0, 0, 0, 0.7)'
|
||||||
|
})
|
||||||
|
return this.$axios.post(loc() + '/pageData', this.pageForm).then((resp) => {
|
||||||
if (resp.code === 0) {
|
if (resp.code === 0) {
|
||||||
this.tableData = resp.data.tableList
|
this.$set(this, "tableData", resp.data.tableList)
|
||||||
}
|
}
|
||||||
|
}).finally(() => {
|
||||||
|
// 业务错误或网络异常也必须释放遮罩,保证页面可以重新查询。
|
||||||
|
this.tableLoading = false
|
||||||
loading.close()
|
loading.close()
|
||||||
|
})
|
||||||
},
|
},
|
||||||
pageNumberChange(val) {
|
pageNumberChange(val) {
|
||||||
this.pageFormUnion.pageNumber = val;
|
this.pageFormUnion.pageNumber = val;
|
||||||
|
|||||||
Reference in New Issue
Block a user