Commit 512fb42b by fudahua

Merge branch 'master' into developer

parents f734e8b4 0635433e
package com.gic.haoban.manage.api.dto;
import java.io.Serializable;
import java.util.Date;
/**
* Created By MBG-GUI-EXTENSION https://github.com/spawpaw/mybatis-generator-gui-extension
* Description:
* staff与clerk绑定日志
* @author fdh
*/
public class StaffClerkBindLogDetailDTO implements Serializable {
/**
*
*/
private Integer logId;
/**
* 被操作staff
*
*/
private String staffId;
/**
* 备操作userId
*/
private String wxUserId;
/**
* staff名称
*/
private String staffName;
/**
* 企业微信id
*
*/
private String wxEnterpriseId;
/**
* 操作人staffId
*
*/
private String optStaffId;
/**
* 操作名称
*/
private String optStaffName;
/**
* 操作类型 0 绑定 1解绑
*
*/
private Integer optType;
/**
* 渠道编码 1001=后台管理员绑定 1002=好办客户端绑定 1003=审核绑定 1004=同步绑定 2001=后台管理员解绑 2002=好办客户端解绑 1003=同步解绑
*
*/
private Integer channelCode;
/**
* gic enterpriseId
*
*/
private String enterpriseId;
/**
* gicClerkid
*
*/
private String clerkId;
/**
* 导购名称
*/
private String clerkName;
/**
* 导购手机号
*/
private String clerkPhoneNumber;
/**
* clerkcode
*
*/
private String clerkCode;
/**
* 关联id
*/
private String relationId;
/**
* 创建时间
*
*/
private Date createTime;
/**
* 更新时间
*
*/
private Date updateTime;
/**
*/
private static final long serialVersionUID = 1L;
public Integer getLogId() {
return logId;
}
public void setLogId(Integer logId) {
this.logId = logId;
}
public String getStaffId() {
return staffId;
}
public void setStaffId(String staffId) {
this.staffId = staffId;
}
public String getWxUserId() {
return wxUserId;
}
public void setWxUserId(String wxUserId) {
this.wxUserId = wxUserId;
}
public String getStaffName() {
return staffName;
}
public void setStaffName(String staffName) {
this.staffName = staffName;
}
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
public String getOptStaffId() {
return optStaffId;
}
public void setOptStaffId(String optStaffId) {
this.optStaffId = optStaffId;
}
public String getOptStaffName() {
return optStaffName;
}
public void setOptStaffName(String optStaffName) {
this.optStaffName = optStaffName;
}
public Integer getOptType() {
return optType;
}
public void setOptType(Integer optType) {
this.optType = optType;
}
public Integer getChannelCode() {
return channelCode;
}
public void setChannelCode(Integer channelCode) {
this.channelCode = channelCode;
}
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public String getClerkId() {
return clerkId;
}
public void setClerkId(String clerkId) {
this.clerkId = clerkId;
}
public String getClerkName() {
return clerkName;
}
public void setClerkName(String clerkName) {
this.clerkName = clerkName;
}
public String getClerkPhoneNumber() {
return clerkPhoneNumber;
}
public void setClerkPhoneNumber(String clerkPhoneNumber) {
this.clerkPhoneNumber = clerkPhoneNumber;
}
public String getClerkCode() {
return clerkCode;
}
public void setClerkCode(String clerkCode) {
this.clerkCode = clerkCode;
}
public String getRelationId() {
return relationId;
}
public void setRelationId(String relationId) {
this.relationId = relationId;
}
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.api.dto;
import java.io.Serializable;
import java.util.Date;
/**
* Created By MBG-GUI-EXTENSION https://github.com/spawpaw/mybatis-generator-gui-extension
* Description:
* staff与clerk绑定日志
* @author fdh
*/
public class StaffClerkBindLogInfoDTO implements Serializable {
/**
* 操作人staffId
*
*/
private String optStaffId;
/**
* 操作类型 0 绑定 1解绑
*
*/
private Integer optType;
/**
* 渠道编码 1001=后台管理员绑定 1002=好办客户端绑定 1003=审核绑定 1004=同步绑定 2001=后台管理员解绑 2002=好办客户端解绑 1003=同步解绑
*
*/
private Integer channelCode;
/**
* 绑定关联id staffclerkId
*/
private String relationId;
/**
*/
private static final long serialVersionUID = 1L;
public String getOptStaffId() {
return optStaffId;
}
public void setOptStaffId(String optStaffId) {
this.optStaffId = optStaffId;
}
public Integer getOptType() {
return optType;
}
public void setOptType(Integer optType) {
this.optType = optType;
}
public Integer getChannelCode() {
return channelCode;
}
public void setChannelCode(Integer channelCode) {
this.channelCode = channelCode;
}
public String getRelationId() {
return relationId;
}
public void setRelationId(String relationId) {
this.relationId = relationId;
}
}
\ No newline at end of file
package com.gic.haoban.manage.api.enums;
/**
* Created by hua on 2020/6/24.
*/
public enum BindTypeEnum {
BIND(1),
UNBIND(2);
private int val;
BindTypeEnum(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/6/24.
*/
public enum ChannelCodeEnum {
ADMIN_BIND(1001,"后台管理员绑定"),
SELF_BIND(1002,"好办客户端绑定"),
AUDIT_BIND(1003,"审核绑定"),
SYNC_BIND(1004,"同步绑定"),
ADMIN_UNBIND(2001,"后台管理员解绑"),
SELF_UNBIND(2002,"好办客户端解绑"),
SYNC_UNBIND(2003,"同步解绑"),
WEIXIN_DEL(2004,"微信删除解绑"),
AUDIT_UNBIND(2005,"审核解绑"),
;
private int code;
private String name;
ChannelCodeEnum(int code, String name) {
this.code = code;
this.name = name;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
......@@ -3,11 +3,19 @@ package com.gic.haoban.manage.api.service;
import java.util.List;
import java.util.Set;
import com.gic.api.base.commons.Page;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.manage.api.dto.StaffClerkBindLogDetailDTO;
import com.gic.haoban.manage.api.dto.StaffClerkInfoDTO;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
public interface StaffClerkRelationApiService {
/**
* 绑定日志
* @param params
*/
public void bindLogMq(String params);
List<StaffClerkRelationDTO> listBindCode(String enterpriseId, Set<String> clerkCodeList);
......@@ -24,16 +32,14 @@ public interface StaffClerkRelationApiService {
* 绑定
* @return
*/
public ServiceResponse bindStaffClerk(StaffClerkRelationDTO staffClerkRelationDTO);
public ServiceResponse bindStaffClerk(StaffClerkRelationDTO staffClerkRelationDTO,String optStaffId,int chanelCode);
StaffClerkRelationDTO getByCodeAndEnterpriseId(String clerkCode, String enterpriseId);
String insert(StaffClerkRelationDTO staffClerkRelation);
void insertOrUpdate(StaffClerkRelationDTO staffClerkRelation);
void delAndInsert(StaffClerkRelationDTO staffClerkRelation);
void delAndInsert(StaffClerkRelationDTO staffClerkRelation,String optStaffId,int chanelCode);
/**
* 解绑
* @param storeId
......@@ -56,7 +62,7 @@ public interface StaffClerkRelationApiService {
/**
* 解绑
* @param staffId
* @param staffId 操作人
* @param clerkId
* @return
*/
......@@ -88,4 +94,24 @@ public interface StaffClerkRelationApiService {
*/
void delByClerkId(String clerkId);
/**
* 搜索查询列表
* @param wxEnterpriseId
* @param search
* @param enterpriseId
* @param optType
* @return
*/
public Page<StaffClerkBindLogDetailDTO> pageStaffClerkBindLog(String wxEnterpriseId, String search, String enterpriseId, int optType, BasePageInfo pageInfo);
/**
* 追加到绑定日志
* @param staffId
* @param optStaffId
* @param optType
* @param channelCode
* @param relationId
*/
public void pushToBindLog(String staffId,String optStaffId,int optType,int channelCode,String relationId);
}
package com.gic.haoban.manage.service.dao.mapper;
import com.gic.haoban.manage.service.entity.TabHaobanStaffClerkBindLog;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import retrofit2.http.PATCH;
import java.util.List;
@Mapper
public interface StaffClerkBindLogMapper {
/**
*/
int deleteByPrimaryKey(Integer logId);
/**
*/
int insert(TabHaobanStaffClerkBindLog record);
/**
*/
int insertSelective(TabHaobanStaffClerkBindLog record);
/**
*/
TabHaobanStaffClerkBindLog selectByPrimaryKey(Integer logId);
/**
*/
int updateByPrimaryKeySelective(TabHaobanStaffClerkBindLog record);
/**
*/
int updateByPrimaryKey(TabHaobanStaffClerkBindLog record);
/**
* 列表
* @param clerkIds
* @param staffIds
* @param enterpriseIds
* @param optType
* @return
*/
public List<TabHaobanStaffClerkBindLog> listStaffClerkBindLog(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("clerkIds") List<String> clerkIds
, @Param("staffIds") List<String> staffIds, @Param("enterpriseIds") List<String> enterpriseIds, @Param("optType") int optType);
}
\ 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:
* staff与clerk绑定日志
* @author fdh
*/
public class TabHaobanStaffClerkBindLog implements Serializable {
/**
*
*/
private Integer logId;
/**
* 被操作staff
*
*/
private String staffId;
/**
* 企业微信id
*
*/
private String wxEnterpriseId;
/**
* 操作人staffId
*
*/
private String optStaffId;
/**
* 操作类型 0 绑定 1解绑
*
*/
private Integer optType;
/**
* 渠道编码 1001=后台管理员绑定 1002=好办客户端绑定 1003=审核绑定 1004=同步绑定 2001=后台管理员解绑 2002=好办客户端解绑 1003=同步解绑
*
*/
private Integer channelCode;
/**
* gic enterpriseId
*
*/
private String enterpriseId;
/**
* gicClerkid
*
*/
private String clerkId;
/**
* clerkcode
*
*/
private String clerkCode;
/**
* 关联id
*/
private String relationId;
/**
* 0 删除 1正常
*
*/
private Integer statusFlag;
/**
* 创建时间
*
*/
private Date createTime;
/**
* 更新时间
*
*/
private Date updateTime;
/**
*/
private static final long serialVersionUID = 1L;
public String getRelationId() {
return relationId;
}
public void setRelationId(String relationId) {
this.relationId = relationId;
}
/**
* This method returns the value of the database column tab_haoban_staff_clerk_bind_log.log_id
*
* @return the value of tab_haoban_staff_clerk_bind_log.log_id
*/
public Integer getLogId() {
return logId;
}
/**
* This method sets the value of the database column tab_haoban_staff_clerk_bind_log.log_id
*
* @param logId the value for tab_haoban_staff_clerk_bind_log.log_id
*/
public void setLogId(Integer logId) {
this.logId = logId;
}
/**
* This method returns the value of the database column tab_haoban_staff_clerk_bind_log.staff_id
*
* @return the value of tab_haoban_staff_clerk_bind_log.staff_id
*/
public String getStaffId() {
return staffId;
}
/**
* This method sets the value of the database column tab_haoban_staff_clerk_bind_log.staff_id
*
* @param staffId the value for tab_haoban_staff_clerk_bind_log.staff_id
*/
public void setStaffId(String staffId) {
this.staffId = staffId;
}
/**
* This method returns the value of the database column tab_haoban_staff_clerk_bind_log.wx_enterprise_id
*
* @return the value of tab_haoban_staff_clerk_bind_log.wx_enterprise_id
*/
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
/**
* This method sets the value of the database column tab_haoban_staff_clerk_bind_log.wx_enterprise_id
*
* @param wxEnterpriseId the value for tab_haoban_staff_clerk_bind_log.wx_enterprise_id
*/
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
/**
* This method returns the value of the database column tab_haoban_staff_clerk_bind_log.opt_staff_id
*
* @return the value of tab_haoban_staff_clerk_bind_log.opt_staff_id
*/
public String getOptStaffId() {
return optStaffId;
}
/**
* This method sets the value of the database column tab_haoban_staff_clerk_bind_log.opt_staff_id
*
* @param optStaffId the value for tab_haoban_staff_clerk_bind_log.opt_staff_id
*/
public void setOptStaffId(String optStaffId) {
this.optStaffId = optStaffId;
}
/**
* This method returns the value of the database column tab_haoban_staff_clerk_bind_log.opt_type
*
* @return the value of tab_haoban_staff_clerk_bind_log.opt_type
*/
public Integer getOptType() {
return optType;
}
/**
* This method sets the value of the database column tab_haoban_staff_clerk_bind_log.opt_type
*
* @param optType the value for tab_haoban_staff_clerk_bind_log.opt_type
*/
public void setOptType(Integer optType) {
this.optType = optType;
}
/**
* This method returns the value of the database column tab_haoban_staff_clerk_bind_log.channel_code
*
* @return the value of tab_haoban_staff_clerk_bind_log.channel_code
*/
public Integer getChannelCode() {
return channelCode;
}
/**
* This method sets the value of the database column tab_haoban_staff_clerk_bind_log.channel_code
*
* @param channelCode the value for tab_haoban_staff_clerk_bind_log.channel_code
*/
public void setChannelCode(Integer channelCode) {
this.channelCode = channelCode;
}
/**
* This method returns the value of the database column tab_haoban_staff_clerk_bind_log.enterprise_id
*
* @return the value of tab_haoban_staff_clerk_bind_log.enterprise_id
*/
public String getEnterpriseId() {
return enterpriseId;
}
/**
* This method sets the value of the database column tab_haoban_staff_clerk_bind_log.enterprise_id
*
* @param enterpriseId the value for tab_haoban_staff_clerk_bind_log.enterprise_id
*/
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
/**
* This method returns the value of the database column tab_haoban_staff_clerk_bind_log.clerk_id
*
* @return the value of tab_haoban_staff_clerk_bind_log.clerk_id
*/
public String getClerkId() {
return clerkId;
}
/**
* This method sets the value of the database column tab_haoban_staff_clerk_bind_log.clerk_id
*
* @param clerkId the value for tab_haoban_staff_clerk_bind_log.clerk_id
*/
public void setClerkId(String clerkId) {
this.clerkId = clerkId;
}
/**
* This method returns the value of the database column tab_haoban_staff_clerk_bind_log.clerk_code
*
* @return the value of tab_haoban_staff_clerk_bind_log.clerk_code
*/
public String getClerkCode() {
return clerkCode;
}
/**
* This method sets the value of the database column tab_haoban_staff_clerk_bind_log.clerk_code
*
* @param clerkCode the value for tab_haoban_staff_clerk_bind_log.clerk_code
*/
public void setClerkCode(String clerkCode) {
this.clerkCode = clerkCode;
}
/**
* This method returns the value of the database column tab_haoban_staff_clerk_bind_log.status_flag
*
* @return the value of tab_haoban_staff_clerk_bind_log.status_flag
*/
public Integer getStatusFlag() {
return statusFlag;
}
/**
* This method sets the value of the database column tab_haoban_staff_clerk_bind_log.status_flag
*
* @param statusFlag the value for tab_haoban_staff_clerk_bind_log.status_flag
*/
public void setStatusFlag(Integer statusFlag) {
this.statusFlag = statusFlag;
}
/**
* This method returns the value of the database column tab_haoban_staff_clerk_bind_log.create_time
*
* @return the value of tab_haoban_staff_clerk_bind_log.create_time
*/
public Date getCreateTime() {
return createTime;
}
/**
* This method sets the value of the database column tab_haoban_staff_clerk_bind_log.create_time
*
* @param createTime the value for tab_haoban_staff_clerk_bind_log.create_time
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* This method returns the value of the database column tab_haoban_staff_clerk_bind_log.update_time
*
* @return the value of tab_haoban_staff_clerk_bind_log.update_time
*/
public Date getUpdateTime() {
return updateTime;
}
/**
* This method sets the value of the database column tab_haoban_staff_clerk_bind_log.update_time
*
* @param updateTime the value for tab_haoban_staff_clerk_bind_log.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.api.base.commons.Page;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.manage.api.dto.StaffClerkBindLogDetailDTO;
import com.gic.haoban.manage.service.entity.TabHaobanStaffClerkBindLog;
import java.util.List;
/**
* Created 2020/6/24.
*
* @author hua
*/
public interface StaffClerkBindLogService {
/**
* 绑定日志
* @param bindLog
*/
public void insert(TabHaobanStaffClerkBindLog bindLog);
/**
* 插入日志到mq
* @param staffId
* @param optStaffId
* @param optType
* @param channelCode
* @param relationId
*/
public void pushToMq(String staffId,String optStaffId,int optType,int channelCode,String relationId);
/**
*
* @return
*/
public Page<StaffClerkBindLogDetailDTO> pageBindLog(String wxEnterpriseId,List<String> clerkIds, List<String> staffIds,List<String> enterpriseIds,int optType, BasePageInfo pageInfo);
}
......@@ -17,14 +17,14 @@ public interface StaffClerkRelationService {
* @param clerkId
* @return
*/
public boolean delBind(String clerkId);
public boolean delBind(String clerkId,String optStaffId,int chanelCode);
/**
* 绑定
* @param dto
* @return
*/
public boolean bind(StaffClerkRelationDTO dto);
public String bind(StaffClerkRelationDTO dto,String optStaffId,int chanelCode);
/**
* 根据clerkId 更新数据
......
package com.gic.haoban.manage.service.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page;
import com.gic.commons.util.GICMQClientUtil;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.manage.api.dto.StaffClerkBindLogDetailDTO;
import com.gic.haoban.manage.api.dto.StaffClerkBindLogInfoDTO;
import com.gic.haoban.manage.service.dao.mapper.StaffClerkBindLogMapper;
import com.gic.haoban.manage.service.entity.TabHaobanStaffClerkBindLog;
import com.gic.haoban.manage.service.service.StaffClerkBindLogService;
import com.gic.mq.sdk.GicMQClient;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* Created 2020/6/24.
*
* @author hua
*/
@Service
public class StaffClerkBindLogServiceImpl implements StaffClerkBindLogService {
private static final Logger logger= LoggerFactory.getLogger(StaffClerkBindLogServiceImpl.class);
@Autowired
private StaffClerkBindLogMapper staffClerkBindLogMapper;
private static final String STAFF_LOG_MQ="haobanStaffClerkBindLogMq";
@Override
public void insert(TabHaobanStaffClerkBindLog bindLog) {
bindLog.setCreateTime(new Date());
staffClerkBindLogMapper.insert(bindLog);
}
@Override
public void pushToMq(String staffId, String optStaffId, int optType, int channelCode, String relationId) {
StaffClerkBindLogInfoDTO infoDTO = new StaffClerkBindLogInfoDTO();
infoDTO.setChannelCode(channelCode);
infoDTO.setOptStaffId(optStaffId);
infoDTO.setOptType(optType);
infoDTO.setRelationId(relationId);
GicMQClient clientInstance = GICMQClientUtil.getClientInstance();
try {
String ret = JSONObject.toJSONString(infoDTO);
logger.info("绑定的mq日志:{}",ret);
clientInstance.sendMessage(STAFF_LOG_MQ, ret);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public Page<StaffClerkBindLogDetailDTO> pageBindLog(String wxEnterpriseId,List<String> clerkIds, List<String> staffIds, List<String> enterpriseIds, int optType, BasePageInfo pageInfo) {
PageHelper.startPage(pageInfo);
List<TabHaobanStaffClerkBindLog> clerkBindLogList = staffClerkBindLogMapper.listStaffClerkBindLog(wxEnterpriseId, clerkIds, staffIds, enterpriseIds, optType);
Page<StaffClerkBindLogDetailDTO> retPage = PageUtil.changePageHelperToCurrentPage(new PageInfo<>(clerkBindLogList), StaffClerkBindLogDetailDTO.class);
return retPage;
}
}
......@@ -7,10 +7,14 @@ import java.util.Set;
import com.alibaba.fastjson.JSONObject;
import com.gic.commons.util.ToolUtil;
import com.gic.haoban.manage.api.enums.BindTypeEnum;
import com.gic.haoban.manage.api.enums.ChannelCodeEnum;
import com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation;
import com.gic.haoban.manage.service.service.StaffClerkBindLogService;
import javafx.scene.control.Tab;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -30,6 +34,10 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
@Autowired
private TabHaobanStaffClerkRelationMapper mapper;
@Autowired
private StaffClerkBindLogService staffClerkBindLogService;
@Override
public List<StaffClerkRelationDTO> listBindCode(String enterpriseId, Set<String> clerkCodeList) {
return EntityUtil.changeEntityListByJSON(StaffClerkRelationDTO.class, mapper.listBindCode(enterpriseId,clerkCodeList));
......@@ -40,20 +48,35 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
}
@Override
public boolean delBind(String clerkId) {
public boolean delBind(String clerkId,String optStaffId,int chanelCode) {
TabHaobanStaffClerkRelation clerkRelation = mapper.getByClerkId(clerkId);
if (null == clerkRelation) {
logger.info("已经不存在:{},{}",clerkId,optStaffId);
return true;
}
int i = mapper.changeStatusByClerkId(clerkId, 0);
return i>=0;
boolean b = i >= 0;
if (b) {
//推入日志
staffClerkBindLogService.pushToMq(clerkRelation.getStaffId(),optStaffId, BindTypeEnum.UNBIND.getVal(),chanelCode,clerkRelation.getStaffClerkRelationId());
}
return b;
}
@Override
public boolean bind(StaffClerkRelationDTO dto) {
public String bind(StaffClerkRelationDTO dto,String optStaffId,int chanelCode) {
dto.setStaffClerkRelationId(ToolUtil.randomUUID());
dto.setStatusFlag(1);
dto.setCreateTime(new Date());
dto.setUpdateTime(new Date());
int insert = mapper.insert(EntityUtil.changeEntityByJSON(TabHaobanStaffClerkRelation.class, dto));
return insert>0;
String s = insert > 0 ? dto.getStaffClerkRelationId() : null;
if (null != s) {
//推入日志
staffClerkBindLogService.pushToMq(dto.getStaffId(),optStaffId, BindTypeEnum.BIND.getVal(),chanelCode,dto.getStaffClerkRelationId());
}
return s;
}
@Override
......@@ -89,7 +112,16 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
}
@Override
public int cleanStaffClerk(String wxEnterpriseId, List<String> staffIds) {
return mapper.cleanStaffDepart(wxEnterpriseId,staffIds);
staffIds.forEach(staffId->{
List<StaffClerkRelationDTO> relationDTOS = listBindCodeByStaffId(null, staffId);
if (CollectionUtils.isNotEmpty(relationDTOS)) {
relationDTOS.forEach(mid->{
staffClerkBindLogService.pushToMq(mid.getStaffId(),"-1",BindTypeEnum.UNBIND.getVal(), ChannelCodeEnum.SYNC_UNBIND.getCode(),mid.getStaffClerkRelationId());
});
}
});
int ret = mapper.cleanStaffDepart(wxEnterpriseId, staffIds);
return ret;
}
@Override
......
......@@ -8,6 +8,7 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.gic.haoban.manage.api.enums.*;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -39,10 +40,6 @@ import com.gic.haoban.manage.api.dto.EnterpriseDetailDTO;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
import com.gic.haoban.manage.api.dto.StoreAddressDTO;
import com.gic.haoban.manage.api.enums.AppPageType;
import com.gic.haoban.manage.api.enums.AuditRsultType;
import com.gic.haoban.manage.api.enums.AuditType;
import com.gic.haoban.manage.api.enums.StoreFieldEnum;
import com.gic.haoban.manage.api.service.AuditApiService;
import com.gic.haoban.manage.api.service.StaffClerkRelationApiService;
import com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService;
......@@ -225,7 +222,8 @@ public class AuditApiServiceImpl implements AuditApiService{
staffClerkRelation.setWxEnterpriseId(tab.getWxEnterpriseId());
staffClerkRelation.setWxUserId(obj.getWxUserId());
staffClerkRelation.setStaffId(obj.getStaffId());
staffClerkRelationApiService.delAndInsert(staffClerkRelation); }
staffClerkRelationApiService.delAndInsert(staffClerkRelation,tab.getCommitStaffId(), ChannelCodeEnum.AUDIT_BIND.getCode());
}
if(org.apache.commons.lang.StringUtils.isNotBlank(batchId)){
insertBatchLog( batchId,AuditRsultType.success.getCode(), tab);
}
......@@ -261,8 +259,12 @@ public class AuditApiServiceImpl implements AuditApiService{
if(org.apache.commons.lang.StringUtils.isNotBlank(batchId)){
insertBatchLog( batchId,AuditRsultType.success.getCode(),tab);
}
//解绑日志
StaffClerkRelationDTO relationDTO = staffClerkRelationApiService.getByClerkId(obj.getClerkId());
if (null != relationDTO) {
staffClerkRelationApiService.pushToBindLog(relationDTO.getStaffId(),tab.getCommitStaffId(),BindTypeEnum.UNBIND.getVal(),ChannelCodeEnum.SELF_UNBIND.getCode(),relationDTO.getStaffClerkRelationId());
}
staffClerkRelationApiService.delByClerkId(obj.getClerkId());
staffDepartmentRelatedApiService.sendClerkDel(obj.getClerkName(), obj.getClerkCode(),tab.getCommitStoreId(), 1, "");
}else if(auditType == AuditType.CLERK_UNBIND.getCode()){
//解绑申请,无需审核,直接通过
......
......@@ -7,9 +7,12 @@ import com.gic.binlog.base.entity.enums.GicRecordType;
import com.gic.commons.util.EntityUtil;
import com.gic.dubbo.entity.ProviderLocalTag;
import com.gic.haoban.contacts.manage.api.enums.StatusEnum;
import com.gic.haoban.manage.api.dto.StaffClerkBindLogInfoDTO;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.enums.ChannelCodeEnum;
import com.gic.haoban.manage.service.pojo.BinlogBasePojo;
import com.gic.haoban.manage.service.pojo.ClerkSyncPojo;
import com.gic.haoban.manage.service.service.StaffClerkBindLogService;
import com.gic.haoban.manage.service.service.StaffClerkRelationService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.time.DateUtils;
......@@ -37,6 +40,10 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor
@Autowired
private StaffClerkRelationService staffClerkRelationService;
@Autowired
private StaffClerkBindLogService staffClerkBindLogService;
@Override
public void onMessage(ConsumerRecord<String, GicRecord> record) {
......@@ -59,7 +66,7 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor
private void dealClerk(ClerkSyncPojo syncPojo) {
GicRecordType gicRecordType = GicRecordType.valueOf(syncPojo.getRecordType());
if(gicRecordType.equals(GicRecordType.DELETE)){
staffClerkRelationService.delBind(syncPojo.getClerkId());
staffClerkRelationService.delBind(syncPojo.getClerkId(),"-1", ChannelCodeEnum.SYNC_UNBIND.getCode());
}else if (gicRecordType.equals(GicRecordType.INSERT)) {
StaffClerkRelationDTO relationDTO = staffClerkRelationService.getOneBindCodeNoStatus(syncPojo.getEnterpriseId(), syncPojo.getClerkCode());
moveOrAddClerk(syncPojo,relationDTO);
......@@ -71,7 +78,7 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor
//非正常状态 删除
if (!syncPojo.getStatus().equals(1)) {
logger.info("删除操作:{}",syncPojo.getClerkId());
staffClerkRelationService.delBind(syncPojo.getClerkId());
staffClerkRelationService.delBind(syncPojo.getClerkId(),"-1", ChannelCodeEnum.SYNC_UNBIND.getCode());
}else {
List<String> clerkIds=new ArrayList<>();
clerkIds.add(syncPojo.getClerkId());
......@@ -104,17 +111,17 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor
}
//正常的时候
if (relationDTO.getStatusFlag() != StatusEnum.DEL.getValue()) {
staffClerkRelationService.delBind(relationDTO.getClerkId());
staffClerkRelationService.delBind(relationDTO.getClerkId(),"-1", ChannelCodeEnum.SYNC_UNBIND.getCode());
relationDTO.setClerkId(syncPojo.getClerkId());
relationDTO.setStoreId(syncPojo.getStoreId());
staffClerkRelationService.bind(relationDTO);
staffClerkRelationService.bind(relationDTO,"-1", ChannelCodeEnum.SYNC_BIND.getCode());
}else {//删除状态 需要判断是否近段时间有操作删除 2分组内有更新 判断是转移操作
Date timeDiff = DateUtils.addMinutes(new Date(), -2);
if(relationDTO.getUpdateTime().after(timeDiff)){
staffClerkRelationService.delBind(relationDTO.getClerkId());
staffClerkRelationService.delBind(relationDTO.getClerkId(),"-1", ChannelCodeEnum.SYNC_UNBIND.getCode());
relationDTO.setClerkId(syncPojo.getClerkId());
relationDTO.setStoreId(syncPojo.getStoreId());
staffClerkRelationService.bind(relationDTO);
staffClerkRelationService.bind(relationDTO,"-1", ChannelCodeEnum.SYNC_BIND.getCode());
}
}
}
......
<?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.StaffClerkBindLogMapper">
<resultMap id="BaseResultMap" type="com.gic.haoban.manage.service.entity.TabHaobanStaffClerkBindLog">
<id column="log_id" jdbcType="INTEGER" property="logId" />
<result column="staff_id" jdbcType="VARCHAR" property="staffId" />
<result column="wx_enterprise_id" jdbcType="VARCHAR" property="wxEnterpriseId" />
<result column="opt_staff_id" jdbcType="VARCHAR" property="optStaffId" />
<result column="opt_type" jdbcType="INTEGER" property="optType" />
<result column="channel_code" jdbcType="INTEGER" property="channelCode" />
<result column="enterprise_id" jdbcType="VARCHAR" property="enterpriseId" />
<result column="clerk_id" jdbcType="VARCHAR" property="clerkId" />
<result column="clerk_code" jdbcType="VARCHAR" property="clerkCode" />
<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">
log_id, staff_id, wx_enterprise_id, opt_staff_id, opt_type, channel_code, enterprise_id,
clerk_id, clerk_code, 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_staff_clerk_bind_log
where log_id = #{logId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tab_haoban_staff_clerk_bind_log
where log_id = #{logId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.gic.haoban.manage.service.entity.TabHaobanStaffClerkBindLog">
insert into tab_haoban_staff_clerk_bind_log (staff_id, wx_enterprise_id,
opt_staff_id, opt_type, channel_code,
enterprise_id, clerk_id, clerk_code,
status_flag, create_time, update_time
)
values ( #{staffId,jdbcType=VARCHAR}, #{wxEnterpriseId,jdbcType=VARCHAR},
#{optStaffId,jdbcType=VARCHAR}, #{optType,jdbcType=INTEGER}, #{channelCode,jdbcType=INTEGER},
#{enterpriseId,jdbcType=VARCHAR}, #{clerkId,jdbcType=VARCHAR}, #{clerkCode,jdbcType=VARCHAR},
#{statusFlag,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanStaffClerkBindLog">
insert into tab_haoban_staff_clerk_bind_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="logId != null">
log_id,
</if>
<if test="staffId != null">
staff_id,
</if>
<if test="wxEnterpriseId != null">
wx_enterprise_id,
</if>
<if test="optStaffId != null">
opt_staff_id,
</if>
<if test="optType != null">
opt_type,
</if>
<if test="channelCode != null">
channel_code,
</if>
<if test="enterpriseId != null">
enterprise_id,
</if>
<if test="clerkId != null">
clerk_id,
</if>
<if test="clerkCode != null">
clerk_code,
</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="logId != null">
#{logId,jdbcType=INTEGER},
</if>
<if test="staffId != null">
#{staffId,jdbcType=VARCHAR},
</if>
<if test="wxEnterpriseId != null">
#{wxEnterpriseId,jdbcType=VARCHAR},
</if>
<if test="optStaffId != null">
#{optStaffId,jdbcType=VARCHAR},
</if>
<if test="optType != null">
#{optType,jdbcType=INTEGER},
</if>
<if test="channelCode != null">
#{channelCode,jdbcType=INTEGER},
</if>
<if test="enterpriseId != null">
#{enterpriseId,jdbcType=VARCHAR},
</if>
<if test="clerkId != null">
#{clerkId,jdbcType=VARCHAR},
</if>
<if test="clerkCode != null">
#{clerkCode,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.TabHaobanStaffClerkBindLog">
update tab_haoban_staff_clerk_bind_log
<set>
<if test="staffId != null">
staff_id = #{staffId,jdbcType=VARCHAR},
</if>
<if test="wxEnterpriseId != null">
wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
</if>
<if test="optStaffId != null">
opt_staff_id = #{optStaffId,jdbcType=VARCHAR},
</if>
<if test="optType != null">
opt_type = #{optType,jdbcType=INTEGER},
</if>
<if test="channelCode != null">
channel_code = #{channelCode,jdbcType=INTEGER},
</if>
<if test="enterpriseId != null">
enterprise_id = #{enterpriseId,jdbcType=VARCHAR},
</if>
<if test="clerkId != null">
clerk_id = #{clerkId,jdbcType=VARCHAR},
</if>
<if test="clerkCode != null">
clerk_code = #{clerkCode,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 log_id = #{logId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.haoban.manage.service.entity.TabHaobanStaffClerkBindLog">
update tab_haoban_staff_clerk_bind_log
set staff_id = #{staffId,jdbcType=VARCHAR},
wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
opt_staff_id = #{optStaffId,jdbcType=VARCHAR},
opt_type = #{optType,jdbcType=INTEGER},
channel_code = #{channelCode,jdbcType=INTEGER},
enterprise_id = #{enterpriseId,jdbcType=VARCHAR},
clerk_id = #{clerkId,jdbcType=VARCHAR},
clerk_code = #{clerkCode,jdbcType=VARCHAR},
status_flag = #{statusFlag,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where log_id = #{logId,jdbcType=INTEGER}
</update>
<select id="listStaffClerkBindLog" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_haoban_staff_clerk_bind_log
where wx_enterprise_id=#{wxEnterpriseId}
<if test="clerkIds!=null and clerkIds.size()>0">
and clerk_id in
<foreach collection="clerkIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="staffIds!=null and staffIds.size()>0">
and staff_id in
<foreach collection="staffIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="enterpriseIds!=null and enterpriseIds.size()>0">
and enterprise_id in
<foreach collection="enterpriseIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</select>
</mapper>
\ No newline at end of file
......@@ -15,6 +15,8 @@ import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.*;
import com.gic.haoban.manage.api.enums.BindTypeEnum;
import com.gic.haoban.manage.api.enums.ChannelCodeEnum;
import com.gic.haoban.manage.api.service.*;
import com.gic.haoban.manage.web.auth.AuthRequestUtil;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
......@@ -285,11 +287,17 @@ public class StaffController extends WebBaseController{
*/
@RequestMapping("del-clerk-relation")
public HaobanResponse delStaffClerkList(String staffId,String clerkId){
LoginVO login = (LoginVO) AuthRequestUtil.getLoginUser();
StaffDTO staffDTO = login.getStaffDTO();
if (staffDTO==null) {
logger.info("登录异常");
return resultResponse(HaoBanErrCode.ERR_4);
}
StaffDTO staff = staffApiService.selectById(staffId);
if(staff == null) {
return resultResponse(HaoBanErrCode.ERR_10007);
}
boolean b = staffClerkRelationApiService.unbindByStaffAndClerkId(staffId, clerkId);
boolean b = staffClerkRelationApiService.unbindByStaffAndClerkId(staffDTO.getStaffId(), clerkId);
return resultResponse(HaoBanErrCode.ERR_1,b);
}
......@@ -348,6 +356,11 @@ public class StaffController extends WebBaseController{
*/
@RequestMapping("add-clerk-relation")
public HaobanResponse staffClerkSearch(String staffId,String clerkId){
LoginVO login = (LoginVO) AuthRequestUtil.getLoginUser();
StaffDTO loginStaffDTO = login.getStaffDTO();
if (null == loginStaffDTO) {
return resultResponse(HaoBanErrCode.ERR_4);
}
if (StringUtils.isAnyBlank(staffId,clerkId)) {
return resultResponse(HaoBanErrCode.ERR_2);
}
......@@ -369,7 +382,7 @@ public class StaffController extends WebBaseController{
relationDTO.setWxUserId(staffDTO.getWxUserId());
ServiceResponse response = staffClerkRelationApiService.bindStaffClerk(relationDTO);
ServiceResponse response = staffClerkRelationApiService.bindStaffClerk(relationDTO,loginStaffDTO.getStaffId(),ChannelCodeEnum.ADMIN_BIND.getCode());
logger.info("返回信息:{}", JSONObject.toJSONString(response));
if (response.getCode()==1) {
return resultResponse(HaoBanErrCode.ERR_1);
......
......@@ -4,6 +4,7 @@ package com.gic.haoban.manage.web.controller;
import java.util.ArrayList;
import java.util.List;
import com.gic.haoban.manage.api.enums.ChannelCodeEnum;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -236,7 +237,7 @@ public class AuditController extends WebBaseController{
staffClerkRelation.setWxEnterpriseId(wxEnterpriseId);
staffClerkRelation.setWxUserId(wxUserId);
staffClerkRelation.setStaffId(auditStaffId);
staffClerkRelationApiService.delAndInsert(staffClerkRelation);
staffClerkRelationApiService.delAndInsert(staffClerkRelation,staffId, ChannelCodeEnum.AUDIT_BIND.getCode());
audit.setAuditStatus(1);
//发送消息
staffDepartmentRelatedApiService.sendClerkBind(auditStaffId, clerkCode,storeId, auditStatus, auditReason);
......
......@@ -8,6 +8,7 @@ import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import com.gic.haoban.manage.api.enums.*;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -45,9 +46,6 @@ import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.enums.AppPageType;
import com.gic.haoban.manage.api.enums.AuditStatus;
import com.gic.haoban.manage.api.enums.AuditType;
import com.gic.haoban.manage.api.service.AuditApiService;
import com.gic.haoban.manage.api.service.AuditSettingApiService;
import com.gic.haoban.manage.api.service.BindApiService;
......@@ -528,7 +526,7 @@ public class ClerkController extends WebBaseController{
staffClerkRelation.setWxUserId(wxUserId);
staffClerkRelation.setStaffId(staffId);
staffClerkRelationApiService.insertOrUpdate(staffClerkRelation);
staffClerkRelationApiService.delAndInsert(staffClerkRelation,staffId,ChannelCodeEnum.SELF_BIND.getCode());
//无需审核
AuditDTO audit = new AuditDTO();
......@@ -650,6 +648,8 @@ public class ClerkController extends WebBaseController{
// auditApiService.insert(audit);
staffClerkRelationApiService.delByStoreIdAndCode(storeId, clerkCode);
//加入日志
staffClerkRelationApiService.pushToBindLog(staffClerkRelation.getStaffId(),staffId, BindTypeEnum.UNBIND.getVal(), ChannelCodeEnum.SELF_UNBIND.getCode(),staffClerkRelation.getStaffClerkRelationId());
return resultResponse(HaoBanErrCode.ERR_1);
}
......
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