Commit 7653fa9f by 墨竹

fix:活码

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