Commit 35f158f8 by qwmqiuwenmin

Merge branch 'developer' into 'contact-4-14'

# Conflicts:
#   haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/DepartmentApiService.java
#   haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/DepartmentApiServiceImpl.java
parents 614b742f 91ffd3ef
package com.gic.haoban.manage.api.dto;
import java.io.Serializable;
import java.util.Date;
public class ClerkMainStoreRelatedDTO implements Serializable{
private String clerkMainStoreRelatedId;
private String staffId;
private String wxEnterpriseId;
private String storeId;
private Integer mainStoreFlag;
private Integer statusFlag;
private Date createTime;
private Date updateTime;
private static final long serialVersionUID = 1L;
public String getClerkMainStoreRelatedId() {
return clerkMainStoreRelatedId;
}
public void setClerkMainStoreRelatedId(String clerkMainStoreRelatedId) {
this.clerkMainStoreRelatedId = clerkMainStoreRelatedId == null ? null : clerkMainStoreRelatedId.trim();
}
public String getStaffId() {
return staffId;
}
public void setStaffId(String staffId) {
this.staffId = staffId;
}
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
public String getStoreId() {
return storeId;
}
public void setStoreId(String storeId) {
this.storeId = storeId == null ? null : storeId.trim();
}
public Integer getMainStoreFlag() {
return mainStoreFlag;
}
public void setMainStoreFlag(Integer mainStoreFlag) {
this.mainStoreFlag = mainStoreFlag;
}
public Integer getStatusFlag() {
return statusFlag;
}
public void setStatusFlag(Integer statusFlag) {
this.statusFlag = statusFlag;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}
package com.gic.haoban.manage.api.dto;
import java.io.Serializable;
/**
* Created 2020/4/10.
*
* @author hua
*/
public class DealParamMqDTO implements Serializable {
private String taskId;
private String data;
private Integer type;
public String getTaskId() {
return taskId;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
}
...@@ -56,6 +56,8 @@ public class StaffDTO implements Serializable{ ...@@ -56,6 +56,8 @@ public class StaffDTO implements Serializable{
private Boolean weixinPush; private Boolean weixinPush;
private long memberCount;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public int getClerkType() { public int getClerkType() {
...@@ -261,5 +263,13 @@ public class StaffDTO implements Serializable{ ...@@ -261,5 +263,13 @@ public class StaffDTO implements Serializable{
this.weixinPush = weixinPush; this.weixinPush = weixinPush;
} }
public long getMemberCount() {
return memberCount;
}
public void setMemberCount(long memberCount) {
this.memberCount = memberCount;
}
} }
package com.gic.haoban.manage.api.dto;
import java.io.Serializable;
import java.util.List;
/**
* Created 2020/4/13.
*
* @author hua
*/
public class SyncCheckDTO implements Serializable {
private Integer syncStatus;
private Integer groupErrCount;
private Integer storeErrCount;
private Integer staffErrCount;
private Integer totalDeal;
private Integer hasDeal;
public Integer getSyncStatus() {
return syncStatus;
}
public void setSyncStatus(Integer syncStatus) {
this.syncStatus = syncStatus;
}
public Integer getGroupErrCount() {
return groupErrCount;
}
public void setGroupErrCount(Integer groupErrCount) {
this.groupErrCount = groupErrCount;
}
public Integer getStoreErrCount() {
return storeErrCount;
}
public void setStoreErrCount(Integer storeErrCount) {
this.storeErrCount = storeErrCount;
}
public Integer getStaffErrCount() {
return staffErrCount;
}
public void setStaffErrCount(Integer staffErrCount) {
this.staffErrCount = staffErrCount;
}
public Integer getTotalDeal() {
return totalDeal;
}
public void setTotalDeal(Integer totalDeal) {
this.totalDeal = totalDeal;
}
public Integer getHasDeal() {
return hasDeal;
}
public void setHasDeal(Integer hasDeal) {
this.hasDeal = hasDeal;
}
}
package com.gic.haoban.manage.api.dto;
import java.io.Serializable;
/**
* Created 2020/4/9.
*
* @author hua
*/
public class SyncSingleDealDTO implements Serializable {
private String departmentId;
private String departmentName;
private String parentDepartmentId;
private String relatedId;
private Integer storeFlag;
private String enterpriseId;
//0 管理员 1 分组
private Integer type;
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public String getDepartmentId() {
return departmentId;
}
public void setDepartmentId(String departmentId) {
this.departmentId = departmentId;
}
public String getDepartmentName() {
return departmentName;
}
public void setDepartmentName(String departmentName) {
this.departmentName = departmentName;
}
public String getParentDepartmentId() {
return parentDepartmentId;
}
public void setParentDepartmentId(String parentDepartmentId) {
this.parentDepartmentId = parentDepartmentId;
}
public String getRelatedId() {
return relatedId;
}
public void setRelatedId(String relatedId) {
this.relatedId = relatedId;
}
public Integer getStoreFlag() {
return storeFlag;
}
public void setStoreFlag(Integer storeFlag) {
this.storeFlag = storeFlag;
}
}
package com.gic.haoban.manage.api.enums;
/**
* Created by hua on 2020/4/10.
*/
public enum PreDealStatusEnum {
all(-1),
pre(0),
dealing(1),
computed(2),
exception(3);
private int val;
PreDealStatusEnum(int val) {
this.val = val;
}
public int getVal() {
return val;
}
public void setVal(int val) {
this.val = val;
}
}
package com.gic.haoban.manage.api.enums;
/**
* Created by hua on 2020/4/10.
*/
public enum PreDealTypeEnum {
all(-1),
group(0),
store(1),
clerk(2);
private int val;
PreDealTypeEnum(int val) {
this.val = val;
}
public int getVal() {
return val;
}
public void setVal(int val) {
this.val = val;
}
}
...@@ -8,27 +8,41 @@ package com.gic.haoban.manage.api.enums; ...@@ -8,27 +8,41 @@ package com.gic.haoban.manage.api.enums;
public enum StoreFieldEnum { public enum StoreFieldEnum {
//门店名称 //门店名称
STORE_NAME("1"), STORE_NAME("1","门店名称"),
//门店面积 //门店面积
STORE_AREA("2"), STORE_AREA("2","门店面积"),
//联系电话 //联系电话
CONACTS_PHONE("3"), CONACTS_PHONE("3","联系电话"),
//营业时间 //营业时间
BUSINESS_TIME_STRING("4"), BUSINESS_TIME_STRING("4","营业时间"),
//门店地址 //门店地址
STORE_ADDRESS("5"), STORE_ADDRESS("5","门店地址"),
//门店图片 //门店图片
STORE_IMAG("6"); STORE_IMAG("6","门店图片");
/** /**
* 类型 * 类型
*/ */
private String value; private String value;
private String name;
StoreFieldEnum(String value) { StoreFieldEnum(String value,String name) {
this.value = value; this.value = value;
this.name = name;
} }
public String getValue() { public String getValue() {
return value; return value;
} }
public String getName() {
return name;
}
public static String getValueName(String changeField) {
for (StoreFieldEnum c : StoreFieldEnum.values()) {
if (c.getValue() == changeField) {
return c.name;
}
}
return null;
}
} }
package com.gic.haoban.manage.api.enums;
/**
* Created by hua on 2020/4/10.
*/
public enum SyncTaskStatusEnum {
init(0),
group_sync(1),
store_sync(2),
clerk_sync(3),
compute(4),
exception_compute(5),
exception_close(6);
private int val;
SyncTaskStatusEnum(int val) {
this.val = val;
}
public int getVal() {
return val;
}
public void setVal(int val) {
this.val = val;
}
}
package com.gic.haoban.manage.api.service;
import com.gic.haoban.manage.api.dto.ClerkMainStoreRelatedDTO;
public interface ClerkMainStoreRelatedApiService {
void setMainStore(String staffId, String storeId, String wxEnterpriseId);
ClerkMainStoreRelatedDTO getWxEnterpriseIdAndStaffId(String wxEnterpriseId, String staffId);
}
package com.gic.haoban.manage.api.service;
import com.gic.haoban.manage.api.dto.SyncCheckDTO;
import com.gic.haoban.manage.api.dto.SyncSingleDealDTO;
import java.util.List;
/**
* Created 2020/4/9.
*
* @author hua
*/
public interface DealSyncOperationApiService {
/**
* 部门同步处理
*
* @param params
*/
public void departmentDealMq(String params);
/**
* 处理前端数据
*
* @param addList
* @param editList
*/
public void dealDepartment(String taskId, String wxEnterpriseId, List<SyncSingleDealDTO> addList, List<SyncSingleDealDTO> editList);
/**
* 重新执行任务
*
* @param taskId
*/
public void reDealDepartment(String taskId, int dataType);
/**
* 创建任务
*
* @param taskName
* @param userId
* @param desc
*/
public String createTask(String wxEnterpriseId, String taskName, String userId, String desc);
/**
* 关闭任务
*
* @param wxEnterpriseId
* @return
*/
public boolean closeTask(String wxEnterpriseId);
/**
* 解锁
*
* @param taskId
*/
public void unlockTask(String taskId);
/**
* 校验是否锁
*
* @param wxEnterpriseId
* @return
*/
public String getTaskLock(String wxEnterpriseId);
/**
* 校验同步状态
*
* @param wxEnterpriseId
* @return
*/
public SyncCheckDTO getTaskCheck(String wxEnterpriseId);
}
...@@ -47,7 +47,7 @@ public interface DepartmentApiService { ...@@ -47,7 +47,7 @@ public interface DepartmentApiService {
* @param department * @param department
* @return * @return
*/ */
ServiceResponse add(DepartmentDTO department); ServiceResponse<DepartmentDTO> add(DepartmentDTO department);
/** /**
* 修改部门 * 修改部门
* @param department * @param department
......
package com.gic.haoban.manage.service.dao.mapper;
import com.gic.haoban.manage.api.dto.SyncCheckDTO;
import com.gic.haoban.manage.service.entity.TabHaobanPreDealLog;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface PreDealLogMapper {
/**
*/
int deleteByPrimaryKey(Integer id);
/**
*/
int insert(TabHaobanPreDealLog record);
/**
*/
int insertSelective(TabHaobanPreDealLog record);
/**
*/
TabHaobanPreDealLog selectByPrimaryKey(Integer id);
/**
*/
int updateByPrimaryKeySelective(TabHaobanPreDealLog record);
/**
*/
int updateByPrimaryKey(TabHaobanPreDealLog record);
/**
* 获取单条数据
*
* @param taskId
* @param dataId
* @return
*/
TabHaobanPreDealLog getByDataId(@Param("taskId") String taskId, @Param("dataId") String dataId, @Param("status") int status);
/**
* 获取单条数据
*
* @param taskId
* @param pDataId
* @return
*/
List<TabHaobanPreDealLog> listByPDataId(@Param("taskId") String taskId, @Param("dataId") String pDataId
, @Param("status") int status, @Param("dataType") int dataType);
/**
* 更新状态
*
* @param taskId
* @param dataId
* @param status
* @return
*/
public int updateStatusByDataId(@Param("taskId") String taskId, @Param("dataId") String dataId, @Param("status") int status, @Param("reason") String reason);
/**
* 校验任务
*
* @param taskId
* @param dataType
* @return
*/
public int checkTask(@Param("taskId") String taskId, @Param("dataType") int dataType, @Param("status") int status);
public List<TabHaobanPreDealLog> listByTaskId(@Param("taskId") String taskId, @Param("dataType") int dataType, @Param("status") int status);
/**
* 统计任务数量
*
* @param taskId
* @return
*/
public int countByTaskId(@Param("taskId") String taskId, @Param("dataType") int dataType, @Param("status") int status);
/**
* 重试的时候 第一级部门
*
* @param taskId
* @return
*/
public List<TabHaobanPreDealLog> listRebuildDepartByTaskId(@Param("taskId") String taskId);
}
\ No newline at end of file
package com.gic.haoban.manage.service.dao.mapper;
import com.gic.haoban.manage.service.entity.TabHaobanSyncTask;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface SyncTaskMapper {
/**
*/
int deleteByPrimaryKey(String taskId);
/**
*/
int insert(TabHaobanSyncTask record);
/**
*/
int insertSelective(TabHaobanSyncTask record);
/**
*/
TabHaobanSyncTask selectByPrimaryKey(String taskId);
/**
*/
int updateByPrimaryKeySelective(TabHaobanSyncTask record);
/**
*/
int updateByPrimaryKey(TabHaobanSyncTask record);
}
\ No newline at end of file
package com.gic.haoban.manage.service.dao.mapper;
import org.apache.ibatis.annotations.Param;
import com.gic.haoban.manage.service.entity.TabHaobanClerkMainStoreRelated;
public interface TabHaobanClerkMainStoreRelatedMapper {
int deleteByPrimaryKey(String clerkMainStoreRelatedId);
int insert(TabHaobanClerkMainStoreRelated record);
int insertSelective(TabHaobanClerkMainStoreRelated record);
TabHaobanClerkMainStoreRelated selectByPrimaryKey(String clerkMainStoreRelatedId);
int updateByPrimaryKeySelective(TabHaobanClerkMainStoreRelated record);
int updateByPrimaryKey(TabHaobanClerkMainStoreRelated record);
TabHaobanClerkMainStoreRelated selectByWxEnterpriseIdAndStoreId(@Param("staffId")String staffId, @Param("wxEnterpriseId")String wxEnterpriseId);
}
\ No newline at end of file
package com.gic.haoban.manage.service.entity;
import java.io.Serializable;
import java.util.Date;
public class TabHaobanClerkMainStoreRelated implements Serializable {
private String clerkMainStoreRelatedId;
private String staffId;
private String wxEnterpriseId;
private String storeId;
private Integer mainStoreFlag;
private Integer statusFlag;
private Date createTime;
private Date updateTime;
private static final long serialVersionUID = 1L;
public String getClerkMainStoreRelatedId() {
return clerkMainStoreRelatedId;
}
public void setClerkMainStoreRelatedId(String clerkMainStoreRelatedId) {
this.clerkMainStoreRelatedId = clerkMainStoreRelatedId == null ? null : clerkMainStoreRelatedId.trim();
}
public String getStaffId() {
return staffId;
}
public void setStaffId(String staffId) {
this.staffId = staffId;
}
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
public String getStoreId() {
return storeId;
}
public void setStoreId(String storeId) {
this.storeId = storeId == null ? null : storeId.trim();
}
public Integer getMainStoreFlag() {
return mainStoreFlag;
}
public void setMainStoreFlag(Integer mainStoreFlag) {
this.mainStoreFlag = mainStoreFlag;
}
public Integer getStatusFlag() {
return statusFlag;
}
public void setStatusFlag(Integer statusFlag) {
this.statusFlag = statusFlag;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}
\ No newline at end of file
package com.gic.haoban.manage.service.entity;
import java.io.Serializable;
import java.util.Date;
/**
* Created By MBG-GUI-EXTENSION https://github.com/spawpaw/mybatis-generator-gui-extension
* Description:
*
* @author fdh
*/
public class TabHaobanPreDealLog implements Serializable {
/**
*
*/
private Integer id;
/**
* 企业微信id
*/
private String wxEnterpriseId;
/**
* 企业id
*/
private String enterpriseId;
/**
* 数据id
*/
private String dataId;
/**
* 父dataid
*/
private String pDataId;
/**
* 任务id
*/
private String taskId;
/**
* 数据类型 0 分组 1门店 2成员
*/
private Integer dataType;
/**
* 状态 0 未同步 1同步完成 2 同步失败
*/
private Integer statusFlag;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
/**
*/
private static final long serialVersionUID = 1L;
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
/**
* This method returns the value of the database column tab_haoban_pre_deal_log.id
*
* @return the value of tab_haoban_pre_deal_log.id
*/
public Integer getId() {
return id;
}
/**
* This method sets the value of the database column tab_haoban_pre_deal_log.id
*
* @param id the value for tab_haoban_pre_deal_log.id
*/
public void setId(Integer id) {
this.id = id;
}
/**
* This method returns the value of the database column tab_haoban_pre_deal_log.wx_enterprise_id
*
* @return the value of tab_haoban_pre_deal_log.wx_enterprise_id
*/
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
/**
* This method sets the value of the database column tab_haoban_pre_deal_log.wx_enterprise_id
*
* @param wxEnterpriseId the value for tab_haoban_pre_deal_log.wx_enterprise_id
*/
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
/**
* This method returns the value of the database column tab_haoban_pre_deal_log.data_id
*
* @return the value of tab_haoban_pre_deal_log.data_id
*/
public String getDataId() {
return dataId;
}
/**
* This method sets the value of the database column tab_haoban_pre_deal_log.data_id
*
* @param dataId the value for tab_haoban_pre_deal_log.data_id
*/
public void setDataId(String dataId) {
this.dataId = dataId;
}
/**
* This method returns the value of the database column tab_haoban_pre_deal_log.p_data_id
*
* @return the value of tab_haoban_pre_deal_log.p_data_id
*/
public String getpDataId() {
return pDataId;
}
/**
* This method sets the value of the database column tab_haoban_pre_deal_log.p_data_id
*
* @param pDataId the value for tab_haoban_pre_deal_log.p_data_id
*/
public void setpDataId(String pDataId) {
this.pDataId = pDataId;
}
/**
* This method returns the value of the database column tab_haoban_pre_deal_log.task_id
*
* @return the value of tab_haoban_pre_deal_log.task_id
*/
public String getTaskId() {
return taskId;
}
/**
* This method sets the value of the database column tab_haoban_pre_deal_log.task_id
*
* @param taskId the value for tab_haoban_pre_deal_log.task_id
*/
public void setTaskId(String taskId) {
this.taskId = taskId;
}
/**
* This method returns the value of the database column tab_haoban_pre_deal_log.data_type
*
* @return the value of tab_haoban_pre_deal_log.data_type
*/
public Integer getDataType() {
return dataType;
}
/**
* This method sets the value of the database column tab_haoban_pre_deal_log.data_type
*
* @param dataType the value for tab_haoban_pre_deal_log.data_type
*/
public void setDataType(Integer dataType) {
this.dataType = dataType;
}
/**
* This method returns the value of the database column tab_haoban_pre_deal_log.status_flag
*
* @return the value of tab_haoban_pre_deal_log.status_flag
*/
public Integer getStatusFlag() {
return statusFlag;
}
/**
* This method sets the value of the database column tab_haoban_pre_deal_log.status_flag
*
* @param statusFlag the value for tab_haoban_pre_deal_log.status_flag
*/
public void setStatusFlag(Integer statusFlag) {
this.statusFlag = statusFlag;
}
/**
* This method returns the value of the database column tab_haoban_pre_deal_log.create_time
*
* @return the value of tab_haoban_pre_deal_log.create_time
*/
public Date getCreateTime() {
return createTime;
}
/**
* This method sets the value of the database column tab_haoban_pre_deal_log.create_time
*
* @param createTime the value for tab_haoban_pre_deal_log.create_time
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* This method returns the value of the database column tab_haoban_pre_deal_log.update_time
*
* @return the value of tab_haoban_pre_deal_log.update_time
*/
public Date getUpdateTime() {
return updateTime;
}
/**
* This method sets the value of the database column tab_haoban_pre_deal_log.update_time
*
* @param updateTime the value for tab_haoban_pre_deal_log.update_time
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}
\ No newline at end of file
package com.gic.haoban.manage.service.entity;
import java.io.Serializable;
import java.util.Date;
/**
* Created By MBG-GUI-EXTENSION https://github.com/spawpaw/mybatis-generator-gui-extension
* Description:
*
* @author fdh
*/
public class TabHaobanSyncTask implements Serializable {
/**
*
*/
private String taskId;
private String wxEnterpriseId;
/**
*
*/
private String taskName;
/**
* 任务创建人
*/
private String addUser;
/**
* 任务描述
*/
private String taskDesc;
/**
* 任务状态
*/
private Integer statusFlag;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
/**
*/
private static final long serialVersionUID = 1L;
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
/**
* This method returns the value of the database column tab_haoban_sync_task.task_id
*
* @return the value of tab_haoban_sync_task.task_id
*/
public String getTaskId() {
return taskId;
}
/**
* This method sets the value of the database column tab_haoban_sync_task.task_id
*
* @param taskId the value for tab_haoban_sync_task.task_id
*/
public void setTaskId(String taskId) {
this.taskId = taskId;
}
/**
* This method returns the value of the database column tab_haoban_sync_task.task_name
*
* @return the value of tab_haoban_sync_task.task_name
*/
public String getTaskName() {
return taskName;
}
/**
* This method sets the value of the database column tab_haoban_sync_task.task_name
*
* @param taskName the value for tab_haoban_sync_task.task_name
*/
public void setTaskName(String taskName) {
this.taskName = taskName;
}
/**
* This method returns the value of the database column tab_haoban_sync_task.add_user
*
* @return the value of tab_haoban_sync_task.add_user
*/
public String getAddUser() {
return addUser;
}
/**
* This method sets the value of the database column tab_haoban_sync_task.add_user
*
* @param addUser the value for tab_haoban_sync_task.add_user
*/
public void setAddUser(String addUser) {
this.addUser = addUser;
}
/**
* This method returns the value of the database column tab_haoban_sync_task.task_desc
*
* @return the value of tab_haoban_sync_task.task_desc
*/
public String getTaskDesc() {
return taskDesc;
}
/**
* This method sets the value of the database column tab_haoban_sync_task.task_desc
*
* @param taskDesc the value for tab_haoban_sync_task.task_desc
*/
public void setTaskDesc(String taskDesc) {
this.taskDesc = taskDesc;
}
/**
* This method returns the value of the database column tab_haoban_sync_task.status_flag
*
* @return the value of tab_haoban_sync_task.status_flag
*/
public Integer getStatusFlag() {
return statusFlag;
}
/**
* This method sets the value of the database column tab_haoban_sync_task.status_flag
*
* @param statusFlag the value for tab_haoban_sync_task.status_flag
*/
public void setStatusFlag(Integer statusFlag) {
this.statusFlag = statusFlag;
}
/**
* This method returns the value of the database column tab_haoban_sync_task.create_time
*
* @return the value of tab_haoban_sync_task.create_time
*/
public Date getCreateTime() {
return createTime;
}
/**
* This method sets the value of the database column tab_haoban_sync_task.create_time
*
* @param createTime the value for tab_haoban_sync_task.create_time
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* This method returns the value of the database column tab_haoban_sync_task.update_time
*
* @return the value of tab_haoban_sync_task.update_time
*/
public Date getUpdateTime() {
return updateTime;
}
/**
* This method sets the value of the database column tab_haoban_sync_task.update_time
*
* @param updateTime the value for tab_haoban_sync_task.update_time
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}
\ No newline at end of file
package com.gic.haoban.manage.service.service;
import com.gic.haoban.manage.service.entity.TabHaobanClerkMainStoreRelated;
public interface ClerkMainStoreRelatedService {
void setMainStore(String staffId, String storeId, String wxEnterpriseId);
TabHaobanClerkMainStoreRelated selectByWxEnterpriseIdAndStoreId(String staffId, String wxEnterpriseId);
void update(TabHaobanClerkMainStoreRelated r);
}
package com.gic.haoban.manage.service.service;
import com.gic.haoban.manage.api.dto.SyncCheckDTO;
import com.gic.haoban.manage.service.entity.TabHaobanPreDealLog;
import java.util.List;
/**
* Created 2020/4/9.
*
* @author hua
*/
public interface PreDealService {
/**
* 批量新增
*
* @param list
* @return
*/
public boolean insert(List<TabHaobanPreDealLog> list);
/**
* 获取单条数据
*
* @param dataId
* @return
*/
public TabHaobanPreDealLog getByDataId(String taskId, String dataId, int status);
/**
* 根据父数据id 获取子节点
*
* @param pDataId
* @param status
* @return
*/
public List<TabHaobanPreDealLog> listByPDataId(String taskId, String pDataId, int status);
/**
* 更新单条数据状态
*
* @param dataId
* @param status
* @return
*/
public boolean updateStatusByDataId(String taskId, String dataId, int status, String reason);
/**
* 获取任务是否有在同步中
*
* @param dataType
* @return
*/
public boolean checkTask(String taskId, int dataType);
/**
* 获取任务列表
*
* @param type
* @param status
* @return
*/
public List<TabHaobanPreDealLog> listByTaskId(String taskId, int dataType, int status);
/**
* 获取任务数量
*
* @param status
* @return
*/
public int countByTaskId(String taskId, int dataType, int status);
/**
* 获取重试时 需要处理的数据
*
* @param taskId
* @return
*/
public List<TabHaobanPreDealLog> queryDepartRebuildDealLog(String taskId);
}
...@@ -28,4 +28,6 @@ public interface StaffDepartmentRelatedService { ...@@ -28,4 +28,6 @@ public interface StaffDepartmentRelatedService {
List<TabHaobanStaffDepartmentRelated> listByWxUserId(String wxUserId); List<TabHaobanStaffDepartmentRelated> listByWxUserId(String wxUserId);
StaffDepartmentRelatedDTO getById(String staffDepartmentStaffRelatedId);
} }
package com.gic.haoban.manage.service.service;
import com.gic.haoban.manage.service.entity.TabHaobanSyncTask;
/**
* Created 2020/4/10.
*
* @author hua
*/
public interface SyncTaskService {
/**
* 创建任务
*
* @param tabHaobanSyncTask
*/
public void createTask(TabHaobanSyncTask tabHaobanSyncTask);
/**
* 更新任务状态
*
* @param taskId
* @param status
*/
public boolean updateTaskStatus(String taskId, int status);
/**
* 获取任务
*
* @param taskId
* @return
*/
public TabHaobanSyncTask getSyncTask(String taskId);
}
package com.gic.haoban.manage.service.service.impl;
import java.util.Date;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanClerkMainStoreRelatedMapper;
import com.gic.haoban.manage.service.entity.TabHaobanClerkMainStoreRelated;
import com.gic.haoban.manage.service.service.ClerkMainStoreRelatedService;
@Service
public class ClerkMainStoreRelatedServiceImpl implements ClerkMainStoreRelatedService {
@Autowired
private TabHaobanClerkMainStoreRelatedMapper mapper;
@Override
public void setMainStore(String staffId, String storeId, String wxEnterpriseId) {
String uuId = com.gic.haoban.common.utils.StringUtil.randomUUID();
Date now = new Date();
TabHaobanClerkMainStoreRelated t = new TabHaobanClerkMainStoreRelated();
t.setStaffId(staffId);
t.setWxEnterpriseId(wxEnterpriseId);
t.setStoreId(storeId);
t.setCreateTime(now);
t.setUpdateTime(now);
t.setStatusFlag(1);
t.setClerkMainStoreRelatedId(uuId);
mapper.insert(t);
}
@Override
public TabHaobanClerkMainStoreRelated selectByWxEnterpriseIdAndStoreId(String staffId, String wxEnterpriseId) {
return mapper.selectByWxEnterpriseIdAndStoreId(staffId,wxEnterpriseId);
}
@Override
public void update(TabHaobanClerkMainStoreRelated r) {
r.setUpdateTime(new Date());
mapper.updateByPrimaryKeySelective(r);
}
}
package com.gic.haoban.manage.service.service.impl;
import com.gic.haoban.manage.api.dto.SyncCheckDTO;
import com.gic.haoban.manage.api.enums.PreDealStatusEnum;
import com.gic.haoban.manage.api.enums.PreDealTypeEnum;
import com.gic.haoban.manage.service.dao.mapper.PreDealLogMapper;
import com.gic.haoban.manage.service.entity.TabHaobanPreDealLog;
import com.gic.haoban.manage.service.service.PreDealService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Created 2020/4/9.
*
* @author hua
*/
@Service
public class PreDealServiceImpl implements PreDealService {
@Autowired
private PreDealLogMapper preDealLogMapper;
@Override
public boolean insert(List<TabHaobanPreDealLog> list) {
for (TabHaobanPreDealLog tab : list) {
preDealLogMapper.insert(tab);
}
return true;
}
@Override
public TabHaobanPreDealLog getByDataId(String taskId, String dataId, int status) {
TabHaobanPreDealLog byDataId = preDealLogMapper.getByDataId(taskId, dataId, status);
return byDataId;
}
@Override
public List<TabHaobanPreDealLog> listByPDataId(String taskId, String pDataId, int status) {
return preDealLogMapper.listByPDataId(taskId, pDataId, status, PreDealTypeEnum.group.getVal());
}
@Override
public boolean updateStatusByDataId(String taskId, String dataId, int status, String reason) {
int i = preDealLogMapper.updateStatusByDataId(taskId, dataId, status, reason);
return i >= 0;
}
@Override
public boolean checkTask(String taskId, int dataType) {
int i = preDealLogMapper.checkTask(taskId, dataType, PreDealStatusEnum.pre.getVal());
return i == 0;
}
@Override
public List<TabHaobanPreDealLog> listByTaskId(String taskId, int dataType, int status) {
return preDealLogMapper.listByTaskId(taskId, dataType, status);
}
@Override
public int countByTaskId(String taskId, int dataType, int status) {
return preDealLogMapper.countByTaskId(taskId, dataType, status);
}
@Override
public List<TabHaobanPreDealLog> queryDepartRebuildDealLog(String taskId) {
return preDealLogMapper.listRebuildDepartByTaskId(taskId);
}
}
...@@ -84,6 +84,10 @@ public class StaffDepartmentRelatedServiceImpl implements StaffDepartmentRelated ...@@ -84,6 +84,10 @@ public class StaffDepartmentRelatedServiceImpl implements StaffDepartmentRelated
public List<TabHaobanStaffDepartmentRelated> listByDepartmentIdByKeyword(String departmentId, String keyword) { public List<TabHaobanStaffDepartmentRelated> listByDepartmentIdByKeyword(String departmentId, String keyword) {
return mapper.listByDepartmentIdByKeyword(departmentId,keyword); return mapper.listByDepartmentIdByKeyword(departmentId,keyword);
} }
@Override
public StaffDepartmentRelatedDTO getById(String staffDepartmentStaffRelatedId) {
return EntityUtil.changeEntityByJSON(StaffDepartmentRelatedDTO.class, mapper.getById(staffDepartmentStaffRelatedId));
}
} }
package com.gic.haoban.manage.service.service.impl;
import com.gic.commons.util.ToolUtil;
import com.gic.haoban.manage.api.enums.SyncTaskStatusEnum;
import com.gic.haoban.manage.service.dao.mapper.SyncTaskMapper;
import com.gic.haoban.manage.service.entity.TabHaobanSyncTask;
import com.gic.haoban.manage.service.service.SyncTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
/**
* Created 2020/4/10.
*
* @author hua
*/
@Service
public class SyncTaskServiceImpl implements SyncTaskService {
@Autowired
private SyncTaskMapper syncTaskMapper;
@Override
public void createTask(TabHaobanSyncTask tabHaobanSyncTask) {
tabHaobanSyncTask.setTaskId(ToolUtil.randomUUID());
tabHaobanSyncTask.setStatusFlag(SyncTaskStatusEnum.init.getVal());
syncTaskMapper.insert(tabHaobanSyncTask);
}
@Override
public boolean updateTaskStatus(String taskId, int status) {
TabHaobanSyncTask tabHaobanSyncTask = new TabHaobanSyncTask();
tabHaobanSyncTask.setTaskId(taskId);
tabHaobanSyncTask.setStatusFlag(status);
tabHaobanSyncTask.setUpdateTime(new Date());
int i = syncTaskMapper.updateByPrimaryKeySelective(tabHaobanSyncTask);
return i >= 0;
}
@Override
public TabHaobanSyncTask getSyncTask(String taskId) {
return syncTaskMapper.selectByPrimaryKey(taskId);
}
}
...@@ -38,6 +38,9 @@ import com.gic.haoban.manage.service.dao.mapper.TabHaobanAuditMapper; ...@@ -38,6 +38,9 @@ import com.gic.haoban.manage.service.dao.mapper.TabHaobanAuditMapper;
import com.gic.haoban.manage.service.entity.TabHaobanAudit; import com.gic.haoban.manage.service.entity.TabHaobanAudit;
import com.gic.haoban.manage.service.entity.TabHaobanDepartment; import com.gic.haoban.manage.service.entity.TabHaobanDepartment;
import com.gic.haoban.manage.service.entity.TabHaobanStaff; import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.gic.haoban.message.api.dto.MessageDTO;
import com.gic.wechat.api.dto.qywx.QywxXcxSendMessageDTO;
import com.gic.wechat.api.service.qywx.QywxSuiteApiService;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
/** /**
...@@ -55,6 +58,8 @@ public class AuditApiServiceImpl implements AuditApiService{ ...@@ -55,6 +58,8 @@ public class AuditApiServiceImpl implements AuditApiService{
private StaffMapper staffMapper; private StaffMapper staffMapper;
@Autowired @Autowired
private StoreService storeService; private StoreService storeService;
@Autowired
private QywxSuiteApiService qywxSuiteApiService;
@Override @Override
public Page<AuditDTO> page(Integer auditType, String search,String wxEnterpriseId, public Page<AuditDTO> page(Integer auditType, String search,String wxEnterpriseId,
...@@ -112,6 +117,13 @@ public class AuditApiServiceImpl implements AuditApiService{ ...@@ -112,6 +117,13 @@ public class AuditApiServiceImpl implements AuditApiService{
String newValue = tab.getNewValue(); String newValue = tab.getNewValue();
String changeField = tab.getChangeField(); String changeField = tab.getChangeField();
this.editStoreInfo(storeId, changeField, oldValue, newValue); this.editStoreInfo(storeId, changeField, oldValue, newValue);
//名字
String title = StoreFieldEnum.getValueName(changeField);
title = "["+title+"]"+"修改审核通过";
// QywxXcxSendMessageDTO messageDTO = new QywxXcxSendMessageDTO();
// config.getWxSuiteid();
// qywxSuiteApiService.sendMessage("ww9ede832a84b7ae5f","ww2c34dc56739bb105", messageDTO);
} }
@Override @Override
public void refuse(String auditId, String auditReason,String auditName) { public void refuse(String auditId, String auditReason,String auditName) {
...@@ -122,6 +134,12 @@ public class AuditApiServiceImpl implements AuditApiService{ ...@@ -122,6 +134,12 @@ public class AuditApiServiceImpl implements AuditApiService{
tab.setAuditReason(auditReason); tab.setAuditReason(auditReason);
tab.setAuditName(auditName); tab.setAuditName(auditName);
auditMapper.updateByPrimaryKeySelective(tab); auditMapper.updateByPrimaryKeySelective(tab);
TabHaobanAudit tab2 = auditMapper.selectByPrimaryKey(auditId);
String changeField = tab2.getChangeField();
String title = StoreFieldEnum.getValueName(changeField);
title = "["+title+"]"+"被拒绝。拒绝理由:"+auditReason;
} }
@Override @Override
public int save(Integer auditType,String wxEnterpriseId, String enterpriseId, public int save(Integer auditType,String wxEnterpriseId, String enterpriseId,
......
package com.gic.haoban.manage.service.service.out.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.gic.commons.util.EntityUtil;
import com.gic.haoban.manage.api.dto.ClerkMainStoreRelatedDTO;
import com.gic.haoban.manage.api.service.ClerkMainStoreRelatedApiService;
import com.gic.haoban.manage.service.entity.TabHaobanClerkMainStoreRelated;
import com.gic.haoban.manage.service.service.ClerkMainStoreRelatedService;
@Service
public class ClerkMainStoreRelatedApiServiceImpl implements ClerkMainStoreRelatedApiService {
@Autowired
ClerkMainStoreRelatedService clerkMainStoreRelatedService;
@Override
public void setMainStore(String staffId, String storeId, String wxEnterpriseId) {
TabHaobanClerkMainStoreRelated r = clerkMainStoreRelatedService.selectByWxEnterpriseIdAndStoreId(staffId,wxEnterpriseId);
if(r != null){
r.setStoreId(storeId);
clerkMainStoreRelatedService.update(r);
}else{
clerkMainStoreRelatedService.setMainStore(staffId, storeId, wxEnterpriseId);
}
}
@Override
public ClerkMainStoreRelatedDTO getWxEnterpriseIdAndStaffId(String wxEnterpriseId, String staffId) {
return EntityUtil.changeEntityByJSON(ClerkMainStoreRelatedDTO.class, clerkMainStoreRelatedService.selectByWxEnterpriseIdAndStoreId(staffId,wxEnterpriseId));
}
}
package com.gic.haoban.manage.service.service.out.impl;
import com.alibaba.fastjson.JSONObject;
import com.gic.commons.util.GICMQClientUtil;
import com.gic.commons.util.ToolUtil;
import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.enterprise.api.dto.StoreGroupDTO;
import com.gic.enterprise.api.service.StoreGroupService;
import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.base.api.common.Constant;
import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.manage.api.dto.DealParamMqDTO;
import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.api.dto.SyncCheckDTO;
import com.gic.haoban.manage.api.dto.SyncSingleDealDTO;
import com.gic.haoban.manage.api.enums.PreDealStatusEnum;
import com.gic.haoban.manage.api.enums.PreDealTypeEnum;
import com.gic.haoban.manage.api.enums.SyncTaskStatusEnum;
import com.gic.haoban.manage.api.service.DealSyncOperationApiService;
import com.gic.haoban.manage.api.service.DepartmentApiService;
import com.gic.haoban.manage.service.entity.TabHaobanDepartment;
import com.gic.haoban.manage.service.entity.TabHaobanPreDealLog;
import com.gic.haoban.manage.service.entity.TabHaobanSyncTask;
import com.gic.haoban.manage.service.service.DepartmentService;
import com.gic.haoban.manage.service.service.PreDealService;
import com.gic.haoban.manage.service.service.SyncTaskService;
import com.gic.haoban.manage.service.task.BaseSyncOperation;
import com.gic.mq.sdk.GicMQClient;
import com.gic.redis.data.util.RedisUtil;
import com.task.allocation.api.AbstractTaskAllocationNewOperation;
import com.task.allocation.exception.TaskAllocationException;
import com.task.allocation.qo.TaskAllocationComputed;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
* Created 2020/4/9.
*
* @author hua
*/
@Service
public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiService {
private static final Logger logger = LoggerFactory.getLogger(DealSyncOperationApiServiceImpl.class);
@Autowired
private DepartmentService departmentService;
@Autowired
private StoreGroupService storeGroupService;
@Autowired
private PreDealService preDealService;
@Autowired
private DepartmentApiService departmentApiService;
@Autowired
private SyncTaskService syncTaskService;
@Autowired
private StoreService storeService;
@Autowired
private Map<String, BaseSyncOperation> operationMap;
private static final String LOCK_KEY = "sync_wx_lock_";
@Override
public void departmentDealMq(String params) {
logger.info("mq处理中:{}", params);
DealParamMqDTO dealParamMqDTO = JSONObject.parseObject(params, DealParamMqDTO.class);
TabHaobanPreDealLog dataPre = preDealService.getByDataId(dealParamMqDTO.getTaskId()
, dealParamMqDTO.getData(), PreDealStatusEnum.all.getVal());
if (dataPre == null) {
logger.info("待处理数据不存在:{}", params);
return;
}
//部门处理
if (dataPre.getDataType().equals(PreDealTypeEnum.group.getVal())) {
operationMap.get("groupSyncOperation").dealSingleByMq(dealParamMqDTO, dataPre);
//门店处理
} else if (dataPre.getDataType().equals(PreDealTypeEnum.store.getVal())) {
logger.info("门店处理:{}", params);
operationMap.get("storeSyncOperation").dealSingleByMq(dealParamMqDTO, dataPre);
//成员处理
} else if (dataPre.getDataType().equals(PreDealTypeEnum.clerk.getVal())) {
logger.info("店员处理:{}", params);
operationMap.get("clerkSyncOperation").dealSingleByMq(dealParamMqDTO, dataPre);
} else {
logger.info("不是正常数据:{}", params);
}
}
@Override
public void dealDepartment(String taskId, String wxEnterpriseId
, List<SyncSingleDealDTO> addList, List<SyncSingleDealDTO> editList) {
logger.info("初始开始:{}", taskId);
//处理修改
dealEidtSync(editList);
if (CollectionUtils.isEmpty(addList)) {
syncTaskService.updateTaskStatus(taskId, SyncTaskStatusEnum.compute.getVal());
unlockTask(wxEnterpriseId);
return;
}
logger.info("处理分组信息开始:{}", taskId);
dealAddSync(taskId, wxEnterpriseId, addList);
//加入队列处理
logger.info("初始化到队列:{}", taskId);
dealDepartmentInit(taskId, wxEnterpriseId, addList);
}
@Override
public void reDealDepartment(String taskId, int dataType) {
int groupErrCount = preDealService.countByTaskId(taskId, PreDealTypeEnum.group.getVal(), PreDealStatusEnum.exception.getVal());
int storeErrCount = preDealService.countByTaskId(taskId, PreDealTypeEnum.store.getVal(), PreDealStatusEnum.exception.getVal());
List<TabHaobanPreDealLog> list = null;
if (dataType == -1) {
if (groupErrCount > 0) {
dataType = PreDealTypeEnum.group.getVal();
list = preDealService.queryDepartRebuildDealLog(taskId);
} else if (storeErrCount > 0) {
dataType = PreDealTypeEnum.store.getVal();
list = preDealService.listByTaskId(taskId, dataType, PreDealStatusEnum.exception.getVal());
} else {
dataType = PreDealTypeEnum.clerk.getVal();
list = preDealService.listByTaskId(taskId, dataType, PreDealStatusEnum.exception.getVal());
}
}
if (CollectionUtils.isEmpty(list)) {
return;
}
Set<String> midList = list.stream().map(TabHaobanPreDealLog::getDataId).collect(Collectors.toSet());
//根据类型获取状态
SyncTaskStatusEnum syncTaskStatusEnum = (dataType == PreDealTypeEnum.group.getVal() ? SyncTaskStatusEnum.group_sync
: (dataType == PreDealTypeEnum.store.getVal() ? SyncTaskStatusEnum.store_sync : SyncTaskStatusEnum.clerk_sync));
dealDepartmentToMq(taskId, midList, syncTaskStatusEnum);
}
@Override
public String createTask(String wxEnterpriseId, String taskName, String userId, String desc) {
TabHaobanSyncTask tabHaobanSyncTask = new TabHaobanSyncTask();
tabHaobanSyncTask.setAddUser(userId);
tabHaobanSyncTask.setTaskName(taskName);
tabHaobanSyncTask.setTaskDesc(desc);
tabHaobanSyncTask.setWxEnterpriseId(wxEnterpriseId);
tabHaobanSyncTask.setStatusFlag(SyncTaskStatusEnum.init.getVal());
tabHaobanSyncTask.setTaskId(ToolUtil.randomUUID());
syncTaskService.createTask(tabHaobanSyncTask);
lockTask(wxEnterpriseId, tabHaobanSyncTask.getTaskId());
return tabHaobanSyncTask.getTaskId();
}
/**
* 处理修改数据
*
* @param editList
*/
private void dealEidtSync(List<SyncSingleDealDTO> editList) {
if (CollectionUtils.isEmpty(editList)) {
return;
}
//先处理修改的
editList.forEach(syncSingleDealDTO -> {
// TODO: 2020/4/9 需要优化
TabHaobanDepartment department = departmentService.selectById(syncSingleDealDTO.getDepartmentId());
if (!department.getParentDepartmentId().equals(syncSingleDealDTO.getParentDepartmentId())) {
department.setParentDepartmentId(syncSingleDealDTO.getParentDepartmentId());
departmentApiService.edit(EntityUtil.changeEntityByJSON(DepartmentDTO.class, department));
}
});
}
/**
* 执行新增同步
*
* @param taskId
* @param wxEnterpriseId
* @param addList
*/
private void dealAddSync(String taskId, String wxEnterpriseId, List<SyncSingleDealDTO> addList) {
Map<String, String> pMap = addList.stream().collect(Collectors.toMap(SyncSingleDealDTO::getRelatedId, SyncSingleDealDTO::getParentDepartmentId));
//获取企业与分组map
Map<String, List<String>> eidListMap = addList.stream().filter(dto -> {
String departmentId = dto.getDepartmentId();
TabHaobanDepartment department = departmentService.selectById(departmentId);
if (department != null) {
return false;
}
Integer storeFlag = dto.getStoreFlag();
if (storeFlag.equals(1)) {
return false;
}
return true;
}).collect(Collectors.groupingBy(SyncSingleDealDTO::getEnterpriseId
, Collectors.mapping(SyncSingleDealDTO::getRelatedId, Collectors.toList())));
//放入预处理表
eidListMap.forEach((k, v) -> {
//获取所有分组列表
List<StoreGroupDTO> groupDTOList = storeGroupService.listStoreGroupAndChildren(v.toArray(new String[]{}), k);
List<TabHaobanPreDealLog> dealList = groupDTOList.stream().map(storeGroupDTO -> {
TabHaobanPreDealLog dealLog = new TabHaobanPreDealLog();
dealLog.setDataId(storeGroupDTO.getStoreGroupId());
if (pMap.containsKey(storeGroupDTO.getStoreGroupId())) {
dealLog.setpDataId(pMap.get(storeGroupDTO.getStoreGroupId()));
} else {
dealLog.setpDataId(storeGroupDTO.getParentGroupId());
}
dealLog.setDataType(PreDealTypeEnum.group.getVal());
dealLog.setStatusFlag(0);
dealLog.setTaskId(taskId);
dealLog.setEnterpriseId(storeGroupDTO.getEnterpriseId());
dealLog.setWxEnterpriseId(wxEnterpriseId);
return dealLog;
}).collect(Collectors.toList());
preDealService.insert(dealList);
});
//处理门店信息
List<TabHaobanPreDealLog> storeList = addList.stream().filter(dto -> {
return dto.getStoreFlag() == 1;
}).map(dto -> {
TabHaobanPreDealLog dealLog = new TabHaobanPreDealLog();
dealLog.setDataId(dto.getRelatedId());
dealLog.setpDataId(dto.getParentDepartmentId());
dealLog.setDataType(1);
dealLog.setStatusFlag(0);
dealLog.setTaskId(taskId);
dealLog.setWxEnterpriseId(wxEnterpriseId);
return dealLog;
}).collect(Collectors.toList());
preDealService.insert(storeList);
}
/**
* 初始化部门
*
* @param taskId
* @param wxEnterpriseId
* @param addList
*/
private void dealDepartmentInit(String taskId, String wxEnterpriseId, List<SyncSingleDealDTO> addList) {
Set<String> addListMid = addList.stream().filter(dto -> dto.getStoreFlag().equals(0)).map(dto -> dto.getRelatedId()).collect(Collectors.toSet());
if (CollectionUtils.isNotEmpty(addListMid)) {
dealDepartmentToMq(taskId, addListMid, SyncTaskStatusEnum.group_sync);
} else {
addListMid = addList.stream().filter(dto -> dto.getStoreFlag().equals(1)).map(dto -> dto.getRelatedId()).collect(Collectors.toSet());
dealDepartmentToMq(taskId, addListMid, SyncTaskStatusEnum.store_sync);
}
}
/**
* 放入mq处理部门数据
*
* @param taskId
* @param dealList
*/
private void dealDepartmentToMq(String taskId, Set<String> dealList, SyncTaskStatusEnum syncTaskStatusEnum) {
//预处理分组任务
syncTaskService.updateTaskStatus(taskId, syncTaskStatusEnum.getVal());
dealList.forEach(relationId -> {
DealParamMqDTO dealParamMqDTO = new DealParamMqDTO();
dealParamMqDTO.setTaskId(taskId);
dealParamMqDTO.setData(relationId);
dealParamMqDTO.setType(syncTaskStatusEnum.getVal());
GicMQClient clientInstance = GICMQClientUtil.getClientInstance();
try {
clientInstance.sendMessage("departmentSyncDealMq", JSONObject.toJSONString(dealParamMqDTO));
} catch (Exception e) {
logger.info("发送失败:{},{}", taskId, relationId);
e.printStackTrace();
}
});
}
public String lockTask(String wxEnterpriseId, String taskId) {
String key = LOCK_KEY + wxEnterpriseId;
Object cache = RedisUtil.getCache(key);
if (null == cache) {
RedisUtil.setCache(key, taskId, 5L, TimeUnit.DAYS);
return taskId;
}
return null;
}
@Override
public boolean closeTask(String wxEnterpriseId) {
String taskId = getTaskLock(wxEnterpriseId);
if (taskId != null) {
syncTaskService.updateTaskStatus(taskId, SyncTaskStatusEnum.exception_close.getVal());
unlockTask(wxEnterpriseId);
}
return true;
}
@Override
public void unlockTask(String wxEnterpriseId) {
String key = LOCK_KEY + wxEnterpriseId;
RedisUtil.delCache(key);
}
@Override
public String getTaskLock(String wxEnterpriseId) {
String key = LOCK_KEY + wxEnterpriseId;
return (String) RedisUtil.getCache(key);
}
@Override
public SyncCheckDTO getTaskCheck(String wxEnterpriseId) {
String taskId = getTaskLock(wxEnterpriseId);
SyncCheckDTO syncCheckDTO = new SyncCheckDTO();
if (null == taskId) {
return syncCheckDTO;
}
TabHaobanSyncTask syncTask = syncTaskService.getSyncTask(taskId);
syncCheckDTO.setSyncStatus(syncTask.getStatusFlag());
int totalCount = preDealService.countByTaskId(taskId, -1, -1);
int groupErrCount = preDealService.countByTaskId(taskId, PreDealTypeEnum.group.getVal(), PreDealStatusEnum.exception.getVal());
int storeErrCount = preDealService.countByTaskId(taskId, PreDealTypeEnum.store.getVal(), PreDealStatusEnum.exception.getVal());
int clerkErrCount = preDealService.countByTaskId(taskId, PreDealTypeEnum.clerk.getVal(), PreDealStatusEnum.exception.getVal());
int preCount = preDealService.countByTaskId(taskId, -1, PreDealStatusEnum.pre.getVal());
syncCheckDTO.setTotalDeal(totalCount);
syncCheckDTO.setGroupErrCount(groupErrCount);
syncCheckDTO.setStoreErrCount(storeErrCount);
syncCheckDTO.setStaffErrCount(clerkErrCount);
syncCheckDTO.setHasDeal(totalCount - preCount);
return syncCheckDTO;
}
}
...@@ -93,7 +93,7 @@ public class DepartmentApiServiceImpl implements DepartmentApiService { ...@@ -93,7 +93,7 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
} }
@Override @Override
public ServiceResponse add(DepartmentDTO department) { public ServiceResponse<DepartmentDTO> add(DepartmentDTO department) {
ServiceResponse hr = new ServiceResponse(); ServiceResponse hr = new ServiceResponse();
hr.setCode(1); hr.setCode(1);
//调微信的新增接口 //调微信的新增接口
......
...@@ -119,8 +119,11 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -119,8 +119,11 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
log.info("staff关联门店不存在1"); log.info("staff关联门店不存在1");
return null; return null;
} }
List<String> storeIds = stores.stream().map(s->s.getRelatedId()).collect(Collectors.toList()); List<String> storeIds = stores.stream().filter(s->(s.getRelatedId()!=null || "".equals(s.getRelatedId()))).map(s->s.getRelatedId()).collect(Collectors.toList());
if(CollectionUtil.isEmpty(storeIds)){
log.info("staff关联门店不存在2");
return null;
}
//2、获取member的storeId //2、获取member的storeId
for(MemberUnionidRelated tab : list){ for(MemberUnionidRelated tab : list){
String memberId = tab.getMemberId(); String memberId = tab.getMemberId();
...@@ -157,15 +160,23 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -157,15 +160,23 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
} }
String[] memberStoreIds =storeId.split(" "); String[] memberStoreIds =storeId.split(" ");
List<String> memberStoreIdList = Arrays.asList(memberStoreIds); List<String> memberStoreIdList = Arrays.asList(memberStoreIds);
//取交集
memberStoreIdList.retainAll(storeIds);
if(CollectionUtil.isEmpty(memberStoreIdList)){ if(CollectionUtil.isEmpty(memberStoreIdList)){
log.info("会员门店不存在");
continue;
}
log.info("memberStoreIdList===============>{}",JSONObject.toJSONString(memberStoreIdList));
log.info("storeIds===============>{}",JSONObject.toJSONString(storeIds));
//取交集(解决不支持的报错现象)
List list3= new ArrayList(memberStoreIdList);
List list4= new ArrayList(storeIds);
list3.retainAll(list4);
if(CollectionUtil.isEmpty(list3)){
continue; continue;
}else{ }else{
for(String resultStoreId : memberStoreIdList){ for(Object resultStoreId : list3){
MemberStoreDTO dto = new MemberStoreDTO(); MemberStoreDTO dto = new MemberStoreDTO();
dto.setMemberId(memberId); dto.setMemberId(memberId);
dto.setStoreId(resultStoreId); dto.setStoreId(resultStoreId.toString());
result.add(dto); result.add(dto);
} }
......
...@@ -215,7 +215,7 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -215,7 +215,7 @@ public class StaffApiServiceImpl implements StaffApiService {
@Override @Override
public void del(String staffDepartmentStaffRelatedId) { public void del(String staffDepartmentStaffRelatedId) {
StaffDepartmentRelatedDTO related = staffDepartmentRelatedService.selectById(staffDepartmentStaffRelatedId); StaffDepartmentRelatedDTO related = staffDepartmentRelatedService.getById(staffDepartmentStaffRelatedId);
if(related != null) { if(related != null) {
List<TabHaobanStaffDepartmentRelated> relatedList = staffDepartmentRelatedService.listStaffDepartmentByStaffId(related.getStaffId()); List<TabHaobanStaffDepartmentRelated> relatedList = staffDepartmentRelatedService.listStaffDepartmentByStaffId(related.getStaffId());
if(relatedList == null || relatedList.isEmpty()){ if(relatedList == null || relatedList.isEmpty()){
...@@ -436,6 +436,7 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -436,6 +436,7 @@ public class StaffApiServiceImpl implements StaffApiService {
} }
ClerkDTO clerkDTO= clerkService.getClerkByCodeNoStatus(enterpriseId,related.getClerkCode()); ClerkDTO clerkDTO= clerkService.getClerkByCodeNoStatus(enterpriseId,related.getClerkCode());
//if(!staffDTO.getPhoneNumber().equals(related.getPhoneNumber())||!staffDTO.getStaffName().equals(clerkDTO.getStaffName())){ //if(!staffDTO.getPhoneNumber().equals(related.getPhoneNumber())||!staffDTO.getStaffName().equals(clerkDTO.getStaffName())){
logger.info("clerkDto:{}", JSONObject.toJSONString(clerkDTO));
String headPic = staffDTO.getHeadImg(); String headPic = staffDTO.getHeadImg();
if(clerkDTO != null && (StringUtils.isNotBlank(staffName) && !clerkDTO.getClerkName().equals(staffName) || !staffDTO.getPhoneNumber().equals(clerkDTO.getPhoneNumber())) if(clerkDTO != null && (StringUtils.isNotBlank(staffName) && !clerkDTO.getClerkName().equals(staffName) || !staffDTO.getPhoneNumber().equals(clerkDTO.getPhoneNumber()))
|| (org.apache.commons.lang3.StringUtils.isNotBlank(headPic) && !headPic.equals(clerkDTO.getImageUrl())) || (org.apache.commons.lang3.StringUtils.isNotBlank(headPic) && !headPic.equals(clerkDTO.getImageUrl()))
......
package com.gic.haoban.manage.service.task;
import com.gic.haoban.manage.api.dto.DealParamMqDTO;
import com.gic.haoban.manage.service.entity.TabHaobanPreDealLog;
/**
* Created 2020/4/13.
*
* @author hua
*/
public interface BaseSyncOperation {
/**
* 处理单条数据
*
* @param dealParamMqDTO
*/
public abstract void dealSingleByMq(DealParamMqDTO dealParamMqDTO, TabHaobanPreDealLog dataPre);
/**
* 单条处理异常
*
* @param taskId
* @param dataId
* @param enterpriseId
* @param reason
*/
public abstract void dealException(String taskId, String dataId, String enterpriseId, String reason);
/**
* 单条处理成功
*
* @param taskId
* @param dataId
* @param wxEnterpriseId
*/
public abstract void dealSuccess(String taskId, String dataId, String enterpriseId, String wxEnterpriseId);
public void checkDepartmentTask(String taskId);
}
package com.gic.haoban.manage.service.task;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.dto.ClerkListDTO;
import com.gic.clerk.api.service.ClerkService;
import com.gic.commons.util.GICMQClientUtil;
import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.enterprise.api.service.StoreGroupService;
import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.base.api.common.Constant;
import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.manage.api.dto.*;
import com.gic.haoban.manage.api.enums.PreDealStatusEnum;
import com.gic.haoban.manage.api.enums.PreDealTypeEnum;
import com.gic.haoban.manage.api.enums.SyncTaskStatusEnum;
import com.gic.haoban.manage.api.service.DealSyncOperationApiService;
import com.gic.haoban.manage.api.service.DepartmentApiService;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.service.entity.TabHaobanDepartment;
import com.gic.haoban.manage.service.entity.TabHaobanPreDealLog;
import com.gic.haoban.manage.service.entity.TabHaobanSyncTask;
import com.gic.haoban.manage.service.service.DepartmentService;
import com.gic.haoban.manage.service.service.PreDealService;
import com.gic.haoban.manage.service.service.StaffService;
import com.gic.haoban.manage.service.service.SyncTaskService;
import com.gic.mq.sdk.GicMQClient;
import com.gic.redis.data.util.RedisUtil;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
/**
* Created 2020/4/13.
*
* @author hua
*/
@Service
public class ClerkSyncOperation implements BaseSyncOperation {
private static final Logger logger = LoggerFactory.getLogger(ClerkSyncOperation.class);
@Autowired
private DepartmentService departmentService;
@Autowired
private StoreGroupService storeGroupService;
@Autowired
private PreDealService preDealService;
@Autowired
private DepartmentApiService departmentApiService;
@Autowired
private SyncTaskService syncTaskService;
@Autowired
private StoreService storeService;
@Autowired
private ClerkService clerkService;
@Autowired
private StaffApiService staffApiService;
@Autowired
private DealSyncOperationApiService dealSyncOperationApiService;
@Override
public void dealSingleByMq(DealParamMqDTO dealParamMqDTO, TabHaobanPreDealLog dataPre) {
logger.info("成员处理:{}", JSONObject.toJSONString(dealParamMqDTO));
ClerkDTO clerkDTO = clerkService.getClerkByClerkId(dealParamMqDTO.getData());
boolean dealFlag = true;
if (clerkDTO == null) {
logger.info("成员不存在:t:{},d:{}", dealParamMqDTO.getTaskId(), dealParamMqDTO.getData());
dealException(dealParamMqDTO.getTaskId(), dealParamMqDTO.getData(), dataPre.getEnterpriseId(), "成员不存在");
return;
}
//处理clerk
try {
GicClerkDTO gicClerkDTO = new GicClerkDTO();
gicClerkDTO.setNationcode(clerkDTO.getNationcode());
gicClerkDTO.setClerkCode(clerkDTO.getClerkCode());
gicClerkDTO.setPostionName(clerkDTO.getPositionName());
gicClerkDTO.setHeadImgUrl(clerkDTO.getHeadImgUrl());
gicClerkDTO.setPhoneNumber(clerkDTO.getPhoneNumber());
gicClerkDTO.setStatus(clerkDTO.getStatus());
if (!StringUtils.isBlank(clerkDTO.getClerkGender())) {
gicClerkDTO.setClerkGender(Integer.valueOf(clerkDTO.getClerkGender()));
}
gicClerkDTO.setClerkName(clerkDTO.getClerkName());
gicClerkDTO.setStoreId(clerkDTO.getStoreId());
gicClerkDTO.setEnterpriseId(clerkDTO.getEnterpriseId());
staffApiService.addGicClerk(gicClerkDTO);
} catch (Exception e) {
e.printStackTrace();
logger.info("同步失败:", JSONObject.toJSONString(dataPre));
dealFlag = false;
} finally {
if (!dealFlag) {
dealException(dealParamMqDTO.getTaskId(), dealParamMqDTO.getData(), dataPre.getEnterpriseId(), "成员处理异常");
} else {
dealSuccess(dealParamMqDTO.getTaskId(), dealParamMqDTO.getData(), dataPre.getEnterpriseId(), dataPre.getWxEnterpriseId());
}
}
}
@Override
public void dealException(String taskId, String dataId, String enterpriseId, String reason) {
logger.info("成员处理失败:t:{},d:{}", taskId, dataId);
boolean b = preDealService.updateStatusByDataId(taskId, dataId, PreDealStatusEnum.exception.getVal(), reason);
if (!b) {
logger.info("成员处理异常:t:{}, d:{}", taskId, dataId);
return;
}
checkDepartmentTask(taskId);
}
@Override
public void dealSuccess(String taskId, String dataId, String enterpriseId, String wxEnterpriseId) {
logger.info("成员处理成功:t:{},d:{}", taskId, dataId);
boolean b = preDealService.updateStatusByDataId(taskId, dataId, PreDealStatusEnum.computed.getVal(), "成功");
if (!b) {
logger.info("成功修改错误!{}", dataId);
return;
}
checkDepartmentTask(taskId);
}
@Override
public void checkDepartmentTask(String taskId) {
boolean b = preDealService.checkTask(taskId, PreDealTypeEnum.clerk.getVal());
if (!b) {
return;
}
logger.info("店员同步成功:{}", taskId);
String key = "haoban_sync_clerk_task_" + taskId;
RedisUtil.lock(key, 3L);
TabHaobanSyncTask syncTask = syncTaskService.getSyncTask(taskId);
//同步成功 进入门店处理
if (syncTask.getStatusFlag().equals(SyncTaskStatusEnum.clerk_sync.getVal())) {
int errCount = preDealService.countByTaskId(taskId, -1, PreDealStatusEnum.exception.getVal());
if (errCount > 0) {
syncTaskService.updateTaskStatus(taskId, SyncTaskStatusEnum.exception_compute.getVal());
} else {
syncTaskService.updateTaskStatus(taskId, SyncTaskStatusEnum.compute.getVal());
dealSyncOperationApiService.unlockTask(syncTask.getWxEnterpriseId());
}
}
RedisUtil.unlock(key);
}
}
package com.gic.haoban.manage.service.task;
import com.alibaba.fastjson.JSONObject;
import com.gic.commons.util.GICMQClientUtil;
import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.enterprise.api.dto.StoreGroupDTO;
import com.gic.enterprise.api.service.StoreGroupService;
import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.base.api.common.Constant;
import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.manage.api.dto.DealParamMqDTO;
import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.api.enums.PreDealStatusEnum;
import com.gic.haoban.manage.api.enums.PreDealTypeEnum;
import com.gic.haoban.manage.api.enums.SyncTaskStatusEnum;
import com.gic.haoban.manage.api.service.DepartmentApiService;
import com.gic.haoban.manage.service.entity.TabHaobanDepartment;
import com.gic.haoban.manage.service.entity.TabHaobanPreDealLog;
import com.gic.haoban.manage.service.entity.TabHaobanSyncTask;
import com.gic.haoban.manage.service.service.DepartmentService;
import com.gic.haoban.manage.service.service.PreDealService;
import com.gic.haoban.manage.service.service.SyncTaskService;
import com.gic.mq.sdk.GicMQClient;
import com.gic.redis.data.util.RedisUtil;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
* Created 2020/4/13.
*
* @author hua
*/
@Service
public class GroupSyncOperation implements BaseSyncOperation {
private static final Logger logger = LoggerFactory.getLogger(GroupSyncOperation.class);
@Autowired
private DepartmentService departmentService;
@Autowired
private StoreGroupService storeGroupService;
@Autowired
private PreDealService preDealService;
@Autowired
private DepartmentApiService departmentApiService;
@Autowired
private SyncTaskService syncTaskService;
@Autowired
private StoreService storeService;
@Override
public void dealSingleByMq(DealParamMqDTO dealParamMqDTO, TabHaobanPreDealLog dataPre) {
logger.info("处理单条部门分组:{}", JSONObject.toJSONString(dealParamMqDTO));
DepartmentDTO departmentDTO = departmentApiService.selectByRelatedId(dataPre.getDataId());
if (departmentDTO != null) {
logger.info("已经同步过了:{}", dataPre.getDataId());
dealException(dealParamMqDTO.getTaskId(), dealParamMqDTO.getData(), dataPre.getEnterpriseId(), dealParamMqDTO.getData() + ":该部门不存在");
return;
}
TabHaobanDepartment pParentDepartment = departmentService.selectByRelatedId(dataPre.getpDataId());
if (null == pParentDepartment) {
pParentDepartment = departmentService.selectById(dataPre.getpDataId());
}
if (null == pParentDepartment) {
logger.info("不存在该父部门:c:{},p:{}", dataPre.getDataId(), dataPre.getpDataId());
return;
}
StoreGroupDTO groupDTO = storeGroupService.getStoreGroupById(dealParamMqDTO.getData());
if (null == groupDTO) {
logger.info("该部门不存在");
dealException(dealParamMqDTO.getTaskId(), dealParamMqDTO.getData(), dataPre.getEnterpriseId(), dealParamMqDTO.getData() + ":该部门不存在");
return;
}
DepartmentDTO department = new DepartmentDTO();
department.setParentDepartmentId(pParentDepartment.getDepartmentId());
department.setWxEnterpriseId(pParentDepartment.getWxEnterpriseId());
department.setDepartmentName(groupDTO.getStoreGroupName());
department.setChainId(pParentDepartment.getChainId() + Constant.ID_SEPARATOR + dealParamMqDTO.getData());
department.setChainName(pParentDepartment.getChainName() + Constant.NAME_SEPARATOR + department.getDepartmentName());
department.setIsStore(0);
department.setLevel(pParentDepartment.getLevel() + 1);
department.setRelatedId(dealParamMqDTO.getData());
department.setSort(groupDTO.getStoreGroupSort());
//状态 处理状态
boolean resultFlag = true;
try {
ServiceResponse add = departmentApiService.add(department);
if (add.getCode() != 1) {
resultFlag = false;
logger.info("处理失败");
return;
}
} catch (Exception e) {
resultFlag = false;
e.printStackTrace();
logger.info("处理异常");
} finally {
if (!resultFlag) {
dealException(dealParamMqDTO.getTaskId(), dealParamMqDTO.getData(), dataPre.getEnterpriseId(), "处理异常或失败");
} else {
dealSuccess(dealParamMqDTO.getTaskId(), dealParamMqDTO.getData(), dataPre.getEnterpriseId(), dataPre.getWxEnterpriseId());
}
}
}
@Override
public void dealException(String taskId, String dataId, String enterpriseId, String reason) {
List<String> ids = storeGroupService.getStoreGroupIdsByParentId(enterpriseId, dataId);
if (CollectionUtils.isEmpty(ids)) {
logger.info("下面层级不存在");
//todo 是否需要加锁判断
return;
}
//todo 需要优化 测试
for (String id : ids) {
preDealService.updateStatusByDataId(taskId, id, PreDealStatusEnum.exception.getVal(), reason);
}
checkDepartmentTask(taskId);
}
@Override
public void dealSuccess(String taskId, String dataId, String enterpriseId, String wxEnterpriseId) {
boolean b = preDealService.updateStatusByDataId(taskId, dataId, PreDealStatusEnum.computed.getVal(), "成功");
if (!b) {
logger.info("成功修改错误!{}", dataId);
return;
}
List<StoreDTO> storeDTOS = storeService.listStoreByStoreGroupId(dataId);
//预处理门店 写入预处理表
if (CollectionUtils.isNotEmpty(storeDTOS)) {
List<TabHaobanPreDealLog> preDealLogList = storeDTOS.stream().map(storeDTO -> {
TabHaobanPreDealLog dealLog = new TabHaobanPreDealLog();
dealLog.setDataId(storeDTO.getStoreId());
dealLog.setpDataId(dataId);
dealLog.setDataType(PreDealTypeEnum.store.getVal());
dealLog.setStatusFlag(0);
dealLog.setTaskId(taskId);
dealLog.setEnterpriseId(storeDTO.getEnterpriseId());
dealLog.setWxEnterpriseId(wxEnterpriseId);
dealLog.setEnterpriseId(enterpriseId);
return dealLog;
}).collect(Collectors.toList());
preDealService.insert(preDealLogList);
}
List<TabHaobanPreDealLog> list = preDealService.listByPDataId(taskId, dataId, PreDealStatusEnum.pre.getVal());
if (CollectionUtils.isNotEmpty(list)) {
Set<String> mid = list.stream().map(tab -> tab.getDataId()).collect(Collectors.toSet());
dealDepartmentToMq(taskId, mid, SyncTaskStatusEnum.group_sync);
} else {
checkDepartmentTask(taskId);
}
}
@Override
public void checkDepartmentTask(String taskId) {
boolean b = preDealService.checkTask(taskId, PreDealTypeEnum.group.getVal());
if (!b) {
return;
}
logger.info("部门继续成功,开始门店同步:{}", taskId);
String key = "haoban_sync_department_task_" + taskId;
RedisUtil.lock(key, 3L);
TabHaobanSyncTask syncTask = syncTaskService.getSyncTask(taskId);
//同步成功 进入门店处理
if (syncTask.getStatusFlag().equals(SyncTaskStatusEnum.group_sync.getVal())) {
syncTaskService.updateTaskStatus(taskId, SyncTaskStatusEnum.store_sync.getVal());
List<TabHaobanPreDealLog> dealLogs = preDealService.listByTaskId(taskId, PreDealTypeEnum.store.getVal(), PreDealStatusEnum.pre.getVal());
if (CollectionUtils.isEmpty(dealLogs)) {
syncTaskService.updateTaskStatus(taskId, SyncTaskStatusEnum.compute.getVal());
} else {
logger.info("处理门店开始");
Set<String> dataIds = dealLogs.stream().map(TabHaobanPreDealLog::getDataId).collect(Collectors.toSet());
dealDepartmentToMq(taskId, dataIds, SyncTaskStatusEnum.store_sync);
}
}
RedisUtil.unlock(key);
}
/**
* 放入mq处理部门数据
*
* @param taskId
* @param dealList
*/
private void dealDepartmentToMq(String taskId, Set<String> dealList, SyncTaskStatusEnum syncTaskStatusEnum) {
//预处理分组任务
syncTaskService.updateTaskStatus(taskId, syncTaskStatusEnum.getVal());
dealList.forEach(relationId -> {
DealParamMqDTO dealParamMqDTO = new DealParamMqDTO();
dealParamMqDTO.setTaskId(taskId);
dealParamMqDTO.setData(relationId);
dealParamMqDTO.setType(syncTaskStatusEnum.getVal());
GicMQClient clientInstance = GICMQClientUtil.getClientInstance();
try {
clientInstance.sendMessage("departmentSyncDealMq", JSONObject.toJSONString(dealParamMqDTO));
} catch (Exception e) {
logger.info("发送失败:{},{}", taskId, relationId);
e.printStackTrace();
}
});
}
}
package com.gic.haoban.manage.service.task;
import com.alibaba.fastjson.JSONObject;
import com.gic.clerk.api.dto.ClerkListDTO;
import com.gic.clerk.api.service.ClerkService;
import com.gic.commons.util.GICMQClientUtil;
import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.enterprise.api.dto.StoreGroupDTO;
import com.gic.enterprise.api.service.StoreGroupService;
import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.base.api.common.Constant;
import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.manage.api.dto.DealParamMqDTO;
import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.api.enums.PreDealStatusEnum;
import com.gic.haoban.manage.api.enums.PreDealTypeEnum;
import com.gic.haoban.manage.api.enums.SyncTaskStatusEnum;
import com.gic.haoban.manage.api.service.DepartmentApiService;
import com.gic.haoban.manage.service.entity.TabHaobanDepartment;
import com.gic.haoban.manage.service.entity.TabHaobanPreDealLog;
import com.gic.haoban.manage.service.entity.TabHaobanSyncTask;
import com.gic.haoban.manage.service.service.DepartmentService;
import com.gic.haoban.manage.service.service.PreDealService;
import com.gic.haoban.manage.service.service.SyncTaskService;
import com.gic.mq.sdk.GicMQClient;
import com.gic.redis.data.util.RedisUtil;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
* Created 2020/4/13.
*
* @author hua
*/
@Service
public class StoreSyncOperation implements BaseSyncOperation {
private static final Logger logger = LoggerFactory.getLogger(StoreSyncOperation.class);
@Autowired
private DepartmentService departmentService;
@Autowired
private StoreGroupService storeGroupService;
@Autowired
private PreDealService preDealService;
@Autowired
private DepartmentApiService departmentApiService;
@Autowired
private SyncTaskService syncTaskService;
@Autowired
private StoreService storeService;
@Autowired
private ClerkService clerkService;
@Override
public void dealSingleByMq(DealParamMqDTO dealParamMqDTO, TabHaobanPreDealLog dataPre) {
logger.info("处理单条门店:{}", JSONObject.toJSONString(dealParamMqDTO));
DepartmentDTO departmentDTO = departmentApiService.selectByRelatedId(dataPre.getDataId());
if (departmentDTO != null) {
logger.info("已经同步过了:{}", dataPre.getDataId());
dealException(dealParamMqDTO.getTaskId(), dealParamMqDTO.getData(), dataPre.getEnterpriseId(), "该部门不存在");
return;
}
TabHaobanDepartment pParentDepartment = departmentService.selectByRelatedId(dataPre.getpDataId());
if (null == pParentDepartment) {
logger.info("不存在该父部门:c:{},p:{}", dataPre.getDataId(), dataPre.getpDataId());
return;
}
StoreDTO storeDTO = storeService.getStore(dealParamMqDTO.getData());
if (null == storeDTO) {
logger.info("该部门不存在");
dealException(dealParamMqDTO.getTaskId(), dealParamMqDTO.getData(), dataPre.getEnterpriseId(), "该部门不存在");
return;
}
DepartmentDTO department = new DepartmentDTO();
department.setParentDepartmentId(pParentDepartment.getDepartmentId());
department.setWxEnterpriseId(pParentDepartment.getWxEnterpriseId());
department.setDepartmentName(storeDTO.getStoreName());
department.setChainId(pParentDepartment.getChainId() + Constant.ID_SEPARATOR + dealParamMqDTO.getData());
department.setChainName(pParentDepartment.getChainName() + Constant.NAME_SEPARATOR + department.getDepartmentName());
department.setIsStore(1);
department.setLevel(pParentDepartment.getLevel() + 1);
department.setRelatedId(dealParamMqDTO.getData());
//状态 处理状态
boolean resultFlag = true;
try {
ServiceResponse add = departmentApiService.add(department);
if (add.getCode() != 1) {
resultFlag = false;
logger.info("处理失败");
return;
}
} catch (Exception e) {
resultFlag = false;
e.printStackTrace();
logger.info("处理异常");
} finally {
if (!resultFlag) {
dealException(dealParamMqDTO.getTaskId(), dealParamMqDTO.getData(), dataPre.getEnterpriseId(), "处理异常或失败");
} else {
dealSuccess(dealParamMqDTO.getTaskId(), dealParamMqDTO.getData(), dataPre.getEnterpriseId(), dataPre.getWxEnterpriseId());
}
}
}
@Override
public void dealException(String taskId, String dataId, String enterpriseId, String reason) {
//处理异常
preDealService.updateStatusByDataId(taskId, dataId, PreDealStatusEnum.exception.getVal(), reason);
checkDepartmentTask(taskId);
}
@Override
public void dealSuccess(String taskId, String dataId, String enterpriseId, String wxEnterpriseId) {
boolean b = preDealService.updateStatusByDataId(taskId, dataId, PreDealStatusEnum.computed.getVal(), "成功");
if (!b) {
logger.info("成功修改错误!{}", dataId);
return;
}
List<ClerkListDTO> clerks = clerkService.getClerkByStoreId(enterpriseId, dataId);
logger.info("导入clerk:{},{},{}", enterpriseId, dataId, JSONObject.toJSONString(clerks));
//预处理门店 写入预处理表
if (CollectionUtils.isNotEmpty(clerks)) {
List<TabHaobanPreDealLog> preDealLogList = clerks.stream().map(clerkMid -> {
TabHaobanPreDealLog dealLog = new TabHaobanPreDealLog();
dealLog.setDataId(clerkMid.getClerkId());
dealLog.setpDataId(dataId);
dealLog.setDataType(PreDealTypeEnum.clerk.getVal());
dealLog.setStatusFlag(0);
dealLog.setTaskId(taskId);
dealLog.setEnterpriseId(clerkMid.getEnterpriseId());
dealLog.setWxEnterpriseId(wxEnterpriseId);
return dealLog;
}).collect(Collectors.toList());
preDealService.insert(preDealLogList);
}
checkDepartmentTask(taskId);
}
@Override
public void checkDepartmentTask(String taskId) {
boolean b = preDealService.checkTask(taskId, PreDealTypeEnum.store.getVal());
if (!b) {
return;
}
logger.info("门店继续成功,成员同步:{}", taskId);
String key = "haoban_sync_store_task_" + taskId;
RedisUtil.lock(key, 3L);
TabHaobanSyncTask syncTask = syncTaskService.getSyncTask(taskId);
//同步成功 进入门店处理
if (syncTask.getStatusFlag().equals(SyncTaskStatusEnum.store_sync.getVal())) {
syncTaskService.updateTaskStatus(taskId, SyncTaskStatusEnum.clerk_sync.getVal());
//是否有成员 需要处理
List<TabHaobanPreDealLog> dealLogs = preDealService.listByTaskId(taskId, PreDealTypeEnum.clerk.getVal(), PreDealStatusEnum.pre.getVal());
if (CollectionUtils.isEmpty(dealLogs)) {
syncTaskService.updateTaskStatus(taskId, SyncTaskStatusEnum.compute.getVal());
} else {
logger.info("处理成员开始");
Set<String> dataIds = dealLogs.stream().map(TabHaobanPreDealLog::getDataId).collect(Collectors.toSet());
dealDepartmentToMq(taskId, dataIds, SyncTaskStatusEnum.clerk_sync);
}
}
RedisUtil.unlock(key);
}
/**
* 放入mq处理部门数据
*
* @param taskId
* @param dealList
*/
private void dealDepartmentToMq(String taskId, Set<String> dealList, SyncTaskStatusEnum syncTaskStatusEnum) {
//预处理分组任务
syncTaskService.updateTaskStatus(taskId, syncTaskStatusEnum.getVal());
dealList.forEach(relationId -> {
DealParamMqDTO dealParamMqDTO = new DealParamMqDTO();
dealParamMqDTO.setTaskId(taskId);
dealParamMqDTO.setData(relationId);
dealParamMqDTO.setType(syncTaskStatusEnum.getVal());
GicMQClient clientInstance = GICMQClientUtil.getClientInstance();
try {
clientInstance.sendMessage("departmentSyncDealMq", JSONObject.toJSONString(dealParamMqDTO));
} catch (Exception e) {
logger.info("发送失败:{},{}", taskId, relationId);
e.printStackTrace();
}
});
}
}
...@@ -36,10 +36,15 @@ ...@@ -36,10 +36,15 @@
<dubbo:service interface="com.gic.haoban.manage.api.service.AuditSettingApiService" ref="auditSettingApiServiceImpl" timeout="10000"/> <dubbo:service interface="com.gic.haoban.manage.api.service.AuditSettingApiService" ref="auditSettingApiServiceImpl" timeout="10000"/>
<dubbo:service interface="com.gic.haoban.manage.api.service.DictApiService" ref="dictApiServiceImpl" timeout="10000"/> <dubbo:service interface="com.gic.haoban.manage.api.service.DictApiService" ref="dictApiServiceImpl" timeout="10000"/>
<dubbo:service interface="com.gic.haoban.manage.api.service.AuditApiService" ref="auditApiServiceImpl" timeout="10000"/> <dubbo:service interface="com.gic.haoban.manage.api.service.AuditApiService" ref="auditApiServiceImpl" timeout="10000"/>
<dubbo:service interface="com.gic.haoban.manage.api.service.ClerkMainStoreRelatedApiService" ref="clerkMainStoreRelatedApiServiceImpl" timeout="10000"/>
<dubbo:service interface="com.gic.haoban.manage.api.service.DealSyncOperationApiService"
ref="dealSyncOperationApiServiceImpl" timeout="10000"/>
<dubbo:reference interface="com.gic.enterprise.api.service.DepartmentService" id="gicDepartmentService"/> <dubbo:reference interface="com.gic.enterprise.api.service.DepartmentService" id="gicDepartmentService"/>
<dubbo:reference interface="com.gic.wechat.api.service.qywx.QywxDepartmentApiService" id="qywxDepartmentApiService"/> <dubbo:reference interface="com.gic.wechat.api.service.qywx.QywxDepartmentApiService" id="qywxDepartmentApiService"/>
<dubbo:reference interface="com.gic.wechat.api.service.qywx.QywxSuiteApiService" id="qywxSuiteApiService"/>
<dubbo:reference interface="com.gic.wechat.api.service.qywx.QywxUserApiService" id="qywxUserApiService"/> <dubbo:reference interface="com.gic.wechat.api.service.qywx.QywxUserApiService" id="qywxUserApiService"/>
<dubbo:reference interface="com.gic.enterprise.api.service.StoreGroupService" id="storeGroupService"/> <dubbo:reference interface="com.gic.enterprise.api.service.StoreGroupService" id="storeGroupService"/>
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gic.haoban.manage.service.dao.mapper.PreDealLogMapper">
<resultMap id="BaseResultMap" type="com.gic.haoban.manage.service.entity.TabHaobanPreDealLog">
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="wx_enterprise_id" jdbcType="VARCHAR" property="wxEnterpriseId"/>
<result column="enterprise_id" jdbcType="VARCHAR" property="enterpriseId"/>
<result column="data_id" jdbcType="VARCHAR" property="dataId"/>
<result column="p_data_id" jdbcType="VARCHAR" property="pDataId"/>
<result column="task_id" jdbcType="VARCHAR" property="taskId"/>
<result column="data_type" jdbcType="INTEGER" property="dataType"/>
<result column="status_flag" jdbcType="INTEGER" property="statusFlag"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
</resultMap>
<sql id="Base_Column_List">
id, wx_enterprise_id,enterprise_id, data_id, p_data_id, task_id, data_type, status_flag, create_time,
update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_pre_deal_log
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tab_haoban_pre_deal_log
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.gic.haoban.manage.service.entity.TabHaobanPreDealLog">
insert into tab_haoban_pre_deal_log ( wx_enterprise_id,enterprise_id, data_id,
p_data_id, task_id, data_type,
status_flag, create_time, update_time
)
values (#{wxEnterpriseId,jdbcType=VARCHAR},#{enterpriseId,jdbcType=VARCHAR}, #{dataId,jdbcType=VARCHAR},
#{pDataId,jdbcType=VARCHAR}, #{taskId,jdbcType=VARCHAR}, #{dataType,jdbcType=INTEGER},
#{statusFlag,jdbcType=INTEGER}, now(), now()
)
</insert>
<insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanPreDealLog">
insert into tab_haoban_pre_deal_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="wxEnterpriseId != null">
wx_enterprise_id,
</if>
<if test="enterpriseId != null">
enterprise_id,
</if>
<if test="dataId != null">
data_id,
</if>
<if test="pDataId != null">
p_data_id,
</if>
<if test="taskId != null">
task_id,
</if>
<if test="dataType != null">
data_type,
</if>
<if test="statusFlag != null">
status_flag,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="wxEnterpriseId != null">
#{wxEnterpriseId,jdbcType=VARCHAR},
</if>
<if test="enterpriseId != null">
#{enterpriseId,jdbcType=VARCHAR},
</if>
<if test="dataId != null">
#{dataId,jdbcType=VARCHAR},
</if>
<if test="pDataId != null">
#{pDataId,jdbcType=VARCHAR},
</if>
<if test="taskId != null">
#{taskId,jdbcType=VARCHAR},
</if>
<if test="dataType != null">
#{dataType,jdbcType=INTEGER},
</if>
<if test="statusFlag != null">
#{statusFlag,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanPreDealLog">
update tab_haoban_pre_deal_log
<set>
<if test="wxEnterpriseId != null">
wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
</if>
<if test="enterpriseId != null">
enterprise_id = #{enterpriseId,jdbcType=VARCHAR},
</if>
<if test="dataId != null">
data_id = #{dataId,jdbcType=VARCHAR},
</if>
<if test="pDataId != null">
p_data_id = #{pDataId,jdbcType=VARCHAR},
</if>
<if test="taskId != null">
task_id = #{taskId,jdbcType=VARCHAR},
</if>
<if test="dataType != null">
data_type = #{dataType,jdbcType=INTEGER},
</if>
<if test="statusFlag != null">
status_flag = #{statusFlag,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.haoban.manage.service.entity.TabHaobanPreDealLog">
update tab_haoban_pre_deal_log
set wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
data_id = #{dataId,jdbcType=VARCHAR},
p_data_id = #{pDataId,jdbcType=VARCHAR},
task_id = #{taskId,jdbcType=VARCHAR},
data_type = #{dataType,jdbcType=INTEGER},
status_flag = #{statusFlag,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="getByDataId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_pre_deal_log
where task_id = #{taskId} and data_id=#{dataId}
<if test="status!=-1">
and status_flag=#{status}
</if>
</select>
<select id="listByPDataId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_pre_deal_log
where task_id = #{taskId} and p_data_id=#{dataId} and data_type=#{dataType}
<if test="status!=-1">
and status_flag=#{status}
</if>
</select>
<update id="updateStatusByDataId">
update tab_haoban_pre_deal_log
<set>
status_flag = #{status,jdbcType=INTEGER},
reason=#{reason},
update_time = now()
</set>
where data_id = #{dataId,jdbcType=INTEGER} and task_id=#{taskId}
</update>
<select id="checkTask" resultType="Integer">
select
count(*)
from tab_haoban_pre_deal_log
where task_id = #{taskId} and data_type=#{dataType}
and status_flag=#{status}
</select>
<select id="listByTaskId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_pre_deal_log
where task_id = #{taskId} and data_type=#{dataType}
and status_flag=#{status}
</select>
<select id="countByTaskId" resultType="Integer">
select
COUNT(*)
from tab_haoban_pre_deal_log
where task_id = #{taskId}
<if test="dataType!=-1">
and data_type=#{dataType}
</if>
<if test="status!=-1">
and status_flag=#{status}
</if>
</select>
<select id="listRebuildDepartByTaskId" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM
tab_haoban_pre_deal_log a
WHERE
a.task_id = #{taskId}
AND data_type = 0
AND status_flag = 3
AND EXISTS (
SELECT
1
FROM
tab_haoban_pre_deal_log b
WHERE
b.task_id = #{taskId}
AND data_type = 0
AND a.p_data_id = b.data_id
AND b.status_flag = 2
)
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gic.haoban.manage.service.dao.mapper.SyncTaskMapper">
<resultMap id="BaseResultMap" type="com.gic.haoban.manage.service.entity.TabHaobanSyncTask">
<id column="task_id" jdbcType="VARCHAR" property="taskId"/>
<result column="wx_enterprise_id" jdbcType="VARCHAR" property="wxEnterpriseId"/>
<result column="task_name" jdbcType="VARCHAR" property="taskName"/>
<result column="add_user" jdbcType="VARCHAR" property="addUser"/>
<result column="task_desc" jdbcType="VARCHAR" property="taskDesc"/>
<result column="status_flag" jdbcType="INTEGER" property="statusFlag"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
</resultMap>
<sql id="Base_Column_List">
task_id,wx_enterprise_id, task_name, add_user, task_desc, status_flag, create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_sync_task
where task_id = #{taskId,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from tab_haoban_sync_task
where task_id = #{taskId,jdbcType=VARCHAR}
</delete>
<insert id="insert" parameterType="com.gic.haoban.manage.service.entity.TabHaobanSyncTask">
insert into tab_haoban_sync_task (task_id,wx_enterprise_id, task_name, add_user,
task_desc, status_flag, create_time,
update_time)
values (#{taskId,jdbcType=VARCHAR},#{wxEnterpriseId}, #{taskName,jdbcType=VARCHAR}, #{addUser,jdbcType=VARCHAR},
#{taskDesc,jdbcType=VARCHAR}, #{statusFlag,jdbcType=INTEGER}, now(),now())
</insert>
<insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanSyncTask">
insert into tab_haoban_sync_task
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="taskId != null">
task_id,
</if>
<if test="taskName != null">
task_name,
</if>
<if test="addUser != null">
add_user,
</if>
<if test="taskDesc != null">
task_desc,
</if>
<if test="statusFlag != null">
status_flag,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="taskId != null">
#{taskId,jdbcType=VARCHAR},
</if>
<if test="taskName != null">
#{taskName,jdbcType=VARCHAR},
</if>
<if test="addUser != null">
#{addUser,jdbcType=VARCHAR},
</if>
<if test="taskDesc != null">
#{taskDesc,jdbcType=VARCHAR},
</if>
<if test="statusFlag != null">
#{statusFlag,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanSyncTask">
update tab_haoban_sync_task
<set>
<if test="taskName != null">
task_name = #{taskName,jdbcType=VARCHAR},
</if>
<if test="addUser != null">
add_user = #{addUser,jdbcType=VARCHAR},
</if>
<if test="taskDesc != null">
task_desc = #{taskDesc,jdbcType=VARCHAR},
</if>
<if test="statusFlag != null">
status_flag = #{statusFlag,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where task_id = #{taskId,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.haoban.manage.service.entity.TabHaobanSyncTask">
update tab_haoban_sync_task
set task_name = #{taskName,jdbcType=VARCHAR},
add_user = #{addUser,jdbcType=VARCHAR},
task_desc = #{taskDesc,jdbcType=VARCHAR},
status_flag = #{statusFlag,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where task_id = #{taskId,jdbcType=VARCHAR}
</update>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.gic.haoban.manage.service.dao.mapper.TabHaobanClerkMainStoreRelatedMapper" >
<resultMap id="BaseResultMap" type="com.gic.haoban.manage.service.entity.TabHaobanClerkMainStoreRelated" >
<id column="clerk_main_store_related_id" property="clerkMainStoreRelatedId" jdbcType="VARCHAR" />
<result column="staff_id" property="staffId" jdbcType="VARCHAR" />
<result column="wx_enterprise_id" property="wxEnterpriseId" jdbcType="VARCHAR" />
<result column="store_id" property="storeId" jdbcType="VARCHAR" />
<result column="main_store_flag" property="mainStoreFlag" jdbcType="INTEGER" />
<result column="status_flag" property="statusFlag" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
</resultMap>
<sql id="Base_Column_List" >
clerk_main_store_related_id, staff_id, wx_enterprise_id, store_id, main_store_flag,
status_flag, create_time, update_time
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_clerk_main_store_related
where clerk_main_store_related_id = #{clerkMainStoreRelatedId,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
delete from tab_haoban_clerk_main_store_related
where clerk_main_store_related_id = #{clerkMainStoreRelatedId,jdbcType=VARCHAR}
</delete>
<insert id="insert" parameterType="com.gic.haoban.manage.service.entity.TabHaobanClerkMainStoreRelated" >
insert into tab_haoban_clerk_main_store_related (clerk_main_store_related_id, staff_id,
wx_enterprise_id, store_id, main_store_flag,
status_flag, create_time, update_time
)
values (#{clerkMainStoreRelatedId,jdbcType=VARCHAR}, #{staffId,jdbcType=VARCHAR},
#{wxEnterpriseId,jdbcType=VARCHAR}, #{storeId,jdbcType=VARCHAR}, #{mainStoreFlag,jdbcType=INTEGER},
#{statusFlag,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanClerkMainStoreRelated" >
insert into tab_haoban_clerk_main_store_related
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="clerkMainStoreRelatedId != null" >
clerk_main_store_related_id,
</if>
<if test="staffId != null" >
staff_id,
</if>
<if test="wxEnterpriseId != null" >
wx_enterprise_id,
</if>
<if test="storeId != null" >
store_id,
</if>
<if test="mainStoreFlag != null" >
main_store_flag,
</if>
<if test="statusFlag != null" >
status_flag,
</if>
<if test="createTime != null" >
create_time,
</if>
<if test="updateTime != null" >
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="clerkMainStoreRelatedId != null" >
#{clerkMainStoreRelatedId,jdbcType=VARCHAR},
</if>
<if test="staffId != null" >
#{staffId,jdbcType=VARCHAR},
</if>
<if test="wxEnterpriseId != null" >
#{wxEnterpriseId,jdbcType=VARCHAR},
</if>
<if test="storeId != null" >
#{storeId,jdbcType=VARCHAR},
</if>
<if test="mainStoreFlag != null" >
#{mainStoreFlag,jdbcType=INTEGER},
</if>
<if test="statusFlag != null" >
#{statusFlag,jdbcType=INTEGER},
</if>
<if test="createTime != null" >
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null" >
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanClerkMainStoreRelated" >
update tab_haoban_clerk_main_store_related
<set >
<if test="staffId != null" >
staff_id = #{staffId,jdbcType=VARCHAR},
</if>
<if test="wxEnterpriseId != null" >
wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
</if>
<if test="storeId != null" >
store_id = #{storeId,jdbcType=VARCHAR},
</if>
<if test="mainStoreFlag != null" >
main_store_flag = #{mainStoreFlag,jdbcType=INTEGER},
</if>
<if test="statusFlag != null" >
status_flag = #{statusFlag,jdbcType=INTEGER},
</if>
<if test="createTime != null" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null" >
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where clerk_main_store_related_id = #{clerkMainStoreRelatedId,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.haoban.manage.service.entity.TabHaobanClerkMainStoreRelated" >
update tab_haoban_clerk_main_store_related
set staff_id = #{staffId,jdbcType=VARCHAR},
wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
store_id = #{storeId,jdbcType=VARCHAR},
main_store_flag = #{mainStoreFlag,jdbcType=INTEGER},
status_flag = #{statusFlag,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where clerk_main_store_related_id = #{clerkMainStoreRelatedId,jdbcType=VARCHAR}
</update>
<select id="selectByWxEnterpriseIdAndStoreId" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_clerk_main_store_related
where staff_id = #{staffId,jdbcType=VARCHAR}
and wx_enterprise_id = #{wxEnterpriseId}
and status_flag = 1
limit 1
</select>
</mapper>
\ No newline at end of file
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.JSONResponse;
import com.gic.haoban.manage.api.dto.SyncSingleDealDTO;
import com.gic.haoban.manage.api.service.DealSyncOperationApiService;
import com.gic.haoban.manage.api.service.DepartmentApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService;
import com.gic.wechat.api.dto.qywx.DepartmentDTO;
import com.gic.wechat.api.dto.qywx.QywxXcxSendMessageDTO;
import com.gic.wechat.api.dto.qywx.UserDTO;
import com.gic.wechat.api.service.qywx.QywxDepartmentApiService;
import com.gic.wechat.api.service.qywx.QywxSuiteApiService;
import com.gic.wechat.api.service.qywx.QywxUserApiService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:applicationContext-conf.xml"})
public class DealSyncTest {
@Autowired
private DealSyncOperationApiService dealSyncOperationApiService;
@Test
public void test() {
List<SyncSingleDealDTO> add = new ArrayList<>();
List<SyncSingleDealDTO> edit = new ArrayList<>();
{
SyncSingleDealDTO dealDTO = new SyncSingleDealDTO();
dealDTO.setDepartmentId("ff80808166c3a1050166c43175d9000e");
dealDTO.setParentDepartmentId("a101b3a51cd549e79f3daec1aa628301");
dealDTO.setDepartmentName("西溪花园");
dealDTO.setRelatedId("ff80808166c3a1050166c43175d9000e");
dealDTO.setStoreFlag(0);
dealDTO.setEnterpriseId("ff8080815dacd3a2015dacd3ef5c0000");
add.add(dealDTO);
}
{
SyncSingleDealDTO dealDTO = new SyncSingleDealDTO();
dealDTO.setDepartmentId("100333808083");
dealDTO.setParentDepartmentId("a101b3a51cd549e79f3daec1aa628301");
dealDTO.setDepartmentName("测试门店1003338");
dealDTO.setRelatedId("100333808083");
dealDTO.setStoreFlag(1);
dealDTO.setEnterpriseId("ff8080815dacd3a2015dacd3ef5c0000");
add.add(dealDTO);
}
dealSyncOperationApiService.dealDepartment("111", "ca66a01b79474c40b3e7c7f93daf1a3b", add, edit);
}
}
import com.gic.haoban.manage.api.service.MemberUnionidRelatedApiService; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.JSONResponse;
import com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService;
import com.gic.wechat.api.dto.qywx.DepartmentDTO;
import com.gic.wechat.api.dto.qywx.QywxXcxSendMessageDTO;
import com.gic.wechat.api.dto.qywx.UserDTO;
import com.gic.wechat.api.service.qywx.QywxDepartmentApiService;
import com.gic.wechat.api.service.qywx.QywxSuiteApiService;
import com.gic.wechat.api.service.qywx.QywxUserApiService; import com.gic.wechat.api.service.qywx.QywxUserApiService;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
...@@ -6,7 +14,9 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -6,7 +14,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService; import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:applicationContext-conf.xml"}) @ContextConfiguration(locations = {"classpath:applicationContext-conf.xml"})
...@@ -17,6 +27,12 @@ public class ServiceTest { ...@@ -17,6 +27,12 @@ public class ServiceTest {
@Autowired @Autowired
private QywxUserApiService qywxUserApiService; private QywxUserApiService qywxUserApiService;
@Autowired
private QywxDepartmentApiService qywxDepartmentApiService;
@Autowired
private QywxSuiteApiService qywxSuiteApiService;
@Test @Test
public void test() { public void test() {
//wxEnterpriseRelatedApiService.listEnterpriseByWxEnterpriseId("073e89a37eb14acabf258e59a57359b6"); //wxEnterpriseRelatedApiService.listEnterpriseByWxEnterpriseId("073e89a37eb14acabf258e59a57359b6");
...@@ -25,9 +41,92 @@ public class ServiceTest { ...@@ -25,9 +41,92 @@ public class ServiceTest {
@Test @Test
public void test1() { public void test1() {
String corpSelfExternalUseridInfo = qywxUserApiService.getCorpSelfExternalUseridInfo("ww50d418adce14b4a9" String res = qywxUserApiService.leaveClerkExternal("ww9ede832a84b7ae5f"
, "1azg6LG5Vj_YKFO-X27to4S4x_y-f6APR0fwE9YnQd8", "wm-0J8CQAAbGIhtnLd51B97OO_0gf3zw"); , "01YQ-pcdYzF3K0So8uCFfkB5i8D5EBW7KcVB4qA8Ktk", 0, 1000);
System.out.println(corpSelfExternalUseridInfo); JSONArray jsonArray = JSONArray.parseArray(res);
jsonArray.forEach(o -> {
JSONObject mid = (JSONObject) o;
qywxUserApiService.leaveClerkReTransfer("ww9ede832a84b7ae5f"
, "01YQ-pcdYzF3K0So8uCFfkB5i8D5EBW7KcVB4qA8Ktk", mid.getString("handover_userid")
, mid.getString("handover_userid"), mid.getString("external_userid"));
});
System.out.println(res);
}
@Test
public void test2() {
UserDTO userDTO = new UserDTO();
userDTO.setUserid("niweizhong");
userDTO.setName("空闻大师");
userDTO.setDepartment(new Integer[]{4});
userDTO.setMobile("17605628855");
userDTO.setCorpid("ww9ede832a84b7ae5f");
JSONResponse workWxUser = qywxUserApiService.createWorkWxUser(userDTO, "ww9ede832a84b7ae5f", "ww7d6566614055cf27");
System.out.println(JSONObject.toJSONString(workWxUser));
}
@Test
public void list() {
List<DepartmentDTO> list = qywxDepartmentApiService.listSelfDepartment("ww9ede832a84b7ae5f"
, "3aOw7jbcHlHkDmOi5TuG42Ta8NqskOhZxy5urrmaGl8", 1);
Iterator<DepartmentDTO> iterator = list.iterator();
// while (iterator.hasNext()) {
// DepartmentDTO next = iterator.next();
// if(!next.getParentid().equals("1")) {
// iterator.remove();
// }
// }
System.out.println(JSONObject.toJSONString(list));
}
@Test
public void addDepart() {
DepartmentDTO dto = new DepartmentDTO();
// dto.set
// JSONResponse department = qywxDepartmentApiService.createDepartment("ww9ede832a84b7ae5f"
// , "ww7d6566614055cf27", null);
// List<DepartmentDTO> list = (List<DepartmentDTO>) department;
// System.out.println(JSONObject.toJSONString(list));
}
@Test
public void getUser() {
DepartmentDTO dto = new DepartmentDTO();
// dto.set
UserDTO phonenumber = qywxUserApiService.getWxUserByPhonenumber("ww9ede832a84b7ae5f"
, "ww7d6566614055cf27", "13735457631");
// String phonenumber = phonenumber;
// UserDTO phonenumber = (UserDTO) useridBymobile;
System.out.println(JSONObject.toJSONString(phonenumber));
}
@Test
public void createSelfUser() {
UserDTO userDTO = new UserDTO();
userDTO.setUserid("niweizhong2");
userDTO.setName("空闻大师2");
userDTO.setDepartment(new Integer[]{5072});
userDTO.setMobile("17605628851");
userDTO.setCorpid("ww9ede832a84b7ae5f");
JSONResponse workWxUser = qywxUserApiService.createSelfWorkWxUser(userDTO, "ww9ede832a84b7ae5f",
"3aOw7jbcHlHkDmOi5TuG42Ta8NqskOhZxy5urrmaGl8");
System.out.println(JSONObject.toJSONString(workWxUser));
}
@Test
public void sendMessage() {
QywxXcxSendMessageDTO messageDTO = new QywxXcxSendMessageDTO();
messageDTO.setAppid("wx6054e7be35015afc");
ArrayList<String> userIDs = new ArrayList<>();
userIDs.add("9ae4c4f1277340a186b16a17d937c72c");
messageDTO.setUserIds(userIDs);
messageDTO.setTitle("我的测试test");
messageDTO.setDescription("我的测试test11111");
boolean ret = qywxSuiteApiService.sendMessage("ww9ede832a84b7ae5f",
"ww2c34dc56739bb105", messageDTO);
System.out.println(JSONObject.toJSONString(ret));
} }
} }
...@@ -123,6 +123,31 @@ public class ApplicationController extends WebBaseController{ ...@@ -123,6 +123,31 @@ public class ApplicationController extends WebBaseController{
return resultResponse(HaoBanErrCode.ERR_1, true); return resultResponse(HaoBanErrCode.ERR_1, true);
} }
@RequestMapping("init-wx-department")
public HaobanResponse initWxDepartment(){
LoginVO login = (LoginVO) AuthRequestUtil.getLoginUser();
String wxEnterpriseId = login.getWxEnterpriseId();
WxEnterpriseDTO enterpriseDTO = this.wxEnterpriseApiService.getOne(wxEnterpriseId);
if(enterpriseDTO != null){
if(StringUtils.isNotBlank(enterpriseDTO.getContactSecret()) && enterpriseDTO.getContactFlag() != null){
log.info("【初始化部门调用】{},{},{}",RouterConstant.INIT_WX_DEPARTMENT_SERVICENAME,RouterConstant.INIT_WX_DEPARTMENT_METHODNAME,wxEnterpriseId);
try {
GICMQClientUtil.getClientInstance().sendCommonMessage(RouterConstant.ROUTERTYPE, wxEnterpriseId,
RouterConstant.INIT_WX_DEPARTMENT_SERVICENAME, RouterConstant.INIT_WX_DEPARTMENT_METHODNAME);
} catch (Exception e) {
log.info(e.getMessage(),e);
}
//this.departmentApiService.initwxDepartmentMQ(enterpriseDTO.getCorpid(), enterpriseDTO.getContactSecret(), enterpriseDTO.getWxEnterpriseId());
// enterpriseDTO.setContactFlag(1);
// wxEnterpriseApiService.update(enterpriseDTO);
}
}
return resultResponse(HaoBanErrCode.ERR_1, true);
}
@RequestMapping("get-auth-url") @RequestMapping("get-auth-url")
public HaobanResponse getAuthUrl(){ public HaobanResponse getAuthUrl(){
String suiteId = config.getSuiteId(); String suiteId = config.getSuiteId();
......
...@@ -186,12 +186,13 @@ public class DepartmentContoller extends WebBaseController{ ...@@ -186,12 +186,13 @@ public class DepartmentContoller extends WebBaseController{
department.setChainId(dto.getChainId() + Constant.ID_SEPARATOR + dto.getDepartmentId()); department.setChainId(dto.getChainId() + Constant.ID_SEPARATOR + dto.getDepartmentId());
department.setIsStore(0); department.setIsStore(0);
department.setLevel(dto.getLevel() + 1); department.setLevel(dto.getLevel() + 1);
ServiceResponse hr = departmentApiService.add(department); ServiceResponse<DepartmentDTO> hr = departmentApiService.add(department);
if(hr.getCode() != 1){ if(hr.getCode() != 1){
return resultResponse(HaoBanErrCode.ERR_DEFINE, hr.getMessage(), null, hr.getMessage()); return resultResponse(HaoBanErrCode.ERR_DEFINE, hr.getMessage(), null, hr.getMessage());
} }
DepartmentDTO departmentDTO = hr.getResult();
return resultResponse(HaoBanErrCode.ERR_1,hr.getResult()); departmentDTO.setHasSonNode(false);
return resultResponse(HaoBanErrCode.ERR_1, departmentDTO);
} }
...@@ -526,6 +527,9 @@ public class DepartmentContoller extends WebBaseController{ ...@@ -526,6 +527,9 @@ public class DepartmentContoller extends WebBaseController{
for (GicTreeDTO departmentDTO : departmentList) { for (GicTreeDTO departmentDTO : departmentList) {
DepartmentDTO dto = departmentApiService.selectByRelatedId(departmentDTO.getId()); DepartmentDTO dto = departmentApiService.selectByRelatedId(departmentDTO.getId());
if(dto == null) { if(dto == null) {
if (departmentDTO.getType() == 1) {
continue;
}
DepartmentDTO unBindDTO = new DepartmentDTO(); DepartmentDTO unBindDTO = new DepartmentDTO();
unBindDTO.setRelatedId(departmentDTO.getId()); unBindDTO.setRelatedId(departmentDTO.getId());
Integer storeType = departmentDTO.getType(); Integer storeType = departmentDTO.getType();
......
package com.gic.haoban.manage.web.controller;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.SyncCheckDTO;
import com.gic.haoban.manage.api.service.DealSyncOperationApiService;
import com.gic.haoban.manage.web.auth.AuthRequestUtil;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.qo.SyncDealQO;
import com.gic.haoban.manage.web.vo.LoginVO;
import com.gic.redis.data.util.RedisUtil;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class SyncDealContoller extends WebBaseController {
private static Logger logger = LoggerFactory.getLogger(SyncDealContoller.class);
@Autowired
private DealSyncOperationApiService dealSyncOperationApiService;
@RequestMapping("/test/department-sync")
@ResponseBody
public HaobanResponse departmentBatchSyncTest(@RequestBody SyncDealQO qo, String wxEid) {
String task = null;
if (StringUtils.isNotBlank(wxEid)) {
task = dealSyncOperationApiService.createTask(wxEid, "门店同步", "11111", "部门同步");
dealSyncOperationApiService.dealDepartment(task, wxEid, qo.getAddDepartment(), qo.getEditDepartment());
} else {
LoginVO login = (LoginVO) AuthRequestUtil.getSessionUser();
String wxEnterpriseId = login.getWxEnterpriseId();
String key = "haoban-sync-department-" + wxEnterpriseId;
if (RedisUtil.getCache(key) != null) {
return resultResponse(HaoBanErrCode.ERR_10011);
}
task = dealSyncOperationApiService.createTask(wxEnterpriseId, "门店同步", login.getStaffDTO().getStaffId(), "部门同步");
dealSyncOperationApiService.dealDepartment(task, login.getWxEnterpriseId(), qo.getAddDepartment(), qo.getEditDepartment());
}
return resultResponse(HaoBanErrCode.ERR_1, task);
}
@RequestMapping("/department-sync")
@ResponseBody
public HaobanResponse departmentBatchSync(@RequestBody SyncDealQO qo) {
String task = null;
LoginVO login = (LoginVO) AuthRequestUtil.getSessionUser();
String wxEnterpriseId = login.getWxEnterpriseId();
String taskLock = dealSyncOperationApiService.getTaskLock(wxEnterpriseId);
if (null != taskLock) {
return resultResponse(HaoBanErrCode.ERR_10011);
}
task = dealSyncOperationApiService.createTask(wxEnterpriseId, "门店同步", login.getStaffDTO().getStaffId(), "部门同步");
dealSyncOperationApiService.dealDepartment(task, login.getWxEnterpriseId(), qo.getAddDepartment(), qo.getEditDepartment());
return resultResponse(HaoBanErrCode.ERR_1, task);
}
/**
* 同步状态校验
*
* @param syncKey
* @return
*/
@RequestMapping("department-sync-check")
public HaobanResponse syncSuccess(String wxEnterpriseId) {
if (StringUtils.isBlank(wxEnterpriseId)) {
LoginVO login = (LoginVO) AuthRequestUtil.getSessionUser();
wxEnterpriseId = login.getWxEnterpriseId();
}
SyncCheckDTO taskCheck = dealSyncOperationApiService.getTaskCheck(wxEnterpriseId);
return resultResponse(HaoBanErrCode.ERR_1, taskCheck);
}
/**
* 同步状态校验
*
* @param syncKey
* @return
*/
@RequestMapping("/test/department-sync-check")
public HaobanResponse testSyncSuccess(String wxEnterpriseId) {
if (StringUtils.isBlank(wxEnterpriseId)) {
LoginVO login = (LoginVO) AuthRequestUtil.getSessionUser();
wxEnterpriseId = login.getWxEnterpriseId();
}
SyncCheckDTO taskCheck = dealSyncOperationApiService.getTaskCheck(wxEnterpriseId);
return resultResponse(HaoBanErrCode.ERR_1, taskCheck);
}
@RequestMapping("/re-sync")
@ResponseBody
public HaobanResponse clerkReSync(String taskId) {
if (StringUtils.isBlank(taskId)) {
LoginVO login = (LoginVO) AuthRequestUtil.getSessionUser();
String wxEnterpriseId = login.getWxEnterpriseId();
taskId = dealSyncOperationApiService.getTaskLock(wxEnterpriseId);
}
dealSyncOperationApiService.reDealDepartment(taskId, -1);
return resultResponse(HaoBanErrCode.ERR_1);
}
@RequestMapping("/close-sync")
@ResponseBody
public HaobanResponse closeReSync(String wxEnterpriseId) {
if (StringUtils.isBlank(wxEnterpriseId)) {
LoginVO login = (LoginVO) AuthRequestUtil.getSessionUser();
wxEnterpriseId = login.getWxEnterpriseId();
}
dealSyncOperationApiService.closeTask(wxEnterpriseId);
return resultResponse(HaoBanErrCode.ERR_1);
}
}
package com.gic.haoban.manage.web.controller;
import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.qo.QywxXcxSendMessageQo;
import com.gic.wechat.api.dto.qywx.QywxXcxSendMessageDTO;
import com.gic.wechat.api.service.qywx.QywxSuiteApiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
/**
* Created 2020/4/9.
*
* @author hua
*/
@RestController
@RequestMapping("/test")
public class TestController extends WebBaseController {
@Autowired
private QywxSuiteApiService qywxSuiteApiService;
@RequestMapping("/send-message-test")
public HaobanResponse testSendMessage(QywxXcxSendMessageQo qo) {
QywxXcxSendMessageDTO messageDTO = EntityUtil.changeEntityByOrika(QywxXcxSendMessageDTO.class, qo);
ArrayList<String> list = new ArrayList<>();
list.add(qo.getUserId());
messageDTO.setUserIds(list);
boolean b = qywxSuiteApiService.sendMessage("ww9ede832a84b7ae5f",
"ww2c34dc56739bb105", messageDTO);
if (b) {
return resultResponse(HaoBanErrCode.ERR_1);
} else {
return resultResponse(HaoBanErrCode.ERR_0);
}
}
}
package com.gic.haoban.manage.web.qo;
import java.io.Serializable;
/**
* Created by hua on 2020/4/8.
*/
public class QywxXcxSendMessageQo implements Serializable {
private String userId;
private String appid;
private String page;
private String title;
private String description;
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getAppid() {
return appid;
}
public void setAppid(String appid) {
this.appid = appid;
}
public String getPage() {
return page;
}
public void setPage(String page) {
this.page = page;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
package com.gic.haoban.manage.web.qo;
import com.gic.haoban.manage.api.dto.SyncSingleDealDTO;
import java.io.Serializable;
import java.util.List;
public class SyncDealQO implements Serializable {
private List<SyncSingleDealDTO> editDepartment;
private List<SyncSingleDealDTO> addDepartment;
public List<SyncSingleDealDTO> getEditDepartment() {
return editDepartment;
}
public void setEditDepartment(List<SyncSingleDealDTO> editDepartment) {
this.editDepartment = editDepartment;
}
public List<SyncSingleDealDTO> getAddDepartment() {
return addDepartment;
}
public void setAddDepartment(List<SyncSingleDealDTO> addDepartment) {
this.addDepartment = addDepartment;
}
}
...@@ -52,4 +52,7 @@ ...@@ -52,4 +52,7 @@
<dubbo:reference interface="com.gic.wechat.token.api.service.QywxTokenManageService" id="qywxTokenManageService"/> <dubbo:reference interface="com.gic.wechat.token.api.service.QywxTokenManageService" id="qywxTokenManageService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.DealSyncOperationApiService"
id="dealSyncOperationApiService"/>
</beans> </beans>
...@@ -220,6 +220,12 @@ ...@@ -220,6 +220,12 @@
<artifactId>gic-quartz-api</artifactId> <artifactId>gic-quartz-api</artifactId>
<version>${gic-quartz-api}</version> <version>${gic-quartz-api}</version>
</dependency> </dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-app-customer-api</artifactId>
<version>${haoban-app-customer-api}</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -19,14 +19,19 @@ import com.alibaba.csp.sentinel.util.StringUtil; ...@@ -19,14 +19,19 @@ import com.alibaba.csp.sentinel.util.StringUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.gic.clerk.api.dto.ClerkDTO; import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.service.ClerkService; import com.gic.clerk.api.service.ClerkService;
import com.gic.commons.util.DateUtil;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
import com.gic.enterprise.api.dto.StoreDTO; import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.enterprise.api.service.StoreService; import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.app.customer.service.api.service.DistributeApiService;
import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.common.utils.HaobanResponse; import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.communicate.api.service.SyncHaobanToGicServiceApi;
import com.gic.haoban.manage.api.dto.DepartmentDTO; import com.gic.haoban.manage.api.dto.DepartmentDTO;
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.service.BindApiService; import com.gic.haoban.manage.api.service.BindApiService;
import com.gic.haoban.manage.api.service.ClerkMainStoreRelatedApiService;
import com.gic.haoban.manage.api.service.DepartmentApiService; import com.gic.haoban.manage.api.service.DepartmentApiService;
import com.gic.haoban.manage.api.service.StaffApiService; import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService; import com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService;
...@@ -35,6 +40,7 @@ import com.gic.haoban.manage.web.errCode.HaoBanErrCode; ...@@ -35,6 +40,7 @@ import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.interceptor.WebInterceptor; import com.gic.haoban.manage.web.interceptor.WebInterceptor;
import com.gic.haoban.manage.web.vo.ClerkVo; import com.gic.haoban.manage.web.vo.ClerkVo;
import com.gic.haoban.manage.web.vo.StoreVO; import com.gic.haoban.manage.web.vo.StoreVO;
import com.gic.redis.data.util.RedisUtil;
@RestController @RestController
public class ClerkController extends WebBaseController{ public class ClerkController extends WebBaseController{
...@@ -52,6 +58,12 @@ public class ClerkController extends WebBaseController{ ...@@ -52,6 +58,12 @@ public class ClerkController extends WebBaseController{
private DepartmentApiService departmentApiService; private DepartmentApiService departmentApiService;
@Autowired @Autowired
private BindApiService bindApiService; private BindApiService bindApiService;
@Autowired
private SyncHaobanToGicServiceApi syncHaobanToGicServiceApi;
@Autowired
private ClerkMainStoreRelatedApiService clerkMainStoreRelatedApiService;
@Autowired
private DistributeApiService distributeApiService;
//导购列表 //导购列表
@RequestMapping("/clerk-list") @RequestMapping("/clerk-list")
...@@ -125,23 +137,40 @@ public class ClerkController extends WebBaseController{ ...@@ -125,23 +137,40 @@ public class ClerkController extends WebBaseController{
Map<String,StaffDepartmentRelatedDTO> relatedMap = com.gic.commons.util.CollectionUtil.toMap(list, "staffId"); Map<String,StaffDepartmentRelatedDTO> relatedMap = com.gic.commons.util.CollectionUtil.toMap(list, "staffId");
List<String> staffIds = list.stream().map(s->s.getStaffId()).collect(Collectors.toList()); List<String> staffIds = list.stream().map(s->s.getStaffId()).collect(Collectors.toList());
List<StaffDTO> resultlist= staffApiService.listByIds(staffIds); List<StaffDTO> resultlist= staffApiService.listByIds(staffIds);
DepartmentDTO departmentDTO = departmentApiService.selectById(departmentId);
String storeId = departmentDTO.getRelatedId();
int size = 0;
if(resultlist != null){
size = resultlist.size();
}
for(StaffDTO dto :resultlist){ for(StaffDTO dto :resultlist){
if(relatedMap.get(dto.getStaffId()) != null){ StaffDepartmentRelatedDTO related = relatedMap.get(dto.getStaffId());
dto.setStaffDepartmentRelatedId(relatedMap.get(dto.getStaffId()).getStaffDepartmentRelatedId()); if(related != null){
if(org.apache.commons.lang.StringUtils.isNotBlank(relatedMap.get(dto.getStaffId()).getClerkCode())){ dto.setStaffDepartmentRelatedId(related.getStaffDepartmentRelatedId());
if(org.apache.commons.lang.StringUtils.isNotBlank(related.getClerkCode())){
dto.setBindFlag(1); dto.setBindFlag(1);
dto.setClerkCode(relatedMap.get(dto.getStaffId()).getClerkCode()); dto.setClerkCode(related.getClerkCode());
if(size > 20){
ClerkDTO clerk = clerkService.getClerkByClerkCode(departmentDTO.getEnterpriseId(), related.getClerkCode());
if(clerk != null){
dto.setMemberCount(distributeApiService.getClerkMemberCount(departmentDTO.getEnterpriseId(), clerk.getClerkId(), storeId));
}
}else{
dto.setMemberCount(0);
}
}else{ }else{
dto.setBindFlag(0); dto.setBindFlag(0);
dto.setMemberCount(0);
} }
}else{ }else{
dto.setBindFlag(0); dto.setBindFlag(0);
} }
} }
//查找店长clerkType //查找店长clerkType
DepartmentDTO departmentDTO = departmentApiService.selectById(departmentId);
String storeId = departmentDTO.getRelatedId();
if(StringUtils.isEmpty(storeId)){ if(StringUtils.isEmpty(storeId)){
}else{ }else{
String storeClerkCode = ""; String storeClerkCode = "";
...@@ -212,4 +241,105 @@ public class ClerkController extends WebBaseController{ ...@@ -212,4 +241,105 @@ public class ClerkController extends WebBaseController{
return resultResponse(HaoBanErrCode.ERR_1); return resultResponse(HaoBanErrCode.ERR_1);
} }
//新增店员
@HttpLimit
@RequestMapping("/staff-add")
public HaobanResponse staffAdd(StaffDTO staffDTO,String storeId,String clerkCode) {
String wxEnterpriseId = staffDTO.getWxEnterpriseId();
String staffName = staffDTO.getStaffName();
String phoneNumber = staffDTO.getPhoneNumber();
String nationcode = staffDTO.getNationCode();
String postion = staffDTO.getPostion();
Integer sex = staffDTO.getSex();
staffDTO.setWxEnterpriseId(wxEnterpriseId);
if(StringUtils.isBlank(staffName)) {
return resultResponse(HaoBanErrCode.ERR_10004);
}
StaffDTO staff = staffApiService.selectByNationcodeAndPhoneNumber(wxEnterpriseId,nationcode,phoneNumber);
if(staff != null) {
return resultResponse(HaoBanErrCode.ERR_10005);
}
boolean flag = syncHaobanToGicServiceApi.syncClerkToGicClerkAdd(storeId, clerkCode, sex, staffName, phoneNumber, nationcode, postion);
if(!flag){
return resultResponse(HaoBanErrCode.ERR_10010);
}
return resultResponse(HaoBanErrCode.ERR_1);
}
//删除店员
@HttpLimit
@RequestMapping("/staff-del")
public HaobanResponse staffDel(String staffDepartmentRelatedIds,String storeId) {
DepartmentDTO departmentDTO = departmentApiService.selectByRelatedId(storeId);
if(departmentDTO == null){
return resultResponse(HaoBanErrCode.ERR_10009);
}
if(StringUtils.isBlank(staffDepartmentRelatedIds)){
return resultResponse(HaoBanErrCode.ERR_2);
}
String[] staffDepartmentRelatedIdArr = staffDepartmentRelatedIds.split(",");
boolean flag = false;
for (String staffDepartmentRelatedId : staffDepartmentRelatedIdArr) {
StaffDepartmentRelatedDTO related = staffDepartmentRelatedApiService.getByStaffDepartmentRelatedId(staffDepartmentRelatedId);
if(related == null){
flag = true;
continue;
}
if(StringUtils.isBlank(related.getClerkCode())){
staffApiService.del(staffDepartmentRelatedId);
}else{
ClerkDTO clerk = clerkService.getClerkByClerkCode(departmentDTO.getEnterpriseId(), related.getClerkCode());
if(clerk != null && distributeApiService.getClerkMemberCount(departmentDTO.getEnterpriseId(), clerk.getClerkId(), storeId) == 0){
syncHaobanToGicServiceApi.delGicClerk(clerk.getClerkId());
staffApiService.del(staffDepartmentRelatedId);
}
}
}
if(flag){
return resultResponse(HaoBanErrCode.ERR_999);
}
return resultResponse(HaoBanErrCode.ERR_1);
}
//设置主导购
@HttpLimit
@RequestMapping("/set-main-store")
public HaobanResponse setMainStore(String staffId,String storeId,String wxEnterpriseId,String staffDepartmentRelatedId) {
StaffDTO staff = staffApiService.selectById(staffId);
String yyyyMM = DateUtil.dateToStr(new Date(), "yyyyMM");
if(staff == null){
return resultResponse(HaoBanErrCode.ERR_10006);
}
String key = "haoban_set_main_store_" + yyyyMM + staffId;
Object hasSet = RedisUtil.getCache(key);
if(hasSet == null){
RedisUtil.setCache(key,true,31 * 24 * 60 * 60l);
clerkMainStoreRelatedApiService.setMainStore(staffId,storeId,wxEnterpriseId);
}else{
return resultResponse(HaoBanErrCode.ERR_10007);
}
return resultResponse(HaoBanErrCode.ERR_1);
}
//刷新微信好友
@RequestMapping("/fresh-wx-friend")
public HaobanResponse freshWxFrend(String staffId,String storeId,String wxEnterpriseId,String staffDepartmentRelatedId,String wxUserId) {
StaffDTO staff = staffApiService.selectById(staffId);
String yyyyMM = DateUtil.dateToStr(new Date(), "yyyyMM");
if(staff == null){
return resultResponse(HaoBanErrCode.ERR_10006);
}
String key = "haoban_set_main_store_" + yyyyMM + staffId;
Object hasSet = RedisUtil.getCache(key);
if(hasSet == null){
RedisUtil.setCache(key,true,31 * 24 * 60 * 60l);
clerkMainStoreRelatedApiService.setMainStore(staffId,storeId,wxEnterpriseId);
}else{
return resultResponse(HaoBanErrCode.ERR_10007);
}
return resultResponse(HaoBanErrCode.ERR_1);
}
} }
...@@ -36,12 +36,14 @@ import com.gic.haoban.data.api.dto.HaobanDataDTO; ...@@ -36,12 +36,14 @@ import com.gic.haoban.data.api.dto.HaobanDataDTO;
import com.gic.haoban.data.api.service.HaobanDataApiService; import com.gic.haoban.data.api.service.HaobanDataApiService;
import com.gic.haoban.manage.api.dto.AuditDTO; import com.gic.haoban.manage.api.dto.AuditDTO;
import com.gic.haoban.manage.api.dto.AuditSettingDTO; import com.gic.haoban.manage.api.dto.AuditSettingDTO;
import com.gic.haoban.manage.api.dto.ClerkMainStoreRelatedDTO;
import com.gic.haoban.manage.api.dto.DepartmentDTO; import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.api.dto.EnterpriseDetailDTO; import com.gic.haoban.manage.api.dto.EnterpriseDetailDTO;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO; import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
import com.gic.haoban.manage.api.enums.StoreFieldEnum; import com.gic.haoban.manage.api.enums.StoreFieldEnum;
import com.gic.haoban.manage.api.service.AuditApiService; import com.gic.haoban.manage.api.service.AuditApiService;
import com.gic.haoban.manage.api.service.AuditSettingApiService; import com.gic.haoban.manage.api.service.AuditSettingApiService;
import com.gic.haoban.manage.api.service.ClerkMainStoreRelatedApiService;
import com.gic.haoban.manage.api.service.DepartmentApiService; import com.gic.haoban.manage.api.service.DepartmentApiService;
import com.gic.haoban.manage.api.service.StaffApiService; import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService; import com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService;
...@@ -73,6 +75,8 @@ public class StoreController extends WebBaseController{ ...@@ -73,6 +75,8 @@ public class StoreController extends WebBaseController{
private AuditApiService auditApiService; private AuditApiService auditApiService;
@Autowired @Autowired
private AuditSettingApiService auditSettingApiService; private AuditSettingApiService auditSettingApiService;
@Autowired
private ClerkMainStoreRelatedApiService clerkMainStoreRelatedApiService;
//门店列表 //门店列表
@RequestMapping("/store-list") @RequestMapping("/store-list")
public HaobanResponse storeList(String staffId,String wxEnterpriseId) { public HaobanResponse storeList(String staffId,String wxEnterpriseId) {
...@@ -121,6 +125,8 @@ public class StoreController extends WebBaseController{ ...@@ -121,6 +125,8 @@ public class StoreController extends WebBaseController{
} }
} }
} }
ClerkMainStoreRelatedDTO mainStore = clerkMainStoreRelatedApiService.getWxEnterpriseIdAndStaffId(wxEnterpriseId,staffId);
//3、判断是否是店长 //3、判断是否是店长
for(StoreVO VO : resultList){ for(StoreVO VO : resultList){
//查gic门店 //查gic门店
...@@ -149,6 +155,12 @@ public class StoreController extends WebBaseController{ ...@@ -149,6 +155,12 @@ public class StoreController extends WebBaseController{
if(CollectionUtil.isNotEmpty(imgList)){ if(CollectionUtil.isNotEmpty(imgList)){
VO.setStoreImg(imgList.get(0).getQcloudImageUrl());; VO.setStoreImg(imgList.get(0).getQcloudImageUrl());;
} }
if(mainStore != null && mainStore.getStoreId().equals(VO.getStoreId())){
VO.setMainStoreFlag(1);
}else{
VO.setMainStoreFlag(0);
}
} }
if(CollectionUtils.isNotEmpty(resultList)){ if(CollectionUtils.isNotEmpty(resultList)){
Map<Integer,StoreVO> map = com.gic.commons.util.CollectionUtil.toMap(resultList, "clerkType"); Map<Integer,StoreVO> map = com.gic.commons.util.CollectionUtil.toMap(resultList, "clerkType");
...@@ -312,6 +324,13 @@ public class StoreController extends WebBaseController{ ...@@ -312,6 +324,13 @@ public class StoreController extends WebBaseController{
if(vo.getStoreArea() == null||vo.getStoreArea()==-1 ){ if(vo.getStoreArea() == null||vo.getStoreArea()==-1 ){
vo.setStoreArea(-1d); vo.setStoreArea(-1d);
} }
ClerkMainStoreRelatedDTO mainStore = clerkMainStoreRelatedApiService.getWxEnterpriseIdAndStaffId(staffDepartmentRelatedDTO.getWxEnterpriseId(),staffDepartmentRelatedDTO.getStaffId());
if(mainStore != null && mainStore.getStoreId().equals(storeId)){
vo.setMainStoreFlag(1);
}else{
vo.setMainStoreFlag(0);
}
return resultResponse(HaoBanErrCode.ERR_1,vo); return resultResponse(HaoBanErrCode.ERR_1,vo);
} }
......
...@@ -36,6 +36,14 @@ public class WebBaseController { ...@@ -36,6 +36,14 @@ public class WebBaseController {
return resultResponse(errCode, null, null); return resultResponse(errCode, null, null);
} }
public HaobanResponse resultResponse(HaoBanErrCode errCode, String message,Object data,String detailError) {
HaobanResponse response = new HaobanResponse();
response.setMessage(message);
response.setDetailError(detailError);
response.setErrorCode(errCode.getCode());
return response;
}
/** /**
* 获取登陆信息 * 获取登陆信息
* *
......
...@@ -186,7 +186,15 @@ public enum HaoBanErrCode { ...@@ -186,7 +186,15 @@ public enum HaoBanErrCode {
ERR_600001(600001, "成员不存在,请联系管理员后台授权通讯录权限"), ERR_600001(600001, "成员不存在,请联系管理员后台授权通讯录权限"),
ERR_600002(600002, "无手机号"), ERR_600002(600002, "无手机号"),
ERR_10004(10004,"成员名称不能为空"),
ERR_10005(10005,"成员已存在"),
ERR_10006(10006,"成员不存在"),
ERR_10007(10007,"本月已经设置过主导购"),
ERR_10009(10009,"门店不存在"),
ERR_10010(10010,"gic新增失败"),
ERR_999(999, "操作失败"),
ERR_DEFINE(-888, "自定义错误"), ERR_DEFINE(-888, "自定义错误"),
ERR_OTHER(-999, "未知错误code"); ERR_OTHER(-999, "未知错误code");
private int code; private int code;
......
...@@ -57,13 +57,6 @@ public class WebInterceptor extends HandlerInterceptorAdapter { ...@@ -57,13 +57,6 @@ public class WebInterceptor extends HandlerInterceptorAdapter {
Map<String, String[]> parameterMap = httpServletRequest.getParameterMap(); Map<String, String[]> parameterMap = httpServletRequest.getParameterMap();
logger.info("post-params:{}", JSONObject.toJSONString(parameterMap)); logger.info("post-params:{}", JSONObject.toJSONString(parameterMap));
HandlerMethod handler = (HandlerMethod) o;
IgnoreLogin ignoreLogin = handler.getMethodAnnotation(IgnoreLogin.class);
if (null != ignoreLogin) {
return true;
}
//TODO 登陆信息拦截 //TODO 登陆信息拦截
return true; return true;
......
...@@ -43,6 +43,8 @@ public class StoreDetailVO implements Serializable { ...@@ -43,6 +43,8 @@ public class StoreDetailVO implements Serializable {
private Integer auditFlag = 0; private Integer auditFlag = 0;
private Integer MainStoreFlag;
public Integer getAuditFlag() { public Integer getAuditFlag() {
return auditFlag; return auditFlag;
} }
...@@ -230,4 +232,14 @@ public class StoreDetailVO implements Serializable { ...@@ -230,4 +232,14 @@ public class StoreDetailVO implements Serializable {
this.storeArea = storeArea; this.storeArea = storeArea;
} }
public Integer getMainStoreFlag() {
return MainStoreFlag;
}
public void setMainStoreFlag(Integer mainStoreFlag) {
MainStoreFlag = mainStoreFlag;
}
} }
...@@ -24,6 +24,7 @@ public class StoreVO implements Serializable { ...@@ -24,6 +24,7 @@ public class StoreVO implements Serializable {
private int clerkType; private int clerkType;
private String wxEnterpriseRelatedId; private String wxEnterpriseRelatedId;
private Date createTime; private Date createTime;
private Integer mainStoreFlag;
public Date getCreateTime() { public Date getCreateTime() {
return createTime; return createTime;
...@@ -110,6 +111,12 @@ public class StoreVO implements Serializable { ...@@ -110,6 +111,12 @@ public class StoreVO implements Serializable {
public void setWxEnterpriseRelatedId(String wxEnterpriseRelatedId) { public void setWxEnterpriseRelatedId(String wxEnterpriseRelatedId) {
this.wxEnterpriseRelatedId = wxEnterpriseRelatedId; this.wxEnterpriseRelatedId = wxEnterpriseRelatedId;
} }
public Integer getMainStoreFlag() {
return mainStoreFlag;
}
public void setMainStoreFlag(Integer mainStoreFlag) {
this.mainStoreFlag = mainStoreFlag;
}
} }
...@@ -36,6 +36,12 @@ ...@@ -36,6 +36,12 @@
<dubbo:reference interface="com.gic.haoban.manage.api.service.ApplicationSettingApiService" id="applicationSettingApiService"/> <dubbo:reference interface="com.gic.haoban.manage.api.service.ApplicationSettingApiService" id="applicationSettingApiService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.MemberUnionidRelatedApiService" id="memberUnionidRelatedApiService"/> <dubbo:reference interface="com.gic.haoban.manage.api.service.MemberUnionidRelatedApiService" id="memberUnionidRelatedApiService"/>
<dubbo:reference interface="com.gic.haoban.communicate.api.service.SyncHaobanToGicServiceApi" id="syncHaobanToGicServiceApi"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.ClerkMainStoreRelatedApiService" id="clerkMainStoreRelatedApiService"/>
<dubbo:reference interface="com.gic.haoban.app.customer.service.api.service.DistributeApiService" id="distributeApiService"/>
<dubbo:reference interface="com.gic.haoban.communicate.api.service.valid.ValidationCodeService" id="validationCodeService"/> <dubbo:reference interface="com.gic.haoban.communicate.api.service.valid.ValidationCodeService" id="validationCodeService"/>
......
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