Commit 5ab9f1c7 by 墨竹

Merge remote-tracking branch 'origin/developer' into developer

parents 1a3dd770 96e8476d
......@@ -132,4 +132,14 @@ public interface StaffMapper {
*/
TabHaobanStaff selectByPhoneNumberAndEnterpriseId(@Param("phoneNumber") String phoneNumber,
@Param("wxEnterpriseId") String wxEnterpriseId);
/**
* 删除除了当前staffId以外其他的staff
*
* @param staffId staffId
* @param wxEnterpriseId wx企业标识
* @param wxUserId wx用户id
*/
void delOtherStaff(@Param("staffId")String staffId,
@Param("wxEnterpriseId")String wxEnterpriseId,
@Param("wxUserId")String wxUserId);
}
\ No newline at end of file
......@@ -98,4 +98,12 @@ public interface StaffService {
int updateOpenUserIdsByUserId(String wxEnterpriseId, String wxUserId, String wxOpenUseId);
/**
* 删除除了当前staffId以外其他的staff
*
* @param staffId staffId
* @param wxEnterpriseId wx企业标识
* @param wxUserId wx用户id
*/
void delOtherStaff(String staffId, String wxEnterpriseId, String wxUserId);
}
......@@ -120,4 +120,12 @@ public class StaffServiceImpl implements StaffService {
return mapper.updateOpenUserIdsByUserId(wxEnterpriseId, wxUserId, wxOpenUseId);
}
@Override
public void delOtherStaff(String staffId, String wxEnterpriseId, String wxUserId) {
if (StringUtils.isEmpty(staffId)){
return;
}
mapper.delOtherStaff(staffId, wxEnterpriseId, wxUserId);
}
}
......@@ -12,10 +12,7 @@ import com.gic.haoban.app.customer.service.api.service.InnerApiService;
import com.gic.haoban.base.api.common.Constant;
import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.manage.api.dto.*;
import com.gic.haoban.manage.api.enums.AppPageType;
import com.gic.haoban.manage.api.enums.GicDataType;
import com.gic.haoban.manage.api.enums.NoticeMessageTypeEnum;
import com.gic.haoban.manage.api.enums.WxEditType;
import com.gic.haoban.manage.api.enums.*;
import com.gic.haoban.manage.api.service.*;
import com.gic.haoban.manage.api.util.notify.NoticeMessageUtil;
import com.gic.haoban.manage.service.config.Config;
......@@ -90,6 +87,9 @@ public class MessageApiServiceImpl implements MessageApiService {
@Autowired
private ClerkService clerkService;
@Autowired
private SecretSettingService secretSettingService;
@Override
public void gicMessageReceive(GicMessageDTO gicMessageDTO) {
if (true) {
......@@ -143,8 +143,13 @@ public class MessageApiServiceImpl implements MessageApiService {
log.info("添加企业员工失败:{}", response.getMessage());
return;
}
SecretSettingDTO secretSetting = secretSettingService.getSecretSetting(enterprise.getWxEnterpriseId(), SecretTypeEnum.HAOBAN_HELP.getVal());
if (null == secretSetting || secretSetting.getCheckFlag() == 0) {
log.info("没有配置secret:{}", JSONObject.toJSONString(enterprise));
return;
}
// 取第一个企业的id
doDealUser(dto, relatedList.get(0).getEnterpriseId());
doDealUser(dto, relatedList.get(0).getEnterpriseId(), secretSetting.getSecretVal());
// 以下暂时不会用到
// if (dto != null) {
......@@ -184,11 +189,11 @@ public class MessageApiServiceImpl implements MessageApiService {
return userid.startsWith("5");
}
private void doDealUser(QywxCallBackDTO dto, String enterpriseId) {
private void doDealUser(QywxCallBackDTO dto, String enterpriseId, String secret) {
ClerkQwDTO clerkQwDTO = new ClerkQwDTO();
clerkQwDTO.setEnterpriseId(enterpriseId);
String mainDeptId = dto.getMainDepartment();
List<com.gic.wechat.api.dto.qywx.DepartmentDTO> departments = qywxDepartmentApiService.listDepartment(dto.getAuthCorpId(), dto.getSuiteId(), Integer.valueOf(mainDeptId));
List<com.gic.wechat.api.dto.qywx.DepartmentDTO> departments = qywxDepartmentApiService.listSelfDepartment(dto.getAuthCorpId(), secret, Integer.valueOf(mainDeptId));
if (CollectionUtils.isEmpty(departments)) {
log.info("通过主部门查询部门列表为空 mainDeptId:{}", mainDeptId);
return;
......
......@@ -390,6 +390,10 @@ public class StaffApiServiceImpl implements StaffApiService {
String nationCode = arr[0];
String phoneNumber = arr[1];
TabHaobanStaff staff = staffService.selectByPhoneNumberAndEnterpriseId(phoneNumber.trim(), wxEnterpriseId);
if (staff != null) {
//兼容导购调整手机号逻辑-该方法强行保证一个导购只存在一条有效导购数据
staffService.delOtherStaff(staff.getStaffId(),staff.getWxEnterpriseId(),staff.getWxUserId());
}
staff = (staff == null ? new TabHaobanStaff() : staff);
staff.setWxUserId(userId);
staff.setUpdateTime(new Date());
......@@ -1519,7 +1523,7 @@ public class StaffApiServiceImpl implements StaffApiService {
return staffQrCodeDTO;
}
String qr_code = user.getQr_code();
staffMapper.updateQrCodeByStaffId(staffId,qr_code);
staffMapper.updateQrCodeByStaffId(staffId, qr_code);
staffQrCodeDTO.setQrCode(qr_code);
return staffQrCodeDTO;
}
......
......@@ -26,7 +26,8 @@
</resultMap>
<sql id="Base_Column_List">
staff_id, wx_user_id, phone_number, staff_name, nation_code, nick_name, sex, postion,
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
</sql>
......@@ -42,6 +43,15 @@
where staff_id = #{staffId,jdbcType=VARCHAR}
</delete>
<update id="delOtherStaff">
update tab_haoban_staff
set status_flag = 0
where wx_enterprise_id = #{wxEnterpriseId}
and wx_user_id = #{wxUserId}
and status_flag = 1
and staff_id != #{staffId}
</update>
<insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanStaff">
insert into tab_haoban_staff
<trim prefix="(" suffix=")" suffixOverrides=",">
......@@ -438,15 +448,15 @@
<update id="updateOpenIdByStaffId" parameterType="com.gic.haoban.manage.service.entity.TabHaobanStaff">
update tab_haoban_staff
set wx_open_id = #{openId},
update_time = now()
set wx_open_id = #{openId},
update_time = now()
where staff_id = #{staffId}
</update>
<update id="updateQrCodeByStaffId" parameterType="com.gic.haoban.manage.service.entity.TabHaobanStaff">
update tab_haoban_staff
set qr_code = #{qrCode},
update_time = now()
set qr_code = #{qrCode},
update_time = now()
where staff_id = #{staffId}
</update>
......
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