Commit ff59d076 by 徐高华

Merge branch 'feature/获取用户敏感信息' into 'developer'

激活账号

See merge request !881
parents 4d1e57be ade9c229
......@@ -28,7 +28,9 @@ import com.gic.haoban.manage.service.service.StaffService;
import com.gic.haoban.manage.service.service.fee.HaobanQywxFeeAccountStaffService;
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.ActiveInfoUserResponseDTO;
import com.gic.wechat.api.service.qywx.QywxOrderApiService;
import com.gic.wechat.api.service.qywx.QywxUserApiService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
......@@ -49,6 +51,8 @@ public class StaffServiceImpl implements StaffService {
private Config config ;
@Autowired
private HaobanQywxFeeAccountStaffService haobanQywxFeeAccountStaffService;
@Autowired
private QywxUserApiService qywxUserApiService ;
@Override
public TabHaobanStaff selectById(String id) {
......@@ -214,7 +218,7 @@ public class StaffServiceImpl implements StaffService {
AccountListResponseDTO dto = resp.getResult() ;
List<AccountListDTO> list = dto.getAccountList() ;
log.info("查询激活账号,size={},wxeid={}",list.size(),wxEnterpriseId);
this.updateAccount(wxEnterpriseId, list);
this.updateAccount(wxEnterpriseId,openCorpid, list);
cursor = dto.getNextCursor() ;
Integer hasMore = dto.getHasMore() ;
// 从企微拉取下一批数据
......@@ -224,10 +228,9 @@ public class StaffServiceImpl implements StaffService {
}
}
private void updateAccount(String wxEnterpriseId , List<AccountListDTO> list) {
private void updateAccount(String wxEnterpriseId , String openCorpid ,List<AccountListDTO> list) {
for(AccountListDTO item : list) {
String userId = item.getUserid() ;
String activeCode = item.getActiveCode() ;
Date start = new Date(item.getActiveTime()*1000L) ;
Date end = new Date(item.getExpireTime()*1000L) ;
TabHaobanStaff staff = this.mapper.selectByUserIdAndEnterpriseId(userId, wxEnterpriseId) ;
......@@ -240,7 +243,16 @@ public class StaffServiceImpl implements StaffService {
TabHaobanQywxFeeAccountStaff accountStaff = new TabHaobanQywxFeeAccountStaff();
accountStaff.setFeeAccountStaffId(UniqueIdUtils.uniqueLong());
accountStaff.setWxEnterpriseId(wxEnterpriseId);
accountStaff.setActiveCode(activeCode);
accountStaff.setCorpId(openCorpid);
ActiveInfoUserResponseDTO activeInfoUserResponseDTO = qywxUserApiService.getActiveInfoByUser(openCorpid, config.getCorpid(), userId);
log.info("查询激活详情={},{}",JSON.toJSONString(activeInfoUserResponseDTO),userId);
if (activeInfoUserResponseDTO.getErrcode() == 0) {
for(AccountListDTO dto : activeInfoUserResponseDTO.getActiveInfoList()) {
if(dto.getType()==2) {
accountStaff.setActiveCode(dto.getActiveCode());
}
}
}
accountStaff.setStaffId(staff.getStaffId());
accountStaff.setAccountType(item.getType());
accountStaff.setExpireTime(DateUtil.date(item.getExpireTime() * 1000));
......
......@@ -28,7 +28,7 @@
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="feeAccountId" useGeneratedKeys="true">
<insert id="insert">
insert into tab_haoban_qywx_fee_account_staff(fee_account_staff_id, order_id, corp_id, wx_enterprise_id,
staff_id, active_code, account_type, expire_time, active_time)
values (#{feeAccountStaffId}, #{orderId}, #{corpId}, #{wxEnterpriseId}, #{staffId}, #{activeCode},
......
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