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