Commit 32f14a6f by zhangzhendong

Merge branch 'master' into feature-消息中心

# Conflicts:
#	haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/content/adaptor/MaterialReportBuilder.java
#	haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/content/adaptor/PotentialCustomerNotifyBuilder.java
#	haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/content/impl/MaterialReportServiceImpl.java
#	haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/notify/out/NoticeMessageApiServiceImpl.java
parents 189c88fd 10bb0c1f
...@@ -44,6 +44,17 @@ public class MemberUnionidRelatedDTO implements Serializable{ ...@@ -44,6 +44,17 @@ public class MemberUnionidRelatedDTO implements Serializable{
private String state; private String state;
private String staffId ; private String staffId ;
// 是否从自建应用下的回调
private int selfCallback = 0;
public int getSelfCallback() {
return selfCallback;
}
public void setSelfCallback(int selfCallback) {
this.selfCallback = selfCallback;
}
public String getStaffId() { public String getStaffId() {
return staffId; return staffId;
......
...@@ -48,6 +48,16 @@ public class QwFrientNoticeDTO implements Serializable { ...@@ -48,6 +48,16 @@ public class QwFrientNoticeDTO implements Serializable {
private String staffId; private String staffId;
private String changeType; private String changeType;
// 是否从自建应用下的回调
private int selfCallback = 0;
public int getSelfCallback() {
return selfCallback;
}
public void setSelfCallback(int selfCallback) {
this.selfCallback = selfCallback;
}
public String getStaffId() { public String getStaffId() {
return staffId; return staffId;
......
...@@ -37,7 +37,17 @@ public class QywxCallBackDTO implements Serializable{ ...@@ -37,7 +37,17 @@ public class QywxCallBackDTO implements Serializable{
/**部门创建:create_party;部门修改:update_party;部门删除:delete_party* /**部门创建:create_party;部门修改:update_party;部门删除:delete_party*
* 成员创建:create_user;成员修改:update_user;成员删除:delete_user*/ * 成员创建:create_user;成员修改:update_user;成员删除:delete_user*/
private String changeType; private String changeType;
// 是否自建应用的回调
private int selfCallback = 0 ;
public int getSelfCallback() {
return selfCallback;
}
public void setSelfCallback(int selfCallback) {
this.selfCallback = selfCallback;
}
public String getAvatar() { public String getAvatar() {
return avatar; return avatar;
} }
......
...@@ -108,6 +108,24 @@ public class WxEnterpriseDTO implements Serializable { ...@@ -108,6 +108,24 @@ public class WxEnterpriseDTO implements Serializable {
private Integer wxSecurityType ; private Integer wxSecurityType ;
private String wxCorpid ; private String wxCorpid ;
private String openCorpid ; private String openCorpid ;
private String wxaAppid ;
private String urlHost ;
public String getUrlHost() {
return urlHost;
}
public void setUrlHost(String urlHost) {
this.urlHost = urlHost;
}
public String getWxaAppid() {
return wxaAppid;
}
public void setWxaAppid(String wxaAppid) {
this.wxaAppid = wxaAppid;
}
public Integer getWxSecurityType() { public Integer getWxSecurityType() {
return wxSecurityType; return wxSecurityType;
......
...@@ -14,10 +14,62 @@ public class WxEnterpriseQwDTO implements Serializable { ...@@ -14,10 +14,62 @@ public class WxEnterpriseQwDTO implements Serializable {
private String memberCorpid; private String memberCorpid;
// 第三方 // 第三方
private String thirdCorpid; private String thirdCorpid;
private String selfSecret ;
// 自建请求地址
private String urlHost ;
private String selfAppid ;
// 好办小程序的appid(根据第三方或自建返回)
private String hbWxaAppid ;
// 自建/第三方
private String self3thSecret ;
public String getHbWxaAppid() {
return hbWxaAppid;
}
public String getSelf3thSecret() {
return self3thSecret;
}
public void setHbWxaAppid(String hbWxaAppid) {
this.hbWxaAppid = hbWxaAppid;
}
public void setSelf3thSecret(String self3thSecret) {
this.self3thSecret = self3thSecret;
}
public String getSelfAppid() {
return selfAppid;
}
public void setSelfAppid(String selfAppid) {
this.selfAppid = selfAppid;
}
public String getUrlHost() {
return urlHost;
}
public void setUrlHost(String urlHost) {
this.urlHost = urlHost;
}
public String getSelfSecret() {
return selfSecret;
}
public void setSelfSecret(String selfSecret) {
this.selfSecret = selfSecret;
}
// 好办小程序应用id // 好办小程序应用id
private String agentId; private String agentId;
// 好办小程序名称 // 好办小程序名称
private String agentName; private String agentName;
// 第三方使用的加密的userid // 第三方使用的加密的userid
public boolean needOpenUserId3th() { public boolean needOpenUserId3th() {
...@@ -27,6 +79,10 @@ public class WxEnterpriseQwDTO implements Serializable { ...@@ -27,6 +79,10 @@ public class WxEnterpriseQwDTO implements Serializable {
public boolean needOpenUserIdDk() { public boolean needOpenUserIdDk() {
return this.wxSecurityType == 2 || this.wxSecurityType == 4; return this.wxSecurityType == 2 || this.wxSecurityType == 4;
} }
public boolean isSelf() {
return this.wxSecurityType == 5 ;
}
public int getWxSecurityType() { public int getWxSecurityType() {
return wxSecurityType; return wxSecurityType;
......
...@@ -16,6 +16,15 @@ public class ChatEventDTO implements Serializable { ...@@ -16,6 +16,15 @@ public class ChatEventDTO implements Serializable {
private Integer quitScene; private Integer quitScene;
private Integer memChangeCnt; private Integer memChangeCnt;
private String corpid; private String corpid;
// 是否自建应用的回调
private int selfCallback = 0 ;
public int getSelfCallback() {
return selfCallback;
}
public void setSelfCallback(int selfCallback) {
this.selfCallback = selfCallback;
}
public String getChangeType() { public String getChangeType() {
return changeType; return changeType;
......
...@@ -69,7 +69,19 @@ public class GroupChatDTO implements Serializable { ...@@ -69,7 +69,19 @@ public class GroupChatDTO implements Serializable {
private int hmAddStatus = 1 ; private int hmAddStatus = 1 ;
private String chatRemark ; private String chatRemark ;
private int initFlag ; private int initFlag ;
private String clerkRelationExcel;
public String getClerkRelationExcel() {
if (clerkRelationFlag == 0){
clerkRelationExcel="未关联";
}else {
clerkRelationExcel="已关联";
}
return clerkRelationExcel;
}
public void setClerkRelationExcel(String clerkRelationExcel) {
this.clerkRelationExcel = clerkRelationExcel;
}
public int getInitFlag() { public int getInitFlag() {
return initFlag; return initFlag;
} }
......
...@@ -153,6 +153,18 @@ public class LicenceOrderDTO implements Serializable { ...@@ -153,6 +153,18 @@ public class LicenceOrderDTO implements Serializable {
* 微信url * 微信url
*/ */
private String wxUrl; private String wxUrl;
/**
* 企业微信订单过期时间
*/
private Date qywxExpireTime;
public Date getQywxExpireTime() {
return qywxExpireTime;
}
public void setQywxExpireTime(Date qywxExpireTime) {
this.qywxExpireTime = qywxExpireTime;
}
public String getWxUrl() { public String getWxUrl() {
return wxUrl; return wxUrl;
......
...@@ -131,6 +131,18 @@ public class LicenceOrderPageDTO implements Serializable { ...@@ -131,6 +131,18 @@ public class LicenceOrderPageDTO implements Serializable {
* 微信订单id * 微信订单id
*/ */
private String wxOrderId; private String wxOrderId;
/**
* 企业微信订单过期时间
*/
private Date qywxExpireTime;
public Date getQywxExpireTime() {
return qywxExpireTime;
}
public void setQywxExpireTime(Date qywxExpireTime) {
this.qywxExpireTime = qywxExpireTime;
}
public String getWxOrderId() { public String getWxOrderId() {
return wxOrderId; return wxOrderId;
......
...@@ -101,6 +101,18 @@ public class LicenceOrderQDTO implements Serializable { ...@@ -101,6 +101,18 @@ public class LicenceOrderQDTO implements Serializable {
* 创建人名称 * 创建人名称
*/ */
private String creatorName; private String creatorName;
/**
* 企业微信订单id
*/
private String qywxOrderId;
public String getQywxOrderId() {
return qywxOrderId;
}
public void setQywxOrderId(String qywxOrderId) {
this.qywxOrderId = qywxOrderId;
}
public Long getOrderId() { public Long getOrderId() {
return orderId; return orderId;
......
...@@ -4,8 +4,9 @@ package com.gic.haoban.manage.api.enums; ...@@ -4,8 +4,9 @@ package com.gic.haoban.manage.api.enums;
* Created by hua on 2020/6/3. * Created by hua on 2020/6/3.
*/ */
public enum SecretTypeEnum { public enum SecretTypeEnum {
CONTACT_CUSTOMER(1, "顾客联系"), SELF_APP(1, "好办自建"),
MEMBER_WAPP(4, "会员小程序"), CONTACT_CUSTOMER(8, "顾客联系(目前无用)"),
MEMBER_WAPP(4, "会员工具"),
CUSTOMIZED_APP(5, "自建代开发"), CUSTOMIZED_APP(5, "自建代开发"),
WEWORK_PAY(6, "企业支付"), WEWORK_PAY(6, "企业支付"),
; ;
......
...@@ -195,6 +195,10 @@ public interface ExternalClerkRelatedApiService { ...@@ -195,6 +195,10 @@ public interface ExternalClerkRelatedApiService {
com.gic.api.base.commons.ServiceResponse<Boolean> isQwFriend(String enterpriseId, String staffId, String memberId) ; com.gic.api.base.commons.ServiceResponse<Boolean> isQwFriend(String enterpriseId, String staffId, String memberId) ;
List<String> listMemberAndStaff(List<String> memberIdList , String StaffId , String enterpriseId) ;
/** /**
* *
* @param enterpriseId * @param enterpriseId
...@@ -204,12 +208,8 @@ public interface ExternalClerkRelatedApiService { ...@@ -204,12 +208,8 @@ public interface ExternalClerkRelatedApiService {
*/ */
com.gic.api.base.commons.ServiceResponse<Boolean> isQwFriendWithUnionId(String enterpriseId, String clerkId, String unionId) ; com.gic.api.base.commons.ServiceResponse<Boolean> isQwFriendWithUnionId(String enterpriseId, String clerkId, String unionId) ;
//无效接口
// com.gic.api.base.commons.ServiceResponse<String> getExternalUseridForWxa(String enterpriseId, String staffId, String memberId) ;
List<String> listMemberAndClerk(List<String> memberIdList , List<String> clerkIdList , String enterpriseId) ;
/** /**
* 批量查询会员与导购好友关系 * 批量查询会员与导购好友关系
* *
* @param memberIdList 会员id列表 * @param memberIdList 会员id列表
......
...@@ -146,14 +146,7 @@ public interface MemberUnionidRelatedApiService { ...@@ -146,14 +146,7 @@ public interface MemberUnionidRelatedApiService {
ExternalUserDTO getCorpSelfExternalUseridInfoForMember(String wxEnterpriseId, String wxUserId, String externalUserId,String enterpriseId); ExternalUserDTO getCorpSelfExternalUseridInfoForMember(String wxEnterpriseId, String wxUserId, String externalUserId,String enterpriseId);
/** public String dealMergeForReflsh(ExternalUserDTO externalUserDTO, String wxEnterpriseId , String staffId) ;
* 添加企微好友关联关系表-无需触达
*
* @param dto
* @return
*/
String addExternal(ExternalUserDTO dto);
/** /**
* 获取客户详情-第三方 * 获取客户详情-第三方
* *
......
...@@ -46,6 +46,8 @@ public interface WxEnterpriseApiService { ...@@ -46,6 +46,8 @@ public interface WxEnterpriseApiService {
*/ */
WxEnterpriseDTO getOne(String wxEnterpriseId); WxEnterpriseDTO getOne(String wxEnterpriseId);
WxEnterpriseDTO selectByWxaAppid(String appid);
WxEnterpriseQwDTO getQwInfo(String wxEnterpriseId); WxEnterpriseQwDTO getQwInfo(String wxEnterpriseId);
/** /**
......
...@@ -151,5 +151,11 @@ public interface LicenceOrderApiService { ...@@ -151,5 +151,11 @@ public interface LicenceOrderApiService {
*/ */
ServiceResponse<HashMap<String, Integer>> hasPopup(String wxEnterpriseId); ServiceResponse<HashMap<String, Integer>> hasPopup(String wxEnterpriseId);
/**
* 查询企业微信订单状态是否过期
* @return
*/
ServiceResponse<Boolean> checkQywxOrderStatus(Long orderId);
} }
...@@ -32,6 +32,7 @@ import org.springframework.web.bind.annotation.RequestParam; ...@@ -32,6 +32,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -92,6 +93,7 @@ public class LicenceOrderController { ...@@ -92,6 +93,7 @@ public class LicenceOrderController {
if (ObjectUtil.isNotNull(wxEnterpriseDTO)) { if (ObjectUtil.isNotNull(wxEnterpriseDTO)) {
vo.setWxEnterpriseName(wxEnterpriseDTO.getCorpName()); vo.setWxEnterpriseName(wxEnterpriseDTO.getCorpName());
} }
vo.setNowTime(new Date());
} }
} }
return RestResponse.successResult(result); return RestResponse.successResult(result);
...@@ -193,6 +195,18 @@ public class LicenceOrderController { ...@@ -193,6 +195,18 @@ public class LicenceOrderController {
} }
return RestResponse.failure(response.getCode(), response.getMessage()); return RestResponse.failure(response.getCode(), response.getMessage());
} }
/**
* 获取当前系统时间
*/
@RequestMapping("get-system-date")
public RestResponse<Date> getSystemDate(HttpServletRequest request) {
AuthcenterUserDetails loginUser = (AuthcenterUserDetails) SessionContextUtil.getUser(request);
if (loginUser == null) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_4.getCode()), HaoBanErrCode.ERR_4.getMsg());
}
return RestResponse.successResult(new Date());
}
} }
......
...@@ -132,6 +132,14 @@ public class LicenceOrderPageVO implements Serializable { ...@@ -132,6 +132,14 @@ public class LicenceOrderPageVO implements Serializable {
* 微信订单id * 微信订单id
*/ */
private String wxOrderId; private String wxOrderId;
/**
* 企业微信订单过期时间
*/
private Date qywxExpireTime;
/**
* 当前时间
*/
private Date nowTime;
} }
...@@ -154,5 +154,9 @@ public class LicenceOrderVO implements Serializable { ...@@ -154,5 +154,9 @@ public class LicenceOrderVO implements Serializable {
* 订单进度list * 订单进度list
*/ */
private List<LicenceOrderProgressVO> OrderProgressList; private List<LicenceOrderProgressVO> OrderProgressList;
/**
* 企业微信订单过期时间
*/
private Date qywxExpireTime;
} }
...@@ -186,7 +186,7 @@ public interface PreDealLogMapper { ...@@ -186,7 +186,7 @@ public interface PreDealLogMapper {
* @param relationKey * @param relationKey
* @return * @return
*/ */
TabHaobanPreDealLog getByRelationKey(@Param("taskId") String taskId, @Param("dataType") int dataType, @Param("relationKey") String relationKey); List<TabHaobanPreDealLog> getByRelationKey(@Param("taskId") String taskId, @Param("dataType") int dataType, @Param("relationKey") String relationKey);
/** /**
* 校验任务 * 校验任务
......
...@@ -365,7 +365,7 @@ public interface TabHaobanExternalClerkRelatedMapper { ...@@ -365,7 +365,7 @@ public interface TabHaobanExternalClerkRelatedMapper {
@Param("staffId") String staffId); @Param("staffId") String staffId);
List<String> listMemberAndClerk(@Param("memberIdList")List<String> memberIdList, @Param("clerkIdList")List<String> clerkIdList, @Param("enterpriseId")String enterpriseId); List<String> listMemberAndClerk(@Param("memberIdList")List<String> memberIdList, @Param("clerkIdList")List<String> clerkIdList, @Param("enterpriseId")String enterpriseId);
int getCountExternalClerk(@Param("wxEnterpriseId") String wxEnterpriseId, int getCountExternalClerk(@Param("wxEnterpriseId") String wxEnterpriseId,
@Param("staffId") String staffId, @Param("staffId") String staffId,
@Param("statusFlags") List<Integer> statusFlags); @Param("statusFlags") List<Integer> statusFlags);
...@@ -373,7 +373,9 @@ public interface TabHaobanExternalClerkRelatedMapper { ...@@ -373,7 +373,9 @@ public interface TabHaobanExternalClerkRelatedMapper {
int getCountByMemberId(@Param("memberId") String memberId); int getCountByMemberId(@Param("memberId") String memberId);
void updateClerkInfo(@Param("staffId")String staffId, @Param("oldClerkId")String oldClerkId, @Param("newClerkId")String newClerkId, @Param("storeId")String storeId); void updateClerkInfo(@Param("staffId")String staffId, @Param("oldClerkId")String oldClerkId, @Param("newClerkId")String newClerkId, @Param("storeId")String storeId);
List<String> listByClerkId(@Param("staffId")String staffId, @Param("clerkId")String clerkId) ;
int updateExternalStatus(@Param("wxEnterpriseId")String wxEnterpriseId, @Param("externalUserid")String externalUserid, @Param("status")int status); int updateExternalStatus(@Param("wxEnterpriseId")String wxEnterpriseId, @Param("externalUserid")String externalUserid, @Param("status")int status);
/** /**
...@@ -381,6 +383,8 @@ public interface TabHaobanExternalClerkRelatedMapper { ...@@ -381,6 +383,8 @@ public interface TabHaobanExternalClerkRelatedMapper {
*/ */
TabHaobanExternalClerkRelated getMemberForExternalId(@Param("wxEnterpriseId") String wxEnterpriseId, TabHaobanExternalClerkRelated getMemberForExternalId(@Param("wxEnterpriseId") String wxEnterpriseId,
@Param("externalUserId") String externalUserId); @Param("externalUserId") String externalUserId);
List<String> listMemberAndStaff(@Param("memberIdList")List<String> memberIdList, @Param("staffId")String staffId, @Param("enterpriseId")String enterpriseId);
/** /**
* 查询成员的好友列表 * 查询成员的好友列表
......
...@@ -13,7 +13,9 @@ public interface WxEnterpriseMapper { ...@@ -13,7 +13,9 @@ public interface WxEnterpriseMapper {
int insertSelective(TabHaobanWxEnterprise record); int insertSelective(TabHaobanWxEnterprise record);
TabHaobanWxEnterprise selectByPrimaryKey(String wxEnterpriseId); TabHaobanWxEnterprise selectByPrimaryKey(String wxEnterpriseId);
TabHaobanWxEnterprise selectByWxaAppid(@Param("appid")String appid);
int updateByPrimaryKeySelective(TabHaobanWxEnterprise record); int updateByPrimaryKeySelective(TabHaobanWxEnterprise record);
Page<TabHaobanWxEnterprise> list(@Param("keyword") String keyword, Page<TabHaobanWxEnterprise> list(@Param("keyword") String keyword,
......
...@@ -109,7 +109,7 @@ public interface TabHaobanLicenceOrderMapper { ...@@ -109,7 +109,7 @@ public interface TabHaobanLicenceOrderMapper {
* @param qywxOrderId * @param qywxOrderId
* @return * @return
*/ */
Integer saveQywxOrderId(@Param("orderId") Long orderId, @Param("qywxOrderId") String qywxOrderId); Integer saveQywxOrderId(@Param("orderId") Long orderId, @Param("qywxOrderId") String qywxOrderId,@Param("qywxExpireTime") Date qywxExpireTime);
List<String> getTransactionIdList(@Param("orderNumber") String orderNumber, @Param("wxEnterpriseId") String wxEnterpriseId); List<String> getTransactionIdList(@Param("orderNumber") String orderNumber, @Param("wxEnterpriseId") String wxEnterpriseId);
......
...@@ -52,7 +52,7 @@ public class TabHaobanStaff implements Serializable { ...@@ -52,7 +52,7 @@ public class TabHaobanStaff implements Serializable {
@Transient @Transient
private String departmentIds; private String departmentIds;
private int openConcatFlag ; private Integer openConcatFlag ;
private Date activeTime; private Date activeTime;
private Date expireTime; private Date expireTime;
...@@ -82,11 +82,11 @@ public class TabHaobanStaff implements Serializable { ...@@ -82,11 +82,11 @@ public class TabHaobanStaff implements Serializable {
this.activeCode = activeCode; this.activeCode = activeCode;
} }
public int getOpenConcatFlag() { public Integer getOpenConcatFlag() {
return openConcatFlag; return openConcatFlag;
} }
public void setOpenConcatFlag(int openConcatFlag) { public void setOpenConcatFlag(Integer openConcatFlag) {
this.openConcatFlag = openConcatFlag; this.openConcatFlag = openConcatFlag;
} }
......
...@@ -91,6 +91,24 @@ public class TabHaobanWxEnterprise implements Serializable { ...@@ -91,6 +91,24 @@ public class TabHaobanWxEnterprise implements Serializable {
private String wxCorpid ; private String wxCorpid ;
private String openCorpid ; private String openCorpid ;
private String wxaAppid ;
private String urlHost ;
public String getUrlHost() {
return urlHost;
}
public void setUrlHost(String urlHost) {
this.urlHost = urlHost;
}
public String getWxaAppid() {
return wxaAppid;
}
public void setWxaAppid(String wxaAppid) {
this.wxaAppid = wxaAppid;
}
public String getWxCorpid() { public String getWxCorpid() {
return wxCorpid; return wxCorpid;
......
...@@ -66,6 +66,25 @@ public class TabSecretSetting implements Serializable { ...@@ -66,6 +66,25 @@ public class TabSecretSetting implements Serializable {
* *
*/ */
private Date updateTime; private Date updateTime;
private String agentName ;
private String agentId ;
public String getAgentName() {
return agentName;
}
public String getAgentId() {
return agentId;
}
public void setAgentName(String agentName) {
this.agentName = agentName;
}
public void setAgentId(String agentId) {
this.agentId = agentId;
}
/** /**
*/ */
......
...@@ -170,6 +170,10 @@ public class TabHaobanLicenceOrder implements Serializable { ...@@ -170,6 +170,10 @@ public class TabHaobanLicenceOrder implements Serializable {
* 微信url * 微信url
*/ */
private String wxUrl; private String wxUrl;
/**
* 企业微信订单过期时间
*/
private Date qywxExpireTime;
} }
package com.gic.haoban.manage.service.pojo.bo.content.binlog;
import com.alibaba.fastjson.annotation.JSONField;
import com.gic.haoban.manage.service.pojo.BinlogBasePojo;
/**
* @Author MUSI
* @Date 2023/5/10 9:43 AM
* @Description
* @Version
**/
public class MaterialMemberUnionIdPoJo extends BinlogBasePojo {
/**
* 会员unionId
*
*/
@JSONField(name = "third_unionid")
private String unionId;
/**
* memberId
*/
@JSONField(name = "member_id")
private String memberId;
public String getUnionId() {
return unionId;
}
public void setUnionId(String unionId) {
this.unionId = unionId;
}
public String getMemberId() {
return memberId;
}
public void setMemberId(String memberId) {
this.memberId = memberId;
}
}
...@@ -64,6 +64,11 @@ public class MaterialReportContext { ...@@ -64,6 +64,11 @@ public class MaterialReportContext {
private String clerkId; private String clerkId;
/** /**
* 是否是区经
*/
private boolean isManager;
/**
* 主门店 * 主门店
*/ */
private String mainStoreId; private String mainStoreId;
...@@ -99,8 +104,8 @@ public class MaterialReportContext { ...@@ -99,8 +104,8 @@ public class MaterialReportContext {
log.info("成员未绑定导购, staffId: {}", this.staffId); log.info("成员未绑定导购, staffId: {}", this.staffId);
return Collections.emptyList(); return Collections.emptyList();
} }
if (StringUtils.isBlank(this.mainStoreId)) { if (this.isManager) {
log.info("成员 {} 没有主门店数据, 区经角色不发送小程序消息通知 ", this.staffId); log.info("成员{}为区经角色, 不发送小程序消息通知 ", this.staffId);
return Collections.emptyList(); return Collections.emptyList();
} }
......
...@@ -8,8 +8,13 @@ import java.util.Set; ...@@ -8,8 +8,13 @@ import java.util.Set;
public interface ClerkMainStoreRelatedService { public interface ClerkMainStoreRelatedService {
void setMainStore(String staffId, String storeId, String wxEnterpriseId); void setMainStore(String staffId, String storeId, String wxEnterpriseId);
// 自动刷新好友列表
void reflushExternal(String wxEnterpriseId ,String staffId) ;
TabHaobanClerkMainStoreRelated selectByWxEnterpriseIdAndStoreId(String staffId, String wxEnterpriseId); TabHaobanClerkMainStoreRelated selectByWxEnterpriseIdAndStoreId(String staffId, String wxEnterpriseId);
TabHaobanClerkMainStoreRelated selectStaffMainStore(String staffId, String wxEnterpriseId);
/** /**
* 获取主门店 如果没有主门店设置主门店 * 获取主门店 如果没有主门店设置主门店
......
...@@ -173,7 +173,7 @@ public interface PreDealService { ...@@ -173,7 +173,7 @@ public interface PreDealService {
* @param relationKey * @param relationKey
* @return * @return
*/ */
public TabHaobanPreDealLog getByRelationKey(String taskId, Integer dataType, String relationKey); public List<TabHaobanPreDealLog> getByRelationKey(String taskId, Integer dataType, String relationKey);
/** /**
* 获取任务是否有在同步中 好友 * 获取任务是否有在同步中 好友
......
...@@ -128,8 +128,7 @@ public class GroupChatDataServiceImpl implements GroupChatDataService { ...@@ -128,8 +128,7 @@ public class GroupChatDataServiceImpl implements GroupChatDataService {
Date date = DateUtil.addDay(DateUtil.getStartTimeOfDay(), -1); Date date = DateUtil.addDay(DateUtil.getStartTimeOfDay(), -1);
Long time = date.getTime() / 1000; Long time = date.getTime() / 1000;
ServiceResponse<List<GroupChatQwDataDTO>> resp = this.qywxChatApiService.statistic(qwDTO.getThirdCorpid(), ServiceResponse<List<GroupChatQwDataDTO>> resp = this.qywxChatApiService.statistic(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), userIdList, time, time , qwDTO.isSelf() , qwDTO.getUrlHost());
config.getWxSuiteid(), userIdList, time, time);
List<GroupChatQwDataDTO> dataList = resp.getResult(); List<GroupChatQwDataDTO> dataList = resp.getResult();
if (CollectionUtils.isEmpty(dataList)) { if (CollectionUtils.isEmpty(dataList)) {
if (list.size() < pageSize) { if (list.size() < pageSize) {
......
...@@ -4,6 +4,7 @@ import java.util.ArrayList; ...@@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
...@@ -143,7 +144,7 @@ public class GroupChatHmServiceImpl implements GroupChatHmService { ...@@ -143,7 +144,7 @@ public class GroupChatHmServiceImpl implements GroupChatHmService {
if (null != secretSetting) { if (null != secretSetting) {
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId); WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
ServiceResponse<Void> resp = this.qywxChatApiService.delJoinWay(qwDTO.getDkCorpid(), ServiceResponse<Void> resp = this.qywxChatApiService.delJoinWay(qwDTO.getDkCorpid(),
secretSetting.getSecretVal(), hm.getWxConfigId()); secretSetting.getSecretVal(), hm.getWxConfigId(),qwDTO.getUrlHost());
logger.info("删除群活码={}", JSON.toJSON(resp)); logger.info("删除群活码={}", JSON.toJSON(resp));
} }
} }
...@@ -190,7 +191,7 @@ public class GroupChatHmServiceImpl implements GroupChatHmService { ...@@ -190,7 +191,7 @@ public class GroupChatHmServiceImpl implements GroupChatHmService {
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId); WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
String configId = hm.getWxConfigId(); String configId = hm.getWxConfigId();
ServiceResponse<AddJoinWayDTO> joinResp = this.qywxChatApiService.getJoinWay(qwDTO.getDkCorpid(), secret, ServiceResponse<AddJoinWayDTO> joinResp = this.qywxChatApiService.getJoinWay(qwDTO.getDkCorpid(), secret,
configId); configId,qwDTO.getUrlHost());
logger.info("查询群活码={}", JSON.toJSON(joinResp)); logger.info("查询群活码={}", JSON.toJSON(joinResp));
if (joinResp.isSuccess()) { if (joinResp.isSuccess()) {
AddJoinWayDTO join = joinResp.getResult(); AddJoinWayDTO join = joinResp.getResult();
...@@ -213,45 +214,57 @@ public class GroupChatHmServiceImpl implements GroupChatHmService { ...@@ -213,45 +214,57 @@ public class GroupChatHmServiceImpl implements GroupChatHmService {
this.saveChatFullNotice(wxEnterpriseId, thisGroupChatId); this.saveChatFullNotice(wxEnterpriseId, thisGroupChatId);
return; return;
} }
if (CollectionUtils.isNotEmpty(qwChatIdList)) { // 处理要踢的
// 处理要踢的 List<String> bakQwChatIdList = EntityUtil.changeEntityListByJSON(String.class, qwChatIdList);
for (String wxChatId : qwChatIdList) { for (String wxChatId : bakQwChatIdList) {
TabGroupChat chat = this.groupChatMapper.selectByWxChatIdDk(wxEnterpriseId, wxChatId); TabGroupChat chat = this.groupChatMapper.selectByWxChatIdDk(wxEnterpriseId, wxChatId);
if (null == chat) { if (null == chat) {
continue; continue;
} }
TabGroupChat cid = null; TabGroupChat cid = null;
String staffId = chat.getStaffId(); String staffId = chat.getStaffId();
for (TabGroupChat obj : chatList) { for (TabGroupChat obj : chatList) {
if (obj.getStaffId().equals(staffId)) { if (obj.getStaffId().equals(staffId)) {
if (null == cid) { if (null == cid) {
cid = obj;
} else {
if (obj.getTotalCount() > cid.getTotalCount()) {
cid = obj; cid = obj;
} else {
if (obj.getTotalCount() > cid.getTotalCount()) {
cid = obj;
}
} }
} }
} }
if (null != cid) { }
logger.info("hm={},群={},要删={}", wxChatId, qwChatIdList, cid.getWxChatId()); boolean flag = false ;
qwChatIdList.remove(cid.getWxChatIdDk()); if (null != cid) {
// 保存活码 logger.info("hm={},群={},要删={}", wxChatId, qwChatIdList, cid.getWxChatId());
List<TabGroupChat> list = this.groupChatMapper.listByWxWxChatIdListDk(wxEnterpriseId, Iterator<String> it = qwChatIdList.iterator() ;
qwChatIdList); while(it.hasNext()) {
if (CollectionUtils.isEmpty(list)) { if(it.next().equals(cid.getWxChatIdDk())) {
logger.info("查询群列表空,dkList={}", qwChatIdList); it.remove();
return; flag = true ;
break ;
} }
List<Long> groupChatIdList = list.stream().map(dto -> dto.getGroupChatId())
.collect(Collectors.toList());
GroupChatHmDTO hmDTO = EntityUtil.changeEntityByJSON(GroupChatHmDTO.class, hm);
hmDTO.setChatIdList(groupChatIdList);
this.saveHm(hmDTO, 2);
} }
} }
if(flag) {
break ;
}
} }
} logger.info("处理后群活码应有的群={}", qwChatIdList);
// 保存活码
List<TabGroupChat> list = this.groupChatMapper.listByWxWxChatIdListDk(wxEnterpriseId,
qwChatIdList);
if (CollectionUtils.isEmpty(list) || list.size() != qwChatIdList.size()) {
this.saveChatFullNotice(wxEnterpriseId, thisGroupChatId);
logger.info("查询群列表空,或数量不一致,dkList={}", qwChatIdList);
return;
}
List<Long> groupChatIdList = list.stream().map(dto -> dto.getGroupChatId())
.collect(Collectors.toList());
GroupChatHmDTO hmDTO = EntityUtil.changeEntityByJSON(GroupChatHmDTO.class, hm);
hmDTO.setChatIdList(groupChatIdList);
this.saveHm(hmDTO, 2);
}
} }
} }
...@@ -303,7 +316,7 @@ public class GroupChatHmServiceImpl implements GroupChatHmService { ...@@ -303,7 +316,7 @@ public class GroupChatHmServiceImpl implements GroupChatHmService {
if (updateFlag) { if (updateFlag) {
joinDTO.setConfig_id(hm.getWxConfigId()); joinDTO.setConfig_id(hm.getWxConfigId());
ServiceResponse<Void> updateResp = this.qywxChatApiService.updateJoinWay(qwDTO.getDkCorpid(), ServiceResponse<Void> updateResp = this.qywxChatApiService.updateJoinWay(qwDTO.getDkCorpid(),
secretSetting.getSecretVal(), joinDTO); secretSetting.getSecretVal(), joinDTO,qwDTO.getUrlHost());
if (!updateResp.isSuccess()) { if (!updateResp.isSuccess()) {
return ServiceResponse.failure("9999", updateResp.getMessage()); return ServiceResponse.failure("9999", updateResp.getMessage());
} }
...@@ -339,14 +352,14 @@ public class GroupChatHmServiceImpl implements GroupChatHmService { ...@@ -339,14 +352,14 @@ public class GroupChatHmServiceImpl implements GroupChatHmService {
} else { } else {
ServiceResponse<String> addResp = this.qywxChatApiService.addJoinWay(qwDTO.getDkCorpid(), ServiceResponse<String> addResp = this.qywxChatApiService.addJoinWay(qwDTO.getDkCorpid(),
secretSetting.getSecretVal(), joinDTO); secretSetting.getSecretVal(), joinDTO,qwDTO.getUrlHost());
logger.info("addResp={}", JSON.toJSONString(addResp)); logger.info("addResp={}", JSON.toJSONString(addResp));
if (!addResp.isSuccess()) { if (!addResp.isSuccess()) {
return ServiceResponse.failure("9999", addResp.getMessage()); return ServiceResponse.failure("9999", addResp.getMessage());
} }
String configId = addResp.getResult(); String configId = addResp.getResult();
ServiceResponse<AddJoinWayDTO> getResp = this.qywxChatApiService.getJoinWay(qwDTO.getDkCorpid(), ServiceResponse<AddJoinWayDTO> getResp = this.qywxChatApiService.getJoinWay(qwDTO.getDkCorpid(),
secretSetting.getSecretVal(), configId); secretSetting.getSecretVal(), configId,qwDTO.getUrlHost());
logger.info("getResp={}", JSON.toJSONString(getResp)); logger.info("getResp={}", JSON.toJSONString(getResp));
if (!getResp.isSuccess()) { if (!getResp.isSuccess()) {
return ServiceResponse.failure("9999", getResp.getMessage()); return ServiceResponse.failure("9999", getResp.getMessage());
......
...@@ -346,6 +346,7 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService { ...@@ -346,6 +346,7 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService {
sendResp = qywxSendService.sendChatMessage(wxEnterpriseId, staffId, sendResp = qywxSendService.sendChatMessage(wxEnterpriseId, staffId,
materialList,message); materialList,message);
} }
logger.info("sendResp={}",JSON.toJSONString(sendResp));
if (sendResp.isSuccess()) { if (sendResp.isSuccess()) {
String msgid = sendResp.getResult(); String msgid = sendResp.getResult();
ownerLog.setMsgid(msgid); ownerLog.setMsgid(msgid);
...@@ -363,7 +364,7 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService { ...@@ -363,7 +364,7 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService {
this.savePendTask(ownerLog, plan); this.savePendTask(ownerLog, plan);
} }
} catch (Exception e) { } catch (Exception e) {
logger.info("群群发任务异常,ownerLog={}", ownerLog.getOwnerLogId()); logger.info("群群发任务异常,ownerLog={},{}", ownerLog.getOwnerLogId(),e.getMessage());
} }
} }
} }
...@@ -429,8 +430,14 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService { ...@@ -429,8 +430,14 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService {
if (qwDTO.needOpenUserId3th()) { if (qwDTO.needOpenUserId3th()) {
userid = staff.getWxOpenUseId(); userid = staff.getWxOpenUseId();
} }
JSONResponse respon = qywxSuiteApiService.resultExternalMessage(qwDTO.getThirdCorpid(), config.getWxSuiteid(), JSONResponse respon = null ;
msgid, null, userid); if(qwDTO.isSelf()) {
respon = qywxSuiteApiService.resultExternalMessageSelf(qwDTO.getThirdCorpid(), qwDTO.getSelfSecret(),
msgid, null, userid , qwDTO.getUrlHost());
}else {
respon = qywxSuiteApiService.resultExternalMessage(qwDTO.getThirdCorpid(), config.getWxSuiteid(),
msgid, null, userid);
}
logger.info("统计企微返回={}", JSON.toJSONString(respon)); logger.info("统计企微返回={}", JSON.toJSONString(respon));
if (respon.getErrorCode() != 0) { if (respon.getErrorCode() != 0) {
return; return;
......
...@@ -530,8 +530,8 @@ public class GroupChatServiceImpl implements GroupChatService { ...@@ -530,8 +530,8 @@ public class GroupChatServiceImpl implements GroupChatService {
private void syncGroupChatList(WxEnterpriseQwDTO qwDTO, List<String> userIdList, String cursor, private void syncGroupChatList(WxEnterpriseQwDTO qwDTO, List<String> userIdList, String cursor,
boolean syncDetailFlag) { boolean syncDetailFlag) {
logger.info("同步群列表={},idlist={},cursor={}", JSON.toJSONString(qwDTO), JSON.toJSONString(userIdList), cursor); logger.info("同步群列表={},idlist={},cursor={}", JSON.toJSONString(qwDTO), JSON.toJSONString(userIdList), cursor);
ServiceResponse<GroupChatListDTO> resp = this.qywxChatApiService.groupchatList3th(qwDTO.getThirdCorpid(), ServiceResponse<GroupChatListDTO> resp = this.qywxChatApiService.groupchatList(qwDTO.getThirdCorpid(),
config.getWxSuiteid(), userIdList, limit, cursor); qwDTO.getSelf3thSecret() , userIdList, limit, cursor , qwDTO.isSelf(), qwDTO.getUrlHost());
if (!resp.isSuccess()) { if (!resp.isSuccess()) {
logger.info("拉取群列表异常={}", JSON.toJSON(resp)); logger.info("拉取群列表异常={}", JSON.toJSON(resp));
return; return;
...@@ -581,6 +581,9 @@ public class GroupChatServiceImpl implements GroupChatService { ...@@ -581,6 +581,9 @@ public class GroupChatServiceImpl implements GroupChatService {
chat.setGicFlag(1); chat.setGicFlag(1);
} }
chat.setWxChatId(wxChatId); chat.setWxChatId(wxChatId);
if(qwDTO.isSelf()) {
chat.setWxChatIdDk(wxChatId);
}
chat.setChatStatus(chatStatus); chat.setChatStatus(chatStatus);
chat.setCreateTime(new Date()); chat.setCreateTime(new Date());
chat.setUpdateTime(new Date()); chat.setUpdateTime(new Date());
...@@ -615,7 +618,8 @@ public class GroupChatServiceImpl implements GroupChatService { ...@@ -615,7 +618,8 @@ public class GroupChatServiceImpl implements GroupChatService {
String wxEnterpriseId = chat.getWxEnterpriseId(); String wxEnterpriseId = chat.getWxEnterpriseId();
String enterpriseId = chat.getEnterpriseId(); String enterpriseId = chat.getEnterpriseId();
ServiceResponse<GroupChatDetailDTO> detailResp = this.qywxChatApiService ServiceResponse<GroupChatDetailDTO> detailResp = this.qywxChatApiService
.groupchatDetail3th(qwDTO.getThirdCorpid(), config.getWxSuiteid(), chat.getWxChatId(), 1); .groupchatDetail(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), chat.getWxChatId(), 1 , qwDTO.isSelf() , qwDTO.getUrlHost());
logger.info("从企微获取群详情{}={}", chat.getWxChatId(), JSON.toJSON(detailResp)); logger.info("从企微获取群详情{}={}", chat.getWxChatId(), JSON.toJSON(detailResp));
if (!detailResp.isSuccess()) { if (!detailResp.isSuccess()) {
logger.info("从企微获取群详情失败"); logger.info("从企微获取群详情失败");
...@@ -983,7 +987,7 @@ public class GroupChatServiceImpl implements GroupChatService { ...@@ -983,7 +987,7 @@ public class GroupChatServiceImpl implements GroupChatService {
private void updateWxChatIdDk(WxEnterpriseQwDTO qwDTO, List<String> userIdList, String cursor, String staffId, private void updateWxChatIdDk(WxEnterpriseQwDTO qwDTO, List<String> userIdList, String cursor, String staffId,
String secret) { String secret) {
ServiceResponse<GroupChatListDTO> resp = this.qywxChatApiService.groupchatList(qwDTO.getDkCorpid(), secret, ServiceResponse<GroupChatListDTO> resp = this.qywxChatApiService.groupchatList(qwDTO.getDkCorpid(), secret,
userIdList, limit, cursor); userIdList, limit, cursor ,true , qwDTO.getUrlHost());
if (!resp.isSuccess()) { if (!resp.isSuccess()) {
logger.info("拉取群异常={}", JSON.toJSON(resp)); logger.info("拉取群异常={}", JSON.toJSON(resp));
return; return;
...@@ -994,7 +998,7 @@ public class GroupChatServiceImpl implements GroupChatService { ...@@ -994,7 +998,7 @@ public class GroupChatServiceImpl implements GroupChatService {
for (GroupChatListItemDTO item : list) { for (GroupChatListItemDTO item : list) {
String wxChatIdDk = item.getChat_id(); String wxChatIdDk = item.getChat_id();
ServiceResponse<GroupChatDetailDTO> detailResp = this.qywxChatApiService ServiceResponse<GroupChatDetailDTO> detailResp = this.qywxChatApiService
.groupchatDetail(qwDTO.getDkCorpid(), secret, wxChatIdDk, 1); .groupchatDetail(qwDTO.getDkCorpid(), secret, wxChatIdDk, 1 , true , qwDTO.getUrlHost());
if (detailResp.isSuccess()) { if (detailResp.isSuccess()) {
GroupChatDetailDTO detail = detailResp.getResult(); GroupChatDetailDTO detail = detailResp.getResult();
Long createTimeLong = detail.getCreate_time() * 1000; Long createTimeLong = detail.getCreate_time() * 1000;
...@@ -1092,8 +1096,8 @@ public class GroupChatServiceImpl implements GroupChatService { ...@@ -1092,8 +1096,8 @@ public class GroupChatServiceImpl implements GroupChatService {
} }
List<TabGroupChat> list = this.groupChatMapper.listByIdSet(new HashSet<>(groupChatIdList)); List<TabGroupChat> list = this.groupChatMapper.listByIdSet(new HashSet<>(groupChatIdList));
List<String> wxChatIdList = list.stream().map(dto -> dto.getWxChatId()).collect(Collectors.toList()); List<String> wxChatIdList = list.stream().map(dto -> dto.getWxChatId()).collect(Collectors.toList());
ServiceResponse<List<FailChatListDTO>> resp = this.qywxChatApiService.transfer(qwDTO.getThirdCorpid(), ServiceResponse<List<FailChatListDTO>> resp = this.qywxChatApiService.transfer(qwDTO.getThirdCorpid(),
config.getWxSuiteid(), wxChatIdList, userid); qwDTO.getSelf3thSecret(), wxChatIdList, userid,qwDTO.isSelf(),qwDTO.getUrlHost());
logger.info("群继承,继承人={}", JSON.toJSONString(resp), userid); logger.info("群继承,继承人={}", JSON.toJSONString(resp), userid);
if (!resp.isSuccess()) { if (!resp.isSuccess()) {
return ServiceResponse.failure("9999", resp.getMessage()); return ServiceResponse.failure("9999", resp.getMessage());
......
...@@ -83,12 +83,17 @@ public class MaterialReportBuilder { ...@@ -83,12 +83,17 @@ public class MaterialReportBuilder {
if (context.getStaffClerkRelations().size() == 1) { if (context.getStaffClerkRelations().size() == 1) {
StaffClerkRelationDTO staffClerkRelationDTO = context.getStaffClerkRelations().get(0); StaffClerkRelationDTO staffClerkRelationDTO = context.getStaffClerkRelations().get(0);
if (staffClerkRelationDTO.getClerkType() != null && staffClerkRelationDTO.getClerkType() == 2) { if (staffClerkRelationDTO.getClerkType() != null && staffClerkRelationDTO.getClerkType() == 2) {
log.info("成员clerId:{}, staffId: {} 为区经角色", staffClerkRelationDTO.getClerkId(), staffClerkRelationDTO.getStaffId()); log.info("成员clerkId:{}, staffId: {} 为区经角色", staffClerkRelationDTO.getClerkId(), staffClerkRelationDTO.getStaffId());
// 区经无主门店 // 区经无主门店
context.setClerkId(staffClerkRelationDTO.getClerkId()); context.setClerkId(staffClerkRelationDTO.getClerkId());
// 是区经角色
context.setManager(true);
return; return;
} }
} }
log.info("成员{}为导购角色", context.getStaffId());
context.setManager(false);
// 获取成员主门店
TabHaobanClerkMainStoreRelated mainStoreInfo = clerkMainStoreRelatedService.getMainStoreByStaffId(context.getStaffId(), context.getStaffInfo().getWxEnterpriseId()); TabHaobanClerkMainStoreRelated mainStoreInfo = clerkMainStoreRelatedService.getMainStoreByStaffId(context.getStaffId(), context.getStaffInfo().getWxEnterpriseId());
if (mainStoreInfo != null) { if (mainStoreInfo != null) {
context.setMainStoreId(mainStoreInfo.getStoreId()); context.setMainStoreId(mainStoreInfo.getStoreId());
...@@ -97,7 +102,7 @@ public class MaterialReportBuilder { ...@@ -97,7 +102,7 @@ public class MaterialReportBuilder {
.filter(item -> StringUtils.equals(item.getStoreId(), mainStoreInfo.getStoreId())) .filter(item -> StringUtils.equals(item.getStoreId(), mainStoreInfo.getStoreId()))
.findFirst(); .findFirst();
if (!mainClerkInfo.isPresent()) { if (!mainClerkInfo.isPresent()) {
log.info("成员{}与主门店{}不存在导购关联关系", context.getStaffId(), context.getMainStoreId()); log.info("成员{}的主门店{}不在当前企业{}的绑定关系中", context.getStaffId(), context.getMainStoreId(), context.getEnterpriseId());
return; return;
} }
// 成员在主门店时的clerkId // 成员在主门店时的clerkId
...@@ -112,6 +117,10 @@ public class MaterialReportBuilder { ...@@ -112,6 +117,10 @@ public class MaterialReportBuilder {
*/ */
public void buildMaterialReportData(MaterialReportContext context) { public void buildMaterialReportData(MaterialReportContext context) {
// 获取该导购/店长/区经 的周报/月报数据 // 获取该导购/店长/区经 的周报/月报数据
if (StringUtils.isBlank(context.getClerkId())) {
log.info("成员{} 默认主门店的clerkId不存在 不发送应用消息", context.getStaffId());
return;
}
String clerkId = context.getClerkId(); String clerkId = context.getClerkId();
String enterpriseId = context.getEnterpriseId(); String enterpriseId = context.getEnterpriseId();
MaterialDataAdaptor.MaterialDataResult materialDataResult; MaterialDataAdaptor.MaterialDataResult materialDataResult;
...@@ -187,12 +196,13 @@ public class MaterialReportBuilder { ...@@ -187,12 +196,13 @@ public class MaterialReportBuilder {
newsSendMessage.setAgentId(Integer.parseInt(wxEnterpriseQwDTO.getAgentId())); newsSendMessage.setAgentId(Integer.parseInt(wxEnterpriseQwDTO.getAgentId()));
newsSendMessage.setUserIds(Collections.singletonList(wxUserId)); newsSendMessage.setUserIds(Collections.singletonList(wxUserId));
QywxNewsArticleMessageDTO articleInfo = new QywxNewsArticleMessageDTO(); QywxNewsArticleMessageDTO articleInfo = new QywxNewsArticleMessageDTO();
articleInfo.setAppid(config.getAppid()); articleInfo.setAppid(wxEnterpriseQwDTO.getHbWxaAppid());
articleInfo.setTitle(context.getMessageTitle()); articleInfo.setTitle(context.getMessageTitle());
articleInfo.setDescription(context.getMessageDesc()); articleInfo.setDescription(context.getMessageDesc());
final NoticeMessageTypeEnum noticeMessageTypeEnum = MaterialReportType.WEEK.getCode().equals(context.getReportType()) ? NoticeMessageTypeEnum.MATERIAL_REPORT_NOTIFY_WEEK : NoticeMessageTypeEnum.MATERIAL_REPORT_NOTIFY_MONTH; String extendParams = StringUtils.isNotBlank(context.getMainStoreId()) ? context.getMainStoreId() : context.getEnterpriseId();
articleInfo.setPagepath(NoticeMessageUtil.buildMiniAppUrl(noticeMessageTypeEnum, context.extendParams(context.getMainStoreId()))); final NoticeMessageTypeEnum noticeMessageTypeEnum = MaterialReportType.WEEK.getCode().equals(context.getReportType()) ? NoticeMessageTypeEnum.MATERIAL_REPORT_NOTIFY_WEEK : NoticeMessageTypeEnum.MATERIAL_REPORT_NOTIFY_MONTH;
articleInfo.setPagepath(NoticeMessageUtil.buildMiniAppUrl(noticeMessageTypeEnum, context.extendParams(extendParams)));
articleInfo.setPicurl(context.getMaterialReportUrl()); articleInfo.setPicurl(context.getMaterialReportUrl());
newsSendMessage.setArticleMessages(Collections.singletonList(articleInfo)); newsSendMessage.setArticleMessages(Collections.singletonList(articleInfo));
return newsSendMessage; return newsSendMessage;
......
...@@ -198,7 +198,7 @@ public class PotentialCustomerNotifyBuilder { ...@@ -198,7 +198,7 @@ public class PotentialCustomerNotifyBuilder {
/* 消息中心修改此处 /* 消息中心修改此处
QywxXcxSendMessageDTO messageDTO = this.buildApplicationMessage(staffClerkRelation, wxEnterpriseQwDTO, QywxXcxSendMessageDTO messageDTO = this.buildApplicationMessage(staffClerkRelation, wxEnterpriseQwDTO,
customerStaticsBOMap.get(staffClerkRelation.getClerkId()).getNum(), context.buildExtendParams(staffClerkRelation.getStoreId(), staffClerkRelation.getClerkId())); customerStaticsBOMap.get(staffClerkRelation.getClerkId()).getNum(), context.buildExtendParams(staffClerkRelation.getStoreId(), staffClerkRelation.getClerkId()));
boolean sendMessage = qywxSuiteApiService.sendMessage(wxEnterpriseQwDTO.getThirdCorpid(), config.getWxSuiteid(), messageDTO); boolean sendMessage = qywxSuiteApiService.sendMessage(wxEnterpriseQwDTO.getThirdCorpid(), wxEnterpriseQwDTO.getSelf3thSecret(), messageDTO,wxEnterpriseQwDTO.isSelf(),wxEnterpriseQwDTO.getUrlHost());
log.info("发送销售线索应用消息结果 {}", sendMessage);*/ log.info("发送销售线索应用消息结果 {}", sendMessage);*/
Map<String, String> variableMap = new HashMap<>(); Map<String, String> variableMap = new HashMap<>();
variableMap.put("memberNum", customerStaticsBOMap.get(staffClerkRelation.getClerkId()).getNum().toString()); variableMap.put("memberNum", customerStaticsBOMap.get(staffClerkRelation.getClerkId()).getNum().toString());
...@@ -228,7 +228,7 @@ public class PotentialCustomerNotifyBuilder { ...@@ -228,7 +228,7 @@ public class PotentialCustomerNotifyBuilder {
itemDTO.setValue(String.format("新增%s个客户的销售线索,请及时跟进", count)); itemDTO.setValue(String.format("新增%s个客户的销售线索,请及时跟进", count));
ArrayList<String> list = new ArrayList<>(); ArrayList<String> list = new ArrayList<>();
list.add(wxUserId); list.add(wxUserId);
messageDTO.setAppid(config.getAppid()); messageDTO.setAppid(wxEnterpriseQwDTO.getHbWxaAppid());
messageDTO.setUserIds(list); messageDTO.setUserIds(list);
messageDTO.setPage(NoticeMessageUtil.buildMiniAppUrl(NoticeMessageTypeEnum.POTENTIAL_CUSTOMER_NOTIFY, extendParams)); messageDTO.setPage(NoticeMessageUtil.buildMiniAppUrl(NoticeMessageTypeEnum.POTENTIAL_CUSTOMER_NOTIFY, extendParams));
messageDTO.setTitle("销售线索通知"); messageDTO.setTitle("销售线索通知");
......
...@@ -20,12 +20,14 @@ import com.gic.haoban.manage.service.service.content.MaterialReportService; ...@@ -20,12 +20,14 @@ import com.gic.haoban.manage.service.service.content.MaterialReportService;
import com.gic.haoban.manage.service.service.content.adaptor.MaterialReportBuilder; import com.gic.haoban.manage.service.service.content.adaptor.MaterialReportBuilder;
import com.gic.haoban.manage.service.service.message.NoticeMessageHandler; import com.gic.haoban.manage.service.service.message.NoticeMessageHandler;
import com.gic.haoban.manage.service.service.notify.NoticeMessageService; import com.gic.haoban.manage.service.service.notify.NoticeMessageService;
import com.gic.haoban.manage.service.util.ApolloUtils;
import com.gic.message.center.api.subscribe.model.NoticeMessageForm; import com.gic.message.center.api.subscribe.model.NoticeMessageForm;
import com.gic.wechat.api.dto.qywx.QywxNewsArticleMessageDTO; import com.gic.wechat.api.dto.qywx.QywxNewsArticleMessageDTO;
import com.gic.wechat.api.dto.qywx.QywxNewsSendMessageDTO; import com.gic.wechat.api.dto.qywx.QywxNewsSendMessageDTO;
import com.gic.wechat.api.service.qywx.QywxSuiteApiService; import com.gic.wechat.api.service.qywx.QywxSuiteApiService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -107,6 +109,11 @@ public class MaterialReportServiceImpl implements MaterialReportService { ...@@ -107,6 +109,11 @@ public class MaterialReportServiceImpl implements MaterialReportService {
if (CollectionUtils.isNotEmpty(noticeMessageBos)) { if (CollectionUtils.isNotEmpty(noticeMessageBos)) {
noticeMessageService.addNoticeMessageBatch(noticeMessageBos); noticeMessageService.addNoticeMessageBatch(noticeMessageBos);
}*/ }*/
}
if (StringUtils.isBlank(context.getClerkId())) {
log.info("成员{}在企业{}中不存在主门店, 不推送企微应用消息", staffId, enterpriseId);
return;
}
// 发送企微消息 // 发送企微消息
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(staffInfo.getWxEnterpriseId()); WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(staffInfo.getWxEnterpriseId());
QywxNewsSendMessageDTO newsSendMessageDTO = materialReportBuilder.buildQywxNewsMessage(context, qwDTO); QywxNewsSendMessageDTO newsSendMessageDTO = materialReportBuilder.buildQywxNewsMessage(context, qwDTO);
...@@ -116,9 +123,16 @@ public class MaterialReportServiceImpl implements MaterialReportService { ...@@ -116,9 +123,16 @@ public class MaterialReportServiceImpl implements MaterialReportService {
} }
log.info("发送企业图文消息参数{}", JSON.toJSONString(newsSendMessageDTO)); log.info("发送企业图文消息参数{}", JSON.toJSONString(newsSendMessageDTO));
/*消息中心修改此处 /*消息中心修改此处*/
if (!ApolloUtils.useMessageCenter()){
log.info("消息中心-走老版消息通知");
/*消息中心修改此处*/
if (CollectionUtils.isNotEmpty(noticeMessageBos)) {
noticeMessageService.addNoticeMessageBatch(noticeMessageBos);
}
}
boolean result = qywxSuiteApiService.sendMessage(qwDTO.getThirdCorpid(), config.getWxSuiteid(), newsSendMessageDTO); boolean result = qywxSuiteApiService.sendMessage(qwDTO.getThirdCorpid(), config.getWxSuiteid(), newsSendMessageDTO);
log.info("成员{}发送素材企微使用报告结果 {}", staffId, result);*/ log.info("成员{}发送素材企微使用报告结果 {}", staffId, result);
Map<String, String> variableMap = new HashMap<>(); Map<String, String> variableMap = new HashMap<>();
QywxNewsArticleMessageDTO qywxNewsArticleMessageDTO = newsSendMessageDTO.getArticleMessages().get(0); QywxNewsArticleMessageDTO qywxNewsArticleMessageDTO = newsSendMessageDTO.getArticleMessages().get(0);
variableMap.put("image", qywxNewsArticleMessageDTO.getPicurl()); variableMap.put("image", qywxNewsArticleMessageDTO.getPicurl());
...@@ -147,5 +161,7 @@ public class MaterialReportServiceImpl implements MaterialReportService { ...@@ -147,5 +161,7 @@ public class MaterialReportServiceImpl implements MaterialReportService {
.userIdList(context.getClerkId() == null ? new ArrayList<>() : Collections.singletonList(context.getClerkId())) .userIdList(context.getClerkId() == null ? new ArrayList<>() : Collections.singletonList(context.getClerkId()))
.variableMap(variableMap).build()); .variableMap(variableMap).build());
boolean result = qywxSuiteApiService.sendMessage(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), newsSendMessageDTO,qwDTO.isSelf(),qwDTO.getUrlHost());
log.info("成员{}发送素材企微使用报告结果 {}", staffId, result);
} }
} }
...@@ -11,10 +11,12 @@ import org.springframework.stereotype.Service; ...@@ -11,10 +11,12 @@ import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.UniqueIdUtils; import com.gic.commons.util.UniqueIdUtils;
import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO;
import com.gic.haoban.manage.service.config.Config; import com.gic.haoban.manage.service.config.Config;
import com.gic.haoban.manage.service.dao.mapper.hm.HmQrcodeTempMapper; import com.gic.haoban.manage.service.dao.mapper.hm.HmQrcodeTempMapper;
import com.gic.haoban.manage.service.entity.hm.TabHmQrcodeTemp; import com.gic.haoban.manage.service.entity.hm.TabHmQrcodeTemp;
import com.gic.haoban.manage.service.pojo.qo.HmQrcodeTempQO; import com.gic.haoban.manage.service.pojo.qo.HmQrcodeTempQO;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.manage.service.service.hm.HmQrcodeTempService; import com.gic.haoban.manage.service.service.hm.HmQrcodeTempService;
import com.gic.wechat.api.dto.qywx.response.QywxResponseDTO; import com.gic.wechat.api.dto.qywx.response.QywxResponseDTO;
import com.gic.wechat.api.service.qywx.QywxUserApiService; import com.gic.wechat.api.service.qywx.QywxUserApiService;
...@@ -30,6 +32,8 @@ public class HmQrcodeTempServiceImpl implements HmQrcodeTempService { ...@@ -30,6 +32,8 @@ public class HmQrcodeTempServiceImpl implements HmQrcodeTempService {
private QywxUserApiService qywxUserApiService; private QywxUserApiService qywxUserApiService;
@Autowired @Autowired
private Config config; private Config config;
@Autowired
private WxEnterpriseService wxEnterpriseService ;
@Override @Override
public void save(HmQrcodeTempQO qo) { public void save(HmQrcodeTempQO qo) {
...@@ -54,10 +58,10 @@ public class HmQrcodeTempServiceImpl implements HmQrcodeTempService { ...@@ -54,10 +58,10 @@ public class HmQrcodeTempServiceImpl implements HmQrcodeTempService {
private void del(TabHmQrcodeTemp item) { private void del(TabHmQrcodeTemp item) {
try { try {
String suiteId = config.getWxSuiteid();
String corpid = item.getCorpid(); String corpid = item.getCorpid();
String configId = item.getWxConfigId(); String configId = item.getWxConfigId();
QywxResponseDTO resp = this.qywxUserApiService.delContactWay(corpid, suiteId, configId); WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(item.getWxEnterpriseId());
QywxResponseDTO resp = qywxUserApiService.delContactWay(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), configId,qwDTO.isSelf(),qwDTO.getUrlHost());
log.info("删除临时活码={}{},返回={}", configId, corpid, JSON.toJSONString(resp)); log.info("删除临时活码={}{},返回={}", configId, corpid, JSON.toJSONString(resp));
this.hmQrcodeTempMapper.deleteByPrimaryKey(item.getId()); this.hmQrcodeTempMapper.deleteByPrimaryKey(item.getId());
} catch (Exception e) { } catch (Exception e) {
......
...@@ -42,11 +42,16 @@ public class ClerkMainStoreRelatedServiceImpl implements ClerkMainStoreRelatedSe ...@@ -42,11 +42,16 @@ public class ClerkMainStoreRelatedServiceImpl implements ClerkMainStoreRelatedSe
@Autowired @Autowired
private StaffService staffService; private StaffService staffService;
@Override @Override
public TabHaobanClerkMainStoreRelated selectByWxEnterpriseIdAndStoreId(String staffId, String wxEnterpriseId) { public TabHaobanClerkMainStoreRelated selectByWxEnterpriseIdAndStoreId(String staffId, String wxEnterpriseId) {
return mapper.selectByWxEnterpriseIdAndStoreId(staffId, wxEnterpriseId, null); return mapper.selectByWxEnterpriseIdAndStoreId(staffId, wxEnterpriseId, null);
} }
@Override
public TabHaobanClerkMainStoreRelated selectStaffMainStore(String staffId, String wxEnterpriseId) {
return mapper.selectByWxEnterpriseIdAndStoreId(staffId, wxEnterpriseId, null);
}
@Override @Override
public void setMainStore(String staffId, String storeId, String wxEnterpriseId) { public void setMainStore(String staffId, String storeId, String wxEnterpriseId) {
...@@ -55,7 +60,6 @@ public class ClerkMainStoreRelatedServiceImpl implements ClerkMainStoreRelatedSe ...@@ -55,7 +60,6 @@ public class ClerkMainStoreRelatedServiceImpl implements ClerkMainStoreRelatedSe
logger.info("区经无需设置主门店:{}", staffId); logger.info("区经无需设置主门店:{}", staffId);
return; return;
} }
String uuId = com.gic.haoban.common.utils.StringUtil.randomUUID(); String uuId = com.gic.haoban.common.utils.StringUtil.randomUUID();
Date now = new Date(); Date now = new Date();
TabHaobanClerkMainStoreRelated t = new TabHaobanClerkMainStoreRelated(); TabHaobanClerkMainStoreRelated t = new TabHaobanClerkMainStoreRelated();
...@@ -68,9 +72,10 @@ public class ClerkMainStoreRelatedServiceImpl implements ClerkMainStoreRelatedSe ...@@ -68,9 +72,10 @@ public class ClerkMainStoreRelatedServiceImpl implements ClerkMainStoreRelatedSe
t.setFreshFriendFlag(1); t.setFreshFriendFlag(1);
t.setClerkMainStoreRelatedId(uuId); t.setClerkMainStoreRelatedId(uuId);
mapper.insert(t); mapper.insert(t);
}
logger.info("切换主门店-刷新企业微信好友:{},{}", staffId, storeId);
//主门店切换需要刷新企业微信好友 @Override
public void reflushExternal(String wxEnterpriseId ,String staffId) {
TabHaobanStaff staff = staffService.selectById(staffId); TabHaobanStaff staff = staffService.selectById(staffId);
if (staff == null) { if (staff == null) {
logger.info("员工不存在:{}", staffId); logger.info("员工不存在:{}", staffId);
...@@ -79,21 +84,16 @@ public class ClerkMainStoreRelatedServiceImpl implements ClerkMainStoreRelatedSe ...@@ -79,21 +84,16 @@ public class ClerkMainStoreRelatedServiceImpl implements ClerkMainStoreRelatedSe
String taskName = "自动刷新企业微信好友(" + staff.getStaffName() + ")"; String taskName = "自动刷新企业微信好友(" + staff.getStaffName() + ")";
String taskId = dealSyncOperationApiService.createWxFriendTaskSingle(wxEnterpriseId, taskName, staffId, staff.getStaffName(), SyncTaskTypeEnum.FRIEND_SINGLE.getType()); String taskId = dealSyncOperationApiService.createWxFriendTaskSingle(wxEnterpriseId, taskName, staffId, staff.getStaffName(), SyncTaskTypeEnum.FRIEND_SINGLE.getType());
if (StringUtils.isBlank(taskId)) { if (StringUtils.isBlank(taskId)) {
logger.info("刷新好友失败或正在刷新:{},{}", staffId, storeId); logger.info("刷新好友失败或正在刷新:{},{}", staffId);
return; return;
} }
dealSyncOperationApiService.dealWxFriendClerkSingle(taskId, staffId, staffId, wxEnterpriseId); dealSyncOperationApiService.dealWxFriendClerkSingle(taskId, staffId, staffId, wxEnterpriseId);
logger.info("任务id:{}", taskId); logger.info("开始自动刷新好友任务id={},staffId={}", taskId,staffId);
} }
@Override @Override
public TabHaobanClerkMainStoreRelated getMainStoreByStaffId(String staffId, String wxEnterpriseId) { public TabHaobanClerkMainStoreRelated getMainStoreByStaffId(String staffId, String wxEnterpriseId) {
TabHaobanClerkMainStoreRelated mainStoreRelated = mapper.selectByWxEnterpriseIdAndStoreId(staffId, wxEnterpriseId, null); return this.getMainStoreByStaffId(staffId, wxEnterpriseId,null);
if (null != mainStoreRelated) {
return mainStoreRelated;
}
return setStaffMainStore(staffId, wxEnterpriseId, null);
} }
@Override @Override
......
...@@ -96,7 +96,7 @@ public class HandoverServiceImpl implements HandoverService { ...@@ -96,7 +96,7 @@ public class HandoverServiceImpl implements HandoverService {
Map<String, List<QywxUnassignedInfoDTO>> handoverUserMap = infoList.stream().collect(Collectors.groupingBy(dto -> dto.getHandoverUserid())); Map<String, List<QywxUnassignedInfoDTO>> handoverUserMap = infoList.stream().collect(Collectors.groupingBy(dto -> dto.getHandoverUserid()));
handoverUserMap.forEach((userId, list) -> { handoverUserMap.forEach((userId, list) -> {
boolean checkFlag = checkStaffOver(secretSetting, userId, qwDTO.getDkCorpid()); boolean checkFlag = checkStaffOver(secretSetting, userId, qwDTO.getDkCorpid() ,qwDTO);
if (checkFlag) { if (checkFlag) {
logger.info("该用户存在,不需要离职基础:{},{}", userId, wxEnterpriseId); logger.info("该用户存在,不需要离职基础:{},{}", userId, wxEnterpriseId);
return; return;
...@@ -144,8 +144,8 @@ public class HandoverServiceImpl implements HandoverService { ...@@ -144,8 +144,8 @@ public class HandoverServiceImpl implements HandoverService {
return false; return false;
} }
private boolean checkStaffOver(SecretSettingDTO secretSetting, String userId, String corpId) { private boolean checkStaffOver(SecretSettingDTO secretSetting, String userId, String corpId,WxEnterpriseQwDTO qwDTO) {
UserDTO user = qywxUserApiService.getSelfWorkWxUser(corpId, secretSetting.getSecretVal(), userId); UserDTO user = qywxUserApiService.getSelfWorkWxUser(corpId, secretSetting.getSecretVal(), userId , qwDTO.getUrlHost());
if (null == user) { if (null == user) {
return false; return false;
} }
......
...@@ -27,7 +27,6 @@ import com.gic.haoban.manage.service.entity.TabHaobanMaterial; ...@@ -27,7 +27,6 @@ import com.gic.haoban.manage.service.entity.TabHaobanMaterial;
import com.gic.haoban.manage.service.entity.TabMaterialContent; import com.gic.haoban.manage.service.entity.TabMaterialContent;
import com.gic.haoban.manage.service.service.MaterialService; import com.gic.haoban.manage.service.service.MaterialService;
import com.gic.haoban.manage.service.service.WxEnterpriseService; import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.manage.service.util.CommonUtil;
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;
import com.gic.weimob.common.Md5Util; import com.gic.weimob.common.Md5Util;
...@@ -216,6 +215,7 @@ public class MaterialServiceImpl implements MaterialService { ...@@ -216,6 +215,7 @@ public class MaterialServiceImpl implements MaterialService {
arr = url.split("/"); arr = url.split("/");
} }
int count = arr.length; int count = arr.length;
boolean selfFlag = qwDTO.isSelf() ;
if(qwUploadFrom==2) { if(qwUploadFrom==2) {
// 朋友圈上传接口 // 朋友圈上传接口
if (type == 2) { if (type == 2) {
...@@ -226,10 +226,10 @@ public class MaterialServiceImpl implements MaterialService { ...@@ -226,10 +226,10 @@ public class MaterialServiceImpl implements MaterialService {
url+= "?imageView2/2/w/1440/h/1080" ; url+= "?imageView2/2/w/1440/h/1080" ;
logger.info("url={}",url); logger.info("url={}",url);
} }
jp = qywxSuiteApiService.uploadAttachment(qwDTO.getThirdCorpid(), config.getWxSuiteid(), CommonUtil.getFileByte(url), arr[count - 1], fileType.getCode()); jp = qywxSuiteApiService.uploadAttachment(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), url, arr[count - 1], fileType.getCode() , selfFlag , qwDTO.getUrlHost());
}else { }else {
// 群发上传 // 群发上传
jp = qywxSuiteApiService.uploadMedia(qwDTO.getThirdCorpid(), config.getWxSuiteid(), CommonUtil.getFileByte(url), arr[count - 1], fileType.getCode()); jp = qywxSuiteApiService.uploadMedia(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), url, arr[count - 1], fileType.getCode() , selfFlag , qwDTO.getUrlHost());
} }
if (jp.getErrorCode() == 0) { if (jp.getErrorCode() == 0) {
if(from==1) { if(from==1) {
......
...@@ -164,7 +164,7 @@ public class PreDealServiceImpl implements PreDealService { ...@@ -164,7 +164,7 @@ public class PreDealServiceImpl implements PreDealService {
} }
@Override @Override
public TabHaobanPreDealLog getByRelationKey(String taskId, Integer dataType, String relationKey) { public List<TabHaobanPreDealLog> getByRelationKey(String taskId, Integer dataType, String relationKey) {
return preDealLogMapper.getByRelationKey(taskId, dataType, relationKey); return preDealLogMapper.getByRelationKey(taskId, dataType, relationKey);
} }
......
...@@ -107,8 +107,14 @@ public class QywxSendServiceImpl implements QywxSendService { ...@@ -107,8 +107,14 @@ public class QywxSendServiceImpl implements QywxSendService {
messageDTO.setSenderUserId(tabHaobanStaff.getWxUserId()); messageDTO.setSenderUserId(tabHaobanStaff.getWxUserId());
} }
// 调接口执行创建群发 // 调接口执行创建群发
JSONResponse respon = qywxSuiteApiService.sendExternalMessage(qwDTO.getThirdCorpid(), config.getWxSuiteid(), JSONResponse respon = null ;
messageDTO); if(qwDTO.isSelf()) {
respon = qywxSuiteApiService.sendExternalMessageSelf(qwDTO.getThirdCorpid(), qwDTO.getSelfSecret(),
messageDTO , qwDTO.getUrlHost());
}else {
respon = qywxSuiteApiService.sendExternalMessage(qwDTO.getThirdCorpid(), config.getWxSuiteid(),
messageDTO);
}
log.info("群发返回={}", JSON.toJSONString(respon)); log.info("群发返回={}", JSON.toJSONString(respon));
Map<String, Object> returnMap = respon.getReturnMap(); Map<String, Object> returnMap = respon.getReturnMap();
String msgIdKey = "msgid"; String msgIdKey = "msgid";
...@@ -154,7 +160,7 @@ public class QywxSendServiceImpl implements QywxSendService { ...@@ -154,7 +160,7 @@ public class QywxSendServiceImpl implements QywxSendService {
range.setSender_list(senderList); range.setSender_list(senderList);
moment.setVisible_range(range); moment.setVisible_range(range);
ServiceResponse<String> resp = this.qywxExternalUserService.addMomentTask(qwDTO.getThirdCorpid(), ServiceResponse<String> resp = this.qywxExternalUserService.addMomentTask(qwDTO.getThirdCorpid(),
config.getWxSuiteid(), moment); qwDTO.getSelf3thSecret(), moment,qwDTO.isSelf(),qwDTO.getUrlHost());
log.info("朋友圈消息={},返回={}", JSON.toJSONString(moment), JSON.toJSONString(resp)); log.info("朋友圈消息={},返回={}", JSON.toJSONString(moment), JSON.toJSONString(resp));
return resp; return resp;
} }
......
package com.gic.haoban.manage.service.service.impl; package com.gic.haoban.manage.service.service.impl;
import java.util.Date;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.ToolUtil; import com.gic.commons.util.ToolUtil;
import com.gic.haoban.manage.api.dto.SecretSettingDTO; import com.gic.haoban.manage.api.dto.SecretSettingDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO;
import com.gic.haoban.manage.api.enums.SecretTypeEnum; import com.gic.haoban.manage.api.enums.SecretTypeEnum;
import com.gic.haoban.manage.service.dao.mapper.SecretSettingMapper; import com.gic.haoban.manage.service.dao.mapper.SecretSettingMapper;
import com.gic.haoban.manage.service.entity.TabSecretSetting; import com.gic.haoban.manage.service.entity.TabSecretSetting;
import com.gic.haoban.manage.service.service.SecretSettingService; import com.gic.haoban.manage.service.service.SecretSettingService;
import org.apache.commons.lang3.StringUtils; import com.gic.haoban.manage.service.service.WxEnterpriseService;
import org.apache.ibatis.annotations.Param;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/** /**
* Created 2020/6/3. * Created 2020/6/3.
...@@ -29,6 +31,8 @@ public class SecretSettingServiceImpl implements SecretSettingService { ...@@ -29,6 +31,8 @@ public class SecretSettingServiceImpl implements SecretSettingService {
@Autowired @Autowired
private SecretSettingMapper secretSettingMapper; private SecretSettingMapper secretSettingMapper;
@Autowired
private WxEnterpriseService wxEnterpriseService ;
@Override @Override
public boolean saveSecretSetting(SecretSettingDTO secretSetting) { public boolean saveSecretSetting(SecretSettingDTO secretSetting) {
...@@ -68,6 +72,11 @@ public class SecretSettingServiceImpl implements SecretSettingService { ...@@ -68,6 +72,11 @@ public class SecretSettingServiceImpl implements SecretSettingService {
logger.info("会员小程序配置使用getMemberSecretSetting接口"); logger.info("会员小程序配置使用getMemberSecretSetting接口");
return null; return null;
} }
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId) ;
// 如果是纯自建,使用自建的token
if(qwDTO.isSelf()) {
secretType = SecretTypeEnum.SELF_APP.getVal() ;
}
TabSecretSetting secretSetting = secretSettingMapper.getSecretSetting(wxEnterpriseId, secretType, null); TabSecretSetting secretSetting = secretSettingMapper.getSecretSetting(wxEnterpriseId, secretType, null);
return EntityUtil.changeEntityByJSON(SecretSettingDTO.class, secretSetting); return EntityUtil.changeEntityByJSON(SecretSettingDTO.class, secretSetting);
} }
......
...@@ -147,7 +147,7 @@ public class StaffDepartmentRelatedServiceImpl implements StaffDepartmentRelated ...@@ -147,7 +147,7 @@ public class StaffDepartmentRelatedServiceImpl implements StaffDepartmentRelated
} }
SecretSettingDTO secretSetting = secretSettingService.getSecretSetting(qwDTO.getWxEnterpriseId(), SecretTypeEnum.CUSTOMIZED_APP.getVal()); SecretSettingDTO secretSetting = secretSettingService.getSecretSetting(qwDTO.getWxEnterpriseId(), SecretTypeEnum.CUSTOMIZED_APP.getVal());
if (null != secretSetting && StringUtils.isNotBlank(secretSetting.getSecretVal())) { if (null != secretSetting && StringUtils.isNotBlank(secretSetting.getSecretVal())) {
UserDTO user = qywxUserApiService.getSelfWorkWxUser(qwDTO.getDkCorpid(), secretSetting.getSecretVal(), wxUserId); UserDTO user = qywxUserApiService.getSelfWorkWxUser(qwDTO.getDkCorpid(), secretSetting.getSecretVal(), wxUserId, qwDTO.getUrlHost());
logger.info("成员详情(代开)={}",JSON.toJSONString(user)) ; logger.info("成员详情(代开)={}",JSON.toJSONString(user)) ;
if(null != user && null != user.getDepartment()) { if(null != user && null != user.getDepartment()) {
this.staffDepartChange(staff, wxEnterpriseId, user.getDepartment(),false); ; this.staffDepartChange(staff, wxEnterpriseId, user.getDepartment(),false); ;
......
package com.gic.haoban.manage.service.service.impl; package com.gic.haoban.manage.service.service.impl;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
...@@ -20,6 +19,9 @@ import com.gic.haoban.common.utils.DingUtils; ...@@ -20,6 +19,9 @@ 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.api.dto.WxEnterpriseQwDTO;
import com.gic.haoban.manage.api.enums.SecretTypeEnum;
import com.gic.haoban.manage.service.config.Config;
import com.gic.haoban.manage.service.dao.mapper.SecretSettingMapper;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanStaffClerkRelationMapper; import com.gic.haoban.manage.service.dao.mapper.TabHaobanStaffClerkRelationMapper;
import com.gic.haoban.manage.service.dao.mapper.WxApplicationMapper; 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;
...@@ -27,6 +29,7 @@ import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseRelatedMapper; ...@@ -27,6 +29,7 @@ import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseRelatedMapper;
import com.gic.haoban.manage.service.entity.TabHaobanWxApplication; 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.entity.TabSecretSetting;
import com.gic.haoban.manage.service.service.WxEnterpriseService; import com.gic.haoban.manage.service.service.WxEnterpriseService;
@Service @Service
...@@ -41,6 +44,10 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService { ...@@ -41,6 +44,10 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService {
private WxApplicationMapper wxApplicationMapper ; private WxApplicationMapper wxApplicationMapper ;
@Autowired @Autowired
private TabHaobanStaffClerkRelationMapper tabHaobanStaffClerkRelationMapper ; private TabHaobanStaffClerkRelationMapper tabHaobanStaffClerkRelationMapper ;
@Autowired
private SecretSettingMapper secretSettingMapper;
@Autowired
private Config config;
@Override @Override
public String add(WxEnterpriseDTO wxDTO) { public String add(WxEnterpriseDTO wxDTO) {
...@@ -98,10 +105,41 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService { ...@@ -98,10 +105,41 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService {
qw.setMemberCorpid(wxEnterprise.getWxCorpid()); qw.setMemberCorpid(wxEnterprise.getWxCorpid());
} }
} }
if(qw.getWxSecurityType()==5) {
qw.setUrlHost(wxEnterprise.getUrlHost());
qw.setDkCorpid(wxEnterprise.getWxCorpid());
qw.setThirdCorpid(wxEnterprise.getWxCorpid());
qw.setMemberCorpid(wxEnterprise.getWxCorpid());
TabSecretSetting secret = secretSettingMapper.getSecretSetting(wxEnterpriseId, SecretTypeEnum.SELF_APP.getVal(), null);
if(null != secret) {
qw.setSelfSecret(secret.getSecretVal());
qw.setAgentId(secret.getAgentId());
qw.setAgentName(secret.getAgentName());
}
qw.setSelfAppid(wxEnterprise.getWxaAppid());
}
qw.setHbWxaAppid(this.getHbAppid(qw, config.getAppid()));
qw.setSelf3thSecret(this.getSecret(qw, config.getWxSuiteid()));
logger.info("企微所有corpid信息={}",JSON.toJSON(qw)); logger.info("企微所有corpid信息={}",JSON.toJSON(qw));
return qw; return qw;
} }
public String getSecret(WxEnterpriseQwDTO qwDTO, String suiteId) {
String secret = suiteId;
if (qwDTO.isSelf()) {
secret = qwDTO.getSelfSecret();
}
return secret;
}
public String getHbAppid(WxEnterpriseQwDTO qwDTO, String thirdAppid) {
String appid = thirdAppid;
if (qwDTO.isSelf()) {
appid = qwDTO.getSelfAppid();
}
return appid;
}
@Override @Override
public TabHaobanWxEnterprise getEnterpriseBycorpId(String corpId) { public TabHaobanWxEnterprise getEnterpriseBycorpId(String corpId) {
if (StringUtils.isBlank(corpId)) { if (StringUtils.isBlank(corpId)) {
...@@ -175,6 +213,10 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService { ...@@ -175,6 +213,10 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService {
@Override @Override
public void updateWxSecurityType(String wxEnterpriseId) { public void updateWxSecurityType(String wxEnterpriseId) {
WxEnterpriseQwDTO qwDTO = this.getQwInfo(wxEnterpriseId) ;
if(qwDTO.isSelf()) {
return ;
}
int wxSecurityType = this.calcSecretType(wxEnterpriseId); int wxSecurityType = this.calcSecretType(wxEnterpriseId);
if(wxSecurityType < 1 || wxSecurityType > 4) { if(wxSecurityType < 1 || wxSecurityType > 4) {
return ; return ;
......
...@@ -112,7 +112,7 @@ public interface LicenceOrderService { ...@@ -112,7 +112,7 @@ public interface LicenceOrderService {
* @param qywxOrderId * @param qywxOrderId
* @return * @return
*/ */
Integer saveQywxOrderId(Long orderId, String qywxOrderId); Integer saveQywxOrderId(Long orderId, String qywxOrderId,Date qywxExpireTime);
/** /**
* 查询订单编号id * 查询订单编号id
......
...@@ -77,27 +77,31 @@ public class LicenceOrderServiceImpl implements LicenceOrderService { ...@@ -77,27 +77,31 @@ public class LicenceOrderServiceImpl implements LicenceOrderService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public String saveOrUpdateLicenceOrder(LicenceOrderQDTO licenceOrderQDTO) { public String saveOrUpdateLicenceOrder(LicenceOrderQDTO licenceOrderQDTO) {
long orderId = UniqueIdUtils.uniqueLong(); long orderId = UniqueIdUtils.uniqueLong();
//订单不支持修改,只能新增 //订单不支持修改,只能新增
TabHaobanLicenceOrder order = JSONObject.parseObject(JSONObject.toJSONString(licenceOrderQDTO), TabHaobanLicenceOrder.class); TabHaobanLicenceOrder order = JSONObject.parseObject(JSONObject.toJSONString(licenceOrderQDTO), TabHaobanLicenceOrder.class);
Date now = new Date(); Date now = new Date();
order.setOrderId(orderId); order.setOrderId(orderId);
//默认支付状态为待支付 //默认支付状态为待支付
order.setOrderStatus(0); order.setOrderStatus(0);
order.setCreateTime(now); order.setQywxOrderStatus(0);
order.setUpdateTime(now); order.setCreateTime(now);
//生成订单编号 order.setUpdateTime(now);
String num = "ZH"+orderId; order.setQywxExpireTime(DateUtil.addDay(now, 10));
order.setOrderNumber(num); //生成订单编号
Date expireTime; String num = "ZH"+orderId;
if(order.getPayType()==1){ order.setOrderNumber(num);
expireTime = DateUtil.addNumForMinute(now, 30); Date expireTime;
}else { if(order.getPayType()==1){
expireTime = DateUtil.addDay(now, 3); expireTime = DateUtil.addNumForMinute(now, 30);
} }else {
order.setExpireTime(expireTime); expireTime = DateUtil.addDay(now, 3);
tabHaobanLicenceOrderMapper.insert(order); }
//记录订单进度 order.setExpireTime(expireTime);
saveOrderProgress(orderId,"创建订单",licenceOrderQDTO.getEnterpriseId(),licenceOrderQDTO.getWxEnterpriseId(),licenceOrderQDTO.getCreatorName(),1,null,null); tabHaobanLicenceOrderMapper.insert(order);
//记录订单进度
saveOrderProgress(orderId,"创建订单",licenceOrderQDTO.getEnterpriseId(),licenceOrderQDTO.getWxEnterpriseId(),licenceOrderQDTO.getCreatorName(),1,null,null);
//记录企业微信订单进度
saveOrderProgress(orderId,"创建订单",licenceOrderQDTO.getEnterpriseId(),licenceOrderQDTO.getWxEnterpriseId(),licenceOrderQDTO.getCreatorName(),2,null,null);
return String.valueOf(orderId); return String.valueOf(orderId);
} }
...@@ -223,13 +227,6 @@ public class LicenceOrderServiceImpl implements LicenceOrderService { ...@@ -223,13 +227,6 @@ public class LicenceOrderServiceImpl implements LicenceOrderService {
} }
PageHelper.startPage(qdto); PageHelper.startPage(qdto);
List<TabHaobanLicenceOrder> licenceOrderPage = tabHaobanLicenceOrderMapper.getLicenceOrderPage(qdto); List<TabHaobanLicenceOrder> licenceOrderPage = tabHaobanLicenceOrderMapper.getLicenceOrderPage(qdto);
//判断订单状态,支付时间已过的订单的需要更改订单状态为已过期
for (TabHaobanLicenceOrder dto : licenceOrderPage){
if (dto.getExpireTime().before(new Date()) && dto.getOrderStatus() == 0){
dto.setOrderStatus(3);
updateLicenceOrderType(dto.getOrderId(), 3,dto.getEnterpriseId(), dto.getWxEnterpriseId(), "系统",1);
}
}
return PageHelperUtils.changePageHelperToCurrentPage(licenceOrderPage, LicenceOrderPageDTO.class); return PageHelperUtils.changePageHelperToCurrentPage(licenceOrderPage, LicenceOrderPageDTO.class);
} }
...@@ -250,8 +247,8 @@ public class LicenceOrderServiceImpl implements LicenceOrderService { ...@@ -250,8 +247,8 @@ public class LicenceOrderServiceImpl implements LicenceOrderService {
} }
@Override @Override
public Integer saveQywxOrderId(Long orderId, String qywxOrderId) { public Integer saveQywxOrderId(Long orderId, String qywxOrderId,Date qywxExpireTime) {
return tabHaobanLicenceOrderMapper.saveQywxOrderId(orderId,qywxOrderId); return tabHaobanLicenceOrderMapper.saveQywxOrderId(orderId,qywxOrderId,qywxExpireTime);
} }
@Override @Override
......
...@@ -106,7 +106,6 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService { ...@@ -106,7 +106,6 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService {
public void noticeMessageMq(String json) { public void noticeMessageMq(String json) {
logger.info("通知消息:{}", json); logger.info("通知消息:{}", json);
NoticeMessageQDTO messageQDTO = JSONObject.parseObject(json, NoticeMessageQDTO.class); NoticeMessageQDTO messageQDTO = JSONObject.parseObject(json, NoticeMessageQDTO.class);
NoticeMessageTypeEnum messageTypeEnum = NoticeMessageTypeEnum.getByType(messageQDTO.getMessageType()); NoticeMessageTypeEnum messageTypeEnum = NoticeMessageTypeEnum.getByType(messageQDTO.getMessageType());
if (messageTypeEnum == null) { if (messageTypeEnum == null) {
logger.error("无消息模板:{}", json); logger.error("无消息模板:{}", json);
...@@ -244,7 +243,6 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService { ...@@ -244,7 +243,6 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService {
logger.info("成员关联列表为空"); logger.info("成员关联列表为空");
return ServiceResponse.success(); return ServiceResponse.success();
} }
NoticeMessageTypeEnum messageTypeEnum = NoticeMessageTypeEnum.getByType(notifyMessageBatchQDTO.getMessageType()); NoticeMessageTypeEnum messageTypeEnum = NoticeMessageTypeEnum.getByType(notifyMessageBatchQDTO.getMessageType());
if (messageTypeEnum == null) { if (messageTypeEnum == null) {
logger.error("无消息模板:{}", JSON.toJSONString(notifyMessageBatchQDTO)); logger.error("无消息模板:{}", JSON.toJSONString(notifyMessageBatchQDTO));
...@@ -397,15 +395,14 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService { ...@@ -397,15 +395,14 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService {
appUrl += messageTypeEnum.getPageType(); appUrl += messageTypeEnum.getPageType();
} }
appUrl += "&data=" + data; appUrl += "&data=" + data;
messageDTO.setAppid(qwDTO.getHbWxaAppid());
messageDTO.setAppid(config.getAppid());
messageDTO.setAgentId(Integer.parseInt(qwDTO.getAgentId())); messageDTO.setAgentId(Integer.parseInt(qwDTO.getAgentId()));
messageDTO.setAgentName(qwDTO.getAgentName()); messageDTO.setAgentName(qwDTO.getAgentName());
messageDTO.setUserIds(wxUserIdList); messageDTO.setUserIds(wxUserIdList);
messageDTO.setPage(appUrl); messageDTO.setPage(appUrl);
messageDTO.setTitle(StringUtils.isNotBlank(title)?title: messageTypeEnum.getName()); messageDTO.setTitle(StringUtils.isNotBlank(title)?title: messageTypeEnum.getName());
messageDTO.setContent(contentList.get(0).getVal()); messageDTO.setContent(contentList.get(0).getVal());
boolean sendMessage = qywxSuiteApiService.sendMessage(qwDTO.getThirdCorpid(), config.getWxSuiteid(), messageDTO); boolean sendMessage = qywxSuiteApiService.sendMessage(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), messageDTO,qwDTO.isSelf(),qwDTO.getUrlHost());
NotifyMessageMQDTO mqdto = new NotifyMessageMQDTO(); NotifyMessageMQDTO mqdto = new NotifyMessageMQDTO();
List<String> clerkIdList = list.stream().map(StaffClerkRelationDTO::getClerkId).collect(Collectors.toList()); List<String> clerkIdList = list.stream().map(StaffClerkRelationDTO::getClerkId).collect(Collectors.toList());
mqdto.setClerkIdList(clerkIdList); mqdto.setClerkIdList(clerkIdList);
...@@ -558,11 +555,11 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService { ...@@ -558,11 +555,11 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService {
List<String> userList = new ArrayList<>(); List<String> userList = new ArrayList<>();
userList.add(wxUserId); userList.add(wxUserId);
messageDTO.setAppid(config.getAppid()); messageDTO.setAppid(qwDTO.getHbWxaAppid());
messageDTO.setUserIds(userList); messageDTO.setUserIds(userList);
messageDTO.setPage(appUrl); messageDTO.setPage(appUrl);
messageDTO.setTitle(StringUtils.isNotBlank(title)?title:messageTypeEnum.getName()); messageDTO.setTitle(StringUtils.isNotBlank(title)?title:messageTypeEnum.getName());
messageDTO.setItems(items); messageDTO.setItems(items);
qywxSuiteApiService.sendMessage(corpid, config.getWxSuiteid(), messageDTO); qywxSuiteApiService.sendMessage(corpid, qwDTO.getSelf3thSecret(), messageDTO,qwDTO.isSelf(),qwDTO.getUrlHost());
} }
} }
...@@ -23,9 +23,10 @@ public class ClerkMainStoreRelatedApiServiceImpl implements ClerkMainStoreRelate ...@@ -23,9 +23,10 @@ public class ClerkMainStoreRelatedApiServiceImpl implements ClerkMainStoreRelate
@Override @Override
public void setMainStore(String staffId, String storeId, String wxEnterpriseId) { public void setMainStore(String staffId, String storeId, String wxEnterpriseId) {
TabHaobanClerkMainStoreRelated related = clerkMainStoreRelatedService.selectByWxEnterpriseIdAndStoreId(staffId, wxEnterpriseId); TabHaobanClerkMainStoreRelated related = clerkMainStoreRelatedService.selectStaffMainStore(staffId, wxEnterpriseId);
if (related == null) { if (related == null) {
clerkMainStoreRelatedService.setMainStore(staffId, storeId, wxEnterpriseId); this.clerkMainStoreRelatedService.setMainStore(staffId, storeId, wxEnterpriseId);
this.clerkMainStoreRelatedService.reflushExternal(wxEnterpriseId, staffId);
} else if (null != related && (!related.getStoreId().equals(storeId))) { } else if (null != related && (!related.getStoreId().equals(storeId))) {
related.setStatusFlag(0); related.setStatusFlag(0);
related.setUpdateTime(new Date()); related.setUpdateTime(new Date());
......
...@@ -535,7 +535,7 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ ...@@ -535,7 +535,7 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ
unlockTask(wxEnterpriseId); unlockTask(wxEnterpriseId);
return "没有配置secret"; return "没有配置secret";
} }
List<com.gic.wechat.api.dto.qywx.DepartmentDTO> list = qywxDepartmentApiService.listSelfDepartment(qwDTO.getDkCorpid(), secretSetting.getSecretVal(), 1); List<com.gic.wechat.api.dto.qywx.DepartmentDTO> list = qywxDepartmentApiService.listSelfDepartment(qwDTO.getDkCorpid(), secretSetting.getSecretVal(), 1,qwDTO.getUrlHost());
if (CollectionUtils.isEmpty(list)) { if (CollectionUtils.isEmpty(list)) {
logger.info("没有数据同步"); logger.info("没有数据同步");
syncTaskService.updateTaskStatus(taskId, SyncTaskStatusEnum.exception_close.getVal()); syncTaskService.updateTaskStatus(taskId, SyncTaskStatusEnum.exception_close.getVal());
......
...@@ -13,6 +13,7 @@ import com.gic.haoban.common.utils.StringUtil; ...@@ -13,6 +13,7 @@ import com.gic.haoban.common.utils.StringUtil;
import com.gic.haoban.manage.api.dto.DepartmentDTO; import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.api.dto.DepartmentShortDTO; import com.gic.haoban.manage.api.dto.DepartmentShortDTO;
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.service.DepartmentApiService; import com.gic.haoban.manage.api.service.DepartmentApiService;
import com.gic.haoban.manage.api.service.StaffApiService; import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService; import com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService;
...@@ -207,7 +208,8 @@ public class DepartmentApiServiceImpl implements DepartmentApiService { ...@@ -207,7 +208,8 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
if (RedisUtil.getCache(key) == null) { if (RedisUtil.getCache(key) == null) {
RedisUtil.setCache(key, 1, 60 * 60L); RedisUtil.setCache(key, 1, 60 * 60L);
String taskId = StringUtil.randomUUID(); String taskId = StringUtil.randomUUID();
List<com.gic.wechat.api.dto.qywx.DepartmentDTO> list = this.qywxDepartmentApiService.listSelfDepartment(corpid, contactSecret, null); WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId) ;
List<com.gic.wechat.api.dto.qywx.DepartmentDTO> list = this.qywxDepartmentApiService.listSelfDepartment(corpid, contactSecret, null , qwDTO.getUrlHost());
logger.info("企业所有部门数据:{}", JSON.toJSONString(list)); logger.info("企业所有部门数据:{}", JSON.toJSONString(list));
if (CollectionUtils.isNotEmpty(list)) { if (CollectionUtils.isNotEmpty(list)) {
this.addAllDepartment(list, 0, wxEnterpriseId, corpid, contactSecret, taskId); this.addAllDepartment(list, 0, wxEnterpriseId, corpid, contactSecret, taskId);
...@@ -225,7 +227,8 @@ public class DepartmentApiServiceImpl implements DepartmentApiService { ...@@ -225,7 +227,8 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
String corpid = json.getString("corpid"); String corpid = json.getString("corpid");
String contactSecret = json.getString("contactSecret"); String contactSecret = json.getString("contactSecret");
String taskId = json.getString("taskId"); String taskId = json.getString("taskId");
List<com.gic.wechat.api.dto.qywx.DepartmentDTO> list = this.qywxDepartmentApiService.listSelfDepartment(corpid, contactSecret, parentId); WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId) ;
List<com.gic.wechat.api.dto.qywx.DepartmentDTO> list = this.qywxDepartmentApiService.listSelfDepartment(corpid, contactSecret, parentId,qwDTO.getUrlHost());
List<com.gic.wechat.api.dto.qywx.DepartmentDTO> handerList = new ArrayList<>(); List<com.gic.wechat.api.dto.qywx.DepartmentDTO> handerList = new ArrayList<>();
if (parentId.equals(0)) { if (parentId.equals(0)) {
for (com.gic.wechat.api.dto.qywx.DepartmentDTO departmentDTO : list) { for (com.gic.wechat.api.dto.qywx.DepartmentDTO departmentDTO : list) {
......
...@@ -27,7 +27,6 @@ import com.gic.haoban.manage.api.service.WxEnterpriseApiService; ...@@ -27,7 +27,6 @@ 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.*; import com.gic.haoban.manage.service.dao.mapper.*;
import com.gic.haoban.manage.service.entity.TabHaobanExternalClerkRelated; import com.gic.haoban.manage.service.entity.TabHaobanExternalClerkRelated;
import com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise; import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise;
import com.gic.haoban.manage.service.entity.ext.MemberStaffRelExtDO; import com.gic.haoban.manage.service.entity.ext.MemberStaffRelExtDO;
import com.gic.haoban.manage.service.pojo.QywxTagSyncInfoPojo; import com.gic.haoban.manage.service.pojo.QywxTagSyncInfoPojo;
...@@ -488,8 +487,8 @@ public class ExternalClerkRelatedApiServiceImpl implements ExternalClerkRelatedA ...@@ -488,8 +487,8 @@ public class ExternalClerkRelatedApiServiceImpl implements ExternalClerkRelatedA
// } // }
@Override @Override
public List<String> listMemberAndClerk(List<String> memberIdList, List<String> clerkIdList, String enterpriseId) { public List<String> listMemberAndStaff(List<String> memberIdList, String staffId, String enterpriseId) {
List<String> list = tabHaobanExternalClerkRelatedMapper.listMemberAndClerk(memberIdList, clerkIdList, enterpriseId); List<String> list = tabHaobanExternalClerkRelatedMapper.listMemberAndStaff(memberIdList, staffId, enterpriseId);
return list; return list;
} }
......
...@@ -104,7 +104,7 @@ public class HandoverOperationApiServiceImpl implements HandoverOperationApiServ ...@@ -104,7 +104,7 @@ public class HandoverOperationApiServiceImpl implements HandoverOperationApiServ
String cursor = null; String cursor = null;
do { do {
//离职成员客户列表 //离职成员客户列表
unassignedListDTO = qywxUserApiService.getUnassignedList(qwDTO.getThirdCorpid(), config.getWxSuiteid(), cursor); unassignedListDTO = qywxUserApiService.getUnassignedList(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), cursor , qwDTO.isSelf(),qwDTO.getUrlHost());
cursor = unassignedListDTO.getNextCursor(); cursor = unassignedListDTO.getNextCursor();
if (CollectionUtils.isNotEmpty(unassignedListDTO.getInfo())) { if (CollectionUtils.isNotEmpty(unassignedListDTO.getInfo())) {
ret.addAll(unassignedListDTO.getInfo()); ret.addAll(unassignedListDTO.getInfo());
...@@ -145,7 +145,7 @@ public class HandoverOperationApiServiceImpl implements HandoverOperationApiServ ...@@ -145,7 +145,7 @@ public class HandoverOperationApiServiceImpl implements HandoverOperationApiServ
logger.info("takeover is null={}",dto.getTakeoverStaffId()); logger.info("takeover is null={}",dto.getTakeoverStaffId());
return; return;
} }
QywxTransferCustomerDTO customerDTO = qywxUserApiService.transferResult(qwDTO.getThirdCorpid(), config.getWxSuiteid(), handover.getWxUserId(), takeover.getWxUserId(), true); QywxTransferCustomerDTO customerDTO = qywxUserApiService.transferResult(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), handover.getWxUserId(), takeover.getWxUserId(), true , qwDTO.isSelf() , qwDTO.getUrlHost());
if (customerDTO.getErrcode() != 0) { if (customerDTO.getErrcode() != 0) {
return; return;
} }
...@@ -255,7 +255,7 @@ public class HandoverOperationApiServiceImpl implements HandoverOperationApiServ ...@@ -255,7 +255,7 @@ public class HandoverOperationApiServiceImpl implements HandoverOperationApiServ
for (Map.Entry<String, List<String>> entry : handoverStaffExternalMap.entrySet()) { for (Map.Entry<String, List<String>> entry : handoverStaffExternalMap.entrySet()) {
String wxUserId = entry.getKey(); String wxUserId = entry.getKey();
List<String> list = entry.getValue(); List<String> list = entry.getValue();
QywxTransferCustomerDTO transferCustomerResp = qywxUserApiService.transferCustomer(qwDTO.getThirdCorpid(), config.getWxSuiteid(), wxUserId, takeoverUserId, list); QywxTransferCustomerDTO transferCustomerResp = qywxUserApiService.transferCustomer(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), wxUserId, takeoverUserId, list,qwDTO.isSelf(),qwDTO.getUrlHost());
if (transferCustomerResp.getErrcode() != 0) { if (transferCustomerResp.getErrcode() != 0) {
logger.info("转移异常"); logger.info("转移异常");
} }
......
...@@ -15,6 +15,7 @@ import com.gic.haoban.manage.api.dto.CommonMQDTO; ...@@ -15,6 +15,7 @@ import com.gic.haoban.manage.api.dto.CommonMQDTO;
import com.gic.haoban.manage.api.service.HaobanCommonMQApiService; import com.gic.haoban.manage.api.service.HaobanCommonMQApiService;
import com.gic.haoban.manage.service.service.StaffDepartmentRelatedService; import com.gic.haoban.manage.service.service.StaffDepartmentRelatedService;
import com.gic.haoban.manage.service.service.WelcomeSendService; import com.gic.haoban.manage.service.service.WelcomeSendService;
import com.gic.member.api.service.MemberOpenCardBusinessService;
import com.gic.mq.sdk.GicMQClient; import com.gic.mq.sdk.GicMQClient;
import com.gic.quartz.api.dto.QuartzTaskDTO; import com.gic.quartz.api.dto.QuartzTaskDTO;
import com.gic.quartz.api.service.QuartzService; import com.gic.quartz.api.service.QuartzService;
...@@ -32,6 +33,8 @@ public class HaobanCommonMQApiServiceImpl implements HaobanCommonMQApiService { ...@@ -32,6 +33,8 @@ public class HaobanCommonMQApiServiceImpl implements HaobanCommonMQApiService {
private StaffDepartmentRelatedService staffDepartmentRelatedService; private StaffDepartmentRelatedService staffDepartmentRelatedService;
@Autowired @Autowired
private WelcomeSendService welcomeSendService; private WelcomeSendService welcomeSendService;
@Autowired
private MemberOpenCardBusinessService memberOpenCardBusinessService ;
@Override @Override
public void putCommonMessage(CommonMQDTO dto) { public void putCommonMessage(CommonMQDTO dto) {
...@@ -74,6 +77,13 @@ public class HaobanCommonMQApiServiceImpl implements HaobanCommonMQApiService { ...@@ -74,6 +77,13 @@ public class HaobanCommonMQApiServiceImpl implements HaobanCommonMQApiService {
if (StringUtils.isNotBlank(staffId)) { if (StringUtils.isNotBlank(staffId)) {
this.staffDepartmentRelatedService.repairStaffDepart(staffId); this.staffDepartmentRelatedService.repairStaffDepart(staffId);
} }
break ;
case 3:
String memberId = map.get("memberId") ;
enterpriseId = map.get("enterpriseId") ;
String clerkId = map.get("clerkId") ;
this.memberOpenCardBusinessService.memberClerkByQywx(enterpriseId, memberId, clerkId);
break ;
default: default:
break; break;
} }
......
...@@ -147,7 +147,7 @@ public class MaterialApiServiceImpl implements MaterialApiService { ...@@ -147,7 +147,7 @@ public class MaterialApiServiceImpl implements MaterialApiService {
if (type == 3) { if (type == 3) {
String imgUrl = materialDTO.getImgUrl(); String imgUrl = materialDTO.getImgUrl();
logger.info("【上传图片】imgUrl={}", imgUrl); logger.info("【上传图片】imgUrl={}", imgUrl);
JSONResponse response = qywxSuiteApiService.uploadImage(qwDTO.getThirdCorpid() , config.getWxSuiteid(), CommonUtil.getFileByte(imgUrl)); JSONResponse response = qywxSuiteApiService.uploadImage(qwDTO.getThirdCorpid() , qwDTO.getSelf3thSecret(), imgUrl , qwDTO.isSelf(),qwDTO.getUrlHost());
logger.info("【上传图片返回】response={}", JSON.toJSONString(response)); logger.info("【上传图片返回】response={}", JSON.toJSONString(response));
String wxImgUrl = response.getResult() == null ? "" : response.getResult().toString(); String wxImgUrl = response.getResult() == null ? "" : response.getResult().toString();
materialDTO.setWxImgUrl(wxImgUrl); materialDTO.setWxImgUrl(wxImgUrl);
...@@ -155,7 +155,8 @@ public class MaterialApiServiceImpl implements MaterialApiService { ...@@ -155,7 +155,8 @@ public class MaterialApiServiceImpl implements MaterialApiService {
if (fileType != null) { if (fileType != null) {
String[] arr = url.split("/"); String[] arr = url.split("/");
int count = arr.length; int count = arr.length;
JSONResponse jp = qywxSuiteApiService.uploadMedia(qwDTO.getThirdCorpid() , config.getWxSuiteid(), CommonUtil.getFileByte(url), arr[count - 1], fileType.getCode()); boolean selfFlag = qwDTO.isSelf() ;
JSONResponse jp = qywxSuiteApiService.uploadMedia(qwDTO.getThirdCorpid() , qwDTO.getSelf3thSecret(), url, arr[count - 1], fileType.getCode(),selfFlag,qwDTO.getUrlHost());
if (jp.getErrorCode() == 0) { if (jp.getErrorCode() == 0) {
materialDTO.setWxLastUploadTime(new Date()); materialDTO.setWxLastUploadTime(new Date());
materialDTO.setMediaId(jp.getResult().toString()); materialDTO.setMediaId(jp.getResult().toString());
...@@ -232,7 +233,7 @@ public class MaterialApiServiceImpl implements MaterialApiService { ...@@ -232,7 +233,7 @@ public class MaterialApiServiceImpl implements MaterialApiService {
String imgUrl = materialDTO.getImgUrl(); String imgUrl = materialDTO.getImgUrl();
String oldImgUrl = materialDTO.getImgUrl(); String oldImgUrl = materialDTO.getImgUrl();
if (!imgUrl.equals(oldImgUrl)) { if (!imgUrl.equals(oldImgUrl)) {
JSONResponse response = qywxSuiteApiService.uploadImage(qwDTO.getThirdCorpid(), config.getWxSuiteid(), CommonUtil.getFileByte(imgUrl)); JSONResponse response = qywxSuiteApiService.uploadImage(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), imgUrl ,qwDTO.isSelf(),qwDTO.getUrlHost());
String wxImgUrl = response.getResult() == null ? "" : response.getResult().toString(); String wxImgUrl = response.getResult() == null ? "" : response.getResult().toString();
materialDTO.setWxImgUrl(wxImgUrl); materialDTO.setWxImgUrl(wxImgUrl);
} }
...@@ -240,7 +241,8 @@ public class MaterialApiServiceImpl implements MaterialApiService { ...@@ -240,7 +241,8 @@ public class MaterialApiServiceImpl implements MaterialApiService {
if (fileType != null && !url.equals(oldUrl)) { if (fileType != null && !url.equals(oldUrl)) {
String[] arr = url.split("/"); String[] arr = url.split("/");
int count = arr.length; int count = arr.length;
JSONResponse jp = qywxSuiteApiService.uploadMedia(qwDTO.getThirdCorpid(), config.getWxSuiteid(), CommonUtil.getFileByte(url), arr[count - 1], fileType.getCode()); boolean selfFlag = qwDTO.isSelf() ;
JSONResponse jp = qywxSuiteApiService.uploadMedia(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), url , arr[count - 1], fileType.getCode(),selfFlag,qwDTO.getUrlHost());
if (jp.getErrorCode() == 0) { if (jp.getErrorCode() == 0) {
materialDTO.setWxLastUploadTime(new Date()); materialDTO.setWxLastUploadTime(new Date());
materialDTO.setMediaId(jp.getResult().toString()); materialDTO.setMediaId(jp.getResult().toString());
...@@ -289,7 +291,7 @@ public class MaterialApiServiceImpl implements MaterialApiService { ...@@ -289,7 +291,7 @@ public class MaterialApiServiceImpl implements MaterialApiService {
} }
String[] arr = url.split("/"); String[] arr = url.split("/");
int count = arr.length; int count = arr.length;
JSONResponse jp = qywxSuiteApiService.uploadMedia(qwDTO.getThirdCorpid(), config.getWxSuiteid(), CommonUtil.getFileByte(url), arr[count - 1], fileType.getCode()); JSONResponse jp = qywxSuiteApiService.uploadMedia(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), url, arr[count - 1], fileType.getCode(),qwDTO.isSelf(),qwDTO.getUrlHost());
if (jp.getErrorCode() == 0) { if (jp.getErrorCode() == 0) {
old.setWxLastUploadTime(new Date()); old.setWxLastUploadTime(new Date());
old.setMediaId(jp.getResult().toString()); old.setMediaId(jp.getResult().toString());
...@@ -449,7 +451,7 @@ public class MaterialApiServiceImpl implements MaterialApiService { ...@@ -449,7 +451,7 @@ public class MaterialApiServiceImpl implements MaterialApiService {
materialDTO.setMaterialTitle(material.getMaterialTitle()); materialDTO.setMaterialTitle(material.getMaterialTitle());
} }
materialDTO.setImgUrl(one.getMediaUrl()); materialDTO.setImgUrl(one.getMediaUrl());
String mediaId = uploadMediaToWx(qwDTO.getThirdCorpid(), one.getMediaUrl()); String mediaId = uploadMediaToWx(qwDTO.getThirdCorpid(), one.getMediaUrl(),qwDTO);
if (StringUtils.isNotEmpty(mediaId)) { if (StringUtils.isNotEmpty(mediaId)) {
materialDTO.setWxLastUploadTime(new Date()); materialDTO.setWxLastUploadTime(new Date());
materialDTO.setMediaId(mediaId); materialDTO.setMediaId(mediaId);
...@@ -460,12 +462,13 @@ public class MaterialApiServiceImpl implements MaterialApiService { ...@@ -460,12 +462,13 @@ public class MaterialApiServiceImpl implements MaterialApiService {
materialService.batchInsertMaterial(materialList); materialService.batchInsertMaterial(materialList);
} }
private String uploadMediaToWx(String corPid, String url) { private String uploadMediaToWx(String corPid, String url, WxEnterpriseQwDTO qwDTO) {
String[] arr = url.split("/"); String[] arr = url.split("/");
// 先写死为图片类型, 以后有别的再扩展 // 先写死为图片类型, 以后有别的再扩展
QywxMediaTypeEnum fileType = QywxMediaTypeEnum.IMAGE; QywxMediaTypeEnum fileType = QywxMediaTypeEnum.IMAGE;
int count = arr.length; int count = arr.length;
JSONResponse jp = qywxSuiteApiService.uploadMedia(corPid, config.getWxSuiteid(), CommonUtil.getFileByte(url), arr[count - 1], fileType.getCode()); boolean selfFlag = qwDTO.isSelf() ;
JSONResponse jp = qywxSuiteApiService.uploadMedia(corPid, qwDTO.getSelf3thSecret(), url, arr[count - 1], fileType.getCode(),selfFlag,qwDTO.getUrlHost());
if (jp.getErrorCode() == 0) { if (jp.getErrorCode() == 0) {
return jp.getResult().toString(); return jp.getResult().toString();
} }
......
...@@ -62,7 +62,8 @@ public class MiniprogramSettingServiceImpl implements MiniprogramSettingService ...@@ -62,7 +62,8 @@ public class MiniprogramSettingServiceImpl implements MiniprogramSettingService
} }
String[] arr = miniprogramSetting.getImageUrl().split("/"); String[] arr = miniprogramSetting.getImageUrl().split("/");
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(miniprogramSetting.getWxEnterpriseId()) ; WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(miniprogramSetting.getWxEnterpriseId()) ;
JSONResponse jp = qywxSuiteApiService.uploadMedia(qwDTO.getThirdCorpid(), config.getWxSuiteid(), CommonUtil.getFileByte(miniprogramSetting.getImageUrl()), arr[arr.length - 1], QywxMediaTypeEnum.IMAGE.getCode()); boolean selfFlag = qwDTO.isSelf() ;
JSONResponse jp = qywxSuiteApiService.uploadMedia(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), miniprogramSetting.getImageUrl(), arr[arr.length - 1], QywxMediaTypeEnum.IMAGE.getCode(),selfFlag,qwDTO.getUrlHost());
if (jp.getErrorCode() == 0) { if (jp.getErrorCode() == 0) {
miniprogramSetting.setMediaTime(date); miniprogramSetting.setMediaTime(date);
miniprogramSetting.setMediaId(jp.getResult().toString()); miniprogramSetting.setMediaId(jp.getResult().toString());
...@@ -116,7 +117,8 @@ public class MiniprogramSettingServiceImpl implements MiniprogramSettingService ...@@ -116,7 +117,8 @@ public class MiniprogramSettingServiceImpl implements MiniprogramSettingService
} }
String[] arr = miniprogramSetting.getImageUrl().split("/"); String[] arr = miniprogramSetting.getImageUrl().split("/");
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId) ; WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId) ;
JSONResponse jp = qywxSuiteApiService.uploadMedia(qwDTO.getThirdCorpid(), config.getWxSuiteid(), CommonUtil.getFileByte(miniprogramSetting.getImageUrl()), arr[arr.length - 1], QywxMediaTypeEnum.IMAGE.getCode()); boolean selfFlag = qwDTO.isSelf() ;
JSONResponse jp = qywxSuiteApiService.uploadMedia(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), miniprogramSetting.getImageUrl(), arr[arr.length - 1], QywxMediaTypeEnum.IMAGE.getCode(),selfFlag,qwDTO.getUrlHost());
if (jp.getErrorCode() == 0) { if (jp.getErrorCode() == 0) {
miniprogramSetting.setMediaTime(date); miniprogramSetting.setMediaTime(date);
miniprogramSetting.setMediaId(jp.getResult().toString()); miniprogramSetting.setMediaId(jp.getResult().toString());
......
...@@ -196,14 +196,14 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -196,14 +196,14 @@ public class StaffApiServiceImpl implements StaffApiService {
if (qwDTO.getWxSecurityType() == 4) { if (qwDTO.getWxSecurityType() == 4) {
user = qywxUserApiService.getWorkWxUser(qwDTO.getThirdCorpid(), config.getWxSuiteid(), wxUserId); user = qywxUserApiService.getWorkWxUser(qwDTO.getThirdCorpid(), config.getWxSuiteid(), wxUserId);
logger.info("成员详情(第三方)={}", JSON.toJSONString(user)); logger.info("成员详情(第三方)={}", JSON.toJSONString(user));
UserDTO userSelf = qywxUserApiService.getSelfWorkWxUser(dkCorpid, secretSetting.getSecretVal(), user.getOpen_userid()); UserDTO userSelf = qywxUserApiService.getSelfWorkWxUser(dkCorpid, secretSetting.getSecretVal(), user.getOpen_userid() , qwDTO.getUrlHost());
logger.info("成员详情(代开)={}", JSON.toJSONString(user)); logger.info("成员详情(代开)={}", JSON.toJSONString(user));
if (user != null && userSelf != null) { if (user != null && userSelf != null) {
user.setName(userSelf.getName()); user.setName(userSelf.getName());
user.setPosition(userSelf.getPosition()); user.setPosition(userSelf.getPosition());
} }
} else { } else {
user = qywxUserApiService.getSelfWorkWxUser(dkCorpid, secretSetting.getSecretVal(), wxUserId); user = qywxUserApiService.getSelfWorkWxUser(dkCorpid, secretSetting.getSecretVal(), wxUserId , qwDTO.getUrlHost());
logger.info("成员详情(代开)={}", JSON.toJSONString(user)); logger.info("成员详情(代开)={}", JSON.toJSONString(user));
} }
if (null == user) { if (null == user) {
...@@ -255,6 +255,11 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -255,6 +255,11 @@ public class StaffApiServiceImpl implements StaffApiService {
if (StringUtils.isNotBlank(qr_code)) { if (StringUtils.isNotBlank(qr_code)) {
staff.setQrCode(qr_code); staff.setQrCode(qr_code);
} }
//判断成员是否开启联系我
if (this.openConcatFlag(wxEnterpriseId,wxUserId)) {
logger.info("成员开启联系我");
staff.setOpenConcatFlag(1);
}
//成员更改或更新 //成员更改或更新
if (StringUtils.isBlank(staff.getStaffId())) { if (StringUtils.isBlank(staff.getStaffId())) {
logger.info("新增成员"); logger.info("新增成员");
...@@ -270,6 +275,22 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -270,6 +275,22 @@ public class StaffApiServiceImpl implements StaffApiService {
res.setResult(staff.getStaffName()); res.setResult(staff.getStaffName());
return res; return res;
} }
private Boolean openConcatFlag(String wxEnterpriseId,String userId){
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
//企微已经开启联系我
List<String> wxUserIdsList = null ;
Boolean flag = false;
if(qwDTO.isSelf()) {
wxUserIdsList = qywxUserApiService.listCorpExternalUserSelf(qwDTO.getDkCorpid(), qwDTO.getSelfSecret(),qwDTO.getUrlHost());
}else {
wxUserIdsList = qywxUserApiService.listCorpExternalUser(qwDTO.getThirdCorpid(), config.getWxSuiteid());
}
if (CollUtil.isNotEmpty(wxUserIdsList) && wxUserIdsList.contains(userId)) {
logger.info("成员开启联系我");
flag = true;
}
return flag;
}
/** /**
* 获取wxopenuserid * 获取wxopenuserid
...@@ -279,6 +300,9 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -279,6 +300,9 @@ public class StaffApiServiceImpl implements StaffApiService {
* @return * @return
*/ */
private String getOpenUserid(String userId, String corpid, WxEnterpriseQwDTO qwDTO) { private String getOpenUserid(String userId, String corpid, WxEnterpriseQwDTO qwDTO) {
if(qwDTO.isSelf()) {
return null ;
}
if (qwDTO.getWxSecurityType() == 2) { if (qwDTO.getWxSecurityType() == 2) {
return userId; return userId;
} }
...@@ -489,7 +513,8 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -489,7 +513,8 @@ public class StaffApiServiceImpl implements StaffApiService {
@Override @Override
public void initWxUser(String corpid, String contactSecret, String wxEnterpriseId, Integer wxDepartmentId, String taskId) { public void initWxUser(String corpid, String contactSecret, String wxEnterpriseId, Integer wxDepartmentId, String taskId) {
List<UserDTO> list = this.qywxUserApiService.listSelfDepartmentUser(corpid, contactSecret, wxDepartmentId.toString(), 0); WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId) ;
List<UserDTO> list = this.qywxUserApiService.listSelfDepartmentUser(corpid, contactSecret, wxDepartmentId.toString(), 0 , qwDTO.getUrlHost());
if (CollectionUtils.isNotEmpty(list)) { if (CollectionUtils.isNotEmpty(list)) {
for (UserDTO dto : list) { for (UserDTO dto : list) {
try { try {
......
...@@ -98,12 +98,17 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -98,12 +98,17 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
clerkName = clerkDTO.getClerkName(); clerkName = clerkDTO.getClerkName();
} }
String operClerkId = infoDTO.getOptStaffId(); String operClerkId = infoDTO.getOptStaffId();
//操作人只有staffId,operName字段存储成员名称 ClerkDTO operClerkDTO = clerkService.getClerkByClerkIdNoStatus(operClerkId);
TabHaobanStaff tabHaobanStaff = staffService.selectById(operClerkId);
// clerkDTO = clerkService.getClerkByClerkIdNoStatus(clerkRelation.getClerkId());
String operName = null; String operName = null;
if (null != tabHaobanStaff) { if (null != operClerkDTO) {
operName = tabHaobanStaff.getStaffName(); operName = operClerkDTO.getClerkName();
}
//如果是小程序解绑,需要存储staffName
if(infoDTO.getChannelCode() != null &&(infoDTO.getChannelCode().equals(ChannelCodeEnum.SELF_UNBIND.getCode()) || infoDTO.getChannelCode().equals(ChannelCodeEnum.SELF_BIND.getCode()))){
TabHaobanStaff tabHaobanStaff = staffService.selectById(operClerkId);
if (null != tabHaobanStaff) {
operName =tabHaobanStaff.getStaffName();
}
} }
TabHaobanStaffClerkBindLog enity = new TabHaobanStaffClerkBindLog(); TabHaobanStaffClerkBindLog enity = new TabHaobanStaffClerkBindLog();
enity.setClerkId(clerkRelation.getClerkId()); enity.setClerkId(clerkRelation.getClerkId());
...@@ -199,23 +204,25 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -199,23 +204,25 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
logger.info("该导购已经被被申请绑定,请审核处理后再绑定"); logger.info("该导购已经被被申请绑定,请审核处理后再绑定");
return ServiceResponse.failure("4", "该导购已经被被申请绑定,请审核处理后再绑定"); return ServiceResponse.failure("4", "该导购已经被被申请绑定,请审核处理后再绑定");
} }
List<AuditDTO> list = auditApiService.listByStoreId(staffClerkRelationDTO.getStoreId()); if (manageFlag == null || manageFlag == 0) {
if (CollectionUtils.isNotEmpty(list)) { List<AuditDTO> list = auditApiService.listByStoreId(staffClerkRelationDTO.getStoreId());
Set<String> staffIds = list.stream().map(AuditDTO::getCommitStaffId).collect(Collectors.toSet()); if (CollectionUtils.isNotEmpty(list)) {
if (staffIds.contains(staffId)) { Set<String> staffIds = list.stream().map(AuditDTO::getCommitStaffId).collect(Collectors.toSet());
logger.info("该成员已经已经在该门店下申请了绑定,请审核处理后再绑定"); if (staffIds.contains(staffId)) {
return ServiceResponse.failure("5", "该成员已经已经在该门店下申请了绑定,请审核处理后再绑定"); logger.info("该成员已经已经在该门店下申请了绑定,请审核处理后再绑定");
return ServiceResponse.failure("5", "该成员已经已经在该门店下申请了绑定,请审核处理后再绑定");
}
}
StaffClerkRelationDTO storeHasBind = staffClerkRelationService.getOneBindByStoreId(staffId, staffClerkRelationDTO.getStoreId());
if (storeHasBind != null) {
logger.info("该导购已在该门店下有其它成员绑定");
return ServiceResponse.failure("3", "该导购已在该门店下有其它成员绑定");
}
List<StaffClerkRelationDTO> staffClerkRelationDTOS = staffClerkRelationService.listManageBindByStaffId(staffId);
if (CollectionUtils.isNotEmpty(staffClerkRelationDTOS)) {
logger.info("该导购已绑定区经,不允许绑定导购");
return ServiceResponse.failure("3", "该导购已绑定区经,不允许绑定导购");
} }
}
StaffClerkRelationDTO storeHasBind = staffClerkRelationService.getOneBindByStoreId(staffId, staffClerkRelationDTO.getStoreId());
if (storeHasBind != null) {
logger.info("该导购已在该门店下有其它成员绑定");
return ServiceResponse.failure("3", "该导购已在该门店下有其它成员绑定");
}
List<StaffClerkRelationDTO> staffClerkRelationDTOS = staffClerkRelationService.listManageBindByStaffId(staffId);
if (CollectionUtils.isNotEmpty(staffClerkRelationDTOS)) {
logger.info("该导购已绑定区经,不允许绑定导购");
return ServiceResponse.failure("3", "该导购已绑定区经,不允许绑定导购");
} }
return null; return null;
} }
...@@ -437,7 +444,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -437,7 +444,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
} else { } else {
userIds.add(relationDTO.getQwUserId()); userIds.add(relationDTO.getQwUserId());
} }
QywxExternalcontactResultDTO configResp = qywxUserApiService.addContactWay(qwDTO.getThirdCorpid(), config.getWxSuiteid(), send); QywxExternalcontactResultDTO configResp = qywxUserApiService.addContactWay(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), send,qwDTO.isSelf(),qwDTO.getUrlHost());
logger.info("configId:{}", JSON.toJSONString(configResp)); logger.info("configId:{}", JSON.toJSONString(configResp));
String configId = configResp.getConfig_id(); String configId = configResp.getConfig_id();
if (StringUtils.isBlank(configId)) { if (StringUtils.isBlank(configId)) {
...@@ -540,11 +547,11 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -540,11 +547,11 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
// 导购门店转移 // 导购门店转移
private void moveOrAddClerk(ClerkSyncQDTO clerkSyncQDTO, StaffClerkRelationDTO oldRelationDTO) { private void moveOrAddClerk(ClerkSyncQDTO clerkSyncQDTO, StaffClerkRelationDTO oldRelationDTO) {
boolean flag = false; /* boolean flag = false;
if (null != RedisUtil.getCache("clerkMoveFlag2022")) { if (null != RedisUtil.getCache("clerkMoveFlag2022")) {
flag = true; flag = true;
} }
if (flag) { if (flag) {*/
String oldClerkId = oldRelationDTO.getClerkId(); String oldClerkId = oldRelationDTO.getClerkId();
this.staffClerkRelationService.delBind(oldClerkId, "-1", ChannelCodeEnum.SYNC_UNBIND.getCode(), clerkSyncQDTO.getClerkId(),oldRelationDTO.getWxEnterpriseId()); this.staffClerkRelationService.delBind(oldClerkId, "-1", ChannelCodeEnum.SYNC_UNBIND.getCode(), clerkSyncQDTO.getClerkId(),oldRelationDTO.getWxEnterpriseId());
// 设置新的ID // 设置新的ID
...@@ -554,16 +561,21 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -554,16 +561,21 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
logger.info("绑定结果正常:{},{}", JSONObject.toJSONString(response), oldRelationDTO.getClerkId()); logger.info("绑定结果正常:{},{}", JSONObject.toJSONString(response), oldRelationDTO.getClerkId());
if (response == null) { if (response == null) {
this.staffClerkRelationService.insert(oldRelationDTO); this.staffClerkRelationService.insert(oldRelationDTO);
logger.info("换门店后,查询主门店,newClerkId={}",oldRelationDTO.getStaffId());
// 设置主门店
List<StaffClerkRelationDTO> relationList = this.listByStaffId(oldRelationDTO.getWxEnterpriseId(), oldRelationDTO.getStaffId()) ;
List<String> storeIdList = relationList.stream().map(o->o.getStoreId()).collect(Collectors.toList()) ;
this.clerkMainStoreRelatedService.getMainStoreByStaffId(oldRelationDTO.getStaffId(), oldRelationDTO.getWxEnterpriseId(), storeIdList) ;
} }
} else { /*} else {
String oldClerkId = oldRelationDTO.getClerkId(); String oldClerkId = oldRelationDTO.getClerkId();
this.staffClerkRelationService.delBind(oldClerkId, "-1", ChannelCodeEnum.SYNC_UNBIND.getCode(), null,null); this.staffClerkRelationService.delBind(oldClerkId, "-1", ChannelCodeEnum.SYNC_UNBIND.getCode(), null,null);
// 设置新的ID // 设置新的ID
oldRelationDTO.setClerkId(clerkSyncQDTO.getClerkId()); oldRelationDTO.setClerkId(clerkSyncQDTO.getClerkId());
oldRelationDTO.setStoreId(clerkSyncQDTO.getStoreId()); oldRelationDTO.setStoreId(clerkSyncQDTO.getStoreId());
ServiceResponse resp = this.bindStaffClerk(oldRelationDTO, "-1", ChannelCodeEnum.SYNC_BIND.getCode()); ServiceResponse resp = this.bindStaffClerk(oldRelationDTO, "-1", ChannelCodeEnum.SYNC_BIND.getCode());
logger.info("绑定结果正常:{},{}", JSONObject.toJSONString(resp), oldRelationDTO.getClerkId()); logger.info("绑定结果正常:{},{}", JSONObject.toJSONString(resp), oldRelationDTO.getClerkId());*/
} // }
} }
@Override @Override
......
...@@ -34,6 +34,7 @@ import com.gic.haoban.manage.service.config.Config; ...@@ -34,6 +34,7 @@ import com.gic.haoban.manage.service.config.Config;
import com.gic.haoban.manage.service.dao.mapper.StaffDepartmentRelatedMapper; import com.gic.haoban.manage.service.dao.mapper.StaffDepartmentRelatedMapper;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanStaffClerkRelationMapper; import com.gic.haoban.manage.service.dao.mapper.TabHaobanStaffClerkRelationMapper;
import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated; import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise;
import com.gic.haoban.manage.service.service.StaffDepartmentRelatedService; import com.gic.haoban.manage.service.service.StaffDepartmentRelatedService;
import com.gic.haoban.manage.service.service.WxEnterpriseService; import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.wechat.api.dto.qywx.ItemDTO; import com.gic.wechat.api.dto.qywx.ItemDTO;
...@@ -248,15 +249,16 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela ...@@ -248,15 +249,16 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
items.add(dto2); items.add(dto2);
ArrayList<String> list = new ArrayList<>(); ArrayList<String> list = new ArrayList<>();
list.add(wxUserId); list.add(wxUserId);
messageDTO.setAppid(config.getAppid()); TabHaobanWxEnterprise wxEnterprise = this.wxEnterpriseService.getEnterpriseBycorpId(corpId);
WxEnterpriseQwDTO qwDTO =this.wxEnterpriseService.getQwInfo(wxEnterprise.getWxEnterpriseId()) ;
messageDTO.setAppid(qwDTO.getHbWxaAppid());
messageDTO.setUserIds(list); messageDTO.setUserIds(list);
messageDTO.setPage(pageUrl); messageDTO.setPage(pageUrl);
messageDTO.setTitle(title); messageDTO.setTitle(title);
messageDTO.setItems(items); messageDTO.setItems(items);
logger.info("发送参数为corpId============:{},suitId============:{},messageDTO============:{},", corpId, config.getWxSuiteid(), JSONObject.toJSONString(messageDTO)); logger.info("发送参数为corpId============:{},suitId============:{},messageDTO============:{},", corpId, config.getWxSuiteid(), JSONObject.toJSONString(messageDTO));
boolean b = qywxSuiteApiService.sendMessage(corpId, qwDTO.getSelf3thSecret(), messageDTO,qwDTO.isSelf(),qwDTO.getUrlHost());
boolean b = qywxSuiteApiService.sendMessage(corpId, config.getWxSuiteid(), messageDTO);
logger.info("发送===============》{}", b); logger.info("发送===============》{}", b);
return b; return b;
} }
...@@ -303,13 +305,15 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela ...@@ -303,13 +305,15 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
contentList.add(itemDTO); contentList.add(itemDTO);
}); });
QywxXcxSendMessageDTO messageDTO = new QywxXcxSendMessageDTO(); QywxXcxSendMessageDTO messageDTO = new QywxXcxSendMessageDTO();
messageDTO.setAppid(this.config.getAppid()); TabHaobanWxEnterprise wxEnterprise = this.wxEnterpriseService.getEnterpriseBycorpId(corpId);
WxEnterpriseQwDTO qwDTO =this.wxEnterpriseService.getQwInfo(wxEnterprise.getWxEnterpriseId()) ;
messageDTO.setAppid(qwDTO.getHbWxaAppid());
messageDTO.setUserIds(Collections.singletonList(wxUserId)); messageDTO.setUserIds(Collections.singletonList(wxUserId));
messageDTO.setTitle(title); messageDTO.setTitle(title);
messageDTO.setItems(contentList); messageDTO.setItems(contentList);
messageDTO.setPage(pageUrl); messageDTO.setPage(pageUrl);
logger.info("消息发送, corpId : {}, suitId : {}, messageDTO : {}", corpId, config.getWxSuiteid(), JSONObject.toJSONString(messageDTO)); logger.info("消息发送, corpId : {}, suitId : {}, messageDTO : {}", corpId, config.getWxSuiteid(), JSONObject.toJSONString(messageDTO));
boolean sendResult = qywxSuiteApiService.sendMessage(corpId, config.getWxSuiteid(), messageDTO); boolean sendResult = qywxSuiteApiService.sendMessage(corpId, qwDTO.getSelf3thSecret(), messageDTO,qwDTO.isSelf(),qwDTO.getUrlHost());
logger.info("消息发送结果, sendResult : {}", sendResult); logger.info("消息发送结果, sendResult : {}", sendResult);
return sendResult; return sendResult;
} }
...@@ -354,14 +358,16 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela ...@@ -354,14 +358,16 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
} }
ArrayList<String> list = new ArrayList<>(); ArrayList<String> list = new ArrayList<>();
list.add(wxUserId); list.add(wxUserId);
messageDTO.setAppid(config.getAppid()); TabHaobanWxEnterprise wxEnterprise = this.wxEnterpriseService.getEnterpriseBycorpId(corpId);
WxEnterpriseQwDTO qwDTO =this.wxEnterpriseService.getQwInfo(wxEnterprise.getWxEnterpriseId()) ;
messageDTO.setAppid(qwDTO.getHbWxaAppid());
messageDTO.setUserIds(list); messageDTO.setUserIds(list);
messageDTO.setPage(pageUrl); messageDTO.setPage(pageUrl);
messageDTO.setTitle(title); messageDTO.setTitle(title);
messageDTO.setItems(items); messageDTO.setItems(items);
logger.info("发送消息参数为corpId={},messageDTO={},", corpId, JSONObject.toJSONString(messageDTO)); logger.info("发送消息参数为corpId={},messageDTO={},", corpId, JSONObject.toJSONString(messageDTO));
boolean b = qywxSuiteApiService.sendMessage(corpId, config.getWxSuiteid(), messageDTO); boolean b = qywxSuiteApiService.sendMessage(corpId, qwDTO.getSelf3thSecret(), messageDTO,qwDTO.isSelf(),qwDTO.getUrlHost());
logger.info("发送消息返回={}", b); logger.info("发送消息返回={}", b);
return b; return b;
} }
......
...@@ -49,27 +49,11 @@ public class TestServiceImpl implements TestApiService { ...@@ -49,27 +49,11 @@ public class TestServiceImpl implements TestApiService {
@Override @Override
public String listSelfQywxUser(String corpid, String secretVal, String dataId) { public String listSelfQywxUser(String corpid, String secretVal, String dataId) {
long t = System.currentTimeMillis();
List<UserDTO> list = this.qywxUserApiService.listSelfDepartmentUser(corpid, secretVal, dataId, 0);
logger.info("耗时为===============>{}毫秒", (System.currentTimeMillis() - t));
if (null != list) {
logger.info("微信获取部门成员数量为:{}", list.size());
} else {
logger.info("微信获取部门成员数量异常");
}
return ""; return "";
} }
@Override @Override
public String listAllQywxUser(String corpid, String secretVal, String dataId) { public String listAllQywxUser(String corpid, String secretVal, String dataId) {
long t = System.currentTimeMillis();
List<UserDTO> list = this.qywxUserApiService.listSelfDepartmentUser(corpid, secretVal, dataId, 1);
logger.info("耗时为===============>{}毫秒", (System.currentTimeMillis() - t));
if (null != list) {
logger.info("微信获取部门成员数量为:{}", list.size());
} else {
logger.info("微信获取部门成员数量异常");
}
return ""; return "";
} }
......
...@@ -249,6 +249,13 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService { ...@@ -249,6 +249,13 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
WxEnterpriseDTO wxDTO = EntityUtil.changeEntityByJSON(WxEnterpriseDTO.class, tab); WxEnterpriseDTO wxDTO = EntityUtil.changeEntityByJSON(WxEnterpriseDTO.class, tab);
return wxDTO; return wxDTO;
} }
@Override
public WxEnterpriseDTO selectByWxaAppid(String appid) {
TabHaobanWxEnterprise tab = wxEnterpriseMapper.selectByWxaAppid(appid);
WxEnterpriseDTO wxDTO = EntityUtil.changeEntityByJSON(WxEnterpriseDTO.class, tab);
return wxDTO;
}
@Override @Override
public WxEnterpriseQwDTO getQwInfo(String wxEnterpriseId) { public WxEnterpriseQwDTO getQwInfo(String wxEnterpriseId) {
......
...@@ -23,6 +23,7 @@ import com.gic.api.base.commons.ServiceResponse; ...@@ -23,6 +23,7 @@ import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.DateUtil; import com.gic.commons.util.DateUtil;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.PageHelperUtils; import com.gic.commons.util.PageHelperUtils;
import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO;
import com.gic.haoban.manage.api.dto.chat.ChatEventDTO; import com.gic.haoban.manage.api.dto.chat.ChatEventDTO;
import com.gic.haoban.manage.api.dto.chat.GroupChatDTO; import com.gic.haoban.manage.api.dto.chat.GroupChatDTO;
import com.gic.haoban.manage.api.dto.chat.GroupChatOwnerDTO; import com.gic.haoban.manage.api.dto.chat.GroupChatOwnerDTO;
...@@ -33,11 +34,13 @@ import com.gic.haoban.manage.api.dto.qdto.chat.GroupChatUserSearchQDTO; ...@@ -33,11 +34,13 @@ import com.gic.haoban.manage.api.dto.qdto.chat.GroupChatUserSearchQDTO;
import com.gic.haoban.manage.api.dto.qdto.chat.OwnerSearchQDTO; import com.gic.haoban.manage.api.dto.qdto.chat.OwnerSearchQDTO;
import com.gic.haoban.manage.api.service.chat.GroupChatApiService; import com.gic.haoban.manage.api.service.chat.GroupChatApiService;
import com.gic.haoban.manage.service.entity.TabHaobanStaff; import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterpriseRelated; import com.gic.haoban.manage.service.entity.TabHaobanWxEnterpriseRelated;
import com.gic.haoban.manage.service.pojo.bo.chat.GroupChatBO; import com.gic.haoban.manage.service.pojo.bo.chat.GroupChatBO;
import com.gic.haoban.manage.service.service.StaffClerkRelationService; import com.gic.haoban.manage.service.service.StaffClerkRelationService;
import com.gic.haoban.manage.service.service.StaffService; import com.gic.haoban.manage.service.service.StaffService;
import com.gic.haoban.manage.service.service.WxEnterpriseRelatedService; import com.gic.haoban.manage.service.service.WxEnterpriseRelatedService;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.manage.service.service.chat.GroupChatService; import com.gic.haoban.manage.service.service.chat.GroupChatService;
import com.gic.haoban.manage.service.service.chat.GroupChatUserService; import com.gic.haoban.manage.service.service.chat.GroupChatUserService;
...@@ -56,6 +59,8 @@ public class GroupChatApiServiceImpl implements GroupChatApiService { ...@@ -56,6 +59,8 @@ public class GroupChatApiServiceImpl implements GroupChatApiService {
private WxEnterpriseRelatedService wxEnterpriseRelatedService; private WxEnterpriseRelatedService wxEnterpriseRelatedService;
@Autowired @Autowired
private StaffClerkRelationService staffClerkRelationService; private StaffClerkRelationService staffClerkRelationService;
@Autowired
private WxEnterpriseService wxEnterpriseService ;
@Override @Override
public ServiceResponse<Page<GroupChatDTO>> listPage(GroupChatSearchQDTO qdto, BasePageInfo basePageInfo) { public ServiceResponse<Page<GroupChatDTO>> listPage(GroupChatSearchQDTO qdto, BasePageInfo basePageInfo) {
...@@ -183,6 +188,17 @@ public class GroupChatApiServiceImpl implements GroupChatApiService { ...@@ -183,6 +188,17 @@ public class GroupChatApiServiceImpl implements GroupChatApiService {
String changeType = dto.getChangeType(); String changeType = dto.getChangeType();
String wxChatId = dto.getChatId(); String wxChatId = dto.getChatId();
String corpid = dto.getCorpid(); String corpid = dto.getCorpid();
TabHaobanWxEnterprise wxEnterprise = this.wxEnterpriseService.getEnterpriseBycorpId(corpid);
if (wxEnterprise == null) {
logger.info("企业不存在,corpid={}", corpid);
return ServiceResponse.success();
}
String wxEnterpriseId = wxEnterprise.getWxEnterpriseId();
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
if(qwDTO.isSelf() && dto.getSelfCallback()==0) {
logger.info("非自建应用回调");
return ServiceResponse.success();
}
// 群解散事件 // 群解散事件
if ("dismiss".equals(changeType)) { if ("dismiss".equals(changeType)) {
this.groupChatService.dismissChat(corpid, wxChatId); this.groupChatService.dismissChat(corpid, wxChatId);
......
...@@ -105,7 +105,7 @@ public class InteractRecordApiServiceImpl implements InteractRecordApiService { ...@@ -105,7 +105,7 @@ public class InteractRecordApiServiceImpl implements InteractRecordApiService {
// 会员授权事件 // 会员授权事件
// 根据unionId 刷新 memberId 并写入销售线索 // 根据unionId 刷新 memberId 并写入销售线索
interactRecordService.memberAuthorized(memberAttrChangeBO.getMemberId(), memberAttrChangeBO.getUnionId()); // interactRecordService.memberAuthorized(memberAttrChangeBO.getMemberId(), memberAttrChangeBO.getUnionId());
} }
if (MemberAttrChangeBO.MemberChangeOpt.MEMBER_MERGE.getCode().equals(memberAttrChangeBO.getOpt())) { if (MemberAttrChangeBO.MemberChangeOpt.MEMBER_MERGE.getCode().equals(memberAttrChangeBO.getOpt())) {
......
...@@ -110,14 +110,14 @@ public class QywxGroupMsgTaskApiServiceImpl implements QywxGroupMsgTaskApiServic ...@@ -110,14 +110,14 @@ public class QywxGroupMsgTaskApiServiceImpl implements QywxGroupMsgTaskApiServic
*/ */
@Override @Override
public ServiceResponse<Void> handlerMaterialWeekReport(String params) { public ServiceResponse<Void> handlerMaterialWeekReport(String params) {
log.info("handlerMaterialWeekReport 执行素材周报任务开始 >>>>> {}", DateUtil.datetimeToString(new Date())); log.info("handlerMaterialWeekReport 执行素材周报任务开始 >>>>> params:{} date: {}", params, DateUtil.datetimeToString(new Date()));
Date now = new Date(); Date now = new Date();
Week week = cn.hutool.core.date.DateUtil.dayOfWeekEnum(now); Week week = cn.hutool.core.date.DateUtil.dayOfWeekEnum(now);
if (!Week.MONDAY.equals(week)) { if (!Week.MONDAY.equals(week)) {
log.info("handlerMaterialWeekReport 当前时间 不是周一 忽略 》》》 {}", DateUtil.datetimeToString(new Date())); log.info("handlerMaterialWeekReport 当前时间 不是周一 忽略 》》》 params:{}, date:{}", params, DateUtil.datetimeToString(new Date()));
return ServiceResponse.success(); return ServiceResponse.success();
} }
return doHandlerReportInner(MaterialReportType.WEEK.getCode()); return doHandlerReportInner(MaterialReportType.WEEK.getCode(), params);
} }
/** /**
...@@ -129,7 +129,7 @@ public class QywxGroupMsgTaskApiServiceImpl implements QywxGroupMsgTaskApiServic ...@@ -129,7 +129,7 @@ public class QywxGroupMsgTaskApiServiceImpl implements QywxGroupMsgTaskApiServic
@Override @Override
public ServiceResponse<Void> handlerMaterialMonthReport(String params) { public ServiceResponse<Void> handlerMaterialMonthReport(String params) {
log.info("handlerMaterialWeekReport 执行素材月报任务开始 >>>>> {}", DateUtil.datetimeToString(new Date())); log.info("handlerMaterialWeekReport 执行素材月报任务开始 >>>>> {}", DateUtil.datetimeToString(new Date()));
return doHandlerReportInner(MaterialReportType.MONTH.getCode()); return doHandlerReportInner(MaterialReportType.MONTH.getCode(), params);
} }
/** /**
...@@ -138,13 +138,20 @@ public class QywxGroupMsgTaskApiServiceImpl implements QywxGroupMsgTaskApiServic ...@@ -138,13 +138,20 @@ public class QywxGroupMsgTaskApiServiceImpl implements QywxGroupMsgTaskApiServic
* @param reportType * @param reportType
* @return * @return
*/ */
private ServiceResponse<Void> doHandlerReportInner(Integer reportType) { private ServiceResponse<Void> doHandlerReportInner(Integer reportType, String params) {
List<String> enterpriseIds = groupMessageService.hasMaterialRightEnterprise(MaterialEnterpriseAdaptor.MaterialLevel.LOW.getCode()); List<String> enterpriseIds = groupMessageService.hasMaterialRightEnterprise(MaterialEnterpriseAdaptor.MaterialLevel.LOW.getCode());
if (CollectionUtils.isEmpty(enterpriseIds)) { if (CollectionUtils.isEmpty(enterpriseIds)) {
return ServiceResponse.success(); return ServiceResponse.success();
} }
for (String enterpriseId : enterpriseIds) { for (String enterpriseId : enterpriseIds) {
if (StringUtils.isNotBlank(params) && !StringUtils.equals("-1", params)) {
log.info("执行指定企业的数据 {}", params);
if (!StringUtils.equals(params, enterpriseId)) {
log.info("企业{}非目标企业,忽略", enterpriseId);
continue;
}
}
List<String> wxEnterpriseIds = wxEnterpriseService.queryWxEnterpriseWithEnterpriseId(enterpriseId); List<String> wxEnterpriseIds = wxEnterpriseService.queryWxEnterpriseWithEnterpriseId(enterpriseId);
if (CollectionUtils.isEmpty(wxEnterpriseIds)) { if (CollectionUtils.isEmpty(wxEnterpriseIds)) {
log.info("企业 {}未关联企微", enterpriseId); log.info("企业 {}未关联企微", enterpriseId);
......
...@@ -161,8 +161,8 @@ public class HaobanQywxFeeApiServiceImpl implements HaobanQywxFeeApiService { ...@@ -161,8 +161,8 @@ public class HaobanQywxFeeApiServiceImpl implements HaobanQywxFeeApiService {
} }
String serviceCorpid = config.getCorpid(); String serviceCorpid = config.getCorpid();
WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseService.selectById(wxEnterpriseId); WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseService.selectById(wxEnterpriseId);
if (wxEnterpriseDTO.getWxSecurityType() <= 0) { if (wxEnterpriseDTO.getWxSecurityType() <= 0 || wxEnterpriseDTO.getWxSecurityType()==5) {
logger.info("WxSecurityType=0,wxEnterpriseId={}", wxEnterpriseId); logger.info("WxSecurityType=0/5,wxEnterpriseId={}", wxEnterpriseId);
return; return;
} }
String corpid = wxEnterpriseDTO.getOpenCorpid(); String corpid = wxEnterpriseDTO.getOpenCorpid();
...@@ -226,7 +226,6 @@ public class HaobanQywxFeeApiServiceImpl implements HaobanQywxFeeApiService { ...@@ -226,7 +226,6 @@ public class HaobanQywxFeeApiServiceImpl implements HaobanQywxFeeApiService {
// 成员的激活码信息 // 成员的激活码信息
this.staffService.activedAccountTimer(wxEnterpriseId); this.staffService.activedAccountTimer(wxEnterpriseId);
// 更新企业的激活数量统计
this.wxEnterpriseActiveDataService.saveOrUpdate(wxEnterpriseId); this.wxEnterpriseActiveDataService.saveOrUpdate(wxEnterpriseId);
// 统计 haobanQywxFeeDetailDTO 30天内最新过期的时间和人数 // 统计 haobanQywxFeeDetailDTO 30天内最新过期的时间和人数
...@@ -250,8 +249,9 @@ public class HaobanQywxFeeApiServiceImpl implements HaobanQywxFeeApiService { ...@@ -250,8 +249,9 @@ public class HaobanQywxFeeApiServiceImpl implements HaobanQywxFeeApiService {
tabHaobanQywxFee.setInterceptFlag(0); tabHaobanQywxFee.setInterceptFlag(0);
haobanQywxFeeService.insert(tabHaobanQywxFee); haobanQywxFeeService.insert(tabHaobanQywxFee);
// 判断今天是否是本月最后一天 // 判断今天是否是本月最后一天
if (DateUtil.isSameDay(DateUtil.endOfMonth(new Date()), new Date()) || "ca66a01b79474c40b3e7c7f93daf1a3b".equals(wxEnterpriseId)) { if (DateUtil.isSameDay(DateUtil.endOfMonth(new Date()), new Date())
int monthWillInterceptNum = haobanQywxFeeDetailDTO.getInterceptUserNum() ; || "ca66a01b79474c40b3e7c7f93daf1a3b".equals(wxEnterpriseId)) {
int monthWillInterceptNum = haobanQywxFeeDetailDTO.getInterceptUserNum();
String content = "30天将有" + monthWillInterceptNum + "个接口许可证即将过期,您总共还剩余" + permissionUserNum String content = "30天将有" + monthWillInterceptNum + "个接口许可证即将过期,您总共还剩余" + permissionUserNum
+ "个可用的接口许可证,请保证数量充足,如需增加请及时联系相关人员续费,避免影响使用"; + "个可用的接口许可证,请保证数量充足,如需增加请及时联系相关人员续费,避免影响使用";
messageAlert(wxEnterpriseId, corpName, corpid, AlertTypeEnum.FEE_ALARM.getName(), content); messageAlert(wxEnterpriseId, corpName, corpid, AlertTypeEnum.FEE_ALARM.getName(), content);
...@@ -296,13 +296,13 @@ public class HaobanQywxFeeApiServiceImpl implements HaobanQywxFeeApiService { ...@@ -296,13 +296,13 @@ public class HaobanQywxFeeApiServiceImpl implements HaobanQywxFeeApiService {
TabHaobanQywxFeeOrderAccount activeAccount = new TabHaobanQywxFeeOrderAccount(); TabHaobanQywxFeeOrderAccount activeAccount = new TabHaobanQywxFeeOrderAccount();
// 查询激活码的详情 // 查询激活码的详情
List<ActiveInfoCodeResponseDTO> respList = qywxUserApiService.getActiveInfoByCodeList(corpid, serviceCorpid, List<List<String>> list = Lists.partition(codeList, 1000);
codeList); for (int i = 0; i < list.size(); i++) {
if (CollectionUtils.isNotEmpty(respList)) { List<String> subCodeList = list.get(i);
List<List<ActiveInfoCodeResponseDTO>> list = Lists.partition(respList, 800); List<ActiveInfoCodeResponseDTO> respList = qywxUserApiService.getActiveInfoByCodeList(corpid, serviceCorpid,
for (int i = 0; i < list.size(); i++) { subCodeList);
List<ActiveInfoCodeResponseDTO> subList = list.get(i); if (CollectionUtils.isNotEmpty(respList)) {
for (ActiveInfoCodeResponseDTO activeDetail : subList) { for (ActiveInfoCodeResponseDTO activeDetail : respList) {
String userid = activeDetail.getUserid(); String userid = activeDetail.getUserid();
String activeCode = activeDetail.getActiveCode(); String activeCode = activeDetail.getActiveCode();
activeAccount.setWxUserId(userid); activeAccount.setWxUserId(userid);
......
package com.gic.haoban.manage.service.service.out.impl.hm; package com.gic.haoban.manage.service.service.out.impl.hm;
import cn.hutool.core.convert.Convert;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse; import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.haoban.base.api.common.errCode.HaoBanErrCodeCommon; import com.gic.haoban.base.api.common.errCode.HaoBanErrCodeCommon;
import com.gic.haoban.common.utils.EntityUtil; import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.common.utils.PageUtil; import com.gic.haoban.common.utils.PageUtil;
......
...@@ -540,8 +540,7 @@ public class HmLinkApiServiceImpl implements HmLinkApiService { ...@@ -540,8 +540,7 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
paramsDTO.setUser(Arrays.asList(tabHaobanStaff.getWxUserId())); paramsDTO.setUser(Arrays.asList(tabHaobanStaff.getWxUserId()));
} }
} }
QywxExternalcontactResultDTO wxResp = qywxUserApiService.addContactWay(qwDTO.getThirdCorpid(), QywxExternalcontactResultDTO wxResp = qywxUserApiService.addContactWay(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), paramsDTO , qwDTO.isSelf(),qwDTO.getUrlHost());
config.getWxSuiteid(), paramsDTO);
log.info("创建动态活码参数corpid={},app={},param={},返回={}", qwDTO.getThirdCorpid(), config.getWxSuiteid(), log.info("创建动态活码参数corpid={},app={},param={},返回={}", qwDTO.getThirdCorpid(), config.getWxSuiteid(),
JSON.toJSONString(paramsDTO), JSON.toJSONString(wxResp)); JSON.toJSONString(paramsDTO), JSON.toJSONString(wxResp));
if (null != wxResp && 0 == wxResp.getErrcode()) { if (null != wxResp && 0 == wxResp.getErrcode()) {
......
...@@ -151,14 +151,13 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService { ...@@ -151,14 +151,13 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
qywxExternalcontactDTO.setRemark(hmQrcodeQDTO.getName()); qywxExternalcontactDTO.setRemark(hmQrcodeQDTO.getName());
qywxExternalcontactDTO.setSkipVerify(hmQrcodeQDTO.getPassFlag() == 1); qywxExternalcontactDTO.setSkipVerify(hmQrcodeQDTO.getPassFlag() == 1);
qywxExternalcontactDTO.setState("HM" + hmId); qywxExternalcontactDTO.setState("HM" + hmId);
String corpid = qwDTO.getThirdCorpid();
List<String> userIds = staffClerkRelationService.listWxUserIdByClerkIds(clerkIdList, wxEnterpriseId); List<String> userIds = staffClerkRelationService.listWxUserIdByClerkIds(clerkIdList, wxEnterpriseId);
if (CollectionUtils.isEmpty(userIds)) { if (CollectionUtils.isEmpty(userIds)) {
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_8.getCode()), "导购未关联好办"); return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_8.getCode()), "导购未关联好办");
} }
qywxExternalcontactDTO.setUser(userIds); qywxExternalcontactDTO.setUser(userIds);
logger.info("新增活码参数:{}", JSON.toJSONString(qywxExternalcontactDTO)); logger.info("新增活码参数:{}", JSON.toJSONString(qywxExternalcontactDTO));
QywxExternalcontactResultDTO qywxExternalcontactResultDTO = qywxUserApiService.addContactWay(corpid, config.getWxSuiteid(), qywxExternalcontactDTO); QywxExternalcontactResultDTO qywxExternalcontactResultDTO = qywxUserApiService.addContactWay(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), qywxExternalcontactDTO,qwDTO.isSelf(),qwDTO.getUrlHost());
if (qywxExternalcontactResultDTO.getErrcode() != 0) { if (qywxExternalcontactResultDTO.getErrcode() != 0) {
GicLogRecordEvaluationContext.noWriteLog(); GicLogRecordEvaluationContext.noWriteLog();
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_0.getCode()), "创建企微活码失败,具体失败原因请参考企微报错http链接:" + qywxExternalcontactResultDTO.getErrmsg()); return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_0.getCode()), "创建企微活码失败,具体失败原因请参考企微报错http链接:" + qywxExternalcontactResultDTO.getErrmsg());
...@@ -341,7 +340,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService { ...@@ -341,7 +340,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_8.getCode()), "导购未关联好办"); return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_8.getCode()), "导购未关联好办");
} }
qywxExternalcontactDTO.setUser(userIds); qywxExternalcontactDTO.setUser(userIds);
QywxResponseDTO qywxResponseDTO = qywxUserApiService.updateContactWay(qwDTO.getThirdCorpid(), config.getWxSuiteid(), qywxExternalcontactDTO); QywxResponseDTO qywxResponseDTO = qywxUserApiService.updateContactWay(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), qywxExternalcontactDTO,qwDTO.isSelf(),qwDTO.getUrlHost());
if (qywxResponseDTO.getErrcode() != 0) { if (qywxResponseDTO.getErrcode() != 0) {
logger.error("更新企微活码失败"); logger.error("更新企微活码失败");
GicLogRecordEvaluationContext.noWriteLog(); GicLogRecordEvaluationContext.noWriteLog();
...@@ -691,7 +690,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService { ...@@ -691,7 +690,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
String wxConfigId = hmQrcodeBO.getWxConfigId(); String wxConfigId = hmQrcodeBO.getWxConfigId();
if (StringUtils.isNotBlank(wxConfigId)) { if (StringUtils.isNotBlank(wxConfigId)) {
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(hmQrcodeBO.getWxEnterpriseId()); WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(hmQrcodeBO.getWxEnterpriseId());
QywxResponseDTO qywxResponseDTO = qywxUserApiService.delContactWay(qwDTO.getThirdCorpid(), config.getWxSuiteid(), wxConfigId); QywxResponseDTO qywxResponseDTO = qywxUserApiService.delContactWay(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), wxConfigId,qwDTO.isSelf(),qwDTO.getUrlHost());
int errcode = qywxResponseDTO.getErrcode(); int errcode = qywxResponseDTO.getErrcode();
//https://open.work.weixin.qq.com/devtool/query?e=41044 //https://open.work.weixin.qq.com/devtool/query?e=41044
if (errcode != 0) { if (errcode != 0) {
...@@ -816,7 +815,12 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService { ...@@ -816,7 +815,12 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId); WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
//查询出所有正常的导购 //查询出所有正常的导购
//企微已经开启联系我 //企微已经开启联系我
List<String> wxUserIdsList = qywxUserApiService.listCorpExternalUser(qwDTO.getThirdCorpid(), config.getWxSuiteid()); List<String> wxUserIdsList = null ;
if(qwDTO.isSelf()) {
wxUserIdsList = qywxUserApiService.listCorpExternalUserSelf(qwDTO.getDkCorpid(), qwDTO.getSelfSecret(),qwDTO.getUrlHost());
}else {
wxUserIdsList = qywxUserApiService.listCorpExternalUser(qwDTO.getThirdCorpid(), config.getWxSuiteid());
}
this.staffService.updateOpenConcatFlag(wxUserIdsList,qwDTO.needOpenUserId3th()?1:0) ; this.staffService.updateOpenConcatFlag(wxUserIdsList,qwDTO.needOpenUserId3th()?1:0) ;
List<StaffClerkRelationDTO> staffClerkRelationDTOS = staffClerkRelationService.listIdsByWxUserIds(wxUserIdsList, wxEnterpriseId, enterpriseId); List<StaffClerkRelationDTO> staffClerkRelationDTOS = staffClerkRelationService.listIdsByWxUserIds(wxUserIdsList, wxEnterpriseId, enterpriseId);
if (CollectionUtils.isEmpty(staffClerkRelationDTOS)) { if (CollectionUtils.isEmpty(staffClerkRelationDTOS)) {
......
...@@ -16,7 +16,9 @@ import com.gic.haoban.manage.service.pojo.GroupSyncPojo; ...@@ -16,7 +16,9 @@ import com.gic.haoban.manage.service.pojo.GroupSyncPojo;
import com.gic.haoban.manage.service.pojo.bo.content.binlog.MaterialMemberEOrderPojo; import com.gic.haoban.manage.service.pojo.bo.content.binlog.MaterialMemberEOrderPojo;
import com.gic.haoban.manage.service.pojo.StoreSyncPojo; import com.gic.haoban.manage.service.pojo.StoreSyncPojo;
import com.gic.haoban.manage.service.pojo.bo.content.binlog.MaterialMemberGicOrderPojo; import com.gic.haoban.manage.service.pojo.bo.content.binlog.MaterialMemberGicOrderPojo;
import com.gic.haoban.manage.service.pojo.bo.content.binlog.MaterialMemberUnionIdPoJo;
import com.gic.haoban.manage.service.service.StoreRangeService; import com.gic.haoban.manage.service.service.StoreRangeService;
import com.gic.haoban.manage.service.service.content.InteractRecordService;
import com.gic.haoban.manage.service.service.content.PotentialCustomerService; import com.gic.haoban.manage.service.service.content.PotentialCustomerService;
import com.gic.haoban.manage.service.service.hm.HmQrcodeService; import com.gic.haoban.manage.service.service.hm.HmQrcodeService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -49,6 +51,8 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor ...@@ -49,6 +51,8 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor
private final String tab_gic_eorder = "tab_gic_eorder"; private final String tab_gic_eorder = "tab_gic_eorder";
private final String tab_gic_order = "tab_gic_order"; private final String tab_gic_order = "tab_gic_order";
private final String tab_gic_member = "tab_gic_member";
@Autowired @Autowired
private StoreRangeService storeRangeService; private StoreRangeService storeRangeService;
...@@ -59,6 +63,8 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor ...@@ -59,6 +63,8 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor
private HmQrcodeService hmQrcodeService; private HmQrcodeService hmQrcodeService;
@Autowired @Autowired
PotentialCustomerService potentialCustomerService; PotentialCustomerService potentialCustomerService;
@Autowired
private InteractRecordService interactRecordService;
@Override @Override
public void onMessage(ConsumerRecord<String, GicRecord> record) { public void onMessage(ConsumerRecord<String, GicRecord> record) {
...@@ -95,6 +101,9 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor ...@@ -95,6 +101,9 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor
else if (StringUtils.startsWith(record.value().getTableName(), tab_gic_order)) { else if (StringUtils.startsWith(record.value().getTableName(), tab_gic_order)) {
// 处理会员订单新增事件 // 处理会员订单新增事件
dealMemberGicOrder((MaterialMemberGicOrderPojo) pojo); dealMemberGicOrder((MaterialMemberGicOrderPojo) pojo);
}else if (StringUtils.startsWith(record.value().getTableName(), tab_gic_member)) {
// 会员unionId新增事件
dealMemberUnionIdChange((MaterialMemberUnionIdPoJo) pojo);
} }
} }
...@@ -119,6 +128,36 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor ...@@ -119,6 +128,36 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor
mid.put(gicField.getName(), gicField.getValue()); mid.put(gicField.getName(), gicField.getValue());
} }
return JSON.parseObject(JSON.toJSONString(mid), MaterialMemberGicOrderPojo.class); return JSON.parseObject(JSON.toJSONString(mid), MaterialMemberGicOrderPojo.class);
} else if (StringUtils.startsWith(record.getTableName(), tab_gic_member)) {
GicRecordType recordType = record.getRecordType();
if (GicRecordType.INSERT.equals(recordType)) {
Map<String, String> mid = new HashMap<>();
for (GicField gicField : record.getFieldList()) {
mid.put(gicField.getName(), gicField.getValue());
}
return JSON.parseObject(JSON.toJSONString(mid), MaterialMemberUnionIdPoJo.class);
}
if (GicRecordType.UPDATE.equals(recordType)) {
Map<String, String> old = new HashMap<>();
Map<String, String> newMap = new HashMap<>();
for (int i = 0; i < record.getFieldList().size(); i++) {
GicField gicField = record.getFieldList().get(i);
if (i % 2 == 0){
old.put(gicField.getName(), gicField.getValue());
}else {
newMap.put(gicField.getName(), gicField.getValue());
}
}
MaterialMemberUnionIdPoJo oldMember = JSON.parseObject(JSON.toJSONString(old), MaterialMemberUnionIdPoJo.class);
MaterialMemberUnionIdPoJo newMemberInfo = JSON.parseObject(JSON.toJSONString(newMap), MaterialMemberUnionIdPoJo.class);
if (oldMember == null || StringUtils.isNotBlank(oldMember.getUnionId())) {
logger.info("会员原本存在unionId, old:{}, new:{}", JSON.toJSONString(oldMember), JSON.toJSONString(newMemberInfo));
return null;
}
return newMemberInfo;
}
return null;
} }
return null; return null;
} }
...@@ -235,5 +274,17 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor ...@@ -235,5 +274,17 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor
potentialCustomerService.updateMemberDealFlag(memberOrderPojo.getEnterpriseId(), memberOrderPojo.getMemberId()); potentialCustomerService.updateMemberDealFlag(memberOrderPojo.getEnterpriseId(), memberOrderPojo.getMemberId());
} }
/**
*
* @param materialMemberUnionIdPoJo
*/
private void dealMemberUnionIdChange(MaterialMemberUnionIdPoJo materialMemberUnionIdPoJo) {
logger.info("处理会员unionId新增事件 >> {}", JSON.toJSONString(materialMemberUnionIdPoJo));
if (StringUtils.isBlank(materialMemberUnionIdPoJo.getUnionId()) || StringUtils.equalsIgnoreCase("null", materialMemberUnionIdPoJo.getUnionId())) {
logger.info("处理会员unionId事件异常,会员unionId为空 {}", JSON.toJSONString(materialMemberUnionIdPoJo));
return;
}
interactRecordService.memberAuthorized(materialMemberUnionIdPoJo.getMemberId(), materialMemberUnionIdPoJo.getUnionId());
}
} }
...@@ -170,12 +170,12 @@ public class QywxDeptSyncOperation implements BaseSyncOperation { ...@@ -170,12 +170,12 @@ public class QywxDeptSyncOperation implements BaseSyncOperation {
if ("0".equals(pDataId)) { if ("0".equals(pDataId)) {
//根级部门 //根级部门
List<UserDTO> list = null ; List<UserDTO> list = null ;
WxEnterpriseQwDTO wxInfo = this.wxEnterpriseService.getQwInfo(wxEnterpriseId) ; WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId) ;
if(wxInfo.getWxSecurityType()==4) { if(qwDTO.getWxSecurityType()==4) {
list = this.qywxUserApiService.listDepartmentUser(wxInfo.getThirdCorpid(), config.getWxSuiteid(), dataId, 1) ; list = this.qywxUserApiService.listDepartmentUser(qwDTO.getThirdCorpid(), config.getWxSuiteid(), dataId, 1) ;
logger.info("从(第三方)获取通讯录={}",JSON.toJSONString(list)) ; logger.info("从(第三方)获取通讯录={}",JSON.toJSONString(list)) ;
}else { }else {
list = this.qywxUserApiService.listSelfDepartmentUser(wxInfo.getDkCorpid(), secretSetting.getSecretVal(), dataId, 1); list = this.qywxUserApiService.listSelfDepartmentUser(qwDTO.getDkCorpid(), secretSetting.getSecretVal(), dataId, 1,qwDTO.getUrlHost());
logger.info("从(代开)获取通讯录={}",JSON.toJSONString(list)) ; logger.info("从(代开)获取通讯录={}",JSON.toJSONString(list)) ;
} }
if (null == list) { if (null == list) {
......
...@@ -56,7 +56,7 @@ public class FriendClerkSyncNewOperation implements BaseSyncOperation { ...@@ -56,7 +56,7 @@ public class FriendClerkSyncNewOperation implements BaseSyncOperation {
@Override @Override
public void dealSingleByMq(DealParamMqDTO dealParamMqDTO, TabHaobanPreDealLog dataPre) { public void dealSingleByMq(DealParamMqDTO dealParamMqDTO, TabHaobanPreDealLog dataPre) {
logger.info("dealParamMqDTO={},dataPre={}", JSON.toJSONString(dealParamMqDTO), JSON.toJSONString(dataPre)); logger.info("刷新好友列表(7-8),dealParamMqDTO={},dataPre={}", JSON.toJSONString(dealParamMqDTO), JSON.toJSONString(dataPre));
String reason = ""; String reason = "";
boolean dealFlag = true; boolean dealFlag = true;
try { try {
...@@ -74,6 +74,7 @@ public class FriendClerkSyncNewOperation implements BaseSyncOperation { ...@@ -74,6 +74,7 @@ public class FriendClerkSyncNewOperation implements BaseSyncOperation {
dkWxUserId = staff.getWxOpenUseId(); dkWxUserId = staff.getWxOpenUseId();
} }
List<String> selfUserIdList = memberUnionidRelatedApiService.listSelfExterialList(wxEnterpriseId, dkWxUserId); List<String> selfUserIdList = memberUnionidRelatedApiService.listSelfExterialList(wxEnterpriseId, dkWxUserId);
List<String> delUserIdList = selfUserIdList ;
logger.info("selfUserIdList={}", JSONObject.toJSONString(selfUserIdList)); logger.info("selfUserIdList={}", JSONObject.toJSONString(selfUserIdList));
if (CollectionUtils.isEmpty(selfUserIdList)) { if (CollectionUtils.isEmpty(selfUserIdList)) {
logger.info("自建应用调用第三方接口进入重试"); logger.info("自建应用调用第三方接口进入重试");
...@@ -82,31 +83,35 @@ public class FriendClerkSyncNewOperation implements BaseSyncOperation { ...@@ -82,31 +83,35 @@ public class FriendClerkSyncNewOperation implements BaseSyncOperation {
return; return;
} }
if (CollectionUtils.isEmpty(selfUserIdList)) { if (CollectionUtils.isEmpty(selfUserIdList)) {
logger.info("改用户没有外部联系人:{}", JSONObject.toJSONString(dataPre)); logger.info("该用户无代开外部联系人:{}", JSONObject.toJSONString(dataPre));
dealFlag = false; dealFlag = false;
reason = "该用户没有外部联系人"; reason = "该用户没有外部联系人";
return; return;
} }
//第三方服务商的外部联系人
String wxUserId3th = staff.getWxUserId() ; String wxUserId3th = staff.getWxUserId() ;
if(qwDTO.needOpenUserId3th()) { if(qwDTO.needOpenUserId3th()) {
wxUserId3th = staff.getWxOpenUseId() ; wxUserId3th = staff.getWxOpenUseId() ;
} }
List<String> userIdList = memberUnionidRelatedApiService.listExterialList(wxEnterpriseId, wxUserId3th); List<String> userIdList = null ;
if (CollectionUtils.isEmpty(selfUserIdList)) { if(!qwDTO.isSelf()) {
dealFlag = tryAgainToMq(dataPre); //第三方服务商的外部联系人
reason = "重试次数过多"; userIdList = memberUnionidRelatedApiService.listExterialList(wxEnterpriseId, wxUserId3th);
logger.info("第三方服务商外部联系人调用失败进入重试:{}", dataPre.getDataId()); delUserIdList = userIdList ;
return; if (CollectionUtils.isEmpty(selfUserIdList)) {
} dealFlag = tryAgainToMq(dataPre);
if (CollectionUtils.isEmpty(userIdList)) { reason = "重试次数过多";
logger.info("该用户没有外部联系人2:{}", JSONObject.toJSONString(dataPre)); logger.info("第三方服务商外部联系人调用失败进入重试:{}", dataPre.getDataId());
dealFlag = false; return;
reason = "该用户没有外部联系人"; }
return; if (CollectionUtils.isEmpty(userIdList)) {
logger.info("该用户无第三方外部联系人:{}", JSONObject.toJSONString(dataPre));
dealFlag = false;
reason = "该用户没有外部联系人";
return;
}
} }
//清理外部联系人 //清理外部联系人
memberUnionidRelatedApiService.cleanNoExsitFriendNew(wxEnterpriseId, staffId, userIdList); memberUnionidRelatedApiService.cleanNoExsitFriendNew(wxEnterpriseId, staffId, delUserIdList);
//写入外部联系人的处理队列 //写入外部联系人的处理队列
List<TabHaobanPreDealLog> dealLogList = new ArrayList<>(); List<TabHaobanPreDealLog> dealLogList = new ArrayList<>();
for (String externalUserId : selfUserIdList) { for (String externalUserId : selfUserIdList) {
...@@ -122,21 +127,23 @@ public class FriendClerkSyncNewOperation implements BaseSyncOperation { ...@@ -122,21 +127,23 @@ public class FriendClerkSyncNewOperation implements BaseSyncOperation {
} }
preDealService.insert(dealLogList); preDealService.insert(dealLogList);
//写入外部联系人的处理队列 if(!qwDTO.isSelf()) {
List<TabHaobanPreDealLog> thirddealLogList = new ArrayList<>(); //写入外部联系人的处理队列
for (String externalUserId : userIdList) { List<TabHaobanPreDealLog> thirddealLogList = new ArrayList<>();
TabHaobanPreDealLog dealLog = new TabHaobanPreDealLog(); for (String externalUserId : userIdList) {
dealLog.setDataId(externalUserId + "###" + wxUserId3th); TabHaobanPreDealLog dealLog = new TabHaobanPreDealLog();
dealLog.setpDataId(staffId); dealLog.setDataId(externalUserId + "###" + wxUserId3th);
dealLog.setDataType(PreDealTypeEnum.friend.getVal()); dealLog.setpDataId(staffId);
dealLog.setStatusFlag(0); dealLog.setDataType(PreDealTypeEnum.friend.getVal());
dealLog.setTaskId(dataPre.getTaskId()); dealLog.setStatusFlag(0);
dealLog.setDataContent(externalUserId); dealLog.setTaskId(dataPre.getTaskId());
dealLog.setWxEnterpriseId(wxEnterpriseId); dealLog.setDataContent(externalUserId);
thirddealLogList.add(dealLog); dealLog.setWxEnterpriseId(wxEnterpriseId);
thirddealLogList.add(dealLog);
}
preDealService.insert(thirddealLogList);
} }
preDealService.insert(thirddealLogList);
//成功更新状态 //成功更新状态
dealSuccess(dealParamMqDTO.getTaskId(), dealParamMqDTO.getData(), dataPre.getEnterpriseId(), dataPre.getWxEnterpriseId()); dealSuccess(dealParamMqDTO.getTaskId(), dealParamMqDTO.getData(), dataPre.getEnterpriseId(), dataPre.getWxEnterpriseId());
} catch (Exception e) { } catch (Exception e) {
......
...@@ -8,6 +8,7 @@ import com.esotericsoftware.minlog.Log; ...@@ -8,6 +8,7 @@ import com.esotericsoftware.minlog.Log;
import com.gic.commons.util.GICMQClientUtil; import com.gic.commons.util.GICMQClientUtil;
import com.gic.haoban.manage.api.dto.DealParamMqDTO; import com.gic.haoban.manage.api.dto.DealParamMqDTO;
import com.gic.haoban.manage.api.dto.ExternalUserDTO; import com.gic.haoban.manage.api.dto.ExternalUserDTO;
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.SyncTaskStatusEnum; import com.gic.haoban.manage.api.enums.SyncTaskStatusEnum;
...@@ -16,10 +17,12 @@ import com.gic.haoban.manage.service.entity.TabHaobanPreDealLog; ...@@ -16,10 +17,12 @@ import com.gic.haoban.manage.service.entity.TabHaobanPreDealLog;
import com.gic.haoban.manage.service.exception.WxApiLimitException; import com.gic.haoban.manage.service.exception.WxApiLimitException;
import com.gic.haoban.manage.service.service.PreDealService; import com.gic.haoban.manage.service.service.PreDealService;
import com.gic.haoban.manage.service.service.SyncTaskService; import com.gic.haoban.manage.service.service.SyncTaskService;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.manage.service.task.BaseSyncOperation; import com.gic.haoban.manage.service.task.BaseSyncOperation;
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 org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -46,12 +49,14 @@ public class SelfFriendSyncNewOperation implements BaseSyncOperation { ...@@ -46,12 +49,14 @@ public class SelfFriendSyncNewOperation implements BaseSyncOperation {
private SyncTaskService syncTaskService; private SyncTaskService syncTaskService;
@Autowired @Autowired
private FriendClerkSyncNewOperation friendClerkSyncNewOperation; private FriendClerkSyncNewOperation friendClerkSyncNewOperation;
@Autowired
private WxEnterpriseService wxEnterpriseService ;
private static final String TRY_AGAIN = "haoban_fresh_wx_friend_again_"; private static final String TRY_AGAIN = "haoban_fresh_wx_friend_again_";
@Override @Override
public void dealSingleByMq(DealParamMqDTO dealParamMqDTO, TabHaobanPreDealLog dataPre) { public void dealSingleByMq(DealParamMqDTO dealParamMqDTO, TabHaobanPreDealLog dataPre) {
logger.info("同步好友开始,自建代开发={}", JSONObject.toJSONString(dataPre)); logger.info("刷新好友列表7,代开发={}", JSONObject.toJSONString(dataPre));
String reason = "成功"; String reason = "成功";
boolean dealFlag = true; boolean dealFlag = true;
try { try {
...@@ -60,10 +65,10 @@ public class SelfFriendSyncNewOperation implements BaseSyncOperation { ...@@ -60,10 +65,10 @@ public class SelfFriendSyncNewOperation implements BaseSyncOperation {
String staffId = dataPre.getpDataId() ; String staffId = dataPre.getpDataId() ;
String taskId = dealParamMqDTO.getTaskId(); String taskId = dealParamMqDTO.getTaskId();
String externalUserId = dataPre.getDataContent(); String externalUserId = dataPre.getDataContent();
// 查询企微侧外部联系人详情
ExternalUserDTO externalUserDTO = memberUnionidRelatedApiService.getCorpSelfExternalUseridInfo(wxEnterpriseId, wxUserId, externalUserId); ExternalUserDTO externalUserDTO = memberUnionidRelatedApiService.getCorpSelfExternalUseridInfo(wxEnterpriseId, wxUserId, externalUserId);
if (externalUserDTO == null) { if (externalUserDTO == null) {
logger.info("外部联系人好友不存在:{}", JSONObject.toJSONString(dataPre)); logger.info("代开发外部联系人详情查询失败,staffId={},{},{}", staffId,wxUserId,externalUserId);
dealException(taskId, dataPre.getDataId(), null, "好友不存在"); dealException(taskId, dataPre.getDataId(), null, "好友不存在");
return; return;
} }
...@@ -74,13 +79,22 @@ public class SelfFriendSyncNewOperation implements BaseSyncOperation { ...@@ -74,13 +79,22 @@ public class SelfFriendSyncNewOperation implements BaseSyncOperation {
json.put("avatar", externalUserDTO.getAvatar()); json.put("avatar", externalUserDTO.getAvatar());
json.put("externalUserId", externalUserDTO.getExternalUserId()); json.put("externalUserId", externalUserDTO.getExternalUserId());
json.put("addCreateTime", externalUserDTO.getAddCreateTime()); json.put("addCreateTime", externalUserDTO.getAddCreateTime());
String str = staffId + "_" + externalUserDTO.getName() + "_" + externalUserDTO.getAddCreateTime() ;
//relationkey String relationKey = SecureUtil.md5(str);
logger.info("生成relationKey:{},{},{}",staffId,externalUserDTO.getName(),externalUserDTO.getAddCreateTime()); logger.info("生成代开发relationKey={},staff={},{}",relationKey,staffId,str);
String relationKey = SecureUtil.md5(staffId + "_" + externalUserDTO.getName() + "_" + externalUserDTO.getAddCreateTime()); WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId) ;
logger.info("relationKey:{},{}", relationKey, externalUserDTO.getExternalUserId()); if(qwDTO.isSelf()) {
externalUserDTO.setSelfExternalUserId(externalUserDTO.getExternalUserId());
String ret = this.memberUnionidRelatedApiService.dealMergeForReflsh(externalUserDTO, wxEnterpriseId, staffId) ;
if (StringUtils.isNotBlank(ret)) {
logger.info("好友创建失败:{},{}", ret, JSONObject.toJSONString(externalUserDTO));
dealFlag = false;
reason = ret + ":" + relationKey;
return;
}
}
//更新状态 //更新状态
preDealService.updateFriendStatusByDataId(taskId, dataPre.getDataId(), PreDealStatusEnum.computed.getVal(), reason, json.toJSONString(), relationKey , PreDealTypeEnum.self_friend.getVal()); this.preDealService.updateFriendStatusByDataId(taskId, dataPre.getDataId(), PreDealStatusEnum.computed.getVal(), reason, json.toJSONString(), relationKey , PreDealTypeEnum.self_friend.getVal());
dealSuccess(taskId, dataPre.getDataId(), null, wxEnterpriseId); dealSuccess(taskId, dataPre.getDataId(), null, wxEnterpriseId);
} catch (WxApiLimitException e) { } catch (WxApiLimitException e) {
logger.info("接口次数限制:{}", JSONObject.toJSONString(dataPre)); logger.info("接口次数限制:{}", JSONObject.toJSONString(dataPre));
......
...@@ -141,7 +141,7 @@ ...@@ -141,7 +141,7 @@
<dubbo:reference interface="com.gic.enterprise.api.service.DepartmentService" id="gicDepartmentService"/> <dubbo:reference interface="com.gic.enterprise.api.service.DepartmentService" id="gicDepartmentService"/>
<dubbo:reference interface="com.gic.wechat.api.service.qywx.QywxDepartmentApiService" <dubbo:reference interface="com.gic.wechat.api.service.qywx.QywxDepartmentApiService"
id="qywxDepartmentApiService"/> id="qywxDepartmentApiService"/>
<dubbo:reference interface="com.gic.wechat.api.service.qywx.QywxSuiteApiService" id="qywxSuiteApiService"/> <dubbo:reference interface="com.gic.wechat.api.service.qywx.QywxSuiteApiService" id="qywxSuiteApiService" timeout="20000"/>
<dubbo:reference interface="com.gic.wechat.api.service.qywx.QywxUserApiService" id="qywxUserApiService"/> <dubbo:reference interface="com.gic.wechat.api.service.qywx.QywxUserApiService" id="qywxUserApiService"/>
<dubbo:reference interface="com.gic.enterprise.api.service.StoreGroupService" id="storeGroupService"/> <dubbo:reference interface="com.gic.enterprise.api.service.StoreGroupService" id="storeGroupService"/>
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
<value>haoban_gic_store_group</value> <value>haoban_gic_store_group</value>
<value>tab_haoban_member_order_event_prod</value> <value>tab_haoban_member_order_event_prod</value>
<value>haoban_gic_order</value> <value>haoban_gic_order</value>
<value>content_member_unionId_notice</value>
</list> </list>
</constructor-arg> </constructor-arg>
<property name="messageListener" ref="kafkaConsumerService"/> <property name="messageListener" ref="kafkaConsumerService"/>
......
...@@ -12,10 +12,12 @@ ...@@ -12,10 +12,12 @@
<result column="status_flag" jdbcType="INTEGER" property="statusFlag" /> <result column="status_flag" jdbcType="INTEGER" property="statusFlag" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="agent_name" property="agentName" />
<result column="agent_id" property="agentId" />
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
secret_id, wx_enterprise_id, secret_name, secret_val, enterprise_id, secret_type, secret_id, wx_enterprise_id, secret_name, secret_val, enterprise_id, secret_type,
check_flag, status_flag, create_time, update_time check_flag, status_flag, create_time, update_time,agent_name,agent_id
</sql> </sql>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap"> <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select select
...@@ -28,11 +30,11 @@ ...@@ -28,11 +30,11 @@
insert into tab_haoban_secret_setting (secret_id, wx_enterprise_id, secret_name, insert into tab_haoban_secret_setting (secret_id, wx_enterprise_id, secret_name,
secret_val, enterprise_id, secret_type, secret_val, enterprise_id, secret_type,
check_flag, status_flag, create_time, check_flag, status_flag, create_time,
update_time) update_time,agent_name,agent_id)
values (#{secretId,jdbcType=VARCHAR}, #{wxEnterpriseId,jdbcType=VARCHAR}, #{secretName,jdbcType=VARCHAR}, values (#{secretId,jdbcType=VARCHAR}, #{wxEnterpriseId,jdbcType=VARCHAR}, #{secretName,jdbcType=VARCHAR},
#{secretVal,jdbcType=VARCHAR}, #{enterpriseId,jdbcType=VARCHAR}, #{secretType,jdbcType=INTEGER}, #{secretVal,jdbcType=VARCHAR}, #{enterpriseId,jdbcType=VARCHAR}, #{secretType,jdbcType=INTEGER},
#{checkFlag,jdbcType=INTEGER}, #{statusFlag,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{checkFlag,jdbcType=INTEGER}, #{statusFlag,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP}) #{updateTime,jdbcType=TIMESTAMP},#{agentName} , #{agentId})
</insert> </insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.haoban.manage.service.entity.TabSecretSetting"> <update id="updateByPrimaryKeySelective" parameterType="com.gic.haoban.manage.service.entity.TabSecretSetting">
...@@ -65,6 +67,12 @@ ...@@ -65,6 +67,12 @@
<if test="updateTime != null"> <if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP}, update_time = #{updateTime,jdbcType=TIMESTAMP},
</if> </if>
<if test="agentName != null">
agent_name = #{agentName},
</if>
<if test="agentId != null">
agent_id = #{agentId},
</if>
</set> </set>
where secret_id = #{secretId,jdbcType=VARCHAR} where secret_id = #{secretId,jdbcType=VARCHAR}
</update> </update>
......
...@@ -120,6 +120,9 @@ ...@@ -120,6 +120,9 @@
<if test="qrCode != null"> <if test="qrCode != null">
qr_code, qr_code,
</if> </if>
<if test="openConcatFlag != null">
open_concat_flag,
</if>
<if test="addNum != null"> <if test="addNum != null">
add_num, add_num,
</if> </if>
...@@ -188,6 +191,9 @@ ...@@ -188,6 +191,9 @@
<if test="qrCode != null"> <if test="qrCode != null">
#{qrCode}, #{qrCode},
</if> </if>
<if test="openConcatFlag != null">
#{openConcatFlag},
</if>
<if test="addNum != null"> <if test="addNum != null">
#{addNum} #{addNum}
</if> </if>
......
...@@ -121,7 +121,7 @@ ...@@ -121,7 +121,7 @@
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from tab_haoban_sync_task from tab_haoban_sync_task
where wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR} where wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
and task_type != 4 and task_type not in (4,5)
order by update_time desc order by update_time desc
</select> </select>
......
...@@ -745,6 +745,13 @@ ...@@ -745,6 +745,13 @@
and status_flag in (1,3,4) and status_flag in (1,3,4)
</update> </update>
<select id="listByClerkId" resultType="String">
select member_id from tab_haoban_external_clerk_related
where staff_id = #{staffId}
and clerk_id = #{clerkId}
and status_flag = 1
</select>
<update id="updateExternalStatus"> <update id="updateExternalStatus">
update tab_haoban_external_clerk_related set external_status = #{status} where update tab_haoban_external_clerk_related set external_status = #{status} where
external_user_id = #{externalUserid} and wx_enterprise_id = #{wxEnterpriseId} external_user_id = #{externalUserid} and wx_enterprise_id = #{wxEnterpriseId}
...@@ -774,4 +781,16 @@ ...@@ -774,4 +781,16 @@
</foreach> </foreach>
</select> </select>
<select id="listMemberAndStaff" resultType="java.lang.String">
select member_id
from tab_haoban_external_clerk_related
where member_id in
<foreach collection="memberIdList" item="item" separator="," open="(" close=")">
#{item}
</foreach>
and staff_id = #{staffId}
and enterprise_id = #{enterpriseId}
AND status_flag = 1
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -43,6 +43,8 @@ ...@@ -43,6 +43,8 @@
<result column="auto_active_flag" property="autoActiveFlag" jdbcType="INTEGER"/> <result column="auto_active_flag" property="autoActiveFlag" jdbcType="INTEGER"/>
<result column="wx_corpid" property="wxCorpid"/> <result column="wx_corpid" property="wxCorpid"/>
<result column="open_corpid" property="openCorpid"/> <result column="open_corpid" property="openCorpid"/>
<result column="wxa_appid" property="wxaAppid" />
<result column="url_host" property="urlHost"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
...@@ -50,7 +52,7 @@ ...@@ -50,7 +52,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 ,wx_security_type , wx_corpid , open_corpid , auto_active_flag ,member_secret,contact_secret,agree_external_userid_flag,agree_external_userid_time,external_flag,userid_flag ,wx_security_type , wx_corpid , open_corpid , auto_active_flag , wxa_appid , url_host
</sql> </sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String"> <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String">
select select
...@@ -58,7 +60,14 @@ ...@@ -58,7 +60,14 @@
from tab_haoban_wx_enterprise from tab_haoban_wx_enterprise
where wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR} where wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
</select> </select>
<select id="selectByWxaAppid" resultMap="BaseResultMap" parameterType="java.lang.String">
select
<include refid="Base_Column_List"/>
from tab_haoban_wx_enterprise
where wxa_appid = #{appid} and wx_security_type = 5 and status_flag = 1
</select>
<insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise"> <insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise">
insert into tab_haoban_wx_enterprise insert into tab_haoban_wx_enterprise
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
...@@ -503,7 +512,6 @@ ...@@ -503,7 +512,6 @@
from tab_haoban_wx_enterprise_related a from tab_haoban_wx_enterprise_related a
left join tab_haoban_wx_enterprise b on a.wx_enterprise_id = b.wx_enterprise_id left join tab_haoban_wx_enterprise b on a.wx_enterprise_id = b.wx_enterprise_id
where a.status_flag = 1 and b.status_flag = 1 where a.status_flag = 1 and b.status_flag = 1
group by a.enterprise_id
</select> </select>
<select id="queryWxEnterpriseByEnterpriseId" resultType="java.lang.String"> <select id="queryWxEnterpriseByEnterpriseId" resultType="java.lang.String">
......
...@@ -61,6 +61,7 @@ ...@@ -61,6 +61,7 @@
name, name,
staff_id, staff_id,
wx_chat_id, wx_chat_id,
wx_chat_id_dk,
chat_add_time, chat_add_time,
chat_dissolve_time, chat_dissolve_time,
chat_notice, chat_notice,
...@@ -82,6 +83,7 @@ ...@@ -82,6 +83,7 @@
#{name}, #{name},
#{staffId}, #{staffId},
#{wxChatId}, #{wxChatId},
#{wxChatIdDk},
#{chatAddTime}, #{chatAddTime},
#{chatDissolveTime}, #{chatDissolveTime},
#{chatNotice}, #{chatNotice},
......
...@@ -296,7 +296,7 @@ ...@@ -296,7 +296,7 @@
<select id="staticsClerkInteractRecordNew" resultType="com.gic.haoban.manage.service.pojo.bo.content.PotentialCustomerStaticsBO"> <select id="staticsClerkInteractRecordNew" resultType="com.gic.haoban.manage.service.pojo.bo.content.PotentialCustomerStaticsBO">
select clerk_id clerkId, count(DISTINCT member_id) num select clerk_id clerkId, count(DISTINCT member_id) num
from tab_haoban_interact_record from tab_haoban_interact_record
where delete_flag = 0 and member_id is not null where delete_flag = 0 and member_id is not null and member_id <![CDATA[ <> ]]> ''
<if test="clerkId != null and clerkId != ''"> <if test="clerkId != null and clerkId != ''">
and clerk_id = #{clerkId} and clerk_id = #{clerkId}
</if> </if>
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
<result column="prepay_id" property="prepayId"/> <result column="prepay_id" property="prepayId"/>
<result column="wx_order_id" property="wxOrderId"/> <result column="wx_order_id" property="wxOrderId"/>
<result column="wx_url" property="wxUrl"/> <result column="wx_url" property="wxUrl"/>
<result column="qywx_expire_time" property="qywxExpireTime"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
order_id, order_id,
...@@ -65,7 +66,8 @@ ...@@ -65,7 +66,8 @@
expire_time, expire_time,
prepay_id, prepay_id,
wx_order_id, wx_order_id,
wx_url wx_url,
qywx_expire_time
</sql> </sql>
<!-- ===================== 新增 ======================== --> <!-- ===================== 新增 ======================== -->
<insert id="insert" parameterType="com.gic.haoban.manage.service.entity.licence.TabHaobanLicenceOrder" <insert id="insert" parameterType="com.gic.haoban.manage.service.entity.licence.TabHaobanLicenceOrder"
...@@ -98,7 +100,8 @@ ...@@ -98,7 +100,8 @@
update_time, update_time,
creator_id, creator_id,
creator_name, creator_name,
expire_time) expire_time,
qywx_expire_time)
VALUES (#{orderId,jdbcType=BIGINT}, VALUES (#{orderId,jdbcType=BIGINT},
#{enterpriseId,jdbcType=VARCHAR}, #{enterpriseId,jdbcType=VARCHAR},
#{wxEnterpriseId,jdbcType=VARCHAR}, #{wxEnterpriseId,jdbcType=VARCHAR},
...@@ -126,7 +129,8 @@ ...@@ -126,7 +129,8 @@
now(), now(),
#{creatorId,jdbcType=VARCHAR}, #{creatorId,jdbcType=VARCHAR},
#{creatorName,jdbcType=VARCHAR}, #{creatorName,jdbcType=VARCHAR},
#{expireTime,jdbcType=VARCHAR}) #{expireTime,jdbcType=TIMESTAMP},
#{qywxExpireTime,jdbcType=TIMESTAMP})
]]> ]]>
</insert> </insert>
...@@ -205,7 +209,7 @@ ...@@ -205,7 +209,7 @@
FROM tab_haoban_licence_order FROM tab_haoban_licence_order
WHERE wx_enterprise_id = #{wxEnterpriseId} WHERE wx_enterprise_id = #{wxEnterpriseId}
and delete_flag = 0 and delete_flag = 0
and order_status = 0 limit 1 and qywx_order_status = 0 limit 1
</select> </select>
<select id="getLicenceOrderPage" resultMap="BaseResultMap"> <select id="getLicenceOrderPage" resultMap="BaseResultMap">
...@@ -286,7 +290,7 @@ ...@@ -286,7 +290,7 @@
<update id="saveQywxOrderId"> <update id="saveQywxOrderId">
UPDATE tab_haoban_licence_order UPDATE tab_haoban_licence_order
SET qywx_order_id = #{qywxOrderId} ,update_time = now() SET qywx_order_id = #{qywxOrderId} ,update_time = now() ,qywx_expire_time= #{qywxExpireTime}
WHERE order_id = #{orderId} WHERE order_id = #{orderId}
and delete_flag = 0 and delete_flag = 0
</update> </update>
......
...@@ -85,12 +85,6 @@ public class DealSyncTest { ...@@ -85,12 +85,6 @@ public class DealSyncTest {
@Test @Test
public void test3() {
List<DepartmentDTO> department = qywxDepartmentApiService.listSelfDepartment("wweac4ef962720aa12", "GFu4FwkfcGFPue-qinB7ThEU4wR2SadbBH1yT5sLDzs", null);
System.out.println(JSONObject.toJSONString(department));
}
@Test
public void test4() { public void test4() {
String s = ""; String s = "";
memberUnionidRelatedApiService.dealQywxExternalUser(s); memberUnionidRelatedApiService.dealQywxExternalUser(s);
......
...@@ -5,6 +5,7 @@ import com.gic.api.base.commons.ServiceResponse; ...@@ -5,6 +5,7 @@ import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.manage.api.dto.licence.LicenceOrderDTO; import com.gic.haoban.manage.api.dto.licence.LicenceOrderDTO;
import com.gic.haoban.manage.api.dto.licence.LicenceOrderPageDTO; import com.gic.haoban.manage.api.dto.licence.LicenceOrderPageDTO;
import com.gic.haoban.manage.api.dto.qdto.licence.LicenceOrderPageQDTO; import com.gic.haoban.manage.api.dto.qdto.licence.LicenceOrderPageQDTO;
import com.gic.haoban.manage.api.dto.qdto.licence.LicenceOrderQDTO;
import com.gic.haoban.manage.api.service.licence.LicenceOrderApiService; import com.gic.haoban.manage.api.service.licence.LicenceOrderApiService;
import com.gic.haoban.manage.service.entity.licence.TabHaobanLicenceOrder; import com.gic.haoban.manage.service.entity.licence.TabHaobanLicenceOrder;
import com.gic.haoban.manage.service.service.licence.LicenceOrderService; import com.gic.haoban.manage.service.service.licence.LicenceOrderService;
...@@ -68,4 +69,18 @@ public class LicenceOrderServiceTest { ...@@ -68,4 +69,18 @@ public class LicenceOrderServiceTest {
public void test7(){ public void test7(){
licenceOrderApiService.hasPopup("ca66a01b79474c40b3e7c7f93daf1a3b"); licenceOrderApiService.hasPopup("ca66a01b79474c40b3e7c7f93daf1a3b");
} }
@Test
public void test8(){
LicenceOrderQDTO licenceOrderQDTO = new LicenceOrderQDTO();
licenceOrderQDTO.setEnterpriseId("ff8080815dacd3a2015dacd3ef5c0000");
licenceOrderQDTO.setWxEnterpriseId("ca66a01b79474c40b3e7c7f93daf1a3b");
licenceOrderQDTO.setOrderType(1);
licenceOrderQDTO.setExternalContactCount(10);
licenceOrderQDTO.setTimeType(1);
licenceOrderQDTO.setTimeValue(2);
licenceOrderQDTO.setPayType(1);
ServiceResponse<String> stringServiceResponse = licenceOrderApiService.saveOrUpdateLicenceOrder(licenceOrderQDTO);
}
} }
...@@ -43,6 +43,7 @@ import com.gic.haoban.manage.api.dto.HaobanUserDTO; ...@@ -43,6 +43,7 @@ import com.gic.haoban.manage.api.dto.HaobanUserDTO;
import com.gic.haoban.manage.api.dto.StaffDTO; import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.dto.WxApplicationDTO; import com.gic.haoban.manage.api.dto.WxApplicationDTO;
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.service.HaobanUserApiService; import com.gic.haoban.manage.api.service.HaobanUserApiService;
import com.gic.haoban.manage.api.service.StaffApiService; import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.WxApplicationApiService; import com.gic.haoban.manage.api.service.WxApplicationApiService;
...@@ -330,7 +331,10 @@ public class LoginController extends WebBaseController { ...@@ -330,7 +331,10 @@ public class LoginController extends WebBaseController {
WxApplicationDTO application = wxApplicationApiService.selectByWxEnterpriseIdAndApplicationType(wxEnterpriseId,2); WxApplicationDTO application = wxApplicationApiService.selectByWxEnterpriseIdAndApplicationType(wxEnterpriseId,2);
if (null == application) { if (null == application) {
logger.info("登录企业应用 没授权!gicEnterpriseId:{}", gicEnterpriseId); logger.info("登录企业应用 没授权!gicEnterpriseId:{}", gicEnterpriseId);
return "1004"; WxEnterpriseQwDTO qw = this.wxEnterpriseApiService.getQwInfo(wxEnterpriseId) ;
if(!qw.isSelf()) {
return "1004";
}
} }
WxEnterpriseDTO enterprise = wxEnterpriseApiService.getOne(wxEnterpriseId); WxEnterpriseDTO enterprise = wxEnterpriseApiService.getOne(wxEnterpriseId);
if (null == enterprise) { if (null == enterprise) {
......
...@@ -374,11 +374,13 @@ public class StaffController extends WebBaseController { ...@@ -374,11 +374,13 @@ public class StaffController extends WebBaseController {
} }
} }
StoreDTO store = storeService.getStore(clerkInfoVo.getStoreId()); StoreDTO store = storeService.getStore(clerkInfoVo.getStoreId());
if (null != store) { if (null != store && store.getStatus() != -3) {
clerkInfoVo.setStoreName(store.getStoreName()); clerkInfoVo.setStoreName(store.getStoreName());
} }
}); });
if (manageFlag == null || manageFlag != 1) {
retList = retList.stream().filter(o->StringUtils.isNotEmpty(o.getStoreName())).collect(Collectors.toList()) ;
}
} }
} }
return resultResponse(HaoBanErrCode.ERR_1, retList); return resultResponse(HaoBanErrCode.ERR_1, retList);
......
...@@ -94,22 +94,6 @@ public class TestController extends WebBaseController { ...@@ -94,22 +94,6 @@ public class TestController extends WebBaseController {
return this.resultResponse(HaoBanErrCode.ERR_0,this.qwFriendApiService.getCallTimes(wxEnterpriseId)); return this.resultResponse(HaoBanErrCode.ERR_0,this.qwFriendApiService.getCallTimes(wxEnterpriseId));
} }
@RequestMapping("/send-message-test")
public HaobanResponse testSendMessage(QywxXcxSendMessageQo qo) {
QywxXcxSendMessageDTO messageDTO = EntityUtil.changeEntityByOrika(QywxXcxSendMessageDTO.class, qo);
ArrayList<String> list = new ArrayList<>();
list.add(qo.getUserId());
messageDTO.setUserIds(list);
boolean b = qywxSuiteApiService.sendMessage("ww9ede832a84b7ae5f",
"ww2c34dc56739bb105", messageDTO);
if (b) {
return resultResponse(HaoBanErrCode.ERR_1);
} else {
return resultResponse(HaoBanErrCode.ERR_0);
}
}
@RequestMapping("/test-dubbo") @RequestMapping("/test-dubbo")
public HaobanResponse dubbo(@RequestParam(defaultValue = "2000") Integer n, @RequestParam(defaultValue = "100") String t) { public HaobanResponse dubbo(@RequestParam(defaultValue = "2000") Integer n, @RequestParam(defaultValue = "100") String t) {
......
...@@ -163,6 +163,9 @@ public class WxEnterpriseController extends WebBaseController { ...@@ -163,6 +163,9 @@ public class WxEnterpriseController extends WebBaseController {
return resultResponse(HaoBanErrCode.ERR_10012); return resultResponse(HaoBanErrCode.ERR_10012);
} }
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseApiService.getQwInfo(wxEnterpriseId) ; WxEnterpriseQwDTO qwDTO = this.wxEnterpriseApiService.getQwInfo(wxEnterpriseId) ;
if(qwDTO.isSelf()) {
return this.fail("自建应用不能刷新");
}
QywxCorpInfoDTO dto = qywxTokenManageService.getCorpInfo(qwDTO.getThirdCorpid(), config.getWxSuiteid()); QywxCorpInfoDTO dto = qywxTokenManageService.getCorpInfo(qwDTO.getThirdCorpid(), config.getWxSuiteid());
if (dto == null) { if (dto == null) {
return resultResponse(HaoBanErrCode.ERR_10012); return resultResponse(HaoBanErrCode.ERR_10012);
...@@ -205,9 +208,12 @@ public class WxEnterpriseController extends WebBaseController { ...@@ -205,9 +208,12 @@ public class WxEnterpriseController extends WebBaseController {
if(wxType==4) { if(wxType==4) {
desc = "(第三方明文,代开密文)" ; desc = "(第三方明文,代开密文)" ;
} }
if(wxType==5) {
desc = " ( "+wxEnterpriseDTO.getWxaAppid() +" / " + wxEnterpriseDTO.getUrlHost()+") " ;
}
int newType = this.wxEnterpriseApiService.calcSecretType(wxEnterpriseId) ; int newType = this.wxEnterpriseApiService.calcSecretType(wxEnterpriseId) ;
String diff = ""; String diff = "";
if(null != wxType && wxType.intValue() != newType) { if(null != wxType && wxType.intValue() != newType && wxType != 5) {
diff = "*"; diff = "*";
} }
return Arrays.asList(wxEnterpriseDTO.getWxCorpid(),wxEnterpriseDTO.getOpenCorpid()).stream().filter(str -> StringUtils.isNotBlank(str)).collect(Collectors.joining(" / ")) + desc + diff; return Arrays.asList(wxEnterpriseDTO.getWxCorpid(),wxEnterpriseDTO.getOpenCorpid()).stream().filter(str -> StringUtils.isNotBlank(str)).collect(Collectors.joining(" / ")) + desc + diff;
...@@ -314,11 +320,18 @@ public class WxEnterpriseController extends WebBaseController { ...@@ -314,11 +320,18 @@ public class WxEnterpriseController extends WebBaseController {
if (CollectionUtils.isEmpty(secretTypeList)) { if (CollectionUtils.isEmpty(secretTypeList)) {
return resultResponse(HaoBanErrCode.ERR_1, false); return resultResponse(HaoBanErrCode.ERR_1, false);
} }
if ((secretTypeList.contains(SecretTypeEnum.CUSTOMIZED_APP.getVal()))) { // 如果是第三方校验待开发
return resultResponse(HaoBanErrCode.ERR_1, true); WxEnterpriseQwDTO qwDTO = this.wxEnterpriseApiService.getQwInfo(wxEnterpriseId) ;
} else { if(qwDTO.isSelf()) {
return resultResponse(HaoBanErrCode.ERR_1, false); if ((secretTypeList.contains(SecretTypeEnum.SELF_APP.getVal()))) {
return resultResponse(HaoBanErrCode.ERR_1, true);
}
}else {
if ((secretTypeList.contains(SecretTypeEnum.CUSTOMIZED_APP.getVal()))) {
return resultResponse(HaoBanErrCode.ERR_1, true);
}
} }
return resultResponse(HaoBanErrCode.ERR_1, false);
} }
/** /**
...@@ -340,16 +353,16 @@ public class WxEnterpriseController extends WebBaseController { ...@@ -340,16 +353,16 @@ public class WxEnterpriseController extends WebBaseController {
} }
wxSecretKey = wxSecretKey.trim(); wxSecretKey = wxSecretKey.trim();
String token = this.qywxCorpApiService.getToken(qwDTO.getDkCorpid(), wxSecretKey); String token = this.qywxCorpApiService.getToken(qwDTO.getDkCorpid(), wxSecretKey);
logger.info("查询token", token) ; logger.info("查询token={}", token) ;
if(StringUtils.isEmpty(token) || token.length() < 10) { if(StringUtils.isEmpty(token) || token.length() < 10) {
return this.fail("请确认secret是否正确") ; return this.fail("请确认secret是否正确") ;
} }
SecretSettingDTO secretSetting = wxEnterpriseApiService.getSecretSetting(wxEnterpriseId, SecretTypeEnum.CONTACT_CUSTOMER.getVal(), null); SecretSettingDTO secretSetting = wxEnterpriseApiService.getSecretSetting(wxEnterpriseId, SecretTypeEnum.SELF_APP.getVal(), null);
if (null == secretSetting) { if (null == secretSetting) {
secretSetting = new SecretSettingDTO(); secretSetting = new SecretSettingDTO();
} }
secretSetting.setSecretType(SecretTypeEnum.CONTACT_CUSTOMER.getVal()); secretSetting.setSecretType(SecretTypeEnum.SELF_APP.getVal());
secretSetting.setSecretName(SecretTypeEnum.CONTACT_CUSTOMER.getName()); secretSetting.setSecretName(SecretTypeEnum.SELF_APP.getName());
secretSetting.setWxEnterpriseId(wxEnterpriseId); secretSetting.setWxEnterpriseId(wxEnterpriseId);
secretSetting.setEnterpriseId("-1"); secretSetting.setEnterpriseId("-1");
secretSetting.setSecretVal(wxSecretKey); secretSetting.setSecretVal(wxSecretKey);
......
package com.gic.haoban.manage.web.controller.chat; package com.gic.haoban.manage.web.controller.chat;
import java.util.ArrayList; import cn.hutool.core.collection.CollUtil;
import java.util.List; import cn.hutool.core.convert.Convert;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
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.RestController;
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;
import com.gic.api.base.commons.ServiceResponse; import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.ExcelUtils;
import com.gic.commons.webapi.reponse.RestResponse; import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.enterprise.api.service.EnterpriseService;
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.dto.StaffDTO; import com.gic.haoban.manage.api.dto.StaffDTO;
...@@ -28,14 +20,29 @@ import com.gic.haoban.manage.api.dto.qdto.chat.GroupChatUserSearchQDTO; ...@@ -28,14 +20,29 @@ import com.gic.haoban.manage.api.dto.qdto.chat.GroupChatUserSearchQDTO;
import com.gic.haoban.manage.api.dto.qdto.chat.OwnerSearchQDTO; import com.gic.haoban.manage.api.dto.qdto.chat.OwnerSearchQDTO;
import com.gic.haoban.manage.api.service.StaffApiService; import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.chat.GroupChatApiService; import com.gic.haoban.manage.api.service.chat.GroupChatApiService;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.log.LogRecordUserServiceImpl; import com.gic.haoban.manage.web.log.LogRecordUserServiceImpl;
import com.gic.log.record.anno.GicLogRecord; import com.gic.log.record.anno.GicLogRecord;
import com.gic.log.record.util.GicLogRecordCategoryEnum; import com.gic.log.record.util.GicLogRecordCategoryEnum;
import com.gic.log.record.util.GicLogRecordEvaluationContext; import com.gic.log.record.util.GicLogRecordEvaluationContext;
import com.gic.log.record.util.GicLogRecordOptTypeEnum; import com.gic.log.record.util.GicLogRecordOptTypeEnum;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
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.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/** /**
* *
* @ClassName: GroupChatController * @ClassName: GroupChatController
* @Description: 群 * @Description: 群
* @author xugh * @author xugh
...@@ -52,6 +59,8 @@ public class GroupChatController { ...@@ -52,6 +59,8 @@ public class GroupChatController {
private GroupChatApiService groupChatApiService; private GroupChatApiService groupChatApiService;
@Autowired @Autowired
private StaffApiService staffApiService; private StaffApiService staffApiService;
@Autowired
private EnterpriseService enterpriseService;
@RequestMapping("get-set-gic-flag") @RequestMapping("get-set-gic-flag")
public RestResponse<Object> getFlag() { public RestResponse<Object> getFlag() {
...@@ -63,7 +72,7 @@ public class GroupChatController { ...@@ -63,7 +72,7 @@ public class GroupChatController {
} }
/** /**
* *
* @Title: save * @Title: save
* @Description: 认领gic * @Description: 认领gic
* @author xugh * @author xugh
...@@ -204,5 +213,52 @@ public class GroupChatController { ...@@ -204,5 +213,52 @@ public class GroupChatController {
GicLogRecordEvaluationContext.putOptTargetId(AuthWebRequestUtil.getLoginUser().getClerkId()); GicLogRecordEvaluationContext.putOptTargetId(AuthWebRequestUtil.getLoginUser().getClerkId());
return RestResponse.successResult(resp.getResult()); return RestResponse.successResult(resp.getResult());
} }
/**
* 客户群列表数据明细导出
*/
@RequestMapping("customer-group-export")
public RestResponse<Boolean> customerGroupExport(HttpServletRequest request, HttpServletResponse response,GroupChatSearchQDTO qdto) {
// 登录校验
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
if (loginUser == null || StringUtils.isBlank(loginUser.getEnterpriseId())) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_4.getCode()), HaoBanErrCode.ERR_4.getMsg());
}
String sortColumn = qdto.getSortColumn();
if (StringUtils.isBlank(sortColumn)) {
sortColumn = null;
} else if ("totalCount".equals(sortColumn)) {
sortColumn = "total_count";
} else if ("totalMemberCount".equals(sortColumn)) {
sortColumn = "total_member_count";
} else if ("addMemberCount".equals(sortColumn)) {
sortColumn = "add_member_count";
} else if ("addCount".equals(sortColumn)) {
sortColumn = "add_count";
} else if ("quitCount".equals(sortColumn)) {
sortColumn = "quit_count";
} else if ("quitMemberCount".equals(sortColumn)) {
sortColumn = "quit_member_count";
}
BasePageInfo basePageInfo = new BasePageInfo() ;
basePageInfo.setPageNum(1);
basePageInfo.setPageSize(99999);
qdto.setSortColumn(sortColumn);
qdto.setWxEnterpriseId(loginUser.getWxEnterpriseId());
qdto.setEnterpriseId(loginUser.getEnterpriseId());
ServiceResponse<Page<GroupChatDTO>> page = this.groupChatApiService.listPage(qdto, basePageInfo);
if (page.isSuccess() && CollUtil.isNotEmpty(page.getResult().getResult())){
String fileName = "客户群列表数据";
List<String> titleList = Arrays.asList("客户群ID", "客户群名称", "群人数", "群客户数", "新增总数", "流失总数","群主","群主在好办小程序关联状态","创建时间");
List<String> fileList = Arrays.asList("groupChatId", "name", "totalCount", "totalMemberCount", "addCount", "quitCount", "staffName", "clerkRelationExcel", "createTime");
try {
ExcelUtils.xls(response, request, fileName, page.getResult().getResult(), fileList, titleList);
} catch (Exception e) {
e.printStackTrace();
logger.info("导出失败");
}
return RestResponse.successResult(true);
}
return RestResponse.successResult(false);
}
} }
...@@ -9,7 +9,6 @@ import com.gic.api.base.commons.Page; ...@@ -9,7 +9,6 @@ import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse; import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.DateUtil; import com.gic.commons.util.DateUtil;
import com.gic.commons.util.PageHelperUtils; import com.gic.commons.util.PageHelperUtils;
import com.gic.commons.util.UniqueIdUtils;
import com.gic.commons.webapi.reponse.RestResponse; import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.enterprise.api.dto.EnterpriseDTO; import com.gic.enterprise.api.dto.EnterpriseDTO;
import com.gic.enterprise.api.service.EnterpriseService; import com.gic.enterprise.api.service.EnterpriseService;
...@@ -98,38 +97,39 @@ public class LicenceOrderController { ...@@ -98,38 +97,39 @@ public class LicenceOrderController {
// } // }
/** /**
* 新增或者修改订单 * 新增订单
*
* @param licenceOrderQO
* @return JSONObject key:orderId 和 price
*/ */
@RequestMapping("licence-order-saveOrUpdate") @RequestMapping("licence-order-saveOrUpdate")
@GicLogRecord(value = "${#logValue}", category = GicLogRecordCategoryEnum.HB_LICENCE_ORDER, @GicLogRecord(value = "${#logValue}", category = GicLogRecordCategoryEnum.HB_LICENCE_ORDER,
optType = GicLogRecordOptTypeEnum.HB_1004_01, userFunc = LogRecordUserServiceImpl.class, optPage = "购买企业微信许可账号") optType = GicLogRecordOptTypeEnum.HB_1004_01, userFunc = LogRecordUserServiceImpl.class, optPage = "购买企业微信许可账号")
public RestResponse<String> saveOrUpdateLicenceOrder(@RequestBody LicenceOrderQO licenceOrderQO) { public RestResponse<JSONObject> saveOrUpdateLicenceOrder(@RequestBody LicenceOrderQO licenceOrderQO) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser(); WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
if (loginUser == null || StringUtils.isBlank(loginUser.getEnterpriseId())) { if (loginUser == null || StringUtils.isBlank(loginUser.getEnterpriseId())) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_4.getCode()), HaoBanErrCode.ERR_4.getMsg()); return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_4.getCode()), HaoBanErrCode.ERR_4.getMsg());
} }
//金额校验
Integer integer = licenceOrderQO.checkPrice();
if (integer == -1) {
return RestResponse.failure("-9999", "许可账号数量有误!");
} else if (integer == 0) {
return RestResponse.failure("-9999", "购买金额计算有误!");
}
LicenceOrderQDTO licenceOrderQDTO = JSONObject.parseObject(JSONObject.toJSONString(licenceOrderQO), LicenceOrderQDTO.class); LicenceOrderQDTO licenceOrderQDTO = JSONObject.parseObject(JSONObject.toJSONString(licenceOrderQO), LicenceOrderQDTO.class);
licenceOrderQDTO.setEnterpriseId(loginUser.getEnterpriseId()); licenceOrderQDTO.setEnterpriseId(loginUser.getEnterpriseId());
licenceOrderQDTO.setWxEnterpriseId(loginUser.getWxEnterpriseId()); licenceOrderQDTO.setWxEnterpriseId(loginUser.getWxEnterpriseId());
licenceOrderQDTO.setCreatorId(loginUser.getClerkId()); licenceOrderQDTO.setCreatorId(loginUser.getClerkId());
licenceOrderQDTO.setCreatorName(loginUser.getClerkName()); licenceOrderQDTO.setCreatorName(loginUser.getClerkName());
String result = licenceOrderApiService.saveOrUpdateLicenceOrder(licenceOrderQDTO).getResult(); ServiceResponse<String> response = licenceOrderApiService.saveOrUpdateLicenceOrder(licenceOrderQDTO);
String time = ""; if (response.isSuccess()) {
if (licenceOrderQO.getTimeType() == 1) { JSONObject object = JSONObject.parseObject(response.getResult(), JSONObject.class);
time = licenceOrderQO.getTimeValue() + "个月"; String time = "";
} else { if (licenceOrderQO.getTimeType() == 1) {
time = licenceOrderQO.getTimeValue() + "天"; time = licenceOrderQO.getTimeValue() + "个月";
} else {
time = licenceOrderQO.getTimeValue() + "天";
}
String logValue = "【购买企微许可账号】:订单编号ZH" + object.getString("orderId") + ",企业员工账号" + licenceOrderQO.getExternalContactCount() + "个,时长" + time;
GicLogRecordEvaluationContext.putAttribute("logValue", logValue);
return RestResponse.successResult(object);
} }
String logValue = "【购买企微许可账号】:订单编号ZH" + result + ",企业员工账号" + licenceOrderQO.getExternalContactCount() + "个,时长" + time; GicLogRecordEvaluationContext.noWriteLog();
GicLogRecordEvaluationContext.putAttribute("logValue", logValue); return RestResponse.failure(response.getCode(), response.getMessage());
return RestResponse.successResult(result);
} }
/** /**
...@@ -155,7 +155,7 @@ public class LicenceOrderController { ...@@ -155,7 +155,7 @@ public class LicenceOrderController {
} }
/** /**
* 取消订单/订单已经过期 * 取消订单
*/ */
@RequestMapping("licence-order-cancel") @RequestMapping("licence-order-cancel")
@GicLogRecord(value = "${#logValue}", category = GicLogRecordCategoryEnum.HB_LICENCE_ORDER, @GicLogRecord(value = "${#logValue}", category = GicLogRecordCategoryEnum.HB_LICENCE_ORDER,
...@@ -173,10 +173,18 @@ public class LicenceOrderController { ...@@ -173,10 +173,18 @@ public class LicenceOrderController {
String enterpriseId = loginUser.getEnterpriseId(); String enterpriseId = loginUser.getEnterpriseId();
String wxEnterpriseId = loginUser.getWxEnterpriseId(); String wxEnterpriseId = loginUser.getWxEnterpriseId();
String clerkName = loginUser.getClerkName(); String clerkName = loginUser.getClerkName();
Boolean result = licenceOrderApiService.updateLicenceOrderType(orderId, type, enterpriseId, wxEnterpriseId, clerkName, 1).getResult(); //取消企业微信订单
String logValue = "【取消购买企微许可账号订单】:订单编号" + dto.getOrderNumber() + ",取消时间" + DateUtil.dateToStr(new Date(), DateUtil.FORMAT_DATETIME_19); ServiceResponse<Boolean> response = licenceOrderApiService.cancelQywxOrder(orderId);
GicLogRecordEvaluationContext.putAttribute("logValue", logValue); if (response.isSuccess()) {
return RestResponse.successResult(result); Boolean result = licenceOrderApiService.updateLicenceOrderType(orderId, type, enterpriseId, wxEnterpriseId, clerkName, 1).getResult();
//操作日志记录
String logValue = "【取消购买企微许可账号订单】:订单编号" + dto.getOrderNumber() + ",取消时间" + DateUtil.dateToStr(new Date(), DateUtil.FORMAT_DATETIME_19);
GicLogRecordEvaluationContext.putAttribute("logValue", logValue);
return RestResponse.successResult(result);
}
GicLogRecordEvaluationContext.noWriteLog();
return RestResponse.failure(response.getCode(), response.getMessage());
} }
/** /**
...@@ -198,10 +206,14 @@ public class LicenceOrderController { ...@@ -198,10 +206,14 @@ public class LicenceOrderController {
String enterpriseId = loginUser.getEnterpriseId(); String enterpriseId = loginUser.getEnterpriseId();
String wxEnterpriseId = loginUser.getWxEnterpriseId(); String wxEnterpriseId = loginUser.getWxEnterpriseId();
String clerkName = loginUser.getClerkName(); String clerkName = loginUser.getClerkName();
Boolean result = licenceOrderApiService.uploadLicenceOrderVoucher(orderId, voucher, enterpriseId, wxEnterpriseId, clerkName).getResult(); ServiceResponse<Boolean> response = licenceOrderApiService.uploadLicenceOrderVoucher(orderId, voucher, enterpriseId, wxEnterpriseId, clerkName);
String logValue = "【上传购买企微许可账号支付凭证】:订单编号" + dto.getOrderNumber() + ",上传时间" + DateUtil.dateToStr(new Date(), DateUtil.FORMAT_DATETIME_19); if (response.isSuccess()) {
GicLogRecordEvaluationContext.putAttribute("logValue", logValue); String logValue = "【上传购买企微许可账号支付凭证】:订单编号" + dto.getOrderNumber() + ",上传时间" + DateUtil.dateToStr(new Date(), DateUtil.FORMAT_DATETIME_19);
return RestResponse.successResult(result); GicLogRecordEvaluationContext.putAttribute("logValue", logValue);
return RestResponse.successResult(true);
}
GicLogRecordEvaluationContext.noWriteLog();
return RestResponse.failure(response.getCode(), response.getMessage());
} }
/** /**
...@@ -226,7 +238,7 @@ public class LicenceOrderController { ...@@ -226,7 +238,7 @@ public class LicenceOrderController {
return RestResponse.successResult(map); return RestResponse.successResult(map);
} }
Integer money = result.getPrice(); Integer money = result.getPrice();
if (null != loginUser.getPhoneNumber() && Arrays.asList("13456789987", "13429152802","13383841777","13576223447").contains(loginUser.getPhoneNumber())) { if (null != loginUser.getPhoneNumber() && Arrays.asList("13456789987", "13429152802", "13383841777", "13576223447").contains(loginUser.getPhoneNumber())) {
//测试账号付款一分 //测试账号付款一分
money = 1; money = 1;
} }
......
...@@ -154,5 +154,9 @@ public class LicenceOrderVO implements Serializable { ...@@ -154,5 +154,9 @@ public class LicenceOrderVO implements Serializable {
* 订单进度list * 订单进度list
*/ */
private List<LicenceOrderProgressVO> OrderProgressList; private List<LicenceOrderProgressVO> OrderProgressList;
/**
* 企业微信订单过期时间
*/
private Date qywxExpireTime;
} }
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