xinyb
2024-09-19 1956855b43808d81f246d9570d477ac1cbc404b7
src/com/yc/crm/mail/action/MailController.java
@@ -2,6 +2,7 @@
import com.yc.crm.mail.entity.*;
import com.yc.crm.mail.service.MailAccountIfc;
import com.yc.crm.mail.service.MailFileIfc;
import com.yc.crm.mail.service.MailIfc;
import com.yc.crm.mail.service.MailServiceIfc;
import com.yc.crm.mail.util.AllBackMsg;
@@ -47,6 +48,8 @@
    MailIfc emailIfc;
    @Autowired
    MailServiceIfc mailServiceIfc;
    @Autowired
    MailFileIfc mailFileIfc;
    private static final Pattern EMAIL_PATTERN =
            Pattern.compile("^[a-zA-Z0-9_+&*-]+(?:\\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,7}$");
@@ -85,7 +88,8 @@
     * @return
     */
    @GetMapping("/getMailList.do")
    public AllBackMsg getMailList(String mail, @RequestParam(defaultValue = "1") Integer mailType, boolean isNoRead, HttpServletRequest request, HttpServletResponse response) throws Exception {
    public AllBackMsg getMailList(String mail, @RequestParam(defaultValue = "1") Integer mailType,
                                  @RequestParam(defaultValue = "1") Integer page,@RequestParam(defaultValue = "20") Integer limit, boolean isNoRead, HttpServletRequest request, HttpServletResponse response) throws Exception {
        AllBackMsg msg = new AllBackMsg();
        try {
            if (StringUtils.isNotBlank(mail)) {
@@ -102,7 +106,7 @@
            }
            DataSourceEntity dataSourceEntity = MultiDataSource.getDataSourceMap(request);//获取数据源信息
            SpObserver.setDBtoInstance("_" + dataSourceEntity.getDbId());//切换数据源
            List<t482101HList> t482101HEntityList = emailIfc.getReceivingMailList(mail, mailType, isNoRead, userCode);
            List<t482101HList> t482101HEntityList = emailIfc.getReceivingMailList(mail, mailType, isNoRead, userCode,page,limit);
            if (t482101HEntityList.size() > 0) {
                msg.setSuccess("执行完成", t482101HEntityList);
            }
@@ -120,7 +124,8 @@
     * @return
     */
    @GetMapping("/getHandleMailList.do")
    public AllBackMsg getHandleMailList(String mail, HttpServletRequest request, HttpServletResponse response) throws Exception {
    public AllBackMsg getHandleMailList(String mail,@RequestParam(defaultValue = "1") Integer page,@RequestParam(defaultValue = "20") Integer limit,
                                        HttpServletRequest request, HttpServletResponse response) throws Exception {
        AllBackMsg msg = new AllBackMsg();
        try {
            if (StringUtils.isNotBlank(mail)) {
@@ -137,7 +142,7 @@
            }
            DataSourceEntity dataSourceEntity = MultiDataSource.getDataSourceMap(request);//获取数据源信息
            SpObserver.setDBtoInstance("_" + dataSourceEntity.getDbId());//切换数据源
            List<t482101HList> t482101HEntityList = emailIfc.getHandleMailList(mail, userCode);
            List<t482101HList> t482101HEntityList = emailIfc.getHandleMailList(mail, userCode,page,limit);
            if (t482101HEntityList.size() > 0) {
                msg.setSuccess("执行完成", t482101HEntityList);
            }
@@ -168,11 +173,11 @@
            if (t482101HEntity != null) {
                if (StringUtils.isNotBlank(t482101HEntity.getAttachmentList())) {//附件的处理
                    //获取到附件内容
                    List<AttachmentEntity> attachmentEntities = emailIfc.getAttachmentEntityList(t482101HEntity.getAttachmentList());
                    List<AttachmentEntity> attachmentEntities = mailFileIfc.getAttachmentEntityList(t482101HEntity.getAttachmentList());
                    List<String> list = new ArrayList<>();
                    if (attachmentEntities.size() > 0) {
                        for (AttachmentEntity a : attachmentEntities) {
                            list.add(shoppingImageServer + "/uploads/attachment/" + dataSourceEntity.getDbId() + "/482101/" + a.getUnid() + "@p@" + a.getPhysicalFile());
                            list.add(shoppingImageServer + "/uploads/email/" + dataSourceEntity.getDbId() + "/482101/" + a.getUnid() + "@p@" + a.getPhysicalFile());
                        }
                        t482101HEntity.setAttachmentPath(list);
                    }