refactor(sip): 优化邮件发送功能并修复模板邮件 logo 图片显示问题
- 修改 InventoryOuterDetailMapper.xml 中的查询语句,使用参数化查询 - 在 outer.html 和 track.html 中添加 endCallBack 函数,用于刷新表格数据 - 更新 ry-ui.js 中的 Modal 对话框,增加结束回调函数 - 修复 TemplateMailUtil.java 中的邮件发送功能,使用 InputStreamResource 解决 logo 图片显示问题dev_1.0.0
parent
f85e557d1c
commit
0450796bfd
|
|
@ -982,6 +982,12 @@ var table = {
|
||||||
},
|
},
|
||||||
success: function () {
|
success: function () {
|
||||||
$(':focus').blur();
|
$(':focus').blur();
|
||||||
|
},
|
||||||
|
end: function () {
|
||||||
|
let hasOwnProperty = window.hasOwnProperty('endCallBack');
|
||||||
|
if (hasOwnProperty) {
|
||||||
|
endCallBack();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
top.layer.full(index);
|
top.layer.full(index);
|
||||||
|
|
|
||||||
|
|
@ -368,6 +368,9 @@
|
||||||
})
|
})
|
||||||
|
|
||||||
});
|
});
|
||||||
|
function endCallBack(){
|
||||||
|
$.table.search()
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
@ -154,6 +154,9 @@
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
function endCallBack(){
|
||||||
|
$.table.search()
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.ruoyi.sip.utils;
|
package com.ruoyi.sip.utils;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.core.io.resource.InputStreamResource;
|
||||||
import cn.hutool.core.lang.Dict;
|
import cn.hutool.core.lang.Dict;
|
||||||
import cn.hutool.extra.mail.Mail;
|
import cn.hutool.extra.mail.Mail;
|
||||||
import cn.hutool.extra.template.Template;
|
import cn.hutool.extra.template.Template;
|
||||||
|
|
@ -54,12 +55,14 @@ public class TemplateMailUtil {
|
||||||
|
|
||||||
try{
|
try{
|
||||||
org.springframework.core.io.Resource resource = SpringUtils.getResource("classpath:static/img/companyLogo.png");
|
org.springframework.core.io.Resource resource = SpringUtils.getResource("classpath:static/img/companyLogo.png");
|
||||||
|
// 使用 InputStreamResource 包装输入流
|
||||||
|
InputStreamResource imageResource = new InputStreamResource(resource.getInputStream());
|
||||||
Mail mail = Mail.create()
|
Mail mail = Mail.create()
|
||||||
.setTos(toEmail.toArray(new String[0]))
|
.setTos(toEmail.toArray(new String[0]))
|
||||||
.setTitle(title)
|
.setTitle(title)
|
||||||
.setContent(result)
|
.setContent(result)
|
||||||
.setHtml(true);
|
.setHtml(true);
|
||||||
mail.addImage("signature",resource.getFile());
|
mail.addImage("signature",imageResource.getStream());
|
||||||
mail.send();
|
mail.send();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("发送邮件失败,错误原因:{},错误详情:{}",e.getMessage(),e.getStackTrace());
|
log.error("发送邮件失败,错误原因:{},错误详情:{}",e.getMessage(),e.getStackTrace());
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
left join oms_warehouse_info t3 on t2.warehouse_id=t3.id
|
left join oms_warehouse_info t3 on t2.warehouse_id=t3.id
|
||||||
left join product_info t4 on t1.product_code=t4.product_code
|
left join product_info t4 on t1.product_code=t4.product_code
|
||||||
WHERE
|
WHERE
|
||||||
t1.id = 8
|
t1.id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertInventoryOuterDetail" parameterType="InventoryOuterDetail" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertInventoryOuterDetail" parameterType="InventoryOuterDetail" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue