体检管理添加体检反馈功能
This commit is contained in:
+90
@@ -24,6 +24,7 @@ import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.web.commons.base.Globals;
|
||||
import com.budwk.app.zhgh.activity.basic.models.ActivityUserScope;
|
||||
import com.budwk.app.zhgh.dayofficework.healthCheckup.model.*;
|
||||
import com.budwk.app.zhgh.dayofficework.healthCheckup.service.HealthCheckupFeedbackService;
|
||||
import com.budwk.app.zhgh.dayofficework.healthCheckup.service.HealthCheckupProjectService;
|
||||
import com.budwk.app.zhgh.dayofficework.healthCheckup.template.HealthCheckupImportTemp;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -79,12 +80,21 @@ public class HealthCheckupListController {
|
||||
@Inject
|
||||
private HealthCheckupProjectService healthCheckupProjectService;
|
||||
|
||||
@Inject
|
||||
private HealthCheckupFeedbackService healthCheckupFeedbackService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/dayofficework/healthCheckup/listMange/index.html")
|
||||
@SaCheckPermission("healthCheckup.list.mange")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At("/feedback/query")
|
||||
@Ok("beetl:/platform/zhgh/dayofficework/healthCheckup/feedbackQuery/index.html")
|
||||
@SaCheckPermission("healthCheckup.list.mange.feedback")
|
||||
public void feedbackQueryIndex() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("healthCheckup.list.mange")
|
||||
@@ -468,6 +478,86 @@ public class HealthCheckupListController {
|
||||
);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("体检反馈列表")
|
||||
@SaCheckPermission("healthCheckup.list.mange")
|
||||
public Result feedbackList(String year, String projectId, String unionId) {
|
||||
if (StrUtil.isBlank(unionId)) {
|
||||
unionId = SecurityUtil.getUnionId();
|
||||
}
|
||||
if (StrUtil.hasBlank(year, projectId, unionId)) {
|
||||
return Result.error("请选择年度、体检项目、分工会后再查看反馈");
|
||||
}
|
||||
return Result.success(healthCheckupFeedbackService.listFeedback(year, projectId, unionId));
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("保存体检反馈")
|
||||
@SLog(type = "healthCheckup", tag = "体检管理", msg = "新增体检反馈")
|
||||
@SaCheckPermission("healthCheckup.list.mange")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Result saveFeedback(String year, String projectId, String unionId, String feedbackInfo) {
|
||||
if (StrUtil.isBlank(unionId)) {
|
||||
unionId = SecurityUtil.getUnionId();
|
||||
}
|
||||
NutMap result = healthCheckupFeedbackService.saveFeedback(year, projectId, unionId, feedbackInfo);
|
||||
if (result.getInt("code") == 0) {
|
||||
return Result.success(result.getString("msg"));
|
||||
}
|
||||
return Result.error(result.getString("msg"));
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("删除体检反馈")
|
||||
@SLog(type = "healthCheckup", tag = "体检管理", msg = "删除体检反馈")
|
||||
@SaCheckPermission("healthCheckup.list.mange")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Result deleteFeedback(String id) {
|
||||
NutMap result = healthCheckupFeedbackService.deleteFeedback(id);
|
||||
if (result.getInt("code") == 0) {
|
||||
return Result.success(result.getString("msg"));
|
||||
}
|
||||
return Result.error(result.getString("msg"));
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("批量删除体检反馈")
|
||||
@SLog(type = "healthCheckup", tag = "体检管理", msg = "批量删除体检反馈")
|
||||
@SaCheckPermission("healthCheckup.list.mange")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Result deleteFeedbackBatch(String ids) {
|
||||
String[] idArray = null;
|
||||
if (StrUtil.isNotBlank(ids)) {
|
||||
// 兼容前端传逗号分隔字符串和JSON数组字符串两种格式。
|
||||
if (ids.trim().startsWith("[")) {
|
||||
idArray = JSONUtil.parseArray(ids).toList(String.class).toArray(new String[0]);
|
||||
} else {
|
||||
idArray = ids.split(",");
|
||||
}
|
||||
}
|
||||
NutMap result = healthCheckupFeedbackService.deleteFeedbackBatch(idArray);
|
||||
if (result.getInt("code") == 0) {
|
||||
return Result.success(result.getString("msg"));
|
||||
}
|
||||
return Result.error(result.getString("msg"));
|
||||
}
|
||||
|
||||
@At("/feedback/query/pageData")
|
||||
@ApiOperation("问题反馈列表分页")
|
||||
@SaCheckPermission("healthCheckup.list.mange")
|
||||
public Result feedbackQueryPageData(PageForm pageForm, String year, String projectId, String unionId) {
|
||||
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name()) && StrUtil.isBlank(unionId)) {
|
||||
unionId = SecurityUtil.getUnionId();
|
||||
}
|
||||
return Result.success(healthCheckupFeedbackService.listFeedbackPage(
|
||||
pageForm.getPageNumber(),
|
||||
pageForm.getPageSize(),
|
||||
year,
|
||||
projectId,
|
||||
unionId
|
||||
));
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("体检名单编辑备注")
|
||||
@SLog(type = "healthCheckup", tag = "体检管理", msg = "编辑备注")
|
||||
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
package com.budwk.app.zhgh.dayofficework.healthCheckup.model;
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.ColDefine;
|
||||
import org.nutz.dao.entity.annotation.ColType;
|
||||
import org.nutz.dao.entity.annotation.Column;
|
||||
import org.nutz.dao.entity.annotation.Comment;
|
||||
import org.nutz.dao.entity.annotation.Name;
|
||||
import org.nutz.dao.entity.annotation.Table;
|
||||
import org.nutz.dao.entity.annotation.TableMeta;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
import java.io.Serializable;
|
||||
/**
|
||||
* Health checkup feedback record.
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("health_checkup_feedback")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
@Comment("health checkup feedback")
|
||||
public class HealthCheckupFeedback extends BaseModel implements Serializable {
|
||||
@Name
|
||||
@Comment("id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
@Column
|
||||
@Comment("year")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 4)
|
||||
private String year;
|
||||
@Column
|
||||
@Comment("project id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String projectId;
|
||||
@Column
|
||||
@Comment("project name")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String projectName;
|
||||
@Column
|
||||
@Comment("union id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unionId;
|
||||
@Column
|
||||
@Comment("union name")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String unionName;
|
||||
@Column
|
||||
@Comment("feedback info")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String feedbackInfo;
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package com.budwk.app.zhgh.dayofficework.healthCheckup.service;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.dayofficework.healthCheckup.model.HealthCheckupFeedback;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import java.util.List;
|
||||
public interface HealthCheckupFeedbackService extends BaseService<HealthCheckupFeedback> {
|
||||
/**
|
||||
* Query feedback records by the selected filters on the list page.
|
||||
*/
|
||||
List<NutMap> listFeedback(String year, String projectId, String unionId);
|
||||
/**
|
||||
* Save a feedback record and bind it to the selected year, project and union.
|
||||
*/
|
||||
NutMap saveFeedback(String year, String projectId, String unionId, String feedbackInfo);
|
||||
|
||||
/**
|
||||
* 删除单条体检反馈。
|
||||
*/
|
||||
NutMap deleteFeedback(String id);
|
||||
NutMap deleteFeedbackBatch(String[] ids);
|
||||
|
||||
/**
|
||||
* 查询问题反馈列表页数据。
|
||||
*/
|
||||
Pagination listFeedbackPage(Integer pageNumber, Integer pageSize, String year, String projectId, String unionId);
|
||||
}
|
||||
+126
@@ -0,0 +1,126 @@
|
||||
package com.budwk.app.zhgh.dayofficework.healthCheckup.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.sys.models.Sys_union;
|
||||
import com.budwk.app.zhgh.dayofficework.healthCheckup.model.HealthCheckupFeedback;
|
||||
import com.budwk.app.zhgh.dayofficework.healthCheckup.model.HealthCheckupProject;
|
||||
import com.budwk.app.zhgh.dayofficework.healthCheckup.service.HealthCheckupFeedbackService;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class HealthCheckupFeedbackServiceImpl extends BaseServiceImpl<HealthCheckupFeedback> implements HealthCheckupFeedbackService {
|
||||
|
||||
public HealthCheckupFeedbackServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NutMap> listFeedback(String year, String projectId, String unionId) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("year", "=", year)
|
||||
.and("projectId", "=", projectId)
|
||||
.and("unionId", "=", unionId)
|
||||
.desc("createdAt");
|
||||
List<HealthCheckupFeedback> feedbackList = query(cnd);
|
||||
List<NutMap> result = new ArrayList<>();
|
||||
for (HealthCheckupFeedback feedback : feedbackList) {
|
||||
result.add(NutMap.NEW()
|
||||
.addv("id", feedback.getId())
|
||||
.addv("year", feedback.getYear())
|
||||
.addv("projectName", feedback.getProjectName())
|
||||
.addv("unionName", feedback.getUnionName())
|
||||
.addv("feedbackInfo", feedback.getFeedbackInfo())
|
||||
.addv("createdBy", feedback.getCreatedBy())
|
||||
.addv("createdAt", feedback.getCreatedAt()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NutMap saveFeedback(String year, String projectId, String unionId, String feedbackInfo) {
|
||||
if (StrUtil.isBlank(year) || StrUtil.isBlank(projectId) || StrUtil.isBlank(unionId)) {
|
||||
return NutMap.NEW().addv("code", 1).addv("msg", "请选择年度、体检项目、分工会后再录入反馈");
|
||||
}
|
||||
if (StrUtil.isBlank(feedbackInfo)) {
|
||||
return NutMap.NEW().addv("code", 1).addv("msg", "请输入反馈信息");
|
||||
}
|
||||
|
||||
// 保存前先根据页面选中的条件反查项目和分工会,确保反馈和主列表条件强关联。
|
||||
HealthCheckupProject project = dao().fetch(HealthCheckupProject.class, projectId);
|
||||
if (project == null) {
|
||||
return NutMap.NEW().addv("code", 1).addv("msg", "当前体检项目不存在,请重新选择");
|
||||
}
|
||||
Sys_union union = dao().fetch(Sys_union.class, unionId);
|
||||
if (union == null) {
|
||||
return NutMap.NEW().addv("code", 1).addv("msg", "当前分工会不存在,请重新选择");
|
||||
}
|
||||
|
||||
HealthCheckupFeedback feedback = new HealthCheckupFeedback();
|
||||
feedback.setYear(year);
|
||||
feedback.setProjectId(projectId);
|
||||
feedback.setProjectName(project.getName());
|
||||
feedback.setUnionId(unionId);
|
||||
feedback.setUnionName(union.getName());
|
||||
feedback.setFeedbackInfo(feedbackInfo);
|
||||
insert(feedback);
|
||||
return NutMap.NEW().addv("code", 0).addv("msg", "保存成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public NutMap deleteFeedback(String id) {
|
||||
if (StrUtil.isBlank(id)) {
|
||||
return NutMap.NEW().addv("code", 1).addv("msg", "反馈ID不能为空");
|
||||
}
|
||||
HealthCheckupFeedback feedback = fetch(id);
|
||||
if (feedback == null) {
|
||||
return NutMap.NEW().addv("code", 1).addv("msg", "反馈记录不存在");
|
||||
}
|
||||
delete(id);
|
||||
return NutMap.NEW().addv("code", 0).addv("msg", "删除成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public NutMap deleteFeedbackBatch(String[] ids) {
|
||||
if (ids == null || ids.length == 0) {
|
||||
return NutMap.NEW().addv("code", 1).addv("msg", "请选择需要删除的反馈");
|
||||
}
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("id", "in", ids);
|
||||
clear(cnd);
|
||||
return NutMap.NEW().addv("code", 0).addv("msg", "批量删除成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination listFeedbackPage(Integer pageNumber, Integer pageSize, String year, String projectId, String unionId) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("hcf.year", "=", year);
|
||||
cnd.andEX("hcf.projectId", "=", projectId);
|
||||
cnd.andEX("hcf.unionId", "=", unionId);
|
||||
cnd.desc("hcf.createdAt");
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
hcf.id,
|
||||
hcf.year,
|
||||
hcf.projectName,
|
||||
hcf.unionName,
|
||||
hcf.feedbackInfo,
|
||||
hcf.createdAt,
|
||||
su.username AS createdByName
|
||||
FROM health_checkup_feedback hcf
|
||||
LEFT JOIN sys_user su ON su.id = hcf.createdBy
|
||||
$condition
|
||||
""");
|
||||
sql.setCondition(cnd);
|
||||
return listPageMap(pageNumber, pageSize, sql);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user