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;
}
}
...@@ -97,7 +97,8 @@ public class StaffDTO implements Serializable { ...@@ -97,7 +97,8 @@ public class StaffDTO implements Serializable {
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;
...@@ -157,7 +158,6 @@ public class StaffDTO implements Serializable { ...@@ -157,7 +158,6 @@ public class StaffDTO implements Serializable {
} }
public String getWxEnterpriseId() { public String getWxEnterpriseId() {
return wxEnterpriseId; return wxEnterpriseId;
} }
...@@ -365,4 +365,12 @@ public class StaffDTO implements Serializable { ...@@ -365,4 +365,12 @@ public class StaffDTO implements Serializable {
public void setClerkName(String clerkName) { public void setClerkName(String clerkName) {
this.clerkName = clerkName; this.clerkName = clerkName;
} }
public Integer getAddNum() {
return addNum;
}
public void setAddNum(Integer addNum) {
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) ;
}
...@@ -73,22 +73,25 @@ public interface HmQrcodeApiService { ...@@ -73,22 +73,25 @@ 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);
...@@ -12,20 +13,23 @@ public interface WxEnterpriseService { ...@@ -12,20 +13,23 @@ public interface WxEnterpriseService {
WxEnterpriseDTO selectById(String wxEnterpriseId); WxEnterpriseDTO selectById(String wxEnterpriseId);
/** /**
* 通过微信企业ID查询好办企业ID *
* @param corpId * @Title: getQwInfo
* @Description: 获取商户企微信息
* @author xugh
* @param wxEnterpriseId
* @return * @return
* @throws
*/ */
TabHaobanWxEnterprise getEnterpriseBycorpId(String corpId); WxEnterpriseQwDTO getQwInfo(String wxEnterpriseId);
/** /**
* 通过微信企业ID查询删除状态好办企业ID * 通过微信企业ID查询好办企业ID
*
* @param corpId * @param corpId
* @return * @return
*/ */
@Deprecated TabHaobanWxEnterprise getEnterpriseBycorpId(String corpId);
TabHaobanWxEnterprise getDelEnterpriseBycorpId(String corpId);
void update(WxEnterpriseDTO enterpriseDTO); void update(WxEnterpriseDTO enterpriseDTO);
......
...@@ -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);
...@@ -54,6 +60,34 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService { ...@@ -54,6 +60,34 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService {
} }
@Override @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
public TabHaobanWxEnterprise getEnterpriseBycorpId(String corpId) { public TabHaobanWxEnterprise getEnterpriseBycorpId(String corpId) {
if (StringUtils.isBlank(corpId)) { if (StringUtils.isBlank(corpId)) {
return null; return null;
...@@ -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 "";
} }
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); log.info("【新增外部联系人会员】enterpriseId={},unionId={},name={},avatar={},QrcodeParam={}", enterpriseId, unionId, name, avatar, qrcodeParam);
MemberDTO member = memberOpenCardBusinessService.getMemberByQywxChannelParam(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);
......
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
...@@ -198,4 +198,9 @@ ...@@ -198,4 +198,9 @@
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,7 +315,11 @@ ...@@ -315,7 +315,11 @@
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>
...@@ -323,7 +327,11 @@ ...@@ -323,7 +327,11 @@
<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());
logger.info("活码门店={}",hmStoreIdList);
if(!authStoreIdList.contains("-1")) {
Sets.SetView<String> setView = Sets.intersection(Sets.newHashSet(authStoreIdList), Sets.SetView<String> setView = Sets.intersection(Sets.newHashSet(authStoreIdList),
Sets.newHashSet(hmStoreIdList)); Sets.newHashSet(hmStoreIdList));
hmStoreIdList = setView.stream().collect(Collectors.toList()); hmStoreIdList = setView.stream().collect(Collectors.toList());
if (CollectionUtils.isEmpty(hmStoreList)) { }
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