Commit 95f6e43c authored by fangxinjiang's avatar fangxinjiang

科目预警提醒-fxj

parent 55c2bd3d
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.ekp.entity;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.util.Date;
/**
* 预警配置表
*
* @author fxj
* @date 2025-07-21 09:49:56
*/
@Data
@TableName("ekp_alert_table")
@Schema(description = "预警配置表")
public class EkpAlertTable {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@ExcelProperty("主键")
@Schema(description = "主键")
private String fdId;
/**
* 预警科目ID
*/
@ExcelAttribute(name = "预警科目ID", maxLength = 1000)
@Length(max = 1000, message = "预警科目ID不能超过1000个字符")
@ExcelProperty("预警科目ID")
@Schema(description = "预警科目ID")
private String fdAlertSubject;
/**
* 预警科目
*/
@ExcelAttribute(name = "预警科目", maxLength = 1000)
@Length(max = 1000, message = "预警科目不能超过1000个字符")
@ExcelProperty("预警科目")
@Schema(description = "预警科目")
private String fdAlertSubjectText;
/**
* 有效日期始
*/
@ExcelAttribute(name = "有效日期始", isDate = true)
@ExcelProperty("有效日期始")
@Schema(description = "有效日期始")
private Date fdEffectiveStartDate;
/**
* 有效日期止
*/
@ExcelAttribute(name = "有效日期止", isDate = true)
@ExcelProperty("有效日期止")
@Schema(description = "有效日期止")
private Date fdEffectiveEndDate;
/**
* 检测方式
*/
@ExcelAttribute(name = "检测方式", maxLength = 200)
@Length(max = 200, message = "检测方式不能超过200个字符")
@ExcelProperty("检测方式")
@Schema(description = "检测方式")
private String fdDetectionMethod;
/**
* 阈值(%)
*/
@ExcelAttribute(name = "阈值")
@ExcelProperty("阈值")
@Schema(description = "阈值")
private Integer fdThresholdValue;
/**
* 是否有效:是 否
*/
@ExcelAttribute(name = "是否有效", maxLength = 200)
@Length(max = 200, message = "是否有效不能超过200个字符")
@ExcelProperty("是否有效")
@Schema(description = "是否有效")
private String fdIsActive;
/**
* 预警内容
*/
@ExcelAttribute(name = "预警内容")
@ExcelProperty("预警内容")
@Schema(description = "预警内容")
private String fdAlertMessage;
/**
* 检测方式-每日时间
*/
@ExcelAttribute(name = "检测方式-每日", isDate = true)
@ExcelProperty("检测方式-每日")
@Schema(description = "检测方式-每日")
private Date fdEverydayTime;
/**
* 检测方式-每月:每月时间(日)
*/
@ExcelAttribute(name = "检测方式", maxLength = 20)
@Length(max = 20, message = "检测方式不能超过20个字符")
@ExcelProperty("检测方式")
@Schema(description = "检测方式")
private String fdChecktype;
/**
* 检测方式-每月:1.每月 2.每日
*/
@ExcelAttribute(name = "检测方式-每月")
@ExcelProperty("检测方式-每月")
@Schema(description = "检测方式-每月")
private Integer fdMonthday;
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.ekp.entity;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import java.util.Date;
/**
* EKP预算预警表
*
* @author fxj
* @date 2025-07-15 11:53:01
*/
@Data
@TableName("ekp_budget_warning_info")
@Schema(description = "EKP预算预警表")
public class EkpBudgetWarningInfo{
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@ExcelProperty("主键")
@Schema(description = "主键")
private String fdId;
/**
* 预警内容
*/
@ExcelAttribute(name = "预警内容", maxLength = 300)
@Length(max = 300, message = "预警内容不能超过300个字符")
@ExcelProperty("预警内容")
@Schema(description = "预警内容")
private String fdContent;
/**
* 预警时间
*/
@ExcelAttribute(name = "预警时间", isDate = true)
@ExcelProperty("预警时间")
@Schema(description = "预警时间")
private Date fdCreateTime;
/**
* 科目
*/
@ExcelAttribute(name = "科目", maxLength = 50)
@Length(max = 50, message = "科目不能超过50个字符")
@ExcelProperty("科目")
@Schema(description = "科目")
private String fdSubject;
/**
* 阅读状态:0未读 1已读
*/
@ExcelAttribute(name = "阅读状态:0未读 1已读", maxLength = 10)
@Length(max = 10, message = "阅读状态:0未读 1已读不能超过10个字符")
@ExcelProperty("阅读状态:0未读 1已读")
@Schema(description = "阅读状态:0未读 1已读")
private String fdReadStatus;
/**
* 接受人姓名
*/
@ExcelAttribute(name = "接受人姓名", maxLength = 50)
@Length(max = 50, message = "接受人姓名不能超过50个字符")
@ExcelProperty("接受人姓名")
@Schema(description = "接受人姓名")
private String fdRecipientName;
/**
* 接收人账号
*/
@ExcelAttribute(name = "接收人账号", maxLength = 50)
@Length(max = 50, message = "接收人账号不能超过50个字符")
@ExcelProperty("接收人账号")
@Schema(description = "接收人账号")
private String fdRecipientAccount;
/**
* 接收人ID(EKP-ID)
*/
@ExcelAttribute(name = "接收人ID(EKP-ID)", maxLength = 36)
@Length(max = 36, message = "接收人ID(EKP-ID)不能超过36个字符")
@ExcelProperty("接收人ID(EKP-ID)")
@Schema(description = "接收人ID(EKP-ID)")
private String fdRecipientId;
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.ekp.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;
import java.util.Date;
/**
* 预警配置表
*
* @author fxj
* @date 2025-07-21 09:49:56
*/
@Data
@Schema(description = "预警配置表")
public class BudgetWarningVo {
/**
* 科目
*/
@Schema(description = "科目")
private String km;
/**
* 提醒时间
*/
@Schema(description = "提醒时间")
private String at;
/**
* 余额
*/
@Schema(description = "余额")
private Double ye;
/**
* 比率
*/
@Schema(description = "比率")
private Double bl;
/**
* 二级成本中心
*/
@Schema(description = "二级成本中心")
private String cbzx;
/**
* 二级成本中心-提醒人
*/
@Schema(description = "二级成本中心-提醒人")
private String txr;
/**
* 阀值-剩余
*/
@Schema(description = "阀值-剩余")
private Integer fz;
}
package com.yifu.cloud.plus.v1.ekp.config;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.exception.CheckedException;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.security.authentication.AuthenticationServiceException;
import org.springframework.web.client.RestTemplate;
import java.util.Map;
import java.util.concurrent.TimeUnit;
/**
* @Author: huyc
* @Date: 2023/7/28
* @Description:
* @return: 企业微信配置
**/
@Configuration
@Data
@Slf4j
public class WxConfig {
@Value("${wx.corpid}")
private String corpid;
@Value("${wx.corpsecret}")
private String corpsecret;
@Value("${wx.agentid}")
private String agentid;
@Value("${wx.authUrl}")
private String authUrl;
@Value("${wx.domainName}")
private String domainName;
@Autowired
private RedisTemplate redisTemplate;
//未授权
private String accossTokenInvliad = "40014";
/**
* @param
* @Author: huyc
* @Date: 2023/7/28
* @Description: 获取微信accos_token
* @return: java.lang.String
**/
public String getAccessToken(RestTemplate restTemplate) {
if (Common.isNotNull(agentid)) {
return this.getToken(restTemplate, CacheConstants.WX_ACCOSS_TOKEN.concat(agentid), corpsecret);
}
return this.getToken(restTemplate, CacheConstants.WX_ACCOSS_TOKEN, corpsecret);
}
public String getAccessToken(RestTemplate restTemplate,String corpsecret)throws AuthenticationServiceException {
if(Common.isEmpty(corpsecret)){
throw new AuthenticationServiceException("未找到对应的corpsecret请联系管理员配置");
}
return this.getToken(restTemplate, CacheConstants.WX_ACCOSS_TOKEN.concat(agentid), corpsecret);
}
/**
* @param restTemplate
* @param tokenKey
* @param corpsecretKey
* @Description: 获取token
* @Author: huyc
* @Date: 2023/7/28 14:46
* @return: java.lang.String
**/
public String getToken(RestTemplate restTemplate,String tokenKey, String corpsecretKey) {
Object wxToken = redisTemplate.opsForValue().get(tokenKey);
if (null != wxToken) {
return String.valueOf(wxToken);
}
String requestTokenUrl = String.format(SecurityConstants.WX_GET_ACCOSS_TOKEN, corpid, corpsecretKey);
String result = restTemplate.getForObject(requestTokenUrl, String.class);
if (Common.isEmpty(result)) {
throw new CheckedException("微信授权失败");
}
String token = JSON.parseObject(result).getString("access_token");
if (Common.isEmpty(token)) {
log.info(result);
throw new CheckedException("获取微信token失败");
}
redisTemplate.opsForValue().set(tokenKey, token);
redisTemplate.expire(tokenKey, 3600, TimeUnit.SECONDS);
return token;
}
/**
* @param
* @Author: huyc
* @Date: 2023/7/28 14:43
* @Description: 移除微信accossToken
* @return: java.lang.String
**/
public void removeAccessToken() {
redisTemplate.delete(CacheConstants.WX_ACCOSS_TOKEN);
}
/**
* @param restTemplate
* @param requestMap 请求内容
* @Author: huyc
* @Date: 2023/7/28 14:48
* @Description: 发送卡片消息
* @return: java.lang.String
**/
public boolean sendTextCard(RestTemplate restTemplate, Map<String, Object> requestMap) {
// 必须加上header说明
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
Gson gson = new Gson();
log.debug("发企业微信===请求:{}", gson.toJson(requestMap));
HttpEntity<String> requestEntity = new HttpEntity<>(gson.toJson(requestMap), headers);
String accessToken = getAccessToken(restTemplate);
ResponseEntity<String> responseEntity = restTemplate.postForEntity(String.format(SecurityConstants.WX_SEND_MESSAGE, accessToken), requestEntity, String.class);
log.debug("发企业微信===返回:{}",JSON.toJSONString(responseEntity));
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(responseEntity));
JSONObject jsonBody = jsonObject.getJSONObject("body");
if (jsonBody != null) {
String errcode = jsonBody.getString("errcode");
if (accossTokenInvliad.equals(errcode)) {
//删除accossToken缓存
removeAccessToken();
return false;
}
if (!CommonConstants.ZERO_STRING.equals(errcode)) { //非正常,则打印错误日志
log.info(jsonObject.toJSONString());
}
} else {
log.info(jsonObject.toJSONString());
}
return true;
}
/**
* 功能描述: 获取微信accos_token
* @Author: huyc
* @Date: 2023/7/28 14:50
* @return: java.lang.String
*/
public String getAppAccessToken(RestTemplate restTemplate) {
return this.getToken(restTemplate, CacheConstants.WX_ACCOSS_TOKEN, corpsecret);
}
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.ekp.controller;
import com.yifu.cloud.plus.v1.ekp.service.EkpAlertTableService;
import com.yifu.cloud.plus.v1.ekp.vo.EkpIncomePushInfoVo;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpIncomeParamRisk;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 预警配置表
*
* @author fxj
* @date 2025-07-21 09:49:56
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/ekpalerttable")
@Tag(name = "预警配置表管理")
public class EkpAlertTableController {
private final EkpAlertTableService ekpAlertTableService;
/**
* @return
* @Author fxj
* @Description 定时任务推送 预算超额预警信息 按日推送
* @Date 10:03 2025/7/21
* @Param
**/
@Inner
@PostMapping("/inner/pushBudgetAlertInfoTomanager")
public void pushRiskInfoToEkp() {
ekpAlertTableService.pushBudgetAlertInfoTomanager(1);
}
/**
* @return
* @Author fxj
* @Description 定时任务推送 预算超额预警信息 按月推送
* @Date 10:03 2025/7/21
* @Param
**/
@Inner
@PostMapping("/inner/pushBudgetAlertInfoTomanagerMonth")
public void pushBudgetAlertInfoTomanagerMonth() {
ekpAlertTableService.pushBudgetAlertInfoTomanager(0);
}
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.ekp.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.ekp.entity.EkpAlertTable;
import com.yifu.cloud.plus.v1.ekp.vo.BudgetWarningVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 预警配置表
*
* @author fxj
* @date 2025-07-21 09:49:56
*/
@Mapper
public interface EkpAlertTableMapper extends BaseMapper<EkpAlertTable> {
/**
* 预警配置表简单分页查询
*
* @param ekpAlertTable 预警配置表
* @return
*/
IPage<EkpAlertTable> getEkpAlertTablePage(Page<EkpAlertTable> page, @Param("ekpAlertTable") EkpAlertTable ekpAlertTable);
List<BudgetWarningVo> getBudgetWarningVos(@Param("km") String km);
List<EkpAlertTable> getEkpAlertTableList(int type);
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.ekp.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.ekp.entity.EkpBudgetWarningInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* EKP预算预警表
*
* @author fxj
* @date 2025-07-15 11:53:01
*/
@Mapper
public interface EkpBudgetWarningInfoMapper extends BaseMapper<EkpBudgetWarningInfo> {
/**
* EKP预算预警表简单分页查询
*
* @param ekpBudgetWarningInfo EKP预算预警表
* @return
*/
IPage<EkpBudgetWarningInfo> getEkpBudgetWarningInfoPage(Page<EkpBudgetWarningInfo> page, @Param("ekpBudgetWarningInfo") EkpBudgetWarningInfo ekpBudgetWarningInfo);
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.ekp.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.ekp.entity.EkpAlertTable;
/**
* 预警配置表
*
* @author fxj
* @date 2025-07-21 09:49:56
*/
public interface EkpAlertTableService extends IService<EkpAlertTable> {
void pushBudgetAlertInfoTomanager(int type);
}
......@@ -45,4 +45,11 @@ entry:
entryFdFlowId: 191919ae533d0484bb60c5ed74e55a4b
entryDocStatus: 20
entryLoginName: admin
entryDocSubject: 入账明细推送ekp接口
\ No newline at end of file
entryDocSubject: 入账明细推送ekp接口
wx:
corpid: wwbcb090af0dfe50e5
corpsecret: R0nKkvsY-oF41fuQvUXZ-kFG3_g_Ce0bpZt6mByx524
agentid: 1000009
authUrl: https://wx.worfu.com/yifu-auth/method/oauth/wxLogin
domainName: https://wx.worfu.com
\ No newline at end of file
......@@ -111,4 +111,11 @@ entry:
entryFdFlowId: 191919ae533d080b60e6e784c55a3c8b
entryDocStatus: 20
entryLoginName: admin
entryDocSubject: 入账明细推送ekp接口
\ No newline at end of file
entryDocSubject: 入账明细推送ekp接口
wx:
corpid: wwbcb090af0dfe50e5
corpsecret: 16kqEL_eU-ARwYyqLgEBWHgxm8gXVnkzv_eJMLy9NpU
agentid: 1000010
authUrl: https://test-wx.worfu.com/yifu-auth/method/oauth/wxLogin
domainName: https://test-wx.worfu.com
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!--
~
~ Copyright (c) 2018-2025, lengleng All rights reserved.
~
~ Redistribution and use in source and binary forms, with or without
~ modification, are permitted provided that the following conditions are met:
~
~ Redistributions of source code must retain the above copyright notice,
~ this list of conditions and the following disclaimer.
~ Redistributions in binary form must reproduce the above copyright
~ notice, this list of conditions and the following disclaimer in the
~ documentation and/or other materials provided with the distribution.
~ Neither the name of the yifu4cloud.com developer nor the names of its
~ contributors may be used to endorse or promote products derived from
~ this software without specific prior written permission.
~ Author: lengleng (wangiegie@gmail.com)
~
-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yifu.cloud.plus.v1.ekp.mapper.EkpAlertTableMapper">
<resultMap id="budgetWarningMap" type="com.yifu.cloud.plus.v1.ekp.vo.BudgetWarningVo">
<id property="km" column="km"/>
<result property="at" column="at"/>
<result property="ye" column="ye"/>
<result property="bl" column="bl"/>
<result property="cbzx" column="cbzx"/>
<result property="txr" column="txr"/>
</resultMap>
<resultMap id="ekpAlertTableMap" type="com.yifu.cloud.plus.v1.ekp.entity.EkpAlertTable">
<id property="fdId" column="fd_id"/>
<result property="fdAlertSubject" column="fd_alert_subject"/>
<result property="fdAlertSubjectText" column="fd_alert_subject_text"/>
<result property="fdEffectiveStartDate" column="fd_effective_start_date"/>
<result property="fdEffectiveEndDate" column="fd_effective_end_date"/>
<result property="fdDetectionMethod" column="fd_detection_method"/>
<result property="fdThresholdValue" column="fd_threshold_value"/>
<result property="fdIsActive" column="fd_is_active"/>
<result property="fdAlertMessage" column="fd_alert_message"/>
<result property="fdEverydayTime" column="fd_everyday_time"/>
<result property="fdChecktype" column="fd_checktype"/>
<result property="fdMonthday" column="fd_monthday"/>
</resultMap>
<sql id="Base_Column_List">
a.fd_id,
a.fd_alert_subject,
a.fd_alert_subject_text,
a.fd_effective_start_date,
a.fd_effective_end_date,
a.fd_detection_method,
a.fd_threshold_value,
a.fd_is_active,
a.fd_alert_message,
a.fd_everyday_time,
a.fd_checktype,
a.fd_monthday
</sql>
<sql id="ekpAlertTable_where">
<if test="ekpAlertTable != null">
<if test="ekpAlertTable.fdId != null and ekpAlertTable.fdId.trim() != ''">
AND a.fd_id = #{ekpAlertTable.fdId}
</if>
<if test="ekpAlertTable.fdAlertSubject != null and ekpAlertTable.fdAlertSubject.trim() != ''">
AND a.fd_alert_subject = #{ekpAlertTable.fdAlertSubject}
</if>
<if test="ekpAlertTable.fdAlertSubjectText != null and ekpAlertTable.fdAlertSubjectText.trim() != ''">
AND a.fd_alert_subject_text = #{ekpAlertTable.fdAlertSubjectText}
</if>
<if test="ekpAlertTable.fdEffectiveStartDate != null">
AND a.fd_effective_start_date = #{ekpAlertTable.fdEffectiveStartDate}
</if>
<if test="ekpAlertTable.fdEffectiveEndDate != null">
AND a.fd_effective_end_date = #{ekpAlertTable.fdEffectiveEndDate}
</if>
<if test="ekpAlertTable.fdDetectionMethod != null and ekpAlertTable.fdDetectionMethod.trim() != ''">
AND a.fd_detection_method = #{ekpAlertTable.fdDetectionMethod}
</if>
<if test="ekpAlertTable.fdThresholdValue != null">
AND a.fd_threshold_value = #{ekpAlertTable.fdThresholdValue}
</if>
<if test="ekpAlertTable.fdIsActive != null and ekpAlertTable.fdIsActive.trim() != ''">
AND a.fd_is_active = #{ekpAlertTable.fdIsActive}
</if>
<if test="ekpAlertTable.fdAlertMessage != null and ekpAlertTable.fdAlertMessage.trim() != ''">
AND a.fd_alert_message = #{ekpAlertTable.fdAlertMessage}
</if>
<if test="ekpAlertTable.fdEverydayTime != null">
AND a.fd_everyday_time = #{ekpAlertTable.fdEverydayTime}
</if>
<if test="ekpAlertTable.fdChecktype != null and ekpAlertTable.fdChecktype.trim() != ''">
AND a.fd_checktype = #{ekpAlertTable.fdChecktype}
</if>
<if test="ekpAlertTable.fdMonthday != null">
AND a.fd_monthday = #{ekpAlertTable.fdMonthday}
</if>
</if>
</sql>
<!--ekpAlertTable简单分页查询-->
<select id="getEkpAlertTablePage" resultMap="ekpAlertTableMap">
SELECT
<include refid="Base_Column_List"/>
FROM ekp_alert_table a
<where>
1=1
<include refid="ekpAlertTable_where"/>
</where>
</select>
<select id="getBudgetWarningVos" resultMap="budgetWarningMap">
select
a.fd_ke_mu as 'km',
DATE_FORMAT(NOW(),"%Y-%m-%d %H:%i") as 'at',
ROUND((sum(a.fd_money) - sum(ifnull(b.fd_money,0))),2) as 'ye'
,ROUND(sum(ifnull(b.fd_money,0))/sum(a.fd_money)*100,2) as 'bl',
a.fd_cheng_ben_two as 'cbzx',c.txr
from (select sum(a.fd_money) fd_money,a.fd_cheng_ben_two,a.fd_ke_mu,a.fd_fee_type,a.fd_id from view_xing_zheng_yu_suan_all a where a.fd_date_month like concat(DATE_FORMAT(now(),'%Y-'),'%') GROUP BY a.fd_ke_mu,a.fd_cheng_ben_two) a
left join (
select
ifnull(sum(a.fd_money),0) fd_money,fd_ke_mu,fd_cheng_ben_two
from view_xing_zheng_yu_suan a where DATE_FORMAT(a.fd_date,'%Y') = DATE_FORMAT(now(),'%Y')
GROUP BY fd_ke_mu,fd_cheng_ben_two
) b on b.fd_ke_mu = a.fd_ke_mu and b.fd_cheng_ben_two = a.fd_cheng_ben_two
LEFT JOIN (
select GROUP_CONCAT(DISTINCT CONCAT(d.fd_login_name,"_",d.fd_id)) as 'txr',cb.fd_3c290891cded14 from ekp_3cf9b7112e544ba9fe18 cb
LEFT JOIN ekporg_18ca06406b8e5d35104b t on t.fd_parent_id=cb.fd_id
LEFT JOIN sys_org_person d on t.sys_org_person_id=d.fd_id
GROUP BY cb.fd_id
) c on c.fd_3c290891cded14 = a.fd_cheng_ben_two
where a.fd_ke_mu = #{km}
GROUP BY a.fd_ke_mu,a.fd_cheng_ben_two ORDER BY a.fd_id
</select>
<select id="getEkpAlertTableList" resultMap="ekpAlertTableMap">
SELECT
<include refid="Base_Column_List"/>
FROM ekp_alert_table a
<where>
1=1
AND a.fd_effective_start_date <![CDATA[ <= ]]> NOW()
AND a.fd_effective_end_date >= NOW()
AND a.fd_is_active = '是'
<if test="type ==0 ">
AND fd_checktype = '每月'
</if>
<if test="type ==1 ">
AND fd_checktype = '每日'
</if>
</where>
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!--
~
~ Copyright (c) 2018-2025, lengleng All rights reserved.
~
~ Redistribution and use in source and binary forms, with or without
~ modification, are permitted provided that the following conditions are met:
~
~ Redistributions of source code must retain the above copyright notice,
~ this list of conditions and the following disclaimer.
~ Redistributions in binary form must reproduce the above copyright
~ notice, this list of conditions and the following disclaimer in the
~ documentation and/or other materials provided with the distribution.
~ Neither the name of the yifu4cloud.com developer nor the names of its
~ contributors may be used to endorse or promote products derived from
~ this software without specific prior written permission.
~ Author: lengleng (wangiegie@gmail.com)
~
-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yifu.cloud.plus.v1.ekp.mapper.EkpBudgetWarningInfoMapper">
<resultMap id="ekpBudgetWarningInfoMap" type="com.yifu.cloud.plus.v1.ekp.entity.EkpBudgetWarningInfo">
<id property="fdId" column="fd_id"/>
<result property="fdContent" column="fd_content"/>
<result property="fdCreateTime" column="fd_create_time"/>
<result property="fdSubject" column="fd_subject"/>
<result property="fdReadStatus" column="fd_read_status"/>
<result property="fdRecipientName" column="fd_recipient_name"/>
<result property="fdRecipientAccount" column="fd_recipient_account"/>
<result property="fdRecipientId" column="fd_recipient_id"/>
</resultMap>
<sql id="Base_Column_List">
a.fd_id,
a.fd_content,
a.fd_create_time,
a.fd_subject,
a.fd_read_status,
a.fd_recipient_name,
a.fd_recipient_account,
a.fd_recipient_id
</sql>
<sql id="ekpBudgetWarningInfo_where">
<if test="ekpBudgetWarningInfo != null">
<if test="ekpBudgetWarningInfo.fdId != null and ekpBudgetWarningInfo.fdId.trim() != ''">
AND a.fd_id = #{ekpBudgetWarningInfo.fdId}
</if>
<if test="ekpBudgetWarningInfo.fdContent != null and ekpBudgetWarningInfo.fdContent.trim() != ''">
AND a.fd_content = #{ekpBudgetWarningInfo.fdContent}
</if>
<if test="ekpBudgetWarningInfo.fdCreateTime != null">
AND a.fd_create_time = #{ekpBudgetWarningInfo.fdCreateTime}
</if>
<if test="ekpBudgetWarningInfo.fdSubject != null and ekpBudgetWarningInfo.fdSubject.trim() != ''">
AND a.fd_subject = #{ekpBudgetWarningInfo.fdSubject}
</if>
<if test="ekpBudgetWarningInfo.fdReadStatus != null and ekpBudgetWarningInfo.fdReadStatus.trim() != ''">
AND a.fd_read_status = #{ekpBudgetWarningInfo.fdReadStatus}
</if>
<if test="ekpBudgetWarningInfo.fdRecipientName != null and ekpBudgetWarningInfo.fdRecipientName.trim() != ''">
AND a.fd_recipient_name = #{ekpBudgetWarningInfo.fdRecipientName}
</if>
<if test="ekpBudgetWarningInfo.fdRecipientAccount != null and ekpBudgetWarningInfo.fdRecipientAccount.trim() != ''">
AND a.fd_recipient_account = #{ekpBudgetWarningInfo.fdRecipientAccount}
</if>
<if test="ekpBudgetWarningInfo.fdRecipientId != null and ekpBudgetWarningInfo.fdRecipientId.trim() != ''">
AND a.fd_recipient_id = #{ekpBudgetWarningInfo.fdRecipientId}
</if>
</if>
</sql>
<!--ekpBudgetWarningInfo简单分页查询-->
<select id="getEkpBudgetWarningInfoPage" resultMap="ekpBudgetWarningInfoMap">
SELECT
<include refid="Base_Column_List"/>
FROM ekp_budget_warning_info a
<where>
1=1
<include refid="ekpBudgetWarningInfo_where"/>
</where>
</select>
</mapper>
......@@ -72,4 +72,25 @@ public class EkpTask {
HttpDaprUtil.invokeMethodPost(daprEkpProperties.getAppUrl(),daprEkpProperties.getAppId(),"/icbcIssue/inner/getPdfFile","", Object.class, SecurityConstants.FROM_IN);
log.info("------------定时生成生成昨日的回单文件-定时任务结束------------");
}
/**
* @Author fxj
* @Description 每日预算预警信息
* @Date 16:49 2025/7/21
**/
public void pushBudgetAlertInfoTomanager() {
log.info("------------定时生成每日预算预警信息-定时任务开始------------");
HttpDaprUtil.invokeMethodPost(daprEkpProperties.getAppUrl(),daprEkpProperties.getAppId(),"/ekpalerttable/inner/pushBudgetAlertInfoTomanager","", Object.class, SecurityConstants.FROM_IN);
log.info("------------定时生成生每日预算预警信息-定时任务结束------------");
}
/**
* @Author fxj
* @Description 每月预算预警信息
* @Date 16:49 2025/7/21
**/
public void pushBudgetAlertInfoTomanagerMonth() {
log.info("------------定时生成每月预算预警信息-定时任务开始------------");
HttpDaprUtil.invokeMethodPost(daprEkpProperties.getAppUrl(),daprEkpProperties.getAppId(),"/ekpalerttable/inner/pushBudgetAlertInfoTomanagerMonth","", Object.class, SecurityConstants.FROM_IN);
log.info("------------定时生成每月预算预警信息-定时任务结束------------");
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment