From 47a751cb301d05276ae5d75145d57b2d090fe4e1 Mon Sep 17 00:00:00 2001 From: kongzy <kongzy> Date: 星期一, 01 七月 2024 10:58:35 +0800 Subject: [PATCH] change --- src/main/java/com/nanometer/smartlab/email/EmailSendSchedule.java | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/nanometer/smartlab/email/EmailSendSchedule.java b/src/main/java/com/nanometer/smartlab/email/EmailSendSchedule.java index 387622c..0de3ff8 100644 --- a/src/main/java/com/nanometer/smartlab/email/EmailSendSchedule.java +++ b/src/main/java/com/nanometer/smartlab/email/EmailSendSchedule.java @@ -138,7 +138,7 @@ content.append("</body></html>"); try { - EmailSend.sendArrivalEmail(revicerList,content.toString()); + EmailSend.sendArrivalEmail(revicerList,content.toString(),"-待补货试剂"); // 发送成功,更新邮件发送状态为:已发送 } catch (BusinessException e) { // 发送失败,更新邮件发送状态为:发送失败 @@ -165,6 +165,7 @@ * @date 2021/8/19 9:06 */ @Scheduled(cron = "0 0 2 * * ?") +// @Scheduled(cron = "0/5 * * * * ?") //每隔5秒执行一次 public void ReagentPriceSend(){ //0.限制在姑苏实验室 if (StringUtils.isBlank(reagentApi) || reagentApi.length() == 0) return; @@ -175,8 +176,8 @@ if (admin == null ||StringUtils.isBlank(admin.getEmail())) throw new BusinessException(ExceptionEnumCode.PARAM_NULL,"找不到管理员或者管理员邮箱信息"); //2.获取国药试剂 - String supplierId = sysSupplierService.getSysSupplierIdByname(send_supplier_name); - if (StringUtils.isBlank(supplierId)) + Long supplierId = sysSupplierService.getSysSupplierIdByname(send_supplier_name); + if (supplierId==null) throw new BusinessException(ExceptionEnumCode.PARAM_NO_EXIST, "没有找到与(" + send_supplier_name + ")相关供应商,请检查最近信息更新"); List<SysReagent> guoyao_reagents = sysReagentService.getSysReagentListNew(null, null, supplierId, 1, null, null, null); @@ -204,8 +205,8 @@ BigDecimal goodsCostPrice = goodJson.getBigDecimal("goodsCostPrice"); BigDecimal price = reagent.getPrice(); //保留两位 - BigDecimal price_afterDiscount = SALE_85.multiply(price).setScale(2, RoundingMode.HALF_UP); - if (price_afterDiscount.compareTo(goodsCostPrice) != 0) { + BigDecimal price_afterDiscount = SALE_85.multiply(goodsCostPrice).setScale(2, RoundingMode.HALF_UP); + if (price_afterDiscount.compareTo(price) > 0) { sendDataList.add(new JSONObject() {{ put("goodsName", goodsName); put("goodsCostPrice", goodsCostPrice); @@ -241,7 +242,7 @@ //发送邮件 - EmailSend.sendArrivalEmail(Collections.singletonList(admin.getEmail()),content.toString()); + EmailSend.sendArrivalEmail(Collections.singletonList(admin.getEmail()),content.toString(),"-国药试剂价格变动"); // 发送成功,更新邮件发送状态为:已发送 } catch (BusinessException e) { -- Gitblit v1.9.2