Commit dbadacf7 authored by luzhuang's avatar luzhuang

签到时间问题

parent e111edee
......@@ -11,6 +11,7 @@ import org.hibernate.validator.constraints.Length;
import org.rcisoft.business.blesson.dto.ILessonCountDTO;
import org.rcisoft.core.entity.IdEntity;
import org.rcisoft.core.util.UserUtil;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.Entity;
import javax.persistence.Table;
......@@ -81,6 +82,7 @@ public class BLessonPerson extends IdEntity<BLessonPerson> {
private Date finishDate;
@ApiModelProperty(value = "签到日期")
@DateTimeFormat(pattern="yyyy/MM/dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy/MM/dd HH:mm:ss")
private Date signDate;
//-----------------------------
......
package org.rcisoft.business.blesson.service.impl;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.rcisoft.business.blesson.dao.BAppointRepository;
import org.rcisoft.business.blesson.dao.BHotRepository;
......@@ -33,6 +34,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.*;
......@@ -41,6 +43,7 @@ import java.util.*;
* @date 2019/9/10
*/
@Service
@Slf4j
@Transactional(readOnly = true, propagation = Propagation.NOT_SUPPORTED)
public class BLessonPersonServiceImpl implements BLessonPersonService {
......@@ -366,7 +369,9 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
@Override
public PersistModel signIn(QuitAndSignDTO quitAndSignDTO) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
BLessonPerson bLessonPerson = getLessonPersonByDto(quitAndSignDTO);
log.debug("=========签到1=====>>>>"+bLessonPerson);
BLesson bLesson = new BLesson();
bLesson.setBusinessId(quitAndSignDTO.getLessonId());
......@@ -381,6 +386,7 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
Date now = new Date();
Long time = Long.parseLong(bLesson.getTrainSignTime()) * 60 * 1000;
Date signStart = new Date(bLesson.getTrainStartDate().getTime() - time);
log.debug("==========签到2========>>>>当前时间"+simpleDateFormat.format(now));
//时间不在签到范围内
if (now.before(signStart) || bLesson.getTrainOverDate().before(now)){
throw new ServiceException(ResultServiceEnums.NOT_SIGN_DATE);
......@@ -398,8 +404,10 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
bLessonPerson.setEverFinished("1");
}
bLessonPerson.setSignDate(new Date());
log.debug("========签到3======>>>>"+simpleDateFormat.format(bLessonPerson.getSignDate()));
bLessonPerson.setTrainIsSign("2");
UserUtil.setCurrentMergeOperation(bLessonPerson);
log.debug("========签到4======>>>>"+bLessonPerson);
int line = bLessonPersonRepository.updateByPrimaryKeySelective(bLessonPerson);
return new PersistModel(line);
}
......
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