Commit 690bf483 by qwmqiuwenmin

Merge branch 'developer_repair_contact20200408' into 'master'

Developer repair contact20200408

See merge request !39
parents 0188aa4a 72814d98
package com.gic.haoban.manage.api.dto;
import java.io.Serializable;
import java.util.Date;
public class MemberStoreDTO implements Serializable {
private String memberId;
private String storeId;
private static final long serialVersionUID = 1L;
public String getMemberId() {
return memberId;
}
public void setMemberId(String memberId) {
this.memberId = memberId;
}
public String getStoreId() {
return storeId;
}
public void setStoreId(String storeId) {
this.storeId = storeId;
}
}
...@@ -16,6 +16,8 @@ public class MemberUnionidRelatedDTO implements Serializable{ ...@@ -16,6 +16,8 @@ public class MemberUnionidRelatedDTO implements Serializable{
private String unionid; private String unionid;
private String wxEnterpriseId; private String wxEnterpriseId;
private String enterpriseId;
private Integer statusFlag; private Integer statusFlag;
...@@ -147,5 +149,13 @@ public class MemberUnionidRelatedDTO implements Serializable{ ...@@ -147,5 +149,13 @@ public class MemberUnionidRelatedDTO implements Serializable{
this.addCreateTime = addCreateTime; this.addCreateTime = addCreateTime;
} }
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
} }
...@@ -60,6 +60,8 @@ public class WxEnterpriseDTO implements Serializable { ...@@ -60,6 +60,8 @@ public class WxEnterpriseDTO implements Serializable {
private String wxSecretKey; private String wxSecretKey;
private String memberSecret; private String memberSecret;
private String contactSecret;
private Date createTime; private Date createTime;
...@@ -317,6 +319,15 @@ public class WxEnterpriseDTO implements Serializable { ...@@ -317,6 +319,15 @@ public class WxEnterpriseDTO implements Serializable {
this.wxSecretKey = wxSecretKey; this.wxSecretKey = wxSecretKey;
} }
public String getContactSecret() {
return contactSecret;
}
public void setContactSecret(String contactSecret) {
this.contactSecret = contactSecret;
}
} }
...@@ -120,7 +120,7 @@ public interface DepartmentApiService { ...@@ -120,7 +120,7 @@ public interface DepartmentApiService {
List<DepartmentDTO> listByChainId(String chainId,String wxEnterpriseId); List<DepartmentDTO> listByChainId(String chainId,String wxEnterpriseId);
void initwxDepartment(String corpid, String suiteid, String wxEnterpriseId); void initwxDepartment(String corpid, String contactSecret, String wxEnterpriseId);
/** /**
* 回收站的数量 * 回收站的数量
* @param wxEnterpriseId * @param wxEnterpriseId
......
...@@ -2,6 +2,7 @@ package com.gic.haoban.manage.api.service; ...@@ -2,6 +2,7 @@ package com.gic.haoban.manage.api.service;
import java.util.List; import java.util.List;
import com.gic.haoban.manage.api.dto.MemberStoreDTO;
import com.gic.haoban.manage.api.dto.MemberUnionidRelatedDTO; import com.gic.haoban.manage.api.dto.MemberUnionidRelatedDTO;
public interface MemberUnionidRelatedApiService { public interface MemberUnionidRelatedApiService {
...@@ -15,5 +16,7 @@ public interface MemberUnionidRelatedApiService { ...@@ -15,5 +16,7 @@ public interface MemberUnionidRelatedApiService {
MemberUnionidRelatedDTO getByMemberId(String staffId, String memberId); MemberUnionidRelatedDTO getByMemberId(String staffId, String memberId);
List<MemberUnionidRelatedDTO> getByWxUserIdAndWxEnterpriseId(String wxUserId, String wxEnterpriseId); List<MemberUnionidRelatedDTO> getByWxUserIdAndWxEnterpriseId(String wxUserId, String wxEnterpriseId);
List<MemberStoreDTO> listByExTernalUseridAndWxUserId(String externalUserid, String wxUserId);
} }
...@@ -47,7 +47,7 @@ public interface StaffApiService { ...@@ -47,7 +47,7 @@ public interface StaffApiService {
StaffDepartmentRelatedDTO getDepartmentIdAndCode(String departmentId, String code); StaffDepartmentRelatedDTO getDepartmentIdAndCode(String departmentId, String code);
void initWxUser(String corpid, String suiteid, String wxEnterpriseId, Integer wxDepartmentId); void initWxUser(String corpid, String contactSecret, String wxEnterpriseId, Integer wxDepartmentId);
public List<String> listUnBindClerk(String storeId); public List<String> listUnBindClerk(String storeId);
......
...@@ -105,6 +105,12 @@ ...@@ -105,6 +105,12 @@
<dependency> <dependency>
<groupId>com.gic</groupId> <groupId>com.gic</groupId>
<artifactId>gic-search-engine-api</artifactId>
<version>${gic-search-engine-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-member-api</artifactId> <artifactId>gic-member-api</artifactId>
<version>3.0-SNAPSHOT</version> <version>3.0-SNAPSHOT</version>
<scope>compile</scope> <scope>compile</scope>
......
...@@ -26,6 +26,8 @@ public interface MemberUnionidRelatedMapper { ...@@ -26,6 +26,8 @@ public interface MemberUnionidRelatedMapper {
List<MemberUnionidRelated> getByWxUserIdAndWxEnterpriseId(@Param("wxUserId")String wxUserId, @Param("wxEnterpriseId")String wxEnterpriseId); List<MemberUnionidRelated> getByWxUserIdAndWxEnterpriseId(@Param("wxUserId")String wxUserId, @Param("wxEnterpriseId")String wxEnterpriseId);
MemberUnionidRelated getByParams(@Param("wxUserId")String wxUserId, @Param("wxEnterpriseId")String wxEnterpriseId, MemberUnionidRelated getByParams(@Param("wxUserId")String wxUserId, @Param("enterpriseId")String enterpriseId,
@Param("externalName")String name, @Param("addCreateTime")String createTime); @Param("externalName")String name, @Param("addCreateTime")String createTime);
List<MemberUnionidRelated> listByExTernalUseridAndWxUserId(@Param("externalUserid")String externalUserid, @Param("wxUserId")String wxUserId);
} }
\ No newline at end of file
...@@ -43,5 +43,7 @@ public interface StaffDepartmentRelatedMapper { ...@@ -43,5 +43,7 @@ public interface StaffDepartmentRelatedMapper {
List<TabHaobanStaffDepartmentRelated> listByDepartmentIdByKeyword(@Param("departmentId")String departmentId, @Param("keyword")String keyword); List<TabHaobanStaffDepartmentRelated> listByDepartmentIdByKeyword(@Param("departmentId")String departmentId, @Param("keyword")String keyword);
int countByDepartmentIds(@Param("departmentIds")List<String> departmentIds); int countByDepartmentIds(@Param("departmentIds")List<String> departmentIds);
List<TabHaobanStaffDepartmentRelated> listByWxUserId(@Param("wxUserId")String wxUserId);
} }
\ No newline at end of file
...@@ -11,6 +11,8 @@ public class MemberUnionidRelated implements Serializable { ...@@ -11,6 +11,8 @@ public class MemberUnionidRelated implements Serializable {
private String unionid; private String unionid;
private String wxEnterpriseId; private String wxEnterpriseId;
private String enterpriseId;
private Integer statusFlag; private Integer statusFlag;
...@@ -126,6 +128,14 @@ public class MemberUnionidRelated implements Serializable { ...@@ -126,6 +128,14 @@ public class MemberUnionidRelated implements Serializable {
this.addCreateTime = addCreateTime; this.addCreateTime = addCreateTime;
} }
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
} }
\ No newline at end of file
...@@ -59,6 +59,8 @@ public class TabHaobanWxEnterprise implements Serializable { ...@@ -59,6 +59,8 @@ public class TabHaobanWxEnterprise implements Serializable {
private String wxSecretKey; private String wxSecretKey;
private String memberSecret; private String memberSecret;
private String contactSecret;
private Date createTime; private Date createTime;
...@@ -306,6 +308,15 @@ public class TabHaobanWxEnterprise implements Serializable { ...@@ -306,6 +308,15 @@ public class TabHaobanWxEnterprise implements Serializable {
this.wxSecretKey = wxSecretKey; this.wxSecretKey = wxSecretKey;
} }
public String getContactSecret() {
return contactSecret;
}
public void setContactSecret(String contactSecret) {
this.contactSecret = contactSecret;
}
} }
\ No newline at end of file
...@@ -14,7 +14,7 @@ public interface MemberUnionRelatedService { ...@@ -14,7 +14,7 @@ public interface MemberUnionRelatedService {
List<MemberUnionidRelatedDTO> getByWxUserIdAndWxEnterpriseId(String wxUserId, String wxEnterpriseId); List<MemberUnionidRelatedDTO> getByWxUserIdAndWxEnterpriseId(String wxUserId, String wxEnterpriseId);
MemberUnionidRelatedDTO getByParams(String wxUserId, String wxEnterpriseId, String name, String createTime); MemberUnionidRelatedDTO getByParams(String wxUserId, String enterpriseId, String name, String createTime);
void update(MemberUnionidRelatedDTO exsitDTO); void update(MemberUnionidRelatedDTO exsitDTO);
......
...@@ -25,4 +25,7 @@ public interface StaffDepartmentRelatedService { ...@@ -25,4 +25,7 @@ public interface StaffDepartmentRelatedService {
int countByDepartmentId(String departmentId); int countByDepartmentId(String departmentId);
List<TabHaobanStaffDepartmentRelated> listByDepartmentIdByKeyword(String departmentId, String keyword); List<TabHaobanStaffDepartmentRelated> listByDepartmentIdByKeyword(String departmentId, String keyword);
List<TabHaobanStaffDepartmentRelated> listByWxUserId(String wxUserId);
} }
...@@ -46,8 +46,8 @@ public class MemberUnionRelatedServiceImpl implements MemberUnionRelatedService ...@@ -46,8 +46,8 @@ public class MemberUnionRelatedServiceImpl implements MemberUnionRelatedService
} }
@Override @Override
public MemberUnionidRelatedDTO getByParams(String wxUserId, String wxEnterpriseId, String name, String createTime) { public MemberUnionidRelatedDTO getByParams(String wxUserId, String enterpriseId, String name, String createTime) {
return EntityUtil.changeEntityByJSON(MemberUnionidRelatedDTO.class,mapper.getByParams(wxUserId,wxEnterpriseId,name,createTime)); return EntityUtil.changeEntityByJSON(MemberUnionidRelatedDTO.class,mapper.getByParams(wxUserId,enterpriseId,name,createTime));
} }
@Override @Override
......
...@@ -20,7 +20,12 @@ public class StaffDepartmentRelatedServiceImpl implements StaffDepartmentRelated ...@@ -20,7 +20,12 @@ public class StaffDepartmentRelatedServiceImpl implements StaffDepartmentRelated
@Autowired @Autowired
private StaffDepartmentRelatedMapper mapper; private StaffDepartmentRelatedMapper mapper;
@Override
public List<TabHaobanStaffDepartmentRelated> listByWxUserId(String wxUserId){
List<TabHaobanStaffDepartmentRelated> list = mapper.listByWxUserId(wxUserId);
return list;
}
@Override @Override
public List<TabHaobanStaffDepartmentRelated> listByDepartmentId(String departmentId) { public List<TabHaobanStaffDepartmentRelated> listByDepartmentId(String departmentId) {
......
package com.gic.haoban.manage.service.service.out.impl; package com.gic.haoban.manage.service.service.out.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.gic.wechat.api.service.qywx.QywxUserApiService; import com.gic.wechat.api.service.qywx.QywxUserApiService;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
...@@ -20,17 +24,23 @@ import com.gic.clerk.api.service.ClerkService; ...@@ -20,17 +24,23 @@ import com.gic.clerk.api.service.ClerkService;
import com.gic.commons.util.MD5Utils; import com.gic.commons.util.MD5Utils;
import com.gic.commons.util.Md5Util; import com.gic.commons.util.Md5Util;
import com.gic.commons.util.StringUtil; import com.gic.commons.util.StringUtil;
import com.gic.haoban.contacts.manage.api.dto.SearchDataDTO;
import com.gic.haoban.manage.api.dto.DepartmentDTO; import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.api.dto.MemberStoreDTO;
import com.gic.haoban.manage.api.dto.MemberUnionidRelatedDTO; import com.gic.haoban.manage.api.dto.MemberUnionidRelatedDTO;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO; import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
import com.gic.haoban.manage.api.service.DepartmentApiService; import com.gic.haoban.manage.api.service.DepartmentApiService;
import com.gic.haoban.manage.api.service.MemberUnionidRelatedApiService; import com.gic.haoban.manage.api.service.MemberUnionidRelatedApiService;
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.api.service.WxEnterpriseApiService;
import com.gic.haoban.manage.service.dao.mapper.MemberUnionidRelatedMapper;
import com.gic.haoban.manage.service.entity.MemberUnionidRelated;
import com.gic.haoban.manage.service.entity.TabHaobanStaff; import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise; import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterpriseRelated; import com.gic.haoban.manage.service.entity.TabHaobanWxEnterpriseRelated;
import com.gic.haoban.manage.service.service.MemberUnionRelatedService; import com.gic.haoban.manage.service.service.MemberUnionRelatedService;
import com.gic.haoban.manage.service.service.StaffDepartmentRelatedService;
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.WxEnterpriseService;
...@@ -40,6 +50,13 @@ import com.gic.member.api.service.MemberOpenCardBusinessService; ...@@ -40,6 +50,13 @@ import com.gic.member.api.service.MemberOpenCardBusinessService;
import com.gic.member.api.service.MemberService; import com.gic.member.api.service.MemberService;
import com.gic.redis.data.anno.RedisLock; import com.gic.redis.data.anno.RedisLock;
import com.gic.redis.data.util.RedisUtil; import com.gic.redis.data.util.RedisUtil;
import com.gic.search.engine.api.constant.MemberDataEnum;
import com.gic.search.engine.api.constant.OperateEnum;
import com.gic.search.engine.api.dto.ESResponseQueryBatch;
import com.gic.search.engine.api.dto.ESResponseQuerySingle;
import com.gic.search.engine.api.dto.dynamic.DynamicSearchDTO;
import com.gic.search.engine.api.filter.NewNodeAddUtil;
import com.gic.search.engine.api.service.dynamic.ESDataDynamicOperationApiService;
@Service @Service
public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedApiService{ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedApiService{
...@@ -71,7 +88,91 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -71,7 +88,91 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
@Autowired @Autowired
private DepartmentApiService departmentApiService; private DepartmentApiService departmentApiService;
@Autowired
private MemberUnionidRelatedMapper memberUnionidRelatedMapper;
@Autowired
private StaffDepartmentRelatedService staffDepartmentRelatedService;
@Autowired
private ESDataDynamicOperationApiService eSDataDynamicOperationApiService;
@Override
public List<MemberStoreDTO> listByExTernalUseridAndWxUserId(String externalUserid, String wxUserId) {
List<MemberUnionidRelated> list = memberUnionidRelatedMapper.listByExTernalUseridAndWxUserId(externalUserid, wxUserId);
List<MemberStoreDTO> result = new ArrayList<>();
if(CollectionUtil.isEmpty(list)){
return null;
}
//1、查该staff的门店id
List<TabHaobanStaffDepartmentRelated> relatedIds = staffDepartmentRelatedService.listByWxUserId(wxUserId);
if(CollectionUtil.isEmpty(relatedIds)){
log.info("staff关联部门不存在1");
return null;
}
List<String> departmentIds = relatedIds.stream().map(s->s.getDepartmentId()).collect(Collectors.toList());
if(CollectionUtil.isEmpty(departmentIds)){
log.info("staff部门不存在1");
return null;
}
List<DepartmentDTO> stores = departmentApiService.listByDepartmentIds(departmentIds, 1);
if(CollectionUtil.isEmpty(stores)){
log.info("staff关联门店不存在1");
return null;
}
List<String> storeIds = stores.stream().map(s->s.getRelatedId()).collect(Collectors.toList());
//2、获取member的storeId
for(MemberUnionidRelated tab : list){
String memberId = tab.getMemberId();
if(StringUtils.isEmpty(memberId)){
continue ;
}
String gicEnterpriseId = tab.getEnterpriseId();
JSONObject searchJson = new JSONObject();
searchJson = NewNodeAddUtil.addNewNodeForAnd(MemberDataEnum.member_memberId.getCode(), OperateEnum.OPERATE_EQ.getValue(), memberId,searchJson);
DynamicSearchDTO dynamicSearchDTO = new DynamicSearchDTO();
dynamicSearchDTO.setEnterpriseId(gicEnterpriseId);
dynamicSearchDTO.setColumnCategoryCode("member");
dynamicSearchDTO.setSearchJson(searchJson);
dynamicSearchDTO.setBegin(0);
dynamicSearchDTO.setRecordNumber(1);
log.info("gicEnterpriseId=========>{},searchJson=========={}",gicEnterpriseId,searchJson);
ESResponseQueryBatch responseQuery = eSDataDynamicOperationApiService.queryDataBatch(dynamicSearchDTO, false, null);
if(null == responseQuery){
log.info("会员不存在1");
continue;
}
List<JSONObject> res = responseQuery.getRes();
if(CollectionUtil.isEmpty(res)){
log.info("会员不存在2");
continue;
}
String storeId = "";
for (JSONObject jsonObject : res) {
storeId = jsonObject.get("storeId") == null?"":jsonObject.get("storeId").toString();
}
if(StringUtils.isEmpty(storeId)){
log.info("会员门店不存在");
continue;
}
String[] memberStoreIds =storeId.split(" ");
List<String> memberStoreIdList = Arrays.asList(memberStoreIds);
//取交集
memberStoreIdList.retainAll(storeIds);
if(CollectionUtil.isEmpty(memberStoreIdList)){
continue;
}else{
for(String resultStoreId : memberStoreIdList){
MemberStoreDTO dto = new MemberStoreDTO();
dto.setMemberId(memberId);
dto.setStoreId(resultStoreId);
result.add(dto);
}
}
}
return result;
}
@Override @Override
public MemberUnionidRelatedDTO getByUnionId(String staffId, String unionid) { public MemberUnionidRelatedDTO getByUnionId(String staffId, String unionid) {
TabHaobanStaff staff = staffService.selectById(staffId); TabHaobanStaff staff = staffService.selectById(staffId);
...@@ -137,7 +238,8 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -137,7 +238,8 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
for (TabHaobanWxEnterpriseRelated tabHaobanWxEnterpriseRelated : list) { for (TabHaobanWxEnterpriseRelated tabHaobanWxEnterpriseRelated : list) {
String key = "external" + tabHaobanWxEnterpriseRelated.getEnterpriseId() + "_"+ userId1 + "_" + name + "_" + createTime; String key = "external" + tabHaobanWxEnterpriseRelated.getEnterpriseId() + "_"+ userId1 + "_" + name + "_" + createTime;
RedisUtil.lock(key,2l); RedisUtil.lock(key,2l);
dto.setWxEnterpriseId(tabHaobanWxEnterpriseRelated.getEnterpriseId()); dto.setWxEnterpriseId(tabHaobanWxEnterpriseRelated.getWxEnterpriseId());
dto.setEnterpriseId(tabHaobanWxEnterpriseRelated.getEnterpriseId());
MemberDTO member = null; MemberDTO member = null;
TabHaobanStaff staff = staffService.selectByUserIdAndEnterpriseId(userId1, tabHaobanWxEnterpriseRelated.getWxEnterpriseId()); TabHaobanStaff staff = staffService.selectByUserIdAndEnterpriseId(userId1, tabHaobanWxEnterpriseRelated.getWxEnterpriseId());
if(staff == null){ if(staff == null){
......
...@@ -22,6 +22,7 @@ import com.gic.haoban.manage.service.config.Config; ...@@ -22,6 +22,7 @@ import com.gic.haoban.manage.service.config.Config;
import com.gic.haoban.manage.service.entity.*; import com.gic.haoban.manage.service.entity.*;
import com.gic.haoban.manage.service.service.*; import com.gic.haoban.manage.service.service.*;
import com.gic.mq.sdk.GicMQClient; import com.gic.mq.sdk.GicMQClient;
import com.gic.wechat.api.service.qywx.QywxDepartmentApiService;
import java.util.List; import java.util.List;
...@@ -57,6 +58,10 @@ public class MessageApiServiceImpl implements MessageApiService { ...@@ -57,6 +58,10 @@ public class MessageApiServiceImpl implements MessageApiService {
private WxApplicationService wxApplicationService; private WxApplicationService wxApplicationService;
@Autowired @Autowired
private Config config; private Config config;
@Autowired
private QywxDepartmentApiService qywxDepartmentApiService;
private final String CONTACT_APP = "contactSuiteId";
@Override @Override
public void gicMessageReceive(GicMessageDTO gicMessageDTO) { public void gicMessageReceive(GicMessageDTO gicMessageDTO) {
...@@ -73,7 +78,7 @@ public class MessageApiServiceImpl implements MessageApiService { ...@@ -73,7 +78,7 @@ public class MessageApiServiceImpl implements MessageApiService {
public void wxMessageReceive(QywxCallBackDTO qywxCallBackDTO) { public void wxMessageReceive(QywxCallBackDTO qywxCallBackDTO) {
GicMQClient clientInstance = GICMQClientUtil.getClientInstance(); GicMQClient clientInstance = GICMQClientUtil.getClientInstance();
try { try {
if(config.getSuiteId().equals(qywxCallBackDTO.getSuiteId())){ if(config.getSuiteId().equals(qywxCallBackDTO.getSuiteId()) || CONTACT_APP.equals(qywxCallBackDTO.getSuiteId())){
log.info("发送消息到dealWxMessageMq,{}", JSON.toJSONString(qywxCallBackDTO)); log.info("发送消息到dealWxMessageMq,{}", JSON.toJSONString(qywxCallBackDTO));
clientInstance.sendMessage("dealWxMessageMq", JSON.toJSONString(qywxCallBackDTO)); clientInstance.sendMessage("dealWxMessageMq", JSON.toJSONString(qywxCallBackDTO));
} }
...@@ -152,18 +157,14 @@ public class MessageApiServiceImpl implements MessageApiService { ...@@ -152,18 +157,14 @@ public class MessageApiServiceImpl implements MessageApiService {
QywxCallBackDTO dto = JSON.parseObject(param, QywxCallBackDTO.class); QywxCallBackDTO dto = JSON.parseObject(param, QywxCallBackDTO.class);
log.info("【处理微信回调】dto={}",JSON.toJSONString(param)); log.info("【处理微信回调】dto={}",JSON.toJSONString(param));
if(dto != null){ if(dto != null){
String siteId = dto.getSuiteId();
String corpId = dto.getAuthCorpId(); String corpId = dto.getAuthCorpId();
TabHaobanWxEnterprise enterprise = this.enterpriseService.getEnterpriseBycorpId(corpId); TabHaobanWxEnterprise enterprise = this.enterpriseService.getEnterpriseBycorpId(corpId);
if(enterprise != null){ if(enterprise != null){
TabHaobanWxApplication application = wxApplicationService.selectBySiteIdAndWxEnterpriseId(siteId, enterprise.getWxEnterpriseId()); if(dto.getChangeType().endsWith("party")){
if(application != null && application.getApplicationType() == 1){ this.dealDepartment(dto);
if(dto.getChangeType().endsWith("party")){ }else {
this.dealDepartment(dto); this.dealUser(dto);
}else { }
this.dealUser(dto);
}
}
} }
} }
} }
...@@ -195,7 +196,22 @@ public class MessageApiServiceImpl implements MessageApiService { ...@@ -195,7 +196,22 @@ public class MessageApiServiceImpl implements MessageApiService {
} }
departmentDTO.setWxEnterpriseId(enterprise.getWxEnterpriseId()); departmentDTO.setWxEnterpriseId(enterprise.getWxEnterpriseId());
departmentDTO.setWxDepartmentId(qywxCallBackDTO.getId()+""); departmentDTO.setWxDepartmentId(qywxCallBackDTO.getId()+"");
departmentDTO.setSort(qywxCallBackDTO.getOrder()); if(qywxCallBackDTO.getParentId() != null){
List<com.gic.wechat.api.dto.qywx.DepartmentDTO> list = this.qywxDepartmentApiService.listDepartment(qywxCallBackDTO.getAuthCorpId(), qywxCallBackDTO.getSuiteId(), qywxCallBackDTO.getParentId());
if(list != null){
for (com.gic.wechat.api.dto.qywx.DepartmentDTO departmentDTO2 : list) {
if(departmentDTO2.getId().equals(departmentDTO.getDepartmentId())){
departmentDTO.setSort(qywxCallBackDTO.getOrder());
}else{
TabHaobanDepartment tab = this.departmentService.getByWxId(departmentDTO2.getId() + "", enterprise.getWxEnterpriseId());
if(tab != null){
tab.setSort(departmentDTO2.getOrder());
this.departmentService.edit(EntityUtil.changeEntityByJSON(DepartmentDTO.class, tab));
}
}
}
}
}
if(qywxCallBackDTO.getChangeType().equals(WxEditType.ADDDEPART.getCode())){ if(qywxCallBackDTO.getChangeType().equals(WxEditType.ADDDEPART.getCode())){
String response = this.departmentService.add(departmentDTO); String response = this.departmentService.add(departmentDTO);
log.info("微信同步新增部门:{}", JSON.toJSONString(response)); log.info("微信同步新增部门:{}", JSON.toJSONString(response));
...@@ -318,6 +334,7 @@ public class MessageApiServiceImpl implements MessageApiService { ...@@ -318,6 +334,7 @@ public class MessageApiServiceImpl implements MessageApiService {
if(StringUtils.isNotBlank(staffRelated.getClerkCode())){ if(StringUtils.isNotBlank(staffRelated.getClerkCode())){
staffApiService.cleanGicClerk(staffRelated.getClerkCode(), staffRelated.getDepartmentId()); staffApiService.cleanGicClerk(staffRelated.getClerkCode(), staffRelated.getDepartmentId());
} }
this.staffDepartmentRelatedService.del(EntityUtil.changeEntityByJSON(StaffDepartmentRelatedDTO.class, staffRelated));
this.staffService.delByuserid(oldStaff.getStaffId()); this.staffService.delByuserid(oldStaff.getStaffId());
}else { }else {
log.info("微信同步删除的门店不存在,{}", qywxCallBackDTO.getUserid()); log.info("微信同步删除的门店不存在,{}", qywxCallBackDTO.getUserid());
......
...@@ -28,6 +28,7 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela ...@@ -28,6 +28,7 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
private StaffDepartmentRelatedService staffDepartmentRelatedService; private StaffDepartmentRelatedService staffDepartmentRelatedService;
@Autowired @Autowired
private StaffDepartmentRelatedMapper staffDepartmentRelatedMapper; private StaffDepartmentRelatedMapper staffDepartmentRelatedMapper;
@Override @Override
public List<StaffDepartmentRelatedDTO> listByDepartmentId( public List<StaffDepartmentRelatedDTO> listByDepartmentId(
String departmentId) { String departmentId) {
......
...@@ -47,10 +47,6 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService { ...@@ -47,10 +47,6 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
private WxEnterpriseMapper wxEnterpriseMapper; private WxEnterpriseMapper wxEnterpriseMapper;
@Autowired @Autowired
private WxApplicationService wxApplicationService; private WxApplicationService wxApplicationService;
@Autowired
private QywxDepartmentApiService qywxDepartmentApiService;
@Autowired
private DepartmentService departmentService;
@Override @Override
public void callbackReviceEnterprise(QywxCorpInfoSimpleDTO dto) { public void callbackReviceEnterprise(QywxCorpInfoSimpleDTO dto) {
...@@ -63,8 +59,9 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService { ...@@ -63,8 +59,9 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
wxDTO.setWxEnterpriseId(enterprise.getWxEnterpriseId()); wxDTO.setWxEnterpriseId(enterprise.getWxEnterpriseId());
wxDTO.setStatusFlag(1); wxDTO.setStatusFlag(1);
wxEnterpriseService.update(wxDTO); wxEnterpriseService.update(wxDTO);
}else{
wxEnterpriseId = wxEnterpriseService.add(wxDTO);
} }
wxEnterpriseId = wxEnterpriseService.add(wxDTO);
String userId = dto.getUserid(); String userId = dto.getUserid();
String name = dto.getName(); String name = dto.getName();
if(StringUtils.isNotBlank(userId)) { if(StringUtils.isNotBlank(userId)) {
......
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
<dubbo:reference interface="com.gic.enterprise.api.service.StoreService" id="storeService"/> <dubbo:reference interface="com.gic.enterprise.api.service.StoreService" id="storeService"/>
<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"/>
</beans> </beans>
\ No newline at end of file
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<result column="member_id" property="memberId" jdbcType="VARCHAR" /> <result column="member_id" property="memberId" jdbcType="VARCHAR" />
<result column="unionid" property="unionid" jdbcType="VARCHAR" /> <result column="unionid" property="unionid" jdbcType="VARCHAR" />
<result column="wx_enterprise_id" property="wxEnterpriseId" jdbcType="VARCHAR" /> <result column="wx_enterprise_id" property="wxEnterpriseId" jdbcType="VARCHAR" />
<result column="enterprise_id" property="enterpriseId" jdbcType="VARCHAR" />
<result column="status_flag" property="statusFlag" jdbcType="INTEGER" /> <result column="status_flag" property="statusFlag" jdbcType="INTEGER" />
<result column="external_userid" property="externalUserid" jdbcType="VARCHAR" /> <result column="external_userid" property="externalUserid" jdbcType="VARCHAR" />
<result column="wx_user_id" property="wxUserId" jdbcType="VARCHAR" /> <result column="wx_user_id" property="wxUserId" jdbcType="VARCHAR" />
...@@ -17,7 +18,7 @@ ...@@ -17,7 +18,7 @@
</resultMap> </resultMap>
<sql id="Base_Column_List" > <sql id="Base_Column_List" >
member_unionid_related_id, member_id, unionid, wx_enterprise_id, status_flag, external_userid, member_unionid_related_id, member_id, unionid, wx_enterprise_id, status_flag, external_userid,
wx_user_id, create_time, update_time,add_create_time,self_external_userid,external_name wx_user_id, create_time, update_time,add_create_time,self_external_userid,external_name,enterprise_id
</sql> </sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" > <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
select select
...@@ -33,11 +34,11 @@ ...@@ -33,11 +34,11 @@
insert into tab_haoban_member_unionid_related (member_unionid_related_id, member_id, insert into tab_haoban_member_unionid_related (member_unionid_related_id, member_id,
unionid, wx_enterprise_id, status_flag, unionid, wx_enterprise_id, status_flag,
external_userid, wx_user_id, create_time, external_userid, wx_user_id, create_time,
update_time,add_create_time,self_external_userid,external_name) update_time,add_create_time,self_external_userid,external_name,enterprise_id)
values (#{memberUnionidRelatedId,jdbcType=VARCHAR}, #{memberId,jdbcType=VARCHAR}, values (#{memberUnionidRelatedId,jdbcType=VARCHAR}, #{memberId,jdbcType=VARCHAR},
#{unionid,jdbcType=VARCHAR}, #{wxEnterpriseId,jdbcType=VARCHAR}, #{statusFlag,jdbcType=INTEGER}, #{unionid,jdbcType=VARCHAR}, #{wxEnterpriseId,jdbcType=VARCHAR}, #{statusFlag,jdbcType=INTEGER},
#{externalUserid,jdbcType=VARCHAR}, #{wxUserId,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{externalUserid,jdbcType=VARCHAR}, #{wxUserId,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP},#{addCreateTime},#{selfExternalUserid},#{externalName}) #{updateTime,jdbcType=TIMESTAMP},#{addCreateTime},#{selfExternalUserid},#{externalName},#{enterpriseId})
</insert> </insert>
<insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.MemberUnionidRelated" > <insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.MemberUnionidRelated" >
insert into tab_haoban_member_unionid_related insert into tab_haoban_member_unionid_related
...@@ -54,6 +55,9 @@ ...@@ -54,6 +55,9 @@
<if test="wxEnterpriseId != null" > <if test="wxEnterpriseId != null" >
wx_enterprise_id, wx_enterprise_id,
</if> </if>
<if test="enterpriseId != null" >
enterprise_id,
</if>
<if test="statusFlag != null" > <if test="statusFlag != null" >
status_flag, status_flag,
</if> </if>
...@@ -92,6 +96,9 @@ ...@@ -92,6 +96,9 @@
<if test="wxEnterpriseId != null" > <if test="wxEnterpriseId != null" >
#{wxEnterpriseId,jdbcType=VARCHAR}, #{wxEnterpriseId,jdbcType=VARCHAR},
</if> </if>
<if test="enterpriseId != null" >
#{enterpriseId,jdbcType=VARCHAR},
</if>
<if test="statusFlag != null" > <if test="statusFlag != null" >
#{statusFlag,jdbcType=INTEGER}, #{statusFlag,jdbcType=INTEGER},
</if> </if>
...@@ -130,6 +137,9 @@ ...@@ -130,6 +137,9 @@
<if test="wxEnterpriseId != null" > <if test="wxEnterpriseId != null" >
wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}, wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
</if> </if>
<if test="enterpriseId != null" >
enterprise_id = #{enterpriseId,jdbcType=VARCHAR},
</if>
<if test="statusFlag != null" > <if test="statusFlag != null" >
status_flag = #{statusFlag,jdbcType=INTEGER}, status_flag = #{statusFlag,jdbcType=INTEGER},
</if> </if>
...@@ -162,6 +172,7 @@ ...@@ -162,6 +172,7 @@
set member_id = #{memberId,jdbcType=VARCHAR}, set member_id = #{memberId,jdbcType=VARCHAR},
unionid = #{unionid,jdbcType=VARCHAR}, unionid = #{unionid,jdbcType=VARCHAR},
wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}, wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
enterprise_id = #{enterpriseId,jdbcType=VARCHAR},
status_flag = #{statusFlag,jdbcType=INTEGER}, status_flag = #{statusFlag,jdbcType=INTEGER},
external_userid = #{externalUserid,jdbcType=VARCHAR}, external_userid = #{externalUserid,jdbcType=VARCHAR},
wx_user_id = #{wxUserId,jdbcType=VARCHAR}, wx_user_id = #{wxUserId,jdbcType=VARCHAR},
...@@ -198,6 +209,14 @@ ...@@ -198,6 +209,14 @@
and status_flag = 1 and status_flag = 1
and wx_enterprise_id = #{wxEnterpriseId} and wx_enterprise_id = #{wxEnterpriseId}
</select> </select>
<select id="listByExTernalUseridAndWxUserId" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_member_unionid_related
where wx_user_id = #{wxUserId}
and status_flag = 1
and external_userid = #{externalUserid}
</select>
<select id="getByParams" resultMap="BaseResultMap" parameterType="java.lang.String" > <select id="getByParams" resultMap="BaseResultMap" parameterType="java.lang.String" >
select select
...@@ -205,7 +224,7 @@ ...@@ -205,7 +224,7 @@
from tab_haoban_member_unionid_related from tab_haoban_member_unionid_related
where wx_user_id = #{wxUserId} where wx_user_id = #{wxUserId}
and status_flag = 1 and status_flag = 1
and wx_enterprise_id = #{wxEnterpriseId} and enterprise_id = #{enterpriseId}
and external_name = #{externalName} and external_name = #{externalName}
and add_create_time = #{addCreateTime} and add_create_time = #{addCreateTime}
</select> </select>
......
...@@ -213,6 +213,7 @@ ...@@ -213,6 +213,7 @@
from tab_haoban_staff_department_related from tab_haoban_staff_department_related
where staff_id = #{staffId,jdbcType=VARCHAR} where staff_id = #{staffId,jdbcType=VARCHAR}
and status_flag = 1 and status_flag = 1
group by department_id
</select> </select>
<update id="delByUserid" > <update id="delByUserid" >
update tab_haoban_staff_department_related update tab_haoban_staff_department_related
...@@ -232,6 +233,14 @@ ...@@ -232,6 +233,14 @@
limit 1 limit 1
</select> </select>
<select id="listByWxUserId" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_staff_department_related
where wx_user_id = #{wxUserId}
and status_flag = 1
</select>
<select id="countByDepartmentId" resultType="java.lang.Integer" parameterType="java.lang.String" > <select id="countByDepartmentId" resultType="java.lang.Integer" parameterType="java.lang.String" >
select select
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
<result column="round_logo_url" property="roundLogoUrl" jdbcType="VARCHAR" /> <result column="round_logo_url" property="roundLogoUrl" jdbcType="VARCHAR" />
<result column="wx_secret_key" property="wxSecretKey" jdbcType="VARCHAR" /> <result column="wx_secret_key" property="wxSecretKey" jdbcType="VARCHAR" />
<result column="member_secret" property="memberSecret" jdbcType="VARCHAR"/> <result column="member_secret" property="memberSecret" jdbcType="VARCHAR"/>
<result column="contact_secret" property="contactSecret" jdbcType="VARCHAR"/>
<result column="level" property="level" jdbcType="INTEGER" /> <result column="level" property="level" jdbcType="INTEGER" />
<result column="contact_flag" property="contactFlag" jdbcType="INTEGER" /> <result column="contact_flag" property="contactFlag" jdbcType="INTEGER" />
<result column="bind_flag" property="bindFlag" jdbcType="INTEGER" /> <result column="bind_flag" property="bindFlag" jdbcType="INTEGER" />
...@@ -38,7 +39,7 @@ ...@@ -38,7 +39,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 square_logo_url, round_logo_url, level, bind_flag, status_flag, create_time, update_time,contact_flag,wx_secret_key
,member_secret ,member_secret,contact_secret
</sql> </sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" > <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
select select
...@@ -59,7 +60,7 @@ ...@@ -59,7 +60,7 @@
auth_info, agent, agentid, auth_info, agent, agentid,
appid, name, square_logo_url, appid, name, square_logo_url,
round_logo_url, level, bind_flag, round_logo_url, level, bind_flag,
status_flag, create_time, update_time,contact_flag,wx_secret_key status_flag, create_time, update_time,contact_flag,wx_secret_key,contact_secret
) )
values (#{wxEnterpriseId,jdbcType=VARCHAR}, #{corpid,jdbcType=VARCHAR}, #{permanentCode,jdbcType=VARCHAR}, values (#{wxEnterpriseId,jdbcType=VARCHAR}, #{corpid,jdbcType=VARCHAR}, #{permanentCode,jdbcType=VARCHAR},
#{corpName,jdbcType=VARCHAR}, #{corpType,jdbcType=VARCHAR}, #{corpSquareLogoUrl,jdbcType=VARCHAR}, #{corpName,jdbcType=VARCHAR}, #{corpType,jdbcType=VARCHAR}, #{corpSquareLogoUrl,jdbcType=VARCHAR},
...@@ -69,7 +70,7 @@ ...@@ -69,7 +70,7 @@
#{authInfo,jdbcType=VARCHAR}, #{agent,jdbcType=VARCHAR}, #{agentid,jdbcType=VARCHAR}, #{authInfo,jdbcType=VARCHAR}, #{agent,jdbcType=VARCHAR}, #{agentid,jdbcType=VARCHAR},
#{appid,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{squareLogoUrl,jdbcType=VARCHAR}, #{appid,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{squareLogoUrl,jdbcType=VARCHAR},
#{roundLogoUrl,jdbcType=VARCHAR}, #{level,jdbcType=INTEGER}, #{bindFlag,jdbcType=INTEGER}, #{roundLogoUrl,jdbcType=VARCHAR}, #{level,jdbcType=INTEGER}, #{bindFlag,jdbcType=INTEGER},
#{statusFlag,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},#{contactFlag},#{wxSecretKey} #{statusFlag,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},#{contactFlag},#{wxSecretKey},#{contactSecret}
) )
</insert> </insert>
<insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise" > <insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise" >
...@@ -162,6 +163,9 @@ ...@@ -162,6 +163,9 @@
<if test="wxSecretKey != null" > <if test="wxSecretKey != null" >
wx_secret_key, wx_secret_key,
</if> </if>
<if test="contactSecret != null" >
contact_secret,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides="," > <trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="wxEnterpriseId != null" > <if test="wxEnterpriseId != null" >
...@@ -251,6 +255,9 @@ ...@@ -251,6 +255,9 @@
<if test="wxSecretKey != null" > <if test="wxSecretKey != null" >
#{wxSecretKey,jdbcType=TIMESTAMP}, #{wxSecretKey,jdbcType=TIMESTAMP},
</if> </if>
<if test="contactSecret != null" >
#{contactSecret,jdbcType=TIMESTAMP},
</if>
</trim> </trim>
</insert> </insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise" > <update id="updateByPrimaryKeySelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise" >
...@@ -340,6 +347,9 @@ ...@@ -340,6 +347,9 @@
<if test="wxSecretKey != null" > <if test="wxSecretKey != null" >
wx_secret_key = #{wxSecretKey,jdbcType=VARCHAR}, wx_secret_key = #{wxSecretKey,jdbcType=VARCHAR},
</if> </if>
<if test="contactSecret != null" >
contact_secret = #{contactSecret,jdbcType=VARCHAR},
</if>
</set> </set>
where wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR} where wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
</update> </update>
...@@ -372,6 +382,7 @@ ...@@ -372,6 +382,7 @@
contact_flag = #{contactFlag,jdbcType=INTEGER}, contact_flag = #{contactFlag,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP}, create_time = #{createTime,jdbcType=TIMESTAMP},
wx_secret_key = #{wxSecretKey,jdbcType=VARCHAR}, wx_secret_key = #{wxSecretKey,jdbcType=VARCHAR},
contact_secret = #{contactSecret,jdbcType=VARCHAR},
update_time = #{updateTime,jdbcType=TIMESTAMP} update_time = #{updateTime,jdbcType=TIMESTAMP}
where wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR} where wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
</update> </update>
......
...@@ -19,7 +19,7 @@ public class ServiceTest { ...@@ -19,7 +19,7 @@ public class ServiceTest {
@Test @Test
public void test() { public void test() {
wxEnterpriseRelatedApiService.listEnterpriseByWxEnterpriseId("073e89a37eb14acabf258e59a57359b6"); //wxEnterpriseRelatedApiService.listEnterpriseByWxEnterpriseId("073e89a37eb14acabf258e59a57359b6");
} }
......
...@@ -48,7 +48,7 @@ public class AdminController extends WebBaseController{ ...@@ -48,7 +48,7 @@ public class AdminController extends WebBaseController{
public HaobanResponse adminList() { public HaobanResponse adminList() {
LoginVO login = (LoginVO) AuthRequestUtil.getLoginUser(); LoginVO login = (LoginVO) AuthRequestUtil.getLoginUser();
String wxEnterpriseId = login.getWxEnterpriseId(); String wxEnterpriseId = login.getWxEnterpriseId();
WxApplicationDTO application = wxApplicationApiService.selectByWxEnterpriseIdAndApplicationType(wxEnterpriseId, 1); WxApplicationDTO application = wxApplicationApiService.selectByWxEnterpriseIdAndApplicationType(wxEnterpriseId, 2);
WxEnterpriseDTO enterprise = wxEnterpriseApiService.getOne(wxEnterpriseId); WxEnterpriseDTO enterprise = wxEnterpriseApiService.getOne(wxEnterpriseId);
logger.info("【管理员查询】corpid={},siteId={},agentId={}",enterprise.getCorpid(),application.getSiteId(),application.getAgentId()); logger.info("【管理员查询】corpid={},siteId={},agentId={}",enterprise.getCorpid(),application.getSiteId(),application.getAgentId());
String adminList = qywxSuiteApiService.getAdminList(enterprise.getCorpid(), application.getSiteId(), Integer.parseInt(application.getAgentId())); String adminList = qywxSuiteApiService.getAdminList(enterprise.getCorpid(), application.getSiteId(), Integer.parseInt(application.getAgentId()));
......
...@@ -102,13 +102,18 @@ public class ApplicationController extends WebBaseController{ ...@@ -102,13 +102,18 @@ public class ApplicationController extends WebBaseController{
} }
@RequestMapping("has-bind-contract") @RequestMapping("has-bind-contract")
public HaobanResponse hasBindContract(){ public HaobanResponse hasBindContract(){
LoginVO login = AuthRequestUtil.getSessionUser(); LoginVO login = (LoginVO) AuthRequestUtil.getLoginUser();
String wxEnterpriseId = login.getWxEnterpriseId(); String wxEnterpriseId = login.getWxEnterpriseId();
WxApplicationDTO wxApplicationDTO = this.wxApplicationApiService.selectByWxEnterpriseIdAndApplicationType(wxEnterpriseId, 1); WxEnterpriseDTO enterpriseDTO = this.wxEnterpriseApiService.getOne(wxEnterpriseId);
if(wxApplicationDTO != null){ if(enterpriseDTO != null){
return resultResponse(HaoBanErrCode.ERR_1, true); if(StringUtils.isNotBlank(enterpriseDTO.getContactSecret()) && enterpriseDTO.getContactFlag() != null && enterpriseDTO.getContactFlag() == 0){
this.departmentApiService.initwxDepartment(enterpriseDTO.getCorpid(), enterpriseDTO.getContactSecret(), enterpriseDTO.getWxEnterpriseId());
enterpriseDTO.setContactFlag(1);
wxEnterpriseApiService.update(enterpriseDTO);
}
} }
return resultResponse(HaoBanErrCode.ERR_1, false);
return resultResponse(HaoBanErrCode.ERR_1, true);
} }
@RequestMapping("get-auth-url") @RequestMapping("get-auth-url")
...@@ -136,7 +141,7 @@ public class ApplicationController extends WebBaseController{ ...@@ -136,7 +141,7 @@ public class ApplicationController extends WebBaseController{
applicationDTO.setAgentName(dto.getAgentName()); applicationDTO.setAgentName(dto.getAgentName());
applicationDTO.setSiteId(dto.getSuiteId()); applicationDTO.setSiteId(dto.getSuiteId());
wxApplicationApiService.addSuite(applicationDTO); wxApplicationApiService.addSuite(applicationDTO);
this.departmentApiService.initwxDepartment(dto.getCorpid(), suiteId, enterpriseDTO.getWxEnterpriseId()); this.departmentApiService.initwxDepartment(dto.getCorpid(), enterpriseDTO.getContactSecret(), enterpriseDTO.getWxEnterpriseId());
enterpriseDTO.setContactFlag(1); enterpriseDTO.setContactFlag(1);
wxEnterpriseApiService.update(enterpriseDTO); wxEnterpriseApiService.update(enterpriseDTO);
} }
......
...@@ -689,40 +689,68 @@ public class DepartmentContoller extends WebBaseController{ ...@@ -689,40 +689,68 @@ public class DepartmentContoller extends WebBaseController{
List<ClerkListDTO> list = clerkService.getClerkByStoreId(store.getEnterpriseId(), storeId); List<ClerkListDTO> list = clerkService.getClerkByStoreId(store.getEnterpriseId(), storeId);
logger.info("【处理门店下导购】list={}",JSON.toJSONString(list)); logger.info("【处理门店下导购】list={}",JSON.toJSONString(list));
for (ClerkListDTO clerkListDTO : list) { for (ClerkListDTO clerkListDTO : list) {
String nationcode = clerkListDTO.getNationcode(); try {
String phoneNumber = clerkListDTO.getPhoneNumber(); String nationcode = clerkListDTO.getNationcode();
if(StringUtils.isBlank(phoneNumber)){ if(StringUtils.isNotBlank(nationcode) && nationcode.startsWith("+")){
continue; nationcode = nationcode.replace("+", "");
} }
String clerkCode = clerkListDTO.getClerkCode(); String phoneNumber = clerkListDTO.getPhoneNumber();
StaffDTO staff = staffApiService.selectByNationcodeAndPhoneNumber(wxEnterpriseId, nationcode, phoneNumber); if(StringUtils.isBlank(phoneNumber)){
if(staff == null){ continue;
staff = new StaffDTO();
staff.setNationCode(nationcode);
staff.setActiveFlag(1);
staff.setDepartmentIds(departmentId);
staff.setBindFlag(1);
staff.setClerkCode(clerkCode);
staff.setNickName(clerkListDTO.getClerkName());
staff.setStaffName(clerkListDTO.getClerkName());
staff.setPostion(clerkListDTO.getPositionName());
staff.setWxEnterpriseId(wxEnterpriseId);
staff.setPhoneNumber(phoneNumber);
try {
staff.setSex(clerkListDTO.getClerkGender() == null?null:Integer.parseInt(clerkListDTO.getClerkGender()));
} catch (Exception e) {
logger.info("【同步店员】设置性别错误sex={}",clerkListDTO.getClerkGender());
} }
staff.setSyncPostionFlag(1); String clerkCode = clerkListDTO.getClerkCode();
StaffDTO staff = staffApiService.selectByNationcodeAndPhoneNumber(wxEnterpriseId, nationcode, phoneNumber);
ServiceResponse hr = staffApiService.add(staff, departmentId); if(staff == null){
if(hr.getCode() == 1){ staff = new StaffDTO();
StaffDepartmentRelatedDTO staffRelated = staffApiService.getDepartmentIdAndStaffId(departmentId, hr.getResult().toString()); staff.setNationCode(nationcode);
staff.setActiveFlag(1);
staff.setDepartmentIds(departmentId);
staff.setBindFlag(1);
staff.setClerkCode(clerkCode);
staff.setNickName(clerkListDTO.getClerkName());
staff.setStaffName(clerkListDTO.getClerkName());
staff.setPostion(clerkListDTO.getPositionName());
staff.setWxEnterpriseId(wxEnterpriseId);
staff.setPhoneNumber(phoneNumber);
try {
staff.setSex(clerkListDTO.getClerkGender() == null?null:Integer.parseInt(clerkListDTO.getClerkGender()));
} catch (Exception e) {
logger.info("【同步店员】设置性别错误sex={}",clerkListDTO.getClerkGender());
}
staff.setSyncPostionFlag(1);
ServiceResponse hr = staffApiService.add(staff, departmentId);
if(hr.getCode() == 1){
StaffDepartmentRelatedDTO staffRelated = staffApiService.getDepartmentIdAndStaffId(departmentId, hr.getResult().toString());
StaffDepartmentRelatedDTO isCodeExist = staffApiService.getDepartmentIdAndCode(departmentId,clerkCode);
if(staffRelated != null && isCodeExist == null){
staffRelated.setClerkCode(clerkCode);
staffDepartmentRelatedApiService.updateById(staffRelated);
ClerkDTO clerkDTO= clerkService.getClerkByCodeNoStatus(enterpriseId,clerkCode);
if(clerkDTO != null && (!clerkDTO.getClerkName().equals(staff.getStaffName()) || !staff.getPhoneNumber().equals(clerkDTO.getPhoneNumber()))){
logger.info("【员工修改】clerkDTO={}",JSON.toJSONString(clerkDTO));
clerkDTO.setClerkName(staff.getStaffName());
clerkDTO.setPhoneNumber(staff.getPhoneNumber());
clerkService.updateClerk(clerkDTO);
}
}
}
}else{
String staffId = staff.getStaffId();
List<StaffDepartmentRelatedDTO> relatedList = staffApiService.listStaffDepartmentByStaffId(staffId);
String departmentIds = departmentId;
for (StaffDepartmentRelatedDTO staffDepartmentRelatedDTO : relatedList) {
departmentIds += "," + staffDepartmentRelatedDTO.getDepartmentId();
}
Map<String,StaffDepartmentRelatedDTO> map = com.gic.commons.util.CollectionUtil.toMap(relatedList, "departmentId");
if(map.get(departmentId) == null){
staffApiService.staffEdit(staff, departmentIds);
}
StaffDepartmentRelatedDTO staffRelated = staffApiService.getDepartmentIdAndStaffId(departmentId, staffId);
//如果这个人是未绑定的 则绑定clerk
StaffDepartmentRelatedDTO isCodeExist = staffApiService.getDepartmentIdAndCode(departmentId,clerkCode); StaffDepartmentRelatedDTO isCodeExist = staffApiService.getDepartmentIdAndCode(departmentId,clerkCode);
if(staffRelated != null && isCodeExist == null){ if(StringUtils.isBlank(staffRelated.getClerkCode()) && isCodeExist == null){
staffRelated.setClerkCode(clerkCode);
staffDepartmentRelatedApiService.updateById(staffRelated);
ClerkDTO clerkDTO= clerkService.getClerkByCodeNoStatus(enterpriseId,clerkCode); ClerkDTO clerkDTO= clerkService.getClerkByCodeNoStatus(enterpriseId,clerkCode);
if(clerkDTO != null && (!clerkDTO.getClerkName().equals(staff.getStaffName()) || !staff.getPhoneNumber().equals(clerkDTO.getPhoneNumber()))){ if(clerkDTO != null && (!clerkDTO.getClerkName().equals(staff.getStaffName()) || !staff.getPhoneNumber().equals(clerkDTO.getPhoneNumber()))){
logger.info("【员工修改】clerkDTO={}",JSON.toJSONString(clerkDTO)); logger.info("【员工修改】clerkDTO={}",JSON.toJSONString(clerkDTO));
...@@ -730,34 +758,13 @@ public class DepartmentContoller extends WebBaseController{ ...@@ -730,34 +758,13 @@ public class DepartmentContoller extends WebBaseController{
clerkDTO.setPhoneNumber(staff.getPhoneNumber()); clerkDTO.setPhoneNumber(staff.getPhoneNumber());
clerkService.updateClerk(clerkDTO); clerkService.updateClerk(clerkDTO);
} }
staffRelated.setClerkCode(clerkCode);
staffDepartmentRelatedApiService.updateById(staffRelated);
} }
} }
}else{ } catch (Exception e) {
String staffId = staff.getStaffId(); logger.info("同步失败");
List<StaffDepartmentRelatedDTO> relatedList = staffApiService.listStaffDepartmentByStaffId(staffId);
String departmentIds = departmentId;
for (StaffDepartmentRelatedDTO staffDepartmentRelatedDTO : relatedList) {
departmentIds += "," + staffDepartmentRelatedDTO.getDepartmentId();
}
Map<String,StaffDepartmentRelatedDTO> map = com.gic.commons.util.CollectionUtil.toMap(relatedList, "departmentId");
if(map.get(departmentId) == null){
staffApiService.staffEdit(staff, departmentIds);
}
StaffDepartmentRelatedDTO staffRelated = staffApiService.getDepartmentIdAndStaffId(departmentId, staffId);
//如果这个人是未绑定的 则绑定clerk
StaffDepartmentRelatedDTO isCodeExist = staffApiService.getDepartmentIdAndCode(departmentId,clerkCode);
if(StringUtils.isBlank(staffRelated.getClerkCode()) && isCodeExist == null){
ClerkDTO clerkDTO= clerkService.getClerkByCodeNoStatus(enterpriseId,clerkCode);
if(clerkDTO != null && (!clerkDTO.getClerkName().equals(staff.getStaffName()) || !staff.getPhoneNumber().equals(clerkDTO.getPhoneNumber()))){
logger.info("【员工修改】clerkDTO={}",JSON.toJSONString(clerkDTO));
clerkDTO.setClerkName(staff.getStaffName());
clerkDTO.setPhoneNumber(staff.getPhoneNumber());
clerkService.updateClerk(clerkDTO);
}
staffRelated.setClerkCode(clerkCode);
staffDepartmentRelatedApiService.updateById(staffRelated);
}
} }
} }
}else{ }else{
......
package com.gic.haoban.manage.web.anno;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.concurrent.TimeUnit;
/**
* 访问限制
* 默认1秒
* @author hzw
*
*/
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface HttpLimit {
long time() default 1L;
TimeUnit unit() default TimeUnit.SECONDS;
int times() default 2;
}
\ No newline at end of file
...@@ -30,6 +30,7 @@ import com.gic.haoban.manage.api.service.BindApiService; ...@@ -30,6 +30,7 @@ import com.gic.haoban.manage.api.service.BindApiService;
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.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;
...@@ -166,6 +167,7 @@ public class ClerkController extends WebBaseController{ ...@@ -166,6 +167,7 @@ public class ClerkController extends WebBaseController{
} }
//成员绑定 //成员绑定
@HttpLimit
@RequestMapping("/staff-bind") @RequestMapping("/staff-bind")
public HaobanResponse staffBind(String departmentId,String fromClerkCode,String fromStaffDepartmentRelatedId) { public HaobanResponse staffBind(String departmentId,String fromClerkCode,String fromStaffDepartmentRelatedId) {
if(StringUtils.isAnyBlank(departmentId,fromClerkCode,fromStaffDepartmentRelatedId)){ if(StringUtils.isAnyBlank(departmentId,fromClerkCode,fromStaffDepartmentRelatedId)){
...@@ -175,6 +177,7 @@ public class ClerkController extends WebBaseController{ ...@@ -175,6 +177,7 @@ public class ClerkController extends WebBaseController{
return resultResponse(HaoBanErrCode.ERR_1); return resultResponse(HaoBanErrCode.ERR_1);
} }
//成员解除绑定 //成员解除绑定
@HttpLimit
@RequestMapping("/clerk-single-unbind") @RequestMapping("/clerk-single-unbind")
public HaobanResponse clerkSingleUnbind(String fromClerkCode,String departmentId) { public HaobanResponse clerkSingleUnbind(String fromClerkCode,String departmentId) {
if(StringUtils.isAnyBlank(fromClerkCode)){ if(StringUtils.isAnyBlank(fromClerkCode)){
...@@ -184,6 +187,7 @@ public class ClerkController extends WebBaseController{ ...@@ -184,6 +187,7 @@ public class ClerkController extends WebBaseController{
return resultResponse(HaoBanErrCode.ERR_1); return resultResponse(HaoBanErrCode.ERR_1);
} }
//成员换绑定 //成员换绑定
@HttpLimit
@RequestMapping("/clerk-unbind") @RequestMapping("/clerk-unbind")
public HaobanResponse clerkUnbind(String departmentId,String fromClerkCode,String toStaffId,String manager) { public HaobanResponse clerkUnbind(String departmentId,String fromClerkCode,String toStaffId,String manager) {
if(StringUtils.isAnyBlank(fromClerkCode,toStaffId)){ if(StringUtils.isAnyBlank(fromClerkCode,toStaffId)){
...@@ -197,6 +201,7 @@ public class ClerkController extends WebBaseController{ ...@@ -197,6 +201,7 @@ public class ClerkController extends WebBaseController{
return resultResponse(HaoBanErrCode.ERR_1); return resultResponse(HaoBanErrCode.ERR_1);
} }
//店长转让 //店长转让
@HttpLimit
@RequestMapping("/clerk-manager-tranfer") @RequestMapping("/clerk-manager-tranfer")
public HaobanResponse clerkManagerTranfer(String departmentId,String fromClerkCode,String toStaffDepartmentRelatedId) { public HaobanResponse clerkManagerTranfer(String departmentId,String fromClerkCode,String toStaffDepartmentRelatedId) {
logger.info("===========================》111111111111111"); logger.info("===========================》111111111111111");
......
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 com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.gic.enterprise.api.dto.StoreDTO; import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.haoban.base.api.common.ServiceResponse; import com.gic.haoban.base.api.common.ServiceResponse;
...@@ -9,6 +10,7 @@ import com.gic.haoban.common.utils.HaobanResponse; ...@@ -9,6 +10,7 @@ import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.contacts.manage.api.service.StoreService; import com.gic.haoban.contacts.manage.api.service.StoreService;
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.api.service.MemberUnionidRelatedApiService;
import com.gic.haoban.manage.api.service.StaffApiService; import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseApiService; import com.gic.haoban.manage.api.service.WxEnterpriseApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService; import com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService;
...@@ -21,6 +23,7 @@ import com.gic.haoban.manage.web.vo.StoreVO; ...@@ -21,6 +23,7 @@ import com.gic.haoban.manage.web.vo.StoreVO;
import com.gic.wechat.api.dto.qywx.UserDTO; import com.gic.wechat.api.dto.qywx.UserDTO;
import com.gic.wechat.api.service.qywx.QywxCorpApiService; import com.gic.wechat.api.service.qywx.QywxCorpApiService;
import com.gic.wechat.api.service.qywx.QywxUserApiService; import com.gic.wechat.api.service.qywx.QywxUserApiService;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -55,6 +58,9 @@ public class InfoController extends WebBaseController{ ...@@ -55,6 +58,9 @@ public class InfoController extends WebBaseController{
@Autowired @Autowired
private com.gic.enterprise.api.service.StoreService storeService; private com.gic.enterprise.api.service.StoreService storeService;
@Autowired
private MemberUnionidRelatedApiService memberUnionidRelatedApiService;
private static Logger logger= LoggerFactory.getLogger(InfoController.class); private static Logger logger= LoggerFactory.getLogger(InfoController.class);
@Autowired @Autowired
...@@ -96,6 +102,7 @@ public class InfoController extends WebBaseController{ ...@@ -96,6 +102,7 @@ public class InfoController extends WebBaseController{
infoVo.setStaffName(loginStaff.getStaffName()); infoVo.setStaffName(loginStaff.getStaffName());
infoVo.setPhoneNumber(loginStaff.getPhoneNumber()); infoVo.setPhoneNumber(loginStaff.getPhoneNumber());
infoVo.setNationcode(loginStaff.getNationCode()); infoVo.setNationcode(loginStaff.getNationCode());
infoVo.setWxUserId(loginStaff.getWxUserId());
return resultResponse(HaoBanErrCode.ERR_1,infoVo); return resultResponse(HaoBanErrCode.ERR_1,infoVo);
} }
...@@ -165,6 +172,15 @@ public class InfoController extends WebBaseController{ ...@@ -165,6 +172,15 @@ public class InfoController extends WebBaseController{
} }
@RequestMapping("get-member-store")
public HaobanResponse getMemberStore(String externalUserid,String wxUserId) {
if (StringUtils.isAnyBlank(externalUserid,wxUserId)) {
return resultResponse(HaoBanErrCode.ERR_2);
}
List<MemberStoreDTO> result = memberUnionidRelatedApiService.listByExTernalUseridAndWxUserId(externalUserid, wxUserId);
return resultResponse(HaoBanErrCode.ERR_1,result);
}
@RequestMapping("get-staff-info") @RequestMapping("get-staff-info")
public HaobanResponse getStaffInfo(String phoneNumber) { public HaobanResponse getStaffInfo(String phoneNumber) {
if (StringUtils.isBlank(phoneNumber)) { if (StringUtils.isBlank(phoneNumber)) {
......
...@@ -68,6 +68,8 @@ public enum HaoBanErrCode { ...@@ -68,6 +68,8 @@ public enum HaoBanErrCode {
ERR_21(21, "验证码已过期或者错误"), ERR_21(21, "验证码已过期或者错误"),
ERR_22(22, "验证码一分钟只能请求一次"), ERR_22(22, "验证码一分钟只能请求一次"),
ERR_10008(10008,"请不要过于频繁点击"),
/** /**
* 员工档案模块 * 员工档案模块
......
package com.gic.haoban.manage.web.interceptor;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Map;
import com.alibaba.fastjson.JSONObject;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.web.anno.HttpLimit;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.redis.data.util.RedisUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* 测试登录拦截器
*
* @author zhurz
*/
public class HttpLimitInterceptor extends HandlerInterceptorAdapter {
private static Logger logger = LoggerFactory.getLogger(HttpLimitInterceptor.class);
private void errorResult(HttpServletResponse httpServletResponse, HaoBanErrCode errCode) {
HaobanResponse response = new HaobanResponse();
response.setErrorCode(errCode.getCode());
response.setMessage(errCode.getMsg());
PrintWriter writer = null;
try {
httpServletResponse.setHeader("Content-type", "application/json;charset=UTF-8");
writer = httpServletResponse.getWriter();
writer.append(JSONObject.toJSONString(response));
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public boolean preHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o) throws Exception {
String requestURI = httpServletRequest.getRequestURI();
logger.info("post-url:{}", requestURI);
Map<String, String[]> parameterMap = httpServletRequest.getParameterMap();
logger.info("post-params:{}", JSONObject.toJSONString(parameterMap));
if (!(o instanceof HandlerMethod)) {
return true;
}
HandlerMethod handler = (HandlerMethod) o;
HttpLimit httpLimit = handler.getMethodAnnotation(HttpLimit.class);
if (httpLimit != null) {
String ip = getIpAddress(httpServletRequest);
String url = httpServletRequest.getRequestURL().toString();
String key = "http_limit_".concat(url);
key = key + ip;
if(RedisUtil.getCache(key)!=null){
this.errorResult(httpServletResponse, HaoBanErrCode.ERR_10008);
logger.info("过于频繁点击");
return false;
}else{
RedisUtil.setCache(key, 1, httpLimit.time());
}
}
return true;
}
private String getIpAddress(HttpServletRequest request) {
String ip = request.getHeader("x-forwarded-for");
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("Proxy-Client-IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("WL-Proxy-Client-IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_CLIENT_IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_X_FORWARDED_FOR");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getRemoteAddr();
}
return ip;
}
}
...@@ -18,6 +18,14 @@ public class AppStaffVo implements Serializable { ...@@ -18,6 +18,14 @@ public class AppStaffVo implements Serializable {
private String phoneNumber; private String phoneNumber;
private String wxEnterpriseId; private String wxEnterpriseId;
private String wxEnterpriseName; private String wxEnterpriseName;
private String wxUserId;
public String getWxUserId() {
return wxUserId;
}
public void setWxUserId(String wxUserId) {
this.wxUserId = wxUserId;
}
public String getStaffId() { public String getStaffId() {
return staffId; return staffId;
} }
......
...@@ -15,7 +15,14 @@ public class InfoVo implements Serializable { ...@@ -15,7 +15,14 @@ public class InfoVo implements Serializable {
private String staffName; private String staffName;
private String phoneNumber; private String phoneNumber;
private String nationcode; private String nationcode;
private String wxUserId;
public String getWxUserId() {
return wxUserId;
}
public void setWxUserId(String wxUserId) {
this.wxUserId = wxUserId;
}
public String getStaffId() { public String getStaffId() {
return staffId; return staffId;
} }
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
<dubbo:reference interface="com.gic.haoban.manage.api.service.AuditSettingApiService" id="auditSettingApiService"/> <dubbo:reference interface="com.gic.haoban.manage.api.service.AuditSettingApiService" id="auditSettingApiService"/>
<dubbo:reference interface="com.gic.dict.api.service.ManagerDictService" id="managerDictService"/> <dubbo:reference interface="com.gic.dict.api.service.ManagerDictService" id="managerDictService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.ApplicationSettingApiService" id="applicationSettingApiService"/> <dubbo:reference interface="com.gic.haoban.manage.api.service.ApplicationSettingApiService" id="applicationSettingApiService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.MemberUnionidRelatedApiService" id="memberUnionidRelatedApiService"/>
<dubbo:reference interface="com.gic.haoban.communicate.api.service.valid.ValidationCodeService" id="validationCodeService"/> <dubbo:reference interface="com.gic.haoban.communicate.api.service.valid.ValidationCodeService" id="validationCodeService"/>
......
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