Commit cf5a5158 by guojx

Merge remote-tracking branch 'origin/developer' into developer

parents d7977023 91143804
......@@ -90,6 +90,8 @@ public class HmQrcodeDTO implements Serializable {
*/
private Long hmGroupId;
private String memberLabelName;
private String hmGroupName;
public Long getHmId() {
return hmId;
......@@ -323,5 +325,20 @@ public class HmQrcodeDTO implements Serializable {
this.hmGroupId = hmGroupId;
}
public String getMemberLabelName() {
return memberLabelName;
}
public void setMemberLabelName(String memberLabelName) {
this.memberLabelName = memberLabelName;
}
public String getHmGroupName() {
return hmGroupName;
}
public void setHmGroupName(String hmGroupName) {
this.hmGroupName = hmGroupName;
}
}
......@@ -24,6 +24,17 @@ public interface HmQrcodeApiService {
*/
ServiceResponse add(HmQrcodeQDTO hmQrcodeQDTO);
/**
* 批量创建单人码
*
* @param hmQrcodeQDTO hm qrcode qdto
* @return {@link ServiceResponse }
* @author mozhu
* @date 2022-07-15 13:48:15
*/
ServiceResponse addList(HmQrcodeQDTO hmQrcodeQDTO);
/**
* 更新
*
......
......@@ -91,7 +91,8 @@ public class HmQrcodeBO implements Serializable {
private Long hmGroupId;
private String staffId;
private String staffName;
private String memberLabelName;
private String hmGroupName;
public Long getHmId() {
return hmId;
......@@ -340,5 +341,21 @@ public class HmQrcodeBO implements Serializable {
public void setStaffName(String staffName) {
this.staffName = staffName;
}
public String getMemberLabelName() {
return memberLabelName;
}
public void setMemberLabelName(String memberLabelName) {
this.memberLabelName = memberLabelName;
}
public String getHmGroupName() {
return hmGroupName;
}
public void setHmGroupName(String hmGroupName) {
this.hmGroupName = hmGroupName;
}
}
......@@ -21,6 +21,7 @@ import com.gic.haoban.manage.api.enums.hm.HmWelcomeReferType;
import com.gic.haoban.manage.api.service.hm.HmQrcodeApiService;
import com.gic.haoban.manage.service.config.Config;
import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise;
import com.gic.haoban.manage.service.pojo.bo.hm.HmClerkRelationBO;
import com.gic.haoban.manage.service.pojo.bo.hm.HmGroupSettingBO;
......@@ -61,6 +62,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
* @author mozhu
......@@ -144,10 +146,11 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
qywxExternalcontactDTO.setUser(userIds);
logger.info("新增活码参数:{}", JSON.toJSONString(qywxExternalcontactDTO));
QywxExternalcontactResultDTO qywxExternalcontactResultDTO = qywxUserApiService.addContactWay(wxEnterpriseDTO.getCorpid(), config.getWxSuiteid(), qywxExternalcontactDTO);
if (qywxExternalcontactResultDTO != null && "0".equals(qywxExternalcontactResultDTO.getErrcode())) {
if (qywxExternalcontactResultDTO.getErrcode() != 0) {
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_0.getCode()),"创建活码失败:"+qywxExternalcontactResultDTO.getErrmsg());
}
hmQrcodeQDTO.setWxQrcode(qywxExternalcontactResultDTO.getQr_code());
hmQrcodeQDTO.setWxConfigId(qywxExternalcontactResultDTO.getConfig_id());
}
int saveResult = hmQrcodeService.insert(hmQrcodeQDTO);
if (saveResult == 1) {
// save welcome relation
......@@ -158,6 +161,29 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
return ServiceResponse.success();
}
@Override
public ServiceResponse addList(HmQrcodeQDTO hmQrcodeQDTO) {
String wxEnterpriseId = hmQrcodeQDTO.getWxEnterpriseId();
WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseService.selectById(wxEnterpriseId);
if (wxEnterpriseDTO == null) {
logger.error("未查询到微信企业");
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_8.getCode()),"微信企业不存在");
}
List<String> clerkIdList = hmQrcodeQDTO.getClerkIdList();
if (CollectionUtils.isEmpty(clerkIdList)) {
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_5.getCode()),"导购不允许为空");
}
if (clerkIdList.contains("-1")) {
List<TabHaobanStaffClerkRelation> tabHaobanStaffClerkRelations = staffClerkRelationService.listByWxEnterpriseId(wxEnterpriseId);
clerkIdList = tabHaobanStaffClerkRelations.stream().map(TabHaobanStaffClerkRelation::getClerkId).collect(Collectors.toList());
}
for (String clerkId : clerkIdList) {
hmQrcodeQDTO.setClerkIdList(Collections.singletonList(clerkId));
add(hmQrcodeQDTO);
}
return ServiceResponse.success();
}
/**
* 设置日志记录器上下文
* 日志
......@@ -410,7 +436,18 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
@Override
public HmQrcodeDTO queryById(Long hmId) {
return EntityUtil.changeEntityNew(HmQrcodeDTO.class, hmQrcodeService.queryById(hmId));
HmQrcodeBO hmQrcodeBO = hmQrcodeService.queryById(hmId);
if (hmQrcodeBO != null) {
HmGroupSettingBO hmGroupSettingBO = hmGroupService.queryGroupSettingDetail(hmQrcodeBO.getHmGroupId());
if (hmGroupSettingBO != null) {
hmQrcodeBO.setHmGroupName(hmGroupSettingBO.getGroupName());
}
MemberTagDTO memberTagDTO = memberTagApiService.getMemberTagById( hmQrcodeBO.getMemberLabelId());
if (memberTagDTO != null) {
hmQrcodeBO.setMemberLabelName(memberTagDTO.getTagName());
}
}
return EntityUtil.changeEntityNew(HmQrcodeDTO.class, hmQrcodeBO);
}
@GicLogRecord(value = "废弃员工活码-${#logContent}",
......
......@@ -76,6 +76,22 @@ public class HmQrcodeController {
return RestResponse.successResult();
}
@RequestMapping(value = "addList", method = RequestMethod.POST)
public RestResponse addList(@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());
ServiceResponse serviceResponse = this.hmQrcodeApiService.addList(hmQrcodeQDTO);
if (!"0000".equals(serviceResponse.getCode())) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_0.getCode()),serviceResponse.getMessage());
}
return RestResponse.successResult();
}
/**
* 修改
* @param hmQrcodeQDTO
......
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