Commit 2ef6ce38 by jianan

日程接口统一请求和响应格式

parent 22f3f6a2
...@@ -22,11 +22,16 @@ import com.yd.api.practitioner.vo.rank.PractitionerRankRequestVO; ...@@ -22,11 +22,16 @@ import com.yd.api.practitioner.vo.rank.PractitionerRankRequestVO;
import com.yd.api.practitioner.vo.rank.PractitionerRankResponseVO; import com.yd.api.practitioner.vo.rank.PractitionerRankResponseVO;
import com.yd.api.practitioner.vo.recruit.*; import com.yd.api.practitioner.vo.recruit.*;
import com.yd.api.practitioner.vo.salestarget.*; import com.yd.api.practitioner.vo.salestarget.*;
import com.yd.api.practitioner.vo.sechedule.AddScheduleTrackRequestVO;
import com.yd.api.practitioner.vo.sechedule.AddScheduleTrackResponseVO;
import com.yd.api.practitioner.vo.sechedule.QueryScheduleTrackListRequestVO;
import com.yd.api.practitioner.vo.sechedule.QueryScheduleTrackListResponseVO;
import com.yd.api.practitioner.vo.setting.*; import com.yd.api.practitioner.vo.setting.*;
import com.yd.api.practitioner.vo.subordinate.SubordinateSystemMemberQueryRequestVO; import com.yd.api.practitioner.vo.subordinate.SubordinateSystemMemberQueryRequestVO;
import com.yd.api.practitioner.vo.subordinate.SubordinateSystemMemberQueryResponseVO; import com.yd.api.practitioner.vo.subordinate.SubordinateSystemMemberQueryResponseVO;
import com.yd.api.result.JsonResult; import com.yd.api.result.JsonResult;
import com.yd.dal.entity.practitioner.ScheduleTrack; import com.yd.dal.entity.practitioner.ScheduleTrack;
import org.apache.commons.codec.net.QCodec;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -506,27 +511,32 @@ public class PractitionerController { ...@@ -506,27 +511,32 @@ public class PractitionerController {
result.setData(responseVO); result.setData(responseVO);
return result; return result;
} }
/** /**
* 新建日程 * 新建日程
* @param schedule * @param requestVO
* @return * @return
*/ */
@RequestMapping("/addScheduleTrack") @RequestMapping("/addScheduleTrack")
public Object addScheduleTrack(@RequestBody ScheduleTrack schedule){ public Object addScheduleTrack(@RequestBody AddScheduleTrackRequestVO requestVO){
JsonResult result = scheduleTrackService.insert(schedule); JsonResult result = new JsonResult();
AddScheduleTrackResponseVO responseVO = scheduleTrackService.insert(requestVO);
result.addResult(responseVO);
result.setData(responseVO);
return result; return result;
} }
/** /**
* 根据经纪人id查询日程列表 * 根据经纪人id查询日程列表
* @param params * @param requestVO
* @return * @return
*/ */
@RequestMapping("/queryScheduleTrackList") @RequestMapping("/queryScheduleTrackList")
public Object queryScheduleTrackList(@RequestBody Map<String, String> params){ public Object queryScheduleTrackList(@RequestBody QueryScheduleTrackListRequestVO requestVO){
Long practitionerId = Long.parseLong(params.get("practitionerId")) ; JsonResult result = new JsonResult();
String trackDate = (String) params.get("trackDate"); QueryScheduleTrackListResponseVO responseVO = scheduleTrackService.queryScheduleTrackList(requestVO);
JsonResult result = scheduleTrackService.queryScheduleTrackList(practitionerId, trackDate); result.addResult(responseVO);
result.setData(responseVO);
return result; return result;
} }
......
package com.yd.api.practitioner.service; package com.yd.api.practitioner.service;
import com.yd.api.result.JsonResult; import com.yd.api.practitioner.vo.sechedule.AddScheduleTrackRequestVO;
import com.yd.dal.entity.practitioner.ScheduleTrack; import com.yd.api.practitioner.vo.sechedule.AddScheduleTrackResponseVO;
import com.yd.api.practitioner.vo.sechedule.QueryScheduleTrackListRequestVO;
import com.yd.api.practitioner.vo.sechedule.QueryScheduleTrackListResponseVO;
public interface ScheduleTrackService { public interface ScheduleTrackService {
JsonResult insert(ScheduleTrack schedule); AddScheduleTrackResponseVO insert(AddScheduleTrackRequestVO requestVO);
JsonResult queryScheduleTrackList(Long practitionerId, String trackDate); QueryScheduleTrackListResponseVO queryScheduleTrackList(QueryScheduleTrackListRequestVO requestVO);
} }
package com.yd.api.practitioner.service.impl; package com.yd.api.practitioner.service.impl;
import com.yd.api.practitioner.service.ScheduleTrackService; import com.yd.api.practitioner.service.ScheduleTrackService;
import com.yd.api.practitioner.vo.organization.OrganizationQueryResponseVO; import com.yd.api.practitioner.vo.opportunity.OwnOpportunityRecordSaveResponseVO;
import com.yd.api.practitioner.vo.sechedule.*;
import com.yd.api.result.CommonResult; import com.yd.api.result.CommonResult;
import com.yd.api.result.JsonResult; import com.yd.api.result.JsonResult;
import com.yd.dal.entity.customer.AclPractitionerPotentialAssignedTrack; import com.yd.dal.entity.customer.AclPractitionerPotentialAssignedTrack;
...@@ -10,12 +11,12 @@ import com.yd.dal.entity.meta.MdDropOptions; ...@@ -10,12 +11,12 @@ import com.yd.dal.entity.meta.MdDropOptions;
import com.yd.dal.entity.practitioner.ScheduleTrack; import com.yd.dal.entity.practitioner.ScheduleTrack;
import com.yd.dal.mapper.marketing.ScheduleTrackMapper; import com.yd.dal.mapper.marketing.ScheduleTrackMapper;
import com.yd.dal.service.customer.AclPractitionerPotentialAssignedTrackDALService; import com.yd.dal.service.customer.AclPractitionerPotentialAssignedTrackDALService;
import com.yd.dal.service.customer.AclPractitionerSubordinateSystemDALService;
import com.yd.dal.service.marketing.MktLeadsAssignedTrackDALService; import com.yd.dal.service.marketing.MktLeadsAssignedTrackDALService;
import com.yd.dal.service.meta.MdDropOptionsDALService; import com.yd.dal.service.meta.MdDropOptionsDALService;
import com.yd.util.CommonUtil; import com.yd.util.CommonUtil;
import com.yd.util.config.ZHBErrorConfig; import com.yd.util.config.ZHBErrorConfig;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -33,9 +34,12 @@ public class ScheduleTrackServiceImpl implements ScheduleTrackService { ...@@ -33,9 +34,12 @@ public class ScheduleTrackServiceImpl implements ScheduleTrackService {
private MktLeadsAssignedTrackDALService mktLeadsAssignedTrackDALService; private MktLeadsAssignedTrackDALService mktLeadsAssignedTrackDALService;
@Override @Override
public JsonResult insert(ScheduleTrack schedule) { public AddScheduleTrackResponseVO insert(AddScheduleTrackRequestVO requestVO) {
JsonResult result = new JsonResult(); // 响应实体
result.setSuccess(false); AddScheduleTrackResponseVO resp = new AddScheduleTrackResponseVO();
// 数据库实体
ScheduleTrack schedule = new ScheduleTrack();
BeanUtils.copyProperties(requestVO, schedule);
try { try {
String taskTimeFrom = schedule.getTaskTimeFrom(); String taskTimeFrom = schedule.getTaskTimeFrom();
String taskTimeEnd = schedule.getTaskTimeEnd(); String taskTimeEnd = schedule.getTaskTimeEnd();
...@@ -45,12 +49,12 @@ public class ScheduleTrackServiceImpl implements ScheduleTrackService { ...@@ -45,12 +49,12 @@ public class ScheduleTrackServiceImpl implements ScheduleTrackService {
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);
if (count > 0) { if (count > 0) {
result.setMessage(ZHBErrorConfig.getErrorInfo("830020")); resp.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("830020")));
return result; return resp;
} }
} else { } else {
result.setMessage("taskTimeFrom,taskTimeEnd不能为空"); resp.setCommonResult(new CommonResult(true, "taskTimeFrom,taskTimeEnd不能为空"));
return result; return resp;
} }
Map<Long, MdDropOptions> taskTypeMap = this.getScheduleTaskTypeMap(); Map<Long, MdDropOptions> taskTypeMap = this.getScheduleTaskTypeMap();
...@@ -74,13 +78,12 @@ public class ScheduleTrackServiceImpl implements ScheduleTrackService { ...@@ -74,13 +78,12 @@ public class ScheduleTrackServiceImpl implements ScheduleTrackService {
if (2 == taskType && null != referPotentialId) { if (2 == taskType && null != referPotentialId) {
this.insertPotentialAssignedTrack(schedule); this.insertPotentialAssignedTrack(schedule);
} }
result.setSuccess(true); resp.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000")));
result.setMessage(ZHBErrorConfig.getErrorInfo("800000"));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
result.setMessage(e.getMessage()); resp.setCommonResult(new CommonResult(false, ZHBErrorConfig.getErrorInfo("800001")));
} }
return result; return resp;
} }
private void insertOpportunityRecord(ScheduleTrack schedule) { private void insertOpportunityRecord(ScheduleTrack schedule) {
...@@ -136,33 +139,36 @@ public class ScheduleTrackServiceImpl implements ScheduleTrackService { ...@@ -136,33 +139,36 @@ public class ScheduleTrackServiceImpl implements ScheduleTrackService {
} }
@Override @Override
public JsonResult queryScheduleTrackList(Long practitionerId, String trackDate) { public QueryScheduleTrackListResponseVO queryScheduleTrackList(QueryScheduleTrackListRequestVO requestVO) {
JsonResult result = new JsonResult(); QueryScheduleTrackListResponseVO resp = new QueryScheduleTrackListResponseVO();
result.setSuccess(false);
Long practitionerId = requestVO.getPractitionerId();
String trackDate = requestVO.getTrackDate();
if (StringUtils.isEmpty(trackDate) || null == practitionerId) { if (StringUtils.isEmpty(trackDate) || null == practitionerId) {
result.setMessage("经纪人id和查询时间不能为空"); resp.setCommonResult(new CommonResult(true, "经纪人id和查询时间不能为空"));
return result; return resp;
} }
List<ScheduleTrack> showList = new ArrayList<>(); List<ScheduleTrackVO> showList = new ArrayList<>();
try { try {
List<ScheduleTrack> dataList = scheduleTrackMapper.queryScheduleTrackList(practitionerId); List<ScheduleTrack> dataList = scheduleTrackMapper.queryScheduleTrackList(practitionerId);
Map<Long, MdDropOptions> taskTypeMap = this.getScheduleTaskTypeMap(); Map<Long, MdDropOptions> taskTypeMap = this.getScheduleTaskTypeMap();
String optionName = null; String optionName = null;
for (ScheduleTrack schedule: dataList) { for (ScheduleTrack schedule: dataList) {
if (this.checkFixedDay(trackDate, schedule)) { if (this.checkFixedDay(trackDate, schedule)) {
ScheduleTrackVO scheduleTrackVO = new ScheduleTrackVO();
BeanUtils.copyProperties(schedule, scheduleTrackVO);
optionName = taskTypeMap.get(schedule.getMdDropOptionId()).getDropOptionName(); optionName = taskTypeMap.get(schedule.getMdDropOptionId()).getDropOptionName();
schedule.setMdDropOptionName(optionName); scheduleTrackVO.setMdDropOptionName(optionName);
showList.add(schedule); showList.add(scheduleTrackVO);
} }
} }
result.setData(showList); resp.setDataList(showList);
result.setSuccess(true); resp.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000")));
result.setMessage(ZHBErrorConfig.getErrorInfo("800000"));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
result.setMessage(e.getMessage()); resp.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800001")));
} }
return result; return resp;
} }
private Map<Long, MdDropOptions> getScheduleTaskTypeMap() { private Map<Long, MdDropOptions> getScheduleTaskTypeMap() {
......
package com.yd.api.practitioner.vo.sechedule;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@Data
public class AddScheduleTrackRequestVO {
private Long practitionerId;
private String notice;
private Integer taskType;
private Long referLeadsId;
private Long referPotentialId;
private Integer taskImportantTag;
private Integer isActive;
private String taskTimeFrom;
private String taskTimeEnd;
private Integer taskRoutineAtweek7;
private Integer taskRoutineAtweek6;
private Integer taskRoutineAtweek5;
private Integer taskRoutineAtweek4;
private Integer taskRoutineAtweek3;
private Integer taskRoutineAtweek2;
private Integer taskRoutineAtweek1;
private Long customerId;
private Long mdDropOptionId;
private String mdDropOptionName;
private Integer trackScore;
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date trackTime;
}
package com.yd.api.practitioner.vo.sechedule;
import com.yd.api.result.CommonResult;
import lombok.Data;
@Data
public class AddScheduleTrackResponseVO {
private CommonResult commonResult;
}
package com.yd.api.practitioner.vo.sechedule;
import lombok.Data;
@Data
public class QueryScheduleTrackListRequestVO {
private Long practitionerId;
private String trackDate;
}
package com.yd.api.practitioner.vo.sechedule;
import com.yd.api.result.CommonResult;
import lombok.Data;
import java.util.List;
@Data
public class QueryScheduleTrackListResponseVO {
private List<ScheduleTrackVO> dataList;
private CommonResult commonResult;
}
package com.yd.api.practitioner.vo.sechedule;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@Data
public class ScheduleTrackVO {
private Long id;
private Long practitionerId;
private String notice;
private Integer taskType;
private Long referLeadsId;
private Long referPotentialId;
private Integer taskImportantTag;
private Integer isActive;
private String taskTimeFrom;
private String taskTimeEnd;
private Integer taskRoutineAtweek7;
private Integer taskRoutineAtweek6;
private Integer taskRoutineAtweek5;
private Integer taskRoutineAtweek4;
private Integer taskRoutineAtweek3;
private Integer taskRoutineAtweek2;
private Integer taskRoutineAtweek1;
private Long customerId;
private String mdDropOptionName;
private Integer trackScore;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date trackTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createdAt;
private Long createdBy;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updatedAt;
private Long updatedBy;
private Integer creatorType;
private Integer updatorType;
}
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