Commit a97a8429 by fudahua

同步处理 日志

parent e18875b6
...@@ -68,4 +68,13 @@ public interface StaffApiService { ...@@ -68,4 +68,13 @@ public interface StaffApiService {
* @return * @return
*/ */
public ServiceResponse saveSyncStaffByGic(GicClerkDTO clerkDTO); public ServiceResponse saveSyncStaffByGic(GicClerkDTO clerkDTO);
/**
* 获取成员头像
*
* @param clerkCode
* @param storeId
* @return
*/
public ServiceResponse<String> getStaffQrcode(String clerkCode, String storeId);
} }
...@@ -29,5 +29,6 @@ public interface StaffDepartmentRelatedService { ...@@ -29,5 +29,6 @@ public interface StaffDepartmentRelatedService {
List<TabHaobanStaffDepartmentRelated> listByWxUserId(String wxUserId); List<TabHaobanStaffDepartmentRelated> listByWxUserId(String wxUserId);
StaffDepartmentRelatedDTO getById(String staffDepartmentStaffRelatedId); StaffDepartmentRelatedDTO getById(String staffDepartmentStaffRelatedId);
} }
...@@ -1068,6 +1068,34 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -1068,6 +1068,34 @@ public class StaffApiServiceImpl implements StaffApiService {
} }
@Override
public ServiceResponse<String> getStaffQrcode(String clerkCode, String storeId) {
ServiceResponse<String> resp = new ServiceResponse<>();
TabHaobanDepartment department = departmentService.selectByRelatedId(storeId);
if (null == department) {
resp.setMessage("部门没关联");
resp.setCode(0);
return resp;
}
List<TabHaobanStaffDepartmentRelated> retList = staffDepartmentRelatedService.listByDepartmentId(department.getDepartmentId());
if (CollectionUtils.isEmpty(retList)) {
resp.setMessage("成员没关联");
resp.setCode(0);
return resp;
}
for (TabHaobanStaffDepartmentRelated tab : retList) {
if (tab.getClerkCode().equals(clerkCode)) {
WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseService.selectById(department.getWxEnterpriseId());
UserDTO user = qywxUserApiService.getSelfWorkWxUser(wxEnterpriseDTO.getCorpid(), wxEnterpriseDTO.getContactSecret(), tab.getWxUserId());
if (user != null) {
resp.setResult(user.getQr_code());
return resp;
}
}
}
return resp;
}
// private String getMobile(String phoneNumber,String nationcode){ // private String getMobile(String phoneNumber,String nationcode){
// String mobile = nationcode + phoneNumber; // String mobile = nationcode + phoneNumber;
// return mobile; // return mobile;
......
...@@ -2,6 +2,8 @@ import com.alibaba.fastjson.JSON; ...@@ -2,6 +2,8 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.JSONResponse; import com.gic.api.base.commons.JSONResponse;
import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService; import com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService;
import com.gic.redis.data.util.RedisUtil; import com.gic.redis.data.util.RedisUtil;
import com.gic.wechat.api.dto.qywx.DepartmentDTO; import com.gic.wechat.api.dto.qywx.DepartmentDTO;
...@@ -36,6 +38,9 @@ public class ServiceTest { ...@@ -36,6 +38,9 @@ public class ServiceTest {
@Autowired @Autowired
private QywxSuiteApiService qywxSuiteApiService; private QywxSuiteApiService qywxSuiteApiService;
@Autowired
private StaffApiService staffApiService;
@Test @Test
public void test() { public void test() {
System.err.println(RedisUtil.getCache("init-enterprise-ca66a01b79474c40b3e7c7f93daf1a3b")); System.err.println(RedisUtil.getCache("init-enterprise-ca66a01b79474c40b3e7c7f93daf1a3b"));
...@@ -104,20 +109,20 @@ public class ServiceTest { ...@@ -104,20 +109,20 @@ public class ServiceTest {
// System.out.println(JSONObject.toJSONString(phonenumber)); // System.out.println(JSONObject.toJSONString(phonenumber));
// } // }
// //
// @Test @Test
// public void createSelfUser() { public void createSelfUser() {
// UserDTO userDTO = new UserDTO(); UserDTO userDTO = new UserDTO();
// userDTO.setUserid("niweizhong2"); userDTO.setUserid("niweizhong2");
// userDTO.setName("空闻大师2"); userDTO.setName("空闻大师2");
// userDTO.setDepartment(new Integer[]{5072}); userDTO.setDepartment(new Integer[]{5072});
// userDTO.setMobile("17605628851"); userDTO.setMobile("17605628851");
// userDTO.setCorpid("ww9ede832a84b7ae5f"); userDTO.setCorpid("ww9ede832a84b7ae5f");
// JSONResponse workWxUser = qywxUserApiService.createSelfWorkWxUser(userDTO, "ww9ede832a84b7ae5f", JSONResponse workWxUser = qywxUserApiService.createSelfWorkWxUser(userDTO, "ww9ede832a84b7ae5f",
// "3aOw7jbcHlHkDmOi5TuG42Ta8NqskOhZxy5urrmaGl8"); "3aOw7jbcHlHkDmOi5TuG42Ta8NqskOhZxy5urrmaGl8");
// System.out.println(JSONObject.toJSONString(workWxUser)); System.out.println(JSONObject.toJSONString(workWxUser));
// } }
//
//
@Test @Test
public void sendMessage() { public void sendMessage() {
QywxXcxSendMessageDTO messageDTO = new QywxXcxSendMessageDTO(); QywxXcxSendMessageDTO messageDTO = new QywxXcxSendMessageDTO();
...@@ -129,10 +134,33 @@ public void sendMessage() { ...@@ -129,10 +134,33 @@ public void sendMessage() {
messageDTO.setDescription("我的测试test11111"); messageDTO.setDescription("我的测试test11111");
HashMap<String, String> map = new HashMap<>(); HashMap<String, String> map = new HashMap<>();
map.put("名称", "hua"); map.put("名称", "hua");
messageDTO.setItems(map); // messageDTO.setItems(map);
boolean ret = qywxSuiteApiService.sendMessage("ww9ede832a84b7ae5f", boolean ret = qywxSuiteApiService.sendMessage("ww9ede832a84b7ae5f",
"ww2c34dc56739bb105", messageDTO); "ww2c34dc56739bb105", messageDTO);
System.out.println(JSONObject.toJSONString(ret)); System.out.println(JSONObject.toJSONString(ret));
} }
@Test
public void listExternalUserid() {
UserDTO userDTO = new UserDTO();
userDTO.setUserid("niweizhong2");
userDTO.setName("空闻大师2");
userDTO.setDepartment(new Integer[]{5072});
userDTO.setMobile("17605628851");
userDTO.setCorpid("ww9ede832a84b7ae5f");
String s = qywxUserApiService.listExternalUserid("ww9ede832a84b7ae5f",
"ww2c34dc56739bb105", "qiuwenmin");
System.out.println(s);
}
@Test
public void getQrcode() {
UserDTO workWxUser = qywxUserApiService.getSelfWorkWxUser("ww9ede832a84b7ae5f", "3aOw7jbcHlHkDmOi5TuG42Ta8NqskOhZxy5urrmaGl8", "lining");
ServiceResponse<String> qrcode = staffApiService.getStaffQrcode("167442", "ff8080817181d322017182737b16021f");
System.out.println(JSONObject.toJSONString(qrcode));
}
} }
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