diff --git a/dxhy-core/src/main/java/com/dxhy/core/config/WebConfiguration.java b/dxhy-core/src/main/java/com/dxhy/core/config/WebConfiguration.java index 50ba2ef3..531a1034 100644 --- a/dxhy-core/src/main/java/com/dxhy/core/config/WebConfiguration.java +++ b/dxhy-core/src/main/java/com/dxhy/core/config/WebConfiguration.java @@ -1,11 +1,13 @@ package com.dxhy.core.config; -import java.math.BigInteger; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - +import com.alibaba.fastjson.serializer.SerializeConfig; +import com.alibaba.fastjson.serializer.SerializerFeature; +import com.alibaba.fastjson.serializer.ToStringSerializer; +import com.alibaba.fastjson.support.config.FastJsonConfig; +import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter; +import com.dxhy.auth.client.interceptor.ServiceAuthRestInterceptor; +import com.dxhy.auth.client.interceptor.UserAuthRestInterceptor; +import com.dxhy.common.handler.GlobalExceptionHandler; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Primary; @@ -18,14 +20,11 @@ import org.springframework.http.converter.support.AllEncompassingFormHttpMessage import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; -import com.alibaba.fastjson.serializer.SerializeConfig; -import com.alibaba.fastjson.serializer.SerializerFeature; -import com.alibaba.fastjson.serializer.ToStringSerializer; -import com.alibaba.fastjson.support.config.FastJsonConfig; -import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter; -import com.dxhy.auth.client.interceptor.ServiceAuthRestInterceptor; -import com.dxhy.auth.client.interceptor.UserAuthRestInterceptor; -import com.dxhy.common.handler.GlobalExceptionHandler; +import java.math.BigInteger; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; /** * @ClassName: WebConfiguration : @@ -65,7 +64,7 @@ public class WebConfiguration implements WebMvcConfigurer { private ArrayList getIncludePathPatterns() { ArrayList list = new ArrayList<>(); String[] urls = - {"/excel/apply", "/ftp/download", "/scan/get/scaninfo", "/setPwd", "/resetPwd", "/invoiceDetail/info", + {"/mailGatherLog/**","/emailMaintain/**","/excel/apply", "/ftp/download", "/scan/get/scaninfo", "/setPwd", "/resetPwd", "/invoiceDetail/info", "/invoiceDetail/saleInfo", "/smcy/info", "/invoiceDetail/companyPoolInvoiceDetail/**", "/pool/**"}; Collections.addAll(list, urls); return list; 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 index 2f6dbf57..2588737b 100644 --- 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 @@ -1,13 +1,20 @@ package com.dxhy.core.controller.mailGather; +import cn.hutool.core.codec.Base64; +import com.alibaba.fastjson.JSONObject; import com.dxhy.common.controller.AbstractController; import com.dxhy.common.utils.Base64Encoding; import com.dxhy.common.utils.R; +import com.dxhy.common.vo.UserInfo; import com.dxhy.core.model.mailGather.EmailMaintainVo; import com.dxhy.core.service.mailGather.EmailMaintainService; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; +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; @@ -18,6 +25,7 @@ import java.util.Map; * @author makejava * @since 2023-03-23 08:39:46 */ +@Slf4j @RestController @RequestMapping("/emailMaintain") public class EmailMaintainController extends AbstractController { @@ -46,10 +54,10 @@ public class EmailMaintainController extends AbstractController { // 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("收件人姓名不能为空!")); - } + UserInfo userInfo = getUserInfo(); + log.debug("用户信息:{}", JSONObject.toJSONString(userInfo)); + String loginname = getUserInfo().getLoginname(); + pramsMap.put("userId",loginname); return ResponseEntity.ok(R.ok().put("data",this.emailMaintainService.queryByPage(pramsMap))); } @@ -105,5 +113,30 @@ public class EmailMaintainController extends AbstractController { return ResponseEntity.ok(R.error()); } + + + /** + * 编辑数据 + * + * @param paramsMap 实体 + * @return 编辑结果 + */ + @PostMapping("/getUserName") + public ResponseEntity getUserName(@RequestBody Map paramsMap) { + String userCode = paramsMap.get("userCode"); + if(StringUtils.isEmpty(userCode)){ + return ResponseEntity.ok(R.error("数据不能为空!")); + } + String userName = emailMaintainService.getUserName(userCode); + if(StringUtils.isNotEmpty(userName)){ + JSONObject json = new JSONObject(); + json.put("datalist", userName); + log.debug("返回结果:{}", json.toJSONString()); + String jsonString = Base64.encode(json.toJSONString()); + return ResponseEntity.ok(R.ok().put("data",jsonString)); + } + 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 index 64f66412..6815c9d5 100644 --- 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 @@ -37,9 +37,9 @@ public class MailGatherLogController extends AbstractController { 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("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("开始日期不能为空!")); } 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 index c4a18cc4..4cad42c4 100644 --- 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 @@ -78,4 +78,7 @@ public interface EmailMaintainDao extends BaseMapper { */ int deleteById(String id); + + String getUserName(@Param("userCode") String userCode); + } 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 index 1e763576..220990ed 100644 --- 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 @@ -46,4 +46,6 @@ public interface EmailMaintainService { * @return 是否成功 */ boolean deleteById(String id); + + String getUserName(String userCode); } 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 index db1d2556..036417d4 100644 --- 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 @@ -109,6 +109,11 @@ public class EmailMaintainServiceImpl implements EmailMaintainService { return this.emailMaintainDao.deleteById(id) > 0; } + @Override + public String getUserName(String userCode) { + return emailMaintainDao.getUserName(userCode); + } + //根据用户名进行查询 public void getdeptInfo(String deptId){ DynamicContextHolder.push(DbConstant.BASICS_READ); 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 b08b4509..c8197e2c 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 @@ -58,8 +58,7 @@ public class SnEmailGatherTask { public void mailGatherTask(){ DynamicContextHolder.push(DbConstant.BASICS_READ); - ScheduleJobEntity scheduleJobEntity = scheduleJobService.queryByBeanName("snEmailGatherTask", "getInvoices"); - + ScheduleJobEntity scheduleJobEntity = scheduleJobService.queryByBeanName("snEmailGatherTask", "mailGatherTask"); if (scheduleJobEntity != null && "0".equals(scheduleJobEntity.getJobStatus())) { try { log.info("邮箱采集接口开始--"); @@ -68,9 +67,13 @@ public class SnEmailGatherTask { scheduleJobService.updateById(scheduleJobEntity); //进行邮件采集 List maintainVos = emailMaintainService.queryAll(); - for (EmailMaintainVo maintainVo : maintainVos) { - //挨个邮箱进行数据采集 - parseEmail(maintainVo); + if(maintainVos != null && !maintainVos.isEmpty()){ + for (EmailMaintainVo maintainVo : maintainVos) { + //挨个邮箱进行数据采集 + parseEmail(maintainVo); + } + }else { + log.info("未配置邮箱数据--"); } log.info("邮箱采集接口执行结束--"); } catch (Exception e) { diff --git a/dxhy-core/src/main/resources/mapper/mailGather/EmailMaintainMapper.xml b/dxhy-core/src/main/resources/mapper/mailGather/EmailMaintainMapper.xml index 628add7f..7e408ba0 100644 --- a/dxhy-core/src/main/resources/mapper/mailGather/EmailMaintainMapper.xml +++ b/dxhy-core/src/main/resources/mapper/mailGather/EmailMaintainMapper.xml @@ -37,6 +37,9 @@ and username = #{username} + + and user_id = #{userId} + @@ -154,5 +157,9 @@ delete from email_maintain where id = #{id} + +