feature 1.新增邮箱采集功能

release
zhenghaiyang@ele-cloud.com 2 years ago
parent 38d3257df9
commit 3622e643d6
  1. 26
      dxhy-core/src/main/java/com/dxhy/core/controller/DictDataController.java
  2. 93
      dxhy-core/src/main/java/com/dxhy/core/controller/mailGather/EmailMaintainController.java
  3. 53
      dxhy-core/src/main/java/com/dxhy/core/controller/mailGather/MailGatherLogController.java
  4. 81
      dxhy-core/src/main/java/com/dxhy/core/dao/mailGather/EmailMaintainDao.java
  5. 80
      dxhy-core/src/main/java/com/dxhy/core/dao/mailGather/MailGatherLogDao.java
  6. 29
      dxhy-core/src/main/java/com/dxhy/core/model/mailGather/EmailMaintainVo.java
  7. 29
      dxhy-core/src/main/java/com/dxhy/core/model/mailGather/MailGatherLogVo.java
  8. 48
      dxhy-core/src/main/java/com/dxhy/core/service/mailGather/EmailMaintainService.java
  9. 49
      dxhy-core/src/main/java/com/dxhy/core/service/mailGather/MailGatherLogService.java
  10. 108
      dxhy-core/src/main/java/com/dxhy/core/service/mailGather/impl/EmailMaintainServiceImpl.java
  11. 98
      dxhy-core/src/main/java/com/dxhy/core/service/mailGather/impl/MailGatherLogServiceImpl.java
  12. 11
      dxhy-core/src/main/java/com/dxhy/core/task/SnEmailGatherTask.java
  13. 146
      dxhy-core/src/main/resources/mapper/mailGather/EmailMaintainMapper.xml
  14. 204
      dxhy-core/src/main/resources/mapper/mailGather/MailGatherLogMapper.xml
  15. 36
      dxhy-sign/src/main/java/com/dxhy/sign/controller/SignCheckInvoiceQueryController.java
  16. 43
      dxhy-sign/src/main/java/com/dxhy/sign/controller/SignFpqsController.java

@ -1,23 +1,21 @@
package com.dxhy.core.controller;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.apache.commons.lang3.StringUtils;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSONObject;
import com.dxhy.common.controller.AbstractController;
import com.dxhy.common.service.DictdetaServcice;
import com.dxhy.common.utils.R;
import com.dxhy.common.vo.DictdetaModel;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
* 业务字典
@ -45,4 +43,8 @@ public class DictDataController extends AbstractController {
return ResponseEntity.ok(R.ok().put("data", json));
}
@GetMapping("/test")
public String test(){
return "123";
}
}

@ -0,0 +1,93 @@
package com.dxhy.core.controller.mailGather;
import com.dxhy.common.controller.AbstractController;
import com.dxhy.common.utils.Base64Encoding;
import com.dxhy.common.utils.R;
import com.dxhy.core.model.mailGather.EmailMaintainVo;
import com.dxhy.core.service.mailGather.EmailMaintainService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Map;
/**
* (EmailMaintain)表控制层
*
* @author makejava
* @since 2023-03-23 08:39:46
*/
@RestController
@RequestMapping("emailMaintain")
public class EmailMaintainController extends AbstractController {
/**
* 服务对象
*/
@Resource
private EmailMaintainService emailMaintainService;
/**
* 分页查询
*
* @param pramsMap 筛选条件
* @return 查询结果
*/
@GetMapping("/queryByPage")
public ResponseEntity<R> queryByPage(@RequestBody Map<String, Object> pramsMap) {
// 入参统一在入口处理
pramsMap.put("dbName", getUserInfo().getDbName());
// List<String> gfshList = new ArrayList<>();
// if (!"99".equals(pramsMap.get("gfsh")) && pramsMap.get("gfsh") != null && !"".equals(pramsMap.get("gfsh"))) {
// gfshList.add(pramsMap.get("gfsh").toString());
// } else {
// gfshList = UserInfoUtil.getGfshAll(getUserInfo().getOrg());
// if (gfshList.size() == 0) {
// return ResponseEntity.ok(R.ok().put("data", ""));
// }
// }
// pramsMap.put("gfsh", gfshList);
if (pramsMap.get("username") == null || "".equals(pramsMap.get("username"))) {
return ResponseEntity.ok(R.error("收件人姓名不能为空!"));
}
return ResponseEntity.ok(R.ok().put("data",this.emailMaintainService.queryByPage(pramsMap)));
}
/**
* 新增数据
*
* @param emailMaintain 实体
* @return 新增结果
*/
@PostMapping("/add")
public ResponseEntity<R> add(@RequestBody EmailMaintainVo emailMaintain) {
if(StringUtils.isBlank(emailMaintain.getEmailPassword()) || StringUtils.isBlank(emailMaintain.getEmailAddress()) ){
return ResponseEntity.ok(R.error("邮箱地址/密码不能为空!"));
}else {
String encode = Base64Encoding.encode(emailMaintain.getEmailPassword());
emailMaintain.setEmailPassword(encode);
}
boolean insert = this.emailMaintainService.insert(emailMaintain);
if(insert){
return ResponseEntity.ok(R.ok());
}
return ResponseEntity.ok(R.error());
}
/**
* 编辑数据
*
* @param emailMaintain 实体
* @return 编辑结果
*/
@PostMapping("/edit")
public ResponseEntity<R> edit(EmailMaintainVo emailMaintain) {
boolean b = emailMaintainService.update(emailMaintain);
if(b){
return ResponseEntity.ok(R.ok());
}
return ResponseEntity.ok(R.error());
}
}

