Commit a87b3f2f by 墨竹

fix:新增活码增加判断

parent a6bb8753
......@@ -130,7 +130,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
hmQrcodeQDTO.setHmGroupId(0L);
}
List<String> clerkIdList = setStoreClerk(hmQrcodeQDTO, wxEnterpriseId, hmId, hmType);
List<String> clerkIdList = setStoreClerk(hmQrcodeQDTO, wxEnterpriseId, hmId, hmType,true);
if (CollectionUtils.isEmpty(clerkIdList)) {
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_8.getCode()), "该导购已经生成过活码或未关联过好办");
}
......@@ -236,7 +236,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_8.getCode()), "该活码不存在");
}
Integer hmType = hmQrcodeQDTO.getHmType();
List<String> clerkIdList = setStoreClerk(hmQrcodeQDTO, wxEnterpriseId, hmId, hmType);
List<String> clerkIdList = setStoreClerk(hmQrcodeQDTO, wxEnterpriseId, hmId, hmType,false);
if (CollectionUtils.isEmpty(clerkIdList)) {
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_8.getCode()), "该导购已经生成过活码或未关联过好办");
}
......@@ -376,14 +376,14 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
* @param hmType
* @return
*/
private List<String> setStoreClerk(HmQrcodeQDTO hmQrcodeQDTO, String wxEnterpriseId, Long hmId, Integer hmType) {
private List<String> setStoreClerk(HmQrcodeQDTO hmQrcodeQDTO, String wxEnterpriseId, Long hmId, Integer hmType,Boolean addFlag) {
List<String> clerkIdList = hmQrcodeQDTO.getClerkIdList();
if (CollectionUtils.isEmpty(clerkIdList)) {
return null;
}
if (hmType == 2) {
//多人活码
insertHmClerkRelation(hmQrcodeQDTO, wxEnterpriseId, hmId, clerkIdList);
insertHmClerkRelation(hmQrcodeQDTO, wxEnterpriseId, hmId, clerkIdList,addFlag);
}
//单人活码
String clerkId = clerkIdList.get(0);
......@@ -401,8 +401,8 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
}
}
HmQrcodeBO hmQrcodeBO = hmQrcodeService.queryByClerkId(clerkId, wxEnterpriseId);
if (hmQrcodeBO != null) {
logger.error("已经生成过活码,clerkId:{}",clerkId);
if (addFlag && hmQrcodeBO != null) {
logger.error("已经生成过活码,clerkId:{}", clerkId);
return null;
}
StaffClerkRelationDTO staffClerkRelationDTO = staffClerkRelationService.getByClerkId(clerkId);
......@@ -425,15 +425,16 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
* @param hmId
* @param clerkIdList
*/
private void insertHmClerkRelation(HmQrcodeQDTO hmQrcodeQDTO, String wxEnterpriseId, Long hmId, List<String> clerkIdList) {
private void insertHmClerkRelation(HmQrcodeQDTO hmQrcodeQDTO, String wxEnterpriseId, Long hmId, List<String> clerkIdList,Boolean addFlag) {
List<HmClerkRelationQDTO> clerkRelationQDTOS = new ArrayList<>();
Date now = new Date();
for (String clerkId : clerkIdList) {
HmClerkRelationBO hmClerkRelationBO = hmClerkRelationService.queryByHmIdAndClerkId(hmId, clerkId);
if (hmClerkRelationBO != null) {
logger.error("该导购已经在该多人活码中,clerkId:{}",clerkId);
if (addFlag && hmClerkRelationBO != null) {
logger.error("该导购已经在该多人活码中,clerkId:{}", clerkId);
continue;
}
StaffClerkRelationDTO clerkRelationDTO = staffClerkRelationService.getByClerkId(clerkId);
HmClerkRelationQDTO hmClerkRelationQDTO = new HmClerkRelationQDTO();
hmClerkRelationQDTO.setRelationId(UniqueIdUtils.uniqueLong());
......
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