This commit is contained in:
parent
47d62ab66a
commit
8aa28b5ce9
|
|
@ -43,7 +43,7 @@ public class PmTask {
|
||||||
/**
|
/**
|
||||||
* 人员数量
|
* 人员数量
|
||||||
*/
|
*/
|
||||||
private String workerCount;
|
private Integer workerCount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 人员列表
|
* 人员列表
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,12 @@ import com.bonus.common.utils.DateUtils;
|
||||||
import com.bonus.common.utils.SecurityUtils;
|
import com.bonus.common.utils.SecurityUtils;
|
||||||
import com.bonus.common.utils.StringUtils;
|
import com.bonus.common.utils.StringUtils;
|
||||||
import com.bonus.job.domain.SysJob;
|
import com.bonus.job.domain.SysJob;
|
||||||
|
import com.bonus.job.mapper.WorkerJobMapper;
|
||||||
import com.bonus.job.util.CronUtils;
|
import com.bonus.job.util.CronUtils;
|
||||||
import com.bonus.job.util.MessageSendUtil;
|
import com.bonus.job.util.MessageSendUtil;
|
||||||
import com.bonus.job.util.ScheduleUtils;
|
import com.bonus.job.util.ScheduleUtils;
|
||||||
import com.bonus.message.dao.WorkerVo;
|
import com.bonus.message.dao.WorkerVo;
|
||||||
|
import com.bonus.message.service.WorkerService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.quartz.SchedulerException;
|
import org.quartz.SchedulerException;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -34,9 +36,27 @@ public class PmTaskServiceImpl implements PmTaskService{
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysJobService jobService;
|
private ISysJobService jobService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private WorkerJobMapper workerJobMapper;
|
||||||
|
@Resource
|
||||||
|
private WorkerService workerService;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PmTask> getMsgTaskList(PmTask task) {
|
public List<PmTask> getMsgTaskList(PmTask task) {
|
||||||
return mapper.getMsgTaskList(task);
|
List<PmTask> msgTaskList = mapper.getMsgTaskList(task);
|
||||||
|
msgTaskList.forEach(o -> {
|
||||||
|
//人数,改成了sex,groupList,和workerList
|
||||||
|
List<WorkerVo> workerList;
|
||||||
|
if(o.getId() == 1){
|
||||||
|
//生日任务默认为系统所有人
|
||||||
|
workerList = workerService.getWorkerList(new WorkerVo());
|
||||||
|
}else{
|
||||||
|
workerList = workerJobMapper.getWorkerByJobId(String.valueOf(o.getId()));
|
||||||
|
}
|
||||||
|
o.setWorkerCount(workerList.size());
|
||||||
|
});
|
||||||
|
return msgTaskList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
|
|
@ -239,11 +259,11 @@ public class PmTaskServiceImpl implements PmTaskService{
|
||||||
String[] split = msgResult.split(",");
|
String[] split = msgResult.split(",");
|
||||||
if (split.length == 2 && "ok".equals(split[0])) {
|
if (split.length == 2 && "ok".equals(split[0])) {
|
||||||
// 发送成功,更新任务状态为成功
|
// 发送成功,更新任务状态为成功
|
||||||
o.setSubmitStatus(split[0]);
|
o.setSubmitStatus("提交成功");
|
||||||
o.setBatchNumber(split[1]);
|
o.setBatchNumber(split[1]);
|
||||||
} else {
|
} else {
|
||||||
// 发送失败,更新任务状态为失败
|
// 发送失败,更新任务状态为失败
|
||||||
o.setSubmitStatus(split[0]);
|
o.setSubmitStatus("提交失败");
|
||||||
o.setReason(split[1]);
|
o.setReason(split[1]);
|
||||||
}
|
}
|
||||||
// 在设置发送时间时使用时分秒格式
|
// 在设置发送时间时使用时分秒格式
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@ public class WorkerSendMsgTask{
|
||||||
userList.forEach(user -> {
|
userList.forEach(user -> {
|
||||||
user.setLoopId(String.valueOf(loopId));
|
user.setLoopId(String.valueOf(loopId));
|
||||||
user.setPhone(user.getPhone());
|
user.setPhone(user.getPhone());
|
||||||
user.setSubmitStatus(split[0]);
|
user.setSubmitStatus("提交成功");
|
||||||
user.setBatchNumber(split[1]);
|
user.setBatchNumber(split[1]);
|
||||||
// 在设置发送时间时使用时分秒格式
|
// 在设置发送时间时使用时分秒格式
|
||||||
user.setSendTime(DateUtils.getTime()); // 简洁且安全
|
user.setSendTime(DateUtils.getTime()); // 简洁且安全
|
||||||
|
|
@ -119,7 +119,7 @@ public class WorkerSendMsgTask{
|
||||||
userList.forEach(user -> {
|
userList.forEach(user -> {
|
||||||
user.setLoopId(String.valueOf(loopId));
|
user.setLoopId(String.valueOf(loopId));
|
||||||
user.setPhone(user.getPhone());
|
user.setPhone(user.getPhone());
|
||||||
user.setSubmitStatus(split[0]);
|
user.setSubmitStatus("提交失败");
|
||||||
user.setReason(split[1]);
|
user.setReason(split[1]);
|
||||||
// 在设置发送时间时使用时分秒格式
|
// 在设置发送时间时使用时分秒格式
|
||||||
user.setSendTime(DateUtils.getTime()); // 简洁且安全
|
user.setSendTime(DateUtils.getTime()); // 简洁且安全
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ public class WorkerVo {
|
||||||
/**
|
/**
|
||||||
* 修改时间
|
* 修改时间
|
||||||
*/
|
*/
|
||||||
private Date updateTime;
|
private String updateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 关键字
|
* 关键字
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,6 @@ public class WorkerServiceImpl implements WorkerService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int updateWorker(WorkerVo workerVo) {
|
public int updateWorker(WorkerVo workerVo) {
|
||||||
workerVo.setUpdateTime(new Date());
|
|
||||||
if (StringUtils.isNotEmpty(workerVo.getPhone())){
|
if (StringUtils.isNotEmpty(workerVo.getPhone())){
|
||||||
//判断该手机号是否存在
|
//判断该手机号是否存在
|
||||||
WorkerVo worker = workerMapper.getWorkerByPhone(workerVo);
|
WorkerVo worker = workerMapper.getWorkerByPhone(workerVo);
|
||||||
|
|
|
||||||
|
|
@ -26,10 +26,9 @@
|
||||||
<select id="getMsgTaskList" resultMap="BaseResultMap">
|
<select id="getMsgTaskList" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
pt.id, pt.task_name, pt.remark, pt.msg_type, pt.send_content,
|
pt.id, pt.task_name, pt.remark, pt.msg_type, pt.send_content,
|
||||||
sj.status as task_status,sj.job_id,pt.create_time,count(bm.worker_id) as worker_count
|
sj.status as task_status,sj.job_id,pt.create_time
|
||||||
from pm_task pt
|
from pm_task pt
|
||||||
left join sys_job sj on pt.id = sj.relation_id and sj.relation_type = '短信'
|
left join sys_job sj on pt.id = sj.relation_id and sj.relation_type = '短信'
|
||||||
left join bm_task_worker bm on pt.id = bm.task_id
|
|
||||||
<where>
|
<where>
|
||||||
is_active = 1
|
is_active = 1
|
||||||
<if test="taskName != null">
|
<if test="taskName != null">
|
||||||
|
|
@ -39,7 +38,6 @@
|
||||||
and msg_type = #{msgType}
|
and msg_type = #{msgType}
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
group by pt.id
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getById" resultMap="BaseResultMap">
|
<select id="getById" resultMap="BaseResultMap">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue