Commit 8858900a by 徐高华

企微托管账号

parent 3ddb24c3
......@@ -24,6 +24,9 @@ public interface OpenStaffApiService {
*/
public ServiceResponse<OpenStaffDTO> getById(Long openStaffId) ;
public ServiceResponse<OpenStaffDTO> getByQwUserId(Long qwUserId) ;
/**
* 删除
* @param id
......
......@@ -2,9 +2,6 @@ package com.gic.haoban.manage.web.controller;
import com.alibaba.fastjson.JSONObject;
import com.gic.authcenter.commons.util.IgnoreLogin;
import com.gic.commons.util.GlobalVar;
import com.gic.commons.util.HttpClient;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.enums.QwOpenStepEnum;
import com.gic.haoban.manage.api.service.OpenStaffApiService;
import org.apache.commons.io.IOUtils;
......@@ -16,10 +13,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller
......@@ -29,6 +23,8 @@ public class QywxCallbackController extends WebBaseController {
@Autowired
private OpenStaffApiService openStaffApiService ;
@Autowired
private com.gic.haoban.task.manage.api.service.OpenQwApiService openQwApiService ;
@RequestMapping("qywx-msg-notice")
@IgnoreLogin
......@@ -53,6 +49,9 @@ public class QywxCallbackController extends WebBaseController {
private void post(int type , String uuid , JSONObject json) {
switch (type) {
case 102000:
this.chat(uuid,json) ;
break;
case 100001 :
this.v100001(uuid,json) ;
break;
......@@ -81,6 +80,12 @@ public class QywxCallbackController extends WebBaseController {
break;
}
}
private void chat(String uuid, JSONObject json) {
logger.info("消息");
this.openQwApiService.saveChatLog(json.getLong("sender"),json.getLong("receiver"),json.getString("content"),1) ;
}
private void v100012(String uuid , JSONObject json) {
logger.info("需要二次扫码");
this.openStaffApiService.update2QrcodeFlag(uuid) ;
......
......@@ -14,7 +14,7 @@
<dubbo:application name="haoban-manage3-operation-web"/>
<dubbo:protocol name="dubbo" port="300112"/>
<dubbo:reference interface="com.gic.haoban.task.manage.api.service.OpenQwApiService" id="openQwApiService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.OpenStaffApiService" id="openStaffApiService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.StaffApiService" id="staffApiService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.TestApiService" id="testApiService"/>
......
......@@ -37,4 +37,6 @@ public interface OpenStaffMapper {
void updateLoginStep(@Param("id")Long openStaffId, @Param("step")int step);
List<OpenStaffDTO> list(OpenStaffPageQDTO qdto);
TabOpenStaff getByQwUserId(@Param("qwUserId")Long qwUserId);
}
\ No newline at end of file
......@@ -110,6 +110,12 @@ public class OpenStaffApiServiceImpl implements OpenStaffApiService {
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);
log.info("只能托管一个企业={},{}",uuid,corpName);
return ServiceResponse.failure("9999","只能托管一个企业") ;
}
openStaff.setWxCorpId(qwCorpId);
openStaff.setQwUserId(qwUserId);
if(null == openStaff.getFirstAuthTime()) {
......@@ -147,6 +153,16 @@ public class OpenStaffApiServiceImpl implements OpenStaffApiService {
}
@Override
public ServiceResponse<OpenStaffDTO> getByQwUserId(Long qwUserId) {
TabOpenStaff openStaff = this.openStaffMapper.getByQwUserId(qwUserId) ;
if(null == openStaff) {
return ServiceResponse.failure("9999","已删除") ;
}
OpenStaffDTO dto = EntityUtil.changeEntityByJSON(OpenStaffDTO.class,openStaff) ;
return ServiceResponse.success(dto);
}
@Override
public ServiceResponse<Long> init(OpenStaffInitQDTO qdto) {
String staffId = qdto.getStaffId();
if(StringUtils.isBlank(staffId)) {
......
......@@ -123,4 +123,10 @@
select * from tab_haoban_open_staff
</select>
<select id="getByQwUserId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_open_staff where qw_user_id = #{qwUserId} and delete_flag = 0
</select>
</mapper>
\ No newline at end of file
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