Commit df59ae34 by fudahua

导购新增接口

parent 7ac036d6
package com.gic.haoban.manage.api.dto;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
public class GicClerkDTO implements Serializable {
private String storeId;
private String clerkCode;
private String clerkName;
private String phoneNumber;
private String nationcode;
private Integer clerkGender;
private String headImgUrl;
private String postionName;
private String enterpriseId;
private Integer status;
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
private static final long serialVersionUID = 1L;
public String getStoreId() {
return storeId;
}
public void setStoreId(String storeId) {
this.storeId = storeId;
}
public String getClerkCode() {
return clerkCode;
}
public void setClerkCode(String clerkCode) {
this.clerkCode = clerkCode;
}
public String getClerkName() {
return clerkName;
}
public void setClerkName(String clerkName) {
this.clerkName = clerkName;
}
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public String getNationcode() {
return nationcode;
}
public void setNationcode(String nationcode) {
this.nationcode = nationcode;
}
public Integer getClerkGender() {
return clerkGender;
}
public void setClerkGender(Integer clerkGender) {
this.clerkGender = clerkGender;
}
public String getHeadImgUrl() {
return headImgUrl;
}
public void setHeadImgUrl(String headImgUrl) {
this.headImgUrl = headImgUrl;
}
public String getPostionName() {
return postionName;
}
public void setPostionName(String postionName) {
this.postionName = postionName;
}
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
}
...@@ -5,6 +5,7 @@ import java.util.List; ...@@ -5,6 +5,7 @@ import java.util.List;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.haoban.base.api.common.BasePageInfo; import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.common.utils.HaobanResponse; import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.GicClerkDTO;
import com.gic.haoban.manage.api.dto.StaffDTO; import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO; import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
import com.gic.haoban.manage.api.dto.UserLoginLogDTO; import com.gic.haoban.manage.api.dto.UserLoginLogDTO;
...@@ -42,6 +43,8 @@ public interface StaffApiService { ...@@ -42,6 +43,8 @@ public interface StaffApiService {
public void syncGicClerk(String fieldListString); public void syncGicClerk(String fieldListString);
public void addGicClerk(GicClerkDTO clerkDTO);
StaffDepartmentRelatedDTO getDepartmentIdAndCode(String departmentId, String code); StaffDepartmentRelatedDTO getDepartmentIdAndCode(String departmentId, String code);
void initWxUser(String corpid, String suiteid, String wxEnterpriseId, Integer wxDepartmentId); void initWxUser(String corpid, String suiteid, String wxEnterpriseId, Integer wxDepartmentId);
......
...@@ -10,6 +10,8 @@ import java.util.Map; ...@@ -10,6 +10,8 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import com.gic.haoban.manage.api.dto.*;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -35,12 +37,6 @@ import com.gic.haoban.common.utils.HaobanResponse; ...@@ -35,12 +37,6 @@ import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.common.utils.PageUtil; import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.common.utils.StringUtil; import com.gic.haoban.common.utils.StringUtil;
import com.gic.haoban.common.utils.UuidUtil; import com.gic.haoban.common.utils.UuidUtil;
import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
import com.gic.haoban.manage.api.dto.SyncJsonColumnDTO;
import com.gic.haoban.manage.api.dto.UserLoginLogDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.service.StaffApiService; import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.service.dao.mapper.StaffDepartmentRelatedMapper; import com.gic.haoban.manage.service.dao.mapper.StaffDepartmentRelatedMapper;
import com.gic.haoban.manage.service.dao.mapper.StaffMapper; import com.gic.haoban.manage.service.dao.mapper.StaffMapper;
...@@ -506,120 +502,117 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -506,120 +502,117 @@ public class StaffApiServiceImpl implements StaffApiService {
} }
@Override @Override
public void addGicClerk(GicClerkDTO clerkDTO) {
logger.info("同步gic店员:{}", JSONObject.toJSONString(clerkDTO));
addClerkByGic(clerkDTO);
}
@Override
public void syncGicClerk(String fieldListString) { public void syncGicClerk(String fieldListString) {
logger.info("【同步店员】fieldList={}",fieldListString); logger.info("【同步店员】fieldList={}", fieldListString);
List<SyncJsonColumnDTO> fieldList = JSONArray.parseArray(fieldListString,SyncJsonColumnDTO.class); List<SyncJsonColumnDTO> fieldList = JSONArray.parseArray(fieldListString, SyncJsonColumnDTO.class);
if(fieldList.isEmpty()){ if (fieldList.isEmpty()) {
return; return;
} }
String gicStoreId = "";
String code = "";
String staffName = ""; GicClerkDTO clerkMid = new GicClerkDTO();
String phoneNumber = "";
String nationcode = ""; for (SyncJsonColumnDTO syncJsonColumnDTO : fieldList) {
Integer sex = null; String name = StringUtil.camelName(syncJsonColumnDTO.getName());
String headPic = ""; String value = syncJsonColumnDTO.getValue();
Integer status = null;
String postion = ""; if ("enterpriseId".equals(name)) {
String gicClerkId = ""; if (StringUtils.isBlank(value)) {
String enterpriseId = ""; return;
}
for (SyncJsonColumnDTO syncJsonColumnDTO:fieldList){ clerkMid.setEnterpriseId(value);
String name = StringUtil.camelName(syncJsonColumnDTO.getName()); continue;
String value = syncJsonColumnDTO.getValue(); }
if("clerkId".equals(name)){ if ("storeId".equals(name)) {
gicClerkId = value; if (StringUtils.isBlank(value)) {
if(StringUtils.isBlank(gicClerkId)){ return;
return; }
} clerkMid.setStoreId(value);
continue; continue;
} }
if("enterpriseId".equals(name)){ if ("clerkName".equals(name)) {
enterpriseId = value; clerkMid.setClerkName(value);
if(StringUtils.isBlank(enterpriseId)){ continue;
return; }
}
continue;
} if ("clerkCode".equals(name)) {
clerkMid.setClerkCode(value);
if("storeId".equals(name)){ continue;
gicStoreId = value; }
if(StringUtils.isBlank(gicStoreId)){
return; if ("clerkGender".equals(name)) {
} clerkMid.setClerkGender((value == null ? null : Integer.parseInt(value)));
continue; continue;
} }
if("clerkName".equals(name)){ if ("status".equals(name)) {
staffName = value; clerkMid.setStatus((value == null ? null : Integer.parseInt(value)));
continue; continue;
} }
if ("headImgUrl".equals(name)) {
if("clerkCode".equals(name)){ clerkMid.setHeadImgUrl(value);
code = value; continue;
continue; }
}
if ("phoneNumber".equals(name)) {
if("clerkGender".equals(name)){ clerkMid.setPhoneNumber(value);
sex = value == null?null:Integer.parseInt(value); continue;
continue; }
}
if ("postionName".equals(name)) {
if("status".equals(name)){ clerkMid.setPostionName(value);
status = value == null?null:Integer.parseInt(value); continue;
continue; }
}
if ("nationcode".equals(name)) {
if("headImgUrl".equals(name)){ clerkMid.setNationcode((StringUtils.isBlank(value) ? "86" : value));
headPic = value; continue;
continue; }
} }
if("phoneNumber".equals(name)){ addClerkByGic(clerkMid);
phoneNumber = value; }
continue;
}
private void addClerkByGic(GicClerkDTO clerkDTO) {
if("postionName".equals(postion)){
postion = value; String gicStoreId = clerkDTO.getStoreId();
continue; String code = clerkDTO.getClerkCode();
} String staffName = clerkDTO.getClerkName();
String phoneNumber = clerkDTO.getPhoneNumber();
if("nationcode".equals(name)){ String nationcode = clerkDTO.getNationcode();
if(StringUtils.isBlank(value)){ Integer sex = clerkDTO.getClerkGender();
nationcode = "86"; String headPic = clerkDTO.getHeadImgUrl();
}else{ Integer status = 1;
nationcode = value; String postion = clerkDTO.getPostionName();
} String enterpriseId = clerkDTO.getEnterpriseId();
continue;
} if(StringUtils.isBlank(gicStoreId)){
}
if(StringUtils.isBlank(gicStoreId)){
logger.info("【店员同步】gicStoreId为空"); logger.info("【店员同步】gicStoreId为空");
return; return;
} }
TabHaobanDepartment department = departmentService.selectByRelatedId(gicStoreId); TabHaobanDepartment department = departmentService.selectByRelatedId(gicStoreId);
if(department == null){ if(department == null){
// try { logger.info("【店员同步】失败====department为空");
// Thread.sleep(3 * 1000); return;
// department = departmentService.selectByRelatedId(gicStoreId);
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
// if(department == null){
logger.info("【店员同步】department为空");
return;
// }
} }
String departmentId = department.getDepartmentId(); String departmentId = department.getDepartmentId();
String wxEnterpriseId = department.getWxEnterpriseId(); String wxEnterpriseId = department.getWxEnterpriseId();
StaffDTO staff = this.selectByNationcodeAndPhoneNumber(wxEnterpriseId, nationcode, phoneNumber); StaffDTO staff = this.selectByNationcodeAndPhoneNumber(wxEnterpriseId, nationcode, phoneNumber);
if(staff == null){ if(staff == null){
if(status != 1){ if(status != 1){
return; return;
}else{ }else{
...@@ -697,7 +690,7 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -697,7 +690,7 @@ public class StaffApiServiceImpl implements StaffApiService {
staffRelated.setClerkCode(code); staffRelated.setClerkCode(code);
staffDepartmentRelatedMapper.updateByPrimaryKey(EntityUtil.changeEntityByJSON(TabHaobanStaffDepartmentRelated.class, staffRelated)); staffDepartmentRelatedMapper.updateByPrimaryKey(EntityUtil.changeEntityByJSON(TabHaobanStaffDepartmentRelated.class, staffRelated));
} }
// ClerkDTO clerkDTO= clerkService.getClerkByCodeNoStatus(enterpriseId,code); // ClerkDTO clerkDTO= clerkService.getClerkByCodeNoStatus(enterpriseId,code);
// if(clerkDTO != null && (!clerkDTO.getClerkName().equals(staffName) || !staff.getPhoneNumber().equals(clerkDTO.getPhoneNumber()))){ // if(clerkDTO != null && (!clerkDTO.getClerkName().equals(staffName) || !staff.getPhoneNumber().equals(clerkDTO.getPhoneNumber()))){
// logger.info("【员工修改】clerkDTO={}",JSON.toJSONString(clerkDTO)); // logger.info("【员工修改】clerkDTO={}",JSON.toJSONString(clerkDTO));
......
...@@ -26,7 +26,7 @@ public class ServiceTest { ...@@ -26,7 +26,7 @@ public class ServiceTest {
@Test @Test
public void test1() { public void test1() {
String corpSelfExternalUseridInfo = qywxUserApiService.getCorpSelfExternalUseridInfo("ww50d418adce14b4a9" String corpSelfExternalUseridInfo = qywxUserApiService.getCorpSelfExternalUseridInfo("ww50d418adce14b4a9"
, "1azg6LG5Vj_YKFO-X27to4S4x_y-f6APR0fwE9YnQd8", "wm59NLDQAAC2w0nEhwp20s24xSRYgQDA"); , "1azg6LG5Vj_YKFO-X27to4S4x_y-f6APR0fwE9YnQd8", "wm-0J8CQAAbGIhtnLd51B97OO_0gf3zw");
System.out.println(corpSelfExternalUseridInfo); System.out.println(corpSelfExternalUseridInfo);
} }
......
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