Commit ff06fcb9 by 墨竹

fix:活码

parent dcf9ca26
......@@ -32,7 +32,7 @@ public interface HmQrcodeApiService {
* @author mozhu
* @date 2022-07-05 10:59:06
*/
int update(HmQrcodeQDTO hmQrcodeQDTO);
ServiceResponse update(HmQrcodeQDTO hmQrcodeQDTO);
/**
* 查询详情
......
......@@ -193,18 +193,20 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
afterFunc = LogRecordAfterServiceImpl.class)
@Override
@Transactional(rollbackFor = Exception.class)
public int update(HmQrcodeQDTO hmQrcodeQDTO) {
public ServiceResponse update(HmQrcodeQDTO hmQrcodeQDTO) {
String wxEnterpriseId = hmQrcodeQDTO.getWxEnterpriseId();
WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseService.selectById(wxEnterpriseId);
if (wxEnterpriseDTO == null) {
logger.error("未查询到微信企业");
return 0;
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_8.getCode()),"微信企业不存在");
}
Long hmId = hmQrcodeQDTO.getHmId();
Integer hmType = hmQrcodeQDTO.getHmType();
List<String> clerkIdList = setStoreClerk(hmQrcodeQDTO, wxEnterpriseId, hmId, hmType);
if (CollectionUtils.isEmpty(clerkIdList)) {
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_8.getCode()),"该导购已经生成过活码或未关联过好办");
}
//更新活码
QywxExternalcontactDTO qywxExternalcontactDTO = new QywxExternalcontactDTO();
qywxExternalcontactDTO.setType(hmQrcodeQDTO.getHmType());
......@@ -213,11 +215,14 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
qywxExternalcontactDTO.setSkipVerify(hmQrcodeQDTO.getPassFlag() == 1);
qywxExternalcontactDTO.setState("HM" + hmId);
List<String> userIds = staffClerkRelationService.listWxUserIdByClerkIds(clerkIdList, wxEnterpriseId);
if (CollectionUtils.isEmpty(userIds)) {
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_8.getCode()),"导购未关联好办");
}
qywxExternalcontactDTO.setUser(userIds);
boolean flag = qywxUserApiService.updateContactWay(wxEnterpriseDTO.getCorpid(), config.getWxSuiteid(), qywxExternalcontactDTO);
if (!flag) {
logger.error("更新企微活码失败");
return 0;
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_0.getCode()),"更新企微活码失败");
}
int updateResult = hmQrcodeService.update(hmQrcodeQDTO);
......@@ -229,7 +234,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
setLoggerContext(hmQrcodeQDTO.getEnterpriseId(), wxEnterpriseId, hmQrcodeQDTO.getModifierId(), hmQrcodeQDTO.getModifierName());
updateSystemLog(hmQrcodeQDTO, hmId);
return updateResult;
return ServiceResponse.success();
}
/**
......
......@@ -88,7 +88,10 @@ public class HmQrcodeController {
hmQrcodeQDTO.setModifierName(loginUser.getClerkName());
hmQrcodeQDTO.setWxEnterpriseId(loginUser.getWxEnterpriseId());
hmQrcodeQDTO.setEnterpriseId(loginUser.getEnterpriseId());
this.hmQrcodeApiService.update(hmQrcodeQDTO);
ServiceResponse serviceResponse = this.hmQrcodeApiService.update(hmQrcodeQDTO);
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