Commit 90c8c687 authored by zhangqingle's avatar zhangqingle

修改ENUM

parent 66fdd238
package org.rcisoft.business.bbanner.enums;
import lombok.Getter;
@Getter
public enum IsExternalLinkEnum {
//是否为外部链接(0:否,1:是)
NOT_EXTERNAL_LINK("0"),
IS_EXTERNAL_LINK("1"),
;
IsExternalLinkEnum(String code) {
this.code = code;
}
private String code;
}
...@@ -7,6 +7,7 @@ import org.rcisoft.business.bbanner.dto.AddOrUpdateDTO; ...@@ -7,6 +7,7 @@ import org.rcisoft.business.bbanner.dto.AddOrUpdateDTO;
import org.rcisoft.business.bbanner.dto.BannerInfoRspDTO; import org.rcisoft.business.bbanner.dto.BannerInfoRspDTO;
import org.rcisoft.business.bbanner.dto.FindBannerPaginDTO; import org.rcisoft.business.bbanner.dto.FindBannerPaginDTO;
import org.rcisoft.business.bbanner.dto.TopDownDTO; import org.rcisoft.business.bbanner.dto.TopDownDTO;
import org.rcisoft.business.bbanner.enums.IsExternalLinkEnum;
import org.rcisoft.core.aop.PageUtil; import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.exception.ServiceException; import org.rcisoft.core.exception.ServiceException;
import org.rcisoft.core.model.PersistModel; import org.rcisoft.core.model.PersistModel;
...@@ -50,9 +51,9 @@ public class BBannerServiceImpl implements BBannerService { ...@@ -50,9 +51,9 @@ public class BBannerServiceImpl implements BBannerService {
int line = 0; int line = 0;
//外部链接但外部URL为空或长度为0 抛异常 //外部链接但外部URL为空或长度为0 抛异常
if ("1".equals(model.getIsExternalLink()) && StringUtils.isEmpty(model.getExternalUrl())) if (IsExternalLinkEnum.IS_EXTERNAL_LINK.getCode().equals(model.getIsExternalLink()) && StringUtils.isEmpty(model.getExternalUrl()))
throw new ServiceException(ResultServiceEnums.JUMP_ADDRESS_NULL); throw new ServiceException(ResultServiceEnums.JUMP_ADDRESS_NULL);
else if ("1".equals(model.getIsExternalLink()) && StringUtils.isNotBlank(model.getExternalUrl())){ else if (IsExternalLinkEnum.IS_EXTERNAL_LINK.getCode().equals(model.getIsExternalLink()) && StringUtils.isNotBlank(model.getExternalUrl())){
// String regex = "^([hH][tT]{2}[pP]:/*|[hH][tT]{2}[pP][sS]:/*|[fF][tT][pP]:/*)(([A-Za-z0-9-~]+).)+([A-Za-z0-9-~\\/])+(\\?{0,1}(([A-Za-z0-9-~]+\\={0,1})([A-Za-z0-9-~]*)\\&{0,1})*)$"; // +(\?{0,1}(([A-Za-z0-9-~]+\={0,1})([A-Za-z0-9-~]*)\&{0,1})*)$ // String regex = "^([hH][tT]{2}[pP]:/*|[hH][tT]{2}[pP][sS]:/*|[fF][tT][pP]:/*)(([A-Za-z0-9-~]+).)+([A-Za-z0-9-~\\/])+(\\?{0,1}(([A-Za-z0-9-~]+\\={0,1})([A-Za-z0-9-~]*)\\&{0,1})*)$"; // +(\?{0,1}(([A-Za-z0-9-~]+\={0,1})([A-Za-z0-9-~]*)\&{0,1})*)$
// Pattern pattern = Pattern.compile(regex); // Pattern pattern = Pattern.compile(regex);
// //
...@@ -67,7 +68,7 @@ public class BBannerServiceImpl implements BBannerService { ...@@ -67,7 +68,7 @@ public class BBannerServiceImpl implements BBannerService {
} }
} }
//内部链接但类型或课程ID为空或长度为0 抛异常 //内部链接但类型或课程ID为空或长度为0 抛异常
if ("0".equals(model.getIsExternalLink()) && (StringUtils.isEmpty(model.getLineType()) || StringUtils.isEmpty(model.getCourseId()))) if (IsExternalLinkEnum.NOT_EXTERNAL_LINK.getCode().equals(model.getIsExternalLink()) && (StringUtils.isEmpty(model.getLineType()) || StringUtils.isEmpty(model.getCourseId())))
throw new ServiceException(ResultServiceEnums.JUMP_ADDRESS_NULL); throw new ServiceException(ResultServiceEnums.JUMP_ADDRESS_NULL);
if (model.getBusinessId() != null) { if (model.getBusinessId() != null) {
//按ID查询Banner个数 //按ID查询Banner个数
......
package org.rcisoft.business.bchapter.enums;
import lombok.Getter;
@Getter
public enum FileTypeEnum {
PPT("2"),
PDF("3"),
WORD("4"),
;
FileTypeEnum(String code) {
this.code = code;
}
private String code;
}
...@@ -5,6 +5,7 @@ import org.apache.commons.lang3.StringUtils; ...@@ -5,6 +5,7 @@ import org.apache.commons.lang3.StringUtils;
import org.rcisoft.business.bdiscuss.dto.BDiscussDto; import org.rcisoft.business.bdiscuss.dto.BDiscussDto;
import org.rcisoft.business.blesson.dao.BLessonRepository; import org.rcisoft.business.blesson.dao.BLessonRepository;
import org.rcisoft.business.blesson.entity.BLesson; import org.rcisoft.business.blesson.entity.BLesson;
import org.rcisoft.business.blesson.enums.LessonTypeEnum;
import org.rcisoft.business.blesson.service.BLessonService; import org.rcisoft.business.blesson.service.BLessonService;
import org.rcisoft.business.bmessage.dao.BMessageRepository; import org.rcisoft.business.bmessage.dao.BMessageRepository;
import org.rcisoft.business.bmessage.entity.BMessage; import org.rcisoft.business.bmessage.entity.BMessage;
...@@ -104,8 +105,8 @@ public class BDiscussServiceImpl implements BDiscussService { ...@@ -104,8 +105,8 @@ public class BDiscussServiceImpl implements BDiscussService {
bNotice.setCorpId(curUser.getCorpId()); bNotice.setCorpId(curUser.getCorpId());
// 获取课程信息 // 获取课程信息
BLesson bLesson = lessonRepository.selectByPrimaryKey(bDiscuss.getLessonId()); BLesson bLesson = lessonRepository.selectByPrimaryKey(bDiscuss.getLessonId());
String lessonType = "0".equals(bLesson.getLessonType()) ? "线上课程" : "线下培训"; String lessonType = LessonTypeEnum.LESSON.getCode().equals(bLesson.getLessonType()) ? "线上课程" : "线下培训";
String urlType = "0".equals(bLesson.getLessonType()) ? UrlTypeEnum.LESSON.getName() : UrlTypeEnum.TRAIN.getName(); String urlType = LessonTypeEnum.LESSON.getCode().equals(bLesson.getLessonType()) ? UrlTypeEnum.LESSON.getName() : UrlTypeEnum.TRAIN.getName();
bNotice.setInfoText(sysUserServiceImpl.getNameById(bDiscuss.getStudentId()).getName() + "回复了您在" + lessonType +"[" + bLesson.getLessonName() +"]的评论" ); bNotice.setInfoText(sysUserServiceImpl.getNameById(bDiscuss.getStudentId()).getName() + "回复了您在" + lessonType +"[" + bLesson.getLessonName() +"]的评论" );
// 发消息 // 发消息
client.send(bNotice,InfoTypeEnum.REPLY_DISCUSS.getLable(), MessageEnum.HFPL.getName(),urlType); client.send(bNotice,InfoTypeEnum.REPLY_DISCUSS.getLable(), MessageEnum.HFPL.getName(),urlType);
...@@ -129,8 +130,8 @@ public class BDiscussServiceImpl implements BDiscussService { ...@@ -129,8 +130,8 @@ public class BDiscussServiceImpl implements BDiscussService {
// 获取课程信息 // 获取课程信息
BLesson bLesson = lessonRepository.selectByPrimaryKey(bDiscuss.getLessonId()); BLesson bLesson = lessonRepository.selectByPrimaryKey(bDiscuss.getLessonId());
bNotice.setRecipientIds(new ArrayList<>(Arrays.asList(bLesson.getLecturerId()))); bNotice.setRecipientIds(new ArrayList<>(Arrays.asList(bLesson.getLecturerId())));
String lessonType = "0".equals(bLesson.getLessonType()) ? "线上课程" : "线下培训"; String lessonType = LessonTypeEnum.LESSON.getCode().equals(bLesson.getLessonType()) ? "线上课程" : "线下培训";
String urlType = "0".equals(bLesson.getLessonType()) ? UrlTypeEnum.LESSON.getName() : UrlTypeEnum.TRAIN.getName(); String urlType = LessonTypeEnum.LESSON.getCode().equals(bLesson.getLessonType()) ? UrlTypeEnum.LESSON.getName() : UrlTypeEnum.TRAIN.getName();
bNotice.setInfoText(sysUserServiceImpl.getNameById(bDiscuss.getStudentId()).getName() + "评论了您主讲的" + lessonType +"\"" + bLesson.getLessonName()+"\"" ); bNotice.setInfoText(sysUserServiceImpl.getNameById(bDiscuss.getStudentId()).getName() + "评论了您主讲的" + lessonType +"\"" + bLesson.getLessonName()+"\"" );
// 发消息 // 发消息
......
package org.rcisoft.business.blesson.enums;
import lombok.Getter;
@Getter
public enum IsApplyEnum {
//培训是否报名(0 未报名 1已报名)
NOT_APPLY("0"),
APPLYED("1"),
;
IsApplyEnum(String code) {
this.code = code;
}
private String code;
}
package org.rcisoft.business.blesson.enums;
import lombok.Getter;
@Getter
public enum IsFinishEnum {
//是否已学完(0:未开始 1:已开始 2: 已学完)
NOT_START("0"),
LEARNING("1"),
FINISHED("2"),
;
IsFinishEnum(String code) {
this.code = code;
}
private String code;
}
package org.rcisoft.business.blesson.enums;
import lombok.Getter;
@Getter
public enum LessonTypeEnum {
//是否已学完(0:未开始 1:已开始 2: 已学完)
LESSON("0"),
TRAIN("1"),
;
LessonTypeEnum(String code) {
this.code = code;
}
private String code;
}
package org.rcisoft.business.blesson.enums;
import lombok.Getter;
@Getter
public enum ReleaseStateEnum {
//发布状态(0:待发布 2:已发布 4:已关闭)
UNRELEASED("0"),
RELEASED("2"),
CLOSED("4"),
;
ReleaseStateEnum(String code) {
this.code = code;
}
private String code;
}
...@@ -10,6 +10,10 @@ import org.rcisoft.business.blesson.entity.BHot; ...@@ -10,6 +10,10 @@ import org.rcisoft.business.blesson.entity.BHot;
import org.rcisoft.business.blesson.entity.BLesson; import org.rcisoft.business.blesson.entity.BLesson;
import org.rcisoft.business.blesson.dao.BLessonPersonRepository; import org.rcisoft.business.blesson.dao.BLessonPersonRepository;
import org.rcisoft.business.blesson.entity.BLessonPerson; import org.rcisoft.business.blesson.entity.BLessonPerson;
import org.rcisoft.business.blesson.enums.IsApplyEnum;
import org.rcisoft.business.blesson.enums.IsFinishEnum;
import org.rcisoft.business.blesson.enums.LessonTypeEnum;
import org.rcisoft.business.blesson.enums.ReleaseStateEnum;
import org.rcisoft.business.blesson.service.BLessonPersonService; import org.rcisoft.business.blesson.service.BLessonPersonService;
import org.rcisoft.business.bpersonvalue.dao.BPersonValueRepository; import org.rcisoft.business.bpersonvalue.dao.BPersonValueRepository;
import org.rcisoft.business.bpersonvalue.entity.BPersonValue; import org.rcisoft.business.bpersonvalue.entity.BPersonValue;
...@@ -76,10 +80,10 @@ public class BLessonPersonServiceImpl implements BLessonPersonService { ...@@ -76,10 +80,10 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
if (bLesson == null){ if (bLesson == null){
throw new ServiceException(ResultServiceEnums.NOT_LESSON_ERROR); throw new ServiceException(ResultServiceEnums.NOT_LESSON_ERROR);
} }
if (bLessonPerson == null && "0".equals(bLesson.getLessonType())){ if (bLessonPerson == null && LessonTypeEnum.LESSON.getCode().equals(bLesson.getLessonType())){
throw new ServiceException(ResultServiceEnums.APPOINT_NOT_CLOSE); throw new ServiceException(ResultServiceEnums.APPOINT_NOT_CLOSE);
} }
if (bLessonPerson == null && "1".equals(bLesson.getLessonType())){ if (bLessonPerson == null && LessonTypeEnum.TRAIN.getCode().equals(bLesson.getLessonType())){
throw new ServiceException(ResultServiceEnums.LEARN_LESSON_NOT_EXISTS); throw new ServiceException(ResultServiceEnums.LEARN_LESSON_NOT_EXISTS);
} }
...@@ -103,7 +107,7 @@ public class BLessonPersonServiceImpl implements BLessonPersonService { ...@@ -103,7 +107,7 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
@Override @Override
public List<BLessonPerson> queryLearnBLessonsByPagination(PageUtil pageUtil, ILearnLessonDTO model) { public List<BLessonPerson> queryLearnBLessonsByPagination(PageUtil pageUtil, ILearnLessonDTO model) {
List<BLessonPerson> bLessonList = bLessonPersonRepository.queryLearnBLessons(model); List<BLessonPerson> bLessonList = bLessonPersonRepository.queryLearnBLessons(model);
if ("1".equals(model.getLessonType())){ if (LessonTypeEnum.TRAIN.getCode().equals(model.getLessonType())){
Date now = new Date(); Date now = new Date();
bLessonList.forEach(bLesson -> { bLessonList.forEach(bLesson -> {
Long time = Long.parseLong(bLesson.getTrainSignTime()) * 60 * 1000; Long time = Long.parseLong(bLesson.getTrainSignTime()) * 60 * 1000;
...@@ -135,7 +139,7 @@ public class BLessonPersonServiceImpl implements BLessonPersonService { ...@@ -135,7 +139,7 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
throw new ServiceException(ResultServiceEnums.LESSON_NOT_EXISTA); throw new ServiceException(ResultServiceEnums.LESSON_NOT_EXISTA);
} }
String trainType = ""; String trainType = "";
if ("1".equals(bLesson.getLessonType())){ if (LessonTypeEnum.TRAIN.getCode().equals(bLesson.getLessonType())){
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);
...@@ -227,7 +231,7 @@ public class BLessonPersonServiceImpl implements BLessonPersonService { ...@@ -227,7 +231,7 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
// BLessonPerson bLessonPerson1 = bLessonPersonRepository.selectById(cancelAppointDTO.getBusinessId()); // BLessonPerson bLessonPerson1 = bLessonPersonRepository.selectById(cancelAppointDTO.getBusinessId());
int result = 0; int result = 0;
//课程 //课程
if (bLesson != null && "0".equals(bLesson.getLessonType()) && "0".equals(bLessonPerson.getIsFinish())){ if (bLesson != null && LessonTypeEnum.LESSON.getCode().equals(bLesson.getLessonType()) && IsFinishEnum.NOT_START.getCode().equals(bLessonPerson.getIsFinish())){
//未开始执行删除 //未开始执行删除
bLessonPerson.setDelFlag("1"); bLessonPerson.setDelFlag("1");
//将加入学习时间置空 //将加入学习时间置空
...@@ -236,7 +240,7 @@ public class BLessonPersonServiceImpl implements BLessonPersonService { ...@@ -236,7 +240,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()) && ("1".equals(bLessonPerson.getIsFinish()) || "2".equals(bLessonPerson.getIsFinish()))){ if (bLesson != null && "0".equals(bLesson.getLessonType()) && (IsFinishEnum.LEARNING.getCode().equals(bLessonPerson.getIsFinish()) || IsFinishEnum.FINISHED.getCode().equals(bLessonPerson.getIsFinish()))){
//已开始执行更新 //已开始执行更新
UserUtil.setCurrentMergeOperation(bLessonPerson); UserUtil.setCurrentMergeOperation(bLessonPerson);
bLessonPerson.setIsAppoint("0"); bLessonPerson.setIsAppoint("0");
...@@ -244,7 +248,7 @@ public class BLessonPersonServiceImpl implements BLessonPersonService { ...@@ -244,7 +248,7 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
result = bLessonPersonRepository.updateByPrimaryKeySelective(bLessonPerson); result = bLessonPersonRepository.updateByPrimaryKeySelective(bLessonPerson);
} }
//培训 //培训
if (bLesson != null && "1".equals(bLesson.getLessonType())){ if (bLesson != null && LessonTypeEnum.TRAIN.getCode().equals(bLesson.getLessonType())){
UserUtil.setCurrentMergeOperation(bLessonPerson); UserUtil.setCurrentMergeOperation(bLessonPerson);
bLessonPerson.setIsAppoint("0"); bLessonPerson.setIsAppoint("0");
...@@ -276,10 +280,10 @@ public class BLessonPersonServiceImpl implements BLessonPersonService { ...@@ -276,10 +280,10 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
} }
BLesson bLesson = bLessonList.get(0); BLesson bLesson = bLessonList.get(0);
//判断课程是否被关闭 //判断课程是否被关闭
if ("4".equals(bLesson.getReleaseState())){ if (ReleaseStateEnum.CLOSED.getCode().equals(bLesson.getReleaseState())){
throw new ServiceException(ResultServiceEnums.LESSON_CLOSED); throw new ServiceException(ResultServiceEnums.LESSON_CLOSED);
} }
if (!"0".equals(bLesson.getLessonType())){ if (!(LessonTypeEnum.LESSON.getCode().equals(bLesson.getLessonType()))){
throw new ServiceException(ResultServiceEnums.NOT_TRAIN_TYPE); throw new ServiceException(ResultServiceEnums.NOT_TRAIN_TYPE);
} }
...@@ -294,7 +298,7 @@ public class BLessonPersonServiceImpl implements BLessonPersonService { ...@@ -294,7 +298,7 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
BLessonPerson bLessonPerson; BLessonPerson bLessonPerson;
int line = 0; int line = 0;
//被指派未开始 //被指派未开始
if (bLessonPersons != null && bLessonPersons.size()>0 && "0".equals(bLessonPersons.get(0).getIsFinish()) ){ if (bLessonPersons != null && bLessonPersons.size()>0 && IsFinishEnum.NOT_START.getCode().equals(bLessonPersons.get(0).getIsFinish()) ){
bLessonPerson = bLessonPersons.get(0); bLessonPerson = bLessonPersons.get(0);
bLessonPerson.setIsFinish("1"); bLessonPerson.setIsFinish("1");
bLessonPerson.setApplyDate(new Date()); bLessonPerson.setApplyDate(new Date());
...@@ -370,7 +374,7 @@ public class BLessonPersonServiceImpl implements BLessonPersonService { ...@@ -370,7 +374,7 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
if (bLesson == null){ if (bLesson == null){
throw new ServiceException(ResultServiceEnums.NOT_LESSON_ERROR); throw new ServiceException(ResultServiceEnums.NOT_LESSON_ERROR);
} }
if (bLessonPerson == null || "0".equals(bLessonPerson.getIsApply())){ if (bLessonPerson == null || IsApplyEnum.NOT_APPLY.getCode().equals(bLessonPerson.getIsApply())){
throw new ServiceException(ResultServiceEnums.APPLY_TRAIN_NOT_EXISTS); throw new ServiceException(ResultServiceEnums.APPLY_TRAIN_NOT_EXISTS);
} }
......
...@@ -3,6 +3,7 @@ package org.rcisoft.business.blesson.service.impl; ...@@ -3,6 +3,7 @@ package org.rcisoft.business.blesson.service.impl;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.rcisoft.business.blesson.dto.AppointLessonDTO; import org.rcisoft.business.blesson.dto.AppointLessonDTO;
import org.rcisoft.business.blesson.entity.BLesson; import org.rcisoft.business.blesson.entity.BLesson;
import org.rcisoft.business.blesson.enums.LessonTypeEnum;
import org.rcisoft.business.blesson.service.SendNoticeService; import org.rcisoft.business.blesson.service.SendNoticeService;
import org.rcisoft.business.bmessage.dao.BMessageRepository; import org.rcisoft.business.bmessage.dao.BMessageRepository;
import org.rcisoft.business.bmessage.entity.BMessage; import org.rcisoft.business.bmessage.entity.BMessage;
...@@ -42,7 +43,7 @@ public class SendNoticeServiceImpl implements SendNoticeService { ...@@ -42,7 +43,7 @@ public class SendNoticeServiceImpl implements SendNoticeService {
// e.printStackTrace(); // e.printStackTrace();
// } // }
//是否去掉已在切已指派的人员 //是否去掉已在切已指派的人员
String type = "0".equals(bLesson.getLessonType()) ? MessageEnum.ZPKC.getName() : MessageEnum.ZPPX.getName(); String type = LessonTypeEnum.LESSON.getCode().equals(bLesson.getLessonType()) ? MessageEnum.ZPKC.getName() : MessageEnum.ZPPX.getName();
List<BMessage> bMessageList = bMessageRepository.queryByNameAndCorp(type,appointLessonDTO.getCorpId()); List<BMessage> bMessageList = bMessageRepository.queryByNameAndCorp(type,appointLessonDTO.getCorpId());
BMessage message = new BMessage(); BMessage message = new BMessage();
if (bMessageList != null && bMessageList.size() > 0){ if (bMessageList != null && bMessageList.size() > 0){
...@@ -56,10 +57,10 @@ public class SendNoticeServiceImpl implements SendNoticeService { ...@@ -56,10 +57,10 @@ public class SendNoticeServiceImpl implements SendNoticeService {
bNotice.setSenderId(appointLessonDTO.getUserId()); bNotice.setSenderId(appointLessonDTO.getUserId());
bNotice.setCorpId(appointLessonDTO.getCorpId()); bNotice.setCorpId(appointLessonDTO.getCorpId());
// 获取课程信息 // 获取课程信息
String lessonType = "0".equals(bLesson.getLessonType()) ? "线上课程" : "线下培训"; String lessonType = LessonTypeEnum.LESSON.getCode().equals(bLesson.getLessonType()) ? "线上课程" : "线下培训";
String infoType = "0".equals(bLesson.getLessonType()) ? InfoTypeEnum.ONLINE_LESSON.getValue() : InfoTypeEnum.OFFLINE_TRAIN.getValue(); String infoType = LessonTypeEnum.LESSON.getCode().equals(bLesson.getLessonType()) ? InfoTypeEnum.ONLINE_LESSON.getValue() : InfoTypeEnum.OFFLINE_TRAIN.getValue();
bNotice.setInfoType(infoType); bNotice.setInfoType(infoType);
String urlType = "0".equals(bLesson.getLessonType()) ? UrlTypeEnum.LESSON.getName() : UrlTypeEnum.TRAIN.getName(); String urlType = LessonTypeEnum.LESSON.getCode().equals(bLesson.getLessonType()) ? UrlTypeEnum.LESSON.getName() : UrlTypeEnum.TRAIN.getName();
bNotice.setInfoText(sysUserServiceImpl.getNameById(appointLessonDTO.getUserId()).getName() + "给您指派了" + lessonType +"“" + bLesson.getLessonName() +"”,请及时学习" ); bNotice.setInfoText(sysUserServiceImpl.getNameById(appointLessonDTO.getUserId()).getName() + "给您指派了" + lessonType +"“" + bLesson.getLessonName() +"”,请及时学习" );
// 往智信平台发啊消息 // 往智信平台发啊消息
client.send(bNotice,InfoTypeEnum.REPLY_DISCUSS.getLable(),type,urlType); client.send(bNotice,InfoTypeEnum.REPLY_DISCUSS.getLable(),type,urlType);
......
...@@ -2,6 +2,8 @@ package org.rcisoft.business.breleasevalue.service.impl; ...@@ -2,6 +2,8 @@ package org.rcisoft.business.breleasevalue.service.impl;
import org.apache.commons.collections.map.HashedMap; import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.rcisoft.business.blesson.enums.LessonTypeEnum;
import org.rcisoft.business.blesson.enums.ReleaseStateEnum;
import org.rcisoft.business.breleasevalue.dto.*; import org.rcisoft.business.breleasevalue.dto.*;
import org.rcisoft.business.breleasevalue.entity.BReleaseValueSon; import org.rcisoft.business.breleasevalue.entity.BReleaseValueSon;
import org.rcisoft.common.util.feignDto.MTUserGetsReqDTO; import org.rcisoft.common.util.feignDto.MTUserGetsReqDTO;
...@@ -168,10 +170,10 @@ public class BReleaseValueServiceImpl implements BReleaseValueService { ...@@ -168,10 +170,10 @@ public class BReleaseValueServiceImpl implements BReleaseValueService {
List<LessonValueDto> list = bReleaseValueRepository.getLessonValue(curUser,dto); List<LessonValueDto> list = bReleaseValueRepository.getLessonValue(curUser,dto);
for(LessonValueDto valueDto :list){ for(LessonValueDto valueDto :list){
//0未发布 1审核 2已发布 3驳回 4关闭 //0未发布 1审核 2已发布 3驳回 4关闭
if("0".equals(valueDto.getReleaseState())){ if(ReleaseStateEnum.UNRELEASED.getCode().equals(valueDto.getReleaseState())){
valueDto.setReleaseState("未发布"); valueDto.setReleaseState("未发布");
}else if("2".equals(valueDto.getReleaseState())){ }else if(ReleaseStateEnum.RELEASED.getCode().equals(valueDto.getReleaseState())){
if("0".equals(dto.getType())){ if(LessonTypeEnum.LESSON.getCode().equals(dto.getType())){
valueDto.setReleaseState("已发布"); valueDto.setReleaseState("已发布");
}else{ }else{
if(valueDto.getTrainStart().after(new Date())){ if(valueDto.getTrainStart().after(new Date())){
...@@ -182,7 +184,7 @@ public class BReleaseValueServiceImpl implements BReleaseValueService { ...@@ -182,7 +184,7 @@ public class BReleaseValueServiceImpl implements BReleaseValueService {
valueDto.setReleaseState("已发布(已结束)"); valueDto.setReleaseState("已发布(已结束)");
} }
} }
}else if("4".equals(valueDto.getReleaseState())){ }else if(ReleaseStateEnum.CLOSED.getCode().equals(valueDto.getReleaseState())){
valueDto.setReleaseState("已关闭"); valueDto.setReleaseState("已关闭");
} }
} }
......
...@@ -11,6 +11,7 @@ import org.rcisoft.business.blesson.dao.BLessonRepository; ...@@ -11,6 +11,7 @@ import org.rcisoft.business.blesson.dao.BLessonRepository;
import org.rcisoft.business.blesson.dto.LessonAndUserDTO; import org.rcisoft.business.blesson.dto.LessonAndUserDTO;
import org.rcisoft.business.blesson.entity.BLesson; import org.rcisoft.business.blesson.entity.BLesson;
import org.rcisoft.business.blesson.entity.BLessonPerson; import org.rcisoft.business.blesson.entity.BLessonPerson;
import org.rcisoft.business.blesson.enums.IsFinishEnum;
import org.rcisoft.business.blesson.service.impl.BLessonServiceImpl; import org.rcisoft.business.blesson.service.impl.BLessonServiceImpl;
import org.rcisoft.business.bpersonvalue.entity.BPersonValue; import org.rcisoft.business.bpersonvalue.entity.BPersonValue;
import org.rcisoft.business.brstudentchapter.dto.BRStudentChapterDto; import org.rcisoft.business.brstudentchapter.dto.BRStudentChapterDto;
...@@ -133,7 +134,7 @@ public class BRStudentChapterServiceImpl implements BRStudentChapterService { ...@@ -133,7 +134,7 @@ public class BRStudentChapterServiceImpl implements BRStudentChapterService {
BLessonPerson bLessonPerson = this.dealBLessonPerson(bLessonPersonList.get(0),brStudentChapterDto,totalProgress); BLessonPerson bLessonPerson = this.dealBLessonPerson(bLessonPersonList.get(0),brStudentChapterDto,totalProgress);
//TODO 判断是否为已学完 曾经是否学完过 奖励积分 //TODO 判断是否为已学完 曾经是否学完过 奖励积分
BLesson bLesson = bLessonRepository.selectByPrimaryKey(brStudentChapterDto.getLessonId()); BLesson bLesson = bLessonRepository.selectByPrimaryKey(brStudentChapterDto.getLessonId());
if (bLesson != null && "2".equals(bLessonPerson.getIsFinish()) && !("1".equals(bLessonPerson.getEverFinished()))){ if (bLesson != null && IsFinishEnum.FINISHED.getCode().equals(bLessonPerson.getIsFinish()) && !("1".equals(bLessonPerson.getEverFinished()))){
//查询课程信息 //查询课程信息
BPersonValue bPersonValue = new BPersonValue(curUser.getUserId(),"学完!@#课程",bLesson.getValueGain(),"0",bLesson.getBusinessId()); BPersonValue bPersonValue = new BPersonValue(curUser.getUserId(),"学完!@#课程",bLesson.getValueGain(),"0",bLesson.getBusinessId());
bLessonServiceImpl.addValueEvent(curUser.getUserId(),bPersonValue,null); bLessonServiceImpl.addValueEvent(curUser.getUserId(),bPersonValue,null);
...@@ -148,7 +149,7 @@ public class BRStudentChapterServiceImpl implements BRStudentChapterService { ...@@ -148,7 +149,7 @@ public class BRStudentChapterServiceImpl implements BRStudentChapterService {
bLessonPerson.setLessonId(brStudentChapterDto.getLessonId()); bLessonPerson.setLessonId(brStudentChapterDto.getLessonId());
//TODO 判断是否为已学完 曾经是否学完过 奖励积分 //TODO 判断是否为已学完 曾经是否学完过 奖励积分
BLesson bLesson = bLessonRepository.selectByPrimaryKey(brStudentChapterDto.getLessonId()); BLesson bLesson = bLessonRepository.selectByPrimaryKey(brStudentChapterDto.getLessonId());
if (bLesson != null && "2".equals(bLessonPerson.getIsFinish()) && !("1".equals(bLessonPerson.getEverFinished()))){ if (bLesson != null && IsFinishEnum.FINISHED.getCode().equals(bLessonPerson.getIsFinish()) && !("1".equals(bLessonPerson.getEverFinished()))){
//查询课程信息 //查询课程信息
BPersonValue bPersonValue = new BPersonValue(curUser.getUserId(),"学完!@#课程",bLesson.getValueGain(),"0",bLesson.getBusinessId()); BPersonValue bPersonValue = new BPersonValue(curUser.getUserId(),"学完!@#课程",bLesson.getValueGain(),"0",bLesson.getBusinessId());
bLessonServiceImpl.addValueEvent(curUser.getUserId(),bPersonValue,null); bLessonServiceImpl.addValueEvent(curUser.getUserId(),bPersonValue,null);
......
...@@ -59,6 +59,9 @@ public class MTNotificationApiRequestClient { ...@@ -59,6 +59,9 @@ public class MTNotificationApiRequestClient {
@Value("${notice.defaultUrl}") @Value("${notice.defaultUrl}")
private String defaultUrl; private String defaultUrl;
@Value("${appId.noticeAppId}")
private Long noticeAppId;
@Autowired @Autowired
private NotificationFeignClient notificationFeignClient; private NotificationFeignClient notificationFeignClient;
@Autowired @Autowired
...@@ -66,8 +69,6 @@ public class MTNotificationApiRequestClient { ...@@ -66,8 +69,6 @@ public class MTNotificationApiRequestClient {
@Autowired @Autowired
private SysUserMapper sysUserMapper; private SysUserMapper sysUserMapper;
// @Autowired
// private INotificationService notificationService;
@Autowired @Autowired
MTMicroappApiRequestClient microappApiRequestClient; MTMicroappApiRequestClient microappApiRequestClient;
...@@ -84,11 +85,10 @@ public class MTNotificationApiRequestClient { ...@@ -84,11 +85,10 @@ public class MTNotificationApiRequestClient {
* @return * @return
*/ */
public boolean send(BNotice message, String noticeTitle, String type, String urlType) { public boolean send(BNotice message, String noticeTitle, String type, String urlType) {
// if(true) { if("dev".equalsIgnoreCase(serverType)) {
// return true; return true;
// } }
NotiRet ret = new NotiRet(); NotiRet ret = new NotiRet();
// List<BNotice> bNoticeList = new ArrayList<>();
String noticeType = InfoTypeEnum.EXAN.getLable(); String noticeType = InfoTypeEnum.EXAN.getLable();
if (InfoTypeEnum.REPLY_DISCUSS.getValue().equals(message.getInfoType())){ if (InfoTypeEnum.REPLY_DISCUSS.getValue().equals(message.getInfoType())){
...@@ -123,8 +123,6 @@ public class MTNotificationApiRequestClient { ...@@ -123,8 +123,6 @@ public class MTNotificationApiRequestClient {
senderUser.setHeadPic(defaultUrl); senderUser.setHeadPic(defaultUrl);
} }
// List<String> reciIds = new ArrayList<>();
// List<SysUser> personnelsList = sysUserMapper.selectByIds(message.getRecipientIds());
if (null != message.getRecipientIds() && message.getRecipientIds().size() > 0 && message.getRecipientIds().get(0) != null) { if (null != message.getRecipientIds() && message.getRecipientIds().size() > 0 && message.getRecipientIds().get(0) != null) {
List<Long> recipientIdLongList = new ArrayList<>(); List<Long> recipientIdLongList = new ArrayList<>();
...@@ -142,8 +140,6 @@ public class MTNotificationApiRequestClient { ...@@ -142,8 +140,6 @@ public class MTNotificationApiRequestClient {
}); });
MTUserGetsAccountReqDTO mtUserGetsReqDTO = new MTUserGetsAccountReqDTO(message.getCorpId(),getUserAccountList); MTUserGetsAccountReqDTO mtUserGetsReqDTO = new MTUserGetsAccountReqDTO(message.getCorpId(),getUserAccountList);
// MTUserGetsReqDTO mtUserGetsReqDTO = new MTUserGetsReqDTO(message.getCorpId(),Arrays.asList(new String[]{"1042237477358641154"}));
// List<MTAccountIdRspDTO> mtAccountIdRspDTOList = mtCotactApiRequestClient.accountGetUserHead(mtUserGetsReqDTO);
List<MTAccountIdRspDTO> mtAccountIdRspDTOList = mtCotactApiRequestClient.accountGetUserHead(mtUserGetsReqDTO); List<MTAccountIdRspDTO> mtAccountIdRspDTOList = mtCotactApiRequestClient.accountGetUserHead(mtUserGetsReqDTO);
mtAccountIdRspDTOList.forEach(mtAccountIdRspDTO -> { mtAccountIdRspDTOList.forEach(mtAccountIdRspDTO -> {
haveJurisAccountIds.add(mtAccountIdRspDTO.getAccountId()); haveJurisAccountIds.add(mtAccountIdRspDTO.getAccountId());
...@@ -170,8 +166,7 @@ public class MTNotificationApiRequestClient { ...@@ -170,8 +166,7 @@ public class MTNotificationApiRequestClient {
noticePropertiesUrl = this.noticeUrlExam; noticePropertiesUrl = this.noticeUrlExam;
} }
String url = noticePropertiesUrl + "&from=zx"; String url = noticePropertiesUrl + "&from=zx";
// String url = noticePropertiesUrl + "noticeType=" + dealWithTitle(noticeTitle) + "&id=" + sysUser.getBusinessId() + "&infoText=" + UrlUtil.Utf8URLencode(message.getInfoText())
// + "&messageId=" + message.getBusinessId() + "&createDate=" + UrlUtil.Utf8URLencodeTime(df.format(message.getCreateDate())) + "&from=zx";
final String finalNoticeType = noticeType; final String finalNoticeType = noticeType;
mtNotificationSendReqDTO.setProperties(new HashMap<String, String>() {{ mtNotificationSendReqDTO.setProperties(new HashMap<String, String>() {{
put("url", url); put("url", url);
...@@ -184,7 +179,7 @@ public class MTNotificationApiRequestClient { ...@@ -184,7 +179,7 @@ public class MTNotificationApiRequestClient {
log.debug(json); log.debug(json);
try { try {
ret = notificationFeignClient.sendMessage(mtNotificationSendReqDTO, "app", (long) 1); ret = notificationFeignClient.sendMessage(mtNotificationSendReqDTO, "app", noticeAppId);
} catch (Exception ex) { } catch (Exception ex) {
log.error("----------------------------------------------------调用智信通知失败!----------------------------------------------------------"+ex); log.error("----------------------------------------------------调用智信通知失败!----------------------------------------------------------"+ex);
return false; return false;
......
...@@ -95,13 +95,13 @@ public class OfficeToPdf { ...@@ -95,13 +95,13 @@ public class OfficeToPdf {
if (!inputFile.exists()) { if (!inputFile.exists()) {
return -1;// 找不到源文件, 则返回-1 return -1;// 找不到源文件, 则返回-1
} }
LogUtil.fileChangeLog("----------ZH------------"); LogUtil.fileChangeLog("----------如果目标路径不存在, 则新建该路径------------");
// 如果目标路径不存在, 则新建该路径 // 如果目标路径不存在, 则新建该路径
File outputFile = new File(destFile); File outputFile = new File(destFile);
if (!outputFile.getParentFile().exists()) { if (!outputFile.getParentFile().exists()) {
outputFile.getParentFile().mkdirs(); outputFile.getParentFile().mkdirs();
} }
LogUtil.fileChangeLog("----------ZH------------"); LogUtil.fileChangeLog("----------新建SocketOpenOfficeConnection连接------------");
// connect to an OpenOffice.org instance running on port 8100 // connect to an OpenOffice.org instance running on port 8100
connection = new SocketOpenOfficeConnection( connection = new SocketOpenOfficeConnection(
global.getLibreofficeIp(), global.getLibreofficePort()); global.getLibreofficeIp(), global.getLibreofficePort());
...@@ -112,11 +112,11 @@ public class OfficeToPdf { ...@@ -112,11 +112,11 @@ public class OfficeToPdf {
LogUtil.fileChangeLog("****************connect + end***********" + DateFormatUtils.format(new Date(), "HH:mm:ss")); LogUtil.fileChangeLog("****************connect + end***********" + DateFormatUtils.format(new Date(), "HH:mm:ss"));
// convert // convert
LogUtil.fileChangeLog("----------ZH------------"); LogUtil.fileChangeLog("----------创建OpenOfficeDocumentConverter------------");
DocumentConverter converter = new OpenOfficeDocumentConverter( DocumentConverter converter = new OpenOfficeDocumentConverter(
connection); connection);
DocumentFormatRegistry factory = new BasicDocumentFormatRegistry(); DocumentFormatRegistry factory = new BasicDocumentFormatRegistry();
LogUtil.fileChangeLog("----------ZH------------"); LogUtil.fileChangeLog("----------设置输入输出------------");
DocumentFormat inputDocumentFormat = factory DocumentFormat inputDocumentFormat = factory
.getFormatByFileExtension(FileUtil.getFilePostfix(sourceFile)); .getFormatByFileExtension(FileUtil.getFilePostfix(sourceFile));
DocumentFormat outputDocumentFormat = factory DocumentFormat outputDocumentFormat = factory
...@@ -128,18 +128,18 @@ public class OfficeToPdf { ...@@ -128,18 +128,18 @@ public class OfficeToPdf {
// close the connection // close the connection
} catch (ConnectException e) { } catch (ConnectException e) {
LogUtil.fileChangeLog("----------------------catch1------------------"+e); LogUtil.fileChangeLog("----------------------ConnectException------------------"+e);
e.printStackTrace(); e.printStackTrace();
} catch (IOException e) { } catch (IOException e) {
LogUtil.fileChangeLog("----------------------catch2------------------"+e); LogUtil.fileChangeLog("----------------------IOException------------------"+e);
e.printStackTrace(); e.printStackTrace();
return 0; return 0;
}finally { }finally {
if(connection!=null) { if(connection!=null) {
LogUtil.fileChangeLog("----------------------finally1------------------"); LogUtil.fileChangeLog("----------------------finally1-断开连接------------------");
connection.disconnect(); connection.disconnect();
}else{ }else{
LogUtil.fileChangeLog("----------------------finally2------------------"); LogUtil.fileChangeLog("----------------------finally2-无连接抛异常------------------");
// throw new ServiceException(ResultServiceEnums.CHANGE_FILE_ERROR); // throw new ServiceException(ResultServiceEnums.CHANGE_FILE_ERROR);
throw new ServiceException(ResultServiceEnums.CHANGE_HAVE_MEDIA); throw new ServiceException(ResultServiceEnums.CHANGE_HAVE_MEDIA);
} }
......
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