Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gogirl-miniapp-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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
huluobin
gogirl-miniapp-backend
Commits
c34f9e97
Commit
c34f9e97
authored
Apr 13, 2020
by
huluobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
美甲师评分
parent
a02897e3
Show whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
493 additions
and
296 deletions
+493
-296
ScheduleManageService.java
...gogirl/application/order/serve/ScheduleManageService.java
+5
-5
ScheduleManageServiceImpl.java
...plication/order/serve/impl/ScheduleManageServiceImpl.java
+99
-56
TechScoreRulesServiceImpl.java
...lication/store/career/impl/TechScoreRulesServiceImpl.java
+81
-14
CustomerServiceImpl.java
...l/application/user/customer/impl/CustomerServiceImpl.java
+18
-17
TechScoreRules.java
...n/java/com/gogirl/domain/store/career/TechScoreRules.java
+2
-0
IdleTimeProgramQuery.java
src/main/java/com/gogirl/dto/IdleTimeProgramQuery.java
+0
-127
IdleTimeQry.java
src/main/java/com/gogirl/dto/IdleTimeQry.java
+33
-0
TechScore.java
src/main/java/com/gogirl/dto/TechScore.java
+1
-1
AchievementsPersonaResult.java
.../java/com/gogirl/dto/admin/AchievementsPersonaResult.java
+71
-0
AchievementsPersonaResultPageApiRequest.java
...rl/dto/admin/AchievementsPersonaResultPageApiRequest.java
+20
-0
GogirlProperties.java
...girl/infrastructure/config/property/GogirlProperties.java
+2
-0
PrefixUtils.java
...main/java/com/gogirl/infrastructure/util/PrefixUtils.java
+45
-0
ScheduleManageController.java
...girl/interfaces/order/serve/ScheduleManageController.java
+15
-9
CustomerController.java
...n/java/com/gogirl/interfaces/user/CustomerController.java
+30
-49
FileController.java
src/main/java/com/gogirl/interfaces/user/FileController.java
+40
-0
MessageController.java
...in/java/com/gogirl/interfaces/user/MessageController.java
+15
-14
IdleTimeQuery.java
...om/gogirl/shared/order/serve/query/qry/IdleTimeQuery.java
+5
-4
Period.java
.../java/com/gogirl/shared/order/serve/query/qry/Period.java
+7
-0
application-dev.yml
src/main/resources/application-dev.yml
+1
-0
application-pre.yml
src/main/resources/application-pre.yml
+1
-0
application-prod.yml
src/main/resources/application-prod.yml
+1
-0
application-test.yml
src/main/resources/application-test.yml
+1
-0
No files found.
src/main/java/com/gogirl/application/order/serve/ScheduleManageService.java
View file @
c34f9e97
...
...
@@ -6,13 +6,13 @@ import com.baomidou.mybatisplus.extension.service.IService;
import
com.gogirl.domain.order.serve.ScheduleManage
;
import
com.gogirl.domain.order.serve.ScheduleServe
;
import
com.gogirl.domain.store.store.StoreTechnician
;
import
com.gogirl.dto.IdleTimeProgramQuery
;
import
com.gogirl.dto.LeisureScheduleServe
;
import
com.gogirl.dto.LeisureScheduleServeQuery
;
import
com.gogirl.shared.order.serve.command.schedule.CancelScheduleCommand
;
import
com.gogirl.shared.order.serve.command.schedule.SubmitScheduleCommand
;
import
com.gogirl.shared.order.serve.command.schedule.UpdateScheduleCommand
;
import
com.gogirl.shared.order.serve.query.dto.IdleTimeDTO
;
import
com.gogirl.shared.order.serve.query.qry.IdleTimeQuery
;
import
com.gogirl.shared.order.serve.query.qry.StoreTechnicianPeriod
;
import
com.gogirl.shared.order.serve.query.qry.schedule.ScheduleManagePageQuery
;
...
...
@@ -31,11 +31,11 @@ public interface ScheduleManageService extends IService<ScheduleManage> {
/**
* 普通预约入口查询预约时间
*
* @param
param
param
* @param
query
param
* @return list
* @throws ParseException exception
*/
List
<
IdleTimeDTO
>
queryIdleTime
(
IdleTime
ProgramQuery
param
)
throws
ParseException
,
ExecutionException
,
InterruptedException
;
List
<
IdleTimeDTO
>
queryIdleTime
(
IdleTime
Query
query
)
throws
ParseException
,
ExecutionException
,
InterruptedException
;
/**
* 闲时入口查询预约时间
...
...
@@ -89,7 +89,7 @@ public interface ScheduleManageService extends IService<ScheduleManage> {
*
* @param cmd 提交预约命令
*/
void
submitSchedule
(
SubmitScheduleCommand
cmd
);
void
submitSchedule
(
SubmitScheduleCommand
cmd
)
throws
ParseException
,
ExecutionException
,
InterruptedException
;
/**
* 更新预约
...
...
@@ -97,7 +97,7 @@ public interface ScheduleManageService extends IService<ScheduleManage> {
* @param cmd
* @return
*/
void
updateSchedule
(
SubmitScheduleCommand
cmd
);
void
updateSchedule
(
SubmitScheduleCommand
cmd
)
throws
ParseException
,
ExecutionException
,
InterruptedException
;
/**
* 更新预约前检查
...
...
src/main/java/com/gogirl/application/order/serve/impl/ScheduleManageServiceImpl.java
View file @
c34f9e97
...
...
@@ -23,7 +23,6 @@ import com.gogirl.domain.store.store.StoreClassesTechnician;
import
com.gogirl.domain.store.store.StoreManage
;
import
com.gogirl.domain.store.store.StoreTechnician
;
import
com.gogirl.domain.user.customer.Customer
;
import
com.gogirl.dto.IdleTimeProgramQuery
;
import
com.gogirl.dto.LeisureScheduleServe
;
import
com.gogirl.dto.LeisureScheduleServeQuery
;
import
com.gogirl.infrastructure.common.exception.RRException
;
...
...
@@ -52,7 +51,6 @@ import com.gogirl.shared.order.serve.query.qry.schedule.ScheduleManagePageQuery;
import
com.google.common.collect.Lists
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
...
...
@@ -230,59 +228,39 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper,
@Override
public
List
<
IdleTimeDTO
>
queryIdleTime
(
IdleTime
Program
Query
qry
)
throws
ParseException
,
ExecutionException
,
InterruptedException
{
public
List
<
IdleTimeDTO
>
queryIdleTime
(
IdleTimeQuery
qry
)
throws
ParseException
,
ExecutionException
,
InterruptedException
{
IdleTimeQuery
idleTimeQuery
=
new
IdleTimeQuery
();
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
//美甲师不可用日期列表
List
<
StoreTechnicianPeriod
>
storeTechnicianDTOList
=
this
.
queryStoreTechnicianPeriod
(
qry
.
getId
(),
qry
.
getDepartmentId
(),
qry
.
getScheduleDate
(),
qry
.
getListScheduleServer
().
stream
().
map
(
ScheduleServe:
:
getServeId
).
collect
(
Collectors
.
toList
()));
idleTimeQuery
.
setStoreTechnicianDTOList
(
storeTechnicianDTOList
);
List
<
StoreTechnicianPeriod
>
storeTechnicianDTOList
=
this
.
queryStoreTechnicianPeriod
(
qry
.
getId
(),
qry
.
getDepartmentId
(),
qry
.
getScheduleDate
(),
qry
.
getListScheduleServer
().
stream
().
map
(
ScheduleServeQuery:
:
getServeId
).
collect
(
Collectors
.
toList
()));
//查询时段
if
(
ListUtil
.
isEmpty
(
qry
.
getDateTimeList
()))
{
long
workStartTime
=
simpleDateFormat
.
parse
(
qry
.
getScheduleDate
()
+
" 10:00:00"
).
getTime
();
long
workEndTime
=
simpleDateFormat
.
parse
(
qry
.
getScheduleDate
()
+
" 22:00:00"
).
getTime
();
List
<
Long
>
dateTimeList
=
new
ArrayList
<>();
//是否只查询指定时间段
if
(
ListUtil
.
isNotEmpty
(
qry
.
getDateTimeList
()))
{
dateTimeList
=
qry
.
getDateTimeList
();
}
//返回全部时间段
else
{
while
(
workStartTime
<
workEndTime
)
{
dateTimeList
.
add
(
workStartTime
);
workStartTime
=
workStartTime
+
15
*
60000
;
}
qry
.
setDateTimeList
(
dateTimeList
);
}
idleTimeQuery
.
setDateTimeList
(
dateTimeList
);
idleTimeQuery
.
setScheduleServeQueryList
(
qry
.
getListScheduleServer
()
.
stream
()
.
map
(
scheduleServe
->
{
ScheduleServeQuery
scheduleServeQuery
=
new
ScheduleServeQuery
();
BeanUtils
.
copyProperties
(
scheduleServe
,
scheduleServeQuery
);
//款式or服务时间
if
(
scheduleServe
.
getProduceId
()
==
null
)
{
scheduleServeQuery
.
setLengthTimeForEndTime
(
baseServeMapper
.
selectById
(
scheduleServe
.
getServeId
()).
getServiceDuration
());
//预约服务时长和图片
qry
.
getListScheduleServer
().
forEach
(
scheduleServeQuery
->
{
if
(
scheduleServeQuery
.
getProduceId
()
==
null
)
{
scheduleServeQuery
.
setLengthTimeForEndTime
(
baseServeMapper
.
selectById
(
scheduleServeQuery
.
getServeId
()).
getServiceDuration
());
}
else
{
scheduleServeQuery
.
setLengthTimeForEndTime
(
baseProduceMapper
.
selectById
(
scheduleServe
.
getProduceId
()).
getServiceDuration
());
scheduleServeQuery
.
setLengthTimeForEndTime
(
baseProduceMapper
.
selectById
(
scheduleServeQuery
.
getProduceId
()).
getServiceDuration
());
}
BaseServe
baseServe
=
baseServeMapper
.
selectById
(
scheduleServe
.
getServeId
());
log
.
debug
(
"-------,{}"
,
baseServe
.
toString
());
BaseServe
baseServe
=
baseServeMapper
.
selectById
(
scheduleServeQuery
.
getServeId
());
scheduleServeQuery
.
setServePicturePath
(
baseServe
.
getPicturePath
());
scheduleServeQuery
.
setServeName
(
baseServe
.
getName
());
return
scheduleServeQuery
;
})
.
collect
(
Collectors
.
toList
()));
});
//预约服务
List
<
ScheduleServeQuery
>
scheduleServeQueryList
=
idleTimeQuery
.
getScheduleServeQueryList
();
List
<
ScheduleServeQuery
>
scheduleServeQueryList
=
qry
.
getListScheduleServer
();
//预约子服务
List
<
ScheduleServeQuery
>
subScheduleServeQueryLinkedList
=
scheduleServeQueryList
.
stream
()
...
...
@@ -304,11 +282,11 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper,
});
});
ForkJoinPool
myPool
=
new
ForkJoinPool
(
dateTimeList
.
size
());
List
<
IdleTimeDTO
>
idleTimeDTOList
=
new
ArrayList
<>(
dateTimeList
.
size
());
ForkJoinPool
myPool
=
new
ForkJoinPool
(
qry
.
getDateTimeList
()
.
size
());
List
<
IdleTimeDTO
>
idleTimeDTOList
=
new
ArrayList
<>(
qry
.
getDateTimeList
()
.
size
());
myPool
.
submit
(()
->
{
idleTimeQue
ry
.
getDateTimeList
()
q
ry
.
getDateTimeList
()
.
forEach
(
dateTime
->
{
...
...
@@ -327,7 +305,7 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper,
List
<
ScheduleServeQuery
>
cloneMainServeDTOList
=
mainScheduleServeQueryLinkedList
.
stream
().
map
(
CloneUtil:
:
deepClone
).
collect
(
Collectors
.
toList
());
//美甲师深度克隆
List
<
StoreTechnicianPeriod
>
cloneStoreTechnicianDTOList
=
idleTimeQuery
.
getStoreTechnicianDTOList
()
.
stream
().
map
(
CloneUtil:
:
deepClone
).
collect
(
Collectors
.
toList
());
List
<
StoreTechnicianPeriod
>
cloneStoreTechnicianDTOList
=
storeTechnicianDTOList
.
stream
().
map
(
CloneUtil:
:
deepClone
).
collect
(
Collectors
.
toList
());
//构造预约方案树🌲
TreeProgram
treeProgram
=
this
.
rec
(
new
LinkedList
<>(
cloneMainServeDTOList
),
cloneStoreTechnicianDTOList
,
TreeProgram
.
root
());
...
...
@@ -343,6 +321,8 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper,
IdleTimeDTO
idleTimeDTO
=
new
IdleTimeDTO
();
idleTimeDTO
.
setDateTime
(
dateTime
);
idleTimeDTO
.
setTime
(
new
SimpleDateFormat
(
"HH:mm"
).
format
(
new
Date
(
dateTime
)));
/*关键信息 节点是否可用*/
idleTimeDTO
.
setStatus
(!
treeProgram
.
childNull
());
idleTimeDTO
.
setTreeProgram
(
treeProgram
);
idleTimeDTO
.
setDefaultNodeList
(
defaultNodes
);
...
...
@@ -360,7 +340,6 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper,
idleTimeDTO
.
setTreeProgram
(
null
);
});
}
return
idleTimeDTOList
.
stream
().
sorted
(
Comparator
.
comparing
(
IdleTimeDTO:
:
getTime
)).
collect
(
Collectors
.
toList
());
}
...
...
@@ -782,23 +761,85 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper,
latestOfDayString
;
}
private
void
validSubmit
(
S
ubmitScheduleCommand
cmd
)
{
private
void
validSubmit
(
S
cheduleManage
scheduleManage
)
throws
ParseException
,
ExecutionException
,
InterruptedException
{
ScheduleManageCommand
scheduleManageDTO
=
cmd
.
getScheduleManageDTO
();
cmd
.
getScheduleManageDTO
().
getScheduleServeDTOList
().
forEach
(
scheduleServeCommand
->
{
/*用户提交 更新预约校验*/
if
(
SessionUtils
.
isSourceFromCustomer
())
{
if
(
scheduleServeCommand
.
getMainServeId
()
==
null
)
{
BaseServe
baseServe
=
baseServeMapper
.
selectById
(
scheduleServeCommand
.
getServeId
());
/*1、校验同类型服务一天只能预约一次*/
scheduleManage
.
getListScheduleServer
().
forEach
(
scheduleServe
->
{
if
(
scheduleServe
.
getMainServeId
()
==
null
)
{
BaseServe
baseServe
=
baseServeMapper
.
selectById
(
scheduleServe
.
getServeId
());
List
<
ScheduleServe
>
typeConflictScheduleServe
=
scheduleServeMapper
.
selectConflictType
(
scheduleManageDTO
.
getScheduledUser
(),
scheduleManageDTO
.
getArriveTime
(),
scheduleManage
.
getScheduledUser
(),
scheduleManage
.
getArriveTime
(),
baseServe
.
getSchTypeId
(),
scheduleServeCommand
.
getServeId
());
scheduleServe
.
getServeId
());
if
(
ListUtil
.
isNotEmpty
(
typeConflictScheduleServe
))
{
throw
new
RRException
(
"同类型服务一天只能预约一次"
);
}
}
});
/*2、校验提交的预约时间是否可约*/
IdleTimeQuery
query
=
new
IdleTimeQuery
();
query
.
setDepartmentId
(
scheduleManage
.
getDepartmentId
());
query
.
setScheduleDate
(
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
scheduleManage
.
getArriveTime
()));
query
.
setListScheduleServer
(
scheduleManage
.
getListScheduleServer
()
.
stream
()
.
map
(
scheduleServeCommand
->
{
ScheduleServeQuery
scheduleServe
=
new
ScheduleServeQuery
();
scheduleServe
.
setLengthTimeForEndTime
(
scheduleServeCommand
.
getLengthTime
());
scheduleServe
.
setProduceId
(
scheduleServeCommand
.
getProduceId
());
scheduleServe
.
setServeId
(
scheduleServeCommand
.
getServeId
());
return
scheduleServe
;
})
.
collect
(
Collectors
.
toList
()));
query
.
setShowNodeDetail
(
true
);
query
.
setDateTimeList
(
Lists
.
newArrayList
(
scheduleManage
.
getArriveTime
().
getTime
()));
List
<
IdleTimeDTO
>
idleTimeDTOList
=
this
.
queryIdleTime
(
query
);
IdleTimeDTO
idleTimeDTO
=
idleTimeDTOList
.
stream
().
findAny
().
orElseThrow
(
NullPointerException:
:
new
);
if
(!
idleTimeDTO
.
isStatus
())
{
throw
new
RRException
(
"预约时间不可用"
);
}
/*3、判断美甲师是否是可用的美甲师*/
//构造子树
List
<
TreeProgram
>
treeProgramList
=
new
ArrayList
<>();
TreeProgram
treeProgram
=
new
TreeProgram
();
List
<
ScheduleServe
>
scheduleServeList
=
scheduleManage
.
getListScheduleServer
()
.
stream
()
.
filter
(
scheduleServe
->
scheduleServe
.
getServeId
()
==
null
)
.
collect
(
Collectors
.
toList
());
List
<
List
<
ScheduleServe
>>
params
=
new
ArrayList
<>();
scheduleServeList
.
forEach
(
scheduleServe
->
{
params
.
add
(
CloneUtil
.
deepClone
(
scheduleServeList
));
});
}
}
/**
* 通过ScheduleServe构建TreeProgram
*
* @param scheduleServe
* @return
*/
private
final
TreeProgram
getNode
(
ScheduleServe
scheduleServe
)
{
TreeProgram
node
=
new
TreeProgram
();
StoreTechnicianPeriod
storeTechnicianPeriod
=
new
StoreTechnicianPeriod
();
storeTechnicianPeriod
.
setTechnicianId
(
scheduleServe
.
getTechnicianId
());
node
.
setStoreTechnicianDTO
(
storeTechnicianPeriod
);
ScheduleServeQuery
scheduleServeQuery
=
new
ScheduleServeQuery
();
scheduleServeQuery
.
setServeId
(
scheduleServe
.
getServeId
());
scheduleServeQuery
.
setProduceId
(
scheduleServe
.
getProduceId
());
scheduleServeQuery
.
setLengthTimeForEndTime
(
scheduleServe
.
getLengthTimeForEndTime
());
Period
period
=
new
Period
(
scheduleServe
.
getStartTime
(),
scheduleServe
.
getEndTime
());
scheduleServeQuery
.
setPeriod
(
period
);
node
.
setScheduleServeQuery
(
scheduleServeQuery
);
return
node
;
}
private
String
getScheduleNo
(
Integer
debarmentId
)
{
...
...
@@ -825,18 +866,20 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper,
}
@Override
public
void
submitSchedule
(
SubmitScheduleCommand
cmd
)
{
this
.
validSubmit
(
cmd
);
public
void
submitSchedule
(
SubmitScheduleCommand
cmd
)
throws
ParseException
,
ExecutionException
,
InterruptedException
{
/*1、校验*/
cmd
.
getScheduleManageDTO
().
setScheduledUser
(
SessionUtils
.
getCustomerId
());
ScheduleManage
scheduleManage
=
this
.
setScheduleServe
(
cmd
.
getScheduleManageDTO
(),
cmd
.
getDefaultNodeList
());
this
.
validSubmit
(
scheduleManage
);
//状态 已预约
scheduleManage
.
setStatus
(
ScheduleManage
.
STATUS_SCHEDULED
);
//最近更新时间
scheduleManage
.
setLastUpdateTime
(
new
Date
());
//预约时间
scheduleManage
.
setScheduledTime
(
new
Date
());
//
scheduleManage
.
setRemark
(
scheduleManage
.
getScheduledUser
()
+
"用户提交预约"
);
//保存预约
scheduleManageMapper
.
insert
(
scheduleManage
);
...
...
@@ -850,15 +893,15 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper,
}
@Override
public
void
updateSchedule
(
SubmitScheduleCommand
cmd
)
{
public
void
updateSchedule
(
SubmitScheduleCommand
cmd
)
throws
ParseException
,
ExecutionException
,
InterruptedException
{
log
.
info
(
"更新预约:{}"
,
cmd
);
if
(
SessionUtils
.
isSourceFromCustomer
())
{
this
.
validSubmit
(
cmd
);
}
ScheduleManage
scheduleManage
=
this
.
setScheduleServe
(
cmd
.
getScheduleManageDTO
(),
cmd
.
getDefaultNodeList
());
ScheduleManage
scheduleManage
=
this
.
setScheduleServe
(
cmd
.
getScheduleManageDTO
(),
cmd
.
getDefaultNodeList
());
if
(
SessionUtils
.
isSourceFromCustomer
())
{
this
.
validSubmit
(
scheduleManage
);
}
scheduleManage
.
setLastUpdateTime
(
new
Date
());
//更次预约
scheduleManageMapper
.
updateById
(
scheduleManage
);
...
...
src/main/java/com/gogirl/application/store/career/impl/TechScoreRulesServiceImpl.java
View file @
c34f9e97
package
com
.
gogirl
.
application
.
store
.
career
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.gogirl.application.store.career.ITechScoreRulesService
;
import
com.gogirl.domain.store.career.Career
;
import
com.gogirl.domain.store.career.TechScoreRules
;
import
com.gogirl.dto.TechScore
;
import
com.gogirl.dto.admin.AchievementsPersonaResult
;
import
com.gogirl.dto.admin.AchievementsPersonaResultPageApiRequest
;
import
com.gogirl.dto.admin.AdminPage
;
import
com.gogirl.dto.admin.AdminResult
;
import
com.gogirl.infrastructure.config.property.GogirlProperties
;
import
com.gogirl.infrastructure.mapper.store.career.CareerMapper
;
import
com.gogirl.infrastructure.mapper.store.career.TechScoreRulesMapper
;
import
com.gogirl.infrastructure.util.SessionUtils
;
import
lombok.AllArgsConstructor
;
import
org.springframework.core.ParameterizedTypeReference
;
import
org.springframework.http.HttpEntity
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpMethod
;
import
org.springframework.http.MediaType
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.client.RestTemplate
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.List
;
/**
...
...
@@ -23,24 +34,80 @@ import java.util.List;
* @since 2020-03-12
*/
@Service
@AllArgsConstructor
public
class
TechScoreRulesServiceImpl
extends
ServiceImpl
<
TechScoreRulesMapper
,
TechScoreRules
>
implements
ITechScoreRulesService
{
private
final
CareerMapper
careerMapper
;
@Resource
private
CareerMapper
careerMapper
;
@Resource
RestTemplate
restTemplate
;
@Resource
GogirlProperties
gogirlProperties
;
@Override
public
TechScore
getTechScore
()
{
Integer
technicianId
=
SessionUtils
.
getTechnicianId
();
List
<
TechScoreRules
>
techScoreRulesList
=
this
.
list
();
Career
career
=
careerMapper
.
selectOne
(
new
LambdaQueryWrapper
<
Career
>()
.
eq
(
Career:
:
getTechnicianId
,
technicianId
));
HttpHeaders
httpHeaders
=
new
HttpHeaders
();
httpHeaders
.
setContentType
(
MediaType
.
APPLICATION_JSON
);
Calendar
calendar
=
Calendar
.
getInstance
();
AchievementsPersonaResultPageApiRequest
resultPageApiRequest
=
AchievementsPersonaResultPageApiRequest
.
builder
()
.
page
(
1
)
.
year
(
calendar
.
get
(
Calendar
.
YEAR
))
.
month
(
calendar
.
get
(
Calendar
.
MONTH
))
.
status
(
1
)
.
page
(
1
)
.
rows
(
30
)
.
sidx
(
""
)
.
sord
(
"desc"
)
.
technician_id
(
SessionUtils
.
getTechnicianId
())
.
build
();
HttpEntity
<
AchievementsPersonaResultPageApiRequest
>
httpEntity
=
new
HttpEntity
<>(
resultPageApiRequest
,
httpHeaders
);
ParameterizedTypeReference
<
AdminResult
<
AdminPage
<
AchievementsPersonaResult
>>>
responseBodyType
=
new
ParameterizedTypeReference
<
AdminResult
<
AdminPage
<
AchievementsPersonaResult
>>>()
{
};
AdminResult
<
AdminPage
<
AchievementsPersonaResult
>>
result
=
restTemplate
.
exchange
(
gogirlProperties
.
getAdminBackendAchievementsUrl
(),
HttpMethod
.
POST
,
httpEntity
,
responseBodyType
).
getBody
();
AchievementsPersonaResult
achievementsPersonaResult
=
result
.
getData
().
getItems
().
stream
().
findAny
().
orElseThrow
(
NullPointerException:
:
new
);
TechScore
techScore
=
new
TechScore
();
techScore
.
setTechScore
(
achievementsPersonaResult
.
getMonth_score
().
doubleValue
());
List
<
TechScoreRules
>
techScoreRulesList
=
new
ArrayList
<>();
String
card
=
String
.
format
(
"开卡得分:%s。开卡率:%s。权重:%s。规则:20%%该项满分、5%%该项0分。可以超过100分"
,
achievementsPersonaResult
.
getActivate_a_card_score
().
toString
(),
achievementsPersonaResult
.
getActivate_a_card_val
().
toString
()
,
achievementsPersonaResult
.
getActivate_a_card_proportion_str
());
TechScoreRules
t1
=
TechScoreRules
.
builder
().
sort
(
1
).
techScoreRules
(
card
).
build
();
techScoreRulesList
.
add
(
t1
);
//好评得分
String
comment
=
String
.
format
(
"好评率得分:%s。好评率:%s。权重:%s。规则:分数=好评(>3星)数/总评论数*100,评论包括所有渠道投诉。"
,
achievementsPersonaResult
.
getPraise_score
().
toString
()
,
achievementsPersonaResult
.
getPraise_val
().
toString
()
,
achievementsPersonaResult
.
getPraise_proportion_str
());
TechScoreRules
t2
=
TechScoreRules
.
builder
().
sort
(
2
).
techScoreRules
(
comment
).
build
();
techScoreRulesList
.
add
(
t2
);
//服务准时得分
String
serviceTime
=
String
.
format
(
"服务准时得分: %s。服务准时得分率:%s。权重: %s。规则:+10%%,-20%%以内为准。90%%出勤率为满分"
,
achievementsPersonaResult
.
getService_time_score
().
toString
()
,
achievementsPersonaResult
.
getService_time_val
().
toString
()
,
achievementsPersonaResult
.
getService_time_proportion_str
());
TechScoreRules
t3
=
TechScoreRules
.
builder
().
sort
(
3
).
techScoreRules
(
serviceTime
).
build
();
techScoreRulesList
.
add
(
t3
);
//店务得分
String
shop
=
String
.
format
(
"店务得分:%s。权重:%s。规则:该项得分为满分,抽查发现问题时一个问题扣1分"
,
achievementsPersonaResult
.
getShop_item_score
().
toString
()
,
achievementsPersonaResult
.
getShop_item_proportion_str
());
TechScoreRules
t4
=
TechScoreRules
.
builder
().
sort
(
4
).
techScoreRules
(
shop
).
build
();
techScoreRulesList
.
add
(
t4
);
//总分
String
total
=
String
.
format
(
"总分:%s。规则:按月计算,达到满分以上奖励300元,低于80分罚500元"
,
achievementsPersonaResult
.
getMonth_score
().
toString
());
TechScoreRules
t5
=
TechScoreRules
.
builder
().
sort
(
5
).
techScoreRules
(
total
).
build
();
techScoreRulesList
.
add
(
t5
);
techScore
.
setTechScoreRulesList
(
techScoreRulesList
);
if
(
career
!=
null
)
{
techScore
.
setTechScore
(
career
.
getTechScore
());
}
else
{
techScore
.
setTechScore
(
0
);
}
return
techScore
;
}
}
src/main/java/com/gogirl/application/user/customer/impl/CustomerServiceImpl.java
View file @
c34f9e97
...
...
@@ -12,7 +12,6 @@ import com.gogirl.application.xcx.WechatService;
import
com.gogirl.domain.order.serve.OrderManage
;
import
com.gogirl.domain.order.serve.OrderRecord
;
import
com.gogirl.domain.order.serve.OrderServe
;
import
com.gogirl.domain.order.serve.ScheduleManage
;
import
com.gogirl.domain.product.serve.BaseServe
;
import
com.gogirl.domain.store.store.StoreManage
;
import
com.gogirl.domain.user.customer.Customer
;
...
...
@@ -22,7 +21,6 @@ import com.gogirl.domain.xcx.GogirlConfig;
import
com.gogirl.domain.xcx.GogirlToken
;
import
com.gogirl.dto.customer.CustomerOrderDetail
;
import
com.gogirl.infrastructure.common.exception.RRException
;
import
com.gogirl.infrastructure.common.util.ListUtil
;
import
com.gogirl.infrastructure.common.util.StringUtils
;
import
com.gogirl.infrastructure.mapper.order.serve.OrderManageMapper
;
import
com.gogirl.infrastructure.mapper.order.serve.OrderRecordMapper
;
...
...
@@ -206,11 +204,12 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
}
@Override
public
Customer
authorized1
(
String
token
,
String
encryptedData
,
String
iv
)
throws
InvalidAlgorithmParameterException
{
public
Customer
authorized1
(
String
token
,
String
encryptedData
,
String
iv
)
{
GogirlToken
gogirlToken
=
gogirlTokenService
.
getByToken
(
token
);
JSONObject
data
=
WxUtils
.
decrypt
(
encryptedData
,
gogirlToken
.
getSessionKey
(),
iv
);
/*1、解密微信用户数据*/
String
unionid
=
(
String
)
data
.
get
(
"unionId"
);
String
openid
=
(
String
)
data
.
get
(
"openId"
);
Integer
gender
=
(
Integer
)
data
.
get
(
"gender"
);
...
...
@@ -220,8 +219,10 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
String
province
=
(
String
)
data
.
get
(
"province"
);
String
nickName
=
filterEmoji
((
String
)
data
.
get
(
"nickName"
));
/*2、根据openid查询用户*/
Customer
customer
=
customerMapper
.
selectOne
(
new
LambdaQueryWrapper
<
Customer
>().
eq
(
Customer:
:
getOpenid1
,
openid
));
/*3、更新用户*/
customer
.
setSex
(
gender
==
1
?
"男"
:
gender
==
2
?
"女"
:
"未知"
);
customer
.
setHeadimgurl
(
avatarUrl
);
customer
.
setNickname
(
nickName
);
...
...
@@ -237,21 +238,25 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
public
Customer
authorizedPhone
(
String
token
,
String
encryptedData
,
String
iv
)
throws
InvalidAlgorithmParameterException
{
GogirlToken
gogirlToken
=
gogirlTokenService
.
getByToken
(
token
);
/*1、获取微信用户手机号数据*/
JSONObject
data
=
WxUtils
.
decrypt
(
encryptedData
,
gogirlToken
.
getSessionKey
(),
iv
);
String
phone
=
(
String
)
data
.
get
(
"purePhoneNumber"
);
/*2、更新用户token*/
gogirlToken
.
setPhone
(
phone
);
gogirlTokenService
.
updateByToken
(
gogirlToken
);
Customer
customer
=
customerMapper
.
selectById
(
gogirlToken
.
getCustomerId
());
Customer
phoneCustomer
=
customerMapper
.
selectOne
(
new
LambdaQueryWrapper
<
Customer
>().
eq
(
Customer:
:
getPhone
,
phone
));
//如果存在手机号
if
(
StringUtils
.
isNotEmpty
(
customer
.
getPhone
()))
{
throw
new
RRException
(
"您已经授权过手机号"
);
}
//当前用户没有绑定手机号 ,并且授权的手机号已经存在对应的用户
if
(
phoneCustomer
!=
null
)
{
/*3、将当前用户的信息绑定到授权手机号对应的用户上*/
phoneCustomer
.
setSex
(
customer
.
getSex
());
phoneCustomer
.
setHeadimgurl
(
customer
.
getHeadimgurl
());
phoneCustomer
.
setNickname
(
customer
.
getNickname
());
...
...
@@ -268,23 +273,19 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
phoneCustomer
.
setState
(
customer
.
getState
());
phoneCustomer
.
setUpdateTime
(
new
Date
());
/*3、删除当前用户*/
customerMapper
.
deleteById
(
customer
);
/*4、更新授权手机号对应的用户*/
customerMapper
.
updateById
(
phoneCustomer
);
List
<
ScheduleManage
>
scheduleManageList
=
scheduleManageMapper
.
selectList
(
new
LambdaQueryWrapper
<
ScheduleManage
>()
.
eq
(
ScheduleManage:
:
getTelephone
,
phone
));
if
(
ListUtil
.
isNotEmpty
(
scheduleManageList
))
{
scheduleManageList
.
forEach
(
scheduleManage
->
{
scheduleManage
.
setTelephone
(
phone
);
scheduleManageMapper
.
updateById
(
scheduleManage
);
});
}
//清除token
/*5、清空当前用户登录token*/
gogirlTokenService
.
remove
(
token
);
return
phoneCustomer
;
}
//
不存在手机号
//
当前用户没有绑定手机号 ,授权手机号没有对应用户存在
else
{
/*6、更新当前用户*/
customer
.
setPhone
(
phone
);
customerMapper
.
updateById
(
customer
);
return
customer
;
...
...
src/main/java/com/gogirl/domain/store/career/TechScoreRules.java
View file @
c34f9e97
...
...
@@ -3,6 +3,7 @@ package com.gogirl.domain.store.career;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
io.swagger.annotations.ApiModel
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
...
...
@@ -18,6 +19,7 @@ import java.io.Serializable;
* @since 2020-03-12
*/
@Data
@Builder
@EqualsAndHashCode
(
callSuper
=
false
)
@Accessors
(
chain
=
true
)
@ApiModel
(
value
=
"TechScoreRules对象"
,
description
=
""
)
...
...
src/main/java/com/gogirl/dto/IdleTimeProgramQuery.java
deleted
100644 → 0
View file @
a02897e3
package
com
.
gogirl
.
dto
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.gogirl.domain.order.serve.ScheduleServe
;
import
com.gogirl.domain.user.customer.Customer
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.Date
;
import
java.util.List
;
@Data
public
class
IdleTimeProgramQuery
{
private
Integer
id
;
//修改预约的时候,修改前的id
@ApiModelProperty
(
"修改预约的时候,修改前的id"
)
private
Integer
oldId
;
@ApiModelProperty
(
"预约订单号"
)
private
String
scheduledNo
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@ApiModelProperty
(
"预约时间"
)
private
Date
scheduledTime
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@ApiModelProperty
(
"最近修改时间"
)
private
Date
lastUpdateTime
;
@ApiModelProperty
(
"下单人id"
)
private
Integer
scheduledUser
;
@ApiModelProperty
(
"店铺端预约用户名"
)
private
String
storeScheduleUsername
;
@ApiModelProperty
(
"店铺端预约手机号码"
)
private
String
telephone
;
@ApiModelProperty
(
"预约到达时间字符串"
)
private
String
arriveTimeString
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@ApiModelProperty
(
"预约到达时间"
)
private
Date
arriveTime
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@ApiModelProperty
(
"上次服务时间"
)
private
Date
lastServiceTime
;
@ApiModelProperty
(
"到店人"
)
private
String
arriveUser
;
@ApiModelProperty
(
"下单店铺id"
)
private
Integer
departmentId
;
@ApiModelProperty
(
"备注"
)
private
String
remark
;
@ApiModelProperty
(
"删除备注"
)
private
String
delRemaerk
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@ApiModelProperty
(
"开单时间"
)
private
Date
openbillTime
;
@ApiModelProperty
(
"已预约#1 失约#2 守约#3 已取消#4 已删除#5"
)
private
Integer
status
;
@ApiModelProperty
(
"创建人"
)
private
String
createUser
;
@ApiModelProperty
(
"店铺名称"
)
private
String
departmentName
;
@ApiModelProperty
(
"删除服务字段"
)
private
String
deleteServe
;
@ApiModelProperty
(
"id"
)
private
Integer
scheduledType
;
@ApiModelProperty
(
"提醒类型"
)
private
Integer
remindStatus
;
@ApiModelProperty
(
"已读状态"
)
private
Integer
isRead
;
@ApiModelProperty
(
"统计开始时间"
)
private
String
startTime
;
@ApiModelProperty
(
"统计结束时间"
)
private
String
endTime
;
@ApiModelProperty
(
"分页查询当天预约"
)
private
String
sameDayTime
;
@ApiModelProperty
(
"发送服务通知需要的formId"
)
private
String
formId
;
/**
* 非数据库字段
*/
@TableField
(
exist
=
false
)
@ApiModelProperty
(
"token"
)
private
String
token
;
@TableField
(
exist
=
false
)
@ApiModelProperty
(
"预约时间"
)
private
String
scheduleDate
;
@TableField
(
exist
=
false
)
@ApiModelProperty
(
"预约下服务列表"
)
private
List
<
ScheduleServe
>
listScheduleServer
;
@TableField
(
exist
=
false
)
@ApiModelProperty
(
"预约用户信息"
)
private
Customer
customer
;
@TableField
(
exist
=
false
)
private
List
<
Long
>
dateTimeList
;
@TableField
(
exist
=
false
)
private
Boolean
showNodeDetail
;
}
src/main/java/com/gogirl/dto/IdleTimeQry.java
0 → 100644
View file @
c34f9e97
//package com.gogirl.dto;
//
//import com.baomidou.mybatisplus.annotation.TableField;
//import com.gogirl.domain.order.serve.ScheduleServe;
//import com.gogirl.domain.user.customer.Customer;
//import com.gogirl.shared.order.serve.query.qry.ScheduleServeQuery;
//import io.swagger.annotations.ApiModelProperty;
//import lombok.Data;
//
//import java.util.List;
//
//@Data
//public class IdleTimeQry {
//
// private Integer id;
//
// @ApiModelProperty("下单店铺id")
// private Integer departmentId;
//
// @TableField(exist = false)
// @ApiModelProperty("预约时间")
// private String scheduleDate;
//
// @TableField(exist = false)
// @ApiModelProperty("预约下服务列表")
// private List<ScheduleServeQuery> listScheduleServer;
//
// @TableField(exist = false)
// private List<Long> dateTimeList;
//
// @TableField(exist = false)
// private Boolean showNodeDetail;
//}
src/main/java/com/gogirl/dto/TechScore.java
View file @
c34f9e97
...
...
@@ -10,5 +10,5 @@ public class TechScore {
private
List
<
TechScoreRules
>
techScoreRulesList
;
private
Integer
techScore
;
private
Double
techScore
;
}
src/main/java/com/gogirl/dto/admin/AchievementsPersonaResult.java
0 → 100644
View file @
c34f9e97
package
com
.
gogirl
.
dto
.
admin
;
import
lombok.Data
;
import
java.math.BigDecimal
;
@Data
public
class
AchievementsPersonaResult
{
private
String
shop_item_proportion_str
;
//20.00 %;
private
String
marketing_proportion_str
;
//0.00 %;
private
String
activate_a_card_proportion_str
;
//40.00 %;
private
String
repeat_purchase_45_proportion_str
;
//0.00 %;
private
String
complaint_proportion_str
;
//0.00 %;
private
String
study_personal_proportion_str
;
//0.00 %;
private
String
external_training_proportion_str
;
//0.00 %;
private
String
old_belt_new_proportion_str
;
//0.00 %;
private
String
time_weight_month_proportion_str
;
//50.00 %;
private
String
time_weight_quarter_proportion_str
;
//40.00 %;
private
String
time_weight_year_proportion_str
;
//10.00 %;
private
String
information_complete_proportion_str
;
//0.00 %;
private
String
service_time_proportion_str
;
//20.00 %;
private
String
praise_proportion_str
;
//20.00 %;
private
Integer
id
;
//334;
private
Integer
year
;
//2020;
private
Integer
month
;
//4;
private
String
time
;
//2020-04-01T00;//00;//00;
private
Integer
technician_id
;
//99;
private
Integer
store_id
;
//17;
private
String
technician_name
;
//姜晴文;
private
BigDecimal
marketing_score
;
//0.0000;
private
BigDecimal
marketing_val
;
//0.0000;
private
BigDecimal
marketing_proportion
;
//0.0000;
private
BigDecimal
activate_a_card_score
;
//26.6667;
private
BigDecimal
activate_a_card_val
;
//0.0900;
private
BigDecimal
activate_a_card_proportion
;
//0.4000;
private
BigDecimal
repeat_purchase_45_score
;
//0.0000;
private
BigDecimal
repeat_purchase_45_val
;
//0.0000;
private
BigDecimal
repeat_purchase_45_proportion
;
//0.0000;
private
BigDecimal
complaint_score
;
//0.0000;
private
BigDecimal
complaint_val
;
//0.0000;
private
BigDecimal
complaint_proportion
;
//0.0000;
private
BigDecimal
study_personal_score
;
//0.0000;
private
BigDecimal
study_personal_val
;
//0.0000;
private
BigDecimal
study_personal_proportion
;
//0.0000;
private
BigDecimal
external_training_score
;
//0.0000;
private
BigDecimal
external_training_val
;
//0.0000;
private
BigDecimal
external_training_proportion
;
//0.0000;
private
BigDecimal
old_belt_new_score
;
//0.0000;
private
BigDecimal
old_belt_new_val
;
//0.0000;
private
BigDecimal
old_belt_new_proportion
;
//0.0000;
private
BigDecimal
month_score
;
//52.5087;
private
BigDecimal
time_weight_month_proportion
;
//0.5000;
private
BigDecimal
quarter_score
;
//52.5087;
private
BigDecimal
time_weight_quarter_proportion
;
//0.4000;
private
BigDecimal
year_score
;
//65.6661;
private
BigDecimal
time_weight_year_proportion
;
//0.1000;
private
BigDecimal
final_score
;
//53.8244;
private
BigDecimal
information_complete_val
;
//0.0000;
private
BigDecimal
information_complete_score
;
//0.0000;
private
BigDecimal
information_complete_proportion
;
//0.0;
private
BigDecimal
service_time_val
;
//0.2250;
private
BigDecimal
service_time_score
;
//25.0000;
private
BigDecimal
service_time_proportion
;
//0.2000;
private
BigDecimal
praise_val
;
//0.8421;
private
BigDecimal
praise_score
;
//84.2100;
private
BigDecimal
praise_proportion
;
//0.2000;
private
BigDecimal
shop_item_val
;
//0.0000;
private
BigDecimal
shop_item_score
;
//100.0000;
private
BigDecimal
shop_item_proportion
;
//0.2000
}
src/main/java/com/gogirl/dto/admin/AchievementsPersonaResultPageApiRequest.java
0 → 100644
View file @
c34f9e97
package
com
.
gogirl
.
dto
.
admin
;
import
lombok.Builder
;
import
lombok.Data
;
@Data
@Builder
public
class
AchievementsPersonaResultPageApiRequest
{
private
Integer
year
;
private
Integer
month
;
private
Integer
status
;
private
Integer
page
;
private
Integer
rows
;
private
String
sidx
;
private
String
sord
;
private
Integer
technician_id
;
}
src/main/java/com/gogirl/infrastructure/config/property/GogirlProperties.java
View file @
c34f9e97
...
...
@@ -60,4 +60,6 @@ public class GogirlProperties {
* 后台地址
*/
private
String
adminBackendUrl
;
private
String
adminBackendAchievementsUrl
;
}
src/main/java/com/gogirl/infrastructure/util/PrefixUtils.java
View file @
c34f9e97
package
com
.
gogirl
.
infrastructure
.
util
;
import
com.gogirl.infrastructure.common.util.ListUtil
;
import
com.google.common.collect.Lists
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.List
;
...
...
@@ -56,4 +59,46 @@ public class PrefixUtils {
}
static
<
T
>
void
permutation
(
List
<
T
>
source
,
int
i
,
List
<
List
<
T
>>
list
)
{
// 如果为空
if
(
ListUtil
.
isEmpty
(
source
))
return
;
// 如果i指向了最后一个字符
if
(
i
==
source
.
size
()
-
1
)
{
if
(
list
.
contains
(
source
))
return
;
list
.
add
(
source
);
}
else
{
// i指向当前我们做排列操作的字符串的第一个字符
for
(
int
j
=
i
;
j
<
source
.
size
();
j
++)
{
// 把做排列操作的字符串的第一个字符和后面的所有字符交换
T
temp
=
source
.
get
(
j
);
source
.
set
(
j
,
source
.
get
(
i
));
source
.
set
(
i
,
temp
);
// obj[j] = obj[i];
// obj[i] = temp;
// 交换后对i后面的字符串递归做排列操作
permutation
(
source
,
i
+
1
,
list
);
// 每一轮结束后换回来进行下一轮排列操作
// temp = obj[j];
temp
=
source
.
get
(
j
);
// obj[j] = obj[i];
// obj[i] = temp;
source
.
set
(
j
,
source
.
get
(
i
));
source
.
set
(
i
,
temp
);
}
}
}
public
static
void
main
(
String
[]
args
)
{
List
<
List
<
String
>>
lists
=
new
ArrayList
<>();
List
<
String
>
source
=
Lists
.
newArrayList
(
"a1"
,
"b2"
,
"c3"
);
PrefixUtils
.
permutation
(
source
,
0
,
lists
);
for
(
int
i
=
0
;
i
<
lists
.
size
();
i
++)
{
System
.
out
.
println
(
lists
.
get
(
i
)
+
" "
);
}
}
}
src/main/java/com/gogirl/interfaces/order/serve/ScheduleManageController.java
View file @
c34f9e97
...
...
@@ -14,7 +14,6 @@ import com.gogirl.domain.order.serve.ScheduleManage;
import
com.gogirl.domain.product.serve.BaseProduce
;
import
com.gogirl.domain.store.store.StoreTechnician
;
import
com.gogirl.domain.xcx.GogirlToken
;
import
com.gogirl.dto.IdleTimeProgramQuery
;
import
com.gogirl.dto.LeisureScheduleServe
;
import
com.gogirl.dto.LeisureScheduleServeQuery
;
import
com.gogirl.dto.QueryLeisureTechnicianReq
;
...
...
@@ -24,6 +23,7 @@ import com.gogirl.infrastructure.common.util.ListUtil;
import
com.gogirl.infrastructure.mapper.product.purchase.PurchaseSkuMapper
;
import
com.gogirl.infrastructure.mapper.product.serve.BaseProduceMapper
;
import
com.gogirl.infrastructure.util.SessionUtils
;
import
com.gogirl.infrastructure.util.lock.CustomerIdLock
;
import
com.gogirl.infrastructure.util.lock.ScheduleServeIdLock
;
import
com.gogirl.infrastructure.util.lock.ScheduledLock
;
import
com.gogirl.shared.order.serve.command.schedule.CancelScheduleCommand
;
...
...
@@ -31,6 +31,7 @@ import com.gogirl.shared.order.serve.command.schedule.SubmitScheduleCommand;
import
com.gogirl.shared.order.serve.command.schedule.UpdateScheduleCommand
;
import
com.gogirl.shared.order.serve.query.dto.IdleTimeDTO
;
import
com.gogirl.shared.order.serve.query.dto.ScheduleManageDTO
;
import
com.gogirl.shared.order.serve.query.qry.IdleTimeQuery
;
import
com.gogirl.shared.order.serve.query.qry.schedule.ScheduleManagePageQuery
;
import
com.gogirl.shared.product.query.dto.PurchaseSkuDTO
;
import
com.gogirl.shared.user.query.qry.VipServeQuery
;
...
...
@@ -64,7 +65,7 @@ public class ScheduleManageController {
@ApiModelProperty
(
"查询可预约时间列表"
)
@PostMapping
(
"/customer/schedule/queryIdleTime"
)
public
JsonResult
<
List
<
IdleTimeDTO
>>
queryIdleTime
(
@RequestBody
IdleTime
Program
Query
qry
)
throws
ParseException
,
ExecutionException
,
InterruptedException
{
public
JsonResult
<
List
<
IdleTimeDTO
>>
queryIdleTime
(
@RequestBody
IdleTimeQuery
qry
)
throws
ParseException
,
ExecutionException
,
InterruptedException
{
List
<
IdleTimeDTO
>
idleTimeDTOList
=
scheduleManageService
.
queryIdleTime
(
qry
);
return
JsonResult
.
success
(
idleTimeDTOList
);
}
...
...
@@ -82,9 +83,16 @@ public class ScheduleManageController {
@ApiOperation
(
"提交预约"
)
@PostMapping
(
"/customer/schedule/submitSchedule"
)
public
JsonResult
<
Void
>
submitSchedule
(
@RequestHeader
String
token
,
@RequestBody
SubmitScheduleCommand
cmd
)
{
cmd
.
getScheduleManageDTO
().
setScheduledUser
(
SessionUtils
.
getCustomerId
());
@RequestBody
SubmitScheduleCommand
cmd
)
throws
ParseException
,
ExecutionException
,
InterruptedException
{
Integer
customerId
=
SessionUtils
.
getCustomerId
();
CustomerIdLock
lock
=
CustomerIdLock
.
getInsatance
();
try
{
lock
.
lock
(
customerId
);
cmd
.
getScheduleManageDTO
().
setScheduledUser
(
customerId
);
scheduleManageService
.
submitSchedule
(
cmd
);
}
finally
{
lock
.
unlock
(
customerId
);
}
return
JsonResult
.
success
();
}
...
...
@@ -105,10 +113,8 @@ public class ScheduleManageController {
@ApiOperation
(
"用户更新预约"
)
@PostMapping
(
"/customer/schedule/updateSchedule"
)
public
JsonResult
<
Void
>
updateSchedule
(
@RequestHeader
String
token
,
@RequestBody
SubmitScheduleCommand
cmd
)
{
Integer
currentCustomerId
=
Optional
.
ofNullable
(
gogirlTokenService
.
getByToken
(
token
).
getCustomerId
())
.
orElseThrow
(()
->
new
RRException
(
500
,
"token不存在"
));
@RequestBody
SubmitScheduleCommand
cmd
)
throws
ParseException
,
ExecutionException
,
InterruptedException
{
Integer
currentCustomerId
=
SessionUtils
.
getCustomerId
();
cmd
.
getScheduleManageDTO
().
setScheduledUser
(
currentCustomerId
);
ScheduledLock
scheduledLock
=
ScheduledLock
.
getInsatance
();
...
...
@@ -211,7 +217,7 @@ public class ScheduleManageController {
@ApiOperation
(
"更新预约"
)
@PostMapping
(
"/technician/schedule/updateSchedule"
)
public
JsonResult
<
Void
>
updateSchedule
(
@RequestBody
SubmitScheduleCommand
cmd
)
{
public
JsonResult
<
Void
>
updateSchedule
(
@RequestBody
SubmitScheduleCommand
cmd
)
throws
ParseException
,
ExecutionException
,
InterruptedException
{
cmd
.
getScheduleManageDTO
().
setDepartmentId
(
SessionUtils
.
getTechnicianToken
().
getDepartmentId
());
scheduleManageService
.
updateSchedule
(
cmd
);
return
JsonResult
.
success
();
...
...
src/main/java/com/gogirl/interfaces/user/CustomerController.java
View file @
c34f9e97
...
...
@@ -5,13 +5,11 @@ import com.gogirl.domain.user.customer.Customer;
import
com.gogirl.dto.customer.CustomerOrderDetail
;
import
com.gogirl.infrastructure.common.base.JsonResult
;
import
com.gogirl.infrastructure.service.file.FileService
;
import
com.gogirl.infrastructure.util.Base64Utils
;
import
com.gogirl.shared.user.query.qry.CustomerQuery
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.annotation.Resource
;
import
java.security.InvalidAlgorithmParameterException
;
...
...
@@ -50,19 +48,7 @@ public class CustomerController {
return
JsonResult
.
success
();
}
/*cmd接口结束*/
/*query接口开始*/
/*query接口结束*/
@ApiOperation
((
"查询会员"
))
@PostMapping
(
"/customer/xcx/query"
)
public
JsonResult
<
Customer
>
query
(
@RequestBody
CustomerQuery
qry
)
{
Customer
customer
=
customerService
.
getById
(
qry
.
getCustomerId
());
return
JsonResult
.
success
(
customer
);
}
@ApiOperation
(
value
=
"客户根据code获取token"
)
@ApiOperation
(
value
=
"小程序用户登录"
)
@GetMapping
(
"/customer/xcx/login"
)
public
JsonResult
<
String
>
login
(
@RequestParam
String
code
)
{
String
token
=
customerService
.
login
(
code
);
...
...
@@ -81,6 +67,32 @@ public class CustomerController {
return
JsonResult
.
success
(
customer
);
}
@ApiOperation
(
value
=
"h5用户登录"
)
@GetMapping
(
"/customer/no_h5Login"
)
public
JsonResult
<
String
>
h5Login
(
@RequestParam
Integer
orderId
)
{
String
token
=
customerService
.
h5Login
(
orderId
);
return
JsonResult
.
success
(
token
);
}
@ApiOperation
(
value
=
"超时测试接口"
)
@RequestMapping
(
"/customer/testTimeOut"
)
public
JsonResult
<
Void
>
testTimeOut
()
throws
InterruptedException
{
Thread
.
sleep
(
36000L
);
return
JsonResult
.
success
();
}
/*cmd接口结束*/
/*query接口开始*/
@ApiOperation
(
"查询会员"
)
@PostMapping
(
"/customer/xcx/query"
)
public
JsonResult
<
Customer
>
query
(
@RequestBody
CustomerQuery
qry
)
{
Customer
customer
=
customerService
.
getById
(
qry
.
getCustomerId
());
return
JsonResult
.
success
(
customer
);
}
@ApiOperation
(
value
=
"客户授权手机号码"
)
@RequestMapping
(
method
=
{
RequestMethod
.
POST
},
value
=
"/customer/xcx/authorizedPhone"
)
public
JsonResult
<
Customer
>
authorizedPhone
(
@RequestHeader
String
token
,
...
...
@@ -91,31 +103,14 @@ public class CustomerController {
return
JsonResult
.
success
(
customer
);
}
@GetMapping
(
"/customer/xcx/getUserInfo"
)
@ApiOperation
(
value
=
"客户根据token获取用户信息"
)
@GetMapping
(
"/customer/xcx/getUserInfo"
)
public
JsonResult
<
Customer
>
getUserInfo
(
@RequestParam
String
token
)
throws
Exception
{
log
.
info
(
"根据token:"
+
token
+
",查询用户信息."
);
Customer
customer
=
customerService
.
getUserInfo
(
token
);
return
JsonResult
.
success
(
customer
);
}
@ApiOperation
(
value
=
"图片上传"
)
@PostMapping
(
"/customer/xcx/upload"
)
public
JsonResult
<
String
>
upload
(
MultipartFile
multipartFile
)
throws
Exception
{
log
.
info
(
"图片上传"
);
String
imgUrl
=
fileService
.
saveImage
(
multipartFile
);
return
JsonResult
.
success
(
imgUrl
);
}
@ApiOperation
(
value
=
"base64图片上传"
)
@PostMapping
(
"/customer/xcx/no_base64Upload"
)
public
JsonResult
<
String
>
base64Upload
(
@RequestBody
String
base64
)
throws
Exception
{
log
.
info
(
"图片上传"
);
MultipartFile
multipartFile
=
Base64Utils
.
base64ToMultipart
(
base64
);
String
imgUrl
=
fileService
.
saveImage
(
multipartFile
);
return
JsonResult
.
success
(
imgUrl
);
}
@ApiOperation
(
value
=
"查询用户可选年龄段"
)
@PostMapping
(
"/technician/getAgeGroups"
)
public
JsonResult
<
List
<
String
>>
getAgeGroups
()
{
...
...
@@ -125,10 +120,8 @@ public class CustomerController {
@ApiOperation
(
value
=
"用户详情数据查看"
)
@PostMapping
(
"/technician/queryCustomerDetail"
)
public
JsonResult
<
CustomerOrderDetail
>
queryCustomerDetail
(
@RequestHeader
String
token
,
@RequestParam
Integer
customerId
,
public
JsonResult
<
CustomerOrderDetail
>
queryCustomerDetail
(
@RequestParam
Integer
customerId
,
@RequestParam
(
required
=
false
)
Integer
orderId
)
{
CustomerOrderDetail
customerOrderDetail
=
customerService
.
queryCustomerDetail
(
customerId
,
orderId
);
return
JsonResult
.
success
(
customerOrderDetail
);
}
...
...
@@ -152,18 +145,6 @@ public class CustomerController {
customerService
.
updateCustomerDetail
(
birthdayMonth
,
birthdayDay
,
ageGroup
,
customerId
,
orderId
,
orderServeId
,
storeRecordRealName
,
sex
,
age
,
job
,
preference
,
character
,
customerSource
);
return
JsonResult
.
success
();
}
/*query接口结束*/
@ApiOperation
(
value
=
"h5用户登录"
)
@GetMapping
(
"/customer/no_h5Login"
)
public
JsonResult
<
String
>
h5Login
(
@RequestParam
Integer
orderId
)
{
String
token
=
customerService
.
h5Login
(
orderId
);
return
JsonResult
.
success
(
token
);
}
@ApiOperation
(
value
=
"超时测试接口"
)
@RequestMapping
(
"/customer/testTimeOut"
)
public
JsonResult
<
Void
>
testTimeOut
()
throws
InterruptedException
{
Thread
.
sleep
(
36000L
);
return
JsonResult
.
success
();
}
}
src/main/java/com/gogirl/interfaces/user/FileController.java
0 → 100644
View file @
c34f9e97
package
com
.
gogirl
.
interfaces
.
user
;
import
com.gogirl.infrastructure.common.base.JsonResult
;
import
com.gogirl.infrastructure.service.file.FileService
;
import
com.gogirl.infrastructure.util.Base64Utils
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.annotation.Resource
;
@RestController
@Api
(
tags
=
"文件服务接口"
)
@Slf4j
public
class
FileController
{
@Resource
FileService
fileService
;
@ApiOperation
(
value
=
"图片上传"
)
@PostMapping
(
"/customer/xcx/upload"
)
public
JsonResult
<
String
>
upload
(
MultipartFile
multipartFile
)
throws
Exception
{
log
.
info
(
"图片上传"
);
String
imgUrl
=
fileService
.
saveImage
(
multipartFile
);
return
JsonResult
.
success
(
imgUrl
);
}
@ApiOperation
(
value
=
"base64图片上传"
)
@PostMapping
(
"/customer/xcx/no_base64Upload"
)
public
JsonResult
<
String
>
base64Upload
(
@RequestBody
String
base64
)
throws
Exception
{
log
.
info
(
"图片上传"
);
MultipartFile
multipartFile
=
Base64Utils
.
base64ToMultipart
(
base64
);
String
imgUrl
=
fileService
.
saveImage
(
multipartFile
);
return
JsonResult
.
success
(
imgUrl
);
}
}
src/main/java/com/gogirl/interfaces/user/MessageController.java
View file @
c34f9e97
...
...
@@ -8,7 +8,7 @@ import com.gogirl.domain.user.customer.CustomerMessage;
import
com.gogirl.domain.xcx.GogirlToken
;
import
com.gogirl.domain.xcx.VisitsLog
;
import
com.gogirl.infrastructure.common.base.JsonResult
;
import
com.gogirl.infrastructure.
common.exception.RRException
;
import
com.gogirl.infrastructure.
util.SessionUtils
;
import
com.gogirl.shared.user.command.ReadMessageCommand
;
import
com.gogirl.shared.user.query.qry.CustomerMessagePageQuery
;
import
io.swagger.annotations.Api
;
...
...
@@ -23,19 +23,13 @@ import org.springframework.web.bind.annotation.*;
@Api
(
tags
=
{
"用户消息消息接口"
})
@Slf4j
public
class
MessageController
{
private
final
GogirlTokenService
gogirlTokenService
;
private
final
VisitLogService
visitLogService
;
private
final
CustomerMessageService
customerMessageService
;
@ApiModelProperty
(
"我的消息"
)
@PostMapping
(
"/customer/message/queryPageMessage"
)
public
JsonResult
<
Page
<
CustomerMessage
>>
queryPageMessage
(
@RequestHeader
String
token
,
@RequestBody
CustomerMessagePageQuery
qry
)
{
Page
<
CustomerMessage
>
customerMessagePage
=
customerMessageService
.
queryPageMessage
(
qry
);
return
JsonResult
.
success
(
customerMessagePage
);
}
/*cmd接口开始*/
@ApiModelProperty
(
"已读消息"
)
@PostMapping
(
"/customer/message/customer/readMessage"
)
public
JsonResult
<
Void
>
readMessage
(
@RequestBody
ReadMessageCommand
cmd
)
{
...
...
@@ -82,11 +76,7 @@ public class MessageController {
@RequestParam
(
required
=
false
)
String
pageName
,
@RequestParam
(
required
=
false
)
Integer
produceId
)
{
GogirlToken
gt
=
gogirlTokenService
.
getByToken
(
token
);
if
(
gt
==
null
)
{
throw
new
RRException
(
2000
,
"token失效"
);
}
Integer
customerId
=
gt
.
getCustomerId
();
Integer
customerId
=
SessionUtils
.
getCustomerId
();
VisitsLog
visitsLog
=
visitLogService
.
pageIn
(
customerId
,
type
,
activityId
,
shareType
,
shareUserId
,
serviceId
,
departmentId
,
pageName
,
produceId
);
return
JsonResult
.
success
(
visitsLog
.
getId
());
}
...
...
@@ -100,5 +90,16 @@ public class MessageController {
return
JsonResult
.
success
();
}
/*cmd接口结束*/
/*query接口开始*/
@ApiModelProperty
(
"我的消息"
)
@PostMapping
(
"/customer/message/queryPageMessage"
)
public
JsonResult
<
Page
<
CustomerMessage
>>
queryPageMessage
(
@RequestHeader
String
token
,
@RequestBody
CustomerMessagePageQuery
qry
)
{
Page
<
CustomerMessage
>
customerMessagePage
=
customerMessageService
.
queryPageMessage
(
qry
);
return
JsonResult
.
success
(
customerMessagePage
);
}
/*query接口结束*/
}
src/main/java/com/gogirl/shared/order/serve/query/qry/IdleTimeQuery.java
View file @
c34f9e97
...
...
@@ -8,18 +8,19 @@ import java.util.List;
@Data
public
class
IdleTimeQuery
{
@ApiModelProperty
(
"所有美甲师"
)
List
<
StoreTechnicianPeriod
>
storeTechnicianDTOList
;
@ApiModelProperty
(
"时间节点"
)
List
<
Long
>
dateTimeList
;
private
Integer
id
;
private
Integer
DepartmentId
;
@ApiModelProperty
(
"预约时间"
)
private
String
scheduleDate
;
@ApiModelProperty
(
"预约"
)
private
List
<
ScheduleServeQuery
>
scheduleServeQueryList
;
private
List
<
ScheduleServeQuery
>
listScheduleServer
;
private
Boolean
showNodeDetail
;
}
src/main/java/com/gogirl/shared/order/serve/query/qry/Period.java
View file @
c34f9e97
...
...
@@ -3,6 +3,7 @@ package com.gogirl.shared.order.serve.query.qry;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* 时间段类
...
...
@@ -20,6 +21,12 @@ public class Period implements Serializable {
this
.
length
=
endTime
-
startTime
;
}
public
Period
(
Date
startTime
,
Date
endTime
)
{
this
.
startTime
=
startTime
.
getTime
();
this
.
endTime
=
endTime
.
getTime
();
this
.
length
=
this
.
endTime
-
this
.
startTime
;
}
public
Period
()
{
}
...
...
src/main/resources/application-dev.yml
View file @
c34f9e97
...
...
@@ -92,6 +92,7 @@ gogirl:
test-paper-time
:
1440
#后台后端接口访问地址
admin-backend-url
:
http://test.admin.begogirls.com:7712/api/ReportTable/GetTechnicianPage
admin-backend-achievements-url
:
http://test.admin.begogirls.com:7712/api/salary/AchievementsPersonaResultPageApi
wx
:
pay
:
...
...
src/main/resources/application-pre.yml
View file @
c34f9e97
...
...
@@ -93,6 +93,7 @@ gogirl:
test-paper-time
:
1
#后台后端接口访问地址
admin-backend-url
:
http://test.admin.begogirls.com:7712/api/ReportTable/GetTechnicianPage
admin-backend-achievements-url
:
http://test.admin.begogirls.com:7712/api/salary/AchievementsPersonaResultPageApi
wx
:
pay
:
...
...
src/main/resources/application-prod.yml
View file @
c34f9e97
...
...
@@ -91,6 +91,7 @@ gogirl:
test-paper-time
:
1440
#后台后端接口访问地址
admin-backend-url
:
http://admin.begogirls.com:7712/api/ReportTable/GetTechnicianPageApi
admin-backend-achievements-url
:
http://admin.begogirls.com:7712/api/salary/AchievementsPersonaResultPageApi
wx
:
pay
:
...
...
src/main/resources/application-test.yml
View file @
c34f9e97
...
...
@@ -92,6 +92,7 @@ gogirl:
test-paper-time
:
1440
#后台后端接口访问地址
admin-backend-url
:
http://test.admin.begogirls.com:7712/api/ReportTable/GetTechnicianPage
admin-backend-achievements-url
:
http://test.admin.begogirls.com:7712/api/salary/AchievementsPersonaResultPageApi
wx
:
pay
:
...
...
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