From 9bbd62e9e977bd3e0b7db4bb854cbaab29075025 Mon Sep 17 00:00:00 2001 From: "DESKTOP-369JRHT\\12997" <9> Date: Tue, 30 Jul 2024 11:35:37 +0800 Subject: [PATCH] no message --- .../src/views/Site/components/before.vue | 4 +- .../src/views/system/notify/page/mode.vue | 5 +- .../impl/DeptTransactionInfoServiceImpl.java | 2 +- .../sys/mapper/xml/SysNotifyMapper.xml | 6 +- .../service/impl/SysNotifyServiceImpl.java | 87 ++++++++++++------- .../main/resources/mapper/TAccountMapper.xml | 9 +- 6 files changed, 74 insertions(+), 39 deletions(-) diff --git a/fuintAdmin_zt/src/views/Site/components/before.vue b/fuintAdmin_zt/src/views/Site/components/before.vue index 6c9af96f4..e77d1db4f 100644 --- a/fuintAdmin_zt/src/views/Site/components/before.vue +++ b/fuintAdmin_zt/src/views/Site/components/before.vue @@ -72,8 +72,8 @@ export default { // let remainingTransactionVolume = estimatedTransactionVolume - prepaidAmount; let remainingTransactionVolume = estimatedTransactionVolume - this.payMoney; - this.form.estimatedTransactionVolume = estimatedTransactionVolume; - this.form.remainingTransactionVolume = remainingTransactionVolume; + this.form.estimatedTransactionVolume = estimatedTransactionVolume/10000; + this.form.remainingTransactionVolume = remainingTransactionVolume/10000; } }, diff --git a/fuintAdmin_zt/src/views/system/notify/page/mode.vue b/fuintAdmin_zt/src/views/system/notify/page/mode.vue index 31d6e5a82..fc83b5bbe 100644 --- a/fuintAdmin_zt/src/views/system/notify/page/mode.vue +++ b/fuintAdmin_zt/src/views/system/notify/page/mode.vue @@ -146,7 +146,7 @@ - + @@ -367,6 +367,9 @@ export default { }); return }else { + if (!this.form.conditions) { + this.form.conditions = [] + } this.form.conditions.push({ field: '', operator: '', value: '' }); } }, diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/deptPay/service/impl/DeptTransactionInfoServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/deptPay/service/impl/DeptTransactionInfoServiceImpl.java index c78868e0a..a809eb827 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/deptPay/service/impl/DeptTransactionInfoServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/deptPay/service/impl/DeptTransactionInfoServiceImpl.java @@ -102,7 +102,7 @@ public class DeptTransactionInfoServiceImpl implements DeptTransactionInfoServic public DeptTransactionInfo insert(DeptTransactionInfo deptTransactionInfo) { AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); deptTransactionInfo.setCreateName(nowAccountInfo.getRealName()); - deptTransactionInfo.setDeptId(nowAccountInfo.getDeptId()); + // deptTransactionInfo.setDeptId(nowAccountInfo.getDeptId()); // 查询当前是否有进行中的数据,没有则更新状态 DeptTransactionInfo deptTransactionInfo1 = this.deptTransactionInfoMapper.queryByDeptId(nowAccountInfo.getDeptId()); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/sys/mapper/xml/SysNotifyMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/sys/mapper/xml/SysNotifyMapper.xml index 30c60460c..0b720e634 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/sys/mapper/xml/SysNotifyMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/sys/mapper/xml/SysNotifyMapper.xml @@ -77,9 +77,9 @@ template_status,create_by,update_by,update_time,create_time,create_name,conditio - insert into sys_notify(notification_name,notification_type,template_content,recipient_roles,template_status,conditions,create_name,conditions) - values (#{notificationName},#{notificationType},#{templateContent},#{recipientRoles},#{templateStatus},#{conditions},#{createName}, - #{conditions}) + insert into sys_notify(notification_name,notification_type,template_content,recipient_roles,template_status,conditions,create_name) + values (#{notificationName},#{notificationType},#{templateContent},#{recipientRoles},#{templateStatus},#{conditions},#{createName} + ) diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/sys/service/impl/SysNotifyServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/sys/service/impl/SysNotifyServiceImpl.java index 3e3c13799..b81d61633 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/sys/service/impl/SysNotifyServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/sys/service/impl/SysNotifyServiceImpl.java @@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.TypeReference; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -39,6 +40,7 @@ import com.fuint.common.dto.AccountInfo; import javax.annotation.Resource; +import java.math.BigDecimal; import java.time.LocalDate; import java.time.ZoneId; import java.time.temporal.ChronoUnit; @@ -108,9 +110,10 @@ public class SysNotifyServiceImpl extends ServiceImpl sysNotifies = this.sysNotifyMapper.selectList(new QueryWrapper<>()); + // 获取全部通知数据 + LambdaQueryWrapper objectQueryWrapper = new LambdaQueryWrapper<>(); + objectQueryWrapper.eq(SysNotify::getTemplateStatus, true); + + List sysNotifies = this.sysNotifyMapper.selectList(objectQueryWrapper); for (SysNotify notify : sysNotifies) { String recipientRoles = notify.getRecipientRoles(); - String[] array = recipientRoles.split("[\\[\\], ]"); - +// String[] array = recipientRoles.split("[\"\\\\[|\\\\]\", \"\"]"); + String str = recipientRoles.replaceAll("\\[|\\]", ""); // 移除字符串中的中括号 + String[] array = str.split(","); // 使用逗号分割字符串 List> conditionsList = JSON.parseObject(notify.getConditions(), new TypeReference>>() {}); // 判断通知类型 Map map = new HashMap<>(); for (Map stringObjectMap : conditionsList) { - if (ObjectUtil.isNotEmpty(stringObjectMap.get("系统到期日期")) && "".equals(stringObjectMap.get("field"))){ + if (ObjectUtil.isNotEmpty(stringObjectMap.get("field")) && "系统到期日期".equals(stringObjectMap.get("field"))){ map.put("5",stringObjectMap.get("value")); } - if (ObjectUtil.isNotEmpty(stringObjectMap.get("剩余交易流量")) && "".equals(stringObjectMap.get("field"))){ + if (ObjectUtil.isNotEmpty(stringObjectMap.get("field")) && "剩余交易量".equals(stringObjectMap.get("field"))){ map.put("3",stringObjectMap.get("value")); } - if (ObjectUtil.isNotEmpty(stringObjectMap.get("系统服务费统计")) && "".equals(stringObjectMap.get("field"))){ + if (ObjectUtil.isNotEmpty(stringObjectMap.get("field")) && "系统服务费统计".equals(stringObjectMap.get("field"))){ map.put("4",stringObjectMap.get("value")); } + +// if (ObjectUtil.isNotEmpty(stringObjectMap.get("系统到期日期")) && "".equals(stringObjectMap.get("field"))){ +// map.put("5",stringObjectMap.get("value")); +// } +// if (ObjectUtil.isNotEmpty(stringObjectMap.get("剩余交易流量")) && "".equals(stringObjectMap.get("field"))){ +// map.put("3",stringObjectMap.get("value")); +// } +// if (ObjectUtil.isNotEmpty(stringObjectMap.get("系统服务费统计")) && "".equals(stringObjectMap.get("field"))){ +// map.put("4",stringObjectMap.get("value")); +// } } // 根据dutyId查询员工id List accountByRolsIds = tAccountMapper.getAccountByRolsIds(Arrays.asList(array)); @@ -179,13 +197,14 @@ public class SysNotifyServiceImpl extends ServiceImpldaysBetween){ + // 发送通知 + String templateContent = sysNotify1.getTemplateContent(); + String replace = templateContent.replace("{系统到期日期}", "到期时间" + expiryDate.toString() + ",还剩" + daysBetween.toString() + "天"); // sendNotification(notify,accountByRolId); - sysNotify1.setSendType(sysNotify1.getSendType()+"1"); - sysNotify1.setTemplateContent(templateContent); - + sysNotify1.setTemplateContent(replace); + sysNotify1.setSendType(sysNotify1.getSendType() + "1"); + } } + } } - if ("3".equals(accountByRolId.getTurnoverType()) && ObjectUtil.isNotEmpty(map.get("3"))) { - DeptTransactionInfo deptTransactionInfo = deptTransactionInfoMapper.queryByDeptId(accountByRolId.getDeptId()); + if (3 == accountByRolsId.getTurnoverType() && ObjectUtil.isNotEmpty(map.get("3"))) { + DeptTransactionInfo deptTransactionInfo = deptTransactionInfoMapper.queryByDeptId(accountByRolsId.getDeptId()); if (ObjectUtil.isNotEmpty(deptTransactionInfo)) { Double remainingTransactionVolume = deptTransactionInfo.getRemainingTransactionVolume(); - if (Double.parseDouble(map.get("4").toString())-remainingTransactionVolume > 0) { + BigDecimal bigDecimal = new BigDecimal(map.get("3").toString()).multiply(new BigDecimal("10000")); + + if (Double.parseDouble(bigDecimal.toString())-remainingTransactionVolume > 0) { // sendNotification(notify,accountByRolId); String templateContent = sysNotify1.getTemplateContent(); - templateContent.replace("{剩余交易流量}",remainingTransactionVolume.toString()); + String replace = templateContent.replace("{剩余交易量}", remainingTransactionVolume.toString()); sysNotify1.setSendType(sysNotify1.getSendType()+"2"); - sysNotify1.setTemplateContent(templateContent); + sysNotify1.setTemplateContent(replace); } } } - if ("4".equals(accountByRolId.getTurnoverType()) && ObjectUtil.isNotEmpty(map.get("4"))) { - DeptServiceFeeInfo deptServiceFeeInfo = deptServiceFeeInfoMapper.queryByDeptId(accountByRolId.getDeptId()); + if (4== accountByRolsId.getTurnoverType() && ObjectUtil.isNotEmpty(map.get("4"))) { + DeptServiceFeeInfo deptServiceFeeInfo = deptServiceFeeInfoMapper.queryByDeptId(accountByRolsId.getDeptId()); if (ObjectUtil.isNotEmpty(deptServiceFeeInfo)) { Double serviceFeeLimit = deptServiceFeeInfo.getServiceFeeLimit(); - if (Double.parseDouble(map.get("4").toString())-serviceFeeLimit > 0) { + BigDecimal bigDecimal = new BigDecimal(map.get("4").toString()).multiply(new BigDecimal("10000")); + + if (Double.parseDouble(bigDecimal.toString())-serviceFeeLimit > 0) { // sendNotification(notify,accountByRolId); sysNotify1.setSendType(sysNotify1.getSendType()+"3"); String templateContent = sysNotify1.getTemplateContent(); - templateContent.replace("{系统服务费统计}",serviceFeeLimit.toString()); - sysNotify1.setTemplateContent(templateContent); + String replace = templateContent.replace("{系统服务费统计}", serviceFeeLimit.toString()); + sysNotify1.setTemplateContent(replace); } } } + if (!"".equals(sysNotify1.getSendType())) { + sendNotification(sysNotify1); + } } map = new HashMap<>(); - // 发送通知 - sendNotification(sysNotify1); - } + // 发送通知 + } } diff --git a/fuintBackend/fuint-repository/src/main/resources/mapper/TAccountMapper.xml b/fuintBackend/fuint-repository/src/main/resources/mapper/TAccountMapper.xml index 11bda7b69..e27a05740 100644 --- a/fuintBackend/fuint-repository/src/main/resources/mapper/TAccountMapper.xml +++ b/fuintBackend/fuint-repository/src/main/resources/mapper/TAccountMapper.xml @@ -62,8 +62,12 @@