Commit 22f3f6a2 by jianan

日程查询接口显示任务类型名

parent 3a89643c
......@@ -19,9 +19,7 @@ import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.*;
@Service
public class ScheduleTrackServiceImpl implements ScheduleTrackService {
......@@ -42,6 +40,7 @@ public class ScheduleTrackServiceImpl implements ScheduleTrackService {
String taskTimeFrom = schedule.getTaskTimeFrom();
String taskTimeEnd = schedule.getTaskTimeEnd();
Long practitionerId = schedule.getPractitionerId();
Long mdDropOptionId = schedule.getMdDropOptionId();
// 判断活动时间段是否冲突
if (!CommonUtil.isNullOrBlank(taskTimeFrom) && !CommonUtil.isNullOrBlank(taskTimeEnd)) {
int count = scheduleTrackMapper.checkTimePeriodConflict(taskTimeFrom, taskTimeEnd, practitionerId);
......@@ -54,6 +53,9 @@ public class ScheduleTrackServiceImpl implements ScheduleTrackService {
return result;
}
Map<Long, MdDropOptions> taskTypeMap = this.getScheduleTaskTypeMap();
Integer trackScore = taskTypeMap.get(mdDropOptionId).getDropOptionScore();
schedule.setTrackScore(trackScore);
schedule.setCreatedBy(practitionerId);
schedule.setUpdatedBy(practitionerId);
schedule.setUpdatorType(2);
......@@ -144,8 +146,12 @@ public class ScheduleTrackServiceImpl implements ScheduleTrackService {
List<ScheduleTrack> showList = new ArrayList<>();
try {
List<ScheduleTrack> dataList = scheduleTrackMapper.queryScheduleTrackList(practitionerId);
Map<Long, MdDropOptions> taskTypeMap = this.getScheduleTaskTypeMap();
String optionName = null;
for (ScheduleTrack schedule: dataList) {
if (this.checkFixedDay(trackDate, schedule)) {
optionName = taskTypeMap.get(schedule.getMdDropOptionId()).getDropOptionName();
schedule.setMdDropOptionName(optionName);
showList.add(schedule);
}
}
......@@ -159,6 +165,18 @@ public class ScheduleTrackServiceImpl implements ScheduleTrackService {
return result;
}
private Map<Long, MdDropOptions> getScheduleTaskTypeMap() {
Map<Long, MdDropOptions> saleOptMap = mdDropOptionsDALService.queryIdObjMapByByDropMasterCode("bizchance_promotion_action");
Map<Long, MdDropOptions> recruitOptMap = mdDropOptionsDALService.queryIdObjMapByByDropMasterCode("team_building_track");
Map<Long, MdDropOptions> otherOptMap = mdDropOptionsDALService.queryIdObjMapByByDropMasterCode("pep_schedule_task_others");
Map<Long, MdDropOptions> taskTypeMap = new HashMap<>();
taskTypeMap.putAll(saleOptMap);
taskTypeMap.putAll(recruitOptMap);
taskTypeMap.putAll(otherOptMap);
return taskTypeMap;
}
private boolean checkFixedDay(String trackDate, ScheduleTrack track) {
Date date = CommonUtil.stringParseDate(trackDate, "yyyy-MM-dd");
String week = CommonUtil.getWeekOfDate(date);
......@@ -189,7 +207,7 @@ public class ScheduleTrackServiceImpl implements ScheduleTrackService {
default:
break;
}
if (CommonUtil.isToday(trackTime) || flag == 1) {
if (trackTime.equals(trackDate) || flag == 1) {
return true;
} else {
return false;
......
......@@ -27,6 +27,7 @@ public class ScheduleTrack {
private Integer taskRoutineAtweek1;
private Long customerId;
private Long mdDropOptionId;
private String mdDropOptionName;
private Integer trackScore;
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
......
......@@ -6,6 +6,8 @@ import com.yd.dal.entity.meta.MdDropOptions;
import com.yd.dal.entity.meta.OptionsEGolden;
import java.util.List;
import java.util.Map;
public interface MdDropOptionsDALService {
List<MdDropOptions> findByDropMasterId(long dropMasterId);
......@@ -40,4 +42,6 @@ public interface MdDropOptionsDALService {
List<InsurerBranchInfo> findInsurerBranchInfoEG();
List<MdDropOptions> findByDropMasterCodes(List<String> asList);
Map<Long, MdDropOptions> queryIdObjMapByByDropMasterCode(String masterCode);
}
......@@ -11,7 +11,9 @@ import com.yd.util.intercept.annotation.TargetDataSource;
import com.yd.util.intercept.commons.DataSourceKey;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service("mdDropOptionsDALService")
public class MdDropOptionsDALServiceImpl implements MdDropOptionsDALService {
......@@ -111,4 +113,12 @@ public class MdDropOptionsDALServiceImpl implements MdDropOptionsDALService {
public List<MdDropOptions> findByDropMasterCodes(List<String> masterCodeList) {
return mdDropOptionsMapper.findByDropMasterCodes(masterCodeList);
}
@Override
public Map<Long, MdDropOptions> queryIdObjMapByByDropMasterCode(String masterCode) {
Map<Long,MdDropOptions> optMap = new HashMap<>();
List<MdDropOptions> dropOptionsList = this.findByDropMasterCode(masterCode);
dropOptionsList.forEach(i->optMap.put(i.getId(), i));
return optMap;
}
}
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