Commit 56a002f3 by jinxin

其它占用的许可被当天激活实时更新

parent c72e69ab
...@@ -188,6 +188,7 @@ public interface StaffMapper { ...@@ -188,6 +188,7 @@ public interface StaffMapper {
*/ */
List<String> queryStaffIdsWithEnterpriseId(@Param("wxEnterpriseIds") List<String> wxEnterpriseIds); List<String> queryStaffIdsWithEnterpriseId(@Param("wxEnterpriseIds") List<String> wxEnterpriseIds);
Integer getNumByActiveCode(@Param("wxEnterpriseId") String wxEnterpriseId,@Param("activeCode")String activeCode); TabHaobanStaff getNumByActiveCode(@Param("wxEnterpriseId") String wxEnterpriseId,@Param("activeCode")String activeCode);
void updateOccupyFlagByStaffId(@Param("staffId") String staffId);
} }
\ No newline at end of file
...@@ -57,6 +57,30 @@ public class TabHaobanStaff implements Serializable { ...@@ -57,6 +57,30 @@ public class TabHaobanStaff implements Serializable {
private Date activeTime; private Date activeTime;
private Date expireTime; private Date expireTime;
private String activeCode; private String activeCode;
/**
* 其他占用许可是否自动激活 0否1是
*/
private Integer occupyFlag;
/**
* 成员的删除时间
*/
private Date delTime;
public Date getDelTime() {
return delTime;
}
public void setDelTime(Date delTime) {
this.delTime = delTime;
}
public Integer getOccupyFlag() {
return occupyFlag;
}
public void setOccupyFlag(Integer occupyFlag) {
this.occupyFlag = occupyFlag;
}
public Date getActiveTime() { public Date getActiveTime() {
return activeTime; return activeTime;
......
...@@ -1183,15 +1183,13 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -1183,15 +1183,13 @@ public class StaffApiServiceImpl implements StaffApiService {
return com.gic.api.base.commons.ServiceResponse.failure("-9999","成员userid不存在!"); return com.gic.api.base.commons.ServiceResponse.failure("-9999","成员userid不存在!");
} }
String staffId = staff.getStaffId(); String staffId = staff.getStaffId();
groupChatService.initStaffGroupChat(staffId);
staffMapper.updateActiveStatusById(staffId,timeStampDate,expireTimeDate,activeCode);
StaffActiveDataDTO activeDataDTO = wxEnterpriseActiveDataService.getWxEnterpriseActiveDataByWxEnterpriseId(wxEnterprise.getWxEnterpriseId()); StaffActiveDataDTO activeDataDTO = wxEnterpriseActiveDataService.getWxEnterpriseActiveDataByWxEnterpriseId(wxEnterprise.getWxEnterpriseId());
if (null == activeDataDTO){ if (null == activeDataDTO){
logger.info("查询不到企业微信id->{}的许可账号统计信息!",wxEnterprise.getWxEnterpriseId()); logger.info("查询不到企业微信id->{}的许可账号统计信息!",wxEnterprise.getWxEnterpriseId());
}else { }else {
//需要区分激活码,待转移状态的激活码不需要处理 //需要区分激活码,待转移状态的激活码不需要处理
Integer num = staffMapper.getNumByActiveCode(wxEnterprise.getWxEnterpriseId(), activeCode); TabHaobanStaff haobanStaff = staffMapper.getNumByActiveCode(wxEnterprise.getWxEnterpriseId(), activeCode);
if (num==0){ if (null == haobanStaff){
//已使用的加1,已激活的加1,未激活的减1 //已使用的加1,已激活的加1,未激活的减1
Integer used = activeDataDTO.getUsed(); Integer used = activeDataDTO.getUsed();
Integer inactive = activeDataDTO.getInactive(); Integer inactive = activeDataDTO.getInactive();
...@@ -1205,9 +1203,19 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -1205,9 +1203,19 @@ public class StaffApiServiceImpl implements StaffApiService {
activeDataDTO.setInactive(inactive); activeDataDTO.setInactive(inactive);
activeDataDTO.setActivated(activated); activeDataDTO.setActivated(activated);
wxEnterpriseActiveDataService.updateByStaffActiveDataDTO(activeDataDTO); wxEnterpriseActiveDataService.updateByStaffActiveDataDTO(activeDataDTO);
}else {
//判断是否是其它占用的许可被当天激活
Date delTime = haobanStaff.getDelTime();
Date now = new Date();
int days = DateUtil.daysBetween(delTime, now);
if(days == 0){
staffMapper.updateOccupyFlagByStaffId(haobanStaff.getStaffId());
} }
} }
} }
staffMapper.updateActiveStatusById(staffId,timeStampDate,expireTimeDate,activeCode);
groupChatService.initStaffGroupChat(staffId);
}
return com.gic.api.base.commons.ServiceResponse.success(true); return com.gic.api.base.commons.ServiceResponse.success(true);
} }
......
...@@ -27,14 +27,16 @@ ...@@ -27,14 +27,16 @@
<result column="open_concat_flag" property="openConcatFlag"/> <result column="open_concat_flag" property="openConcatFlag"/>
<result column="active_time" property="activeTime" jdbcType="TIMESTAMP"/> <result column="active_time" property="activeTime" jdbcType="TIMESTAMP"/>
<result column="expire_time" property="expireTime" jdbcType="TIMESTAMP"/> <result column="expire_time" property="expireTime" jdbcType="TIMESTAMP"/>
<result column="del_time" property="delTime" jdbcType="TIMESTAMP"/>
<result column="active_code" property="activeCode" jdbcType="VARCHAR"/> <result column="active_code" property="activeCode" jdbcType="VARCHAR"/>
<result column="occupy_flag" property="occupyFlag" jdbcType="INTEGER"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
staff_id staff_id
, wx_user_id, phone_number, staff_name, nation_code, nick_name, sex, postion, , wx_user_id, phone_number, staff_name, nation_code, nick_name, sex, postion,
active_flag, extend_postion, status_flag, create_time, update_time,wx_enterprise_id,head_img, active_flag, extend_postion, status_flag, create_time, update_time,wx_enterprise_id,head_img,
sort,sync_postion_flag,super_manager_flag,wx_open_user_id,wx_open_id,qr_code,add_num,open_concat_flag,active_time,expire_time,active_code sort,sync_postion_flag,super_manager_flag,wx_open_user_id,wx_open_id,qr_code,add_num,open_concat_flag,active_time,expire_time,active_code,occupy_flag,del_time
</sql> </sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String"> <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String">
select select
...@@ -323,7 +325,7 @@ ...@@ -323,7 +325,7 @@
<!-- 其他占用 --> <!-- 其他占用 -->
<if test="occupy != null and 1==occupy"> <if test="occupy != null and 1==occupy">
and a.status_flag = 0 and a.del_time >= DATE_FORMAT(NOW(),'%Y-%m-%d') and a.expire_time >= DATE_FORMAT(NOW(),'%Y-%m-%d') and a.status_flag = 0 and a.del_time >= DATE_FORMAT(NOW(),'%Y-%m-%d') and a.expire_time >= DATE_FORMAT(NOW(),'%Y-%m-%d') and a.occupy_flag = 0
</if> </if>
<!-- --> <!-- -->
<if test="occupy != null and 2==occupy"> <if test="occupy != null and 2==occupy">
...@@ -621,7 +623,12 @@ ...@@ -621,7 +623,12 @@
</update> </update>
<select id="getOccupyNum" resultType="java.lang.Integer"> <select id="getOccupyNum" resultType="java.lang.Integer">
SELECT count(*) FROM tab_haoban_staff WHERE status_flag = 0 and del_time >= DATE_FORMAT(NOW(),'%Y-%m-%d') and expire_time >= DATE_FORMAT(NOW(),'%Y-%m-%d') and wx_enterprise_id = #{wxEnterpriseId} SELECT count(*) FROM tab_haoban_staff
WHERE status_flag = 0
and del_time >= DATE_FORMAT(NOW(),'%Y-%m-%d')
and expire_time >= DATE_FORMAT(NOW(),'%Y-%m-%d')
and wx_enterprise_id = #{wxEnterpriseId}
and occupy_flag = 0
</select> </select>
<select id="getExpiringNum" resultType="java.lang.Integer"> <select id="getExpiringNum" resultType="java.lang.Integer">
...@@ -646,8 +653,15 @@ ...@@ -646,8 +653,15 @@
#{wxEnterpriseId} #{wxEnterpriseId}
</foreach> </foreach>
</select> </select>
<select id="getNumByActiveCode" resultType="java.lang.Integer"> <select id="getNumByActiveCode" resultMap="BaseResultMap">
SELECT count(*) FROM tab_haoban_staff WHERE wx_enterprise_id = #{wxEnterpriseId} and active_code = #{activeCode} SELECT <include refid="Base_Column_List" /> FROM tab_haoban_staff WHERE wx_enterprise_id = #{wxEnterpriseId} and active_code = #{activeCode} limit 1
</select> </select>
<update id="updateOccupyFlagByStaffId">
update tab_haoban_staff set
occupy_flag = 1,
update_time = now()
where staff_id= #{staffId}
</update>
</mapper> </mapper>
\ No newline at end of file
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