@ -0,0 +1,53 @@
package com.dxhy.core.controller.mailGather;
import com.dxhy.common.controller.AbstractController;
import com.dxhy.common.utils.R;
import com.dxhy.core.service.mailGather.MailGatherLogService;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.Map;
/**
* (MailGatherLog)表控制层
*
* @author makejava
* @since 2023-03-23 08:42:35
*/
@RestController
@RequestMapping("mailGatherLog")
public class MailGatherLogController extends AbstractController {
/**
* 服务对象
*/
@Resource
private MailGatherLogService mailGatherLogService;
/**
* 分页查询
*
* @param pramsMap 筛选条件
* @return 查询结果
*/
@PostMapping("/queryByPage")
public ResponseEntity<R> queryByPage(@RequestBody Map<String, Object> pramsMap) {
pramsMap.put("dbName", getUserInfo().getDbName());
if (pramsMap.get("username") == null || "".equals(pramsMap.get("username"))) {
return ResponseEntity.ok(R.error("收件人姓名不能为空!"));
}
if (pramsMap.get("parseStart") == null || "".equals(pramsMap.get("parseStart"))) {
return ResponseEntity.ok(R.error("开始日期不能为空!"));
}
if (pramsMap.get("parseEnd") == null || "".equals(pramsMap.get("parseEnd"))) {
return ResponseEntity.ok(R.error("结束日期不能为空!"));
}
return ResponseEntity.ok(R.ok().put("data",this.mailGatherLogService.queryByPage(pramsMap)));
}
}

@ -0,0 +1,81 @@
package com.dxhy.core.dao.mailGather;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dxhy.core.model.mailGather.EmailMaintainVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@Mapper
public interface EmailMaintainDao extends BaseMapper<EmailMaintainVo> {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
EmailMaintainVo queryById(String id);
/**
* 查询指定行数据
*
* @param pramsMap 查询条件
* @return 对象列表
*/
List<EmailMaintainVo> queryAllByLimit(Map<String, Object> pramsMap);
/**
* 统计总行数
*
* @param emailMaintainVo 查询条件
* @return 总行数
*/
long count(EmailMaintainVo emailMaintainVo);
/**
* 新增数据
*
* @param emailMaintainVo 实例对象
* @return 影响行数
*/
int insert(EmailMaintainVo emailMaintainVo);
/**
* 批量新增数据MyBatis原生foreach方法
*
* @param entities List<EmailMaintainVo> 实例对象列表
* @return 影响行数
*/
int insertBatch(@Param("entities") List<EmailMaintainVo> entities);
/**
* 批量新增或按主键更新数据MyBatis原生foreach方法
*
* @param entities List<EmailMaintainVo> 实例对象列表
* @return 影响行数
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常请自行校验入参
*/
int insertOrUpdateBatch(@Param("entities") List<EmailMaintainVo> entities);
/**
* 修改数据
*
* @param emailMaintainVo 实例对象
* @return 影响行数
*/
int update(EmailMaintainVo emailMaintainVo);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 影响行数
*/
int deleteById(String id);
}

