Commit 01e69571 by 徐高华

Merge branch 'feature/xgh/20250609' into 'master'

应用过期提醒

See merge request !3033
parents 2137b9bf 939face5
......@@ -157,4 +157,10 @@ public interface HaobanTimerApiService {
* @param params
*/
void contactDataTimer(String params);
/**
* 企业微信应用过期提醒
* @param params
*/
void qywxAppOverTimer(String params) ;
}
......@@ -88,5 +88,13 @@ public interface TabHaobanAppOrderMapper {
*/
TabHaobanAppOrder queryByOrderId(@Param("orderId")String orderId);
/**
* 查询有效订单
* @param wxEnterpriseId
* @return
*/
List<TabHaobanAppOrder> listOrderForNotice(@Param("wxEnterpriseId")String wxEnterpriseId) ;
}
......@@ -96,4 +96,10 @@ public interface WxEnterpriseMapper {
List<String> listWxEnterpriseByCallbackFlag(@Param("callbackFlag")Integer callbackFlag);
List<String> getWxEnterpriseIdByName(@Param("corpName")String corpName);
/**
* 查询所有非自建的
* @return
*/
List<TabHaobanWxEnterprise> listAllNotSelf() ;
}
\ No newline at end of file
......@@ -47,4 +47,5 @@ public interface HaobanQywxFeeOrderService {
void refund(Long feeOrderId ,String wxEnterpriseId , String orderId) ;
void qywxAppOverTimer(String params);
}
package com.gic.haoban.manage.service.service.fee.impl;
import java.util.Date;
import java.util.List;
import com.gic.commons.util.DateUtil;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanAppOrderMapper;
import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseMapper;
import com.gic.haoban.manage.service.dao.mapper.fee.TabHaobanQywxFeeOrderAccountMapper;
import com.gic.haoban.manage.service.entity.TabHaobanAppOrder;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise;
import com.gic.haoban.manage.service.util.DingUtils;
import org.apache.commons.collections.CollectionUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -29,6 +37,10 @@ public class HaobanQywxFeeOrderServiceImpl implements HaobanQywxFeeOrderService
private TabHaobanQywxFeeOrderMapper tabHaobanQywxFeeOrderMapper;
@Autowired
private TabHaobanQywxFeeOrderAccountMapper tabHaobanQywxFeeOrderAccountMapper ;
@Autowired
private WxEnterpriseMapper wxEnterpriseMapper;
@Autowired
private TabHaobanAppOrderMapper tabHaobanAppOrderMapper;
/**
* 新增数据
......@@ -69,4 +81,26 @@ public class HaobanQywxFeeOrderServiceImpl implements HaobanQywxFeeOrderService
this.tabHaobanQywxFeeOrderMapper.refund(feeOrderId);
this.tabHaobanQywxFeeOrderAccountMapper.refund(wxEnterpriseId,orderId);
}
@Override
public void qywxAppOverTimer(String params) {
// https://oapi.dingtalk.com/robot/send?access_token=62053271b8f98ac1d7e0695d98639be00ac1963e101f80e022200b5af9632ec7
List<TabHaobanWxEnterprise> enList = this.wxEnterpriseMapper.listAllNotSelf() ;
for(TabHaobanWxEnterprise wxEnterprise : enList) {
String wxEnterpriseId = wxEnterprise.getWxEnterpriseId() ;
List<TabHaobanAppOrder> orderList = this.tabHaobanAppOrderMapper.listOrderForNotice(wxEnterpriseId) ;
if(CollectionUtils.isNotEmpty(orderList)) {
TabHaobanAppOrder order = orderList.get(0) ;
Date endTime = order.getEndTime() ;
// 3天内过期
if(DateUtil.getStartTimeOfDay(endTime).getTime() - 1000*3600*24*3 <= DateUtil.getStartTimeOfDay().getTime()) {
if(DateUtil.getStartTimeOfDay(endTime).getTime()<DateUtil.getStartTimeOfDay().getTime() && DateUtil.daysBetween(DateUtil.getStartTimeOfDay(endTime),DateUtil.getStartTimeOfDay())>1) {
continue;
}
logger.info("应用即将到期={}",wxEnterpriseId);
DingUtils.send("企微企业名称:"+wxEnterprise.getCorpName()+"-"+wxEnterprise.getOpenCorpid() + "\n应用到期时间:" + DateUtil.dateToStr(endTime,"yyyy-MM-dd HH:mm:ss") , "https://oapi.dingtalk.com/robot/send?access_token=62053271b8f98ac1d7e0695d98639be00ac1963e101f80e022200b5af9632ec7",false);
}
}
}
}
}
......@@ -15,6 +15,7 @@ import com.gic.haoban.manage.service.service.chat.GroupChatDataService;
import com.gic.haoban.manage.service.service.chat.GroupChatPlanService;
import com.gic.haoban.manage.service.service.chat.GroupChatService;
import com.gic.haoban.manage.service.service.contact.adaptor.ContactAdaptor;
import com.gic.haoban.manage.service.service.fee.HaobanQywxFeeOrderService;
import com.gic.haoban.manage.service.service.hm.HmQrcodeTempService;
import com.gic.haoban.manage.service.util.DingUtils;
import com.gic.haoban.manage.service.util.HBQwMonitorUtils;
......@@ -62,6 +63,8 @@ public class HaobanTimerApiServiceImpl implements HaobanTimerApiService {
private GroupChatPlanService groupChatPlanService ;
@Autowired
private ContactAdaptor contactAdaptor;
@Autowired
private HaobanQywxFeeOrderService haobanQywxFeeOrderService ;
@Override
......@@ -214,4 +217,9 @@ public class HaobanTimerApiServiceImpl implements HaobanTimerApiService {
public void contactDataTimer(String params) {
contactAdaptor.contactDataTimer();
}
@Override
public void qywxAppOverTimer(String params) {
this.haobanQywxFeeOrderService.qywxAppOverTimer(params) ;
}
}
......@@ -23,7 +23,9 @@
<result property="creatorName" column="creator_name" jdbcType="VARCHAR"/>
<result property="expireTime" column="expire_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List" >
id, wx_enterprise_id, order_id, order_status, order_type, user_num, duration, begin_time, end_time, pay_time, origin_price, paid_price, order_url, delete_flag, create_time, update_time, creator_id, creator_name,expire_time
</sql>
<!--查询单个-->
<select id="queryById" resultMap="TabHaobanAppOrderMap">
select
......@@ -274,5 +276,9 @@
limit 1
</select>
<select id="listOrderForNotice" resultMap="TabHaobanAppOrderMap">
select <include refid="Base_Column_List" /> from tab_haoban_app_order where wx_enterprise_id=#{wxEnterpriseId} and delete_flag = 0 and order_status = 2 and order_type in (0,2) order by end_time desc
</select>
</mapper>
......@@ -608,4 +608,9 @@
</select>
<select id="listAllNotSelf" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/> from tab_haoban_wx_enterprise where wx_security_type IN (1,2,3,4) AND status_flag = 1
</select>
</mapper>
\ 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