Browse Source

信件初筛init

dev_ycq
21819 2 years ago
parent
commit
6ec444618b
  1. 110
      mailbox-lan/src/main/java/com/biutag/lan/controller/SiftMailController.java
  2. 7
      mailbox-lan/src/main/java/com/biutag/lan/entity/CJD.java
  3. 7
      mailbox-lan/src/main/java/com/biutag/lan/entity/FKD.java
  4. 7
      mailbox-lan/src/main/java/com/biutag/lan/entity/JJD.java
  5. 83
      mailbox-lan/src/main/java/com/biutag/lan/entity/Mail.java
  6. 9
      mailbox-lan/src/main/java/com/biutag/lan/mapper/CJDMapper.java
  7. 9
      mailbox-lan/src/main/java/com/biutag/lan/mapper/FKDMapper.java
  8. 9
      mailbox-lan/src/main/java/com/biutag/lan/mapper/JJDMapper.java
  9. 9
      mailbox-lan/src/main/java/com/biutag/lan/mapper/MailMapper.java
  10. 10
      mailbox-lan/src/main/java/com/biutag/lan/service/CJDService.java
  11. 10
      mailbox-lan/src/main/java/com/biutag/lan/service/FKDService.java
  12. 10
      mailbox-lan/src/main/java/com/biutag/lan/service/JJDService.java
  13. 13
      mailbox-lan/src/main/java/com/biutag/lan/service/MailService.java
  14. 24
      mailbox-lan/src/main/java/com/biutag/lan/util/PolyMailUtil.java

110
mailbox-lan/src/main/java/com/biutag/lan/controller/SiftMailController.java

@ -0,0 +1,110 @@
package com.biutag.lan.controller;
import com.biutag.lan.entity.Mail;
import com.biutag.lan.mapper.MailMapper;
import com.biutag.lan.service.MailService;
import com.biutag.lan.util.PolyMailUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
@RequiredArgsConstructor
@RequestMapping("/sift-mail")
@RestController
public class SiftMailController {
private final MailService mailService;
private final MailMapper mailMapper;
private List<Mail> mailList = PolyMailUtil.getMails();
private List<Mail> removeMailList;
/**
* 获取来源的所有信件
*
* @return 当前来源的所有信件列表
*/
@RequestMapping("/{type}")
public List<Mail> getMails(@PathVariable String type) {
List<Mail> result = new ArrayList<>();
for (Mail mail : mailList)
if (mail.getSource().equals(type))
result.add(mail);
return result;
// return mailMapper.selectList(new QueryWrapper<Mail>().eq("type", type));
}
/**
* 依照输入条件使用QueryWrapper进行查询
*
* @param sender 输入
* @return 自定义条件筛选后的邮箱列表
*/
@RequestMapping("/{type}/search-by")
public List<Mail> getMailsBySender(@PathVariable String type, String sender) {
List<Mail> result = new ArrayList<>();
if (type != null) {
for (Mail mail : mailList) {
if (mail.getContactName().equals(sender) && mail.getSource().equals(type))
result.add(mail);
}
}
return result;
// QueryWrapper<Mail> queryWrapper = new QueryWrapper<>();
// queryWrapper.eq("type", type).eq("sender", sender);
// return mailService.list(queryWrapper);
}
/**
* 单个信件的详细信息
*
* @param id 信件id
* @return 单个信件实体
*/
@RequestMapping("/{type}/mail-detail/{id}")
public Mail getMailDetail(@PathVariable String type, @PathVariable String id) {
if (type != null) {
for (Mail mail : mailList) {
if (mail.getId().equals(id) && mail.getSource().equals(type)) {
return mail;
}
}
// Mail mail = mailMapper.selectById(id);
// return mail;
}
return null;
}
/**
* 使用逻辑删除字段移入对应剔除栏
*
* @param type 来源类别
* @param id 信件id
*/
@RequestMapping("/{type}/mail-remove/{id}")
public void removeMail(@PathVariable String type, @PathVariable String id) {
if (type != null) {
for (Mail mail : mailList) {
if (mail.getId().equals(id) && mail.getSource().equals(type)) {
mail.setDeleted(1);
removeMailList.add(mail);
}
}
}
// Mail mail = mailMapper.selectById(id);
// mail.setDeleted(1);
// return mail;
}
@RequestMapping("/{type}/send2work/{id}")
public void sendMail(@PathVariable String type, @PathVariable String id) {
for (Mail mail : removeMailList)
mailMapper.insert(mail);
// Mail mail = mailMapper.selectById(id);
// mailMapper.insert(mail);
System.out.println("Send OK");
}
}

7
mailbox-lan/src/main/java/com/biutag/lan/entity/CJD.java

