Commit 7653fa9f by 墨竹

fix:活码

parent 562e8468
......@@ -22,7 +22,7 @@ public interface HmQrcodeApiService {
* @author mozhu
* @date 2022-07-05 10:59:08
*/
int add(HmQrcodeQDTO hmQrcodeQDTO);
ServiceResponse add(HmQrcodeQDTO hmQrcodeQDTO);
/**
* 更新
......
......@@ -642,13 +642,15 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
* @return
*/
private String getRefId(String state) {
String substring = state.substring(2);
String id = state.substring(2);
String refId = "";
if (state.contains("HM")) {
refId = substring;
refId = id;
} else if (state.contains("DT")) {
KeyDataLinkBO dataForHmLink = keyDataService.getDataForHmLink(refId);
refId = Convert.toStr(dataForHmLink.getLinkId());
KeyDataLinkBO dataForHmLink = keyDataService.getDataForHmLink(id);
if (dataForHmLink != null) {
refId = Convert.toStr(dataForHmLink.getLinkId());
}
}
return refId;
}
......
package com.gic.haoban.manage.service.service.out.impl.hm;
import cn.hutool.core.convert.Convert;
import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.clerk.api.dto.ClerkDTO;
......@@ -88,8 +89,6 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
@Autowired
private StaffService staffService;
@Autowired
private HmGroupService groupService;
@Autowired
private WelcomeRelationService welcomeRelationService;
@Autowired
private HmGroupService hmGroupService;
......@@ -106,12 +105,12 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
afterFunc = LogRecordAfterServiceImpl.class)
@Override
@Transactional(rollbackFor = Exception.class)
public int add(HmQrcodeQDTO hmQrcodeQDTO) {
public ServiceResponse add(HmQrcodeQDTO hmQrcodeQDTO) {
String wxEnterpriseId = hmQrcodeQDTO.getWxEnterpriseId();
WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseService.selectById(wxEnterpriseId);
if (wxEnterpriseDTO == null) {
logger.error("未查询到微信企业");
return HaoBanErrCodeCommon.ERR_8.getCode();
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_8.getCode()),"微信企业不存在");
}
hmQrcodeQDTO.setHmId(UniqueIdUtils.uniqueLong());
......@@ -124,7 +123,9 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
}
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());
......@@ -133,6 +134,9 @@ 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);
logger.info("新增活码参数:{}", JSON.toJSONString(qywxExternalcontactDTO));
QywxExternalcontactResultDTO qywxExternalcontactResultDTO = qywxUserApiService.addContactWay(wxEnterpriseDTO.getCorpid(), config.getWxSuiteid(), qywxExternalcontactDTO);
......@@ -147,7 +151,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
}
setLoggerContext(hmQrcodeQDTO.getEnterpriseId(), wxEnterpriseId, hmQrcodeQDTO.getCreatorId(), hmQrcodeQDTO.getCreatorName());
GicLogRecordEvaluationContext.putAttribute("logContent", "【" + hmId + "-" + hmQrcodeQDTO.getName() + "】");
return saveResult;
return ServiceResponse.success();
}
/**
......
......@@ -45,7 +45,7 @@ public class ServiceTest {
hmQrcodeQDTO.setEnterpriseId("ff8080815dacd3a2015dacd3ef5c0000");
hmQrcodeQDTO.setName("徐高华");
hmQrcodeQDTO.setPassFlag(1);
hmQrcodeQDTO.setStoreId("ff1307040a7748699cf3109615fb24d7");
hmQrcodeQDTO.setStoreId("ff8080816ad96137016ad97c87580000");
hmQrcodeQDTO.setClerkIdList(Collections.singletonList("ff1307040a7748699cf3109615fb24d7"));
hmQrcodeApiService.add(hmQrcodeQDTO);
}
......
......@@ -57,37 +57,38 @@ public class HmQrcodeController {
/**
* 新增
* @param HmQrcodeQDTO
* @param hmQrcodeQDTO
* @return
*/
@RequestMapping(value = "add", method = RequestMethod.POST)
public RestResponse add(@RequestBody HmQrcodeQDTO HmQrcodeQDTO) {
public RestResponse add(@RequestBody HmQrcodeQDTO hmQrcodeQDTO) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
HmQrcodeQDTO.setCreatorId(loginUser.getClerkId());
HmQrcodeQDTO.setCreatorName(loginUser.getClerkName());
HmQrcodeQDTO.setModifierId(loginUser.getClerkId());
HmQrcodeQDTO.setModifierName(loginUser.getClerkName());
HmQrcodeQDTO.setWxEnterpriseId(loginUser.getWxEnterpriseId());
HmQrcodeQDTO.setEnterpriseId(loginUser.getEnterpriseId());
this.hmQrcodeApiService.add(HmQrcodeQDTO);
hmQrcodeQDTO.setCreatorId(loginUser.getClerkId());
hmQrcodeQDTO.setCreatorName(loginUser.getClerkName());
hmQrcodeQDTO.setModifierId(loginUser.getClerkId());
hmQrcodeQDTO.setModifierName(loginUser.getClerkName());
hmQrcodeQDTO.setWxEnterpriseId(loginUser.getWxEnterpriseId());
hmQrcodeQDTO.setEnterpriseId(loginUser.getEnterpriseId());
ServiceResponse serviceResponse = this.hmQrcodeApiService.add(hmQrcodeQDTO);
if (!"0000".equals(serviceResponse.getCode())) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_0.getCode()),serviceResponse.getMessage());
}
return RestResponse.successResult();
}
/**
* 修改
* @param HmQrcodeQDTO
* @param hmQrcodeQDTO
* @return
*/
@RequestMapping(value = "update", method = RequestMethod.POST)
public RestResponse update(@RequestBody HmQrcodeQDTO HmQrcodeQDTO) {
public RestResponse update(@RequestBody HmQrcodeQDTO hmQrcodeQDTO) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
HmQrcodeQDTO.setCreatorId(loginUser.getClerkId());
HmQrcodeQDTO.setCreatorName(loginUser.getClerkName());
HmQrcodeQDTO.setModifierId(loginUser.getClerkId());
HmQrcodeQDTO.setModifierName(loginUser.getClerkName());
HmQrcodeQDTO.setWxEnterpriseId(loginUser.getWxEnterpriseId());
HmQrcodeQDTO.setEnterpriseId(loginUser.getEnterpriseId());
this.hmQrcodeApiService.update(HmQrcodeQDTO);
hmQrcodeQDTO.setModifierId(loginUser.getClerkId());
hmQrcodeQDTO.setModifierName(loginUser.getClerkName());
hmQrcodeQDTO.setWxEnterpriseId(loginUser.getWxEnterpriseId());
hmQrcodeQDTO.setEnterpriseId(loginUser.getEnterpriseId());
this.hmQrcodeApiService.update(hmQrcodeQDTO);
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