diff --git a/src/main/java/io/v/nutz/zhgh/mobile/suggestionBox/controller/SuggestionBoxAdminController.java b/src/main/java/io/v/nutz/zhgh/mobile/suggestionBox/controller/SuggestionBoxAdminController.java new file mode 100644 index 0000000..85981f2 --- /dev/null +++ b/src/main/java/io/v/nutz/zhgh/mobile/suggestionBox/controller/SuggestionBoxAdminController.java @@ -0,0 +1,112 @@ +package io.v.nutz.zhgh.mobile.suggestionBox.controller; + +import cn.hutool.core.util.StrUtil; +import cn.wizzer.framework.base.Result; +import io.v.nutz.base.page.Pagination; +import io.v.nutz.base.query.PageForm; +import io.v.nutz.base.service.BaseService; +import io.v.nutz.web.commons.utils.ShiroUtil; +import io.v.nutz.zhgh.mobile.suggestionBox.models.SuggestionBox; +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; +import org.nutz.dao.util.cri.Static; +import org.nutz.ioc.loader.annotation.Inject; +import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; +import org.nutz.mvc.annotation.Param; + +import java.time.LocalDateTime; +import java.util.Map; + +@IocBean +@At("/platform/suggestionBox/admin") +@Ok("json:full") +public class SuggestionBoxAdminController { + + @Inject + private Dao dao; + @Inject + private BaseService baseService; + + @At("/h5") + @Ok("beetl:/mobile/suggestionBox/admin.html") + public void h5() { + + } + + /** + * 分页数据 + * + * @param pageForm 分页 + * @param status 状态 是否回复 + * @param timeRange 时间范围 今日 本周 本月 + * @return + */ + @At("/pageData") + public Result pageData(PageForm pageForm, Integer status, String timeRange, String keyword) { + Sql sql = Sqls.create("select * from suggestion_box $condition"); + Cnd cnd = Cnd.NEW(); + cnd.andEX("isReply", "=", status); + if (StrUtil.isNotBlank(timeRange)) { + switch (timeRange) { + case "today": + cnd.and(new Static("DATE(submitTime) = CURDATE()")); + break; + case "week": + cnd.and(new Static("WEEKOFYEAR(submitTime) = WEEKOFYEAR(CURDATE())")); + break; + case "month": + cnd.and(new Static("MONTH(submitTime) = MONTH(CURDATE())")); + break; + default: + break; + } + } + if (StrUtil.isNotBlank(keyword)) { + SqlExpressionGroup seg = new SqlExpressionGroup(); + seg.orLike("submitterName", keyword); + seg.orLike("content", keyword); + seg.orLike("title", keyword); + cnd.and(seg); + } + cnd.desc("submitTime"); + sql.setCondition(cnd); + Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + return Result.success(pagination); + } + + /** + * 统计 + */ + @At("/getStats") + public Result stats() { + // 查询总意见数 + int total = dao.count(SuggestionBox.class); + // 待回复数 + int pending = dao.count(SuggestionBox.class, Cnd.where("isReply", "=", 0)); + // 已回复数 + int replied = dao.count(SuggestionBox.class, Cnd.where("isReply", "=", 1)); + // 今日新增 + int today = dao.count(SuggestionBox.class, Cnd.NEW().and(new Static("DATE(submitTime) = CURDATE()"))); + return Result.success(Map.of("total", total, "pending", pending, "replied", replied, "today", today)); + } + + /** + * 答复 + */ + @At + public Result reply(@Param("reply") SuggestionBox suggestionBox) { + suggestionBox.setIsReply(true); + suggestionBox.setReplyTime(LocalDateTime.now()); + suggestionBox.setReplyUserId(ShiroUtil.getUserId()); + suggestionBox.setReplyUserName((String) ShiroUtil.getPrincipalProperty("username")); + dao.update(suggestionBox,"isReply|replyContent|replyTime|replyUserId|replyUserName"); + return Result.success(); + } + + +} diff --git a/src/main/java/io/v/nutz/zhgh/mobile/suggestionBox/controller/SuggestionBoxController.java b/src/main/java/io/v/nutz/zhgh/mobile/suggestionBox/controller/SuggestionBoxController.java new file mode 100644 index 0000000..e579d20 --- /dev/null +++ b/src/main/java/io/v/nutz/zhgh/mobile/suggestionBox/controller/SuggestionBoxController.java @@ -0,0 +1,76 @@ +package io.v.nutz.zhgh.mobile.suggestionBox.controller; + +import cn.wizzer.framework.base.Result; +import io.v.nutz.base.page.Pagination; +import io.v.nutz.base.query.PageForm; +import io.v.nutz.base.service.BaseService; +import io.v.nutz.web.commons.utils.ShiroUtil; +import io.v.nutz.zhgh.mobile.suggestionBox.models.SuggestionBox; +import org.nutz.dao.Cnd; +import org.nutz.dao.Dao; +import org.nutz.dao.Sqls; +import org.nutz.dao.sql.Sql; +import org.nutz.ioc.loader.annotation.Inject; +import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; +import org.nutz.mvc.annotation.Param; + +import java.time.LocalDateTime; + +@IocBean +@At("/platform/suggestionBox") +@Ok("json:full") +public class SuggestionBoxController { + + @Inject + private Dao dao; + @Inject + private BaseService baseService; + + @At("/h5") + @Ok("beetl:/mobile/suggestionBox/index.html") + public void h5Index() { + + } + + @At("/h5/write") + @Ok("beetl:/mobile/suggestionBox/write.html") + public void h5Write() { + + } + + @At("/h5/mine") + @Ok("beetl:/mobile/suggestionBox/mine.html") + public void h5Mine() { + + } + + @At + public Result submit(@Param("suggestion") SuggestionBox suggestionBox) { + suggestionBox.setSubmitTime(LocalDateTime.now()); + dao.insert(suggestionBox); + return Result.success(); + } + + @At + public Result delete(@Param("id") String id) { + dao.delete(SuggestionBox.class, id); + return Result.success(); + } + + /** + * 我的意见列表 + */ + @At + public Result pageData(PageForm pageForm) { + Sql sql = Sqls.create("select * from suggestion_box $condition"); + Cnd cnd = Cnd.NEW(); + cnd.and("submitterId","=", ShiroUtil.getUserId()); + cnd.desc("submitTime"); + sql.setCondition(cnd); + Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + return Result.success(pagination); + } + +} diff --git a/src/main/java/io/v/nutz/zhgh/mobile/suggestionBox/models/SuggestionBox.java b/src/main/java/io/v/nutz/zhgh/mobile/suggestionBox/models/SuggestionBox.java new file mode 100644 index 0000000..f32d79a --- /dev/null +++ b/src/main/java/io/v/nutz/zhgh/mobile/suggestionBox/models/SuggestionBox.java @@ -0,0 +1,116 @@ +package io.v.nutz.zhgh.mobile.suggestionBox.models; + +import cn.wizzer.framework.base.model.BaseModel; +import io.v.nutz.sys.models.Sys_file; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.nutz.dao.entity.annotation.*; +import org.nutz.dao.interceptor.annotation.PrevInsert; + +import java.time.LocalDateTime; +import java.util.List; + +@EqualsAndHashCode(callSuper = true) +@Table("suggestion_box") +@Comment("意见箱") +@Data +public class SuggestionBox extends BaseModel { + + @Name + @Comment("ID") + @ColDefine(type = ColType.VARCHAR, width = 32) + @PrevInsert(uu32 = true) + private String id; + + @Column + @Comment("提交人ID") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String submitterId; + + @Column + @Comment("提交人姓名") + @ColDefine(type = ColType.VARCHAR, width = 50) + private String submitterName; + + @Column + @Comment("提交人工号") + @ColDefine(type = ColType.VARCHAR, width = 50) + private String submitterLoginName; + + @Column + @Comment("提交人单位ID") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String submitterUnitId; + + @Column + @Comment("提交人单位名称") + @ColDefine(type = ColType.VARCHAR, width = 100) + private String submitterUnitName; + + @Column + @Comment("提交人分工会ID") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String submitterUnionId; + + @Column + @Comment("提交人分工会名称") + @ColDefine(type = ColType.VARCHAR, width = 100) + private String submitterUnionName; + + @Column + @Comment("提交时间") + @ColDefine(type = ColType.DATETIME) + private LocalDateTime submitTime; + + @Column + @Comment("意见名称") + @ColDefine(type = ColType.VARCHAR, width = 50) + private String title; + + @Column + @Comment("意见内容") + @ColDefine(type = ColType.TEXT) + private String content; + + @Column + @Comment("附件") + @ColDefine(type = ColType.MYSQL_JSON) + private List attachments; + + @Column + @Comment("联系方式") + @ColDefine(type = ColType.VARCHAR, width = 100) + private String concat; + + @Column + @Comment("回复状态") + @ColDefine(type = ColType.BOOLEAN) + @Default("0") + private Boolean isReply; + + @Column + @Comment("回复内容") + @ColDefine(type = ColType.TEXT) + private String replyContent; + + @Column + @Comment("回复时间") + @ColDefine(type = ColType.DATETIME) + private LocalDateTime replyTime; + + @Column + @Comment("回复人ID") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String replyUserId; + + @Column + @Comment("回复人姓名") + @ColDefine(type = ColType.VARCHAR, width = 50) + private String replyUserName; + + @Column + @Comment("回复附件") + @ColDefine(type = ColType.MYSQL_JSON) + private List replyAttachments; + +} diff --git a/src/main/resources/views/mobile/suggestionBox/admin.html b/src/main/resources/views/mobile/suggestionBox/admin.html new file mode 100644 index 0000000..2344709 --- /dev/null +++ b/src/main/resources/views/mobile/suggestionBox/admin.html @@ -0,0 +1,877 @@ + + + + +
+ + + +
+
+
{{ stats.total }}
+
总意见数
+
+
+
{{ stats.pending }}
+
待回复
+
+
+
{{ stats.replied }}
+
已回复
+
+
+
{{ stats.today }}
+
今日新增
+
+
+ + +
+
+
筛选条件
+
+ {{ filters.isCollapsed ? '展开' : '收起' }} + +
+
+ + + +
+
+
状态
+
+
+ 全部 +
+
+ 待回复 +
+
+ 已回复 +
+
+
+ +
+
时间
+
+
全部 +
+
今日 +
+
+ 本周 +
+
本月 +
+
+
+
+
+ + +
+ + + + +
+ +
暂无符合条件的意见
+
+ + +
+
+
{{ item.title || '意见反馈' }}
+
+ {{ getStatusText(item.isReply) }} +
+
+
+ + {{ item.submitterName }} + {{ item.submitterUnitName }} +
+
{{ item.content }}
+ +
+
+
+
+ + + +
+
+
{{ currentSuggestion.title || '意见反馈' }}
+
+ {{ formatDate(currentSuggestion.submitTime) }} + {{ getStatusText(currentSuggestion.isReply) }} +
+
+ +
+
提交人信息
+
+
+ 姓名: + {{ currentSuggestion.submitterName || '未填写' }} +
+
+ 工号: + {{ currentSuggestion.submitterLoginName || '未填写' }} +
+
+ 单位: + {{ currentSuggestion.submitterUnitName || '未填写' }} +
+
+ 联系方式: + {{ currentSuggestion.concat || '未填写' }} +
+
+
+ +
+
意见内容
+
{{ currentSuggestion.content }}
+
+ +
+
附件
+
+ + +
+
+ +
+
已回复内容
+
{{ currentSuggestion.reply }}
+
+ 回复时间:{{ formatDate(currentSuggestion.replyTime) }} +
+ +
+ +
+
{{ currentSuggestion.isReply ? '修改回复' : '回复意见' }}
+
+ + + + + + +
+ 提交回复 + +
+
+
+
+
+
+ + + + diff --git a/src/main/resources/views/mobile/suggestionBox/index.html b/src/main/resources/views/mobile/suggestionBox/index.html new file mode 100644 index 0000000..8965fe0 --- /dev/null +++ b/src/main/resources/views/mobile/suggestionBox/index.html @@ -0,0 +1,531 @@ + + +
+ + + + + + +
+ +
+
+ +
+
+

提交意见

+

分享您的想法和建议

+
+
+ +
+
+ + +
+
+ +
+
+

我的意见

+

查看您提交的所有意见

+
+
+ +
+
+ + +
+
+ +
+
+

意见管理

+

管理所有用户提交的意见

+
+
+ +
+
+
+ + +
+
+

使用指南

+
+
+
+
1
+
+

提交意见

+

点击"提交意见"按钮,填写您的意见和建议

+
+
+ +
+
+
+
+
2
+
+

等待处理

+

我们将在3个工作日内处理您的意见

+
+
+ +
+
+
+
+
3
+
+

查看回复

+

在"我的意见"中查看官方回复

+
+
+ +
+
+
+
+ + +
+
+

常见问题

+ 解答您的疑惑 +
+
+
+
+ + 如何提交带附件的意见? + +
+
+

在提交意见表单中,您可以上传最多3个文件作为附件,支持图片格式。点击附件上传区域,选择您要上传的文件即可。

+
+
+
+
+ + 意见提交后多久能收到回复? + +
+
+

我们会在3个工作日内处理您的意见,紧急问题会优先处理。您可以随时在"我的意见"中查看处理进度。

+
+
+
+
+ + 我可以修改已提交的意见吗? + +
+
+

提交后的意见暂不支持修改,如有补充,请重新提交并说明这是对之前意见的补充。我们会将相关意见关联处理。

+
+
+
+
+
+ + + + + + diff --git a/src/main/resources/views/mobile/suggestionBox/mine.html b/src/main/resources/views/mobile/suggestionBox/mine.html new file mode 100644 index 0000000..2bbb169 --- /dev/null +++ b/src/main/resources/views/mobile/suggestionBox/mine.html @@ -0,0 +1,549 @@ + + + + +
+ + + +
+ + + + +
+ +
您还没有提交过意见
+ 去提交意见 +
+ + +
+
+
{{ item.title || '意见反馈' }}
+
+ {{ getStatusText(item.isReply) }} +
+
+
{{ item.content }}
+ +
+
+
+
+ + + +
+
+
{{ currentSuggestion.title || '意见反馈' }}
+
+ {{ formatDate(currentSuggestion.submitTime) }} + {{ getStatusText(currentSuggestion.isReply) }} +
+
+ +
+
提交人信息
+
+
+ 姓名: + {{ currentSuggestion.submitterName || '未填写' }} +
+
+ 工号: + {{ currentSuggestion.submitterLoginName || '未填写' }} +
+
+ 单位: + {{ currentSuggestion.submitterUnitName || '未填写' }} +
+
+ 联系方式: + {{ currentSuggestion.concat || '未填写' }} +
+
+
+ +
+
意见内容
+
{{ currentSuggestion.content }}
+
+ +
+
附件
+
+ + +
+
+ +
+
回复
+
{{ currentSuggestion.replyContent }}
+
+ +
+
回复
+
+ +
暂无回复
+
+
+
+
+
+ + + + + diff --git a/src/main/resources/views/mobile/suggestionBox/write.html b/src/main/resources/views/mobile/suggestionBox/write.html new file mode 100644 index 0000000..91e163a --- /dev/null +++ b/src/main/resources/views/mobile/suggestionBox/write.html @@ -0,0 +1,294 @@ + + + + +
+ + + + +
+
+
+
+ 填写人信息 +
+
+
姓名
+
+ +
+
+
+
工号
+
+ +
+
+
+
手机号码
+
+ +
+
+
+
所在单位
+
+ +
+
+
+
+
+
+ 填写标题 +
+
+
标题
+
+ +
+
+
+
+
+
+ 填写意见建议内容 +
+
+ +
+
+
+
+
+ 照片上传 +
+ +
+ + + + + + + + + + + + + +
+
+
+ + 提 交 + +
+
+
+ +