Browse Source

预警信息

master
blankk 2 years ago
parent
commit
fc4ff1d833
  1. 98
      ruoyi-code/src/main/java/com/ruoyi/code/warning/controller/WaAlarmController.java
  2. 96
      ruoyi-code/src/main/java/com/ruoyi/code/warning/controller/WaEmployeeController.java
  3. 96
      ruoyi-code/src/main/java/com/ruoyi/code/warning/controller/WaMessageController.java
  4. 106
      ruoyi-code/src/main/java/com/ruoyi/code/warning/controller/WaThresholdController.java
  5. 41
      ruoyi-code/src/main/java/com/ruoyi/code/warning/domain/WaAlarm.java
  6. 36
      ruoyi-code/src/main/java/com/ruoyi/code/warning/domain/WaEmpMsg.java
  7. 39
      ruoyi-code/src/main/java/com/ruoyi/code/warning/domain/WaEmployee.java
  8. 50
      ruoyi-code/src/main/java/com/ruoyi/code/warning/domain/WaMessage.java
  9. 40
      ruoyi-code/src/main/java/com/ruoyi/code/warning/domain/WaThreshold.java
  10. 17
      ruoyi-code/src/main/java/com/ruoyi/code/warning/mapper/WaAlarmMapper.java
  11. 23
      ruoyi-code/src/main/java/com/ruoyi/code/warning/mapper/WaEmpMsgMapper.java
  12. 18
      ruoyi-code/src/main/java/com/ruoyi/code/warning/mapper/WaEmployeeMapper.java
  13. 17
      ruoyi-code/src/main/java/com/ruoyi/code/warning/mapper/WaMessageMapper.java
  14. 18
      ruoyi-code/src/main/java/com/ruoyi/code/warning/mapper/WaThresholdMapper.java
  15. 22
      ruoyi-code/src/main/java/com/ruoyi/code/warning/service/IWaAlarmService.java
  16. 21
      ruoyi-code/src/main/java/com/ruoyi/code/warning/service/IWaEmpMsgService.java
  17. 24
      ruoyi-code/src/main/java/com/ruoyi/code/warning/service/IWaEmployeeService.java
  18. 35
      ruoyi-code/src/main/java/com/ruoyi/code/warning/service/IWaMessageService.java
  19. 22
      ruoyi-code/src/main/java/com/ruoyi/code/warning/service/IWaThresholdService.java
  20. 39
      ruoyi-code/src/main/java/com/ruoyi/code/warning/service/impl/WaAlarmServiceImpl.java
  21. 33
      ruoyi-code/src/main/java/com/ruoyi/code/warning/service/impl/WaEmpMsgServiceImpl.java
  22. 59
      ruoyi-code/src/main/java/com/ruoyi/code/warning/service/impl/WaEmployeeServiceImpl.java
  23. 90
      ruoyi-code/src/main/java/com/ruoyi/code/warning/service/impl/WaMessageServiceImpl.java
  24. 36
      ruoyi-code/src/main/java/com/ruoyi/code/warning/service/impl/WaThresholdServiceImpl.java
  25. 15
      ruoyi-code/src/main/resources/mapper/warning/WaEmpMsgMapper.xml
  26. 5
      ruoyi-code/src/main/resources/mapper/warning/WaMessageMapper.xml

98
ruoyi-code/src/main/java/com/ruoyi/code/warning/controller/WaAlarmController.java

