Commit 61cf4885 by 墨竹

加好友上限修改

parent 66bd2256
......@@ -186,4 +186,23 @@ public interface StaffMapper {
int updateWxUserIdsByWxOpenUserId(@Param("wxEnterpriseId") String wxEnterpriseId,
@Param("wxOpenUseId") String wxOpenUseId,
@Param("wxUserId") String wxUserId);
/**
* 更新添加num通过id
*
* @param staffId 员工id
* @return int
* @author mozhu
* @date 2022-07-25 16:33:30
*/
int updateAddNumById(@Param("staffId") String staffId);
/**
* 重置添加num
*
* @return int
* @author mozhu
* @date 2022-07-25 16:36:07
*/
int resetAddNum();
}
\ No newline at end of file
......@@ -48,6 +48,7 @@ public class TabHaobanStaff implements Serializable {
private String wxOpenId;
private String qrCode;
private Integer addNum;
@Transient
private String departmentIds;
......@@ -227,4 +228,12 @@ public class TabHaobanStaff implements Serializable {
public void setDepartmentIds(String departmentIds) {
this.departmentIds = departmentIds;
}
public Integer getAddNum() {
return addNum;
}
public void setAddNum(Integer addNum) {
this.addNum = addNum;
}
}
\ No newline at end of file
......@@ -144,5 +144,22 @@ public interface StaffService {
int updateUserIdByUserId(String wxEnterpriseId, String newWxUserId, String oldWxUserId);
/**
* 更新添加num通过id
*
* @param staffId 员工id
* @return int
* @author mozhu
* @date 2022-07-25 16:36:38
*/
int updateAddNumById(String staffId);
/**
* 重置添加num
*
* @return int
* @author mozhu
* @date 2022-07-25 16:36:53
*/
int resetAddNum();
}
......@@ -64,6 +64,7 @@ public class StaffServiceImpl implements StaffService {
tab.setStaffId(StringUtil.randomUUID());
}
tab.setStatusFlag(1);
tab.setAddNum(0);
mapper.insertSelective(tab);
return tab.getStaffId();
}
......@@ -180,4 +181,14 @@ public class StaffServiceImpl implements StaffService {
public int updateUserIdByUserId(String wxEnterpriseId, String newWxUserId, String oldWxUserId) {
return mapper.updateUserIdByUserId(wxEnterpriseId, newWxUserId, oldWxUserId);
}
@Override
public int updateAddNumById(String staffId) {
return mapper.updateAddNumById(staffId);
}
@Override
public int resetAddNum() {
return mapper.resetAddNum();
}
}
......@@ -350,17 +350,18 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
String memberLabelId = "";
if (StringUtils.isNotBlank(state)) {
String id = state.substring(2);
Long hmId = null;
HmQrcodeDTO hmQrcodeDTO = null;
if (state.contains(Manage3Constants.HM)) {
Long hmId = Convert.toLong(id);
hmId = Convert.toLong(id);
log.info("普通活码={}", hmId);
HmQrcodeDTO hmQrcodeDTO = hmQrcodeApiService.getSimpleById(hmId);
hmQrcodeDTO = hmQrcodeApiService.getSimpleById(hmId);
if (hmQrcodeDTO == null) {
log.error("活码为空:{}", hmId);
return;
}
memberLabelId = hmQrcodeDTO.getMemberLabelId();
wxUserAddLogQDTO.setHmId(hmId);
hmQrcodeApiService.updateAddNumById(hmId, hmQrcodeDTO.getClerkId());
//处理活码导购
if (hmQrcodeDTO.getHmType() == 1) {
staffClerkRelationDTO = staffClerkRelationService.getBindByClerkId(hmQrcodeDTO.getClerkId(), wxEnterpriseId);
......@@ -385,14 +386,14 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
} else if (state.contains(Manage3Constants.DT)) {
KeyDataLinkBO dataForHmLink = keyDataService.getDataForHmLink(id);
Long linkId = dataForHmLink.getLinkId();
Long hmId = dataForHmLink.getHmId();
hmId = dataForHmLink.getHmId();
mobile = dataForHmLink.getMobile();
unionid = dataForHmLink.getUnionid();
log.info("动态活码hmId={},linkId={},unionid={}", hmId, linkId, unionid);
isHmUnionid = true;
wxUserAddLogQDTO.setLinkId(linkId);
wxUserAddLogQDTO.setHmId(hmId);
HmQrcodeDTO hmQrcodeDTO = hmQrcodeApiService.getSimpleById(hmId);
hmQrcodeDTO = hmQrcodeApiService.getSimpleById(hmId);
if (hmQrcodeDTO == null) {
log.error("活码动态为空,hmId:{}", hmId);
return;
......@@ -403,6 +404,10 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
memberLabelId = hmLinkBO.getMemberLabelId();
}
}
if (hmId != null && hmQrcodeDTO != null) {
log.info("计算活码的上限和加好友数量:{}", hmId);
hmQrcodeApiService.updateAddNumById(hmId, hmQrcodeDTO.getClerkId());
}
} else {
TabHaobanClerkMainStoreRelated mainStoreRelated = clerkMainStoreRelatedService.getMainStoreByStaffId(staffId, wxEnterpriseId);
if (mainStoreRelated == null) {
......@@ -439,6 +444,8 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
setMemberTag(staffClerkRelationDTO, memberLabelId, memberId);
}
//加好友增加数量
staffService.updateAddNumById(staffId);
log.info("插入加好友日志");
wxUserAddLogQDTO.setWxEnterpriseId(wxEnterpriseId);
wxUserAddLogQDTO.setEnterpriseId(enterpriseId);
......
......@@ -636,15 +636,20 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
@Override
public int updateAddNumById(Long hmId, String clerkId) {
StaffClerkRelationDTO staffClerkRelationDTO = staffClerkRelationService.getByClerkId(clerkId);
if (staffClerkRelationDTO == null) {
logger.error("未绑定好办:{}",clerkId);
return 0;
}
HmQrcodeBO hmQrcodeBO = hmQrcodeService.queryById(hmId);
if (hmQrcodeBO == null) {
logger.error("无活码数据");
return 0;
}
TabHaobanStaff tabHaobanStaff = staffService.selectById(staffClerkRelationDTO.getStaffId());
Integer addNum = tabHaobanStaff.getAddNum();
Integer hmType = hmQrcodeBO.getHmType();
int limit = QwFriendLimitCountUtil.getLimit(true);
Integer addNum = hmQrcodeBO.getAddNum();
if (hmType == 1) {
//单人活码
Integer overFlag = 0;
......@@ -674,6 +679,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
logger.info("重置上限时间定时任务 start");
hmQrcodeService.resetAddNumAndOverFlag();
hmClerkRelationService.resetAddNumAndOverFlag();
staffService.resetAddNum();
logger.info("重置上限时间定时任务 end");
}
......
......@@ -23,14 +23,14 @@
<result column="wx_open_user_id" property="wxOpenUseId" jdbcType="VARCHAR"/>
<result column="wx_open_id" property="wxOpenId" jdbcType="VARCHAR"/>
<result column="qr_code" property="qrCode" jdbcType="VARCHAR"/>
<result column="add_num" property="addNum" jdbcType="INTEGER"/>
</resultMap>
<sql id="Base_Column_List">
staff_id
, 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,
sort,sync_postion_flag,super_manager_flag,wx_open_user_id,wx_open_id,qr_code
sort,sync_postion_flag,super_manager_flag,wx_open_user_id,wx_open_id,qr_code,add_num
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String">
select
......@@ -120,6 +120,9 @@
<if test="qrCode != null">
qr_code,
</if>
<if test="addNum != null">
add_num,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="staffId != null">
......@@ -183,7 +186,10 @@
#{wxOpenId},
</if>
<if test="qrCode != null">
#{qrCode}
#{qrCode},
</if>
<if test="addNum != null">
#{addNum}
</if>
</trim>
</insert>
......@@ -250,6 +256,9 @@
<if test="qrCode != null">
qr_code = #{qrCode}
</if>
<if test="addNum != null">
add_num = #{addNum}
</if>
</set>
where staff_id = #{staffId,jdbcType=VARCHAR}
</update>
......@@ -532,4 +541,20 @@
and wx_open_user_id = #{wxOpenUseId}
</update>
<update id="updateAddNumById" parameterType="java.lang.String">
update tab_haoban_staff
set add_num = add_num +1,
update_time = now()
where staff_id = #{staffId}
</update>
<update id="resetAddNum">
update tab_haoban_staff
<set>
add_num = 0,update_time = now()
</set>
</update>
</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