Commit c34ba206 by 徐高华

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

parents 2118101a 088efd63
......@@ -53,7 +53,7 @@ public interface HmQrcodeApiService {
* @author mozhu
* @date 2022-07-06 13:40:27
*/
boolean delById(Long hmId);
ServiceResponse delById(Long hmId);
/**
* 导购解绑作废
......@@ -64,7 +64,7 @@ public interface HmQrcodeApiService {
* @author mozhu
* @date 2022-07-06 15:39:01
*/
boolean delByClerkId(String clerkId,String enterpriseId);
ServiceResponse delByClerkId(String clerkId,String enterpriseId);
/**
......
......@@ -380,18 +380,8 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
addFriendByWelcome(dto, staffClerkRelationDTO);
}
if (StringUtils.isNotBlank(memberId)) {
log.info("插入加好友日志");
wxUserAddLogQDTO.setWxEnterpriseId(wxEnterpriseId);
wxUserAddLogQDTO.setEnterpriseId(enterpriseId);
wxUserAddLogQDTO.setMemberId(memberId);
wxUserAddLogQDTO.setUnionid(unionid);
wxUserAddLogQDTO.setDelFlag(false);
wxUserAddLogQDTO.setExternalUserid(externalUserId);
wxUserAddLogQDTO.setWxUserId(wxUserId);
wxUserAddLogQDTO.setStaffId(staffId);
wxUserAddLogService.save(wxUserAddLogQDTO);
}
log.info("插入加好友日志");
wxUserAddLogService.updateMemberInfo(wxEnterpriseId,externalUserId,memberId);
}
/**
......
......@@ -44,6 +44,7 @@ import com.gic.log.record.util.GicLogRecordOptTypeEnum;
import com.gic.member.tag.api.dto.MemberTagDTO;
import com.gic.member.tag.api.service.MemberTagApiService;
import com.gic.redis.data.util.RedisUtil;
import com.gic.wechat.api.dto.qywx.response.QywxResponseDTO;
import com.gic.wechat.api.dto.qywx.welcome.QywxExternalcontactDTO;
import com.gic.wechat.api.dto.qywx.welcome.QywxExternalcontactResultDTO;
import com.gic.wechat.api.service.qywx.QywxUserApiService;
......@@ -209,10 +210,10 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_8.getCode()),"导购未关联好办");
}
qywxExternalcontactDTO.setUser(userIds);
boolean flag = qywxUserApiService.updateContactWay(wxEnterpriseDTO.getCorpid(), config.getWxSuiteid(), qywxExternalcontactDTO);
if (!flag) {
QywxResponseDTO qywxResponseDTO = qywxUserApiService.updateContactWay(wxEnterpriseDTO.getCorpid(), config.getWxSuiteid(), qywxExternalcontactDTO);
if (qywxResponseDTO.getErrcode() != 0) {
logger.error("更新企微活码失败");
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_0.getCode()),"更新企微活码失败");
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_0.getCode()),qywxResponseDTO.getErrmsg());
}
int updateResult = hmQrcodeService.update(hmQrcodeQDTO);
......@@ -324,7 +325,6 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
*/
private List<String> setStoreClerk(HmQrcodeQDTO hmQrcodeQDTO, String wxEnterpriseId, Long hmId, Integer hmType) {
List<String> clerkIdList = hmQrcodeQDTO.getClerkIdList();
if (hmType == 2) {
//多人活码
insertHmClerkRelation(hmQrcodeQDTO, wxEnterpriseId, hmId, clerkIdList);
......@@ -420,23 +420,29 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
afterFunc = LogRecordAfterServiceImpl.class)
@Override
@Transactional(rollbackFor = Exception.class)
public boolean delById(Long hmId) {
public ServiceResponse delById(Long hmId) {
HmQrcodeBO hmQrcodeBO = hmQrcodeService.queryById(hmId);
if (hmQrcodeBO == null) {
return false;
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_8.getCode()),"活码不存在");
}
String wxConfigId = hmQrcodeBO.getWxConfigId();
if (StringUtils.isBlank(wxConfigId)) {
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_8.getCode()),"活码未生成");
}
WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseService.selectById(hmQrcodeBO.getWxEnterpriseId());
boolean flag = qywxUserApiService.delContactWay(wxEnterpriseDTO.getCorpid(), config.getWxSuiteid(), hmQrcodeBO.getWxConfigId());
if (flag) {
hmQrcodeService.deleteById(hmId);
QywxResponseDTO qywxResponseDTO = qywxUserApiService.delContactWay(wxEnterpriseDTO.getCorpid(), config.getWxSuiteid(), wxConfigId);
int errcode = qywxResponseDTO.getErrcode();
if (errcode != 0) {
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_8.getCode()),qywxResponseDTO.getErrmsg());
}
hmQrcodeService.deleteById(hmId);
setLoggerContext(hmQrcodeBO.getEnterpriseId(), hmQrcodeBO.getWxEnterpriseId(), hmQrcodeBO.getModifierId(), hmQrcodeBO.getModifierName());
GicLogRecordEvaluationContext.putAttribute("logContent", "【" + hmId + "-" + hmQrcodeBO.getName() + "】");
return true;
return ServiceResponse.success();
}
@Override
public boolean delByClerkId(String clerkId, String enterpriseId) {
public ServiceResponse delByClerkId(String clerkId, String enterpriseId) {
// 单人活码 直接废弃,多人活码,更新
HmQrcodeBO hmQrcodeBO = hmQrcodeService.queryByClerkId(clerkId, enterpriseId);
if (hmQrcodeBO != null) {
......@@ -447,7 +453,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
List<HmClerkRelationBO> hmClerkRelationBOS = hmClerkRelationService.queryByClerkId(clerkId, enterpriseId);
if (CollectionUtils.isEmpty(hmClerkRelationBOS)) {
logger.info("无多人活码");
return true;
return ServiceResponse.success();
}
for (HmClerkRelationBO hmClerkRelationBO : hmClerkRelationBOS) {
Long hmId = hmClerkRelationBO.getHmId();
......@@ -459,7 +465,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
hmQrcodeQDTO.setClerkIdList(clerkIds);
update(hmQrcodeQDTO);
}
return true;
return ServiceResponse.success();
}
@Override
......@@ -518,7 +524,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
List<StaffClerkRelationDTO> staffClerkRelationDTOS = staffClerkRelationService.listIdsByWxOpenUserIds(wxUserIdsList, wxEnterpriseId);
if (CollectionUtils.isEmpty(staffClerkRelationDTOS)) {
logger.error("无导购关联数据");
return;
continue;
}
for (StaffClerkRelationDTO staffClerkRelationDTO : staffClerkRelationDTOS) {
//具有联系我功能的导购创建活码
......@@ -538,7 +544,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
List<StaffClerkRelationDTO> relationDTOS = staffClerkRelationService.listIdsByNotInWxOpenUserIds(wxUserIdsList, wxEnterpriseId);
if (CollectionUtils.isEmpty(relationDTOS)) {
logger.error("无导购不包含关联数据");
return;
continue;
}
for (StaffClerkRelationDTO relationDTO : relationDTOS) {
//有活码,但是企微联系我功能 被关闭
......
......@@ -133,7 +133,10 @@ public class HmQrcodeController {
*/
@RequestMapping(value = "del", method = RequestMethod.DELETE)
public RestResponse del(Long hmId) {
this.hmQrcodeApiService.delById(hmId);
ServiceResponse serviceResponse = this.hmQrcodeApiService.delById(hmId);
if (!"0000".equals(serviceResponse.getCode())) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_0.getCode()),serviceResponse.getMessage());
}
return RestResponse.successResult();
}
......
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