Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yd-backend
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
AutogeneralShanghai
yd-backend
Commits
dfd7cccd
Commit
dfd7cccd
authored
Sep 10, 2020
by
jianan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增-创建日程接口,查询日程接口
parent
17bd03e4
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
329 additions
and
1 deletions
+329
-1
yd-api/src/main/java/com/yd/api/practitioner/PractitionerController.java
+27
-1
yd-api/src/main/java/com/yd/api/practitioner/service/ScheduleTrackService.java
+10
-0
yd-api/src/main/java/com/yd/api/practitioner/service/impl/ScheduleTrackServiceImpl.java
+124
-0
yd-api/src/main/java/com/yd/dal/entity/practitioner/ScheduleTrack.java
+44
-0
yd-api/src/main/java/com/yd/dal/mapper/marketing/ScheduleTrackMapper.java
+16
-0
yd-api/src/main/java/com/yd/util/CommonUtil.java
+14
-0
yd-api/src/main/resources/i18n/messages_zh_CN.properties
+2
-0
yd-api/src/main/resources/mapper/marketing/ScheduleTrackMapper.xml
+92
-0
No files found.
yd-api/src/main/java/com/yd/api/practitioner/PractitionerController.java
View file @
dfd7cccd
...
@@ -2,6 +2,7 @@ package com.yd.api.practitioner;
...
@@ -2,6 +2,7 @@ package com.yd.api.practitioner;
import
com.yd.api.practitioner.service.PractitionerBasicInfoService
;
import
com.yd.api.practitioner.service.PractitionerBasicInfoService
;
import
com.yd.api.practitioner.service.PractitionerService
;
import
com.yd.api.practitioner.service.PractitionerService
;
import
com.yd.api.practitioner.service.ScheduleTrackService
;
import
com.yd.api.practitioner.vo.login.PractitionerLoginRequestVO
;
import
com.yd.api.practitioner.vo.login.PractitionerLoginRequestVO
;
import
com.yd.api.practitioner.vo.login.PractitionerLoginResponseVO
;
import
com.yd.api.practitioner.vo.login.PractitionerLoginResponseVO
;
import
com.yd.api.practitioner.vo.media.MediaGetReqVO
;
import
com.yd.api.practitioner.vo.media.MediaGetReqVO
;
...
@@ -25,6 +26,7 @@ import com.yd.api.practitioner.vo.setting.*;
...
@@ -25,6 +26,7 @@ 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
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.*
;
...
@@ -38,7 +40,8 @@ public class PractitionerController {
...
@@ -38,7 +40,8 @@ public class PractitionerController {
private
PractitionerService
practitionerService
;
private
PractitionerService
practitionerService
;
@Autowired
@Autowired
private
PractitionerBasicInfoService
practitionerBasicInfoService
;
private
PractitionerBasicInfoService
practitionerBasicInfoService
;
@Autowired
private
ScheduleTrackService
scheduleTrackService
;
/**
/**
* 经纪人登录
* 经纪人登录
* @param requestVO 请求数据
* @param requestVO 请求数据
...
@@ -501,4 +504,27 @@ public class PractitionerController {
...
@@ -501,4 +504,27 @@ public class PractitionerController {
result
.
setData
(
responseVO
);
result
.
setData
(
responseVO
);
return
result
;
return
result
;
}
}
/**
* 新建日程
* @param schedule
* @return
*/
@RequestMapping
(
"/addScheduleTrack"
)
public
Object
addScheduleTrack
(
@RequestBody
ScheduleTrack
schedule
){
JsonResult
result
=
scheduleTrackService
.
insert
(
schedule
);
return
result
;
}
/**
* 根据经纪人id查询日程列表
* @param practitionerId 经纪人id
* @param trackDate 查询日期
* @return
*/
@RequestMapping
(
"/queryScheduleTrackList"
)
public
Object
queryScheduleTrackList
(
@RequestParam
(
"practitionerId"
)
Long
practitionerId
,
@RequestParam
(
"trackDate"
)
String
trackDate
){
JsonResult
result
=
scheduleTrackService
.
queryScheduleTrackList
(
practitionerId
,
trackDate
);
return
result
;
}
}
}
yd-api/src/main/java/com/yd/api/practitioner/service/ScheduleTrackService.java
0 → 100644
View file @
dfd7cccd
package
com
.
yd
.
api
.
practitioner
.
service
;
import
com.yd.api.result.JsonResult
;
import
com.yd.dal.entity.practitioner.ScheduleTrack
;
public
interface
ScheduleTrackService
{
JsonResult
insert
(
ScheduleTrack
schedule
);
JsonResult
queryScheduleTrackList
(
Long
practitionerId
,
String
trackDate
);
}
yd-api/src/main/java/com/yd/api/practitioner/service/impl/ScheduleTrackServiceImpl.java
0 → 100644
View file @
dfd7cccd
package
com
.
yd
.
api
.
practitioner
.
service
.
impl
;
import
com.yd.api.practitioner.service.ScheduleTrackService
;
import
com.yd.api.practitioner.vo.organization.OrganizationQueryResponseVO
;
import
com.yd.api.result.JsonResult
;
import
com.yd.dal.entity.practitioner.ScheduleTrack
;
import
com.yd.dal.mapper.marketing.ScheduleTrackMapper
;
import
com.yd.util.CommonUtil
;
import
com.yd.util.config.ZHBErrorConfig
;
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
;
@Service
public
class
ScheduleTrackServiceImpl
implements
ScheduleTrackService
{
@Autowired
private
ScheduleTrackMapper
scheduleTrackMapper
;
@Override
public
JsonResult
insert
(
ScheduleTrack
schedule
)
{
JsonResult
result
=
new
JsonResult
();
result
.
setSuccess
(
false
);
try
{
String
taskTimeFrom
=
schedule
.
getTaskTimeFrom
();
String
taskTimeEnd
=
schedule
.
getTaskTimeEnd
();
Long
practitionerId
=
schedule
.
getPractitionerId
();
// 判断活动时间段是否冲突
if
(!
CommonUtil
.
isNullOrBlank
(
taskTimeFrom
)
&&
!
CommonUtil
.
isNullOrBlank
(
taskTimeEnd
))
{
int
count
=
scheduleTrackMapper
.
checkTimePeriodConflict
(
taskTimeFrom
,
taskTimeEnd
,
practitionerId
);
if
(
count
>
0
)
{
result
.
setMessage
(
ZHBErrorConfig
.
getErrorInfo
(
"830020"
));
return
result
;
}
}
else
{
result
.
setMessage
(
"taskTimeFrom,taskTimeEnd不能为空"
);
return
result
;
}
schedule
.
setCreatedBy
(
practitionerId
);
schedule
.
setUpdatedBy
(
practitionerId
);
schedule
.
setUpdatorType
(
2
);
schedule
.
setCreatorType
(
2
);
Date
curTime
=
new
Date
();
schedule
.
setUpdatedAt
(
new
Date
());
schedule
.
setCreatedAt
(
curTime
);
scheduleTrackMapper
.
insert
(
schedule
);
result
.
setSuccess
(
true
);
result
.
setMessage
(
ZHBErrorConfig
.
getErrorInfo
(
"800000"
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
result
.
setMessage
(
e
.
getMessage
());
}
return
result
;
}
@Override
public
JsonResult
queryScheduleTrackList
(
Long
practitionerId
,
String
trackDate
)
{
JsonResult
result
=
new
JsonResult
();
result
.
setSuccess
(
false
);
if
(
StringUtils
.
isEmpty
(
trackDate
)
||
null
==
practitionerId
)
{
result
.
setMessage
(
"经纪人id和查询时间不能为空"
);
return
result
;
}
List
<
ScheduleTrack
>
showList
=
new
ArrayList
<>();
try
{
List
<
ScheduleTrack
>
dataList
=
scheduleTrackMapper
.
queryScheduleTrackList
(
practitionerId
);
for
(
ScheduleTrack
schedule:
dataList
)
{
if
(
this
.
checkFixedDay
(
trackDate
,
schedule
))
{
showList
.
add
(
schedule
);
}
}
result
.
setData
(
showList
);
result
.
setSuccess
(
true
);
result
.
setMessage
(
ZHBErrorConfig
.
getErrorInfo
(
"800000"
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
result
.
setMessage
(
e
.
getMessage
());
}
return
result
;
}
private
boolean
checkFixedDay
(
String
trackDate
,
ScheduleTrack
track
)
{
Date
date
=
CommonUtil
.
stringParseDate
(
trackDate
,
"yyyy-MM-dd"
);
String
week
=
CommonUtil
.
getWeekOfDate
(
date
);
String
trackTime
=
CommonUtil
.
dateParseString
(
track
.
getTrackTime
(),
"yyyy-MM-dd"
);
int
flag
=
0
;
switch
(
week
)
{
case
"周一"
:
flag
=
track
.
getTaskRoutineAtweek1
();
break
;
case
"周二"
:
flag
=
track
.
getTaskRoutineAtweek2
();
break
;
case
"周三"
:
flag
=
track
.
getTaskRoutineAtweek3
();
break
;
case
"周四"
:
flag
=
track
.
getTaskRoutineAtweek4
();
break
;
case
"周五"
:
flag
=
track
.
getTaskRoutineAtweek5
();
break
;
case
"周六"
:
flag
=
track
.
getTaskRoutineAtweek6
();
break
;
case
"周日"
:
flag
=
track
.
getTaskRoutineAtweek7
();
break
;
default
:
break
;
}
if
(
CommonUtil
.
isToday
(
trackTime
)
||
flag
==
1
)
{
return
true
;
}
else
{
return
false
;
}
}
}
yd-api/src/main/java/com/yd/dal/entity/practitioner/ScheduleTrack.java
0 → 100644
View file @
dfd7cccd
package
com
.
yd
.
dal
.
entity
.
practitioner
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.util.Date
;
@Data
public
class
ScheduleTrack
{
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
Long
mdDropOptionId
;
private
Integer
trackScore
;
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@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
;
}
yd-api/src/main/java/com/yd/dal/mapper/marketing/ScheduleTrackMapper.java
0 → 100644
View file @
dfd7cccd
package
com
.
yd
.
dal
.
mapper
.
marketing
;
import
com.yd.dal.entity.practitioner.ScheduleTrack
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
public
interface
ScheduleTrackMapper
{
void
insert
(
ScheduleTrack
schedule
);
List
<
ScheduleTrack
>
queryScheduleTrackList
(
@Param
(
"practitionerId"
)
Long
practitionerId
);
int
checkTimePeriodConflict
(
@Param
(
"taskTimeFrom"
)
String
taskTimeFrom
,
@Param
(
"taskTimeEnd"
)
String
taskTimeEnd
,
@Param
(
"practitionerId"
)
Long
practitionerId
);
}
yd-api/src/main/java/com/yd/util/CommonUtil.java
View file @
dfd7cccd
...
@@ -1451,4 +1451,18 @@ public class CommonUtil {
...
@@ -1451,4 +1451,18 @@ public class CommonUtil {
}
}
return
false
;
return
false
;
}
}
/**
* 根据日期获得星期
* @param date
* @return
*/
public
static
String
getWeekOfDate
(
Date
date
)
{
String
[]
weekDaysName
=
{
"周日"
,
"周一"
,
"周二"
,
"周三"
,
"周四"
,
"周五"
,
"周六"
};
String
[]
weekDaysCode
=
{
"0"
,
"1"
,
"2"
,
"3"
,
"4"
,
"5"
,
"6"
};
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTime
(
date
);
int
intWeek
=
calendar
.
get
(
Calendar
.
DAY_OF_WEEK
)
-
1
;
return
weekDaysCode
[
intWeek
];
}
}
}
yd-api/src/main/resources/i18n/messages_zh_CN.properties
View file @
dfd7cccd
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
######################用户提示信息########################
######################用户提示信息########################
800000
=
执行成功!
800000
=
执行成功!
800001
=
执行失败!
##系统提示信息
##系统提示信息
810001
=
token无效或者错误!
810001
=
token无效或者错误!
820001
=
未查询到相应结果。
820001
=
未查询到相应结果。
...
@@ -22,6 +23,7 @@
...
@@ -22,6 +23,7 @@
830007
=
上传头像失败,请重新上传!
830007
=
上传头像失败,请重新上传!
830008
=
上传生活照失败,请重新上传!
830008
=
上传生活照失败,请重新上传!
830009
=
上传微信二维码失败,请重新上传!
830009
=
上传微信二维码失败,请重新上传!
830020
=
活动时间段冲突
830010
=
该用户已经注册为银盾经纪人
830010
=
该用户已经注册为银盾经纪人
830011
=
该增员已存在!
830011
=
该增员已存在!
830012
=
请填写跟进时间!
830012
=
请填写跟进时间!
...
...
yd-api/src/main/resources/mapper/marketing/ScheduleTrackMapper.xml
0 → 100644
View file @
dfd7cccd
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.yd.dal.mapper.marketing.ScheduleTrackMapper"
>
<resultMap
id=
"ScheduleTrackResultMap"
type=
"com.yd.dal.entity.practitioner.ScheduleTrack"
>
<id
column=
"id"
jdbcType=
"BIGINT"
property=
"id"
/>
<result
column=
"notice"
jdbcType=
"VARCHAR"
property=
"notice"
/>
<result
column=
"task_type"
jdbcType=
"INTEGER"
property=
"taskType"
/>
<result
column=
"refer_leads_id"
jdbcType=
"BIGINT"
property=
"referLeadsId"
/>
<result
column=
"refer_potential_id"
jdbcType=
"BIGINT"
property=
"referPotentialId"
/>
<result
column=
"task_important_tag"
jdbcType=
"INTEGER"
property=
"taskImportantTag"
/>
<result
column=
"task_routine_at_week7"
jdbcType=
"INTEGER"
property=
"taskRoutineAtweek7"
/>
<result
column=
"task_routine_at_week5"
jdbcType=
"INTEGER"
property=
"taskRoutineAtweek6"
/>
<result
column=
"task_routine_at_week4"
jdbcType=
"INTEGER"
property=
"taskRoutineAtweek5"
/>
<result
column=
"task_routine_at_week4"
jdbcType=
"INTEGER"
property=
"taskRoutineAtweek4"
/>
<result
column=
"task_routine_at_week3"
jdbcType=
"INTEGER"
property=
"taskRoutineAtweek3"
/>
<result
column=
"task_routine_at_week2"
jdbcType=
"INTEGER"
property=
"taskRoutineAtweek2"
/>
<result
column=
"task_routine_at_week1"
jdbcType=
"INTEGER"
property=
"taskRoutineAtweek1"
/>
<result
column=
"task_time_from"
jdbcType=
"VARCHAR"
property=
"taskTimeFrom"
/>
<result
column=
"task_time_end"
jdbcType=
"VARCHAR"
property=
"taskTimeEnd"
/>
<result
column=
"is_active"
jdbcType=
"INTEGER"
property=
"isActive"
/>
<result
column=
"practitioner_id"
jdbcType=
"BIGINT"
property=
"practitionerId"
/>
<result
column=
"customer_id"
jdbcType=
"BIGINT"
property=
"customerId"
/>
<result
column=
"md_drop_option_id"
jdbcType=
"BIGINT"
property=
"mdDropOptionId"
/>
<result
column=
"track_score"
jdbcType=
"INTEGER"
property=
"trackScore"
/>
<result
column=
"track_time"
jdbcType=
"TIMESTAMP"
property=
"trackTime"
/>
<result
column=
"created_at"
jdbcType=
"TIMESTAMP"
property=
"createdAt"
/>
<result
column=
"created_by"
jdbcType=
"BIGINT"
property=
"createdBy"
/>
<result
column=
"updated_at"
jdbcType=
"TIMESTAMP"
property=
"updatedAt"
/>
<result
column=
"updated_by"
jdbcType=
"BIGINT"
property=
"updatedBy"
/>
<result
column=
"updator_type"
jdbcType=
"INTEGER"
property=
"updatorType"
/>
<result
column=
"creator_type"
jdbcType=
"INTEGER"
property=
"creatorType"
/>
</resultMap>
<select
id=
"queryScheduleTrackList"
resultMap=
"ScheduleTrackResultMap"
>
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_routine_at_week4, task_routine_at_week3, task_routine_at_week2, task_routine_at_week1,
task_time_from, task_time_end, is_active, practitioner_id, customer_id, md_drop_option_id, track_score, track_time,
created_at, created_by, updated_at, updated_by, updator_type, creator_type
FROM
ag_mkt_schedule_task_tracking t
WHERE practitioner_id = #{practitionerId,jdbcType=BIGINT}
ORDER BY task_time_from DESC
</select>
<insert
id=
"insert"
keyColumn=
"id"
keyProperty=
"id"
parameterType=
"com.yd.dal.entity.practitioner.ScheduleTrack"
useGeneratedKeys=
"true"
>
insert into ag_mkt_schedule_task_tracking
(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_routine_at_week4, task_routine_at_week3, task_routine_at_week2, task_routine_at_week1,
task_time_from, task_time_end, is_active, practitioner_id, customer_id, md_drop_option_id, track_score, track_time,
created_at, created_by, updated_at, updated_by, updator_type,creator_type )
values (#{notice,jdbcType=VARCHAR},
#{taskType,jdbcType=INTEGER},
#{referLeadsId,jdbcType=BIGINT},
#{referPotentialId,jdbcType=BIGINT},
#{taskImportantTag,jdbcType=INTEGER},
#{taskRoutineAtweek7,jdbcType=INTEGER},
#{taskRoutineAtweek6,jdbcType=INTEGER},
#{taskRoutineAtweek5,jdbcType=INTEGER},
#{taskRoutineAtweek4,jdbcType=INTEGER},
#{taskRoutineAtweek3,jdbcType=INTEGER},
#{taskRoutineAtweek2,jdbcType=INTEGER},
#{taskRoutineAtweek1,jdbcType=INTEGER},
#{taskTimeFrom,jdbcType=VARCHAR},
#{taskTimeEnd,jdbcType=VARCHAR},
#{isActive,jdbcType=INTEGER},
#{practitionerId,jdbcType=BIGINT},
#{customerId,jdbcType=BIGINT},
#{mdDropOptionId,jdbcType=BIGINT},
#{trackScore,jdbcType=INTEGER},
#{trackTime,jdbcType=TIMESTAMP},
#{createdAt,jdbcType=TIMESTAMP},
#{createdBy,jdbcType=BIGINT},
#{updatedAt,jdbcType=TIMESTAMP},
#{updatedBy,jdbcType=BIGINT},
#{updatorType,jdbcType=INTEGER},
#{creatorType,jdbcType=INTEGER}
)
</insert>
<select
id=
"checkTimePeriodConflict"
resultType=
"int"
>
SELECT count(1)
FROM ag_mkt_schedule_task_tracking
WHERE practitioner_id = #{practitionerId,jdbcType=BIGINT}
AND task_time_from
<
STR_TO_DATE(#{taskTimeEnd,jdbcType=VARCHAR}, '%H:%i:%s')
AND task_time_end
>
STR_TO_DATE(#{taskTimeFrom,jdbcType=VARCHAR}, '%H:%i:%s')
</select>
</mapper>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment