Commit 669e8990 by 徐高华

激活账号

parent ae2d6990
package com.gic.haoban.manage.service.dao.mapper.fee; package com.gic.haoban.manage.service.dao.mapper.fee;
import com.gic.haoban.manage.service.entity.fee.TabHaobanQywxFeeOrderAccount;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;
import java.util.List; import com.gic.haoban.manage.service.entity.fee.TabHaobanQywxFeeOrderAccount;
/** /**
* 企业微信收费订单账号(激活码)(TabHaobanQywxFeeOrderAccount)表数据库访问层 * 企业微信收费订单账号(激活码)(TabHaobanQywxFeeOrderAccount)表数据库访问层
...@@ -20,16 +18,7 @@ public interface TabHaobanQywxFeeOrderAccountMapper { ...@@ -20,16 +18,7 @@ public interface TabHaobanQywxFeeOrderAccountMapper {
* @param feeAccountId 主键 * @param feeAccountId 主键
* @return 实例对象 * @return 实例对象
*/ */
TabHaobanQywxFeeOrderAccount queryById(Long feeAccountId); TabHaobanQywxFeeOrderAccount selectByOrderIdAndCode( @Param("wxEnterpriseId")String wxEnterpriseId , @Param("orderId")String orderId, @Param("activeCode")String activeCode);
/**
* 查询指定行数据
*
* @param tabHaobanQywxFeeOrderAccount 查询条件
* @param pageable 分页对象
* @return 对象列表
*/
List<TabHaobanQywxFeeOrderAccount> queryAllByLimit(TabHaobanQywxFeeOrderAccount tabHaobanQywxFeeOrderAccount, @Param("pageable") Pageable pageable);
/** /**
* 新增数据 * 新增数据
...@@ -40,14 +29,6 @@ public interface TabHaobanQywxFeeOrderAccountMapper { ...@@ -40,14 +29,6 @@ public interface TabHaobanQywxFeeOrderAccountMapper {
int insert(TabHaobanQywxFeeOrderAccount tabHaobanQywxFeeOrderAccount); int insert(TabHaobanQywxFeeOrderAccount tabHaobanQywxFeeOrderAccount);
/** /**
* 批量新增数据(MyBatis原生foreach方法)
*
* @param entities List<TabHaobanQywxFeeOrderAccount> 实例对象列表
* @return 影响行数
*/
int insertBatch(@Param("entities") List<TabHaobanQywxFeeOrderAccount> entities);
/**
* 修改数据 * 修改数据
* *
* @param tabHaobanQywxFeeOrderAccount 实例对象 * @param tabHaobanQywxFeeOrderAccount 实例对象
...@@ -56,14 +37,6 @@ public interface TabHaobanQywxFeeOrderAccountMapper { ...@@ -56,14 +37,6 @@ public interface TabHaobanQywxFeeOrderAccountMapper {
int update(TabHaobanQywxFeeOrderAccount tabHaobanQywxFeeOrderAccount); int update(TabHaobanQywxFeeOrderAccount tabHaobanQywxFeeOrderAccount);
/** /**
* 通过主键删除数据
*
* @param feeAccountId 主键
* @return 影响行数
*/
int deleteById(Long feeAccountId);
/**
* 根据状态查询用户数 * 根据状态查询用户数
* *
* @param status * @param status
......
...@@ -11,36 +11,12 @@ import com.gic.haoban.manage.service.entity.fee.TabHaobanQywxFeeOrderAccount; ...@@ -11,36 +11,12 @@ import com.gic.haoban.manage.service.entity.fee.TabHaobanQywxFeeOrderAccount;
public interface HaobanQywxFeeOrderAccountService { public interface HaobanQywxFeeOrderAccountService {
/** /**
* 通过ID查询单条数据
*
* @param feeAccountId 主键
* @return 实例对象
*/
TabHaobanQywxFeeOrderAccount queryById(Long feeAccountId);
/**
* 新增数据 * 新增数据
* *
* @param tabHaobanQywxFeeOrderAccount 实例对象 * @param tabHaobanQywxFeeOrderAccount 实例对象
* @return 实例对象 * @return 实例对象
*/ */
TabHaobanQywxFeeOrderAccount insert(TabHaobanQywxFeeOrderAccount tabHaobanQywxFeeOrderAccount); TabHaobanQywxFeeOrderAccount save(TabHaobanQywxFeeOrderAccount activeAccount);
/**
* 修改数据
*
* @param tabHaobanQywxFeeOrderAccount 实例对象
* @return 实例对象
*/
TabHaobanQywxFeeOrderAccount update(TabHaobanQywxFeeOrderAccount tabHaobanQywxFeeOrderAccount);
/**
* 通过主键删除数据
*
* @param feeAccountId 主键
* @return 是否成功
*/
boolean deleteById(Long feeAccountId);
/** /**
* 未激活用户数 * 未激活用户数
......
package com.gic.haoban.manage.service.service.fee.impl; package com.gic.haoban.manage.service.service.fee.impl;
import com.gic.commons.util.UniqueIdUtils;
import com.gic.haoban.manage.service.dao.mapper.fee.TabHaobanQywxFeeOrderAccountMapper; import com.gic.haoban.manage.service.dao.mapper.fee.TabHaobanQywxFeeOrderAccountMapper;
import com.gic.haoban.manage.service.entity.fee.TabHaobanQywxFeeOrderAccount; import com.gic.haoban.manage.service.entity.fee.TabHaobanQywxFeeOrderAccount;
import com.gic.haoban.manage.service.service.fee.HaobanQywxFeeOrderAccountService; import com.gic.haoban.manage.service.service.fee.HaobanQywxFeeOrderAccountService;
...@@ -18,50 +19,25 @@ public class HaobanQywxFeeOrderAccountServiceImpl implements HaobanQywxFeeOrderA ...@@ -18,50 +19,25 @@ public class HaobanQywxFeeOrderAccountServiceImpl implements HaobanQywxFeeOrderA
private TabHaobanQywxFeeOrderAccountMapper tabHaobanQywxFeeOrderAccountMapper; private TabHaobanQywxFeeOrderAccountMapper tabHaobanQywxFeeOrderAccountMapper;
/** /**
* 通过ID查询单条数据
*
* @param feeAccountId 主键
* @return 实例对象
*/
@Override
public TabHaobanQywxFeeOrderAccount queryById(Long feeAccountId) {
return this.tabHaobanQywxFeeOrderAccountMapper.queryById(feeAccountId);
}
/**
* 新增数据 * 新增数据
* *
* @param tabHaobanQywxFeeOrderAccount 实例对象 * @param tabHaobanQywxFeeOrderAccount 实例对象
* @return 实例对象 * @return 实例对象
*/ */
@Override @Override
public TabHaobanQywxFeeOrderAccount insert(TabHaobanQywxFeeOrderAccount tabHaobanQywxFeeOrderAccount) { public TabHaobanQywxFeeOrderAccount save(TabHaobanQywxFeeOrderAccount activeAccount) {
this.tabHaobanQywxFeeOrderAccountMapper.insert(tabHaobanQywxFeeOrderAccount); String wxEnterpriseId = activeAccount.getWxEnterpriseId() ;
return tabHaobanQywxFeeOrderAccount; String orderId = activeAccount.getOrderId() ;
String activeCode = activeAccount.getActiveCode() ;
TabHaobanQywxFeeOrderAccount tab = this.tabHaobanQywxFeeOrderAccountMapper.selectByOrderIdAndCode(wxEnterpriseId, orderId, activeCode) ;
if(tab==null) {
activeAccount.setFeeAccountId(UniqueIdUtils.uniqueLong());
this.tabHaobanQywxFeeOrderAccountMapper.insert(activeAccount);
}else {
activeAccount.setFeeAccountId(tab.getFeeAccountId());
this.tabHaobanQywxFeeOrderAccountMapper.update(activeAccount);
} }
return activeAccount;
/**
* 修改数据
*
* @param tabHaobanQywxFeeOrderAccount 实例对象
* @return 实例对象
*/
@Override
public TabHaobanQywxFeeOrderAccount update(TabHaobanQywxFeeOrderAccount tabHaobanQywxFeeOrderAccount) {
this.tabHaobanQywxFeeOrderAccountMapper.update(tabHaobanQywxFeeOrderAccount);
return this.queryById(tabHaobanQywxFeeOrderAccount.getFeeAccountId());
}
/**
* 通过主键删除数据
*
* @param feeAccountId 主键
* @return 是否成功
*/
@Override
public boolean deleteById(Long feeAccountId) {
return this.tabHaobanQywxFeeOrderAccountMapper.deleteById(feeAccountId) > 0;
} }
@Override @Override
......
...@@ -55,7 +55,6 @@ import com.gic.wechat.api.dto.qywx.fee.FeeOrderResponseList; ...@@ -55,7 +55,6 @@ import com.gic.wechat.api.dto.qywx.fee.FeeOrderResponseList;
import com.gic.wechat.api.dto.qywx.fee.qdto.FeeOrderListQDTO; import com.gic.wechat.api.dto.qywx.fee.qdto.FeeOrderListQDTO;
import com.gic.wechat.api.service.qywx.QywxUserApiService; import com.gic.wechat.api.service.qywx.QywxUserApiService;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
@Service("haobanQywxFeeApiService") @Service("haobanQywxFeeApiService")
...@@ -124,11 +123,14 @@ public class HaobanQywxFeeApiServiceImpl implements HaobanQywxFeeApiService { ...@@ -124,11 +123,14 @@ public class HaobanQywxFeeApiServiceImpl implements HaobanQywxFeeApiService {
return ; return ;
} }
for (AccountListDTO accountListDTO : accountListResponseDTO.getAccountList()) { for (AccountListDTO accountListDTO : accountListResponseDTO.getAccountList()) {
// 只记录互通账号
if(accountListDTO.getType()==2) {
Map<String, String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
map.put("orderId", orderId); map.put("orderId", orderId);
map.put("activeCode", accountListDTO.getActiveCode()); map.put("activeCode", accountListDTO.getActiveCode());
activeCodeList.add(map); activeCodeList.add(map);
} }
}
cursor = accountListResponseDTO.getNextCursor() ; cursor = accountListResponseDTO.getNextCursor() ;
Integer hasMore = accountListResponseDTO.getHasMore(); Integer hasMore = accountListResponseDTO.getHasMore();
...@@ -251,26 +253,21 @@ public class HaobanQywxFeeApiServiceImpl implements HaobanQywxFeeApiService { ...@@ -251,26 +253,21 @@ public class HaobanQywxFeeApiServiceImpl implements HaobanQywxFeeApiService {
for (Map<String, String> activeCodeMap : activeCodeList) { for (Map<String, String> activeCodeMap : activeCodeList) {
String activeCode = activeCodeMap.get("activeCode"); String activeCode = activeCodeMap.get("activeCode");
String orderId = activeCodeMap.get("orderId"); String orderId = activeCodeMap.get("orderId");
ActiveInfoCodeResponseDTO activeInfoCodeResponseDTO = qywxUserApiService.getActiveInfoByCode(corpid, serviceCorpid, activeCode); TabHaobanQywxFeeOrderAccount activeAccount = new TabHaobanQywxFeeOrderAccount();
if (activeInfoCodeResponseDTO.getErrcode() != 0) { ActiveInfoCodeResponseDTO activeDetail = qywxUserApiService.getActiveInfoByCode(corpid, serviceCorpid, activeCode);
logger.error("激活码详情报错:{}", activeInfoCodeResponseDTO.getErrmsg()); if (activeDetail.getErrcode() == 0) {
continue; String userid = activeDetail.getUserid();
} activeAccount.setWxUserId(userid);
String userid = activeInfoCodeResponseDTO.getUserid(); activeAccount.setAccountType(activeDetail.getType());
if (StringUtils.isNotBlank(userid)) { activeAccount.setStatus(activeDetail.getStatus());
TabHaobanQywxFeeOrderAccount tabHaobanQywxFeeOrderAccount = new TabHaobanQywxFeeOrderAccount(); activeAccount.setExpireTime(DateUtil.date(activeDetail.getExpireTime() * 1000));
tabHaobanQywxFeeOrderAccount.setFeeAccountId(UniqueIdUtils.uniqueLong()); activeAccount.setActiveTime(DateUtil.date(activeDetail.getActiveTime() * 1000));
tabHaobanQywxFeeOrderAccount.setOrderId(orderId); }
tabHaobanQywxFeeOrderAccount.setCorpId(corpid); activeAccount.setOrderId(orderId);
tabHaobanQywxFeeOrderAccount.setWxEnterpriseId(wxEnterpriseId); activeAccount.setActiveCode(activeCode);
tabHaobanQywxFeeOrderAccount.setWxUserId(userid); activeAccount.setCorpId(corpid);
tabHaobanQywxFeeOrderAccount.setActiveCode(activeInfoCodeResponseDTO.getActiveCode()); activeAccount.setWxEnterpriseId(wxEnterpriseId);
tabHaobanQywxFeeOrderAccount.setAccountType(activeInfoCodeResponseDTO.getType()); haobanQywxFeeOrderAccountService.save(activeAccount);
tabHaobanQywxFeeOrderAccount.setStatus(activeInfoCodeResponseDTO.getStatus());
tabHaobanQywxFeeOrderAccount.setExpireTime(DateUtil.date(activeInfoCodeResponseDTO.getExpireTime() * 1000));
tabHaobanQywxFeeOrderAccount.setActiveTime(DateUtil.date(activeInfoCodeResponseDTO.getActiveTime() * 1000));
haobanQywxFeeOrderAccountService.insert(tabHaobanQywxFeeOrderAccount);
}
} }
} }
......
...@@ -21,73 +21,21 @@ ...@@ -21,73 +21,21 @@
</sql> </sql>
<!--查询单个--> <!--查询单个-->
<select id="queryById" resultMap="TabHaobanQywxFeeOrderAccountMap"> <select id="selectByOrderIdAndCode" resultMap="TabHaobanQywxFeeOrderAccountMap">
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from tab_haoban_qywx_fee_order_account from tab_haoban_qywx_fee_order_account
where fee_account_id = #{feeAccountId} where order_id = #{orderId} and active_code = #{activeCode} and wx_enterprise_id = #{wxEnterpriseId}
</select> </select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="TabHaobanQywxFeeOrderAccountMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_qywx_fee_order_account
<where>
<if test="feeAccountId != null">
and fee_account_id = #{feeAccountId}
</if>
<if test="orderId != null and orderId != ''">
and order_id = #{orderId}
</if>
<if test="corpId != null and corpId != ''">
and corp_id = #{corpId}
</if>
<if test="wxEnterpriseId != null and wxEnterpriseId != ''">
and wx_enterprise_id = #{wxEnterpriseId}
</if>
<if test="wxUserId != null and wxUserId != ''">
and wx_user_id = #{wxUserId}
</if>
<if test="activeCode != null and activeCode != ''">
and active_code = #{activeCode}
</if>
<if test="accountType != null">
and account_type = #{accountType}
</if>
<if test="status != null">
and status = #{status}
</if>
<if test="expireTime != null">
and expire_time = #{expireTime}
</if>
<if test="activeTime != null">
and active_time = #{activeTime}
</if>
</where>
limit #{pageable.offset}, #{pageable.pageSize}
</select>
<!--新增所有列--> <!--新增所有列-->
<insert id="insert" keyProperty="feeAccountId" useGeneratedKeys="true"> <insert id="insert">
insert into tab_haoban_qywx_fee_order_account(fee_account_id, order_id, corp_id, wx_enterprise_id, wx_user_id, insert into tab_haoban_qywx_fee_order_account(fee_account_id, order_id, corp_id, wx_enterprise_id, wx_user_id,
active_code, account_type, status, expire_time, active_time) active_code, account_type, status, expire_time, active_time)
values (#{feeAccountId}, #{orderId}, #{corpId}, #{wxEnterpriseId}, #{wxUserId}, #{activeCode}, #{accountType}, values (#{feeAccountId}, #{orderId}, #{corpId}, #{wxEnterpriseId}, #{wxUserId}, #{activeCode}, #{accountType},
#{status}, #{expireTime}, #{activeTime}) #{status}, #{expireTime}, #{activeTime})
</insert> </insert>
<insert id="insertBatch" keyProperty="feeAccountId" useGeneratedKeys="true">
insert into tab_haoban_qywx_fee_order_account(fee_account_id, order_id, corp_id, wx_enterprise_id, wx_user_id,
active_code, account_type, status, expire_time, active_time)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.feeAccountId}, #{entity.orderId}, #{entity.corpId}, #{entity.wxEnterpriseId}, #{entity.wxUserId},
#{entity.activeCode}, #{entity.accountType}, #{entity.status}, #{entity.expireTime}, #{entity.activeTime})
</foreach>
</insert>
<!--通过主键修改数据--> <!--通过主键修改数据-->
<update id="update"> <update id="update">
update tab_haoban_qywx_fee_order_account update tab_haoban_qywx_fee_order_account
...@@ -123,14 +71,6 @@ ...@@ -123,14 +71,6 @@
where fee_account_id = #{feeAccountId} where fee_account_id = #{feeAccountId}
</update> </update>
<!--通过主键删除-->
<delete id="deleteById">
delete
from tab_haoban_qywx_fee_order_account
where fee_account_id = #{feeAccountId}
</delete>
<select id="countOrderAccountStatus" resultType="java.lang.Integer"> <select id="countOrderAccountStatus" resultType="java.lang.Integer">
select select
count(*) count(*)
......
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