From 3622e643d63a8282b66f12fb7b13629e535709bf Mon Sep 17 00:00:00 2001 From: "zhenghaiyang@ele-cloud.com" Date: Thu, 23 Mar 2023 16:45:52 +0800 Subject: [PATCH] =?UTF-8?q?feature=201.=E6=96=B0=E5=A2=9E=E9=82=AE?= =?UTF-8?q?=E7=AE=B1=E9=87=87=E9=9B=86=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/controller/DictDataController.java | 26 +-- .../mailGather/EmailMaintainController.java | 93 ++++++++ .../mailGather/MailGatherLogController.java | 53 +++++ .../core/dao/mailGather/EmailMaintainDao.java | 81 +++++++ .../core/dao/mailGather/MailGatherLogDao.java | 80 +++++++ .../model/mailGather/EmailMaintainVo.java | 29 +++ .../model/mailGather/MailGatherLogVo.java | 29 +++ .../mailGather/EmailMaintainService.java | 48 +++++ .../mailGather/MailGatherLogService.java | 49 +++++ .../impl/EmailMaintainServiceImpl.java | 108 ++++++++++ .../impl/MailGatherLogServiceImpl.java | 98 +++++++++ .../com/dxhy/core/task/SnEmailGatherTask.java | 11 +- .../mapper/mailGather/EmailMaintainMapper.xml | 146 +++++++++++++ .../mapper/mailGather/MailGatherLogMapper.xml | 204 ++++++++++++++++++ .../SignCheckInvoiceQueryController.java | 36 ++-- .../sign/controller/SignFpqsController.java | 43 ++-- 16 files changed, 1075 insertions(+), 59 deletions(-) create mode 100644 dxhy-core/src/main/java/com/dxhy/core/controller/mailGather/EmailMaintainController.java create mode 100644 dxhy-core/src/main/java/com/dxhy/core/controller/mailGather/MailGatherLogController.java create mode 100644 dxhy-core/src/main/java/com/dxhy/core/dao/mailGather/EmailMaintainDao.java create mode 100644 dxhy-core/src/main/java/com/dxhy/core/dao/mailGather/MailGatherLogDao.java create mode 100644 dxhy-core/src/main/java/com/dxhy/core/model/mailGather/EmailMaintainVo.java create mode 100644 dxhy-core/src/main/java/com/dxhy/core/model/mailGather/MailGatherLogVo.java create mode 100644 dxhy-core/src/main/java/com/dxhy/core/service/mailGather/EmailMaintainService.java create mode 100644 dxhy-core/src/main/java/com/dxhy/core/service/mailGather/MailGatherLogService.java create mode 100644 dxhy-core/src/main/java/com/dxhy/core/service/mailGather/impl/EmailMaintainServiceImpl.java create mode 100644 dxhy-core/src/main/java/com/dxhy/core/service/mailGather/impl/MailGatherLogServiceImpl.java create mode 100644 dxhy-core/src/main/resources/mapper/mailGather/EmailMaintainMapper.xml create mode 100644 dxhy-core/src/main/resources/mapper/mailGather/MailGatherLogMapper.xml diff --git a/dxhy-core/src/main/java/com/dxhy/core/controller/DictDataController.java b/dxhy-core/src/main/java/com/dxhy/core/controller/DictDataController.java index 951a9484..8ab13899 100644 --- a/dxhy-core/src/main/java/com/dxhy/core/controller/DictDataController.java +++ b/dxhy-core/src/main/java/com/dxhy/core/controller/DictDataController.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"; + } } diff --git a/dxhy-core/src/main/java/com/dxhy/core/controller/mailGather/EmailMaintainController.java b/dxhy-core/src/main/java/com/dxhy/core/controller/mailGather/EmailMaintainController.java new file mode 100644 index 00000000..4e186038 --- /dev/null +++ b/dxhy-core/src/main/java/com/dxhy/core/controller/mailGather/EmailMaintainController.java @@ -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 queryByPage(@RequestBody Map pramsMap) { + // 入参统一在入口处理 + pramsMap.put("dbName", getUserInfo().getDbName()); +// List 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 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 edit(EmailMaintainVo emailMaintain) { + boolean b = emailMaintainService.update(emailMaintain); + if(b){ + return ResponseEntity.ok(R.ok()); + } + return ResponseEntity.ok(R.error()); + } + +} + diff --git a/dxhy-core/src/main/java/com/dxhy/core/controller/mailGather/MailGatherLogController.java b/dxhy-core/src/main/java/com/dxhy/core/controller/mailGather/MailGatherLogController.java new file mode 100644 index 00000000..a4711fea --- /dev/null +++ b/dxhy-core/src/main/java/com/dxhy/core/controller/mailGather/MailGatherLogController.java @@ -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 queryByPage(@RequestBody Map 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))); + } + +} + diff --git a/dxhy-core/src/main/java/com/dxhy/core/dao/mailGather/EmailMaintainDao.java b/dxhy-core/src/main/java/com/dxhy/core/dao/mailGather/EmailMaintainDao.java new file mode 100644 index 00000000..1277d54f --- /dev/null +++ b/dxhy-core/src/main/java/com/dxhy/core/dao/mailGather/EmailMaintainDao.java @@ -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 { + + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + EmailMaintainVo queryById(String id); + + /** + * 查询指定行数据 + * + * @param pramsMap 查询条件 + * @return 对象列表 + */ + List queryAllByLimit(Map pramsMap); + + /** + * 统计总行数 + * + * @param emailMaintainVo 查询条件 + * @return 总行数 + */ + long count(EmailMaintainVo emailMaintainVo); + + /** + * 新增数据 + * + * @param emailMaintainVo 实例对象 + * @return 影响行数 + */ + int insert(EmailMaintainVo emailMaintainVo); + + /** + * 批量新增数据(MyBatis原生foreach方法) + * + * @param entities List 实例对象列表 + * @return 影响行数 + */ + int insertBatch(@Param("entities") List entities); + + /** + * 批量新增或按主键更新数据(MyBatis原生foreach方法) + * + * @param entities List 实例对象列表 + * @return 影响行数 + * @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参 + */ + int insertOrUpdateBatch(@Param("entities") List entities); + + /** + * 修改数据 + * + * @param emailMaintainVo 实例对象 + * @return 影响行数 + */ + int update(EmailMaintainVo emailMaintainVo); + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 影响行数 + */ + int deleteById(String id); + +} diff --git a/dxhy-core/src/main/java/com/dxhy/core/dao/mailGather/MailGatherLogDao.java b/dxhy-core/src/main/java/com/dxhy/core/dao/mailGather/MailGatherLogDao.java new file mode 100644 index 00000000..5cd39931 --- /dev/null +++ b/dxhy-core/src/main/java/com/dxhy/core/dao/mailGather/MailGatherLogDao.java @@ -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 { + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + MailGatherLogVo queryById(String id); + + /** + * 查询指定行数据 + * + * @param mailGatherLogVo 查询条件 + * @param pageable 分页对象 + * @return 对象列表 + */ + List queryAllByLimit(Map pramsMap); + + /** + * 统计总行数 + * + * @param mailGatherLogVo 查询条件 + * @return 总行数 + */ + long count(MailGatherLogVo mailGatherLogVo); + + /** + * 新增数据 + * + * @param mailGatherLogVo 实例对象 + * @return 影响行数 + */ + int insert(MailGatherLogVo mailGatherLogVo); + + /** + * 批量新增数据(MyBatis原生foreach方法) + * + * @param entities List 实例对象列表 + * @return 影响行数 + */ + int insertBatch(@Param("entities") List entities); + + /** + * 批量新增或按主键更新数据(MyBatis原生foreach方法) + * + * @param entities List 实例对象列表 + * @return 影响行数 + * @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参 + */ + int insertOrUpdateBatch(@Param("entities") List entities); + + /** + * 修改数据 + * + * @param mailGatherLogVo 实例对象 + * @return 影响行数 + */ + int update(MailGatherLogVo mailGatherLogVo); + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 影响行数 + */ + int deleteById(String id); + +} diff --git a/dxhy-core/src/main/java/com/dxhy/core/model/mailGather/EmailMaintainVo.java b/dxhy-core/src/main/java/com/dxhy/core/model/mailGather/EmailMaintainVo.java new file mode 100644 index 00000000..3ede8d8e --- /dev/null +++ b/dxhy-core/src/main/java/com/dxhy/core/model/mailGather/EmailMaintainVo.java @@ -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; +} diff --git a/dxhy-core/src/main/java/com/dxhy/core/model/mailGather/MailGatherLogVo.java b/dxhy-core/src/main/java/com/dxhy/core/model/mailGather/MailGatherLogVo.java new file mode 100644 index 00000000..2e665fa2 --- /dev/null +++ b/dxhy-core/src/main/java/com/dxhy/core/model/mailGather/MailGatherLogVo.java @@ -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; + +} diff --git a/dxhy-core/src/main/java/com/dxhy/core/service/mailGather/EmailMaintainService.java b/dxhy-core/src/main/java/com/dxhy/core/service/mailGather/EmailMaintainService.java new file mode 100644 index 00000000..69d31c2d --- /dev/null +++ b/dxhy-core/src/main/java/com/dxhy/core/service/mailGather/EmailMaintainService.java @@ -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 pramsMap); + + /** + * 新增数据 + * + * @param emailMaintain 实例对象 + * @return 实例对象 + */ + boolean insert(EmailMaintainVo emailMaintain); + + /** + * 修改数据 + * + * @param emailMaintain 实例对象 + * @return 实例对象 + */ + boolean update(EmailMaintainVo emailMaintain); + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 是否成功 + */ + boolean deleteById(String id); +} diff --git a/dxhy-core/src/main/java/com/dxhy/core/service/mailGather/MailGatherLogService.java b/dxhy-core/src/main/java/com/dxhy/core/service/mailGather/MailGatherLogService.java new file mode 100644 index 00000000..e7e02b52 --- /dev/null +++ b/dxhy-core/src/main/java/com/dxhy/core/service/mailGather/MailGatherLogService.java @@ -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 pramsMap); + + /** + * 新增数据 + * + * @param mailGatherLog 实例对象 + * @return 实例对象 + */ + MailGatherLogVo insert(MailGatherLogVo mailGatherLog); + + /** + * 修改数据 + * + * @param mailGatherLog 实例对象 + * @return 实例对象 + */ + MailGatherLogVo update(MailGatherLogVo mailGatherLog); + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 是否成功 + */ + boolean deleteById(String id); + +} diff --git a/dxhy-core/src/main/java/com/dxhy/core/service/mailGather/impl/EmailMaintainServiceImpl.java b/dxhy-core/src/main/java/com/dxhy/core/service/mailGather/impl/EmailMaintainServiceImpl.java new file mode 100644 index 00000000..9b0b5d15 --- /dev/null +++ b/dxhy-core/src/main/java/com/dxhy/core/service/mailGather/impl/EmailMaintainServiceImpl.java @@ -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 pramsMap) { + List returnList = new ArrayList<>(); + JSONObject json = new JSONObject(); + int curr = (int)pramsMap.get("curr"); + int size = (int)pramsMap.get("size"); + PageHelper.startPage(curr, size); + List emailMaintainVos = emailMaintainDao.queryAllByLimit(pramsMap); + PageInfo 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; + } +} diff --git a/dxhy-core/src/main/java/com/dxhy/core/service/mailGather/impl/MailGatherLogServiceImpl.java b/dxhy-core/src/main/java/com/dxhy/core/service/mailGather/impl/MailGatherLogServiceImpl.java new file mode 100644 index 00000000..b04f8088 --- /dev/null +++ b/dxhy-core/src/main/java/com/dxhy/core/service/mailGather/impl/MailGatherLogServiceImpl.java @@ -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 pramsMap) { + + List returnList = new ArrayList<>(); + JSONObject json = new JSONObject(); + int curr = (int)pramsMap.get("curr"); + int size = (int)pramsMap.get("size"); + PageHelper.startPage(curr, size); + List emailMaintainVos = mailGatherLogDao.queryAllByLimit(pramsMap); + PageInfo 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; + } +} diff --git a/dxhy-core/src/main/java/com/dxhy/core/task/SnEmailGatherTask.java b/dxhy-core/src/main/java/com/dxhy/core/task/SnEmailGatherTask.java index 78653b5f..1e6d648e 100644 --- a/dxhy-core/src/main/java/com/dxhy/core/task/SnEmailGatherTask.java +++ b/dxhy-core/src/main/java/com/dxhy/core/task/SnEmailGatherTask.java @@ -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(); diff --git a/dxhy-core/src/main/resources/mapper/mailGather/EmailMaintainMapper.xml b/dxhy-core/src/main/resources/mapper/mailGather/EmailMaintainMapper.xml new file mode 100644 index 00000000..9a5cf9d7 --- /dev/null +++ b/dxhy-core/src/main/resources/mapper/mailGather/EmailMaintainMapper.xml @@ -0,0 +1,146 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 into email_maintain(dept_id, dept_name, username, user_id, email_address, email_password, create_time, del_status, modify_time) + values + + (#{entity.deptId}, #{entity.deptName}, #{entity.username}, #{entity.userId}, #{entity.emailAddress}, #{entity.emailPassword}, #{entity.createTime}, #{entity.delStatus}, #{entity.modifyTime}) + + + + + insert into email_maintain(dept_id, dept_name, username, user_id, email_address, email_password, create_time, del_status, modify_time) + values + + (#{entity.deptId}, #{entity.deptName}, #{entity.username}, #{entity.userId}, #{entity.emailAddress}, #{entity.emailPassword}, #{entity.createTime}, #{entity.delStatus}, #{entity.modifyTime}) + + 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) + + + + + update email_maintain + + + dept_id = #{deptId}, + + + dept_name = #{deptName}, + + + username = #{username}, + + + user_id = #{userId}, + + + email_address = #{emailAddress}, + + + email_password = #{emailPassword}, + + + del_status = #{delStatus}, + + + where id = #{id} + + + + + delete from email_maintain where id = #{id} + + + + diff --git a/dxhy-core/src/main/resources/mapper/mailGather/MailGatherLogMapper.xml b/dxhy-core/src/main/resources/mapper/mailGather/MailGatherLogMapper.xml new file mode 100644 index 00000000..5e76cb61 --- /dev/null +++ b/dxhy-core/src/main/resources/mapper/mailGather/MailGatherLogMapper.xml @@ -0,0 +1,204 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 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 + + (#{entity.subject}, #{entity.fromAddress}, #{entity.receiveAddress}, #{entity.sentDate}, #{entity.fileType}, #{entity.fpdm}, #{entity.fphm}, #{entity.msgUid}, #{entity.ocrType}, #{entity.errorMsg}, #{entity.fileName}, #{entity.createTime}) + + + + + 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 + + (#{entity.subject}, #{entity.fromAddress}, #{entity.receiveAddress}, #{entity.sentDate}, #{entity.fileType}, #{entity.fpdm}, #{entity.fphm}, #{entity.msgUid}, #{entity.ocrType}, #{entity.errorMsg}, #{entity.fileName}, #{entity.createTime}) + + 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) + + + + + update mail_gather_log + + + subject = #{subject}, + + + from_address = #{fromAddress}, + + + receive_address = #{receiveAddress}, + + + sent_date = #{sentDate}, + + + file_type = #{fileType}, + + + fpdm = #{fpdm}, + + + fphm = #{fphm}, + + + msg_uid = #{msgUid}, + + + ocr_type = #{ocrType}, + + + error_msg = #{errorMsg}, + + + file_name = #{fileName}, + + + create_time = #{createTime}, + + + where id = #{id} + + + + + delete from mail_gather_log where id = #{id} + + + + diff --git a/dxhy-sign/src/main/java/com/dxhy/sign/controller/SignCheckInvoiceQueryController.java b/dxhy-sign/src/main/java/com/dxhy/sign/controller/SignCheckInvoiceQueryController.java index bd739499..cd45ec80 100644 --- a/dxhy-sign/src/main/java/com/dxhy/sign/controller/SignCheckInvoiceQueryController.java +++ b/dxhy-sign/src/main/java/com/dxhy/sign/controller/SignCheckInvoiceQueryController.java @@ -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 uploadFile(MultipartFile file) { diff --git a/dxhy-sign/src/main/java/com/dxhy/sign/controller/SignFpqsController.java b/dxhy-sign/src/main/java/com/dxhy/sign/controller/SignFpqsController.java index 472f3068..f40366a4 100644 --- a/dxhy-sign/src/main/java/com/dxhy/sign/controller/SignFpqsController.java +++ b/dxhy-sign/src/main/java/com/dxhy/sign/controller/SignFpqsController.java @@ -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 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 pramsMap, HttpServletResponse response){ + if (pramsMap.get("ids") == null || "".equals(pramsMap.get("ids"))) { +// return ResponseEntity.ok(R.error("请选择发票数据")); + return; + } List excelList = signFpqsService.selectWqsfp(pramsMap); ExcelWriter excelWriter = null; if(excelList != null){