Commit 7e9db769 by jianan

日程时间冲突从当日显示日程列表中检测

parent 12a6b97d
......@@ -72,8 +72,9 @@ public class ScheduleTrackServiceImpl implements ScheduleTrackService {
Long mdDropOptionId = schedule.getMdDropOptionId();
// 判断活动时间段是否冲突
if (!CommonUtil.isNullOrBlank(taskTimeFrom) && !CommonUtil.isNullOrBlank(taskTimeEnd)) {
int count = scheduleTrackMapper.checkTimePeriodConflict(trackTime, taskTimeFrom, taskTimeEnd, practitionerId);
if (count > 0) {
// int count = scheduleTrackMapper.checkTimePeriodConflict(trackTime, taskTimeFrom, taskTimeEnd, practitionerId);
boolean isConflict = this.checkTimePeriodConflict(trackTime, taskTimeFrom, taskTimeEnd, practitionerId);
if (isConflict) {
resp.setCommonResult(new CommonResult(false, ZHBErrorConfig.getErrorInfo("830020")));
return resp;
}
......@@ -101,6 +102,8 @@ public class ScheduleTrackServiceImpl implements ScheduleTrackService {
this.insertOpportunityRecord(schedule);
}
if (2 == taskType && null != referPotentialId) {
AclPractitionerPotential potential = aclPractitionerPotentialMapper.selectByPrimaryKey(referPotentialId);
schedule.setCustomerId(potential.getCustomerId());
this.insertPotentialAssignedTrack(schedule);
}
resp.setCommonResult(new CommonResult(true, "任务添加成功"));
......@@ -111,6 +114,29 @@ public class ScheduleTrackServiceImpl implements ScheduleTrackService {
return resp;
}
private boolean checkTimePeriodConflict(Date trackTime, String taskTimeFrom, String taskTimeEnd, Long practitionerId) {
List<ScheduleTrack> showList = new ArrayList<>();
List<ScheduleTrack> dataList = scheduleTrackMapper.queryScheduleTrackList(practitionerId);
// 获得当天展示的日程列表
for (ScheduleTrack schedule: dataList) {
if (this.checkFixedDay(CommonUtil.dateParseString(trackTime, "yyyy-MM-dd"), schedule)) {
showList.add(schedule);
}
}
// 检查时间段是否冲突
boolean isConflict = false;
String taskStartTime;
String taskEndTime;
for (ScheduleTrack schedule: showList) {
taskStartTime = schedule.getTaskTimeFrom();
taskEndTime = schedule.getTaskTimeEnd();
if (taskStartTime.compareTo(taskTimeEnd)<0 && taskEndTime.compareTo(taskTimeFrom)>0) {
isConflict = true;
}
}
return isConflict;
}
private void insertOpportunityRecord(ScheduleTrack schedule) {
MktLeadsAssignedTrack track = new MktLeadsAssignedTrack();
BeanUtils.copyProperties(schedule, track, "id");
......@@ -201,12 +227,6 @@ public class ScheduleTrackServiceImpl implements ScheduleTrackService {
// 获取optionName
optionName = taskTypeMap.get(schedule.getMdDropOptionId()).getDropOptionName();
scheduleTrackVO.setMdDropOptionName(optionName);
// 获取增员姓名和电话
if (schedule.getReferPotentialId() != null) {
AclPractitionerPotential potential = aclPractitionerPotentialMapper.selectByPrimaryKey(schedule.getReferPotentialId());
scheduleTrackVO.setName(potential.getName());
scheduleTrackVO.setMobileNo(potential.getMobileNo());
}
showList.add(scheduleTrackVO);
}
}
......
......@@ -117,8 +117,11 @@
then COALESCE(t.track_score,0) else 0 end) monthScore
from ag_acl_practitioner p
left join (select practitioner_id, track_time, track_score
from ag_mkt_schedule_task_tracking where md_drop_option_id not in (223,224,225,226,227)
and date_format(track_time,'%Y-%m')=date_format(now(),'%Y-%m')
from ag_mkt_schedule_task_tracking
where md_drop_option_id not in
(SELECT o.id FROM ag_md_drop_options o LEFT JOIN ag_md_drop_master m ON m.id = o.drop_master_id
WHERE m.scenario_code = 'pep_schedule_task_others')
and date_format(track_time,'%Y-%m')=date_format(now(),'%Y-%m')
) t on p.id = t.practitioner_id
where 1=1
and p.is_active=1
......@@ -189,7 +192,10 @@
FROM
ag_mkt_schedule_task_tracking t
WHERE 1=1
AND md_drop_option_id in (223,224,225,226,227)
AND md_drop_option_id in
(SELECT o.id FROM ag_md_drop_options o LEFT JOIN ag_md_drop_master m ON m.id = o.drop_master_id
WHERE m.scenario_code = 'pep_schedule_task_others'
)
AND practitioner_id in
<foreach collection="list" item="practitionerId" index="index" open="(" close=")" separator=",">
#{practitionerId,jdbcType=BIGINT}
......
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