parent
0e78425c8e
commit
f66c54dde1
@ -0,0 +1,114 @@
|
||||
package cn.jyjz.xiaoyao.ocr.controller;
|
||||
|
||||
import cn.jyjz.xiaoyao.common.base.util.StringUtils;
|
||||
import cn.jyjz.xiaoyao.oa.from.dataobject.Candidateuser;
|
||||
import cn.jyjz.xiaoyao.ocr.dataobject.OcrMsg;
|
||||
import cn.jyjz.xiaoyao.ocr.dataobject.OcrMsgRead;
|
||||
import cn.jyjz.xiaoyao.ocr.service.IOcrMsgService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import cn.jyjz.xiaoyao.ocr.service.IOcrMsgReadService;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* ocr控制器
|
||||
*
|
||||
* @author 你的肉
|
||||
* @Date 2024-03-13 20:21:38
|
||||
*/
|
||||
@CrossOrigin
|
||||
@RestController
|
||||
@RequestMapping("/ocr/msg")
|
||||
public class OcrMsgReadController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private IOcrMsgReadService ocrMsgReadService;
|
||||
|
||||
@Autowired
|
||||
private IOcrMsgService iocrmsgservice;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param map
|
||||
* @param map start 起始页
|
||||
* @param map limit 每页显示多少条 默认10 条
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "系统消息分页", notes = "系统消息分页")
|
||||
@RequestMapping(value = "/systempage", method = RequestMethod.GET)
|
||||
public ResponseEntity<?> systempage(@RequestBody Map<String, String> map) {
|
||||
|
||||
IPage<OcrMsg> iPage = new Page<>(Integer.valueOf(map.get("start")),Integer.valueOf(map.get("limit")));
|
||||
|
||||
|
||||
QueryWrapper<OcrMsg> wrapper = new QueryWrapper<>();
|
||||
wrapper.select("id","titile","sender","bus_json","send_time").eq("msg_category",map.get("msgCategory")).eq("send_status","1").eq("send_status","2").apply(map.get("receiveUser"),"receive_user_ids");
|
||||
// if(!StringUtils.isEmpty(map.get("productsId"))) {
|
||||
// }
|
||||
//执行查询方法
|
||||
|
||||
IPage<OcrMsg> page = this.iocrmsgservice.page(iPage,wrapper);
|
||||
|
||||
|
||||
|
||||
return new ResponseEntity<Object>(page,HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询 单条 信息
|
||||
*
|
||||
* @param id
|
||||
* @param id 编号
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "消息详情", notes = "消息详情")
|
||||
@RequestMapping(value = "/msgOne", method = RequestMethod.GET)
|
||||
public ResponseEntity<?> msgOne(@RequestParam(value = "id", required = false)String id) {
|
||||
|
||||
QueryWrapper<OcrMsg> wrapper = new QueryWrapper<>();
|
||||
wrapper.select("titile","msg_content","sender","msg_category","send_time");
|
||||
wrapper.eq("id", id);
|
||||
//执行查询方法
|
||||
OcrMsg one = iocrmsgservice.getOne(wrapper);
|
||||
|
||||
return new ResponseEntity<Object>(one,HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加
|
||||
* @param listMsgRead
|
||||
* @param listMsgRead
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "消除未读", notes = "消除未读")
|
||||
@RequestMapping(value = "eliminateUnread", method = RequestMethod.POST)
|
||||
public ResponseEntity<?> eliminateUnread(@RequestBody List<OcrMsgRead> listMsgRead) {
|
||||
List<OcrMsgRead> listCa = new ArrayList<>();
|
||||
for(OcrMsgRead list:listMsgRead){
|
||||
list.setReadTime(System.currentTimeMillis());
|
||||
listCa.add(list);
|
||||
}
|
||||
boolean save = ocrMsgReadService.saveBatch(listCa);
|
||||
//此处需要手工处理 返回需要将修改后的数据返回
|
||||
return new ResponseEntity<Object>(save,HttpStatus.CREATED);
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package cn.jyjz.xiaoyao.ocr.dataDao;
|
||||
|
||||
|
||||
import cn.jyjz.xiaoyao.ocr.dataobject.OcrMsg;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 你的肉123
|
||||
* @since 2024-03-13
|
||||
*/
|
||||
@Mapper
|
||||
public interface OcrMsgMapper extends BaseMapper<OcrMsg> {
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package cn.jyjz.xiaoyao.ocr.dataDao;
|
||||
|
||||
import cn.jyjz.xiaoyao.ocr.dataobject.OcrMsgRead;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 你的肉123
|
||||
* @since 2024-03-13
|
||||
*/
|
||||
@Mapper
|
||||
public interface OcrMsgReadMapper extends BaseMapper<OcrMsgRead> {
|
||||
|
||||
}
|
@ -0,0 +1,100 @@
|
||||
package cn.jyjz.xiaoyao.ocr.dataobject;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author 你的肉123
|
||||
* @since 2024-03-13
|
||||
*/
|
||||
@TableName("ocr_msg_read")
|
||||
public class OcrMsgRead extends Model<OcrMsgRead> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
/**
|
||||
* 消息id
|
||||
*/
|
||||
@TableField("msg_id")
|
||||
private Long msgId;
|
||||
/**
|
||||
* 读取用户id
|
||||
*/
|
||||
@TableField("user_id")
|
||||
private Long userId;
|
||||
/**
|
||||
* 1.已读
|
||||
*/
|
||||
@TableField("read_flag")
|
||||
private Integer readFlag;
|
||||
/**
|
||||
* 读取时间戳
|
||||
*/
|
||||
@TableField("read_time")
|
||||
private Long readTime;
|
||||
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getMsgId() {
|
||||
return msgId;
|
||||
}
|
||||
|
||||
public void setMsgId(Long msgId) {
|
||||
this.msgId = msgId;
|
||||
}
|
||||
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Integer getReadFlag() {
|
||||
return readFlag;
|
||||
}
|
||||
|
||||
public void setReadFlag(Integer readFlag) {
|
||||
this.readFlag = readFlag;
|
||||
}
|
||||
|
||||
public Long getReadTime() {
|
||||
return readTime;
|
||||
}
|
||||
|
||||
public void setReadTime(Long readTime) {
|
||||
this.readTime = readTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable pkVal() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OcrMsgRead{" +
|
||||
"id=" + id +
|
||||
", msgId=" + msgId +
|
||||
", userId=" + userId +
|
||||
", readFlag=" + readFlag +
|
||||
", readTime=" + readTime +
|
||||
"}";
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package cn.jyjz.xiaoyao.ocr.service;
|
||||
|
||||
|
||||
import cn.jyjz.xiaoyao.ocr.dataobject.OcrMsgRead;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 你的肉123
|
||||
* @since 2024-03-13
|
||||
*/
|
||||
public interface IOcrMsgReadService extends IService<OcrMsgRead> {
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package cn.jyjz.xiaoyao.ocr.service;
|
||||
|
||||
|
||||
import cn.jyjz.xiaoyao.ocr.dataobject.OcrMsg;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 你的肉123
|
||||
* @since 2024-03-13
|
||||
*/
|
||||
public interface IOcrMsgService extends IService<OcrMsg> {
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package cn.jyjz.xiaoyao.ocr.service.impl;
|
||||
|
||||
import cn.jyjz.xiaoyao.ocr.dataDao.OcrMsgReadMapper;
|
||||
import cn.jyjz.xiaoyao.ocr.dataobject.OcrMsgRead;
|
||||
import cn.jyjz.xiaoyao.ocr.service.IOcrMsgReadService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 你的肉123
|
||||
* @since 2024-03-13
|
||||
*/
|
||||
@Service
|
||||
public class OcrMsgReadServiceImpl extends ServiceImpl<OcrMsgReadMapper, OcrMsgRead> implements IOcrMsgReadService {
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package cn.jyjz.xiaoyao.ocr.service.impl;
|
||||
|
||||
import cn.jyjz.xiaoyao.ocr.dataDao.OcrMsgMapper;
|
||||
import cn.jyjz.xiaoyao.ocr.dataobject.OcrMsg;
|
||||
import cn.jyjz.xiaoyao.ocr.service.IOcrMsgService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 你的肉123
|
||||
* @since 2024-03-13
|
||||
*/
|
||||
@Service
|
||||
public class OcrMsgServiceImpl extends ServiceImpl<OcrMsgMapper, OcrMsg> implements IOcrMsgService {
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
<?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="cn.jyjz.xiaoyao.ocr.dataDao.OcrMsgMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="cn.jyjz.xiaoyao.ocr.dataobject.OcrMsg">
|
||||
<id column="id" property="id" />
|
||||
<result column="titile" property="titile" />
|
||||
<result column="msg_content" property="msgContent" />
|
||||
<result column="sender" property="sender" />
|
||||
<result column="msg_category" property="msgCategory" />
|
||||
<result column="receive_user_type" property="receiveUserType" />
|
||||
<result column="bus_json" property="busJson" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="create_by" property="createBy" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="update_by" property="updateBy" />
|
||||
<result column="receive_user_ids" property="receiveUserIds" />
|
||||
<result column="open_type" property="openType" />
|
||||
<result column="open_page" property="openPage" />
|
||||
<result column="send_status" property="sendStatus" />
|
||||
<result column="send_time" property="sendTime" />
|
||||
<result column="cancel_time" property="cancelTime" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, titile, msg_content AS msgContent, sender, msg_category AS msgCategory, receive_user_type AS receiveUserType, bus_json AS busJson, create_time AS createTime, create_by AS createBy, update_time AS updateTime, update_by AS updateBy, receive_user_ids AS receiveUserIds, open_type AS openType, open_page AS openPage, send_status AS sendStatus, send_time AS sendTime, cancel_time AS cancelTime
|
||||
</sql>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,19 @@
|
||||
<?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="cn.jyjz.xiaoyao.ocr.dataDao.OcrMsgReadMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="cn.jyjz.xiaoyao.ocr.dataobject.OcrMsgRead">
|
||||
<id column="id" property="id" />
|
||||
<result column="msg_id" property="msgId" />
|
||||
<result column="user_id" property="userId" />
|
||||
<result column="read_flag" property="readFlag" />
|
||||
<result column="read_time" property="readTime" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, msg_id AS msgId, user_id AS userId, read_flag AS readFlag, read_time AS readTime
|
||||
</sql>
|
||||
|
||||
</mapper>
|
Loading…
Reference in new issue