| | |
| | | import com.yc.crm.mail.util.AllBackMsg; |
| | | import com.yc.entity.AttachmentConfig; |
| | | import com.yc.entity.DataSourceEntity; |
| | | import com.yc.entity.attachment.AttachmentEntity; |
| | | import com.yc.factory.FactoryBean; |
| | | import com.yc.multiData.MultiDataSource; |
| | | import com.yc.multiData.SpObserver; |
| | |
| | | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.mail.MessagingException; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.servlet.http.HttpSession; |
| | |
| | | t482101HEntity t482101HEntity = emailIfc.getReceivingMailInfo(docCode); |
| | | if (t482101HEntity != null) { |
| | | if (StringUtils.isNotBlank(t482101HEntity.getAttachmentList())) {//附件的处理 |
| | | //获取到附件内容 |
| | | List<AttachmentEntity> attachmentEntities = emailIfc.getAttachmentEntityList(t482101HEntity.getAttachmentList()); |
| | | List<String> list = new ArrayList<>(); |
| | | String[] path = t482101HEntity.getAttachmentList().split(";"); |
| | | if (path.length > 1) { |
| | | String unId = path[0];//第一个必定是unid; |
| | | for (int p = 1; p < path.length; p++) { |
| | | list.add(shoppingImageServer + "/uploads/attachment/82/482101/" + unId + "@p@" + path[p]); |
| | | if (attachmentEntities.size() > 0) { |
| | | for (AttachmentEntity a : attachmentEntities) { |
| | | list.add(shoppingImageServer + "/uploads/attachment/"+dataSourceEntity.getDbId()+"/482101/" + a.getUnid() + "@p@" + a.getPhysicalFile()); |
| | | } |
| | | t482101HEntity.setAttachmentPath(list); |
| | | } |
| | |
| | | //发送 |
| | | mailServiceIfc.sendEmails(t482101H, request); |
| | | msg.setOk("发送成功"); |
| | | } catch (Exception e) { |
| | | } catch (MessagingException e) { |
| | | String error = e.getCause() != null ? e.getCause().getMessage() : e.getMessage(); |
| | | String[] arrayError = error.split("#"); |
| | | if (arrayError.length == 2) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("docCode", arrayError[1]); |
| | | msg.setError(arrayError[0], map); |
| | | if (StringUtils.isNotBlank(error)) { |
| | | String[] arrayError = error.split("#"); |
| | | if (arrayError.length == 2) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("docCode", arrayError[1]); |
| | | msg.setError(arrayError[0], map); |
| | | } else { |
| | | msg.setFail(error); |
| | | } |
| | | } else { |
| | | msg.setFail(error); |
| | | } |
| | | } catch (Exception e) { |
| | | msg.setFail(e.getCause() != null ? e.getCause().getMessage() : e.getMessage()); |
| | | } finally { |
| | | SpObserver.setDBtoInstance(); |
| | | } |