no message

This commit is contained in:
DESKTOP-369JRHT\12997 2024-07-24 15:16:20 +08:00
parent baa12f36c3
commit 23939a5d8d
22 changed files with 310 additions and 48 deletions

View File

@ -16,6 +16,13 @@ export function dutyLists(query) {
params: query params: query
}) })
} }
export function selectyDutyIdsApi(query) {
return request({
url: '/business/member/duty/selectyDutyIds',
method: 'get',
params: query
})
}
// 根据id删除角色信息 // 根据id删除角色信息
export function dutyDelete(id) { export function dutyDelete(id) {

View File

@ -5,38 +5,34 @@
<el-form-item label="" prop="notificationName"> <el-form-item label="" prop="notificationName">
<el-input <el-input
v-model="queryParams.notificationName" v-model="queryParams.notificationName"
placeholder="请选择通知名称" placeholder="请输入通知名称"
clearable clearable
style="width: 240px;" style="width: 240px;"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="" prop="notificationType"> <el-form-item label="" prop="notificationType">
<el-input <el-select v-model="queryParams.notificationType" placeholder="请选择通知类型" clearable style="width: 240px;">
v-model="queryParams.notificationType" <el-option label="到期提醒" value="到期提醒"></el-option>
placeholder="请选择通知类型" <el-option label="库存预警" value="库存预警"></el-option>
clearable <!-- 添加其他选项 -->
style="width: 240px;" </el-select>
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="" prop="recipientRoles">
<el-input
v-model="queryParams.recipientRoles"
placeholder="请选择接收角色"
clearable
style="width: 240px;"
@keyup.enter.native="handleQuery"
/>
</el-form-item> </el-form-item>
<!-- <el-form-item label="" prop="recipientRoles">-->
<!-- <el-input-->
<!-- v-model="queryParams.recipientRoles"-->
<!-- placeholder="请选择接收角色"-->
<!-- clearable-->
<!-- style="width: 240px;"-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<el-form-item label="" prop="templateStatus"> <el-form-item label="" prop="templateStatus">
<el-input <el-select v-model="queryParams.templateStatus" placeholder="请选择通知状态" clearable style="width: 240px;">
v-model="queryParams.templateStatus" <el-option label="启用" value="1"></el-option>
placeholder="请选择通知状态" <el-option label="禁用" value="0"></el-option>
clearable <!-- 添加其他选项 -->
style="width: 240px;" </el-select>
@keyup.enter.native="handleQuery"
/>
</el-form-item> </el-form-item>
<el-form-item style="float: right"> <el-form-item style="float: right">
@ -56,9 +52,15 @@
<el-table-column prop="notificationName" label="通知名称"></el-table-column> <el-table-column prop="notificationName" label="通知名称"></el-table-column>
<el-table-column prop="notificationType" label="通知类型"></el-table-column> <el-table-column prop="notificationType" label="通知类型"></el-table-column>
<el-table-column prop="templateContent" label="模板内容"></el-table-column> <el-table-column prop="templateContent" label="模板内容"></el-table-column>
<el-table-column prop="recipientRoles" label="接收角色"></el-table-column> <el-table-column prop="recipientRolesName" label="接收角色">
<el-table-column prop="templateStatus" label="模板状态"></el-table-column> </el-table-column>
<el-table-column prop="createBy" label="创建人"></el-table-column> <el-table-column prop="templateStatus" label="模板状态">
<template slot-scope="scope">
<el-switch v-model="scope.row.templateStatus" @change="clickSwitch(scope.row)" active-color="#13ce66" inactive-color="#ff4949">
</el-switch>
</template>
</el-table-column>
<el-table-column prop="createName" label="创建人"></el-table-column>
<el-table-column prop="createTime" label="创建时间"></el-table-column> <el-table-column prop="createTime" label="创建时间"></el-table-column>
<el-table-column label="操作" align="center" width="200" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" width="200" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
@ -110,7 +112,7 @@
<!-- 接收角色 --> <!-- 接收角色 -->
<el-form-item label="接收角色" :required="true"> <el-form-item label="接收角色" :required="true">
<el-select v-model="form.recipientRoles" multiple placeholder="请选择角色"> <el-select v-model="form.recipientRoles" multiple placeholder="请选择角色">
<el-option v-for="item in dutyList" :label="item.dutyName" :value="item.dutyId"></el-option> <el-option v-for="item in dutyList1" :label="item.dutyName" :value="item.dutyId"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -157,7 +159,7 @@
import {deleteAppApi, getAppListApi, saveAppApi, updateAppApi} from "@/api/sys/app"; import {deleteAppApi, getAppListApi, saveAppApi, updateAppApi} from "@/api/sys/app";
import {dutyList} from "@/api/duty/duty"; import {dutyList, selectyDutyIdsApi} from "@/api/duty/duty";
import {getSysNotifyList, saveSysNotifyApi, updateSysNotifyApi} from "@/api/sys/sysNotify"; import {getSysNotifyList, saveSysNotifyApi, updateSysNotifyApi} from "@/api/sys/sysNotify";
export default { export default {
@ -166,6 +168,8 @@ export default {
data() { data() {
return { return {
tableData: [], tableData: [],
dutyList1: [],
form: { form: {
id: null, id: null,
notificationName: '', notificationName: '',
@ -186,6 +190,7 @@ export default {
recipientRoles: '', // 255 recipientRoles: '', // 255
templateStatus: true // templateStatus: true //
}, },
dutyNames: {}, // dutyNames
// //
open: false, open: false,
title:"", title:"",
@ -226,6 +231,8 @@ export default {
// }, // },
handleSubmit() { handleSubmit() {
this.open = false
// //
console.log('提交设备信息数据:', this.form); console.log('提交设备信息数据:', this.form);
this.form.conditions = JSON.stringify(this.form.conditions) this.form.conditions = JSON.stringify(this.form.conditions)
@ -236,7 +243,6 @@ export default {
this.getList() this.getList()
this.open = false this.open = false
} }
}) })
}else { }else {
saveSysNotifyApi(this.form).then(res=>{ saveSysNotifyApi(this.form).then(res=>{
@ -277,6 +283,9 @@ export default {
this.form = e this.form = e
this.form.conditions = JSON.parse(this.form.conditions) this.form.conditions = JSON.parse(this.form.conditions)
if (!this.form.conditions) {
this.form.conditions = []
}
this.form.recipientRoles = JSON.parse(this.form.recipientRoles) this.form.recipientRoles = JSON.parse(this.form.recipientRoles)
console.log('提交设备信息数据:', this.deviceInfo); console.log('提交设备信息数据:', this.deviceInfo);
@ -318,11 +327,35 @@ export default {
pageSize: 10000 pageSize: 10000
} }
dutyList(queryParams1).then(res => { dutyList(queryParams1).then(res => {
this.dutyList = res.data.records; this.dutyList1 = res.data.records;
// this.total1 = res.data.total; // this.total1 = res.data.total;
// this.loading = false; // this.loading = false;
}) })
}, },
xunhuanbanduan() {
this.dutyList.forEach(item => {
this.form.recipientRoles.forEach(res=>{
if(item.id === this.form.dutyId) {
this.form.dutyName = item.dutyName
}
})
})
},
clickSwitch(data){
updateSysNotifyApi(data).then(res=>{
if(res.code === 200) {
this.$message({
type: 'info',
message: '修改成功'
});
this.getList()
this.open = false
}
})
},
clean() { clean() {
this.deviceInfo= { this.deviceInfo= {
id: null, // id id: null, // id
@ -330,7 +363,7 @@ export default {
notificationType: '', notificationType: '',
templateContent: '', templateContent: '',
recipientRoles: [], recipientRoles: [],
dutyList: [], dutyList1: [],
templateStatus: true, templateStatus: true,
conditions: [ conditions: [
{ field: '', operator: '', value: '' } { field: '', operator: '', value: '' }

View File

@ -65,8 +65,8 @@
<el-table-column prop="notificationName" label="通知名称"></el-table-column> <el-table-column prop="notificationName" label="通知名称"></el-table-column>
<el-table-column prop="notificationType" label="通知类型"></el-table-column> <el-table-column prop="notificationType" label="通知类型"></el-table-column>
<el-table-column prop="templateContent" label="通知内容"></el-table-column> <el-table-column prop="templateContent" label="通知内容"></el-table-column>
<el-table-column prop="recipientRoles" label="接收角色"></el-table-column> <el-table-column prop="recipientRolesName" label="接收角色"></el-table-column>
<el-table-column prop="recipientRoles" label="通知状态"></el-table-column> <el-table-column prop="sendStatus" label="通知状态"></el-table-column>
<el-table-column prop="createByName" label="创建人"></el-table-column> <el-table-column prop="createByName" label="创建人"></el-table-column>
<el-table-column prop="createTime" label="创建时间"></el-table-column> <el-table-column prop="createTime" label="创建时间"></el-table-column>
@ -181,6 +181,7 @@ import {deleteAppApi, getAppListApi, saveAppApi, updateAppApi} from "@/api/sys/a
import {listUser} from "@/api/system/Site/site"; import {listUser} from "@/api/system/Site/site";
import {dutyList} from "@/api/duty/duty"; import {dutyList} from "@/api/duty/duty";
import {getNotificationlogList, saveSysNotificationApi, updateSysNotificationApi} from "@/api/sys/sysNotificationlog"; import {getNotificationlogList, saveSysNotificationApi, updateSysNotificationApi} from "@/api/sys/sysNotificationlog";
import {getSysNotifyList} from "@/api/sys/sysNotify";
export default { export default {
name: "notify-record", name: "notify-record",
@ -234,7 +235,7 @@ export default {
}, },
methods: { methods: {
getList(){ getList(){
getNotificationlogList(this.queryParams).then(res=>{ getSysNotifyList(this.queryParams).then(res=>{
this.tableData = res.data.records; this.tableData = res.data.records;
this.total = res.data.total this.total = res.data.total
}) })

View File

@ -38,7 +38,7 @@ public class DeptPriceInfo extends BaseEntity {
/** /**
* 状态布尔类型不能为空 * 状态布尔类型不能为空
*/ */
private Boolean status; private Integer status; //0未开始1进行中2已完成
private Integer deptId; private Integer deptId;

View File

@ -22,6 +22,7 @@ public interface DeptPriceInfoMapper {
* @return 实例对象 * @return 实例对象
*/ */
DeptPriceInfo queryById(Integer id); DeptPriceInfo queryById(Integer id);
DeptPriceInfo queryByDeptId(Integer id);
/** /**
* 查询指定行数据 * 查询指定行数据

View File

@ -67,6 +67,13 @@ create_time,create_by
</if> </if>
</where> </where>
</select> </select>
<select id="queryByDeptId" resultType="com.fuint.business.deptPay.entity.DeptPriceInfo">
select
id,price,prepaid_amount,system_validity_period_start,system_validity_period_end,
status,create_time,create_by
from dept_price_info
where deptId = #{deptId}
</select>
<!--新增所有列--> <!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true"> <insert id="insert" keyProperty="id" useGeneratedKeys="true">

View File

@ -57,6 +57,13 @@ public class LjDutyController extends BaseController {
return getSuccessResult(dutyService.selectDutyPage(page,duty)); return getSuccessResult(dutyService.selectDutyPage(page,duty));
} }
// 角色查询
@GetMapping("/selectyDutyIds")
public ResponseObject selectyDutyIds(String dutyId){
return getSuccessResult(dutyService.selectyDutyIds(dutyId));
}
@DeleteMapping("/{dutyId}") @DeleteMapping("/{dutyId}")
public ResponseObject delete(@PathVariable Integer dutyId){ public ResponseObject delete(@PathVariable Integer dutyId){
return getSuccessResult(dutyService.deleteDuty(dutyId)); return getSuccessResult(dutyService.deleteDuty(dutyId));

View File

@ -42,6 +42,7 @@ public interface ILJDutyService extends IService<TDuty> {
* @param id * @param id
*/ */
int deleteDuty(Integer id); int deleteDuty(Integer id);
List<TDuty> selectyDutyIds(String id);
int updateDuty(TDuty duty); int updateDuty(TDuty duty);
} }

View File

@ -15,6 +15,8 @@ import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
@Service @Service
@ -87,6 +89,12 @@ public class LJDutyServiceImpl extends ServiceImpl<LJDutyMapper, TDuty> implemen
public int deleteDuty(Integer id) { public int deleteDuty(Integer id) {
return baseMapper.deleteById(id); return baseMapper.deleteById(id);
} }
@Override
public List<TDuty> selectyDutyIds(String id) {
String[] array = id.split("[\\[\\], ]");
List<TDuty> tDuties = baseMapper.selectBatchIds(new ArrayList<>(Arrays.asList(array)));
return tDuties;
}
@Override @Override
public int updateDuty(TDuty duty) { public int updateDuty(TDuty duty) {

View File

@ -21,6 +21,7 @@ public class SysNotificationlog extends BaseEntity {
* 通知ID关联Notification表的主键 * 通知ID关联Notification表的主键
*/ */
private Integer notifyId; private Integer notifyId;
private Long deptId;
/** /**
* 接收者字符长度最多255不能为空 * 接收者字符长度最多255不能为空
*/ */

View File

@ -35,6 +35,8 @@ public class SysNotify extends BaseEntity {
private String recipientRoles; private String recipientRoles;
@TableField(exist = false) @TableField(exist = false)
private String recipientRolesName; private String recipientRolesName;
private String conditions; private String conditions;
private String createName; private String createName;
/** /**

View File

@ -1,8 +1,10 @@
package com.fuint.business.sys.mapper; package com.fuint.business.sys.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.sys.entity.SysNotificationlog; import com.fuint.business.sys.entity.SysNotificationlog;
import com.fuint.business.sys.entity.SysNotify;
import com.fuint.business.sys.vo.SysNotificationlogVo; import com.fuint.business.sys.vo.SysNotificationlogVo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
@ -14,7 +16,7 @@ import java.util.List;
* @author wangh * @author wangh
* @since 2024-07-22 10:56:33 * @since 2024-07-22 10:56:33
*/ */
public interface SysNotificationlogMapper { public interface SysNotificationlogMapper extends BaseMapper<SysNotificationlog> {
/** /**
* 通过ID查询单条数据 * 通过ID查询单条数据
@ -47,7 +49,7 @@ public interface SysNotificationlogMapper {
* @param sysNotificationlog 实例对象 * @param sysNotificationlog 实例对象
* @return 影响行数 * @return 影响行数
*/ */
int insert(SysNotificationlog sysNotificationlog); int insert1(SysNotificationlog sysNotificationlog);
/** /**
* 批量新增数据MyBatis原生foreach方法 * 批量新增数据MyBatis原生foreach方法

View File

@ -1,7 +1,9 @@
package com.fuint.business.sys.mapper; package com.fuint.business.sys.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.setting.entity.HardwareStore;
import com.fuint.business.sys.entity.SysNotify; import com.fuint.business.sys.entity.SysNotify;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
@ -13,7 +15,7 @@ import java.util.List;
* @author wangh * @author wangh
* @since 2024-07-22 10:56:13 * @since 2024-07-22 10:56:13
*/ */
public interface SysNotifyMapper { public interface SysNotifyMapper extends BaseMapper<SysNotify> {
/** /**
* 通过ID查询单条数据 * 通过ID查询单条数据

View File

@ -74,7 +74,7 @@ id,notify_id,sent_to,sent_at,status,error_message
</select> </select>
<!--新增所有列--> <!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true"> <insert id="insert1" keyProperty="id" useGeneratedKeys="true">
insert into sys_notificationlog(notify_id,sent_to,sent_at,status,error_message) insert into sys_notificationlog(notify_id,sent_to,sent_at,status,error_message)
values (#{notifyId}#{sentTo}#{sentAt}#{status}#{errorMessage}) values (#{notifyId}#{sentTo}#{sentAt}#{status}#{errorMessage})
</insert> </insert>

View File

@ -23,7 +23,8 @@ id,notification_name,notification_type,template_content,recipient_roles,template
<!--查询指定行数据--> <!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="SysNotifyMap"> <select id="queryAllByLimit" resultMap="SysNotifyMap">
select select
id,notification_name,notification_type,template_content,recipient_roles,template_status,create_by,update_by,update_time,create_time,create_name id,notification_name,notification_type,template_content,recipient_roles,
template_status,create_by,update_by,update_time,create_time,create_name,conditions
from sys_notify from sys_notify
<where> <where>
@ -76,8 +77,9 @@ id,notification_name,notification_type,template_content,recipient_roles,template
<!--新增所有列--> <!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true"> <insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into sys_notify(notification_name,notification_type,template_content,recipient_roles,template_status,conditions,create_name) 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}) values (#{notificationName},#{notificationType},#{templateContent},#{recipientRoles},#{templateStatus},#{conditions},#{createName},
#{conditions})
</insert> </insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true"> <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">

View File

@ -2,7 +2,9 @@ package com.fuint.business.sys.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fuint.business.sys.entity.SysNotificationlog; import com.fuint.business.sys.entity.SysNotificationlog;
import com.fuint.business.sys.entity.SysNotify;
import com.fuint.business.sys.vo.SysNotificationlogVo; import com.fuint.business.sys.vo.SysNotificationlogVo;
import io.lettuce.core.dynamic.annotation.Param; import io.lettuce.core.dynamic.annotation.Param;
@ -13,7 +15,7 @@ import io.lettuce.core.dynamic.annotation.Param;
* @author wangh * @author wangh
* @since 2024-07-22 10:56:33 * @since 2024-07-22 10:56:33
*/ */
public interface SysNotificationlogService { public interface SysNotificationlogService extends IService<SysNotificationlog> {
/** /**
* 通过ID查询单条数据 * 通过ID查询单条数据

View File

@ -2,6 +2,7 @@ package com.fuint.business.sys.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fuint.business.sys.entity.SysNotify; import com.fuint.business.sys.entity.SysNotify;
import io.lettuce.core.dynamic.annotation.Param; import io.lettuce.core.dynamic.annotation.Param;
@ -12,7 +13,7 @@ import io.lettuce.core.dynamic.annotation.Param;
* @author wangh * @author wangh
* @since 2024-07-22 10:56:13 * @since 2024-07-22 10:56:13
*/ */
public interface SysNotifyService { public interface SysNotifyService extends IService<SysNotify> {
/** /**
* 通过ID查询单条数据 * 通过ID查询单条数据

View File

@ -2,6 +2,7 @@ package com.fuint.business.sys.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.sys.entity.SysNotificationlog; import com.fuint.business.sys.entity.SysNotificationlog;
import com.fuint.business.sys.mapper.SysNotificationlogMapper; import com.fuint.business.sys.mapper.SysNotificationlogMapper;
import com.fuint.business.sys.service.SysNotificationlogService; import com.fuint.business.sys.service.SysNotificationlogService;
@ -22,7 +23,7 @@ import javax.annotation.Resource;
* @since 2024-07-22 10:56:33 * @since 2024-07-22 10:56:33
*/ */
@Service("sysNotificationlogService") @Service("sysNotificationlogService")
public class SysNotificationlogServiceImpl implements SysNotificationlogService { public class SysNotificationlogServiceImpl extends ServiceImpl<SysNotificationlogMapper, SysNotificationlog> implements SysNotificationlogService {
@Resource @Resource
private SysNotificationlogMapper sysNotificationlogMapper; private SysNotificationlogMapper sysNotificationlogMapper;

View File

@ -1,10 +1,30 @@
package com.fuint.business.sys.service.impl; package com.fuint.business.sys.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.deptPay.mapper.DeptPriceInfoMapper;
import com.fuint.business.deptPay.mapper.DeptServiceFeeInfoMapper;
import com.fuint.business.deptPay.mapper.DeptTransactionInfoMapper;
import com.fuint.business.member.service.ILJDutyService;
import com.fuint.business.member.service.impl.LJDutyServiceImpl;
import com.fuint.business.setting.entity.HardwareStore;
import com.fuint.business.setting.mapper.HardwareStoreMapper;
import com.fuint.business.sys.entity.SysNotificationlog;
import com.fuint.business.sys.entity.SysNotify; import com.fuint.business.sys.entity.SysNotify;
import com.fuint.business.sys.mapper.SysNotifyMapper; import com.fuint.business.sys.mapper.SysNotifyMapper;
import com.fuint.business.sys.service.SysNotificationlogService;
import com.fuint.business.sys.service.SysNotifyService; import com.fuint.business.sys.service.SysNotifyService;
import com.fuint.common.service.AccountService;
import com.fuint.repository.mapper.TAccountMapper;
import com.fuint.repository.model.TAccount;
import com.fuint.system.role.entity.TDuty;
import com.fuint.system.role.service.DutyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.fuint.common.util.TokenUtil; import com.fuint.common.util.TokenUtil;
import io.lettuce.core.dynamic.annotation.Param; import io.lettuce.core.dynamic.annotation.Param;
@ -13,6 +33,7 @@ import com.fuint.common.dto.AccountInfo;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.*;
/** /**
* 存储通知信息的表(SysNotify)表服务实现类 * 存储通知信息的表(SysNotify)表服务实现类
@ -21,9 +42,11 @@ import javax.annotation.Resource;
* @since 2024-07-22 10:56:13 * @since 2024-07-22 10:56:13
*/ */
@Service("sysNotifyService") @Service("sysNotifyService")
public class SysNotifyServiceImpl implements SysNotifyService { public class SysNotifyServiceImpl extends ServiceImpl<SysNotifyMapper, SysNotify> implements SysNotifyService {
@Resource @Resource
private SysNotifyMapper sysNotifyMapper; private SysNotifyMapper sysNotifyMapper;
@Resource
private SysNotificationlogService sysNotificationlogService;
/** /**
* 通过ID查询单条数据 * 通过ID查询单条数据
@ -36,6 +59,9 @@ public class SysNotifyServiceImpl implements SysNotifyService {
return this.sysNotifyMapper.queryById(id); return this.sysNotifyMapper.queryById(id);
} }
@Autowired
ILJDutyService dutyService;
/** /**
* 分页查询 * 分页查询
* *
@ -47,7 +73,19 @@ public class SysNotifyServiceImpl implements SysNotifyService {
public IPage<SysNotify> queryByPage(@Param("page") Page page, SysNotify sysNotify) { public IPage<SysNotify> queryByPage(@Param("page") Page page, SysNotify sysNotify) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
// sysNotify.setStoreId(nowAccountInfo.getStoreId()); // sysNotify.setStoreId(nowAccountInfo.getStoreId());
return this.sysNotifyMapper.queryAllByLimit(page, sysNotify); IPage<SysNotify> sysNotifyIPage = this.sysNotifyMapper.queryAllByLimit(page, sysNotify);
for (SysNotify record : sysNotifyIPage.getRecords()) {
List<TDuty> tDuties = dutyService.selectyDutyIds(record.getRecipientRoles());
StringBuilder recipientRolesNameBuilder = new StringBuilder();
for (TDuty tDuty : tDuties) {
if (recipientRolesNameBuilder.length() > 0) {
recipientRolesNameBuilder.append(",");
}
recipientRolesNameBuilder.append(tDuty.getDutyName());
}
record.setRecipientRolesName(recipientRolesNameBuilder.toString());
}
return sysNotifyIPage;
} }
/** /**
@ -87,4 +125,106 @@ public class SysNotifyServiceImpl implements SysNotifyService {
public boolean deleteById(Integer id) { public boolean deleteById(Integer id) {
return this.sysNotifyMapper.deleteById(id) > 0; return this.sysNotifyMapper.deleteById(id) > 0;
} }
@Resource
DeptPriceInfoMapper deptPriceInfoMapper;
@Resource
DeptServiceFeeInfoMapper deptServiceFeeInfoMapper;
@Resource
DeptTransactionInfoMapper deptTransactionInfoMapper;
// 通知自动发送
public void sendNotify(SysNotify sysNotify) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
List<SysNotify> sysNotifies = this.sysNotifyMapper.selectList(new QueryWrapper<>());
for (SysNotify notify : sysNotifies) {
String recipientRoles = notify.getRecipientRoles();
String[] array = recipientRoles.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"))){
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));
for (TAccount accountByRolsId : accountByRolsIds) {
// 根据id查员工以及dept
TAccount accountByRolId = tAccountMapper.getAccountByRolsId(accountByRolsId.getRoleIds());
if ("5".equals(accountByRolId.getTurnoverType()) && ObjectUtil.isNotEmpty(map.get("5"))) {
// 拿到时间
// deptPriceInfoMapper.count()
}
if ("3".equals(accountByRolId.getTurnoverType()) && ObjectUtil.isNotEmpty(map.get("3"))) {
}
if ("4".equals(accountByRolId.getTurnoverType()) && ObjectUtil.isNotEmpty(map.get("3"))) {
}
}
map = new HashMap<>();
String conditions = notify.getConditions();
if (ObjectUtil.isNotEmpty(conditions)) {
// 使用 fastjson 解析 JSON 数组
// List<Map<String, Object>> conditionsList = JSON.parseObject(notify.getConditions(), new TypeReference<List<Map<String, Object>>>() {});
for (Map<String, Object> stringObjectMap : conditionsList) {
if (ObjectUtil.isNotEmpty(stringObjectMap.get("系统到期日期")) && "".equals(stringObjectMap.get("field"))){
// 根据角色id查询对应的部门
List<TAccount> tAccounts = tAccountMapper.getDeptByRolsIds(Arrays.asList(array),5L);
// 判断部门的条件
// 发送通知
}
if (ObjectUtil.isNotEmpty(stringObjectMap.get("剩余交易流量")) && "".equals(stringObjectMap.get("field"))){
List<TAccount> tAccounts = tAccountMapper.getDeptByRolsIds(Arrays.asList(array),5L);
}
if (ObjectUtil.isNotEmpty(stringObjectMap.get("系统服务费统计")) && "".equals(stringObjectMap.get("field"))){
List<TAccount> tAccounts = tAccountMapper.getDeptByRolsIds(Arrays.asList(array),5L);
}
}
}
}
// sysNotify.setCreateName(nowAccountInfo.getRealName());
// sysNotify.setCreateTime(new java.util.Date());
// sysNotify.setUpdateName(nowAccountInfo.getRealName());
// sysNotify.setUpdateTime()
}
@Resource
AccountService accountService;
@Resource
private TAccountMapper tAccountMapper;
public void sendNotifyOne(Integer id) {
SysNotify sysNotify = baseMapper.queryById(id);
String recipientRoles = sysNotify.getRecipientRoles();
String[] array = recipientRoles.split("[\\[\\], ]");
// 根据dutyId查询员工id
List<TAccount> accountByRolsIds = tAccountMapper.getAccountByRolsIds(Arrays.asList(array));
for (TAccount account : accountByRolsIds) {
// 发送通知
SysNotificationlog sysNotificationlog = new SysNotificationlog();
sysNotificationlog.setNotifyId(sysNotify.getId());
sysNotificationlog.setSentTo(account.getAcctId().toString());
sysNotificationlog.setDeptId(account.getDeptId());
sysNotificationlogService.insert(sysNotificationlog);
}
}
} }

View File

@ -22,5 +22,11 @@ public interface TAccountMapper extends BaseMapper<TAccount> {
// 根据storeId查询对应的站长 // 根据storeId查询对应的站长
List<TAccount> getStationmasterByStoreId(TAccount tAccount); List<TAccount> getStationmasterByStoreId(TAccount tAccount);
// 根绝duptIdList查询
TAccount getAccountByRolsId(@Param("rolsId") String rolsId);
List<TAccount> getAccountByRolsIds(@Param("list") List<String> rolsIds);
List<TAccount> getDeptByRolsIds(@Param("list") List<String> rolsIds,@Param("turnoverType") Long turnoverType);
} }

View File

@ -82,4 +82,6 @@ public class TAccount extends BaseEntity implements Serializable {
@TableField(exist = false) @TableField(exist = false)
private Integer roleId; private Integer roleId;
@TableField(exist = false)
private Integer turnoverType;
} }

View File

@ -60,5 +60,41 @@
ta.dept_id = #{deptId} ta.dept_id = #{deptId}
and td.duty_id = #{roleIds} and td.duty_id = #{roleIds}
</select>
<select id="getAccountByRolsIds" resultType="com.fuint.repository.model.TAccount">
select * from t_account
where role_ids in
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="getDeptByRolsIds" resultType="com.fuint.repository.model.TAccount">
select dept_id deptId,
dept_name deptName,
turnover_type turnoverType
from t_account ta
left join sys_dept td on ta.acct_id = td.acct_id
<where>
role_ids in
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item}
</foreach>
<if test="turnoverType != null">
td.turnover_type = #{turnoverType}
</if>
</where>
group by dept_id
</select>
<select id="getAccountByRolsId" resultType="com.fuint.repository.model.TAccount">
select
dept_id deptId,
dept_name deptName,
turnover_type turnoverType
from t_account
where role_ids = #{rolsId}
group by dept_id
</select> </select>
</mapper> </mapper>