no message
This commit is contained in:
parent
1bd695ba5f
commit
aac4621621
@ -9,6 +9,13 @@ export function getSysNotifyList(query) {
|
||||
params: query
|
||||
|
||||
})
|
||||
}// 分页查询所有的订单信息
|
||||
export function getSendNotifyApi(query) {
|
||||
return request({
|
||||
url: 'sysNotify/sendNotify',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
//
|
||||
export function deleteSysNotifyApi(PayId) {
|
||||
|
@ -8,6 +8,12 @@ export function getYearListApi(query) {
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}export function getALlInfoBydeptIdApi(query) {
|
||||
return request({
|
||||
url: 'deptpay/deptPriceInfo/getALlInfoBydeptId',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
//
|
||||
export function addYearApi(data) {
|
||||
|
@ -2,7 +2,7 @@
|
||||
import {
|
||||
addAfterApi,
|
||||
addYearApi,
|
||||
getAfterListApi,
|
||||
getAfterListApi, getALlInfoBydeptIdApi,
|
||||
getYearListApi,
|
||||
updateAfterApi,
|
||||
updateYearApi
|
||||
@ -25,12 +25,13 @@ export default {
|
||||
}, ],
|
||||
form: {
|
||||
deductionRate: '', // 扣点费率
|
||||
likelyTransactionVolume: '100', // 已发生交易流量
|
||||
likelyTransactionVolume: '0', // 已发生交易流量
|
||||
serviceFeeStatistics: 0, // 系统服务费统计(这里假设为0,实际可能需要计算)
|
||||
serviceFeeLimit: '', // 系统服务费限制
|
||||
paymentAmount: '', // 收款金额
|
||||
deptId:this.deptId,
|
||||
},
|
||||
sum:''
|
||||
}
|
||||
},
|
||||
props: {
|
||||
@ -45,6 +46,12 @@ export default {
|
||||
this.tableData = res.data.records
|
||||
})
|
||||
},
|
||||
getData() {
|
||||
getALlInfoBydeptIdApi({deptId : this.deptId}).then(res => {
|
||||
this.form.serviceFeeStatistics = res.data.payMoney;
|
||||
this.form.likelyTransactionVolume = res.data.payMoney;
|
||||
})
|
||||
},
|
||||
onSubmit() {
|
||||
console.log('表单提交', this.form);
|
||||
// 在这里添加提交表单的逻辑
|
||||
@ -135,6 +142,11 @@ export default {
|
||||
prop="status"
|
||||
align="center"
|
||||
label="状态">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.status == 0">未开始</span>
|
||||
<span v-if="scope.row.status == 1">进行中</span>
|
||||
<span v-if="scope.row.status == 2">已完成</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="createTime"
|
||||
@ -198,7 +210,6 @@ export default {
|
||||
<el-form :model="form" label-width="120px">
|
||||
<el-form-item label="扣点费率">
|
||||
<!-- 假设扣点费率是固定的,这里仅显示 -->
|
||||
<span>{{ form.deductionRate }}</span>
|
||||
<el-input v-model="form.deductionRate" placeholder="" readonly></el-input>
|
||||
|
||||
</el-form-item>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<script>
|
||||
import {
|
||||
addBeforeApi,
|
||||
addBeforerApi,
|
||||
addBeforerApi, getALlInfoBydeptIdApi,
|
||||
getBeforeListApi,
|
||||
getBeforerListApi, updateBeforeApi,
|
||||
updateBeforerApi
|
||||
@ -22,21 +22,22 @@ export default {
|
||||
upadate: '2016-05-02',
|
||||
}, ],
|
||||
form: {
|
||||
prepaidAmount:'',
|
||||
deductionRate:'',
|
||||
estimatedTransactionVolume:'',
|
||||
remainingTransactionVolume:'',
|
||||
prepaidAmount:null,
|
||||
deductionRate:null,
|
||||
estimatedTransactionVolume:null,
|
||||
remainingTransactionVolume:null,
|
||||
|
||||
},
|
||||
form2: {
|
||||
form: {
|
||||
deductionRate: 1, // 扣点费率
|
||||
transactionVolume: '', // 已发生交易流量
|
||||
systemServiceFee: 0, // 系统服务费统计(这里假设为0,实际可能需要计算)
|
||||
serviceFeeLimit: 5000, // 系统服务费限制
|
||||
receiptAmount: '', // 收款金额
|
||||
},
|
||||
}
|
||||
// form2: {
|
||||
// form: {
|
||||
// deductionRate: 1, // 扣点费率
|
||||
// transactionVolume: '', // 已发生交易流量
|
||||
// systemServiceFee: 0, // 系统服务费统计(这里假设为0,实际可能需要计算)
|
||||
// serviceFeeLimit: 5000, // 系统服务费限制
|
||||
// receiptAmount: '', // 收款金额
|
||||
// },
|
||||
// },
|
||||
payMoney:'0'
|
||||
}
|
||||
},
|
||||
props: {
|
||||
@ -44,6 +45,7 @@ export default {
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
this.getData()
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
@ -51,6 +53,11 @@ export default {
|
||||
this.tableData = res.data.records
|
||||
})
|
||||
},
|
||||
getData() {
|
||||
getALlInfoBydeptIdApi({deptId : this.deptId}).then(res => {
|
||||
this.payMoney = res.data.payMoney
|
||||
})
|
||||
},
|
||||
onCancel() {
|
||||
// 取消操作逻辑
|
||||
console.log('取消操作');
|
||||
@ -60,12 +67,16 @@ export default {
|
||||
inputval() {
|
||||
// if (
|
||||
// )
|
||||
if (!this.form.prepaidAmount || !this.form.deductionRate) {
|
||||
return
|
||||
}
|
||||
let prepaidAmount = this.form.prepaidAmount;
|
||||
let deductionRate = this.form.deductionRate / 1000;
|
||||
let deductionRate = this.form.deductionRate / 10000;
|
||||
|
||||
if (!isNaN(prepaidAmount) && !isNaN(deductionRate)) {
|
||||
let estimatedTransactionVolume = prepaidAmount / (1 - deductionRate);
|
||||
let remainingTransactionVolume = estimatedTransactionVolume - prepaidAmount;
|
||||
let estimatedTransactionVolume = prepaidAmount / deductionRate;
|
||||
// let remainingTransactionVolume = estimatedTransactionVolume - prepaidAmount;
|
||||
let remainingTransactionVolume = estimatedTransactionVolume - this.payMoney;
|
||||
|
||||
this.form.estimatedTransactionVolume = estimatedTransactionVolume;
|
||||
this.form.remainingTransactionVolume = remainingTransactionVolume;
|
||||
@ -87,11 +98,14 @@ export default {
|
||||
})
|
||||
}
|
||||
},
|
||||
handleUpdate1(){
|
||||
handleUpdate1(data){
|
||||
this.dialogVisible=true
|
||||
// this.form = data
|
||||
|
||||
},
|
||||
handleEdit(data){
|
||||
this.form = data
|
||||
console.log("123",data)
|
||||
this.dialogVisible=true
|
||||
|
||||
},
|
||||
@ -131,6 +145,11 @@ export default {
|
||||
prop="status"
|
||||
align="center"
|
||||
label="状态">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.status == 0">未开始</span>
|
||||
<span v-if="scope.row.status == 1">进行中</span>
|
||||
<span v-if="scope.row.status == 2">已完成</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="createTime"
|
||||
@ -153,7 +172,7 @@ export default {
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
@click="handleEdit(scope.$index, scope.row)">修改</el-button>
|
||||
@click="handleEdit( scope.row)">修改</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
@ -114,7 +114,9 @@ export default {
|
||||
align="center"
|
||||
label="状态">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.status?'已完成':'未完成'}}</span>
|
||||
<span v-if="scope.row.status == 0">未开始</span>
|
||||
<span v-if="scope.row.status == 1">进行中</span>
|
||||
<span v-if="scope.row.status == 2">已完成</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
@ -137,6 +139,7 @@ export default {
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
v-if="scope.row.status == 0"
|
||||
size="mini"
|
||||
@click="handleEdit(scope.row)">修改</el-button>
|
||||
|
||||
|
@ -4,48 +4,36 @@
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px">
|
||||
<el-form-item label="" prop="deptName">
|
||||
<el-input
|
||||
v-model="queryParams.deptName"
|
||||
v-model="queryParams.notificationName"
|
||||
placeholder="请输入选择通知名称"
|
||||
clearable
|
||||
style="width: 240px;"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="" prop="legalRepresentativeContact">
|
||||
<el-input
|
||||
v-model="queryParams.legalRepresentativeContact"
|
||||
placeholder="请选择通知类型"
|
||||
clearable
|
||||
style="width: 240px;"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
<el-form-item label="" prop="notificationType">
|
||||
<el-select v-model="queryParams.notificationType" placeholder="请选择通知类型" clearable style="width: 240px;">
|
||||
<el-option label="到期提醒" value="到期提醒"></el-option>
|
||||
<el-option label="库存预警" value="库存预警"></el-option>
|
||||
<!-- 添加其他选项 -->
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="" prop="appStatus">
|
||||
<el-input
|
||||
v-model="queryParams.appStatus"
|
||||
placeholder="请选择小程序状态"
|
||||
clearable
|
||||
style="width: 240px;"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="" prop="appStatus">
|
||||
<el-input
|
||||
v-model="queryParams.appStatus"
|
||||
placeholder="请选择接受角色"
|
||||
clearable
|
||||
style="width: 240px;"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="" prop="appStatus">
|
||||
<el-input
|
||||
v-model="queryParams.appStatus"
|
||||
placeholder="请选择通知状态"
|
||||
clearable
|
||||
style="width: 240px;"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
|
||||
<!-- <el-form-item label="" prop="appStatus">-->
|
||||
<!-- <el-input-->
|
||||
<!-- v-model="queryParams.appStatus"-->
|
||||
<!-- placeholder="请选择接受角色"-->
|
||||
<!-- clearable-->
|
||||
<!-- style="width: 240px;"-->
|
||||
<!-- @keyup.enter.native="handleQuery"-->
|
||||
<!-- />-->
|
||||
<!-- </el-form-item>-->
|
||||
<el-form-item label="" prop="templateStatus">
|
||||
<el-select v-model="queryParams.templateStatus" placeholder="请选择通知状态" clearable style="width: 240px;">
|
||||
<el-option label="启用" value="1"></el-option>
|
||||
<el-option label="禁用" value="0"></el-option>
|
||||
<!-- 添加其他选项 -->
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item style="float: right">
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
||||
@ -85,6 +73,12 @@
|
||||
icon="el-icon-edit"
|
||||
@click="del(scope.row)"
|
||||
>删除</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="send(scope.row.id)"
|
||||
>发送通知</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@ -122,7 +116,7 @@
|
||||
<!-- 接收角色 -->
|
||||
<el-form-item label="接收角色" :required="true">
|
||||
<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-form-item>
|
||||
<el-form-item label="接收用户" :required="true">
|
||||
@ -181,7 +175,7 @@ import {deleteAppApi, getAppListApi, saveAppApi, updateAppApi} from "@/api/sys/a
|
||||
import {listUser} from "@/api/system/Site/site";
|
||||
import {dutyList} from "@/api/duty/duty";
|
||||
import {getNotificationlogList, saveSysNotificationApi, updateSysNotificationApi} from "@/api/sys/sysNotificationlog";
|
||||
import {getSysNotifyList} from "@/api/sys/sysNotify";
|
||||
import {getSendNotifyApi, getSysNotifyList} from "@/api/sys/sysNotify";
|
||||
|
||||
export default {
|
||||
name: "notify-record",
|
||||
@ -203,7 +197,8 @@ export default {
|
||||
|
||||
]
|
||||
},
|
||||
dutyList:[],
|
||||
// dutyList:[],
|
||||
dutyList1:[],
|
||||
|
||||
// 用户表格数据
|
||||
userList: null,
|
||||
@ -253,6 +248,15 @@ export default {
|
||||
}
|
||||
});
|
||||
},
|
||||
// 发送通知
|
||||
send(data) {
|
||||
getSendNotifyApi({id :data}).then(res=>{
|
||||
if(res.code === 200) {
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
handleQuery(){
|
||||
this.getList()
|
||||
@ -281,6 +285,7 @@ export default {
|
||||
if(res.code === 200) {
|
||||
this.getList()
|
||||
this.open = false
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
@ -302,6 +307,7 @@ export default {
|
||||
this.title = "编辑设备"
|
||||
this.form = e
|
||||
this.form.recipientUser = JSON.parse(this.form.recipientUser)
|
||||
this.getDutyList()
|
||||
|
||||
console.log('提交设备信息数据:', this.deviceInfo);
|
||||
|
||||
@ -376,7 +382,7 @@ export default {
|
||||
pageSize: 10000
|
||||
}
|
||||
dutyList(queryParams1).then(res => {
|
||||
this.dutyList = res.data.records;
|
||||
this.dutyList1 = res.data.records;
|
||||
// this.total1 = res.data.total;
|
||||
// this.loading = false;
|
||||
})
|
||||
|
@ -60,6 +60,10 @@ public class DeptPriceInfoController extends BaseController {
|
||||
public ResponseObject queryById(@PathVariable("id") Integer id) {
|
||||
return getSuccessResult(this.deptPriceInfoService.queryById(id));
|
||||
}
|
||||
@GetMapping("/getALlInfoBydeptId")
|
||||
public ResponseObject getALlInfoBydeptId(Long deptId) {
|
||||
return getSuccessResult(this.deptPriceInfoService.getALlInfoBydeptId(deptId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
|
@ -6,6 +6,7 @@ import com.fuint.business.deptPay.entity.DeptPriceInfo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 存储年付费的表(DeptPriceInfo)表数据库访问层
|
||||
@ -22,7 +23,7 @@ public interface DeptPriceInfoMapper {
|
||||
* @return 实例对象
|
||||
*/
|
||||
DeptPriceInfo queryById(Integer id);
|
||||
DeptPriceInfo queryByDeptId(Integer id);
|
||||
DeptPriceInfo queryByDeptId(Long deptId);
|
||||
|
||||
/**
|
||||
* 查询指定行数据
|
||||
@ -82,5 +83,6 @@ public interface DeptPriceInfoMapper {
|
||||
*/
|
||||
int deleteById(Integer id);
|
||||
|
||||
Map<String, Object> getALlInfoBydeptId(@Param("deptId") List<Long> deptId);
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,7 @@ public interface DeptServiceFeeInfoMapper {
|
||||
* @return 实例对象
|
||||
*/
|
||||
DeptServiceFeeInfo queryById(Integer id);
|
||||
DeptServiceFeeInfo queryByDeptId(Long id);
|
||||
|
||||
/**
|
||||
* 查询指定行数据
|
||||
|
@ -23,6 +23,8 @@ public interface DeptTransactionInfoMapper {
|
||||
*/
|
||||
DeptTransactionInfo queryById(Integer id);
|
||||
|
||||
DeptTransactionInfo queryByDeptId(Long id);
|
||||
|
||||
/**
|
||||
* 查询指定行数据
|
||||
*
|
||||
|
@ -73,6 +73,16 @@ create_time,create_by
|
||||
status,create_time,create_by
|
||||
from dept_price_info
|
||||
where deptId = #{deptId}
|
||||
and status = 1
|
||||
</select>
|
||||
<select id="getALlInfoBydeptId" resultType="java.util.Map">
|
||||
select sum(pay_money) payMoney
|
||||
from all_order_info
|
||||
where
|
||||
store_id in
|
||||
<foreach collection="deptId" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<!--新增所有列-->
|
||||
|
@ -79,6 +79,13 @@ service_fee_statistics,service_fee_limit,status
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="queryByDeptId" resultType="com.fuint.business.deptPay.entity.DeptServiceFeeInfo">
|
||||
select
|
||||
id,deduction_rate,payment_amount,likely_transaction_volume,service_fee_statistics,service_fee_limit,status
|
||||
from dept_service_fee_info
|
||||
where deptId = #{deptId}
|
||||
and status = 1
|
||||
</select>
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
||||
|
@ -75,6 +75,14 @@ remaining_transaction_volume,status,create_time,create_by
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="queryByDeptId" resultType="com.fuint.business.deptPay.entity.DeptTransactionInfo">
|
||||
select
|
||||
id,prepaid_amount,deduction_rate,estimated_transaction_volume,
|
||||
remaining_transaction_volume,status,create_time,create_by
|
||||
from dept_transaction_info
|
||||
where deptId = #{deptId}
|
||||
and status = 1
|
||||
</select>
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
||||
|
@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.deptPay.entity.DeptPriceInfo;
|
||||
import io.lettuce.core.dynamic.annotation.Param;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 存储年付费的表(DeptPriceInfo)表服务接口
|
||||
@ -55,4 +57,11 @@ public interface DeptPriceInfoService {
|
||||
*/
|
||||
boolean deleteById(Integer id);
|
||||
|
||||
/**
|
||||
* 根据条件查询数据
|
||||
*
|
||||
* @param deptPriceInfo 筛选条件
|
||||
* @return 对象列表
|
||||
*/
|
||||
Map<String,Object> getALlInfoBydeptId(Long deptId) ;
|
||||
}
|
||||
|
@ -5,6 +5,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.deptPay.entity.DeptPriceInfo;
|
||||
import com.fuint.business.deptPay.mapper.DeptPriceInfoMapper;
|
||||
import com.fuint.business.deptPay.service.DeptPriceInfoService;
|
||||
import com.fuint.business.store.mapper.MtStoreMapper;
|
||||
import com.fuint.system.dept.mapper.SysDeptMapper;
|
||||
import lombok.Data;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import io.lettuce.core.dynamic.annotation.Param;
|
||||
@ -13,6 +16,8 @@ import com.fuint.common.dto.AccountInfo;
|
||||
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 存储年付费的表(DeptPriceInfo)表服务实现类
|
||||
@ -47,6 +52,8 @@ public class DeptPriceInfoServiceImpl implements DeptPriceInfoService {
|
||||
public IPage<DeptPriceInfo> queryByPage(@Param("page") Page page, DeptPriceInfo deptPriceInfo) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
// deptPriceInfo.setStoreId(nowAccountInfo.getStoreId());
|
||||
// 判断以进行中的数据进行判断并修改状态
|
||||
// Data data = new Data();
|
||||
return this.deptPriceInfoMapper.queryAllByLimit(page, deptPriceInfo);
|
||||
}
|
||||
|
||||
@ -86,4 +93,14 @@ public class DeptPriceInfoServiceImpl implements DeptPriceInfoService {
|
||||
public boolean deleteById(Integer id) {
|
||||
return this.deptPriceInfoMapper.deleteById(id) > 0;
|
||||
}
|
||||
@Resource
|
||||
private SysDeptMapper sysDeptMapper;
|
||||
@Resource
|
||||
private MtStoreMapper mtStoreMapper;
|
||||
public Map<String,Object> getALlInfoBydeptId(Long deptId) {
|
||||
List<Long> strings = sysDeptMapper.selectChildByDeptIdR(deptId);
|
||||
List<Long> longs = mtStoreMapper.queryStoresByDeptIdsR(strings);
|
||||
return deptPriceInfoMapper.getALlInfoBydeptId(longs);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ public class LJOrder extends BaseEntity implements Serializable {
|
||||
private List<Long> storeIds;
|
||||
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
private String count;
|
||||
|
||||
}
|
||||
|
@ -59,6 +59,11 @@ public class SysNotifyController extends BaseController {
|
||||
public ResponseObject queryById(@PathVariable("id") Integer id) {
|
||||
return getSuccessResult(this.sysNotifyService.queryById(id));
|
||||
}
|
||||
@GetMapping("/sendNotify")
|
||||
public ResponseObject sendNotify(Integer id) {
|
||||
this.sysNotifyService.sendNotifyOne(id);
|
||||
return getSuccessResult(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
|
@ -1,6 +1,9 @@
|
||||
package com.fuint.business.sys.entity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fuint.repository.model.base.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
@ -16,6 +19,8 @@ public class SysNotificationlog extends BaseEntity {
|
||||
/**
|
||||
* 自增的主键,用于唯一标识每条记录
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
|
||||
private Integer id;
|
||||
/**
|
||||
* 通知ID,关联Notification表的主键
|
||||
@ -38,6 +43,7 @@ public class SysNotificationlog extends BaseEntity {
|
||||
* 错误信息,不限字符长度,可以为空
|
||||
*/
|
||||
private String errorMessage;
|
||||
private String content;
|
||||
|
||||
|
||||
|
||||
|
@ -1,9 +1,13 @@
|
||||
package com.fuint.business.sys.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fuint.repository.model.base.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* 存储通知信息的表(SysNotify)实体类
|
||||
*
|
||||
@ -16,6 +20,7 @@ public class SysNotify extends BaseEntity {
|
||||
/**
|
||||
* 自增的主键,用于唯一标识每条记录
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
/**
|
||||
* 通知名称,字符长度最多100,不能为空
|
||||
@ -29,12 +34,23 @@ public class SysNotify extends BaseEntity {
|
||||
* 模板内容,不限字符长度,不能为空
|
||||
*/
|
||||
private String templateContent;
|
||||
private Integer type;
|
||||
private Integer sendStatus;
|
||||
/**
|
||||
* 接收角色,字符长度最多255,不能为空
|
||||
*/
|
||||
private String recipientRoles;
|
||||
@TableField(exist = false)
|
||||
private String recipientRolesName;
|
||||
@TableField(exist = false)
|
||||
private Long acctId;
|
||||
@TableField(exist = false)
|
||||
private Long deptId;
|
||||
@TableField(exist = false)
|
||||
private String sendType;
|
||||
|
||||
@TableField(exist = false)
|
||||
private HashMap<String,String> mapType;
|
||||
|
||||
|
||||
private String conditions;
|
||||
|
@ -40,6 +40,8 @@ public interface SysNotifyService extends IService<SysNotify> {
|
||||
*/
|
||||
SysNotify insert(SysNotify sysNotify);
|
||||
|
||||
void sendNotify();
|
||||
void sendNotifyOne(Integer id);
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.fuint.business.sys.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
@ -7,6 +8,9 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fuint.business.deptPay.entity.DeptPriceInfo;
|
||||
import com.fuint.business.deptPay.entity.DeptServiceFeeInfo;
|
||||
import com.fuint.business.deptPay.entity.DeptTransactionInfo;
|
||||
import com.fuint.business.deptPay.mapper.DeptPriceInfoMapper;
|
||||
import com.fuint.business.deptPay.mapper.DeptServiceFeeInfoMapper;
|
||||
import com.fuint.business.deptPay.mapper.DeptTransactionInfoMapper;
|
||||
@ -33,6 +37,9 @@ import com.fuint.common.dto.AccountInfo;
|
||||
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@ -134,7 +141,7 @@ public class SysNotifyServiceImpl extends ServiceImpl<SysNotifyMapper, SysNotif
|
||||
@Resource
|
||||
DeptTransactionInfoMapper deptTransactionInfoMapper;
|
||||
// 通知自动发送
|
||||
public void sendNotify(SysNotify sysNotify) {
|
||||
public void sendNotify() {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
List<SysNotify> sysNotifies = this.sysNotifyMapper.selectList(new QueryWrapper<>());
|
||||
for (SysNotify notify : sysNotifies) {
|
||||
@ -158,55 +165,82 @@ public class SysNotifyServiceImpl extends ServiceImpl<SysNotifyMapper, SysNotif
|
||||
// 根据dutyId查询员工id
|
||||
List<TAccount> accountByRolsIds = tAccountMapper.getAccountByRolsIds(Arrays.asList(array));
|
||||
|
||||
// 存储发送信息
|
||||
for (TAccount accountByRolsId : accountByRolsIds) {
|
||||
SysNotify sysNotify1 = new SysNotify();
|
||||
sysNotify1.setTemplateContent(notify.getTemplateContent());
|
||||
sysNotify1.setId(notify.getId());
|
||||
sysNotify1.setAcctId(Long.valueOf(accountByRolsId.getAcctId()));
|
||||
sysNotify1.setDeptId(notify.getDeptId());
|
||||
sysNotify1.setSendType("");
|
||||
// 根据id查员工以及dept
|
||||
TAccount accountByRolId = tAccountMapper.getAccountByRolsId(accountByRolsId.getRoleIds());
|
||||
if ("5".equals(accountByRolId.getTurnoverType()) && ObjectUtil.isNotEmpty(map.get("5"))) {
|
||||
// 拿到时间
|
||||
// deptPriceInfoMapper.count()
|
||||
DeptPriceInfo deptPriceInfo = deptPriceInfoMapper.queryByDeptId(accountByRolId.getDeptId());
|
||||
if (ObjectUtil.isNotEmpty(deptPriceInfo)) {
|
||||
// 剩余提醒时间
|
||||
Integer days= Integer.parseInt(map.get("5").toString());
|
||||
// 过期时间
|
||||
Date systemValidityPeriodEnd = deptPriceInfo.getSystemValidityPeriodEnd();
|
||||
// 获取当前时间减去days天判断还剩几天过期 //已过期的不判断
|
||||
LocalDate expiryDate = convertToLocalDateViaInstant(systemValidityPeriodEnd);
|
||||
// 计算提醒日期,即过期日期减去指定的天数
|
||||
LocalDate notificationDate = expiryDate.minusDays(days);
|
||||
// 获取当前日期
|
||||
LocalDate currentDate = LocalDate.now();
|
||||
// 检查当前日期是否在提醒日期之前,且deptPriceInfo未过期
|
||||
if (currentDate.isBefore(notificationDate) && currentDate.isBefore(expiryDate)) {
|
||||
// 计算剩余天数
|
||||
Long daysBetween = ChronoUnit.DAYS.between(currentDate, expiryDate);
|
||||
// 发送通知
|
||||
String templateContent = sysNotify1.getTemplateContent();
|
||||
templateContent.replace("{系统到期日期}",daysBetween.toString());
|
||||
// sendNotification(notify,accountByRolId);
|
||||
sysNotify1.setSendType(sysNotify1.getSendType()+"1");
|
||||
sysNotify1.setTemplateContent(templateContent);
|
||||
|
||||
}
|
||||
}
|
||||
if ("3".equals(accountByRolId.getTurnoverType()) && ObjectUtil.isNotEmpty(map.get("3"))) {
|
||||
DeptTransactionInfo deptTransactionInfo = deptTransactionInfoMapper.queryByDeptId(accountByRolId.getDeptId());
|
||||
if (ObjectUtil.isNotEmpty(deptTransactionInfo)) {
|
||||
Double remainingTransactionVolume = deptTransactionInfo.getRemainingTransactionVolume();
|
||||
if (Double.parseDouble(map.get("4").toString())-remainingTransactionVolume > 0) {
|
||||
// sendNotification(notify,accountByRolId);
|
||||
String templateContent = sysNotify1.getTemplateContent();
|
||||
|
||||
templateContent.replace("{剩余交易流量}",remainingTransactionVolume.toString());
|
||||
|
||||
sysNotify1.setSendType(sysNotify1.getSendType()+"2");
|
||||
sysNotify1.setTemplateContent(templateContent);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if ("4".equals(accountByRolId.getTurnoverType()) && ObjectUtil.isNotEmpty(map.get("3"))) {
|
||||
|
||||
if ("4".equals(accountByRolId.getTurnoverType()) && ObjectUtil.isNotEmpty(map.get("4"))) {
|
||||
DeptServiceFeeInfo deptServiceFeeInfo = deptServiceFeeInfoMapper.queryByDeptId(accountByRolId.getDeptId());
|
||||
if (ObjectUtil.isNotEmpty(deptServiceFeeInfo)) {
|
||||
Double serviceFeeLimit = deptServiceFeeInfo.getServiceFeeLimit();
|
||||
if (Double.parseDouble(map.get("4").toString())-serviceFeeLimit > 0) {
|
||||
// sendNotification(notify,accountByRolId);
|
||||
sysNotify1.setSendType(sysNotify1.getSendType()+"3");
|
||||
String templateContent = sysNotify1.getTemplateContent();
|
||||
templateContent.replace("{系统服务费统计}",serviceFeeLimit.toString());
|
||||
sysNotify1.setTemplateContent(templateContent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// 发送通知
|
||||
sendNotification(sysNotify1);
|
||||
}
|
||||
}
|
||||
// sysNotify.setCreateName(nowAccountInfo.getRealName());
|
||||
// sysNotify.setCreateTime(new java.util.Date());
|
||||
// sysNotify.setUpdateName(nowAccountInfo.getRealName());
|
||||
// sysNotify.setUpdateTime()
|
||||
}
|
||||
|
||||
@Resource
|
||||
AccountService accountService;
|
||||
@Resource
|
||||
@ -223,8 +257,54 @@ public class SysNotifyServiceImpl extends ServiceImpl<SysNotifyMapper, SysNotif
|
||||
sysNotificationlog.setNotifyId(sysNotify.getId());
|
||||
sysNotificationlog.setSentTo(account.getAcctId().toString());
|
||||
sysNotificationlog.setDeptId(account.getDeptId());
|
||||
sysNotificationlogService.insert(sysNotificationlog);
|
||||
sysNotificationlog.setContent(sysNotify.getTemplateContent());
|
||||
SysNotificationlog insert = sysNotificationlogService.insert(sysNotificationlog);
|
||||
// 发送成功修改状态
|
||||
SysNotify sysNotify1 = new SysNotify();
|
||||
sysNotify1.setId(id);
|
||||
sysNotify1.setType(1);
|
||||
this.baseMapper.updateById(sysNotify1);
|
||||
}
|
||||
|
||||
}
|
||||
private void sendNotification(SysNotify sysNotify,TAccount account) {
|
||||
// 发送通知的实现
|
||||
SysNotificationlog sysNotificationlog = new SysNotificationlog();
|
||||
sysNotificationlog.setNotifyId(sysNotify.getId());
|
||||
sysNotificationlog.setSentTo(account.getAcctId().toString());
|
||||
sysNotificationlog.setDeptId(account.getDeptId());
|
||||
sysNotificationlog.setContent(sysNotify.getTemplateContent());
|
||||
sysNotificationlogService.insert(sysNotificationlog);
|
||||
}
|
||||
|
||||
private void sendNotification(SysNotify sysNotify) {
|
||||
if (ObjectUtil.isNotEmpty(sysNotify.getSendType())) {
|
||||
String templateContent = sysNotify.getTemplateContent();
|
||||
templateContent.replace("{系统到期日期}","--");
|
||||
|
||||
templateContent.replace("{剩余交易流量}","--");
|
||||
|
||||
templateContent.replace("{系统服务费统计}","--");
|
||||
sysNotify.setTemplateContent(templateContent);
|
||||
|
||||
// 发送通知的实现
|
||||
SysNotificationlog sysNotificationlog = new SysNotificationlog();
|
||||
sysNotificationlog.setNotifyId(sysNotify.getId());
|
||||
sysNotificationlog.setSentTo(sysNotify.getAcctId().toString());
|
||||
sysNotificationlog.setDeptId(sysNotify.getDeptId());
|
||||
sysNotificationlog.setContent(sysNotify.getTemplateContent());
|
||||
|
||||
sysNotificationlogService.insert(sysNotificationlog);
|
||||
// 发送成功修改
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 辅助方法,将Date转换为LocalDate
|
||||
private LocalDate convertToLocalDateViaInstant(Date dateToConvert) {
|
||||
return dateToConvert.toInstant()
|
||||
.atZone(ZoneId.systemDefault())
|
||||
.toLocalDate();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,22 @@
|
||||
package com.fuint.business.sys.task;
|
||||
|
||||
import com.fuint.business.sys.service.SysNotifyService;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Component("SendNotify")
|
||||
@EnableScheduling
|
||||
public class SendNotify {
|
||||
|
||||
@Resource
|
||||
private SysNotifyService sysNotifyService;
|
||||
|
||||
// @Scheduled(cron = "0/1 * * * * ?")
|
||||
public void ryParams() {
|
||||
System.out.println("1111111111111111111");
|
||||
// sysNotifyService.sendNotify();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user