Commit c57b62fe by guojx

Merge remote-tracking branch 'origin/developer' into developer

# Conflicts:
#	haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/hm/HmQrcodeController.java
parents d0a49c24 b5cb7b86
package com.gic.haoban.manage.api.dto;
import java.io.Serializable;
public class CommonMQDTO implements Serializable {
/**
* @Fields serialVersionUID : TODO(用一句话描述这个变量表示什么)
*/
private static final long serialVersionUID = -5681421708810402425L;
private int type ;
private String params ;
public int getType() {
return type;
}
public String getParams() {
return params;
}
public void setType(int type) {
this.type = type;
}
public void setParams(String params) {
this.params = params;
}
}
...@@ -6,100 +6,101 @@ import java.util.List; ...@@ -6,100 +6,101 @@ import java.util.List;
public class StaffDTO implements Serializable { public class StaffDTO implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* 员工id * 员工id
*/ */
private String staffId; private String staffId;
/** /**
* 企业微信id * 企业微信id
*/ */
private String wxEnterpriseId; private String wxEnterpriseId;
/** /**
* 微信用户id * 微信用户id
*/ */
private String wxUserId; private String wxUserId;
/** /**
* 手机号 * 手机号
*/ */
private String phoneNumber; private String phoneNumber;
/** /**
* 员工姓名 * 员工姓名
*/ */
private String staffName; private String staffName;
/** /**
* 国家码 * 国家码
*/ */
private String nationCode; private String nationCode;
/** /**
* 昵称 * 昵称
*/ */
private String nickName; private String nickName;
/** /**
* 性别 * 性别
*/ */
private Integer sex; private Integer sex;
/** /**
* 职位 * 职位
*/ */
private String postion; private String postion;
/** /**
* 激活状态 * 激活状态
*/ */
private Integer activeFlag; private Integer activeFlag;
/** /**
* 对外职务 * 对外职务
*/ */
private String extendPostion; private String extendPostion;
/** /**
* 状态 * 状态
*/ */
private Integer statusFlag; private Integer statusFlag;
private Date createTime; private Date createTime;
private Date updateTime; private Date updateTime;
private String departmentIds; private String departmentIds;
private String headImg; private String headImg;
private Integer sort; private Integer sort;
private List<DepartmentDTO> departmentList; private List<DepartmentDTO> departmentList;
private int bindFlag; private int bindFlag;
private String clerkCode; private String clerkCode;
private String staffDepartmentRelatedId; private String staffDepartmentRelatedId;
private int clerkType; private int clerkType;
private Integer syncPostionFlag; private Integer syncPostionFlag;
private Integer superManagerFlag; private Integer superManagerFlag;
private Boolean weixinPush; private Boolean weixinPush;
private Integer memberCount; private Integer memberCount;
private String clerkId; private String clerkId;
/** /**
* 关联状态 1 已关联 0 未关联 * 关联状态 1 已关联 0 未关联
* 关联状态为 员工是否关联某门店导购 * 关联状态为 员工是否关联某门店导购
*/ */
private Integer relationFlag; private Integer relationFlag;
private String wxOpenUseId; private String wxOpenUseId;
private String wxOpenId; private String wxOpenId;
private String qrCode; private String qrCode;
private String clerkName; private String clerkName;
private String defaultGicEid ; private String defaultGicEid;
private Integer addNum;
public String getDefaultGicEid() { public String getDefaultGicEid() {
return defaultGicEid; return defaultGicEid;
} }
...@@ -108,97 +109,96 @@ public class StaffDTO implements Serializable { ...@@ -108,97 +109,96 @@ public class StaffDTO implements Serializable {
} }
public String getClerkId() { public String getClerkId() {
return clerkId; return clerkId;
} }
public void setClerkId(String clerkId) { public void setClerkId(String clerkId) {
this.clerkId = clerkId; this.clerkId = clerkId;
} }
public int getClerkType() { public int getClerkType() {
return clerkType; return clerkType;
} }
public void setClerkType(int clerkType) { public void setClerkType(int clerkType) {
this.clerkType = clerkType; this.clerkType = clerkType;
} }
public String getStaffDepartmentRelatedId() { public String getStaffDepartmentRelatedId() {
return staffDepartmentRelatedId; return staffDepartmentRelatedId;
} }
public void setStaffDepartmentRelatedId(String staffDepartmentRelatedId) { public void setStaffDepartmentRelatedId(String staffDepartmentRelatedId) {
this.staffDepartmentRelatedId = staffDepartmentRelatedId; this.staffDepartmentRelatedId = staffDepartmentRelatedId;
} }
public String getClerkCode() { public String getClerkCode() {
return clerkCode; return clerkCode;
} }
public void setClerkCode(String clerkCode) { public void setClerkCode(String clerkCode) {
this.clerkCode = clerkCode; this.clerkCode = clerkCode;
} }
public int getBindFlag() { public int getBindFlag() {
return bindFlag; return bindFlag;
} }
public void setBindFlag(int bindFlag) { public void setBindFlag(int bindFlag) {
this.bindFlag = bindFlag; this.bindFlag = bindFlag;
} }
public String getStaffId() { public String getStaffId() {
return staffId; return staffId;
} }
public void setStaffId(String staffId) { public void setStaffId(String staffId) {
this.staffId = staffId == null ? null : staffId.trim(); this.staffId = staffId == null ? null : staffId.trim();
} }
public String getWxEnterpriseId() { public String getWxEnterpriseId() {
return wxEnterpriseId; return wxEnterpriseId;
} }
public void setWxEnterpriseId(String wxEnterpriseId) { public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId; this.wxEnterpriseId = wxEnterpriseId;
} }
public String getExtendPostion() { public String getExtendPostion() {
return extendPostion; return extendPostion;
} }
public void setExtendPostion(String extendPostion) { public void setExtendPostion(String extendPostion) {
this.extendPostion = extendPostion; this.extendPostion = extendPostion;
} }
public Integer getStatusFlag() { public Integer getStatusFlag() {
return statusFlag; return statusFlag;
} }
public void setStatusFlag(Integer statusFlag) { public void setStatusFlag(Integer statusFlag) {
this.statusFlag = statusFlag; this.statusFlag = statusFlag;
} }
public Date getCreateTime() { public Date getCreateTime() {
return createTime; return createTime;
} }
public void setCreateTime(Date createTime) { public void setCreateTime(Date createTime) {
this.createTime = createTime; this.createTime = createTime;
} }
public Date getUpdateTime() { public Date getUpdateTime() {
return updateTime; return updateTime;
} }
public void setUpdateTime(Date updateTime) { public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime; this.updateTime = updateTime;
} }
public String getWxUserId() { public String getWxUserId() {
return wxUserId; return wxUserId;
} }
...@@ -262,107 +262,115 @@ public class StaffDTO implements Serializable { ...@@ -262,107 +262,115 @@ public class StaffDTO implements Serializable {
this.activeFlag = activeFlag; this.activeFlag = activeFlag;
} }
public String getDepartmentIds() { public String getDepartmentIds() {
return departmentIds; return departmentIds;
} }
public void setDepartmentIds(String departmentIds) {
this.departmentIds = departmentIds;
}
public void setDepartmentIds(String departmentIds) { public String getHeadImg() {
this.departmentIds = departmentIds; return headImg;
} }
public String getHeadImg() { public void setHeadImg(String headImg) {
return headImg; this.headImg = headImg;
} }
public void setHeadImg(String headImg) { public List<DepartmentDTO> getDepartmentList() {
this.headImg = headImg; return departmentList;
} }
public List<DepartmentDTO> getDepartmentList() { public void setDepartmentList(List<DepartmentDTO> departmentList) {
return departmentList; this.departmentList = departmentList;
} }
public Integer getSort() {
return sort;
}
public void setDepartmentList(List<DepartmentDTO> departmentList) { public void setSort(Integer sort) {
this.departmentList = departmentList; this.sort = sort;
} }
public Integer getSort() { public Integer getSyncPostionFlag() {
return sort; return syncPostionFlag;
} }
public void setSort(Integer sort) { public void setSyncPostionFlag(Integer syncPostionFlag) {
this.sort = sort; this.syncPostionFlag = syncPostionFlag;
} }
public Integer getSyncPostionFlag() { public Integer getSuperManagerFlag() {
return syncPostionFlag; return superManagerFlag;
} }
public void setSyncPostionFlag(Integer syncPostionFlag) { public void setSuperManagerFlag(Integer superManagerFlag) {
this.syncPostionFlag = syncPostionFlag; this.superManagerFlag = superManagerFlag;
} }
public Integer getSuperManagerFlag() { public Boolean getWeixinPush() {
return superManagerFlag; return weixinPush;
} }
public void setSuperManagerFlag(Integer superManagerFlag) { public void setWeixinPush(Boolean weixinPush) {
this.superManagerFlag = superManagerFlag; this.weixinPush = weixinPush;
} }
public Boolean getWeixinPush() { public Integer getMemberCount() {
return weixinPush; return memberCount;
} }
public void setWeixinPush(Boolean weixinPush) { public void setMemberCount(Integer memberCount) {
this.weixinPush = weixinPush; this.memberCount = memberCount;
} }
public Integer getMemberCount() { public Integer getRelationFlag() {
return memberCount; return relationFlag;
} }
public void setMemberCount(Integer memberCount) { public void setRelationFlag(Integer relationFlag) {
this.memberCount = memberCount; this.relationFlag = relationFlag;
} }
public Integer getRelationFlag() { public String getWxOpenUseId() {
return relationFlag; return wxOpenUseId;
} }
public void setRelationFlag(Integer relationFlag) { public void setWxOpenUseId(String wxOpenUseId) {
this.relationFlag = relationFlag; this.wxOpenUseId = wxOpenUseId;
} }
public String getWxOpenUseId() { public String getWxOpenId() {
return wxOpenUseId; return wxOpenId;
} }
public void setWxOpenUseId(String wxOpenUseId) { public void setWxOpenId(String wxOpenId) {
this.wxOpenUseId = wxOpenUseId; this.wxOpenId = wxOpenId;
} }
public String getWxOpenId() { public String getQrCode() {
return wxOpenId; return qrCode;
} }
public void setWxOpenId(String wxOpenId) { public void setQrCode(String qrCode) {
this.wxOpenId = wxOpenId; this.qrCode = qrCode;
} }
public String getQrCode() { public String getClerkName() {
return qrCode; return clerkName;
} }
public void setQrCode(String qrCode) { public void setClerkName(String clerkName) {
this.qrCode = qrCode; this.clerkName = clerkName;
} }
public String getClerkName() { public Integer getAddNum() {
return clerkName; return addNum;
} }
public void setClerkName(String clerkName) { public void setAddNum(Integer addNum) {
this.clerkName = clerkName; this.addNum = addNum;
} }
} }
package com.gic.haoban.manage.api.dto;
import java.io.Serializable;
public class WxEnterpriseQwDTO implements Serializable {
private static final long serialVersionUID = 1L;
private int wxSecurityType ;
private String wxEnterpriseId;
// 企业表中的id(正常同第三方)
private String corpid;
// 好办 助手
private String dkCorpid;
// 会员小程序dk
private String memberCorpid;
// 第三方
private String thirdCorpid;
// 自建
private String selfCorpid;
public int getWxSecurityType() {
return wxSecurityType;
}
public void setWxSecurityType(int wxSecurityType) {
this.wxSecurityType = wxSecurityType;
}
public String getSelfCorpid() {
return selfCorpid;
}
public void setSelfCorpid(String selfCorpid) {
this.selfCorpid = selfCorpid;
}
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public String getCorpid() {
return corpid;
}
public String getDkCorpid() {
return dkCorpid;
}
public String getMemberCorpid() {
return memberCorpid;
}
public String getThirdCorpid() {
return thirdCorpid;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
public void setCorpid(String corpid) {
this.corpid = corpid;
}
public void setDkCorpid(String dkCorpid) {
this.dkCorpid = dkCorpid;
}
public void setMemberCorpid(String memberCorpid) {
this.memberCorpid = memberCorpid;
}
public void setThirdCorpid(String thirdCorpid) {
this.thirdCorpid = thirdCorpid;
}
}
...@@ -19,6 +19,8 @@ public class HmLinkWxaDTO implements Serializable { ...@@ -19,6 +19,8 @@ public class HmLinkWxaDTO implements Serializable {
private Long pageId ; private Long pageId ;
private Long hmId ; private Long hmId ;
private String wxEnterpriseId ;
private String enterpriseId ;
private HmPageDTO page; private HmPageDTO page;
// 二维码 // 二维码
private String hmQrcode; private String hmQrcode;
...@@ -33,6 +35,22 @@ public class HmLinkWxaDTO implements Serializable { ...@@ -33,6 +35,22 @@ public class HmLinkWxaDTO implements Serializable {
// 说明 // 说明
private Map<String,String> remarkMap ; private Map<String,String> remarkMap ;
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public String getEnterpriseId() {
return enterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public Long getHmId() { public Long getHmId() {
return hmId; return hmId;
} }
......
...@@ -25,6 +25,7 @@ public class HmQrcodeListDTO implements Serializable { ...@@ -25,6 +25,7 @@ public class HmQrcodeListDTO implements Serializable {
private String enterpriseId; private String enterpriseId;
private String name; private String name;
private String hmName;
private String creatorId; private String creatorId;
...@@ -79,6 +80,7 @@ public class HmQrcodeListDTO implements Serializable { ...@@ -79,6 +80,7 @@ public class HmQrcodeListDTO implements Serializable {
* 活码分组 * 活码分组
*/ */
private Long hmGroupId; private Long hmGroupId;
private String hmGroupName;
/** /**
* 新增总人数 * 新增总人数
*/ */
...@@ -319,4 +321,20 @@ public class HmQrcodeListDTO implements Serializable { ...@@ -319,4 +321,20 @@ public class HmQrcodeListDTO implements Serializable {
public void setStoreList(List<HmStoreDTO> storeList) { public void setStoreList(List<HmStoreDTO> storeList) {
this.storeList = storeList; this.storeList = storeList;
} }
public String getHmGroupName() {
return hmGroupName;
}
public void setHmGroupName(String hmGroupName) {
this.hmGroupName = hmGroupName;
}
public String getHmName() {
return hmName;
}
public void setHmName(String hmName) {
this.hmName = hmName;
}
} }
...@@ -97,9 +97,9 @@ public class HmQrcodeQDTO implements Serializable { ...@@ -97,9 +97,9 @@ public class HmQrcodeQDTO implements Serializable {
private String staffId; private String staffId;
private String staffName; private String staffName;
/** /**
* 调用类型,1:手动调用;2:系统调用;3:批量调用 * 调用类型来源 0:不记录,1:来源为后台操作 其他查看枚举 HbBindEnum
*/ */
private Integer invokingType; private Integer invokingType = 0;
public Long getHmId() { public Long getHmId() {
......
package com.gic.haoban.manage.api.dto.qdto.hm; package com.gic.haoban.manage.api.dto.qdto.hm;
import com.gic.api.base.commons.BasePageInfo;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import org.springframework.format.annotation.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.gic.api.base.commons.BasePageInfo;
public class WxUserAddLogSearchQDTO extends BasePageInfo implements Serializable { public class WxUserAddLogSearchQDTO extends BasePageInfo implements Serializable {
/** /**
...@@ -17,10 +20,27 @@ public class WxUserAddLogSearchQDTO extends BasePageInfo implements Serializable ...@@ -17,10 +20,27 @@ public class WxUserAddLogSearchQDTO extends BasePageInfo implements Serializable
private Long linkId; private Long linkId;
private Long hmId; private Long hmId;
private String clerkId; private String clerkId;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date startTime; private Date startTime;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date endTime; private Date endTime;
private Integer addChannel; private Integer addChannel;
private String createTimeOrder = "create_time desc"; // 1添加 2流失
private int statusFlag = 1 ;
private String createTimeOrder = "desc";
public int getStatusFlag() {
if(0==statusFlag) {
return 1 ;
}
return statusFlag;
}
public void setStatusFlag(int statusFlag) {
this.statusFlag = statusFlag;
}
public String getWxEnterpriseId() { public String getWxEnterpriseId() {
return wxEnterpriseId; return wxEnterpriseId;
......
...@@ -4,18 +4,22 @@ package com.gic.haoban.manage.api.enums; ...@@ -4,18 +4,22 @@ package com.gic.haoban.manage.api.enums;
* Created by hua on 2020/6/24. * Created by hua on 2020/6/24.
*/ */
public enum ChannelCodeEnum { public enum ChannelCodeEnum {
/**
* 好办绑定 解绑类型
*/
ADMIN_BIND(1001,"后台管理员绑定"), ADMIN_BIND(1001,"后台管理员绑定"),
SELF_BIND(1002,"好办客户端绑定"), SELF_BIND(1002,"好办小程序绑定"),
AUDIT_BIND(1003,"审核绑定"), AUDIT_BIND(1003,"后台审核绑定"),
SYNC_BIND(1004,"GIC同步绑定"), SYNC_BIND(1004,"GIC同步绑定"),
ADMIN_UNBIND(2001,"后台管理员解绑"), ADMIN_UNBIND(2001,"后台管理员解绑"),
SELF_UNBIND(2002,"好办客户端解绑"), SELF_UNBIND(2002,"好办小程序解绑"),
SYNC_UNBIND(2003,"GIC同步解绑"), SYNC_UNBIND(2003,"GIC同步解绑"),
WEIXIN_DEL(2004,"微信删除解绑"), WEIXIN_DEL(2004,"员工离职解绑"),
AUDIT_UNBIND(2005,"审核解绑"), AUDIT_UNBIND(2005,"后台审核解绑"),
RIGHT_CHANGE_UNBIND(2006, "权限变更解绑"), RIGHT_CHANGE_UNBIND(2006, "好办门店权限变更解绑"),
STORE_CHANGE_UNBIND(2007, "门店变更解绑"), STORE_CHANGE_UNBIND(2007, "GIC门店变更解绑"),
// CHANGR_RIGHT_UNBIND(2005,"审核解绑"), GIC_CLERK_DEL_UNBIND(2008, "GIC导购删除解绑"),
; ;
private int code; private int code;
private String name; private String name;
...@@ -41,6 +45,7 @@ public enum ChannelCodeEnum { ...@@ -41,6 +45,7 @@ public enum ChannelCodeEnum {
this.name = name; this.name = name;
} }
public static String getNameByCode(int code) { public static String getNameByCode(int code) {
ChannelCodeEnum[] values = ChannelCodeEnum.values(); ChannelCodeEnum[] values = ChannelCodeEnum.values();
for (ChannelCodeEnum channelCodeEnum : values) { for (ChannelCodeEnum channelCodeEnum : values) {
......
package com.gic.haoban.manage.api.service;
import com.gic.haoban.manage.api.dto.CommonMQDTO;
/**
*
* @ClassName: HaobanCommonMQApiService
* @Description: 好办通用MQ
* @author xugh
* @date 2022年7月25日 下午2:27:06
*
*/
public interface HaobanCommonMQApiService {
public void commonHandler(CommonMQDTO dto) ;
}
...@@ -72,23 +72,26 @@ public interface HmQrcodeApiService { ...@@ -72,23 +72,26 @@ public interface HmQrcodeApiService {
/** /**
* 作废 * 作废
* *
* @param hmId hm id * @param hmId hm id
* @return boolean * @param invokingType 调用类型
* @return {@link ServiceResponse }
* @author mozhu * @author mozhu
* @date 2022-07-06 13:40:27 * @date 2022-07-22 15:10:42
*/ */
ServiceResponse delById(Long hmId); ServiceResponse delById(Long hmId,Integer invokingType);
/** /**
* 导购解绑作废 * 导购解绑作废
* *
* @param clerkId * @param clerkId
* @param enterpriseId 企业标识 * @param enterpriseId 企业标识
* @return boolean * @param wxEnterpriseId wx企业标识
* @param invokingType 调用类型
* @return {@link ServiceResponse }
* @author mozhu * @author mozhu
* @date 2022-07-06 15:39:01 * @date 2022-07-22 15:14:51
*/ */
ServiceResponse delByClerkId(String clerkId,String enterpriseId,String wxEnterpriseId); ServiceResponse delByClerkId(String clerkId,String enterpriseId,String wxEnterpriseId,Integer invokingType);
/** /**
...@@ -141,7 +144,7 @@ public interface HmQrcodeApiService { ...@@ -141,7 +144,7 @@ public interface HmQrcodeApiService {
* @author mozhu * @author mozhu
* @date 2022-07-08 15:07:15 * @date 2022-07-08 15:07:15
*/ */
List<HmQrcodeStoreDTO> getHmStoreByEnterpriseId(String enterpriseId); List<HmQrcodeStoreDTO> getHmStoreByEnterpriseId(String wxEnterpriseId , String enterpriseId);
/** /**
* *
...@@ -152,7 +155,7 @@ public interface HmQrcodeApiService { ...@@ -152,7 +155,7 @@ public interface HmQrcodeApiService {
* @return * @return
* @throws * @throws
*/ */
List<String> getHmStoreForWxa(String enterpriseId) ; List<String> getHmStoreForWxa(String wxEnterpriseId ,String enterpriseId) ;
/** /**
* 根据导购信息获取hmid * 根据导购信息获取hmid
......
...@@ -186,4 +186,23 @@ public interface StaffMapper { ...@@ -186,4 +186,23 @@ public interface StaffMapper {
int updateWxUserIdsByWxOpenUserId(@Param("wxEnterpriseId") String wxEnterpriseId, int updateWxUserIdsByWxOpenUserId(@Param("wxEnterpriseId") String wxEnterpriseId,
@Param("wxOpenUseId") String wxOpenUseId, @Param("wxOpenUseId") String wxOpenUseId,
@Param("wxUserId") String wxUserId); @Param("wxUserId") String wxUserId);
/**
* 更新添加num通过id
*
* @param staffId 员工id
* @return int
* @author mozhu
* @date 2022-07-25 16:33:30
*/
int updateAddNumById(@Param("staffId") String staffId);
/**
* 重置添加num
*
* @return int
* @author mozhu
* @date 2022-07-25 16:36:07
*/
int resetAddNum();
} }
\ No newline at end of file
package com.gic.haoban.manage.service.dao.mapper; package com.gic.haoban.manage.service.dao.mapper;
import com.gic.haoban.manage.service.entity.TabHaobanWxApplication; import java.util.List;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import com.gic.haoban.manage.service.entity.TabHaobanWxApplication;
public interface WxApplicationMapper { public interface WxApplicationMapper {
int insertSelective(TabHaobanWxApplication record); int insertSelective(TabHaobanWxApplication record);
...@@ -37,4 +40,6 @@ public interface WxApplicationMapper { ...@@ -37,4 +40,6 @@ public interface WxApplicationMapper {
* @date 2022-06-30 19:19:19 * @date 2022-06-30 19:19:19
*/ */
int updateCorpidById(@Param("wxApplicationId") String wxApplicationId, @Param("corpid") String corpid); int updateCorpidById(@Param("wxApplicationId") String wxApplicationId, @Param("corpid") String corpid);
List<TabHaobanWxApplication> listApplication(@Param("wxEnterpriseId")String wxEnterpriseId) ;
} }
\ No newline at end of file
...@@ -140,5 +140,17 @@ public interface TabHaobanHmClerkRelationMapper { ...@@ -140,5 +140,17 @@ public interface TabHaobanHmClerkRelationMapper {
* @date 2022-07-21 16:32:43 * @date 2022-07-21 16:32:43
*/ */
int updateStatusById(@Param("status") Integer status, @Param("relationId") Long relationId); int updateStatusById(@Param("status") Integer status, @Param("relationId") Long relationId);
/**
* 查询需要删除的数据
*
* @param hmId hm id
* @param clerkIds 职员id
* @return {@link List }<{@link TabHaobanHmClerkRelation }>
* @author mozhu
* @date 2022-07-26 15:42:07
*/
List<TabHaobanHmClerkRelation> queryByHmIdNotInClerkIds(@Param("hmId") Long hmId,
@Param("clerkIds") List<String> clerkIds);
} }
...@@ -157,7 +157,7 @@ public interface TabHaobanHmQrcodeMapper { ...@@ -157,7 +157,7 @@ public interface TabHaobanHmQrcodeMapper {
* @author mozhu * @author mozhu
* @date 2022-07-08 15:10:57 * @date 2022-07-08 15:10:57
*/ */
List<TabHaobanHmQrcode> getHmStoreByEnterpriseId(@Param("enterpriseId") String enterpriseId); List<TabHaobanHmQrcode> getHmStoreByEnterpriseId(@Param("wxEnterpriseId")String wxEnterpriseId, @Param("enterpriseId") String enterpriseId);
/** /**
* 根据分组id获取活码数量 * 根据分组id获取活码数量
...@@ -203,7 +203,7 @@ public interface TabHaobanHmQrcodeMapper { ...@@ -203,7 +203,7 @@ public interface TabHaobanHmQrcodeMapper {
List<HmQrcodeClerkBO> listCanAddClerk(@Param("wxEnterpriseId")String wxEnterpriseId , @Param("enterpriseId")String enterpriseId , @Param("storeIdList")List<String> storeIdList); List<HmQrcodeClerkBO> listCanAddClerk(@Param("wxEnterpriseId")String wxEnterpriseId , @Param("enterpriseId")String enterpriseId , @Param("storeIdList")List<String> storeIdList);
List<String> getHmStoreForWxa(@Param("enterpriseId") String enterpriseId); List<String> getHmStoreForWxa(@Param("wxEnterpriseId")String wxEnterpriseId , @Param("enterpriseId") String enterpriseId);
List<String> listHmIdForIndex(HmQrcodeListQDTO qdto); List<String> listHmIdForIndex(HmQrcodeListQDTO qdto);
......
...@@ -48,6 +48,7 @@ public class TabHaobanStaff implements Serializable { ...@@ -48,6 +48,7 @@ public class TabHaobanStaff implements Serializable {
private String wxOpenId; private String wxOpenId;
private String qrCode; private String qrCode;
private Integer addNum;
@Transient @Transient
private String departmentIds; private String departmentIds;
...@@ -227,4 +228,12 @@ public class TabHaobanStaff implements Serializable { ...@@ -227,4 +228,12 @@ public class TabHaobanStaff implements Serializable {
public void setDepartmentIds(String departmentIds) { public void setDepartmentIds(String departmentIds) {
this.departmentIds = departmentIds; this.departmentIds = departmentIds;
} }
public Integer getAddNum() {
return addNum;
}
public void setAddNum(Integer addNum) {
this.addNum = addNum;
}
} }
\ No newline at end of file
...@@ -87,6 +87,15 @@ public class TabHaobanWxEnterprise implements Serializable { ...@@ -87,6 +87,15 @@ public class TabHaobanWxEnterprise implements Serializable {
*/ */
private Integer externalFlag; private Integer externalFlag;
private Integer useridFlag; private Integer useridFlag;
private Integer wxSecurityType ;
public Integer getWxSecurityType() {
return wxSecurityType;
}
public void setWxSecurityType(Integer wxSecurityType) {
this.wxSecurityType = wxSecurityType;
}
public String getMemberSecret() { public String getMemberSecret() {
return memberSecret; return memberSecret;
......
package com.gic.haoban.manage.service.pojo.bo.hm; package com.gic.haoban.manage.service.pojo.bo.hm;
public class HmQrcodeClerkBO { import java.io.Serializable;
public class HmQrcodeClerkBO implements Serializable {
private static final long serialVersionUID = 6292988639958194870L;
private String clerkId; private String clerkId;
private String storeId; private String storeId;
......
...@@ -11,6 +11,15 @@ public class KeyDataLinkBO implements Serializable{ ...@@ -11,6 +11,15 @@ public class KeyDataLinkBO implements Serializable{
private String unionid; private String unionid;
private Long hmId; private Long hmId;
private Long linkId; private Long linkId;
private String mobile ;
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getUnionid() { public String getUnionid() {
return unionid; return unionid;
......
...@@ -144,5 +144,22 @@ public interface StaffService { ...@@ -144,5 +144,22 @@ public interface StaffService {
int updateUserIdByUserId(String wxEnterpriseId, String newWxUserId, String oldWxUserId); int updateUserIdByUserId(String wxEnterpriseId, String newWxUserId, String oldWxUserId);
/**
* 更新添加num通过id
*
* @param staffId 员工id
* @return int
* @author mozhu
* @date 2022-07-25 16:36:38
*/
int updateAddNumById(String staffId);
/**
* 重置添加num
*
* @return int
* @author mozhu
* @date 2022-07-25 16:36:53
*/
int resetAddNum();
} }
package com.gic.haoban.manage.service.service; package com.gic.haoban.manage.service.service;
import java.util.List;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO; import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise; import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise;
import java.util.List;
public interface WxEnterpriseService { public interface WxEnterpriseService {
String add(WxEnterpriseDTO wxDTO); String add(WxEnterpriseDTO wxDTO);
WxEnterpriseDTO selectById(String wxEnterpriseId); WxEnterpriseDTO selectById(String wxEnterpriseId);
/**
*
* @Title: getQwInfo
* @Description: 获取商户企微信息
* @author xugh
* @param wxEnterpriseId
* @return
* @throws
*/
WxEnterpriseQwDTO getQwInfo(String wxEnterpriseId);
/** /**
* 通过微信企业ID查询好办企业ID * 通过微信企业ID查询好办企业ID
...@@ -18,15 +31,6 @@ public interface WxEnterpriseService { ...@@ -18,15 +31,6 @@ public interface WxEnterpriseService {
*/ */
TabHaobanWxEnterprise getEnterpriseBycorpId(String corpId); TabHaobanWxEnterprise getEnterpriseBycorpId(String corpId);
/**
* 通过微信企业ID查询删除状态好办企业ID
*
* @param corpId
* @return
*/
@Deprecated
TabHaobanWxEnterprise getDelEnterpriseBycorpId(String corpId);
void update(WxEnterpriseDTO enterpriseDTO); void update(WxEnterpriseDTO enterpriseDTO);
int delete(String wxEnterpriseId); int delete(String wxEnterpriseId);
......
...@@ -159,4 +159,15 @@ public interface HmClerkRelationService { ...@@ -159,4 +159,15 @@ public interface HmClerkRelationService {
*/ */
int updateStatusById(Integer status, Long relationId); int updateStatusById(Integer status, Long relationId);
/**
* 查询需要删除的数据
*
* @param hmId hm id
* @param clerkIds 职员id
* @return {@link List }<{@link HmClerkRelationBO }>
* @author mozhu
* @date 2022-07-26 15:38:33
*/
List<HmClerkRelationBO> queryByHmIdNotInClerkIds(Long hmId, List<String> clerkIds);
} }
...@@ -146,7 +146,7 @@ public interface HmQrcodeService { ...@@ -146,7 +146,7 @@ public interface HmQrcodeService {
* @author mozhu * @author mozhu
* @date 2022-07-08 15:09:50 * @date 2022-07-08 15:09:50
*/ */
List<HmQrcodeBO> getHmStoreByEnterpriseId(String enterpriseId); List<HmQrcodeBO> getHmStoreByEnterpriseId(String wxEnterpriseId , String enterpriseId);
/** /**
...@@ -183,7 +183,7 @@ public interface HmQrcodeService { ...@@ -183,7 +183,7 @@ public interface HmQrcodeService {
List<HmQrcodeClerkBO> listCanAddClerk(String wxEnterpriseId , String enterpriseId , String clerkId) ; List<HmQrcodeClerkBO> listCanAddClerk(String wxEnterpriseId , String enterpriseId , String clerkId) ;
List<String> getHmStoreForWxa(String enterpriseId); List<String> getHmStoreForWxa(String wxEnterpriseId ,String enterpriseId);
List<String> listHmIdForIndex(HmQrcodeListQDTO qdto); List<String> listHmIdForIndex(HmQrcodeListQDTO qdto);
......
...@@ -111,4 +111,9 @@ public class HmClerkRelationServiceImpl implements HmClerkRelationService { ...@@ -111,4 +111,9 @@ public class HmClerkRelationServiceImpl implements HmClerkRelationService {
public int updateStatusById(Integer status, Long relationId) { public int updateStatusById(Integer status, Long relationId) {
return tabHaobanHmClerkRelationMapper.updateStatusById(status,relationId); return tabHaobanHmClerkRelationMapper.updateStatusById(status,relationId);
} }
@Override
public List<HmClerkRelationBO> queryByHmIdNotInClerkIds(Long hmId, List<String> clerkIds) {
return EntityUtil.changeEntityListByOrika(HmClerkRelationBO.class,tabHaobanHmClerkRelationMapper.queryByHmIdNotInClerkIds(hmId,clerkIds));
}
} }
...@@ -117,9 +117,9 @@ public class HmQrcodeServiceImpl implements HmQrcodeService { ...@@ -117,9 +117,9 @@ public class HmQrcodeServiceImpl implements HmQrcodeService {
} }
@Override @Override
public List<HmQrcodeBO> getHmStoreByEnterpriseId(String enterpriseId) { public List<HmQrcodeBO> getHmStoreByEnterpriseId(String wxEnterpriseId,String enterpriseId) {
return EntityUtil.changeEntityListNew(HmQrcodeBO.class, return EntityUtil.changeEntityListNew(HmQrcodeBO.class,
tabHaobanHmQrcodeMapper.getHmStoreByEnterpriseId(enterpriseId)); tabHaobanHmQrcodeMapper.getHmStoreByEnterpriseId(wxEnterpriseId ,enterpriseId));
} }
@Override @Override
...@@ -171,8 +171,8 @@ public class HmQrcodeServiceImpl implements HmQrcodeService { ...@@ -171,8 +171,8 @@ public class HmQrcodeServiceImpl implements HmQrcodeService {
} }
@Override @Override
public List<String> getHmStoreForWxa(String enterpriseId) { public List<String> getHmStoreForWxa(String wxEnterpriseId ,String enterpriseId) {
return tabHaobanHmQrcodeMapper.getHmStoreForWxa(enterpriseId) ; return tabHaobanHmQrcodeMapper.getHmStoreForWxa(wxEnterpriseId , enterpriseId) ;
} }
@Override @Override
......
...@@ -82,7 +82,7 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService ...@@ -82,7 +82,7 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
staffClerkBindLogService.pushToMq(clerkRelation.getStaffId(), optStaffId, BindTypeEnum.UNBIND.getVal(), chanelCode, clerkRelation.getStaffClerkRelationId()); staffClerkBindLogService.pushToMq(clerkRelation.getStaffId(), optStaffId, BindTypeEnum.UNBIND.getVal(), chanelCode, clerkRelation.getStaffClerkRelationId());
//废弃活码 //废弃活码
hmQrcodeApiService.delByClerkId(clerkId, clerkRelation.getEnterpriseId(),clerkRelation.getWxEnterpriseId()); hmQrcodeApiService.delByClerkId(clerkId, clerkRelation.getEnterpriseId(),clerkRelation.getWxEnterpriseId(),chanelCode);
} }
return b; return b;
} }
...@@ -155,6 +155,7 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService ...@@ -155,6 +155,7 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
hmQrcodeQDTO.setPassFlag(1); hmQrcodeQDTO.setPassFlag(1);
hmQrcodeQDTO.setStoreId(dto.getStoreId()); hmQrcodeQDTO.setStoreId(dto.getStoreId());
hmQrcodeQDTO.setClerkIdList(Collections.singletonList(dto.getClerkId())); hmQrcodeQDTO.setClerkIdList(Collections.singletonList(dto.getClerkId()));
hmQrcodeQDTO.setInvokingType(chanelCode);
hmQrcodeApiService.add(hmQrcodeQDTO); hmQrcodeApiService.add(hmQrcodeQDTO);
} }
return s; return s;
......
...@@ -64,6 +64,7 @@ public class StaffServiceImpl implements StaffService { ...@@ -64,6 +64,7 @@ public class StaffServiceImpl implements StaffService {
tab.setStaffId(StringUtil.randomUUID()); tab.setStaffId(StringUtil.randomUUID());
} }
tab.setStatusFlag(1); tab.setStatusFlag(1);
tab.setAddNum(0);
mapper.insertSelective(tab); mapper.insertSelective(tab);
return tab.getStaffId(); return tab.getStaffId();
} }
...@@ -180,4 +181,14 @@ public class StaffServiceImpl implements StaffService { ...@@ -180,4 +181,14 @@ public class StaffServiceImpl implements StaffService {
public int updateUserIdByUserId(String wxEnterpriseId, String newWxUserId, String oldWxUserId) { public int updateUserIdByUserId(String wxEnterpriseId, String newWxUserId, String oldWxUserId) {
return mapper.updateUserIdByUserId(wxEnterpriseId, newWxUserId, oldWxUserId); return mapper.updateUserIdByUserId(wxEnterpriseId, newWxUserId, oldWxUserId);
} }
@Override
public int updateAddNumById(String staffId) {
return mapper.updateAddNumById(staffId);
}
@Override
public int resetAddNum() {
return mapper.resetAddNum();
}
} }
...@@ -17,8 +17,11 @@ import com.gic.commons.util.EntityUtil; ...@@ -17,8 +17,11 @@ import com.gic.commons.util.EntityUtil;
import com.gic.haoban.common.utils.DingUtils; import com.gic.haoban.common.utils.DingUtils;
import com.gic.haoban.common.utils.StringUtil; import com.gic.haoban.common.utils.StringUtil;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO; import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO;
import com.gic.haoban.manage.service.dao.mapper.WxApplicationMapper;
import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseMapper; import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseMapper;
import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseRelatedMapper; import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseRelatedMapper;
import com.gic.haoban.manage.service.entity.TabHaobanWxApplication;
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.service.WxEnterpriseService; import com.gic.haoban.manage.service.service.WxEnterpriseService;
...@@ -31,9 +34,12 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService { ...@@ -31,9 +34,12 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService {
private WxEnterpriseMapper mapper; private WxEnterpriseMapper mapper;
@Autowired @Autowired
private WxEnterpriseRelatedMapper wxEnterpriseRelatedMapper ; private WxEnterpriseRelatedMapper wxEnterpriseRelatedMapper ;
@Autowired
private WxApplicationMapper wxApplicationMapper ;
@Override @Override
public String add(WxEnterpriseDTO wxDTO) { public String add(WxEnterpriseDTO wxDTO) {
logger.info("新增wx_enterprise,dto={}",JSON.toJSONString(wxDTO));
Date now = new Date(); Date now = new Date();
wxDTO.setWxEnterpriseId(StringUtil.randomUUID()); wxDTO.setWxEnterpriseId(StringUtil.randomUUID());
wxDTO.setCreateTime(now); wxDTO.setCreateTime(now);
...@@ -52,7 +58,35 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService { ...@@ -52,7 +58,35 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService {
} }
return EntityUtil.changeEntityByJSON(WxEnterpriseDTO.class, mapper.selectByPrimaryKey(wxEnterpriseId)); return EntityUtil.changeEntityByJSON(WxEnterpriseDTO.class, mapper.selectByPrimaryKey(wxEnterpriseId));
} }
@Override
public WxEnterpriseQwDTO getQwInfo(String wxEnterpriseId) {
TabHaobanWxEnterprise wxEnterprise = this.mapper.selectByPrimaryKey(wxEnterpriseId) ;
WxEnterpriseQwDTO qw = new WxEnterpriseQwDTO();
qw.setCorpid(wxEnterprise.getCorpid());
qw.setWxEnterpriseId(wxEnterpriseId);
if(null != wxEnterprise.getWxSecurityType()) {
qw.setWxSecurityType(wxEnterprise.getWxSecurityType());
}
List<TabHaobanWxApplication> applictionList = this.wxApplicationMapper.listApplication(wxEnterpriseId) ;
if(CollectionUtils.isNotEmpty(applictionList)) {
applictionList.forEach(app->{
Integer appType = app.getApplicationType() ;
if(appType==2) {
qw.setThirdCorpid(app.getCorpid());
}else if(appType.equals(3)) {
qw.setDkCorpid(app.getCorpid());
}else if(appType.equals(4)) {
qw.setMemberCorpid(app.getCorpid());
}
});
}
qw.setSelfCorpid(wxEnterprise.getCorpid());
logger.info("企微所有corpid信息={}",JSON.toJSON(qw));
return qw;
}
@Override @Override
public TabHaobanWxEnterprise getEnterpriseBycorpId(String corpId) { public TabHaobanWxEnterprise getEnterpriseBycorpId(String corpId) {
if (StringUtils.isBlank(corpId)) { if (StringUtils.isBlank(corpId)) {
...@@ -62,11 +96,6 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService { ...@@ -62,11 +96,6 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService {
} }
@Override @Override
public TabHaobanWxEnterprise getDelEnterpriseBycorpId(String corpId) {
return mapper.getEnterpriseBycorpId(corpId, 0);
}
@Override
public void update(WxEnterpriseDTO enterpriseDTO) { public void update(WxEnterpriseDTO enterpriseDTO) {
enterpriseDTO.setUpdateTime(new Date()); enterpriseDTO.setUpdateTime(new Date());
mapper.updateByPrimaryKeySelective(EntityUtil.changeEntityByJSON(TabHaobanWxEnterprise.class, enterpriseDTO)); mapper.updateByPrimaryKeySelective(EntityUtil.changeEntityByJSON(TabHaobanWxEnterprise.class, enterpriseDTO));
......
package com.gic.haoban.manage.service.service.out.impl;
import org.springframework.stereotype.Service;
import com.gic.haoban.manage.api.dto.CommonMQDTO;
import com.gic.haoban.manage.api.service.HaobanCommonMQApiService;
@Service("haobanCommonMQApiService")
public class HaobanCommonMQApiServiceImpl implements HaobanCommonMQApiService {
@Override
public void commonHandler(CommonMQDTO dto) {
}
}
...@@ -65,13 +65,13 @@ import com.gic.haoban.manage.service.util.EmojiFilterUtil; ...@@ -65,13 +65,13 @@ 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.MemberApiService; import com.gic.member.api.service.MemberApiService;
import com.gic.member.api.service.MemberOpenCardBusinessService; import com.gic.member.api.service.MemberOpenCardBusinessService;
import com.gic.member.api.service.MemberService;
import com.gic.member.api.service.MemberStoreService; import com.gic.member.api.service.MemberStoreService;
import com.gic.member.tag.api.dto.outapi.MemberTagSingleDTO; import com.gic.member.tag.api.dto.outapi.MemberTagSingleDTO;
import com.gic.member.tag.api.service.MemberTagOpenApiService; import com.gic.member.tag.api.service.MemberTagOpenApiService;
import com.gic.mq.sdk.GicMQClient; import com.gic.mq.sdk.GicMQClient;
import com.gic.redis.data.util.RedisUtil; import com.gic.redis.data.util.RedisUtil;
import com.gic.wechat.api.dto.qywx.*; import com.gic.wechat.api.dto.qywx.*;
import com.gic.wechat.api.dto.qywx.response.QywxResponseDTO;
import com.gic.wechat.api.dto.qywx.welcome.*; import com.gic.wechat.api.dto.qywx.welcome.*;
import com.gic.wechat.api.enums.QywxMediaTypeEnum; import com.gic.wechat.api.enums.QywxMediaTypeEnum;
import com.gic.wechat.api.service.qywx.QywxSuiteApiService; import com.gic.wechat.api.service.qywx.QywxSuiteApiService;
...@@ -168,6 +168,8 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -168,6 +168,8 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
private MemberTagOpenApiService memberTagOpenApiService; private MemberTagOpenApiService memberTagOpenApiService;
@Autowired @Autowired
private HmLinkService hmLinkService; private HmLinkService hmLinkService;
@Autowired
private MemberService memberService;
@Override @Override
public void dealQywxExternalUser(String params) { public void dealQywxExternalUser(String params) {
...@@ -320,6 +322,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -320,6 +322,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
String unionid = dto.getUnionid(); String unionid = dto.getUnionid();
String state = dto.getState(); String state = dto.getState();
boolean isHmUnionid = false; boolean isHmUnionid = false;
String mobile = "";
log.info("新增外部联系人,wxEnterpriseId:{}", wxEnterpriseId); log.info("新增外部联系人,wxEnterpriseId:{}", wxEnterpriseId);
if (StringUtils.isAnyBlank(wxUserId, wxEnterpriseId, name, createTime, externalUserId)) { if (StringUtils.isAnyBlank(wxUserId, wxEnterpriseId, name, createTime, externalUserId)) {
log.error("新增外部联系人,缺少必须字段:wxUserId:{},wxEnterpriseId:{},name:{},createTime:{},externalUserId:{}", wxUserId, wxEnterpriseId, name, createTime, externalUserId); log.error("新增外部联系人,缺少必须字段:wxUserId:{},wxEnterpriseId:{},name:{},createTime:{},externalUserId:{}", wxUserId, wxEnterpriseId, name, createTime, externalUserId);
...@@ -347,17 +350,18 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -347,17 +350,18 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
String memberLabelId = ""; String memberLabelId = "";
if (StringUtils.isNotBlank(state)) { if (StringUtils.isNotBlank(state)) {
String id = state.substring(2); String id = state.substring(2);
Long hmId = null;
HmQrcodeDTO hmQrcodeDTO = null;
if (state.contains(Manage3Constants.HM)) { if (state.contains(Manage3Constants.HM)) {
Long hmId = Convert.toLong(id); hmId = Convert.toLong(id);
log.info("普通活码={}", hmId); log.info("普通活码={}", hmId);
HmQrcodeDTO hmQrcodeDTO = hmQrcodeApiService.getSimpleById(hmId); hmQrcodeDTO = hmQrcodeApiService.getSimpleById(hmId);
if (hmQrcodeDTO == null) { if (hmQrcodeDTO == null) {
log.error("活码为空:{}", hmId); log.error("活码为空:{}", hmId);
return; return;
} }
memberLabelId = hmQrcodeDTO.getMemberLabelId(); memberLabelId = hmQrcodeDTO.getMemberLabelId();
wxUserAddLogQDTO.setHmId(hmId); wxUserAddLogQDTO.setHmId(hmId);
hmQrcodeApiService.updateAddNumById(hmId, hmQrcodeDTO.getClerkId());
//处理活码导购 //处理活码导购
if (hmQrcodeDTO.getHmType() == 1) { if (hmQrcodeDTO.getHmType() == 1) {
staffClerkRelationDTO = staffClerkRelationService.getBindByClerkId(hmQrcodeDTO.getClerkId(), wxEnterpriseId); staffClerkRelationDTO = staffClerkRelationService.getBindByClerkId(hmQrcodeDTO.getClerkId(), wxEnterpriseId);
...@@ -382,13 +386,14 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -382,13 +386,14 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
} else if (state.contains(Manage3Constants.DT)) { } else if (state.contains(Manage3Constants.DT)) {
KeyDataLinkBO dataForHmLink = keyDataService.getDataForHmLink(id); KeyDataLinkBO dataForHmLink = keyDataService.getDataForHmLink(id);
Long linkId = dataForHmLink.getLinkId(); Long linkId = dataForHmLink.getLinkId();
Long hmId = dataForHmLink.getHmId(); hmId = dataForHmLink.getHmId();
mobile = dataForHmLink.getMobile();
unionid = dataForHmLink.getUnionid(); unionid = dataForHmLink.getUnionid();
log.info("动态活码hmId={},linkId={},unionid={}", hmId, linkId, unionid); log.info("动态活码hmId={},linkId={},unionid={}", hmId, linkId, unionid);
isHmUnionid = true; isHmUnionid = true;
wxUserAddLogQDTO.setLinkId(linkId); wxUserAddLogQDTO.setLinkId(linkId);
wxUserAddLogQDTO.setHmId(hmId); wxUserAddLogQDTO.setHmId(hmId);
HmQrcodeDTO hmQrcodeDTO = hmQrcodeApiService.getSimpleById(hmId); hmQrcodeDTO = hmQrcodeApiService.getSimpleById(hmId);
if (hmQrcodeDTO == null) { if (hmQrcodeDTO == null) {
log.error("活码动态为空,hmId:{}", hmId); log.error("活码动态为空,hmId:{}", hmId);
return; return;
...@@ -399,6 +404,10 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -399,6 +404,10 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
memberLabelId = hmLinkBO.getMemberLabelId(); memberLabelId = hmLinkBO.getMemberLabelId();
} }
} }
if (hmId != null && hmQrcodeDTO != null) {
log.info("计算活码的上限和加好友数量:{}", hmId);
hmQrcodeApiService.updateAddNumById(hmId, hmQrcodeDTO.getClerkId());
}
} else { } else {
TabHaobanClerkMainStoreRelated mainStoreRelated = clerkMainStoreRelatedService.getMainStoreByStaffId(staffId, wxEnterpriseId); TabHaobanClerkMainStoreRelated mainStoreRelated = clerkMainStoreRelatedService.getMainStoreByStaffId(staffId, wxEnterpriseId);
if (mainStoreRelated == null) { if (mainStoreRelated == null) {
...@@ -424,7 +433,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -424,7 +433,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
if (StringUtils.isNotBlank(unionid)) { if (StringUtils.isNotBlank(unionid)) {
log.info("有unionid处理:wxEnterpriseId:{},unionid:{}", wxEnterpriseId, unionid); log.info("有unionid处理:wxEnterpriseId:{},unionid:{}", wxEnterpriseId, unionid);
dto.setUnionid(unionid); dto.setUnionid(unionid);
memberId = addExternalClerkRelated(dto, staffId, staffClerkRelationDTO, wxEnterpriseRelated, isHmUnionid); memberId = addExternalClerkRelated(dto, staffId, staffClerkRelationDTO, wxEnterpriseRelated, isHmUnionid, mobile);
} else { } else {
log.info("发送欢迎语逻辑:wxEnterpriseId:{}", wxEnterpriseId); log.info("发送欢迎语逻辑:wxEnterpriseId:{}", wxEnterpriseId);
addFriendByWelcome(dto, staffClerkRelationDTO); addFriendByWelcome(dto, staffClerkRelationDTO);
...@@ -435,6 +444,8 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -435,6 +444,8 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
setMemberTag(staffClerkRelationDTO, memberLabelId, memberId); setMemberTag(staffClerkRelationDTO, memberLabelId, memberId);
} }
//加好友增加数量
staffService.updateAddNumById(staffId);
log.info("插入加好友日志"); log.info("插入加好友日志");
wxUserAddLogQDTO.setWxEnterpriseId(wxEnterpriseId); wxUserAddLogQDTO.setWxEnterpriseId(wxEnterpriseId);
wxUserAddLogQDTO.setEnterpriseId(enterpriseId); wxUserAddLogQDTO.setEnterpriseId(enterpriseId);
...@@ -456,7 +467,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -456,7 +467,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
* @param memberId * @param memberId
*/ */
private void setMemberTag(StaffClerkRelationDTO staffClerkRelationDTO, String memberLabelId, String memberId) { private void setMemberTag(StaffClerkRelationDTO staffClerkRelationDTO, String memberLabelId, String memberId) {
log.info("会员打标签,memberLabelId:{},memberId:{}",memberLabelId,memberId); log.info("会员打标签,memberLabelId:{},memberId:{}", memberLabelId, memberId);
if (StringUtils.isNotBlank(memberLabelId)) { if (StringUtils.isNotBlank(memberLabelId)) {
MemberTagSingleDTO tagSingleDTO = new MemberTagSingleDTO(); MemberTagSingleDTO tagSingleDTO = new MemberTagSingleDTO();
tagSingleDTO.setEnterpriseId(staffClerkRelationDTO.getEnterpriseId()); tagSingleDTO.setEnterpriseId(staffClerkRelationDTO.getEnterpriseId());
...@@ -475,7 +486,8 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -475,7 +486,8 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
* @param staffClerkRelationDTO * @param staffClerkRelationDTO
* @param wxEnterpriseRelated * @param wxEnterpriseRelated
*/ */
private String addExternalClerkRelated(MemberUnionidRelatedDTO dto, String staffId, StaffClerkRelationDTO staffClerkRelationDTO, TabHaobanWxEnterpriseRelated wxEnterpriseRelated, boolean isHmUnionid) { private String addExternalClerkRelated(MemberUnionidRelatedDTO dto, String staffId, StaffClerkRelationDTO staffClerkRelationDTO,
TabHaobanWxEnterpriseRelated wxEnterpriseRelated, boolean isHmUnionid, String mobile) {
String wxUserId = dto.getWxUserId(); String wxUserId = dto.getWxUserId();
String wxEnterpriseId = dto.getWxEnterpriseId(); String wxEnterpriseId = dto.getWxEnterpriseId();
String name = dto.getExternalName(); String name = dto.getExternalName();
...@@ -516,12 +528,25 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -516,12 +528,25 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
log.info("不能生产导购二维码:{}", JSONObject.toJSONString(clerk)); log.info("不能生产导购二维码:{}", JSONObject.toJSONString(clerk));
return ""; return "";
} }
log.info("【新增外部联系人会员】enterpriseId={},unionId={},name={},avatar={},QrcodeParam={}", enterpriseId, unionId, name, avatar, qrcodeParam);
MemberDTO member = memberOpenCardBusinessService.getMemberByQywxChannelParam(enterpriseId, unionId, "", name, avatar, qrcodeParam); MemberDTO member = null;
if (isHmUnionid) {
log.info("根据手机号查询会员:{},{}", enterpriseId, mobile);
if (StringUtils.isNotBlank(mobile)) {
member = memberService.getMemberByPhone(enterpriseId, mobile);
}
}
if (member == null) {
log.info("【新增外部联系人会员】enterpriseId={},unionId={},name={},avatar={},QrcodeParam={}", enterpriseId, unionId, name, avatar, qrcodeParam);
member = memberOpenCardBusinessService.getMemberByQywxChannelParam(enterpriseId, unionId, "", name, avatar, qrcodeParam);
}
if (member == null) { if (member == null) {
log.info("生产会员memnerid失败:{}", unionId); log.info("生产会员memberid失败:{}", unionId);
return ""; return "";
} }
String memberId = member.getMemberId(); String memberId = member.getMemberId();
List<TabHaobanExternalClerkRelated> externalClerkRelateds = externalClerkRelatedService.listByExTernalUseridAndWxUserIdAllStatus(wxEnterpriseId, externalUserid, dto.getWxUserId()); List<TabHaobanExternalClerkRelated> externalClerkRelateds = externalClerkRelatedService.listByExTernalUseridAndWxUserIdAllStatus(wxEnterpriseId, externalUserid, dto.getWxUserId());
String relationKey = SecureUtil.md5(staffId + externalUserid); String relationKey = SecureUtil.md5(staffId + externalUserid);
...@@ -658,10 +683,6 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -658,10 +683,6 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
log.info("特殊欢迎语 state:{}", state); log.info("特殊欢迎语 state:{}", state);
WelcomeReferBO welcomeReferBo = getWelcomeReferBo(state); WelcomeReferBO welcomeReferBo = getWelcomeReferBo(state);
welcomeDetailBO = welcomeService.getMatchWelcomeWithReferId(staffId, wxEnterpriseId, welcomeReferBo); welcomeDetailBO = welcomeService.getMatchWelcomeWithReferId(staffId, wxEnterpriseId, welcomeReferBo);
//结束临时会话模式
log.info("结束临时会话模式:userid:{},externalUserid:{}", dto.getWxUserId(), dto.getExternalUserid());
QywxResponseDTO qywxResponseDTO = qywxUserApiService.closeTempChat(corpid, config.getWxSuiteid(), dto.getWxUserId(), dto.getExternalUserid());
log.info("结束临时会话返回结果:{}", JSON.toJSONString(qywxResponseDTO));
} else { } else {
welcomeDetailBO = welcomeService.getMatchWelcome(staffId, wxEnterpriseId); welcomeDetailBO = welcomeService.getMatchWelcome(staffId, wxEnterpriseId);
} }
......
...@@ -317,19 +317,19 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -317,19 +317,19 @@ public class StaffApiServiceImpl implements StaffApiService {
res.setCode(4); res.setCode(4);
return res; return res;
} }
String staffThirdWxEnterpriseId = config.getStaffThirdWxEnterpriseId();
UserDTO user = null; UserDTO user = null;
if (staffThirdWxEnterpriseId.contains(corpid)) { WxEnterpriseQwDTO wxInfo = this.wxEnterpriseService.getQwInfo(wxEnterpriseId) ;
if(wxInfo.getWxSecurityType()==4) {
user = qywxUserApiService.getWorkWxUser(corpid, config.getWxSuiteid(), userId); user = qywxUserApiService.getWorkWxUser(corpid, config.getWxSuiteid(), userId);
UserDTO userSelf = qywxUserApiService.getSelfWorkWxUser(corpid, secretSetting.getSecretVal(), user.getOpen_userid()); logger.info("成员详情(第三方)={}",JSON.toJSONString(user)) ;
UserDTO userSelf = qywxUserApiService.getSelfWorkWxUser(wxInfo.getDkCorpid(), secretSetting.getSecretVal(), user.getOpen_userid());
if (user != null && userSelf != null) { if (user != null && userSelf != null) {
user.setName(userSelf.getName()); user.setName(userSelf.getName());
} }
} else { } else {
user = qywxUserApiService.getSelfWorkWxUser(corpid, secretSetting.getSecretVal(), userId); user = qywxUserApiService.getSelfWorkWxUser(corpid, secretSetting.getSecretVal(), userId);
logger.info("成员详情(代开)={}",JSON.toJSONString(user)) ;
} }
if (null == user) { if (null == user) {
logger.info("企业微信用户不存在:{}:{}", wxEnterpriseId, userId); logger.info("企业微信用户不存在:{}:{}", wxEnterpriseId, userId);
res.setMessage("企业微信用户不存在"); res.setMessage("企业微信用户不存在");
......
...@@ -238,7 +238,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -238,7 +238,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
//删除绑定关系 //删除绑定关系
tabHaobanStaffClerkRelationMapper.delByStoreIdAndCode(storeId, clerkCode); tabHaobanStaffClerkRelationMapper.delByStoreIdAndCode(storeId, clerkCode);
//删除主门店 //删除主门店
delSetMainStore(staffClerkRelation); delSetMainStore(staffClerkRelation,ChannelCodeEnum.SELF_UNBIND.getCode());
} }
@Override @Override
...@@ -305,7 +305,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -305,7 +305,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
public void delByClerkId(String clerkId) { public void delByClerkId(String clerkId) {
TabHaobanStaffClerkRelation staffClerkRelation = tabHaobanStaffClerkRelationMapper.getOneByClerkId(clerkId); TabHaobanStaffClerkRelation staffClerkRelation = tabHaobanStaffClerkRelationMapper.getOneByClerkId(clerkId);
tabHaobanStaffClerkRelationMapper.delByClerkId(clerkId); tabHaobanStaffClerkRelationMapper.delByClerkId(clerkId);
delSetMainStore(staffClerkRelation); delSetMainStore(staffClerkRelation,ChannelCodeEnum.AUDIT_UNBIND.getCode());
} }
@Override @Override
...@@ -387,7 +387,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -387,7 +387,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
staffClerkBindLogService.pushToMq(staffId, optStaffId, optType, channelCode, relationId); staffClerkBindLogService.pushToMq(staffId, optStaffId, optType, channelCode, relationId);
} }
private void delSetMainStore(TabHaobanStaffClerkRelation staffClerkRelation) { private void delSetMainStore(TabHaobanStaffClerkRelation staffClerkRelation,Integer channelCode) {
if (staffClerkRelation == null) { if (staffClerkRelation == null) {
logger.info("staffClerkRelation为空"); logger.info("staffClerkRelation为空");
return; return;
...@@ -399,7 +399,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -399,7 +399,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
//删除主门店 //删除主门店
clerkMainStoreRelatedService.delMainStore(staffId, staffClerkRelation.getStoreId(), wxEnterpriseId); clerkMainStoreRelatedService.delMainStore(staffId, staffClerkRelation.getStoreId(), wxEnterpriseId);
//废弃活码 //废弃活码
hmQrcodeApiService.delByClerkId(clerkId,staffClerkRelation.getEnterpriseId(),wxEnterpriseId); hmQrcodeApiService.delByClerkId(clerkId,staffClerkRelation.getEnterpriseId(),wxEnterpriseId,channelCode);
} }
@Override @Override
...@@ -495,7 +495,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -495,7 +495,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
//导购删除解绑 //导购删除解绑
if (!clerkDTO.getStatus().equals(1)) { if (!clerkDTO.getStatus().equals(1)) {
//解绑 //解绑
staffClerkRelationService.delBind(clerkId, "-1", ChannelCodeEnum.SYNC_UNBIND.getCode()); staffClerkRelationService.delBind(clerkId, "-1", ChannelCodeEnum.GIC_CLERK_DEL_UNBIND.getCode());
} }
} else if (type == 2) { } else if (type == 2) {
//门店转移、重新绑定 //门店转移、重新绑定
......
...@@ -34,7 +34,6 @@ import com.gic.haoban.manage.api.dto.WelcomeDTO; ...@@ -34,7 +34,6 @@ import com.gic.haoban.manage.api.dto.WelcomeDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO; import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.dto.YwWxEnterpriseDTO; import com.gic.haoban.manage.api.dto.YwWxEnterpriseDTO;
import com.gic.haoban.manage.api.enums.SecretTypeEnum; import com.gic.haoban.manage.api.enums.SecretTypeEnum;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseApiService; import com.gic.haoban.manage.api.service.WxEnterpriseApiService;
import com.gic.haoban.manage.service.config.Config; import com.gic.haoban.manage.service.config.Config;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanWelcomeMapper; import com.gic.haoban.manage.service.dao.mapper.TabHaobanWelcomeMapper;
...@@ -60,8 +59,6 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService { ...@@ -60,8 +59,6 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
@Autowired @Autowired
private WxEnterpriseService wxEnterpriseService; private WxEnterpriseService wxEnterpriseService;
@Autowired @Autowired
private StaffApiService staffApiService;
@Autowired
private WxEnterpriseMapper wxEnterpriseMapper; private WxEnterpriseMapper wxEnterpriseMapper;
@Autowired @Autowired
private WxApplicationService wxApplicationService; private WxApplicationService wxApplicationService;
...@@ -92,7 +89,6 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService { ...@@ -92,7 +89,6 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
String agentName = dto.getAgentName(); String agentName = dto.getAgentName();
String permanentCode = dto.getPermanentCode(); String permanentCode = dto.getPermanentCode();
String applicationName = dto.getName(); String applicationName = dto.getName();
String userId = dto.getUserid();
Integer isCustomizedApp = dto.getIsCustomizedApp(); Integer isCustomizedApp = dto.getIsCustomizedApp();
String qywxMemberSuite = config.getQywxMemberSuite(); String qywxMemberSuite = config.getQywxMemberSuite();
WxEnterpriseDTO wxDTO = EntityUtil.changeEntityByJSON(WxEnterpriseDTO.class, dto); WxEnterpriseDTO wxDTO = EntityUtil.changeEntityByJSON(WxEnterpriseDTO.class, dto);
...@@ -101,6 +97,7 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService { ...@@ -101,6 +97,7 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
// 获取授权好办小程序 // 获取授权好办小程序
wxEnterprise = this.wxEnterpriseService.getEnterpriseBycorpId(corpid); wxEnterprise = this.wxEnterpriseService.getEnterpriseBycorpId(corpid);
if (wxEnterprise == null) { if (wxEnterprise == null) {
log.info("通过corpid={}未查到记录",corpid);
wxEnterprise = this.wxEnterpriseService.getEnterpriseByCorpName(corpName); wxEnterprise = this.wxEnterpriseService.getEnterpriseByCorpName(corpName);
} }
...@@ -110,16 +107,19 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService { ...@@ -110,16 +107,19 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
wxEnterpriseDTO.setWxEnterpriseId(wxEnterpriseId); wxEnterpriseDTO.setWxEnterpriseId(wxEnterpriseId);
wxEnterpriseDTO.setStatusFlag(1); wxEnterpriseDTO.setStatusFlag(1);
wxEnterpriseDTO.setBindFlag(1); wxEnterpriseDTO.setBindFlag(1);
wxEnterpriseService.update(wxDTO); // 如果corpid为空且是好办小程序,写入corpid
wxEnterpriseService.update(wxEnterpriseDTO);
} else { } else {
// 如果不是好办,不需要写入corpid
wxEnterpriseId = wxEnterpriseService.add(wxDTO); wxEnterpriseId = wxEnterpriseService.add(wxDTO);
} }
if (StringUtils.isNotBlank(userId)) { /*if (StringUtils.isNotBlank(userId)) {
staffApiService.wxGetAdd(userId, wxEnterpriseId); staffApiService.wxGetAdd(userId, wxEnterpriseId);
} }*/
TabHaobanWxApplication haobanWxApplication = wxApplicationService.selectBySiteIdAndWxEnterpriseId(siteId, TabHaobanWxApplication haobanWxApplication = wxApplicationService.selectBySiteIdAndWxEnterpriseId(siteId,
wxEnterpriseId); wxEnterpriseId);
if (haobanWxApplication == null) { if (haobanWxApplication == null) {
log.info("新增应用,suiteid={}",siteId);
haobanWxApplication = new TabHaobanWxApplication(); haobanWxApplication = new TabHaobanWxApplication();
haobanWxApplication.setAgentId(agentId); haobanWxApplication.setAgentId(agentId);
haobanWxApplication.setCorpid(corpid); haobanWxApplication.setCorpid(corpid);
......
...@@ -3,7 +3,6 @@ package com.gic.haoban.manage.service.service.out.impl; ...@@ -3,7 +3,6 @@ package com.gic.haoban.manage.service.service.out.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.clerk.api.dto.ClerkDTO; import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.service.ClerkService; import com.gic.clerk.api.service.ClerkService;
import com.gic.clerk.api.service.RightService; import com.gic.clerk.api.service.RightService;
...@@ -16,16 +15,19 @@ import com.gic.enterprise.api.service.EnterpriseService; ...@@ -16,16 +15,19 @@ import com.gic.enterprise.api.service.EnterpriseService;
import com.gic.enterprise.api.service.StoreGroupService; import com.gic.enterprise.api.service.StoreGroupService;
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.BasePageInfo;
import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.base.api.common.errCode.HaoBanErrCodeCommon; import com.gic.haoban.base.api.common.errCode.HaoBanErrCodeCommon;
import com.gic.haoban.common.utils.PageUtil; import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.common.utils.UuidUtil; import com.gic.haoban.common.utils.UuidUtil;
import com.gic.haoban.manage.api.dto.*; import com.gic.haoban.manage.api.dto.*;
import com.gic.haoban.manage.api.enums.ChannelCodeEnum; import com.gic.haoban.manage.api.enums.ChannelCodeEnum;
import com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService; import com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService;
import com.gic.haoban.manage.service.dao.mapper.StaffMapper;
import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseRelatedMapper; import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseRelatedMapper;
import com.gic.haoban.manage.service.entity.*; import com.gic.haoban.manage.service.entity.*;
import com.gic.haoban.manage.service.service.*; import com.gic.haoban.manage.service.service.DepartmentService;
import com.gic.haoban.manage.service.service.MiniprogramSettingService;
import com.gic.haoban.manage.service.service.StoreRangeService;
import com.gic.haoban.manage.service.service.WxEnterpriseRelatedService;
import com.gic.mq.sdk.GicMQClient; import com.gic.mq.sdk.GicMQClient;
import com.gic.redis.data.util.RedisUtil; import com.gic.redis.data.util.RedisUtil;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
...@@ -58,14 +60,10 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi ...@@ -58,14 +60,10 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi
@Autowired @Autowired
private DepartmentService departmentService; private DepartmentService departmentService;
@Autowired @Autowired
private StaffService staffService;
@Autowired
private MiniprogramSettingService miniprogramSettingService; private MiniprogramSettingService miniprogramSettingService;
@Autowired @Autowired
private AuthorizeService authorizeService; private AuthorizeService authorizeService;
@Autowired @Autowired
private StaffMapper staffMapper;
@Autowired
private EnterpriseService enterpriseService; private EnterpriseService enterpriseService;
@Autowired @Autowired
private StoreRangeService storeRangeService; private StoreRangeService storeRangeService;
...@@ -74,7 +72,7 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi ...@@ -74,7 +72,7 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi
@Autowired @Autowired
private RightService rightService; private RightService rightService;
@Autowired @Autowired
private ClerkService clerkService ; private ClerkService clerkService;
/** /**
* 查询好办所有的企业id * 查询好办所有的企业id
...@@ -88,36 +86,36 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi ...@@ -88,36 +86,36 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi
@Override @Override
public List<EnterpriseDetailDTO> listEnterpriseByWxEnterpriseId(String wxEnterpriseId) { public List<EnterpriseDetailDTO> listEnterpriseByWxEnterpriseId(String wxEnterpriseId) {
return this.listEnterpriseByWxEnterpriseId(wxEnterpriseId, null,false) ; return this.listEnterpriseByWxEnterpriseId(wxEnterpriseId, null, false);
} }
@Override @Override
public EnterpriseDetailDTO getByEnterpriseId(String wxEnterpriseId, String enterpriseId) { public EnterpriseDetailDTO getByEnterpriseId(String wxEnterpriseId, String enterpriseId) {
TabHaobanWxEnterpriseRelated entity = wxEnterpriseRelatedService.getByEnterpriseId(wxEnterpriseId, enterpriseId); TabHaobanWxEnterpriseRelated entity = wxEnterpriseRelatedService.getByEnterpriseId(wxEnterpriseId, enterpriseId);
EnterpriseDetailDTO dto = EntityUtil.changeEntityByJSON(EnterpriseDetailDTO.class, entity); EnterpriseDetailDTO dto = EntityUtil.changeEntityByJSON(EnterpriseDetailDTO.class, entity);
return dto ; return dto;
} }
@Override @Override
public List<EnterpriseDetailDTO> listEnterpriseByWxEnterpriseIdList(List<String> wxEnterpriseIdList) { public List<EnterpriseDetailDTO> listEnterpriseByWxEnterpriseIdList(List<String> wxEnterpriseIdList) {
List<TabHaobanWxEnterpriseRelated> relatedList = this.wxEnterpriseRelatedMapper.listByWxenterpriseIdList(wxEnterpriseIdList) ; List<TabHaobanWxEnterpriseRelated> relatedList = this.wxEnterpriseRelatedMapper.listByWxenterpriseIdList(wxEnterpriseIdList);
if(CollectionUtils.isNotEmpty(relatedList)) { if (CollectionUtils.isNotEmpty(relatedList)) {
List<EnterpriseDetailDTO> list = EntityUtil.changeEntityListByJSON(EnterpriseDetailDTO.class, relatedList); List<EnterpriseDetailDTO> list = EntityUtil.changeEntityListByJSON(EnterpriseDetailDTO.class, relatedList);
for(EnterpriseDetailDTO item : list) { for (EnterpriseDetailDTO item : list) {
String enterpriseId = item.getEnterpriseId() ; String enterpriseId = item.getEnterpriseId();
EnterpriseDTO en = this.enterpriseService.getEnterpriseById(enterpriseId) ; EnterpriseDTO en = this.enterpriseService.getEnterpriseById(enterpriseId);
if(null != en) { if (null != en) {
item.setEnterpriseName(en.getBrandName()); item.setEnterpriseName(en.getBrandName());
} }
} }
return list ; return list;
} }
return null; return null;
} }
@Override @Override
public List<EnterpriseDetailDTO> listEnterpriseByWxEnterpriseId(String wxEnterpriseId, String phoneNumber,boolean filterFlag) { public List<EnterpriseDetailDTO> listEnterpriseByWxEnterpriseId(String wxEnterpriseId, String phoneNumber, boolean filterFlag) {
logger.info("listEnterpriseByWxEnterpriseId,wxeid={},phone={}",wxEnterpriseId,phoneNumber); logger.info("listEnterpriseByWxEnterpriseId,wxeid={},phone={}", wxEnterpriseId, phoneNumber);
List<TabHaobanWxEnterpriseRelated> relatedList = wxEnterpriseRelatedMapper.listByWxenterpriseId(wxEnterpriseId); List<TabHaobanWxEnterpriseRelated> relatedList = wxEnterpriseRelatedMapper.listByWxenterpriseId(wxEnterpriseId);
List<EnterpriseDetailDTO> list = EntityUtil.changeEntityListByJSON(EnterpriseDetailDTO.class, relatedList); List<EnterpriseDetailDTO> list = EntityUtil.changeEntityListByJSON(EnterpriseDetailDTO.class, relatedList);
if (CollectionUtils.isEmpty(list)) { if (CollectionUtils.isEmpty(list)) {
...@@ -126,9 +124,9 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi ...@@ -126,9 +124,9 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi
List<String> enterpriseIds = list.stream().map(s -> s.getEnterpriseId()).collect(Collectors.toList()); List<String> enterpriseIds = list.stream().map(s -> s.getEnterpriseId()).collect(Collectors.toList());
List<EnterpriseDTO> enterpriseList = enterpriseService.listEnterpriseByIds(enterpriseIds); List<EnterpriseDTO> enterpriseList = enterpriseService.listEnterpriseByIds(enterpriseIds);
Map<String, EnterpriseDTO> map = com.gic.commons.util.CollectionUtil.toMap(enterpriseList, "enterpriseId"); Map<String, EnterpriseDTO> map = com.gic.commons.util.CollectionUtil.toMap(enterpriseList, "enterpriseId");
Iterator<EnterpriseDetailDTO> it = list.iterator() ; Iterator<EnterpriseDetailDTO> it = list.iterator();
while(it.hasNext()) { while (it.hasNext()) {
EnterpriseDetailDTO dto = it.next() ; EnterpriseDetailDTO dto = it.next();
EnterpriseDTO enterpriseDTO = map.get(dto.getEnterpriseId()); EnterpriseDTO enterpriseDTO = map.get(dto.getEnterpriseId());
if (enterpriseDTO != null) { if (enterpriseDTO != null) {
dto.setEnterpriseName(enterpriseDTO.getEnterpriseName()); dto.setEnterpriseName(enterpriseDTO.getEnterpriseName());
...@@ -137,12 +135,12 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi ...@@ -137,12 +135,12 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi
dto.setConactsPhone(enterpriseDTO.getConactsPhone()); dto.setConactsPhone(enterpriseDTO.getConactsPhone());
dto.setCustomerPhone(enterpriseDTO.getCustomerPhone()); dto.setCustomerPhone(enterpriseDTO.getCustomerPhone());
dto.setAclFlag(1); dto.setAclFlag(1);
if(StringUtils.isNotBlank(phoneNumber)) { if (StringUtils.isNotBlank(phoneNumber)) {
com.gic.api.base.commons.ServiceResponse<Boolean> resp = this.rightService.hasHaobanAcl(enterpriseDTO.getEnterpriseId(), phoneNumber) ; com.gic.api.base.commons.ServiceResponse<Boolean> resp = this.rightService.hasHaobanAcl(enterpriseDTO.getEnterpriseId(), phoneNumber);
if(!resp.getResult()) { if (!resp.getResult()) {
dto.setAclFlag(0); dto.setAclFlag(0);
if(filterFlag) { if (filterFlag) {
it.remove(); it.remove();
} }
} }
} }
...@@ -215,20 +213,28 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi ...@@ -215,20 +213,28 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi
resp.setMessage("总部已经被设置不能存在多个总部!"); resp.setMessage("总部已经被设置不能存在多个总部!");
return resp; return resp;
} }
String enterpriseId = detailDTO.getEnterpriseId();
String wxEnterpriseId = detailDTO.getWxEnterpriseId();
//校验关联已经企业绑定 //校验关联已经企业绑定
TabHaobanWxEnterpriseRelated tab = wxEnterpriseRelatedMapper.findOneByEIdAndWxEid(detailDTO.getEnterpriseId(), detailDTO.getWxEnterpriseId()); TabHaobanWxEnterpriseRelated tab = wxEnterpriseRelatedMapper.findOneByEIdAndWxEid(enterpriseId, wxEnterpriseId);
if (tab != null && (!tab.getWxEnterpriseRelatedId().equals(detailDTO.getWxEnterpriseRelatedId()))) { if (tab != null && (!tab.getWxEnterpriseRelatedId().equals(detailDTO.getWxEnterpriseRelatedId()))) {
logger.info("该企业已经被绑定过"); logger.info("该企业已经被绑定过");
resp.setCode(2); resp.setCode(2);
resp.setMessage("该企业已经被绑定过!"); resp.setMessage("该企业已经被绑定过!");
return resp; return resp;
} }
EnterpriseDTO enterpriseDTO = enterpriseService.getEnterpriseById(enterpriseId);
if (enterpriseDTO == null) {
logger.info("该企业为空:{}", enterpriseId);
resp.setCode(2);
resp.setMessage("该企业为空");
return resp;
}
if (tab == null) { if (tab == null) {
logger.info("该gicEnterpriseId已经绑定过了:{}", JSONObject.toJSONString(detailDTO)); logger.info("该gicEnterpriseId已经绑定过了:{}", JSONObject.toJSONString(detailDTO));
//保存企业关联关系 //保存企业关联关系
tab = EntityUtil.changeEntityNew(TabHaobanWxEnterpriseRelated.class, detailDTO); tab = EntityUtil.changeEntityNew(TabHaobanWxEnterpriseRelated.class, detailDTO);
tab.setEnterpriseName(enterpriseDTO.getEnterpriseName());
tab.setStatusFlag(1); tab.setStatusFlag(1);
tab.setRangeType(1); tab.setRangeType(1);
tab.setVersion("3.0"); tab.setVersion("3.0");
...@@ -245,18 +251,9 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi ...@@ -245,18 +251,9 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi
} }
//保存门店范围 //保存门店范围
storeRangeService.saveStoreRange(detailDTO.getRelations(), detailDTO.getEnterpriseId(), detailDTO.getWxEnterpriseId()); storeRangeService.saveStoreRange(detailDTO.getRelations(), enterpriseId, wxEnterpriseId);
/*//超级管理员新增
TabHaobanStaff sStaff = staffMapper.selectSuperByWxEnterpriseId(detailDTO.getWxEnterpriseId()); List<EnterpriseWxaRelationDTO> relationDTOList = authorizeService.queryList(enterpriseId);
if (sStaff == null) {
TabHaobanStaff staff = new TabHaobanStaff();
staff.setStaffName("超级管理员");
staff.setWxEnterpriseId(detailDTO.getWxEnterpriseId());
staff.setSuperManagerFlag(1);
staffService.add(staff);
}*/
EnterpriseDTO enterpriseDTO = enterpriseService.getEnterpriseById(detailDTO.getEnterpriseId());
List<EnterpriseWxaRelationDTO> relationDTOList = authorizeService.queryList(detailDTO.getEnterpriseId());
if (CollectionUtils.isEmpty(relationDTOList)) { if (CollectionUtils.isEmpty(relationDTOList)) {
logger.info("relationDTOList is null"); logger.info("relationDTOList is null");
return resp; return resp;
...@@ -266,30 +263,30 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi ...@@ -266,30 +263,30 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi
logger.info("relationDTO is null"); logger.info("relationDTO is null");
return resp; return resp;
} }
TabMiniprogramSetting miniprogramSetting = miniprogramSettingService.getMiniprogramSettingNoMedia(detailDTO.getWxEnterpriseId(), detailDTO.getEnterpriseId()); TabMiniprogramSetting miniprogramSetting = miniprogramSettingService.getMiniprogramSettingNoMedia(wxEnterpriseId, enterpriseId);
if (null == miniprogramSetting) { if (null == miniprogramSetting) {
miniprogramSetting = new TabMiniprogramSetting(); miniprogramSetting = new TabMiniprogramSetting();
} }
miniprogramSetting.setWxEnterpriseId(detailDTO.getWxEnterpriseId()); miniprogramSetting.setWxEnterpriseId(wxEnterpriseId);
miniprogramSetting.setAppId(relationDTO.getWxaAppkey()); miniprogramSetting.setAppId(relationDTO.getWxaAppkey());
miniprogramSetting.setImageUrl(enterpriseDTO.getMallMiniprogramLogoUrl()); miniprogramSetting.setImageUrl(enterpriseDTO.getMallMiniprogramLogoUrl());
miniprogramSetting.setMiniprogramName(relationDTO.getAuthName()); miniprogramSetting.setMiniprogramName(relationDTO.getAuthName());
miniprogramSetting.setEnterpriseId(detailDTO.getEnterpriseId()); miniprogramSetting.setEnterpriseId(enterpriseId);
miniprogramSetting.setTitle(relationDTO.getAuthName()); miniprogramSetting.setTitle(relationDTO.getAuthName());
miniprogramSettingService.saveMiniprogramSetting(miniprogramSetting); miniprogramSettingService.saveMiniprogramSetting(miniprogramSetting);
//刷新门店信息 //刷新门店信息
ServiceResponse response = this.flushBindStoreByEnterpriseId(detailDTO.getEnterpriseId(), detailDTO.getWxEnterpriseId(), detailDTO.getStaffId(), ChannelCodeEnum.RIGHT_CHANGE_UNBIND.getCode()); ServiceResponse response = this.flushBindStoreByEnterpriseId(enterpriseId, wxEnterpriseId, detailDTO.getStaffId(), ChannelCodeEnum.RIGHT_CHANGE_UNBIND.getCode());
logger.info("刷新返回信息:{}", JSONObject.toJSONString(response)); logger.info("刷新返回信息:{}", JSONObject.toJSONString(response));
//如果已经在刷新了 需要放入队列再刷新 //如果已经在刷新了 需要放入队列再刷新
if (response.getCode() == 2) { if (response.getCode() == 2) {
logger.info("放入队列刷新:{}", detailDTO.getEnterpriseId()); logger.info("放入队列刷新:{}", enterpriseId);
FlushStoreMqDTO flushStoreMqDTO = new FlushStoreMqDTO(); FlushStoreMqDTO flushStoreMqDTO = new FlushStoreMqDTO();
flushStoreMqDTO.setEnterpriseId(detailDTO.getEnterpriseId()); flushStoreMqDTO.setEnterpriseId(enterpriseId);
flushStoreMqDTO.setOptStaffId(detailDTO.getStaffId()); flushStoreMqDTO.setOptStaffId(detailDTO.getStaffId());
flushStoreMqDTO.setWxEnterpriseId(detailDTO.getWxEnterpriseId()); flushStoreMqDTO.setWxEnterpriseId(wxEnterpriseId);
flushStoreMqDTO.setChannalCode(ChannelCodeEnum.ADMIN_UNBIND.getCode()); flushStoreMqDTO.setChannalCode(ChannelCodeEnum.ADMIN_UNBIND.getCode());
this.flushBindStoreToDelayMq(detailDTO.getEnterpriseId(), flushStoreMqDTO); this.flushBindStoreToDelayMq(enterpriseId, flushStoreMqDTO);
} }
return resp; return resp;
} }
...@@ -425,7 +422,7 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi ...@@ -425,7 +422,7 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi
// 获取所有门店信息 // 获取所有门店信息
List<StoreSimpleDTO> storeDtos = storeService.listSimpleStore(enterpriseId, null, null); List<StoreSimpleDTO> storeDtos = storeService.listSimpleStore(enterpriseId, null, null);
logger.info("所有门店数={},{}",enterpriseId,storeDtos.size()); logger.info("所有门店数={},{}", enterpriseId, storeDtos.size());
Map<String, List<String>> storeMapByGroupId = storeDtos.stream().filter(dto -> StringUtils.isNotBlank(dto.getStoreGroupId())).collect(Collectors.groupingBy(dto -> dto.getStoreGroupId(), Collectors.mapping(dto -> dto.getStoreId(), Collectors.toList()))); Map<String, List<String>> storeMapByGroupId = storeDtos.stream().filter(dto -> StringUtils.isNotBlank(dto.getStoreGroupId())).collect(Collectors.groupingBy(dto -> dto.getStoreGroupId(), Collectors.mapping(dto -> dto.getStoreId(), Collectors.toList())));
Map<String, StoreSimpleDTO> storeIdMap = storeDtos.stream().collect(Collectors.toMap(dto -> dto.getStoreId(), dto -> dto)); Map<String, StoreSimpleDTO> storeIdMap = storeDtos.stream().collect(Collectors.toMap(dto -> dto.getStoreId(), dto -> dto));
...@@ -513,28 +510,28 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi ...@@ -513,28 +510,28 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi
List<WxEnterpriseDTO> ret = EntityUtil.changeEntityListNew(WxEnterpriseDTO.class, wxEnterprises); List<WxEnterpriseDTO> ret = EntityUtil.changeEntityListNew(WxEnterpriseDTO.class, wxEnterprises);
return ret; return ret;
} }
@Override @Override
public List<WxEnterpriseDTO> listWxEnterpriseByEid(String enterpriseId, String clerkPhoneNumber) { public List<WxEnterpriseDTO> listWxEnterpriseByEid(String enterpriseId, String clerkPhoneNumber) {
List<WxEnterpriseDTO> list = new ArrayList<>(); List<WxEnterpriseDTO> list = new ArrayList<>();
ClerkDTO clerk = this.clerkService.getUserByPhoneNumber(clerkPhoneNumber, enterpriseId); ClerkDTO clerk = this.clerkService.getUserByPhoneNumber(clerkPhoneNumber, enterpriseId);
if(null == clerk || (StringUtils.isBlank(clerk.getHbEnt()) && null != clerk.getSuperAdmin() && 0==clerk.getSuperAdmin())) { if (null == clerk || (StringUtils.isBlank(clerk.getHbEnt()) && null != clerk.getSuperAdmin() && 0 == clerk.getSuperAdmin())) {
logger.info("导购校验不通过,不存在或hbEnt为空,clerkPhoneNumber={},eid={}",clerkPhoneNumber,enterpriseId); logger.info("导购校验不通过,不存在或hbEnt为空,clerkPhoneNumber={},eid={}", clerkPhoneNumber, enterpriseId);
return list ; return list;
} }
List<WxEnterpriseDTO> dtoList = this.listWxEnterpriseByEid(enterpriseId) ; List<WxEnterpriseDTO> dtoList = this.listWxEnterpriseByEid(enterpriseId);
logger.info("用户管辖微信企业phone={},hbEnt={},dtoList={},super={}",clerkPhoneNumber,clerk.getHbEnt(),JSON.toJSONString(dtoList),clerk.getSuperAdmin()); logger.info("用户管辖微信企业phone={},hbEnt={},dtoList={},super={}", clerkPhoneNumber, clerk.getHbEnt(), JSON.toJSONString(dtoList), clerk.getSuperAdmin());
if(CollectionUtils.isEmpty(dtoList)) { if (CollectionUtils.isEmpty(dtoList)) {
return list ; return list;
} }
if(null != clerk.getSuperAdmin() && 0 == clerk.getSuperAdmin()) { if (null != clerk.getSuperAdmin() && 0 == clerk.getSuperAdmin()) {
for(WxEnterpriseDTO item : dtoList) { for (WxEnterpriseDTO item : dtoList) {
if(clerk.getHbEnt().contains(item.getWxEnterpriseId())) { if (clerk.getHbEnt().contains(item.getWxEnterpriseId())) {
list.add(item) ; list.add(item);
} }
} }
}else { } else {
return dtoList ; return dtoList;
} }
return list; return list;
} }
...@@ -643,17 +640,13 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi ...@@ -643,17 +640,13 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi
if (tabHaobanWxEnterpriseRelated == null) { if (tabHaobanWxEnterpriseRelated == null) {
return false; return false;
} }
/* if (tabHaobanWxEnterpriseRelated.getWxEnterpriseType() == 1) {
logger.info("非总部不能设置好友");
return false;
}*/
wxEnterpriseRelatedService.setClerkEdit(wxEnterprieseRelatedId, clerkEditFlag); wxEnterpriseRelatedService.setClerkEdit(wxEnterprieseRelatedId, clerkEditFlag);
return true; return true;
} }
@Override @Override
public void saveClerkEditFlag(String wxEnterpriseId, String enterpriseId, int value) { public void saveClerkEditFlag(String wxEnterpriseId, String enterpriseId, int value) {
this.wxEnterpriseRelatedMapper.saveClerkEditFlag(wxEnterpriseId,enterpriseId,value) ; this.wxEnterpriseRelatedMapper.saveClerkEditFlag(wxEnterpriseId, enterpriseId, value);
} }
@Override @Override
...@@ -665,18 +658,18 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi ...@@ -665,18 +658,18 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi
//return enterpriseRelated.getWxEnterpriseType() == 0; //return enterpriseRelated.getWxEnterpriseType() == 0;
return true; return true;
} }
@Override @Override
public List<StoreOrGroupInfoDTO> queryBindStoreRange(String enterpriseId, String wxEnterpriseId) { public List<StoreOrGroupInfoDTO> queryBindStoreRange(String enterpriseId, String wxEnterpriseId) {
return this.storeRangeService.queryBindStoreRange(enterpriseId, wxEnterpriseId); return this.storeRangeService.queryBindStoreRange(enterpriseId, wxEnterpriseId);
} }
@Override @Override
public List<String> listStoreIdByName(String wxEnterpriseId, String enterpriseId, String storeName) { public List<String> listStoreIdByName(String wxEnterpriseId, String enterpriseId, String storeName) {
if(StringUtils.isAnyBlank(wxEnterpriseId,enterpriseId,storeName)) { if (StringUtils.isAnyBlank(wxEnterpriseId, enterpriseId, storeName)) {
return null ; return null;
} }
return this.storeRangeService.listStoreIdByName(wxEnterpriseId, enterpriseId,storeName); return this.storeRangeService.listStoreIdByName(wxEnterpriseId, enterpriseId, storeName);
} }
/** /**
...@@ -690,13 +683,13 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi ...@@ -690,13 +683,13 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi
public com.gic.api.base.commons.ServiceResponse<EnterpriseDetailDTO> queryEnterpriseDetail(String wxEnterpriseId, String enterpriseId) { public com.gic.api.base.commons.ServiceResponse<EnterpriseDetailDTO> queryEnterpriseDetail(String wxEnterpriseId, String enterpriseId) {
TabHaobanWxEnterpriseRelated oneByEnterpriseId = wxEnterpriseRelatedMapper.findOneByEIdAndWxEid(enterpriseId, wxEnterpriseId); TabHaobanWxEnterpriseRelated oneByEnterpriseId = wxEnterpriseRelatedMapper.findOneByEIdAndWxEid(enterpriseId, wxEnterpriseId);
if (oneByEnterpriseId == null){ if (oneByEnterpriseId == null) {
return com.gic.api.base.commons.ServiceResponse.failure(HaoBanErrCodeCommon.ERR_8.getCode()+"", HaoBanErrCodeCommon.ERR_8.getMsg()); return com.gic.api.base.commons.ServiceResponse.failure(HaoBanErrCodeCommon.ERR_8.getCode() + "", HaoBanErrCodeCommon.ERR_8.getMsg());
} }
EnterpriseDetailDTO enterpriseDetailDTO = EntityUtil.changeEntity(EnterpriseDetailDTO.class, oneByEnterpriseId); EnterpriseDetailDTO enterpriseDetailDTO = EntityUtil.changeEntity(EnterpriseDetailDTO.class, oneByEnterpriseId);
EnterpriseDTO enterprise = enterpriseService.getEnterpriseById(enterpriseId); EnterpriseDTO enterprise = enterpriseService.getEnterpriseById(enterpriseId);
if (enterprise == null){ if (enterprise == null) {
return com.gic.api.base.commons.ServiceResponse.failure(HaoBanErrCodeCommon.ERR_8.getCode()+"", HaoBanErrCodeCommon.ERR_8.getMsg()); return com.gic.api.base.commons.ServiceResponse.failure(HaoBanErrCodeCommon.ERR_8.getCode() + "", HaoBanErrCodeCommon.ERR_8.getMsg());
} }
enterpriseDetailDTO.setEnterpriseName(enterprise.getEnterpriseName()); enterpriseDetailDTO.setEnterpriseName(enterprise.getEnterpriseName());
enterpriseDetailDTO.setEnterpriseLogo(enterprise.getQcloudImageUrl()); enterpriseDetailDTO.setEnterpriseLogo(enterprise.getQcloudImageUrl());
......
...@@ -163,7 +163,7 @@ public class HmLinkApiServiceImpl implements HmLinkApiService { ...@@ -163,7 +163,7 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
Map<String, String> remarkMap = new HashMap<>(); Map<String, String> remarkMap = new HashMap<>();
if (null == link) { if (null == link) {
log.error("链接记录不存,linkShortCode={}", linkShortCode); log.error("链接记录不存,linkShortCode={}", linkShortCode);
return ServiceResponse.failure(HaoBanErrCode.ERR_OTHER.getCode(), "链接记录不存"); return ServiceResponse.failure(HaoBanErrCode.ERR_OTHER.getCode(), "无效的链接");
} }
// 查询页面 // 查询页面
retDTO.setPageId(link.getPageId()); retDTO.setPageId(link.getPageId());
...@@ -174,16 +174,20 @@ public class HmLinkApiServiceImpl implements HmLinkApiService { ...@@ -174,16 +174,20 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
} }
Long linkId = link.getLinkId(); Long linkId = link.getLinkId();
String wxEnterpriseId = link.getWxEnterpriseId(); String wxEnterpriseId = link.getWxEnterpriseId();
retDTO.setWxEnterpriseId(wxEnterpriseId);
retDTO.setEnterpriseId(enterpriseId);
WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseService.selectById(wxEnterpriseId); WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseService.selectById(wxEnterpriseId);
if (wxEnterpriseDTO == null) { if (wxEnterpriseDTO == null) {
log.error("未查询到微信企业,id={}", wxEnterpriseId); log.error("未查询到微信企业,id={}", wxEnterpriseId);
return ServiceResponse.failure(HaoBanErrCode.ERR_OTHER.getCode(), "未查到微信企业"); return ServiceResponse.failure(HaoBanErrCode.ERR_OTHER.getCode(), "未查到微信企业");
} }
// 判断导购是否有活码,如果没有返回错误 // 判断导购是否有活码,如果没有返回错误
if (StringUtils.isNotBlank(inClerkId)) { if (StringUtils.isNotBlank(inClerkId)) {
hm = this.getHmFromClerk(inClerkId, wxEnterpriseId); hm = this.getHmFromClerk(inClerkId, wxEnterpriseId);
if (null == hm) { if (null == hm) {
return ServiceResponse.failure(HaoBanErrCode.ERR_OTHER.getCode(), "导购活码不存在"); remarkMap.put("reason","无任何导购活码");
retDTO.setRemarkMap(remarkMap);
return ServiceResponse.success(retDTO) ;
} }
} }
// 直接返回门店的导购活码,如果没有返回错误 // 直接返回门店的导购活码,如果没有返回错误
...@@ -220,11 +224,22 @@ public class HmLinkApiServiceImpl implements HmLinkApiService { ...@@ -220,11 +224,22 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
hm = this.getHmFormStore(wxEnterpriseId, inStoreId, dz, dy, new ArrayList<>()); hm = this.getHmFormStore(wxEnterpriseId, inStoreId, dz, dy, new ArrayList<>());
log.info("获取到的门店配置dz={},dy={},获取的活码={}", dz, dy, JSON.toJSONString(hm)); log.info("获取到的门店配置dz={},dy={},获取的活码={}", dz, dy, JSON.toJSONString(hm));
if (null == hm) { if (null == hm) {
return ServiceResponse.failure(HaoBanErrCode.ERR_OTHER.getCode(), "导购活码不存在"); remarkMap.put("reason","无任何导购活码");
retDTO.setRemarkMap(remarkMap);
return ServiceResponse.success(retDTO) ;
} }
remarkMap.put("sm", "会员选门店活码"); remarkMap.put("sm", "会员选门店活码");
} }
} }
String mobile = null ;
if (StringUtils.isNotEmpty(mixPhone)) {
mobile = this.keyDataService.getMobile(mixPhone, linkShortCode);
log.info("查询手机号,mobile={},mixPhone={}", mobile, mixPhone);
String mobileMemberId = this.memberService.getMemberIdByPhoneNumber(mobile, enterpriseId);
if (StringUtils.isNotBlank(mobileMemberId)) {
memberId = mobileMemberId;
}
}
// 会员门店 // 会员门店
if (null == hm) { if (null == hm) {
HmLinkStoreSettingDTO fwStore = null; HmLinkStoreSettingDTO fwStore = null;
...@@ -241,14 +256,6 @@ public class HmLinkApiServiceImpl implements HmLinkApiService { ...@@ -241,14 +256,6 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
if (null == xgStore || xgStore.getOpen() == 0) { if (null == xgStore || xgStore.getOpen() == 0) {
xgStore = null; xgStore = null;
} }
if (StringUtils.isNotEmpty(mixPhone)) {
String mobile = this.keyDataService.getMobile(mixPhone, linkShortCode);
log.info("小程序获取活码mobile={},mixPhone={}", mobile, mixPhone);
String mobileMemberId = this.memberService.getMemberIdByPhoneNumber(mobile, enterpriseId);
if (StringUtils.isNotBlank(mobileMemberId)) {
memberId = mobileMemberId;
}
}
log.info("小程序获取活码memberId={}", memberId); log.info("小程序获取活码memberId={}", memberId);
if (StringUtils.isNotBlank(memberId)) { if (StringUtils.isNotBlank(memberId)) {
MemberDataDTO member = this.getMemberClerk(enterpriseId, memberId); MemberDataDTO member = this.getMemberClerk(enterpriseId, memberId);
...@@ -258,16 +265,22 @@ public class HmLinkApiServiceImpl implements HmLinkApiService { ...@@ -258,16 +265,22 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
if (null != fwStore) { if (null != fwStore) {
log.info("处理服务门店逻辑"); log.info("处理服务门店逻辑");
List<String> clerkIdList = new ArrayList<>() ; List<String> clerkIdList = new ArrayList<>() ;
if (fwStore.getZs() == 1 && StringUtils.isNotBlank(mainClerkId)) { if(StringUtils.isNotBlank(mainClerkId)) {
hm = this.getHmFromClerk(mainClerkId, wxEnterpriseId);
clerkIdList.add(mainClerkId); clerkIdList.add(mainClerkId);
if (fwStore.getZs() == 1) {
hm = this.getHmFromClerk(mainClerkId, wxEnterpriseId);
if(null != hm) {
log.info("获取服务导购活码,mainClerkId={}",mainClerkId);
remarkMap.put("sm", "主门店-服务导购");
}
}
} }
if (null == hm && StringUtils.isNotBlank(mainStoreId)) { if (null == hm && StringUtils.isNotBlank(mainStoreId)) {
hm = this.getHmFormStore(wxEnterpriseId, mainStoreId, fwStore.getDz(), fwStore.getDy(), hm = this.getHmFormStore(wxEnterpriseId, mainStoreId, fwStore.getDz(), fwStore.getDy(),
clerkIdList); clerkIdList);
} if (null != hm) {
if (null != hm) { remarkMap.put("sm", "主门店-店长-店员");
remarkMap.put("sm", "会员主门店活码"); }
} }
} }
// 协管门店 // 协管门店
...@@ -287,6 +300,7 @@ public class HmLinkApiServiceImpl implements HmLinkApiService { ...@@ -287,6 +300,7 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
} }
hm = this.getHmFromClerk(clerkId, wxEnterpriseId); hm = this.getHmFromClerk(clerkId, wxEnterpriseId);
if (null != hm) { if (null != hm) {
remarkMap.put("sm", "协管活码-主导购");
storeIdList = null; storeIdList = null;
break; break;
} }
...@@ -298,6 +312,7 @@ public class HmLinkApiServiceImpl implements HmLinkApiService { ...@@ -298,6 +312,7 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
for (String storeId : storeIdList) { for (String storeId : storeIdList) {
hm = this.getHmFormStore(wxEnterpriseId, storeId, 1, 0, clerkIdList); hm = this.getHmFormStore(wxEnterpriseId, storeId, 1, 0, clerkIdList);
if (null != hm) { if (null != hm) {
remarkMap.put("sm", "协管活码-店长");
break; break;
} }
} }
...@@ -307,13 +322,11 @@ public class HmLinkApiServiceImpl implements HmLinkApiService { ...@@ -307,13 +322,11 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
for (String storeId : storeIdList) { for (String storeId : storeIdList) {
hm = this.getHmFormStore(wxEnterpriseId, storeId, 0, 1, clerkIdList); hm = this.getHmFormStore(wxEnterpriseId, storeId, 0, 1, clerkIdList);
if (null != hm) { if (null != hm) {
remarkMap.put("sm", "协管活码-店员");
break; break;
} }
} }
} }
if (null != hm) {
remarkMap.put("sm", "会员协管活码");
}
} }
} }
} }
...@@ -363,6 +376,9 @@ public class HmLinkApiServiceImpl implements HmLinkApiService { ...@@ -363,6 +376,9 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
bo.setUnionid(unionid); bo.setUnionid(unionid);
bo.setLinkId(linkId); bo.setLinkId(linkId);
bo.setHmId(hm.getHmId()); bo.setHmId(hm.getHmId());
if(StringUtils.isNotBlank(mixPhone) && StringUtils.isNotBlank(mobile)) {
bo.setMobile(mobile);
}
String dthmKey = this.keyDataService.saveDataForLink(enterpriseId, bo); String dthmKey = this.keyDataService.saveDataForLink(enterpriseId, bo);
remarkMap.put("dthmKey", dthmKey); remarkMap.put("dthmKey", dthmKey);
if (null != dthmKey) { if (null != dthmKey) {
...@@ -370,7 +386,9 @@ public class HmLinkApiServiceImpl implements HmLinkApiService { ...@@ -370,7 +386,9 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
if (!addResp.isSuccess()) { if (!addResp.isSuccess()) {
remarkMap.put("sm", "创建动态活码失败,取单人活码"); remarkMap.put("sm", "创建动态活码失败,取单人活码");
if (StringUtils.isBlank(hm.getWxQrcode())) { if (StringUtils.isBlank(hm.getWxQrcode())) {
return ServiceResponse.failure(HaoBanErrCode.ERR_OTHER.getCode(), "导购活码不存在"); remarkMap.put("reason","无任何导购活码");
retDTO.setRemarkMap(remarkMap);
return ServiceResponse.success(retDTO) ;
} }
retDTO.setHmQrcode(hm.getWxQrcode()); retDTO.setHmQrcode(hm.getWxQrcode());
} else { } else {
...@@ -492,7 +510,7 @@ public class HmLinkApiServiceImpl implements HmLinkApiService { ...@@ -492,7 +510,7 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
if (dz == 1) { if (dz == 1) {
hm = this.getHmFromClerk(dzClerk.getClerkId(), wxEnterpriseId); hm = this.getHmFromClerk(dzClerk.getClerkId(), wxEnterpriseId);
if (null != hm) { if (null != hm) {
log.info("选择门店后,获取到店长活码,clerkId={},inStoreId={}", hm.getClerkId(), inStoreId); log.info("获取到店长活码,clerkId={},inStoreId={}", hm.getClerkId(), inStoreId);
} }
} }
} else { } else {
...@@ -502,12 +520,15 @@ public class HmLinkApiServiceImpl implements HmLinkApiService { ...@@ -502,12 +520,15 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
log.info("过滤的导购={}",clerkIdList); log.info("过滤的导购={}",clerkIdList);
if (null == hm && dy == 1) { if (null == hm && dy == 1) {
List<HmQrcodeBO> list = this.hmQrcodeService.listByStoreId(wxEnterpriseId, inStoreId, 0); List<HmQrcodeBO> list = this.hmQrcodeService.listByStoreId(wxEnterpriseId, inStoreId, 0);
list = list.stream().filter(dto -> !clerkIdList.contains(dto.getClerkId())).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(list)) { if (CollectionUtils.isNotEmpty(list)) {
log.info("选择门店下{},导购数={}", inStoreId, list.size()); log.info("查询门店下有活码的导购数={}",list.size());
list = list.stream().filter(dto -> !clerkIdList.contains(dto.getClerkId())).collect(Collectors.toList());
}
if (CollectionUtils.isNotEmpty(list)) {
log.info("门店下{},导购数={}", inStoreId, list.size());
hm = list.get(new Random().nextInt(list.size())); hm = list.get(new Random().nextInt(list.size()));
if (null != hm) { if (null != hm) {
log.info("选择门店后,获取到店员活码,clerkId={},inStoreId={}", hm.getClerkId(), inStoreId); log.info("获取到店员活码,clerkId={},inStoreId={}", hm.getClerkId(), inStoreId);
} }
} }
} }
......
...@@ -22,6 +22,7 @@ import com.gic.haoban.manage.api.dto.hm.HmQrcodeStoreDTO; ...@@ -22,6 +22,7 @@ import com.gic.haoban.manage.api.dto.hm.HmQrcodeStoreDTO;
import com.gic.haoban.manage.api.dto.qdto.hm.HmClerkRelationQDTO; import com.gic.haoban.manage.api.dto.qdto.hm.HmClerkRelationQDTO;
import com.gic.haoban.manage.api.dto.qdto.hm.HmQrcodeListQDTO; import com.gic.haoban.manage.api.dto.qdto.hm.HmQrcodeListQDTO;
import com.gic.haoban.manage.api.dto.qdto.hm.HmQrcodeQDTO; import com.gic.haoban.manage.api.dto.qdto.hm.HmQrcodeQDTO;
import com.gic.haoban.manage.api.enums.ChannelCodeEnum;
import com.gic.haoban.manage.api.enums.hm.HmWelcomeReferType; import com.gic.haoban.manage.api.enums.hm.HmWelcomeReferType;
import com.gic.haoban.manage.api.service.hm.HmQrcodeApiService; import com.gic.haoban.manage.api.service.hm.HmQrcodeApiService;
import com.gic.haoban.manage.service.config.Config; import com.gic.haoban.manage.service.config.Config;
...@@ -153,16 +154,39 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService { ...@@ -153,16 +154,39 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
} }
hmQrcodeQDTO.setWxQrcode(qywxExternalcontactResultDTO.getQr_code()); hmQrcodeQDTO.setWxQrcode(qywxExternalcontactResultDTO.getQr_code());
hmQrcodeQDTO.setWxConfigId(qywxExternalcontactResultDTO.getConfig_id()); hmQrcodeQDTO.setWxConfigId(qywxExternalcontactResultDTO.getConfig_id());
//操作日志
addLog(hmQrcodeQDTO, wxEnterpriseId, hmId);
int saveResult = hmQrcodeService.insert(hmQrcodeQDTO); int saveResult = hmQrcodeService.insert(hmQrcodeQDTO);
if (saveResult == 1) { if (saveResult == 1) {
// save welcome relation // save welcome relation
this.updateWelcomeRelation(hmQrcodeQDTO); this.updateWelcomeRelation(hmQrcodeQDTO);
} }
setLoggerContext(hmQrcodeQDTO.getEnterpriseId(), wxEnterpriseId, hmQrcodeQDTO.getCreatorId(), hmQrcodeQDTO.getCreatorName());
GicLogRecordEvaluationContext.putAttribute("logContent", "【" + hmId + "-" + hmQrcodeQDTO.getName() + "】");
return ServiceResponse.success(); return ServiceResponse.success();
} }
private void addLog(HmQrcodeQDTO hmQrcodeQDTO, String wxEnterpriseId, Long hmId) {
Integer invokingType = hmQrcodeQDTO.getInvokingType();
if (invokingType == 0) {
GicLogRecordEvaluationContext.noWriteLog();
} else {
//操作日志
setLoggerContext(hmQrcodeQDTO.getEnterpriseId(), wxEnterpriseId, hmQrcodeQDTO.getCreatorId(), hmQrcodeQDTO.getCreatorName());
String logContent = "【" + hmId + "-" + hmQrcodeQDTO.getName() + "】";
if (StringUtils.isBlank(logContent)) {
GicLogRecordEvaluationContext.noWriteLog();
} else {
if (invokingType != 1) {
logContent = logContent + "——" + ChannelCodeEnum.getNameByCode(invokingType);
}
GicLogRecordEvaluationContext.putAttribute("logContent", logContent);
logger.info("新增活码日志:logText:{}", logContent);
}
}
}
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@GicLogRecord(value = "批量新增员工活码-${#logContent}", @GicLogRecord(value = "批量新增员工活码-${#logContent}",
...@@ -184,19 +208,25 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService { ...@@ -184,19 +208,25 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
} }
if (clerkIdList.contains("-1")) { if (clerkIdList.contains("-1")) {
List<HmQrcodeClerkBO> hmQrcodeClerkBOS = hmQrcodeService.listCanAddClerk(wxEnterpriseId, enterpriseId, hmQrcodeQDTO.getCreatorId()); List<HmQrcodeClerkBO> hmQrcodeClerkBOS = hmQrcodeService.listCanAddClerk(wxEnterpriseId, enterpriseId, hmQrcodeQDTO.getCreatorId());
clerkIdList = hmQrcodeClerkBOS.stream().map(HmQrcodeClerkBO::getClerkId).collect(Collectors.toList()); if (CollectionUtils.isEmpty(hmQrcodeClerkBOS)) {
if (CollectionUtils.isEmpty(clerkIdList)) {
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_5.getCode()), "无需要生成活码导购"); return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_5.getCode()), "无需要生成活码导购");
} }
clerkIdList = hmQrcodeClerkBOS.stream().map(HmQrcodeClerkBO::getClerkId).filter(StringUtils::isNotBlank).collect(Collectors.toList());
}
if (CollectionUtils.isEmpty(clerkIdList)) {
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_5.getCode()), "无需要生成活码导购");
} }
for (String clerkId : clerkIdList) { for (String clerkId : clerkIdList) {
hmQrcodeQDTO.setClerkIdList(Collections.singletonList(clerkId)); hmQrcodeQDTO.setClerkIdList(Collections.singletonList(clerkId));
hmQrcodeQDTO.setInvokingType(3);
add(hmQrcodeQDTO); add(hmQrcodeQDTO);
} }
setLoggerContext(enterpriseId, wxEnterpriseId, hmQrcodeQDTO.getCreatorId(), hmQrcodeQDTO.getCreatorName()); setLoggerContext(enterpriseId, wxEnterpriseId, hmQrcodeQDTO.getCreatorId(), hmQrcodeQDTO.getCreatorName());
GicLogRecordEvaluationContext.putAttribute("logContent", "【" + "批量创建数量" + clerkIdList.size() + "】"); String logContent = "【" + "批量创建数量" + clerkIdList.size() + "】";
GicLogRecordEvaluationContext.putAttribute("logContent", logContent);
logger.info("批量新增活码日志:logText:{}", logContent);
return ServiceResponse.success(); return ServiceResponse.success();
} }
...@@ -219,7 +249,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService { ...@@ -219,7 +249,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
} }
@GicLogRecord(value = "修改员工活码-${#hmName}-${#logContent}", @GicLogRecord(value = "修改员工活码-${#hmName}${#logContent}",
category = GicLogRecordCategoryEnum.HUOMA, category = GicLogRecordCategoryEnum.HUOMA,
optType = GicLogRecordOptTypeEnum.HUOMA_EDIT, optType = GicLogRecordOptTypeEnum.HUOMA_EDIT,
optPage = "活码管理-修改员工活码", optPage = "活码管理-修改员工活码",
...@@ -262,15 +292,14 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService { ...@@ -262,15 +292,14 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_0.getCode()), qywxResponseDTO.getErrmsg()); return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_0.getCode()), qywxResponseDTO.getErrmsg());
} }
setLoggerContext(hmQrcodeQDTO.getEnterpriseId(), wxEnterpriseId, hmQrcodeQDTO.getModifierId(), hmQrcodeQDTO.getModifierName());
updateSystemLog(hmQrcodeQDTO, hmId);
int updateResult = hmQrcodeService.update(hmQrcodeQDTO); int updateResult = hmQrcodeService.update(hmQrcodeQDTO);
if (updateResult == 1) { if (updateResult == 1) {
// 更新欢迎语引用次数 // 更新欢迎语引用次数
this.updateWelcomeRelation(hmQrcodeQDTO); this.updateWelcomeRelation(hmQrcodeQDTO);
} }
setLoggerContext(hmQrcodeQDTO.getEnterpriseId(), wxEnterpriseId, hmQrcodeQDTO.getModifierId(), hmQrcodeQDTO.getModifierName());
updateSystemLog(hmQrcodeQDTO, hmId);
return ServiceResponse.success(); return ServiceResponse.success();
} }
...@@ -286,6 +315,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService { ...@@ -286,6 +315,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
//操作日志 //操作日志
//名称 //名称
String name = hmQrcodeQDTO.getName(); String name = hmQrcodeQDTO.getName();
Integer invokingType = hmQrcodeQDTO.getInvokingType();
String nameOld = hmOld.getName(); String nameOld = hmOld.getName();
if (!name.equals(nameOld)) { if (!name.equals(nameOld)) {
logContent.append("活码名称「").append(nameOld).append("」").append("变更为「").append(name).append("」"); logContent.append("活码名称「").append(nameOld).append("」").append("变更为「").append(name).append("」");
...@@ -349,8 +379,15 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService { ...@@ -349,8 +379,15 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
logContent.append("欢迎语「").append(welcomeOld.getTitle()).append("」").append("变更为「").append(welcome.getTitle()).append("」"); logContent.append("欢迎语「").append(welcomeOld.getTitle()).append("」").append("变更为「").append(welcome.getTitle()).append("」");
} }
} }
GicLogRecordEvaluationContext.putAttribute("hmName", "【" + hmId + "-" + hmQrcodeQDTO.getName() + "】:");
GicLogRecordEvaluationContext.putAttribute("logContent", logContent.toString()); String logText = logContent.toString();
String hmName = "【" + hmId + "-" + hmQrcodeQDTO.getName() + "】";
GicLogRecordEvaluationContext.putAttribute("hmName", hmName);
if (invokingType != 1) {
logText = logText + "——" + ChannelCodeEnum.getNameByCode(invokingType);
}
GicLogRecordEvaluationContext.putAttribute("logContent", logText);
logger.info("更新活码日志:hmName:{},logText:{}", hmName, logText);
} }
...@@ -385,11 +422,12 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService { ...@@ -385,11 +422,12 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
if (CollectionUtils.isEmpty(clerkIdList)) { if (CollectionUtils.isEmpty(clerkIdList)) {
return null; return null;
} }
String enterpriseId = hmQrcodeQDTO.getEnterpriseId();
//单人活码 //单人活码
String clerkId = clerkIdList.get(0); String clerkId = clerkIdList.get(0);
if (hmType == 2) { if (hmType == 2) {
//多人活码 //多人活码
insertHmClerkRelation(hmQrcodeQDTO, wxEnterpriseId, hmId, clerkIdList, addFlag); insertHmClerkRelation(enterpriseId, wxEnterpriseId, hmId, clerkIdList, addFlag);
} else if (hmType == 1) { } else if (hmType == 1) {
HmQrcodeBO hmQrcodeBO = hmQrcodeService.queryByClerkId(clerkId, wxEnterpriseId); HmQrcodeBO hmQrcodeBO = hmQrcodeService.queryByClerkId(clerkId, wxEnterpriseId);
if (addFlag && hmQrcodeBO != null) { if (addFlag && hmQrcodeBO != null) {
...@@ -401,7 +439,12 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService { ...@@ -401,7 +439,12 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
hmQrcodeQDTO.setClerkId(clerkId); hmQrcodeQDTO.setClerkId(clerkId);
ClerkDTO clerkDTO = clerkService.getclerkById(clerkId); ClerkDTO clerkDTO = clerkService.getclerkById(clerkId);
if (clerkDTO != null) { if (clerkDTO != null) {
hmQrcodeQDTO.setClerkName(clerkDTO.getClerkName()); String name = hmQrcodeQDTO.getName();
String clerkName = clerkDTO.getClerkName();
if (StringUtils.isBlank(name)) {
hmQrcodeQDTO.setName(clerkName);
}
hmQrcodeQDTO.setClerkName(clerkName);
hmQrcodeQDTO.setClerkCode(clerkDTO.getClerkCode()); hmQrcodeQDTO.setClerkCode(clerkDTO.getClerkCode());
String storeId = clerkDTO.getStoreId(); String storeId = clerkDTO.getStoreId();
hmQrcodeQDTO.setStoreId(storeId); hmQrcodeQDTO.setStoreId(storeId);
...@@ -425,17 +468,27 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService { ...@@ -425,17 +468,27 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
/** /**
* 多人活码关联关系 * 多人活码关联关系
* * @param enterpriseId
* @param hmQrcodeQDTO
* @param wxEnterpriseId * @param wxEnterpriseId
* @param hmId * @param hmId
* @param clerkIdList * @param clerkIdList
* @param addFlag
*/ */
private void insertHmClerkRelation(HmQrcodeQDTO hmQrcodeQDTO, String wxEnterpriseId, Long hmId, List<String> clerkIdList, Boolean addFlag) { private void insertHmClerkRelation(String enterpriseId,String wxEnterpriseId, Long hmId, List<String> clerkIdList, Boolean addFlag) {
Date now = new Date(); Date now = new Date();
if (!addFlag) {
//修改,删除其余无效导购
List<HmClerkRelationBO> hmClerkRelationBOS = hmClerkRelationService.queryByHmIdNotInClerkIds(hmId, clerkIdList);
if (CollectionUtils.isNotEmpty(hmClerkRelationBOS)) {
for (HmClerkRelationBO hmClerkRelationBO : hmClerkRelationBOS) {
hmClerkRelationService.updateStatusById(0,hmClerkRelationBO.getRelationId());
}
}
}
for (String clerkId : clerkIdList) { for (String clerkId : clerkIdList) {
HmClerkRelationBO hmClerkRelationBO = hmClerkRelationService.queryByHmIdAndClerkId(hmId, clerkId); HmClerkRelationBO hmClerkRelationBO = hmClerkRelationService.queryByHmIdAndClerkId(hmId, clerkId);
if (addFlag && hmClerkRelationBO != null) { if (hmClerkRelationBO != null) {
logger.error("该导购已经在该多人活码中,clerkId:{}", clerkId); logger.error("该导购已经在该多人活码中,clerkId:{}", clerkId);
continue; continue;
} }
...@@ -446,7 +499,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService { ...@@ -446,7 +499,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
hmClerkRelationQDTO.setHmId(hmId); hmClerkRelationQDTO.setHmId(hmId);
hmClerkRelationQDTO.setWxUserId(clerkRelationDTO.getWxUserId()); hmClerkRelationQDTO.setWxUserId(clerkRelationDTO.getWxUserId());
hmClerkRelationQDTO.setWxEnterpriseId(wxEnterpriseId); hmClerkRelationQDTO.setWxEnterpriseId(wxEnterpriseId);
hmClerkRelationQDTO.setEnterpriseId(hmQrcodeQDTO.getEnterpriseId()); hmClerkRelationQDTO.setEnterpriseId(enterpriseId);
hmClerkRelationQDTO.setClerkId(clerkId); hmClerkRelationQDTO.setClerkId(clerkId);
ClerkDTO clerkDTO = clerkService.getclerkById(clerkId); ClerkDTO clerkDTO = clerkService.getclerkById(clerkId);
if (clerkDTO != null) { if (clerkDTO != null) {
...@@ -531,11 +584,12 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService { ...@@ -531,11 +584,12 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
afterFunc = LogRecordAfterServiceImpl.class) afterFunc = LogRecordAfterServiceImpl.class)
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ServiceResponse delById(Long hmId) { public ServiceResponse delById(Long hmId, Integer invokingType) {
HmQrcodeBO hmQrcodeBO = hmQrcodeService.queryById(hmId); HmQrcodeBO hmQrcodeBO = hmQrcodeService.queryById(hmId);
if (hmQrcodeBO == null) { if (hmQrcodeBO == null) {
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_8.getCode()), "活码不存在"); return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_8.getCode()), "活码不存在");
} }
String wxConfigId = hmQrcodeBO.getWxConfigId(); String wxConfigId = hmQrcodeBO.getWxConfigId();
if (StringUtils.isNotBlank(wxConfigId)) { if (StringUtils.isNotBlank(wxConfigId)) {
WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseService.selectById(hmQrcodeBO.getWxEnterpriseId()); WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseService.selectById(hmQrcodeBO.getWxEnterpriseId());
...@@ -545,18 +599,25 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService { ...@@ -545,18 +599,25 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_8.getCode()), qywxResponseDTO.getErrmsg()); return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_8.getCode()), qywxResponseDTO.getErrmsg());
} }
} }
hmQrcodeService.deleteById(hmId);
//操作日志
setLoggerContext(hmQrcodeBO.getEnterpriseId(), hmQrcodeBO.getWxEnterpriseId(), hmQrcodeBO.getModifierId(), hmQrcodeBO.getModifierName()); setLoggerContext(hmQrcodeBO.getEnterpriseId(), hmQrcodeBO.getWxEnterpriseId(), hmQrcodeBO.getModifierId(), hmQrcodeBO.getModifierName());
GicLogRecordEvaluationContext.putAttribute("logContent", "【" + hmId + "-" + hmQrcodeBO.getName() + "】"); String logContent = "【" + hmId + "-" + hmQrcodeBO.getName() + "】";
if (invokingType != 1) {
logContent = logContent + "——" + ChannelCodeEnum.getNameByCode(invokingType);
}
GicLogRecordEvaluationContext.putAttribute("logContent", logContent);
hmQrcodeService.deleteById(hmId);
return ServiceResponse.success(); return ServiceResponse.success();
} }
@Override @Override
public ServiceResponse delByClerkId(String clerkId, String enterpriseId, String wxEnterpriseId) { public ServiceResponse delByClerkId(String clerkId, String enterpriseId, String wxEnterpriseId, Integer invokingType) {
// 单人活码 直接废弃,多人活码,更新 // 单人活码 直接废弃,多人活码,更新
HmQrcodeBO hmQrcodeBO = hmQrcodeService.queryByClerkId(clerkId, wxEnterpriseId); HmQrcodeBO hmQrcodeBO = hmQrcodeService.queryByClerkId(clerkId, wxEnterpriseId);
if (hmQrcodeBO != null) { if (hmQrcodeBO != null) {
delById(hmQrcodeBO.getHmId()); delById(hmQrcodeBO.getHmId(), invokingType);
} }
// 多人活码逻辑 // 多人活码逻辑
...@@ -565,32 +626,41 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService { ...@@ -565,32 +626,41 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
logger.info("无多人活码"); logger.info("无多人活码");
return ServiceResponse.success(); return ServiceResponse.success();
} }
for (HmClerkRelationBO hmClerkRelationBO : hmClerkRelationBOS) { for (HmClerkRelationBO hmClerkRelationBO : hmClerkRelationBOS) {
Long hmId = hmClerkRelationBO.getHmId(); Long hmId = hmClerkRelationBO.getHmId();
List<String> clerkIds = hmClerkRelationService.getClerkIdByHmId(hmId); List<String> clerkIds = hmClerkRelationService.getClerkIdByHmId(hmId);
hmClerkRelationService.updateStatusById(0, hmClerkRelationBO.getRelationId());
hmClerkRelationService.updateStatusById(0,hmClerkRelationBO.getRelationId());
clerkIds.remove(clerkId); clerkIds.remove(clerkId);
// 更新活码 if (CollectionUtils.isNotEmpty(clerkIds)) {
HmQrcodeQDTO hmQrcodeQDTO = new HmQrcodeQDTO(); // 更新活码
hmQrcodeQDTO.setHmId(hmId); HmQrcodeQDTO hmQrcodeQDTO = new HmQrcodeQDTO();
hmQrcodeQDTO.setClerkIdList(clerkIds); hmQrcodeQDTO.setHmId(hmId);
update(hmQrcodeQDTO); hmQrcodeQDTO.setClerkIdList(clerkIds);
update(hmQrcodeQDTO);
} else {
delById(hmId, invokingType);
}
} }
return ServiceResponse.success(); return ServiceResponse.success();
} }
@Override @Override
public int updateAddNumById(Long hmId, String clerkId) { public int updateAddNumById(Long hmId, String clerkId) {
StaffClerkRelationDTO staffClerkRelationDTO = staffClerkRelationService.getByClerkId(clerkId);
if (staffClerkRelationDTO == null) {
logger.error("未绑定好办:{}",clerkId);
return 0;
}
HmQrcodeBO hmQrcodeBO = hmQrcodeService.queryById(hmId); HmQrcodeBO hmQrcodeBO = hmQrcodeService.queryById(hmId);
if (hmQrcodeBO == null) { if (hmQrcodeBO == null) {
logger.error("无活码数据"); logger.error("无活码数据");
return 0; return 0;
} }
TabHaobanStaff tabHaobanStaff = staffService.selectById(staffClerkRelationDTO.getStaffId());
Integer addNum = tabHaobanStaff.getAddNum();
Integer hmType = hmQrcodeBO.getHmType(); Integer hmType = hmQrcodeBO.getHmType();
int limit = QwFriendLimitCountUtil.getLimit(true); int limit = QwFriendLimitCountUtil.getLimit(true);
Integer addNum = hmQrcodeBO.getAddNum();
if (hmType == 1) { if (hmType == 1) {
//单人活码 //单人活码
Integer overFlag = 0; Integer overFlag = 0;
...@@ -620,6 +690,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService { ...@@ -620,6 +690,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
logger.info("重置上限时间定时任务 start"); logger.info("重置上限时间定时任务 start");
hmQrcodeService.resetAddNumAndOverFlag(); hmQrcodeService.resetAddNumAndOverFlag();
hmClerkRelationService.resetAddNumAndOverFlag(); hmClerkRelationService.resetAddNumAndOverFlag();
staffService.resetAddNum();
logger.info("重置上限时间定时任务 end"); logger.info("重置上限时间定时任务 end");
} }
...@@ -716,26 +787,26 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService { ...@@ -716,26 +787,26 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
} }
@Override @Override
public List<HmQrcodeStoreDTO> getHmStoreByEnterpriseId(String enterpriseId) { public List<HmQrcodeStoreDTO> getHmStoreByEnterpriseId(String wxEnterpriseId, String enterpriseId) {
String key = "HM:STORE:" + enterpriseId; String key = "HM:STORE:" + enterpriseId + wxEnterpriseId;
Object cache = RedisUtil.getCache(key); Object cache = RedisUtil.getCache(key);
if (cache != null) { if (cache != null) {
return (List<HmQrcodeStoreDTO>) cache; return (List<HmQrcodeStoreDTO>) cache;
} }
List<HmQrcodeStoreDTO> hmQrcodeStoreDTOS = EntityUtil.changeEntityListNew(HmQrcodeStoreDTO.class, hmQrcodeService.getHmStoreByEnterpriseId(enterpriseId)); List<HmQrcodeStoreDTO> hmQrcodeStoreDTOS = EntityUtil.changeEntityListNew(HmQrcodeStoreDTO.class, hmQrcodeService.getHmStoreByEnterpriseId(wxEnterpriseId, enterpriseId));
RedisUtil.setCache(key, hmQrcodeStoreDTOS, 10L, TimeUnit.MINUTES); RedisUtil.setCache(key, hmQrcodeStoreDTOS, 5L, TimeUnit.MINUTES);
return hmQrcodeStoreDTOS; return hmQrcodeStoreDTOS;
} }
@Override @Override
public List<String> getHmStoreForWxa(String enterpriseId) { public List<String> getHmStoreForWxa(String wxEnterpriseId, String enterpriseId) {
String key = "HM:STORE:WXA" + enterpriseId; String key = "HM:STORE:WXA" + enterpriseId + wxEnterpriseId;
Object cache = RedisUtil.getCache(key); Object cache = RedisUtil.getCache(key);
if (cache != null) { if (cache != null) {
return (List<String>) cache; return (List<String>) cache;
} }
List<String> list = hmQrcodeService.getHmStoreForWxa(enterpriseId); List<String> list = hmQrcodeService.getHmStoreForWxa(wxEnterpriseId, enterpriseId);
RedisUtil.setCache(key, list, 10L, TimeUnit.MINUTES); RedisUtil.setCache(key, list, 5L, TimeUnit.MINUTES);
return list; return list;
} }
...@@ -781,9 +852,9 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService { ...@@ -781,9 +852,9 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
public ServiceResponse<List<String>> listHmIdForIndex(HmQrcodeListQDTO qdto) { public ServiceResponse<List<String>> listHmIdForIndex(HmQrcodeListQDTO qdto) {
return ServiceResponse.success(hmQrcodeService.listHmIdForIndex(qdto)); return ServiceResponse.success(hmQrcodeService.listHmIdForIndex(qdto));
} }
@Override @Override
public ServiceResponse<List<String>> listHasQrcodeClerk(String enterpriseId, List<String> clerkIdList) { public ServiceResponse<List<String>> listHasQrcodeClerk(String enterpriseId, List<String> clerkIdList) {
return ServiceResponse.success(hmQrcodeService.listHasQrcodeClerk(enterpriseId,clerkIdList)); return ServiceResponse.success(hmQrcodeService.listHasQrcodeClerk(enterpriseId, clerkIdList));
} }
} }
package com.gic.haoban.manage.service.task; package com.gic.haoban.manage.service.task;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
...@@ -9,28 +19,25 @@ import com.gic.haoban.manage.api.dto.DealParamMqDTO; ...@@ -9,28 +19,25 @@ import com.gic.haoban.manage.api.dto.DealParamMqDTO;
import com.gic.haoban.manage.api.dto.DepartmentDTO; import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.api.dto.SecretSettingDTO; import com.gic.haoban.manage.api.dto.SecretSettingDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO; import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO;
import com.gic.haoban.manage.api.enums.PreDealStatusEnum; import com.gic.haoban.manage.api.enums.PreDealStatusEnum;
import com.gic.haoban.manage.api.enums.PreDealTypeEnum; import com.gic.haoban.manage.api.enums.PreDealTypeEnum;
import com.gic.haoban.manage.api.enums.SecretTypeEnum; import com.gic.haoban.manage.api.enums.SecretTypeEnum;
import com.gic.haoban.manage.api.enums.SyncTaskStatusEnum; import com.gic.haoban.manage.api.enums.SyncTaskStatusEnum;
import com.gic.haoban.manage.service.config.Config;
import com.gic.haoban.manage.service.entity.TabHaobanDepartment; import com.gic.haoban.manage.service.entity.TabHaobanDepartment;
import com.gic.haoban.manage.service.entity.TabHaobanPreDealLog; import com.gic.haoban.manage.service.entity.TabHaobanPreDealLog;
import com.gic.haoban.manage.service.entity.TabHaobanSyncTask; import com.gic.haoban.manage.service.entity.TabHaobanSyncTask;
import com.gic.haoban.manage.service.service.*; import com.gic.haoban.manage.service.service.DepartmentService;
import com.gic.haoban.manage.service.service.PreDealService;
import com.gic.haoban.manage.service.service.SecretSettingService;
import com.gic.haoban.manage.service.service.SyncTaskService;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.manage.service.util.EmojiFilterUtil; import com.gic.haoban.manage.service.util.EmojiFilterUtil;
import com.gic.mq.sdk.GicMQClient; import com.gic.mq.sdk.GicMQClient;
import com.gic.redis.data.util.RedisUtil; import com.gic.redis.data.util.RedisUtil;
import com.gic.wechat.api.dto.qywx.UserDTO; import com.gic.wechat.api.dto.qywx.UserDTO;
import com.gic.wechat.api.service.qywx.QywxUserApiService; import com.gic.wechat.api.service.qywx.QywxUserApiService;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/** /**
* 同步通讯录部门 * 同步通讯录部门
...@@ -44,24 +51,20 @@ public class QywxDeptSyncOperation implements BaseSyncOperation { ...@@ -44,24 +51,20 @@ public class QywxDeptSyncOperation implements BaseSyncOperation {
@Autowired @Autowired
private DepartmentService departmentService; private DepartmentService departmentService;
@Autowired @Autowired
private PreDealService preDealService; private PreDealService preDealService;
@Autowired @Autowired
private SyncTaskService syncTaskService; private SyncTaskService syncTaskService;
@Autowired @Autowired
private QywxUserApiService qywxUserApiService; private QywxUserApiService qywxUserApiService;
@Autowired @Autowired
private WxEnterpriseService wxEnterpriseService; private WxEnterpriseService wxEnterpriseService;
@Autowired @Autowired
private QywxStaffSyncOperation qywxClerkSyncOperation; private QywxStaffSyncOperation qywxClerkSyncOperation;
@Autowired @Autowired
private SecretSettingService secretSettingService; private SecretSettingService secretSettingService;
@Autowired
private Config config;
@Override @Override
public void dealSingleByMq(DealParamMqDTO dealParamMqDTO, TabHaobanPreDealLog dataPre) { public void dealSingleByMq(DealParamMqDTO dealParamMqDTO, TabHaobanPreDealLog dataPre) {
...@@ -168,12 +171,20 @@ public class QywxDeptSyncOperation implements BaseSyncOperation { ...@@ -168,12 +171,20 @@ public class QywxDeptSyncOperation implements BaseSyncOperation {
String pDataId = preData.getpDataId(); String pDataId = preData.getpDataId();
if ("0".equals(pDataId)) { if ("0".equals(pDataId)) {
//根级部门 //根级部门
List<UserDTO> list = this.qywxUserApiService.listSelfDepartmentUser(wxEnterpriseDTO.getCorpid(), secretSetting.getSecretVal(), dataId, 1); List<UserDTO> list = null ;
WxEnterpriseQwDTO wxInfo = this.wxEnterpriseService.getQwInfo(wxEnterpriseId) ;
if(wxInfo.getWxSecurityType()==4) {
list = this.qywxUserApiService.listDepartmentUser(wxEnterpriseDTO.getCorpid(), config.getWxSuiteid(), dataId, 1) ;
logger.info("通讯录(第三方)={}",JSON.toJSONString(list)) ;
}else {
list = this.qywxUserApiService.listSelfDepartmentUser(wxEnterpriseDTO.getCorpid(), secretSetting.getSecretVal(), dataId, 1);
logger.info("通讯录(代开)={}",JSON.toJSONString(list)) ;
}
if (null == list) { if (null == list) {
logger.info("微信获取部门成员异常:{},{}", taskId, dataId); logger.info("微信获取部门成员异常:{},{}", taskId, dataId);
return; return;
} }
logger.info("是否已经进来了,进来"); logger.info("获取部门列表");
//预处理门店 写入预处理表 //预处理门店 写入预处理表
if (CollectionUtils.isNotEmpty(list)) { if (CollectionUtils.isNotEmpty(list)) {
List<String> dataList = preDealService.listDataIdByTaskIdAndDataType(taskId, PreDealTypeEnum.clerk.getVal()); List<String> dataList = preDealService.listDataIdByTaskIdAndDataType(taskId, PreDealTypeEnum.clerk.getVal());
......
...@@ -57,11 +57,7 @@ public class QywxStaffSyncOperation implements BaseSyncOperation { ...@@ -57,11 +57,7 @@ public class QywxStaffSyncOperation implements BaseSyncOperation {
@Autowired @Autowired
private WxEnterpriseApiService wxEnterpriseApiService; private WxEnterpriseApiService wxEnterpriseApiService;
@Autowired @Autowired
private WxApplicationMapper wxApplicationMapper;
@Autowired
private Config config; private Config config;
@Autowired
private SecretSettingService secretSettingService;
@Override @Override
public void dealSingleByMq(DealParamMqDTO dealParamMqDTO, TabHaobanPreDealLog dataPre) { public void dealSingleByMq(DealParamMqDTO dealParamMqDTO, TabHaobanPreDealLog dataPre) {
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
<constructor-arg index="0" value="haoban-manage-service"/> <constructor-arg index="0" value="haoban-manage-service"/>
</bean> </bean>
<dubbo:service interface="com.gic.haoban.manage.api.service.HaobanCommonMQApiService" ref="haobanCommonMQApiService" timeout="10000"/>
<dubbo:service interface="com.gic.haoban.manage.api.service.hm.WxUserAddLogApiService" ref="wxUserAddLogApiService" timeout="10000"/> <dubbo:service interface="com.gic.haoban.manage.api.service.hm.WxUserAddLogApiService" ref="wxUserAddLogApiService" timeout="10000"/>
<dubbo:service interface="com.gic.haoban.manage.api.service.KeyDataApiService" ref="keyDataApiService" timeout="10000"/> <dubbo:service interface="com.gic.haoban.manage.api.service.KeyDataApiService" ref="keyDataApiService" timeout="10000"/>
<dubbo:service interface="com.gic.haoban.manage.api.service.hm.HmLinkApiService" ref="hmLinkApiService" timeout="10000"/> <dubbo:service interface="com.gic.haoban.manage.api.service.hm.HmLinkApiService" ref="hmLinkApiService" timeout="10000"/>
......
...@@ -23,14 +23,14 @@ ...@@ -23,14 +23,14 @@
<result column="wx_open_user_id" property="wxOpenUseId" jdbcType="VARCHAR"/> <result column="wx_open_user_id" property="wxOpenUseId" jdbcType="VARCHAR"/>
<result column="wx_open_id" property="wxOpenId" jdbcType="VARCHAR"/> <result column="wx_open_id" property="wxOpenId" jdbcType="VARCHAR"/>
<result column="qr_code" property="qrCode" jdbcType="VARCHAR"/> <result column="qr_code" property="qrCode" jdbcType="VARCHAR"/>
<result column="add_num" property="addNum" jdbcType="INTEGER"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
staff_id staff_id
, wx_user_id, phone_number, staff_name, nation_code, nick_name, sex, postion, , wx_user_id, phone_number, staff_name, nation_code, nick_name, sex, postion,
active_flag, extend_postion, status_flag, create_time, update_time,wx_enterprise_id,head_img, active_flag, extend_postion, status_flag, create_time, update_time,wx_enterprise_id,head_img,
sort,sync_postion_flag,super_manager_flag,wx_open_user_id,wx_open_id,qr_code sort,sync_postion_flag,super_manager_flag,wx_open_user_id,wx_open_id,qr_code,add_num
</sql> </sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String"> <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String">
select select
...@@ -120,6 +120,9 @@ ...@@ -120,6 +120,9 @@
<if test="qrCode != null"> <if test="qrCode != null">
qr_code, qr_code,
</if> </if>
<if test="addNum != null">
add_num,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="staffId != null"> <if test="staffId != null">
...@@ -183,7 +186,10 @@ ...@@ -183,7 +186,10 @@
#{wxOpenId}, #{wxOpenId},
</if> </if>
<if test="qrCode != null"> <if test="qrCode != null">
#{qrCode} #{qrCode},
</if>
<if test="addNum != null">
#{addNum}
</if> </if>
</trim> </trim>
</insert> </insert>
...@@ -250,6 +256,9 @@ ...@@ -250,6 +256,9 @@
<if test="qrCode != null"> <if test="qrCode != null">
qr_code = #{qrCode} qr_code = #{qrCode}
</if> </if>
<if test="addNum != null">
add_num = #{addNum}
</if>
</set> </set>
where staff_id = #{staffId,jdbcType=VARCHAR} where staff_id = #{staffId,jdbcType=VARCHAR}
</update> </update>
...@@ -532,4 +541,20 @@ ...@@ -532,4 +541,20 @@
and wx_open_user_id = #{wxOpenUseId} and wx_open_user_id = #{wxOpenUseId}
</update> </update>
<update id="updateAddNumById" parameterType="java.lang.String">
update tab_haoban_staff
set add_num = add_num +1,
update_time = now()
where staff_id = #{staffId}
</update>
<update id="resetAddNum">
update tab_haoban_staff
<set>
add_num = 0,update_time = now()
</set>
</update>
</mapper> </mapper>
\ No newline at end of file
...@@ -197,5 +197,10 @@ ...@@ -197,5 +197,10 @@
where wx_application_id = #{wxApplicationId} where wx_application_id = #{wxApplicationId}
and status_flag = 1 and status_flag = 1
</update> </update>
<select id="listApplication" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/> from
tab_haoban_wx_application where wx_enterprise_id = #{wxEnterpriseId} and status_flag = 1
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
<result column="agree_external_userid_time" property="agreeExternalUseridTime" jdbcType="TIMESTAMP"/> <result column="agree_external_userid_time" property="agreeExternalUseridTime" jdbcType="TIMESTAMP"/>
<result column="external_flag" property="externalFlag" jdbcType="INTEGER"/> <result column="external_flag" property="externalFlag" jdbcType="INTEGER"/>
<result column="userid_flag" property="useridFlag" jdbcType="INTEGER"/> <result column="userid_flag" property="useridFlag" jdbcType="INTEGER"/>
<result column="wx_security_type" property="wxSecurityType"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
...@@ -47,7 +48,7 @@ ...@@ -47,7 +48,7 @@
corp_user_max, corp_full_name, subject_type, verified_end_time, corp_wxqrcode, corp_scale, corp_user_max, corp_full_name, subject_type, verified_end_time, corp_wxqrcode, corp_scale,
corp_industry, corp_sub_industry, location, auth_info, agent, agentid, appid, name, corp_industry, corp_sub_industry, location, auth_info, agent, agentid, appid, name,
square_logo_url, round_logo_url, level, bind_flag, status_flag, create_time, update_time,contact_flag,wx_secret_key,wx_secret_key_last_time,member_secret_last_time,contact_secret_last_time square_logo_url, round_logo_url, level, bind_flag, status_flag, create_time, update_time,contact_flag,wx_secret_key,wx_secret_key_last_time,member_secret_last_time,contact_secret_last_time
,member_secret,contact_secret,agree_external_userid_flag,agree_external_userid_time,external_flag,userid_flag ,member_secret,contact_secret,agree_external_userid_flag,agree_external_userid_time,external_flag,userid_flag ,wx_security_type
</sql> </sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String"> <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String">
select select
......
...@@ -126,7 +126,7 @@ ...@@ -126,7 +126,7 @@
<if test="null != linkType"> <if test="null != linkType">
and link_type = #{linkType} and link_type = #{linkType}
</if> </if>
and status_flag = 1 and status_flag = 1 order by create_time desc
limit 20 limit 20
</select> </select>
...@@ -144,7 +144,7 @@ ...@@ -144,7 +144,7 @@
<if test="null != linkType"> <if test="null != linkType">
and link_type = #{linkType} and link_type = #{linkType}
</if> </if>
and status_flag = 1 and status_flag = 1 order by create_time desc
</select> </select>
<select id="queryPageRelationList" resultMap="result-map-tabHaobanHmLink"> <select id="queryPageRelationList" resultMap="result-map-tabHaobanHmLink">
......
...@@ -131,7 +131,7 @@ ...@@ -131,7 +131,7 @@
select <include refid="Base_Column_List"></include> select <include refid="Base_Column_List"></include>
from tab_haoban_hm_clerk_relation from tab_haoban_hm_clerk_relation
where clerk_id = #{clerkId} where clerk_id = #{clerkId}
and hm_id = #{hmId} and hm_id = #{hmId} and status = 1
limit 1 limit 1
</select> </select>
...@@ -166,7 +166,7 @@ ...@@ -166,7 +166,7 @@
<select id="getNumByHmId" resultType="string"> <select id="getNumByHmId" resultType="string">
select clerk_id select clerk_id
from tab_haoban_hm_clerk_relation from tab_haoban_hm_clerk_relation
where hm_id = #{hmId} where hm_id = #{hmId} and status = 1
</select> </select>
...@@ -190,5 +190,15 @@ ...@@ -190,5 +190,15 @@
where relation_id = #{relationId} where relation_id = #{relationId}
</update> </update>
<select id="queryByHmIdNotInClerkIds" resultMap="TabHaobanHmClerkRelationMap">
select <include refid="Base_Column_List"></include>
from tab_haoban_hm_clerk_relation
where hm_id = #{hmId} and status = 1
and clerk_id not in
<foreach item="id" index="index" collection="clerkIds" open="(" separator="," close=")">
#{id}
</foreach>
</select>
</mapper> </mapper>
...@@ -315,15 +315,23 @@ ...@@ -315,15 +315,23 @@
select store_id storeId, select store_id storeId,
MIN(over_flag) overFlag MIN(over_flag) overFlag
from tab_haoban_hm_qrcode from tab_haoban_hm_qrcode
where enterprise_id = #{enterpriseId} and status_flag = 1 where 1
<if test="null != wxEnterpriseId">
and wx_enterprise_id = #{wxEnterpriseId}
</if>
and enterprise_id = #{enterpriseId} and status_flag = 1
and store_id is not null and store_id is not null
GROUP BY store_id GROUP BY store_id
</select> </select>
<select id="getHmStoreForWxa" resultType="String"> <select id="getHmStoreForWxa" resultType="String">
select distinct(store_id) select distinct(store_id)
from tab_haoban_hm_qrcode from tab_haoban_hm_qrcode
where enterprise_id = #{enterpriseId} and status_flag = 1 and over_flag = 0 and store_id is not null where 1
<if test="null != wxEnterpriseId">
and wx_enterprise_id = #{wxEnterpriseId}
</if>
and enterprise_id = #{enterpriseId} and status_flag = 1 and over_flag = 0 and store_id is not null
</select> </select>
<select id="listHmIdForIndex" resultType="String" parameterType="com.gic.haoban.manage.api.dto.qdto.hm.HmQrcodeListQDTO"> <select id="listHmIdForIndex" resultType="String" parameterType="com.gic.haoban.manage.api.dto.qdto.hm.HmQrcodeListQDTO">
...@@ -334,7 +342,7 @@ ...@@ -334,7 +342,7 @@
and a.wx_enterprise_id = #{wxEnterpriseId} and a.wx_enterprise_id = #{wxEnterpriseId}
</if> </if>
<if test="null != hmSelect and '' != hmSelect "> <if test="null != hmSelect and '' != hmSelect ">
and (a.hm_code=#{hmSelect} or a.name like '%${hmSelect}%' or a.creator_name like '%${hmSelect}%' ) and (a.hm_id=#{hmSelect} or a.hm_code=#{hmSelect} or a.name like '%${hmSelect}%' or a.creator_name like '%${hmSelect}%' )
</if> </if>
<if test="null != clerkSelect and '' != clerkSelect"> <if test="null != clerkSelect and '' != clerkSelect">
and ( a.clerk_id = #{clerkSelect} or b.clerk_id = #{clerkSelect} ) and ( a.clerk_id = #{clerkSelect} or b.clerk_id = #{clerkSelect} )
...@@ -425,7 +433,10 @@ ...@@ -425,7 +433,10 @@
</select> </select>
<select id="listCanAddClerk" resultType="com.gic.haoban.manage.service.pojo.bo.hm.HmQrcodeClerkBO"> <select id="listCanAddClerk" resultType="com.gic.haoban.manage.service.pojo.bo.hm.HmQrcodeClerkBO">
select a.clerk_id , a.store_id , a.staff_id from select a.clerk_id clerkId,
a.store_id storeId,
a.staff_id staffId
from
<include refid="canAddClerkSql" /> <include refid="canAddClerkSql" />
</select> </select>
......
...@@ -208,6 +208,6 @@ ...@@ -208,6 +208,6 @@
<if test="null != addChannel"> <if test="null != addChannel">
and add_channel = #{addChannel} and add_channel = #{addChannel}
</if> </if>
and status_flag != 0 order by #{createTimeOrder} and status_flag = #{statusFlag} order by create_time ${createTimeOrder}
</select> </select>
</mapper> </mapper>
\ No newline at end of file
package com.gic.haoban.manage.web.controller; package com.gic.haoban.manage.web.controller;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.redisson.api.RRateLimiter;
import org.redisson.api.RateIntervalUnit;
import org.redisson.api.RateType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.ctrip.framework.apollo.ConfigService;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.commons.util.HttpClient;
import com.gic.haoban.base.api.common.BasePageInfo; import com.gic.haoban.base.api.common.BasePageInfo;
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.MaidianLogDTO;
import com.gic.haoban.manage.api.service.*; import com.gic.haoban.manage.api.dto.QywxCorpInfoSimpleDTO;
import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.dto.WxApplicationDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.service.MaidianLogApiService;
import com.gic.haoban.manage.api.service.MemberUnionidRelatedApiService;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.TestApiService;
import com.gic.haoban.manage.api.service.WxApplicationApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService;
import com.gic.haoban.manage.api.service.hm.HmQrcodeApiService; import com.gic.haoban.manage.api.service.hm.HmQrcodeApiService;
import com.gic.haoban.manage.web.config.Config; import com.gic.haoban.manage.web.config.Config;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode; import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
...@@ -15,28 +49,9 @@ import com.gic.redis.data.util.GicRateLimiter; ...@@ -15,28 +49,9 @@ import com.gic.redis.data.util.GicRateLimiter;
import com.gic.redis.data.util.RedisUtil; import com.gic.redis.data.util.RedisUtil;
import com.gic.wechat.api.dto.qywx.QywxNewUseridDTO; import com.gic.wechat.api.dto.qywx.QywxNewUseridDTO;
import com.gic.wechat.api.dto.qywx.QywxXcxSendMessageDTO; import com.gic.wechat.api.dto.qywx.QywxXcxSendMessageDTO;
import com.gic.wechat.api.service.qywx.QywxCorpApiService;
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 org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.redisson.api.RRateLimiter;
import org.redisson.api.RateIntervalUnit;
import org.redisson.api.RateType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/** /**
* Created 2020/4/9. * Created 2020/4/9.
...@@ -54,19 +69,14 @@ public class TestController extends WebBaseController { ...@@ -54,19 +69,14 @@ public class TestController extends WebBaseController {
@Autowired @Autowired
private QywxSuiteApiService qywxSuiteApiService; private QywxSuiteApiService qywxSuiteApiService;
@Autowired @Autowired
private MemberUnionidRelatedApiService memberUnionidRelatedApiService; private MemberUnionidRelatedApiService memberUnionidRelatedApiService;
@Autowired @Autowired
private TestApiService testApiService; private TestApiService testApiService;
@Autowired @Autowired
private MaidianLogApiService maidianLogApiService; private MaidianLogApiService maidianLogApiService;
@Autowired @Autowired
private WxEnterpriseRelatedApiService wxEnterpriseRelatedApiService; private WxEnterpriseRelatedApiService wxEnterpriseRelatedApiService;
@Autowired @Autowired
private WxEnterpriseApiService wxEnterpriseApiService; private WxEnterpriseApiService wxEnterpriseApiService;
@Autowired @Autowired
...@@ -79,6 +89,10 @@ public class TestController extends WebBaseController { ...@@ -79,6 +89,10 @@ public class TestController extends WebBaseController {
private Config config; private Config config;
@Autowired @Autowired
private HmQrcodeApiService hmQrcodeApiService; private HmQrcodeApiService hmQrcodeApiService;
@Autowired
private QywxCorpApiService qywxCorpApiService;
@RequestMapping("/send-message-test") @RequestMapping("/send-message-test")
public HaobanResponse testSendMessage(QywxXcxSendMessageQo qo) { public HaobanResponse testSendMessage(QywxXcxSendMessageQo qo) {
...@@ -326,4 +340,91 @@ public class TestController extends WebBaseController { ...@@ -326,4 +340,91 @@ public class TestController extends WebBaseController {
hmQrcodeApiService.checkStaffOpenContactByWxEnterpriseId(wxEnterpriseId); hmQrcodeApiService.checkStaffOpenContactByWxEnterpriseId(wxEnterpriseId);
return resultResponse(HaoBanErrCode.ERR_1); return resultResponse(HaoBanErrCode.ERR_1);
} }
@RequestMapping("test-qw-post-fws")
public HaobanResponse testQwPost(String url , String corpid , String json) {
if(isProd()) {
return null ;
}
String token = qywxCorpApiService.getProviderAccessToken(corpid) ;
logger.info("toekn={},corpId={} , url={} , json={}",token, corpid ,(url + token) , json);
Map<String, Object> map = HttpClient.getWinxinResByJson(url + token ,json);
return resultResponse(HaoBanErrCode.ERR_0, map) ;
}
@RequestMapping("test-qw-get-fws")
public HaobanResponse testQwGet(String url , String corpId) {
if(isProd()) {
return null ;
}
String token =qywxCorpApiService.getProviderAccessToken(corpId) ;
logger.info("toekn={},appid={} , url={} , json={}",token,corpId ,(url + token));
Map<String, Object> map = HttpClient.getHttpByGet(url + token);
return resultResponse(HaoBanErrCode.ERR_0, map) ;
}
@RequestMapping("test-qw-post-3")
public HaobanResponse testQwPost3(String url , String corpid , String json) {
if(isProd()) {
return null ;
}
String token = qywxCorpApiService.getCorpAccessToken(corpid,config.getWxSuiteid()) ;
logger.info("toekn={},corpId={} , url={} , json={}",token, corpid ,(url + token) , json);
Map<String, Object> map = HttpClient.getWinxinResByJson(url + token ,json);
return resultResponse(HaoBanErrCode.ERR_0, map) ;
}
@RequestMapping("test-qw-token")
public HaobanResponse testQwPost3(String corpid , String secret) {
if(StringUtils.isBlank(secret)) {
String token = qywxCorpApiService.getCorpAccessToken(corpid,config.getWxSuiteid()) ;
return resultResponse(HaoBanErrCode.ERR_0, token) ;
}else {
String token = qywxCorpApiService.getToken(corpid, secret) ;
return resultResponse(HaoBanErrCode.ERR_0, token) ;
}
}
@RequestMapping("test-qw-get-3")
public HaobanResponse testQwGet3(String url , String corpid) {
if(isProd()) {
return null ;
}
String token = qywxCorpApiService.getCorpAccessToken(corpid,config.getWxSuiteid()) ;
logger.info("toekn={},appid={} , url={} , json={}",token,corpid ,(url + token));
Map<String, Object> map = HttpClient.getHttpByGet(url + token);
return resultResponse(HaoBanErrCode.ERR_0, map) ;
}
@RequestMapping("test-qw-post-dk")
public HaobanResponse testQwPostdk(String url , String corpid , String secret, String json) {
if(isProd()) {
return null ;
}
String token = qywxCorpApiService.getToken(corpid, secret) ;
logger.info("toekn={},corpId={} , url={} , json={}",token, corpid ,(url + token) , json);
Map<String, Object> map = HttpClient.getWinxinResByJson(url + token ,json);
return resultResponse(HaoBanErrCode.ERR_0, map) ;
}
@RequestMapping("test-qw-get-dk")
public HaobanResponse testQwGetdk(String url , String corpid , String secret) {
if(isProd()) {
return null ;
}
String token = qywxCorpApiService.getToken(corpid, secret) ;
logger.info("toekn={},appid={} , url={} , json={}",token,corpid ,(url + token));
Map<String, Object> map = HttpClient.getHttpByGet(url + token);
return resultResponse(HaoBanErrCode.ERR_0, map) ;
}
private boolean isProd() {
com.ctrip.framework.apollo.Config config = ConfigService.getConfig("COMMON.gic-properties");
String env = config.getProperty("environment.value", "");
boolean isProd = "prod".equals(env);
return isProd ;
}
} }
...@@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import cn.hutool.core.convert.Convert;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.BasePageInfo; import com.gic.api.base.commons.BasePageInfo;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
...@@ -24,18 +25,14 @@ import com.gic.commons.webapi.reponse.RestResponse; ...@@ -24,18 +25,14 @@ import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO; import com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO;
import com.gic.haoban.common.utils.AuthWebRequestUtil; import com.gic.haoban.common.utils.AuthWebRequestUtil;
import com.gic.haoban.manage.api.constants.StatisticsApolloKeyConstant; import com.gic.haoban.manage.api.constants.StatisticsApolloKeyConstant;
import com.gic.haoban.manage.api.dto.hm.HmClerkDTO; import com.gic.haoban.manage.api.dto.hm.*;
import com.gic.haoban.manage.api.dto.hm.HmClerkRelationDTO;
import com.gic.haoban.manage.api.dto.hm.HmQrcodeDTO;
import com.gic.haoban.manage.api.dto.hm.HmQrcodeListDTO;
import com.gic.haoban.manage.api.dto.hm.HmStoreDTO;
import com.gic.haoban.manage.api.dto.hm.WxUserAddLogDTO;
import com.gic.haoban.manage.api.dto.qdto.hm.HmQrcodeListQDTO; import com.gic.haoban.manage.api.dto.qdto.hm.HmQrcodeListQDTO;
import com.gic.haoban.manage.api.dto.qdto.hm.HmQrcodeQDTO; import com.gic.haoban.manage.api.dto.qdto.hm.HmQrcodeQDTO;
import com.gic.haoban.manage.api.dto.qdto.hm.WxUserAddLogSearchQDTO; import com.gic.haoban.manage.api.dto.qdto.hm.WxUserAddLogSearchQDTO;
import com.gic.haoban.manage.api.dto.statistics.StatisticsDTO; import com.gic.haoban.manage.api.dto.statistics.StatisticsDTO;
import com.gic.haoban.manage.api.service.StaffApiService; import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.StaffClerkRelationApiService; import com.gic.haoban.manage.api.service.StaffClerkRelationApiService;
import com.gic.haoban.manage.api.service.hm.HmGroupApiService;
import com.gic.haoban.manage.api.service.hm.HmQrcodeApiService; import com.gic.haoban.manage.api.service.hm.HmQrcodeApiService;
import com.gic.haoban.manage.api.service.hm.WxUserAddLogApiService; import com.gic.haoban.manage.api.service.hm.WxUserAddLogApiService;
import com.gic.haoban.manage.api.util.DataHttpUtil; import com.gic.haoban.manage.api.util.DataHttpUtil;
...@@ -48,8 +45,17 @@ import com.gic.haoban.manage.web.qo.hm.data.HmQrcodeListQO; ...@@ -48,8 +45,17 @@ import com.gic.haoban.manage.web.qo.hm.data.HmQrcodeListQO;
import com.gic.haoban.manage.web.qo.hm.data.HmTrendQO; import com.gic.haoban.manage.web.qo.hm.data.HmTrendQO;
import com.gic.haoban.manage.web.vo.hm.HmDetailClerkListVO; import com.gic.haoban.manage.web.vo.hm.HmDetailClerkListVO;
import com.gic.haoban.manage.web.vo.hm.HmTrendVO; import com.gic.haoban.manage.web.vo.hm.HmTrendVO;
import org.apache.commons.collections.CollectionUtils;
import org.apache.logging.log4j.LogManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import cn.hutool.core.convert.Convert; import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/** /**
* 活码(TabHaobanHmQrcode)表控制层 * 活码(TabHaobanHmQrcode)表控制层
...@@ -71,6 +77,8 @@ public class HmQrcodeController { ...@@ -71,6 +77,8 @@ public class HmQrcodeController {
private WxUserAddLogApiService wxUserAddLogApiService; private WxUserAddLogApiService wxUserAddLogApiService;
@Autowired @Autowired
private StaffClerkRelationApiService staffClerkRelationApiService; private StaffClerkRelationApiService staffClerkRelationApiService;
@Autowired
private HmGroupApiService hmGroupApiService;
/** /**
* 新增 * 新增
...@@ -87,6 +95,7 @@ public class HmQrcodeController { ...@@ -87,6 +95,7 @@ public class HmQrcodeController {
hmQrcodeQDTO.setModifierName(loginUser.getClerkName()); hmQrcodeQDTO.setModifierName(loginUser.getClerkName());
hmQrcodeQDTO.setWxEnterpriseId(loginUser.getWxEnterpriseId()); hmQrcodeQDTO.setWxEnterpriseId(loginUser.getWxEnterpriseId());
hmQrcodeQDTO.setEnterpriseId(loginUser.getEnterpriseId()); hmQrcodeQDTO.setEnterpriseId(loginUser.getEnterpriseId());
hmQrcodeQDTO.setInvokingType(1);
ServiceResponse serviceResponse = this.hmQrcodeApiService.add(hmQrcodeQDTO); ServiceResponse serviceResponse = this.hmQrcodeApiService.add(hmQrcodeQDTO);
if (!"0000".equals(serviceResponse.getCode())) { if (!"0000".equals(serviceResponse.getCode())) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_DEFINE.getCode()), serviceResponse.getMessage()); return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_DEFINE.getCode()), serviceResponse.getMessage());
...@@ -123,6 +132,7 @@ public class HmQrcodeController { ...@@ -123,6 +132,7 @@ public class HmQrcodeController {
hmQrcodeQDTO.setModifierName(loginUser.getClerkName()); hmQrcodeQDTO.setModifierName(loginUser.getClerkName());
hmQrcodeQDTO.setWxEnterpriseId(loginUser.getWxEnterpriseId()); hmQrcodeQDTO.setWxEnterpriseId(loginUser.getWxEnterpriseId());
hmQrcodeQDTO.setEnterpriseId(loginUser.getEnterpriseId()); hmQrcodeQDTO.setEnterpriseId(loginUser.getEnterpriseId());
hmQrcodeQDTO.setInvokingType(1);
ServiceResponse serviceResponse = this.hmQrcodeApiService.update(hmQrcodeQDTO); ServiceResponse serviceResponse = this.hmQrcodeApiService.update(hmQrcodeQDTO);
if (!"0000".equals(serviceResponse.getCode())) { if (!"0000".equals(serviceResponse.getCode())) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_DEFINE.getCode()), serviceResponse.getMessage()); return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_DEFINE.getCode()), serviceResponse.getMessage());
...@@ -145,12 +155,16 @@ public class HmQrcodeController { ...@@ -145,12 +155,16 @@ public class HmQrcodeController {
if (CollectionUtils.isEmpty(storeList)) { if (CollectionUtils.isEmpty(storeList)) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_100007.getCode()), HaoBanErrCode.ERR_100007.getMsg()); return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_100007.getCode()), HaoBanErrCode.ERR_100007.getMsg());
} }
if (!storeList.contains("-1")) { if (!storeList.contains("-1")) {
StringBuffer stringBuffer = new StringBuffer(); StringBuffer stringBuffer = new StringBuffer();
storeList.forEach(c -> stringBuffer.append(c).append(",")); storeList.forEach(c -> stringBuffer.append(c).append(","));
hmQrcodeListQO.getInFields().setStoreId(stringBuffer.toString()); hmQrcodeListQO.getInFields().setStoreId(stringBuffer.toString());
} }
Long hmGroupId = hmQrcodeListQO.getInFields().getHmGroupId();
//-1 代表全部分组
if (hmGroupId == -1) {
hmQrcodeListQO.getInFields().setHmGroupId(null);
}
HmQrcodeListQDTO qdto = EntityUtil.changeEntityByJSON(HmQrcodeListQDTO.class, hmQrcodeListQO.getInFields()); HmQrcodeListQDTO qdto = EntityUtil.changeEntityByJSON(HmQrcodeListQDTO.class, hmQrcodeListQO.getInFields());
if (!storeList.contains("-1")) { if (!storeList.contains("-1")) {
qdto.setStoreId(storeList); qdto.setStoreId(storeList);
...@@ -166,10 +180,10 @@ public class HmQrcodeController { ...@@ -166,10 +180,10 @@ public class HmQrcodeController {
hmQrcodeListQO.getInFields().setHmId(stringBuffer.toString()); hmQrcodeListQO.getInFields().setHmId(stringBuffer.toString());
StatisticsDTO statisticsDTO = DataHttpUtil.post(StatisticsApolloKeyConstant.data_haoban_hm_list, hmQrcodeListQO); StatisticsDTO statisticsDTO = DataHttpUtil.post(StatisticsApolloKeyConstant.data_haoban_hm_list, hmQrcodeListQO);
List<HmQrcodeListDTO> data = JSON.parseArray(JSON.toJSONString(statisticsDTO.getData()), HmQrcodeListDTO.class); List<HmQrcodeListDTO> data = JSON.parseArray(JSON.toJSONString(statisticsDTO.getData()), HmQrcodeListDTO.class);
List<HmStoreDTO> storeDTOList = new ArrayList<>();
List<HmClerkDTO> clerkDTOList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(data)) { if (CollectionUtils.isNotEmpty(data)) {
for (HmQrcodeListDTO hmQrcodeListDTO : data) { for (HmQrcodeListDTO hmQrcodeListDTO : data) {
List<HmStoreDTO> storeDTOList = new ArrayList<>();
List<HmClerkDTO> clerkDTOList = new ArrayList<>();
Long hmId = hmQrcodeListDTO.getHmId(); Long hmId = hmQrcodeListDTO.getHmId();
Integer hmType = hmQrcodeListDTO.getHmType(); Integer hmType = hmQrcodeListDTO.getHmType();
if (hmType == 1) { if (hmType == 1) {
...@@ -178,6 +192,7 @@ public class HmQrcodeController { ...@@ -178,6 +192,7 @@ public class HmQrcodeController {
clerkDTO.setClerkId(hmQrcodeListDTO.getClerkId()); clerkDTO.setClerkId(hmQrcodeListDTO.getClerkId());
clerkDTO.setClerkCode(hmQrcodeListDTO.getClerkCode()); clerkDTO.setClerkCode(hmQrcodeListDTO.getClerkCode());
clerkDTOList.add(clerkDTO); clerkDTOList.add(clerkDTO);
HmStoreDTO storeDTO = new HmStoreDTO(); HmStoreDTO storeDTO = new HmStoreDTO();
storeDTO.setStoreId(hmQrcodeListDTO.getStoreId()); storeDTO.setStoreId(hmQrcodeListDTO.getStoreId());
storeDTO.setStoreName(hmQrcodeListDTO.getStoreName()); storeDTO.setStoreName(hmQrcodeListDTO.getStoreName());
...@@ -186,7 +201,7 @@ public class HmQrcodeController { ...@@ -186,7 +201,7 @@ public class HmQrcodeController {
} else if (hmType == 2) { } else if (hmType == 2) {
BasePageInfo basePageInfo = new BasePageInfo(); BasePageInfo basePageInfo = new BasePageInfo();
basePageInfo.setPageNum(1); basePageInfo.setPageNum(1);
basePageInfo.setPageNum(1000); basePageInfo.setPageSize(1000);
Page<HmClerkRelationDTO> hmClerkByHmId = hmQrcodeApiService.getHmClerkByHmId(basePageInfo, hmId); Page<HmClerkRelationDTO> hmClerkByHmId = hmQrcodeApiService.getHmClerkByHmId(basePageInfo, hmId);
List<HmClerkRelationDTO> hmClerkRelationDTOList = hmClerkByHmId.getResult(); List<HmClerkRelationDTO> hmClerkRelationDTOList = hmClerkByHmId.getResult();
if (CollectionUtils.isNotEmpty(hmClerkRelationDTOList)) { if (CollectionUtils.isNotEmpty(hmClerkRelationDTOList)) {
...@@ -196,6 +211,7 @@ public class HmQrcodeController { ...@@ -196,6 +211,7 @@ public class HmQrcodeController {
clerkDTO.setClerkId(hmClerkRelationDTO.getClerkId()); clerkDTO.setClerkId(hmClerkRelationDTO.getClerkId());
clerkDTO.setClerkCode(hmClerkRelationDTO.getClerkCode()); clerkDTO.setClerkCode(hmClerkRelationDTO.getClerkCode());
clerkDTOList.add(clerkDTO); clerkDTOList.add(clerkDTO);
HmStoreDTO storeDTO = new HmStoreDTO(); HmStoreDTO storeDTO = new HmStoreDTO();
storeDTO.setStoreId(hmClerkRelationDTO.getStoreId()); storeDTO.setStoreId(hmClerkRelationDTO.getStoreId());
storeDTO.setStoreName(hmClerkRelationDTO.getStoreName()); storeDTO.setStoreName(hmClerkRelationDTO.getStoreName());
...@@ -204,9 +220,21 @@ public class HmQrcodeController { ...@@ -204,9 +220,21 @@ public class HmQrcodeController {
} }
} }
} }
ServiceResponse<HmGroupDTO> hmGroupDTOServiceResponse = hmGroupApiService.queryGroupDetail(hmQrcodeListDTO.getHmGroupId());
HmGroupDTO hmGroupDTO = hmGroupDTOServiceResponse.getResult();
if (hmGroupDTO != null) {
hmQrcodeListDTO.setHmGroupName(hmGroupDTO.getGroupName());
}
//if (CollectionUtils.isNotEmpty(storeDTOList)) {
// //门店id去重
// storeDTOList = storeDTOList.stream()
// .collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(HmStoreDTO::getStoreId))), ArrayList::new));
//}
hmQrcodeListDTO.setClerkList(clerkDTOList); hmQrcodeListDTO.setClerkList(clerkDTOList);
hmQrcodeListDTO.setStoreList(storeDTOList); hmQrcodeListDTO.setStoreList(storeDTOList);
} }
statisticsDTO.setData(data);
} }
return RestResponse.successResult(statisticsDTO); return RestResponse.successResult(statisticsDTO);
} }
...@@ -231,7 +259,7 @@ public class HmQrcodeController { ...@@ -231,7 +259,7 @@ public class HmQrcodeController {
*/ */
@RequestMapping(value = "del", method = RequestMethod.DELETE) @RequestMapping(value = "del", method = RequestMethod.DELETE)
public RestResponse del(Long hmId) { public RestResponse del(Long hmId) {
ServiceResponse serviceResponse = this.hmQrcodeApiService.delById(hmId); ServiceResponse serviceResponse = this.hmQrcodeApiService.delById(hmId,1);
if (!"0000".equals(serviceResponse.getCode())) { if (!"0000".equals(serviceResponse.getCode())) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_DEFINE.getCode()), serviceResponse.getMessage()); return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_DEFINE.getCode()), serviceResponse.getMessage());
} }
......
...@@ -214,17 +214,20 @@ public class HmStoreController { ...@@ -214,17 +214,20 @@ public class HmStoreController {
searchDTO.setSearchName(storeSearchParams); searchDTO.setSearchName(storeSearchParams);
// 企业ID // 企业ID
searchDTO.setEnterpriseId(enterpriseId); searchDTO.setEnterpriseId(enterpriseId);
List<HmQrcodeStoreDTO> hmStoreList = this.hmQrcodeApiService.getHmStoreByEnterpriseId(enterpriseId); List<HmQrcodeStoreDTO> hmStoreList = this.hmQrcodeApiService.getHmStoreByEnterpriseId(wxEnterpriseId , enterpriseId);
if (CollectionUtils.isEmpty(hmStoreList)) { if (CollectionUtils.isEmpty(hmStoreList)) {
return RestResponse.failure("-1", "无活码门店"); return RestResponse.failure("-1", "无活码门店");
} }
Map<String, Integer> map = hmStoreList.stream() Map<String, Integer> map = hmStoreList.stream()
.collect(Collectors.toMap(HmQrcodeStoreDTO::getStoreId, HmQrcodeStoreDTO::getOverFlag, (k1, k2) -> k1)); .collect(Collectors.toMap(HmQrcodeStoreDTO::getStoreId, HmQrcodeStoreDTO::getOverFlag, (k1, k2) -> k1));
List<String> hmStoreIdList = hmStoreList.stream().map(dto -> dto.getStoreId()).collect(Collectors.toList()); List<String> hmStoreIdList = hmStoreList.stream().map(dto -> dto.getStoreId()).collect(Collectors.toList());
Sets.SetView<String> setView = Sets.intersection(Sets.newHashSet(authStoreIdList), logger.info("活码门店={}",hmStoreIdList);
Sets.newHashSet(hmStoreIdList)); if(!authStoreIdList.contains("-1")) {
hmStoreIdList = setView.stream().collect(Collectors.toList()); Sets.SetView<String> setView = Sets.intersection(Sets.newHashSet(authStoreIdList),
if (CollectionUtils.isEmpty(hmStoreList)) { Sets.newHashSet(hmStoreIdList));
hmStoreIdList = setView.stream().collect(Collectors.toList());
}
if (CollectionUtils.isEmpty(hmStoreIdList)) {
return RestResponse.failure("-1", "无符合门店"); return RestResponse.failure("-1", "无符合门店");
} }
// 授权门店 且有活码的门店 // 授权门店 且有活码的门店
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment