Commit 3023e34c by 徐高华

企微托管账号

parent 5e695942
...@@ -43,12 +43,12 @@ public class OpenStaffDTO implements Serializable { ...@@ -43,12 +43,12 @@ public class OpenStaffDTO implements Serializable {
private Integer deleteFlag; private Integer deleteFlag;
/** /**
* 0待验证 1授权中 2已过期 * 1授权中 2未登录(已过期)
*/ */
private Integer statusFlag; private Integer statusFlag;
/** /**
* 登录步骤 * 登录步骤1已扫码 2取消登录 3超时 4验证码正确
*/ */
private Integer step; private Integer step;
...@@ -98,10 +98,23 @@ public class OpenStaffDTO implements Serializable { ...@@ -98,10 +98,23 @@ public class OpenStaffDTO implements Serializable {
private Date firstAuthTime; private Date firstAuthTime;
/** /**
* 需要二次扫码
*/
private Integer validQrcodeFlag ;
/**
* tab_haoban_open_staff * tab_haoban_open_staff
*/ */
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public Integer getValidQrcodeFlag() {
return validQrcodeFlag;
}
public void setValidQrcodeFlag(Integer validQrcodeFlag) {
this.validQrcodeFlag = validQrcodeFlag;
}
public Long getOpenStaffId() { public Long getOpenStaffId() {
return openStaffId; return openStaffId;
} }
......
...@@ -7,6 +7,15 @@ public class OpenStaffInitQDTO implements Serializable { ...@@ -7,6 +7,15 @@ public class OpenStaffInitQDTO implements Serializable {
private String wxEnterpriseId ; private String wxEnterpriseId ;
private String enterpriseId ; private String enterpriseId ;
private String staffId ; private String staffId ;
private int loginAgainFlag ;
public int getLoginAgainFlag() {
return loginAgainFlag;
}
public void setLoginAgainFlag(int loginAgainFlag) {
this.loginAgainFlag = loginAgainFlag;
}
public String getEnterpriseId() { public String getEnterpriseId() {
return enterpriseId; return enterpriseId;
......
...@@ -6,4 +6,8 @@ public interface OpenStaffService { ...@@ -6,4 +6,8 @@ public interface OpenStaffService {
public TabOpenStaff save(TabOpenStaff tab) ; public TabOpenStaff save(TabOpenStaff tab) ;
public TabOpenStaff getByUUID(String uuid) ;
public void logout(String uuid) ;
} }
package com.gic.haoban.manage.service.service.impl; package com.gic.haoban.manage.service.service.impl;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.UniqueIdUtils; import com.gic.commons.util.UniqueIdUtils;
import com.gic.haoban.manage.api.service.OpenStaffApiService;
import com.gic.haoban.manage.service.dao.mapper.OpenStaffMapper; import com.gic.haoban.manage.service.dao.mapper.OpenStaffMapper;
import com.gic.haoban.manage.service.entity.TabOpenStaff; import com.gic.haoban.manage.service.entity.TabOpenStaff;
import com.gic.haoban.manage.service.service.OpenStaffService; import com.gic.haoban.manage.service.service.OpenStaffService;
import com.gic.haoban.manage.service.util.OpenUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -12,6 +17,8 @@ import java.util.Date; ...@@ -12,6 +17,8 @@ import java.util.Date;
@Service("openStaffService") @Service("openStaffService")
public class OpenStaffServiceImpl implements OpenStaffService { public class OpenStaffServiceImpl implements OpenStaffService {
private static final Logger log = LogManager.getLogger(OpenStaffService.class);
@Autowired @Autowired
private OpenStaffMapper openStaffMapper ; private OpenStaffMapper openStaffMapper ;
...@@ -29,4 +36,28 @@ public class OpenStaffServiceImpl implements OpenStaffService { ...@@ -29,4 +36,28 @@ public class OpenStaffServiceImpl implements OpenStaffService {
} }
return tab ; return tab ;
} }
@Override
public TabOpenStaff getByUUID(String uuid) {
TabOpenStaff openStaff = this.openStaffMapper.getByUUID(uuid) ;
if(null == openStaff) {
log.info("通过uuid查不到={}",uuid);
OpenUtils.logout(uuid);
}
return openStaff;
}
@Override
public void logout(String uuid) {
TabOpenStaff openStaff = this.getByUUID(uuid) ;
if(null == openStaff) {
return ;
}
OpenUtils.logout(uuid);
openStaff.setStep(0);
openStaff.setStatusFlag(2);
openStaff.setValidFlag(0);
openStaff.setValidQrcodeFlag(0);
this.openStaffMapper.update(openStaff) ;
}
} }
...@@ -52,9 +52,8 @@ public class OpenStaffApiServiceImpl implements OpenStaffApiService { ...@@ -52,9 +52,8 @@ public class OpenStaffApiServiceImpl implements OpenStaffApiService {
@Override @Override
public ServiceResponse<Void> update2QrcodeFlag(String uuid) { public ServiceResponse<Void> update2QrcodeFlag(String uuid) {
TabOpenStaff openStaff = this.openStaffMapper.getByUUID(uuid) ; TabOpenStaff openStaff = this.openStaffService.getByUUID(uuid) ;
if(null == openStaff) { if(null == openStaff) {
log.info("通过uuid查不到={}",uuid);
return ServiceResponse.failure("9999","登录错误") ; return ServiceResponse.failure("9999","登录错误") ;
} }
this.openStaffMapper.update2QrcodeFlag(openStaff.getOpenStaffId()); this.openStaffMapper.update2QrcodeFlag(openStaff.getOpenStaffId());
...@@ -82,10 +81,8 @@ public class OpenStaffApiServiceImpl implements OpenStaffApiService { ...@@ -82,10 +81,8 @@ public class OpenStaffApiServiceImpl implements OpenStaffApiService {
@Override @Override
public ServiceResponse<Void> updateLoginStep(String uuid, int step) { public ServiceResponse<Void> updateLoginStep(String uuid, int step) {
TabOpenStaff openStaff = this.openStaffMapper.getByUUID(uuid) ; TabOpenStaff openStaff = this.openStaffService.getByUUID(uuid) ;
if(null == openStaff) { if(null == openStaff) {
log.info("通过uuid查不到={}",uuid);
OpenUtils.logout(uuid);
return ServiceResponse.failure("9999","登录错误") ; return ServiceResponse.failure("9999","登录错误") ;
} }
this.openStaffMapper.updateLoginStep(openStaff.getOpenStaffId(),step) ; this.openStaffMapper.updateLoginStep(openStaff.getOpenStaffId(),step) ;
...@@ -94,16 +91,14 @@ public class OpenStaffApiServiceImpl implements OpenStaffApiService { ...@@ -94,16 +91,14 @@ public class OpenStaffApiServiceImpl implements OpenStaffApiService {
@Override @Override
public ServiceResponse<Void> login(String uuid, Long qwCorpId, String corpName, Long qwUserId) { public ServiceResponse<Void> login(String uuid, Long qwCorpId, String corpName, Long qwUserId) {
TabOpenStaff openStaff = this.openStaffMapper.getByUUID(uuid) ; TabOpenStaff openStaff = this.openStaffService.getByUUID(uuid) ;
if(null == openStaff) { if(null == openStaff) {
log.info("通过uuid查不到={}",uuid);
OpenUtils.logout(uuid);
return ServiceResponse.failure("9999","登录错误") ; return ServiceResponse.failure("9999","登录错误") ;
} }
String wxEnterpriseId = openStaff.getWxEnterpriseId() ; String wxEnterpriseId = openStaff.getWxEnterpriseId() ;
List<String> backWxEnterpriseIdList = this.wxEnterpriseService.getWxEnterpriseIdByName(corpName) ; List<String> backWxEnterpriseIdList = this.wxEnterpriseService.getWxEnterpriseIdByName(corpName) ;
if(CollectionUtils.isEmpty(backWxEnterpriseIdList) || backWxEnterpriseIdList.size()>1 || !backWxEnterpriseIdList.get(0).equals(wxEnterpriseId)) { if(CollectionUtils.isEmpty(backWxEnterpriseIdList) || backWxEnterpriseIdList.size()>1 || !backWxEnterpriseIdList.get(0).equals(wxEnterpriseId)) {
OpenUtils.logout(uuid); this.openStaffService.logout(uuid);
log.info("登录的企业不对={},{}",uuid,corpName); log.info("登录的企业不对={},{}",uuid,corpName);
return ServiceResponse.failure("9999","登录错误") ; return ServiceResponse.failure("9999","登录错误") ;
} }
...@@ -120,15 +115,7 @@ public class OpenStaffApiServiceImpl implements OpenStaffApiService { ...@@ -120,15 +115,7 @@ public class OpenStaffApiServiceImpl implements OpenStaffApiService {
@Override @Override
public ServiceResponse<Void> logout(String uuid) { public ServiceResponse<Void> logout(String uuid) {
TabOpenStaff openStaff = this.openStaffMapper.getByUUID(uuid) ; this.openStaffService.logout(uuid);
if(null == openStaff) {
log.info("通过uuid查不到={}",uuid);
OpenUtils.logout(uuid);
return ServiceResponse.failure("9999","登录错误") ;
}
openStaff.setStep(0);
openStaff.setStatusFlag(2);
this.openStaffMapper.update(openStaff) ;
return ServiceResponse.success(); return ServiceResponse.success();
} }
...@@ -164,9 +151,12 @@ public class OpenStaffApiServiceImpl implements OpenStaffApiService { ...@@ -164,9 +151,12 @@ public class OpenStaffApiServiceImpl implements OpenStaffApiService {
TabOpenStaff openStaff = this.openStaffMapper.getByStaffId(staffId) ; TabOpenStaff openStaff = this.openStaffMapper.getByStaffId(staffId) ;
Long qwUserId = null ; Long qwUserId = null ;
if(null != openStaff) { if(null != openStaff) {
if(openStaff.getStatusFlag()==1 && qdto.getLoginAgainFlag()==0) {
return ServiceResponse.failure("9999","成员已托管中") ;
}
qwUserId = openStaff.getQwUserId() ; qwUserId = openStaff.getQwUserId() ;
log.info("重新初始化,退出登录"); log.info("重新初始化,退出登录");
OpenUtils.logout(openStaff.getUuid()); this.openStaffService.logout(openStaff.getUuid());
} }
if(null == openStaff) { if(null == openStaff) {
openStaff = new TabOpenStaff() ; openStaff = new TabOpenStaff() ;
...@@ -181,6 +171,8 @@ public class OpenStaffApiServiceImpl implements OpenStaffApiService { ...@@ -181,6 +171,8 @@ public class OpenStaffApiServiceImpl implements OpenStaffApiService {
openStaff.setQrCode1(init.getQrcode()); openStaff.setQrCode1(init.getQrcode());
openStaff.setKey1(init.getKey()); openStaff.setKey1(init.getKey());
openStaff.setStep(0); openStaff.setStep(0);
openStaff.setValidFlag(0);
openStaff.setValidQrcodeFlag(0);
openStaff = this.openStaffService.save(openStaff); openStaff = this.openStaffService.save(openStaff);
return ServiceResponse.success(openStaff.getOpenStaffId()) ; return ServiceResponse.success(openStaff.getOpenStaffId()) ;
}catch (Exception e) { }catch (Exception e) {
......
package com.gic.haoban.manage.web.qo.open;
public class OpenStaffQO {
}
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
<dubbo:application name="haoban-manage3-web"/> <dubbo:application name="haoban-manage3-web"/>
<dubbo:protocol name="dubbo" port="30009"/> <dubbo:protocol name="dubbo" port="30009"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.OpenStaffApiService" id="openStaffApiService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.WxEnterpriseActiveDataApiService" id="wxEnterpriseActiveDataApiService" timeout="10000"/> <dubbo:reference interface="com.gic.haoban.manage.api.service.WxEnterpriseActiveDataApiService" id="wxEnterpriseActiveDataApiService" timeout="10000"/>
<dubbo:reference interface="com.gic.enterprise.api.service.DownloadReportService" id="downloadReportService" timeout="10000"/> <dubbo:reference interface="com.gic.enterprise.api.service.DownloadReportService" id="downloadReportService" timeout="10000"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.chat.GroupChatDataApiService" id="groupChatDataApiService" timeout="10000"/> <dubbo:reference interface="com.gic.haoban.manage.api.service.chat.GroupChatDataApiService" id="groupChatDataApiService" timeout="10000"/>
......
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