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