Commit 22f3f6a2 by jianan

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

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