Commit 5c6bfe56 by yaosai

Merge branch 'bugfix-0214' into 'developer'

修复群发返回错误信息

See merge request !165
parents aee12114 d35ac170
...@@ -14,132 +14,144 @@ public interface StaffMapper { ...@@ -14,132 +14,144 @@ public interface StaffMapper {
TabHaobanStaff selectByPrimaryKey(String staffId); TabHaobanStaff selectByPrimaryKey(String staffId);
int updateByPrimaryKeySelective(TabHaobanStaff record); int updateByPrimaryKeySelective(TabHaobanStaff record);
TabHaobanStaff selectByNationcodeAndPhoneNumber(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("nationCode") String nationcode, @Param("phoneNumber") String phoneNumber); TabHaobanStaff selectByNationcodeAndPhoneNumber(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("nationCode") String nationcode, @Param("phoneNumber") String phoneNumber);
List<TabHaobanStaff> listByIds(@Param("staffIds") List<String> staffIds); List<TabHaobanStaff> listByIds(@Param("staffIds") List<String> staffIds);
List<TabHaobanStaff> listByWxUserId(@Param("wxUserId") String wxUserId); List<TabHaobanStaff> listByWxUserId(@Param("wxUserId") String wxUserId);
List<TabHaobanStaff> listLikeName(@Param("staffName") String staffName); List<TabHaobanStaff> listLikeName(@Param("staffName") String staffName);
Page<TabHaobanStaff> pageStaff(@Param("staffIds") Set<String> staffIds, @Param("activeFlag") Integer activeFlag, @Param("keyword") String keyword); Page<TabHaobanStaff> pageStaff(@Param("staffIds") Set<String> staffIds, @Param("activeFlag") Integer activeFlag, @Param("keyword") String keyword);
/** /**
* 选择用户id和企业标识 * 选择用户id和企业标识
* *
* @param userId 用户id * @param userId 用户id
* @param wxEnterpriseId wx企业标识 * @param wxEnterpriseId wx企业标识
* @return {@link TabHaobanStaff } * @return {@link TabHaobanStaff }
* @author mozhu * @author mozhu
* @date 2022-01-13 15:05:28 * @date 2022-01-13 15:05:28
*/ */
TabHaobanStaff selectByUserIdAndEnterpriseId(@Param("userId") String userId, TabHaobanStaff selectByUserIdAndEnterpriseId(@Param("userId") String userId,
@Param("wxEnterpriseId") String wxEnterpriseId); @Param("wxEnterpriseId") String wxEnterpriseId);
TabHaobanStaff selectSuperByWxEnterpriseId(@Param("wxEnterpriseId") String wxEnterpriseId); TabHaobanStaff selectSuperByWxEnterpriseId(@Param("wxEnterpriseId") String wxEnterpriseId);
List<TabHaobanStaff> listByPhoneNumber(@Param("phoneNumber") String phoneNumber); List<TabHaobanStaff> listByPhoneNumber(@Param("phoneNumber") String phoneNumber);
List<TabHaobanStaff> listByUserIdsAndWxEnterpriseId(@Param("userIds") List<String> userIds, @Param("wxEnterpriseId") String wxEnterpriseId); List<TabHaobanStaff> listByUserIdsAndWxEnterpriseId(@Param("userIds") List<String> userIds, @Param("wxEnterpriseId") String wxEnterpriseId);
int cleanStaff(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("staffIds") List<String> staffIds); int cleanStaff(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("staffIds") List<String> staffIds);
TabHaobanStaff getWxStaffByOne(@Param("wxEnterpriseId") String wxEnterpriseId); TabHaobanStaff getWxStaffByOne(@Param("wxEnterpriseId") String wxEnterpriseId);
List<String> listUserStaffId(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("staffIds") List<String> staffIds); List<String> listUserStaffId(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("staffIds") List<String> staffIds);
List<TabHaobanStaff> listNoStatusStaffIds(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("staffIds") List<String> staffIds); List<TabHaobanStaff> listNoStatusStaffIds(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("staffIds") List<String> staffIds);
TabHaobanStaff getNoStatusByWxUserIds(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("wxUserId") String wxUserId); TabHaobanStaff getNoStatusByWxUserIds(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("wxUserId") String wxUserId);
/** /**
* 通过开放用户id和wx企业id列表 * 通过开放用户id和wx企业id列表
* *
* @param openUserIds 开放的用户id * @param openUserIds 开放的用户id
* @param wxEnterpriseId wx企业标识 * @param wxEnterpriseId wx企业标识
* @return {@link List<TabHaobanStaff> } * @return {@link List<TabHaobanStaff> }
* @author mozhu * @author mozhu
* @date 2021-12-21 16:35:35 * @date 2021-12-21 16:35:35
*/ */
List<TabHaobanStaff> listByOpenUserIdsAndWxEnterpriseId(@Param("openUserIds") List<String> openUserIds, List<TabHaobanStaff> listByOpenUserIdsAndWxEnterpriseId(@Param("openUserIds") List<String> openUserIds,
@Param("wxEnterpriseId") String wxEnterpriseId); @Param("wxEnterpriseId") String wxEnterpriseId);
/** /**
* 用户id wx企业id列表 * 用户id wx企业id列表
* *
* @param wxEnterpriseId wx企业标识 * @param wxEnterpriseId wx企业标识
* @return {@link List<String> } * @return {@link List<String> }
* @author mozhu * @author mozhu
* @date 2021-12-21 17:05:58 * @date 2021-12-21 17:05:58
*/ */
List<TabHaobanStaff> listUserIdByWxEnterpriseId(@Param("wxEnterpriseId") String wxEnterpriseId); List<TabHaobanStaff> listUserIdByWxEnterpriseId(@Param("wxEnterpriseId") String wxEnterpriseId);
/** /**
* 更新开放用户id,用户id * 更新开放用户id,用户id
* *
* @param wxEnterpriseId wx企业标识 * @param wxEnterpriseId wx企业标识
* @param wxUserId wx用户id * @param wxUserId wx用户id
* @param wxOpenUseId 开放的用户id * @param wxOpenUseId 开放的用户id
* @return int * @return int
* @author mozhu * @author mozhu
* @date 2021-12-21 17:17:51 * @date 2021-12-21 17:17:51
*/ */
int updateOpenUserIdsByUserId(@Param("wxEnterpriseId") String wxEnterpriseId, int updateOpenUserIdsByUserId(@Param("wxEnterpriseId") String wxEnterpriseId,
@Param("wxUserId") String wxUserId, @Param("wxUserId") String wxUserId,
@Param("wxOpenUseId") String wxOpenUseId); @Param("wxOpenUseId") String wxOpenUseId);
/** /**
* 选择通过打开用户id和企业标识 * 选择通过打开用户id和企业标识
* *
* @param wxOpenUseId wx开放使用id * @param wxOpenUseId wx开放使用id
* @param wxEnterpriseId wx企业标识 * @param wxEnterpriseId wx企业标识
* @return {@link TabHaobanStaff } * @return {@link TabHaobanStaff }
* @author mozhu * @author mozhu
* @date 2021-12-21 21:13:56 * @date 2021-12-21 21:13:56
*/ */
TabHaobanStaff selectByOpenUserIdAndEnterpriseId(@Param("wxOpenUseId") String wxOpenUseId, TabHaobanStaff selectByOpenUserIdAndEnterpriseId(@Param("wxOpenUseId") String wxOpenUseId,
@Param("wxEnterpriseId") String wxEnterpriseId); @Param("wxEnterpriseId") String wxEnterpriseId);
/** /**
* 更新开放id员工id * 更新开放id员工id
* *
* @param staffId 员工id * @param staffId 员工id
* @param openId 开放id * @param openId 开放id
* @return int * @return int
*/ */
int updateOpenIdByStaffId(@Param("staffId") String staffId, @Param("openId") String openId); int updateOpenIdByStaffId(@Param("staffId") String staffId, @Param("openId") String openId);
/** /**
* 更新二维码通过员工id * 更新二维码通过员工id
* *
* @param staffId 员工id * @param staffId 员工id
* @param qrCode 二维码 * @param qrCode 二维码
* @return int * @return int
*/ */
int updateQrCodeByStaffId(@Param("staffId") String staffId, @Param("qrCode") String qrCode); int updateQrCodeByStaffId(@Param("staffId") String staffId, @Param("qrCode") String qrCode);
/** /**
* 选择电话号码和企业标识 * 选择电话号码和企业标识
* *
* @param phoneNumber 电话号码 * @param phoneNumber 电话号码
* @param wxEnterpriseId wx企业标识 * @param wxEnterpriseId wx企业标识
* @return {@link TabHaobanStaff } * @return {@link TabHaobanStaff }
* @author mozhu * @author mozhu
* @date 2022-01-12 17:20:16 * @date 2022-01-12 17:20:16
*/ */
TabHaobanStaff selectByPhoneNumberAndEnterpriseId(@Param("phoneNumber") String phoneNumber, TabHaobanStaff selectByPhoneNumberAndEnterpriseId(@Param("phoneNumber") String phoneNumber,
@Param("wxEnterpriseId") String wxEnterpriseId); @Param("wxEnterpriseId") String wxEnterpriseId);
/**
* 删除除了当前staffId以外其他的staff /**
* * 删除同微信用户id的其他导购
* @param staffId staffId *
* @param wxEnterpriseId wx企业标识 * @param wxEnterpriseId 微信企业id
* @param wxUserId wx用户id * @param wxUserId 微信用户id
*/ * @param staffId 导购id
void delOtherStaff(@Param("staffId")String staffId, */
@Param("wxEnterpriseId")String wxEnterpriseId, void delStaffByWxUserId(@Param("wxEnterpriseId") String wxEnterpriseId,
@Param("wxUserId")String wxUserId); @Param("wxUserId") String wxUserId,
@Param("staffId") String staffId);
/**
* 删除同手机号的其他导购
*
* @param wxEnterpriseId 微信企业id
* @param phoneNumber 手机号
* @param staffId 导购id
*/
void delStaffByPhoneNumber(@Param("wxEnterpriseId") String wxEnterpriseId,
@Param("phoneNumber") String phoneNumber,
@Param("staffId") String staffId);
} }
\ No newline at end of file
...@@ -97,13 +97,13 @@ public interface StaffService { ...@@ -97,13 +97,13 @@ public interface StaffService {
*/ */
int updateOpenUserIdsByUserId(String wxEnterpriseId, String wxUserId, String wxOpenUseId); int updateOpenUserIdsByUserId(String wxEnterpriseId, String wxUserId, String wxOpenUseId);
/** /**
* 删除除了当前staffId以外其他的staff * 删除同手机号同wxUserId的其他用户
* *
* @param staffId staffId * @param staffId 导购id
* @param wxEnterpriseId wx企业标识
* @param wxUserId wx用户id * @param wxUserId wx用户id
* @param phoneNumber 手机号
* @param wxEnterpriseId 微信企业id
*/ */
void delOtherStaff(String staffId, String wxEnterpriseId, String wxUserId); void delOtherStaffById(String staffId, String wxUserId, String phoneNumber, String wxEnterpriseId);
} }
...@@ -121,11 +121,9 @@ public class StaffServiceImpl implements StaffService { ...@@ -121,11 +121,9 @@ public class StaffServiceImpl implements StaffService {
} }
@Override @Override
public void delOtherStaff(String staffId, String wxEnterpriseId, String wxUserId) { public void delOtherStaffById(String staffId, String wxUserId, String phoneNumber, String wxEnterpriseId) {
if (StringUtils.isEmpty(staffId)){ mapper.delStaffByWxUserId(wxEnterpriseId, wxUserId, staffId);
return; mapper.delStaffByPhoneNumber(wxEnterpriseId, phoneNumber, staffId);
}
mapper.delOtherStaff(staffId, wxEnterpriseId, wxUserId);
} }
} }
...@@ -391,8 +391,8 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -391,8 +391,8 @@ public class StaffApiServiceImpl implements StaffApiService {
String phoneNumber = arr[1]; String phoneNumber = arr[1];
TabHaobanStaff staff = staffService.selectByPhoneNumberAndEnterpriseId(phoneNumber.trim(), wxEnterpriseId); TabHaobanStaff staff = staffService.selectByPhoneNumberAndEnterpriseId(phoneNumber.trim(), wxEnterpriseId);
if (staff != null) { if (staff != null) {
//兼容导购调整手机号逻辑-该方法强行保证一个导购只存在一条有效导购数据 //同手机号或者同wxUerId的导购只存在一个
staffService.delOtherStaff(staff.getStaffId(),staff.getWxEnterpriseId(),staff.getWxUserId()); staffService.delOtherStaffById(staff.getStaffId(), staff.getWxUserId(), staff.getPhoneNumber(), wxEnterpriseId);
} }
staff = (staff == null ? new TabHaobanStaff() : staff); staff = (staff == null ? new TabHaobanStaff() : staff);
staff.setWxUserId(userId); staff.setWxUserId(userId);
......
...@@ -469,4 +469,22 @@ ...@@ -469,4 +469,22 @@
and status_flag = 1 limit 1 and status_flag = 1 limit 1
</select> </select>
<update id="delStaffByWxUserId">
update tab_haoban_staff
set status_flag = 0,update_time = now()
where wx_enterprise_id = #{wxEnterpriseId}
and wx_user_id = #{wxUserId}
and status_flag = 1
and staff_id != #{staffId}
</update>
<update id="delStaffByPhoneNumber">
update tab_haoban_staff
set status_flag = 0,update_time = now()
where wx_enterprise_id = #{wxEnterpriseId}
and phone_number = #{phoneNumber}
and status_flag = 1
and staff_id != #{staffId}
</update>
</mapper> </mapper>
\ No newline at end of file
...@@ -102,7 +102,7 @@ public class ClerkController extends WebBaseController { ...@@ -102,7 +102,7 @@ public class ClerkController extends WebBaseController {
return resultResponse(HaoBanErrCode.ERR_2); return resultResponse(HaoBanErrCode.ERR_2);
} }
List<StaffClerkRelationDTO> list = staffClerkRelationApiService.listByStoreId(storeId); List<StaffClerkRelationDTO> list = staffClerkRelationApiService.listByStoreId(storeId);
List<String> staffIds = list.stream().map(s -> s.getStaffId()).collect(Collectors.toList()); List<String> staffIds = list.stream().map(StaffClerkRelationDTO::getStaffId).collect(Collectors.toList());
List<StaffDTO> resultlist = staffApiService.listByIds(staffIds); List<StaffDTO> resultlist = staffApiService.listByIds(staffIds);
Map<String, StaffDTO> map = com.gic.commons.util.CollectionUtil.toMap(resultlist, "staffId"); Map<String, StaffDTO> map = com.gic.commons.util.CollectionUtil.toMap(resultlist, "staffId");
......
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