@ -0,0 +1,98 @@
package com.ruoyi.code.warning.controller;
import com.ruoyi.code.warning.domain.WaAlarm;
import com.ruoyi.code.warning.service.IWaAlarmService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.R;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 预警管理Controller
*
* @author ruoyi
* @date 2022-09-19
*/
@RestController
@RequestMapping("/warning/alarm")
public class WaAlarmController extends BaseController
{
@Resource
private IWaAlarmService waAlarmService;
/**
* 查询列表
*/
@PreAuthorize("@ss.hasPermi('warning:alarm:list')")
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params){
return waAlarmService.queryPage(params);
}
/**
* 获取详细信息
*/
@RequestMapping("/info/{id}")
@PreAuthorize("@ss.hasPermi('warning:alarm:query')")
public R info(@PathVariable("id") Long id){
WaAlarm waAlarm = waAlarmService.getById(id);
return R.ok().put("data", waAlarm);
}
/**
* 导出列表
*/
@PreAuthorize("@ss.hasPermi('warning:alarm:export')")
@Log(title = "列表", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WaAlarm waAlarm)
{
List<WaAlarm> list = waAlarmService.list();
ExcelUtil<WaAlarm> util = new ExcelUtil<WaAlarm>(WaAlarm.class);
util.exportExcel(response, list, "列表数据");
}
/**
* 新增
*/
@RequestMapping("/add")
@Log(title = "WaAlarm", businessType = BusinessType.INSERT)
@PreAuthorize("@ss.hasPermi('warning:alarm:add')")
public R add(@RequestBody WaAlarm waAlarm){
waAlarmService.save(waAlarm);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/edit")
@PreAuthorize("@ss.hasPermi('warning:alarm:edit')")
@Log(title = "WaAlarm", businessType = BusinessType.UPDATE)
public R edit(@RequestBody WaAlarm waAlarm){
waAlarmService.updateById(waAlarm);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete/{ids}")
@PreAuthorize("@ss.hasPermi('warning:alarm:remove')")
@Log(title = "WaAlarm", businessType = BusinessType.DELETE)
public R delete(@PathVariable Long[] ids){
waAlarmService.removeByIds(Arrays.asList(ids));
return R.ok();
}
}

96
ruoyi-code/src/main/java/com/ruoyi/code/warning/controller/WaEmployeeController.java

@ -0,0 +1,96 @@
package com.ruoyi.code.warning.controller;
import com.ruoyi.code.warning.domain.WaEmployee;
import com.ruoyi.code.warning.service.IWaEmployeeService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.R;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 人员管理Controller
*
* @author ruoyi
* @date 2022-09-19
*/
@RestController
@RequestMapping("/warning/employee")
public class WaEmployeeController extends BaseController
{
@Resource
private IWaEmployeeService waEmployeeService;
/**
* 查询列表
*/
@PreAuthorize("@ss.hasPermi('warning:employee:list')")
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params){
return waEmployeeService.queryPage(params);
}
/**
* 获取详细信息
*/
@RequestMapping("/info/{id}")
@PreAuthorize("@ss.hasPermi('warning:employee:query')")
public R info(@PathVariable("id") Long id){
WaEmployee waEmployee = waEmployeeService.getById(id);
return R.ok().put("data", waEmployee);
}
/**
* 导出列表
*/
@PreAuthorize("@ss.hasPermi('warning:employee:export')")
@Log(title = "列表", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WaEmployee waEmployee)
{
List<WaEmployee> list = waEmployeeService.list();
ExcelUtil<WaEmployee> util = new ExcelUtil<WaEmployee>(WaEmployee.class);
util.exportExcel(response, list, "列表数据");
}
/**
* 新增
*/
@RequestMapping("/add")
@Log(title = "WaEmployee", businessType = BusinessType.INSERT)
@PreAuthorize("@ss.hasPermi('warning:employee:add')")
public R add(@RequestBody WaEmployee waEmployee){
waEmployeeService.save(waEmployee);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/edit")
@PreAuthorize("@ss.hasPermi('warning:employee:edit')")
@Log(title = "WaEmployee", businessType = BusinessType.UPDATE)
public R edit(@RequestBody WaEmployee waEmployee){
waEmployeeService.updateById(waEmployee);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete/{ids}")
@PreAuthorize("@ss.hasPermi('warning:employee:remove')")
@Log(title = "WaEmployee", businessType = BusinessType.DELETE)
public R delete(@PathVariable Long[] ids){
return waEmployeeService.delByIds(Arrays.asList(ids));
}
}

96
ruoyi-code/src/main/java/com/ruoyi/code/warning/controller/WaMessageController.java

@ -0,0 +1,96 @@
package com.ruoyi.code.warning.controller;
import com.ruoyi.code.warning.domain.WaMessage;
import com.ruoyi.code.warning.service.IWaMessageService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.R;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 短信管理Controller
*
* @author ruoyi
* @date 2022-09-19
*/
@RestController
@RequestMapping("/warning/message")
public class WaMessageController extends BaseController
{
@Resource
private IWaMessageService waMessageService;
/**
* 查询列表
*/
@PreAuthorize("@ss.hasPermi('warning:message:list')")
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params){
return waMessageService.queryPage(params);
}
/**
* 获取详细信息
*/
@RequestMapping("/info/{id}")
@PreAuthorize("@ss.hasPermi('warning:message:query')")
public R info(@PathVariable("id") Long id){
WaMessage waMessage = waMessageService.selectById(id);
return R.ok().put("data", waMessage);
}
/**
* 导出列表
*/
@PreAuthorize("@ss.hasPermi('warning:message:export')")
@Log(title = "列表", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WaMessage waMessage)
{
List<WaMessage> list = waMessageService.list();
ExcelUtil<WaMessage> util = new ExcelUtil<WaMessage>(WaMessage.class);
util.exportExcel(response, list, "列表数据");
}
/**
* 新增
*/
@RequestMapping("/add")
@Log(title = "WaMessage", businessType = BusinessType.INSERT)
@PreAuthorize("@ss.hasPermi('warning:message:add')")
public R add(@RequestBody WaMessage waMessage){
return waMessageService.saveMessage(waMessage);
}
/**
* 修改
*/
@RequestMapping("/edit")
@PreAuthorize("@ss.hasPermi('warning:message:edit')")
@Log(title = "WaMessage", businessType = BusinessType.UPDATE)
public R edit(@RequestBody WaMessage waMessage){
waMessageService.updateByMessage(waMessage);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete/{ids}")
@PreAuthorize("@ss.hasPermi('warning:message:remove')")
@Log(title = "WaMessage", businessType = BusinessType.DELETE)
public R delete(@PathVariable Long[] ids){
waMessageService.delByIds(Arrays.asList(ids));
return R.ok();
}
}

106
ruoyi-code/src/main/java/com/ruoyi/code/warning/controller/WaThresholdController.java

@ -0,0 +1,106 @@
package com.ruoyi.code.warning.controller;
import java.util.List;
import java.util.Arrays;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import javax.annotation.Resource;
import com.ruoyi.common.core.page.R;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.code.warning.domain.WaThreshold;
import com.ruoyi.code.warning.service.IWaThresholdService;
import com.ruoyi.common.utils.poi.ExcelUtil;
/**
* 阈值管理Controller
*
* @author ruoyi
* @date 2022-09-19
*/
@RestController
@RequestMapping("/warning/threshold")
public class WaThresholdController extends BaseController
{
@Resource
private IWaThresholdService waThresholdService;
/**
* 查询列表
*/
@PreAuthorize("@ss.hasPermi('warning:threshold:list')")
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params){
return waThresholdService.queryPage(params);
}
/**
* 获取详细信息
*/
@RequestMapping("/info/{id}")
@PreAuthorize("@ss.hasPermi('warning:threshold:query')")
public R info(@PathVariable("id") Long id){
WaThreshold waThreshold = waThresholdService.getById(id);
return R.ok().put("data", waThreshold);
}
/**
* 导出列表
*/
@PreAuthorize("@ss.hasPermi('warning:threshold:export')")
@Log(title = "列表", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WaThreshold waThreshold)
{
List<WaThreshold> list = waThresholdService.list();
ExcelUtil<WaThreshold> util = new ExcelUtil<WaThreshold>(WaThreshold.class);
util.exportExcel(response, list, "列表数据");
}
/**
* 新增
*/
@RequestMapping("/add")
@Log(title = "WaThreshold", businessType = BusinessType.INSERT)
@PreAuthorize("@ss.hasPermi('warning:threshold:add')")
public R add(@RequestBody WaThreshold waThreshold){
waThresholdService.save(waThreshold);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/edit")
@PreAuthorize("@ss.hasPermi('warning:threshold:edit')")
@Log(title = "WaThreshold", businessType = BusinessType.UPDATE)
public R edit(@RequestBody WaThreshold waThreshold){
waThresholdService.updateById(waThreshold);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete/{ids}")
@PreAuthorize("@ss.hasPermi('warning:threshold:remove')")
@Log(title = "WaThreshold", businessType = BusinessType.DELETE)
public R delete(@PathVariable Long[] ids){
waThresholdService.removeByIds(Arrays.asList(ids));
return R.ok();
}
}

41
ruoyi-code/src/main/java/com/ruoyi/code/warning/domain/WaAlarm.java

@ -0,0 +1,41 @@
package com.ruoyi.code.warning.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 预警管理对象 wa_alarm
*
* @author ruoyi
* @date 2022-09-19
*/
@Data
@TableName("wa_alarm")
public class WaAlarm implements Serializable
{
private static final long serialVersionUID = 1L;
/** 预警id */
@TableId(type = IdType.INPUT)
private Long id;
/** 测站id */
private Long stnmId;
/** 预警内容 */
private String alarmContent;
/** 预警时间 */
private Date alarmTime;
/** 0 未删除 1 删除 */
// @TableLogic
private Long deleted;
}

36
ruoyi-code/src/main/java/com/ruoyi/code/warning/domain/WaEmpMsg.java

@ -0,0 +1,36 @@
package com.ruoyi.code.warning.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableId;
import com.ruoyi.common.annotation.Excel;
import java.io.Serializable;
import lombok.Data;
/**
* 短信人员对象 wa_emp_msg
*
* @author ruoyi
* @date 2022-09-20
*/
@Data
@TableName("wa_emp_msg")
public class WaEmpMsg implements Serializable
{
private static final long serialVersionUID = 1L;
/** id */
@TableId(type = IdType.INPUT)
private Long id;
/** 人员id */
private Long empId;
/** 消息id */
private Long msgId;
}

39
ruoyi-code/src/main/java/com/ruoyi/code/warning/domain/WaEmployee.java

@ -0,0 +1,39 @@
package com.ruoyi.code.warning.domain;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.io.Serializable;
/**
* 人员管理对象 wa_employee
*
* @author ruoyi
* @date 2022-09-19
*/
@Data
@TableName("wa_employee")
public class WaEmployee implements Serializable
{
private static final long serialVersionUID = 1L;
/** id */
@TableId(type = IdType.INPUT)
private Long id;
/** 姓名 */
private String name;
/** 手机号 */
private Long phone;
/** 备注 */
private String remarks;
/** 0 未删除 1 删除 */
// @TableLogic
private Long deleted;
}

50
ruoyi-code/src/main/java/com/ruoyi/code/warning/domain/WaMessage.java

@ -0,0 +1,50 @@
package com.ruoyi.code.warning.domain;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 短信管理对象 wa_message
*
* @author ruoyi
* @date 2022-09-19
*/
@Data
@TableName("wa_message")
public class WaMessage implements Serializable
{
private static final long serialVersionUID = 1L;
/** 短信id */
@TableId(value = "id",type = IdType.AUTO)
private Long id;
/** 短信名称 */
private String msgName;
/** 短信内容 */
private String msgContent;
/** 发送时间 */
private Date sendTime;
/** 消息状态 */
private String sendStaus;
/** 测站id */
private Long stnmId;
/** 人员id */
@TableField(exist = false)
private Long empId;
/** 0 未删除 1 删除 */
// @TableLogic
private Long deleted;
}

40
ruoyi-code/src/main/java/com/ruoyi/code/warning/domain/WaThreshold.java

@ -0,0 +1,40 @@
package com.ruoyi.code.warning.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
/**
* 阈值管理对象 wa_threshold
*
* @author ruoyi
* @date 2022-09-19
*/
@Data
@TableName("wa_threshold")
public class WaThreshold implements Serializable
{
private static final long serialVersionUID = 1L;
/** 阈值id */
@TableId(type = IdType.INPUT)
private Long id;
/** 阈值一级 */
private String thresholdLevelL;
/** 阈值二级 */
private String thresholdLevelLl;
/** 阈值三级 */
private String thresholdLevelLll;
/** 测站id */
private Long stnmId;
}

17
ruoyi-code/src/main/java/com/ruoyi/code/warning/mapper/WaAlarmMapper.java

@ -0,0 +1,17 @@
package com.ruoyi.code.warning.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import com.ruoyi.code.warning.domain.WaAlarm;
/**
* Mapper接口
*
* @author ruoyi
* @date 2022-09-19
*/
@Mapper
public interface WaAlarmMapper extends BaseMapper<WaAlarm>
{
}

23
ruoyi-code/src/main/java/com/ruoyi/code/warning/mapper/WaEmpMsgMapper.java

@ -0,0 +1,23 @@
package com.ruoyi.code.warning.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.code.warning.domain.WaEmpMsg;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* Mapper接口
*
* @author ruoyi
* @date 2022-09-20
*/
@Mapper
public interface WaEmpMsgMapper extends BaseMapper<WaEmpMsg>
{
boolean saveMessageAndStation(@Param("empId")Long empId, @Param("msgId")Long msgId);
Long selectEmpIdByMsgId(Long msgId);
WaEmpMsg selectByMsgId(Long id);
}

18
ruoyi-code/src/main/java/com/ruoyi/code/warning/mapper/WaEmployeeMapper.java

@ -0,0 +1,18 @@
package com.ruoyi.code.warning.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import com.ruoyi.code.warning.domain.WaEmployee;
/**
* Mapper接口
*
* @author ruoyi
* @date 2022-09-19
*/
@Mapper
public interface WaEmployeeMapper extends BaseMapper<WaEmployee>
{
}

17
ruoyi-code/src/main/java/com/ruoyi/code/warning/mapper/WaMessageMapper.java

@ -0,0 +1,17 @@
package com.ruoyi.code.warning.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.code.warning.domain.WaMessage;
import org.apache.ibatis.annotations.Mapper;
/**
* Mapper接口
*
* @author ruoyi
* @date 2022-09-19
*/
@Mapper
public interface WaMessageMapper extends BaseMapper<WaMessage>
{
}

18
ruoyi-code/src/main/java/com/ruoyi/code/warning/mapper/WaThresholdMapper.java

@ -0,0 +1,18 @@
package com.ruoyi.code.warning.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import com.ruoyi.code.warning.domain.WaThreshold;
/**
* Mapper接口
*
* @author ruoyi
* @date 2022-09-19
*/
@Mapper
public interface WaThresholdMapper extends BaseMapper<WaThreshold>
{
}

22
ruoyi-code/src/main/java/com/ruoyi/code/warning/service/IWaAlarmService.java

@ -0,0 +1,22 @@
package com.ruoyi.code.warning.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.code.warning.domain.WaAlarm;
import com.ruoyi.common.core.page.R;
import java.util.Map;
/**
* Service接口
*
* @author ruoyi
* @date 2022-09-19
*/
public interface IWaAlarmService extends IService<WaAlarm>
{
/**
* 查询
*/
R queryPage(Map<String, Object> params);
}

21
ruoyi-code/src/main/java/com/ruoyi/code/warning/service/IWaEmpMsgService.java

@ -0,0 +1,21 @@
package com.ruoyi.code.warning.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.page.R;
import java.util.Map;
import com.ruoyi.code.warning.domain.WaEmpMsg;
/**
* Service接口
*
* @author ruoyi
* @date 2022-09-20
*/
public interface IWaEmpMsgService extends IService<WaEmpMsg>
{
/**
* 查询
*/
R queryPage(Map<String, Object> params);
}

24
ruoyi-code/src/main/java/com/ruoyi/code/warning/service/IWaEmployeeService.java

@ -0,0 +1,24 @@
package com.ruoyi.code.warning.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.code.warning.domain.WaEmployee;
import com.ruoyi.common.core.page.R;
import java.util.List;
import java.util.Map;
/**
* Service接口
*
* @author ruoyi
* @date 2022-09-19
*/
public interface IWaEmployeeService extends IService<WaEmployee>
{
/**
* 查询
*/
R queryPage(Map<String, Object> params);
R delByIds(List<Long> asList);
}

35
ruoyi-code/src/main/java/com/ruoyi/code/warning/service/IWaMessageService.java

@ -0,0 +1,35 @@
package com.ruoyi.code.warning.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.code.warning.domain.WaMessage;
import com.ruoyi.common.core.page.R;
import java.util.List;
import java.util.Map;
/**
* Service接口
*
* @author ruoyi
* @date 2022-09-19
*/
public interface IWaMessageService extends IService<WaMessage>
{
/**
* 查询
*/
R queryPage(Map<String, Object> params);
/**
* 保存短信
* @param waMessage
* @return
*/
R saveMessage(WaMessage waMessage);
WaMessage selectById(Long id);
void updateByMessage(WaMessage waMessage);
void delByIds(List<Long> asList);
}

22
ruoyi-code/src/main/java/com/ruoyi/code/warning/service/IWaThresholdService.java

@ -0,0 +1,22 @@
package com.ruoyi.code.warning.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.code.warning.domain.WaThreshold;
import com.ruoyi.common.core.page.R;
import java.util.Map;
/**
* Service接口
*
* @author ruoyi
* @date 2022-09-19
*/
public interface IWaThresholdService extends IService<WaThreshold>
{
/**
* 查询
*/
R queryPage(Map<String, Object> params);
}

39
ruoyi-code/src/main/java/com/ruoyi/code/warning/service/impl/WaAlarmServiceImpl.java

@ -0,0 +1,39 @@
package com.ruoyi.code.warning.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.code.warning.domain.WaAlarm;
import com.ruoyi.code.warning.mapper.WaAlarmMapper;
import com.ruoyi.code.warning.service.IWaAlarmService;
import com.ruoyi.common.core.page.R;
import com.ruoyi.common.utils.Query;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* Service业务层处理
*
* @author ruoyi
* @date 2022-09-19
*/
@Service("waAlarmService")
public class WaAlarmServiceImpl extends ServiceImpl<WaAlarmMapper, WaAlarm> implements IWaAlarmService
{
@Override
public R queryPage(Map<String, Object> params) {
Object stnmId = params.get("stnmId");
Object alarmTime = params.get("alarmTime");
IPage<WaAlarm> page = this.page(
new Query<WaAlarm>().getPage(params),
new QueryWrapper<WaAlarm>()
.eq(StringUtils.isNotNull(stnmId),"stnm_id",stnmId)
.eq(StringUtils.isNotNull(alarmTime),"alarm_time",alarmTime)
);
return R.ok().put("count", page.getTotal()).put("data", page.getRecords());
}
}

33
ruoyi-code/src/main/java/com/ruoyi/code/warning/service/impl/WaEmpMsgServiceImpl.java

@ -0,0 +1,33 @@
package com.ruoyi.code.warning.service.impl;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.page.R;
import com.ruoyi.common.utils.Query;
import org.springframework.stereotype.Service;
import com.ruoyi.code.warning.mapper.WaEmpMsgMapper;
import com.ruoyi.code.warning.domain.WaEmpMsg;
import com.ruoyi.code.warning.service.IWaEmpMsgService;
/**
* Service业务层处理
*
* @author ruoyi
* @date 2022-09-20
*/
@Service("waEmpMsgService")
public class WaEmpMsgServiceImpl extends ServiceImpl<WaEmpMsgMapper, WaEmpMsg> implements IWaEmpMsgService
{
@Override
public R queryPage(Map<String, Object> params) {
IPage<WaEmpMsg> page = this.page(
new Query<WaEmpMsg>().getPage(params),
new QueryWrapper<WaEmpMsg>()
);
return R.ok().put("count", page.getTotal()).put("data", page.getRecords());
}
}

59
ruoyi-code/src/main/java/com/ruoyi/code/warning/service/impl/WaEmployeeServiceImpl.java

@ -0,0 +1,59 @@
package com.ruoyi.code.warning.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.code.warning.domain.WaEmpMsg;
import com.ruoyi.code.warning.domain.WaEmployee;
import com.ruoyi.code.warning.mapper.WaEmpMsgMapper;
import com.ruoyi.code.warning.mapper.WaEmployeeMapper;
import com.ruoyi.code.warning.service.IWaEmployeeService;
import com.ruoyi.common.core.page.R;
import com.ruoyi.common.utils.Query;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* Service业务层处理
*
* @author ruoyi
* @date 2022-09-19
*/
@Service("waEmployeeService")
public class WaEmployeeServiceImpl extends ServiceImpl<WaEmployeeMapper, WaEmployee> implements IWaEmployeeService
{
@Autowired
private WaEmpMsgMapper waEmpMsgMapper;
@Override
public R queryPage(Map<String, Object> params) {
Object name = params.get("name");
Object phone = params.get("phone");
IPage<WaEmployee> page = this.page(
new Query<WaEmployee>().getPage(params),
new QueryWrapper<WaEmployee>()
.like(ObjectUtils.isNotEmpty(name),"name",name)
.eq(ObjectUtils.isNotEmpty(phone),"phone",phone)
);
return R.ok().put("count", page.getTotal()).put("data", page.getRecords());
}
@Override
public R delByIds(List<Long> asList) {
if (asList.size() > 0){
List<WaEmpMsg> list = waEmpMsgMapper.selectList(new LambdaQueryWrapper<WaEmpMsg>()
.in(WaEmpMsg::getEmpId, asList));
if (list.size() == 0) {
baseMapper.deleteBatchIds(asList);
return R.ok();
}
}
return R.error("该用户有短信消息,不能删除!");
}
}

90
ruoyi-code/src/main/java/com/ruoyi/code/warning/service/impl/WaMessageServiceImpl.java

@ -0,0 +1,90 @@
package com.ruoyi.code.warning.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.code.warning.domain.WaEmpMsg;
import com.ruoyi.code.warning.domain.WaMessage;
import com.ruoyi.code.warning.mapper.WaEmpMsgMapper;
import com.ruoyi.code.warning.mapper.WaMessageMapper;
import com.ruoyi.code.warning.service.IWaMessageService;
import com.ruoyi.common.core.page.R;
import com.ruoyi.common.utils.Query;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
/**
* Service业务层处理
*
* @author ruoyi
* @date 2022-09-19
*/
@Service("waMessageService")
public class WaMessageServiceImpl extends ServiceImpl<WaMessageMapper, WaMessage> implements IWaMessageService
{
@Autowired
private WaEmpMsgMapper waEmpMsgMapper;
@Override
public R queryPage(Map<String, Object> params) {
Object stnmId = params.get("stnmId");
Object sendTime = params.get("sendTime");
Object sendStatus = params.get("sendStatus");
IPage<WaMessage> page = this.page(
new Query<WaMessage>().getPage(params),
new QueryWrapper<WaMessage>()
.eq(ObjectUtils.isNotEmpty(stnmId),"stnm_id",stnmId)
.eq(ObjectUtils.isNotEmpty(sendTime),"send_time",sendTime)
.eq(ObjectUtils.isNotEmpty(sendStatus),"send_status",sendStatus)
);
return R.ok().put("count", page.getTotal()).put("data", page.getRecords());
}
@Override
@Transactional
public R saveMessage(WaMessage waMessage) {
int result = baseMapper.insert(waMessage);
System.out.println(waMessage.getId());
if (result > 0){
boolean flag = waEmpMsgMapper.saveMessageAndStation(waMessage.getEmpId(),waMessage.getId());
if(flag){
return R.ok();
}
}
return R.error();
}
@Override
public WaMessage selectById(Long id) {
WaMessage waMessage = baseMapper.selectById(id);
Long msgId = waMessage.getId();
Long empId = waEmpMsgMapper.selectEmpIdByMsgId(msgId);
waMessage.setEmpId(empId);
return waMessage;
}
@Override
public void updateByMessage(WaMessage waMessage) {
baseMapper.updateById(waMessage);
Long empId = waMessage.getEmpId();
WaEmpMsg waEmpMsg = waEmpMsgMapper.selectByMsgId(waMessage.getId());
waEmpMsg.setEmpId(empId);
waEmpMsgMapper.updateById(waEmpMsg);
}
@Override
public void delByIds(List<Long> asList) {
baseMapper.deleteBatchIds(asList);
waEmpMsgMapper.delete(new LambdaQueryWrapper<WaEmpMsg>()
.in(WaEmpMsg::getMsgId,asList));
}
}

36
ruoyi-code/src/main/java/com/ruoyi/code/warning/service/impl/WaThresholdServiceImpl.java

@ -0,0 +1,36 @@
package com.ruoyi.code.warning.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.code.warning.domain.WaThreshold;
import com.ruoyi.code.warning.mapper.WaThresholdMapper;
import com.ruoyi.code.warning.service.IWaThresholdService;
import com.ruoyi.common.core.page.R;
import com.ruoyi.common.utils.Query;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* Service业务层处理
*
* @author ruoyi
* @date 2022-09-19
*/
@Service("waThresholdService")
public class WaThresholdServiceImpl extends ServiceImpl<WaThresholdMapper, WaThreshold> implements IWaThresholdService
{
@Override
public R queryPage(Map<String, Object> params) {
IPage<WaThreshold> page = this.page(
new Query<WaThreshold>().getPage(params),
new QueryWrapper<WaThreshold>()
.eq(ObjectUtils.isNotEmpty(params.get("stnmId")),"stnm_id",params.get("stnmId"))
);
return R.ok().put("count", page.getTotal()).put("data", page.getRecords());
}
}

15
ruoyi-code/src/main/resources/mapper/warning/WaEmpMsgMapper.xml

@ -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.ruoyi.code.warning.mapper.WaEmpMsgMapper">
<insert id="saveMessageAndStation">
insert into wa_emp_msg(emp_id,msg_id) value(#{empId},#{msgId})
</insert>
<select id="selectEmpIdByMsgId" resultType="java.lang.Long">
select emp_id from wa_emp_msg where msg_id = #{msgId}
</select>
<select id="selectByMsgId" resultType="com.ruoyi.code.warning.domain.WaEmpMsg">
select * from wa_emp_msg where msg_id = #{msgId}
</select>
</mapper>

5
ruoyi-code/src/main/resources/mapper/warning/WaMessageMapper.xml

@ -0,0 +1,5 @@
<?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.ruoyi.code.warning.mapper.WaMessageMapper">
</mapper>
Loading…
Cancel
Save