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
dddd01a5
Commit
dddd01a5
authored
Dec 01, 2020
by
huluobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
考勤
parent
99f90504
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
56 additions
and
17 deletions
+56
-17
TakeLeaveEventCmdServiceImpl.java
...cation/store/store/impl/TakeLeaveEventCmdServiceImpl.java
+11
-11
TakeLeaveEventMapper.java
.../infrastructure/mapper/store/oa/TakeLeaveEventMapper.java
+4
-3
TakeLeaveEventMapper.xml
src/main/resources/mapper/store/TakeLeaveEventMapper.xml
+1
-1
Test.java
src/test/java/com/gogirl/Test.java
+6
-2
CustomerBalanceServiceImplTest.java
...on/user/customer/impl/CustomerBalanceServiceImplTest.java
+34
-0
No files found.
src/main/java/com/gogirl/application/store/store/impl/TakeLeaveEventCmdServiceImpl.java
View file @
dddd01a5
...
@@ -61,12 +61,12 @@ public class TakeLeaveEventCmdServiceImpl implements TakeLeaveEventCmdService {
...
@@ -61,12 +61,12 @@ public class TakeLeaveEventCmdServiceImpl implements TakeLeaveEventCmdService {
@Override
@Override
public
void
applyTakeLeave
(
ApplyTakeLeaveCommand
cmd
)
{
public
void
applyTakeLeave
(
ApplyTakeLeaveCommand
cmd
)
{
if
(
cmd
.
getStartTime
().
compareTo
(
cmd
.
getEndTime
())
>=
0
)
{
if
(
cmd
.
getStartTime
().
compareTo
(
cmd
.
getEndTime
())
>=
0
)
{
throw
new
RRException
(
"申请时间有误"
);
throw
new
RRException
(
"申请时间有误"
);
}
}
List
<
TakeLeaveEvent
>
appliedList
=
takeLeaveEventRepository
.
appliedList
(
cmd
.
getApplyTechnicianId
(),
cmd
.
getStartTime
().
getTime
(),
cmd
.
getEndTime
().
getTime
());
List
<
TakeLeaveEvent
>
appliedList
=
takeLeaveEventRepository
.
appliedList
(
cmd
.
getApplyTechnicianId
(),
cmd
.
getStartTime
().
getTime
(),
cmd
.
getEndTime
().
getTime
()
,
cmd
.
getType
()
);
if
(
ListUtil
.
isNotEmpty
(
appliedList
))
{
if
(
ListUtil
.
isNotEmpty
(
appliedList
))
{
throw
new
RRException
(
"重复时间提交"
);
throw
new
RRException
(
"重复时间提交"
);
}
}
TakeLeaveEvent
takeLeaveEvent
=
applyTakeLeaveCommandAssembler
.
apply
(
cmd
);
TakeLeaveEvent
takeLeaveEvent
=
applyTakeLeaveCommandAssembler
.
apply
(
cmd
);
...
@@ -96,7 +96,7 @@ public class TakeLeaveEventCmdServiceImpl implements TakeLeaveEventCmdService {
...
@@ -96,7 +96,7 @@ public class TakeLeaveEventCmdServiceImpl implements TakeLeaveEventCmdService {
log
.
info
(
"申请时间:{}"
,
takeLeaveEvent
.
getTimeLength
());
log
.
info
(
"申请时间:{}"
,
takeLeaveEvent
.
getTimeLength
());
log
.
info
(
"选择的时间{},"
,
overTimeRecordLogList
.
stream
().
map
(
OverTimeRecordLog:
:
getLengthTime
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
));
log
.
info
(
"选择的时间{},"
,
overTimeRecordLogList
.
stream
().
map
(
OverTimeRecordLog:
:
getLengthTime
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
));
throw
new
RRException
(
500
,
"调休时间有误"
);
throw
new
RRException
(
500
,
"调休时间有误"
);
}
}
overTimeRecordLogList
.
forEach
(
overTimeRecordLog
->
{
overTimeRecordLogList
.
forEach
(
overTimeRecordLog
->
{
...
@@ -106,7 +106,7 @@ public class TakeLeaveEventCmdServiceImpl implements TakeLeaveEventCmdService {
...
@@ -106,7 +106,7 @@ public class TakeLeaveEventCmdServiceImpl implements TakeLeaveEventCmdService {
overtimeRecord
.
setLeftTimeLength
(
overtimeRecord
.
getLeftTimeLength
().
subtract
(
overTimeRecordLog
.
getLengthTime
()));
overtimeRecord
.
setLeftTimeLength
(
overtimeRecord
.
getLeftTimeLength
().
subtract
(
overTimeRecordLog
.
getLengthTime
()));
//检查调休时间和加班时间匹配
//检查调休时间和加班时间匹配
if
(
overtimeRecord
.
getLeftTimeLength
().
compareTo
(
BigDecimal
.
ZERO
)
<
0
)
{
if
(
overtimeRecord
.
getLeftTimeLength
().
compareTo
(
BigDecimal
.
ZERO
)
<
0
)
{
throw
new
RRException
(
500
,
"超出加班时间"
);
throw
new
RRException
(
500
,
"超出加班时间"
);
}
}
if
(
overtimeRecord
.
getLeftTimeLength
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
if
(
overtimeRecord
.
getLeftTimeLength
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
//不能调休
//不能调休
...
@@ -123,12 +123,12 @@ public class TakeLeaveEventCmdServiceImpl implements TakeLeaveEventCmdService {
...
@@ -123,12 +123,12 @@ public class TakeLeaveEventCmdServiceImpl implements TakeLeaveEventCmdService {
takeLeaveEvent
.
setApplyStoreTechnician
(
storeTechnicianRepository
.
selectById
(
cmd
.
getApplyTechnicianId
()));
takeLeaveEvent
.
setApplyStoreTechnician
(
storeTechnicianRepository
.
selectById
(
cmd
.
getApplyTechnicianId
()));
Message
message
=
Message
.
builder
()
Message
message
=
Message
.
builder
()
.
content
(
"请假审核通知"
)
.
content
(
"请假审核通知"
)
.
isRead
(
0
)
.
isRead
(
0
)
.
paramJson
(
JsonUtilByFsJson
.
beanToJson
(
takeLeaveEvent
))
.
paramJson
(
JsonUtilByFsJson
.
beanToJson
(
takeLeaveEvent
))
.
technicianId
(
takeLeaveEvent
.
getDealingTechnicianId
())
.
technicianId
(
takeLeaveEvent
.
getDealingTechnicianId
())
.
time
(
new
Date
())
.
time
(
new
Date
())
.
title
(
"请假审核"
)
.
title
(
"请假审核"
)
.
type
(
1
)
.
type
(
1
)
.
tab
(
2
)
.
tab
(
2
)
.
build
();
.
build
();
...
@@ -142,7 +142,7 @@ public class TakeLeaveEventCmdServiceImpl implements TakeLeaveEventCmdService {
...
@@ -142,7 +142,7 @@ public class TakeLeaveEventCmdServiceImpl implements TakeLeaveEventCmdService {
TakeLeaveEvent
takeLeaveEvent
=
takeLeaveEventRepository
.
selectById
(
cmd
.
getTakeLeaveEventId
());
TakeLeaveEvent
takeLeaveEvent
=
takeLeaveEventRepository
.
selectById
(
cmd
.
getTakeLeaveEventId
());
if
(!
takeLeaveEvent
.
getStatus
().
equals
(
TakeLeaveEvent
.
STATUS_UN_APPROVAL
))
{
if
(!
takeLeaveEvent
.
getStatus
().
equals
(
TakeLeaveEvent
.
STATUS_UN_APPROVAL
))
{
throw
new
RRException
(
500
,
"审批状态异常"
);
throw
new
RRException
(
500
,
"审批状态异常"
);
}
}
//加班申请通过 添加加班记录
//加班申请通过 添加加班记录
...
@@ -190,17 +190,17 @@ public class TakeLeaveEventCmdServiceImpl implements TakeLeaveEventCmdService {
...
@@ -190,17 +190,17 @@ public class TakeLeaveEventCmdServiceImpl implements TakeLeaveEventCmdService {
takeLeaveEvent
.
setApplyStoreTechnician
(
storeTechnician
);
takeLeaveEvent
.
setApplyStoreTechnician
(
storeTechnician
);
Message
message
=
Message
.
builder
()
Message
message
=
Message
.
builder
()
.
content
(
"请假申请通过了"
)
.
content
(
"请假申请通过了"
)
.
isRead
(
0
)
.
isRead
(
0
)
.
paramJson
(
JsonUtilByFsJson
.
beanToJson
(
takeLeaveEvent
))
.
paramJson
(
JsonUtilByFsJson
.
beanToJson
(
takeLeaveEvent
))
.
technicianId
(
takeLeaveEvent
.
getApplyTechnicianId
())
.
technicianId
(
takeLeaveEvent
.
getApplyTechnicianId
())
.
time
(
new
Date
())
.
time
(
new
Date
())
.
title
(
"请假申请"
)
.
title
(
"请假申请"
)
.
type
(
3
)
.
type
(
3
)
.
tab
(
2
)
.
tab
(
2
)
.
build
();
.
build
();
if
(
cmd
.
getApproval
().
equals
(
TakeLeaveEvent
.
STATUS_APPROVAL_REFUSE
))
{
if
(
cmd
.
getApproval
().
equals
(
TakeLeaveEvent
.
STATUS_APPROVAL_REFUSE
))
{
message
.
setContent
(
"请假申请被拒绝了"
);
message
.
setContent
(
"请假申请被拒绝了"
);
}
}
messageMapper
.
insert
(
message
);
messageMapper
.
insert
(
message
);
}
}
...
...
src/main/java/com/gogirl/infrastructure/mapper/store/oa/TakeLeaveEventMapper.java
View file @
dddd01a5
...
@@ -11,16 +11,17 @@ import java.util.List;
...
@@ -11,16 +11,17 @@ import java.util.List;
public
interface
TakeLeaveEventMapper
extends
BaseMapper
<
TakeLeaveEvent
>
{
public
interface
TakeLeaveEventMapper
extends
BaseMapper
<
TakeLeaveEvent
>
{
/**
/**
*
* @param applyTechnicianId
* @param applyTechnicianId
* @param startTime
* @param startTime
* @param endTime
* @param endTime
* @return
* @return
*/
*/
List
<
TakeLeaveEvent
>
appliedList
(
@Param
(
"applyTechnicianId"
)
Integer
applyTechnicianId
,
@Param
(
"startTime"
)
long
startTime
,
@Param
(
"endTime"
)
long
endTime
);
List
<
TakeLeaveEvent
>
appliedList
(
@Param
(
"applyTechnicianId"
)
Integer
applyTechnicianId
,
@Param
(
"startTime"
)
long
startTime
,
@Param
(
"endTime"
)
long
endTime
,
@Param
(
"type"
)
Integer
type
);
/**
/**
*
* @return
* @return
*/
*/
List
<
OverTimeRecord
>
takeLeaveId
();
List
<
OverTimeRecord
>
takeLeaveId
();
...
...
src/main/resources/mapper/store/TakeLeaveEventMapper.xml
View file @
dddd01a5
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
or (start_time
>
= #{startTime} and end_time
<
= #{endTime}))
or (start_time
>
= #{startTime} and end_time
<
= #{endTime}))
and apply_technician_id = #{applyTechnicianId}
and apply_technician_id = #{applyTechnicianId}
and `status` != 3
and `status` != 3
and type
!= 2
and type
= #{type}
</select>
</select>
<select
id=
"takeLeaveId"
resultType=
"com.gogirl.domain.store.oa.OverTimeRecord"
>
<select
id=
"takeLeaveId"
resultType=
"com.gogirl.domain.store.oa.OverTimeRecord"
>
...
...
src/test/java/com/gogirl/Test.java
View file @
dddd01a5
...
@@ -69,6 +69,7 @@ import org.junit.runner.RunWith;
...
@@ -69,6 +69,7 @@ import org.junit.runner.RunWith;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.scheduling.annotation.EnableAsync
;
import
org.springframework.scheduling.annotation.EnableAsync
;
import
org.springframework.test.context.ActiveProfiles
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
...
@@ -85,6 +86,7 @@ import java.util.stream.Collectors;
...
@@ -85,6 +86,7 @@ import java.util.stream.Collectors;
@RunWith
(
SpringRunner
.
class
)
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
@SpringBootTest
@Slf4j
@Slf4j
@ActiveProfiles
(
"pre"
)
@EnableAsync
@EnableAsync
public
class
Test
{
public
class
Test
{
...
@@ -93,6 +95,8 @@ public class Test {
...
@@ -93,6 +95,8 @@ public class Test {
@org
.
junit
.
Test
@org
.
junit
.
Test
public
void
timeNode
()
throws
ParseException
{
public
void
timeNode
()
throws
ParseException
{
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
LocalTime
localTime
=
LocalTime
.
of
(
0
,
0
);
LocalTime
localTime
=
LocalTime
.
of
(
0
,
0
);
LocalTime
localTime2
=
LocalTime
.
of
(
23
,
45
);
LocalTime
localTime2
=
LocalTime
.
of
(
23
,
45
);
...
@@ -121,8 +125,8 @@ public class Test {
...
@@ -121,8 +125,8 @@ public class Test {
weekConfigMapper
.
delete
(
new
LambdaQueryWrapper
<>());
weekConfigMapper
.
delete
(
new
LambdaQueryWrapper
<>());
LocalDate
localDate
=
LocalDate
.
now
(
);
LocalDate
localDate
=
LocalDate
.
of
(
2020
,
10
,
1
);
for
(
int
i
=
0
;
i
<
7
;
i
++)
{
for
(
int
i
=
0
;
i
<
1000
;
i
++)
{
WeekConfig
weekConfig
=
new
WeekConfig
();
WeekConfig
weekConfig
=
new
WeekConfig
();
weekConfig
.
setWeek
(
localDate
.
getDayOfWeek
().
getValue
());
weekConfig
.
setWeek
(
localDate
.
getDayOfWeek
().
getValue
());
weekConfig
.
setWeekStr
(
localDate
.
getDayOfWeek
().
toString
());
weekConfig
.
setWeekStr
(
localDate
.
getDayOfWeek
().
toString
());
...
...
src/test/java/com/gogirl/application/user/customer/impl/CustomerBalanceServiceImplTest.java
View file @
dddd01a5
package
com
.
gogirl
.
application
.
user
.
customer
.
impl
;
package
com
.
gogirl
.
application
.
user
.
customer
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.gogirl.application.user.customer.CustomerBalanceService
;
import
com.gogirl.application.user.customer.CustomerBalanceService
;
import
com.gogirl.domain.market.coupon.CouponCustomerRelevance
;
import
com.gogirl.domain.order.serve.OrderManage
;
import
com.gogirl.infrastructure.mapper.market.coupon.CouponCustomerRelevanceMapper
;
import
com.gogirl.infrastructure.mapper.order.serve.OrderManageMapper
;
import
com.google.common.collect.Lists
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.boot.test.context.SpringBootTest
;
...
@@ -8,6 +14,7 @@ import org.springframework.test.context.ActiveProfiles;
...
@@ -8,6 +14,7 @@ import org.springframework.test.context.ActiveProfiles;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.List
;
/**
/**
* <p>
* <p>
...
@@ -25,9 +32,36 @@ public class CustomerBalanceServiceImplTest {
...
@@ -25,9 +32,36 @@ public class CustomerBalanceServiceImplTest {
@Resource
@Resource
CustomerBalanceService
customerBalanceService
;
CustomerBalanceService
customerBalanceService
;
@Resource
OrderManageMapper
orderManageMapper
;
@Resource
CouponCustomerRelevanceMapper
couponCustomerRelevanceMapper
;
@org
.
junit
.
Test
@org
.
junit
.
Test
public
void
transferBalance
()
{
public
void
transferBalance
()
{
customerBalanceService
.
transferBalance
(
"18671855858"
,
"18671855851"
);
customerBalanceService
.
transferBalance
(
"18671855858"
,
"18671855851"
);
}
}
//撤回带核算
@org
.
junit
.
Test
public
void
order
()
{
List
<
OrderManage
>
orderManageList
=
orderManageMapper
.
selectList
(
new
LambdaQueryWrapper
<
OrderManage
>()
.
in
(
OrderManage:
:
getOrderNo
,
Lists
.
newArrayList
(
"BTD-GZJ-NNN-201113-0038"
,
"TYD-GJM-JQW-201127-0026"
)));
orderManageList
.
forEach
(
orderManage
->
{
if
(
orderManage
.
getStatus
().
equals
(
2
))
{
orderManage
.
setStatus
(
11
);
orderManageMapper
.
updateById
(
orderManage
);
List
<
CouponCustomerRelevance
>
couponCustomerRelevanceList
=
couponCustomerRelevanceMapper
.
selectList
(
new
LambdaQueryWrapper
<
CouponCustomerRelevance
>()
.
eq
(
CouponCustomerRelevance:
:
getOrderId
,
orderManage
.
getId
()));
couponCustomerRelevanceList
.
forEach
(
couponCustomerRelevance
->
{
couponCustomerRelevance
.
setOrderId
(
null
);
couponCustomerRelevanceMapper
.
updateById
(
couponCustomerRelevance
);
});
}
else
{
log
.
error
(
"invalid status"
);
}
});
}
}
}
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