Commit a04ab877 by 徐高华

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

激活码

See merge request !907
parents de74d060 0e342371
...@@ -135,16 +135,13 @@ public interface StaffMapper { ...@@ -135,16 +135,13 @@ public interface StaffMapper {
/** /**
* 更新是否激活 * 更新是否激活
*
* @param activeStatus 活跃状态
* @param staffId 员工id
* @return int
* @author mozhu
* @date 2022-08-03 17:36:52
*/ */
int updateActiveStatusById(@Param("staffId")String staffId, @Param("activeTime")Date activeTime, int updateActiveStatusById(@Param("wxOpenUserId")String wxOpenUserId, @Param("activeTime")Date activeTime,
@Param("expireTime")Date expireTime, @Param("expireTime")Date expireTime,
@Param("activeDoTime")Date activeDoTime, @Param("activeStatus")Integer activeStatus); @Param("activeCode")String activeCode, @Param("activeStatus")Integer activeStatus);
// 初始化激活码信息,先删除
void deleteActivieInfo(@Param("wxEnterpriseId") String wxEnterpriseId) ;
/** /**
* 重置添加num * 重置添加num
......
...@@ -66,5 +66,7 @@ public interface TabHaobanQywxFeeAccountStaffMapper { ...@@ -66,5 +66,7 @@ public interface TabHaobanQywxFeeAccountStaffMapper {
* @date 2022-08-08 15:53:32 * @date 2022-08-08 15:53:32
*/ */
int lastFeeInterceptCount(@Param("wxEnterpriseId") String wxEnterpriseId); int lastFeeInterceptCount(@Param("wxEnterpriseId") String wxEnterpriseId);
void deleteAll(@Param("wxEnterpriseId") String wxEnterpriseId);
} }
...@@ -20,7 +20,7 @@ public class TabHaobanQywxFeeAccountStaff implements Serializable { ...@@ -20,7 +20,7 @@ public class TabHaobanQywxFeeAccountStaff implements Serializable {
/** /**
* 员工id * 员工id
*/ */
private String staffId; private String wxUserId;
/** /**
* 帐号码 * 帐号码
*/ */
...@@ -62,13 +62,13 @@ public class TabHaobanQywxFeeAccountStaff implements Serializable { ...@@ -62,13 +62,13 @@ public class TabHaobanQywxFeeAccountStaff implements Serializable {
public void setWxEnterpriseId(String wxEnterpriseId) { public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId; this.wxEnterpriseId = wxEnterpriseId;
} }
public String getStaffId() { public String getWxUserId() {
return staffId; return wxUserId;
} }
public void setStaffId(String staffId) { public void setWxUserId(String wxUserId) {
this.staffId = staffId; this.wxUserId = wxUserId;
} }
public String getActiveCode() { public String getActiveCode() {
......
...@@ -139,7 +139,7 @@ public interface StaffService { ...@@ -139,7 +139,7 @@ public interface StaffService {
* @return * @return
* @throws * @throws
*/ */
int updateActiveStatusById(String staffId, Date activeTime, Date expireTime , Date activeDoTime , Integer activeStatus); int updateActiveStatusById(String staffId, Date activeTime, Date expireTime ,String activeCode ,Integer activeStatus);
void updateOpenConcatFlag(List<String> wxUserIdList,int mixFlag); void updateOpenConcatFlag(List<String> wxUserIdList,int mixFlag);
......
...@@ -53,4 +53,6 @@ public interface HaobanQywxFeeAccountStaffService { ...@@ -53,4 +53,6 @@ public interface HaobanQywxFeeAccountStaffService {
*/ */
int monthWillInterceptNum(String wxEnterpriseId); int monthWillInterceptNum(String wxEnterpriseId);
void deleteAll(String wxEnterpriseId);
} }
...@@ -28,15 +28,14 @@ public class HaobanQywxFeeAccountStaffServiceImpl implements HaobanQywxFeeAccoun ...@@ -28,15 +28,14 @@ public class HaobanQywxFeeAccountStaffServiceImpl implements HaobanQywxFeeAccoun
*/ */
@Override @Override
public TabHaobanQywxFeeAccountStaff save(TabHaobanQywxFeeAccountStaff account) { public TabHaobanQywxFeeAccountStaff save(TabHaobanQywxFeeAccountStaff account) {
TabHaobanQywxFeeAccountStaff old = this.tabHaobanQywxFeeAccountStaffMapper.selectByActiveCode(account.getWxEnterpriseId(), account.getActiveCode()) ; this.tabHaobanQywxFeeAccountStaffMapper.insert(account);
if(null != old) {
account.setFeeAccountStaffId(old.getFeeAccountStaffId());
this.tabHaobanQywxFeeAccountStaffMapper.update(account) ;
}else {
this.tabHaobanQywxFeeAccountStaffMapper.insert(account);
}
return account ; return account ;
} }
@Override
public void deleteAll(String wxEnterpriseId) {
this.tabHaobanQywxFeeAccountStaffMapper.deleteAll(wxEnterpriseId);
}
@Override @Override
public List<HaobanQywxFeeDetailDTO> feeDetail(String wxEnterpriseId) { public List<HaobanQywxFeeDetailDTO> feeDetail(String wxEnterpriseId) {
......
...@@ -174,10 +174,9 @@ public class StaffServiceImpl implements StaffService { ...@@ -174,10 +174,9 @@ public class StaffServiceImpl implements StaffService {
} }
@Override @Override
public int updateActiveStatusById(String staffId, Date activeTime, Date expireTime, public int updateActiveStatusById(String wxOpenUserId, Date activeTime, Date expireTime,
Date activeDoTime, Integer activeStatus) { String activeCode, Integer activeStatus) {
return mapper.updateActiveStatusById(wxOpenUserId, activeTime, expireTime, activeCode , activeStatus) ;
return mapper.updateActiveStatusById(staffId, activeTime, expireTime, activeDoTime, activeStatus) ;
} }
@Override @Override
...@@ -203,6 +202,8 @@ public class StaffServiceImpl implements StaffService { ...@@ -203,6 +202,8 @@ 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) {
this.haobanQywxFeeAccountStaffService.deleteAll(item.getWxEnterpriseId()) ;
this.mapper.deleteActivieInfo(item.getWxEnterpriseId());
this.listAccount(item, 500, null); this.listAccount(item, 500, null);
} }
} }
...@@ -231,32 +232,30 @@ public class StaffServiceImpl implements StaffService { ...@@ -231,32 +232,30 @@ public class StaffServiceImpl implements StaffService {
private void updateAccount(String wxEnterpriseId , String openCorpid ,List<AccountListDTO> list) { private void updateAccount(String wxEnterpriseId , String openCorpid ,List<AccountListDTO> list) {
for(AccountListDTO item : list) { for(AccountListDTO item : list) {
String userId = item.getUserid() ; String userId = item.getUserid() ;
Date start = new Date(item.getActiveTime()*1000L) ;
Date end = new Date(item.getExpireTime()*1000L) ;
TabHaobanStaff staff = this.mapper.selectByUserIdAndEnterpriseId(userId, wxEnterpriseId) ;
if(null == staff && end.getTime()>System.currentTimeMillis()) {
staff = this.mapper.getDeleteUser(userId, wxEnterpriseId) ;
}
TabHaobanQywxFeeAccountStaff accountStaff = new TabHaobanQywxFeeAccountStaff();
accountStaff.setFeeAccountStaffId(UniqueIdUtils.uniqueLong());
accountStaff.setWxEnterpriseId(wxEnterpriseId);
accountStaff.setCorpId(openCorpid);
if(null != staff) {
this.updateActiveStatusById(staff.getStaffId(), start, end, new Date(), 1) ;
accountStaff.setStaffId(staff.getStaffId());
}else {
log.info("查询激活账号,用户不存在,userid={}",userId);
accountStaff.setStaffId(userId);
}
ActiveInfoUserResponseDTO activeInfoUserResponseDTO = qywxUserApiService.getActiveInfoByUser(openCorpid, config.getCorpid(), userId); ActiveInfoUserResponseDTO activeInfoUserResponseDTO = qywxUserApiService.getActiveInfoByUser(openCorpid, config.getCorpid(), userId);
log.info("查询激活详情={},{}",JSON.toJSONString(activeInfoUserResponseDTO),userId); log.info("查询用户激活详情={},{}",JSON.toJSONString(activeInfoUserResponseDTO),userId);
String activeCode = null ;
if (activeInfoUserResponseDTO.getErrcode() == 0) { if (activeInfoUserResponseDTO.getErrcode() == 0) {
for(AccountListDTO dto : activeInfoUserResponseDTO.getActiveInfoList()) { for(AccountListDTO dto : activeInfoUserResponseDTO.getActiveInfoList()) {
if(dto.getType()==2) { if(dto.getType()==2) {
accountStaff.setActiveCode(dto.getActiveCode()); activeCode = dto.getActiveCode() ;
} }
} }
} }
if(StringUtils.isEmpty(activeCode)){
log.info("无互通激活码={}",userId);
continue ;
}
Date start = new Date(item.getActiveTime()*1000L) ;
Date end = new Date(item.getExpireTime()*1000L) ;
log.info("更新staff表,userId={}",userId);
this.updateActiveStatusById(userId , start, end, activeCode, 1) ;
TabHaobanQywxFeeAccountStaff accountStaff = new TabHaobanQywxFeeAccountStaff();
accountStaff.setFeeAccountStaffId(UniqueIdUtils.uniqueLong());
accountStaff.setWxEnterpriseId(wxEnterpriseId);
accountStaff.setCorpId(openCorpid);
accountStaff.setActiveCode(activeCode);
accountStaff.setWxUserId(userId);
accountStaff.setAccountType(item.getType()); accountStaff.setAccountType(item.getType());
accountStaff.setExpireTime(DateUtil.date(item.getExpireTime() * 1000)); accountStaff.setExpireTime(DateUtil.date(item.getExpireTime() * 1000));
accountStaff.setActiveTime(DateUtil.date(item.getActiveTime() * 1000)); accountStaff.setActiveTime(DateUtil.date(item.getActiveTime() * 1000));
......
...@@ -502,9 +502,18 @@ ...@@ -502,9 +502,18 @@
set active_status = #{activeStatus}, set active_status = #{activeStatus},
`active_time` = #{activeTime}, `active_time` = #{activeTime},
`expire_time` = #{expireTime}, `expire_time` = #{expireTime},
`active_do_time` = #{activeDoTime}, `active_code` = #{activeCode},
update_time = now() update_time = now()
where staff_id = #{staffId} where wx_open_user_id = #{wxOpenUserId}
</update>
<update id="deleteActivieInfo">
update tab_haoban_staff
set active_status = 0,
`active_time` = null,
`expire_time` = null ,
update_time = now()
where wx_enterprise_id = #{wxEnterpriseId} and expire_time is not null
</update> </update>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<result property="feeAccountStaffId" column="fee_account_staff_id" jdbcType="INTEGER"/> <result property="feeAccountStaffId" column="fee_account_staff_id" jdbcType="INTEGER"/>
<result property="corpId" column="corp_id" jdbcType="VARCHAR"/> <result property="corpId" column="corp_id" jdbcType="VARCHAR"/>
<result property="wxEnterpriseId" column="wx_enterprise_id" jdbcType="VARCHAR"/> <result property="wxEnterpriseId" column="wx_enterprise_id" jdbcType="VARCHAR"/>
<result property="staffId" column="staff_id" jdbcType="VARCHAR"/> <result property="wxUserId" column="wx_user_id" jdbcType="VARCHAR"/>
<result property="activeCode" column="active_code" jdbcType="VARCHAR"/> <result property="activeCode" column="active_code" jdbcType="VARCHAR"/>
<result property="accountType" column="account_type" jdbcType="INTEGER"/> <result property="accountType" column="account_type" jdbcType="INTEGER"/>
<result property="expireTime" column="expire_time" jdbcType="TIMESTAMP"/> <result property="expireTime" column="expire_time" jdbcType="TIMESTAMP"/>
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<sql id="Base_Column_List"> <sql id="Base_Column_List">
fee_account_staff_id fee_account_staff_id
, corp_id, wx_enterprise_id, staff_id, active_code, account_type, expire_time, active_time , corp_id, wx_enterprise_id, wx_user_id, active_code, account_type, expire_time, active_time
</sql> </sql>
<!--查询单个--> <!--查询单个-->
...@@ -29,8 +29,8 @@ ...@@ -29,8 +29,8 @@
<!--新增所有列--> <!--新增所有列-->
<insert id="insert"> <insert id="insert">
insert into tab_haoban_qywx_fee_account_staff(fee_account_staff_id, corp_id, wx_enterprise_id, insert into tab_haoban_qywx_fee_account_staff(fee_account_staff_id, corp_id, wx_enterprise_id,
staff_id, active_code, account_type, expire_time, active_time) wx_user_id, active_code, account_type, expire_time, active_time)
values (#{feeAccountStaffId}, #{corpId}, #{wxEnterpriseId}, #{staffId}, #{activeCode}, values (#{feeAccountStaffId}, #{corpId}, #{wxEnterpriseId}, #{wxUserId}, #{activeCode},
#{accountType}, #{expireTime}, #{activeTime}) #{accountType}, #{expireTime}, #{activeTime})
</insert> </insert>
...@@ -44,9 +44,6 @@ ...@@ -44,9 +44,6 @@
<if test="wxEnterpriseId != null and wxEnterpriseId != ''"> <if test="wxEnterpriseId != null and wxEnterpriseId != ''">
wx_enterprise_id = #{wxEnterpriseId}, wx_enterprise_id = #{wxEnterpriseId},
</if> </if>
<if test="staffId != null and staffId != ''">
staff_id = #{staffId},
</if>
<if test="activeCode != null and activeCode != ''"> <if test="activeCode != null and activeCode != ''">
active_code = #{activeCode}, active_code = #{activeCode},
</if> </if>
...@@ -65,7 +62,7 @@ ...@@ -65,7 +62,7 @@
<select id="feeDetail" resultType="com.gic.haoban.manage.api.dto.fee.HaobanQywxFeeDetailDTO"> <select id="feeDetail" resultType="com.gic.haoban.manage.api.dto.fee.HaobanQywxFeeDetailDTO">
select select
count(distinct staff_id) interceptUserNum, count(distinct wx_user_id) interceptUserNum,
DATE_FORMAT( expire_time, '%Y-%m-%d' ) interceptTime DATE_FORMAT( expire_time, '%Y-%m-%d' ) interceptTime
from tab_haoban_qywx_fee_account_staff from tab_haoban_qywx_fee_account_staff
where wx_enterprise_id = #{wxEnterpriseId} where wx_enterprise_id = #{wxEnterpriseId}
...@@ -85,9 +82,13 @@ ...@@ -85,9 +82,13 @@
<select id="lastFeeInterceptCount" resultType="java.lang.Integer"> <select id="lastFeeInterceptCount" resultType="java.lang.Integer">
select select
count(distinct staff_id) count(distinct wx_user_id)
from tab_haoban_qywx_fee_account_staff from tab_haoban_qywx_fee_account_staff
where wx_enterprise_id = #{wxEnterpriseId} where wx_enterprise_id = #{wxEnterpriseId}
and expire_time between DATE(CURDATE()) and DATE_add(CURDATE(), INTERVAL 30 DAY) and expire_time between DATE(CURDATE()) and DATE_add(CURDATE(), INTERVAL 30 DAY)
</select> </select>
<delete id="deleteAll">
delete from tab_haoban_qywx_fee_account_staff where wx_enterprise_id = #{wxEnterpriseId}
</delete>
</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