Commit f5239ca8 authored by YangZhaoJun1's avatar YangZhaoJun1

补充UserUtil

parent b689bfaa
......@@ -48,7 +48,7 @@ public class BCarouselController extends PaginationController<BCarousel> {
@ApiImplicitParam(name = "remarks", value = "备注", required = false, dataType = "varchar")})
@RequestMapping("/add")
public Result add(BCarousel bCarousel) {
PersistModel data = bCarouselServiceImpl.persist(bCarousel);
PersistModel data = bCarouselServiceImpl.persist(bCarousel,getToken());
return Result.builder(data,MessageConstant.MESSAGE_ALERT_SUCCESS,bCarousel);
}
......
......@@ -38,7 +38,7 @@ public interface BCarouselService{
* @param model
* @return
*/
PersistModel persist(BCarousel model);
PersistModel persist(BCarousel model, String token);
/**
* 删除
......
......@@ -55,16 +55,16 @@ public class BCarouselServiceImpl implements BCarouselService {
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
@Override
public PersistModel persist(BCarousel model){
public PersistModel persist(BCarousel model, String token){
int line = 0;
if(!StringUtils.isEmpty(model.getBusinessId())){
model.setUpdateDate(new Date());
BImage image = new BImage();
image.setUpdateDate(new Date());
UserUtil.setCurrentMergeOperation(image,token);
bImageRepository.updateTime(image);
UserUtil.setCurrentMergeOperation(model,token);
line = bCarouselRepository.updateCarouselById(model);
}else{
model.setCommonBusinessId();
UserUtil.setCurrentPersistOperation(model,token);
line = bCarouselRepository.insertSelective(model);
}
if(line!=1)
......
......@@ -66,12 +66,6 @@ public class BChapterController extends PaginationController<BChapter> {
@ApiImplicitParam(name = "chapterUrl", value = "课程url", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "mdFile", value = "任务书", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "isTest", value = "1:实验 2:视频 3:PPT'", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "createBy", value = "创建者", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "createDate", value = "创建日期", required = false, dataType = "datetime"),
@ApiImplicitParam(name = "updateBy", value = "更新者", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "updateDate", value = "更新日期", required = false, dataType = "datetime"),
@ApiImplicitParam(name = "delFlag", value = "删除标记(0:正常;1:删除;2:审核)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "flag", value = "启用标记(0:停用;1:启用)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "remarks", value = "备注", required = false, dataType = "varchar")})
@RequestMapping(value = "/add", method = RequestMethod.POST)
public Result add(@Valid BChapter bChapter,
......@@ -83,7 +77,7 @@ public class BChapterController extends PaginationController<BChapter> {
throw new ServiceException(ResultServiceEnums.PARAMER_ERROR.getCode(),
bindingResult.getFieldError().getDefaultMessage());
}
PersistModel data = bChapterService.persist(bChapter);
PersistModel data = bChapterService.persist(bChapter,getToken());
result.setCode(ResultCode.SUCCESS.code);
result.setMessage(MessageConstant.MESSAGE_ALERT_SUCCESS);
result.setData(data);
......@@ -96,7 +90,7 @@ public class BChapterController extends PaginationController<BChapter> {
@RequestMapping("/remove")
public Result remove(String id) {
Result result = new Result();
PersistModel data = bChapterService.removeBChapter(id);
PersistModel data = bChapterService.removeBChapter(id,getToken());
result.setCode(ResultCode.SUCCESS.code);
result.setMessage(MessageConstant.MESSAGE_ALERT_SUCCESS);
......@@ -147,10 +141,6 @@ public class BChapterController extends PaginationController<BChapter> {
@ApiImplicitParam(name = "chapterUrl", value = "课程url", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "mdFile", value = "任务书", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "isTest", value = "1:实验 2:视频 3:PPT'", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "createBy", value = "创建者", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "createDate", value = "创建日期", required = false, dataType = "datetime"),
@ApiImplicitParam(name = "updateBy", value = "更新者", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "updateDate", value = "更新日期", required = false, dataType = "datetime"),
@ApiImplicitParam(name = "delFlag", value = "删除标记(0:正常;1:删除;2:审核)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "flag", value = "启用标记(0:停用;1:启用)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "remarks", value = "备注", required = false, dataType = "varchar")})
......@@ -172,10 +162,6 @@ public class BChapterController extends PaginationController<BChapter> {
@ApiImplicitParam(name = "chapterUrl", value = "课程url", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "mdFile", value = "任务书", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "isTest", value = "1:实验 2:视频 3:PPT'", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "createBy", value = "创建者", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "createDate", value = "创建日期", required = false, dataType = "datetime"),
@ApiImplicitParam(name = "updateBy", value = "更新者", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "updateDate", value = "更新日期", required = false, dataType = "datetime"),
@ApiImplicitParam(name = "delFlag", value = "删除标记(0:正常;1:删除;2:审核)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "flag", value = "启用标记(0:停用;1:启用)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "remarks", value = "备注", required = false, dataType = "varchar")})
......@@ -231,7 +217,7 @@ public class BChapterController extends PaginationController<BChapter> {
e.printStackTrace();
throw new ServiceException(ResultServiceEnums.PARAMER_ERROR);
}
bChapterService.markScore(list);
bChapterService.markScore(list,getToken());
result.setCode(ResultCode.SUCCESS.code);
result.setMessage(MessageConstant.MESSAGE_ALERT_SUCCESS);
result.setData(null);
......@@ -254,14 +240,7 @@ public class BChapterController extends PaginationController<BChapter> {
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "score", value = "分数", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "chapterId", value = "章节id", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "studentId", value = "学生学号", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "createBy", value = "创建者", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "createDate", value = "创建日期", required = false, dataType = "datetime"),
@ApiImplicitParam(name = "updateBy", value = "更新者", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "updateDate", value = "更新日期", required = false, dataType = "datetime"),
@ApiImplicitParam(name = "delFlag", value = "删除标记(0:正常;1:删除;2:审核)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "flag", value = "启用标记(0:停用;1:启用)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "remarks", value = "备注", required = false, dataType = "varchar")})
@ApiImplicitParam(name = "studentId", value = "学生学号", required = false, dataType = "varchar")})
@RequestMapping(value = "/complete", method = RequestMethod.POST)
public Result complete(ScoreInfoDTO scoreInfoDTO) {
Result result = new Result();
......@@ -271,7 +250,7 @@ public class BChapterController extends PaginationController<BChapter> {
throw new ServiceException(ResultServiceEnums.ROLE_ERROR);
scoreInfoDTO.setStudentId(UserUtil.getUserInfoProp(getToken(),UserUtil.USER_ID));
bChapterService.updateIsComplete(scoreInfoDTO);
bChapterService.updateIsComplete(scoreInfoDTO,getToken());
result.setCode(ResultCode.SUCCESS.code);
result.setMessage(MessageConstant.MESSAGE_ALERT_SUCCESS);
result.setData(null);
......
......@@ -49,7 +49,7 @@ public interface BChapterService{
* @param model
* @return
*/
PersistModel persist(BChapter model);
PersistModel persist(BChapter model, String token);
/**
* 修改
......@@ -63,14 +63,14 @@ public interface BChapterService{
* @param id
* @return
*/
PersistModel removeBChapter(String id);
PersistModel removeBChapter(String id,String token);
/**
* 打分
* @param scoreInfoDTOS
* @return
*/
void markScore(List<ScoreInfoDTO> scoreInfoDTOS);
void markScore(List<ScoreInfoDTO> scoreInfoDTOS,String token);
/**
* 根据学生id和课程id获取该学生的课程章节分数列表
......@@ -90,6 +90,6 @@ public interface BChapterService{
* 更新已经完成状态
* @param scoreInfoDTO
*/
void updateIsComplete(ScoreInfoDTO scoreInfoDTO);
void updateIsComplete(ScoreInfoDTO scoreInfoDTO,String token);
}
......@@ -16,6 +16,7 @@ import org.rcisoft.common.component.PageUtil;
import org.rcisoft.core.exception.ServiceException;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.result.ResultServiceEnums;
import org.rcisoft.core.util.UserUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
......@@ -73,14 +74,15 @@ public class BChapterServiceImpl implements BChapterService {
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
@Override
public PersistModel persist(BChapter model){
public PersistModel persist(BChapter model, String token){
int line = 0;
if(model.getBusinessId()==null) {
if (bSlRepository.selectByPrimaryKey(model.getSlId()) == null)
throw new ServiceException(ResultServiceEnums.SL_INFO_NOT_EXISTS);
model.setCommonBusinessId(); // UserUtils.setCurrentPersistOperation(model);
UserUtil.setCurrentPersistOperation(model,token);
line = bChapterRepository.insertSelective(model);
}else
UserUtil.setCurrentMergeOperation(model,token);
line = bChapterRepository.updateByPrimaryKeySelective(model);
//FamilyLogger.sysInfo(UserUtils.getUser().getBusinessId(),UserUtils.getUser().getLoginName()+"新增了ID为"+user.getBusinessId()+"的用户");
return new PersistModel(line);
......@@ -95,7 +97,7 @@ public class BChapterServiceImpl implements BChapterService {
@Override
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
public PersistModel removeBChapter(String id) {
public PersistModel removeBChapter(String id,String token) {
BChapter bChapter = bChapterRepository.selectByPrimaryKey(id);
if(bChapter==null)
throw new ServiceException(ResultServiceEnums.CHAPTER_NOT_EXISTS);
......@@ -106,13 +108,14 @@ public class BChapterServiceImpl implements BChapterService {
throw new ServiceException(ResultServiceEnums.CHAPTER_HAS_CHILD);
bChapterRepository.deleteStudentChapter(id);
bChapterRepository.deleteByPrimaryKey(id);
UserUtil.setCurrentMergeOperation(bChapter,token);
int line = bChapterRepository.updateByPrimaryKeySelective(bChapter);
return new PersistModel(line);
}
@Override
@Transactional
public void markScore(List<ScoreInfoDTO> scoreInfoDTOS) {
public void markScore(List<ScoreInfoDTO> scoreInfoDTOS,String token) {
for(ScoreInfoDTO scoreInfoDTO:scoreInfoDTOS){
String id = bChapterRepository.selectIdByStudentIdAndChapterId(scoreInfoDTO.getChapterId(),scoreInfoDTO.getStudentId());
if(scoreInfoDTO.getScore()==null||scoreInfoDTO.getScore()<0||scoreInfoDTO.getScore()>100) //分数不为空且在0到100之间
......@@ -132,6 +135,7 @@ public class BChapterServiceImpl implements BChapterService {
// bChapterRepository.insertScoreInfo(scoreInfoDTO);
}else{ //已经学习则修改
scoreInfoDTO.setBusinessId(id);
UserUtil.setCurrentMergeOperation(scoreInfoDTO,token);
bChapterRepository.updateScoreInfo(scoreInfoDTO);
}
}
......@@ -152,12 +156,13 @@ public class BChapterServiceImpl implements BChapterService {
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
@Override
public void updateIsComplete(ScoreInfoDTO scoreInfoDTO) {
public void updateIsComplete(ScoreInfoDTO scoreInfoDTO,String token) {
String stuid = bStudentRepository.queryStudentByUserId(scoreInfoDTO.getStudentId());
scoreInfoDTO.setStudentId(stuid);
if(bChapterRepository.selectIdByStudentIdAndChapterId(scoreInfoDTO.getChapterId(),scoreInfoDTO.getStudentId())!=null)
return;
scoreInfoDTO.setCommonBusinessId();
UserUtil.setCurrentMergeOperation(scoreInfoDTO,token);
int result = bChapterRepository.updateIsComplete(scoreInfoDTO);
if(result<1)
throw new ServiceException(ResultServiceEnums.UPDATE_ERROR);
......
......@@ -43,12 +43,6 @@ public class BClassController extends PaginationController<BClass> {
@ApiImplicitParam(name = "code", value = "班级编号", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "className", value = "班级名称", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "studentNum", value = "学生数量", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "createBy", value = "创建者", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "createDate", value = "创建日期", required = false, dataType = "datetime"),
@ApiImplicitParam(name = "updateBy", value = "更新者", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "updateDate", value = "更新日期", required = false, dataType = "datetime"),
@ApiImplicitParam(name = "delFlag", value = "删除标记(0:正常;1:删除;2:审核)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "flag", value = "启用标记(0:停用;1:启用)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "remarks", value = "备注", required = false, dataType = "varchar")})
@RequestMapping("/add")
public Result add(@Valid BClass bClass, BindingResult bindingResult) {
......@@ -61,7 +55,7 @@ public class BClassController extends PaginationController<BClass> {
throw new ServiceException(ResultServiceEnums.PARAMER_ERROR.getCode(),
bindingResult.getFieldError().getDefaultMessage());
}
PersistModel data = bClassService.persist(bClass);
PersistModel data = bClassService.persist(bClass,getToken());
result.setCode(ResultCode.SUCCESS.code);
result.setMessage(MessageConstant.MESSAGE_ALERT_SUCCESS);
result.setData(data);
......@@ -83,9 +77,9 @@ public class BClassController extends PaginationController<BClass> {
@ApiOperation(value="excel导入", notes="上传excel到服务器")
@ApiImplicitParam(name = "importFile", value = "excel文件", required = true, dataType = "MultipartFile")
@RequestMapping("excelImport")
public Result excelImport(MultipartFile importFile) throws Exception {
public Result excelImport(MultipartFile importFile, String token) throws Exception {
Result result = new Result();
PersistModel data = bClassService.importExcel(MultipartFile2HSSFWorkbookConverter.convert(importFile));
PersistModel data = bClassService.importExcel(MultipartFile2HSSFWorkbookConverter.convert(importFile),token);
result.setCode(ResultCode.SUCCESS.code);
result.setMessage(MessageConstant.MESSAGE_ALERT_SUCCESS);
result.setData(data);
......@@ -109,10 +103,6 @@ public class BClassController extends PaginationController<BClass> {
@ApiImplicitParam(name = "code", value = "班级编号", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "className", value = "班级名称", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "studentNum", value = "学生数量", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "createBy", value = "创建者", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "createDate", value = "创建日期", required = false, dataType = "datetime"),
@ApiImplicitParam(name = "updateBy", value = "更新者", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "updateDate", value = "更新日期", required = false, dataType = "datetime"),
@ApiImplicitParam(name = "delFlag", value = "删除标记(0:正常;1:删除;2:审核)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "flag", value = "启用标记(0:停用;1:启用)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "remarks", value = "备注", required = false, dataType = "varchar")})
......@@ -129,10 +119,6 @@ public class BClassController extends PaginationController<BClass> {
@ApiImplicitParam(name = "code", value = "班级编号", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "className", value = "班级名称", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "studentNum", value = "学生数量", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "createBy", value = "创建者", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "createDate", value = "创建日期", required = false, dataType = "datetime"),
@ApiImplicitParam(name = "updateBy", value = "更新者", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "updateDate", value = "更新日期", required = false, dataType = "datetime"),
@ApiImplicitParam(name = "delFlag", value = "删除标记(0:正常;1:删除;2:审核)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "flag", value = "启用标记(0:停用;1:启用)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "remarks", value = "备注", required = false, dataType = "varchar")})
......
......@@ -40,7 +40,7 @@ public interface BClassService{
* @param model
* @return
*/
PersistModel persist(BClass model);
PersistModel persist(BClass model,String token);
/**
* 逻辑删除
......@@ -54,5 +54,5 @@ public interface BClassService{
* @param hwb
* @return
*/
PersistModel importExcel(HSSFWorkbook hwb) throws IOException;
PersistModel importExcel(HSSFWorkbook hwb, String token) throws IOException;
}
......@@ -11,6 +11,7 @@ import org.rcisoft.core.exception.ServiceException;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.result.ResultServiceEnums;
import org.rcisoft.core.util.ExcelUtil;
import org.rcisoft.core.util.UserUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
......@@ -52,15 +53,15 @@ public class BClassServiceImpl implements BClassService {
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
@Override
public PersistModel persist(BClass model){
public PersistModel persist(BClass model, String token){
int line = 0;
if(model.getBusinessId()==null) {
if (bClassRepository.selectOne(new BClass(model.getCode())) != null)
throw new ServiceException(ResultServiceEnums.CLASS_EXISTS);
model.setCommonBusinessId();
// UserUtils.setCurrentPersistOperation(model);
UserUtil.setCurrentPersistOperation(model,token);
line = bClassRepository.insertSelective(model);
}else
UserUtil.setCurrentMergeOperation(model,token);
line = bClassRepository.updateByPrimaryKeySelective(model);
//FamilyLogger.sysInfo(UserUtils.getUser().getBusinessId(),UserUtils.getUser().getLoginName()+"新增了ID为"+user.getBusinessId()+"的用户");
return new PersistModel(line);
......@@ -77,7 +78,7 @@ public class BClassServiceImpl implements BClassService {
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
@Override
public PersistModel importExcel(HSSFWorkbook hwb) throws IOException {
public PersistModel importExcel(HSSFWorkbook hwb, String token) throws IOException {
ArrayList<BClass> bClasses = new ArrayList<BClass>();
ArrayList<String> repeatCode = new ArrayList<String>();
......@@ -97,7 +98,7 @@ public class BClassServiceImpl implements BClassService {
}
bClass= new BClass(value[0],value[1]);
bClass.setCommonBusinessId();
UserUtils.setCurrentPersistOperation(bClass);
UserUtil.setCurrentPersistOperation(bClass,token);
if(!bClasses.contains(bClass)){
bClasses.add(bClass);
......
......@@ -29,17 +29,11 @@ public class BImageController extends PaginationController<BImage> {
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "imageName", value = "图片标题", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "imageCode", value = "图片code", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "createBy", value = "创建者", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "createDate", value = "创建日期", required = false, dataType = "datetime"),
@ApiImplicitParam(name = "updateBy", value = "更新者", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "updateDate", value = "更新日期", required = false, dataType = "datetime"),
@ApiImplicitParam(name = "delFlag", value = "删除标记(0:正常;1:删除;2:审核)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "flag", value = "启用标记(0:停用;1:启用)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "remarks", value = "备注", required = false, dataType = "varchar")})
@RequestMapping("/add")
public Result add(BImage bImage) {
Result result = new Result();
PersistModel data = bImageService.persist(bImage);
PersistModel data = bImageService.persist(bImage,getToken());
result.setCode(ResultCode.SUCCESS.code);
result.setMessage(MessageConstant.MESSAGE_ALERT_SUCCESS);
result.setData(data);
......@@ -51,7 +45,7 @@ public class BImageController extends PaginationController<BImage> {
@RequestMapping("/remove")
public Result remove(String id) {
Result result = new Result();
PersistModel data = bImageService.removeBImage(id);
PersistModel data = bImageService.removeBImage(id,getToken());
result.setCode(ResultCode.SUCCESS.code);
result.setMessage(MessageConstant.MESSAGE_ALERT_SUCCESS);
result.setData(data);
......@@ -74,10 +68,6 @@ public class BImageController extends PaginationController<BImage> {
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "imageName", value = "图片标题", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "imageCode", value = "图片code", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "createBy", value = "创建者", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "createDate", value = "创建日期", required = false, dataType = "datetime"),
@ApiImplicitParam(name = "updateBy", value = "更新者", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "updateDate", value = "更新日期", required = false, dataType = "datetime"),
@ApiImplicitParam(name = "delFlag", value = "删除标记(0:正常;1:删除;2:审核)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "flag", value = "启用标记(0:停用;1:启用)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "remarks", value = "备注", required = false, dataType = "varchar")})
......@@ -93,10 +83,6 @@ public class BImageController extends PaginationController<BImage> {
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "imageName", value = "图片标题", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "imageCode", value = "图片code", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "createBy", value = "创建者", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "createDate", value = "创建日期", required = false, dataType = "datetime"),
@ApiImplicitParam(name = "updateBy", value = "更新者", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "updateDate", value = "更新日期", required = false, dataType = "datetime"),
@ApiImplicitParam(name = "delFlag", value = "删除标记(0:正常;1:删除;2:审核)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "flag", value = "启用标记(0:停用;1:启用)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "remarks", value = "备注", required = false, dataType = "varchar")})
......
......@@ -38,12 +38,12 @@ public interface BImageService{
* @param model
* @return
*/
PersistModel persist(BImage model);
PersistModel persist(BImage model,String token);
/**
* 逻辑删除
* @param id
* @return
*/
PersistModel removeBImage(String id);
PersistModel removeBImage(String id, String token);
}
......@@ -8,6 +8,7 @@ import org.rcisoft.core.constant.DelStatus;
import org.rcisoft.core.exception.ServiceException;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.result.ResultServiceEnums;
import org.rcisoft.core.util.UserUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
......@@ -48,14 +49,15 @@ public class BImageServiceImpl implements BImageService {
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
@Override
public PersistModel persist(BImage model){
public PersistModel persist(BImage model,String token){
int line = 0;
if(StringUtils.isEmpty(model.getBusinessId())){
UserUtil.setCurrentMergeOperation(model,token);
line = bImageRepository.updateByPrimaryKeySelective(model);
}else {
if(bImageRepository.selectOne(new BImage(model.getImageCode()))!=null)
throw new ServiceException(ResultServiceEnums.INSERT_DATA_EXIST);
model.setCommonBusinessId();
UserUtil.setCurrentPersistOperation(model,token);
line = bImageRepository.insertSelective(model);
}
......@@ -64,10 +66,10 @@ public class BImageServiceImpl implements BImageService {
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
@Override
public PersistModel removeBImage(String id) {
public PersistModel removeBImage(String id, String token) {
BImage bImage = bImageRepository.selectByPrimaryKey(id);
bImage.setDelFlag(DelStatus.DELETED.getStatus());
UserUtils.setCurrentMergeOperation(bImage);
UserUtil.setCurrentMergeOperation(bImage,token);
int line = bImageRepository.updateByPrimaryKeySelective(bImage);
return new PersistModel(line);
}
......
......@@ -45,12 +45,6 @@ public class BLessonController extends PaginationController<BLesson> {
@ApiImplicitParam(name = "code", value = "课程编号", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "lessonName", value = "课程名称", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "defaultUrl", value = "默认封面图片url", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "createBy", value = "创建者", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "createDate", value = "创建日期", required = false, dataType = "datetime"),
@ApiImplicitParam(name = "updateBy", value = "更新者", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "updateDate", value = "更新日期", required = false, dataType = "datetime"),
@ApiImplicitParam(name = "delFlag", value = "删除标记(0:正常;1:删除;2:审核)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "flag", value = "启用标记(0:停用;1:启用)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "remarks", value = "备注", required = false, dataType = "varchar")})
@RequestMapping("/add")
public Result add(@Valid BLesson bLesson, BindingResult bindingResult) {
......@@ -63,7 +57,7 @@ public class BLessonController extends PaginationController<BLesson> {
throw new ServiceException(ResultServiceEnums.PARAMER_ERROR.getCode(),
bindingResult.getFieldError().getDefaultMessage());
}
PersistModel data = bLessonService.persist(bLesson);
PersistModel data = bLessonService.persist(bLesson,getToken());
result.setCode(ResultCode.SUCCESS.code);
result.setMessage(MessageConstant.MESSAGE_ALERT_SUCCESS);
result.setData(data);
......@@ -87,7 +81,7 @@ public class BLessonController extends PaginationController<BLesson> {
@RequestMapping("excelImport")
public Result excelImport(MultipartFile importFile) throws Exception {
Result result = new Result();
PersistModel data = bLessonService.importExcel(MultipartFile2HSSFWorkbookConverter.convert(importFile));
PersistModel data = bLessonService.importExcel(MultipartFile2HSSFWorkbookConverter.convert(importFile),getToken());
result.setCode(ResultCode.SUCCESS.code);
result.setMessage(MessageConstant.MESSAGE_ALERT_SUCCESS);
result.setData(data.getInfluenceReason());
......@@ -110,6 +104,7 @@ public class BLessonController extends PaginationController<BLesson> {
BLesson bLesson=bLessonService.selectOne(bL);
if(bLesson!=null){
bLesson.setDefaultUrl(map.get(UploadUtil.URL).toString());
UserUtil.setCurrentMergeOperation(bLesson,getToken());
int line = bLessonService.updateByPrimaryKeySelective(bLesson);
result.setCode(ResultCode.SUCCESS.code);
result.setMessage(MessageConstant.MESSAGE_ALERT_SUCCESS);
......@@ -136,6 +131,7 @@ public class BLessonController extends PaginationController<BLesson> {
BLesson bLesson=bLessonService.selectOne(bL);
if(bLesson!=null){
bLesson.setDefaultUrl(path);
UserUtil.setCurrentMergeOperation(bLesson,getToken());
bLessonService.updateByPrimaryKeySelective(bLesson);
result.setCode(ResultCode.SUCCESS.code);
result.setMessage(MessageConstant.MESSAGE_ALERT_SUCCESS);
......@@ -165,10 +161,6 @@ public class BLessonController extends PaginationController<BLesson> {
@ApiImplicitParam(name = "code", value = "课程编号", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "lessonName", value = "课程名称", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "defaultUrl", value = "默认封面图片url", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "createBy", value = "创建者", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "createDate", value = "创建日期", required = false, dataType = "datetime"),
@ApiImplicitParam(name = "updateBy", value = "更新者", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "updateDate", value = "更新日期", required = false, dataType = "datetime"),
@ApiImplicitParam(name = "delFlag", value = "删除标记(0:正常;1:删除;2:审核)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "flag", value = "启用标记(0:停用;1:启用)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "remarks", value = "备注", required = false, dataType = "varchar")})
......@@ -185,10 +177,6 @@ public class BLessonController extends PaginationController<BLesson> {
@ApiImplicitParam(name = "code", value = "课程编号", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "lessonName", value = "课程名称", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "defaultUrl", value = "默认封面图片url", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "createBy", value = "创建者", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "createDate", value = "创建日期", required = false, dataType = "datetime"),
@ApiImplicitParam(name = "updateBy", value = "更新者", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "updateDate", value = "更新日期", required = false, dataType = "datetime"),
@ApiImplicitParam(name = "delFlag", value = "删除标记(0:正常;1:删除;2:审核)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "flag", value = "启用标记(0:停用;1:启用)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "remarks", value = "备注", required = false, dataType = "varchar")})
......
......@@ -49,14 +49,14 @@ public interface BLessonService{
* @param model
* @return
*/
PersistModel persist(BLesson model);
PersistModel persist(BLesson model,String token);
/**
* 课程信息excel导入
* @param hwb
* @return
*/
PersistModel importExcel(HSSFWorkbook hwb) throws IOException;
PersistModel importExcel(HSSFWorkbook hwb,String token) throws IOException;
/**
* 逻辑删除
......
......@@ -12,6 +12,7 @@ import org.rcisoft.core.exception.ServiceException;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.result.ResultServiceEnums;
import org.rcisoft.core.util.ExcelUtil;
import org.rcisoft.core.util.UserUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
......@@ -67,16 +68,17 @@ public class BLessonServiceImpl implements BLessonService {
@Override
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
public PersistModel persist(BLesson model){
public PersistModel persist(BLesson model,String token){
int line = 0;
if(model.getBusinessId()==null) {
if (bLessonRepository.queryBLessonByCode(model.getCode()) != null)
throw new ServiceException(ResultServiceEnums.INSERT_DATA_EXIST);
model.setCommonBusinessId();
model.setDefaultUrl(global.getDEFAULT_COURSE_LOCATION());
// UserUtils.setCurrentPersistOperation(model);
UserUtil.setCurrentPersistOperation(model,token);
line = bLessonRepository.insertSelective(model);
}else
UserUtil.setCurrentMergeOperation(model,token);
line = bLessonRepository.updateByPrimaryKeySelective(model);
//FamilyLogger.sysInfo(UserUtils.getUser().getBusinessId(),UserUtils.getUser().getLoginName()+"新增了ID为"+user.getBusinessId()+"的用户");
return new PersistModel(line);
......@@ -85,7 +87,7 @@ public class BLessonServiceImpl implements BLessonService {
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
@Override
public PersistModel importExcel(HSSFWorkbook hwb) throws IOException {
public PersistModel importExcel(HSSFWorkbook hwb, String token) throws IOException {
ArrayList<BLesson> lessons = new ArrayList<BLesson>();
ArrayList<String> repeatCode = new ArrayList<String>();
List<String> errorCode = new ArrayList<>();
......@@ -113,9 +115,8 @@ public class BLessonServiceImpl implements BLessonService {
continue;
}
bLesson= new BLesson(value[0],value[1]);
bLesson.setCommonBusinessId();
bLesson.setDefaultUrl(global.getDEFAULT_COURSE_LOCATION());
UserUtils.setCurrentPersistOperation(bLesson);
UserUtil.setCurrentPersistOperation(bLesson,token);
if(!lessons.contains(bLesson)){
lessons.add(bLesson);
......
......@@ -40,12 +40,6 @@ public class BNewsController extends PaginationController<BNews> {
@ApiImplicitParam(name = "attribute", value = "0:非头条,1:头条", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "isRelease", value = "0未发布,1:发布", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "newsContent", value = "新闻内容", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "createBy", value = "创建者", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "createDate", value = "创建日期", required = false, dataType = "datetime"),
@ApiImplicitParam(name = "updateBy", value = "更新者", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "updateDate", value = "更新日期", required = false, dataType = "datetime"),
@ApiImplicitParam(name = "delFlag", value = "删除标记(0:正常;1:删除;2:审核)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "flag", value = "启用标记(0:停用;1:启用)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "remarks", value = "备注", required = false, dataType = "varchar")})
@RequestMapping("/add")
public Result add(@Valid BNews bNews, BindingResult bindingResult) {
......@@ -55,7 +49,7 @@ public class BNewsController extends PaginationController<BNews> {
throw new ServiceException(ResultServiceEnums.PARAMER_ERROR.getCode(),
bindingResult.getFieldError().getDefaultMessage());
}
PersistModel data = bNewsService.persist(bNews);
PersistModel data = bNewsService.persist(bNews,getToken());
result.setCode(ResultCode.SUCCESS.code);
result.setMessage(MessageConstant.MESSAGE_ALERT_SUCCESS);
result.setData(data);
......@@ -67,7 +61,7 @@ public class BNewsController extends PaginationController<BNews> {
@RequestMapping("/remove")
public Result remove(String id) {
Result result = new Result();
PersistModel data = bNewsService.removeBNews(id);
PersistModel data = bNewsService.removeBNews(id,getToken());
result.setCode(ResultCode.SUCCESS.code);
result.setMessage(MessageConstant.MESSAGE_ALERT_SUCCESS);
result.setData(data);
......@@ -94,10 +88,6 @@ public class BNewsController extends PaginationController<BNews> {
@ApiImplicitParam(name = "attribute", value = "0:非头条,1:头条", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "isRelease", value = "0未发布,1:发布", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "newsContent", value = "新闻内容", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "createBy", value = "创建者", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "createDate", value = "创建日期", required = false, dataType = "datetime"),
@ApiImplicitParam(name = "updateBy", value = "更新者", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "updateDate", value = "更新日期", required = false, dataType = "datetime"),
@ApiImplicitParam(name = "delFlag", value = "删除标记(0:正常;1:删除;2:审核)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "flag", value = "启用标记(0:停用;1:启用)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "remarks", value = "备注", required = false, dataType = "varchar")})
......@@ -116,10 +106,6 @@ public class BNewsController extends PaginationController<BNews> {
@ApiImplicitParam(name = "attribute", value = "0:非头条,1:头条", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "isRelease", value = "0未发布,1:发布", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "newsContent", value = "新闻内容", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "createBy", value = "创建者", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "createDate", value = "创建日期", required = false, dataType = "datetime"),
@ApiImplicitParam(name = "updateBy", value = "更新者", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "updateDate", value = "更新日期", required = false, dataType = "datetime"),
@ApiImplicitParam(name = "delFlag", value = "删除标记(0:正常;1:删除;2:审核)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "flag", value = "启用标记(0:停用;1:启用)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "remarks", value = "备注", required = false, dataType = "varchar")})
......
......@@ -38,12 +38,12 @@ public interface BNewsService{
* @param model
* @return
*/
PersistModel persist(BNews model);
PersistModel persist(BNews model,String token);
/**
* 逻辑删除
* @param id
* @return
*/
PersistModel removeBNews(String id);
PersistModel removeBNews(String id,String token);
}
......@@ -9,6 +9,7 @@ import org.rcisoft.core.constant.DelStatus;
import org.rcisoft.core.exception.ServiceException;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.result.ResultServiceEnums;
import org.rcisoft.core.util.UserUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
......@@ -52,18 +53,17 @@ public class BNewsServiceImpl implements BNewsService {
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
@Override
public PersistModel persist(BNews model){
public PersistModel persist(BNews model,String token){
int line = 0;
if(model.getBusinessId()!=null&&model.getBusinessId()!=""&&!model.getBusinessId().equals("")){
if(!StringUtils.isEmpty(model.getIsRelease())&&model.getIsRelease().equals(ReleaseEnum.RELEASE.getCode())) //如果修改发布状态为发布,
model.setReleaseTime(new Date()); // 则添加发布时间
model.setReleaseTime(new Date()); // 则添加发布时间
UserUtil.setCurrentMergeOperation(model,token);
line = bNewsRepository.updateByPrimaryKeySelective(model);
}
else {
// if(bNewsRepository.selectOne(new BNews(model.getNewsCode()))!=null)
// throw new BusinessException(ResultEnums.NEWS_EXISTS);
model.setCommonBusinessId();
model.autoSetApplyCode();
UserUtil.setCurrentPersistOperation(model,token);
line = bNewsRepository.insertSelective(model);
}
if(line!=1)
......@@ -73,12 +73,12 @@ public class BNewsServiceImpl implements BNewsService {
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
@Override
public PersistModel removeBNews(String id) {
public PersistModel removeBNews(String id, String token) {
BNews bNews = bNewsRepository.selectByPrimaryKey(id);
if(bNews==null)
throw new ServiceException(ResultServiceEnums.NEWS_NOT_EXISTS);
bNews.setDelFlag(DelStatus.DELETED.getStatus());
UserUtils.setCurrentMergeOperation(bNews);
UserUtil.setCurrentMergeOperation(bNews,token);
int line = bNewsRepository.updateByPrimaryKeySelective(bNews);
return new PersistModel(line);
}
......
......@@ -54,16 +54,11 @@ public class BSlController extends PaginationController<BSl> {
@ApiImplicitParam(name = "recommendCourse", value = "推荐原因", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "gitLabProjectId", value = "gitlab项目id", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "gitLabProjectName", value = "gitlab项目名", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "createBy", value = "创建者", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "createDate", value = "创建日期", required = false, dataType = "datetime"),
@ApiImplicitParam(name = "updateBy", value = "更新者", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "updateDate", value = "更新日期", required = false, dataType = "datetime"),
@ApiImplicitParam(name = "delFlag", value = "删除标记(0:正常;1:删除;2:审核)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "flag", value = "启用标记(0:停用;1:启用)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "remarks", value = "备注", required = false, dataType = "varchar")})
@RequestMapping("/add")
public Result add(@Valid BSl bSl, BindingResult bindingResult) throws UnsupportedEncodingException {
// 51b2e02474b5473384963e92aa6d7663
Result result = new Result();
if(bSl.getCode()!=null&&bSl.getCode().length()>
Integer.parseInt(global.getMAX_CODE_LENGTH()))
......@@ -73,7 +68,7 @@ public class BSlController extends PaginationController<BSl> {
throw new ServiceException(ResultServiceEnums.PARAMER_ERROR.getCode(),
bindingResult.getFieldError().getDefaultMessage());
}
PersistModel data = bSlService.persist(bSl);
PersistModel data = bSlService.persist(bSl,getToken());
result.setCode(ResultCode.SUCCESS.code);
result.setMessage(MessageConstant.MESSAGE_ALERT_SUCCESS);
result.setData(data);
......
......@@ -43,7 +43,7 @@ public interface BSlService{
* @param model
* @return
*/
PersistModel persist(BSl model) throws UnsupportedEncodingException;
PersistModel persist(BSl model,String token) throws UnsupportedEncodingException;
/**
* 开课信息excel导入
......
......@@ -23,6 +23,7 @@ import org.rcisoft.core.exception.ServiceException;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.result.ResultServiceEnums;
import org.rcisoft.core.util.ExcelUtil;
import org.rcisoft.core.util.UserUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
......@@ -78,7 +79,7 @@ public class BSlServiceImpl implements BSlService {
@Override
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
public PersistModel persist(BSl model) throws UnsupportedEncodingException {
public PersistModel persist(BSl model,String token) throws UnsupportedEncodingException {
int line = 0;
if(model.getBusinessId()!=null){
BSl bSl = bSlRepository.selectByPrimaryKey(model.getBusinessId());
......@@ -89,6 +90,7 @@ public class BSlServiceImpl implements BSlService {
if(isRecommend&&!isOnline)
throw new ServiceException(ResultServiceEnums.SL_NOT_ONLINE);
UserUtil.setCurrentMergeOperation(model,token);
line = bSlRepository.updateByPrimaryKeySelective(model);
}
else {
......@@ -111,8 +113,7 @@ public class BSlServiceImpl implements BSlService {
Project project = action.createProject(pName,dto);
model.setGitLabProjectId(project.getId());
model.setGitLabProjectName(pName);
model.setCommonBusinessId();
// UserUtils.setCurrentPersistOperation(model);
UserUtil.setCurrentPersistOperation(model,token);
line = bSlRepository.insertSelective(model);
}
//FamilyLogger.sysInfo(UserUtils.getUser().getBusinessId(),UserUtils.getUser().getLoginName()+"新增了ID为"+user.getBusinessId()+"的用户");
......
......@@ -38,7 +38,7 @@ public class UserUtil {
public static void setCurrentPersistOperation(IdEntity entity,String token) {
entity.setCreateBy(UserUtil.getUserInfoProp(token,UserUtil.USER_ID));
entity.setCreateDate(new Date());
entity.setBusinessId(IdGen.uuid());
entity.setCommonBusinessId();
entity.setNotDeleted();
entity.setStart();
}
......
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