Commit dddd01a5 by huluobin

考勤

parent 99f90504
......@@ -61,12 +61,12 @@ public class TakeLeaveEventCmdServiceImpl implements TakeLeaveEventCmdService {
@Override
public void applyTakeLeave(ApplyTakeLeaveCommand cmd) {
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)) {
throw new RRException("重复时间提交" );
throw new RRException("重复时间提交");
}
TakeLeaveEvent takeLeaveEvent = applyTakeLeaveCommandAssembler.apply(cmd);
......@@ -96,7 +96,7 @@ public class TakeLeaveEventCmdServiceImpl implements TakeLeaveEventCmdService {
log.info("申请时间:{}", takeLeaveEvent.getTimeLength());
log.info("选择的时间{},", overTimeRecordLogList.stream().map(OverTimeRecordLog::getLengthTime).reduce(BigDecimal.ZERO, BigDecimal::add));
throw new RRException(500, "调休时间有误" );
throw new RRException(500, "调休时间有误");
}
overTimeRecordLogList.forEach(overTimeRecordLog -> {
......@@ -106,7 +106,7 @@ public class TakeLeaveEventCmdServiceImpl implements TakeLeaveEventCmdService {
overtimeRecord.setLeftTimeLength(overtimeRecord.getLeftTimeLength().subtract(overTimeRecordLog.getLengthTime()));
//检查调休时间和加班时间匹配
if (overtimeRecord.getLeftTimeLength().compareTo(BigDecimal.ZERO) < 0) {
throw new RRException(500, "超出加班时间" );
throw new RRException(500, "超出加班时间");
}
if (overtimeRecord.getLeftTimeLength().compareTo(BigDecimal.ZERO) == 0) {
//不能调休
......@@ -123,12 +123,12 @@ public class TakeLeaveEventCmdServiceImpl implements TakeLeaveEventCmdService {
takeLeaveEvent.setApplyStoreTechnician(storeTechnicianRepository.selectById(cmd.getApplyTechnicianId()));
Message message = Message.builder()
.content("请假审核通知" )
.content("请假审核通知")
.isRead(0)
.paramJson(JsonUtilByFsJson.beanToJson(takeLeaveEvent))
.technicianId(takeLeaveEvent.getDealingTechnicianId())
.time(new Date())
.title("请假审核" )
.title("请假审核")
.type(1)
.tab(2)
.build();
......@@ -142,7 +142,7 @@ public class TakeLeaveEventCmdServiceImpl implements TakeLeaveEventCmdService {
TakeLeaveEvent takeLeaveEvent = takeLeaveEventRepository.selectById(cmd.getTakeLeaveEventId());
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 {
takeLeaveEvent.setApplyStoreTechnician(storeTechnician);
Message message = Message.builder()
.content("请假申请通过了" )
.content("请假申请通过了")
.isRead(0)
.paramJson(JsonUtilByFsJson.beanToJson(takeLeaveEvent))
.technicianId(takeLeaveEvent.getApplyTechnicianId())
.time(new Date())
.title("请假申请" )
.title("请假申请")
.type(3)
.tab(2)
.build();
if (cmd.getApproval().equals(TakeLeaveEvent.STATUS_APPROVAL_REFUSE)) {
message.setContent("请假申请被拒绝了" );
message.setContent("请假申请被拒绝了");
}
messageMapper.insert(message);
}
......
......@@ -11,16 +11,17 @@ import java.util.List;
public interface TakeLeaveEventMapper extends BaseMapper<TakeLeaveEvent> {
/**
*
* @param applyTechnicianId
* @param startTime
* @param endTime
* @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
*/
List<OverTimeRecord> takeLeaveId();
......
......@@ -10,7 +10,7 @@
or (start_time &gt;= #{startTime} and end_time &lt;= #{endTime}))
and apply_technician_id = #{applyTechnicianId}
and `status` != 3
and type != 2
and type = #{type}
</select>
<select id="takeLeaveId" resultType="com.gogirl.domain.store.oa.OverTimeRecord">
......
......@@ -69,6 +69,7 @@ import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource;
......@@ -85,6 +86,7 @@ import java.util.stream.Collectors;
@RunWith(SpringRunner.class)
@SpringBootTest
@Slf4j
@ActiveProfiles("pre")
@EnableAsync
public class Test {
......@@ -93,6 +95,8 @@ public class Test {
@org.junit.Test
public void timeNode() throws ParseException {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
LocalTime localTime = LocalTime.of(0, 0);
LocalTime localTime2 = LocalTime.of(23, 45);
......@@ -121,8 +125,8 @@ public class Test {
weekConfigMapper.delete(new LambdaQueryWrapper<>());
LocalDate localDate = LocalDate.now();
for (int i = 0; i < 7; i++) {
LocalDate localDate = LocalDate.of(2020, 10, 1);
for (int i = 0; i < 1000; i++) {
WeekConfig weekConfig = new WeekConfig();
weekConfig.setWeek(localDate.getDayOfWeek().getValue());
weekConfig.setWeekStr(localDate.getDayOfWeek().toString());
......
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.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 org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
......@@ -8,6 +14,7 @@ import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource;
import java.util.List;
/**
* <p>
......@@ -25,9 +32,36 @@ public class CustomerBalanceServiceImplTest {
@Resource
CustomerBalanceService customerBalanceService;
@Resource
OrderManageMapper orderManageMapper;
@Resource
CouponCustomerRelevanceMapper couponCustomerRelevanceMapper;
@org.junit.Test
public void transferBalance() {
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");
}
});
}
}
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