@ -0,0 +1,7 @@
package com.biutag.lan.entity;
import lombok.Data;
@Data
public class CJD {
}

7
mailbox-lan/src/main/java/com/biutag/lan/entity/FKD.java

@ -0,0 +1,7 @@
package com.biutag.lan.entity;
import lombok.Data;
@Data
public class FKD {
}

7
mailbox-lan/src/main/java/com/biutag/lan/entity/JJD.java

@ -0,0 +1,7 @@
package com.biutag.lan.entity;
import lombok.Data;
@Data
public class JJD {
}

83
mailbox-lan/src/main/java/com/biutag/lan/entity/Mail.java

@ -0,0 +1,83 @@
package com.biutag.lan.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data;
import java.util.Date;
@Data
public class Mail {
@TableId
private String id;
/**
* 联系人姓名
*/
private String contactName;
/**
* 联系人性别
*/
private String contactSex;
/**
* 联系人身份证号码
*/
private String contactIdCard;
/**
*
*/
private String contactPhone;
/**
* 案件编号
*/
private String caseNumber;
/**
* 内容
*/
private String content;
/**
* 附件
*/
private String attachments;
/**
* 用户ID
*/
private Integer userId;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 评价
*/
private String evaluate;
/**
* 是否满意
*/
private String satisfiedFlag;
/**
* 信件来源
*/
private String source;
/**
* 逻辑删除
*/
@TableLogic
private Integer deleted;
}

9
mailbox-lan/src/main/java/com/biutag/lan/mapper/CJDMapper.java

@ -0,0 +1,9 @@
package com.biutag.lan.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.biutag.lan.entity.CJD;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CJDMapper extends BaseMapper<CJD> {
}

9
mailbox-lan/src/main/java/com/biutag/lan/mapper/FKDMapper.java

@ -0,0 +1,9 @@
package com.biutag.lan.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.biutag.lan.entity.FKD;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface FKDMapper extends BaseMapper<FKD> {
}

9
mailbox-lan/src/main/java/com/biutag/lan/mapper/JJDMapper.java

@ -0,0 +1,9 @@
package com.biutag.lan.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.biutag.lan.entity.JJD;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface JJDMapper extends BaseMapper<JJD> {
}

9
mailbox-lan/src/main/java/com/biutag/lan/mapper/MailMapper.java

@ -0,0 +1,9 @@
package com.biutag.lan.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.biutag.lan.entity.Mail;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface MailMapper extends BaseMapper<Mail> {
}

10
mailbox-lan/src/main/java/com/biutag/lan/service/CJDService.java

@ -0,0 +1,10 @@
package com.biutag.lan.service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.biutag.lan.entity.CJD;
import com.biutag.lan.mapper.CJDMapper;
import org.springframework.stereotype.Service;
@Service
public class CJDService extends ServiceImpl<CJDMapper, CJD> {
}

10
mailbox-lan/src/main/java/com/biutag/lan/service/FKDService.java

@ -0,0 +1,10 @@
package com.biutag.lan.service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.biutag.lan.entity.FKD;
import com.biutag.lan.mapper.FKDMapper;
import org.springframework.stereotype.Service;
@Service
public class FKDService extends ServiceImpl<FKDMapper, FKD> {
}

10
mailbox-lan/src/main/java/com/biutag/lan/service/JJDService.java

@ -0,0 +1,10 @@
package com.biutag.lan.service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.biutag.lan.entity.JJD;
import com.biutag.lan.mapper.JJDMapper;
import org.springframework.stereotype.Service;
@Service
public class JJDService extends ServiceImpl<JJDMapper, JJD> {
}

13
mailbox-lan/src/main/java/com/biutag/lan/service/MailService.java

@ -0,0 +1,13 @@
package com.biutag.lan.service;
import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.biutag.lan.entity.Mail;
import com.biutag.lan.mapper.MailMapper;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class MailService extends ServiceImpl<MailMapper, Mail> {
}

24
mailbox-lan/src/main/java/com/biutag/lan/util/PolyMailUtil.java

@ -0,0 +1,24 @@
package com.biutag.lan.util;
import com.biutag.lan.entity.Mail;
import com.biutag.lan.service.CJDService;
import com.biutag.lan.service.FKDService;
import com.biutag.lan.service.JJDService;
import lombok.RequiredArgsConstructor;
import java.util.ArrayList;
import java.util.List;
/**
* 将对接来的数据合并成信件格式
*/
@RequiredArgsConstructor
public class PolyMailUtil {
private final CJDService cjdService;
private final FKDService fkdService;
private final JJDService jjdService;
public static List<Mail> getMails() {
return new ArrayList<>();
}
}
Loading…
Cancel
Save