Commit 054cfe2c by jianan

Merge branch 'dev_20200908_PEP_Statistics' into dev

parents 8233e064 12a6b97d
...@@ -3,10 +3,12 @@ package com.yd.api.practitioner.service.impl; ...@@ -3,10 +3,12 @@ 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.sechedule.*; import com.yd.api.practitioner.vo.sechedule.*;
import com.yd.api.result.CommonResult; import com.yd.api.result.CommonResult;
import com.yd.dal.entity.customer.AclPractitionerPotential;
import com.yd.dal.entity.customer.AclPractitionerPotentialAssignedTrack; import com.yd.dal.entity.customer.AclPractitionerPotentialAssignedTrack;
import com.yd.dal.entity.marketing.MktLeadsAssignedTrack; import com.yd.dal.entity.marketing.MktLeadsAssignedTrack;
import com.yd.dal.entity.meta.MdDropOptions; import com.yd.dal.entity.meta.MdDropOptions;
import com.yd.dal.entity.practitioner.*; import com.yd.dal.entity.practitioner.*;
import com.yd.dal.mapper.customer.AclPractitionerPotentialMapper;
import com.yd.dal.mapper.marketing.ScheduleTrackMapper; import com.yd.dal.mapper.marketing.ScheduleTrackMapper;
import com.yd.dal.service.agms.AgmsDashboardDALService; import com.yd.dal.service.agms.AgmsDashboardDALService;
import com.yd.dal.service.customer.AclPractitionerPotentialAssignedTrackDALService; import com.yd.dal.service.customer.AclPractitionerPotentialAssignedTrackDALService;
...@@ -35,6 +37,8 @@ public class ScheduleTrackServiceImpl implements ScheduleTrackService { ...@@ -35,6 +37,8 @@ public class ScheduleTrackServiceImpl implements ScheduleTrackService {
private MktLeadsAssignedTrackDALService mktLeadsAssignedTrackDALService; private MktLeadsAssignedTrackDALService mktLeadsAssignedTrackDALService;
@Autowired @Autowired
private AgmsDashboardDALService agmsDashboardDALService; private AgmsDashboardDALService agmsDashboardDALService;
@Autowired
private AclPractitionerPotentialMapper aclPractitionerPotentialMapper;
@Override @Override
public AddScheduleTrackResponseVO insert(AddScheduleTrackRequestVO requestVO) { public AddScheduleTrackResponseVO insert(AddScheduleTrackRequestVO requestVO) {
...@@ -99,7 +103,7 @@ public class ScheduleTrackServiceImpl implements ScheduleTrackService { ...@@ -99,7 +103,7 @@ public class ScheduleTrackServiceImpl implements ScheduleTrackService {
if (2 == taskType && null != referPotentialId) { if (2 == taskType && null != referPotentialId) {
this.insertPotentialAssignedTrack(schedule); this.insertPotentialAssignedTrack(schedule);
} }
resp.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000"))); resp.setCommonResult(new CommonResult(true, "任务添加成功"));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
resp.setCommonResult(new CommonResult(false, e.getMessage())); resp.setCommonResult(new CommonResult(false, e.getMessage()));
...@@ -194,8 +198,15 @@ public class ScheduleTrackServiceImpl implements ScheduleTrackService { ...@@ -194,8 +198,15 @@ public class ScheduleTrackServiceImpl implements ScheduleTrackService {
if (this.checkFixedDay(trackDate, schedule)) { if (this.checkFixedDay(trackDate, schedule)) {
ScheduleTrackVO scheduleTrackVO = new ScheduleTrackVO(); ScheduleTrackVO scheduleTrackVO = new ScheduleTrackVO();
BeanUtils.copyProperties(schedule, scheduleTrackVO); BeanUtils.copyProperties(schedule, scheduleTrackVO);
// 获取optionName
optionName = taskTypeMap.get(schedule.getMdDropOptionId()).getDropOptionName(); optionName = taskTypeMap.get(schedule.getMdDropOptionId()).getDropOptionName();
scheduleTrackVO.setMdDropOptionName(optionName); scheduleTrackVO.setMdDropOptionName(optionName);
// 获取增员姓名和电话
if (schedule.getReferPotentialId() != null) {
AclPractitionerPotential potential = aclPractitionerPotentialMapper.selectByPrimaryKey(schedule.getReferPotentialId());
scheduleTrackVO.setName(potential.getName());
scheduleTrackVO.setMobileNo(potential.getMobileNo());
}
showList.add(scheduleTrackVO); showList.add(scheduleTrackVO);
} }
} }
...@@ -335,12 +346,11 @@ public class ScheduleTrackServiceImpl implements ScheduleTrackService { ...@@ -335,12 +346,11 @@ public class ScheduleTrackServiceImpl implements ScheduleTrackService {
Long practitionerId = requestVO.getPractitionerId(); Long practitionerId = requestVO.getPractitionerId();
String time = requestVO.getTime(); String time = requestVO.getTime();
Calendar cal = Calendar.getInstance(); // 根据time获取查询起始日期和结束日期,默认当天
// 根据time获取查询起始日期,默认当天
Date startDate = new Date(); Date startDate = new Date();
// 根据time获取查询结束日期,默认当天
Date endDate = new Date(); Date endDate = new Date();
Calendar cal = Calendar.getInstance();
if ("w".equalsIgnoreCase(time)) { if ("w".equalsIgnoreCase(time)) {
cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.HOUR_OF_DAY, 0);
...@@ -359,8 +369,8 @@ public class ScheduleTrackServiceImpl implements ScheduleTrackService { ...@@ -359,8 +369,8 @@ public class ScheduleTrackServiceImpl implements ScheduleTrackService {
// 根据经纪人id查询个人所有日程 // 根据经纪人id查询个人所有日程
List<ScheduleTrack> scheduleList = scheduleTrackMapper.queryPersonalScheduleListByTime(practitionerId, time); List<ScheduleTrack> scheduleList = scheduleTrackMapper.queryPersonalScheduleListByTime(practitionerId, time);
// 计算增员日程和销售日程的得分 // 计算增员日程和销售日程的得分
List<Integer> saleOption = Arrays.asList(95,96,97,98,99,101,228); List<Long> saleOption = mdDropOptionsDALService.queryIdByByDropMasterCode("bizchance_promotion_action");
List<Integer> RecruitOption = Arrays.asList(107,108,109,110,111,112); List<Long> RecruitOption = mdDropOptionsDALService.queryIdByByDropMasterCode("team_building_track");
Long recruitScore = 0L; Long recruitScore = 0L;
Long saleScore = 0L; Long saleScore = 0L;
...@@ -368,11 +378,11 @@ public class ScheduleTrackServiceImpl implements ScheduleTrackService { ...@@ -368,11 +378,11 @@ public class ScheduleTrackServiceImpl implements ScheduleTrackService {
Long trainScore = 0L; Long trainScore = 0L;
Long meetingScore = 0L; Long meetingScore = 0L;
for (ScheduleTrack schedule : scheduleList) { for (ScheduleTrack schedule : scheduleList) {
if (saleOption.contains(schedule.getMdDropOptionId().intValue())) { if (saleOption.contains(schedule.getMdDropOptionId())) {
saleScore += schedule.getTrackScore(); saleScore += schedule.getTrackScore();
continue; continue;
} }
if (RecruitOption.contains(schedule.getMdDropOptionId().intValue())) { if (RecruitOption.contains(schedule.getMdDropOptionId())) {
recruitScore += schedule.getTrackScore(); recruitScore += schedule.getTrackScore();
continue; continue;
} }
......
...@@ -26,18 +26,9 @@ public class ScheduleTrackVO { ...@@ -26,18 +26,9 @@ public class ScheduleTrackVO {
private Long customerId; private Long customerId;
private Long mdDropOptionId; private Long mdDropOptionId;
private String mdDropOptionName; private String mdDropOptionName;
private String name;
private String mobileNo;
private Integer trackScore; private Integer trackScore;
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
private Date trackTime; 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;
} }
...@@ -42,4 +42,6 @@ public class ScheduleTrack { ...@@ -42,4 +42,6 @@ public class ScheduleTrack {
private Long updatedBy; private Long updatedBy;
private Integer creatorType; private Integer creatorType;
private Integer updatorType; private Integer updatorType;
private String name;
private String mobileNo;
} }
...@@ -44,4 +44,8 @@ public interface MdDropOptionsDALService { ...@@ -44,4 +44,8 @@ public interface MdDropOptionsDALService {
List<MdDropOptions> findByDropMasterCodes(List<String> asList); List<MdDropOptions> findByDropMasterCodes(List<String> asList);
Map<Long, MdDropOptions> queryIdObjMapByByDropMasterCode(String masterCode); Map<Long, MdDropOptions> queryIdObjMapByByDropMasterCode(String masterCode);
List<Long> queryIdByByDropMasterCodes(List<String> masterCodeList);
List<Long> queryIdByByDropMasterCode(String masterCode);
} }
...@@ -11,6 +11,7 @@ import com.yd.util.intercept.annotation.TargetDataSource; ...@@ -11,6 +11,7 @@ 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.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -121,4 +122,20 @@ public class MdDropOptionsDALServiceImpl implements MdDropOptionsDALService { ...@@ -121,4 +122,20 @@ public class MdDropOptionsDALServiceImpl implements MdDropOptionsDALService {
dropOptionsList.forEach(i->optMap.put(i.getId(), i)); dropOptionsList.forEach(i->optMap.put(i.getId(), i));
return optMap; return optMap;
} }
@Override
public List<Long> queryIdByByDropMasterCodes(List<String> masterCodeList) {
List<Long> idList = new ArrayList<>();
List<MdDropOptions> options = mdDropOptionsMapper.findByDropMasterCodes(masterCodeList);
options.forEach(i->idList.add(i.getId()));
return idList;
}
@Override
public List<Long> queryIdByByDropMasterCode(String masterCode) {
List<Long> idList = new ArrayList<>();
List<MdDropOptions> options = mdDropOptionsMapper.findByMasterCode(masterCode);
options.forEach(i->idList.add(i.getId()));
return idList;
}
} }
...@@ -29,16 +29,18 @@ ...@@ -29,16 +29,18 @@
<result column="updated_by" jdbcType="BIGINT" property="updatedBy"/> <result column="updated_by" jdbcType="BIGINT" property="updatedBy"/>
<result column="updator_type" jdbcType="INTEGER" property="updatorType"/> <result column="updator_type" jdbcType="INTEGER" property="updatorType"/>
<result column="creator_type" jdbcType="INTEGER" property="creatorType"/> <result column="creator_type" jdbcType="INTEGER" property="creatorType"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="mobile_no" jdbcType="VARCHAR" property="mobileNo" typeHandler="com.yd.util.deshandler.DESTypeHandler"/>
</resultMap> </resultMap>
<select id="queryScheduleTrackList" resultMap="ScheduleTrackResultMap"> <select id="queryScheduleTrackList" resultMap="ScheduleTrackResultMap">
SELECT id, notice, task_type, refer_leads_id, refer_potential_id, SELECT t.id, notice, task_type, refer_leads_id, refer_potential_id,
task_important_tag, task_routine_at_week7,task_routine_at_week6, task_routine_at_week5, task_important_tag, task_routine_at_week7,task_routine_at_week6, task_routine_at_week5,
task_routine_at_week4, task_routine_at_week3, task_routine_at_week2, task_routine_at_week1, task_routine_at_week4, task_routine_at_week3, task_routine_at_week2, task_routine_at_week1,
DATE_FORMAT(task_time_from,'%H:%i') task_time_from, DATE_FORMAT(task_time_end,'%H:%i') task_time_end, DATE_FORMAT(task_time_from,'%H:%i') task_time_from, DATE_FORMAT(task_time_end,'%H:%i') task_time_end,
is_active, practitioner_id, customer_id, md_drop_option_id, track_score, track_time, practitioner_id, customer_id, md_drop_option_id, track_score, track_time,
created_at, created_by, updated_at, updated_by, updator_type, creator_type c.name, c.mobile_no
FROM FROM ag_mkt_schedule_task_tracking t
ag_mkt_schedule_task_tracking t LEFT JOIN ag_acl_customer c on t.customer_id=c.id
WHERE practitioner_id = #{practitionerId,jdbcType=BIGINT} WHERE practitioner_id = #{practitionerId,jdbcType=BIGINT}
ORDER BY task_time_from ORDER BY task_time_from
</select> </select>
...@@ -202,7 +204,6 @@ ...@@ -202,7 +204,6 @@
created_at, created_by, updated_at, updated_by, updator_type, creator_type created_at, created_by, updated_at, updated_by, updator_type, creator_type
from ag_mkt_schedule_task_tracking t from ag_mkt_schedule_task_tracking t
where t.practitioner_id = #{practitionerId,jdbcType=BIGINT} where t.practitioner_id = #{practitionerId,jdbcType=BIGINT}
and md_drop_option_id not in (223,224,225,226,227)
and to_days(t.track_time) &lt;= to_days(now()) and to_days(t.track_time) &lt;= to_days(now())
<if test="time != null"> <if test="time != null">
<choose> <choose>
...@@ -217,7 +218,7 @@ ...@@ -217,7 +218,7 @@
</when> </when>
</choose> </choose>
</if> </if>
union all union
select id, notice, task_type, refer_leads_id, refer_potential_id, select id, notice, task_type, refer_leads_id, refer_potential_id,
task_important_tag, task_routine_at_week7,task_routine_at_week6, task_routine_at_week5, task_important_tag, task_routine_at_week7,task_routine_at_week6, task_routine_at_week5,
task_routine_at_week4, task_routine_at_week3, task_routine_at_week2, task_routine_at_week1, task_routine_at_week4, task_routine_at_week3, task_routine_at_week2, task_routine_at_week1,
...@@ -225,7 +226,10 @@ ...@@ -225,7 +226,10 @@
created_at, created_by, updated_at, updated_by, updator_type, creator_type created_at, created_by, updated_at, updated_by, updator_type, creator_type
from ag_mkt_schedule_task_tracking t from ag_mkt_schedule_task_tracking t
where t.practitioner_id = #{practitionerId,jdbcType=BIGINT} where t.practitioner_id = #{practitionerId,jdbcType=BIGINT}
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'
)
</select> </select>
<delete id="deleteScheduleTrackById"> <delete id="deleteScheduleTrackById">
......
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