Commit 30e5d514 by qwmqiuwenmin

Merge branch 'developer' into 'master'

Developer

See merge request haoban3.0/haoban-manage3.0!73
parents bf32d279 46dc4f58
...@@ -48,8 +48,18 @@ public class AuditDTO implements Serializable { ...@@ -48,8 +48,18 @@ public class AuditDTO implements Serializable {
private String relatedId; private String relatedId;
private String auditStaffId;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public String getAuditStaffId() {
return auditStaffId;
}
public void setAuditStaffId(String auditStaffId) {
this.auditStaffId = auditStaffId;
}
public String getRelatedId() { public String getRelatedId() {
return relatedId; return relatedId;
} }
......
package com.gic.haoban.manage.api.dto;
import java.io.Serializable;
import java.util.Date;
public class ExternalClerkRelatedDTO implements Serializable {
private String externalClerkRelatedId;
private String wxEnterpriseId;
private String enterpriseId;
private String storeId;
private String memberId;
private String unionid;
private String externalUserId;
private String externalName;
private String addCreateTime;
private String memberUnionidRelatedId;
private String clerkId;
private String staffId;
private String wxUserId;
private Integer statusFlag;
private Date createTime;
private Date updateTime;
private static final long serialVersionUID = 1L;
public String getExternalClerkRelatedId() {
return externalClerkRelatedId;
}
public void setExternalClerkRelatedId(String externalClerkRelatedId) {
this.externalClerkRelatedId = externalClerkRelatedId == null ? null : externalClerkRelatedId.trim();
}
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId == null ? null : wxEnterpriseId.trim();
}
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId == null ? null : enterpriseId.trim();
}
public String getStoreId() {
return storeId;
}
public void setStoreId(String storeId) {
this.storeId = storeId == null ? null : storeId.trim();
}
public String getMemberId() {
return memberId;
}
public void setMemberId(String memberId) {
this.memberId = memberId == null ? null : memberId.trim();
}
public String getUnionid() {
return unionid;
}
public void setUnionid(String unionid) {
this.unionid = unionid == null ? null : unionid.trim();
}
public String getExternalName() {
return externalName;
}
public void setExternalName(String externalName) {
this.externalName = externalName == null ? null : externalName.trim();
}
public String getAddCreateTime() {
return addCreateTime;
}
public void setAddCreateTime(String addCreateTime) {
this.addCreateTime = addCreateTime == null ? null : addCreateTime.trim();
}
public String getMemberUnionidRelatedId() {
return memberUnionidRelatedId;
}
public void setMemberUnionidRelatedId(String memberUnionidRelatedId) {
this.memberUnionidRelatedId = memberUnionidRelatedId == null ? null : memberUnionidRelatedId.trim();
}
public String getClerkId() {
return clerkId;
}
public void setClerkId(String clerkId) {
this.clerkId = clerkId == null ? null : clerkId.trim();
}
public String getStaffId() {
return staffId;
}
public void setStaffId(String staffId) {
this.staffId = staffId == null ? null : staffId.trim();
}
public String getWxUserId() {
return wxUserId;
}
public void setWxUserId(String wxUserId) {
this.wxUserId = wxUserId == null ? null : wxUserId.trim();
}
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;
}
public String getExternalUserId() {
return externalUserId;
}
public void setExternalUserId(String externalUserId) {
this.externalUserId = externalUserId;
}
}
\ No newline at end of file
...@@ -35,6 +35,8 @@ public class MemberUnionidRelatedDTO implements Serializable{ ...@@ -35,6 +35,8 @@ public class MemberUnionidRelatedDTO implements Serializable{
private Date updateTime; private Date updateTime;
private String avatar;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public String getMemberUnionidRelatedId() { public String getMemberUnionidRelatedId() {
...@@ -157,5 +159,13 @@ public class MemberUnionidRelatedDTO implements Serializable{ ...@@ -157,5 +159,13 @@ public class MemberUnionidRelatedDTO implements Serializable{
this.enterpriseId = enterpriseId; this.enterpriseId = enterpriseId;
} }
public String getAvatar() {
return avatar;
}
public void setAvatar(String avatar) {
this.avatar = avatar;
}
} }
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;
private String clerkPhone;
/**
* 关联id
*/
private String relationId;
/**
* 创建时间
*
*/
private Date createTime;
/**
* 更新时间
*
*/
private Date updateTime;
/**
*/
private static final long serialVersionUID = 1L;
public String getClerkPhone() {
return clerkPhone;
}
public void setClerkPhone(String clerkPhone) {
this.clerkPhone = clerkPhone;
}
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(0),
UNBIND(1);
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,"GIC同步绑定"),
ADMIN_UNBIND(2001,"后台管理员解绑"),
SELF_UNBIND(2002,"好办客户端解绑"),
SYNC_UNBIND(2003,"GIC同步解绑"),
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;
}
}
...@@ -15,9 +15,9 @@ public interface AuditApiService { ...@@ -15,9 +15,9 @@ public interface AuditApiService {
Page<AuditDTO> page(Integer auditType, String search,String wxEnterpriseId,String enterpriseId,Integer auditStatus,Integer auditFlag,BasePageInfo pageInfo); Page<AuditDTO> page(Integer auditType, String search,String wxEnterpriseId,String enterpriseId,Integer auditStatus,Integer auditFlag,BasePageInfo pageInfo);
String audit(String batchId,String auditId,String aduitName); String audit(String batchId,String auditId,String aduitName,String optStaffId);
void refuse(String auditId,String auditReason,String aduitName); void refuse(String auditId,String auditReason,String aduitStaffId,String aduitName);
int save(Integer auditType,String wxEnterpriseId,String enterpriseId,String commitStaffId,String commitStoreId,String changeField,String oldValue,String newValue); int save(Integer auditType,String wxEnterpriseId,String enterpriseId,String commitStaffId,String commitStoreId,String changeField,String oldValue,String newValue);
......
package com.gic.haoban.manage.api.service;
import java.util.Date;
import java.util.List;
import com.gic.api.base.commons.Page;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.manage.api.dto.AuditDTO;
import com.gic.haoban.manage.api.dto.BatchAuditLogDTO;
import com.gic.haoban.manage.api.dto.ExternalClerkRelatedDTO;
import com.gic.haoban.manage.api.dto.MemberUnionidRelatedDTO;
/**
* Created by tgs on 2020/2/9.
*/
public interface ExternalClerkRelatedApiService {
List<ExternalClerkRelatedDTO> listByEnterpriseIdAndDate(String enterpriseId,Date date);
Page<ExternalClerkRelatedDTO> pageMemberUnionByParams(List<String> userIdList, List<String> sendMemberIds,
String enterpriseId, BasePageInfo pageInfo);
List<ExternalClerkRelatedDTO> listByWxEnterpriseIdAndWxUserId(String wxUserId, String wxEnterpriseId);
List<ExternalClerkRelatedDTO> listByWxEnterpriseIdAndWxUserIds(List<String> userIdList, String wxEnterpriseId);
}
...@@ -25,9 +25,9 @@ public interface MemberUnionidRelatedApiService { ...@@ -25,9 +25,9 @@ public interface MemberUnionidRelatedApiService {
List<MemberStoreDTO> listByExTernalUseridAndWxUserId(String externalUserid, String wxUserId); List<MemberStoreDTO> listByExTernalUseridAndWxUserId(String externalUserid, String wxUserId);
String add(String wxEnterpriseId, String selfExternalUserId, String userId1); String add(String wxEnterpriseId, String selfExternalUserId, String userId1,String storeId);
void freshWxFrend(String wxEnterpriseId, String wxUserId); void freshWxFrend(String wxEnterpriseId, String wxUserId,String storeId);
public void cleanByCid(String cid); public void cleanByCid(String cid);
...@@ -40,4 +40,8 @@ public interface MemberUnionidRelatedApiService { ...@@ -40,4 +40,8 @@ public interface MemberUnionidRelatedApiService {
List<MemberUnionidRelatedDTO> getByWxUserIdListAndWxEnterpriseId(List<String> userIdList, String wxEnterpriseId); List<MemberUnionidRelatedDTO> getByWxUserIdListAndWxEnterpriseId(List<String> userIdList, String wxEnterpriseId);
String addMemberUnionidRelatedNew(MemberUnionidRelatedDTO dto);
void mqFreshWxFrend(String res);
} }
...@@ -3,11 +3,19 @@ package com.gic.haoban.manage.api.service; ...@@ -3,11 +3,19 @@ package com.gic.haoban.manage.api.service;
import java.util.List; import java.util.List;
import java.util.Set; 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.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.StaffClerkInfoDTO;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO; import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
public interface StaffClerkRelationApiService { public interface StaffClerkRelationApiService {
/**
* 绑定日志
* @param params
*/
public void bindLogMq(String params);
List<StaffClerkRelationDTO> listBindCode(String enterpriseId, Set<String> clerkCodeList); List<StaffClerkRelationDTO> listBindCode(String enterpriseId, Set<String> clerkCodeList);
...@@ -24,16 +32,14 @@ public interface StaffClerkRelationApiService { ...@@ -24,16 +32,14 @@ public interface StaffClerkRelationApiService {
* 绑定 * 绑定
* @return * @return
*/ */
public ServiceResponse bindStaffClerk(StaffClerkRelationDTO staffClerkRelationDTO); public ServiceResponse bindStaffClerk(StaffClerkRelationDTO staffClerkRelationDTO,String optStaffId,int chanelCode);
StaffClerkRelationDTO getByCodeAndEnterpriseId(String clerkCode, String enterpriseId); 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 * @param storeId
...@@ -56,7 +62,7 @@ public interface StaffClerkRelationApiService { ...@@ -56,7 +62,7 @@ public interface StaffClerkRelationApiService {
/** /**
* 解绑 * 解绑
* @param staffId * @param staffId 操作人
* @param clerkId * @param clerkId
* @return * @return
*/ */
...@@ -88,4 +94,24 @@ public interface StaffClerkRelationApiService { ...@@ -88,4 +94,24 @@ public interface StaffClerkRelationApiService {
*/ */
void delByClerkId(String clerkId); 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);
} }
...@@ -34,7 +34,7 @@ public interface MemberUnionidRelatedMapper { ...@@ -34,7 +34,7 @@ public interface MemberUnionidRelatedMapper {
List<MemberUnionidRelated> listByEnterpriseIdAndDate(@Param("enterpriseId")String enterpriseId,@Param("date")Date date); List<MemberUnionidRelated> listByEnterpriseIdAndDate(@Param("enterpriseId")String enterpriseId,@Param("date")Date date);
MemberUnionidRelated getByParams(@Param("wxUserId")String wxUserId, @Param("enterpriseId")String enterpriseId, MemberUnionidRelated getByParams(@Param("wxUserId")String wxUserId, @Param("wxEnterpriseId")String wxEnterpriseId,
@Param("externalName")String name, @Param("addCreateTime")String createTime); @Param("externalName")String name, @Param("addCreateTime")String createTime);
List<MemberUnionidRelated> listByExTernalUseridAndWxUserId(@Param("externalUserid")String externalUserid, @Param("wxUserId")String wxUserId); List<MemberUnionidRelated> listByExTernalUseridAndWxUserId(@Param("externalUserid")String externalUserid, @Param("wxUserId")String wxUserId);
...@@ -43,4 +43,6 @@ public interface MemberUnionidRelatedMapper { ...@@ -43,4 +43,6 @@ public interface MemberUnionidRelatedMapper {
@Param("enterpriseId")String enterpriseId); @Param("enterpriseId")String enterpriseId);
List<MemberUnionidRelated> getByWxUserIdListAndWxEnterpriseId(@Param("userIdList")List<String> userIdList, @Param("wxEnterpriseId")String wxEnterpriseId); List<MemberUnionidRelated> getByWxUserIdListAndWxEnterpriseId(@Param("userIdList")List<String> userIdList, @Param("wxEnterpriseId")String wxEnterpriseId);
void cleanStaffRelated(@Param("wxEnterpriseId")String wxEnterpriseId, @Param("staffIds")List<String> staffIds);
} }
\ No newline at end of file
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,@Param("search") String search);
}
\ No newline at end of file
...@@ -42,4 +42,6 @@ public interface StaffMapper { ...@@ -42,4 +42,6 @@ public interface StaffMapper {
public int cleanStaff(@Param("wxEnterpriseId")String wxEnterpriseId,@Param("staffIds")List<String> staffIds); public int cleanStaff(@Param("wxEnterpriseId")String wxEnterpriseId,@Param("staffIds")List<String> staffIds);
TabHaobanStaff getWxStaffByOne(@Param("wxEnterpriseId")String wxEnterpriseId); TabHaobanStaff getWxStaffByOne(@Param("wxEnterpriseId")String wxEnterpriseId);
public List<String> listUserStaffId(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("staffIds") List<String> staffIds);
} }
\ No newline at end of file
package com.gic.haoban.manage.service.dao.mapper;
import java.util.Date;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.gic.haoban.manage.service.entity.TabHaobanExternalClerkRelated;
import com.github.pagehelper.Page;
public interface TabHaobanExternalClerkRelatedMapper {
int deleteByPrimaryKey(String externalClerkRelatedId);
int insert(TabHaobanExternalClerkRelated record);
int insertSelective(TabHaobanExternalClerkRelated record);
TabHaobanExternalClerkRelated selectByPrimaryKey(String externalClerkRelatedId);
int updateByPrimaryKeySelective(TabHaobanExternalClerkRelated record);
int updateByPrimaryKey(TabHaobanExternalClerkRelated record);
TabHaobanExternalClerkRelated selectByClerkIdAndExternalUserId(@Param("clerkId")String clerkId, @Param("externalUserId")String externalUserId);
void delByUserIdAndExternalUserId(TabHaobanExternalClerkRelated record);
void delByClerkIdAndStaffId(@Param("clerkId")String clerkId, @Param("staffId")String staffId);
void cleanStaffRelated(@Param("wxEnterpriseId")String wxEnterpriseId, @Param("staffIds")List<String> staffIds);
TabHaobanExternalClerkRelated getByParams(@Param("userId")String userId, @Param("wxEnterpriseId")String wxEnterpriseId, @Param("name")String name, @Param("createTime")String createTime);
List<TabHaobanExternalClerkRelated> listByExTernalUseridAndWxUserId(@Param("externalUserid")String externalUserid, @Param("userId")String wxUserId);
List<TabHaobanExternalClerkRelated> listByEnterpriseIdAndDate(@Param("enterpriseId")String enterpriseId,@Param("date")Date date);
Page<TabHaobanExternalClerkRelated> pageMemberUnionByParams(@Param("userIdList")List<String> userIdList, @Param("sendMemberIds")List<String> sendMemberIds,
@Param("enterpriseId")String enterpriseId);
List<TabHaobanExternalClerkRelated> listByWxEnterpriseIdAndWxUserId(@Param("wxUserId")String wxUserId, @Param("wxEnterpriseId")String wxEnterpriseId);
List<TabHaobanExternalClerkRelated> listByWxEnterpriseIdAndWxUserIds(@Param("userIdList")List<String> userIdList, @Param("wxEnterpriseId")String wxEnterpriseId);
}
\ No newline at end of file
...@@ -79,4 +79,8 @@ public interface TabHaobanStaffClerkRelationMapper { ...@@ -79,4 +79,8 @@ public interface TabHaobanStaffClerkRelationMapper {
void delByClerkId(@Param("clerkId")String clerkId); void delByClerkId(@Param("clerkId")String clerkId);
List<TabHaobanStaffClerkRelation>listByEnterpriseIdAndWxUserId(@Param("enterpriseId")String enterpriseId,@Param("wxUserId")String wxUserId); List<TabHaobanStaffClerkRelation>listByEnterpriseIdAndWxUserId(@Param("enterpriseId")String enterpriseId,@Param("wxUserId")String wxUserId);
List<TabHaobanStaffClerkRelation> lisByStaffId(@Param("wxEnterpriseId")String wxEnterpriseId, @Param("staffId")String staffId);
TabHaobanStaffClerkRelation getByCodeAndStoreId(@Param("clerkCode")String clerkCode, @Param("storeId")String storeId);
} }
\ No newline at end of file
...@@ -137,5 +137,4 @@ public class MemberUnionidRelated implements Serializable { ...@@ -137,5 +137,4 @@ public class MemberUnionidRelated implements Serializable {
} }
} }
\ No newline at end of file
...@@ -44,8 +44,18 @@ public class TabHaobanAudit implements Serializable { ...@@ -44,8 +44,18 @@ public class TabHaobanAudit implements Serializable {
private String relatedId; private String relatedId;
private String auditStaffId;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public String getAuditStaffId() {
return auditStaffId;
}
public void setAuditStaffId(String auditStaffId) {
this.auditStaffId = auditStaffId;
}
public String getRelatedId() { public String getRelatedId() {
return relatedId; return relatedId;
} }
......
package com.gic.haoban.manage.service.entity;
import java.io.Serializable;
import java.util.Date;
public class TabHaobanExternalClerkRelated implements Serializable {
private String externalClerkRelatedId;
private String wxEnterpriseId;
private String enterpriseId;
private String storeId;
private String memberId;
private String unionid;
private String externalUserId;
private String externalName;
private String addCreateTime;
private String memberUnionidRelatedId;
private String clerkId;
private String staffId;
private String wxUserId;
private Integer statusFlag;
private Date createTime;
private Date updateTime;
private static final long serialVersionUID = 1L;
public String getExternalClerkRelatedId() {
return externalClerkRelatedId;
}
public void setExternalClerkRelatedId(String externalClerkRelatedId) {
this.externalClerkRelatedId = externalClerkRelatedId == null ? null : externalClerkRelatedId.trim();
}
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId == null ? null : wxEnterpriseId.trim();
}
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId == null ? null : enterpriseId.trim();
}
public String getStoreId() {
return storeId;
}
public void setStoreId(String storeId) {
this.storeId = storeId == null ? null : storeId.trim();
}
public String getMemberId() {
return memberId;
}
public void setMemberId(String memberId) {
this.memberId = memberId == null ? null : memberId.trim();
}
public String getUnionid() {
return unionid;
}
public void setUnionid(String unionid) {
this.unionid = unionid == null ? null : unionid.trim();
}
public String getExternalName() {
return externalName;
}
public void setExternalName(String externalName) {
this.externalName = externalName == null ? null : externalName.trim();
}
public String getAddCreateTime() {
return addCreateTime;
}
public void setAddCreateTime(String addCreateTime) {
this.addCreateTime = addCreateTime == null ? null : addCreateTime.trim();
}
public String getMemberUnionidRelatedId() {
return memberUnionidRelatedId;
}
public void setMemberUnionidRelatedId(String memberUnionidRelatedId) {
this.memberUnionidRelatedId = memberUnionidRelatedId == null ? null : memberUnionidRelatedId.trim();
}
public String getClerkId() {
return clerkId;
}
public void setClerkId(String clerkId) {
this.clerkId = clerkId == null ? null : clerkId.trim();
}
public String getStaffId() {
return staffId;
}
public void setStaffId(String staffId) {
this.staffId = staffId == null ? null : staffId.trim();
}
public String getWxUserId() {
return wxUserId;
}
public void setWxUserId(String wxUserId) {
this.wxUserId = wxUserId == null ? null : wxUserId.trim();
}
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;
}
public String getExternalUserId() {
return externalUserId;
}
public void setExternalUserId(String externalUserId) {
this.externalUserId = externalUserId;
}
}
\ 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;
private String clerkPhone;
/**
* 关联id
*/
private String relationId;
/**
* 0 删除 1正常
*
*/
private Integer statusFlag;
/**
* 创建时间
*
*/
private Date createTime;
/**
* 更新时间
*
*/
private Date updateTime;
/**
*/
private static final long serialVersionUID = 1L;
public String getClerkPhone() {
return clerkPhone;
}
public void setClerkPhone(String clerkPhone) {
this.clerkPhone = clerkPhone;
}
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.pojo;
import java.io.Serializable;
public class ExternalUserPojo implements Serializable{
private String wxEnterpriseId;
private String name;
private String unionId;
private String avatar;
private String addCreateTime;
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUnionId() {
return unionId;
}
public void setUnionId(String unionId) {
this.unionId = unionId;
}
public String getAvatar() {
return avatar;
}
public void setAvatar(String avatar) {
this.avatar = avatar;
}
public String getAddCreateTime() {
return addCreateTime;
}
public void setAddCreateTime(String addCreateTime) {
this.addCreateTime = addCreateTime;
}
}
package com.gic.haoban.manage.service.service;
import java.util.List;
import com.gic.haoban.manage.api.dto.MemberUnionidRelatedDTO;
import com.gic.haoban.manage.service.entity.TabHaobanExternalClerkRelated;
public interface ExternalClerkRelatedService {
void insert(TabHaobanExternalClerkRelated related);
void delByUserIdAndExternalUserId(MemberUnionidRelatedDTO dto);
void delByClerkIdAndStaffId(String clerkId, String staffId);
void cleanStaffRelated(String wxEnterpriseId, List<String> staffIds);
void update(TabHaobanExternalClerkRelated exsitDTO);
TabHaobanExternalClerkRelated getByParams(String userId, String wxEnterpriseId, String name, String createTime);
List<TabHaobanExternalClerkRelated> listByExTernalUseridAndWxUserId(String externalUserid, String wxUserId);
}
...@@ -25,4 +25,6 @@ public interface MemberUnionRelatedService { ...@@ -25,4 +25,6 @@ public interface MemberUnionRelatedService {
com.github.pagehelper.Page<MemberUnionidRelated> pageMemberUnionByParams(List<String> userIdList, List<String> sendMemberIds, com.github.pagehelper.Page<MemberUnionidRelated> pageMemberUnionByParams(List<String> userIdList, List<String> sendMemberIds,
String enterpriseId); String enterpriseId);
void cleanStaffRelated(String wxEnterpriseId, List<String> staffIds);
} }
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,String search, BasePageInfo pageInfo);
}
...@@ -17,14 +17,14 @@ public interface StaffClerkRelationService { ...@@ -17,14 +17,14 @@ public interface StaffClerkRelationService {
* @param clerkId * @param clerkId
* @return * @return
*/ */
public boolean delBind(String clerkId); public boolean delBind(String clerkId,String optStaffId,int chanelCode);
/** /**
* 绑定 * 绑定
* @param dto * @param dto
* @return * @return
*/ */
public boolean bind(StaffClerkRelationDTO dto); public String bind(StaffClerkRelationDTO dto,String optStaffId,int chanelCode);
/** /**
* 根据clerkId 更新数据 * 根据clerkId 更新数据
...@@ -55,4 +55,6 @@ public interface StaffClerkRelationService { ...@@ -55,4 +55,6 @@ public interface StaffClerkRelationService {
List<StaffClerkRelationDTO> listByClerkIds(List<String> clerkList); List<StaffClerkRelationDTO> listByClerkIds(List<String> clerkList);
List<StaffClerkRelationDTO> lisByStaffId(String wxEnterpriseId, String staffId);
} }
...@@ -35,4 +35,12 @@ public interface StaffService { ...@@ -35,4 +35,12 @@ public interface StaffService {
TabHaobanStaff getWxStaffByOne( String wxEnterpriseId); TabHaobanStaff getWxStaffByOne( String wxEnterpriseId);
/**
* 获取需要删除的staff列表
* @param wxEnterpriseId
* @param staffIds
* @return
*/
public List<String> listDelUserStaffId(String wxEnterpriseId,List<String> staffIds);
} }
package com.gic.haoban.manage.service.service.impl;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import com.alibaba.dubbo.config.annotation.Service;
import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.common.utils.StringUtil;
import com.gic.haoban.manage.api.dto.MemberUnionidRelatedDTO;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanExternalClerkRelatedMapper;
import com.gic.haoban.manage.service.entity.TabHaobanExternalClerkRelated;
import com.gic.haoban.manage.service.service.ExternalClerkRelatedService;
@Service
public class ExternalClerkRelatedServiceImpl implements ExternalClerkRelatedService {
@Autowired
private TabHaobanExternalClerkRelatedMapper mapper;
@Override
public void insert(TabHaobanExternalClerkRelated related) {
String clerkId = related.getClerkId();
String externalUserId = related.getExternalUserId();
TabHaobanExternalClerkRelated tab = mapper.selectByClerkIdAndExternalUserId(clerkId,externalUserId);
if(tab == null){
String uuId = StringUtil.randomUUID();
related.setStatusFlag(1);
related.setExternalClerkRelatedId(uuId);
related.setCreateTime(new Date());
related.setUpdateTime(new Date());
mapper.insertSelective(related);
}
}
@Override
public void delByUserIdAndExternalUserId(MemberUnionidRelatedDTO dto) {
mapper.delByUserIdAndExternalUserId(EntityUtil.changeEntityByJSON(TabHaobanExternalClerkRelated.class, dto));
}
@Override
public void delByClerkIdAndStaffId(String clerkId, String staffId) {
mapper.delByClerkIdAndStaffId(clerkId,staffId);
}
@Override
public void cleanStaffRelated(String wxEnterpriseId, List<String> staffIds) {
if(staffIds != null && !staffIds.isEmpty()){
mapper.cleanStaffRelated(wxEnterpriseId,staffIds);
}
}
@Override
public void update(TabHaobanExternalClerkRelated exsitDTO) {
exsitDTO.setUpdateTime(new Date());
mapper.updateByPrimaryKeySelective(exsitDTO);
}
@Override
public TabHaobanExternalClerkRelated getByParams(String userId, String wxEnterpriseId, String name,
String createTime) {
return mapper.getByParams(userId, wxEnterpriseId,name,createTime);
}
@Override
public List<TabHaobanExternalClerkRelated> listByExTernalUseridAndWxUserId(String externalUserid, String wxUserId) {
return mapper.listByExTernalUseridAndWxUserId(externalUserid,wxUserId);
}
}
...@@ -50,8 +50,8 @@ public class MemberUnionRelatedServiceImpl implements MemberUnionRelatedService ...@@ -50,8 +50,8 @@ public class MemberUnionRelatedServiceImpl implements MemberUnionRelatedService
} }
@Override @Override
public MemberUnionidRelatedDTO getByParams(String wxUserId, String enterpriseId, String name, String createTime) { public MemberUnionidRelatedDTO getByParams(String wxUserId, String wxEnterpriseId, String name, String createTime) {
return EntityUtil.changeEntityByJSON(MemberUnionidRelatedDTO.class,mapper.getByParams(wxUserId,enterpriseId,name,createTime)); return EntityUtil.changeEntityByJSON(MemberUnionidRelatedDTO.class,mapper.getByParams(wxUserId,wxEnterpriseId,name,createTime));
} }
@Override @Override
...@@ -70,4 +70,12 @@ public class MemberUnionRelatedServiceImpl implements MemberUnionRelatedService ...@@ -70,4 +70,12 @@ public class MemberUnionRelatedServiceImpl implements MemberUnionRelatedService
String enterpriseId) { String enterpriseId) {
return mapper.pageMemberUnionByParams(userIdList,sendMemberIds,enterpriseId); return mapper.pageMemberUnionByParams(userIdList,sendMemberIds,enterpriseId);
} }
@Override
public void cleanStaffRelated(String wxEnterpriseId, List<String> staffIds) {
if(staffIds == null || staffIds.isEmpty()){
return;
}
mapper.cleanStaffRelated(wxEnterpriseId,staffIds);
}
} }
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.insertSelective(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,String search, BasePageInfo pageInfo) {
PageHelper.startPage(pageInfo);
List<TabHaobanStaffClerkBindLog> clerkBindLogList = staffClerkBindLogMapper.listStaffClerkBindLog(wxEnterpriseId, clerkIds, staffIds, enterpriseIds, optType,search);
Page<StaffClerkBindLogDetailDTO> retPage = PageUtil.changePageHelperToCurrentPage(new PageInfo<>(clerkBindLogList), StaffClerkBindLogDetailDTO.class);
return retPage;
}
}
...@@ -7,10 +7,17 @@ import java.util.Set; ...@@ -7,10 +7,17 @@ import java.util.Set;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.gic.commons.util.ToolUtil; 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.TabHaobanClerkMainStoreRelated;
import com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation; import com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation;
import com.gic.haoban.manage.service.service.ClerkMainStoreRelatedService;
import com.gic.haoban.manage.service.service.ExternalClerkRelatedService;
import com.gic.haoban.manage.service.service.StaffClerkBindLogService;
import com.gic.haoban.manage.service.service.StaffService;
import javafx.scene.control.Tab; import javafx.scene.control.Tab;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -30,6 +37,22 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService ...@@ -30,6 +37,22 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
@Autowired @Autowired
private TabHaobanStaffClerkRelationMapper mapper; private TabHaobanStaffClerkRelationMapper mapper;
@Autowired
private StaffClerkBindLogService staffClerkBindLogService;
@Autowired
private ExternalClerkRelatedService externalClerkRelatedService;
@Autowired
private StaffService staffService;
@Autowired
private TabHaobanStaffClerkRelationMapper tabHaobanStaffClerkRelationMapper;
@Autowired
private ClerkMainStoreRelatedService clerkMainStoreRelatedService;
@Override @Override
public List<StaffClerkRelationDTO> listBindCode(String enterpriseId, Set<String> clerkCodeList) { public List<StaffClerkRelationDTO> listBindCode(String enterpriseId, Set<String> clerkCodeList) {
return EntityUtil.changeEntityListByJSON(StaffClerkRelationDTO.class, mapper.listBindCode(enterpriseId,clerkCodeList)); return EntityUtil.changeEntityListByJSON(StaffClerkRelationDTO.class, mapper.listBindCode(enterpriseId,clerkCodeList));
...@@ -40,20 +63,68 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService ...@@ -40,20 +63,68 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
} }
@Override @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;
}
TabHaobanStaffClerkRelation staffClerkRelation = tabHaobanStaffClerkRelationMapper.getOneByClerkId(clerkId);
int i = mapper.changeStatusByClerkId(clerkId, 0); int i = mapper.changeStatusByClerkId(clerkId, 0);
return i>=0; delSetMainStore(staffClerkRelation);
boolean b = i >= 0;
if (b) {
//推入日志
staffClerkBindLogService.pushToMq(clerkRelation.getStaffId(),optStaffId, BindTypeEnum.UNBIND.getVal(),chanelCode,clerkRelation.getStaffClerkRelationId());
}
return b;
}
private void delSetMainStore(TabHaobanStaffClerkRelation staffClerkRelation){
if(staffClerkRelation == null){
logger.info("staffClerkRelation为空");
return;
}
String staffId = staffClerkRelation.getStaffId();
String wxEnterpriseId = staffClerkRelation.getWxEnterpriseId();
TabHaobanClerkMainStoreRelated r = clerkMainStoreRelatedService.selectByWxEnterpriseIdAndStoreId(staffId, wxEnterpriseId);
r.setStatusFlag(0);
clerkMainStoreRelatedService.update(r);
externalClerkRelatedService.delByClerkIdAndStaffId(staffClerkRelation.getClerkId(), staffId);
List<StaffClerkRelationDTO> list = this.lisByStaffId(wxEnterpriseId, staffId);
if(list != null && list.size() >= 1){
clerkMainStoreRelatedService.setMainStore(staffId, list.get(list.size()-1).getStoreId(), wxEnterpriseId);
}
}
private void setMainStore(StaffClerkRelationDTO staffClerkRelation){
if(staffClerkRelation == null){
logger.info("staffClerkRelation为空");
return;
}
String staffId = staffClerkRelation.getStaffId();
String wxEnterpriseId = staffClerkRelation.getWxEnterpriseId();
List<StaffClerkRelationDTO> list = this.lisByStaffId(wxEnterpriseId, staffId);
if(list != null && list.size() == 1){
clerkMainStoreRelatedService.setMainStore(staffId, staffClerkRelation.getStoreId(), wxEnterpriseId);
}
} }
@Override @Override
public boolean bind(StaffClerkRelationDTO dto) { public String bind(StaffClerkRelationDTO dto,String optStaffId,int chanelCode) {
dto.setStaffClerkRelationId(ToolUtil.randomUUID()); dto.setStaffClerkRelationId(ToolUtil.randomUUID());
dto.setStatusFlag(1); dto.setStatusFlag(1);
dto.setCreateTime(new Date()); dto.setCreateTime(new Date());
dto.setUpdateTime(new Date()); dto.setUpdateTime(new Date());
int insert = mapper.insert(EntityUtil.changeEntityByJSON(TabHaobanStaffClerkRelation.class, dto)); int insert = mapper.insert(EntityUtil.changeEntityByJSON(TabHaobanStaffClerkRelation.class, dto));
return insert>0; setMainStore(dto);
String s = insert > 0 ? dto.getStaffClerkRelationId() : null;
if (null != s) {
//推入日志
staffClerkBindLogService.pushToMq(dto.getStaffId(),optStaffId, BindTypeEnum.BIND.getVal(),chanelCode,dto.getStaffClerkRelationId());
}
return s;
} }
@Override @Override
...@@ -66,6 +137,8 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService ...@@ -66,6 +137,8 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
return i>=0; return i>=0;
} }
@Override @Override
public StaffClerkRelationDTO getBindByClerkId(String clerkId, String wxEnterpriseId) { public StaffClerkRelationDTO getBindByClerkId(String clerkId, String wxEnterpriseId) {
TabHaobanStaffClerkRelation relation = mapper.getBindByClerkId(clerkId, wxEnterpriseId); TabHaobanStaffClerkRelation relation = mapper.getBindByClerkId(clerkId, wxEnterpriseId);
...@@ -88,8 +161,18 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService ...@@ -88,8 +161,18 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
return uuid; return uuid;
} }
@Override @Override
public int cleanStaffClerk(String wxEnterpriseId, List<String> staffIds) { public int cleanStaffClerk(String wxEnterpriseId, List<String> delStaffIds) {
return mapper.cleanStaffDepart(wxEnterpriseId,staffIds); delStaffIds.forEach(staffId->{
List<StaffClerkRelationDTO> relationDTOS = listBindCodeByStaffId(null, staffId);
if (CollectionUtils.isNotEmpty(relationDTOS)) {
relationDTOS.forEach(mid->{
staffClerkBindLogService.pushToMq(mid.getStaffId(),"-1",BindTypeEnum.UNBIND.getVal(), ChannelCodeEnum.WEIXIN_DEL.getCode(),mid.getStaffClerkRelationId());
});
}
});
int ret = mapper.cleanStaffDepart(wxEnterpriseId, delStaffIds);
externalClerkRelatedService.cleanStaffRelated(wxEnterpriseId,delStaffIds);
return ret;
} }
@Override @Override
...@@ -112,4 +195,8 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService ...@@ -112,4 +195,8 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
} }
return EntityUtil.changeEntityListByJSON(StaffClerkRelationDTO.class,mapper.listByClerkIds(clerkList)); return EntityUtil.changeEntityListByJSON(StaffClerkRelationDTO.class,mapper.listByClerkIds(clerkList));
} }
@Override
public List<StaffClerkRelationDTO> lisByStaffId(String wxEnterpriseId, String staffId) {
return EntityUtil.changeEntityListByJSON(StaffClerkRelationDTO.class, mapper.lisByStaffId(wxEnterpriseId, staffId));
}
} }
...@@ -13,6 +13,7 @@ import com.gic.haoban.common.utils.StringUtil; ...@@ -13,6 +13,7 @@ import com.gic.haoban.common.utils.StringUtil;
import com.gic.haoban.manage.api.dto.StaffDTO; import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.service.dao.mapper.StaffMapper; import com.gic.haoban.manage.service.dao.mapper.StaffMapper;
import com.gic.haoban.manage.service.entity.TabHaobanStaff; import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.gic.haoban.manage.service.service.MemberUnionRelatedService;
import com.gic.haoban.manage.service.service.StaffService; import com.gic.haoban.manage.service.service.StaffService;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
...@@ -22,6 +23,9 @@ public class StaffServiceImpl implements StaffService { ...@@ -22,6 +23,9 @@ public class StaffServiceImpl implements StaffService {
@Autowired @Autowired
StaffMapper mapper; StaffMapper mapper;
@Autowired
private MemberUnionRelatedService memberUnionRelatedService;
@Override @Override
public TabHaobanStaff selectById(String id) { public TabHaobanStaff selectById(String id) {
...@@ -85,6 +89,7 @@ public class StaffServiceImpl implements StaffService { ...@@ -85,6 +89,7 @@ public class StaffServiceImpl implements StaffService {
@Override @Override
public int cleanStaff(String wxEnterpriseId, List<String> staffIds) { public int cleanStaff(String wxEnterpriseId, List<String> staffIds) {
memberUnionRelatedService.cleanStaffRelated(wxEnterpriseId,staffIds);
return mapper.cleanStaff(wxEnterpriseId,staffIds); return mapper.cleanStaff(wxEnterpriseId,staffIds);
} }
...@@ -92,4 +97,9 @@ public class StaffServiceImpl implements StaffService { ...@@ -92,4 +97,9 @@ public class StaffServiceImpl implements StaffService {
public TabHaobanStaff getWxStaffByOne(String wxEnterpriseId) { public TabHaobanStaff getWxStaffByOne(String wxEnterpriseId) {
return mapper.getWxStaffByOne(wxEnterpriseId); return mapper.getWxStaffByOne(wxEnterpriseId);
} }
@Override
public List<String> listDelUserStaffId(String wxEnterpriseId, List<String> staffIds) {
return mapper.listUserStaffId(wxEnterpriseId,staffIds);
}
} }
...@@ -8,6 +8,7 @@ import java.util.List; ...@@ -8,6 +8,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.gic.haoban.manage.api.enums.*;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -39,10 +40,6 @@ import com.gic.haoban.manage.api.dto.EnterpriseDetailDTO; ...@@ -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.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO; import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
import com.gic.haoban.manage.api.dto.StoreAddressDTO; 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.AuditApiService;
import com.gic.haoban.manage.api.service.StaffClerkRelationApiService; import com.gic.haoban.manage.api.service.StaffClerkRelationApiService;
import com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService; import com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService;
...@@ -160,7 +157,7 @@ public class AuditApiServiceImpl implements AuditApiService{ ...@@ -160,7 +157,7 @@ public class AuditApiServiceImpl implements AuditApiService{
} }
@Transactional @Transactional
@Override @Override
public String audit(String batchId,String auditId,String auditName) { public String audit(String batchId,String auditId,String auditName,String optStaffId) {
TabHaobanAudit tab = auditMapper.selectByPrimaryKey(auditId); TabHaobanAudit tab = auditMapper.selectByPrimaryKey(auditId);
if(tab==null){ if(tab==null){
return "审核项目不存在"; return "审核项目不存在";
...@@ -169,6 +166,7 @@ public class AuditApiServiceImpl implements AuditApiService{ ...@@ -169,6 +166,7 @@ public class AuditApiServiceImpl implements AuditApiService{
tab.setAuditId(auditId); tab.setAuditId(auditId);
tab.setUpdateTime(new Date()); tab.setUpdateTime(new Date());
tab.setAuditName(auditName); tab.setAuditName(auditName);
tab.setAuditStaffId(optStaffId);
if(auditType == AuditType.STORE_CHANGE.getCode()){ if(auditType == AuditType.STORE_CHANGE.getCode()){
//门店信息变更 //门店信息变更
String storeId = tab.getCommitStoreId(); String storeId = tab.getCommitStoreId();
...@@ -225,7 +223,8 @@ public class AuditApiServiceImpl implements AuditApiService{ ...@@ -225,7 +223,8 @@ public class AuditApiServiceImpl implements AuditApiService{
staffClerkRelation.setWxEnterpriseId(tab.getWxEnterpriseId()); staffClerkRelation.setWxEnterpriseId(tab.getWxEnterpriseId());
staffClerkRelation.setWxUserId(obj.getWxUserId()); staffClerkRelation.setWxUserId(obj.getWxUserId());
staffClerkRelation.setStaffId(obj.getStaffId()); staffClerkRelation.setStaffId(obj.getStaffId());
staffClerkRelationApiService.delAndInsert(staffClerkRelation); } staffClerkRelationApiService.delAndInsert(staffClerkRelation,optStaffId, ChannelCodeEnum.AUDIT_BIND.getCode());
}
if(org.apache.commons.lang.StringUtils.isNotBlank(batchId)){ if(org.apache.commons.lang.StringUtils.isNotBlank(batchId)){
insertBatchLog( batchId,AuditRsultType.success.getCode(), tab); insertBatchLog( batchId,AuditRsultType.success.getCode(), tab);
} }
...@@ -261,8 +260,12 @@ public class AuditApiServiceImpl implements AuditApiService{ ...@@ -261,8 +260,12 @@ public class AuditApiServiceImpl implements AuditApiService{
if(org.apache.commons.lang.StringUtils.isNotBlank(batchId)){ if(org.apache.commons.lang.StringUtils.isNotBlank(batchId)){
insertBatchLog( batchId,AuditRsultType.success.getCode(),tab); insertBatchLog( batchId,AuditRsultType.success.getCode(),tab);
} }
//解绑日志
StaffClerkRelationDTO relationDTO = staffClerkRelationApiService.getByClerkId(obj.getClerkId());
if (null != relationDTO) {
staffClerkRelationApiService.pushToBindLog(relationDTO.getStaffId(),optStaffId,BindTypeEnum.UNBIND.getVal(),ChannelCodeEnum.SELF_UNBIND.getCode(),relationDTO.getStaffClerkRelationId());
}
staffClerkRelationApiService.delByClerkId(obj.getClerkId()); staffClerkRelationApiService.delByClerkId(obj.getClerkId());
staffDepartmentRelatedApiService.sendClerkDel(obj.getClerkName(), obj.getClerkCode(),tab.getCommitStoreId(), 1, ""); staffDepartmentRelatedApiService.sendClerkDel(obj.getClerkName(), obj.getClerkCode(),tab.getCommitStoreId(), 1, "");
}else if(auditType == AuditType.CLERK_UNBIND.getCode()){ }else if(auditType == AuditType.CLERK_UNBIND.getCode()){
//解绑申请,无需审核,直接通过 //解绑申请,无需审核,直接通过
...@@ -272,13 +275,14 @@ public class AuditApiServiceImpl implements AuditApiService{ ...@@ -272,13 +275,14 @@ public class AuditApiServiceImpl implements AuditApiService{
return ""; return "";
} }
@Override @Override
public void refuse(String auditId, String auditReason,String auditName) { public void refuse(String auditId, String auditReason,String auditStaffId,String auditName) {
TabHaobanAudit tab = new TabHaobanAudit(); TabHaobanAudit tab = new TabHaobanAudit();
tab.setAuditId(auditId); tab.setAuditId(auditId);
tab.setAuditStatus(2); tab.setAuditStatus(2);
tab.setUpdateTime(new Date()); tab.setUpdateTime(new Date());
tab.setAuditReason(auditReason); tab.setAuditReason(auditReason);
tab.setAuditName(auditName); tab.setAuditName(auditName);
tab.setAuditStaffId(auditStaffId);
auditMapper.updateByPrimaryKeySelective(tab); auditMapper.updateByPrimaryKeySelective(tab);
TabHaobanAudit tab2 = auditMapper.selectByPrimaryKey(auditId); TabHaobanAudit tab2 = auditMapper.selectByPrimaryKey(auditId);
int auditType = tab2.getAuditType(); int auditType = tab2.getAuditType();
......
...@@ -574,9 +574,14 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ ...@@ -574,9 +574,14 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ
List<StaffDTO> retLists = staffService.listByUserIdsAndWxEnterpriseId(clerkIds, wxEnterpriseId); List<StaffDTO> retLists = staffService.listByUserIdsAndWxEnterpriseId(clerkIds, wxEnterpriseId);
List<String> staffIds = retLists.stream().map(StaffDTO::getStaffId).collect(Collectors.toList()); List<String> staffIds = retLists.stream().map(StaffDTO::getStaffId).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(staffIds)) { if (CollectionUtils.isNotEmpty(staffIds)) {
staffClerkRelationService.cleanStaffClerk(wxEnterpriseId, staffIds); List<String> delStaffIds = staffService.listDelUserStaffId(wxEnterpriseId, staffIds);
staffService.cleanStaff(wxEnterpriseId, staffIds); if (CollectionUtils.isEmpty(delStaffIds)) {
staffDepartmentRelatedService.cleanStaffDepartment(wxEnterpriseId,staffIds); logger.info("没有要删除的用户:{}--{}",wxEnterpriseId,taskId);
}else {
staffClerkRelationService.cleanStaffClerk(wxEnterpriseId, delStaffIds);
staffService.cleanStaff(wxEnterpriseId, delStaffIds);
staffDepartmentRelatedService.cleanStaffDepartment(wxEnterpriseId, delStaffIds);
}
} }
} }
......
package com.gic.haoban.manage.service.service.out.impl;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.manage.api.dto.*;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.gic.api.base.commons.Page;
import com.gic.commons.util.EntityUtil;
import com.gic.haoban.manage.api.service.ExternalClerkRelatedApiService;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanExternalClerkRelatedMapper;
import com.gic.haoban.manage.service.entity.TabHaobanExternalClerkRelated;
import com.github.pagehelper.PageHelper;
@Service
public class ExternalClerkRelatedApiServiceImpl implements ExternalClerkRelatedApiService{
private static final Logger log = LogManager.getLogger(ExternalClerkRelatedApiServiceImpl.class);
@Autowired
private TabHaobanExternalClerkRelatedMapper tabHaobanExternalClerkRelatedMapper;
@Override
public List<ExternalClerkRelatedDTO> listByEnterpriseIdAndDate(
String enterpriseId, Date date) {
List<TabHaobanExternalClerkRelated> list = tabHaobanExternalClerkRelatedMapper.listByEnterpriseIdAndDate(enterpriseId,date);
return EntityUtil.changeEntityListByJSON(ExternalClerkRelatedDTO.class,list);
}
@Override
public Page<ExternalClerkRelatedDTO> pageMemberUnionByParams(List<String> userIdList, List<String> sendMemberIds,
String enterpriseId, BasePageInfo pageInfo) {
PageHelper.startPage(pageInfo.getPageNum(), pageInfo.getPageSize());
return PageUtil.changePageHelperToCurrentPage(tabHaobanExternalClerkRelatedMapper.pageMemberUnionByParams(userIdList,sendMemberIds,enterpriseId),ExternalClerkRelatedDTO.class);
}
@Override
public List<ExternalClerkRelatedDTO> listByWxEnterpriseIdAndWxUserId(String wxUserId, String wxEnterpriseId) {
return EntityUtil.changeEntityListByJSON(ExternalClerkRelatedDTO.class, tabHaobanExternalClerkRelatedMapper.listByWxEnterpriseIdAndWxUserId(wxUserId,wxEnterpriseId));
}
@Override
public List<ExternalClerkRelatedDTO> listByWxEnterpriseIdAndWxUserIds(List<String> userIdList,
String wxEnterpriseId) {
if(userIdList == null || userIdList.isEmpty()){
return Collections.EMPTY_LIST;
}
return EntityUtil.changeEntityListByJSON(ExternalClerkRelatedDTO.class, tabHaobanExternalClerkRelatedMapper.listByWxEnterpriseIdAndWxUserIds(userIdList,wxEnterpriseId));
}
}
...@@ -52,10 +52,12 @@ import com.gic.haoban.manage.service.config.Config; ...@@ -52,10 +52,12 @@ import com.gic.haoban.manage.service.config.Config;
import com.gic.haoban.manage.service.dao.mapper.MemberUnionidRelatedMapper; import com.gic.haoban.manage.service.dao.mapper.MemberUnionidRelatedMapper;
import com.gic.haoban.manage.service.entity.MemberUnionidRelated; import com.gic.haoban.manage.service.entity.MemberUnionidRelated;
import com.gic.haoban.manage.service.entity.TabHaobanClerkMainStoreRelated; import com.gic.haoban.manage.service.entity.TabHaobanClerkMainStoreRelated;
import com.gic.haoban.manage.service.entity.TabHaobanExternalClerkRelated;
import com.gic.haoban.manage.service.entity.TabHaobanStaff; import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated; import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise; import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterpriseRelated; import com.gic.haoban.manage.service.entity.TabHaobanWxEnterpriseRelated;
import com.gic.haoban.manage.service.pojo.ExternalUserPojo;
import com.gic.haoban.manage.service.util.EmojiFilterUtil; import com.gic.haoban.manage.service.util.EmojiFilterUtil;
import com.gic.member.api.dto.MemberDTO; import com.gic.member.api.dto.MemberDTO;
import com.gic.member.api.service.MemberOpenCardBusinessService; import com.gic.member.api.service.MemberOpenCardBusinessService;
...@@ -121,10 +123,12 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -121,10 +123,12 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
@Autowired @Autowired
private StaffClerkRelationService staffClerkRelationService; private StaffClerkRelationService staffClerkRelationService;
@Autowired
private ExternalClerkRelatedService externalClerkRelatedService;
@Override @Override
public List<MemberStoreDTO> listByExTernalUseridAndWxUserId(String externalUserid, String wxUserId) { public List<MemberStoreDTO> listByExTernalUseridAndWxUserId(String externalUserid, String wxUserId) {
List<MemberUnionidRelated> list = memberUnionidRelatedMapper.listByExTernalUseridAndWxUserId(externalUserid, wxUserId); List<TabHaobanExternalClerkRelated> list = externalClerkRelatedService.listByExTernalUseridAndWxUserId(externalUserid, wxUserId);
List<MemberStoreDTO> result = new ArrayList<>(); List<MemberStoreDTO> result = new ArrayList<>();
if(CollectionUtil.isEmpty(list)){ if(CollectionUtil.isEmpty(list)){
return null; return null;
...@@ -162,7 +166,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -162,7 +166,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
return null; return null;
} }
//2、获取member的storeId //2、获取member的storeId
for(MemberUnionidRelated tab : list){ for(TabHaobanExternalClerkRelated tab : list){
String memberId = tab.getMemberId(); String memberId = tab.getMemberId();
if(StringUtils.isEmpty(memberId)){ if(StringUtils.isEmpty(memberId)){
continue ; continue ;
...@@ -232,253 +236,191 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -232,253 +236,191 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
} }
@Override @Override
public String addMemberUnionidRelated(MemberUnionidRelatedDTO dto) { public String addMemberUnionidRelated(MemberUnionidRelatedDTO dto) {
log.info("【新增外部联系人回调】dto={}",JSON.toJSONString(dto)); return addMemberUnionidRelatedNew(dto);
String corpId = dto.getCorpid();
TabHaobanWxEnterprise wxEnterprise = wxEnterpriseService.getEnterpriseBycorpId(corpId);
if(wxEnterprise == null){
return "";
} }
List<TabHaobanWxEnterpriseRelated> list = wxEnterpriseRelatedService.getByWxEnterpriseId(wxEnterprise.getWxEnterpriseId());
String suiteid = dto.getSuiteid(); @Override
String unionIdJson = ""; public String addMemberUnionidRelatedNew(MemberUnionidRelatedDTO dto) {
if(SELF_APP.equals(suiteid)){ //拼装参数
SecretSettingDTO secretSetting = secretSettingService.getSecretSetting(wxEnterprise.getWxEnterpriseId(), SecretTypeEnum.CONTACT_CUSTOMER.getVal()); dto = getMemberUnionidRelatedDTO(dto);
if (null == secretSetting) { if(dto == null){
log.info("没有配置secret");
return ""; return "";
} }
unionIdJson = qywxUserApiService.getCorpSelfExternalUseridInfo(dto.getCorpid(), secretSetting.getSecretVal(), dto.getExternalUserid());
}else{
unionIdJson = qywxUserApiService.getExternalUseridInfo(dto.getCorpid(), dto.getSuiteid(), dto.getExternalUserid());
}
String userId1 = dto.getWxUserId();
log.info("【新增外部联系人回调】unionIdJson={}",JSON.toJSONString(unionIdJson)); //新增成员和外部联系人的关系
String unionId = ""; String memberUnionId = insertMemberUnionIdRelated(dto);
String name = "";
String follow_user = "";
String createTime = "";
String userId = "";
String avatar = "";
String relaName = "";
if(StringUtils.isNotBlank(unionIdJson)){
JSONObject jo = JSON.parseObject(unionIdJson);
String external_contact = jo.getString("external_contact");
if(StringUtils.isNotBlank(external_contact)){
JSONObject jt = JSON.parseObject(external_contact);
unionId = jt.getString("unionid");
name = EmojiFilterUtil.filterEmojiLast(jt.getString("name"), true);
relaName = EmojiFilterUtil.filterEmojiLast(jt.getString("name"), true);
avatar = jt.getString("avatar");
}
follow_user = jo.getString("follow_user"); //新增导购和外部联系人关系
if(StringUtils.isNotBlank(follow_user)){ dto.setMemberUnionidRelatedId(memberUnionId);
JSONArray j = JSON.parseArray(follow_user); insertExternalClerkRelated(dto);
for (Object object : j) {
String followJson = JSON.toJSONString(object);
JSONObject follow = JSON.parseObject(followJson);
userId = follow.getString("userid");
if(userId.equals(userId1)){
createTime = follow.getString("createtime");
}
}
}
}
TabHaobanStaff staff = staffService.selectByUserIdAndEnterpriseId(userId1, wxEnterprise.getWxEnterpriseId()); return memberUnionId;
if(staff == null){
return "";
} }
List<String> enterpriseIdList = list.stream().map(s->s.getEnterpriseId()).collect(Collectors.toList()); private void insertExternalClerkRelated(MemberUnionidRelatedDTO dto) {
List<StaffClerkRelationDTO> staffRelationList = staffClerkRelationService.listBindCodeByStaffId(enterpriseIdList, staff.getStaffId()); String wxUserId = dto.getWxUserId();
if(staffRelationList == null || staffRelationList.isEmpty()){ String wxEnterpriseId = dto.getWxEnterpriseId();
log.info("【新增外部联系人】未绑定"); String name = dto.getExternalName();
return ""; String createTime = dto.getAddCreateTime();
} String externalUserId = dto.getExternalUserid();
TabHaobanClerkMainStoreRelated r = clerkMainStoreRelatedService.selectByWxEnterpriseIdAndStoreId(staff.getStaffId(),wxEnterprise.getWxEnterpriseId()); String avatar = dto.getAvatar();
StoreDTO mainStore = null; if(StringUtils.isAnyBlank(wxUserId,wxEnterpriseId,name,createTime)){
for (TabHaobanWxEnterpriseRelated tabHaobanWxEnterpriseRelated : list) { log.info("【新增外部联系人】wxUserId={},wxEnterpriseId={},name={},createTime={},avatar={}",wxUserId,wxEnterpriseId,name,createTime,avatar);
if(r != null){ return;
mainStore = storeService.getStore(r.getStoreId());
if(mainStore != null){
if(!tabHaobanWxEnterpriseRelated.getEnterpriseId().equals(mainStore.getEnterpriseId())){
continue;
}
}
} }
String key = "external" + tabHaobanWxEnterpriseRelated.getEnterpriseId() + "_"+ userId1 + "_" + name + "_" + createTime; TabHaobanStaff staff = staffService.selectByUserIdAndEnterpriseId(wxUserId, wxEnterpriseId);
RedisUtil.lock(key,2l);
dto.setWxEnterpriseId(tabHaobanWxEnterpriseRelated.getWxEnterpriseId());
dto.setEnterpriseId(tabHaobanWxEnterpriseRelated.getEnterpriseId());
MemberDTO member = null;
//TabHaobanStaff staff = staffService.selectByUserIdAndEnterpriseId(userId1, tabHaobanWxEnterpriseRelated.getWxEnterpriseId());
if(staff == null){ if(staff == null){
continue; return;
} }
if(SELF_APP.equals(suiteid)){ String staffId = staff.getStaffId();
// List<StaffDepartmentRelatedDTO> relatedList = staffDepartmentRelatedApiService.listByStaffId(staff.getStaffId()); String unionId = dto.getUnionid();
// log.info("【部门list】staffId={}",staff.getStaffId());
// List<StaffDepartmentRelatedDTO> rList = new ArrayList<StaffDepartmentRelatedDTO>();
// for (StaffDepartmentRelatedDTO staffDepartmentRelatedDTO : relatedList) {
// DepartmentDTO depart = departmentApiService.selectById(staffDepartmentRelatedDTO.getDepartmentId());
// log.info("【部门list】depart={},deparmentId={}",JSON.toJSONString(depart),staffDepartmentRelatedDTO.getDepartmentId());
// if(depart != null && tabHaobanWxEnterpriseRelated != null && depart.getEnterpriseId() != null && tabHaobanWxEnterpriseRelated.getEnterpriseId() != null){
// log.info("【部门list】enterpriseId={},enterpriseId2={}",depart.getEnterpriseId(),tabHaobanWxEnterpriseRelated.getEnterpriseId());
// if(depart.getEnterpriseId().equals(tabHaobanWxEnterpriseRelated.getEnterpriseId())){
// if(mainStore != null){
// if(depart.getRelatedId().equals(mainStore.getStoreId())){
// rList.add(staffDepartmentRelatedDTO);
// }
// }else{
// rList.add(staffDepartmentRelatedDTO);
// }
// }
// }
// }
// log.info("【部门list】rList={}",JSON.toJSONString(rList));
// //DepartmentDTO departmentDTO =
// String clerkCode = "";
// if(!rList.isEmpty()){
// for (StaffDepartmentRelatedDTO staffDepartmentRelatedDTO : rList) {
// clerkCode = staffDepartmentRelatedDTO.getClerkCode();
// if(StringUtils.isNotBlank(clerkCode)){
// break;
// }
// }
// }
String clerkCode = ""; MemberDTO member = null;
for (StaffClerkRelationDTO staffClerkRelationDTO : staffRelationList) { TabHaobanClerkMainStoreRelated r = clerkMainStoreRelatedService.selectByWxEnterpriseIdAndStoreId(staffId,wxEnterpriseId);
if(tabHaobanWxEnterpriseRelated.getEnterpriseId().equals(staffClerkRelationDTO.getEnterpriseId())){ if(r == null){
clerkCode = staffClerkRelationDTO.getClerkCode(); log.info("【新增外部联系人】主门店为空");
break; return;
} }
String storeId = r.getStoreId();
StaffClerkRelationDTO staffClerkRelationDTO = staffClerkRelationService.getOneBindByStoreId(staffId,storeId);
if(staffClerkRelationDTO == null){
log.info("【新增外币联系人】导购和clerk关联为空");
return;
} }
ClerkDTO clerk = clerkService.getClerkByClerkCode(tabHaobanWxEnterpriseRelated.getEnterpriseId(), clerkCode); //新增导购和外部联系人关系
if(StringUtils.isNotBlank(unionId)){
String clerkCode = staffClerkRelationDTO.getClerkCode();
ClerkDTO clerk = clerkService.getClerkByClerkCode(staffClerkRelationDTO.getEnterpriseId(), clerkCode);
log.info("【新增外部联系人】clerkCode={},unionid:{}",clerkCode,unionId); log.info("【新增外部联系人】clerkCode={},unionid:{}",clerkCode,unionId);
if(clerk != null && StringUtils.isNotBlank(clerk.getQrcodeParam())&&StringUtils.isNotBlank(unionId)){ if(clerk != null && StringUtils.isNotBlank(clerk.getQrcodeParam())&&StringUtils.isNotBlank(unionId)){
log.info("【新增外部联系人会员】enterpriseId={},unionId={},name={},avatar={},QrcodeParam={}",tabHaobanWxEnterpriseRelated.getEnterpriseId(),unionId,name,avatar,clerk.getQrcodeParam()); log.info("【新增外部联系人会员】enterpriseId={},unionId={},name={},avatar={},QrcodeParam={}",staffClerkRelationDTO.getEnterpriseId(),unionId,name,avatar,clerk.getQrcodeParam());
member = memberOpenCardBusinessService.getMemberByQywxChannelParam(tabHaobanWxEnterpriseRelated.getEnterpriseId(),unionId,"",relaName,avatar,clerk.getQrcodeParam()); member = memberOpenCardBusinessService.getMemberByQywxChannelParam(staffClerkRelationDTO.getEnterpriseId(),unionId,"",name,avatar,clerk.getQrcodeParam());
} }
log.info("【新增外部联系人】member={},clerk={}",JSON.toJSONString(member),JSON.toJSONString(clerk)); }
TabHaobanExternalClerkRelated exsitDTO = externalClerkRelatedService.getByParams(wxUserId, wxEnterpriseId,name,createTime);
if(exsitDTO == null){
TabHaobanExternalClerkRelated related = new TabHaobanExternalClerkRelated();
related.setAddCreateTime(createTime);
related.setClerkId(staffClerkRelationDTO.getClerkId());
related.setEnterpriseId(staffClerkRelationDTO.getEnterpriseId());
related.setExternalName(name);
related.setExternalUserId(externalUserId);
related.setStaffId(staffId);
related.setMemberUnionidRelatedId(dto.getMemberUnionidRelatedId());
related.setStoreId(r.getStoreId());
related.setUnionid(unionId);
related.setWxEnterpriseId(wxEnterpriseId);
related.setWxUserId(wxUserId);
if(member != null){
related.setMemberId(member.getMemberId());
}
externalClerkRelatedService.insert(related);
}else{
if(member != null){ if(member != null){
dto.setMemberId(member.getMemberId()); exsitDTO.setMemberId(member.getMemberId());
} }
exsitDTO.setExternalUserId(externalUserId);
exsitDTO.setUnionid(unionId);
exsitDTO.setStoreId(storeId);
exsitDTO.setEnterpriseId(staffClerkRelationDTO.getEnterpriseId());
exsitDTO.setClerkId(staffClerkRelationDTO.getClerkId());
externalClerkRelatedService.update(exsitDTO);
} }
dto.setSelfExternalUserid(dto.getExternalUserid());
dto.setUnionid(unionId);
dto.setExternalName(name); }
dto.setAddCreateTime(createTime); private String insertMemberUnionIdRelated(MemberUnionidRelatedDTO dto) {
if(StringUtils.isBlank(unionId)){ if(dto == null){
return ""; return "";
} }
String wxUserId = dto.getWxUserId();
dto.setSuiteid(wxEnterprise.getWxSecretKey()); String wxEnterpriseId = dto.getWxEnterpriseId();
String name = dto.getExternalName();
MemberUnionidRelatedDTO exsitDTO = memberUnionRelatedService.getByParams(dto.getWxUserId(), tabHaobanWxEnterpriseRelated.getEnterpriseId(),name,createTime); String createTime = dto.getAddCreateTime();
if(StringUtils.isAnyBlank(wxUserId,wxEnterpriseId,name,createTime)){
log.info("【新增外部联系人】wxUserId={},wxEnterpriseId={},name={},createTime={}",wxUserId,wxEnterpriseId,name,createTime);
return "";
}
MemberUnionidRelatedDTO exsitDTO = memberUnionRelatedService.getByParams(wxUserId, wxEnterpriseId,name,createTime);
String uuid = ""; String uuid = "";
if(exsitDTO == null){ if(exsitDTO == null){
uuid = memberUnionRelatedService.addMemberUnionidRelated(dto); uuid = memberUnionRelatedService.addMemberUnionidRelated(dto);
}else{ }else{
//如果是自建更新uuid //如果是自建更新uuid
if(SELF_APP.equals(suiteid)){ exsitDTO.setSelfExternalUserid(dto.getSelfExternalUserid());
exsitDTO.setUnionid(unionId); exsitDTO.setUnionid(dto.getUnionid());
exsitDTO.setMemberId(dto.getMemberId());
}else{
//更新对外联系人id //更新对外联系人id
exsitDTO.setExternalUserid(dto.getExternalUserid()); exsitDTO.setExternalUserid(dto.getExternalUserid());
}
memberUnionRelatedService.update(exsitDTO); memberUnionRelatedService.update(exsitDTO);
uuid = exsitDTO.getMemberUnionidRelatedId(); uuid = exsitDTO.getMemberUnionidRelatedId();
} }
} return uuid;
// if(SELF_APP.equals(suiteid)){
// MemberDTO member = null;
// for (TabHaobanWxEnterpriseRelated tabHaobanWxEnterpriseRelated : list) {
// TabHaobanStaff staff = staffService.selectByUserIdAndEnterpriseId(userId, tabHaobanWxEnterpriseRelated.getWxEnterpriseId());
// if(staff == null){
// continue;
// }
// List<StaffDepartmentRelatedDTO> relatedList = staffDepartmentRelatedApiService.listByStaffId(staff.getStaffId());
// String clerkCode = "";
// if(!relatedList.isEmpty()){
// for (StaffDepartmentRelatedDTO staffDepartmentRelatedDTO : relatedList) {
// clerkCode = staffDepartmentRelatedDTO.getClerkCode();
// if(StringUtils.isNotBlank(clerkCode)){
// break;
// }
// }
// }
// ClerkDTO clerk = clerkService.getClerkByClerkCode(tabHaobanWxEnterpriseRelated.getEnterpriseId(), clerkCode);
// if(clerk != null){
// log.info("【新增外部联系人会员】enterpriseId={},unionId={},name={},avatar={},QrcodeParam={}",tabHaobanWxEnterpriseRelated.getEnterpriseId(),unionId,name,avatar,clerk.getQrcodeParam());
// member = memberOpenCardBusinessService.getMemberByQywxChannelParam(tabHaobanWxEnterpriseRelated.getEnterpriseId(),unionId,null,name,avatar,clerk.getQrcodeParam());
// }
// log.info("【新增外部联系人】member={},clerk={}",JSON.toJSONString(member),JSON.toJSONString(clerk));
// //member = memberService.getMemberByUnionid(unionId, tabHaobanWxEnterpriseRelated.getEnterpriseId());
//// if(member != null){
//// break;
//// }
// }
// if(member != null){
// dto.setMemberId(member.getMemberId());
// }
// dto.setSelfExternalUserid(dto.getExternalUserid());
// dto.setUnionid(unionId);
// }
//
// dto.setExternalName(name);
// dto.setAddCreateTime(createTime);
// if(StringUtils.isBlank(unionId)){
// return "";
// }
//
// dto.setWxEnterpriseId(wxEnterprise.getWxEnterpriseId());
// dto.setSuiteid(wxEnterprise.getWxSecretKey());
//
// MemberUnionidRelatedDTO exsitDTO = memberUnionRelatedService.getByParams(dto.getWxUserId(), wxEnterprise.getWxEnterpriseId(),name,createTime);
// String uuid = "";
// if(exsitDTO == null){
// uuid = memberUnionRelatedService.addMemberUnionidRelated(dto);
// }else{
// //如果是自建更新uuid
// if(SELF_APP.equals(suiteid)){
// exsitDTO.setUnionid(unionId);
// exsitDTO.setMemberId(dto.getMemberId());
// }else{
// //更新对外联系人id
// exsitDTO.setExternalUserid(dto.getExternalUserid());
// }
// memberUnionRelatedService.update(exsitDTO);
// uuid = exsitDTO.getMemberUnionidRelatedId();
// }
return "";
} }
private MemberUnionidRelatedDTO getMemberUnionidRelatedDTO(MemberUnionidRelatedDTO dto){
@Override log.info("【新增外部联系人回调】dto={}",JSON.toJSONString(dto));
public String add(String wxEnterpriseId,String selfExternalUserId,String userId1) { String corpId = dto.getCorpid();
WxEnterpriseDTO wxEnterprise = wxEnterpriseService.selectById(wxEnterpriseId); TabHaobanWxEnterprise wxEnterprise = wxEnterpriseService.getEnterpriseBycorpId(corpId);
if(wxEnterprise == null){ if(wxEnterprise == null){
return ""; return null;
} }
List<TabHaobanWxEnterpriseRelated> list = wxEnterpriseRelatedService.getByWxEnterpriseId(wxEnterprise.getWxEnterpriseId());
String wxEnterpriseId = wxEnterprise.getWxEnterpriseId();
String userId = dto.getWxUserId();
String suiteid = dto.getSuiteid();
String unionIdJson = "";
if(SELF_APP.equals(suiteid)){
SecretSettingDTO secretSetting = secretSettingService.getSecretSetting(wxEnterpriseId, SecretTypeEnum.CONTACT_CUSTOMER.getVal()); SecretSettingDTO secretSetting = secretSettingService.getSecretSetting(wxEnterpriseId, SecretTypeEnum.CONTACT_CUSTOMER.getVal());
if (null == secretSetting) { if (null == secretSetting) {
log.info("没有配置secret"); log.info("没有配置secret");
return ""; return null;
}
unionIdJson = qywxUserApiService.getCorpSelfExternalUseridInfo(dto.getCorpid(), secretSetting.getSecretVal(), dto.getExternalUserid());
}else{
unionIdJson = qywxUserApiService.getExternalUseridInfo(dto.getCorpid(), dto.getSuiteid(), dto.getExternalUserid());
} }
String unionIdJson = qywxUserApiService.getCorpSelfExternalUseridInfo(wxEnterprise.getCorpid(), secretSetting.getSecretVal(), selfExternalUserId);
if(StringUtils.isBlank(unionIdJson)){
log.info("【新增外部联系人回调】unionIdJson=null");
return null;
}
log.info("【新增外部联系人回调】unionIdJson={}",JSON.toJSONString(unionIdJson)); log.info("【新增外部联系人回调】unionIdJson={}",JSON.toJSONString(unionIdJson));
ExternalUserPojo pojo = getExternalUserPojo(unionIdJson,userId,wxEnterpriseId);
String name = pojo.getName();
String createTime = pojo.getAddCreateTime();
String key = "external" + wxEnterpriseId + "_"+ userId + "_" + name + "_" + createTime;
RedisUtil.lock(key,2l);
dto.setWxEnterpriseId(wxEnterpriseId);
dto.setExternalName(name);
dto.setAddCreateTime(createTime);
dto.setAvatar(pojo.getAvatar());
String externalUserId = null;
String selfExternalUserId = null;
String unionId = null;
if(SELF_APP.equals(suiteid)){
unionId = pojo.getUnionId();
selfExternalUserId = dto.getExternalUserid();
}else{
externalUserId = dto.getExternalUserid();
}
dto.setUnionid(unionId);
dto.setSelfExternalUserid(selfExternalUserId);
dto.setExternalUserid(externalUserId);
return dto;
}
private ExternalUserPojo getExternalUserPojo(String unionIdJson,String userId1,String wxEnterpriseId) {
ExternalUserPojo pojo = new ExternalUserPojo();
String unionId = ""; String unionId = "";
String name = "";
String follow_user = ""; String follow_user = "";
String createTime = ""; String createTime = "";
String userId = ""; String userId = "";
...@@ -490,7 +432,6 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -490,7 +432,6 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
if(StringUtils.isNotBlank(external_contact)){ if(StringUtils.isNotBlank(external_contact)){
JSONObject jt = JSON.parseObject(external_contact); JSONObject jt = JSON.parseObject(external_contact);
unionId = jt.getString("unionid"); unionId = jt.getString("unionid");
name = EmojiFilterUtil.filterEmojiLast(jt.getString("name"), true);
relaName = EmojiFilterUtil.filterEmojiLast(jt.getString("name"), true); relaName = EmojiFilterUtil.filterEmojiLast(jt.getString("name"), true);
avatar = jt.getString("avatar"); avatar = jt.getString("avatar");
} }
...@@ -508,10 +449,75 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -508,10 +449,75 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
} }
} }
} }
pojo.setAddCreateTime(createTime);
pojo.setAvatar(avatar);
pojo.setName(relaName);
pojo.setUnionId(unionId);
pojo.setWxEnterpriseId(wxEnterpriseId);
return pojo;
}
@Override
public String add(String wxEnterpriseId,String selfExternalUserId,String userId,String storeId) {
WxEnterpriseDTO wxEnterprise = wxEnterpriseService.selectById(wxEnterpriseId);
if(wxEnterprise == null){
return "";
}
TabHaobanStaff staff = staffService.selectByUserIdAndEnterpriseId(userId, wxEnterpriseId);
if(staff == null){
return "";
}
SecretSettingDTO secretSetting = secretSettingService.getSecretSetting(wxEnterpriseId, SecretTypeEnum.CONTACT_CUSTOMER.getVal());
if (null == secretSetting) {
log.info("没有配置secret");
return "";
}
String unionIdJson = qywxUserApiService.getCorpSelfExternalUseridInfo(wxEnterprise.getCorpid(), secretSetting.getSecretVal(), selfExternalUserId);
ExternalUserPojo pojo = getExternalUserPojo(unionIdJson,userId,wxEnterpriseId);
String unionId = pojo.getUnionId();
String name = pojo.getName();
String createTime = pojo.getAddCreateTime();
MemberUnionidRelatedDTO dto = new MemberUnionidRelatedDTO();
String externalUserId = getExternalUserId(wxEnterprise, userId, createTime, name);
dto.setExternalUserid(externalUserId);
dto.setWxEnterpriseId(wxEnterpriseId);
dto.setUnionid(unionId);
dto.setExternalName(name);
dto.setAddCreateTime(createTime);
dto.setWxUserId(userId);
dto.setAvatar(pojo.getAvatar());
if(StringUtils.isBlank(unionId)){
return "";
}
dto.setSuiteid(secretSetting.getSecretVal());
MemberUnionidRelatedDTO exsitDTO = memberUnionRelatedService.getByParams(userId, wxEnterpriseId,name,createTime);
String uuid = "";
if(exsitDTO == null){
dto.setUnionid(unionId);
//更新对外联系人id
dto.setSelfExternalUserid(selfExternalUserId);
uuid = memberUnionRelatedService.addMemberUnionidRelated(dto);
}else{
return "";
}
//新增门店和导购的关联关系
insertExternalClerkRelated(dto);
return uuid;
}
private String getExternalUserId(WxEnterpriseDTO wxEnterprise,String userId1,String createTime,String name){
log.info("新增外部联系人】corpid={},suiteId={},userId1={}",wxEnterprise.getCorpid(),config.getWxSuiteid(),userId1); log.info("新增外部联系人】corpid={},suiteId={},userId1={}",wxEnterprise.getCorpid(),config.getWxSuiteid(),userId1);
String wxRes = qywxUserApiService.listExternalUserid(wxEnterprise.getCorpid(), config.getWxSuiteid(), userId1); String wxRes = qywxUserApiService.listExternalUserid(wxEnterprise.getCorpid(), config.getWxSuiteid(), userId1);
MemberUnionidRelatedDTO dto = new MemberUnionidRelatedDTO();
String externalUserId = ""; String externalUserId = "";
log.info("【新增外部联系人】wxRes={}",wxRes); log.info("【新增外部联系人】wxRes={}",wxRes);
if(StringUtils.isNotBlank(wxRes)){ if(StringUtils.isNotBlank(wxRes)){
...@@ -519,14 +525,14 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -519,14 +525,14 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
String wxName = ""; String wxName = "";
for (Object externalUserid : jsonArr) { for (Object externalUserid : jsonArr) {
String uJ = qywxUserApiService.getExternalUseridInfo(wxEnterprise.getCorpid(), config.getWxSuiteid(), externalUserid.toString()); String uJ = qywxUserApiService.getExternalUseridInfo(wxEnterprise.getCorpid(), config.getWxSuiteid(), externalUserid.toString());
log.info("【新增外部联系人】uJ={}",uJ);
if(StringUtils.isNotBlank(uJ)){ if(StringUtils.isNotBlank(uJ)){
JSONObject jo = JSON.parseObject(uJ); JSONObject jo = JSON.parseObject(uJ);
String external_contact = jo.getString("external_contact"); String external_contact = jo.getString("external_contact");
String uj_follow_user = jo.getString("follow_user"); String uj_follow_user = jo.getString("follow_user");
JSONObject jt = null;
if(StringUtils.isNotBlank(external_contact)){ if(StringUtils.isNotBlank(external_contact)){
JSONObject jt = JSON.parseObject(external_contact); jt = JSON.parseObject(external_contact);
externalUserId = jt.getString("external_userid");
wxName = EmojiFilterUtil.filterEmojiLast(jt.getString("name"), true); wxName = EmojiFilterUtil.filterEmojiLast(jt.getString("name"), true);
} }
if(StringUtils.isNotBlank(uj_follow_user)){ if(StringUtils.isNotBlank(uj_follow_user)){
...@@ -538,143 +544,28 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -538,143 +544,28 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
uj_userId = follow.getString("userid"); uj_userId = follow.getString("userid");
log.info("【新增外部联系人】createTime={},name={},followCreateTime={},wxName={}",createTime,name,follow.getString("createtime"),wxName); log.info("【新增外部联系人】createTime={},name={},followCreateTime={},wxName={}",createTime,name,follow.getString("createtime"),wxName);
if(uj_userId.equals(userId1) && createTime.equals(follow.getString("createtime")) && name.equals(wxName)){ if(uj_userId.equals(userId1) && createTime.equals(follow.getString("createtime")) && name.equals(wxName)){
dto.setExternalUserid(externalUserId); if(jt != null){
externalUserId = jt.getString("external_userid");
break; break;
} }
} }
} }
} }
} }
} if(StringUtils.isNotBlank(externalUserId)){
TabHaobanStaff staff = staffService.selectByUserIdAndEnterpriseId(userId1, wxEnterprise.getWxEnterpriseId());
if(staff == null){
return "";
}
TabHaobanClerkMainStoreRelated r = clerkMainStoreRelatedService.selectByWxEnterpriseIdAndStoreId(staff.getStaffId(),wxEnterprise.getWxEnterpriseId());
StoreDTO mainStore = null;
List<String> enterpriseIdList = list.stream().map(s->s.getEnterpriseId()).collect(Collectors.toList());
List<StaffClerkRelationDTO> staffRelationList = staffClerkRelationService.listBindCodeByStaffId(enterpriseIdList, staff.getStaffId());
if(staffRelationList == null || staffRelationList.isEmpty()){
log.info("【新增外部联系人】未绑定");
return "";
}
for (TabHaobanWxEnterpriseRelated tabHaobanWxEnterpriseRelated : list) {
if(r != null){
mainStore = storeService.getStore(r.getStoreId());
if(mainStore != null){
if(!tabHaobanWxEnterpriseRelated.getEnterpriseId().equals(mainStore.getEnterpriseId())){
continue;
}
}
}
String key = "external" + tabHaobanWxEnterpriseRelated.getEnterpriseId() + "_"+ userId1 + "_" + name + "_" + createTime;
RedisUtil.lock(key,2l);
dto.setWxEnterpriseId(tabHaobanWxEnterpriseRelated.getWxEnterpriseId());
dto.setEnterpriseId(tabHaobanWxEnterpriseRelated.getEnterpriseId());
MemberDTO member = null;
//TabHaobanStaff staff = staffService.selectByUserIdAndEnterpriseId(userId1, tabHaobanWxEnterpriseRelated.getWxEnterpriseId());
if(staff == null){
continue;
}
// List<StaffDepartmentRelatedDTO> relatedList = staffDepartmentRelatedApiService.listByStaffId(staff.getStaffId());
// log.info("【部门list】staffId={}",staff.getStaffId());
// List<StaffDepartmentRelatedDTO> rList = new ArrayList<StaffDepartmentRelatedDTO>();
// for (StaffDepartmentRelatedDTO staffDepartmentRelatedDTO : relatedList) {
// DepartmentDTO depart = departmentApiService.selectById(staffDepartmentRelatedDTO.getDepartmentId());
// log.info("【部门list】depart={},deparmentId={}",JSON.toJSONString(depart),staffDepartmentRelatedDTO.getDepartmentId());
// if(depart != null && tabHaobanWxEnterpriseRelated != null && depart.getEnterpriseId() != null && tabHaobanWxEnterpriseRelated.getEnterpriseId() != null){
// log.info("【部门list】enterpriseId={},enterpriseId2={}",depart.getEnterpriseId(),tabHaobanWxEnterpriseRelated.getEnterpriseId());
// if(mainStore != null){
// if(depart.getRelatedId().equals(mainStore.getStoreId())){
// rList.add(staffDepartmentRelatedDTO);
// }
// }else{
// rList.add(staffDepartmentRelatedDTO);
// }
// }
// }
// log.info("【部门list】rList={}",JSON.toJSONString(rList));
// //DepartmentDTO departmentDTO =
// String clerkCode = "";
// if(!rList.isEmpty()){
// for (StaffDepartmentRelatedDTO staffDepartmentRelatedDTO : rList) {
// clerkCode = staffDepartmentRelatedDTO.getClerkCode();
// if(StringUtils.isNotBlank(clerkCode)){
// break;
// }
// }
// }
String clerkCode = "";
for (StaffClerkRelationDTO staffClerkRelationDTO : staffRelationList) {
if(tabHaobanWxEnterpriseRelated.getEnterpriseId().equals(staffClerkRelationDTO.getEnterpriseId())){
clerkCode = staffClerkRelationDTO.getClerkCode();
break; break;
} }
} }
ClerkDTO clerk = clerkService.getClerkByClerkCode(tabHaobanWxEnterpriseRelated.getEnterpriseId(), clerkCode);
log.info("【新增外部联系人】clerkCode={}",clerkCode);
if(clerk != null && StringUtils.isNotBlank(clerk.getQrcodeParam())){
log.info("【新增外部联系人会员】enterpriseId={},unionId={},name={},avatar={},QrcodeParam={}",tabHaobanWxEnterpriseRelated.getEnterpriseId(),unionId,name,avatar,clerk.getQrcodeParam());
member = memberOpenCardBusinessService.getMemberByQywxChannelParam(tabHaobanWxEnterpriseRelated.getEnterpriseId(),unionId,"",relaName,avatar,clerk.getQrcodeParam());
}
log.info("【新增外部联系人】member={},clerk={}",JSON.toJSONString(member),JSON.toJSONString(clerk));
if(member != null){
dto.setMemberId(member.getMemberId());
}
dto.setUnionid(unionId);
dto.setExternalName(name);
dto.setAddCreateTime(createTime);
dto.setWxUserId(userId1);
if(StringUtils.isBlank(unionId)){
return "";
}
dto.setSuiteid(secretSetting.getSecretVal());
MemberUnionidRelatedDTO exsitDTO = memberUnionRelatedService.getByParams(userId, tabHaobanWxEnterpriseRelated.getEnterpriseId(),name,createTime);
String uuid = "";
if(exsitDTO == null){
dto.setUnionid(unionId);
dto.setMemberId(dto.getMemberId());
//更新对外联系人id
dto.setSelfExternalUserid(selfExternalUserId);
uuid = memberUnionRelatedService.addMemberUnionidRelated(dto);
}else{
return "";
}
} }
return externalUserId;
return "";
} }
@Override @Override
public void delMemberUnionidRelated(MemberUnionidRelatedDTO dto) { public void delMemberUnionidRelated(MemberUnionidRelatedDTO dto) {
externalClerkRelatedService.delByUserIdAndExternalUserId(dto);
memberUnionRelatedService.delMemberUnionidRelated(dto); memberUnionRelatedService.delMemberUnionidRelated(dto);
} }
private void getExternalUserUnionid(MemberUnionidRelatedDTO dto){
TabHaobanWxEnterprise wxEnterprise = wxEnterpriseService.getEnterpriseBycorpId(dto.getCorpid());
if(wxEnterprise == null){
return ;
}
SecretSettingDTO secretSetting = secretSettingService.getSecretSetting(wxEnterprise.getWxEnterpriseId(), SecretTypeEnum.CONTACT_CUSTOMER.getVal());
if (null == secretSetting) {
log.info("没有配置secret");
return ;
}
String externalUseridInfo = this.qywxUserApiService.getCorpSelfExternalUseridInfo(dto.getCorpid(), secretSetting.getSecretVal(), dto.getExternalUserid());
if(StringUtils.isNotBlank(externalUseridInfo)){
JSONObject jsonObject = JSON.parseObject(externalUseridInfo);
dto.setUnionid(jsonObject.getString("unionid"));
}
}
@Override @Override
public MemberUnionidRelatedDTO getByMemberId(String staffId, String memberId) { public MemberUnionidRelatedDTO getByMemberId(String staffId, String memberId) {
TabHaobanStaff staff = staffService.selectById(staffId); TabHaobanStaff staff = staffService.selectById(staffId);
...@@ -696,7 +587,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -696,7 +587,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
} }
@Override @Override
public void freshWxFrend(String wxEnterpriseId, String wxUserId) { public void freshWxFrend(String wxEnterpriseId, String wxUserId,String storeId) {
log.info("【刷下好友】wxUserId={}",wxUserId); log.info("【刷下好友】wxUserId={}",wxUserId);
WxEnterpriseDTO enterprise = wxEnterpriseService.selectById(wxEnterpriseId); WxEnterpriseDTO enterprise = wxEnterpriseService.selectById(wxEnterpriseId);
SecretSettingDTO secretSetting = secretSettingService.getSecretSetting(wxEnterpriseId, SecretTypeEnum.CONTACT_CUSTOMER.getVal()); SecretSettingDTO secretSetting = secretSettingService.getSecretSetting(wxEnterpriseId, SecretTypeEnum.CONTACT_CUSTOMER.getVal());
...@@ -721,10 +612,23 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -721,10 +612,23 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
continue; continue;
}else{ }else{
//String string = qywxUserApiService.getCorpSelfExternalUseridInfo(enterprise.getCorpid(), enterprise.getWxSecretKey(), object.toString()); //String string = qywxUserApiService.getCorpSelfExternalUseridInfo(enterprise.getCorpid(), enterprise.getWxSecretKey(), object.toString());
this.add(wxEnterpriseId, object.toString(), wxUserId); this.add(wxEnterpriseId, object.toString(), wxUserId,storeId);
}
} }
} }
@Override
public void mqFreshWxFrend(String res){
JSONObject json = JSON.parseObject(res);
String wxEnterpriseId = json.getString("wxEnterpriseId");
String wxUserId = json.getString("wxUserId");
String storeId = json.getString("storeId");
log.info("【刷下微信好友】wxEnterpriseId={}.wxUserId={},storeId={}",wxEnterpriseId,wxUserId,storeId);
if(StringUtils.isAnyBlank(wxEnterpriseId,wxUserId,storeId)){
return ;
}
freshWxFrend(wxEnterpriseId, wxUserId, storeId);
} }
@Override @Override
......
...@@ -9,6 +9,7 @@ import java.util.stream.Collectors; ...@@ -9,6 +9,7 @@ import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.gic.commons.util.GlobalInfo; import com.gic.commons.util.GlobalInfo;
import com.gic.commons.util.GlobalVar; import com.gic.commons.util.GlobalVar;
import com.gic.commons.util.ImageUtil;
import com.gic.haoban.manage.api.dto.*; import com.gic.haoban.manage.api.dto.*;
import com.gic.haoban.manage.api.enums.SecretTypeEnum; import com.gic.haoban.manage.api.enums.SecretTypeEnum;
import com.gic.haoban.manage.api.service.DepartmentApiService; import com.gic.haoban.manage.api.service.DepartmentApiService;
...@@ -453,7 +454,7 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -453,7 +454,7 @@ public class StaffApiServiceImpl implements StaffApiService {
Set<String> newDepartIds = departmentDTOList.stream().map(DepartmentDTO::getDepartmentId).collect(Collectors.toSet()); Set<String> newDepartIds = departmentDTOList.stream().map(DepartmentDTO::getDepartmentId).collect(Collectors.toSet());
Set<String> hasDepartIds = hasRelationMap.keySet(); Set<String> hasDepartIds = hasRelationMap.keySet();
Sets.SetView<String> delDepartIds = Sets.difference(hasDepartIds, newDepartIds); Sets.SetView<String> delDepartIds = Sets.difference(hasDepartIds, newDepartIds);
Sets.SetView<String> updateDepartIds = Sets.difference(newDepartIds,hasDepartIds ); Sets.SetView<String> updateDepartIds = Sets.intersection(newDepartIds,hasDepartIds );//交集
logger.info("删除部门:{}",JSONObject.toJSONString(delDepartIds)); logger.info("删除部门:{}",JSONObject.toJSONString(delDepartIds));
if (!delDepartIds.isEmpty()) { if (!delDepartIds.isEmpty()) {
delDepartIds.forEach(delDepartId->{ delDepartIds.forEach(delDepartId->{
...@@ -483,6 +484,7 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -483,6 +484,7 @@ public class StaffApiServiceImpl implements StaffApiService {
@Override @Override
public void wxGetAdd(String userId,String wxEnterpriseId){ public void wxGetAdd(String userId,String wxEnterpriseId){
RedisUtil.lock("haoban_add_user" + wxEnterpriseId + userId, 2l);
ServiceResponse wxSaveNew = getWxSaveNew(userId, wxEnterpriseId); ServiceResponse wxSaveNew = getWxSaveNew(userId, wxEnterpriseId);
logger.info("信息:{}",JSONObject.toJSONString(wxSaveNew)); logger.info("信息:{}",JSONObject.toJSONString(wxSaveNew));
} }
...@@ -1339,9 +1341,10 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -1339,9 +1341,10 @@ public class StaffApiServiceImpl implements StaffApiService {
private String changeHeaderImageUrl(String headImgUrl) { private String changeHeaderImageUrl(String headImgUrl) {
// InputStream in = new URL(headImgUrl).openStream();
try { try {
InputStream in = new URL(headImgUrl).openStream(); byte[] data = ImageUtil.getImgbyte(headImgUrl);
byte[] data = IOUtils.toByteArray(in); // byte[] data = IOUtils.toByteArray(in);
PicUploadResDTO uploadPic = qqCloudPicService.uploadPic(GlobalVar.ctxPropertiesMap.get(GlobalInfo.QQPIC_KEY_ENTERPRISE), data); PicUploadResDTO uploadPic = qqCloudPicService.uploadPic(GlobalVar.ctxPropertiesMap.get(GlobalInfo.QQPIC_KEY_ENTERPRISE), data);
logger.info("腾讯云万象优图返回" + JSON.toJSONString(uploadPic)); logger.info("腾讯云万象优图返回" + JSON.toJSONString(uploadPic));
return uploadPic.downloadUrl; return uploadPic.downloadUrl;
......
...@@ -3,24 +3,37 @@ package com.gic.haoban.manage.service.service.out.impl; ...@@ -3,24 +3,37 @@ package com.gic.haoban.manage.service.service.out.impl;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page;
import com.gic.clerk.api.dto.ClerkDTO; import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.service.ClerkNewService;
import com.gic.clerk.api.service.ClerkService; import com.gic.clerk.api.service.ClerkService;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
import com.gic.enterprise.api.dto.EnterpriseDTO; import com.gic.enterprise.api.dto.EnterpriseDTO;
import com.gic.enterprise.api.dto.StoreDTO; import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.enterprise.api.service.EnterpriseService; import com.gic.enterprise.api.service.EnterpriseService;
import com.gic.enterprise.api.service.StoreService; import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.base.api.common.ServiceResponse; import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.manage.api.dto.AuditDTO; import com.gic.haoban.manage.api.dto.*;
import com.gic.haoban.manage.api.dto.StaffClerkInfoDTO;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.enums.AuditType; import com.gic.haoban.manage.api.enums.AuditType;
import com.gic.haoban.manage.api.enums.BindTypeEnum;
import com.gic.haoban.manage.api.enums.ChannelCodeEnum;
import com.gic.haoban.manage.api.service.AuditApiService; import com.gic.haoban.manage.api.service.AuditApiService;
import com.gic.haoban.manage.api.service.StaffClerkRelationApiService; import com.gic.haoban.manage.api.service.StaffClerkRelationApiService;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanStaffClerkRelationMapper; import com.gic.haoban.manage.service.dao.mapper.TabHaobanStaffClerkRelationMapper;
import com.gic.haoban.manage.service.entity.TabHaobanClerkMainStoreRelated;
import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.gic.haoban.manage.service.entity.TabHaobanStaffClerkBindLog;
import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation; import com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterpriseRelated;
import com.gic.haoban.manage.service.service.StaffClerkBindLogService;
import com.gic.haoban.manage.service.service.ClerkMainStoreRelatedService;
import com.gic.haoban.manage.service.service.ExternalClerkRelatedService;
import com.gic.haoban.manage.service.service.StaffClerkRelationService; import com.gic.haoban.manage.service.service.StaffClerkRelationService;
import com.gic.haoban.manage.service.service.StaffService;
import com.gic.haoban.manage.service.service.WxEnterpriseRelatedService;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -30,6 +43,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -30,6 +43,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
@Service @Service
public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiService { public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiService {
...@@ -53,6 +67,60 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -53,6 +67,60 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
@Autowired @Autowired
private AuditApiService auditApiService; private AuditApiService auditApiService;
@Autowired
private ClerkMainStoreRelatedService clerkMainStoreRelatedService;
@Autowired
private StaffClerkBindLogService staffClerkBindLogService;
@Autowired
private WxEnterpriseRelatedService wxEnterpriseRelatedService;
@Autowired
private ClerkNewService clerkNewService;
@Autowired
private StaffService staffService;
@Autowired
private ExternalClerkRelatedService externalClerkRelatedService;
@Override
public void bindLogMq(String params) {
logger.info("绑定日志mq:{}",params);
StaffClerkBindLogInfoDTO infoDTO = JSONObject.parseObject(params, StaffClerkBindLogInfoDTO.class);
if (null == infoDTO){
logger.info("数据不存在");
return;
}
TabHaobanStaffClerkRelation clerkRelation = tabHaobanStaffClerkRelationMapper.selectByPrimaryKey(infoDTO.getRelationId());
if (null == clerkRelation) {
logger.info("不存在绑定数据");
return;
}
ClerkDTO clerkDTO = clerkService.getClerkByClerkIdNoStatus(clerkRelation.getClerkId());
String phoneNumber="";
if (null != clerkDTO) {
phoneNumber=clerkDTO.getPhoneNumber();
}
TabHaobanStaffClerkBindLog staffClerkRelation=new TabHaobanStaffClerkBindLog();
staffClerkRelation.setClerkId(clerkRelation.getClerkId());
staffClerkRelation.setChannelCode(infoDTO.getChannelCode());
staffClerkRelation.setClerkCode(clerkRelation.getClerkCode());
staffClerkRelation.setCreateTime(new Date());
staffClerkRelation.setEnterpriseId(clerkRelation.getEnterpriseId());
staffClerkRelation.setOptStaffId(infoDTO.getOptStaffId());
staffClerkRelation.setOptType(infoDTO.getOptType());
staffClerkRelation.setStatusFlag(1);
staffClerkRelation.setStaffId(clerkRelation.getStaffId());
staffClerkRelation.setWxEnterpriseId(clerkRelation.getWxEnterpriseId());
staffClerkRelation.setRelationId(infoDTO.getRelationId());
staffClerkRelation.setClerkPhone(phoneNumber);
staffClerkRelation.setUpdateTime(new Date());
staffClerkBindLogService.insert(staffClerkRelation);
}
@Override @Override
public List<StaffClerkRelationDTO> listBindCode(String enterpriseId, Set<String> clerkCodeList) { public List<StaffClerkRelationDTO> listBindCode(String enterpriseId, Set<String> clerkCodeList) {
...@@ -111,7 +179,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -111,7 +179,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
} }
@Override @Override
public ServiceResponse bindStaffClerk(StaffClerkRelationDTO staffClerkRelationDTO) { public ServiceResponse bindStaffClerk(StaffClerkRelationDTO staffClerkRelationDTO,String optStaffId,int chanelCode) {
logger.info("绑定clerk:{}", JSONObject.toJSONString(staffClerkRelationDTO)); logger.info("绑定clerk:{}", JSONObject.toJSONString(staffClerkRelationDTO));
ServiceResponse<Object> response = new ServiceResponse<>(); ServiceResponse<Object> response = new ServiceResponse<>();
StaffClerkRelationDTO relationDTO = staffClerkRelatinService.getBindByClerkId(staffClerkRelationDTO.getClerkId(), staffClerkRelationDTO.getWxEnterpriseId()); StaffClerkRelationDTO relationDTO = staffClerkRelatinService.getBindByClerkId(staffClerkRelationDTO.getClerkId(), staffClerkRelationDTO.getWxEnterpriseId());
...@@ -139,7 +207,8 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -139,7 +207,8 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
return response; return response;
} }
staffClerkRelatinService.bind(staffClerkRelationDTO); String relationId = staffClerkRelatinService.bind(staffClerkRelationDTO,optStaffId,chanelCode);
response.setResult(relationId);
return response; return response;
} }
...@@ -147,22 +216,13 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -147,22 +216,13 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
public StaffClerkRelationDTO getByCodeAndEnterpriseId(String clerkCode, String enterpriseId) { public StaffClerkRelationDTO getByCodeAndEnterpriseId(String clerkCode, String enterpriseId) {
return staffClerkRelatinService.getByCodeAndEnterpriseId(clerkCode,enterpriseId); return staffClerkRelatinService.getByCodeAndEnterpriseId(clerkCode,enterpriseId);
} }
@Override
public String insert(StaffClerkRelationDTO staffClerkRelation) {
return staffClerkRelatinService.insert(staffClerkRelation);
}
@Override
public void insertOrUpdate(StaffClerkRelationDTO staffClerkRelation) {
if(StringUtils.isEmpty(staffClerkRelation.getStaffClerkRelationId())){
staffClerkRelatinService.insert(staffClerkRelation);
}else{
TabHaobanStaffClerkRelation tab = EntityUtil.changeEntityByJSON(TabHaobanStaffClerkRelation.class, staffClerkRelation);
tabHaobanStaffClerkRelationMapper.updateByPrimaryKeySelective(tab);
}
}
@Override @Override
public String delByStoreIdAndCode(String storeId, String clerkCode) { public String delByStoreIdAndCode(String storeId, String clerkCode) {
TabHaobanStaffClerkRelation staffClerkRelation = tabHaobanStaffClerkRelationMapper.getByCodeAndStoreId(clerkCode, storeId);
tabHaobanStaffClerkRelationMapper.delByStoreIdAndCode(storeId,clerkCode); tabHaobanStaffClerkRelationMapper.delByStoreIdAndCode(storeId,clerkCode);
delSetMainStore(staffClerkRelation);
return null; return null;
} }
@Override @Override
...@@ -189,7 +249,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -189,7 +249,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
@Override @Override
public boolean unbindByStaffAndClerkId(String staffId, String clerkId) { public boolean unbindByStaffAndClerkId(String staffId, String clerkId) {
boolean b = staffClerkRelatinService.delBind(clerkId); boolean b = staffClerkRelatinService.delBind(clerkId,staffId, ChannelCodeEnum.ADMIN_UNBIND.getCode());
return b; return b;
} }
@Override @Override
...@@ -213,21 +273,123 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -213,21 +273,123 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
return dto; return dto;
} }
@Override @Override
public void delAndInsert(StaffClerkRelationDTO staffClerkRelation) { public void delAndInsert(StaffClerkRelationDTO staffClerkRelation,String optStaffId,int chanelCode) {
if(StringUtils.isEmpty(staffClerkRelation.getStaffClerkRelationId())){ if(StringUtils.isNotBlank(staffClerkRelation.getStaffClerkRelationId())){
staffClerkRelatinService.insert(staffClerkRelation); TabHaobanStaffClerkRelation oldStaffClerkRelation = tabHaobanStaffClerkRelationMapper.selectByPrimaryKey(staffClerkRelation.getStaffClerkRelationId());
}else{
tabHaobanStaffClerkRelationMapper.delByPrimaryKey(staffClerkRelation.getStaffClerkRelationId()); tabHaobanStaffClerkRelationMapper.delByPrimaryKey(staffClerkRelation.getStaffClerkRelationId());
staffClerkRelatinService.insert(staffClerkRelation); staffClerkBindLogService.pushToMq(oldStaffClerkRelation.getStaffId(),optStaffId, BindTypeEnum.BIND.getVal(),chanelCode,staffClerkRelation.getStaffClerkRelationId());
} }
String relationId = staffClerkRelatinService.insert(staffClerkRelation);
staffClerkBindLogService.pushToMq(staffClerkRelation.getStaffId(),optStaffId, BindTypeEnum.BIND.getVal(),chanelCode,relationId);
//设置主门店
setMainStore(staffClerkRelation);
} }
@Override @Override
public void delByClerkId(String clerkId) { public void delByClerkId(String clerkId) {
TabHaobanStaffClerkRelation staffClerkRelation = tabHaobanStaffClerkRelationMapper.getOneByClerkId(clerkId);
tabHaobanStaffClerkRelationMapper.delByClerkId(clerkId); tabHaobanStaffClerkRelationMapper.delByClerkId(clerkId);
delSetMainStore(staffClerkRelation);
} }
@Override @Override
public List<StaffClerkRelationDTO> listByEnterpriseIdAndWxUserId(String enterpriseId,String wxUserId) { public List<StaffClerkRelationDTO> listByEnterpriseIdAndWxUserId(String enterpriseId,String wxUserId) {
List<TabHaobanStaffClerkRelation> list = tabHaobanStaffClerkRelationMapper.listByEnterpriseIdAndWxUserId(enterpriseId,wxUserId); List<TabHaobanStaffClerkRelation> list = tabHaobanStaffClerkRelationMapper.listByEnterpriseIdAndWxUserId(enterpriseId,wxUserId);
return EntityUtil.changeEntityListByJSON(StaffClerkRelationDTO.class, list); return EntityUtil.changeEntityListByJSON(StaffClerkRelationDTO.class, list);
} }
@Override
public Page<StaffClerkBindLogDetailDTO> pageStaffClerkBindLog(String wxEnterpriseId, String search, String enterpriseId, int optType, BasePageInfo pageInfo) {
List<TabHaobanWxEnterpriseRelated> wxEnterpriseRelateds = wxEnterpriseRelatedService.getByWxEnterpriseId(wxEnterpriseId);
if (CollectionUtils.isEmpty(wxEnterpriseRelateds)) {
logger.info("没有关联企业");
return null;
}
List<String> enterpriseList = wxEnterpriseRelateds.stream().map(TabHaobanWxEnterpriseRelated::getEnterpriseId)
.filter(eid->{
if (StringUtils.isBlank(enterpriseId)) {
return true;
}else if (enterpriseId.equals(eid)) {
return true;
}else{
return false;
}
}).collect(Collectors.toList());
if (CollectionUtils.isEmpty(enterpriseList)) {
logger.info("没有有效的企业");
return null;
}
List<String> clerkIds=null;
// if (StringUtils.isNotBlank(search)) {
// List<ClerkDTO> clerk = clerkNewService.listClerkByEnterpriseIdAndSearch(enterpriseList, search);
// if (CollectionUtils.isEmpty(clerk)) {
// logger.info("没有搜索到相应信息");
// return new Page<StaffClerkBindLogDetailDTO>();
// }
// clerkIds = clerk.stream().map(ClerkDTO::getClerkId).collect(Collectors.toList());
// }
Page<StaffClerkBindLogDetailDTO> retList = staffClerkBindLogService.pageBindLog(wxEnterpriseId, clerkIds, null, enterpriseList, optType,search, pageInfo);
if (CollectionUtils.isNotEmpty(retList.getResult())) {
retList.getResult().forEach(staffClerkBindLogDetailDTO -> {
TabHaobanStaff haobanStaff = staffService.selectById(staffClerkBindLogDetailDTO.getStaffId());
if (null !=haobanStaff) {
staffClerkBindLogDetailDTO.setStaffName(haobanStaff.getStaffName());
staffClerkBindLogDetailDTO.setWxUserId(haobanStaff.getWxUserId());
}else{
staffClerkBindLogDetailDTO.setStaffName("未知成员");
}
if ("-1".equals(staffClerkBindLogDetailDTO.getOptStaffId())) {
staffClerkBindLogDetailDTO.setOptStaffName("系统");
}else {
haobanStaff = staffService.selectById(staffClerkBindLogDetailDTO.getOptStaffId());
if (null != haobanStaff) {
staffClerkBindLogDetailDTO.setOptStaffName(haobanStaff.getStaffName());
} else {
staffClerkBindLogDetailDTO.setOptStaffName("未知成员");
}
}
ClerkDTO clerkDTO = clerkService.getClerkByClerkIdNoStatus(staffClerkBindLogDetailDTO.getClerkId());
if (null != clerkDTO) {
staffClerkBindLogDetailDTO.setClerkName(clerkDTO.getClerkName());
}
staffClerkBindLogDetailDTO.setClerkPhoneNumber(staffClerkBindLogDetailDTO.getClerkPhone());
});
}
return retList;
}
@Override
public void pushToBindLog(String staffId, String optStaffId, int optType, int channelCode, String relationId) {
staffClerkBindLogService.pushToMq(staffId,optStaffId,optType,channelCode,relationId);
}
private void setMainStore(StaffClerkRelationDTO staffClerkRelation){
if(staffClerkRelation == null){
logger.info("staffClerkRelation为空");
return;
}
String staffId = staffClerkRelation.getStaffId();
String wxEnterpriseId = staffClerkRelation.getWxEnterpriseId();
List<StaffClerkRelationDTO> list = staffClerkRelatinService.lisByStaffId(wxEnterpriseId, staffId);
if(list != null && list.size() == 1){
clerkMainStoreRelatedService.setMainStore(staffId, staffClerkRelation.getStoreId(), wxEnterpriseId);
}
}
private void delSetMainStore(TabHaobanStaffClerkRelation staffClerkRelation){
if(staffClerkRelation == null){
logger.info("staffClerkRelation为空");
return;
}
String staffId = staffClerkRelation.getStaffId();
String wxEnterpriseId = staffClerkRelation.getWxEnterpriseId();
TabHaobanClerkMainStoreRelated r = clerkMainStoreRelatedService.selectByWxEnterpriseIdAndStoreId(staffId, wxEnterpriseId);
r.setStatusFlag(0);
clerkMainStoreRelatedService.update(r);
externalClerkRelatedService.delByClerkIdAndStaffId(staffClerkRelation.getClerkId(), staffId);
List<StaffClerkRelationDTO> list = staffClerkRelatinService.lisByStaffId(wxEnterpriseId, staffId);
if(list != null && list.size() >= 1){
clerkMainStoreRelatedService.setMainStore(staffId, list.get(list.size()-1).getStoreId(), wxEnterpriseId);
}
}
} }
...@@ -6,10 +6,15 @@ import com.gic.binlog.base.entity.GicRecord; ...@@ -6,10 +6,15 @@ import com.gic.binlog.base.entity.GicRecord;
import com.gic.binlog.base.entity.enums.GicRecordType; import com.gic.binlog.base.entity.enums.GicRecordType;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
import com.gic.dubbo.entity.ProviderLocalTag; import com.gic.dubbo.entity.ProviderLocalTag;
import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.contacts.manage.api.enums.StatusEnum; 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.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.enums.ChannelCodeEnum;
import com.gic.haoban.manage.api.service.StaffClerkRelationApiService;
import com.gic.haoban.manage.service.pojo.BinlogBasePojo; import com.gic.haoban.manage.service.pojo.BinlogBasePojo;
import com.gic.haoban.manage.service.pojo.ClerkSyncPojo; 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 com.gic.haoban.manage.service.service.StaffClerkRelationService;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.lang3.time.DateUtils;
...@@ -37,6 +42,13 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor ...@@ -37,6 +42,13 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor
@Autowired @Autowired
private StaffClerkRelationService staffClerkRelationService; private StaffClerkRelationService staffClerkRelationService;
@Autowired
private StaffClerkBindLogService staffClerkBindLogService;
@Autowired
private StaffClerkRelationApiService staffClerkRelationApiService;
@Override @Override
public void onMessage(ConsumerRecord<String, GicRecord> record) { public void onMessage(ConsumerRecord<String, GicRecord> record) {
...@@ -59,7 +71,7 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor ...@@ -59,7 +71,7 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor
private void dealClerk(ClerkSyncPojo syncPojo) { private void dealClerk(ClerkSyncPojo syncPojo) {
GicRecordType gicRecordType = GicRecordType.valueOf(syncPojo.getRecordType()); GicRecordType gicRecordType = GicRecordType.valueOf(syncPojo.getRecordType());
if(gicRecordType.equals(GicRecordType.DELETE)){ if(gicRecordType.equals(GicRecordType.DELETE)){
staffClerkRelationService.delBind(syncPojo.getClerkId()); staffClerkRelationService.delBind(syncPojo.getClerkId(),"-1", ChannelCodeEnum.SYNC_UNBIND.getCode());
}else if (gicRecordType.equals(GicRecordType.INSERT)) { }else if (gicRecordType.equals(GicRecordType.INSERT)) {
StaffClerkRelationDTO relationDTO = staffClerkRelationService.getOneBindCodeNoStatus(syncPojo.getEnterpriseId(), syncPojo.getClerkCode()); StaffClerkRelationDTO relationDTO = staffClerkRelationService.getOneBindCodeNoStatus(syncPojo.getEnterpriseId(), syncPojo.getClerkCode());
moveOrAddClerk(syncPojo,relationDTO); moveOrAddClerk(syncPojo,relationDTO);
...@@ -71,14 +83,13 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor ...@@ -71,14 +83,13 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor
//非正常状态 删除 //非正常状态 删除
if (!syncPojo.getStatus().equals(1)) { if (!syncPojo.getStatus().equals(1)) {
logger.info("删除操作:{}",syncPojo.getClerkId()); logger.info("删除操作:{}",syncPojo.getClerkId());
staffClerkRelationService.delBind(syncPojo.getClerkId()); staffClerkRelationService.delBind(syncPojo.getClerkId(),"-1", ChannelCodeEnum.SYNC_UNBIND.getCode());
}else { }else {
List<String> clerkIds=new ArrayList<>(); List<String> clerkIds=new ArrayList<>();
clerkIds.add(syncPojo.getClerkId()); clerkIds.add(syncPojo.getClerkId());
StaffClerkRelationDTO clerkRelationDTO = staffClerkRelationService.getByClerkId(syncPojo.getClerkId()); StaffClerkRelationDTO clerkRelationDTO = staffClerkRelationService.getByClerkId(syncPojo.getClerkId());
if (clerkRelationDTO != null) { if (clerkRelationDTO != null) {
logger.info("更新关联信息1:{}",syncPojo.getClerkId()); logger.info("更新关联信息1:{}",syncPojo.getClerkId());
staffClerkRelationService.updateByClerkId(relationDTO); staffClerkRelationService.updateByClerkId(relationDTO);
return; return;
...@@ -86,10 +97,8 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor ...@@ -86,10 +97,8 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor
StaffClerkRelationDTO bindRelationDTO = staffClerkRelationService.getOneBindCodeNoStatus(syncPojo.getEnterpriseId(), syncPojo.getClerkCode()); StaffClerkRelationDTO bindRelationDTO = staffClerkRelationService.getOneBindCodeNoStatus(syncPojo.getEnterpriseId(), syncPojo.getClerkCode());
if (null == bindRelationDTO) { if (null == bindRelationDTO) {
logger.info("没有关联导购,不需要操作:{}", syncPojo.getClerkId()); logger.info("没有关联导购,不需要操作:{}", syncPojo.getClerkId());
return; return;
} }
logger.info("走新增逻辑:{}",syncPojo.getClerkId()); logger.info("走新增逻辑:{}",syncPojo.getClerkId());
//走新增逻辑 //走新增逻辑
moveOrAddClerk(syncPojo,bindRelationDTO); moveOrAddClerk(syncPojo,bindRelationDTO);
...@@ -104,17 +113,19 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor ...@@ -104,17 +113,19 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor
} }
//正常的时候 //正常的时候
if (relationDTO.getStatusFlag() != StatusEnum.DEL.getValue()) { if (relationDTO.getStatusFlag() != StatusEnum.DEL.getValue()) {
staffClerkRelationService.delBind(relationDTO.getClerkId()); staffClerkRelationService.delBind(relationDTO.getClerkId(),"-1", ChannelCodeEnum.SYNC_UNBIND.getCode());
relationDTO.setClerkId(syncPojo.getClerkId()); relationDTO.setClerkId(syncPojo.getClerkId());
relationDTO.setStoreId(syncPojo.getStoreId()); relationDTO.setStoreId(syncPojo.getStoreId());
staffClerkRelationService.bind(relationDTO); ServiceResponse response = staffClerkRelationApiService.bindStaffClerk(relationDTO, "-1", ChannelCodeEnum.SYNC_BIND.getCode());
logger.info("绑定结果正常:{},{}",JSONObject.toJSONString(response),relationDTO.getClerkId());
}else {//删除状态 需要判断是否近段时间有操作删除 2分组内有更新 判断是转移操作 }else {//删除状态 需要判断是否近段时间有操作删除 2分组内有更新 判断是转移操作
Date timeDiff = DateUtils.addMinutes(new Date(), -2); Date timeDiff = DateUtils.addMinutes(new Date(), -2);
if(relationDTO.getUpdateTime().after(timeDiff)){ if(relationDTO.getUpdateTime().after(timeDiff)){
staffClerkRelationService.delBind(relationDTO.getClerkId()); staffClerkRelationService.delBind(relationDTO.getClerkId(),"-1", ChannelCodeEnum.SYNC_UNBIND.getCode());
relationDTO.setClerkId(syncPojo.getClerkId()); relationDTO.setClerkId(syncPojo.getClerkId());
relationDTO.setStoreId(syncPojo.getStoreId()); relationDTO.setStoreId(syncPojo.getStoreId());
staffClerkRelationService.bind(relationDTO); ServiceResponse response = staffClerkRelationApiService.bindStaffClerk(relationDTO, "-1", ChannelCodeEnum.SYNC_BIND.getCode());
logger.info("绑定结果:{},{}",JSONObject.toJSONString(response),relationDTO.getClerkId());
} }
} }
} }
......
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
<dubbo:service interface="com.gic.haoban.manage.api.service.MaterialApiService" ref="materialApiServiceImpl" timeout="10000"/> <dubbo:service interface="com.gic.haoban.manage.api.service.MaterialApiService" ref="materialApiServiceImpl" timeout="10000"/>
<dubbo:service interface="com.gic.haoban.manage.api.service.ApplicationTemplateApiService" ref="applicationTemplateApiServiceImpl" timeout="10000"/> <dubbo:service interface="com.gic.haoban.manage.api.service.ApplicationTemplateApiService" ref="applicationTemplateApiServiceImpl" timeout="10000"/>
<dubbo:service interface="com.gic.haoban.manage.api.service.ExternalClerkRelatedApiService" ref="externalClerkRelatedApiServiceImpl" timeout="10000"/>
<dubbo:service interface="com.gic.haoban.manage.api.service.StaffClerkRelationApiService" ref="staffClerkRelationApiServiceImpl" timeout="10000"/> <dubbo:service interface="com.gic.haoban.manage.api.service.StaffClerkRelationApiService" ref="staffClerkRelationApiServiceImpl" timeout="10000"/>
<dubbo:service interface="com.gic.haoban.manage.api.service.DealSyncOperationApiService" <dubbo:service interface="com.gic.haoban.manage.api.service.DealSyncOperationApiService"
...@@ -57,6 +58,7 @@ ...@@ -57,6 +58,7 @@
<dubbo:reference interface="com.gic.enterprise.api.service.StoreGroupService" id="storeGroupService"/> <dubbo:reference interface="com.gic.enterprise.api.service.StoreGroupService" id="storeGroupService"/>
<dubbo:reference interface="com.gic.clerk.api.service.ClerkService" id="clerkService"/> <dubbo:reference interface="com.gic.clerk.api.service.ClerkService" id="clerkService"/>
<dubbo:reference interface="com.gic.clerk.api.service.ClerkNewService" id="clerkNewService"/>
<dubbo:reference interface="com.gic.member.api.service.MemberService" id="memberService"/> <dubbo:reference interface="com.gic.member.api.service.MemberService" id="memberService"/>
......
...@@ -256,7 +256,7 @@ ...@@ -256,7 +256,7 @@
from tab_haoban_member_unionid_related from tab_haoban_member_unionid_related
where wx_user_id = #{wxUserId} where wx_user_id = #{wxUserId}
and status_flag = 1 and status_flag = 1
and enterprise_id = #{enterpriseId} and wx_enterprise_id = #{wxEnterpriseId}
and external_name = #{externalName} and external_name = #{externalName}
and add_create_time = #{addCreateTime} and add_create_time = #{addCreateTime}
</select> </select>
...@@ -290,4 +290,18 @@ ...@@ -290,4 +290,18 @@
#{wxUserId, jdbcType=CHAR} #{wxUserId, jdbcType=CHAR}
</foreach> </foreach>
</select> </select>
<update id="cleanStaffRelated" parameterType="com.gic.haoban.manage.service.entity.MemberUnionidRelated" >
update tab_haoban_member_unionid_related
set status_flag = 0,
update_time = now()
where wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
and wx_user_id in
(select wx_user_id from tab_haoban_staff where staff_id in
<foreach collection="staffIds" item="id" index="index" open="(" close=")" separator=",">
#{id,jdbcType=VARCHAR}
</foreach>
)
and status_flag = 1
</update>
</mapper> </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.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="clerk_phone" jdbcType="VARCHAR" property="clerkPhone" />
<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,clerk_phone, 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, clerk_phone,
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},#{clerk_phone,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="clerkPhone != null">
clerk_phone,
</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="clerkPhone != null">
#{clerkPhone,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>
<if test="optType!=-1">
and opt_type=#{optType}
</if>
<if test="search!=null and search.length()>0">
and (clerk_code = #{search} or clerk_phone = #{search})
</if>
order by create_time desc
</select>
</mapper>
\ No newline at end of file
...@@ -328,10 +328,11 @@ ...@@ -328,10 +328,11 @@
<update id="cleanStaffDepartment" > <update id="cleanStaffDepartment" >
update tab_haoban_staff_department_related update tab_haoban_staff_department_related
set set
status_flag = 0 status_flag = 0,
update_time = now()
where wx_enterprise_id = #{wxEnterpriseId} where wx_enterprise_id = #{wxEnterpriseId}
and status_flag = 1 and status_flag = 1
and staff_id not in and staff_id in
<foreach collection="staffIds" item="item" open="(" separator="," close=")"> <foreach collection="staffIds" item="item" open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
......
...@@ -347,8 +347,8 @@ ...@@ -347,8 +347,8 @@
status_flag = 0, status_flag = 0,
update_time = now() update_time = now()
where wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR} and status_flag = 1 and super_manager_flag!=1 where wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR} and status_flag = 1
and staff_id not in and staff_id in
<foreach collection="staffIds" item="item" open="(" separator="," close=")"> <foreach collection="staffIds" item="item" open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
...@@ -363,4 +363,14 @@ ...@@ -363,4 +363,14 @@
and wx_user_id is not null and wx_user_id!='' and wx_user_id is not null and wx_user_id!=''
limit 1 limit 1
</select> </select>
<select id="listUserStaffId" resultType="string">
select staff_id FROM tab_haoban_staff
WHERE
wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR} and status_flag = 1 and super_manager_flag is null
and staff_id not in
<foreach collection="staffIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -22,11 +22,12 @@ ...@@ -22,11 +22,12 @@
<result column="status_flag" property="statusFlag" jdbcType="INTEGER" /> <result column="status_flag" property="statusFlag" jdbcType="INTEGER" />
<result column="wx_enterprise_id" property="wxEnterpriseId" jdbcType="VARCHAR" /> <result column="wx_enterprise_id" property="wxEnterpriseId" jdbcType="VARCHAR" />
<result column="related_id" property="relatedId" jdbcType="VARCHAR" /> <result column="related_id" property="relatedId" jdbcType="VARCHAR" />
<result column="audit_staff_id" property="auditStaffId" jdbcType="VARCHAR" />
</resultMap> </resultMap>
<sql id="Base_Column_List" > <sql id="Base_Column_List" >
audit_id, audit_type, commit_name, commit_staff_id, commit_staff_name, commit_staff_img, audit_id, audit_type, commit_name, commit_staff_id, commit_staff_name, commit_staff_img,
commit_store_id, change_field, old_value, new_value, commit_time, enterprise_id, commit_store_id, change_field, old_value, new_value, commit_time, enterprise_id,
audit_name, audit_status, audit_reason, create_time, update_time, status_flag, wx_enterprise_id,related_id audit_name, audit_status, audit_reason, create_time, update_time, status_flag, wx_enterprise_id,related_id,audit_staff_id
</sql> </sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" > <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
select select
...@@ -45,14 +46,14 @@ ...@@ -45,14 +46,14 @@
new_value, commit_time, enterprise_id, new_value, commit_time, enterprise_id,
audit_name, audit_status, audit_reason, audit_name, audit_status, audit_reason,
create_time, update_time, status_flag, create_time, update_time, status_flag,
wx_enterprise_id,related_id) wx_enterprise_id,related_id,audit_staff_id)
values (#{auditId,jdbcType=VARCHAR}, #{auditType,jdbcType=INTEGER}, #{commitName,jdbcType=VARCHAR}, values (#{auditId,jdbcType=VARCHAR}, #{auditType,jdbcType=INTEGER}, #{commitName,jdbcType=VARCHAR},
#{commitStaffId,jdbcType=VARCHAR}, #{commitStaffName,jdbcType=VARCHAR}, #{commitStaffImg,jdbcType=VARCHAR}, #{commitStaffId,jdbcType=VARCHAR}, #{commitStaffName,jdbcType=VARCHAR}, #{commitStaffImg,jdbcType=VARCHAR},
#{commitStoreId,jdbcType=VARCHAR}, #{changeField,jdbcType=VARCHAR}, #{oldValue,jdbcType=VARCHAR}, #{commitStoreId,jdbcType=VARCHAR}, #{changeField,jdbcType=VARCHAR}, #{oldValue,jdbcType=VARCHAR},
#{newValue,jdbcType=VARCHAR}, #{commitTime,jdbcType=TIMESTAMP}, #{enterpriseId,jdbcType=VARCHAR}, #{newValue,jdbcType=VARCHAR}, #{commitTime,jdbcType=TIMESTAMP}, #{enterpriseId,jdbcType=VARCHAR},
#{auditName,jdbcType=VARCHAR}, #{auditStatus,jdbcType=INTEGER}, #{auditReason,jdbcType=VARCHAR}, #{auditName,jdbcType=VARCHAR}, #{auditStatus,jdbcType=INTEGER}, #{auditReason,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{statusFlag,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{statusFlag,jdbcType=INTEGER},
#{wxEnterpriseId,jdbcType=VARCHAR},#{relatedId,jdbcType=VARCHAR}) #{wxEnterpriseId,jdbcType=VARCHAR},#{relatedId,jdbcType=VARCHAR},#{auditStaffId,jdbcType=VARCHAR})
</insert> </insert>
<insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanAudit" > <insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanAudit" >
insert into tab_haoban_audit insert into tab_haoban_audit
...@@ -117,6 +118,9 @@ ...@@ -117,6 +118,9 @@
<if test="relatedId != null" > <if test="relatedId != null" >
related_id, related_id,
</if> </if>
<if test="auditStaffId != null" >
audit_staff_id,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides="," > <trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="auditId != null" > <if test="auditId != null" >
...@@ -179,6 +183,9 @@ ...@@ -179,6 +183,9 @@
<if test="relatedId != null" > <if test="relatedId != null" >
#{relatedId,jdbcType=VARCHAR}, #{relatedId,jdbcType=VARCHAR},
</if> </if>
<if test="auditStaffId != null" >
#{auditStaffId,jdbcType=VARCHAR},
</if>
</trim> </trim>
</insert> </insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanAudit" > <update id="updateByPrimaryKeySelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanAudit" >
...@@ -241,6 +248,9 @@ ...@@ -241,6 +248,9 @@
<if test="relatedId != null" > <if test="relatedId != null" >
related_id = #{relatedId,jdbcType=VARCHAR}, related_id = #{relatedId,jdbcType=VARCHAR},
</if> </if>
<if test="auditStaffId != null" >
audit_staff_id = #{auditStaffId,jdbcType=VARCHAR},
</if>
</set> </set>
where audit_id = #{auditId,jdbcType=VARCHAR} where audit_id = #{auditId,jdbcType=VARCHAR}
</update> </update>
...@@ -264,7 +274,8 @@ ...@@ -264,7 +274,8 @@
update_time = #{updateTime,jdbcType=TIMESTAMP}, update_time = #{updateTime,jdbcType=TIMESTAMP},
status_flag = #{statusFlag,jdbcType=INTEGER}, status_flag = #{statusFlag,jdbcType=INTEGER},
wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}, wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
related_id = #{relatedId,jdbcType=VARCHAR} related_id = #{relatedId,jdbcType=VARCHAR},
audit_staff_id = #{auditStaffId,jdbcType=VARCHAR}
where audit_id = #{auditId,jdbcType=VARCHAR} where audit_id = #{auditId,jdbcType=VARCHAR}
</update> </update>
<sql id="storeSql"> <sql id="storeSql">
...@@ -355,6 +366,7 @@ ...@@ -355,6 +366,7 @@
where 1=1 where 1=1
and commit_store_id = #{storeId,jdbcType=VARCHAR} and commit_store_id = #{storeId,jdbcType=VARCHAR}
and audit_status = 0 and audit_status = 0
and audit_type = 1
</select> </select>
<select id="findByStoreIdAndChangeField" resultMap="BaseResultMap" > <select id="findByStoreIdAndChangeField" resultMap="BaseResultMap" >
select select
......
<?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.TabHaobanExternalClerkRelatedMapper" >
<resultMap id="BaseResultMap" type="com.gic.haoban.manage.service.entity.TabHaobanExternalClerkRelated" >
<id column="external_clerk_related_id" property="externalClerkRelatedId" jdbcType="VARCHAR" />
<result column="wx_enterprise_id" property="wxEnterpriseId" jdbcType="VARCHAR" />
<result column="enterprise_id" property="enterpriseId" jdbcType="VARCHAR" />
<result column="store_id" property="storeId" jdbcType="VARCHAR" />
<result column="member_id" property="memberId" jdbcType="VARCHAR" />
<result column="unionid" property="unionid" jdbcType="VARCHAR" />
<result column="external_name" property="externalName" jdbcType="VARCHAR" />
<result column="external_user_id" property="externalUserId" jdbcType="VARCHAR" />
<result column="add_create_time" property="addCreateTime" jdbcType="VARCHAR" />
<result column="member_unionid_related_id" property="memberUnionidRelatedId" jdbcType="VARCHAR" />
<result column="clerk_id" property="clerkId" jdbcType="VARCHAR" />
<result column="staff_id" property="staffId" jdbcType="VARCHAR" />
<result column="wx_user_id" property="wxUserId" jdbcType="VARCHAR" />
<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" >
external_clerk_related_id, wx_enterprise_id, enterprise_id, store_id, member_id,
unionid, external_name, add_create_time, member_unionid_related_id, clerk_id, staff_id,
wx_user_id, status_flag, create_time, update_time,external_user_id
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_external_clerk_related
where external_clerk_related_id = #{externalClerkRelatedId,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
delete from tab_haoban_external_clerk_related
where external_clerk_related_id = #{externalClerkRelatedId,jdbcType=VARCHAR}
</delete>
<insert id="insert" parameterType="com.gic.haoban.manage.service.entity.TabHaobanExternalClerkRelated" >
insert into tab_haoban_external_clerk_related (external_clerk_related_id, wx_enterprise_id,
enterprise_id, store_id, member_id,
unionid, external_name, add_create_time,
member_unionid_related_id, clerk_id, staff_id,
wx_user_id, status_flag, create_time,
update_time,external_user_id)
values (#{externalClerkRelatedId,jdbcType=VARCHAR}, #{wxEnterpriseId,jdbcType=VARCHAR},
#{enterpriseId,jdbcType=VARCHAR}, #{storeId,jdbcType=VARCHAR}, #{memberId,jdbcType=VARCHAR},
#{unionid,jdbcType=VARCHAR}, #{externalName,jdbcType=VARCHAR}, #{addCreateTime,jdbcType=VARCHAR},
#{memberUnionidRelatedId,jdbcType=VARCHAR}, #{clerkId,jdbcType=VARCHAR}, #{staffId,jdbcType=VARCHAR},
#{wxUserId,jdbcType=VARCHAR}, #{statusFlag,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP},#{externalUserId})
</insert>
<insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanExternalClerkRelated" >
insert into tab_haoban_external_clerk_related
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="externalClerkRelatedId != null" >
external_clerk_related_id,
</if>
<if test="wxEnterpriseId != null" >
wx_enterprise_id,
</if>
<if test="enterpriseId != null" >
enterprise_id,
</if>
<if test="storeId != null" >
store_id,
</if>
<if test="memberId != null" >
member_id,
</if>
<if test="unionid != null" >
unionid,
</if>
<if test="externalName != null" >
external_name,
</if>
<if test="externalUserId != null" >
external_user_id,
</if>
<if test="addCreateTime != null" >
add_create_time,
</if>
<if test="memberUnionidRelatedId != null" >
member_unionid_related_id,
</if>
<if test="clerkId != null" >
clerk_id,
</if>
<if test="staffId != null" >
staff_id,
</if>
<if test="wxUserId != null" >
wx_user_id,
</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="externalClerkRelatedId != null" >
#{externalClerkRelatedId,jdbcType=VARCHAR},
</if>
<if test="wxEnterpriseId != null" >
#{wxEnterpriseId,jdbcType=VARCHAR},
</if>
<if test="enterpriseId != null" >
#{enterpriseId,jdbcType=VARCHAR},
</if>
<if test="storeId != null" >
#{storeId,jdbcType=VARCHAR},
</if>
<if test="memberId != null" >
#{memberId,jdbcType=VARCHAR},
</if>
<if test="unionid != null" >
#{unionid,jdbcType=VARCHAR},
</if>
<if test="externalName != null" >
#{externalName,jdbcType=VARCHAR},
</if>
<if test="externalUserId != null" >
#{externalUserId,jdbcType=VARCHAR},
</if>
<if test="addCreateTime != null" >
#{addCreateTime,jdbcType=VARCHAR},
</if>
<if test="memberUnionidRelatedId != null" >
#{memberUnionidRelatedId,jdbcType=VARCHAR},
</if>
<if test="clerkId != null" >
#{clerkId,jdbcType=VARCHAR},
</if>
<if test="staffId != null" >
#{staffId,jdbcType=VARCHAR},
</if>
<if test="wxUserId != null" >
#{wxUserId,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.TabHaobanExternalClerkRelated" >
update tab_haoban_external_clerk_related
<set >
<if test="wxEnterpriseId != null" >
wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
</if>
<if test="enterpriseId != null" >
enterprise_id = #{enterpriseId,jdbcType=VARCHAR},
</if>
<if test="storeId != null" >
store_id = #{storeId,jdbcType=VARCHAR},
</if>
<if test="memberId != null" >
member_id = #{memberId,jdbcType=VARCHAR},
</if>
<if test="unionid != null" >
unionid = #{unionid,jdbcType=VARCHAR},
</if>
<if test="externalName != null" >
external_name = #{externalName,jdbcType=VARCHAR},
</if>
<if test="externalUserId != null" >
external_user_id = #{externalUserId,jdbcType=VARCHAR},
</if>
<if test="addCreateTime != null" >
add_create_time = #{addCreateTime,jdbcType=VARCHAR},
</if>
<if test="memberUnionidRelatedId != null" >
member_unionid_related_id = #{memberUnionidRelatedId,jdbcType=VARCHAR},
</if>
<if test="clerkId != null" >
clerk_id = #{clerkId,jdbcType=VARCHAR},
</if>
<if test="staffId != null" >
staff_id = #{staffId,jdbcType=VARCHAR},
</if>
<if test="wxUserId != null" >
wx_user_id = #{wxUserId,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 external_clerk_related_id = #{externalClerkRelatedId,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.haoban.manage.service.entity.TabHaobanExternalClerkRelated" >
update tab_haoban_external_clerk_related
set wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
enterprise_id = #{enterpriseId,jdbcType=VARCHAR},
store_id = #{storeId,jdbcType=VARCHAR},
member_id = #{memberId,jdbcType=VARCHAR},
unionid = #{unionid,jdbcType=VARCHAR},
external_name = #{externalName,jdbcType=VARCHAR},
add_create_time = #{addCreateTime,jdbcType=VARCHAR},
member_unionid_related_id = #{memberUnionidRelatedId,jdbcType=VARCHAR},
clerk_id = #{clerkId,jdbcType=VARCHAR},
staff_id = #{staffId,jdbcType=VARCHAR},
wx_user_id = #{wxUserId,jdbcType=VARCHAR},
status_flag = #{statusFlag,jdbcType=INTEGER},
external_user_id = #{externalUserId},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where external_clerk_related_id = #{externalClerkRelatedId,jdbcType=VARCHAR}
</update>
<select id="selectByClerkIdAndExternalUserId" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_external_clerk_related
where clerk_id = #{clerkId,jdbcType=VARCHAR}
and external_user_id = #{externalUserId}
and status_flag = 1
</select>
<update id="delByUserIdAndExternalUserId" parameterType="com.gic.haoban.manage.service.entity.TabHaobanExternalClerkRelated" >
update tab_haoban_external_clerk_related
set
status_flag = 2,
update_time = now()
where external_user_id = #{externalUserId,jdbcType=VARCHAR}
and wx_user_id = #{wxUserId}
and status_flag = 1
</update>
<update id="delByClerkIdAndStaffId" parameterType="com.gic.haoban.manage.service.entity.TabHaobanExternalClerkRelated" >
update tab_haoban_external_clerk_related
set
status_flag = 2,
update_time = now()
where clerk_id = #{clerkId,jdbcType=VARCHAR}
and staff_id = #{staffId}
and status_flag = 1
</update>
<update id="cleanStaffRelated" parameterType="com.gic.haoban.manage.service.entity.TabHaobanExternalClerkRelated" >
update tab_haoban_external_clerk_related
set
status_flag = 2,
update_time = now()
where wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
and staff_id IN
<foreach collection="staffIds" item="id" index="index" open="(" close=")" separator=",">
#{id,jdbcType=VARCHAR}
</foreach>
and status_flag = 1
</update>
<select id="getByParams" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_external_clerk_related
where 1
and wx_user_id = #{userId}
and wx_enterprise_id = #{wxEnterpriseId}
and external_name = #{name}
and add_create_time = #{createTime}
and status_flag = 1
</select>
<select id="listByExTernalUseridAndWxUserId" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_external_clerk_related
where wx_user_id = #{userId,jdbcType=VARCHAR}
and external_user_id = #{externalUserid}
and status_flag = 1
</select>
<select id="listByEnterpriseIdAndDate" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_external_clerk_related
where status_flag = 1
and enterprise_id = #{enterpriseId}
<if test="date != null" >
and TO_DAYS(create_time) <![CDATA[ >= ]]> TO_DAYS(#{date,jdbcType=TIMESTAMP})
</if>
</select>
<select id="pageMemberUnionByParams" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_external_clerk_related
where enterprise_id = #{enterpriseId}
and status_flag = 1
and member_id in
<foreach item="memberId" index="index" collection="sendMemberIds" open="(" separator="," close=")">
#{memberId, jdbcType=CHAR}
</foreach>
and wx_user_id in
<foreach item="wxUserId" index="index" collection="userIdList" open="(" separator="," close=")">
#{wxUserId, jdbcType=CHAR}
</foreach>
and member_id is not null
group by external_user_id
</select>
<select id="listByWxEnterpriseIdAndWxUserId" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_external_clerk_related
where wx_user_id = #{wxUserId,jdbcType=VARCHAR}
and wx_enterprise_id = #{wxEnterpriseId}
and status_flag = 1
</select>
<select id="listByWxEnterpriseIdAndWxUserIds" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_external_clerk_related
where wx_user_id in
<foreach item="wxUserId" index="index" collection="userIdList" open="(" separator="," close=")">
#{wxUserId, jdbcType=CHAR}
</foreach>
and wx_enterprise_id = #{wxEnterpriseId}
and status_flag = 1
</select>
</mapper>
\ No newline at end of file
...@@ -277,7 +277,7 @@ ...@@ -277,7 +277,7 @@
status_flag = 0, status_flag = 0,
update_time = now() update_time = now()
where wx_enterprise_id = #{wxEnterpriseId} and status_flag = 1 and where wx_enterprise_id = #{wxEnterpriseId} and status_flag = 1 and
staff_id not in staff_id in
<foreach collection="staffIds" item="item" open="(" separator="," close=")"> <foreach collection="staffIds" item="item" open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
...@@ -338,4 +338,25 @@ ...@@ -338,4 +338,25 @@
and wx_user_id = #{wxUserId} and wx_user_id = #{wxUserId}
</select> </select>
<select id="lisByStaffId" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_staff_clerk_relation
where
wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
and staff_id = #{staffId}
and status_flag = 1
order by create_time desc
</select>
<select id="getByCodeAndStoreId" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_staff_clerk_relation
where
clerk_code = #{clerkCode}
and store_id = #{storeId}
and status_flag = 1
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -176,7 +176,7 @@ ...@@ -176,7 +176,7 @@
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from tab_haoban_wx_enterprise_related from tab_haoban_wx_enterprise_related
where status_flag = 1 where status_flag = 1
AND AND DATE_FORMAT(update_time,'%Y-%m-%d') = #{time} AND DATE_FORMAT(update_time,'%Y-%m-%d') = #{time}
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -5,6 +5,7 @@ import com.gic.haoban.manage.api.service.DepartmentApiService; ...@@ -5,6 +5,7 @@ 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.TestApiService; import com.gic.haoban.manage.api.service.TestApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService; import com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService;
import com.gic.haoban.manage.service.service.MemberUnionRelatedService;
import com.gic.haoban.manage.service.util.EmojiFilterUtil; import com.gic.haoban.manage.service.util.EmojiFilterUtil;
import com.gic.redis.data.util.RedisUtil; import com.gic.redis.data.util.RedisUtil;
import com.gic.wechat.api.dto.qywx.DepartmentDTO; import com.gic.wechat.api.dto.qywx.DepartmentDTO;
...@@ -15,7 +16,7 @@ import com.gic.wechat.api.enums.QywxMediaTypeEnum; ...@@ -15,7 +16,7 @@ import com.gic.wechat.api.enums.QywxMediaTypeEnum;
import com.gic.wechat.api.service.qywx.QywxDepartmentApiService; import com.gic.wechat.api.service.qywx.QywxDepartmentApiService;
import com.gic.wechat.api.service.qywx.QywxSuiteApiService; 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 com.github.binarywang.java.emoji.EmojiConverter; //import com.github.binarywang.java.emoji.EmojiConverter;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -59,280 +60,286 @@ public class ServiceTest { ...@@ -59,280 +60,286 @@ public class ServiceTest {
@Autowired @Autowired
private DepartmentApiService departmentApiService; private DepartmentApiService departmentApiService;
@Autowired
private MemberUnionRelatedService memberUnionRelatedService;
private final ExecutorService pools = Executors.newFixedThreadPool(50); private final ExecutorService pools = Executors.newFixedThreadPool(50);
@Test @Test
public void test() { public void test() {
int i=2000; List<String> staffIds = new ArrayList<>();
while (i-->0) { staffIds.add("0006ae5de6484cf9b55072d2d967c481");
departmentApiService.listAllDepartment(i+""); memberUnionRelatedService.cleanStaffRelated("ca66a01b79474c40b3e7c7f93daf1a3b", staffIds);
} // int i=2000;
// while (i-->0) {
try { // departmentApiService.listAllDepartment(i+"");
Thread.sleep(1000000L); // }
} catch (InterruptedException e) { //
e.printStackTrace(); // try {
} // Thread.sleep(1000000L);
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
} }
//// @Test
//// public void test1() {
//// String res = qywxUserApiService.leaveClerkExternal("ww9ede832a84b7ae5f"
//// , "01YQ-pcdYzF3K0So8uCFfkB5i8D5EBW7KcVB4qA8Ktk", 0, 1000);
//// 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 // @Test
// public void test1() { // public void addDepart() {
// String res = qywxUserApiService.leaveClerkExternal("ww9ede832a84b7ae5f" // DepartmentDTO dto = new DepartmentDTO();
// , "01YQ-pcdYzF3K0So8uCFfkB5i8D5EBW7KcVB4qA8Ktk", 0, 1000); // dto.setName("测试order");
// JSONArray jsonArray = JSONArray.parseArray(res); // dto.setOrder(2147484447L);
// jsonArray.forEach(o -> { // dto.setParentid(1);
// JSONObject mid = (JSONObject) o; //
// qywxUserApiService.leaveClerkReTransfer("ww9ede832a84b7ae5f" // JSONResponse department = qywxDepartmentApiService.createSelfDepartment("ww9ede832a84b7ae5f"
// , "01YQ-pcdYzF3K0So8uCFfkB5i8D5EBW7KcVB4qA8Ktk", mid.getString("handover_userid") // , "3aOw7jbcHlHkDmOi5TuG42Ta8NqskOhZxy5urrmaGl8", dto);
// , mid.getString("handover_userid"), mid.getString("external_userid")); //// List<DepartmentDTO> list = (List<DepartmentDTO>) department;
// }); // System.out.println(JSONObject.toJSONString(department));
// System.out.println(res);
// } // }
////
//// @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, "n",
// "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");
// HashMap<String, String> map = new HashMap<>();
// map.put("名称", "hua");
//// messageDTO.setItems(map);
// boolean ret = qywxSuiteApiService.sendMessage("ww9ede832a84b7ae5f",
// "ww2c34dc56739bb105", messageDTO);
// System.out.println(JSONObject.toJSONString(ret));
//}
//
// //
// @Test // @Test
// public void test2() { // public void listExternalUserid() {
// UserDTO userDTO = new UserDTO(); // UserDTO userDTO = new UserDTO();
// userDTO.setUserid("niweizhong"); // userDTO.setUserid("niweizhong2");
// userDTO.setName("空闻大师"); // userDTO.setName("空闻大师2");
// userDTO.setDepartment(new Integer[]{4}); // userDTO.setDepartment(new Integer[]{5072});
// userDTO.setMobile("17605628855"); // userDTO.setMobile("17605628851");
// userDTO.setCorpid("ww9ede832a84b7ae5f"); // userDTO.setCorpid("ww9ede832a84b7ae5f");
// JSONResponse workWxUser = qywxUserApiService.createWorkWxUser(userDTO, "ww9ede832a84b7ae5f", "ww7d6566614055cf27"); // String s = qywxUserApiService.listExternalUserid("ww9ede832a84b7ae5f",
// System.out.println(JSONObject.toJSONString(workWxUser)); // "ww2c34dc56739bb105", "qiuwenmin");
// System.out.println(s);
// } // }
// //
// @Test // @Test
// public void list() { // public void getQrcode() {
// //
// List<DepartmentDTO> list = qywxDepartmentApiService.listSelfDepartment("ww9ede832a84b7ae5f" // UserDTO workWxUser = qywxUserApiService.getSelfWorkWxUser("ww9ede832a84b7ae5f", "3aOw7jbcHlHkDmOi5TuG42Ta8NqskOhZxy5urrmaGl8", "lining");
// , "3aOw7jbcHlHkDmOi5TuG42Ta8NqskOhZxy5urrmaGl8", 1); // ServiceResponse<String> qrcode = staffApiService.getStaffQrcode("167442", "ff8080817181d322017182737b16021f");
// Iterator<DepartmentDTO> iterator = list.iterator(); // System.out.println(JSONObject.toJSONString(qrcode));
//// 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.setName("测试order");
dto.setOrder(2147484447L);
dto.setParentid(1);
JSONResponse department = qywxDepartmentApiService.createSelfDepartment("ww9ede832a84b7ae5f"
, "3aOw7jbcHlHkDmOi5TuG42Ta8NqskOhZxy5urrmaGl8", dto);
// List<DepartmentDTO> list = (List<DepartmentDTO>) department;
System.out.println(JSONObject.toJSONString(department));
}
// //
// @Test // @Test
// public void getUser() { // public void extensionList() {
// 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, "n",
"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");
HashMap<String, String> map = new HashMap<>();
map.put("名称", "hua");
// messageDTO.setItems(map);
boolean ret = qywxSuiteApiService.sendMessage("ww9ede832a84b7ae5f",
"ww2c34dc56739bb105", messageDTO);
System.out.println(JSONObject.toJSONString(ret));
}
@Test
public void listExternalUserid() {
UserDTO userDTO = new UserDTO();
userDTO.setUserid("niweizhong2");
userDTO.setName("空闻大师2");
userDTO.setDepartment(new Integer[]{5072});
userDTO.setMobile("17605628851");
userDTO.setCorpid("ww9ede832a84b7ae5f");
String s = qywxUserApiService.listExternalUserid("ww9ede832a84b7ae5f",
"ww2c34dc56739bb105", "qiuwenmin");
System.out.println(s);
}
@Test
public void getQrcode() {
UserDTO workWxUser = qywxUserApiService.getSelfWorkWxUser("ww9ede832a84b7ae5f", "3aOw7jbcHlHkDmOi5TuG42Ta8NqskOhZxy5urrmaGl8", "lining");
ServiceResponse<String> qrcode = staffApiService.getStaffQrcode("167442", "ff8080817181d322017182737b16021f");
System.out.println(JSONObject.toJSONString(qrcode));
}
@Test
public void extensionList() {
String s = qywxUserApiService.listSelfExternalUserid("ww9ede832a84b7ae5f", "01YQ-pcdYzF3K0So8uCFfkB5i8D5EBW7KcVB4qA8Ktk", "de2c33f2e8924ff884e0073ca2f2f711");
System.out.println(JSONObject.toJSONString(s));
}
@Test
public void extensionList1() {
UserDTO selfWorkWxUser = qywxUserApiService.getSelfWorkWxUser("ww9ede832a84b7ae5f", "65zze159pYb4ofbFsIREZ5X7d7iaZ-bWsVIQk2y5kTU", "de2c33f2e8924ff884e0073ca2f2f711");
// String s = qywxUserApiService.listSelfExternalUserid("ww9ede832a84b7ae5f", "01YQ-pcdYzF3K0So8uCFfkB5i8D5EBW7KcVB4qA8Ktk", "de2c33f2e8924ff884e0073ca2f2f711"); // String s = qywxUserApiService.listSelfExternalUserid("ww9ede832a84b7ae5f", "01YQ-pcdYzF3K0So8uCFfkB5i8D5EBW7KcVB4qA8Ktk", "de2c33f2e8924ff884e0073ca2f2f711");
System.out.println(JSONObject.toJSONString(selfWorkWxUser)); // System.out.println(JSONObject.toJSONString(s));
} // }
// @Test
// public void extensionList1() {
// UserDTO selfWorkWxUser = qywxUserApiService.getSelfWorkWxUser("ww9ede832a84b7ae5f", "65zze159pYb4ofbFsIREZ5X7d7iaZ-bWsVIQk2y5kTU", "de2c33f2e8924ff884e0073ca2f2f711");
@Test //// String s = qywxUserApiService.listSelfExternalUserid("ww9ede832a84b7ae5f", "01YQ-pcdYzF3K0So8uCFfkB5i8D5EBW7KcVB4qA8Ktk", "de2c33f2e8924ff884e0073ca2f2f711");
public void extensionList2() { // System.out.println(JSONObject.toJSONString(selfWorkWxUser));
String img="d:/test2.jpg"; // }
byte[] aByte = getFileByteArray(new File(img)); //
JSONResponse response = qywxSuiteApiService.uploadMedia("ww9ede832a84b7ae5f", "ww2c34dc56739bb105", aByte,"测试文件", QywxMediaTypeEnum.IMAGE.getCode()); //
System.out.println(JSONObject.toJSONString(response)); //
} // @Test
// public void extensionList2() {
@Test // String img="d:/test2.jpg";
public void extensionList3() { // byte[] aByte = getFileByteArray(new File(img));
// msg59NLDQAAKvRi-fguFcKRVOjeoJKRJw // JSONResponse response = qywxSuiteApiService.uploadMedia("ww9ede832a84b7ae5f", "ww2c34dc56739bb105", aByte,"测试文件", QywxMediaTypeEnum.IMAGE.getCode());
// System.out.println(JSONObject.toJSONString(response));
// }
//
// @Test
// public void extensionList3() {
//// msg59NLDQAAKvRi-fguFcKRVOjeoJKRJw
//// String img="https://pic01-10001430.image.myqcloud.com/53205d69-01f1-4706-a258-014d59d8d106";
//// byte[] aByte = getByte(img);
//// JSONResponse response = qywxSuiteApiService.uploadMedia("ww9ede832a84b7ae5f", "ww2c34dc56739bb105", aByte, QywxMediaTypeEnum.IMAGE.getCode());
//// System.out.println(JSONObject.toJSONString(response));
// QywxImageExternalMessageDTO messageDTO=new QywxImageExternalMessageDTO();
// messageDTO.setMediaId("msg59NLDQAANPwzc9aMWNCBky8EElovyg");
// messageDTO.setSenderUserId("9ae4c4f1277340a186b16a17d937c72c");
// List<String> list=new ArrayList<>();
// list.add("wm59NLDQAAL0fHb-QEbx-U9pdtRFA1bg");
// messageDTO.setExternalUserid(list);
// JSONResponse response1 = qywxSuiteApiService.sendExternalMessage("ww9ede832a84b7ae5f", "ww2c34dc56739bb105", messageDTO);
// System.out.println(JSONObject.toJSONString(response1));
// }
//
// @Test
// public void extensionList4() {
//// msg59NLDQAAKvRi-fguFcKRVOjeoJKRJw
// String img="https://pic01-10001430.image.myqcloud.com/53205d69-01f1-4706-a258-014d59d8d106"; // String img="https://pic01-10001430.image.myqcloud.com/53205d69-01f1-4706-a258-014d59d8d106";
// byte[] aByte = getByte(img); // byte[] aByte = getByte(img);
// JSONResponse response = qywxSuiteApiService.uploadMedia("ww9ede832a84b7ae5f", "ww2c34dc56739bb105", aByte, QywxMediaTypeEnum.IMAGE.getCode()); //// JSONResponse response = qywxSuiteApiService.uploadMedia("ww9ede832a84b7ae5f", "ww2c34dc56739bb105", aByte, QywxMediaTypeEnum.IMAGE.getCode());
// System.out.println(JSONObject.toJSONString(response)); //// System.out.println(JSONObject.toJSONString(response));
QywxImageExternalMessageDTO messageDTO=new QywxImageExternalMessageDTO(); // JSONResponse response1 = qywxSuiteApiService.uploadImage("ww9ede832a84b7ae5f", "ww2c34dc56739bb105", aByte);
messageDTO.setMediaId("msg59NLDQAANPwzc9aMWNCBky8EElovyg"); // System.out.println(JSONObject.toJSONString(response1));
messageDTO.setSenderUserId("9ae4c4f1277340a186b16a17d937c72c"); // }
List<String> list=new ArrayList<>(); //
list.add("wm59NLDQAAL0fHb-QEbx-U9pdtRFA1bg"); //
messageDTO.setExternalUserid(list); // @Test
JSONResponse response1 = qywxSuiteApiService.sendExternalMessage("ww9ede832a84b7ae5f", "ww2c34dc56739bb105", messageDTO); // public void redis() {
System.out.println(JSONObject.toJSONString(response1)); // long key=111;
} // RedisUtil.setCache("test-key-11",key);
// Long key2=111L;
@Test // RedisUtil.setCache("test-key-112",key2);
public void extensionList4() { //
// msg59NLDQAAKvRi-fguFcKRVOjeoJKRJw // RedisUtil.setCache("test-key-113",1);
String img="https://pic01-10001430.image.myqcloud.com/53205d69-01f1-4706-a258-014d59d8d106"; // int ke22y=22;
byte[] aByte = getByte(img); // RedisUtil.setCache("test-key-115",ke22y);
// JSONResponse response = qywxSuiteApiService.uploadMedia("ww9ede832a84b7ae5f", "ww2c34dc56739bb105", aByte, QywxMediaTypeEnum.IMAGE.getCode()); //
// System.out.println(JSONObject.toJSONString(response)); // RedisUtil.setCache("test-key-114","1");
JSONResponse response1 = qywxSuiteApiService.uploadImage("ww9ede832a84b7ae5f", "ww2c34dc56739bb105", aByte); //
System.out.println(JSONObject.toJSONString(response1)); //
} // }
//
//
@Test // @Test
public void redis() { // public void staff() {
long key=111; // EmojiConverter emojiConverter = EmojiConverter.getInstance();
RedisUtil.setCache("test-key-11",key); //// List<UserDTO> userDTOList = qywxUserApiService.listSelfDepartmentUser("wwd5b0d17fd7952df8", "cFhOS1fkb8-qJNHDr5S8QI1JbpsTLCSTOsxQQUUmYz4", "1", 0);
Long key2=111L; // UserDTO wxUser = qywxUserApiService.getSelfWorkWxUser("wwd5b0d17fd7952df8", "cFhOS1fkb8-qJNHDr5S8QI1JbpsTLCSTOsxQQUUmYz4", "QingSu");
RedisUtil.setCache("test-key-112",key2); // String s = EmojiFilterUtil.removeAllEmoji(wxUser.getName());
//// String name = (String) b;
RedisUtil.setCache("test-key-113",1); //// ServiceResponse res = staffApiService.getWxSaveNew("a.XiaoPangZhi", "ca66a01b79474c40b3e7c7f93daf1a3b");
int ke22y=22; // System.out.println(JSONObject.toJSONString(wxUser));
RedisUtil.setCache("test-key-115",ke22y); //
//
RedisUtil.setCache("test-key-114","1"); // }
//
// private byte[] getByte(String strUrl){
} // ByteArrayOutputStream baos = null;
// try
// {
@Test // URL u = new URL(strUrl);
public void staff() { // BufferedImage image = ImageIO.read(u);
EmojiConverter emojiConverter = EmojiConverter.getInstance(); //
// List<UserDTO> userDTOList = qywxUserApiService.listSelfDepartmentUser("wwd5b0d17fd7952df8", "cFhOS1fkb8-qJNHDr5S8QI1JbpsTLCSTOsxQQUUmYz4", "1", 0); // //convert BufferedImage to byte array
UserDTO wxUser = qywxUserApiService.getSelfWorkWxUser("wwd5b0d17fd7952df8", "cFhOS1fkb8-qJNHDr5S8QI1JbpsTLCSTOsxQQUUmYz4", "QingSu"); // baos = new ByteArrayOutputStream();
String s = EmojiFilterUtil.removeAllEmoji(wxUser.getName()); // ImageIO.write( image, "jpg", baos);
// String name = (String) b; // baos.flush();
// ServiceResponse res = staffApiService.getWxSaveNew("a.XiaoPangZhi", "ca66a01b79474c40b3e7c7f93daf1a3b"); //
System.out.println(JSONObject.toJSONString(wxUser)); // return baos.toByteArray();
// }
// catch (Exception e)
} // {
// }
private byte[] getByte(String strUrl){ // finally
ByteArrayOutputStream baos = null; // {
try // if(baos != null)
{ // {
URL u = new URL(strUrl); // try {
BufferedImage image = ImageIO.read(u); // baos.close();
// } catch (IOException e) {
//convert BufferedImage to byte array // }
baos = new ByteArrayOutputStream(); // return baos.toByteArray();
ImageIO.write( image, "jpg", baos); // }
baos.flush(); // return null;
// }
return baos.toByteArray(); // }
} //
catch (Exception e) // public static byte[] getFileByteArray(File file) {
{ // long fileSize = file.length();
} // if (fileSize > Integer.MAX_VALUE) {
finally // System.out.println("file too big...");
{ // return null;
if(baos != null) // }
{ // byte[] buffer = null;
try { // try (FileInputStream fi = new FileInputStream(file)) {
baos.close(); // buffer = new byte[(int) fileSize];
} catch (IOException e) { // int offset = 0;
} // int numRead = 0;
return baos.toByteArray(); // while (offset < buffer.length
} // && (numRead = fi.read(buffer, offset, buffer.length - offset)) >= 0) {
return null; // offset += numRead;
} // }
} // // 确保所有数据均被读取
// if (offset != buffer.length) {
public static byte[] getFileByteArray(File file) { // throw new IOException("Could not completely read file "
long fileSize = file.length(); // + file.getName());
if (fileSize > Integer.MAX_VALUE) { // }
System.out.println("file too big..."); // } catch (Exception e) {
return null; // e.printStackTrace();
} // }
byte[] buffer = null; // return buffer;
try (FileInputStream fi = new FileInputStream(file)) { // }
buffer = new byte[(int) fileSize];
int offset = 0;
int numRead = 0;
while (offset < buffer.length
&& (numRead = fi.read(buffer, offset, buffer.length - offset)) >= 0) {
offset += numRead;
}
// 确保所有数据均被读取
if (offset != buffer.length) {
throw new IOException("Could not completely read file "
+ file.getName());
}
} catch (Exception e) {
e.printStackTrace();
}
return buffer;
}
} }
...@@ -16,7 +16,9 @@ import com.gic.haoban.manage.api.service.AuditApiService; ...@@ -16,7 +16,9 @@ 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.StaffApiService; import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.web.anno.HttpLimit; import com.gic.haoban.manage.web.anno.HttpLimit;
import com.gic.haoban.manage.web.auth.AuthRequestUtil;
import com.gic.haoban.manage.web.vo.BatchApproveVO; import com.gic.haoban.manage.web.vo.BatchApproveVO;
import com.gic.haoban.manage.web.vo.LoginVO;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
...@@ -161,12 +163,16 @@ public class AuditController extends WebBaseController{ ...@@ -161,12 +163,16 @@ public class AuditController extends WebBaseController{
if(StringUtils.isAnyBlank(auditIds,auditName)){ if(StringUtils.isAnyBlank(auditIds,auditName)){
return resultResponse(HaoBanErrCode.ERR_2); return resultResponse(HaoBanErrCode.ERR_2);
} }
LoginVO login = (LoginVO) AuthRequestUtil.getLoginUser();
String staffId = login.getStaffDTO().getStaffId();
String staffName = login.getStaffDTO().getStaffName();
String[] s = auditIds.split(","); String[] s = auditIds.split(",");
int successCount = 0; int successCount = 0;
int failCount = 0; int failCount = 0;
String batchId = UuidUtil.randomUUID(); String batchId = UuidUtil.randomUUID();
for(String auditId : s){ for(String auditId : s){
String result = auditApiService.audit(batchId,auditId,auditName); String result = auditApiService.audit(batchId,auditId,staffName,staffId);
// String result = auditApiService.audit(batchId,auditId,auditName,loginStaffDTO.getStaffId());
if(StringUtils.isEmpty(result)){ if(StringUtils.isEmpty(result)){
successCount = successCount+1; successCount = successCount+1;
}else{ }else{
...@@ -187,17 +193,27 @@ public class AuditController extends WebBaseController{ ...@@ -187,17 +193,27 @@ public class AuditController extends WebBaseController{
if(StringUtils.isAnyBlank(auditId,auditReason,auditName)){ if(StringUtils.isAnyBlank(auditId,auditReason,auditName)){
return resultResponse(HaoBanErrCode.ERR_2); return resultResponse(HaoBanErrCode.ERR_2);
} }
auditApiService.refuse(auditId, auditReason,auditName); LoginVO login = (LoginVO) AuthRequestUtil.getLoginUser();
String staffId = login.getStaffDTO().getStaffId();
String staffName = login.getStaffDTO().getStaffName();
auditApiService.refuse(auditId, auditReason,staffName,staffId);
return resultResponse(HaoBanErrCode.ERR_1); return resultResponse(HaoBanErrCode.ERR_1);
} }
//审核同意 //审核同意
@HttpLimit @HttpLimit
@RequestMapping("audit") @RequestMapping("audit")
public HaobanResponse audit(String auditId,String auditName ) { public HaobanResponse audit(String auditId,String auditName ) {
LoginVO login = (LoginVO) AuthRequestUtil.getLoginUser();
StaffDTO loginStaffDTO = login.getStaffDTO();
if (null == login) {
return resultResponse(HaoBanErrCode.ERR_4);
}
String staffId = login.getStaffDTO().getStaffId();
String staffName = login.getStaffDTO().getStaffName();
if(StringUtils.isAnyBlank(auditId)){ if(StringUtils.isAnyBlank(auditId)){
return resultResponse(HaoBanErrCode.ERR_2); return resultResponse(HaoBanErrCode.ERR_2);
} }
String result = auditApiService.audit("",auditId,auditName); String result = auditApiService.audit("",auditId,staffName,staffId);
if(StringUtils.isEmpty(result)){ if(StringUtils.isEmpty(result)){
return resultResponse(HaoBanErrCode.ERR_1); return resultResponse(HaoBanErrCode.ERR_1);
}else{ }else{
......
...@@ -15,6 +15,8 @@ import com.gic.haoban.base.api.common.ServiceResponse; ...@@ -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.EntityUtil;
import com.gic.haoban.common.utils.HaobanResponse; import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.*; 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.api.service.*;
import com.gic.haoban.manage.web.auth.AuthRequestUtil; import com.gic.haoban.manage.web.auth.AuthRequestUtil;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode; import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
...@@ -29,6 +31,7 @@ import org.slf4j.Logger; ...@@ -29,6 +31,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -285,11 +288,17 @@ public class StaffController extends WebBaseController{ ...@@ -285,11 +288,17 @@ public class StaffController extends WebBaseController{
*/ */
@RequestMapping("del-clerk-relation") @RequestMapping("del-clerk-relation")
public HaobanResponse delStaffClerkList(String staffId,String clerkId){ 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); StaffDTO staff = staffApiService.selectById(staffId);
if(staff == null) { if(staff == null) {
return resultResponse(HaoBanErrCode.ERR_10007); return resultResponse(HaoBanErrCode.ERR_10007);
} }
boolean b = staffClerkRelationApiService.unbindByStaffAndClerkId(staffId, clerkId); boolean b = staffClerkRelationApiService.unbindByStaffAndClerkId(staffDTO.getStaffId(), clerkId);
return resultResponse(HaoBanErrCode.ERR_1,b); return resultResponse(HaoBanErrCode.ERR_1,b);
} }
...@@ -348,6 +357,11 @@ public class StaffController extends WebBaseController{ ...@@ -348,6 +357,11 @@ public class StaffController extends WebBaseController{
*/ */
@RequestMapping("add-clerk-relation") @RequestMapping("add-clerk-relation")
public HaobanResponse staffClerkSearch(String staffId,String clerkId){ 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)) { if (StringUtils.isAnyBlank(staffId,clerkId)) {
return resultResponse(HaoBanErrCode.ERR_2); return resultResponse(HaoBanErrCode.ERR_2);
} }
...@@ -369,7 +383,7 @@ public class StaffController extends WebBaseController{ ...@@ -369,7 +383,7 @@ public class StaffController extends WebBaseController{
relationDTO.setWxUserId(staffDTO.getWxUserId()); 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)); logger.info("返回信息:{}", JSONObject.toJSONString(response));
if (response.getCode()==1) { if (response.getCode()==1) {
return resultResponse(HaoBanErrCode.ERR_1); return resultResponse(HaoBanErrCode.ERR_1);
...@@ -380,4 +394,20 @@ public class StaffController extends WebBaseController{ ...@@ -380,4 +394,20 @@ public class StaffController extends WebBaseController{
} }
} }
/**
* 绑定日志
* @return
*/
@RequestMapping("staff-clerk-bind-log")
public HaobanResponse bindLogs(String search,String enterpriseId,@RequestParam(defaultValue = "-1") Integer optType,BasePageInfo qo){
LoginVO login = (LoginVO) AuthRequestUtil.getLoginUser();
StaffDTO loginStaffDTO = login.getStaffDTO();
if (null == loginStaffDTO) {
return resultResponse(HaoBanErrCode.ERR_4);
}
Page<StaffClerkBindLogDetailDTO> page = staffClerkRelationApiService.pageStaffClerkBindLog(loginStaffDTO.getWxEnterpriseId(), search, enterpriseId, optType, qo);
return resultResponse(HaoBanErrCode.ERR_1,page);
}
} }
...@@ -4,6 +4,7 @@ package com.gic.haoban.manage.web.controller; ...@@ -4,6 +4,7 @@ package com.gic.haoban.manage.web.controller;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.gic.haoban.manage.api.enums.ChannelCodeEnum;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -236,7 +237,7 @@ public class AuditController extends WebBaseController{ ...@@ -236,7 +237,7 @@ public class AuditController extends WebBaseController{
staffClerkRelation.setWxEnterpriseId(wxEnterpriseId); staffClerkRelation.setWxEnterpriseId(wxEnterpriseId);
staffClerkRelation.setWxUserId(wxUserId); staffClerkRelation.setWxUserId(wxUserId);
staffClerkRelation.setStaffId(auditStaffId); staffClerkRelation.setStaffId(auditStaffId);
staffClerkRelationApiService.delAndInsert(staffClerkRelation); staffClerkRelationApiService.delAndInsert(staffClerkRelation,staffId, ChannelCodeEnum.AUDIT_BIND.getCode());
audit.setAuditStatus(1); audit.setAuditStatus(1);
//发送消息 //发送消息
staffDepartmentRelatedApiService.sendClerkBind(auditStaffId, clerkCode,storeId, auditStatus, auditReason); staffDepartmentRelatedApiService.sendClerkBind(auditStaffId, clerkCode,storeId, auditStatus, auditReason);
......
...@@ -8,6 +8,7 @@ import java.util.Map; ...@@ -8,6 +8,7 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.gic.haoban.manage.api.enums.*;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -26,6 +27,7 @@ import com.gic.clerk.api.service.ClerkNewService; ...@@ -26,6 +27,7 @@ import com.gic.clerk.api.service.ClerkNewService;
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.DateUtil;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.GICMQClientUtil;
import com.gic.enterprise.api.dto.EnterpriseDTO; import com.gic.enterprise.api.dto.EnterpriseDTO;
import com.gic.enterprise.api.dto.StoreDTO; import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.enterprise.api.service.EnterpriseService; import com.gic.enterprise.api.service.EnterpriseService;
...@@ -45,9 +47,6 @@ import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO; ...@@ -45,9 +47,6 @@ import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.dto.StaffDTO; import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO; import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO; 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.AuditApiService;
import com.gic.haoban.manage.api.service.AuditSettingApiService; import com.gic.haoban.manage.api.service.AuditSettingApiService;
import com.gic.haoban.manage.api.service.BindApiService; import com.gic.haoban.manage.api.service.BindApiService;
...@@ -62,6 +61,7 @@ import com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService; ...@@ -62,6 +61,7 @@ import com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService;
import com.gic.haoban.manage.web.anno.HttpLimit; import com.gic.haoban.manage.web.anno.HttpLimit;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode; 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.utils.RouterConstant;
import com.gic.haoban.manage.web.vo.BindClerkVO; import com.gic.haoban.manage.web.vo.BindClerkVO;
import com.gic.haoban.manage.web.vo.ClerkStoreVO; import com.gic.haoban.manage.web.vo.ClerkStoreVO;
import com.gic.haoban.manage.web.vo.ClerkVo; import com.gic.haoban.manage.web.vo.ClerkVo;
...@@ -425,7 +425,18 @@ public class ClerkController extends WebBaseController{ ...@@ -425,7 +425,18 @@ public class ClerkController extends WebBaseController{
Integer count = RedisUtil.getCache(key) == null ? 0 : (Integer)RedisUtil.getCache(key); Integer count = RedisUtil.getCache(key) == null ? 0 : (Integer)RedisUtil.getCache(key);
if(count == null || count < 4){ if(count == null || count < 4){
RedisUtil.setCache(key,count + 1,31 * 24 * 60 * 60l); RedisUtil.setCache(key,count + 1,31 * 24 * 60 * 60l);
memberUnionidRelatedApiService.freshWxFrend(wxEnterpriseId, staff.getWxUserId()); JSONObject json = new JSONObject();
json.put("wxUserId", staff.getWxUserId());
json.put("wxEnterpriseId", wxEnterpriseId);
json.put("storeId", storeId);
logger.info("【刷下微信好友】{},{},{}",RouterConstant.FRESH_WX_FRIEND_SERVICENAME,RouterConstant.INIT_FRESH_WX_FRIEND_METHODNAME,json.toJSONString());
try {
GICMQClientUtil.getClientInstance().sendCommonMessage(RouterConstant.ROUTERTYPE, json.toJSONString(),
RouterConstant.FRESH_WX_FRIEND_SERVICENAME, RouterConstant.INIT_FRESH_WX_FRIEND_METHODNAME);
} catch (Exception e) {
logger.info(e.getMessage(),e);
}
// memberUnionidRelatedApiService.freshWxFrend(wxEnterpriseId, staff.getWxUserId(),storeId);
}else{ }else{
return resultResponse(HaoBanErrCode.ERR_10011); return resultResponse(HaoBanErrCode.ERR_10011);
...@@ -528,7 +539,7 @@ public class ClerkController extends WebBaseController{ ...@@ -528,7 +539,7 @@ public class ClerkController extends WebBaseController{
staffClerkRelation.setWxUserId(wxUserId); staffClerkRelation.setWxUserId(wxUserId);
staffClerkRelation.setStaffId(staffId); staffClerkRelation.setStaffId(staffId);
staffClerkRelationApiService.insertOrUpdate(staffClerkRelation); staffClerkRelationApiService.delAndInsert(staffClerkRelation,staffId,ChannelCodeEnum.SELF_BIND.getCode());
//无需审核 //无需审核
AuditDTO audit = new AuditDTO(); AuditDTO audit = new AuditDTO();
...@@ -650,6 +661,8 @@ public class ClerkController extends WebBaseController{ ...@@ -650,6 +661,8 @@ public class ClerkController extends WebBaseController{
// auditApiService.insert(audit); // auditApiService.insert(audit);
staffClerkRelationApiService.delByStoreIdAndCode(storeId, clerkCode); staffClerkRelationApiService.delByStoreIdAndCode(storeId, clerkCode);
//加入日志
staffClerkRelationApiService.pushToBindLog(staffClerkRelation.getStaffId(),staffId, BindTypeEnum.UNBIND.getVal(), ChannelCodeEnum.SELF_UNBIND.getCode(),staffClerkRelation.getStaffClerkRelationId());
return resultResponse(HaoBanErrCode.ERR_1); return resultResponse(HaoBanErrCode.ERR_1);
} }
......
...@@ -8,10 +8,8 @@ import com.gic.clerk.api.service.ClerkService; ...@@ -8,10 +8,8 @@ import com.gic.clerk.api.service.ClerkService;
import com.gic.dict.api.dto.DictDTO; import com.gic.dict.api.dto.DictDTO;
import com.gic.dict.api.service.ManagerDictService; import com.gic.dict.api.service.ManagerDictService;
import com.gic.enterprise.api.dto.StoreDTO; import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.enterprise.api.dto.StorePhotoDTO;
import com.gic.haoban.app.customer.dto.StaffOpenRelatedDTO; import com.gic.haoban.app.customer.dto.StaffOpenRelatedDTO;
import com.gic.haoban.app.customer.service.api.service.StaffMemberRelationApiService; import com.gic.haoban.app.customer.service.api.service.StaffMemberRelationApiService;
import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.common.utils.EntityUtil; import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.common.utils.HaobanResponse; import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.*; import com.gic.haoban.manage.api.dto.*;
...@@ -24,7 +22,6 @@ import com.gic.haoban.manage.web.qo.MemberLoginQo; ...@@ -24,7 +22,6 @@ import com.gic.haoban.manage.web.qo.MemberLoginQo;
import com.gic.haoban.manage.web.vo.AppStaffVo; import com.gic.haoban.manage.web.vo.AppStaffVo;
import com.gic.haoban.manage.web.vo.InfoVo; import com.gic.haoban.manage.web.vo.InfoVo;
import com.gic.haoban.manage.web.vo.StoreMemberVO; import com.gic.haoban.manage.web.vo.StoreMemberVO;
import com.gic.haoban.manage.web.vo.StoreVO;
import com.gic.wechat.api.dto.qywx.UserDTO; import com.gic.wechat.api.dto.qywx.UserDTO;
import com.gic.wechat.api.service.qywx.QywxCorpApiService; import com.gic.wechat.api.service.qywx.QywxCorpApiService;
import com.gic.wechat.api.service.qywx.QywxUserApiService; import com.gic.wechat.api.service.qywx.QywxUserApiService;
...@@ -36,7 +33,10 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -36,7 +33,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.*; import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@RestController @RestController
...@@ -172,6 +172,13 @@ public class InfoController extends WebBaseController{ ...@@ -172,6 +172,13 @@ public class InfoController extends WebBaseController{
} }
@RequestMapping("get-gyt-info-by-code")
public HaobanResponse getGytCode(String code) {
String userDTOJson = qywxUserApiService.getUserByCode("ww9ede832a84b7ae5f", "lHHKe1X683yWYAdwWATdzRTdVWo8uTnPH3nj5Gkt4og", code);
logger.info(userDTOJson);
return resultResponse(HaoBanErrCode.ERR_1,userDTOJson);
}
@RequestMapping("get-user-by-member-code") @RequestMapping("get-user-by-member-code")
public HaobanResponse getInfoByMemberCode(GetUserByMemberCodeQo qo) { public HaobanResponse getInfoByMemberCode(GetUserByMemberCodeQo qo) {
EnterpriseDetailDTO enterpriseDetailDTO = wxEnterpriseRelatedApiService.getByEnterpriseId(qo.getGicEnterpriseId()); EnterpriseDetailDTO enterpriseDetailDTO = wxEnterpriseRelatedApiService.getByEnterpriseId(qo.getGicEnterpriseId());
......
package com.gic.haoban.manage.web.utils;
public class RouterConstant {
public static final String FRESH_WX_FRIEND_SERVICENAME = "com.gic.haoban.manage.api.service.MemberUnionidRelatedApiService";
public static final String INIT_FRESH_WX_FRIEND_METHODNAME = "mqFreshWxFrend";
public static final String ROUTERTYPE = "commonRouter";
}
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