no message

This commit is contained in:
DESKTOP-369JRHT\12997 2024-07-30 11:35:37 +08:00
parent 37b6b1287b
commit 9bbd62e9e9
6 changed files with 74 additions and 39 deletions

View File

@ -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;
}
},

View File

@ -146,7 +146,7 @@
<!-- &lt;!&ndash; 添加其他选项 &ndash;&gt;-->
<!-- </el-select>-->
<el-input v-model="condition.value" placeholder="请输入数值" style="width: 200px;margin-right: 10px">
<template slot="append">{{ condition.field === '剩余交易量' || condition.field === '系统服务有效期' ? '万元' : '天' }}</template>
<template slot="append">{{ condition.field === '剩余交易量' || condition.field === '系统服务费统计' ? '万元' : '天' }}</template>
</el-input>
<el-button @click="removeCondition(index)" type="danger" icon="el-icon-delete" circle></el-button>
</div>
@ -367,6 +367,9 @@ export default {
});
return
}else {
if (!this.form.conditions) {
this.form.conditions = []
}
this.form.conditions.push({ field: '', operator: '', value: '' });
}
},

View File

@ -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());

View File

@ -77,9 +77,9 @@ template_status,create_by,update_by,update_time,create_time,create_name,conditio
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
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}
)
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">

View File

@ -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<SysNotifyMapper, SysNotif
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
// sysNotify.setStoreId(nowAccountInfo.getStoreId());
sysNotify.setCreateName(nowAccountInfo.getRealName());
sendNotify();
this.sysNotifyMapper.insert(sysNotify);
sendNotify();
return sysNotify;
}
@ -148,24 +151,39 @@ public class SysNotifyServiceImpl extends ServiceImpl<SysNotifyMapper, SysNotif
// 通知自动发送
public void sendNotify() {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
List<SysNotify> sysNotifies = this.sysNotifyMapper.selectList(new QueryWrapper<>());
// 获取全部通知数据
LambdaQueryWrapper<SysNotify> objectQueryWrapper = new LambdaQueryWrapper<>();
objectQueryWrapper.eq(SysNotify::getTemplateStatus, true);
List<SysNotify> 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<Map<String, Object>> conditionsList = JSON.parseObject(notify.getConditions(), new TypeReference<List<Map<String, Object>>>() {});
// 判断通知类型
Map<String , Object> map = new HashMap<>();
for (Map<String, Object> 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<TAccount> accountByRolsIds = tAccountMapper.getAccountByRolsIds(Arrays.asList(array));
@ -179,13 +197,14 @@ public class SysNotifyServiceImpl extends ServiceImpl<SysNotifyMapper, SysNotif
sysNotify1.setDeptId(notify.getDeptId());
sysNotify1.setSendType("");
// 根据id查员工以及dept
TAccount accountByRolId = tAccountMapper.getAccountByRolsId(accountByRolsId.getRoleIds());
if ("5".equals(accountByRolId.getTurnoverType()) && ObjectUtil.isNotEmpty(map.get("5"))) {
// TAccount accountByRolId = tAccountMapper.getAccountByRolsId(accountByRolsId.getRoleIds());
// 根据类型判断
if (5 == accountByRolsId.getTurnoverType() && ObjectUtil.isNotEmpty(map.get("5"))) {
// 拿到时间
DeptPriceInfo deptPriceInfo = deptPriceInfoMapper.queryByDeptId(accountByRolId.getDeptId());
DeptPriceInfo deptPriceInfo = deptPriceInfoMapper.queryByDeptId(accountByRolsId.getDeptId());
if (ObjectUtil.isNotEmpty(deptPriceInfo)) {
// 剩余提醒时间
Integer days= Integer.parseInt(map.get("5").toString());
Integer days = Integer.parseInt(map.get("5").toString());
// 过期时间
Date systemValidityPeriodEnd = deptPriceInfo.getSystemValidityPeriodEnd();
// 获取当前时间减去days天判断还剩几天过期 //已过期的不判断
@ -198,51 +217,59 @@ public class SysNotifyServiceImpl extends ServiceImpl<SysNotifyMapper, SysNotif
if (currentDate.isBefore(notificationDate) && currentDate.isBefore(expiryDate)) {
// 计算剩余天数
Long daysBetween = ChronoUnit.DAYS.between(currentDate, expiryDate);
// 发送通知
String templateContent = sysNotify1.getTemplateContent();
templateContent.replace("{系统到期日期}",daysBetween.toString());
if (days>daysBetween){
// 发送通知
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);
}
// 发送通知
}
}

View File

@ -62,8 +62,12 @@
</select>
<select id="getAccountByRolsIds" resultType="com.fuint.repository.model.TAccount">
select * from t_account
where role_ids in
select * ,
td.turnover_type turnoverType
from t_account ta
left join sys_dept td on ta.dept_id = td.dept_id
where role_ids in
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item}
</foreach>
@ -96,6 +100,7 @@
from t_account ta left join sys_dept td on ta.dept_id = td.dept_id
where role_ids = #{rolsId}
group by ta.dept_id
LIMIT 1
</select>
<select id="getByRoleId" resultType="com.fuint.repository.model.TAccount">
SELECT