Commit 5284bab4 by 徐高华

企微托管账号

parent 64f9d592
......@@ -104,10 +104,23 @@ public class OpenStaffDTO implements Serializable {
private Integer validQrcodeFlag ;
/**
* 登录错误信息
*/
private String loginRemark ;
/**
* tab_haoban_open_staff
*/
private static final long serialVersionUID = 1L;
public String getLoginRemark() {
return loginRemark;
}
public void setLoginRemark(String loginRemark) {
this.loginRemark = loginRemark;
}
public String getEnterpriseId() {
return enterpriseId;
}
......
......@@ -84,16 +84,16 @@ public class QywxCallbackController extends WebBaseController {
private void chat(String uuid, JSONObject json) {
logger.info("消息");
int msgtype = json.getIntValue("msgtype") ;
// 1导购发 2好友发
int sendType = 1 ;
if(msgtype==2) {
msgtype = 2 ;
}else {
msgtype = 1 ;
sendType = 2 ;
}
int isRoom = 0 ;
if(json.getIntValue("is_room") == 1) {
}else {
this.openQwApiService.saveChatLog(uuid,json.getLong("sender"),json.getLong("receiver"),json.getString("content"),msgtype) ;
this.openQwApiService.saveChatLog(uuid,json.getLong("sender"),json.getLong("receiver"),json.getString("content"),sendType) ;
}
}
......
......@@ -101,6 +101,16 @@ public class TabOpenStaff implements Serializable {
private Integer validQrcodeFlag ;
private String loginRemark ;
public String getLoginRemark() {
return loginRemark;
}
public void setLoginRemark(String loginRemark) {
this.loginRemark = loginRemark;
}
/**
* tab_haoban_open_staff
*/
......
......@@ -15,7 +15,7 @@ public interface OpenStaffService {
public TabOpenStaff getByUUID(String uuid) ;
public void logout(String uuid) ;
public void logout(String uuid, String loginRemark) ;
ServiceResponse<Page<OpenStaffDTO>> page(OpenStaffPageQDTO qdto, BasePageInfo basePageInfo);
......
......@@ -56,7 +56,7 @@ public class OpenStaffServiceImpl implements OpenStaffService {
}
@Override
public void logout(String uuid) {
public void logout(String uuid , String loginRemark) {
TabOpenStaff openStaff = this.getByUUID(uuid) ;
if(null == openStaff) {
return ;
......@@ -71,6 +71,7 @@ public class OpenStaffServiceImpl implements OpenStaffService {
openStaff.setKey1(null);
openStaff.setKey2(null);
openStaff.setUuid(null);
openStaff.setLoginRemark(loginRemark);
this.openStaffMapper.update(openStaff) ;
}
......
......@@ -92,7 +92,7 @@ public class OpenStaffApiServiceImpl implements OpenStaffApiService {
}
this.openStaffMapper.updateLoginStep(openStaff.getOpenStaffId(),step) ;
if(QwOpenStepEnum.isFail(step)) {
this.openStaffService.logout(uuid);
this.openStaffService.logout(uuid,"企微返回退出/登录超时");
}
return ServiceResponse.success();
}
......@@ -106,13 +106,13 @@ public class OpenStaffApiServiceImpl implements OpenStaffApiService {
String wxEnterpriseId = openStaff.getWxEnterpriseId() ;
List<String> backWxEnterpriseIdList = this.wxEnterpriseService.getWxEnterpriseIdByName(corpName) ;
if(CollectionUtils.isEmpty(backWxEnterpriseIdList) || backWxEnterpriseIdList.size()>1 || !backWxEnterpriseIdList.get(0).equals(wxEnterpriseId)) {
this.openStaffService.logout(uuid);
this.openStaffService.logout(uuid,"授权登录账号与当前账号不一致");
log.info("登录的企业不对={},{}",uuid,corpName);
return ServiceResponse.failure("9999","登录错误") ;
}
TabOpenStaff staff = this.openStaffMapper.getByQwUserId(qwUserId) ;
if(null != staff && staff.getWxEnterpriseId().equals(wxEnterpriseId)) {
this.openStaffService.logout(uuid);
this.openStaffService.logout(uuid,"只能托管一个企微企业");
log.info("只能托管一个企业={},{}",uuid,corpName);
return ServiceResponse.failure("9999","只能托管一个企业") ;
}
......@@ -129,7 +129,7 @@ public class OpenStaffApiServiceImpl implements OpenStaffApiService {
@Override
public ServiceResponse<Void> logout(String uuid) {
this.openStaffService.logout(uuid);
this.openStaffService.logout(uuid,null);
return ServiceResponse.success();
}
......@@ -180,7 +180,7 @@ public class OpenStaffApiServiceImpl implements OpenStaffApiService {
}
qwUserId = openStaff.getQwUserId() ;
log.info("重新初始化,退出登录");
this.openStaffService.logout(openStaff.getUuid());
this.openStaffService.logout(openStaff.getUuid(),"重新初始化,退出登录");
}
if(null == openStaff) {
openStaff = new TabOpenStaff() ;
......
......@@ -204,9 +204,9 @@ public class StaffApiServiceImpl implements StaffApiService {
if(staffListDTO.getQwOpenFlag()==1) {
List<String> list = this.openStaffService.listAllStaffId(wxEnterpriseId) ;
staffIds = staffIds.stream().filter(o->!list.contains(o)).collect(Collectors.toList());
}
if (CollectionUtils.isEmpty(staffIds)){
return new Page<>();
if (CollectionUtils.isEmpty(staffIds)){
return new Page<>();
}
}
StaffListBO staffListBO = EntityUtil.changeEntityByJSON(StaffListBO.class, staffListDTO);
staffListBO.setStaffIds(staffIds);
......
......@@ -22,12 +22,13 @@
<result column="auth_time" javaType="java.util.Date" jdbcType="TIMESTAMP" property="authTime"/>
<result column="first_auth_time" javaType="java.util.Date" jdbcType="TIMESTAMP" property="firstAuthTime"/>
<result column="valid_qrcode_flag" property="validQrcodeFlag"/>
<result column="login_remark" property="loginRemark" />
</resultMap>
<sql id="Base_Column_List">
open_staff_id
, wx_enterprise_id,enterprise_id, staff_id, create_time, update_time, uuid, delete_flag,status_flag, step, qw_user_id, wx_corp_id, qr_code_1, key_1,
qr_code_2, key_2, valid_flag, auth_time,first_auth_time , valid_qrcode_flag
qr_code_2, key_2, valid_flag, auth_time,first_auth_time , valid_qrcode_flag , login_remark
</sql>
<insert id="insert" parameterType="com.gic.haoban.manage.service.dao.mapper.OpenStaffMapper">
......@@ -65,6 +66,9 @@
<if test="null != firstAuthTime">
first_auth_time=#{firstAuthTime} ,
</if>
<if test="null != loginRemark">
login_remark = #{loginRemark}
</if>
update_time=now()
where open_staff_id = #{openStaffId}
</update>
......
......@@ -12,14 +12,12 @@ import com.gic.haoban.manage.api.dto.OpenStaffDTO;
import com.gic.haoban.manage.api.dto.OpenStaffLicenseDTO;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.dto.chat.GroupChatHmDTO;
import com.gic.haoban.manage.api.qdto.OpenStaffInitQDTO;
import com.gic.haoban.manage.api.qdto.OpenStaffPageQDTO;
import com.gic.haoban.manage.api.service.OpenStaffApiService;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.StaffClerkRelationApiService;
import com.gic.haoban.manage.web.qo.open.OpenStaffQO;
import com.gic.haoban.manage.web.vo.chat.GroupChatHmVO;
import com.gic.haoban.manage.web.vo.open.OpenStaffVO;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
......
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