Commit 46454933 authored by zhangqingle's avatar zhangqingle

修改BUG

parent c33a7dc0
......@@ -129,13 +129,15 @@ public class BChapterServiceImpl implements BChapterService {
model.setLessonId(lessonId);
model.setStudentId(curUser.getUserId());
List<QueryChapterListResDTO> queryChapterListResDTOS = queryChapterListResDTO(model, curUser.getCorpId());
for (QueryChapterListResDTO queryChapterListResDTO : queryChapterListResDTOS) {
for (QueryChapterListResDTO childList : queryChapterListResDTO.getChildList()) {
// 遍历学生章节中间表 查询学生观看章节进度
List<BRStudentChapter> brStudentChapterList = brStudentChapterRepository.queryByStuIdAndChapter(childList.getBusinessId(), curUser.getUserId());
if (null != brStudentChapterList && brStudentChapterList.size() > 0) {
childList.setProgress(brStudentChapterList.get(0).getProgress() * 100 + "%");
childList.setCurrentLocation(brStudentChapterList.get(0).getCurrentLocation());
if (StringUtils.isNotEmpty(curUser.getUserId())){
for (QueryChapterListResDTO queryChapterListResDTO : queryChapterListResDTOS) {
for (QueryChapterListResDTO childList : queryChapterListResDTO.getChildList()) {
// 遍历学生章节中间表 查询学生观看章节进度
List<BRStudentChapter> brStudentChapterList = brStudentChapterRepository.queryByStuIdAndChapter(childList.getBusinessId(), curUser.getUserId());
if (null != brStudentChapterList && brStudentChapterList.size() > 0) {
childList.setProgress(brStudentChapterList.get(0).getProgress() * 100 + "%");
childList.setCurrentLocation(brStudentChapterList.get(0).getCurrentLocation());
}
}
}
}
......@@ -174,7 +176,7 @@ public class BChapterServiceImpl implements BChapterService {
List<String> lecturerIds = new ArrayList<>();
lecturerIds.add(bLesson.getLecturerId());
MTUserGetsReqDTO mtUserGetsReqDTOlecDept = new MTUserGetsReqDTO();
mtUserGetsReqDTOlecDept.setCorpId(curUser.getCorpId());
mtUserGetsReqDTOlecDept.setCorpId(bLesson.getCorpId());
mtUserGetsReqDTOlecDept.setIds(lecturerIds);
List<MTUserInfoRspDTO> mtUserInfoRspDTOLecDeptList = mtCotactApiRequestClient.userGets(mtUserGetsReqDTOlecDept);
if (mtUserInfoRspDTOLecDeptList != null && mtUserInfoRspDTOLecDeptList.size() > 0) {
......@@ -495,8 +497,10 @@ public class BChapterServiceImpl implements BChapterService {
//TODO 判断 曾经是否学完过 奖励积分
if (IsFinishEnum.FINISHED.getCode().equals(lessonPerson.getIsFinish()) && !(IsFinishEnum.LEARNING.getCode().equals(lessonPerson.getEverFinished()))) {
//查询课程信息
BPersonValue bPersonValue = new BPersonValue(lessonPerson.getPersonId(), "学完!@#课程", bLesson.getValueGain(), "0", bLesson.getBusinessId());
bLessonServiceImpl.addValueEvent(lessonPerson.getPersonId(), bPersonValue, null);
if(StringUtils.isNotEmpty(bLesson.getValueGain()) && Long.parseLong(bLesson.getValueGain()) > 0){
BPersonValue bPersonValue = new BPersonValue(lessonPerson.getPersonId(), "学完!@#课程", bLesson.getValueGain(), "0", bLesson.getBusinessId());
bLessonServiceImpl.addValueEvent(lessonPerson.getPersonId(), bPersonValue, null);
}
lessonPerson.setEverFinished("1");
}
// 规避 复数 和超100% 的情况
......
......@@ -313,7 +313,7 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
if (userInfo == null){
throw new ServiceException(ResultServiceEnums.COMPANY_NOT_EXISTS);
}
if (bLesson.getValueConsume() != null && (StringUtils.isEmpty(userInfo.getValue()) || Long.valueOf(userInfo.getValue()) < Long.valueOf(bLesson.getValueConsume()))){
if (!(curUser.getUserId().equals(bLesson.getLecturerId())) && bLesson.getValueConsume() != null && !("0".equals(bLesson.getValueConsume())) && (StringUtils.isEmpty(userInfo.getValue()) || Long.valueOf(userInfo.getValue()) < Long.valueOf(bLesson.getValueConsume()))){
throw new ServiceException(ResultServiceEnums.VALUE_NOT_ENOUGH);
}
//查询是否已有已删除
......@@ -391,8 +391,10 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
//TODO 判断 曾经是否学完过 奖励积分
if ( !("2".equals(bLessonPerson.getTrainIsSign())) && !("1".equals(bLessonPerson.getEverFinished()))){
//查询课程信息
BPersonValue bPersonValue = new BPersonValue(bLessonPerson.getPersonId(),"参加!@#培训",bLesson.getValueGain(),"0",bLesson.getBusinessId());
bLessonServiceImpl.addValueEvent(bLessonPerson.getPersonId(),bPersonValue,null);
if(StringUtils.isNotEmpty(bLesson.getValueGain()) && Long.parseLong(bLesson.getValueGain()) > 0){
BPersonValue bPersonValue = new BPersonValue(bLessonPerson.getPersonId(),"参加!@#培训",bLesson.getValueGain(),"0",bLesson.getBusinessId());
bLessonServiceImpl.addValueEvent(bLessonPerson.getPersonId(),bPersonValue,null);
}
bLessonPerson.setEverFinished("1");
}
bLessonPerson.setSignDate(new Date());
......
......@@ -146,7 +146,7 @@ public class BLessonServiceImpl implements BLessonService {
List<String> ids = new ArrayList<>();
ids.add(bLesson.getLecturerId());
MTUserGetsReqDTO mtUserGetsReqDTO = new MTUserGetsReqDTO();
mtUserGetsReqDTO.setCorpId(curUser.getCorpId());
mtUserGetsReqDTO.setCorpId(bLesson.getCorpId());
mtUserGetsReqDTO.setIds(ids);
List<MTUserInfoRspDTO> mtUserInfoRspDTOList = cotactApiRequestClient.userGets(mtUserGetsReqDTO);
if (mtUserInfoRspDTOList != null && mtUserInfoRspDTOList.size() > 0) {
......@@ -608,17 +608,18 @@ public class BLessonServiceImpl implements BLessonService {
UserUtil.setCurrentPersistOperation(bPersonValue);
bPersonValue.setPersonId(bLesson.getLecturerId());
bPersonValue.setType("0");
if (LessonTypeEnum.LESSON.getCode().equals(bLesson.getLessonType())) {
if (LessonTypeEnum.LESSON.getCode().equals(bLesson.getLessonType()) && StringUtils.isNotEmpty(bReleaseValueList.get(0).getLessonValue()) && Long.parseLong(bReleaseValueList.get(0).getLessonValue()) > 0) {
bPersonValue.setEvent("发布!@#课程");
bPersonValue.setValue(bReleaseValueList.get(0).getLessonValue());
bPersonValue.setLessonId(bLesson.getBusinessId());
bPersonValueRepository.add(bPersonValue);
}
if (LessonTypeEnum.TRAIN.getCode().equals(bLesson.getLessonType())) {
if (LessonTypeEnum.TRAIN.getCode().equals(bLesson.getLessonType()) && StringUtils.isNotEmpty(bReleaseValueList.get(0).getLessonValue()) && Long.parseLong(bReleaseValueList.get(0).getTrainValue()) > 0) {
bPersonValue.setEvent("发布!@#培训");
bPersonValue.setValue(bReleaseValueList.get(0).getTrainValue());
bPersonValue.setLessonId(bLesson.getBusinessId());
bPersonValueRepository.add(bPersonValue);
}
bPersonValueRepository.add(bPersonValue);
//积分变化后 s_user表中value字段重新统计
bPersonValueRepository.updateUserValue(bLesson.getLecturerId(), null);
}
......@@ -1140,8 +1141,10 @@ public class BLessonServiceImpl implements BLessonService {
//TODO 判断 曾经是否学完过 奖励积分
if ("2".equals(setTrainIsSignDTO.getTrainIsSign()) && !("2".equals(bLessonPerson.getTrainIsSign())) && !("1".equals(bLessonPerson.getEverFinished())) && bLesson != null) {
//查询课程信息
BPersonValue bPersonValue = new BPersonValue(bLessonPerson.getPersonId(), "参加!@#培训", bLesson.getValueGain(), "0",bLesson.getBusinessId());
addValueEvent(bLessonPerson.getPersonId(), bPersonValue, null);
if(StringUtils.isNotEmpty(bLesson.getValueGain()) && Long.parseLong(bLesson.getValueGain()) > 0){
BPersonValue bPersonValue = new BPersonValue(bLessonPerson.getPersonId(), "参加!@#培训", bLesson.getValueGain(), "0",bLesson.getBusinessId());
addValueEvent(bLessonPerson.getPersonId(), bPersonValue, null);
}
bLessonPerson.setEverFinished("1");
}
bLessonPerson.setTrainIsSign(setTrainIsSignDTO.getTrainIsSign());
......@@ -1218,7 +1221,7 @@ public class BLessonServiceImpl implements BLessonService {
if (userInfo == null) {
throw new ServiceException(ResultServiceEnums.COMPANY_NOT_EXISTS);
}
if (bLesson.getValueConsume() != null && !("0".equals(bLesson.getValueConsume())) && Long.parseLong(userInfo.getValue()) < Long.parseLong(bLesson.getValueConsume()) && !(curUser.getUserId().equals(bLesson.getLecturerId()))) {
if (bLesson.getValueConsume() != null && !("0".equals(bLesson.getValueConsume())) && (StringUtils.isEmpty(userInfo.getValue()) || (Long.parseLong(userInfo.getValue()) < Long.parseLong(bLesson.getValueConsume()))) && !(curUser.getUserId().equals(bLesson.getLecturerId()))) {
throw new ServiceException(ResultServiceEnums.VALUE_NOT_ENOUGH);
}
int line = bLessonPersonRepository.updateByPrimaryKeySelective(person);
......@@ -1249,7 +1252,7 @@ public class BLessonServiceImpl implements BLessonService {
if (userInfo == null) {
throw new ServiceException(ResultServiceEnums.COMPANY_NOT_EXISTS);
}
if (bLesson.getValueConsume() != null && !"0".equals(bLesson.getValueConsume()) && Long.parseLong(userInfo.getValue()) < Long.parseLong(bLesson.getValueConsume())) {
if (bLesson.getValueConsume() != null && !("0".equals(bLesson.getValueConsume())) && (StringUtils.isEmpty(userInfo.getValue()) || (Long.parseLong(userInfo.getValue()) < Long.parseLong(bLesson.getValueConsume()))) && !(curUser.getUserId().equals(bLesson.getLecturerId()))) {
throw new ServiceException(ResultServiceEnums.VALUE_NOT_ENOUGH);
}
int line = this.trainInsert("0", bLesson, bLessonPersons);
......@@ -1323,7 +1326,7 @@ public class BLessonServiceImpl implements BLessonService {
List<String> ids = new ArrayList<>();
ids.add(bLesson.getLecturerId());
MTUserGetsReqDTO mtUserGetsReqDTO = new MTUserGetsReqDTO();
mtUserGetsReqDTO.setCorpId(curUser.getCorpId());
mtUserGetsReqDTO.setCorpId(bLesson.getCorpId());
mtUserGetsReqDTO.setIds(ids);
List<MTUserInfoRspDTO> mtUserInfoRspDTOList = cotactApiRequestClient.userGets(mtUserGetsReqDTO);
if (mtUserInfoRspDTOList != null && mtUserInfoRspDTOList.size() > 0) {
......@@ -1373,7 +1376,7 @@ public class BLessonServiceImpl implements BLessonService {
List<String> ids = new ArrayList<>();
ids.add(bLesson.getLecturerId());
MTUserGetsReqDTO mtUserGetsReqDTO = new MTUserGetsReqDTO();
mtUserGetsReqDTO.setCorpId(curUser.getCorpId());
mtUserGetsReqDTO.setCorpId(bLesson.getCorpId());
mtUserGetsReqDTO.setIds(ids);
List<MTUserInfoRspDTO> mtUserInfoRspDTOList = cotactApiRequestClient.userGets(mtUserGetsReqDTO);
if (mtUserInfoRspDTOList != null && mtUserInfoRspDTOList.size() > 0) {
......
......@@ -151,8 +151,10 @@ public class BRStudentChapterServiceImpl implements BRStudentChapterService {
BLesson bLesson = bLessonRepository.selectByPrimaryKey(brStudentChapterDto.getLessonId());
if (bLesson != null && IsFinishEnum.FINISHED.getCode().equals(bLessonPerson.getIsFinish()) && !("1".equals(bLessonPerson.getEverFinished()))){
//查询课程信息
BPersonValue bPersonValue = new BPersonValue(curUser.getUserId(),"学完!@#课程",bLesson.getValueGain(),"0",bLesson.getBusinessId());
bLessonServiceImpl.addValueEvent(curUser.getUserId(),bPersonValue,null);
if(StringUtils.isNotEmpty(bLesson.getValueGain()) && Long.parseLong(bLesson.getValueGain()) > 0){
BPersonValue bPersonValue = new BPersonValue(curUser.getUserId(),"学完!@#课程",bLesson.getValueGain(),"0",bLesson.getBusinessId());
bLessonServiceImpl.addValueEvent(curUser.getUserId(),bPersonValue,null);
}
bLessonPerson.setEverFinished("1");
}
bLessonPersonRepository.updateByPrimaryKeySelective(bLessonPerson);
......
......@@ -86,6 +86,7 @@
<result column="train_address" jdbcType="VARCHAR" property="trainAddress"/>
<result column="train_sign_time" jdbcType="VARCHAR" property="trainSignTime"/>
<result column="qr_code" jdbcType="VARCHAR" property="qrCode"/>
<result column="corp_id" jdbcType="VARCHAR" property="corpId"/>
<!---->
<result column="value_consume" jdbcType="VARCHAR" property="valueConsume"/>
<result column="value_gain" jdbcType="VARCHAR" property="valueGain"/>
......
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