Commit dbadacf7 authored by luzhuang's avatar luzhuang

签到时间问题

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