diff --git a/mailbox-lan/src/main/java/com/biutag/lan/controller/SiftMailController.java b/mailbox-lan/src/main/java/com/biutag/lan/controller/SiftMailController.java new file mode 100644 index 0000000..a8f51de --- /dev/null +++ b/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 mailList = PolyMailUtil.getMails(); + private List removeMailList; + + /** + * 获取来源的所有信件 + * + * @return 当前来源的所有信件列表 + */ + @RequestMapping("/{type}") + public List getMails(@PathVariable String type) { + List result = new ArrayList<>(); + for (Mail mail : mailList) + if (mail.getSource().equals(type)) + result.add(mail); + + return result; +// return mailMapper.selectList(new QueryWrapper().eq("type", type)); + } + + /** + * 依照输入条件使用QueryWrapper进行查询 + * + * @param sender 输入 + * @return 自定义条件筛选后的邮箱列表 + */ + @RequestMapping("/{type}/search-by") + public List getMailsBySender(@PathVariable String type, String sender) { + List 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 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"); + } +} \ No newline at end of file diff --git a/mailbox-lan/src/main/java/com/biutag/lan/entity/CJD.java b/mailbox-lan/src/main/java/com/biutag/lan/entity/CJD.java new file mode 100644 index 0000000..fa02871 --- /dev/null +++ b/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 { +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/entity/FKD.java b/mailbox-lan/src/main/java/com/biutag/lan/entity/FKD.java new file mode 100644 index 0000000..b1bfd82 --- /dev/null +++ b/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 { +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/entity/JJD.java b/mailbox-lan/src/main/java/com/biutag/lan/entity/JJD.java new file mode 100644 index 0000000..648722c --- /dev/null +++ b/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 { +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/entity/Mail.java b/mailbox-lan/src/main/java/com/biutag/lan/entity/Mail.java new file mode 100644 index 0000000..b498da8 --- /dev/null +++ b/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; +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/mapper/CJDMapper.java b/mailbox-lan/src/main/java/com/biutag/lan/mapper/CJDMapper.java new file mode 100644 index 0000000..d4b3c5e --- /dev/null +++ b/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 { +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/mapper/FKDMapper.java b/mailbox-lan/src/main/java/com/biutag/lan/mapper/FKDMapper.java new file mode 100644 index 0000000..0df1b58 --- /dev/null +++ b/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 { +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/mapper/JJDMapper.java b/mailbox-lan/src/main/java/com/biutag/lan/mapper/JJDMapper.java new file mode 100644 index 0000000..7b71852 --- /dev/null +++ b/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 { +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/mapper/MailMapper.java b/mailbox-lan/src/main/java/com/biutag/lan/mapper/MailMapper.java new file mode 100644 index 0000000..06fae91 --- /dev/null +++ b/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 { +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/CJDService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/CJDService.java new file mode 100644 index 0000000..c14ab0f --- /dev/null +++ b/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 { +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/FKDService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/FKDService.java new file mode 100644 index 0000000..9e799e2 --- /dev/null +++ b/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 { +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/JJDService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/JJDService.java new file mode 100644 index 0000000..346cca7 --- /dev/null +++ b/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 { +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/MailService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/MailService.java new file mode 100644 index 0000000..d566675 --- /dev/null +++ b/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 { +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/util/PolyMailUtil.java b/mailbox-lan/src/main/java/com/biutag/lan/util/PolyMailUtil.java new file mode 100644 index 0000000..c38eb48 --- /dev/null +++ b/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 getMails() { + return new ArrayList<>(); + } +}