Commit d6dae55e by 徐高华

企微激活账号

parent ad3cdd57
package com.gic.haoban.manage.service.dao.mapper.fee; package com.gic.haoban.manage.service.dao.mapper.fee;
import java.util.List;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import com.gic.haoban.manage.service.entity.fee.TabHaobanQywxFeeOrder; import com.gic.haoban.manage.service.entity.fee.TabHaobanQywxFeeOrder;
...@@ -48,5 +50,8 @@ public interface TabHaobanQywxFeeOrderMapper { ...@@ -48,5 +50,8 @@ public interface TabHaobanQywxFeeOrderMapper {
* @date 2022-08-12 10:42:36 * @date 2022-08-12 10:42:36
*/ */
int hasOrder(@Param("wxEnterpriseId") String wxEnterpriseId); int hasOrder(@Param("wxEnterpriseId") String wxEnterpriseId);
List<TabHaobanQywxFeeOrder> listOrder(@Param("wxEnterpriseId") String wxEnterpriseId);
} }
package com.gic.haoban.manage.service.service.fee; package com.gic.haoban.manage.service.service.fee;
import java.util.List;
import com.gic.haoban.manage.service.entity.fee.TabHaobanQywxFeeOrder; import com.gic.haoban.manage.service.entity.fee.TabHaobanQywxFeeOrder;
/** /**
...@@ -38,6 +40,16 @@ public interface HaobanQywxFeeOrderService { ...@@ -38,6 +40,16 @@ public interface HaobanQywxFeeOrderService {
* @date 2022-08-12 10:43:21 * @date 2022-08-12 10:43:21
*/ */
boolean hasOrder(String wxEnterpriseId); boolean hasOrder(String wxEnterpriseId);
/**
*
* @Title: listOrder
* @Description: 查询订单
* @author xugh
* @param wxEnterpriseId
* @return
* @throws
*/
List<TabHaobanQywxFeeOrder> listOrder(String wxEnterpriseId) ;
} }
package com.gic.haoban.manage.service.service.fee.impl; package com.gic.haoban.manage.service.service.fee.impl;
import java.util.List;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -54,4 +56,9 @@ public class HaobanQywxFeeOrderServiceImpl implements HaobanQywxFeeOrderService ...@@ -54,4 +56,9 @@ public class HaobanQywxFeeOrderServiceImpl implements HaobanQywxFeeOrderService
int count = tabHaobanQywxFeeOrderMapper.hasOrder(wxEnterpriseId); int count = tabHaobanQywxFeeOrderMapper.hasOrder(wxEnterpriseId);
return count > 0; return count > 0;
} }
@Override
public List<TabHaobanQywxFeeOrder> listOrder(String wxEnterpriseId) {
return this.tabHaobanQywxFeeOrderMapper.listOrder(wxEnterpriseId);
}
} }
...@@ -26,6 +26,7 @@ import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise; ...@@ -26,6 +26,7 @@ import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise;
import com.gic.haoban.manage.service.entity.fee.TabHaobanQywxFeeAccountStaff; import com.gic.haoban.manage.service.entity.fee.TabHaobanQywxFeeAccountStaff;
import com.gic.haoban.manage.service.service.StaffService; import com.gic.haoban.manage.service.service.StaffService;
import com.gic.haoban.manage.service.service.fee.HaobanQywxFeeAccountStaffService; import com.gic.haoban.manage.service.service.fee.HaobanQywxFeeAccountStaffService;
import com.gic.haoban.manage.service.service.fee.HaobanQywxFeeOrderService;
import com.gic.wechat.api.dto.qywx.fee.AccountListDTO; import com.gic.wechat.api.dto.qywx.fee.AccountListDTO;
import com.gic.wechat.api.dto.qywx.fee.AccountListResponseDTO; import com.gic.wechat.api.dto.qywx.fee.AccountListResponseDTO;
import com.gic.wechat.api.dto.qywx.fee.ActiveInfoUserResponseDTO; import com.gic.wechat.api.dto.qywx.fee.ActiveInfoUserResponseDTO;
...@@ -53,6 +54,8 @@ public class StaffServiceImpl implements StaffService { ...@@ -53,6 +54,8 @@ public class StaffServiceImpl implements StaffService {
private HaobanQywxFeeAccountStaffService haobanQywxFeeAccountStaffService; private HaobanQywxFeeAccountStaffService haobanQywxFeeAccountStaffService;
@Autowired @Autowired
private QywxUserApiService qywxUserApiService ; private QywxUserApiService qywxUserApiService ;
@Autowired
private HaobanQywxFeeOrderService haobanQywxFeeOrderService ;
@Override @Override
public TabHaobanStaff selectById(String id) { public TabHaobanStaff selectById(String id) {
...@@ -202,6 +205,11 @@ public class StaffServiceImpl implements StaffService { ...@@ -202,6 +205,11 @@ public class StaffServiceImpl implements StaffService {
if(CollectionUtils.isNotEmpty(list)) { if(CollectionUtils.isNotEmpty(list)) {
for(TabHaobanWxEnterprise item : list) { for(TabHaobanWxEnterprise item : list) {
if(item.getWxSecurityType()>0 && StringUtils.isNotEmpty(item.getOpenCorpid()) && item.getStatusFlag()==1) { if(item.getWxSecurityType()>0 && StringUtils.isNotEmpty(item.getOpenCorpid()) && item.getStatusFlag()==1) {
boolean hasFlag = this.haobanQywxFeeOrderService.hasOrder(item.getWxEnterpriseId()) ;
if(!hasFlag) {
log.info("无订单,跳过={}",item.getWxEnterpriseId());
continue ;
}
this.haobanQywxFeeAccountStaffService.deleteAll(item.getWxEnterpriseId()) ; this.haobanQywxFeeAccountStaffService.deleteAll(item.getWxEnterpriseId()) ;
this.mapper.deleteActivieInfo(item.getWxEnterpriseId()); this.mapper.deleteActivieInfo(item.getWxEnterpriseId());
this.listAccount(item, 500, null); this.listAccount(item, 500, null);
......
...@@ -118,6 +118,7 @@ public class HaobanQywxFeeApiServiceImpl implements HaobanQywxFeeApiService { ...@@ -118,6 +118,7 @@ public class HaobanQywxFeeApiServiceImpl implements HaobanQywxFeeApiService {
// 查询订单下的激活码code列表 // 查询订单下的激活码code列表
private void getOrderAccount(String orderId , String corpid , String cursor , List<Map<String, String>> activeCodeList) { private void getOrderAccount(String orderId , String corpid , String cursor , List<Map<String, String>> activeCodeList) {
logger.info("处理订单激活码,orderid={}",orderId);
FeeOrderListQDTO feeOrderListQDTO = new FeeOrderListQDTO(); FeeOrderListQDTO feeOrderListQDTO = new FeeOrderListQDTO();
feeOrderListQDTO.setOrderId(orderId); feeOrderListQDTO.setOrderId(orderId);
feeOrderListQDTO.setCursor(cursor); feeOrderListQDTO.setCursor(cursor);
...@@ -169,8 +170,8 @@ public class HaobanQywxFeeApiServiceImpl implements HaobanQywxFeeApiService { ...@@ -169,8 +170,8 @@ public class HaobanQywxFeeApiServiceImpl implements HaobanQywxFeeApiService {
this.wxEnterpriseService.updateAutoActiveFlagById(1, wxEnterpriseId); this.wxEnterpriseService.updateAutoActiveFlagById(1, wxEnterpriseId);
} }
List<Map<String, String>> activeCodeList = new ArrayList<>(); List<Map<String, String>> activeCodeList = new ArrayList<>();
List<String> orderIds = this.listOrderId(corpid) ; List<String> orderIdList = this.listOrderId(corpid) ;
for (String orderId : orderIds) { for (String orderId : orderIdList) {
FeeOrderDeatilResponseDTO order = qywxUserApiService.getOrder(corpid, serviceCorpid, orderId); FeeOrderDeatilResponseDTO order = qywxUserApiService.getOrder(corpid, serviceCorpid, orderId);
if (order.getErrcode() != 0) { if (order.getErrcode() != 0) {
logger.error("请求企微失败:{}", orderId); logger.error("请求企微失败:{}", orderId);
...@@ -198,8 +199,17 @@ public class HaobanQywxFeeApiServiceImpl implements HaobanQywxFeeApiService { ...@@ -198,8 +199,17 @@ public class HaobanQywxFeeApiServiceImpl implements HaobanQywxFeeApiService {
tabHaobanQywxFeeOrder.setPayTime(DateUtil.date(orderDTO.getPayTime() * 1000)); tabHaobanQywxFeeOrder.setPayTime(DateUtil.date(orderDTO.getPayTime() * 1000));
// 增加到订单表,如果存在不更新 // 增加到订单表,如果存在不更新
this.haobanQywxFeeOrderService.insert(tabHaobanQywxFeeOrder); this.haobanQywxFeeOrderService.insert(tabHaobanQywxFeeOrder);
// 查询订单下的激活码code列表,记录到activeCodeList }
this.getOrderAccount(orderId, corpid, null, activeCodeList);
// 更新订单的激活码状态
List<TabHaobanQywxFeeOrder> orderList = this.haobanQywxFeeOrderService.listOrder(wxEnterpriseId) ;
if(CollectionUtils.isEmpty(orderList)) {
logger.error("无企微订单:{}", wxEnterpriseId);
return ;
}
// 查询订单下的激活码code列表,记录到activeCodeList
for(TabHaobanQywxFeeOrder order : orderList) {
this.getOrderAccount(order.getOrderId(), corpid, null, activeCodeList);
} }
//处理订单下激活账号 //处理订单下激活账号
...@@ -227,8 +237,8 @@ public class HaobanQywxFeeApiServiceImpl implements HaobanQywxFeeApiService { ...@@ -227,8 +237,8 @@ public class HaobanQywxFeeApiServiceImpl implements HaobanQywxFeeApiService {
haobanQywxFeeService.insert(tabHaobanQywxFee); haobanQywxFeeService.insert(tabHaobanQywxFee);
//判断今天是否是本月最后一天 //判断今天是否是本月最后一天
if (DateUtil.isSameDay(DateUtil.endOfMonth(new Date()), new Date())) { if (DateUtil.isSameDay(DateUtil.endOfMonth(new Date()), new Date())) {
int monthWillInterceptNum = haobanQywxFeeAccountStaffService.monthWillInterceptNum(wxEnterpriseId); // int monthWillInterceptNum = haobanQywxFeeAccountStaffService.monthWillInterceptNum(wxEnterpriseId);
String content = "30天将有" + monthWillInterceptNum + "个接口许可证即将过期,您总共还剩余" + permissionUserNum + "个可用的接口许可证,请保证数量充足,如需增加请及时联系相关人员续费,避免影响使用"; // String content = "30天将有" + monthWillInterceptNum + "个接口许可证即将过期,您总共还剩余" + permissionUserNum + "个可用的接口许可证,请保证数量充足,如需增加请及时联系相关人员续费,避免影响使用";
//告警 //告警
// messageAlert(wxEnterpriseId, corpName, corpid, AlertTypeEnum.FEE_ALARM.getName(), content); // messageAlert(wxEnterpriseId, corpName, corpid, AlertTypeEnum.FEE_ALARM.getName(), content);
} }
...@@ -319,8 +329,6 @@ public class HaobanQywxFeeApiServiceImpl implements HaobanQywxFeeApiService { ...@@ -319,8 +329,6 @@ public class HaobanQywxFeeApiServiceImpl implements HaobanQywxFeeApiService {
/** /**
* 告警 * 告警
*
* @param wxEnterpriseId
*/ */
private void messageAlert(String wxEnterpriseId, String corpName, String corpid, String titleSub, String content) { private void messageAlert(String wxEnterpriseId, String corpName, String corpid, String titleSub, String content) {
ProviderLocalTag providerLocalTag = ProviderLocalTag.tag.get(); ProviderLocalTag providerLocalTag = ProviderLocalTag.tag.get();
......
...@@ -50,6 +50,13 @@ ...@@ -50,6 +50,13 @@
from tab_haoban_qywx_fee_order from tab_haoban_qywx_fee_order
where wx_enterprise_id = #{wxEnterpriseId} where wx_enterprise_id = #{wxEnterpriseId}
</select> </select>
<select id="listOrder" resultMap="TabHaobanQywxFeeOrderMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_qywx_fee_order
where wx_enterprise_id = #{wxEnterpriseId}
</select>
</mapper> </mapper>
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