Commit efb404ac by 墨竹

fix:转换修改

parent 591379c6
...@@ -199,7 +199,7 @@ public interface ExternalClerkRelatedApiService { ...@@ -199,7 +199,7 @@ public interface ExternalClerkRelatedApiService {
* @author mozhu * @author mozhu
* @date 2021-12-13 15:37:57 * @date 2021-12-13 15:37:57
*/ */
boolean updateNewExternalUserid(String wxEnterpriseId); ServiceResponse updateNewExternalUserid(String wxEnterpriseId);
/** /**
* 获取导购的好有数 * 获取导购的好有数
......
package com.gic.haoban.manage.web.controller; package com.gic.haoban.manage.web.controller;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import com.gic.haoban.app.customer.service.api.service.QywxTagSyncApiService;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.service.ExternalClerkRelatedApiService;
import com.gic.haoban.task.manage.api.service.GroupSendOperateApiService;
import com.gic.wechat.api.service.qywx.QywxUserApiService;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.commons.util.GlobalVar; import com.gic.commons.util.GlobalVar;
import com.gic.enterprise.api.dto.EnterpriseDTO; 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.EnterpriseService;
import com.gic.enterprise.api.service.StoreService; import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.app.customer.service.api.service.QywxTagSyncApiService;
import com.gic.haoban.base.api.common.BasePageInfo; import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.base.api.common.PageResult; import com.gic.haoban.base.api.common.PageResult;
import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.common.utils.EntityUtil; import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.common.utils.HaobanResponse; import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.common.utils.UuidUtil; import com.gic.haoban.common.utils.UuidUtil;
import com.gic.haoban.manage.api.dto.DepartmentDTO; import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.api.dto.EnterpriseDetailDTO; import com.gic.haoban.manage.api.dto.EnterpriseDetailDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.dto.YwWxEnterpriseDTO; import com.gic.haoban.manage.api.dto.YwWxEnterpriseDTO;
import com.gic.haoban.manage.api.service.DepartmentApiService; import com.gic.haoban.manage.api.service.DepartmentApiService;
import com.gic.haoban.manage.api.service.ExternalClerkRelatedApiService;
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;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode; import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.vo.EnterpriseDetailVo; import com.gic.haoban.manage.web.vo.EnterpriseDetailVo;
import com.gic.haoban.task.manage.api.service.GroupSendOperateApiService;
import com.gic.redis.data.util.RedisUtil; import com.gic.redis.data.util.RedisUtil;
import com.gic.wechat.api.service.qywx.QywxUserApiService;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
@RestController @RestController
public class EnterpriseController extends WebBaseController { public class EnterpriseController extends WebBaseController {
...@@ -384,11 +382,13 @@ public class EnterpriseController extends WebBaseController { ...@@ -384,11 +382,13 @@ public class EnterpriseController extends WebBaseController {
*/ */
@RequestMapping("/updateNewExternalUserid") @RequestMapping("/updateNewExternalUserid")
public HaobanResponse updateNewExternalUserid(String wxEnterpriseId) { public HaobanResponse updateNewExternalUserid(String wxEnterpriseId) {
boolean flag = externalClerkRelatedApiService.updateNewExternalUserid(wxEnterpriseId); ServiceResponse serviceResponse = externalClerkRelatedApiService.updateNewExternalUserid(wxEnterpriseId);
if (flag) { int code = serviceResponse.getCode();
if (HaoBanErrCode.ERR_1.getCode() == code) {
return resultResponse(HaoBanErrCode.ERR_1); return resultResponse(HaoBanErrCode.ERR_1);
} else { } else {
return resultResponse(HaoBanErrCode.ERR_0); String message = serviceResponse.getMessage();
return resultResponse(HaoBanErrCode.ERR_0, message);
} }
} }
......
...@@ -11,6 +11,7 @@ import com.gic.haoban.app.customer.enums.GicQywxSyncTypeEnum; ...@@ -11,6 +11,7 @@ import com.gic.haoban.app.customer.enums.GicQywxSyncTypeEnum;
import com.gic.haoban.app.customer.enums.QywxSyncTaskTypeEnum; import com.gic.haoban.app.customer.enums.QywxSyncTaskTypeEnum;
import com.gic.haoban.base.api.common.BasePageInfo; import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.base.api.common.ServiceResponse; import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.base.api.common.errCode.HaoBanErrCodeCommon;
import com.gic.haoban.common.utils.PageUtil; import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.manage.api.dto.AlertMessageDTO; import com.gic.haoban.manage.api.dto.AlertMessageDTO;
import com.gic.haoban.manage.api.dto.ClerkStaffWxUserDTO; import com.gic.haoban.manage.api.dto.ClerkStaffWxUserDTO;
...@@ -349,28 +350,38 @@ public class ExternalClerkRelatedApiServiceImpl implements ExternalClerkRelatedA ...@@ -349,28 +350,38 @@ public class ExternalClerkRelatedApiServiceImpl implements ExternalClerkRelatedA
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public boolean updateNewExternalUserid(String wxEnterpriseId) { public ServiceResponse updateNewExternalUserid(String wxEnterpriseId) {
log.info("企业外部联系人id start,wxEnterpriseId:{}", wxEnterpriseId); log.info("企业外部联系人id start,wxEnterpriseId:{}", wxEnterpriseId);
TabHaobanWxEnterprise tabHaobanWxEnterprise = wxEnterriseMapper.selectByPrimaryKey(wxEnterpriseId); TabHaobanWxEnterprise tabHaobanWxEnterprise = wxEnterriseMapper.selectByPrimaryKey(wxEnterpriseId);
ServiceResponse serviceResponse = new ServiceResponse();
if (tabHaobanWxEnterprise == null) { if (tabHaobanWxEnterprise == null) {
log.info("企业外部联系人id为空"); log.info("企业外部联系人id为空");
return false; serviceResponse.setCode(HaoBanErrCodeCommon.ERR_0.getCode());
serviceResponse.setMessage("企业外部联系人id为空");
return serviceResponse;
} }
String lockKey = "updateNewExternalUserid_" + wxEnterpriseId; String lockKey = "updateNewExternalUserid_" + wxEnterpriseId;
if (RedisUtil.isLocked(lockKey)) { if (RedisUtil.isLocked(lockKey)) {
log.info("redis锁,lockKey:{}", lockKey); log.info("redis锁,lockKey:{}", lockKey);
return false; String corpName = tabHaobanWxEnterprise.getCorpName();
serviceResponse.setCode(HaoBanErrCodeCommon.ERR_0.getCode());
serviceResponse.setMessage(corpName + "已经在转换中,请勿重复操作!");
return serviceResponse;
} }
RedisUtil.lock(lockKey, 1L, TimeUnit.DAYS, 0L); RedisUtil.lock(lockKey, 1L, TimeUnit.DAYS, 0L);
try { try {
updateNewExUserId(tabHaobanWxEnterprise.getWxEnterpriseId(), tabHaobanWxEnterprise.getCorpid()); updateNewExUserId(tabHaobanWxEnterprise.getWxEnterpriseId(), tabHaobanWxEnterprise.getCorpid());
log.info("企业外部联系人id end,wxEnterpriseId:{}", wxEnterpriseId); log.info("企业外部联系人id end,wxEnterpriseId:{}", wxEnterpriseId);
RedisUtil.unlock(lockKey); RedisUtil.unlock(lockKey);
return true; serviceResponse.setCode(HaoBanErrCodeCommon.ERR_1.getCode());
serviceResponse.setMessage(HaoBanErrCodeCommon.ERR_1.getMsg());
return serviceResponse;
} catch (Exception e) { } catch (Exception e) {
log.info("企业外部联系人id异常,wxEnterpriseId:{},{}", wxEnterpriseId, e.getMessage(), e); log.info("企业外部联系人id异常,wxEnterpriseId:{},{}", wxEnterpriseId, e.getMessage(), e);
RedisUtil.unlock(lockKey); RedisUtil.unlock(lockKey);
return false; serviceResponse.setCode(HaoBanErrCodeCommon.ERR_0.getCode());
serviceResponse.setMessage("企业外部联系人id转换异常,请联系技术人员查看");
return serviceResponse;
} }
} }
......
...@@ -426,6 +426,7 @@ ...@@ -426,6 +426,7 @@
wx_user_id wx_user_id
from tab_haoban_staff from tab_haoban_staff
where status_flag = 1 where status_flag = 1
and wx_user_id is not null
and wx_enterprise_id = #{wxEnterpriseId} and wx_enterprise_id = #{wxEnterpriseId}
</select> </select>
......
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