|
|
@@ -1,19 +1,18 @@ |
|
|
|
package com.tuoheng.api.service.impl; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.tuoheng.api.entity.domain.Tenant; |
|
|
|
import com.tuoheng.api.entity.domain.User; |
|
|
|
import com.tuoheng.api.entity.domain.WestreamActivityApply; |
|
|
|
import com.tuoheng.api.constants.DictConstants; |
|
|
|
import com.tuoheng.api.entity.domain.*; |
|
|
|
import com.tuoheng.api.entity.request.WestreamActivityQuery; |
|
|
|
import com.tuoheng.api.mapper.TenantMapper; |
|
|
|
import com.tuoheng.api.mapper.UserMapper; |
|
|
|
import com.tuoheng.api.mapper.WestreamActivityApplyMapper; |
|
|
|
import com.tuoheng.api.mapper.*; |
|
|
|
import com.tuoheng.api.service.IWestreamActivityApplyService; |
|
|
|
import com.tuoheng.api.service.TextMessageService; |
|
|
|
import com.tuoheng.common.common.BaseServiceImpl; |
|
|
|
import com.tuoheng.common.utils.JsonResult; |
|
|
|
import com.tuoheng.common.utils.StringUtils; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
@@ -22,14 +21,15 @@ import java.util.List; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
@Service |
|
|
|
@Slf4j |
|
|
|
public class WestreamActivityApplyServiceImpl extends BaseServiceImpl<WestreamActivityApplyMapper, WestreamActivityApply> implements IWestreamActivityApplyService { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WestreamActivityApplyMapper westreamActivityApplyMapper; |
|
|
|
@Autowired |
|
|
|
private TenantMapper tenantMapper; |
|
|
|
private ThDictMapper thDictMapper; |
|
|
|
@Autowired |
|
|
|
private UserMapper userMapper; |
|
|
|
private ThDictDataMapper thDictDataMapper; |
|
|
|
@Autowired |
|
|
|
private TextMessageService textMessageService; |
|
|
|
|
|
|
@@ -55,15 +55,25 @@ public class WestreamActivityApplyServiceImpl extends BaseServiceImpl<WestreamAc |
|
|
|
} |
|
|
|
super.add(entity); |
|
|
|
//向对应的审批人发送短信,获取手机号 |
|
|
|
// Tenant tenant = tenantMapper.selectById(entity.getTenantId()); |
|
|
|
// User user = userMapper.selectOne(Wrappers.<User>lambdaQuery().eq(User::getUsername, tenant.getUsername()).eq(User::getMark, 1)); |
|
|
|
// String mobile = user.getMobile(); |
|
|
|
// if (StringUtils.isNotEmpty(mobile)) { |
|
|
|
// List<String> list = Arrays.stream(mobile.split(",")).collect(Collectors.toList()); |
|
|
|
// //发送短信 |
|
|
|
// textMessageService.sendMessage(list); |
|
|
|
// } |
|
|
|
|
|
|
|
ThDict thDict = thDictMapper.selectOne(new LambdaQueryWrapper<ThDict>() |
|
|
|
.eq(ThDict::getTenantId, entity.getTenantId()) |
|
|
|
.eq(ThDict::getMark, 1) |
|
|
|
.eq(ThDict::getCode, DictConstants.MSG_RULE_CODE)); |
|
|
|
if (ObjectUtils.isNotNull(thDict)) { |
|
|
|
Integer dictId = thDict.getId(); |
|
|
|
ThDictData phoneData = thDictDataMapper.selectOne(new LambdaQueryWrapper<ThDictData>() |
|
|
|
.eq(ThDictData::getMark, 1) |
|
|
|
.eq(ThDictData::getDictId, dictId) |
|
|
|
.eq(ThDictData::getName, DictConstants.MSG_RULE_PHONE)); |
|
|
|
if (ObjectUtils.isNotNull(phoneData)) { |
|
|
|
String phones = phoneData.getValue(); |
|
|
|
List<String> list = Arrays.stream(phones.split(",")).collect(Collectors.toList()); |
|
|
|
Integer success = textMessageService.sendMessage(list); |
|
|
|
if (success.equals(list.size())) { |
|
|
|
log.info("短信全部发送成功!"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return JsonResult.success(); |
|
|
|
} |
|
|
|
|