@ -0,0 +1,80 @@
package com.dxhy.core.dao.mailGather;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dxhy.core.model.mailGather.MailGatherLogVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@Mapper
public interface MailGatherLogDao extends BaseMapper<MailGatherLogVo> {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
MailGatherLogVo queryById(String id);
/**
* 查询指定行数据
*
* @param mailGatherLogVo 查询条件
* @param pageable 分页对象
* @return 对象列表
*/
List<MailGatherLogVo> queryAllByLimit(Map<String, Object> pramsMap);
/**
* 统计总行数
*
* @param mailGatherLogVo 查询条件
* @return 总行数
*/
long count(MailGatherLogVo mailGatherLogVo);
/**
* 新增数据
*
* @param mailGatherLogVo 实例对象
* @return 影响行数
*/
int insert(MailGatherLogVo mailGatherLogVo);
/**
* 批量新增数据MyBatis原生foreach方法
*
* @param entities List<MailGatherLogVo> 实例对象列表
* @return 影响行数
*/
int insertBatch(@Param("entities") List<MailGatherLogVo> entities);
/**
* 批量新增或按主键更新数据MyBatis原生foreach方法
*
* @param entities List<MailGatherLogVo> 实例对象列表
* @return 影响行数
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常请自行校验入参
*/
int insertOrUpdateBatch(@Param("entities") List<MailGatherLogVo> entities);
/**
* 修改数据
*
* @param mailGatherLogVo 实例对象
* @return 影响行数
*/
int update(MailGatherLogVo mailGatherLogVo);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 影响行数
*/
int deleteById(String id);
}

@ -0,0 +1,29 @@
package com.dxhy.core.model.mailGather;
import com.dxhy.core.model.CommonDTO;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = true)
public class EmailMaintainVo extends CommonDTO {
public String id;
public String deptId;
public String deptName;
public String username;
public String userId;
public String emailAddress;
public String emailPassword;
public String delStatus;
public Date createTime;
public Date modifyTime;
}

@ -0,0 +1,29 @@
package com.dxhy.core.model.mailGather;
import com.dxhy.core.model.CommonDTO;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
@EqualsAndHashCode(callSuper = true)
@Data
public class MailGatherLogVo extends CommonDTO {
private String id;
//主题
private String subject;
private String fromAddress;
private String receiveAddress;
private String sentDate;
private String fileType;
private String fpdm;
private String fphm;
private String msgUid;
private String ocrType;
private String errorMsg;
private String fileName;
private Date createTime;
}

@ -0,0 +1,48 @@
package com.dxhy.core.service.mailGather;
import com.dxhy.core.model.mailGather.EmailMaintainVo;
import java.util.Map;
public interface EmailMaintainService {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
EmailMaintainVo queryById(String id);
/**
* 分页查询
*
* @param pramsMap 筛选条件
* @return 查询结果
*/
String queryByPage(Map<String, Object> pramsMap);
/**
* 新增数据
*
* @param emailMaintain 实例对象
* @return 实例对象
*/
boolean insert(EmailMaintainVo emailMaintain);
/**
* 修改数据
*
* @param emailMaintain 实例对象
* @return 实例对象
*/
boolean update(EmailMaintainVo emailMaintain);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
boolean deleteById(String id);
}

@ -0,0 +1,49 @@
package com.dxhy.core.service.mailGather;
import com.dxhy.core.model.mailGather.MailGatherLogVo;
import java.util.Map;
public interface MailGatherLogService {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
MailGatherLogVo queryById(String id);
/**
* 分页查询
*
* @param pramsMap 筛选条件
* @return 查询结果
*/
String queryByPage(Map<String, Object> pramsMap);
/**
* 新增数据
*
* @param mailGatherLog 实例对象
* @return 实例对象
*/
MailGatherLogVo insert(MailGatherLogVo mailGatherLog);
/**
* 修改数据
*
* @param mailGatherLog 实例对象
* @return 实例对象
*/
MailGatherLogVo update(MailGatherLogVo mailGatherLog);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
boolean deleteById(String id);
}

