Commit bf15939d authored by luzhuang's avatar luzhuang

Merge remote-tracking branch 'origin/meiteng' into meiteng

parents 5d9f6422 9075a70c
...@@ -194,12 +194,13 @@ public class BLessonPersonServiceImpl implements BLessonPersonService { ...@@ -194,12 +194,13 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
@Transactional(propagation = Propagation.REQUIRED, readOnly = false) @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
@Override @Override
public PersistModel cancelAppoint(CancelAppointDTO cancelAppointDTO) { public PersistModel cancelAppoint(CancelAppointDTO cancelAppointDTO) {
String bAppointId = bLessonPersonRepository.selectAppointIdById(cancelAppointDTO); // String bAppointId = bLessonPersonRepository.selectAppointIdById(cancelAppointDTO);
if (StringUtils.isEmpty(bAppointId)){ BLessonPerson bLessonPerson = bLessonPersonRepository.selectById(cancelAppointDTO.getBusinessId());
if (bLessonPerson == null || StringUtils.isEmpty(bLessonPerson.getAppointId())){
throw new ServiceException(ResultServiceEnums.APPOINT_NOT_CANCEL); throw new ServiceException(ResultServiceEnums.APPOINT_NOT_CANCEL);
} }
BAppoint bAppoint = bAppointRepository.selectById(bAppointId); BAppoint bAppoint = bAppointRepository.selectById(bLessonPerson.getAppointId());
//改变bAppoint 值 //改变bAppoint 值
if (bAppoint == null){ if (bAppoint == null){
throw new ServiceException(ResultServiceEnums.NOT_APPOINT_INFO); throw new ServiceException(ResultServiceEnums.NOT_APPOINT_INFO);
...@@ -221,12 +222,12 @@ public class BLessonPersonServiceImpl implements BLessonPersonService { ...@@ -221,12 +222,12 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
// bAppoint.setDesignatedId(designatedIdRes); // bAppoint.setDesignatedId(designatedIdRes);
//查询是否在学习 //查询是否在学习
BLesson bLesson = bLessonRepository.selectByPrimaryKey(cancelAppointDTO.getLessonId()); BLesson bLesson = bLessonRepository.selectByPrimaryKey(bLessonPerson.getLessonId());
// String isFinish = bLessonPersonRepository.selectIsFinish(cancelAppointDTO); // String isFinish = bLessonPersonRepository.selectIsFinish(cancelAppointDTO);
BLessonPerson bLessonPerson = bLessonPersonRepository.selectById(cancelAppointDTO.getBusinessId()); // BLessonPerson bLessonPerson1 = bLessonPersonRepository.selectById(cancelAppointDTO.getBusinessId());
int result = 0; int result = 0;
//课程 //课程
if (bLesson != null && "0".equals(bLesson.getLessonType()) && bLessonPerson != null && "0".equals(bLessonPerson.getIsFinish())){ if (bLesson != null && "0".equals(bLesson.getLessonType()) && "0".equals(bLessonPerson.getIsFinish())){
//未开始执行删除 //未开始执行删除
bLessonPerson.setDelFlag("1"); bLessonPerson.setDelFlag("1");
//将加入学习时间置空 //将加入学习时间置空
...@@ -235,7 +236,7 @@ public class BLessonPersonServiceImpl implements BLessonPersonService { ...@@ -235,7 +236,7 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
bLessonPerson.setIsAppoint("0"); bLessonPerson.setIsAppoint("0");
result = bLessonPersonRepository.updateByPrimaryKeySelective(bLessonPerson); result = bLessonPersonRepository.updateByPrimaryKeySelective(bLessonPerson);
} }
if (bLesson != null && "0".equals(bLesson.getLessonType()) && bLessonPerson != null && ("1".equals(bLessonPerson.getIsFinish()) || "2".equals(bLessonPerson.getIsFinish()))){ if (bLesson != null && "0".equals(bLesson.getLessonType()) && ("1".equals(bLessonPerson.getIsFinish()) || "2".equals(bLessonPerson.getIsFinish()))){
//已开始执行更新 //已开始执行更新
UserUtil.setCurrentMergeOperation(bLessonPerson); UserUtil.setCurrentMergeOperation(bLessonPerson);
bLessonPerson.setIsAppoint("0"); bLessonPerson.setIsAppoint("0");
...@@ -243,7 +244,7 @@ public class BLessonPersonServiceImpl implements BLessonPersonService { ...@@ -243,7 +244,7 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
result = bLessonPersonRepository.updateByPrimaryKeySelective(bLessonPerson); result = bLessonPersonRepository.updateByPrimaryKeySelective(bLessonPerson);
} }
//培训 //培训
if (bLesson != null && "1".equals(bLesson.getLessonType()) && bLessonPerson != null){ if (bLesson != null && "1".equals(bLesson.getLessonType())){
UserUtil.setCurrentMergeOperation(bLessonPerson); UserUtil.setCurrentMergeOperation(bLessonPerson);
bLessonPerson.setIsAppoint("0"); bLessonPerson.setIsAppoint("0");
...@@ -394,10 +395,15 @@ public class BLessonPersonServiceImpl implements BLessonPersonService { ...@@ -394,10 +395,15 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
@Override @Override
public int selectByPersonAndLesson(LessonAndUserDTO lessonAndUserDTO) { public int selectByPersonAndLesson(LessonAndUserDTO lessonAndUserDTO) {
List<BLessonPerson> bLessonPersonList = bLessonPersonRepository.selectByPersonAndLesson(lessonAndUserDTO); List<BLessonPerson> bLessonPersonList = bLessonPersonRepository.selectByPersonAndLesson(lessonAndUserDTO);
BLesson bLesson = bLessonRepository.selectByPrimaryKey(lessonAndUserDTO.getLessonId());
int result = 0; int result = 0;
if (bLessonPersonList == null || bLessonPersonList.size() < 1 || lessonAndUserDTO.getUserId().equals(bLessonPersonList.get(0).getLecturerId())){ if (bLessonPersonList == null || bLessonPersonList.size() < 1 ){
result = 1; result = 1;
} }
if (bLesson != null && lessonAndUserDTO.getUserId().equals(bLesson.getLecturerId())){
result = 0;
}
return result; return result;
} }
......
...@@ -1291,8 +1291,13 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -1291,8 +1291,13 @@ public class BLessonServiceImpl implements BLessonService {
}else { }else {
bLesson.setIsCollect("0"); bLesson.setIsCollect("0");
} }
//判断签到是否开始 //判断签到是否开始
setDateState(bLesson); setDateState(bLesson);
if ("1".equals(bLesson.getLessonType())){
Date now = new Date();
return setTrainType(bLesson,now);
}
return bLesson; return bLesson;
} }
...@@ -1549,17 +1554,22 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -1549,17 +1554,22 @@ public class BLessonServiceImpl implements BLessonService {
List<BLesson> setTrainTypeByList(List<BLesson> bLessonList){ List<BLesson> setTrainTypeByList(List<BLesson> bLessonList){
Date now = new Date(); Date now = new Date();
bLessonList.forEach(bLesson -> { bLessonList.forEach(bLesson -> {
Long time = Long.parseLong(bLesson.getTrainSignTime()) * 60 * 1000; bLesson = setTrainType(bLesson,now);
Date signStart = new Date(bLesson.getTrainStartDate().getTime() - time);
if (now.before(signStart)){
bLesson.setTrainType("0");
}else if (bLesson.getTrainOverDate().before(now)){
bLesson.setTrainType("2");
}else{
bLesson.setTrainType("1");
}
}); });
return bLessonList; return bLessonList;
} }
BLesson setTrainType(BLesson bLesson, Date now){
Long time = Long.parseLong(bLesson.getTrainSignTime()) * 60 * 1000;
Date signStart = new Date(bLesson.getTrainStartDate().getTime() - time);
if (now.before(signStart)){
bLesson.setTrainType("0");
}else if (bLesson.getTrainOverDate().before(now)){
bLesson.setTrainType("2");
}else{
bLesson.setTrainType("1");
}
return bLesson;
}
} }
...@@ -215,7 +215,7 @@ public enum ResultServiceEnums { ...@@ -215,7 +215,7 @@ public enum ResultServiceEnums {
NOT_MORE_COUNT(114,"添加超过规定个数"), NOT_MORE_COUNT(114,"添加超过规定个数"),
APPOINT_NOT_CLOSE(115,"必修不能退出"), APPOINT_NOT_CLOSE(115,"必修不能退出"),
STATE_NOT_RELEASE(116,"该课程状态不能发布"), STATE_NOT_RELEASE(116,"该课程状态不能发布"),
APPOINT_NOT_CANCEL(117,"该课程不能取消指派"), APPOINT_NOT_CANCEL(117,"不能取消指派"),
INVALID_PARAMETER_VALUE(118,"参数值无效"), INVALID_PARAMETER_VALUE(118,"参数值无效"),
NOT_RECOMMEND(119,"该课程未推荐"), NOT_RECOMMEND(119,"该课程未推荐"),
NO_DATA(120,"该数据不存在"), NO_DATA(120,"该数据不存在"),
......
...@@ -6,6 +6,6 @@ import lombok.extern.slf4j.Slf4j; ...@@ -6,6 +6,6 @@ import lombok.extern.slf4j.Slf4j;
public class LogUtil { public class LogUtil {
//文件转换日志打印 //文件转换日志打印
public static void fileChangeLog(String message){ public static void fileChangeLog(String message){
log.info(message); log.debug(message);
} }
} }
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