Commit 20e6e474 by jinxin

Merge branch 'feature/五月二期' into 'master'

Feature/五月二期

See merge request !1295
parents 190e5538 e8c7fd5e
...@@ -69,6 +69,30 @@ public class SecretSettingDTO implements Serializable { ...@@ -69,6 +69,30 @@ public class SecretSettingDTO implements Serializable {
* *
*/ */
private Date updateTime; private Date updateTime;
/**
* 应用id
*/
private String agentId;
/**
* 应用名称
*/
private String agentName;
public String getAgentId() {
return agentId;
}
public void setAgentId(String agentId) {
this.agentId = agentId;
}
public String getAgentName() {
return agentName;
}
public void setAgentName(String agentName) {
this.agentName = agentName;
}
public String getSecretId() { public String getSecretId() {
return secretId; return secretId;
......
...@@ -110,6 +110,66 @@ public class WxEnterpriseDTO implements Serializable { ...@@ -110,6 +110,66 @@ public class WxEnterpriseDTO implements Serializable {
private String openCorpid ; private String openCorpid ;
private String wxaAppid ; private String wxaAppid ;
private String urlHost ; private String urlHost ;
/**
* 应用类型,0第三方 1自建
*/
private Integer appType;
/**
* 应用id
*/
private String agentId;
/**
* 应用名称
*/
private String agentName;
/**
* secret
*/
private String secretVal;
/**
* 自建应用是否支持配置回调地址 0 不支持 1支持
*/
private Integer callbackFlag;
public Integer getCallbackFlag() {
return callbackFlag;
}
public void setCallbackFlag(Integer callbackFlag) {
this.callbackFlag = callbackFlag;
}
public String getAgentId() {
return agentId;
}
public void setAgentId(String agentId) {
this.agentId = agentId;
}
public String getAgentName() {
return agentName;
}
public void setAgentName(String agentName) {
this.agentName = agentName;
}
public String getSecretVal() {
return secretVal;
}
public void setSecretVal(String secretVal) {
this.secretVal = secretVal;
}
public Integer getAppType() {
return appType;
}
public void setAppType(Integer appType) {
this.appType = appType;
}
public String getUrlHost() { public String getUrlHost() {
return urlHost; return urlHost;
......
...@@ -41,7 +41,60 @@ public class YwWxEnterpriseDTO implements Serializable { ...@@ -41,7 +41,60 @@ public class YwWxEnterpriseDTO implements Serializable {
* 是否开启历史好友关联 true 开启 false 关闭 * 是否开启历史好友关联 true 开启 false 关闭
*/ */
private Boolean openMassFlag; private Boolean openMassFlag;
/**
* 企微加密类型1待开发+第三方(都是明文),2待开发+第三方(都是密文),3待开发(明文)+第三方v密文),4待开发(密文)+第三方(明文),5自建应用
*/
private Integer wxSecurityType;
/**
* 应用类型,0第三方 1自建
*/
private Integer appType;
/**
* 明文corpid
*/
private String wxCorpid ;
/**
* 加密corpid
*/
private String openCorpid ;
public String getWxCorpid() {
return wxCorpid;
}
public void setWxCorpid(String wxCorpid) {
this.wxCorpid = wxCorpid;
}
public String getOpenCorpid() {
return openCorpid;
}
public void setOpenCorpid(String openCorpid) {
this.openCorpid = openCorpid;
}
public Integer getWxSecurityType() {
return wxSecurityType;
}
public void setWxSecurityType(Integer wxSecurityType) {
this.wxSecurityType = wxSecurityType;
}
public Integer getAppType() {
if (null != this.wxSecurityType && this.wxSecurityType == 5){
this.appType = 1;
}else {
this.appType = 0;
}
return appType;
}
public void setAppType(Integer appType) {
this.appType = appType;
}
private List<EnterpriseDetailDTO> enList ; private List<EnterpriseDetailDTO> enList ;
public List<EnterpriseDetailDTO> getEnList() { public List<EnterpriseDetailDTO> getEnList() {
......
...@@ -342,4 +342,18 @@ public interface StaffApiService { ...@@ -342,4 +342,18 @@ public interface StaffApiService {
* @return * @return
*/ */
com.gic.api.base.commons.ServiceResponse<List<WxEnterpriseRelatedDTO>> getWxEnterpriseRelatedList(String wxEnterpriseId); com.gic.api.base.commons.ServiceResponse<List<WxEnterpriseRelatedDTO>> getWxEnterpriseRelatedList(String wxEnterpriseId);
/**
* 定时任务
* 刷新企业成员外部联系人
* @param params 企业微信id,多个按”,“隔开
*/
com.gic.api.base.commons.ServiceResponse<Boolean> updateExternalUserId(String params);
/**
* 定时任务
* 同步企业微信通讯录列表
* @param params 回调参数
* @return
*/
com.gic.api.base.commons.ServiceResponse<Boolean> syncQywxStaffList(String params) ;
} }
...@@ -18,6 +18,13 @@ public interface StaffClerkRelationApiService { ...@@ -18,6 +18,13 @@ public interface StaffClerkRelationApiService {
*/ */
void bindLogMq(String params); void bindLogMq(String params);
/**
*
* @param wxEnterpriseId
* @param enterpriseId
* @param clerkCodeList 改为传导购idList
* @return
*/
List<StaffClerkRelationDTO> listBindCode(String wxEnterpriseId,String enterpriseId, Set<String> clerkCodeList); List<StaffClerkRelationDTO> listBindCode(String wxEnterpriseId,String enterpriseId, Set<String> clerkCodeList);
List<StaffClerkRelationDTO> listBindCodeByStaffId(List<String> enterpriseIdList, String staffId); List<StaffClerkRelationDTO> listBindCodeByStaffId(List<String> enterpriseIdList, String staffId);
......
...@@ -26,6 +26,7 @@ public interface WxEnterpriseApiService { ...@@ -26,6 +26,7 @@ public interface WxEnterpriseApiService {
* @param version 版本 * @param version 版本
* @param enterpriseIdsNotIn 企业不存在列表 * @param enterpriseIdsNotIn 企业不存在列表
* @param loginUserId 登录用户id * @param loginUserId 登录用户id
* @param appType 应用类型,0第三方 1自建
* @return : {@link Page< YwWxEnterpriseDTO>} * @return : {@link Page< YwWxEnterpriseDTO>}
* @author : YongEn * @author : YongEn
* @date : 2022/2/15 * @date : 2022/2/15
...@@ -36,7 +37,8 @@ public interface WxEnterpriseApiService { ...@@ -36,7 +37,8 @@ public interface WxEnterpriseApiService {
Integer gicContactFlag, Integer gicContactFlag,
String version, String version,
List<String> enterpriseIdsNotIn, List<String> enterpriseIdsNotIn,
String loginUserId); String loginUserId,
Integer appType);
/** /**
* 获取一个 * 获取一个
...@@ -232,4 +234,29 @@ public interface WxEnterpriseApiService { ...@@ -232,4 +234,29 @@ public interface WxEnterpriseApiService {
public String getEndDate(String enterpriseId) ; public String getEndDate(String enterpriseId) ;
/**
* 新增或者修改企业微信配置信息
* @param enterpriseDTO
* @return
*/
ServiceResponse<Boolean> saveOrUpdate(WxEnterpriseDTO enterpriseDTO);
/**
* 过滤已经存在的自建应用appid
* @param wxAppidList 好办自建应用appidList
* @return 过滤的好办自建应用appidList
*/
ServiceResponse<List<String>> filterWxAppidList(List<String> wxAppidList);
/**
* 定时任务,同步自建应用信息
*/
ServiceResponse<Boolean> syncWxEnterpriseInfo(String params);
/**
* 删除自建应用wxaAppid
* @param wxEnterpriseId 企业微信id
* @return
*/
ServiceResponse<Boolean> deleteByWxEnterpriseId(String wxEnterpriseId);
} }
...@@ -190,6 +190,17 @@ ...@@ -190,6 +190,17 @@
<artifactId>gic-authcenter-commons</artifactId> <artifactId>gic-authcenter-commons</artifactId>
<version>${gic-authcenter-commons}</version> <version>${gic-authcenter-commons}</version>
</dependency> </dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.9</version>
<exclusions>
<exclusion>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
package com.gic.haoban.manage.web.controller; package com.gic.haoban.manage.web.controller;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.authcenter.commons.dto.AuthcenterUserDetails; import com.gic.authcenter.commons.dto.AuthcenterUserDetails;
...@@ -9,6 +8,7 @@ import com.gic.authcenter.commons.util.SessionContextUtil; ...@@ -9,6 +8,7 @@ import com.gic.authcenter.commons.util.SessionContextUtil;
import com.gic.clerk.api.dto.ClerkDTO; import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.service.ClerkService; import com.gic.clerk.api.service.ClerkService;
import com.gic.commons.util.GlobalVar; import com.gic.commons.util.GlobalVar;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.enterprise.api.dto.EnterpriseAndUserDTO; import com.gic.enterprise.api.dto.EnterpriseAndUserDTO;
import com.gic.enterprise.api.dto.EnterpriseDTO; import com.gic.enterprise.api.dto.EnterpriseDTO;
import com.gic.enterprise.api.dto.PowerStoreGroupDTO; import com.gic.enterprise.api.dto.PowerStoreGroupDTO;
...@@ -31,6 +31,7 @@ import com.gic.haoban.manage.api.service.WxEnterpriseApiService; ...@@ -31,6 +31,7 @@ import com.gic.haoban.manage.api.service.WxEnterpriseApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService; import com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode; import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.qo.WxEnterpriseBindQo; import com.gic.haoban.manage.web.qo.WxEnterpriseBindQo;
import com.gic.haoban.manage.web.qo.WxEnterpriseQO;
import com.gic.haoban.manage.web.vo.EnterpriseDetailVo; import com.gic.haoban.manage.web.vo.EnterpriseDetailVo;
import com.gic.haoban.manage.web.vo.EnterpriseSearchVO; import com.gic.haoban.manage.web.vo.EnterpriseSearchVO;
import com.gic.haoban.manage.web.vo.StoreGroupVo; import com.gic.haoban.manage.web.vo.StoreGroupVo;
...@@ -109,6 +110,7 @@ public class EnterpriseController extends WebBaseController { ...@@ -109,6 +110,7 @@ public class EnterpriseController extends WebBaseController {
* @param gicContactHelper 是否开启通讯录应用1是0否 * @param gicContactHelper 是否开启通讯录应用1是0否
* @param loginUserId 登录用户id * @param loginUserId 登录用户id
* @param version 版本 * @param version 版本
* @param appType 应用类型,0第三方 1自建 null全部
* @return res * @return res
*/ */
@RequestMapping("wx-enterprise-list") @RequestMapping("wx-enterprise-list")
...@@ -118,7 +120,8 @@ public class EnterpriseController extends WebBaseController { ...@@ -118,7 +120,8 @@ public class EnterpriseController extends WebBaseController {
String gicEnterpriseName, String gicEnterpriseName,
Integer gicContactHelper, Integer gicContactHelper,
String loginUserId, String loginUserId,
String version) { String version,
Integer appType) {
List<String> wxEnterpriseIdInList = Lists.newArrayList(); List<String> wxEnterpriseIdInList = Lists.newArrayList();
...@@ -140,15 +143,15 @@ public class EnterpriseController extends WebBaseController { ...@@ -140,15 +143,15 @@ public class EnterpriseController extends WebBaseController {
Page<YwWxEnterpriseDTO> page = new Page<>(); Page<YwWxEnterpriseDTO> page = new Page<>();
if (Objects.nonNull(openTagFlag) && ALL == openTagFlag) { if (Objects.nonNull(openTagFlag) && ALL == openTagFlag) {
page = queryAll(pageInfo, keyword, gicContactHelper, version, wxEnterpriseIdInList, wxEnterpriseIdSetInCache, loginUserId); page = queryAll(pageInfo, keyword, gicContactHelper, version, wxEnterpriseIdInList, wxEnterpriseIdSetInCache, loginUserId,appType);
} }
if (Objects.nonNull(openTagFlag) && OPEN == openTagFlag) { if (Objects.nonNull(openTagFlag) && OPEN == openTagFlag) {
page = queryOpen(pageInfo, keyword, gicEnterpriseName, gicContactHelper, version, wxEnterpriseIdInList, wxEnterpriseIdSetInCache, loginUserId); page = queryOpen(pageInfo, keyword, gicEnterpriseName, gicContactHelper, version, wxEnterpriseIdInList, wxEnterpriseIdSetInCache, loginUserId,appType);
} }
if (Objects.nonNull(openTagFlag) && CLOSE == openTagFlag) { if (Objects.nonNull(openTagFlag) && CLOSE == openTagFlag) {
page = queryClose(pageInfo, keyword, gicContactHelper, version, wxEnterpriseIdInList, wxEnterpriseIdSetInCache, loginUserId); page = queryClose(pageInfo, keyword, gicContactHelper, version, wxEnterpriseIdInList, wxEnterpriseIdSetInCache, loginUserId,appType);
} }
doProcessOpenSendMass(page.getResult()); doProcessOpenSendMass(page.getResult());
...@@ -221,9 +224,10 @@ public class EnterpriseController extends WebBaseController { ...@@ -221,9 +224,10 @@ public class EnterpriseController extends WebBaseController {
String version, String version,
List<String> wxEnterpriseIdInList, List<String> wxEnterpriseIdInList,
Set<String> wxEnterpriseIdSetInCache, Set<String> wxEnterpriseIdSetInCache,
String loginUserId) { String loginUserId,
Integer appType) {
// 查询所有状态 // 查询所有状态
Page<YwWxEnterpriseDTO> page = wxEnterpriseApiService.list(pageInfo, keyword, wxEnterpriseIdInList, gicContactHelper, version, null, loginUserId); Page<YwWxEnterpriseDTO> page = wxEnterpriseApiService.list(pageInfo, keyword, wxEnterpriseIdInList, gicContactHelper, version, null, loginUserId,appType);
if (CollectionUtil.isEmpty(page.getResult())) { if (CollectionUtil.isEmpty(page.getResult())) {
return page; return page;
} }
...@@ -249,14 +253,15 @@ public class EnterpriseController extends WebBaseController { ...@@ -249,14 +253,15 @@ public class EnterpriseController extends WebBaseController {
String version, String version,
List<String> wxEnterpriseIdInList, List<String> wxEnterpriseIdInList,
Set<String> wxEnterpriseIdSetInCache, Set<String> wxEnterpriseIdSetInCache,
String loginUserId) { String loginUserId,
Integer appType) {
// 查询开启状态 // 查询开启状态
if (haveCondition(gicEnterpriseName)) { if (haveCondition(gicEnterpriseName)) {
// 有条件-取交集 // 有条件-取交集
wxEnterpriseIdSetInCache.retainAll(wxEnterpriseIdInList); wxEnterpriseIdSetInCache.retainAll(wxEnterpriseIdInList);
} }
List<String> queryList = new ArrayList<>(wxEnterpriseIdSetInCache); List<String> queryList = new ArrayList<>(wxEnterpriseIdSetInCache);
Page<YwWxEnterpriseDTO> page = wxEnterpriseApiService.list(pageInfo, keyword, queryList, gicContactHelper, version, null, loginUserId); Page<YwWxEnterpriseDTO> page = wxEnterpriseApiService.list(pageInfo, keyword, queryList, gicContactHelper, version, null, loginUserId,appType);
if (CollectionUtil.isEmpty(page.getResult())) { if (CollectionUtil.isEmpty(page.getResult())) {
return page; return page;
} }
...@@ -278,9 +283,10 @@ public class EnterpriseController extends WebBaseController { ...@@ -278,9 +283,10 @@ public class EnterpriseController extends WebBaseController {
String version, String version,
List<String> wxEnterpriseIdInList, List<String> wxEnterpriseIdInList,
Set<String> wxEnterpriseIdSetInCache, Set<String> wxEnterpriseIdSetInCache,
String loginUserId) { String loginUserId,
Integer appType) {
// 查询关闭状态 // 查询关闭状态
Page<YwWxEnterpriseDTO> page = wxEnterpriseApiService.list(pageInfo, keyword, wxEnterpriseIdInList, gicContactHelper, version, new ArrayList<>(wxEnterpriseIdSetInCache), loginUserId); Page<YwWxEnterpriseDTO> page = wxEnterpriseApiService.list(pageInfo, keyword, wxEnterpriseIdInList, gicContactHelper, version, new ArrayList<>(wxEnterpriseIdSetInCache), loginUserId,appType);
if (CollectionUtil.isEmpty(page.getResult())) { if (CollectionUtil.isEmpty(page.getResult())) {
return page; return page;
} }
...@@ -629,4 +635,19 @@ public class EnterpriseController extends WebBaseController { ...@@ -629,4 +635,19 @@ public class EnterpriseController extends WebBaseController {
WxEnterpriseRelationDetailDTO bindInfo = wxEnterpriseRelatedApiService.getEnterpriseBindInfo(wxEnterpriseId, enterpriseId); WxEnterpriseRelationDetailDTO bindInfo = wxEnterpriseRelatedApiService.getEnterpriseBindInfo(wxEnterpriseId, enterpriseId);
return resultResponse(HaoBanErrCode.ERR_1, bindInfo); return resultResponse(HaoBanErrCode.ERR_1, bindInfo);
} }
/**
* 新增或者修改企业微信自建应用信息
* @return
*/
@RequestMapping("saveOrUpdate-WxEnterprise-detail")
public RestResponse<Boolean> saveOrUpdateEnterpriseDetail(@RequestBody WxEnterpriseQO qo){
WxEnterpriseDTO wxEnterpriseDTO = EntityUtil.changeEntityByJSON(WxEnterpriseDTO.class, qo);
com.gic.api.base.commons.ServiceResponse<Boolean> response = wxEnterpriseApiService.saveOrUpdate(wxEnterpriseDTO);
if (response.isSuccess()){
return RestResponse.successResult(true);
}
return RestResponse.failure(response.getCode(),response.getMessage());
}
} }
package com.gic.haoban.manage.web.controller;
import cn.hutool.crypto.SecureUtil;
import com.alibaba.fastjson.JSONObject;
import com.gic.commons.util.DateUtil;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.common.utils.UploadUtils;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.thirdparty.cloudfile.CloudFileUtil;
import com.gic.thirdparty.cloudfile.enums.CloudFileBusinessOptEnum;
import com.gic.thirdparty.cloudfile.enums.CloudFileTypeEnum;
import com.gic.thirdparty.cloudfile.pojo.CloudFileInfo;
import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.FileInputStream;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
@RestController
public class UploadController extends WebBaseController {
private static Logger logger = LoggerFactory.getLogger(UploadController.class);
@RequestMapping("/upload-file")
@ResponseBody
public RestResponse upload(@RequestParam MultipartFile file) throws Exception {
if (file == null || file.isEmpty()) {
return RestResponse.failure("-9999","上传的文件不能为空!");
}
String name = file.getOriginalFilename();
// 未加密前文件名称
String mediaName = file.getOriginalFilename();
mediaName = mediaName.substring(0, mediaName.lastIndexOf("."));
if (mediaName.length() > 20) {
mediaName = mediaName.substring(0, 20);
}
String suffix = name.substring(name.lastIndexOf(".") + 1);
name = SecureUtil.md5(name) + "." + suffix;
String location = System.getProperty("user.dir") + "/data/tmp/";
long len = file.getSize();
File templateFile = new File(location + name);
FileUtils.copyInputStreamToFile(file.getInputStream(), templateFile);
// 2.上传腾讯云
String dayFilePath = LocalDateTime.now().format(DateTimeFormatter.ofPattern(DateUtil.FORMAT_DATETIME_14));
String nameUpload = mediaName + "." + suffix;
String key = "haoban/" + dayFilePath + "/" + nameUpload;
try {
//替换新的上传接口
CloudFileTypeEnum cloudFileTypeEnum = CloudFileTypeEnum.OTHER;
if (UploadUtils.isPicture(suffix)) {
cloudFileTypeEnum = CloudFileTypeEnum.IMAGE;
} else if (UploadUtils.isOffice(suffix)) {
cloudFileTypeEnum = CloudFileTypeEnum.FILE;
} else if (UploadUtils.isMusic(suffix)) {
cloudFileTypeEnum = CloudFileTypeEnum.AUDIO;
} else if (UploadUtils.isVedio(suffix)) {
cloudFileTypeEnum = CloudFileTypeEnum.VIDEO;
}
CloudFileInfo cloudFileInfo = CloudFileUtil.uploadFile(new FileInputStream(templateFile), suffix, cloudFileTypeEnum, "gic_inner", CloudFileBusinessOptEnum.HAOBAN_COMMON);
if (templateFile != null) {
templateFile.delete();
}
JSONObject res = new JSONObject();
res.put("name", name);
res.put("mediaName", mediaName);
res.put("ext", suffix);
res.put("size", len);
res.put("key", key);
res.put("url", cloudFileInfo.getOrgFileUrl());
return RestResponse.successResult(res);
} catch (Exception e) {
logger.info("异常:{}", e.getMessage(), e);
return RestResponse.failure("-9999","操作失败");
}
}
}
package com.gic.haoban.manage.web.qo;
import java.io.Serializable;
public class WxEnterpriseQO implements Serializable {
private static final long serialVersionUID = 1L;
private String wxEnterpriseId;
/**
* 企业名称
*/
private String corpName;
/**
* 企业头像
*/
private String corpSquareLogoUrl;
/**
* 应用id
*/
private String agentId;
/**
* 应用名称
*/
private String agentName;
/**
* secret
*/
private String secretVal;
/**
* 明文corpid
*/
private String wxCorpid;
/**
* 自建小程序appid
*/
private String wxaAppid;
/**
* 自建请求url
*/
private String urlHost;
/**
* 应用类型,0第三方 1自建
*/
private Integer appType;
/**
* 自建应用是否支持配置回调地址 0 不支持 1支持
*/
private Integer callbackFlag;
public Integer getCallbackFlag() {
return callbackFlag;
}
public void setCallbackFlag(Integer callbackFlag) {
this.callbackFlag = callbackFlag;
}
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
public String getCorpName() {
return corpName;
}
public void setCorpName(String corpName) {
this.corpName = corpName;
}
public String getCorpSquareLogoUrl() {
return corpSquareLogoUrl;
}
public void setCorpSquareLogoUrl(String corpSquareLogoUrl) {
this.corpSquareLogoUrl = corpSquareLogoUrl;
}
public String getWxCorpid() {
return wxCorpid;
}
public void setWxCorpid(String wxCorpid) {
this.wxCorpid = wxCorpid;
}
public String getWxaAppid() {
return wxaAppid;
}
public void setWxaAppid(String wxaAppid) {
this.wxaAppid = wxaAppid;
}
public String getUrlHost() {
return urlHost;
}
public void setUrlHost(String urlHost) {
this.urlHost = urlHost;
}
public Integer getAppType() {
return appType;
}
public void setAppType(Integer appType) {
this.appType = appType;
}
public String getAgentId() {
return agentId;
}
public void setAgentId(String agentId) {
this.agentId = agentId;
}
public String getAgentName() {
return agentName;
}
public void setAgentName(String agentName) {
this.agentName = agentName;
}
public String getSecretVal() {
return secretVal;
}
public void setSecretVal(String secretVal) {
this.secretVal = secretVal;
}
}
...@@ -202,6 +202,11 @@ ...@@ -202,6 +202,11 @@
<artifactId>gic-message-center-api</artifactId> <artifactId>gic-message-center-api</artifactId>
<version>${gic-message-center-api}</version> <version>${gic-message-center-api}</version>
</dependency> </dependency>
<dependency>
<groupId>com.gic.operating</groupId>
<artifactId>gic-operating-api</artifactId>
<version>${gic-operating-api}</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -400,4 +400,12 @@ public interface TabHaobanExternalClerkRelatedMapper { ...@@ -400,4 +400,12 @@ public interface TabHaobanExternalClerkRelatedMapper {
*/ */
List<TabHaobanExternalClerkRelated> queryClerkMemberRelations(@Param("staffId") String staffId, @Param("memberIds") List<String> memberIds); List<TabHaobanExternalClerkRelated> queryClerkMemberRelations(@Param("staffId") String staffId, @Param("memberIds") List<String> memberIds);
/**
* 查询企业微信下面 外部联系人是null的所有成员
* @param wxEnterpriseId
* @param enterpriseIdList
* @return
*/
List<String> listByWxEnterpriseId(@Param("wxEnterpriseId")String wxEnterpriseId, @Param("enterpriseIdList") List<String> enterpriseIdList);
} }
\ No newline at end of file
...@@ -31,10 +31,8 @@ public interface TabHaobanStaffClerkRelationMapper { ...@@ -31,10 +31,8 @@ public interface TabHaobanStaffClerkRelationMapper {
int changeStatusByClerkId(@Param("clerkId") String clerkId, @Param("status") Integer status); int changeStatusByClerkId(@Param("clerkId") String clerkId, @Param("status") Integer status);
/** //无效接口删除
* 解绑 // void delByStoreIdAndCode(@Param("storeId") String storeId, @Param("clerkCode") String clerkCode);
*/
void delByStoreIdAndCode(@Param("storeId") String storeId, @Param("clerkCode") String clerkCode);
/** /**
* 解绑 * 解绑
...@@ -49,7 +47,8 @@ public interface TabHaobanStaffClerkRelationMapper { ...@@ -49,7 +47,8 @@ public interface TabHaobanStaffClerkRelationMapper {
List<StaffClerkRelationDTO> lisByStaffId(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("staffId") String staffId, @Param("storeIdList") List<String> storeIdList); List<StaffClerkRelationDTO> lisByStaffId(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("staffId") String staffId, @Param("storeIdList") List<String> storeIdList);
StaffClerkRelationDTO getByCodeAndStoreId(@Param("clerkCode") String clerkCode, @Param("storeId") String storeId); //无效接口删除
// StaffClerkRelationDTO getByCodeAndStoreId(@Param("clerkCode") String clerkCode, @Param("storeId") String storeId);
List<String> listByWxEnterpriseId(@Param("wxEnterpriseId") String wxEnterpriseId); List<String> listByWxEnterpriseId(@Param("wxEnterpriseId") String wxEnterpriseId);
......
...@@ -22,7 +22,8 @@ public interface WxEnterpriseMapper { ...@@ -22,7 +22,8 @@ public interface WxEnterpriseMapper {
@Param("enterpriseIds") List<String> enterpriseIds, @Param("enterpriseIds") List<String> enterpriseIds,
@Param("gicContactFlag") Integer gicContactFlag, @Param("gicContactFlag") Integer gicContactFlag,
@Param("version") String version, @Param("version") String version,
@Param("enterpriseIdsNotIn") List<String> enterpriseIdsNotIn); @Param("enterpriseIdsNotIn") List<String> enterpriseIdsNotIn,
@Param("appType") Integer appType);
List<TabHaobanWxEnterprise> listAll(); List<TabHaobanWxEnterprise> listAll();
...@@ -77,4 +78,20 @@ public interface WxEnterpriseMapper { ...@@ -77,4 +78,20 @@ public interface WxEnterpriseMapper {
* @return * @return
*/ */
List<String> queryWxEnterpriseByEnterpriseId(@Param("enterpriseId") String enterpriseId); List<String> queryWxEnterpriseByEnterpriseId(@Param("enterpriseId") String enterpriseId);
/**
* 根据appidList查询appidList
*/
List<String> getWxAppidListByList(@Param("wxAppidList")List<String> wxAppidList);
/**
* 根据好办app类型所有企业微信
*
* @return
*/
List<TabHaobanWxEnterprise> listAllByWxSecurityType(@Param("wxSecurityType") Integer wxSecurityType);
void updateWxaAppid(@Param("wxEnterpriseId") String wxEnterpriseId,@Param("wxaAppid")String wxaAppid);
/**
* 根据是否配置回调地址查询所有企业微信
* @return
*/
List<String> listWxEnterpriseByCallbackFlag(@Param("callbackFlag")Integer callbackFlag);
} }
\ No newline at end of file
...@@ -93,7 +93,31 @@ public class TabHaobanWxEnterprise implements Serializable { ...@@ -93,7 +93,31 @@ public class TabHaobanWxEnterprise implements Serializable {
private String openCorpid ; private String openCorpid ;
private String wxaAppid ; private String wxaAppid ;
private String urlHost ; private String urlHost ;
/**
* 应用类型,0第三方 1自建
*/
private Integer appType;
/**
* 自建应用是否支持配置回调地址 0 不支持 1支持
*/
private Integer callbackFlag;
public Integer getCallbackFlag() {
return callbackFlag;
}
public void setCallbackFlag(Integer callbackFlag) {
this.callbackFlag = callbackFlag;
}
public Integer getAppType() {
return appType;
}
public void setAppType(Integer appType) {
this.appType = appType;
}
public String getUrlHost() { public String getUrlHost() {
return urlHost; return urlHost;
} }
......
...@@ -98,4 +98,12 @@ public interface ExternalClerkRelatedService { ...@@ -98,4 +98,12 @@ public interface ExternalClerkRelatedService {
*/ */
List<TabHaobanExternalClerkRelated> queryClerkMemberRelations(String staffId, List<String> memberIds); List<TabHaobanExternalClerkRelated> queryClerkMemberRelations(String staffId, List<String> memberIds);
/**
* 查询企业微信下面,所有外部联系人是null的成员
* @param wxEnterpriseId
* @param enterpriseIdList
* @return
*/
List<String> listByWxEnterpriseId(String wxEnterpriseId,List<String> enterpriseIdList);
} }
...@@ -75,5 +75,28 @@ public interface WxEnterpriseService { ...@@ -75,5 +75,28 @@ public interface WxEnterpriseService {
* @return * @return
*/ */
List<String> queryWxEnterpriseWithEnterpriseId(String enterpriseId); List<String> queryWxEnterpriseWithEnterpriseId(String enterpriseId);
/**
* 根据appidList查询appidList
*/
List<String> getWxAppidListByList(List<String> wxAppidList);
/**
* 根据好办app类型所有企业微信
*
* @return
*/
List<TabHaobanWxEnterprise> listAllByWxSecurityType(Integer wxSecurityType);
/**
* 删除
* @param wxEnterpriseId
*/
void deleteByWxEnterpriseId(String wxEnterpriseId,String wxaAppid) ;
/**
* 根据是否配置回调地址查询所有企业微信
* @return
*/
List<String> listWxEnterpriseByCallbackFlag(Integer callbackFlag);
} }
...@@ -520,4 +520,9 @@ public class ExternalClerkRelatedServiceImpl implements ExternalClerkRelatedServ ...@@ -520,4 +520,9 @@ public class ExternalClerkRelatedServiceImpl implements ExternalClerkRelatedServ
} }
return this.mapper.queryClerkMemberRelations(staffId, memberIds); return this.mapper.queryClerkMemberRelations(staffId, memberIds);
} }
@Override
public List<String> listByWxEnterpriseId(String wxEnterpriseId, List<String> enterpriseIdList) {
return this.mapper.listByWxEnterpriseId(wxEnterpriseId,enterpriseIdList);
}
} }
...@@ -7,6 +7,7 @@ import java.util.HashMap; ...@@ -7,6 +7,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import cn.hutool.core.collection.CollUtil;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
...@@ -292,4 +293,27 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService { ...@@ -292,4 +293,27 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService {
} }
return this.mapper.queryWxEnterpriseByEnterpriseId(enterpriseId); return this.mapper.queryWxEnterpriseByEnterpriseId(enterpriseId);
} }
@Override
public List<String> getWxAppidListByList(List<String> wxAppidList) {
if (CollUtil.isEmpty(wxAppidList)){
return Collections.emptyList();
}
return this.mapper.getWxAppidListByList(wxAppidList);
}
@Override
public List<TabHaobanWxEnterprise> listAllByWxSecurityType(Integer wxSecurityType) {
return this.mapper.listAllByWxSecurityType(wxSecurityType);
}
@Override
public void deleteByWxEnterpriseId(String wxEnterpriseId,String wxaAppid) {
this.mapper.updateWxaAppid(wxEnterpriseId,wxaAppid);
}
@Override
public List<String> listWxEnterpriseByCallbackFlag(Integer callbackFlag) {
return this.mapper.listWxEnterpriseByCallbackFlag(callbackFlag);
}
} }
...@@ -132,7 +132,8 @@ public class AuditApiServiceImpl implements AuditApiService { ...@@ -132,7 +132,8 @@ public class AuditApiServiceImpl implements AuditApiService {
//门店导购绑定 //门店导购绑定
String oldValue = tab.getOldValue(); String oldValue = tab.getOldValue();
AuditStaffDTO obj = JSONObject.parseObject(oldValue, AuditStaffDTO.class); AuditStaffDTO obj = JSONObject.parseObject(oldValue, AuditStaffDTO.class);
StaffClerkRelationDTO staffClerkRelation = staffClerkRelationApiService.getByCodeAndEnterpriseId(obj.getClerkCode(), tab.getEnterpriseId()); //统一替换导购code
StaffClerkRelationDTO staffClerkRelation = staffClerkRelationApiService.getByCodeAndEnterpriseId(obj.getClerkId(), tab.getEnterpriseId());
String staffId = obj.getStaffId(); String staffId = obj.getStaffId();
String storeId = tab.getCommitStoreId(); String storeId = tab.getCommitStoreId();
String clerkId = obj.getClerkId(); String clerkId = obj.getClerkId();
......
...@@ -28,7 +28,10 @@ import com.gic.haoban.common.utils.UuidUtil; ...@@ -28,7 +28,10 @@ import com.gic.haoban.common.utils.UuidUtil;
import com.gic.haoban.manage.api.dto.*; import com.gic.haoban.manage.api.dto.*;
import com.gic.haoban.manage.api.dto.qdto.TransferActiveCodeQDTO; import com.gic.haoban.manage.api.dto.qdto.TransferActiveCodeQDTO;
import com.gic.haoban.manage.api.dto.role.StoreRoleDTO; import com.gic.haoban.manage.api.dto.role.StoreRoleDTO;
import com.gic.haoban.manage.api.enums.ChannelCodeEnum;
import com.gic.haoban.manage.api.enums.SecretTypeEnum; import com.gic.haoban.manage.api.enums.SecretTypeEnum;
import com.gic.haoban.manage.api.enums.SyncTaskTypeEnum;
import com.gic.haoban.manage.api.service.DealSyncOperationApiService;
import com.gic.haoban.manage.api.service.StaffApiService; import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.service.config.Config; 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;
...@@ -112,6 +115,10 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -112,6 +115,10 @@ public class StaffApiServiceImpl implements StaffApiService {
private GroupChatService groupChatService; private GroupChatService groupChatService;
@Autowired @Autowired
private WxEnterpriseRelatedService wxEnterpriseRelatedService; private WxEnterpriseRelatedService wxEnterpriseRelatedService;
@Autowired
private DealSyncOperationApiService dealSyncOperationApiService;
@Autowired
private ExternalClerkRelatedService externalClerkRelatedService;
@Override @Override
public StaffDTO selectById(String staffId) { public StaffDTO selectById(String staffId) {
...@@ -1167,4 +1174,61 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -1167,4 +1174,61 @@ public class StaffApiServiceImpl implements StaffApiService {
List<TabHaobanWxEnterpriseRelated> list = wxEnterpriseRelatedService.getByWxEnterpriseId(wxEnterpriseId); List<TabHaobanWxEnterpriseRelated> list = wxEnterpriseRelatedService.getByWxEnterpriseId(wxEnterpriseId);
return com.gic.api.base.commons.ServiceResponse.success(com.gic.haoban.common.utils.EntityUtil.changeEntityListByJSON(WxEnterpriseRelatedDTO.class, list)); return com.gic.api.base.commons.ServiceResponse.success(com.gic.haoban.common.utils.EntityUtil.changeEntityListByJSON(WxEnterpriseRelatedDTO.class, list));
} }
@Override
public com.gic.api.base.commons.ServiceResponse<Boolean> updateExternalUserId(String params) {
if(StrUtil.isBlank(params)){
return com.gic.api.base.commons.ServiceResponse.failure("-9999","参数不能为空");
}
logger.info("定时刷新成员外部联系人开始,id参数:{}",params);
List<String> wxEnterpriseIdList = Arrays.asList(params.split(","));
String taskName = "刷新企业微信好友(定时处理)";
for (String wxEnterpriseId: wxEnterpriseIdList){
List<TabHaobanWxEnterpriseRelated> list = wxEnterpriseRelatedService.getByWxEnterpriseId(wxEnterpriseId);
if (CollUtil.isEmpty(list)){
logger.info("该企业微信没有和gic绑定:{}",wxEnterpriseId);
continue;
}
//查询企业微信下面所有的品牌id
List<String> enterpriseIdList = list.stream().map(dto -> dto.getEnterpriseId()).collect(Collectors.toList());
//查询外部联系人id为空的成员id
List<String> staffIdList = externalClerkRelatedService.listByWxEnterpriseId(wxEnterpriseId, enterpriseIdList);
if (CollUtil.isNotEmpty(staffIdList)){
//去重
List<String> collect = staffIdList.stream().distinct().collect(Collectors.toList());
logger.info("需要刷新好友的企业微信id:{},staff成员列表:{}",wxEnterpriseId,JSON.toJSONString(collect));
for (String staffId : staffIdList){
String taskId = dealSyncOperationApiService.createWxFriendTaskSingle(wxEnterpriseId, taskName, staffId,
"刷新企业微信好友(定时任务处理)", SyncTaskTypeEnum.FRIEND_SINGLE.getType());
if (StringUtils.isNotBlank(taskId)) {
dealSyncOperationApiService.dealWxFriendClerkSingle(taskId, staffId, staffId, wxEnterpriseId);
}
}
}
}
logger.info("定时刷新成员外部联系人结束");
return com.gic.api.base.commons.ServiceResponse.success(true);
}
@Override
public com.gic.api.base.commons.ServiceResponse<Boolean> syncQywxStaffList(String params) {
logger.info("定时刷新企业微信通讯录列表信息");
//查询所有未配置回调地址的自建应用
List<String> wxEnterpriseList = wxEnterpriseService.listWxEnterpriseByCallbackFlag(0);
if(CollUtil.isNotEmpty(wxEnterpriseList)){
for (String wxEnterpriseId : wxEnterpriseList){
logger.info("开始刷新:{}",wxEnterpriseId);
String taskId = dealSyncOperationApiService.createQywxTask(wxEnterpriseId, "后门同步企业微信架构", "定时同步处理", "后门同步企业微信架构");
if (StringUtils.isBlank(taskId)) {
logger.info("企业微信id:{},创建异步任务异常!",wxEnterpriseId);
return com.gic.api.base.commons.ServiceResponse.failure("-9999","创建异步任务失败!");
}
String ret = dealSyncOperationApiService.dealQywxDepartment(taskId, wxEnterpriseId);
if (null != ret) {
logger.info("企业微信id:{},异常信息返回:{}",wxEnterpriseId,ret);
}
}
}
return null;
}
} }
...@@ -500,9 +500,10 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -500,9 +500,10 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
} }
} else if (type == 2) { } else if (type == 2) {
logger.info("导购门店转移,新的导购和门店,clerkId={},storeId={}", clerkId, clerkSyncQDTO.getStoreId()); logger.info("导购门店转移,新的导购和门店,clerkId={},storeId={}", clerkId, clerkSyncQDTO.getStoreId());
StaffClerkRelationDTO oldRelationDTO = staffClerkRelationService.getStaffClerkRelationDTO(clerkCode, enterpriseId); //统一处理:导购code替换为导购id
StaffClerkRelationDTO oldRelationDTO = staffClerkRelationService.getStaffClerkRelationDTO(oldClerkId, enterpriseId);
if (null == oldRelationDTO) { if (null == oldRelationDTO) {
logger.info("导购未关联成员,clerkCode={}", clerkCode); logger.info("导购未关联成员,oldClerkId={}", oldClerkId);
return; return;
} }
/* StaffClerkRelationDTO oldRelationDTO = staffClerkRelationService.getByClerkId(oldClerkId); /* StaffClerkRelationDTO oldRelationDTO = staffClerkRelationService.getByClerkId(oldClerkId);
......
package com.gic.haoban.manage.service.service.out.impl; package com.gic.haoban.manage.service.service.out.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
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;
...@@ -21,6 +23,8 @@ import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseRelatedMapper; ...@@ -21,6 +23,8 @@ import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseRelatedMapper;
import com.gic.haoban.manage.service.entity.*; import com.gic.haoban.manage.service.entity.*;
import com.gic.haoban.manage.service.pojo.bo.StaffPrivacyUseLogBO; import com.gic.haoban.manage.service.pojo.bo.StaffPrivacyUseLogBO;
import com.gic.haoban.manage.service.service.*; import com.gic.haoban.manage.service.service.*;
import com.gic.operating.api.dto.HaobanWxEnterpriseDTO;
import com.gic.operating.api.service.HaobanWxEnterpriseApiService;
import com.gic.wechat.api.service.qywx.QywxUserApiService; import com.gic.wechat.api.service.qywx.QywxUserApiService;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
...@@ -63,6 +67,8 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService { ...@@ -63,6 +67,8 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
private HaobanCommonMQApiService haobanCommonMQApiService ; private HaobanCommonMQApiService haobanCommonMQApiService ;
@Autowired @Autowired
private HaobanRoleApiService haobanRoleApiService; private HaobanRoleApiService haobanRoleApiService;
@Autowired
private HaobanWxEnterpriseApiService haobanWxEnterpriseApiService;
@Override @Override
...@@ -192,10 +198,11 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService { ...@@ -192,10 +198,11 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
@Override @Override
public com.gic.api.base.commons.Page<YwWxEnterpriseDTO> list(BasePageInfo pageInfo, String keyword, public com.gic.api.base.commons.Page<YwWxEnterpriseDTO> list(BasePageInfo pageInfo, String keyword,
List<String> enterpriseIds, Integer gicContactFlag, String version, List<String> enterpriseIdsNotIn, List<String> enterpriseIds, Integer gicContactFlag, String version, List<String> enterpriseIdsNotIn,
String loginUserId) { String loginUserId,Integer appType) {
PageHelper.startPage(pageInfo.getPageNum(), pageInfo.getPageSize()); PageHelper.startPage(pageInfo.getPageNum(), pageInfo.getPageSize());
Page<TabHaobanWxEnterprise> page = wxEnterpriseMapper.list(keyword, enterpriseIds, gicContactFlag, version, Page<TabHaobanWxEnterprise> page = wxEnterpriseMapper.list(keyword, enterpriseIds, gicContactFlag, version,
enterpriseIdsNotIn); enterpriseIdsNotIn,appType);
log.info("微信企业信息列表查询数据:{}",JSON.toJSONString(page));
// 数据转换+白名单过滤 // 数据转换+白名单过滤
if (Objects.isNull(page) || CollectionUtils.isEmpty(page.getResult())) { if (Objects.isNull(page) || CollectionUtils.isEmpty(page.getResult())) {
com.gic.api.base.commons.Page<Object> objectPage = new com.gic.api.base.commons.Page<>(); com.gic.api.base.commons.Page<Object> objectPage = new com.gic.api.base.commons.Page<>();
...@@ -206,6 +213,7 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService { ...@@ -206,6 +213,7 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
} }
com.gic.api.base.commons.Page<YwWxEnterpriseDTO> resPage = PageUtil.changePageHelperToCurrentPage(page, com.gic.api.base.commons.Page<YwWxEnterpriseDTO> resPage = PageUtil.changePageHelperToCurrentPage(page,
YwWxEnterpriseDTO.class); YwWxEnterpriseDTO.class);
log.info("微信企业信息列表查询数据:{}",JSON.toJSONString(resPage));
boolean matchOperId = matchOperId(loginUserId); boolean matchOperId = matchOperId(loginUserId);
resPage.getResult().forEach(one -> { resPage.getResult().forEach(one -> {
if (matchOperId) { if (matchOperId) {
...@@ -247,6 +255,13 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService { ...@@ -247,6 +255,13 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
public WxEnterpriseDTO getOne(String wxEnterpriseId) { public WxEnterpriseDTO getOne(String wxEnterpriseId) {
TabHaobanWxEnterprise tab = wxEnterpriseMapper.selectByPrimaryKey(wxEnterpriseId); TabHaobanWxEnterprise tab = wxEnterpriseMapper.selectByPrimaryKey(wxEnterpriseId);
WxEnterpriseDTO wxDTO = EntityUtil.changeEntityByJSON(WxEnterpriseDTO.class, tab); WxEnterpriseDTO wxDTO = EntityUtil.changeEntityByJSON(WxEnterpriseDTO.class, tab);
//查询secret表信息
SecretSettingDTO secretSetting = secretSettingService.getSecretSetting(wxEnterpriseId, SecretTypeEnum.SELF_APP.getVal());
if (null != secretSetting){
wxDTO.setAgentId(secretSetting.getAgentId());
wxDTO.setAgentName(secretSetting.getAgentName());
wxDTO.setSecretVal(secretSetting.getSecretVal());
}
return wxDTO; return wxDTO;
} }
...@@ -513,4 +528,87 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService { ...@@ -513,4 +528,87 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
} }
return "好办服务已到期" ; return "好办服务已到期" ;
} }
@Override
public ServiceResponse<Boolean> saveOrUpdate(WxEnterpriseDTO enterpriseDTO) {
if (null == enterpriseDTO){
return ServiceResponse.failure("-9999","参数不能为空!");
}
//wxAppid是唯一的,不能重复
String wxaAppid = enterpriseDTO.getWxaAppid();
WxEnterpriseDTO wxEnterpriseDTO = this.selectByWxaAppid(wxaAppid);
if (StrUtil.isBlank(enterpriseDTO.getWxEnterpriseId())){
if (null != wxEnterpriseDTO){
return ServiceResponse.failure("-9999","自建小程序的appid存在重复!");
}
//默认是自建应用
enterpriseDTO.setWxSecurityType(5);
String wxEnterpriseId = wxEnterpriseService.add(enterpriseDTO);
//同步新增
Date now = new Date();
haobanWxEnterpriseApiService.saveOrUpdate(wxEnterpriseId,enterpriseDTO.getCorpName(),enterpriseDTO.getCorpSquareLogoUrl(),1,now,now);
//新增secret表
SecretSettingDTO dto = new SecretSettingDTO();
dto.setWxEnterpriseId(wxEnterpriseId);
dto.setEnterpriseId("-1");
dto.setSecretName("好办自建应用");
dto.setSecretType(1);
dto.setSecretVal(enterpriseDTO.getSecretVal());
dto.setAgentId(enterpriseDTO.getAgentId());
dto.setAgentName(enterpriseDTO.getAgentName());
secretSettingService.saveSecretSetting(dto);
//好办权限初始化
log.info("插入好办小程序权限:{}",wxEnterpriseId);
haobanRoleApiService.addHaobanRole(wxEnterpriseId);
}else {
if(null != wxEnterpriseDTO && (!enterpriseDTO.getWxEnterpriseId().equals(wxEnterpriseDTO.getWxEnterpriseId()))){
return ServiceResponse.failure("-9999","自建小程序的appid存在重复!");
}
wxEnterpriseService.update(enterpriseDTO);
String wxEnterpriseId = enterpriseDTO.getWxEnterpriseId();
SecretSettingDTO secretSetting = secretSettingService.getSecretSetting(wxEnterpriseId, SecretTypeEnum.SELF_APP.getVal());
if (null != secretSetting){
//更新secret表
if (!secretSetting.getAgentName().equals(enterpriseDTO.getAgentName())){
SecretSettingDTO dto = new SecretSettingDTO();
dto.setSecretId(secretSetting.getSecretId());
dto.setAgentName(enterpriseDTO.getAgentName());
secretSettingService.saveSecretSetting(dto);
}
}
}
return ServiceResponse.success(true);
}
@Override
public ServiceResponse<List<String>> filterWxAppidList(List<String> wxAppidList) {
log.info("查询的wxAppidList:{}",JSON.toJSONString(wxAppidList));
if (CollUtil.isEmpty(wxAppidList)){
return ServiceResponse.failure("-9999","参数为空");
}
List<String> list = wxEnterpriseService.getWxAppidListByList(wxAppidList);
log.info("需要过滤的wxAppidList:{}",JSON.toJSONString(list));
//过滤
wxAppidList.removeAll(list);
return ServiceResponse.success(wxAppidList);
}
@Override
public ServiceResponse<Boolean> syncWxEnterpriseInfo(String params) {
log.info("定时同步自建应用信息");
List<TabHaobanWxEnterprise> list = wxEnterpriseService.listAllByWxSecurityType(5);
if (CollUtil.isNotEmpty(list)){
log.info("查询需要同步的信息:{}",JSON.toJSONString(list));
List<HaobanWxEnterpriseDTO> list1 = EntityUtil.changeEntityListByJSON(HaobanWxEnterpriseDTO.class, list);
haobanWxEnterpriseApiService.batchSaveOrUpdate(list1);
}
return null;
}
@Override
public ServiceResponse<Boolean> deleteByWxEnterpriseId(String wxEnterpriseId) {
log.info("删除的企业微信id:{}",wxEnterpriseId);
wxEnterpriseService.deleteByWxEnterpriseId(wxEnterpriseId,null);
return ServiceResponse.success(true);
}
} }
...@@ -224,5 +224,6 @@ ...@@ -224,5 +224,6 @@
<dubbo:reference interface="com.gic.orderecommerce.api.service.EcommerceOrderOutputApiService" id="ecommerceOrderOutputApiService" timeout="10000" retries="0" check="false"/> <dubbo:reference interface="com.gic.orderecommerce.api.service.EcommerceOrderOutputApiService" id="ecommerceOrderOutputApiService" timeout="10000" retries="0" check="false"/>
<dubbo:reference interface="com.gic.order.api.service.sharding.OrderApiService" id="orderApiService" timeout="10000" retries="0" check="false"/> <dubbo:reference interface="com.gic.order.api.service.sharding.OrderApiService" id="orderApiService" timeout="10000" retries="0" check="false"/>
<dubbo:reference interface="com.gic.member.api.service.MemberOutApiService" id="memberOutApiService" timeout="10000" retries="0" check="false"/> <dubbo:reference interface="com.gic.member.api.service.MemberOutApiService" id="memberOutApiService" timeout="10000" retries="0" check="false"/>
<dubbo:reference interface="com.gic.operating.api.service.HaobanWxEnterpriseApiService" id="haobanWxEnterpriseApiService" timeout="10000" retries="0" check="false"/>
</beans> </beans>
\ No newline at end of file
...@@ -795,4 +795,17 @@ ...@@ -795,4 +795,17 @@
AND status_flag = 1 AND status_flag = 1
</select> </select>
<select id="listByWxEnterpriseId" resultType="java.lang.String">
select staff_id
from tab_haoban_external_clerk_related
WHERE
wx_enterprise_id = #{wxEnterpriseId}
AND enterprise_id IN
<foreach collection="enterpriseIdList" item="item" separator="," open="(" close=")">
#{item}
</foreach>
AND status_flag = 1
AND external_user_id IS NULL
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
<include refid="leftJoinStaffSQL"/> <include refid="leftJoinStaffSQL"/>
where a.enterprise_id = #{enterpriseId} where a.enterprise_id = #{enterpriseId}
and a.wx_enterprise_id = #{wxEnterpriseId} and a.status_flag = 1 and b.status_flag = 1 and a.wx_enterprise_id = #{wxEnterpriseId} and a.status_flag = 1 and b.status_flag = 1
and a.clerk_code in and a.clerk_id in
<foreach collection="clerkCodeList" item="id" index="index" open="(" close=")" separator=","> <foreach collection="clerkCodeList" item="id" index="index" open="(" close=")" separator=",">
#{id,jdbcType=VARCHAR} #{id,jdbcType=VARCHAR}
</foreach> </foreach>
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
<include refid="leftJoinStaffSQL"/> <include refid="leftJoinStaffSQL"/>
where a.status_flag = 1 and b.status_flag = 1 where a.status_flag = 1 and b.status_flag = 1
and a.enterprise_id = #{enterpriseId} and a.enterprise_id = #{enterpriseId}
and a.clerk_code = #{clerkCode} order by a.create_time desc limit 1 and a.clerk_id = #{clerkCode} order by a.create_time desc limit 1
</select> </select>
<select id="getStaffClerkRelationDTO" resultType="com.gic.haoban.manage.api.dto.StaffClerkRelationDTO"> <select id="getStaffClerkRelationDTO" resultType="com.gic.haoban.manage.api.dto.StaffClerkRelationDTO">
...@@ -95,7 +95,7 @@ ...@@ -95,7 +95,7 @@
where a.status_flag = 1 and b.status_flag = 1 where a.status_flag = 1 and b.status_flag = 1
and a.manage_flag = 0 and a.manage_flag = 0
and a.enterprise_id = #{enterpriseId} and a.enterprise_id = #{enterpriseId}
and a.clerk_code = #{clerkCode} order by a.create_time desc limit 1 and a.clerk_id = #{clerkCode} order by a.create_time desc limit 1
</select> </select>
...@@ -107,15 +107,7 @@ ...@@ -107,15 +107,7 @@
and status_flag != #{status} and status_flag != #{status}
</update> </update>
<update id="delByStoreIdAndCode">
update tab_haoban_staff_clerk_relation
set status_flag = 0,
update_time = now()
where clerk_code = #{clerkCode,jdbcType=VARCHAR}
and store_id = #{storeId,jdbcType=VARCHAR}
and status_flag = 1
</update>
<select id="listByClerkIds" resultType="com.gic.haoban.manage.api.dto.StaffClerkRelationDTO"> <select id="listByClerkIds" resultType="com.gic.haoban.manage.api.dto.StaffClerkRelationDTO">
<include refid="leftJoinStaffSQL"/> <include refid="leftJoinStaffSQL"/>
where a.status_flag=1 and b.status_flag = 1 where a.status_flag=1 and b.status_flag = 1
...@@ -173,12 +165,6 @@ ...@@ -173,12 +165,6 @@
and a.staff_id = #{staffId} and a.status_flag=1 and b.status_flag=1 and a.staff_id = #{staffId} and a.status_flag=1 and b.status_flag=1
</select> </select>
<select id="getByCodeAndStoreId" resultType="com.gic.haoban.manage.api.dto.StaffClerkRelationDTO">
<include refid="leftJoinStaffSQL" />
where a.clerk_code = #{clerkCode}
and a.store_id = #{storeId}
and a.status_flag = 1 and b.status_flag=1
</select>
<select id="listByWxEnterpriseId" resultType="String"> <select id="listByWxEnterpriseId" resultType="String">
select a.staff_id select a.staff_id
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
<result column="open_corpid" property="openCorpid"/> <result column="open_corpid" property="openCorpid"/>
<result column="wxa_appid" property="wxaAppid" /> <result column="wxa_appid" property="wxaAppid" />
<result column="url_host" property="urlHost"/> <result column="url_host" property="urlHost"/>
<result column="callback_flag" property="callbackFlag"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
...@@ -52,7 +53,7 @@ ...@@ -52,7 +53,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 , wxa_appid , url_host ,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,callback_flag
</sql> </sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String"> <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String">
select select
...@@ -176,6 +177,18 @@ ...@@ -176,6 +177,18 @@
<if test="null != openCorpid"> <if test="null != openCorpid">
open_corpid , open_corpid ,
</if> </if>
<if test="null != wxaAppid">
wxa_appid ,
</if>
<if test="null != urlHost">
url_host ,
</if>
<if test="null != wxSecurityType">
wx_security_type ,
</if>
<if test="null != callbackFlag">
callback_flag ,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="wxEnterpriseId != null"> <if test="wxEnterpriseId != null">
...@@ -280,9 +293,21 @@ ...@@ -280,9 +293,21 @@
<if test="null != wxCorpid"> <if test="null != wxCorpid">
#{wxCorpid} , #{wxCorpid} ,
</if> </if>
<if test="null != openCorpid"> <if test="null != openCorpid">
#{openCorpid} , #{openCorpid} ,
</if> </if>
<if test="null != wxaAppid">
#{wxaAppid} ,
</if>
<if test="null != urlHost">
#{urlHost} ,
</if>
<if test="null != wxSecurityType">
#{wxSecurityType} ,
</if>
<if test="null != callbackFlag">
#{callbackFlag} ,
</if>
</trim> </trim>
</insert> </insert>
...@@ -395,13 +420,22 @@ ...@@ -395,13 +420,22 @@
external_flag = #{externalFlag,jdbcType=INTEGER}, external_flag = #{externalFlag,jdbcType=INTEGER},
</if> </if>
<if test="useridFlag != null"> <if test="useridFlag != null">
userid_flag = #{useridFlag} userid_flag = #{useridFlag},
</if> </if>
<if test="null != wxCorpid"> <if test="null != wxCorpid">
wx_corpid = #{wxCorpid} wx_corpid = #{wxCorpid},
</if> </if>
<if test="null != openCorpid"> <if test="null != openCorpid">
open_corpid = #{openCorpid} open_corpid = #{openCorpid},
</if>
<if test="null != wxaAppid">
wxa_appid = #{wxaAppid},
</if>
<if test="null != urlHost">
url_host = #{urlHost},
</if>
<if test="null != callbackFlag">
callback_flag = #{callbackFlag}
</if> </if>
</set> </set>
where wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR} where wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
...@@ -415,6 +449,12 @@ ...@@ -415,6 +449,12 @@
<if test="gicContactFlag != null"> <if test="gicContactFlag != null">
and contact_flag = #{gicContactFlag,jdbcType=INTEGER} and contact_flag = #{gicContactFlag,jdbcType=INTEGER}
</if> </if>
<if test=" appType != null and appType == 1">
and wx_security_type = 5
</if>
<if test=" appType != null and appType == 0">
and wx_security_type != 5
</if>
<if test="version != null and version == 2"> <if test="version != null and version == 2">
<if test="keyword != null and keyword != '' and enterpriseIds != null and enterpriseIds.size() > 0"> <if test="keyword != null and keyword != '' and enterpriseIds != null and enterpriseIds.size() > 0">
and (corp_name like CONCAT('%',#{keyword},'%') and (corp_name like CONCAT('%',#{keyword},'%')
...@@ -523,4 +563,44 @@ ...@@ -523,4 +563,44 @@
and a.enterprise_id = #{enterpriseId} and a.enterprise_id = #{enterpriseId}
</select> </select>
<select id="getWxAppidListByList" resultType="java.lang.String">
select
wxa_appid
from tab_haoban_wx_enterprise
where
status_flag = 1
and wx_security_type = 5
<if test="wxAppidList != null and wxAppidList.size() > 0">
and wxa_appid IN
<foreach collection="wxAppidList" item="id" index="index" open="(" close=")" separator=",">
#{id,jdbcType=VARCHAR}
</foreach>
</if>
</select>
<select id="listAllByWxSecurityType" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_wx_enterprise
where
status_flag = 1
and wx_security_type = #{wxSecurityType}
</select>
<update id="updateWxaAppid">
update tab_haoban_wx_enterprise
set wxa_appid = #{wxaAppid},
update_time = now()
where wx_enterprise_id = #{wxEnterpriseId}
</update>
<select id="listWxEnterpriseByCallbackFlag" resultType="java.lang.String" >
select
wx_enterprise_id
from tab_haoban_wx_enterprise
where
status_flag = 1
and callback_flag = #{callbackFlag}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -270,7 +270,8 @@ public class AuditController extends WebBaseController { ...@@ -270,7 +270,8 @@ public class AuditController extends WebBaseController {
//审核同意 //审核同意
if (audit.getAuditType() == AuditType.CLERK_BIND.getCode()) { if (audit.getAuditType() == AuditType.CLERK_BIND.getCode()) {
//导购绑定 //导购绑定
StaffClerkRelationDTO staffClerkRelation = staffClerkRelationApiService.getByCodeAndEnterpriseId(clerkCode, enterpriseId); //统一替换导购code
StaffClerkRelationDTO staffClerkRelation = staffClerkRelationApiService.getByCodeAndEnterpriseId(clerkId, enterpriseId);
StaffClerkRelationDTO have = staffClerkRelationApiService.getOneByStoreIdAndStaffId(storeId, auditStaffId); StaffClerkRelationDTO have = staffClerkRelationApiService.getOneByStoreIdAndStaffId(storeId, auditStaffId);
ClerkDTO clerkDTO = clerkService.getClerkByClerkId(clerkId); ClerkDTO clerkDTO = clerkService.getClerkByClerkId(clerkId);
if (have != null) { if (have != null) {
......
...@@ -229,7 +229,8 @@ public class WxStaffController extends WebBaseController { ...@@ -229,7 +229,8 @@ public class WxStaffController extends WebBaseController {
if (CollectionUtils.isEmpty(clerkDTOS)) { if (CollectionUtils.isEmpty(clerkDTOS)) {
return resultResponse(HaoBanErrCode.ERR_10016); return resultResponse(HaoBanErrCode.ERR_10016);
} }
Set<String> clerkCodeList = clerkDTOS.stream().map(ClerkDTO::getClerkCode).collect(Collectors.toSet()); //统一处理:导购code替换为导购id
Set<String> clerkCodeList = clerkDTOS.stream().map(ClerkDTO::getClerkId).collect(Collectors.toSet());
List<StaffClerkRelationDTO> bindRelationList = staffClerkRelationApiService.listBindCode(wxEnterpriseId, List<StaffClerkRelationDTO> bindRelationList = staffClerkRelationApiService.listBindCode(wxEnterpriseId,
enterpriseId, clerkCodeList); enterpriseId, clerkCodeList);
Map<String, StaffClerkRelationDTO> bindCodeMap = bindRelationList.stream() Map<String, StaffClerkRelationDTO> bindCodeMap = bindRelationList.stream()
...@@ -943,7 +944,8 @@ public class WxStaffController extends WebBaseController { ...@@ -943,7 +944,8 @@ public class WxStaffController extends WebBaseController {
String clerkCode = clerk.getClerkCode(); String clerkCode = clerk.getClerkCode();
String enterpriseId = clerk.getEnterpriseId(); String enterpriseId = clerk.getEnterpriseId();
String wxUserId = staff.getWxUserId(); String wxUserId = staff.getWxUserId();
StaffClerkRelationDTO staffClerkRelation = staffClerkRelationApiService.getByCodeAndEnterpriseId(clerkCode, //统一替换导购code
StaffClerkRelationDTO staffClerkRelation = staffClerkRelationApiService.getByCodeAndEnterpriseId(clerkId,
enterpriseId); enterpriseId);
if (auditType == 2) { if (auditType == 2) {
...@@ -992,7 +994,8 @@ public class WxStaffController extends WebBaseController { ...@@ -992,7 +994,8 @@ public class WxStaffController extends WebBaseController {
audit.setCommitTime(new Date()); audit.setCommitTime(new Date());
audit.setAuditType(2); audit.setAuditType(2);
auditApiService.insert(audit); auditApiService.insert(audit);
StaffClerkRelationDTO resultDTO = staffClerkRelationApiService.getByCodeAndEnterpriseId(clerkCode, //统一替换导购code
StaffClerkRelationDTO resultDTO = staffClerkRelationApiService.getByCodeAndEnterpriseId(clerkId,
clerk.getEnterpriseId()); clerk.getEnterpriseId());
return resultResponse(HaoBanErrCode.ERR_1, resultDTO); return resultResponse(HaoBanErrCode.ERR_1, resultDTO);
} else { } else {
...@@ -1058,7 +1061,8 @@ public class WxStaffController extends WebBaseController { ...@@ -1058,7 +1061,8 @@ public class WxStaffController extends WebBaseController {
if (staff == null) { if (staff == null) {
return resultResponse(HaoBanErrCode.ERR_10006); return resultResponse(HaoBanErrCode.ERR_10006);
} }
StaffClerkRelationDTO staffClerkRelation = staffClerkRelationApiService.getByCodeAndEnterpriseId(clerkCode, //统一替换导购code
StaffClerkRelationDTO staffClerkRelation = staffClerkRelationApiService.getByCodeAndEnterpriseId(clerkId,
enterpriseId); enterpriseId);
if (staffClerkRelation == null) { if (staffClerkRelation == null) {
return resultResponse(HaoBanErrCode.ERR_111145); return resultResponse(HaoBanErrCode.ERR_111145);
...@@ -1082,7 +1086,8 @@ public class WxStaffController extends WebBaseController { ...@@ -1082,7 +1086,8 @@ public class WxStaffController extends WebBaseController {
if (CollectionUtils.isEmpty(list)) { if (CollectionUtils.isEmpty(list)) {
return resultResponse(HaoBanErrCode.ERR_10016); return resultResponse(HaoBanErrCode.ERR_10016);
} }
Set<String> clerkCodeList = list.stream().map(ClerkDTO::getClerkCode).collect(Collectors.toSet()); //统一处理:导购code替换为导购id
Set<String> clerkCodeList = list.stream().map(ClerkDTO::getClerkId).collect(Collectors.toSet());
List<StaffClerkRelationDTO> bindRelationList = staffClerkRelationApiService.listBindCode(wxEnterpriseId, List<StaffClerkRelationDTO> bindRelationList = staffClerkRelationApiService.listBindCode(wxEnterpriseId,
enterpriseId, clerkCodeList); enterpriseId, clerkCodeList);
Map<String, StaffClerkRelationDTO> bindCodeMap = bindRelationList.stream() Map<String, StaffClerkRelationDTO> bindCodeMap = bindRelationList.stream()
...@@ -1130,7 +1135,8 @@ public class WxStaffController extends WebBaseController { ...@@ -1130,7 +1135,8 @@ public class WxStaffController extends WebBaseController {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_10016.getCode()), return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_10016.getCode()),
HaoBanErrCode.ERR_10016.getMsg()); HaoBanErrCode.ERR_10016.getMsg());
} }
Set<String> clerkCodeList = list.stream().map(ClerkDTO::getClerkCode).collect(Collectors.toSet()); //统一处理:导购code替换为导购id
Set<String> clerkCodeList = list.stream().map(ClerkDTO::getClerkId).collect(Collectors.toSet());
List<StaffClerkRelationDTO> bindRelationList = staffClerkRelationApiService.listBindCode(wxEnterpriseId, List<StaffClerkRelationDTO> bindRelationList = staffClerkRelationApiService.listBindCode(wxEnterpriseId,
enterpriseId, clerkCodeList); enterpriseId, clerkCodeList);
Map<String, StaffClerkRelationDTO> bindCodeMap = bindRelationList.stream() Map<String, StaffClerkRelationDTO> bindCodeMap = bindRelationList.stream()
......
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