@ -0,0 +1,108 @@
package com.dxhy.core.service.mailGather.impl;
import cn.hutool.core.codec.Base64;
import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSONObject;
import com.dxhy.core.dao.mailGather.EmailMaintainDao;
import com.dxhy.core.model.mailGather.EmailMaintainVo;
import com.dxhy.core.service.mailGather.EmailMaintainService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Slf4j
@Service
public class EmailMaintainServiceImpl implements EmailMaintainService {
@Resource
private EmailMaintainDao emailMaintainDao;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public EmailMaintainVo queryById(String id) {
return this.emailMaintainDao.queryById(id);
}
/**
* 分页查询
* @param pramsMap 筛选条件
* @return 查询结果
*/
@Override
public String queryByPage(Map<String, Object> pramsMap) {
List<Object> returnList = new ArrayList<>();
JSONObject json = new JSONObject();
int curr = (int)pramsMap.get("curr");
int size = (int)pramsMap.get("size");
PageHelper.startPage(curr, size);
List<EmailMaintainVo> emailMaintainVos = emailMaintainDao.queryAllByLimit(pramsMap);
PageInfo<EmailMaintainVo> pageInfo = new PageInfo<>(emailMaintainVos);
// 设置记录总数
json.put("total", pageInfo.getTotal());
json.put("datalist", returnList);
String jsonString = null;
if (json != null) {
log.debug("返回结果:{}", json.toJSONString());
jsonString = Base64.encode(json.toJSONString());
}
return jsonString;
}
/**
* 新增数据
*
* @param emailMaintain 实例对象
* @return 实例对象
*/
@Override
public boolean insert(EmailMaintainVo emailMaintain) {
if(StringUtils.isEmpty(emailMaintain.getId())){
emailMaintain.setId(IdUtil.nanoId());
}
if(StringUtils.isEmpty(emailMaintain.getDelStatus())){
emailMaintain.setId("0");
}
emailMaintain.setCreateTime(new Date());
emailMaintain.setModifyTime(new Date());
int insert = this.emailMaintainDao.insert(emailMaintain);
return insert > 0;
}
/**
* 修改数据
*
* @param emailMaintain 实例对象
* @return 实例对象
*/
@Override
public boolean update(EmailMaintainVo emailMaintain) {
emailMaintain.setModifyTime(new Date());
int update = this.emailMaintainDao.update(emailMaintain);
return update > 0 ;
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public boolean deleteById(String id) {
return this.emailMaintainDao.deleteById(id) > 0;
}
}

@ -0,0 +1,98 @@
package com.dxhy.core.service.mailGather.impl;
import cn.hutool.core.codec.Base64;
import com.alibaba.fastjson.JSONObject;
import com.dxhy.core.dao.mailGather.MailGatherLogDao;
import com.dxhy.core.model.mailGather.MailGatherLogVo;
import com.dxhy.core.service.mailGather.MailGatherLogService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Slf4j
@Service
public class MailGatherLogServiceImpl implements MailGatherLogService {
@Resource
private MailGatherLogDao mailGatherLogDao;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public MailGatherLogVo queryById(String id) {
return this.mailGatherLogDao.queryById(id);
}
/**
* 分页查询
*
* @param pramsMap 筛选条件
* @return 查询结果
*/
@Override
public String queryByPage(Map<String, Object> pramsMap) {
List<Object> returnList = new ArrayList<>();
JSONObject json = new JSONObject();
int curr = (int)pramsMap.get("curr");
int size = (int)pramsMap.get("size");
PageHelper.startPage(curr, size);
List<MailGatherLogVo> emailMaintainVos = mailGatherLogDao.queryAllByLimit(pramsMap);
PageInfo<MailGatherLogVo> pageInfo = new PageInfo<>(emailMaintainVos);
// 设置记录总数
json.put("total", pageInfo.getTotal());
json.put("datalist", returnList);
String jsonString = null;
if (json != null) {
log.debug("返回结果:{}", json.toJSONString());
jsonString = Base64.encode(json.toJSONString());
}
return jsonString;
}
/**
* 新增数据
*
* @param mailGatherLog 实例对象
* @return 实例对象
*/
@Override
public MailGatherLogVo insert(MailGatherLogVo mailGatherLog) {
this.mailGatherLogDao.insert(mailGatherLog);
return mailGatherLog;
}
/**
* 修改数据
*
* @param mailGatherLog 实例对象
* @return 实例对象
*/
@Override
public MailGatherLogVo update(MailGatherLogVo mailGatherLog) {
this.mailGatherLogDao.update(mailGatherLog);
return this.queryById(mailGatherLog.getId());
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public boolean deleteById(String id) {
return this.mailGatherLogDao.deleteById(id) > 0;
}
}

@ -33,13 +33,11 @@ public class SnEmailGatherTask {
@SneakyThrows
public static void main(String[] args) {
//邮件接收协议
String mail_protocol = "mail.store.protocol";
//邮件接收协议类型
String mail_protocol_type2 = "pop3";
String mail_protocol_type = "pop";
//邮件接收服务器端口
String mail_port = "mail.pop3.port";
//邮件接收服务器端口
@ -48,7 +46,6 @@ public class SnEmailGatherTask {
String mail_host = "mail.pop3.host";
String emailName = "1149953701@qq.com";
String password = "pmdzleyabmlzgdhc";
String mailSuffix = emailName.split("@")[1];
//邮箱类型
String mailType = mailSuffix.split("\\.")[0];
@ -65,7 +62,6 @@ public class SnEmailGatherTask {
}
Session session = Session.getInstance(props);
Store store = session.getStore("pop3");
//连接邮箱服务器
store.connect(emailName, password);
//获取当前时间
@ -74,17 +70,13 @@ public class SnEmailGatherTask {
Folder folder = store.getFolder("INBOX");
//获取邮件列表
folder.open(Folder.READ_WRITE);
// 由于POP3协议无法获知邮件的状态,所以getUnreadMessageCount得到的是收件箱的邮件总数
System.out.println("未读邮件数: " + folder.getUnreadMessageCount());
// 由于POP3协议无法获知邮件的状态,所以下面得到的结果始终都是为0
System.out.println("删除邮件数: " + folder.getDeletedMessageCount());
System.out.println("新邮件: " + folder.getNewMessageCount());
// 获得收件箱中的邮件总数
System.out.println("邮件总数: " + folder.getMessageCount());
Message[] messages = folder.getMessages();
for (int i = 0, count = messages.length; i < count; i++) {
MimeMessage msg = (MimeMessage) messages[i];
@ -109,10 +101,9 @@ public class SnEmailGatherTask {
System.out.println("");
}
System.out.println("");
Date endTime = new Date();
//计算耗时时间
// double elapsedTime = CalendarUtil.arithDateTime(endTime, currentTime);
// double elapsedTime = CalendarUtil.arithDateTime(endTime, currentTime);
// 释放资源
folder.close(false); // false为不更新邮件,true为更新,一般在删除邮件后使用
store.close();

@ -0,0 +1,146 @@
<?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.dxhy.core.dao.mailGather.EmailMaintainDao">
<resultMap type="com.dxhy.core.model.mailGather.EmailMaintainVo" id="EmailMaintainMap">
<result property="id" column="id" jdbcType="VARCHAR"/>
<result property="deptId" column="dept_id" jdbcType="VARCHAR"/>
<result property="deptName" column="dept_name" jdbcType="VARCHAR"/>
<result property="username" column="username" jdbcType="VARCHAR"/>
<result property="userId" column="user_id" jdbcType="VARCHAR"/>
<result property="emailAddress" column="email_address" jdbcType="VARCHAR"/>
<result property="emailPassword" column="email_password" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="delStatus" column="del_status" jdbcType="VARCHAR"/>
<result property="modifyTime" column="modify_time" jdbcType="TIMESTAMP"/>
</resultMap>
<!--查询单个-->
<select id="queryById" resultMap="EmailMaintainMap">
select
id, dept_id, dept_name, username, user_id, email_address, email_password, create_time, del_status, modify_time
from email_maintain
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="EmailMaintainMap" parameterType="java.util.Map">
select
id, dept_id, dept_name, username, user_id, email_address, create_time, del_status, modify_time
from email_maintain
<where>
<if test="deptId != null and deptId != ''">
and dept_id = #{deptId}
</if>
<if test="username != null and username != ''">
and username = #{username}
</if>
</where>
</select>
<!--统计总行数-->
<select id="count" resultType="java.lang.Long">
select count(1)
from email_maintain
<where>
<if test="id != null and id != ''">
and id = #{id}
</if>
<if test="deptId != null and deptId != ''">
and dept_id = #{deptId}
</if>
<if test="deptName != null and deptName != ''">
and dept_name = #{deptName}
</if>
<if test="username != null and username != ''">
and username = #{username}
</if>
<if test="userId != null and userId != ''">
and user_id = #{userId}
</if>
<if test="emailAddress != null and emailAddress != ''">
and email_address = #{emailAddress}
</if>
<if test="emailPassword != null and emailPassword != ''">
and email_password = #{emailPassword}
</if>
<if test="createTime != null">
and create_time = #{createTime}
</if>
<if test="delStatus != null and delStatus != ''">
and del_status = #{delStatus}
</if>
<if test="modifyTime != null">
and modify_time = #{modifyTime}
</if>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into email_maintain(dept_id, dept_name, username, user_id, email_address, email_password, create_time, del_status, modify_time)
values (#{deptId}, #{deptName}, #{username}, #{userId}, #{emailAddress}, #{emailPassword}, #{createTime}, #{delStatus}, #{modifyTime})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into email_maintain(dept_id, dept_name, username, user_id, email_address, email_password, create_time, del_status, modify_time)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.deptId}, #{entity.deptName}, #{entity.username}, #{entity.userId}, #{entity.emailAddress}, #{entity.emailPassword}, #{entity.createTime}, #{entity.delStatus}, #{entity.modifyTime})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into email_maintain(dept_id, dept_name, username, user_id, email_address, email_password, create_time, del_status, modify_time)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.deptId}, #{entity.deptName}, #{entity.username}, #{entity.userId}, #{entity.emailAddress}, #{entity.emailPassword}, #{entity.createTime}, #{entity.delStatus}, #{entity.modifyTime})
</foreach>
on duplicate key update
dept_id = values(dept_id),
dept_name = values(dept_name),
username = values(username),
user_id = values(user_id),
email_address = values(email_address),
email_password = values(email_password),
create_time = values(create_time),
del_status = values(del_status),
modify_time = values(modify_time)
</insert>
<!--通过主键修改数据-->
<update id="update">
update email_maintain
<set>
<if test="deptId != null and deptId != ''">
dept_id = #{deptId},
</if>
<if test="deptName != null and deptName != ''">
dept_name = #{deptName},
</if>
<if test="username != null and username != ''">
username = #{username},
</if>
<if test="userId != null and userId != ''">
user_id = #{userId},
</if>
<if test="emailAddress != null and emailAddress != ''">
email_address = #{emailAddress},
</if>
<if test="emailPassword != null and emailPassword != ''">
email_password = #{emailPassword},
</if>
<if test="delStatus != null and delStatus != ''">
del_status = #{delStatus},
</if>
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete from email_maintain where id = #{id}
</delete>
</mapper>

@ -0,0 +1,204 @@
<?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.dxhy.core.dao.mailGather.MailGatherLogDao">
<resultMap type="com.dxhy.core.model.mailGather.MailGatherLogVo" id="MailGatherLogMap">
<result property="id" column="id" jdbcType="VARCHAR"/>
<result property="subject" column="subject" jdbcType="VARCHAR"/>
<result property="fromAddress" column="from_address" jdbcType="VARCHAR"/>
<result property="receiveAddress" column="receive_address" jdbcType="VARCHAR"/>
<result property="sentDate" column="sent_date" jdbcType="VARCHAR"/>
<result property="fileType" column="file_type" jdbcType="VARCHAR"/>
<result property="fpdm" column="fpdm" jdbcType="VARCHAR"/>
<result property="fphm" column="fphm" jdbcType="VARCHAR"/>
<result property="msgUid" column="msg_uid" jdbcType="VARCHAR"/>
<result property="ocrType" column="ocr_type" jdbcType="VARCHAR"/>
<result property="errorMsg" column="error_msg" jdbcType="VARCHAR"/>
<result property="fileName" column="file_name" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
</resultMap>
<!--查询单个-->
<select id="queryById" resultMap="MailGatherLogMap">
select
id, subject, from_address, receive_address, sent_date, file_type, fpdm, fphm, msg_uid, ocr_type, error_msg, file_name, create_time
from mail_gather_log
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="MailGatherLogMap" parameterType="java.util.Map">
select
id, subject, from_address, receive_address, sent_date, file_type, fpdm, fphm, msg_uid, ocr_type, error_msg, file_name, create_time
from mail_gather_log
<where>
<if test="fromAddress != null and fromAddress != ''">
and from_address = #{fromAddress}
</if>
<if test="receiveAddress != null and receiveAddress != ''">
and receive_address = #{receiveAddress}
</if>
<if test="sentDate != null and sentDate != ''">
and sent_date = #{sentDate}
</if>
<if test="fileType != null and fileType != ''">
and file_type = #{fileType}
</if>
<if test="fpdm != null and fpdm != ''">
and fpdm = #{fpdm}
</if>
<if test="fphm != null and fphm != ''">
and fphm = #{fphm}
</if>
<if test="msgUid != null and msgUid != ''">
and msg_uid = #{msgUid}
</if>
<if test="ocrType != null and ocrType != ''">
and ocr_type = #{ocrType}
</if>
<if test="errorMsg != null and errorMsg != ''">
and error_msg = #{errorMsg}
</if>
<if test="fileName != null and fileName != ''">
and file_name = #{fileName}
</if>
<if test="createTime != null">
and create_time = #{createTime}
</if>
</where>
limit #{pageable.offset}, #{pageable.pageSize}
</select>
<!--统计总行数-->
<select id="count" resultType="java.lang.Long">
select count(1)
from mail_gather_log
<where>
<if test="id != null and id != ''">
and id = #{id}
</if>
<if test="subject != null and subject != ''">
and subject = #{subject}
</if>
<if test="fromAddress != null and fromAddress != ''">
and from_address = #{from}
</if>
<if test="receiveAddress != null and receiveAddress != ''">
and receive_address = #{receiveAddress}
</if>
<if test="sentDate != null and sentDate != ''">
and sent_date = #{sentDate}
</if>
<if test="fileType != null and fileType != ''">
and file_type = #{fileType}
</if>
<if test="fpdm != null and fpdm != ''">
and fpdm = #{fpdm}
</if>
<if test="fphm != null and fphm != ''">
and fphm = #{fphm}
</if>
<if test="msgUid != null and msgUid != ''">
and msg_uid = #{msgUid}
</if>
<if test="ocrType != null and ocrType != ''">
and ocr_type = #{ocrType}
</if>
<if test="errorMsg != null and errorMsg != ''">
and error_msg = #{errorMsg}
</if>
<if test="fileName != null and fileName != ''">
and file_name = #{fileName}
</if>
<if test="createTime != null">
and create_time = #{createTime}
</if>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into mail_gather_log(subject, from_address, receive_address, sent_date, file_type, fpdm, fphm, msg_uid, ocr_type, error_msg, file_name, create_time)
values (#{subject}, #{fromAddress}, #{receiveAddress}, #{sentDate}, #{fileType}, #{fpdm}, #{fphm}, #{msgUid}, #{ocrType}, #{errorMsg}, #{fileName}, #{createTime})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into mail_gather_log(subject, from_address, receive_address, sent_date, file_type, fpdm, fphm, msg_uid, ocr_type, error_msg, file_name, create_time)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.subject}, #{entity.fromAddress}, #{entity.receiveAddress}, #{entity.sentDate}, #{entity.fileType}, #{entity.fpdm}, #{entity.fphm}, #{entity.msgUid}, #{entity.ocrType}, #{entity.errorMsg}, #{entity.fileName}, #{entity.createTime})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into mail_gather_log(subject, from_address, receive_address, sent_date, file_type, fpdm, fphm, msg_uid, ocr_type, error_msg, file_name, create_time)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.subject}, #{entity.fromAddress}, #{entity.receiveAddress}, #{entity.sentDate}, #{entity.fileType}, #{entity.fpdm}, #{entity.fphm}, #{entity.msgUid}, #{entity.ocrType}, #{entity.errorMsg}, #{entity.fileName}, #{entity.createTime})
</foreach>
on duplicate key update
subject = values(subject),
from_address = values(fromAddress),
receive_address = values(receive_address),
sent_date = values(sent_date),
file_type = values(file_type),
fpdm = values(fpdm),
fphm = values(fphm),
msg_uid = values(msg_uid),
ocr_type = values(ocr_type),
error_msg = values(error_msg),
file_name = values(file_name),
create_time = values(create_time)
</insert>
<!--通过主键修改数据-->
<update id="update">
update mail_gather_log
<set>
<if test="subject != null and subject != ''">
subject = #{subject},
</if>
<if test="fromAddress != null and fromAddress != ''">
from_address = #{fromAddress},
</if>
<if test="receiveAddress != null and receiveAddress != ''">
receive_address = #{receiveAddress},
</if>
<if test="sentDate != null and sentDate != ''">
sent_date = #{sentDate},
</if>
<if test="fileType != null and fileType != ''">
file_type = #{fileType},
</if>
<if test="fpdm != null and fpdm != ''">
fpdm = #{fpdm},
</if>
<if test="fphm != null and fphm != ''">
fphm = #{fphm},
</if>
<if test="msgUid != null and msgUid != ''">
msg_uid = #{msgUid},
</if>
<if test="ocrType != null and ocrType != ''">
ocr_type = #{ocrType},
</if>
<if test="errorMsg != null and errorMsg != ''">
error_msg = #{errorMsg},
</if>
<if test="fileName != null and fileName != ''">
file_name = #{fileName},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete from mail_gather_log where id = #{id}
</delete>
</mapper>

@ -1,19 +1,6 @@
package com.dxhy.sign.controller;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import cn.hutool.core.io.FileUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.dxhy.common.aspect.SysLog;
@ -30,9 +17,19 @@ import com.dxhy.common.vo.UserInfo;
import com.dxhy.sign.service.elec.SignElecInvoiceService;
import com.dxhy.sign.service.invoicequery.SignInvoiceQueryService;
import com.dxhy.sign.util.DateTimeHelper;
import cn.hutool.core.io.FileUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 发票查验模块接口类
@ -62,6 +59,13 @@ public class SignCheckInvoiceQueryController extends AbstractController {
@Value("${ftp.connection.depositPath}")
private String depositPath;
@GetMapping("/test")
public String test(){
return "123";
}
@PostMapping("/elecCheck/uploadFile")
@SysLog("上传电子发票")
public ResponseEntity<R> uploadFile(MultipartFile file) {

@ -1,23 +1,9 @@
package com.dxhy.sign.controller;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.date.DateUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.dxhy.sign.entity.QsExcelEntity;
import org.apache.commons.lang3.StringUtils;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.dxhy.common.aspect.SysLog;
@ -32,12 +18,23 @@ import com.dxhy.common.utils.R;
import com.dxhy.common.vo.Business;
import com.dxhy.common.vo.UserInfo;
import com.dxhy.oss.service.FileService;
import com.dxhy.sign.entity.QsExcelEntity;
import com.dxhy.sign.entity.TDxInvoiceImg;
import com.dxhy.sign.service.elec.SignInvoiceImgService;
import com.dxhy.sign.service.fpqs.SignFpqsService;
import cn.hutool.core.date.DateUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*
@ -124,7 +121,7 @@ public class SignFpqsController extends AbstractController {
/**
* 手工签收发票列表查询
* 邮箱签收
*
* @param pramsMap
* 购方税号全部时传0
@ -136,17 +133,21 @@ public class SignFpqsController extends AbstractController {
@ResponseBody
@SysLog("手工签收--邮箱签收")
public ResponseEntity<?> sendEmailByQs(@RequestBody Map<String, Object> pramsMap) {
if (pramsMap.get("emailAddress") != null && !"".equals(pramsMap.get("emailAddress"))) {
if (pramsMap.get("emailAddress") == null || "".equals(pramsMap.get("emailAddress"))) {
return ResponseEntity.ok(R.error("邮箱地址不能为空!"));
}
if (pramsMap.get("ids") != null && !"".equals(pramsMap.get("ids"))) {
return ResponseEntity.ok(R.error("未勾选数据!"));
if (pramsMap.get("ids") == null || "".equals(pramsMap.get("ids"))) {
return ResponseEntity.ok(R.error("请选择发票数据"));
}
return ResponseEntity.ok(signFpqsService.qsSendEmail(pramsMap));
}
@RequestMapping("/qsExport")
public void qsExport(@RequestBody Map<String, Object> pramsMap, HttpServletResponse response){
if (pramsMap.get("ids") == null || "".equals(pramsMap.get("ids"))) {
// return ResponseEntity.ok(R.error("请选择发票数据"));
return;
}
List<QsExcelEntity> excelList = signFpqsService.selectWqsfp(pramsMap);
ExcelWriter excelWriter = null;
if(excelList != null){

Loading…
Cancel
Save