修改线索逻辑

master
bynt 5 months ago
parent 281a169db8
commit 6e11ff7ebe

@ -68,12 +68,12 @@ public interface ClueService extends ExtendService<ClueEntity> {
/**
* id
* @param companyId
* @param assignedBy
* @param phone
* @return
*
*/
List<ClueEntity> findByCompanyIdAndNid(Long companyId, String phone);
Long findByAssignedByIdAndNid(Long assignedBy, String phone);
/**
* id

@ -254,9 +254,9 @@ public class ClueServiceImpl extends ExtendServiceImpl<ClueMapper, ClueEntity> i
}
@Override
public List<ClueEntity> findByCompanyIdAndNid(Long companyId, String phone) {
return baseMapper.selectList(Wrappers.lambdaQuery(ClueEntity.class).eq
(ClueEntity::getCompanyId, companyId).eq(ClueEntity::getNid, phone).eq
public Long findByAssignedByIdAndNid(Long assignedById, String phone) {
return baseMapper.selectCount(Wrappers.lambdaQuery(ClueEntity.class).eq
(ClueEntity::getAssignedBy, assignedById).eq(ClueEntity::getNid, phone).eq
(ClueEntity::getDeleted,DefaultNumberConstants.ZERO_NUMBER));
}

@ -185,10 +185,7 @@ public class CustomServiceImpl extends ExtendServiceImpl<CustomMapper, CustomEnt
if (ObjectUtil.isNotNull(customEntity) || customEntity.getEnrollStatus() != DefaultNumberConstants.TWO_NUMBER) {
String phone = AESUtils.encrypt(customEntity.getCustomNid(), securityProperties.getPasswordSecretKey());
Long companyId = customEntity.getCompanyId();
List<ClueEntity> clueEntityList = clueService.findByCompanyIdAndNid(companyId, phone);
if (CollUtil.isNotEmpty(clueEntityList)) {
throw new BadRequestException("该资源已分发,请勿重复操作!");
}
if (status == 0) {
Gson gson = new Gson();
AddressDTO address = new AddressDTO();
@ -201,13 +198,17 @@ public class CustomServiceImpl extends ExtendServiceImpl<CustomMapper, CustomEnt
Long clueId = IdUtil.getSnowflake(workerId, datacenterId).nextId();
StoreUserDTO entity = storeUserService.findUserIdByStoreId(store.getStoreId());
if (ObjectUtil.isNotNull(entity) && ObjectUtil.isNotNull(entity.getUserId())) {
Long countResult = clueService.findByAssignedByIdAndNid(entity.getUserId(), phone);
if (ObjectUtil.isNotNull(countResult) && countResult > DefaultNumberConstants.ZERO_NUMBER) {
throw new BadRequestException("该资源已分发,请勿重复操作!");
}
String username = sysUserService.findById(entity.getUserId()).getUsername();
// 扣减余额
Boolean result = sysUserService.deductionQuantity(entity.getUserId(), entity.getStoreName());
if (Boolean.TRUE.equals(result)) {
ClueDTO clueDTO = new ClueDTO(clueId, customEntity.getChannelName(), phone, customEntity.getRemark(),
otherClue, entity.getUserId(), username, currentUserId, Boolean.TRUE, companyId, customEntity.getSex(),
customEntity.getCustomInformation(), customEntity.getChannelIdentifying(), customEntity.getChannelType(), dto.getCustomId());
customEntity.getCustomInformation(), customEntity.getChannelIdentifying(), customEntity.getChannelType(), dto.getCustomId());
list.add(clueDTO);
}
}
@ -339,7 +340,10 @@ public class CustomServiceImpl extends ExtendServiceImpl<CustomMapper, CustomEnt
Boolean result = sysUserService.addQuantity(vo.getAssignedBy());
if (result.equals(Boolean.TRUE)) {
// 删除线索
clueService.removeById(Long.parseLong(vo.getClueId()));
boolean removed = clueService.removeById(Long.parseLong(vo.getClueId()));
if (Boolean.FALSE.equals(removed)) {
throw new BadRequestException("撤回线索失败!");
}
}
}
// 修改状态

Loading…
Cancel
Save