Commit 168e7272 by huangZW

Merge branch 'developer' of http://115.159.76.241/haoban3.0/haoban-manage3.0.git into developer

parents 5027d886 a0f6dd8b
...@@ -115,6 +115,13 @@ ...@@ -115,6 +115,13 @@
<version>3.0-SNAPSHOT</version> <version>3.0-SNAPSHOT</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-thirdparty-api</artifactId>
<version>${gic-thirdparty-api}</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -479,7 +479,7 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ ...@@ -479,7 +479,7 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ
TabHaobanPreDealLog dealLog = new TabHaobanPreDealLog(); TabHaobanPreDealLog dealLog = new TabHaobanPreDealLog();
dealLog.setDataId(dto.getId().toString()); dealLog.setDataId(dto.getId().toString());
dealLog.setpDataId(dto.getParentid().toString()); dealLog.setpDataId(dto.getParentid().toString());
dealLog.setDataType(1); dealLog.setDataType(0);
dealLog.setStatusFlag(0); dealLog.setStatusFlag(0);
dealLog.setTaskId(taskId); dealLog.setTaskId(taskId);
dealLog.setDataContent(JSONObject.toJSONString(dto)); dealLog.setDataContent(JSONObject.toJSONString(dto));
......
...@@ -485,27 +485,6 @@ public class DepartmentApiServiceImpl implements DepartmentApiService { ...@@ -485,27 +485,6 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
@Override @Override
public void initwxDepartment(String corpid, String contactSecret, String wxEnterpriseId) { public void initwxDepartment(String corpid, String contactSecret, String wxEnterpriseId) {
// List<com.gic.wechat.api.dto.qywx.DepartmentDTO> list = this.qywxDepartmentApiService.listDepartment(corpid, suiteid, null);
logger.info("【同步企业微信】wxEnterpriseId={}",wxEnterpriseId);
//
// com.gic.wechat.api.dto.qywx.DepartmentDTO rootDepartment = null;
// for (com.gic.wechat.api.dto.qywx.DepartmentDTO departmentDTO : list) {
// if("0".equals(departmentDTO.getParentid())){
// rootDepartment = departmentDTO;
// break;
// }
// }
//
// String parentId = addDepartment(rootDepartment, wxEnterpriseId, null,corpid,suiteid);
// List<com.gic.wechat.api.dto.qywx.DepartmentDTO> subList = new ArrayList<>();
// for (com.gic.wechat.api.dto.qywx.DepartmentDTO departmentDTO : list) {
// if(rootDepartment.getId().equals(departmentDTO.getParentid())){
// subList.add(departmentDTO);
// }
// }
//
// DepartmentDTO parent = EntityUtil.changeEntityByJSON(DepartmentDTO.class,departmentService.selectById(parentId));
// this.addSon(subList, wxEnterpriseId, parent,corpid,suiteid);
logger.info("【同步企业微信】wxEnterpriseId={}","init-enterprise-" + wxEnterpriseId); logger.info("【同步企业微信】wxEnterpriseId={}","init-enterprise-" + wxEnterpriseId);
String key = "init-enterprise-" + wxEnterpriseId; String key = "init-enterprise-" + wxEnterpriseId;
if(RedisUtil.getCache(key) == null){ if(RedisUtil.getCache(key) == null){
...@@ -519,9 +498,14 @@ public class DepartmentApiServiceImpl implements DepartmentApiService { ...@@ -519,9 +498,14 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
}else{ }else{
RedisUtil.delCache(key); RedisUtil.delCache(key);
} }
//RedisUtil.lock("init_enterprise_" + wxEnterpriseId,60 * 60L);
//insertMQ(0,wxEnterpriseId, corpid,contactSecret,taskId); // String taskId = StringUtil.randomUUID();
//RedisUtil.unlock("init_enterprise_" + wxEnterpriseId); // List<com.gic.wechat.api.dto.qywx.DepartmentDTO> list = this.qywxDepartmentApiService.listSelfDepartment(corpid, contactSecret, null);
// logger.info("企业所有部门数据:{}", JSON.toJSONString(list));
// if(CollectionUtils.isNotEmpty(list)){
// this.addAllDepartment(list, 0, wxEnterpriseId, corpid, contactSecret,taskId);
// }
} }
...@@ -628,7 +612,7 @@ public class DepartmentApiServiceImpl implements DepartmentApiService { ...@@ -628,7 +612,7 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
@Override @Override
public boolean isInitLocked(String wxEnterpriseId){ public boolean isInitLocked(String wxEnterpriseId){
return RedisUtil.isLocked("init_enterprise_" + wxEnterpriseId); return RedisUtil.isLocked("init-enterprise-" + wxEnterpriseId);
} }
...@@ -765,8 +749,6 @@ public class DepartmentApiServiceImpl implements DepartmentApiService { ...@@ -765,8 +749,6 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
if(enterpriseDTO != null){ if(enterpriseDTO != null){
if(StringUtils.isNotBlank(enterpriseDTO.getContactSecret()) && enterpriseDTO.getContactFlag() != null){ if(StringUtils.isNotBlank(enterpriseDTO.getContactSecret()) && enterpriseDTO.getContactFlag() != null){
this.initwxDepartment(enterpriseDTO.getCorpid(), enterpriseDTO.getContactSecret(), enterpriseDTO.getWxEnterpriseId()); this.initwxDepartment(enterpriseDTO.getCorpid(), enterpriseDTO.getContactSecret(), enterpriseDTO.getWxEnterpriseId());
enterpriseDTO.setContactFlag(1);
this.wxEnterpriseService.update(enterpriseDTO);
} }
} }
......
package com.gic.haoban.manage.service.service.out.impl; package com.gic.haoban.manage.service.service.out.impl;
import java.io.InputStream;
import java.net.URL;
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.HashSet; import java.util.HashSet;
...@@ -11,15 +12,16 @@ import java.util.Set; ...@@ -11,15 +12,16 @@ import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.gic.commons.util.ToolUtil; import com.gic.commons.util.GlobalInfo;
import com.gic.haoban.base.api.common.Constant; import com.gic.commons.util.GlobalVar;
import com.gic.haoban.manage.api.dto.*; import com.gic.haoban.manage.api.dto.*;
import com.gic.haoban.manage.api.service.DepartmentApiService; import com.gic.haoban.manage.api.service.DepartmentApiService;
import com.gic.haoban.manage.service.util.EmojiFilterUtil; import com.gic.thirdparty.api.dto.PicUploadResDTO;
import com.gic.thirdparty.api.service.QQCloudPicService;
import com.vdurmont.emoji.EmojiParser; import com.vdurmont.emoji.EmojiParser;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.hibernate.hql.internal.CollectionSubqueryFactory;
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;
...@@ -98,6 +100,9 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -98,6 +100,9 @@ public class StaffApiServiceImpl implements StaffApiService {
private WxEnterpriseRelatedApiService wxEnterpriseRelatedApiService; private WxEnterpriseRelatedApiService wxEnterpriseRelatedApiService;
@Autowired @Autowired
private SyncErrorLogService syncErrorLogService; private SyncErrorLogService syncErrorLogService;
@Autowired
private QQCloudPicService qqCloudPicService;
@Override @Override
public StaffDTO selectById(String staffId) { public StaffDTO selectById(String staffId) {
...@@ -936,7 +941,8 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -936,7 +941,8 @@ public class StaffApiServiceImpl implements StaffApiService {
} }
//修改 //修改
} else { } else {
staff.setHeadImg(clerkDTO.getHeadImgUrl()); String url = changeHeaderImageUrl(clerkDTO.getHeadImgUrl());
staff.setHeadImg(url);
staff.setSex(clerkDTO.getClerkGender()); staff.setSex(clerkDTO.getClerkGender());
//staff.setPostion(postion); //staff.setPostion(postion);
// staff.setStaffName(staffName); // staff.setStaffName(staffName);
...@@ -978,6 +984,19 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -978,6 +984,19 @@ public class StaffApiServiceImpl implements StaffApiService {
return response; return response;
} }
private String changeHeaderImageUrl(String headImgUrl) {
try {
InputStream in = new URL(headImgUrl).openStream();
byte[] data = IOUtils.toByteArray(in);
PicUploadResDTO uploadPic = qqCloudPicService.uploadPic(GlobalVar.ctxPropertiesMap.get(GlobalInfo.QQPIC_KEY_ENTERPRISE), data);
logger.info("腾讯云万象优图返回" + JSON.toJSONString(uploadPic));
return uploadPic.downloadUrl;
}catch (Exception e){
logger.info("上传腾讯云万象优图返回失败了:", e);
return headImgUrl;
}
}
/** /**
* 删除企业微信 * 删除企业微信
* *
......
...@@ -98,7 +98,7 @@ public class QywxGroupSyncOperation implements BaseSyncOperation { ...@@ -98,7 +98,7 @@ public class QywxGroupSyncOperation implements BaseSyncOperation {
TabHaobanDepartment department = departmentService.getByWxId(dealParamMqDTO.getData(), dataPre.getWxEnterpriseId()); TabHaobanDepartment department = departmentService.getByWxId(dealParamMqDTO.getData(), dataPre.getWxEnterpriseId());
if (department != null) { if (department != null) {
logger.info("已经同步过了:{}", dataPre.getDataId()); logger.info("已经同步过了:{}", dataPre.getDataId());
dealException(dealParamMqDTO.getTaskId(), dealParamMqDTO.getData(), dataPre.getEnterpriseId(), dealParamMqDTO.getData() + ":该部门存在"); dealException(dealParamMqDTO.getTaskId(), dealParamMqDTO.getData(), dataPre.getEnterpriseId(), dealParamMqDTO.getData() + ":该部门存在");
return; return;
} }
......
...@@ -56,6 +56,8 @@ ...@@ -56,6 +56,8 @@
<dubbo:reference interface="com.gic.member.api.service.MemberOpenCardBusinessService" id="memberOpenCardBusinessService"/> <dubbo:reference interface="com.gic.member.api.service.MemberOpenCardBusinessService" id="memberOpenCardBusinessService"/>
<dubbo:reference id="eSDataDynamicOperationApiService" interface="com.gic.search.engine.api.service.dynamic.ESDataDynamicOperationApiService" timeout="10000"/> <dubbo:reference id="eSDataDynamicOperationApiService" interface="com.gic.search.engine.api.service.dynamic.ESDataDynamicOperationApiService" timeout="10000"/>
<dubbo:reference id="qqCloudPicService" interface="com.gic.thirdparty.api.service.QQCloudPicService" timeout="10000" retries="0" check="false" />
</beans> </beans>
\ No newline at end of file
...@@ -109,7 +109,9 @@ public class ApplicationController extends WebBaseController{ ...@@ -109,7 +109,9 @@ public class ApplicationController extends WebBaseController{
WxEnterpriseDTO enterpriseDTO = this.wxEnterpriseApiService.getOne(wxEnterpriseId); WxEnterpriseDTO enterpriseDTO = this.wxEnterpriseApiService.getOne(wxEnterpriseId);
if(enterpriseDTO != null){ if(enterpriseDTO != null){
if(StringUtils.isNotBlank(enterpriseDTO.getContactSecret()) && enterpriseDTO.getContactFlag() != null && enterpriseDTO.getContactFlag() == 0){ if(StringUtils.isNotBlank(enterpriseDTO.getContactSecret()) && enterpriseDTO.getContactFlag() != null && enterpriseDTO.getContactFlag() == 0){
// this.departmentApiService.initwxDepartmentMQ(enterpriseDTO.getWxEnterpriseId());
// enterpriseDTO.setContactFlag(1);
// wxEnterpriseApiService.update(enterpriseDTO);
log.info("【初始化部门调用】{},{},{}",RouterConstant.INIT_WX_DEPARTMENT_SERVICENAME,RouterConstant.INIT_WX_DEPARTMENT_METHODNAME,wxEnterpriseId); log.info("【初始化部门调用】{},{},{}",RouterConstant.INIT_WX_DEPARTMENT_SERVICENAME,RouterConstant.INIT_WX_DEPARTMENT_METHODNAME,wxEnterpriseId);
try { try {
GICMQClientUtil.getClientInstance().sendCommonMessage(RouterConstant.ROUTERTYPE, wxEnterpriseId, GICMQClientUtil.getClientInstance().sendCommonMessage(RouterConstant.ROUTERTYPE, wxEnterpriseId,
...@@ -130,7 +132,7 @@ public class ApplicationController extends WebBaseController{ ...@@ -130,7 +132,7 @@ public class ApplicationController extends WebBaseController{
WxEnterpriseDTO enterpriseDTO = this.wxEnterpriseApiService.getOne(wxEnterpriseId); WxEnterpriseDTO enterpriseDTO = this.wxEnterpriseApiService.getOne(wxEnterpriseId);
if(enterpriseDTO != null){ if(enterpriseDTO != null){
if(StringUtils.isNotBlank(enterpriseDTO.getContactSecret()) && enterpriseDTO.getContactFlag() != null){ if(StringUtils.isNotBlank(enterpriseDTO.getContactSecret()) && enterpriseDTO.getContactFlag() != null){
//
log.info("【初始化部门调用】{},{},{}",RouterConstant.INIT_WX_DEPARTMENT_SERVICENAME,RouterConstant.INIT_WX_DEPARTMENT_METHODNAME,wxEnterpriseId); log.info("【初始化部门调用】{},{},{}",RouterConstant.INIT_WX_DEPARTMENT_SERVICENAME,RouterConstant.INIT_WX_DEPARTMENT_METHODNAME,wxEnterpriseId);
try { try {
GICMQClientUtil.getClientInstance().sendCommonMessage(RouterConstant.ROUTERTYPE, wxEnterpriseId, GICMQClientUtil.getClientInstance().sendCommonMessage(RouterConstant.ROUTERTYPE, wxEnterpriseId,
...@@ -138,9 +140,7 @@ public class ApplicationController extends WebBaseController{ ...@@ -138,9 +140,7 @@ public class ApplicationController extends WebBaseController{
} catch (Exception e) { } catch (Exception e) {
log.info(e.getMessage(),e); log.info(e.getMessage(),e);
} }
//this.departmentApiService.initwxDepartmentMQ(enterpriseDTO.getCorpid(), enterpriseDTO.getContactSecret(), enterpriseDTO.getWxEnterpriseId()); // this.departmentApiService.initwxDepartment(enterpriseDTO.getCorpid(), enterpriseDTO.getContactSecret(), enterpriseDTO.getWxEnterpriseId());
// enterpriseDTO.setContactFlag(1);
// wxEnterpriseApiService.update(enterpriseDTO);
} }
} }
......
...@@ -16,12 +16,15 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -16,12 +16,15 @@ import org.springframework.web.bind.annotation.RestController;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.csp.sentinel.util.StringUtil; import com.alibaba.csp.sentinel.util.StringUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
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.DateUtil; import com.gic.commons.util.DateUtil;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
import com.gic.enterprise.api.dto.EnterpriseDTO;
import com.gic.enterprise.api.dto.StoreDTO; import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.enterprise.api.service.EnterpriseService;
import com.gic.enterprise.api.service.StoreService; import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.app.customer.service.api.service.DistributeApiService; import com.gic.haoban.app.customer.service.api.service.DistributeApiService;
import com.gic.haoban.base.api.common.ServiceResponse; import com.gic.haoban.base.api.common.ServiceResponse;
...@@ -30,17 +33,20 @@ import com.gic.haoban.communicate.api.service.SyncHaobanToGicServiceApi; ...@@ -30,17 +33,20 @@ import com.gic.haoban.communicate.api.service.SyncHaobanToGicServiceApi;
import com.gic.haoban.manage.api.dto.DepartmentDTO; import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.api.dto.StaffDTO; import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO; import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.service.BindApiService; import com.gic.haoban.manage.api.service.BindApiService;
import com.gic.haoban.manage.api.service.ClerkMainStoreRelatedApiService; import com.gic.haoban.manage.api.service.ClerkMainStoreRelatedApiService;
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;
import com.gic.haoban.manage.api.service.WxEnterpriseApiService;
import com.gic.haoban.manage.web.anno.HttpLimit; import com.gic.haoban.manage.web.anno.HttpLimit;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode; import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.interceptor.WebInterceptor; import com.gic.haoban.manage.web.interceptor.WebInterceptor;
import com.gic.haoban.manage.web.vo.ClerkVo; import com.gic.haoban.manage.web.vo.ClerkVo;
import com.gic.haoban.manage.web.vo.StoreVO; import com.gic.haoban.manage.web.vo.StoreVO;
import com.gic.redis.data.util.RedisUtil; import com.gic.redis.data.util.RedisUtil;
import com.gic.wechat.api.service.qywx.QywxUserApiService;
@RestController @RestController
public class ClerkController extends WebBaseController{ public class ClerkController extends WebBaseController{
...@@ -64,6 +70,10 @@ public class ClerkController extends WebBaseController{ ...@@ -64,6 +70,10 @@ public class ClerkController extends WebBaseController{
private ClerkMainStoreRelatedApiService clerkMainStoreRelatedApiService; private ClerkMainStoreRelatedApiService clerkMainStoreRelatedApiService;
@Autowired @Autowired
private DistributeApiService distributeApiService; private DistributeApiService distributeApiService;
@Autowired
private QywxUserApiService qywxUserApiService;
@Autowired
private WxEnterpriseApiService wxEnterpriseApiService;
//导购列表 //导购列表
@RequestMapping("/clerk-list") @RequestMapping("/clerk-list")
...@@ -331,13 +341,18 @@ public class ClerkController extends WebBaseController{ ...@@ -331,13 +341,18 @@ public class ClerkController extends WebBaseController{
if(staff == null){ if(staff == null){
return resultResponse(HaoBanErrCode.ERR_10006); return resultResponse(HaoBanErrCode.ERR_10006);
} }
String key = "haoban_set_main_store_" + yyyyMM + staffId; String key = "haoban_fresh_wx_friend" + yyyyMM + staffId;
Object hasSet = RedisUtil.getCache(key); Integer count = RedisUtil.getCache(key) == null ? 0 : (Integer)RedisUtil.getCache(key);
if(hasSet == null){ if(count == null || count < 4){
RedisUtil.setCache(key,true,31 * 24 * 60 * 60l); WxEnterpriseDTO enterprise = wxEnterpriseApiService.getOne(wxEnterpriseId);
clerkMainStoreRelatedApiService.setMainStore(staffId,storeId,wxEnterpriseId); RedisUtil.setCache(key,count + 1,31 * 24 * 60 * 60l);
String res = qywxUserApiService.listSelfExternalUserid(enterprise.getCorpid(), enterprise.getWxSecretKey(), staff.getWxUserId());
JSONObject json = JSON.parseObject(res);
if("0".equals(json.getString("errcode"))){
}
}else{ }else{
return resultResponse(HaoBanErrCode.ERR_10007); return resultResponse(HaoBanErrCode.ERR_10011);
} }
return resultResponse(HaoBanErrCode.ERR_1); return resultResponse(HaoBanErrCode.ERR_1);
} }
......
...@@ -193,6 +193,7 @@ public enum HaoBanErrCode { ...@@ -193,6 +193,7 @@ public enum HaoBanErrCode {
ERR_10009(10009,"门店不存在"), ERR_10009(10009,"门店不存在"),
ERR_10010(10010,"gic新增失败"), ERR_10010(10010,"gic新增失败"),
ERR_10011(10011,"每月最多可刷新4次"),
ERR_999(999, "操作失败"), ERR_999(999, "操作失败"),
ERR_DEFINE(-888, "自定义错误"), ERR_DEFINE(-888, "自定义错误"),
......
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