新增预警页面
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
package com.jeesite.modules.biz.dao;
|
||||
|
||||
import com.jeesite.common.dao.CrudDao;
|
||||
import com.jeesite.common.mybatis.annotation.MyBatisDao;
|
||||
import com.jeesite.modules.biz.entity.BizCalendarSchedule;
|
||||
|
||||
/**
|
||||
* 日程信息DAO接口
|
||||
* @author gaoxq
|
||||
* @version 2025-12-10
|
||||
*/
|
||||
@MyBatisDao(dataSourceName="work")
|
||||
public interface BizCalendarScheduleDao extends CrudDao<BizCalendarSchedule> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package com.jeesite.modules.biz.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable;
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
import com.jeesite.common.entity.DataEntity;
|
||||
import com.jeesite.common.mybatis.annotation.Column;
|
||||
import com.jeesite.common.mybatis.annotation.Table;
|
||||
import com.jeesite.common.mybatis.mapper.query.QueryType;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Align;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelFields;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 日程信息Entity
|
||||
*
|
||||
* @author gaoxq
|
||||
* @version 2025-12-10
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table(name = "biz_calendar_schedule", alias = "a", label = "日程信息信息", columns = {
|
||||
@Column(name = "create_time", attrName = "createTime", label = "记录时间", isUpdate = false, isUpdateForce = true),
|
||||
@Column(name = "schedule_id", attrName = "scheduleId", label = "主键标识", isPK = true),
|
||||
@Column(name = "schedule_no", attrName = "scheduleNo", label = "日程编号"),
|
||||
@Column(name = "title", attrName = "title", label = "日程标题", queryType = QueryType.LIKE),
|
||||
@Column(name = "content", attrName = "content", label = "日程详情/备注", isQuery = false),
|
||||
@Column(name = "start_time", attrName = "startTime", label = "日程开始时间", isQuery = false),
|
||||
@Column(name = "end_time", attrName = "endTime", label = "日程结束时间", isQuery = false),
|
||||
@Column(name = "all_day", attrName = "allDay", label = "是否全天"),
|
||||
@Column(name = "location", attrName = "location", label = "日程地点", isQuery = false),
|
||||
@Column(name = "priority", attrName = "priority", label = "优先等级"),
|
||||
@Column(name = "ustatus", attrName = "ustatus", label = "日程状态"),
|
||||
@Column(name = "remind_time", attrName = "remindTime", label = "提醒时间", isQuery = false, isUpdateForce = true),
|
||||
@Column(name = "creator_user", attrName = "creatorUser", label = "创建人账号", isUpdate = false, isUpdateForce = true),
|
||||
@Column(name = "participant_user", attrName = "participantUser", label = "接收人账号"),
|
||||
@Column(name = "participant_name", attrName = "participantName", label = "接收人名称"),
|
||||
@Column(name = "update_time", attrName = "updateTime", label = "更新时间", isQuery = false, isUpdateForce = true),
|
||||
}, orderBy = "a.schedule_id DESC"
|
||||
)
|
||||
@Data
|
||||
public class BizCalendarSchedule extends DataEntity<BizCalendarSchedule> implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Date createTime; // 记录时间
|
||||
private String scheduleId; // 主键标识
|
||||
private String scheduleNo; // 日程编号
|
||||
private String title; // 日程标题
|
||||
private String content; // 日程详情/备注
|
||||
private Date startTime; // 日程开始时间
|
||||
private Date endTime; // 日程结束时间
|
||||
private String allDay; // 是否全天
|
||||
private String location; // 日程地点
|
||||
private String priority; // 优先等级
|
||||
private String ustatus; // 日程状态
|
||||
private Date remindTime; // 提醒时间
|
||||
private String creatorUser; // 创建人账号
|
||||
private String participantUser; // 接收人账号
|
||||
private String participantName; // 接收人名称
|
||||
private Date updateTime; // 更新时间
|
||||
|
||||
@ExcelFields({
|
||||
@ExcelField(title = "记录时间", attrName = "createTime", align = Align.CENTER, sort = 10, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title = "主键标识", attrName = "scheduleId", align = Align.CENTER, sort = 20),
|
||||
@ExcelField(title = "日程编号", attrName = "scheduleNo", align = Align.CENTER, sort = 30),
|
||||
@ExcelField(title = "日程标题", attrName = "title", align = Align.CENTER, sort = 40),
|
||||
@ExcelField(title = "日程详情/备注", attrName = "content", align = Align.CENTER, sort = 50),
|
||||
@ExcelField(title = "日程开始时间", attrName = "startTime", align = Align.CENTER, sort = 60, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title = "日程结束时间", attrName = "endTime", align = Align.CENTER, sort = 70, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title = "是否全天", attrName = "allDay", align = Align.CENTER, sort = 80),
|
||||
@ExcelField(title = "日程地点", attrName = "location", align = Align.CENTER, sort = 90),
|
||||
@ExcelField(title = "优先等级", attrName = "priority", dictType = "priority", align = Align.CENTER, sort = 100),
|
||||
@ExcelField(title = "日程状态", attrName = "ustatus", dictType = "todo_status", align = Align.CENTER, sort = 110),
|
||||
@ExcelField(title = "提醒时间", attrName = "remindTime", align = Align.CENTER, sort = 120, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title = "创建人账号", attrName = "creatorUser", align = Align.CENTER, sort = 130),
|
||||
@ExcelField(title = "接收人账号", attrName = "participantUser", align = Align.CENTER, sort = 150),
|
||||
@ExcelField(title = "接收人名称", attrName = "participantName", align = Align.CENTER, sort = 160),
|
||||
@ExcelField(title = "更新时间", attrName = "updateTime", align = Align.CENTER, sort = 170, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
})
|
||||
public BizCalendarSchedule() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public BizCalendarSchedule(String id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public Date getCreateTime_gte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.GTE);
|
||||
}
|
||||
|
||||
public void setCreateTime_gte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.GTE, createTime);
|
||||
}
|
||||
|
||||
public Date getCreateTime_lte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.LTE);
|
||||
}
|
||||
|
||||
public void setCreateTime_lte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.LTE, createTime);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package com.jeesite.modules.biz.service;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.service.CrudService;
|
||||
import com.jeesite.modules.biz.entity.BizCalendarSchedule;
|
||||
import com.jeesite.modules.biz.dao.BizCalendarScheduleDao;
|
||||
import com.jeesite.common.service.ServiceException;
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.validator.ValidatorUtils;
|
||||
import com.jeesite.common.utils.excel.ExcelImport;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import jakarta.validation.ConstraintViolation;
|
||||
import jakarta.validation.ConstraintViolationException;
|
||||
|
||||
/**
|
||||
* 日程信息Service
|
||||
* @author gaoxq
|
||||
* @version 2025-12-10
|
||||
*/
|
||||
@Service
|
||||
public class BizCalendarScheduleService extends CrudService<BizCalendarScheduleDao, BizCalendarSchedule> {
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param bizCalendarSchedule 主键
|
||||
*/
|
||||
@Override
|
||||
public BizCalendarSchedule get(BizCalendarSchedule bizCalendarSchedule) {
|
||||
return super.get(bizCalendarSchedule);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param bizCalendarSchedule 查询条件
|
||||
* @param bizCalendarSchedule page 分页对象
|
||||
*/
|
||||
@Override
|
||||
public Page<BizCalendarSchedule> findPage(BizCalendarSchedule bizCalendarSchedule) {
|
||||
return super.findPage(bizCalendarSchedule);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
* @param bizCalendarSchedule 查询条件
|
||||
*/
|
||||
@Override
|
||||
public List<BizCalendarSchedule> findList(BizCalendarSchedule bizCalendarSchedule) {
|
||||
return super.findList(bizCalendarSchedule);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param bizCalendarSchedule 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void save(BizCalendarSchedule bizCalendarSchedule) {
|
||||
super.save(bizCalendarSchedule);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
* @param file 导入的数据文件
|
||||
*/
|
||||
@Transactional
|
||||
public String importData(MultipartFile file) {
|
||||
if (file == null){
|
||||
throw new ServiceException(text("请选择导入的数据文件!"));
|
||||
}
|
||||
int successNum = 0; int failureNum = 0;
|
||||
StringBuilder successMsg = new StringBuilder();
|
||||
StringBuilder failureMsg = new StringBuilder();
|
||||
try(ExcelImport ei = new ExcelImport(file, 2, 0)){
|
||||
List<BizCalendarSchedule> list = ei.getDataList(BizCalendarSchedule.class);
|
||||
for (BizCalendarSchedule bizCalendarSchedule : list) {
|
||||
try{
|
||||
ValidatorUtils.validateWithException(bizCalendarSchedule);
|
||||
this.save(bizCalendarSchedule);
|
||||
successNum++;
|
||||
successMsg.append("<br/>" + successNum + "、编号 " + bizCalendarSchedule.getId() + " 导入成功");
|
||||
} catch (Exception e) {
|
||||
failureNum++;
|
||||
String msg = "<br/>" + failureNum + "、编号 " + bizCalendarSchedule.getId() + " 导入失败:";
|
||||
if (e instanceof ConstraintViolationException){
|
||||
ConstraintViolationException cve = (ConstraintViolationException)e;
|
||||
for (ConstraintViolation<?> violation : cve.getConstraintViolations()) {
|
||||
msg += Global.getText(violation.getMessage()) + " ("+violation.getPropertyPath()+")";
|
||||
}
|
||||
}else{
|
||||
msg += e.getMessage();
|
||||
}
|
||||
failureMsg.append(msg);
|
||||
logger.error(msg, e);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
failureMsg.append(e.getMessage());
|
||||
return failureMsg.toString();
|
||||
}
|
||||
if (failureNum > 0) {
|
||||
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
||||
throw new ServiceException(failureMsg.toString());
|
||||
}else{
|
||||
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
|
||||
}
|
||||
return successMsg.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param bizCalendarSchedule 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateStatus(BizCalendarSchedule bizCalendarSchedule) {
|
||||
super.updateStatus(bizCalendarSchedule);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param bizCalendarSchedule 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void delete(BizCalendarSchedule bizCalendarSchedule) {
|
||||
super.delete(bizCalendarSchedule);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
package com.jeesite.modules.biz.web;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.jeesite.modules.app.utils.vDate;
|
||||
import com.jeesite.modules.sys.entity.User;
|
||||
import com.jeesite.modules.sys.utils.UserUtils;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.collect.ListUtils;
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.lang.DateUtils;
|
||||
import com.jeesite.common.utils.excel.ExcelExport;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Type;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.biz.entity.BizCalendarSchedule;
|
||||
import com.jeesite.modules.biz.service.BizCalendarScheduleService;
|
||||
|
||||
/**
|
||||
* 日程信息Controller
|
||||
*
|
||||
* @author gaoxq
|
||||
* @version 2025-12-10
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/biz/calendarSchedule")
|
||||
public class BizCalendarScheduleController extends BaseController {
|
||||
|
||||
private final BizCalendarScheduleService bizCalendarScheduleService;
|
||||
|
||||
public BizCalendarScheduleController(BizCalendarScheduleService bizCalendarScheduleService) {
|
||||
this.bizCalendarScheduleService = bizCalendarScheduleService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
@ModelAttribute
|
||||
public BizCalendarSchedule get(String scheduleId, boolean isNewRecord) {
|
||||
return bizCalendarScheduleService.get(scheduleId, isNewRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
@RequiresPermissions("biz:calendarSchedule:view")
|
||||
@RequestMapping(value = {"list", ""})
|
||||
public String list(BizCalendarSchedule bizCalendarSchedule, Model model) {
|
||||
model.addAttribute("bizCalendarSchedule", bizCalendarSchedule);
|
||||
return "modules/biz/bizCalendarScheduleList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
*/
|
||||
@RequiresPermissions("biz:calendarSchedule:view")
|
||||
@RequestMapping(value = "listData")
|
||||
@ResponseBody
|
||||
public Page<BizCalendarSchedule> listData(BizCalendarSchedule bizCalendarSchedule, HttpServletRequest request, HttpServletResponse response) {
|
||||
bizCalendarSchedule.setPage(new Page<>(request, response));
|
||||
Page<BizCalendarSchedule> page = bizCalendarScheduleService.findPage(bizCalendarSchedule);
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看编辑表单
|
||||
*/
|
||||
@RequiresPermissions("biz:calendarSchedule:view")
|
||||
@RequestMapping(value = "form")
|
||||
public String form(BizCalendarSchedule bizCalendarSchedule, Model model) {
|
||||
model.addAttribute("bizCalendarSchedule", bizCalendarSchedule);
|
||||
return "modules/biz/bizCalendarScheduleForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*/
|
||||
@RequiresPermissions("biz:calendarSchedule:edit")
|
||||
@PostMapping(value = "save")
|
||||
@ResponseBody
|
||||
public String save(@Validated BizCalendarSchedule bizCalendarSchedule) {
|
||||
User user = UserUtils.getUser();
|
||||
User fUser = UserUtils.getByLoginCode(bizCalendarSchedule.getParticipantUser());
|
||||
bizCalendarSchedule.setCreatorUser(user.getLoginCode());
|
||||
bizCalendarSchedule.setParticipantName(fUser.getUserName());
|
||||
bizCalendarSchedule.setUpdateTime(vDate.getUpdateTime(bizCalendarSchedule.getIsNewRecord()));
|
||||
bizCalendarScheduleService.save(bizCalendarSchedule);
|
||||
return renderResult(Global.TRUE, text("保存日程信息成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*/
|
||||
@RequiresPermissions("biz:calendarSchedule:view")
|
||||
@RequestMapping(value = "exportData")
|
||||
public void exportData(BizCalendarSchedule bizCalendarSchedule, HttpServletResponse response) {
|
||||
List<BizCalendarSchedule> list = bizCalendarScheduleService.findList(bizCalendarSchedule);
|
||||
String fileName = "日程信息" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
|
||||
try (ExcelExport ee = new ExcelExport("日程信息", BizCalendarSchedule.class)) {
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载模板
|
||||
*/
|
||||
@RequiresPermissions("biz:calendarSchedule:view")
|
||||
@RequestMapping(value = "importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
BizCalendarSchedule bizCalendarSchedule = new BizCalendarSchedule();
|
||||
List<BizCalendarSchedule> list = ListUtils.newArrayList(bizCalendarSchedule);
|
||||
String fileName = "日程信息模板.xlsx";
|
||||
try (ExcelExport ee = new ExcelExport("日程信息", BizCalendarSchedule.class, Type.IMPORT)) {
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequiresPermissions("biz:calendarSchedule:edit")
|
||||
@PostMapping(value = "importData")
|
||||
public String importData(MultipartFile file) {
|
||||
try {
|
||||
String message = bizCalendarScheduleService.importData(file);
|
||||
return renderResult(Global.TRUE, "posfull:" + message);
|
||||
} catch (Exception ex) {
|
||||
return renderResult(Global.FALSE, "posfull:" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*/
|
||||
@RequiresPermissions("biz:calendarSchedule:edit")
|
||||
@RequestMapping(value = "delete")
|
||||
@ResponseBody
|
||||
public String delete(BizCalendarSchedule bizCalendarSchedule) {
|
||||
bizCalendarScheduleService.delete(bizCalendarSchedule);
|
||||
return renderResult(Global.TRUE, text("删除日程信息成功!"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.jeesite.modules.biz.dao.BizCalendarScheduleDao">
|
||||
|
||||
<!-- 查询数据
|
||||
<select id="findList" resultType="BizCalendarSchedule">
|
||||
SELECT ${sqlMap.column.toSql()}
|
||||
FROM ${sqlMap.table.toSql()}
|
||||
<where>
|
||||
${sqlMap.where.toSql()}
|
||||
</where>
|
||||
ORDER BY ${sqlMap.order.toSql()}
|
||||
</select> -->
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user