Commit c1801f2b by 墨竹

fix:企微收费修改

parent aa925a7c
......@@ -5,6 +5,7 @@ import com.gic.haoban.manage.service.entity.fee.TabHaobanQywxFeeAccountStaff;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;
import java.util.Date;
import java.util.List;
/**
......@@ -73,5 +74,23 @@ public interface TabHaobanQywxFeeAccountStaffMapper {
* @date 2022-08-05 15:40:09
*/
List<HaobanQywxFeeDetailDTO> feeDetail(@Param("wxEnterpriseId") String wxEnterpriseId);
/**
* 获取最新的过期时间
* @param wxEnterpriseId
* @return
*/
Date lastFeeInterceptTime(@Param("wxEnterpriseId") String wxEnterpriseId);
/**
* 最后费用过期拦截数
*
* @param wxEnterpriseId wx企业标识
* @return int
* @author mozhu
* @date 2022-08-08 15:53:32
*/
int lastFeeInterceptCount(@Param("wxEnterpriseId") String wxEnterpriseId);
}
......@@ -56,4 +56,15 @@ public interface HaobanQywxFeeAccountStaffService {
*/
List<HaobanQywxFeeDetailDTO> feeDetail(String wxEnterpriseId);
/**
* 费用详细拦截
*
* @param wxEnterpriseId wx企业标识
* @return {@link HaobanQywxFeeDetailDTO }
* @author mozhu
* @date 2022-08-08 15:46:21
*/
HaobanQywxFeeDetailDTO feeIntercept(String wxEnterpriseId);
}
package com.gic.haoban.manage.service.service.fee.impl;
import com.gic.haoban.manage.api.dto.fee.HaobanQywxFeeDetailDTO;
import com.gic.haoban.manage.service.dao.mapper.fee.TabHaobanQywxFeeAccountStaffMapper;
import com.gic.haoban.manage.service.entity.fee.TabHaobanQywxFeeAccountStaff;
......@@ -7,6 +6,7 @@ import com.gic.haoban.manage.service.service.fee.HaobanQywxFeeAccountStaffServic
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
......@@ -71,4 +71,14 @@ public class HaobanQywxFeeAccountStaffServiceImpl implements HaobanQywxFeeAccoun
public List<HaobanQywxFeeDetailDTO> feeDetail(String wxEnterpriseId) {
return tabHaobanQywxFeeAccountStaffMapper.feeDetail(wxEnterpriseId);
}
@Override
public HaobanQywxFeeDetailDTO feeIntercept(String wxEnterpriseId) {
Date lastFeeInterceptTime = tabHaobanQywxFeeAccountStaffMapper.lastFeeInterceptTime(wxEnterpriseId);
int count = tabHaobanQywxFeeAccountStaffMapper.lastFeeInterceptCount(wxEnterpriseId);
HaobanQywxFeeDetailDTO haobanQywxFeeDetailDTO = new HaobanQywxFeeDetailDTO();
haobanQywxFeeDetailDTO.setInterceptTime(lastFeeInterceptTime);
haobanQywxFeeDetailDTO.setInterceptUserNum(count);
return haobanQywxFeeDetailDTO;
}
}
......@@ -68,4 +68,5 @@ public class HaobanQywxFeeOrderAccountServiceImpl implements HaobanQywxFeeOrderA
public int countOrderAccountStatus(Integer status, String wxEnterpriseId) {
return tabHaobanQywxFeeOrderAccountMapper.countOrderAccountStatus(status,wxEnterpriseId);
}
}
......@@ -5,13 +5,13 @@ import com.gic.api.base.commons.Page;
import com.gic.commons.util.UniqueIdUtils;
import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.manage.api.constants.Manage3Constants;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.dto.fee.HaobanQywxFeeDTO;
import com.gic.haoban.manage.api.dto.fee.HaobanQywxFeeDetailDTO;
import com.gic.haoban.manage.api.dto.qdto.QywxFeeListQDTO;
import com.gic.haoban.manage.api.service.fee.HaobanQywxFeeApiService;
import com.gic.haoban.manage.service.config.Config;
import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise;
import com.gic.haoban.manage.service.entity.fee.TabHaobanQywxFee;
import com.gic.haoban.manage.service.entity.fee.TabHaobanQywxFeeAccountStaff;
import com.gic.haoban.manage.service.entity.fee.TabHaobanQywxFeeOrder;
......@@ -61,11 +61,11 @@ public class HaobanQywxFeeApiServiceImpl implements HaobanQywxFeeApiService {
@Override
public void insert(String param) {
List<TabHaobanWxEnterprise> tabHaobanWxEnterprises = wxEnterpriseService.listAll();
List<WxEnterpriseDTO> wxEnterpriseDTOS = wxEnterpriseService.listAllWxEnterprise();
String serviceCorpid = config.getCorpid();
for (TabHaobanWxEnterprise tabHaobanWxEnterpris : tabHaobanWxEnterprises) {
String corpid = tabHaobanWxEnterpris.getCorpid();
String wxEnterpriseId = tabHaobanWxEnterpris.getWxEnterpriseId();
for (WxEnterpriseDTO wxEnterpriseDTO : wxEnterpriseDTOS) {
String corpid = wxEnterpriseDTO.getCorpid();
String wxEnterpriseId = wxEnterpriseDTO.getWxEnterpriseId();
String autoActiveStatus = qywxUserApiService.getAutoActiveStatus(corpid, serviceCorpid);
if (!"1".equals(autoActiveStatus)) {
logger.info("未开启自动激活:{}", corpid);
......@@ -218,25 +218,22 @@ public class HaobanQywxFeeApiServiceImpl implements HaobanQywxFeeApiService {
//更新企微状态
wxEnterpriseService.updateAutoActiveFlagById(1, wxEnterpriseId);
// TODO: 2022/8/5 收费接口算法还未明确
//更新收费
TabHaobanQywxFee tabHaobanQywxFee = new TabHaobanQywxFee();
tabHaobanQywxFee.setQwFeeId(UniqueIdUtils.uniqueLong());
tabHaobanQywxFee.setCorpName(tabHaobanWxEnterpris.getCorpName());
tabHaobanQywxFee.setCorpId(corpid);
tabHaobanQywxFee.setWxEnterpriseId(wxEnterpriseId);
//tabHaobanQywxFee.setInterceptTime();
//
//tabHaobanQywxFee.setInterceptUserNum();
tabHaobanQywxFee.setPermissionUserNum(haobanQywxFeeOrderAccountService.countOrderAccountStatus(1,wxEnterpriseId));
tabHaobanQywxFee.setBuyPermissionUserNum(haobanQywxFeeOrderService.countExternalContactCount(wxEnterpriseId));
tabHaobanQywxFee.setInterceptFlag(0);
haobanQywxFeeService.insert(tabHaobanQywxFee);
HaobanQywxFeeDetailDTO haobanQywxFeeDetailDTO = haobanQywxFeeAccountStaffService.feeIntercept(wxEnterpriseId);
if (haobanQywxFeeDetailDTO != null) {
TabHaobanQywxFee tabHaobanQywxFee = new TabHaobanQywxFee();
tabHaobanQywxFee.setQwFeeId(UniqueIdUtils.uniqueLong());
tabHaobanQywxFee.setCorpName(wxEnterpriseDTO.getCorpName());
tabHaobanQywxFee.setCorpId(corpid);
tabHaobanQywxFee.setWxEnterpriseId(wxEnterpriseId);
tabHaobanQywxFee.setInterceptTime(haobanQywxFeeDetailDTO.getInterceptTime());
tabHaobanQywxFee.setInterceptUserNum(haobanQywxFeeDetailDTO.getInterceptUserNum());
tabHaobanQywxFee.setPermissionUserNum(haobanQywxFeeOrderAccountService.countOrderAccountStatus(1,wxEnterpriseId));
tabHaobanQywxFee.setBuyPermissionUserNum(haobanQywxFeeOrderService.countExternalContactCount(wxEnterpriseId));
tabHaobanQywxFee.setInterceptFlag(0);
haobanQywxFeeService.insert(tabHaobanQywxFee);
}
}
}
......
......@@ -133,12 +133,29 @@
<select id="feeDetail" resultType="com.gic.haoban.manage.api.dto.fee.HaobanQywxFeeDetailDTO">
select
sum(staff_id) interceptUserNum,
sum(distinct staff_id) interceptUserNum,
expire_time interceptTime
from tab_haoban_qywx_fee_account_staff
where wx_enterprise_id = #{wxEnterpriseId}
and DATE_SUB(CURDATE(), INTERVAL 30 DAY) <![CDATA[ <= ]]> date(expire_time)
</select>
<select id="lastFeeInterceptTime" resultType="java.util.Date">
select
expire_time expireTime
from tab_haoban_qywx_fee_account_staff
where wx_enterprise_id = #{wxEnterpriseId}
and DATE_SUB(CURDATE(), INTERVAL 30 DAY) <![CDATA[ <= ]]> date(expire_time)
order by expire_time desc limit 1
</select>
<select id="lastFeeInterceptCount" resultType="java.lang.Integer">
select
sum(distinct staff_id)
from tab_haoban_qywx_fee_account_staff
where wx_enterprise_id = #{wxEnterpriseId}
and DATE_SUB(CURDATE(), INTERVAL 30 DAY) <![CDATA[ <= ]]> date(expire_time)
</select>
</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