Commit c744a50e by 陶光胜

日志

parent f3f4d1eb
package com.gic.haoban.manage.service.dao.mapper;
import java.util.List;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Param;
public interface WxEnterpriseMapper {
int deleteByPrimaryKey(String wxEnterpriseId);
int insert(TabHaobanWxEnterprise record);
int insertSelective(TabHaobanWxEnterprise record);
TabHaobanWxEnterprise selectByPrimaryKey(String wxEnterpriseId);
int updateByPrimaryKeySelective(TabHaobanWxEnterprise record);
int updateByPrimaryKey(TabHaobanWxEnterprise record);
Page<TabHaobanWxEnterprise> list(@Param("keyword") String keyword,@Param("gicContactFlag") Integer gicContactFlag,@Param("version") String version);
List<TabHaobanWxEnterprise> listBycorpId(@Param("corpId") String corpId);
package com.gic.haoban.manage.service.dao.mapper;
import java.util.List;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Param;
public interface WxEnterpriseMapper {
int deleteByPrimaryKey(String wxEnterpriseId);
int insert(TabHaobanWxEnterprise record);
int insertSelective(TabHaobanWxEnterprise record);
TabHaobanWxEnterprise selectByPrimaryKey(String wxEnterpriseId);
int updateByPrimaryKeySelective(TabHaobanWxEnterprise record);
int updateByPrimaryKey(TabHaobanWxEnterprise record);
Page<TabHaobanWxEnterprise> list(@Param("keyword") String keyword,@Param("gicContactFlag") Integer gicContactFlag,@Param("version") String version);
List<TabHaobanWxEnterprise> listBycorpId(@Param("corpId") String corpId);
List<TabHaobanWxEnterprise> listDelBycorpId(@Param("corpId") String corpId);
}
\ No newline at end of file
......@@ -16,6 +16,14 @@ public interface WxEnterpriseService {
*/
TabHaobanWxEnterprise getEnterpriseBycorpId(String corpId);
/**
* 通过微信企业ID查询删除状态好办企业ID
* @param corpId
* @return
*/
TabHaobanWxEnterprise getDelEnterpriseBycorpId(String corpId);
void update(WxEnterpriseDTO enterpriseDTO);
int delete(String wxEnterpriseId);
}
......@@ -47,10 +47,26 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService {
}
@Override
public TabHaobanWxEnterprise getDelEnterpriseBycorpId(String corpId) {
List<TabHaobanWxEnterprise> list = this.mapper.listDelBycorpId(corpId);
if(CollectionUtils.isNotEmpty(list)){
return list.get(0);
}
return null;
}
@Override
public void update(WxEnterpriseDTO enterpriseDTO) {
enterpriseDTO.setUpdateTime(new Date());
mapper.updateByPrimaryKeySelective(EntityUtil.changeEntityByJSON(TabHaobanWxEnterprise.class, enterpriseDTO));
}
@Override
public int delete(String wxEnterpriseId) {
TabHaobanWxEnterprise enterprise = new TabHaobanWxEnterprise();
enterprise.setWxEnterpriseId(wxEnterpriseId);
enterprise.setStatusFlag(0);
return this.mapper.updateByPrimaryKeySelective(enterprise);
}
}
......@@ -7,6 +7,7 @@ import com.gic.haoban.manage.api.service.WxApplicationApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseApiService;
import com.gic.haoban.manage.service.entity.TabHaobanWxApplication;
import com.gic.haoban.manage.service.service.WxApplicationService;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -23,6 +24,8 @@ public class WxApplicationApiServiceImpl implements WxApplicationApiService{
private WxApplicationService wxApplicationService;
@Autowired
private WxEnterpriseApiService wxEnterpriseApiService;
@Autowired
private WxEnterpriseService wxEnterpriseService;
@Override
public void addSuite(WxApplicationDTO dto) {
......@@ -36,6 +39,10 @@ public class WxApplicationApiServiceImpl implements WxApplicationApiService{
if(enterprise != null){
int i = this.wxApplicationService.cancalWxApplication(enterprise.getWxEnterpriseId(), suiteId);
log.info("取消授权结果:{}", i);
TabHaobanWxApplication wxApplication = this.wxApplicationService.selectByWxEnterpriseIdAndApplicationType(enterprise.getWxEnterpriseId(), 2);
if(wxApplication == null){ //如果取消好办小程序应用授权,删除企业
this.wxEnterpriseService.delete(enterprise.getWxEnterpriseId());
}
}
log.info("企业未绑定过,{}", corpId);
}
......
......@@ -55,15 +55,20 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
public void callbackReviceEnterprise(QywxCorpInfoSimpleDTO dto) {
log.info("企业微信授权信息:{}", JSON.toJSONString(dto));
WxEnterpriseDTO wxDTO = EntityUtil.changeEntityByJSON(WxEnterpriseDTO.class, dto);
String wxEnterpriseId = wxEnterpriseService.add(wxDTO);
TabHaobanWxEnterprise enterprise = this.wxEnterpriseService.getDelEnterpriseBycorpId(dto.getCorpid());
String wxEnterpriseId = "";
if(enterprise != null){
wxEnterpriseId = enterprise.getWxEnterpriseId();
wxDTO.setWxEnterpriseId(enterprise.getWxEnterpriseId());
wxDTO.setStatusFlag(1);
wxEnterpriseService.update(wxDTO);
}
wxEnterpriseId = wxEnterpriseService.add(wxDTO);
String userId = dto.getUserid();
String name = dto.getName();
if(StringUtils.isNotBlank(userId)) {
staffApiService.wxGetAdd(userId,wxEnterpriseId);
}
String siteId = dto.getSuiteId();
String agentId = dto.getAgentid();
String agentName = dto.getAgentName();
......
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