Commit ddc46624 by 墨竹

feat:新增修好友openuserid

parent c0737f61
...@@ -28,6 +28,7 @@ import org.springframework.web.bind.annotation.RequestParam; ...@@ -28,6 +28,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.TreeMap; import java.util.TreeMap;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
...@@ -75,6 +76,8 @@ public class TestController extends WebBaseController { ...@@ -75,6 +76,8 @@ public class TestController extends WebBaseController {
private QywxUserApiService qywxUserApiService; private QywxUserApiService qywxUserApiService;
@Autowired @Autowired
private StaffApiService staffApiService; private StaffApiService staffApiService;
@Autowired
private WxApplicationApiService wxApplicationApiService;
@RequestMapping("/send-message-test") @RequestMapping("/send-message-test")
public HaobanResponse testSendMessage(QywxXcxSendMessageQo qo) { public HaobanResponse testSendMessage(QywxXcxSendMessageQo qo) {
...@@ -276,4 +279,39 @@ public class TestController extends WebBaseController { ...@@ -276,4 +279,39 @@ public class TestController extends WebBaseController {
} }
return resultResponse(HaoBanErrCode.ERR_1); return resultResponse(HaoBanErrCode.ERR_1);
} }
/**
* 后台单个处理wx_user_id to wx_open_user_id
*
* @param corpid
* @param staffId
* @return
*/
@RequestMapping("/useridToOpenuseridByStaffId")
public HaobanResponse useridToOpenuseridByStaffId(String corpid, String staffId) {
StaffDTO staffDTO = staffApiService.selectById(staffId);
if (staffDTO == null) {
return resultResponse(HaoBanErrCode.ERR_8);
}
String wxUserId = staffDTO.getWxUserId();
String openUserid = getOpenUserid(wxUserId, corpid);
staffApiService.updateOpenUserIdsByUserId(staffDTO.getWxEnterpriseId(), wxUserId, openUserid);
return resultResponse(HaoBanErrCode.ERR_1);
}
/**
* 获取openuserid
*
* @param userId
* @param corpid
* @return
*/
private String getOpenUserid(String userId, String corpid) {
WxApplicationDTO wxApplicationDTO = wxApplicationApiService.selectByCorpid(corpid);
List<QywxNewUseridDTO> qywxNewUseridDTOS = qywxUserApiService.useridToOpenuserid(corpid, wxApplicationDTO.getSiteId(), Collections.singletonList(userId));
if (CollectionUtils.isEmpty(qywxNewUseridDTOS)) {
return "";
}
return qywxNewUseridDTOS.get(0).getOpen_userid();
}
} }
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