Commit c4db91f6 by yaosai

修复群发返回错误信息

parent fbedf0c7
...@@ -97,5 +97,13 @@ public interface StaffService { ...@@ -97,5 +97,13 @@ public interface StaffService {
*/ */
int updateOpenUserIdsByUserId(String wxEnterpriseId, String wxUserId, String wxOpenUseId); int updateOpenUserIdsByUserId(String wxEnterpriseId, String wxUserId, String wxOpenUseId);
/**
* 删除同手机号同wxUserId的其他用户
*
* @param staffId 导购id
* @param wxUserId wx用户id
* @param phoneNumber 手机号
* @param wxEnterpriseId 微信企业id
*/
void delOtherStaffById(String staffId, String wxUserId, String phoneNumber, String wxEnterpriseId);
} }
...@@ -120,4 +120,10 @@ public class StaffServiceImpl implements StaffService { ...@@ -120,4 +120,10 @@ public class StaffServiceImpl implements StaffService {
return mapper.updateOpenUserIdsByUserId(wxEnterpriseId, wxUserId, wxOpenUseId); return mapper.updateOpenUserIdsByUserId(wxEnterpriseId, wxUserId, wxOpenUseId);
} }
@Override
public void delOtherStaffById(String staffId, String wxUserId, String phoneNumber, String wxEnterpriseId) {
mapper.delStaffByWxUserId(wxEnterpriseId, wxUserId, staffId);
mapper.delStaffByPhoneNumber(wxEnterpriseId, phoneNumber, staffId);
}
} }
...@@ -390,6 +390,10 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -390,6 +390,10 @@ public class StaffApiServiceImpl implements StaffApiService {
String nationCode = arr[0]; String nationCode = arr[0];
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) {
//同手机号或者同wxUerId的导购只存在一个
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);
staff.setUpdateTime(new Date()); staff.setUpdateTime(new Date());
...@@ -1519,7 +1523,7 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -1519,7 +1523,7 @@ public class StaffApiServiceImpl implements StaffApiService {
return staffQrCodeDTO; return staffQrCodeDTO;
} }
String qr_code = user.getQr_code(); String qr_code = user.getQr_code();
staffMapper.updateQrCodeByStaffId(staffId,qr_code); staffMapper.updateQrCodeByStaffId(staffId, qr_code);
staffQrCodeDTO.setQrCode(qr_code); staffQrCodeDTO.setQrCode(qr_code);
return staffQrCodeDTO; return staffQrCodeDTO;
} }
......
...@@ -459,4 +459,22 @@ ...@@ -459,4 +459,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,13 +102,9 @@ public class ClerkController extends WebBaseController { ...@@ -102,13 +102,9 @@ 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");
int size = 0;
if (resultlist != null) {
size = resultlist.size();
}
List<StaffDTO> resultList = new ArrayList<>(); List<StaffDTO> resultList = new ArrayList<>();
for (StaffClerkRelationDTO staffClerkRelationDTO : list) { for (StaffClerkRelationDTO staffClerkRelationDTO : list) {
...@@ -122,7 +118,7 @@ public class ClerkController extends WebBaseController { ...@@ -122,7 +118,7 @@ public class ClerkController extends WebBaseController {
resultList.add(dto); resultList.add(dto);
} }
} }
return resultResponse(HaoBanErrCode.ERR_1, resultlist); return resultResponse(HaoBanErrCode.ERR_1, resultList);
} }
......
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