Commit bf333ad9 by liangkaiping

copy

parent 77953cfe
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.yizhi</groupId>
<artifactId>assignment-project</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>cloud-assignment-api</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>com.yizhi</groupId>
<artifactId>cloud-common-api</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.yizhi</groupId>
<artifactId>cloud-util</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.yizhi</groupId>
<artifactId>cloud-core</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
package com.yizhi.assignment.application.feign;
import com.baomidou.mybatisplus.plugins.Page;
import com.yizhi.assignment.application.vo.entity.AssignmentAnswerTipoff;
import com.yizhi.assignment.application.vo.AssignmentStudentExerciseBookListVO;
import com.yizhi.assignment.application.vo.apivo.ApiAssignmentCommentVO;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
/**
* @ClassName ApiAssignmentExerciseBookClient
* @Description TODO
* @Author shengchenglong
* @DATE 2019-10-22 11:15
* @Version 1.0
*/
@FeignClient(name = "assignment", contextId = "ApiAssignmentExerciseBookClient")
public interface ApiAssignmentExerciseBookClient {
@GetMapping("/remote/api/assignment/exerciseBook/page")
Page<AssignmentStudentExerciseBookListVO> list(
@ApiParam("作业id") @RequestParam("assignmentId") Long assignmentId,
@ApiParam("要跳转的页数") @RequestParam(name = "pageNo", defaultValue = "1") int pageNo,
@ApiParam("每页条数,默认:10") @RequestParam(name = "pageSize", defaultValue = "10") int pageSize);
@GetMapping("/remote/api/assignment/exerciseBook/thumbUp")
boolean thumbup(@RequestParam("assignmentAnswerId") Long assignmentAnswerId,
@RequestParam("isThumbUp") boolean isThumbUp);
@GetMapping("/remote/api/assignment/exerciseBook/comment/page")
Page<ApiAssignmentCommentVO> commentPage(
@RequestParam("assignmentAnswerId") Long assignmentAnswerId,
@ApiParam("要跳转的页数") @RequestParam(name = "pageNo", defaultValue = "1") int pageNo,
@ApiParam("每页条数,默认:10") @RequestParam(name = "pageSize", defaultValue = "10") int pageSize);
@GetMapping("/remote/api/assignment/exerciseBook/comment/add")
Boolean commentAdd(
@RequestParam("assignmentAnswerId") Long assignmentAnswerId,
@RequestParam(name = "parentCommentId", required = false) Long parentCommentId,
@RequestParam("content") String content);
@PostMapping("/remote/api/assignment/exerciseBook/tipoff")
Boolean tipoff(@RequestBody AssignmentAnswerTipoff record);
}
package com.yizhi.assignment.application.feign;
import com.baomidou.mybatisplus.plugins.Page;
import com.yizhi.assignment.application.vo.*;
import com.yizhi.assignment.application.vo.entity.Assignment;
import com.yizhi.assignment.application.vo.entity.AssignmentAnswerFile;
import com.yizhi.assignment.application.vo.entity.AssignmentStudent;
import com.yizhi.assignment.application.vo.apivo.ApiAssignmentAnswerCheckVO;
import com.yizhi.assignment.application.vo.apivo.AssignmentTrainingProject;
import com.yizhi.core.application.vo.DroolsVo;
import com.yizhi.util.application.domain.Response;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@FeignClient(name = "assignment", contextId = "AssignmentClient")
public interface AssignmentClient {
/**
* 生成作业id编号
*
* @return
*/
@GetMapping("/remote/assignment/setid")
public Long setId();
/**
* 新建作业保存
*
*/
@PostMapping("/remote/assignment/save")
public Boolean save(@RequestBody AssignmentSaveParamVo assignmentSaveParamVo);
/**
* 查找作业列表
*
* @return
*/
@GetMapping("/remote/assignment/list")
public Page<AssignmentListVO> list(@RequestParam(value = "currentTime", name = "currentTime", required = false) String currentTime, @RequestBody AssignmentListVoTo assignmentListVoTo);
/**
* 作业删除
*
*/
@PostMapping("/remote/assignment/delete")
public Boolean delete(@RequestBody AssignmentDeleteVO assignmentDelete);
/**
* 批量下载作业
*
* @param ids
* @return
*/
@GetMapping("/remote/assignment/download/batch")
public List<List<AssignmentAnswerFile>> getAssignmentAnswerList(@RequestParam(name = "ids", required = true) List<Long> ids);
/**
* 获取学生提交的作业单个信息
*
*/
@PostMapping("/remote/assignment/marking/select")
public ApiAssignmentAnswerCheckVO getAssignmentAnswer(@RequestBody AssignmentAnswerMarkingSelectVO assignmentAnswerMarkingSelect);
/**
* 根据assignment作业找到学员答作业列表
*
*/
@GetMapping(value = "/remote/assignment/answer/list")
public Page<AssignmentReadListVO> assignmentAnswerList(@RequestParam(name = "assignmentId", required = true) Long assignmentId,
@RequestParam(name = "state", required = false) Integer state,
@RequestParam(name = "name", required = false) String name,
@RequestParam(name = "keywords", required = false) String keywords,
@RequestParam(name = "type", required = false, defaultValue = "1") Integer type,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize);
/**
* 找到作业内容
*
* @param assignmentId
* @return
*/
@GetMapping("/remote/assignment/content/find")
public AssignmentSelectVo query(@RequestParam(name = "assignmentId", required = true) Long assignmentId);
/**
* 添加学员
*
* @param listStudent
* @return
*/
@PostMapping("/remote/assignment/student/add")
public Boolean insert(@RequestBody ListStudent listStudent);
/**
* 添加关联学员,之前记录不删除
*
* @param assignmentStudents
* @return
*/
@PostMapping("/remote/assignment/student/insert")
public Boolean insertStudentRelation(@RequestBody List<AssignmentStudent> assignmentStudents);
/**
* 已关联学员
*
* @param assignmentId
*/
@GetMapping("/remote/assignment/student/relation")
public List<AssignmentStudent> studentRelation(@RequestParam(name = "assignmentId", required = true) Long assignmentId);
/**
* 未关联学员
*
* @param assignmentId
* @param pageNo
* @param pageSize
* @return
*/
@GetMapping("/remote/assignment/student/noRelation")
public List<Long> studentNoRelation(@RequestParam(name = "assignmentId", required = true) Long assignmentId,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize);
/**
* 设置评阅人
*
* @param listAuditor
* @return
*/
@PostMapping("/remote/assignment/auditor/insert")
public Boolean auditorInsert(@RequestBody ListAuditor listAuditor);
/**
* 查看已关联的评阅人
*
* @param assignmentId
* @return
*/
@GetMapping("/remote/assignment/auditor/relation")
public List<Long> auditorRelation(@RequestParam(name = "assignmentId", required = true) Long assignmentId);
/**
* 作业上架/下架
*
*/
@PostMapping("/remote/assignment/status/update")
public Boolean update(@RequestBody AssignmentUpAndDownVO assignmentUpAndDown);
/**
* 作业批阅保存
*
* @param assignmentAnswerContentVO
* @return
*/
@PostMapping("/remote/assignment/marking/save")
public PointParamVO readSave(@RequestBody AssignmentAnswerContentVO assignmentAnswerContentVO);
/**
* 根据账号id查询到此学员下的作业个数
*
* @param accountId
* @return
*/
@GetMapping("/remote/assignment/select/remote/assignmentNum/byAccountId")
public Response<Integer> selectAssignmentNumByAcountId(@RequestParam(name = "accountId", required = true) Long accountId);
/**
* 导出批阅结果
*/
@PostMapping("/remote/assignment/export/suggetion/get")
public AssignmentAnswerListExport exportSuggetionExcel(@RequestBody DownloadAnswerVO vo);
/**
* 批量下载作业
*
*/
@PostMapping("/remote/assignment/export/remote/assignment/get")
public List<AnswersDownVO> exportAssignmentZip(@RequestBody DownloadAnswerVO vo);
/**
* 未提交人员名单
*
* @param assignmentId
*/
@GetMapping("/remote/assignment/export/unsubmit/get")
public AssignmentQXVO exportExcel(@RequestParam(name = "assignmentId", required = true) Long assignmentId);
/**
* 可见范围导出
*
* @param assignmentId
* @return
*/
@GetMapping("/remote/assignment/export/visiblRange")
public VisibleRangeExport exportVisibleRange(@RequestParam(name = "assignmentId", required = true) Long assignmentId);
/**
* 培训项目挂靠作业
*
* @param atp
* @return
*/
@PostMapping("/remote/assignment/updateTrainingProject/byAssignmentId")
public boolean updateTrainingProjectByAssignmentId(AssignmentTrainingProject atp);
@GetMapping("/remote/assignment/by/new/server")
public List<Map<String, Object>> getServerByCompanyIdAndIds(@RequestParam("companyId") Long companyId, @RequestParam(name = "ids", required = false) List<Long> ids);
@GetMapping("/assignment/by/siteId/and/assignmentId/and/accountId")
public List<Long> getListIdsBySiteIdAndAssignmentIdsAndAccountId(@RequestParam("sitId") Long siteId, @RequestParam("accountId") Long accountId, @RequestParam("ids") List<Long> ids);
@GetMapping("/remote/assignment/delete/relation")
public void deleteRelation(@RequestParam(name = "assignmentId", required = true) Long assignmentId);
@PostMapping("/remote/assignment/experiencePoolList")
public Page<Map<String, Object>> experiencePoolList(@RequestParam(value = "name", required = false) String name,
@RequestBody List<Long> ids,
@RequestParam(value = "pageNo", required = false) Integer pageNo,
@RequestParam(value = "pageSize", required = false) Integer pageSize);
/**
* 查询作业完成的学员
*
* @param assignmentId
* @return
*/
@GetMapping("/remote/assignment/finishAccountIds")
public List<Long> getFinishedAccountIds(@RequestParam("assignmentId") Long assignmentId, @RequestParam("siteId") Long siteId, @RequestParam("companyId") Long companyId);
/**
* 查询作业分数
*
* @param assignmentId
* @return
*/
@GetMapping("/remote/assignment/getScore")
public Integer getScore(@RequestParam("assignmentId") Long assignmentId, @RequestParam("siteId") Long siteId, @RequestParam("companyId") Long companyId, @RequestParam("accountId") Long accountId);
/**
* 获取单个作业主体信息
*
* @param assignmentId
* @return
*/
@GetMapping("/remote/assignment/get")
public Assignment get(@RequestParam("assignmentId") Long assignmentId);
@GetMapping("/remote/assignment/visibleRange")
public List<AssignmentStudent> VisibleRange(@RequestParam("assignmentId") Long assignmentId);
@PostMapping("/remote/assignment/verifyVedio")
boolean verifyVedio(@RequestBody List<Long> answerFileIds);
@PostMapping("/remote/assignment/updateVedioTranscodeUrl")
boolean updateVedioTranscodeUrl(@RequestBody Map<String, String> map);
@GetMapping("/remote/assignment/getPageByDrools")
Page<DroolsVo> getPageByDrools(@RequestParam("field") String field,
@RequestParam(value = "value", required = false) String value,
@RequestParam("pageNo") Integer pageNo,
@RequestParam("pageSize") Integer pageSize);
/**
* 获取用户作业列表
* @param answerListVo
* @return
*/
@PostMapping(value = "/remote/assignment/manage/answer/list")
Page<AssignmentReadListVO> manageAssignmentAnswerList(@RequestBody AnswerListVo answerListVo);
}
\ No newline at end of file
package com.yizhi.assignment.application.feign;
import com.baomidou.mybatisplus.plugins.Page;
import com.yizhi.assignment.application.vo.AssignmentCalendarVO;
import com.yizhi.assignment.application.vo.CalendarTaskParamVo;
import com.yizhi.assignment.application.vo.apivo.*;
import com.yizhi.assignment.application.vo.entity.Assignment;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@FeignClient(name="assignment", contextId = "AssignmentStudentClient")
public interface AssignmentStudentClient {
@GetMapping("/remote/api/assignment/my/answer/zip")
public String getStudentAnswerZipByAnswerId(@RequestParam(name="assignmentId")Long assignmentId,@RequestParam(name="answerId")Long answerId);
/**
* 分页查询作业列表
* @param type
* @param pageNo
* @param pageSize
* @return
*/
@GetMapping("/remote/api/assignment/my/list")
public Page<ApiAssignmentListResultVO> list(@RequestParam(name = "type", defaultValue = "1") int type, @RequestParam(name = "pageNo", defaultValue = "1") int pageNo, @RequestParam(name = "pageSize", defaultValue = "10") int pageSize, @RequestParam(name = "accountId") Long accountId, @RequestParam(name = "relationIds") List<Long> relationIds, @RequestParam(name = "companyId") Long companyId, @RequestParam(name = "siteId") Long siteId);
/**
* 根据名字关键字查询
* @param name
* @param pageNo
* @param pageSize
* @return
*/
@GetMapping("/remote/api/assignment/my/list/search")
public Page<ApiAssignmentListResultVO> listSearch(@RequestParam(name = "name",required=false) String name,@RequestParam(name = "pageNo", defaultValue = "1") int pageNo,@RequestParam(name = "pageSize", defaultValue = "10") int pageSize,@RequestParam(name = "accountId") Long accountId,@RequestParam(name = "relationIds") List<Long> relationIds,@RequestParam(name = "siteId") Long siteId);
/**
* 答案列表
* @param assignmentId
* @param accountId
* @return
*/
@GetMapping("/remote/api/assignment/my/answer/list")
public ApiAssignmentAnswerResultVo answerList(@RequestParam(name = "assignmentId") Long assignmentId,
@RequestParam(name = "accountId") Long accountId);
/**
* 查看作业以及自己的某一份答案详细信息
* @param assignmentId
* @return
*/
@GetMapping("/remote/api/assignment/my/toAssignment")
public ApiAssignmentDetailsVo toAssignment(@RequestParam(name = "assignmentId") Long assignmentId, @RequestParam(name = "answerId") Long answerId, @RequestParam(name = "accountId") Long accountId);
/**
* 活动用
* @param assignmentId
* @return
*/
@GetMapping("/remote/api/assignment/my/toAssignmentActivity")
public Assignment toAssignmentActivity(@RequestParam(name = "assignmentId") Long assignmentId);
/**
* 查看作业详细信息
* @param assignmentId
* @return
*/
@GetMapping("/remote/api/assignment/my/getAssignment")
public ApiAssignmentVO getAssignment(@RequestParam(name = "assignmentId") Long assignmentId, @RequestParam(name = "accountId") Long accountId);
@PostMapping("/remote/api/assignment/my/can/submit")
public Integer canSubmit(@RequestBody ApiAssignmentAswerVO assignmentAswerVO);
/**
* 作业提交
* @param assignmentAswerVO
* @return
*/
@PostMapping("/remote/api/assignment/my/submit")
public Boolean submit(@RequestBody ApiAssignmentAswerVO assignmentAswerVO);
/**
* 查看作业评阅
* @return
*/
@GetMapping("/remote/api/assignment/my/suggestion/get")
public ApiSuggestionVo getSuggesstion(@RequestParam(name = "assignmentId") Long assignmentId,@RequestParam(name = "accountId") Long accountId);
@GetMapping("/remote/api/assignment/my/list/search/others")
public List<ToOthersApi> listSearchOthers(
@RequestParam(name = "name",required=false) String name,
@RequestParam(name = "pageNo", defaultValue = "1") int pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") int pageSize,
@RequestParam(name = "accountId") Long accountId,
@RequestParam(name = "relationIds") List<Long> relationIds,
@RequestParam(name = "siteId") Long siteId
);
/**
* 根据id查询到这个账号下的作业个数
* @param accountId
* @return
*/
@GetMapping("/remote/api/assignment/my/assignment/num")
public Integer getAssignmentNumByAccountId(@ApiParam(name="relationIds",value="关联ids")@RequestParam(name="relationIds",required=false)List<Long> relationIds,
@ApiParam(name="siteId",value="站点id")@RequestParam(name="siteId",required=true)Long siteId,
@ApiParam(name="accountId",value="账号id")@RequestParam(name="accountId",required=true)Long accountId);
/**
* 培训项目积分
* @param ids
* @return
*/
@GetMapping("/remote/api/assignment/training/point")
public Map<String,Integer> getTrainingPoint(@RequestParam(name = "ids") List<Long> ids);
/**
* 日历任务获取作业列表
*/
@PostMapping("/remote/api/assignment/getPageToCalendar")
public Page<AssignmentCalendarVO> getPageToCalendar(@ApiParam("paramVo") @RequestBody CalendarTaskParamVo paramVo);
}
package com.yizhi.assignment.application.feign;
import com.baomidou.mybatisplus.plugins.Page;
import com.yizhi.assignment.application.vo.entity.AssignmentAnswerTipoff;
import com.yizhi.assignment.application.vo.TipoffAssignmentListVO;
import com.yizhi.assignment.application.vo.apivo.ApiAssignmentCommentVO;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
* @ClassName AssignmentExpriceBookController
* @Description TODO
* @Author shengchenglong
* @DATE 2019-10-22 11:15
* @Version 1.0
*/
@FeignClient(value = "assignment", contextId = "ManageAssignmentExerciseBookClient")
public interface ManageAssignmentExerciseBookClient {
@GetMapping("/remote/manage/assignment/exerciseBook/answer/down")
public boolean answerDown(@RequestParam("answerId") Long answerId, @RequestParam("isDown") Integer isDown);
@GetMapping("/remote/manage/assignment/exerciseBook/answer/delete")
public boolean answerDelete(@RequestParam("answerId") Long answerId);
@GetMapping("/remote/manage/assignment/exerciseBook/comment/page")
public Page<ApiAssignmentCommentVO> commentPage(
@RequestParam("assignmentAnswerId") Long assignmentAnswerId,
@ApiParam("要跳转的页数") @RequestParam(name = "pageNo", defaultValue = "1") int pageNo,
@ApiParam("每页条数,默认:10") @RequestParam(name = "pageSize", defaultValue = "10") int pageSize
);
@GetMapping("/remote/manage/assignment/exerciseBook/comment/delete")
boolean commentDelete(@RequestParam("commentId") Long commentId);
@GetMapping("/remote/manage/assignment/exerciseBook/comment/audit")
public boolean commentAudit(@RequestParam("commentId") Long commentId, @RequestParam("auditStatus") Integer auditStatus);
@GetMapping("/remote/manage/assignment/exerciseBook/tipoff/answer/page")
public Page<TipoffAssignmentListVO> tipoffAnswerPage(
@RequestParam("assignmentName") String assignmentName,
@ApiParam("要跳转的页数") @RequestParam(name = "pageNo", defaultValue = "1") int pageNo,
@ApiParam("每页条数,默认:10") @RequestParam(name = "pageSize", defaultValue = "10") int pageSize);
@GetMapping("/remote/manage/assignment/exerciseBook/tipoff/page")
public Page<AssignmentAnswerTipoff> tipoffPage(
@RequestParam("answerId") Long answerId,
@ApiParam("要跳转的页数") @RequestParam(name = "pageNo", defaultValue = "1") int pageNo,
@ApiParam("每页条数,默认:10") @RequestParam(name = "pageSize", defaultValue = "10") int pageSize);
@GetMapping("/remote/manage/assignment/exerciseBook/tipoff/remove")
public Boolean tipoffRemove(
@RequestParam("tipoffId") Long tipoffId);
@GetMapping("/remote/manage/assignment/exerciseBook/comment/export")
public String commentExport(@RequestParam("answerId") Long answerId);
}
package com.yizhi.assignment.application.feign;
import com.yizhi.assignment.application.vo.MinimbaStudyRecordVO;
import com.yizhi.assignment.application.vo.MinimbaUserDetailParamVO;
import com.yizhi.assignment.application.vo.MinimbaUserDetailVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 复旦minimba feign接口
*
* @author dingxiaowei
*/
@FeignClient(name = "assignment", contextId = "MinimbaClient")
public interface MinimbaClient {
/**
* 复旦minimba项目获取用户打卡,点赞信息
*
* @param paramVO
* @return
*/
@PostMapping("/remote/assignment/minimba/userDetails")
MinimbaUserDetailVO getUserDetails(@RequestBody MinimbaUserDetailParamVO paramVO);
/**
* 点一个项目,该用户的学习记录
* @param projectId
* @return
*/
@GetMapping("/remote/assignment/minimba/studyingRecords")
List<MinimbaStudyRecordVO> getProjectStudyingRecords(@RequestParam("projectId") Long projectId);
}
package com.yizhi.assignment.application.vo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* 复旦mini mba作业类
* @author ding
*
*/
@Data
@Api(tags = "AssignmentListVO", description = "复旦mini mba作业附件类")
public class AccessoryVO {
@ApiModelProperty(value = "附件名称")
private String accessoryName;
@ApiModelProperty("附件url")
private String accessoryUrl;
@ApiModelProperty("附件大小")
private String accessorySize;
}
package com.yizhi.assignment.application.vo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
@Api(tags = "AnswerListVo")
public class AnswerListVo {
@ApiModelProperty(name = "assignmentId", value = "老师布置作业的id")
private Long assignmentId;
@ApiModelProperty(name = "state", value = "批阅状态(1:待阅,2:已阅,不传则为所有)")
private Integer state;
@ApiModelProperty(name = "name", value = "用户名/姓名/标签")
private String name;
@ApiModelProperty(name = "keywords", value = "部门关键字")
private String keywords;
@ApiModelProperty(name = "type", value = "1.提交时间;2 用户名")
private Integer type;
@ApiModelProperty(name = "pageNo", value = "要跳转的页数")
private Integer pageNo;
@ApiModelProperty(name = "pageSize", value = "每页的条数")
private Integer pageSize;
private List<Long> accountIds;
}
package com.yizhi.assignment.application.vo;
import java.util.Date;
import java.util.List;
import com.yizhi.assignment.application.vo.entity.AssignmentAnswerFile;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 显示老师布置的作业列表
* @author wangfeida
*
*/
@Data
@Api(tags = "AnswersDownVO", description = "批量下载的vo")
public class AnswersDownVO {
@ApiModelProperty(name="accountName",value="accountName")
private String accountName; //用户名
@ApiModelProperty(name="assignmentName",value="assignmentName")
private String assignmentName; //作业名字
@ApiModelProperty(name="作业来源(1本地2做课)",value="source")
private Integer source; //来源
@ApiModelProperty(name="答案提交时间",value="commitTime")
private Date commitTime;
@ApiModelProperty(name="accountId",value="accountId")
private List<AssignmentAnswerFile> list;
}
/**
* Project Name:cloud-assignment
* File Name:AssignmentCommentVO.java
* Package Name:com.yizhi.application.vo
* Date:2018年3月7日下午6:11:11
* Copyright (c) yizhi.
*
*/
package com.yizhi.assignment.application.vo;
import java.util.List;
import com.yizhi.assignment.application.vo.entity.AssignmentAnswerFile;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* ClassName:AssignmentCommentVO
* 作业批阅VO
* Date: 2018年3月7日 下午6:11:11
* @author lilingye
* @version
* @since JDK 1.8
*/
@Data
@Api(tags = "AssignmentAnswerContentVO", description = "老师批阅作业")
public class AssignmentAnswerContentVO {
/*
* answerId 作业提交id;
*/
@ApiModelProperty(name="answerId",value = "作业提交id",required=true)
private Long answerId;
/*
* 作业分数
*/
@ApiModelProperty(name="score",value = "作业分数",required=true)
private Integer score;
/*
* 评语
*/
@ApiModelProperty(name="comment",value = "评语",required=false)
private String comment;
/**
* 文件路径
*/
@ApiModelProperty(name="反馈文件的路径",required=false)
private List<AssignmentAnswerFile> listFeedBackFiles;
@ApiModelProperty(name="accountId",value = "用户id,前端不传",required=false)
private Long accountId;
@ApiModelProperty(name="accountName",value = "用户姓名,前端不传",required=false)
private String accountName;
}
package com.yizhi.assignment.application.vo;
import java.util.List;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@Api(tags = "AssignmentAnswerDownloadVO", description = "批量下载学生作业")
public class AssignmentAnswerDownloadVO {
@ApiModelProperty(name="ids",value="学生的作业答案id")
private List<Long> ids;
}
package com.yizhi.assignment.application.vo;
import java.math.BigDecimal;
import java.util.Date;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@Api(tags = "AssignmentAnswerExport", description = "导出学生作业")
public class AssignmentAnswerExport {
@ApiModelProperty(name="answerId",value="答案Id")
private Long answerId;
@ApiModelProperty(name="accountId",value="账号id")
private Long accountId;
@ApiModelProperty(name="accountName",value="用户名")
private String accountName;
@ApiModelProperty(name="realName",value="姓名")
private String realName;
@ApiModelProperty(name="departName",value="所在部门")
private String departName;
@ApiModelProperty(name="commitTime",value="提交时间")
private Date commitTime;
@ApiModelProperty(name="state",value="批阅状态")
private Integer state;
@ApiModelProperty(name="lastReadTime",value="最后批阅时间")
private Date lastReadTime;
@ApiModelProperty(name="score",value="作业成绩")
private Integer score;
@ApiModelProperty(name="grade",value="作业等级")
private String grade;
@ApiModelProperty(name="suggestion",value="作业评语")
private String suggestion;
@ApiModelProperty(name="content",value="作业内容")
private String content;
@ApiModelProperty(name="accountState",value="用户状态")
private String accountState;
}
package com.yizhi.assignment.application.vo;
import java.util.List;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class AssignmentAnswerListExport {
@ApiModelProperty(name="name",value="作业名字")
private String name;
@ApiModelProperty(name="type",value="评分类型(1:打分制,2:等级制)")
private Integer type;
@ApiModelProperty(name="list",value="查询出来的结果")
private List<AssignmentAnswerExport> list;
}
package com.yizhi.assignment.application.vo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
@Api(tags = "AssignmentAnswerMarkingSelectVO", description = "获取单个学生作业信息")
public class AssignmentAnswerMarkingSelectVO {
@ApiModelProperty(name = "assignmentId", value = "老师布置的作业id", required = true)
private Long assignmentId;
@ApiModelProperty(name = "assignmentAnswerId", value = "学生提交的作业id", required = true)
private Long assignmentAnswerId;
/**
* 新增条件查询所有的列表
*/
@ApiModelProperty(name = "state", value = "批阅状态(1:待阅,2:已阅,不传则为所有)")
private Integer state;
@ApiModelProperty(name = "name", value = "用户名/姓名/标签")
private String name;
@ApiModelProperty(name = "department", value = "部门关键字")
private String department;
@ApiModelProperty(name = "type", value = "1.提交时间;2 用户名")
private Integer type;
/**
* 管辖区内用户列表
*/
private List<Long> accountIds;
}
package com.yizhi.assignment.application.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
@ApiModel(value = "AssignmentCalendarVO", description = "")
@Data
public class AssignmentCalendarVO {
@ApiModelProperty(value = "id")
private Long id;
@ApiModelProperty(value = "名称")
private String name;
@ApiModelProperty(notes = "作业完成时间")
private Date finishTime;
@ApiModelProperty(value = "日历任务设置的开始时间")
private Date taskStartDate;
@ApiModelProperty(value = "日历任务设置的结束时间")
private Date taskEndDate;
@ApiModelProperty(value = "允许次数,允许参加的次数")
private Integer count;
@ApiModelProperty(value="状态:1、未提交 2、待批阅 3、未通过 4、已通过")
private Integer taskStatus;
@ApiModelProperty("业务按钮状态")
public List<String> taskButtonStatus;
@ApiModelProperty("业务状态标签")
public String taskTag;
}
package com.yizhi.assignment.application.vo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@Api(tags = "AssignmentDeleteVO", description = "删除作业入参")
public class AssignmentDeleteVO {
@ApiModelProperty(name="assignmentId",value="作业主键id")
private Long assignmentId; //主键id
@ApiModelProperty(name="accountId",value="用户id",required=false)
private Long accountId; //用户id
@ApiModelProperty(name="accountName",value="用户名字",required=false)
private String accountName; //用户名
}
package com.yizhi.assignment.application.vo;
import java.util.Date;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 显示老师布置的作业列表
* @author wangfeida
*
*/
@Data
@Api(tags = "AssignmentListVO", description = "老师布置的作业列表")
public class AssignmentListVO {
@ApiModelProperty(name="id",value="主键id")
private Long id; //主键id
@ApiModelProperty(name="serialNum",value="作业序号")
private Long serialNum; //作业序号
@ApiModelProperty(name="name",value="作业名字")
private String name; //作业名字
@ApiModelProperty(name="traingProjectId",value="所属项目id")
private Long traingProjectId; //所属项目id
@ApiModelProperty(name="traingProjectName",value="所属项目名字")
private String traingProjectName; //所属项目名字
@ApiModelProperty(name="submitNum",value="作业提交数量")
private Integer submitNum; //作业提交数量
@ApiModelProperty(name="noRead",value="作业未批阅数量")
private Integer noRead;// 作业未批阅数量
@ApiModelProperty(name="status",value="作业状态 状态(1:草稿,2:上架,3:下架)")
private Integer status;//作业状态
@ApiModelProperty(name="endDate",value="要求完成时间")
private Date endDate;
@ApiModelProperty(name="endDate",value="可见范围(1:平台用户可见,2:指定学员可见),默认平台用户可见")
private Integer visibleRange;
@ApiModelProperty(name="image",value="作业封面")
private String image; //作业名字
}
package com.yizhi.assignment.application.vo;
import java.util.List;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@Api(tags = "AssignmentListVo", description = "管理端作业列表入参")
public class AssignmentListVoTo {
@ApiModelProperty(name="name",value="name",required=false)
private String name;
@ApiModelProperty(name="source",value="0直接进来的 1 培训项目进来的 2投票进来",required=false)
private Integer source=0;
@ApiModelProperty(name="pageNo",value="pageNo",required=false)
private Integer pageNo;
@ApiModelProperty(name="pageSize",value="pageSize",required=false)
private Integer pageSize;
@ApiModelProperty(name="orgIds",value="orgIds",required=false)
private List<Long> orgIds;
@ApiModelProperty(name="siteId",value="siteId",required=false)
private Long siteId;
@ApiModelProperty(name="companyId",value="companyId",required=false)
private Long companyId;
private List<Long> accountIds;
}
package com.yizhi.assignment.application.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yizhi.assignment.application.vo.entity.CommentReply;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Data
public class AssignmentPageCommentVo {
private Long id;
@ApiModelProperty(value = "账号id")
private Long accountId;
@ApiModelProperty(value = "评论人")
private String commentator;
@ApiModelProperty(value = "评论内容")
private String content;
@ApiModelProperty(value = "创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
@ApiModelProperty(value = "点赞数")
private Integer thumbsUps;
@ApiModelProperty(value = "用户头像")
private String userAvatar;
@ApiModelProperty(value = "是否点赞 1 是 0否")
private Integer status;
@ApiModelProperty(value = "是否已经点赞")
private Boolean hasThumbsUp;
@ApiModelProperty(value = "回复数")
private Integer replys;
@ApiModelProperty(value = "回复列表")
List<CommentReply> commentReplies = new ArrayList<>();
@ApiModelProperty(value = "姓名")
private String commentatorName;
@ApiModelProperty("状态(0:上架|1:下架 默认为0)")
private Integer state;
@ApiModelProperty(value = "评论对象")
private String replyName;
}
package com.yizhi.assignment.application.vo;
import java.util.List;
import com.yizhi.assignment.application.vo.entity.AssignmentStudent;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class AssignmentQXVO {
@ApiModelProperty(name="作业名字",value="作业名字")
private String name;
@ApiModelProperty(name="siteId",value="站点id")
private Long siteId;
@ApiModelProperty(name="visibleRange",value="可见范围(1:平台用户可见,2:指定学员可见),默认平台用户可见")
private Integer visibleRange;
@ApiModelProperty(name="指定范围的组织,用户,用户组",value="指定范围的组织,用户,用户组")
private List<AssignmentStudent> listStudent;
@ApiModelProperty(name="已经提交的作业人员",value="已经提交的作业人员")
private List<Long> listSubmitAccountId;
}
package com.yizhi.assignment.application.vo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@Data
@Api(tags = "AssignmentReadListVO", description = "老师布置单个作业,显示学生作业列表")
public class AssignmentReadListVO {
@ApiModelProperty(name = "", value = "主键id")
private Long id;
@ApiModelProperty(name = "accountName", value = "用户名")
private String accountName;
@ApiModelProperty(name = "realName", value = "真实姓名")
private String realName;
@ApiModelProperty(name = "createTime", value = "作业提交时间")
private Date createTime;
@ApiModelProperty(name = "score", value = "分数")
private Integer score;
@ApiModelProperty(name = "gradeName", value = "等级")
private String gradeName;
@ApiModelProperty(name = "type", value = "1分数2等级")
private Integer type;
@ApiModelProperty(name = "status", value = "评阅状态(1:待阅,2:已阅)")
private Integer status;
@ApiModelProperty(name = "accountId", value = "用户id")
private Long accountId;
@ApiModelProperty(value = "点赞数")
private int thumbupTimes;
@ApiModelProperty(value = "评论数")
private int commentTimes;
@ApiModelProperty(value = "作业状态0上架,1下架")
private Integer down;
}
package com.yizhi.assignment.application.vo;
import com.yizhi.assignment.application.vo.entity.AssignmentFile;
import com.yizhi.assignment.application.vo.entity.AssignmentGrade;
import com.yizhi.assignment.application.vo.entity.AssignmentPoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* 新建作业
*
* @author wangfeida
*/
@Data
@Api(tags = "AssignmentSaveParamVo", description = "新建作业入参vo类")
public class AssignmentSaveParamVo {
@ApiModelProperty(name = "style", value = "1是保存 2是修改", required = true)
private Integer style;
@ApiModelProperty(name = "id", value = "作业id", required = true)
private Long id;
@ApiModelProperty(name = "name", value = "作业名称", required = true)
private String name;
@ApiModelProperty(name = "content", value = "作业内容", required = true)
private String content;
@ApiModelProperty(name = "finishTime", value = "作业完成时间,如果不限制则不传,如果限制则传 格式2038-01-01 00:00:00", required = false)
private String finishTime;
@ApiModelProperty(name = "amendable", value = "是否支持补交(0:否,1:是),默认是", required = true)
private Integer amendable;
@ApiModelProperty(value = "是否启用提醒 1:启用 0:关闭")
private Integer enableRemind;
@ApiModelProperty(name = "count", value = "提交次数", required = false)
private Integer count;
@ApiModelProperty(name = "visibleRange", value = "可见范围(1:平台用户可见,2:指定学员可见),默认平台用户可见", required = true)
private Integer visibleRange;
@ApiModelProperty(name = "fileUrlList", value = "作业文件url", required = false)
List<AssignmentFile> fileUrlList;
@ApiModelProperty(name = "passScore", value = "合格分", required = true)
private Integer passScore;
@ApiModelProperty(name = "type", value = "1打分制,2等级制", required = true)
private Integer type;
@ApiModelProperty(name = "listGrade", value = "如果type=2等级制度集合,如果是打分,则不写", required = false)
private List<AssignmentGrade> listGrade;
@ApiModelProperty(name = "listPoint", value = "可获得积分,沒有设置则不填", required = false)
private List<AssignmentPoint> listPoint;
@ApiModelProperty(name = "trainingProjectId", value = "作业所属项目id,前端不传", required = false)
private Long trainingProjectId;
@ApiModelProperty(name = "accountId", value = "用户id,前端不传", required = false)
private Long accountId;
@ApiModelProperty(name = "accountName", value = "用户名,前端不传", required = false)
private String accountName;
@ApiModelProperty(name = "companyId", value = "公司id,前端不传", required = false)
private Long companyId;
@ApiModelProperty(name = "siteId", value = "站点id,前端不传", required = false)
private Long siteId;
@ApiModelProperty(name = "orgId", value = "组织机构id,前端不传", required = false)
private Long orgId;
@ApiModelProperty(value = "各个业务设置提醒时的数据")
private MessageRemindVo messageRemindVo;
@ApiModelProperty(notes = "答案字数区间-最小值")
private Integer answerCharaterNumMin;
@ApiModelProperty(notes = "答案字数区间-最大值")
private Integer answerCharaterNumMax;
@ApiModelProperty(notes = "附件个数区间-最小值")
private Integer answerAttachmentNumMin;
@ApiModelProperty(notes = "附件个数区间-最大值")
private Integer answerAttachmentNumMax;
@ApiModelProperty(notes = "学员端是否显示评阅结果和评阅状态,0不显示,1显示")
private Integer showRes;
@ApiModelProperty(notes = "是否启用作业本,0否,1是")
private Integer enableExerciseBook;
@ApiModelProperty(notes = "关键字,逗号分隔")
private String keywords;
@ApiModelProperty(notes = "图片")
private String image;
@ApiModelProperty(value = "是否启用在日历任务中显示")
private Integer enableTask;
@ApiModelProperty(value = "日历任务设置的开始时间")
private Date taskStartDate;
@ApiModelProperty(value = "日历任务设置的结束时间")
private Date taskEndDate;
}
package com.yizhi.assignment.application.vo;
import com.yizhi.assignment.application.vo.entity.AssignmentFile;
import com.yizhi.assignment.application.vo.entity.AssignmentGrade;
import com.yizhi.assignment.application.vo.entity.AssignmentPoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
@Api(tags = "AssignmentSelectVo", description = "查看老师作业详细信息")
public class AssignmentSelectVo {
@ApiModelProperty(name = "id", value = "主键id")
private Long id;
@ApiModelProperty(name = "name", value = "作业名称")
private String name;
@ApiModelProperty(name = "content", value = "内容")
private String content;
@ApiModelProperty(name = "", value = "老师布置得文件")
private List<AssignmentFile> assignmentFiles;
@ApiModelProperty(name = "finishTime", value = "作业完成时间")
private Date finishTime;
@ApiModelProperty(name = "amendable", value = "是否支持补交(0:否,1:是),默认否")
private Integer amendable; //是否支持补交(0:否,1:是),默认否
@ApiModelProperty(name = "visibleRange", value = "可见范围(1:平台用户可见,2:指定学员可见),默认平台用户可见")
private Integer visibleRange; //可见范围
@ApiModelProperty(value = "是否启用提醒 1:启用 0:关闭")
private Integer enableRemind;
@ApiModelProperty(name = "type", value = "1打分制,2等级制")
private Integer type;
@ApiModelProperty(name = "listGrade", value = "如果type=2等级制度集合,如果是打分,则不写")
private List<AssignmentGrade> listGrade;
@ApiModelProperty(name = "listPoint", value = "可获得积分,沒有设置则不写")
private List<AssignmentPoint> listPoint;
@ApiModelProperty(name = "passScore", value = "合格分")
private Integer passScore;
@ApiModelProperty(name = "count", value = "提交次数")
private Integer count;
@ApiModelProperty(notes = "答案字数区间-最小值")
private Integer answerCharaterNumMin;
@ApiModelProperty(notes = "答案字数区间-最大值")
private Integer answerCharaterNumMax;
@ApiModelProperty(notes = "附件个数区间-最小值")
private Integer answerAttachmentNumMin;
@ApiModelProperty(notes = "附件个数区间-最大值")
private Integer answerAttachmentNumMax;
@ApiModelProperty(notes = "学员端是否显示评阅结果和评阅状态,0不显示,1显示")
private Integer showRes;
@ApiModelProperty(notes = "是否启用作业本,0否,1是")
private Integer enableExerciseBook;
@ApiModelProperty(notes = "关键字,逗号分隔")
private String keywords;
@ApiModelProperty(notes = "logo图片")
private String image;
@ApiModelProperty(value = "是否启用在日历任务中显示")
private Integer enableTask;
@ApiModelProperty(value = "日历任务设置的开始时间")
private Date taskStartDate;
@ApiModelProperty(value = "日历任务设置的结束时间")
private Date taskEndDate;
}
package com.yizhi.assignment.application.vo;
import com.yizhi.assignment.application.vo.apivo.ApiFileVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* @ClassName AssignmentExerciseBookListVO
* @Description TODO
* @Author shengchenglong
* @DATE 2019-10-22 11:26
* @Version 1.0
*/
@Data
@ApiModel("学员端-作业本-列表VO")
public class AssignmentStudentExerciseBookListVO {
@ApiModelProperty("提交作业的id")
private Long assignmentAnswerId;
@ApiModelProperty("提交次数")
private int commitNum;
@ApiModelProperty("提交时间")
private Date commitTime;
@ApiModelProperty("提交人")
private String accountName;
@ApiModelProperty("作业提交内容")
private String content;
@ApiModelProperty("点赞次数")
private int thumbpsTimes;
@ApiModelProperty("提交人头像")
private String headPortrait;
@ApiModelProperty("是否对该作业本点过赞")
private boolean hasThumbUp;
@ApiModelProperty("附件列表")
private List<ApiFileVo> fileVos;
}
package com.yizhi.assignment.application.vo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@Api(tags = "AssignmentUpAndDownVO", description = "作业上架下架入参")
public class AssignmentUpAndDownVO {
@ApiModelProperty(name="id",value="作业id",required=true)
private Long id;
@ApiModelProperty(name="id",value="作业现在的状态状态(2:上架,3:下架)",required=true)
private Integer status;
@ApiModelProperty(name="accountId",value="用户id",required=false)
private Long accountId; //用户id
@ApiModelProperty(name="accountName",value="用户名字",required=false)
private String accountName; //用户名
}
package com.yizhi.assignment.application.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@Data
public class CalendarTaskParamVo {
@ApiModelProperty("时间参数")
public Date date;
@ApiModelProperty("业务类型")
public Integer taskType = 0;
@ApiModelProperty("当前页数")
public Integer pageNo;
@ApiModelProperty("页内条数")
public Integer pageSize;
}
package com.yizhi.assignment.application.vo;
import java.util.List;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class DownloadAnswerVO {
@ApiModelProperty("作业id")
private Long assignmentId;
@ApiModelProperty("答案ids")
private List<Long> answerIds;
}
package com.yizhi.assignment.application.vo;
import java.util.List;
import com.yizhi.core.application.context.RequestContext;
import com.yizhi.assignment.application.vo.entity.AssignmentAuditor;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@Api(tags = "ListAuditor", description = "评阅人")
public class ListAuditor {
@ApiModelProperty(name="assignmentId",value="作业id",required=true)
private Long assignmentId;
@ApiModelProperty(name="listAuditor人",value="评阅人详细信息",required=true)
private List<AssignmentAuditor> listAuditor;
@ApiModelProperty(name="contextHolder人",value="上下文对象",required=true)
private RequestContext contextHolder;
}
package com.yizhi.assignment.application.vo;
import java.util.List;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@Api(tags = "ListStudent", description = "学生")
public class ListStudent {
@ApiModelProperty(name="assignmentId",value="作业id")
private Long assignmentId;
@ApiModelProperty(name="listAccountId",value="idList",required=false)
private List<StudentVo> listAccountId;
@ApiModelProperty(name="accountId",value = "当前登陆人用户id",required=true)
private Long accountId;
@ApiModelProperty(name="accountName",value = "当前登陆人用户姓名",required=true)
private String accountName;
}
package com.yizhi.assignment.application.vo;
import com.yizhi.core.application.context.RequestContext;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author hutao123
* @since 2019-09-09
*/
@Data
@Api(tags = "MessageRemindVo", description = "各个业务设置提醒时的数据")
public class MessageRemindVo implements Serializable {
private static final long serialVersionUID = -7621642684091133619l;
@ApiModelProperty(value = "提醒id ")
private Long id;
@ApiModelProperty(value = "消息id")
private Long messageId;
@ApiModelProperty(value = "消息类型:1、自定义消息;2、系统消息;3、事件触发消息")
private Integer messageType;
@ApiModelProperty(value = "用户id 主要用于触发消息 个人完成发消息类型")
private Long accountId;
@ApiModelProperty(value = "消息内容(完整版)")
private String messageContext;
@ApiModelProperty(value = "关联模块类型(1:学习计划、2:考试、3:调研、4、投票5:报名、6:作业、7:签到、8:项目、9:直播、10:积分)")
private Integer relationType;
@ApiModelProperty(value = "关联的业务id: 比如调研id")
private Long relationId;
@ApiModelProperty(value = "发送方式:1、站内信;2、短信;3、邮件")
private Integer sendType;
@ApiModelProperty(value = "该业务提醒是被关闭,关闭则为true,默认false")
private Boolean hasDeleted = false;
@ApiModelProperty(value = "该业务提醒是否有变化,有则为true,默认false")
private Boolean isChangge = false;
@ApiModelProperty(value = "专门存放提醒时间设置")
private List<MessageTaskRemindVo> messageTaskRemindVos = new ArrayList<>();
@ApiModelProperty(value = "目前只有培训项目需要,计划同步项目可见范围")
private Boolean visibleRangeUpdate = false;
@ApiModelProperty(value = "指定范围(0:全平台,1:指定用户)")
private Integer visibleRange;
@ApiModelProperty(value = "业务参数对象")
private TaskVo taskVo;
@ApiModelProperty(value = "触发消息专用 发送时间")
private Date sendTime;
@ApiModelProperty(value = "是否设置为上架状态")
private Boolean hasUp = false;
@ApiModelProperty(value = "是否是 修改业务状态 ")
private Boolean taskStatusUpdate = false;
@ApiModelProperty(value = "业务状态 1:才允上架许发送(业务上架)0:不允许发送(业务非上架) 仅针对于系统消息")
private Integer taskStatus;
@ApiModelProperty(value = "上下文 必传,主要需要 siteId companyId accountId accountName 都不能是空")
private RequestContext requestContext;
@ApiModelProperty(value = "调研是否为复制类型")
private Boolean isCopy = false;
@ApiModelProperty(value = "复制调研时,旧的调研id")
private Long oldRelationId;
}
package com.yizhi.assignment.application.vo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author hutao123
* @since 2019-09-09
*/
@Data
@Api(tags = "MessageTaskRemindVo", description = "各个业务设置提醒时的数据")
public class MessageTaskRemindVo implements Serializable {
@ApiModelProperty(value = "待发消息id")
private Long messageRemindId;
@ApiModelProperty(value = "提醒时间事件类型 1:业务开始时间、 2:业务结束时间、3:自定义时间")
private Integer timeEventType;
@ApiModelProperty(value = "发生时间枚举:1:五分钟前、2:十分钟前、3:三十分钟前、4:一个小时前、5:两个小时前、6:一天前、7:两天前")
private Integer timeType;
@ApiModelProperty(value = "最终发送时间")
private Date sendTime;
}
package com.yizhi.assignment.application.vo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* 复旦mini mba作业类
* @author wangfeida
*
*/
@Data
@Api(tags = "AssignmentListVO", description = "复旦mini mba作业类")
public class MinimbaAssignmentVO {
@ApiModelProperty(value = "作业提交内容")
private String content;
@ApiModelProperty(value = "作业提交时间")
private Date submitTime;
@ApiModelProperty(value = "被点赞数")
private Integer admireNum;
@ApiModelProperty(value = "被评论数")
private Integer commentNum;
@ApiModelProperty(value = "附件列表")
private List<AccessoryVO> accessoryVOList;
}
package com.yizhi.assignment.application.vo;
import io.swagger.annotations.Api;
import lombok.Data;
import java.util.List;
/**
* 复旦mini mba项目学习记录类
*
* @author DING
*/
@Data
@Api(tags = "AssignmentListVO", description = "复旦mini mba项目学习记录类")
public class MinimbaStudyRecordVO {
private Long planId;
private String planName;
private Long courseId;
private Long examId;
private String courseStudyDuration;
private Double courseScore;
List<MinimbaAssignmentVO> assignmentAnswerList;
}
package com.yizhi.assignment.application.vo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* 复旦mini mba项目获取用户打卡,点赞信息请求类
* @author DING
*
*/
@Data
@Api(tags = "MinimbaUserDetailParamVO", description = "复旦mini mba项目获取用户打卡,点赞信息请求类")
public class MinimbaUserDetailParamVO {
@ApiModelProperty("培训项目id集合")
private List<Long> projectIds;
@ApiModelProperty("是否取实时数据 0:取前一天截止的数据 1:取实时数据")
private Integer isRealTime;
}
package com.yizhi.assignment.application.vo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* 复旦mini mba项目获取用户打卡,点赞信息返回类
* @author DING
*
*/
@Data
@Api(tags = "MinimbaUserDetailVO", description = "复旦mini mba项目获取用户打卡,点赞信息返回类")
public class MinimbaUserDetailVO {
@ApiModelProperty("累计打卡次数")
private Integer pushInNum;
@ApiModelProperty("被赞次数")
private Integer praisedNum;
@ApiModelProperty("计划完成百分比整数(所有项目完成的计划/所有项目的计划总数,百分比,分子取整,返回分子整数)")
private Integer percentage;
}
package com.yizhi.assignment.application.vo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@Api(tags = "PdfPages", description = "pdf图片")
public class PdfPages {
private static final long serialVersionUID = 1L;
private Long id;
@ApiModelProperty(value = "页数")
private Integer pdfPage;
@ApiModelProperty(value = "业务id")
private Long bizId;
@ApiModelProperty(value = "业务类型")
private Integer bizType;
@ApiModelProperty(value = "图片地址")
private String imageUrl;
}
package com.yizhi.assignment.application.vo;
import java.io.Serializable;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "PointParamVO", description = "其他微服务配置 积分")
public class PointParamVO implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
private String id;
@ApiModelProperty(value = "事件名称")
private String eventName;
@ApiModelProperty(value = "事件类型/学习活动类型, 枚举 统一传入 ActivityTypeEnum.类型")
private String activityType;
@ApiModelProperty(value = "学习活动来源")
private String activitySource;
@ApiModelProperty(value = "积分来源Id, 存放业务主键, 课程Id,调研Id,考试Id, 投票ID, 作业ID")
private Long sourceId;
@ApiModelProperty("如果是考试,发送考试成绩")
private Integer score;
@ApiModelProperty("积分规则 1按课程 2 按章节 3 按素材")
private Integer portRule;
@ApiModelProperty(value = "学习活动名称")
private String activityName;
@ApiModelProperty(value = "发放条件")
private String releaseCondition;
@ApiModelProperty(value = "发放规则")
private String releaseRules;
@ApiModelProperty(value = "积分数量, 正数 加积分, 负数减积分")
private Integer operatingPoint;
@ApiModelProperty(value = "积分活动创建时间")
private Date createPointTime;
@ApiModelProperty(value = "学员id")
private Long accountId;
@ApiModelProperty(value = "学员姓名")
private String accountName;
private Long siteId;
private Long orgId;
private Long companyId;
}
package com.yizhi.assignment.application.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class StudentVo {
@ApiModelProperty(name="accountId",value="人员/部门/组织")
private Long adoId;
@ApiModelProperty(name="type",value="type")
private Integer type;
}
package com.yizhi.assignment.application.vo;
import com.yizhi.assignment.application.vo.enums.EvenType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 消息
* </p>
*
* @author hutao123
* @since 2019-09-09
*/
@Data
@Api(tags = "TaskVo", description = "业务参数对象")
public class TaskVo implements Serializable {
@ApiModelProperty(value = "业务名称")
private String taskName;
@ApiModelProperty(value = "业务开始时间")
private Date taskStratTime;
@ApiModelProperty(value = "业务结束时间")
private Date taskEndTime;
@ApiModelProperty(value = "业务得分")
private Double taskScore;
@ApiModelProperty(value = "业务发生原因(主要用于积分)")
private String reason;
@ApiModelProperty(value = "业务时间(主要用于积分)")
private Date taskTime;
@ApiModelProperty(value = "事件类型")
private EvenType evenType;
}
package com.yizhi.assignment.application.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.xpath.operations.Bool;
import java.util.Date;
/**
* @ClassName TipoffListVO
* @Description TODO
* @Author shengchenglong
* @DATE 2019-10-22 18:23
* @Version 1.0
*/
@Data
@ApiModel("作业举报--作业列表vo")
public class TipoffAssignmentListVO {
@ApiModelProperty("作业答案id")
private Long answerId;
@ApiModelProperty("作业名称")
private String assignmentName;
@ApiModelProperty(hidden = true)
private Long accountId;
@ApiModelProperty("用户名")
private String username;
@ApiModelProperty("姓名")
private String fullName;
@ApiModelProperty("提交时间")
private Date commitTime;
@ApiModelProperty("举报数")
private Integer tipoffTimes;
@ApiModelProperty("举报时间")
private Date tipoffTime;
@ApiModelProperty("是否有新的举报")
private boolean hasNew;
}
package com.yizhi.assignment.application.vo;
import java.util.List;
import com.yizhi.core.application.context.RequestContext;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 2019/09/19
* @author wangfeida
*
*/
@Data
public class VisibleRangeExport {
@ApiModelProperty(name="bizId",value="具体业务id")
private Long bizId;
@ApiModelProperty(name="bizName",value="具体业务名字")
private String bizName;
@ApiModelProperty(name="个人ID集合",value="个人id集合")
private List<Long> accountIds;
@ApiModelProperty(name="组织ID集合",value="组织ID集合")
private List<Long> orgIds;
@ApiModelProperty(name="上下文对象",value="上下文对象")
private RequestContext context;
}
package com.yizhi.assignment.application.vo.apivo;
import com.yizhi.assignment.application.vo.entity.AssignmentAnswerFile;
import com.yizhi.assignment.application.vo.entity.AssignmentGrade;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
@Api(tags = "ApiAssignmentAnswerCheckVO", description = "单个作业显示")
public class ApiAssignmentAnswerCheckVO {
@ApiModelProperty(notes = "学生真实姓名")
private String realName;
@ApiModelProperty(notes = "答案详情")
private String content;
@ApiModelProperty(notes = "作业答案文件信息")
private List<AssignmentAnswerFile> listAssignmentAnswerFile;
@ApiModelProperty(notes = "作业成绩")
private Integer score;
@ApiModelProperty(notes = "合格分")
private Integer passScore;
@ApiModelProperty(notes = "作业评语")
private String suggestion;
@ApiModelProperty(notes = "答案反馈文件信息")
private List<AssignmentAnswerFile> listAssignmentAnswerBackFile;
// @ApiModelProperty(name = "nextAnswerId", value = "下一个学生提交的作业id")
// private Long nextAnswerId;
//
// @ApiModelProperty(name = "prevAnswerId", value = "上一个学生提交的作业id")
// private Long prevAnswerId;
/**
* 下边的这三个字段没用了,以前的需求需要这个代码,现在的需求不需要了,但是前端需调调试bug,因此先添加上
*/
@ApiModelProperty(notes = "作业地址")
private List<String> fileUrl;
@ApiModelProperty(notes = "全部等级")
private List<AssignmentGrade> grades;
@ApiModelProperty(notes = "作业等级")
private String grade;
@ApiModelProperty(notes = "学员提交作业answerId")
private List<Long> answerIds;
}
package com.yizhi.assignment.application.vo.apivo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 学员端作业vo
*
* @Author: wangfeida
* @Date: 2018/9/5 20:01
*/
@Data
@Api(tags = {"学员端作业答案列表"}, description = "学员端作业答案列表")
public class ApiAssignmentAnswerResultVo implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(notes = "作业id")
private Long id;
@ApiModelProperty(notes = "作业名称")
private String assignmentName;
@ApiModelProperty(notes = "作业内容(作业要求)")
private String assignmentContent;
@ApiModelProperty(notes = "所属培训项目名称")
private String projectName;
@ApiModelProperty(notes = "作业截止时间")
private Date finishTime;
@ApiModelProperty(notes = "上传次数")
private Integer count;
@ApiModelProperty(notes="已经提交的次数")
private Integer submitCount;
@ApiModelProperty(notes="是否允许补交amendable是否支持补交(0:否,1:是) ")
private Integer amendable;
@ApiModelProperty(notes = "合格分")
private Integer passScore;
@ApiModelProperty(notes="是否合格1 合格 2不合格")
private Integer isPass;
@ApiModelProperty(notes="是否逾期 1没有逾期 2逾期")
private Integer isOverDue;
@ApiModelProperty(notes="显示分数还是评阅中 1显示分数 2 显示字符串(评阅中)3等级制 都是 tag取值")
private Integer isScoreOrResult;
@ApiModelProperty(notes = "作业评语")
private String suggestion;
@ApiModelProperty(notes = "提交时间")
private Date commitTime;
@ApiModelProperty(notes="标签")
private String tag;
@ApiModelProperty(notes = "作业上传文件清单")
private List<ApiFileVo> fileList;
@ApiModelProperty(notes="作业答案列表")
private List<ApiAssignmentAnswerVo> answerResultList;
}
package com.yizhi.assignment.application.vo.apivo;
import java.math.BigDecimal;
import java.util.Date;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
*
* @Author: wangfeida
* @Date: 2018/9/5 20:08
*/
@Data
@Api(tags = {"作业答案列表"}, description = "作业答案列表")
public class ApiAssignmentAnswerVo {
@ApiModelProperty(notes="作业Id")
private Long assignmentId;
@ApiModelProperty(notes="答案Id")
private Long answerId;
@ApiModelProperty(notes = "提交时间")
private Date commitTime;
@ApiModelProperty(notes = "答案状态 评阅状态(1:待阅,2:已阅)")
private Integer status;
@ApiModelProperty(notes = "分数,status=1 没值,如果status=2有值")
private Integer score;
@ApiModelProperty(notes="是否合格1 合格 2不合格")
private Integer isPass;
@ApiModelProperty(name="type",value="1打分制,2等级制",required=true)
private Integer type;
private Integer isDown;
@ApiModelProperty(notes = "等级 status=1 没值,如果status=2有值")
private String grade;
}
package com.yizhi.assignment.application.vo.apivo;
import java.util.Date;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Author: shengchenglong
* @Date: 2018/3/7 15:58
*/
@Data
@Api(tags = "ApiAssignmentAnswersVO", description = "学员作业显示列表")
@TableName("assignment_answer")
public class ApiAssignmentAnswersVO {
private static final long serialVersionUID = 1L;
@ApiModelProperty(notes = "id主键")
private Long id;
@ApiModelProperty(notes = "作业id")
@TableField("assignment_id")
private Long assignmentId;
@ApiModelProperty(notes = "账号id")
@TableField("account_id")
private Long accountId;
@ApiModelProperty(notes = "分数")
private Integer score;
@ApiModelProperty(notes = "等级")
private String grade;
@ApiModelProperty(notes = "等级id")
@TableField("grade_id")
private Long gradeId;
@ApiModelProperty(notes = "评阅人")
@TableField("auditor_id")
private Long auditorId;
@ApiModelProperty(notes = "评阅状态(1:待阅,2:已阅)")
private Integer status;
@ApiModelProperty(notes = "公司id")
@TableField("company_id")
private Long companyId;
@ApiModelProperty(notes = "用户名")
@TableField("account_name")
private String accountName;
@ApiModelProperty(notes = "学生真实姓名")
@TableField("real_name")
private String real_name;
@ApiModelProperty(notes = "站点id")
@TableField("site_id")
private Long siteId;
@ApiModelProperty(notes = "部门id")
@TableField("org_id")
private Long orgId;
@ApiModelProperty(notes = "创建人id")
@TableField(value = "create_by_id", fill = FieldFill.INSERT)
private Long createById;
@ApiModelProperty(notes = "创建人姓名")
@TableField(value = "create_by_name", fill = FieldFill.INSERT)
private String createByName;
@ApiModelProperty(notes = "创建时间")
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
@ApiModelProperty(notes = "修改人id")
@TableField(value = "update_by_id", fill = FieldFill.INSERT)
private Long updateById;
@ApiModelProperty(notes = "修改人姓名")
@TableField(value = "update_by_name", fill = FieldFill.INSERT)
private String updateByName;
@ApiModelProperty(notes = "修改时间")
@TableField(value = "update_time", fill = FieldFill.INSERT)
private Date updateTime;
}
package com.yizhi.assignment.application.vo.apivo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @Author: shengchenglong
* @Date: 2018/3/7 15:58
*/
@Data
@Api(tags = {"学员端答案vo"}, description = "学员端作业提交答案vo")
public class ApiAssignmentAswerVO {
/**
* 作业id
*/
@ApiModelProperty(notes = "作业id",required=true)
private Long assignmentId;
/**
* 答案来源
*/
@ApiModelProperty(notes="答案来源(1本地2做课)",required=true)
private Integer source;
/**
* 课程id
*/
@ApiModelProperty(notes = "课程id",required=false)
private Long courseId;
/**
* 上传文件vo集合
*/
@ApiModelProperty(notes = "上传文件vo集合",required=false)
private List<ApiFileVo> fileVos;
@ApiModelProperty(notes="文字说明",required=false)
private String content;
@ApiModelProperty(name="accountId",value="用户id,前端不传",required=false)
private Long accountId;
@ApiModelProperty(name="accountName",value="用户名,前端不传",required=false)
private String accountName;
@ApiModelProperty(name="realName",value="真实姓名,前端不传",required=false)
private String realName;
@ApiModelProperty(name="companyId",value="公司id,前端不传",required=false)
private Long companyId;
@ApiModelProperty(name="siteId",value="站点id,前端不传",required=false)
private Long siteId;
@ApiModelProperty(name="orgId",value="组织机构id,前端不传",required=false)
private Long orgId;
}
package com.yizhi.assignment.application.vo.apivo;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @ClassName ApiAssignmentCommentVO
* @Description TODO
* @Author shengchenglong
* @DATE 2019-10-22 15:38
* @Version 1.0
*/
@ApiModel("评论VO")
@Data
public class ApiAssignmentCommentVO {
@ApiModelProperty("评论id")
private Long commentId;
@ApiModelProperty("评论内容")
private String content;
@ApiModelProperty("当前评论人名称")
private String createByName;
@ApiModelProperty("回复对象的名称(空字符串的话则不是回复)")
private String parentCreateByName = "";
@ApiModelProperty("评论时间")
private Date createTime;
@ApiModelProperty(value = "审核状态:0通过,1下架(默认通过)")
private Integer auditStatus;
@JsonIgnore
private String auditStatusStr;
@ApiModelProperty("评论人")
private String manageCommentator;
@ApiModelProperty("姓名")
private String manageCommentatorFullName;
public String getAuditStatusStr() {
if (auditStatus != null) {
if (auditStatus.equals(0)) {
return "已上架";
} else {
return "已下架";
}
}
return "";
}
public void setAuditStatusStr(String auditStatusStr) {
if (auditStatus != null) {
if (auditStatus.equals(0)) {
this.auditStatusStr = "已上架";
} else {
this.auditStatusStr = "已下架";
}
}
}
}
package com.yizhi.assignment.application.vo.apivo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 学员端作业vo
*
* @Author: shengchenglong
* @Date: 2018/3/8 10:49
*/
@Data
@Api(tags = {"学员端作业vo"}, description = "学员端作业vo")
public class ApiAssignmentDetailsVo implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(notes = "作业id")
private Long id;
@ApiModelProperty(notes = "作业名称")
private String assignmentName;
@ApiModelProperty(notes = "作业内容(作业要求)")
private String assignmentContent;
@ApiModelProperty(notes = "作业上传文件清单")
private List<ApiFileVo> fileList;
@ApiModelProperty(notes = "作业创建时间")
private Date startTime;
@ApiModelProperty(notes = "作业截止时间")
private Date finishTime;
@ApiModelProperty(notes="答案状态 评阅状态(1:待阅,2:已阅)")
private Integer status;
@ApiModelProperty(notes = "所属培训项目名称")
private String projectName;
@ApiModelProperty(notes="管理端设定的次数")
private Integer count;
@ApiModelProperty(notes="已经提交的次数")
private Integer submitCount;
@ApiModelProperty(notes = "合格分")
private Integer passScore;
@ApiModelProperty(notes="1显示分数 2显示等级")
private Integer isScoreAndGrade;
//答案
@ApiModelProperty(notes = "答案清单(提交答案后 可能这里会有多个文件)")
private List<ApiFileVo> answerFileList;
@ApiModelProperty(notes="答案内容")
private String answerContent;
//批阅
@ApiModelProperty(notes="批阅时间")
private Date readTime;
@ApiModelProperty(notes="分数")
private Integer Score;
@ApiModelProperty(notes="等级")
private String grade;
@ApiModelProperty(notes="评语")
private String suggestion;
@ApiModelProperty(notes="反馈文件")
private List<ApiFileVo> backFileList;
@ApiModelProperty(notes = "答案字数区间-最小值")
private Integer answerCharaterNumMin;
@ApiModelProperty(notes = "答案字数区间-最大值")
private Integer answerCharaterNumMax;
@ApiModelProperty(notes = "附件个数区间-最小值")
private Integer answerAttachmentNumMin;
@ApiModelProperty(notes = "附件个数区间-最大值")
private Integer answerAttachmentNumMax;
@ApiModelProperty(notes = "学员端是否显示评阅结果和评阅状态,0不显示,1显示")
private Integer showRes;
@ApiModelProperty(notes = "是否启用作业本,0否,1是")
private Integer enableExerciseBook;
@ApiModelProperty(notes = "提交作业的状态1,下架 ")
private Integer isDown;
@ApiModelProperty("提交人数")
private Integer commitAccountNum;
}
package com.yizhi.assignment.application.vo.apivo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import com.baomidou.mybatisplus.annotations.TableField;
/**
* 学员端作业vo
*
* @Author: wangfeida
* @Date: 2018/09/07 16:40
*/
@Data
@Api(tags = {"学员端作业列表---未完成/已完成列表"}, description = "学员端作业列表---未完成/已完成列表")
public class ApiAssignmentListResultVO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(notes = "作业id")
private Long id;
@ApiModelProperty(notes = "作业名称")
private String assignmentName;
@ApiModelProperty(notes = "所属培训项目名称")
private String projectName;
@ApiModelProperty(notes = "作业截止时间")
private Date finishTime;
@ApiModelProperty(notes="分数")
private Integer score;
@ApiModelProperty(notes="等级")
private String GradeLeval;
@ApiModelProperty(notes="1显示分数 2显示等级")
private Integer isScoreAndGrade;
@ApiModelProperty(notes="是否合格1 合格 2不合格")
private Integer isPass;
@ApiModelProperty(notes="标签")
private String tag;
@ApiModelProperty(notes="管理端设置次数")
private Integer count;
@ApiModelProperty(notes="已经提交的次数")
private Integer submitCount;
@ApiModelProperty(notes="是否允许补交amendable是否支持补交(0:否,1:是) ")
private Integer amendable;
@ApiModelProperty(notes="是否逾期 1没有逾期 2逾期")
private Integer isOverDue;
@ApiModelProperty(notes="合格分")
private Integer passScore;
@ApiModelProperty(value="作业的批阅状态")
private Integer minAnswerStatus;
@ApiModelProperty(value="作业的批阅状态")
private Integer maxAnswerStatus;
@ApiModelProperty(value = "作业的状态")
private Integer status;
@ApiModelProperty(value = "作业的要求")
private String detail;
@ApiModelProperty(value = "作业操作 1 详情,2 继续提交 3 详情/继续提交 4 无操作")
private Integer handle;
@ApiModelProperty(value = "学员端是否显示评阅结果和评阅状态,0不显示,1显示")
private Integer showRes;
@ApiModelProperty(value = "用户id")
private Long accountId;
}
package com.yizhi.assignment.application.vo.apivo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 学员端作业vo
*
* @Author: wangfeida
* @Date: 2018/09/07 16:40
*/
@Data
@Api(tags = {"作业详情"}, description = "作业详情")
public class ApiAssignmentVO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(notes = "作业id")
private Long id;
@ApiModelProperty(notes = "作业名称")
private String assignmentName;
@ApiModelProperty(notes = "所属培训项目名称")
private String projectName;
@ApiModelProperty(notes = "作业截止时间")
private Date finishTime;
@ApiModelProperty(notes="管理端设置次数")
private Integer count;
@ApiModelProperty(notes="是否允许补交amendable是否支持补交(0:否,1:是) ")
private Integer amendable;
@ApiModelProperty(notes="合格分")
private Integer passScore;
@ApiModelProperty(notes = "作业内容(作业要求)")
private String assignmentContent;
@ApiModelProperty(notes = "作业上传文件清单")
private List<ApiFileVo> fileList;
@ApiModelProperty(notes="学员已经提交的次数")
private Integer submitCount;
@ApiModelProperty(notes = "答案字数区间-最小值")
private Integer answerCharaterNumMin;
@ApiModelProperty(notes = "答案字数区间-最大值")
private Integer answerCharaterNumMax;
@ApiModelProperty(notes = "附件个数区间-最小值")
private Integer answerAttachmentNumMin;
@ApiModelProperty(notes = "附件个数区间-最大值")
private Integer answerAttachmentNumMax;
@ApiModelProperty(notes = "学员端是否显示评阅结果和评阅状态,0不显示,1显示")
private Integer showRes;
@ApiModelProperty(notes = "是否启用作业本,0否,1是")
private Integer enableExerciseBook;
@ApiModelProperty("提交人数")
private Integer commitAccountNum;
}
package com.yizhi.assignment.application.vo.apivo;
import com.yizhi.assignment.application.vo.PdfPages;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* 作业文件vo
* 包含作业要求文件和学生提交作业文件
*
* @Author: shengchenglong
* @Date: 2018/3/9 16:18
*/
@Data
@Api(tags = {"作业文件vo"}, description = "包含作业要求文件和学生提交作业文件")
public class ApiFileVo {
/**
* 文件名,包含后缀
*/
@ApiModelProperty(notes = "文件名,包含后缀")
private String fileName;
/**
* 文件后缀
*/
@ApiModelProperty(notes = "文件后缀")
private String suffix;
/**
* oss URL
*/
@ApiModelProperty(notes = "oss URL")
private String ossUrl;
@ApiModelProperty(notes = "转码后的视屏地址, 标清")
private String videoSd;
/**
* 文件大小
*/
@ApiModelProperty(notes="文件大小")
private String size;
@ApiModelProperty(notes="文件上传时间")
private Date upLoadTime;
@ApiModelProperty(notes = "是否是视屏文件")
private boolean isVideo;
@ApiModelProperty(notes = "如果该值不为空字符串,显示出来,视屏正在处理,暂时看不了;如果为空字符串,则视屏可观看")
private String state;
@ApiModelProperty(notes = "作业文件id")
private Long id;
private List<PdfPages> pdfPages;
}
package com.yizhi.assignment.application.vo.apivo;
import java.util.Date;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@Api(tags = {"作业列表"}, description = "作业列表")
public class ApiListVo {
@ApiModelProperty(notes = "id主键")
private Long id;
@ApiModelProperty(notes = "项目名字")
private String projectName;
@ApiModelProperty(notes = "作业名字")
private String assignmentName;
@ApiModelProperty(notes = "作业内容")
private String assignmentContent;
@ApiModelProperty(notes = "开始时间")
private Date startTime;
@ApiModelProperty(notes = "完成时间")
private Date finishTime;
@ApiModelProperty(notes = "分数")
private Integer score;
@ApiModelProperty(notes = "级别")
private String gradeName;
}
package com.yizhi.assignment.application.vo.apivo;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import com.yizhi.assignment.application.vo.entity.AssignmentAnswerFile;
import com.yizhi.assignment.application.vo.entity.AssignmentFile;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Author: shengchenglong
* @Date: 2018/3/9 18:47
*/
@Data
@Api(tags = {"作业评语vo"}, description = "作业评语vo")
public class ApiSuggestionVo {
@ApiModelProperty(notes="作业id,不是答案id")
private Long id;
@ApiModelProperty(notes="作业name")
private String assignmentName;
@ApiModelProperty(notes="指定完成时间")
private Date finishTime;
@ApiModelProperty(notes="状态 评阅状态(1:待阅,2:已阅)")
private Integer status;
@ApiModelProperty(notes="评分类型(1:打分制,2:等级制)")
private Integer type;
@ApiModelProperty(notes="分数")
private BigDecimal score;
@ApiModelProperty(notes="提交时间")
private Date commitTime;
@ApiModelProperty(notes = "等级")
private String gradeName;
@ApiModelProperty(notes = "评语")
private String suggestion;
@ApiModelProperty("老师要求的文件")
private List<AssignmentFile> assignmentFileList;
@ApiModelProperty("学生答案的文件")
private List<AssignmentAnswerFile> answerFileList;
@ApiModelProperty("老师反馈的文件")
private List<AssignmentAnswerFile> backFileList;
}
package com.yizhi.assignment.application.vo.apivo;
import java.util.List;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
*
*
* @Author:wangfeida
* @Date: 2018/39/29 14:58
*/
@Data
@Api(tags = {"根据作业id修改培训项目"}, description = "根据作业id修改培训项目")
public class AssignmentTrainingProject {
@ApiModelProperty(notes = "项目ID")
private Long projectId;
@ApiModelProperty(notes = "项目名字")
private String projectName;
@ApiModelProperty(notes = "作业id集合")
private List<Long> listAssignmentIds;
}
package com.yizhi.assignment.application.vo.apivo;
import java.util.Date;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class ToOthersApi {
@ApiModelProperty(value="主键id")
private Long id;
@ApiModelProperty(value="作业名字")
private String name;
@ApiModelProperty(value="作业内容")
private String content;
@ApiModelProperty(value="作业地址")
private String url;
@ApiModelProperty(value="状态")
private Integer state;
@ApiModelProperty(value="开始时间")
private Date startTime;
@ApiModelProperty(value="结束时间")
private Date endTime;
}
package com.yizhi.assignment.application.vo.entity;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 老师布置作业的主表
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
@Data
@Api(tags = "Assignment", description = "老师布置作业的主表")
public class Assignment{
private static final long serialVersionUID = 1L;
@ApiModelProperty(notes = "id主键")
private Long id;
@ApiModelProperty(notes = "所属项目id,未关联则为0")
private Long trainingProjectId;
@ApiModelProperty(notes = "冗余培训项目名称")
private String trainingProjectName;
@ApiModelProperty(notes = "作业序号")
private Long serialNum;
@ApiModelProperty(notes = "作业名称")
private String name;
@ApiModelProperty(value = "是否启用提醒 1:启用 0:关闭")
private Integer enableRemind;
@ApiModelProperty(notes = "是否支持补交(0:否,1:是),默认否")
private Integer amendable;
@ApiModelProperty(notes = "可见范围(1:平台用户可见,2:指定学员可见),默认平台用户可见")
private Integer visibleRange;
@ApiModelProperty(notes = "作业完成时间")
private Date finishTime;
@ApiModelProperty(notes = "状态(1:草稿,2:上架,3:下架,0删除)")
private Integer status;
@ApiModelProperty(notes = "可以提交的次数")
private Integer count;
@ApiModelProperty(notes = "合格分")
private Integer passScore;
@ApiModelProperty(name="type",value="1打分制,2等级制",required=true)
private Integer type;
@ApiModelProperty(notes = "上架时间")
private Date addedTime;
@ApiModelProperty(notes = "公司id")
private Long companyId;
@ApiModelProperty(notes = "站点id")
private Long siteId;
@ApiModelProperty(notes = "部门id")
private Long orgId;
@ApiModelProperty(notes = "创建人id")
private Long createById;
@ApiModelProperty(notes = "创建人姓名")
private String createByName;
@ApiModelProperty(notes = "创建时间")
private Date createTime;
@ApiModelProperty(notes = "修改人id")
private Long updateById;
@ApiModelProperty(notes = "修改人姓名")
private String updateByName;
@ApiModelProperty(notes = "修改时间")
private Date updateTime;
@ApiModelProperty(notes = "答案字数区间-最小值")
private Integer answerCharaterNumMin;
@ApiModelProperty(notes = "答案字数区间-最大值")
private Integer answerCharaterNumMax;
@ApiModelProperty(notes = "附件个数区间-最小值")
private Integer answerAttachmentNumMin;
@ApiModelProperty(notes = "附件个数区间-最大值")
private Integer answerAttachmentNumMax;
@ApiModelProperty(notes = "学员端是否显示评阅结果和评阅状态,0不显示,1显示")
private Integer showRes;
@ApiModelProperty(notes = "是否启用作业本,0否,1是")
private Integer enableExerciseBook;
@ApiModelProperty(notes = "关键字,逗号分隔")
private String keywords;
@ApiModelProperty(notes = "logo图片")
private String image;
@ApiModelProperty(value = "是否启用在日历任务中显示")
private Integer enableTask;
@ApiModelProperty(value = "日历任务设置的开始时间")
private Date taskStartDate;
@ApiModelProperty(value = "日历任务设置的结束时间")
private Date taskEndDate;
}
package com.yizhi.assignment.application.vo.entity;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 学员对作业的对应关系
* <p>
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
@Data
@Api(tags = "AssignmentAnswer", description = "学员对作业的对应关系 ")
@TableName("assignment_answer")
public class AssignmentAnswer extends Model<AssignmentAnswer> {
private static final long serialVersionUID = 1L;
@ApiModelProperty(notes = "id主键")
private Long id;
@ApiModelProperty(notes = "作业id")
@TableField("assignment_id")
private Long assignmentId;
@ApiModelProperty(notes = "真实姓名")
@TableField("real_name")
private String realName;
@ApiModelProperty(notes = "账号id")
@TableField("account_id")
private Long accountId;
@ApiModelProperty(notes = "用户名")
@TableField("account_name")
private String accountName;
@ApiModelProperty(notes = "文字说明")
private String content;
@ApiModelProperty(notes = "分数")
private Integer score;
@ApiModelProperty(value = "获取积分")
@TableField("point")
private Integer Point;
@ApiModelProperty(notes = "评阅人")
@TableField("auditor_id")
private Long auditorId;
@ApiModelProperty(notes = "评阅时间")
@TableField("auditor_time")
private Date auditorTime;
@ApiModelProperty(notes = "评阅状态(1:待阅,2:已阅)")
private Integer status;
@ApiModelProperty(notes="答案来源(1本地2做课)")
@TableField("source")
private Integer source;
@ApiModelProperty(notes = "公司id")
@TableField("company_id")
private Long companyId;
@ApiModelProperty(notes = "站点id")
@TableField("site_id")
private Long siteId;
@ApiModelProperty(notes = "部门id")
@TableField("org_id")
private Long orgId;
@ApiModelProperty(notes = "创建人id")
@TableField(value = "create_by_id", fill = FieldFill.INSERT)
private Long createById;
@ApiModelProperty(notes = "创建人姓名")
@TableField(value = "create_by_name", fill = FieldFill.INSERT)
private String createByName;
@ApiModelProperty(notes = "创建时间")
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
@ApiModelProperty(notes = "修改人id")
@TableField(value = "update_by_id", fill = FieldFill.INSERT)
private Long updateById;
@ApiModelProperty(notes = "修改人姓名")
@TableField(value = "update_by_name", fill = FieldFill.INSERT)
private String updateByName;
@ApiModelProperty(notes = "修改时间")
@TableField(value = "update_time", fill = FieldFill.INSERT)
private Date updateTime;
@ApiModelProperty(notes="答案文件的zip包")
@TableField(value="answer_file_zip")
private String answerFileZip;
@ApiModelProperty(notes="是否是下架,0:否,1:是")
@TableField("is_down")
private Integer isDown;
@ApiModelProperty("是否删除")
private Integer deleted;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.yizhi.assignment.application.vo.entity;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 一个学员对一个作业的回复内容
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
@Data
@Api(tags = "AssignmentAnswerCourse", description = "一个学员对一个作业的回复内容")
@TableName("assignment_answer_course")
public class AssignmentAnswerCourse extends Model<AssignmentAnswerCourse> {
private static final long serialVersionUID = 1L;
@ApiModelProperty(notes = "id主键")
private Long id;
@ApiModelProperty(notes = "作业提交id")
@TableField("answer_id")
private Long answerId;
@ApiModelProperty(notes = "素材id")
@TableField("mid")
private Long mid;
@ApiModelProperty(notes = "创建人id")
@TableField(value = "create_by_id", fill = FieldFill.INSERT)
private Long createById;
@ApiModelProperty(notes = "创建人姓名")
@TableField(value = "create_by_name", fill = FieldFill.INSERT)
private String createByName;
@ApiModelProperty(notes = "创建时间")
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
@ApiModelProperty(notes = "修改人id")
@TableField(value = "update_by_id", fill = FieldFill.INSERT)
private Long updateById;
@ApiModelProperty(notes = "修改人姓名")
@TableField(value = "update_by_name", fill = FieldFill.INSERT)
private String updateByName;
@ApiModelProperty(notes = "修改时间")
@TableField(value = "update_time", fill = FieldFill.INSERT)
private Date updateTime;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.yizhi.assignment.application.vo.entity;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 学员对作业回复可以是文件,存放学员的作业回复的文件的地址
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
@Data
@Api(tags = "AssignmentAnswerFile", description = "学员对作业回复可以是文件,存放学员的作业回复的文件的地址")
@TableName("assignment_answer_file")
public class AssignmentAnswerFile extends Model<AssignmentAnswerFile> {
private static final long serialVersionUID = 1L;
@ApiModelProperty(notes = "id主键")
private Long id;
@ApiModelProperty(notes = "作业答案id")
@TableField("anwser_id")
private Long anwserId;
@ApiModelProperty(notes = "文件类型(1:作业答案,2:评阅回复)")
private Integer type;
@ApiModelProperty(notes = "文件存放路径")
@TableField("file_url")
private String fileUrl;
@ApiModelProperty(notes = "源文件名")
@TableField("file_name")
private String fileName;
@ApiModelProperty(notes = "后缀名")
private String suffix;
@ApiModelProperty(notes = "文件大小")
private String size;
@ApiModelProperty(notes = "如果是评阅回复,则转换为png格式")
private String png;
@ApiModelProperty(notes = "创建人id")
@TableField(value = "create_by_id", fill = FieldFill.INSERT)
private Long createById;
@ApiModelProperty(notes = "创建人姓名")
@TableField(value = "create_by_name", fill = FieldFill.INSERT)
private String createByName;
@ApiModelProperty(notes = "创建时间")
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
@TableField("video_ld")
private String videoLd;
@TableField("video_sd")
private String videoSd;
@TableField("video_hd")
private String videoHd;
@ApiModelProperty(notes = "是否是视频文件,0否,1是")
@TableField(value = "is_video")
private Integer isVideo;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.yizhi.assignment.application.vo.entity;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 老师对学员做的作业的回复内容
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
@Data
@Api(tags = "AssignmentAnswerSuggestion", description = "老师对学员做的作业的回复内容")
@TableName("assignment_answer_suggestion")
public class AssignmentAnswerSuggestion extends Model<AssignmentAnswerSuggestion> {
private static final long serialVersionUID = 1L;
@ApiModelProperty(notes = "id主键")
private Long id;
@ApiModelProperty(notes = "作业提交id")
@TableField("answer_id")
private Long answerId;
@ApiModelProperty(notes = "评阅内容")
private String suggestion;
@ApiModelProperty(notes = "创建人id")
@TableField(value = "create_by_id", fill = FieldFill.INSERT)
private Long createById;
@ApiModelProperty(notes = "创建人姓名")
@TableField(value = "create_by_name", fill = FieldFill.INSERT)
private String createByName;
@ApiModelProperty(notes = "创建时间")
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
@ApiModelProperty(notes = "修改人id")
@TableField(value = "update_by_id", fill = FieldFill.INSERT)
private Long updateById;
@ApiModelProperty(notes = "修改人姓名")
@TableField(value = "update_by_name", fill = FieldFill.INSERT)
private String updateByName;
@ApiModelProperty(notes = "修改时间")
@TableField(value = "update_time", fill = FieldFill.INSERT)
private Date updateTime;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.yizhi.assignment.application.vo.entity;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @ClassName AssignmentAnswerThumb
* @Description TODO
* @Author shengchenglong
* @DATE 2019-10-22 12:01
* @Version 1.0
*/
@Data
@ApiModel("作业本点赞")
@TableName("assignment_answer_thumb")
public class AssignmentAnswerThumb extends Model<AssignmentAnswerThumb> {
private Long id;
@TableField("assignment_answer_id")
private Long assignmentAnswerId;
@TableField("account_id")
private Long accountId;
@TableField("is_thumb")
private Integer isThumb;
@TableField("create_time")
private Date createTime;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.yizhi.assignment.application.vo.entity;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author shengchenglong123
* @since 2019-10-22
*/
@Data
@Api(tags = "AssignmentAnswerTipoff", description = "")
@TableName("assignment_answer_tipoff")
public class AssignmentAnswerTipoff extends Model<AssignmentAnswerTipoff> {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键id")
private Long id;
@ApiModelProperty(value = "作业答案id")
@TableField("assignment_answer_id")
private Long assignmentAnswerId;
@ApiModelProperty(value = "举报原因")
private String content;
@ApiModelProperty(value = "举报图片")
@TableField("img_url")
private String imgUrl;
private String company;
@ApiModelProperty(value = "创建人id")
@TableField(value = "create_by_id", fill = FieldFill.INSERT)
private Long createById;
@ApiModelProperty(value = "创建人姓名")
@TableField(value = "create_by_name", fill = FieldFill.INSERT)
private String createByName;
@ApiModelProperty(value = "创建时间")
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
@ApiModelProperty(value = "处理状态,0,提交状态(待处理);1 移除(不显示再列表)s")
private Integer status;
@ApiModelProperty(value = "处理人id")
@TableField("auditor_id")
private Long auditorId;
@ApiModelProperty(value = "处理意见")
@TableField("audit_content")
private String auditContent;
@ApiModelProperty(value = "处理时间")
@TableField("audit_time")
private Date auditTime;
@TableField("is_new")
private Integer isNew;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.yizhi.assignment.application.vo.entity;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 作业和评阅人的对应关系
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
@Data
@Api(tags = "AssignmentAuditor", description = "作业和评阅人的对应关系")
@TableName("assignment_auditor")
public class AssignmentAuditor extends Model<AssignmentAuditor> {
private static final long serialVersionUID = 1L;
@ApiModelProperty(notes = "id主键")
private Long id;
@ApiModelProperty(notes = "作业id")
@TableField("assignment_id")
private Long assignmentId;
@ApiModelProperty(notes = "账号id")
@TableField("account_id")
private Long accountId;
@ApiModelProperty(notes = "创建人id")
@TableField(value = "create_by_id", fill = FieldFill.INSERT)
private Long createById;
@ApiModelProperty(notes = "创建人姓名")
@TableField(value = "create_by_name", fill = FieldFill.INSERT)
private String createByName;
@ApiModelProperty(notes = "创建时间")
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.yizhi.assignment.application.vo.entity;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 作业答案 - 评论
* </p>
*
* @author shengchenglong123
* @since 2019-10-22
*/
@Data
@Api(tags = "AssignmentComment", description = "作业答案 - 评论")
@TableName("assignment_comment")
public class AssignmentComment extends Model<AssignmentComment> {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键id")
private Long id;
@ApiModelProperty(value = "作业答案id")
@TableField("assignment_answer_id")
private Long assignmentAnswerId;
@ApiModelProperty(value = "评论内容")
private String content;
@ApiModelProperty(value = "审核状态:0通过,1下架(默认通过)")
@TableField("audit_status")
private Integer auditStatus;
@ApiModelProperty(value = "下架人id")
@TableField("auditor_id")
private Long auditorId;
@ApiModelProperty(value = "下架意见")
@TableField("audit_content")
private String auditContent;
@ApiModelProperty(value = "下架时间")
@TableField("auditor_time")
private Date auditorTime;
@ApiModelProperty(value = "创建者id")
@TableField(value = "create_by_id", fill = FieldFill.INSERT)
private Long createById;
@ApiModelProperty(value = "创建者名称")
@TableField(value = "create_by_name", fill = FieldFill.INSERT)
private String createByName;
@ApiModelProperty(value = "创建时间")
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
@ApiModelProperty(value = "父评论的id(该评论是对父评论的评论)")
@TableField("parent_id")
private Long parentId;
@ApiModelProperty(value = "父评论创建者名称")
@TableField("parent_create_by_name")
private String parentCreateByName;
@ApiModelProperty(value = "父评论创建者id")
@TableField("parent_create_by_id")
private Long parentCreateById;
@ApiModelProperty(value = "站点id")
@TableField("site_id")
private Long siteId;
@ApiModelProperty(value = "组织id")
@TableField("org_id")
private Long orgId;
@ApiModelProperty(value = "企业id")
@TableField("company_id")
private Long companyId;
@ApiModelProperty(value = "用户头像")
@TableField("user_avatar")
private String userAvatar;
// @ApiModelProperty("0上架,1下架")
// private Integer status;
@ApiModelProperty("0未删除,1已删除")
private Integer deleted;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.yizhi.assignment.application.vo.entity;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 老师布置的作业的内容
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
@Data
@Api(tags = "AssignmentContent", description = "老师布置的作业的内容")
@TableName("assignment_content")
public class AssignmentContent extends Model<AssignmentContent> {
private static final long serialVersionUID = 1L;
@ApiModelProperty(notes = "id主键")
private Long id;
@ApiModelProperty(notes = "作业id")
@TableField("assignment_id")
private Long assignmentId;
@ApiModelProperty(notes = "内容")
private String comment;
@ApiModelProperty(notes = "创建人id")
@TableField(value = "create_by_id", fill = FieldFill.INSERT)
private Long createById;
@ApiModelProperty(notes = "创建人姓名")
@TableField(value = "create_by_name", fill = FieldFill.INSERT)
private String createByName;
@ApiModelProperty(notes = "创建时间")
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
@ApiModelProperty(notes = "修改人id")
@TableField(value = "update_by_id", fill = FieldFill.INSERT)
private Long updateById;
@ApiModelProperty(notes = "修改人姓名")
@TableField(value = "update_by_name", fill = FieldFill.INSERT)
private String updateByName;
@ApiModelProperty(notes = "修改时间")
@TableField(value = "update_time", fill = FieldFill.INSERT)
private Date updateTime;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.yizhi.assignment.application.vo.entity;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 老师布置的作业对应多个文件,存放多个文件地址
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
@Data
@Api(tags = "AssignmentFile", description = "老师布置的作业对应多个文件,存放多个文件地址")
@TableName("assignment_file")
public class AssignmentFile extends Model<AssignmentFile> {
private static final long serialVersionUID = 1L;
@ApiModelProperty(notes = "id主键,前端不输入,后台生成")
private Long id;
@ApiModelProperty(notes = "布置的作业id,前端不输入,后台生成")
@TableField("assignment_id")
private Long assignmentId;
@ApiModelProperty(notes = "文件存放路径",required=true)
@TableField("file_url")
private String fileUrl;
@ApiModelProperty(notes = "源文件名。例如:作业1",required=true)
@TableField("file_name")
private String fileName;
@ApiModelProperty(notes = "后缀名。例如:.doc/.ppt",required=true)
private String suffix;
/**
* 文件大小
*/
@ApiModelProperty(notes="文件大小",required=true)
private String size;
@ApiModelProperty(notes = "创建人id,前端不输入,后台生成")
@TableField(value = "create_by_id", fill = FieldFill.INSERT)
private Long createById;
@ApiModelProperty(notes = "创建人姓名,前端不输入,后台生成")
@TableField(value = "create_by_name", fill = FieldFill.INSERT)
private String createByName;
@ApiModelProperty(notes = "创建时间,前端不输入,后台生成")
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.yizhi.assignment.application.vo.entity;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 老师布置的作业等级
* 编号100号作业 可以有多个等级
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
@Data
@Api(tags = "AssignmentGrade", description = "老师布置的作业等级 编号100号作业 可以有多个等级 ")
@TableName("assignment_grade")
public class AssignmentGrade extends Model<AssignmentGrade> {
private static final long serialVersionUID = 1L;
@ApiModelProperty(notes = "id主键")
private Long id;
@ApiModelProperty(notes = "作业id")
@TableField("assignment_id")
private Long assignmentId;
@ApiModelProperty(notes = "开始分数")
@TableField("min_score")
private String minScore;
@ApiModelProperty(notes = "结束分数")
@TableField("max_score")
private String maxScore;
@ApiModelProperty(notes = "等级名字")
@TableField("description")
private String description;
@ApiModelProperty(notes = "创建人id")
@TableField(value = "create_by_id", fill = FieldFill.INSERT)
private Long createById;
@ApiModelProperty(notes = "创建人姓名")
@TableField(value = "create_by_name", fill = FieldFill.INSERT)
private String createByName;
@ApiModelProperty(notes = "创建时间")
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.yizhi.assignment.application.vo.entity;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.annotations.Version;
import com.baomidou.mybatisplus.enums.FieldFill;
import lombok.Data;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
/**
* <p>
*
* </p>
*
* @author yizhi123
* @since 2018-09-04
*/
@Data
@Api(tags = "AssignmentPoint", description = "")
@TableName("assignment_point")
public class AssignmentPoint extends Model<AssignmentPoint> {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "id主键")
private Long id;
@ApiModelProperty(value = "任务id")
@TableField("assignment_id")
private Long assignmentId;
@ApiModelProperty(value = "开始分数")
@TableField("min_score")
private Integer minScore;
@ApiModelProperty(value = "结束分数")
@TableField("max_score")
private Integer maxScore;
@ApiModelProperty(value = "获取积分")
@TableField("point")
private Integer point;
@ApiModelProperty(value = "创建人id")
@TableField(value = "create_by_id", fill = FieldFill.INSERT)
private Long createById;
@ApiModelProperty(value = "创建人姓名")
@TableField(value = "create_by_name", fill = FieldFill.INSERT)
private String createByName;
@ApiModelProperty(value = "创建时间")
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.yizhi.assignment.application.vo.entity;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 老师布置作业和学生进行关联。
* 多对多的关系。
* 一个老师布置的作业有多个学生做。
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
@Data
@Api(tags = "AssignmentStudent", description = "老师布置作业和学生进行关联。 多对多的关系。 一个老师布置的作业有多个学生做。")
@TableName("assignment_student")
public class AssignmentStudent extends Model<AssignmentStudent> {
private static final long serialVersionUID = 1L;
@ApiModelProperty(notes = "id主键")
private Long id;
@ApiModelProperty(notes = "作业id")
@TableField("assignment_id")
private Long assignmentId;
@ApiModelProperty(notes = "账号id")
@TableField("account_id")
private Long accountId;
@ApiModelProperty(notes = "类型")
@TableField("type")
private Integer type;
@ApiModelProperty(notes = "创建人id")
@TableField(value = "create_by_id", fill = FieldFill.INSERT)
private Long createById;
@ApiModelProperty(notes = "创建人姓名")
@TableField(value = "create_by_name", fill = FieldFill.INSERT)
private String createByName;
@ApiModelProperty(notes = "创建时间")
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.yizhi.assignment.application.vo.entity;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import com.yizhi.util.application.sensitive.annotation.SensitiveWords;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 培训项目 - 评论
* </p>
*
* @author shengchenglong
* @since 2018-03-27
*/
@Data
@Api(tags = "Comment", description = "作业答案 - 评论")
@TableName("comment")
public class Comment extends Model<Comment> {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键id")
private Long id;
@ApiModelProperty(value = "作业答案id")
@TableField("assignment_answer_id")
private Long assignmentAnswerId;
@SensitiveWords
@ApiModelProperty(value = "评论内容")
private String content;
@ApiModelProperty(value = "审核状态:0通过,1下架(默认通过)")
@TableField("audit_status")
private String auditStatus;
@ApiModelProperty(value = "下架人id")
@TableField("auditor_id")
private Long auditorId;
@ApiModelProperty(value = "下架意见")
@TableField("audit_content")
private String auditContent;
@ApiModelProperty(value = "下架时间")
@TableField("auditor_time")
private Date auditorTime;
@ApiModelProperty(value = "创建者id")
@TableField(value = "create_by_id", fill = FieldFill.INSERT)
private Long createById;
@ApiModelProperty(value = "创建者名称")
@TableField(value = "create_by_name", fill = FieldFill.INSERT)
private String createByName;
@ApiModelProperty(value = "创建时间")
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
@ApiModelProperty(value = "站点id")
@TableField("site_id")
private Long siteId;
@ApiModelProperty(value = "组织id")
@TableField("org_id")
private Long orgId;
@ApiModelProperty(value = "企业id")
@TableField("company_id")
private Long companyId;
@ApiModelProperty(value = "用户头像")
@TableField("user_avatar")
private String userAvatar;
@Override
protected Serializable pkVal() {
return this.id;
}
@ApiModelProperty("状态(0:上架|1:下架 默认为0)")
@TableField("state")
private Integer state;
}
package com.yizhi.assignment.application.vo.entity;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import com.yizhi.util.application.sensitive.annotation.SensitiveWords;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 培训项目 - 评论回复
* </p>
*
* @author shengchenglong
* @since 2018-03-27
*/
@Data
@Api(tags = "CommentReply", description = "培训项目 - 评论回复")
@TableName("comment_reply")
public class CommentReply extends Model<CommentReply> {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键id")
private Long id;
@ApiModelProperty(value = "评论id")
@TableField("comment_id")
private Long commentId;
@ApiModelProperty(value = "作业答案id")
@TableField("assignment_answer_id")
private Long assignmentAnswerId;
@SensitiveWords
@ApiModelProperty(value = "回复内容")
private String content;
@ApiModelProperty(value = "删除状态:0未删除,1已删除")
@TableField("audit_status")
private String auditStatus;
@ApiModelProperty(value = "删除人id")
@TableField("auditor_id")
private Long auditorId;
@ApiModelProperty(value = "删除时间")
@TableField("auditor_time")
private Date auditorTime;
@ApiModelProperty(value = "创建者id")
@TableField(value = "create_by_id", fill = FieldFill.INSERT)
private Long createById;
@ApiModelProperty(value = "创建者账号名称")
@TableField(value = "create_by_name", fill = FieldFill.INSERT)
private String createByName;
@ApiModelProperty(value = "创建者真实名称")
@TableField(value = "create_by_full_name")
private String createByFullName;
@ApiModelProperty(value = "创建时间")
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
@ApiModelProperty(value = "站点id")
@TableField("site_id")
private Long siteId;
@ApiModelProperty(value = "组织id")
@TableField("org_id")
private Long orgId;
@ApiModelProperty(value = "企业id")
@TableField("company_id")
private Long companyId;
@ApiModelProperty(value = "用户头像")
@TableField("user_avatar")
private String userAvatar;
@ApiModelProperty(value = "回复用户父id")
@TableField("parent_account_id")
private Long parentAccountId;
@ApiModelProperty("回复用户父姓名")
@TableField("parent_account_fullName")
private String parentAccountFullName;
@ApiModelProperty(value = "回复用户父账号名称")
@TableField("parent_account_name")
private String parentAccountName;
@ApiModelProperty("评论回复父Id(若无默认为null)")
@TableField("reply_parent_id")
private Long replyParentId;
@Override
protected Serializable pkVal() {
return this.id;
}
@ApiModelProperty("上架状态:0上架(默认)1下架")
@TableField("state")
private Integer state;
}
package com.yizhi.assignment.application.vo.entity;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* <p>
* 评论点赞记录
* </p>
*
* @author shengchenglong
* @since 2018-03-27
*/
@Data
@Api(tags = "CommentThumbsUp", description = "评论点赞记录")
@TableName("comment_thumbs_up")
public class CommentThumbsUp extends Model<CommentThumbsUp> {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键id")
private Long id;
@ApiModelProperty(value = "评论id")
@TableField("comment_id")
private Long commentId;
@ApiModelProperty(value = "点赞人id")
@TableField("account_id")
private Long accountId;
@ApiModelProperty(value = "是否已经点赞")
@TableField(exist = false)
private Boolean hasThumbsUp;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.yizhi.assignment.application.vo.enums;
/** 作业枚举类
* @author lly
* @date 2019年1月3日
*/
public enum AssignmentConstant {
SUBMISSION(0,"待提交"),MARKING(1,"批阅中"),PASS(2,"通过"),NO_PASS(3,"未通过"),Delay(4,"已逾期"),MARKUP(5,"补交");
private Integer code;
private String msg;
AssignmentConstant(Integer code, String msg) {
this.code = code;
this.msg = msg;
}
public Integer getCode() {
return code;
}
public String getMsg() {
return msg;
}
}
package com.yizhi.assignment.application.vo.enums;
/** 作业枚举类
* @author lly
* @date 2019年1月3日
*/
public enum AssignmentHandleConstant {
DETAIL(1,"详情"),SUBMIT(2,"提交作业"),SUBMITDETAIL(3,"提交作业&查看详情"),NO_HANDLE(4,"无操作"),
CONTINUEDETAIL(5,"继续提交&查看详情");
private Integer code;
private String msg;
AssignmentHandleConstant(Integer code, String msg) {
this.code = code;
this.msg = msg;
}
public Integer getCode() {
return code;
}
public String getMsg() {
return msg;
}
}
package com.yizhi.assignment.application.vo.enums;
import java.util.Arrays;
import java.util.List;
/**
*
*/
public enum EvenType {
COURSE_UP(1L,Arrays.asList(1,2)),//"课程上架通知"
COURSE_FINISH(2L, Arrays.asList(1,2)),//课程完成通知
ENROLL_START(3L, Arrays.asList(1,3,4,5)),//报名开始
TRAINING_AUDIT_PASS(4L, Arrays.asList(1,3,4,5)),//项目审核通过通知
TRAINING_AUDIT_FAIL(5L, Arrays.asList(1,3,4,5)),//项目审核不通过通知
SIGN_SUCCESS(6L, Arrays.asList(1,3,4,5)),//签到成功通知
TRAINING_FINISH(7L, Arrays.asList(1,3,4,5)),//项目完成通知
ASSIGNMENT_AUDIT_FINISH(8L, Arrays.asList(1,6,7,8)),//作业已被批阅通知
EXAM_AUDIT_FINISH(9L, Arrays.asList(1,9,10,11)),//考试已被批阅通知
POINT_CHANGE(10L, Arrays.asList(1,12,13,14));//积分变动原因
//数据库message表的id
private Long key;
//数据库message_parameter表的field_type
private List<Integer> fieldType;
private EvenType(Long key, List<Integer> fieldType) {
this.key = key;
this.fieldType = fieldType;
}
public Long getKey() {
return key;
}
public List<Integer> getName() {
return fieldType;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.yizhi</groupId>
<artifactId>assignment-project</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>cloud-assignment</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>com.yizhi</groupId>
<artifactId>cloud-assignment-api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.yizhi</groupId>
<artifactId>cloud-system-api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.yizhi</groupId>
<artifactId>cloud-comment-api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.yizhi</groupId>
<artifactId>cloud-common-api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.yizhi</groupId>
<artifactId>cloud-newMessage-api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.yizhi</groupId>
<artifactId>cloud-orm</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.yizhi</groupId>
<artifactId>cloud-util</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.yizhi</groupId>
<artifactId>cloud-core</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<!-- deploy 时跳过该模块 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
package com.yizhi.application;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ComponentScan;
/**
* @Author: shengchenglong
* @Date: 2018/3/6 14:29
*/
@SpringBootApplication
@EnableDiscoveryClient
@ComponentScan(basePackages = {"com.yizhi"})
@EnableFeignClients(basePackages = {"com.yizhi"})
public class AssignmentApplication {
public static void main(String[] args) {
SpringApplication.run(AssignmentApplication.class, args);
}
}
package com.yizhi.application.controller.api;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.yizhi.core.application.context.ContextHolder;
import com.yizhi.comment.application.vo.domain.PdfPagesVo;
import com.yizhi.application.entity.AssignmentAnswer;
import com.yizhi.application.entity.AssignmentAnswerThumb;
import com.yizhi.application.entity.AssignmentAnswerTipoff;
import com.yizhi.application.entity.AssignmentComment;
import com.yizhi.comment.application.feign.PdfPagesClient;
import com.yizhi.application.mapper.AssignmentAnswerFileMapper;
import com.yizhi.application.mapper.AssignmentAnswerMapper;
import com.yizhi.application.orm.id.IdGenerator;
import com.yizhi.application.service.AssignmentAnswerFileService;
import com.yizhi.application.service.AssignmentAnswerThumbService;
import com.yizhi.system.application.system.remote.AccountClient;
import com.yizhi.util.application.constant.TpActivityType;
import com.yizhi.system.application.vo.AccountVO;
import com.yizhi.assignment.application.vo.AssignmentStudentExerciseBookListVO;
import com.yizhi.assignment.application.vo.apivo.ApiAssignmentCommentVO;
import com.yizhi.assignment.application.vo.apivo.ApiFileVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* @ClassName AssignmentExpriceBookController
* @Description TODO
* @Author shengchenglong
* @DATE 2019-10-22 11:15
* @Version 1.0
*/
@Api("作业本--学员端")
@RestController(value = "ApiAssignmentExerciseBookControllerRemote")
@RequestMapping("/api/assignment/exerciseBook")
public class ApiAssignmentExerciseBookController {
@Autowired
private AssignmentAnswerMapper assignmentAnswerMapper;
@Autowired
private AssignmentAnswerFileMapper assignmentAnswerFileMapper;
@Autowired
private AssignmentAnswerThumbService assignmentAnswerThumbService;
@Autowired
private AssignmentAnswerFileService assignmentAnswerFileService;
@Autowired
private AccountClient accountClient;
@Autowired
private IdGenerator idGenerator;
@Autowired
private PdfPagesClient pdfPagesClient;
@GetMapping("/page")
@ApiOperation("作业本列表(每个人对改作业提交的答案)")
public Page<AssignmentStudentExerciseBookListVO> list(
@ApiParam("作业id") @RequestParam("assignmentId") Long assignmentId,
@ApiParam("要跳转的页数") @RequestParam(name = "pageNo", defaultValue = "1") int pageNo,
@ApiParam("每页条数,默认:10") @RequestParam(name = "pageSize", defaultValue = "10") int pageSize) {
AssignmentAnswer answerObj = new AssignmentAnswer();
answerObj.setAssignmentId(assignmentId);
answerObj.setIsDown(0);
answerObj.setDeleted(0);
EntityWrapper<AssignmentAnswer> ew = new EntityWrapper<>(answerObj);
ew.orderBy("create_time", false);
// 提交次数 查询实体工具 obj
AssignmentAnswer answerObjForCommitTimes = new AssignmentAnswer();
answerObjForCommitTimes.setAssignmentId(assignmentId);
// 点赞次数 查询实体工具 obj
AssignmentAnswerThumb assignmentAnswerThumbObj = new AssignmentAnswerThumb();
assignmentAnswerThumbObj.setIsThumb(1);
Page<AssignmentAnswer> page = new Page<>(pageNo, pageSize);
page = answerObj.selectPage(page, ew);
if (page != null && CollectionUtils.isNotEmpty(page.getRecords())) {
List<AssignmentAnswer> answers = page.getRecords();
Page<AssignmentStudentExerciseBookListVO> resultPage = new Page<>(pageNo, pageSize);
resultPage.setTotal(page.getTotal());
List<AssignmentStudentExerciseBookListVO> resultVos = new ArrayList<>();
answers.forEach(answer -> {
AssignmentStudentExerciseBookListVO vo = new AssignmentStudentExerciseBookListVO();
vo.setAssignmentAnswerId(answer.getId());
answerObjForCommitTimes.setAccountId(answer.getAccountId());
vo.setCommitNum(answerObjForCommitTimes.selectCount(new EntityWrapper(answerObjForCommitTimes)));
vo.setCommitTime(answer.getCreateTime());
vo.setContent(answer.getContent());
assignmentAnswerThumbObj.setAssignmentAnswerId(answer.getId());
vo.setThumbpsTimes(assignmentAnswerThumbService.selectCount(new EntityWrapper<>(assignmentAnswerThumbObj)));
assignmentAnswerThumbObj.setAccountId(ContextHolder.get().getAccountId());
vo.setHasThumbUp(assignmentAnswerThumbService.selectCount(new EntityWrapper<>(assignmentAnswerThumbObj)) > 0);
List<ApiFileVo> fileList = assignmentAnswerFileMapper.listAssignmentAnswerFile(answer.getId(), 1);
try {
fileList.forEach(file -> {
exechangePages(file,file.getId(),TpActivityType.TYPE_ASSIGNMENT);
/*List<PdfPages> list = pdfPagesClient.list(file.getId(), TpActivityType.TYPE_ASSIGNMENT);
if (CollectionUtils.isNotEmpty(list)) {
file.setPdfPages(list);
}*/
});
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
vo.setFileVos(fileList);
AccountVO accountVO = getAccount(answer.getAccountId());
if (accountVO != null) {
vo.setAccountName(StringUtils.isEmpty(accountVO.getFullName()) ? accountVO.getName() : accountVO.getFullName());
vo.setHeadPortrait(accountVO.getHeadPortrait());
}
resultVos.add(vo);
assignmentAnswerThumbObj.setAssignmentAnswerId(null);
assignmentAnswerThumbObj.setAccountId(null);
});
resultPage.setRecords(resultVos);
return resultPage;
}
return new Page<>(pageNo, pageSize);
}
private void exechangePages(ApiFileVo file,Long id,Integer tpActivityType ) {
List<PdfPagesVo> list1 = pdfPagesClient.list(id, tpActivityType);
if (CollectionUtils.isNotEmpty(list1)) {
List<com.yizhi.assignment.application.vo.PdfPages> list = new ArrayList<>();
list1.forEach(pdfPages -> {
com.yizhi.assignment.application.vo.PdfPages pages = new com.yizhi.assignment.application.vo.PdfPages();
BeanUtils.copyProperties(pdfPages,pages);
list.add(pages);
});
file.setPdfPages(list);
}
}
@GetMapping("/thumbUp")
public boolean thumbup(@RequestParam("assignmentAnswerId") Long assignmentAnswerId,
@RequestParam("isThumbUp") boolean isThumbUp) {
AssignmentAnswerThumb assignmentAnswerThumbObj = new AssignmentAnswerThumb();
assignmentAnswerThumbObj.setAccountId(ContextHolder.get().getAccountId());
assignmentAnswerThumbObj.setAssignmentAnswerId(assignmentAnswerId);
AssignmentAnswerThumb oldOne = assignmentAnswerThumbObj.selectOne(new EntityWrapper(assignmentAnswerThumbObj));
if (oldOne != null) {
// assignmentAnswerThumbObj = new AssignmentAnswerThumb();
assignmentAnswerThumbObj.setIsThumb(isThumbUp ? 1 : 0);
assignmentAnswerThumbObj.setId(oldOne.getId());
return assignmentAnswerThumbObj.updateById();
}
assignmentAnswerThumbObj.setId(idGenerator.generate());
assignmentAnswerThumbObj.setCreateTime(new Date());
return assignmentAnswerThumbObj.insert();
}
@GetMapping("/comment/page")
@ApiOperation("评论列表")
public Page<ApiAssignmentCommentVO> commentPage(
@RequestParam("assignmentAnswerId") Long assignmentAnswerId,
@ApiParam("要跳转的页数") @RequestParam(name = "pageNo", defaultValue = "1") int pageNo,
@ApiParam("每页条数,默认:10") @RequestParam(name = "pageSize", defaultValue = "10") int pageSize
) {
Page<AssignmentComment> page = new Page(pageNo, pageSize);
AssignmentComment comment = new AssignmentComment();
comment.setAuditStatus(0);
comment.setDeleted(0);
comment.setAssignmentAnswerId(assignmentAnswerId);
EntityWrapper<AssignmentComment> ew = new EntityWrapper<>(comment);
ew.orderBy("create_time", false);
page = comment.selectPage(page, ew);
if (page != null && CollectionUtils.isNotEmpty(page.getRecords())) {
List<ApiAssignmentCommentVO> vos = new ArrayList<>();
page.getRecords().forEach(item -> {
ApiAssignmentCommentVO vo = new ApiAssignmentCommentVO();
vo.setCommentId(item.getId());
vo.setContent(item.getContent());
vo.setCreateTime(item.getCreateTime());
AccountVO accountVO = getAccount(item.getCreateById());
if (accountVO != null) {
vo.setCreateByName(StringUtils.isEmpty(accountVO.getFullName()) ? accountVO.getName() : accountVO.getFullName());
}
if (item.getParentCreateById() != null) {
accountVO = getAccount(item.getParentCreateById());
if (accountVO != null) {
vo.setParentCreateByName(StringUtils.isEmpty(accountVO.getFullName()) ? accountVO.getName() : accountVO.getFullName());
}
}
vos.add(vo);
});
Page<ApiAssignmentCommentVO> resultPage = new Page<>(pageNo, pageSize);
resultPage.setTotal(page.getTotal());
resultPage.setRecords(vos);
return resultPage;
}
return new Page<>(pageNo, pageSize);
}
@GetMapping("/comment/add")
@ApiOperation("进行评论")
public Boolean commentAdd(
@RequestParam("assignmentAnswerId") Long assignmentAnswerId,
@RequestParam(name = "parentCommentId", required = false) Long parentCommentId,
@RequestParam("content") String content
) {
AssignmentComment comment = new AssignmentComment();
comment.setAssignmentAnswerId(assignmentAnswerId);
comment.setCompanyId(ContextHolder.get().getCompanyId());
comment.setContent(content);
comment.setCreateById(ContextHolder.get().getAccountId());
comment.setCreateByName(ContextHolder.get().getAccountName());
comment.setId(idGenerator.generate());
comment.setOrgId(ContextHolder.get().getOrgId());
if (parentCommentId != null) {
AssignmentComment parent = new AssignmentComment();
parent.setId(parentCommentId);
parent = parent.selectById();
if (parent != null) {
comment.setParentId(parentCommentId);
comment.setParentCreateById(parent.getCreateById());
}
}
comment.setCreateTime(new Date());
comment.setSiteId(ContextHolder.get().getSiteId());
return comment.insert();
}
@PostMapping("/tipoff")
public Boolean tipoff(@RequestBody AssignmentAnswerTipoff record) {
record.setId(idGenerator.generate());
record.setCreateById(ContextHolder.get().getAccountId());
record.setCreateByName(ContextHolder.get().getAccountName());
record.setCreateTime(new Date());
record.setIsNew(1);
return record.insert();
}
private AccountVO getAccount(long accountId) {
AccountVO accountVO = accountClient.findById(accountId);
return accountVO;
}
}
package com.yizhi.application.controller.api;
import com.yizhi.core.application.context.ContextHolder;
import com.yizhi.core.application.context.RequestContext;
import com.yizhi.application.mapper.AssignmentMapper;
import com.yizhi.util.application.num.NumUtil;
import com.yizhi.assignment.application.vo.MinimbaAssignmentVO;
import com.yizhi.assignment.application.vo.MinimbaStudyRecordVO;
import com.yizhi.assignment.application.vo.MinimbaUserDetailParamVO;
import com.yizhi.assignment.application.vo.MinimbaUserDetailVO;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
* @Author: ding
* @Date: 2019/10/24
*/
@RequestMapping("/assignment/minimba")
@RestController(value = "MinimbaControllerRemote")
public class MinimbaController {
private static final Logger logger = LoggerFactory.getLogger(MinimbaController.class);
@Autowired
private AssignmentMapper assignmentMapper;
@PostMapping("/userDetails")
public MinimbaUserDetailVO getUserDetails(@RequestBody MinimbaUserDetailParamVO paramVO) {
paramVO.getIsRealTime();
RequestContext context = ContextHolder.get();
MinimbaUserDetailVO vo = assignmentMapper.userDetail(paramVO, context.getSiteId(), context.getCompanyId(), context.getAccountId());
int allNum = assignmentMapper.selectCountAllPlan(paramVO);
int finishedNum = assignmentMapper.selectCountFinishedPlan(context.getAccountId(), paramVO);
String percentage = NumUtil.getPercentage(finishedNum, allNum, 0);
int res = Integer.parseInt(percentage.replace("%", ""));
vo.setPercentage(res);
return vo;
}
@GetMapping("/studyingRecords")
public List<MinimbaStudyRecordVO> getProjectStudyingRecords(Long projectId) {
List<MinimbaStudyRecordVO> vos = assignmentMapper.getMinimbaStudyRecordVO(projectId);
List<MinimbaStudyRecordVO> resultList = new ArrayList<>();
RequestContext res = ContextHolder.get();
if (CollectionUtils.isNotEmpty(vos)) {
vos.forEach(vo -> {
// vo.setCourseScore(assignmentMapper.selectScore(vo.getCourseId()));
// vo.setCourseStudyDuration(String.valueOf(assignmentMapper.selectSeconds(vo.getCourseId())));
List<MinimbaAssignmentVO> assignmentVOList = assignmentMapper.getMinimbaAssignmentVO(vo.getPlanId(), res.getAccountId());
Long examId = assignmentMapper.getPlanExamId(vo.getPlanId());
vo.setExamId(examId);
if (CollectionUtils.isNotEmpty(assignmentVOList)) {
vo.setAssignmentAnswerList(assignmentVOList);
resultList.add(vo);
}
});
}
return resultList;
}
}
package com.yizhi.application.controller.api;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.yizhi.application.entity.Assignment;
import com.yizhi.application.entity.AssignmentPoint;
import com.yizhi.application.service.AssignmentAnswerService;
import com.yizhi.application.service.AssignmentPointService;
import com.yizhi.application.service.AssignmentService;
import com.yizhi.application.service.AssignmentStudentService;
import com.yizhi.assignment.application.vo.AssignmentCalendarVO;
import com.yizhi.system.application.vo.CalendarTaskParamVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.plugins.Page;
import com.yizhi.assignment.application.vo.apivo.ApiAssignmentAnswerResultVo;
import com.yizhi.assignment.application.vo.apivo.ApiAssignmentAswerVO;
import com.yizhi.assignment.application.vo.apivo.ApiAssignmentDetailsVo;
import com.yizhi.assignment.application.vo.apivo.ApiAssignmentListResultVO;
import com.yizhi.assignment.application.vo.apivo.ApiAssignmentVO;
import com.yizhi.assignment.application.vo.apivo.ToOthersApi;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
/**
* @Author: shengchenglong
* @Date: 2018/3/7 13:59
*/
@Api(tags = "学员端作业接口")
@RestController(value = "StudentAssignmentController")
@RequestMapping("/api/assignment")
public class StudentAssignmentController {
@Autowired
private AssignmentService assignmentService;
@Autowired
private AssignmentAnswerService assignmentAnswerService;
@Autowired
private AssignmentStudentService assignmentStudentService;
@Autowired
private AssignmentPointService assignmentPointService;
@GetMapping("/my/answer/zip")
public String getStudentAnswerZipByAnswerId(@RequestParam(name="assignmentId")Long assignmentId,@RequestParam("answerId")Long answerId) {
return assignmentAnswerService.getStudentAnswerZipByAnswerId(assignmentId, answerId);
}
@GetMapping("/my/list")
@ApiOperation(value = "分页查询作业列表", notes = "分页查询作业列表")
public Page<ApiAssignmentListResultVO> list(
@ApiParam(name = "type", value = "类型(1:进行中,2:已完成)", required = true) @RequestParam(name = "type", defaultValue = "1") int type,
@ApiParam(name = "pageNo", value = "要跳转的页数", required = false) @RequestParam(name = "pageNo", defaultValue = "1") int pageNo,
@ApiParam(name = "pageSize", value = "每页条数,默认:10", required = false) @RequestParam(name = "pageSize", defaultValue = "10") int pageSize,
@ApiParam(name = "accountId", value = "用户id", required = true) @RequestParam(name = "accountId") Long accountId,
@ApiParam(name = "relationIds", value = "关联ids", required = true) @RequestParam(name = "relationIds") List<Long> relationIds,
@ApiParam(name = "siteId", value = "站点id", required = true) @RequestParam(name = "siteId") Long siteId,
@ApiParam(name = "companyId", value = "公司id", required = true) @RequestParam(name = "companyId") Long companyId) {
Page<ApiAssignmentListResultVO> page = null;
if (type == 1) { page = assignmentService.listUnfinishedAssignment(pageNo, pageSize,accountId,relationIds,companyId,siteId); }
if (type == 2) { page = assignmentService.listFinishedAssignment(pageNo, pageSize,accountId,relationIds,companyId,siteId); }
return page;
}
@GetMapping("/my/list/search")
@ApiOperation(value = "分页查询作业列表(按照条件查 )", notes = "分页查询作业列表(按照条件查)")
public Page<ApiAssignmentListResultVO> listSearch(
@ApiParam(name = "name", value = "关键字", required = false) @RequestParam(name = "name",required=false) String name,
@ApiParam(name = "pageNo", value = "要跳转的页数", required = false) @RequestParam(name = "pageNo", defaultValue = "1") int pageNo,
@ApiParam(name = "pageSize", value = "每页条数,默认:10", required = false) @RequestParam(name = "pageSize", defaultValue = "10") int pageSize,
@ApiParam(name = "accountId", value = "用户id", required = true) @RequestParam(name = "accountId") Long accountId,
@ApiParam(name = "relationIds", value = "关联ids", required = true) @RequestParam(name = "relationIds") List<Long> relationIds,
@ApiParam(name = "siteId", value = "站点id", required = true) @RequestParam(name = "siteId") Long siteId) {
return assignmentService.listAllAssignmentByName(name, pageNo, pageSize,accountId,relationIds,siteId);
}
@GetMapping("/my/answer/list")
@ApiOperation(value = "答案列表", notes = "答案列表")
public ApiAssignmentAnswerResultVo answerList(@RequestParam(name = "assignmentId") Long assignmentId,
@RequestParam(name = "accountId") Long accountId) {
return assignmentAnswerService.getAnswerList(assignmentId, accountId);
}
@GetMapping("/my/getAssignment")
@ApiOperation(value="作业详情列表",notes="作业详情列表")
public ApiAssignmentVO getAssignment(@ApiParam(name = "assignmentId", value = "作业id", required = true) @RequestParam(name = "assignmentId") Long assignmentId,
@ApiParam(name = "accountId", value = "学员账号", required = true) @RequestParam(name = "accountId") Long accountId) {
return assignmentService.getAssignment(assignmentId,accountId);
}
@GetMapping("/my/toAssignment")
@ApiOperation(value = "查看某一份答案详细信息", notes = "查看某一份答案详细信息")
public ApiAssignmentDetailsVo toAssignment(@ApiParam(name = "assignmentId", value = "作业id", required = true) @RequestParam(name = "assignmentId") Long assignmentId,
@ApiParam(name = "answerId", value = "答案Id", required = true) @RequestParam(name = "answerId") Long answerId,
@ApiParam(name = "accountId", value = "学员账号", required = true) @RequestParam(name = "accountId") Long accountId) {
return assignmentAnswerService.toAssignment(assignmentId,answerId,accountId);
}
@PostMapping("/my/can/submit")
@ApiOperation(value="判断作业是都可以提交")
public Integer canSubmit(@RequestBody ApiAssignmentAswerVO assignmentAswerVO) {
return assignmentAnswerService.canSubmitAssignmentAnswer(assignmentAswerVO);
}
@PostMapping("/my/submit")
@ApiOperation(value = "作业提交", notes = "作业提交 ")
public Boolean submit(@RequestBody ApiAssignmentAswerVO assignmentAswerVO) {
return assignmentAnswerService.submitAssignmentAnswer(assignmentAswerVO);
}
/* @GetMapping("/my/suggestion/get")
@ApiOperation(value = "查看作业评阅详细信息", notes = "查看作业评阅详细信息")
public ApiSuggestionVo getSuggesstion(@ApiParam(name = "assignmentId", value = "作业id", required = true) @RequestParam(name = "assignmentId") Long assignmentId,
@ApiParam(name = "accountId", value = "用户id", required = true) @RequestParam(name = "accountId") Long accountId) {
return assignmentAnswerService.getMyAnswerDetailsByAssignmentId(assignmentId,accountId);
}*/
@GetMapping("/my/list/search/others")
@ApiOperation(value = "分页查询作业列表(给门户用)", notes = "分页查询作业列表(给门户用)")
public List<ToOthersApi> listSearchOthers(
@ApiParam(name = "name", value = "关键字", required = false) @RequestParam(name = "name",required=false) String name,
@ApiParam(name = "pageNo", value = "要跳转的页数", required = false) @RequestParam(name = "pageNo", defaultValue = "1") int pageNo,
@ApiParam(name = "pageSize", value = "每页条数,默认:10", required = false) @RequestParam(name = "pageSize", defaultValue = "10") int pageSize,
@ApiParam(name = "accountId", value = "用户id", required = true) @RequestParam(name = "accountId") Long accountId,
@ApiParam(name = "relationIds", value = "关联ids", required = true) @RequestParam(name = "relationIds") List<Long> relationIds,
@ApiParam(name = "siteId", value = "站点id", required = true) @RequestParam(name = "siteId") Long siteId) {
return assignmentService.listSearchOthers(name, pageNo, pageSize, accountId, relationIds, siteId);
}
@GetMapping("/my/assignment/num")
@ApiOperation(value="根据账号id查到分发给此人的作业没有提交答案的个数",notes="根据账号id查到分发给此人的作业没有提交答案的个数")
public Integer getAssignmentNumByAccountId(@ApiParam(name="relationIds",value="关联的账号Ids")@RequestParam(name="relationIds",required=false)List<Long> relationIds,@ApiParam(name="siteId",value="站点id")@RequestParam(name="siteId",required=true)Long siteId,@ApiParam(name="accountId",value="账号id")@RequestParam(name="accountId",required=true)Long accountId) {
return assignmentStudentService.getAssignmentNumByAccountId(relationIds,siteId,accountId);
}
@GetMapping("/my/toAssignmentActivity")
@ApiOperation(value="根据id查到作业,门户用到",notes="根据id查到作业,门户用到")
public Assignment toAssignmentActivity(@RequestParam(name = "assignmentId") Long assignmentId) {
return assignmentService.selectById(assignmentId);
}
/*@PostMapping("/update/trainningProject")
@ApiOperation(value="作业挂靠到培训项目",notes="作业挂靠到培训项目")
public Boolean update(@RequestParam(name = "assignmentId") Long assignmentId) {
return assignmentService.selectById(assignmentId);
}*/
@GetMapping("/training/point")
@ApiOperation(value = "培训项目需要的培训积分")
public Map<String, Integer> getTrainingPoint(@RequestParam(name = "ids") List<Long> ids) {
AssignmentPoint assignmentPoint = assignmentPointService.getTrainingPoint(ids);
Map<String, Integer> map = null;
if (assignmentPoint != null) {
map = new HashMap<String, Integer>(2);
map.put("minPoint", assignmentPoint.getMinScore());
map.put("maxPoint", assignmentPoint.getMaxScore());
}
return map;
}
@PostMapping("/getPageToCalendar")
public Page<AssignmentCalendarVO> getPageToCalendar(@ApiParam("paramVo") @RequestBody CalendarTaskParamVo paramVo){
Page<Assignment> page = new Page(paramVo.getPageNo(), paramVo.getPageSize());
return assignmentService.getPageToCalendar(paramVo.getDate(),page);
}
}
package com.yizhi.application.controller.manage;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.yizhi.application.entity.*;
import com.yizhi.application.orm.id.IdGenerator;
import com.yizhi.application.service.*;
import com.yizhi.assignment.application.vo.*;
import com.yizhi.assignment.application.vo.apivo.ApiAssignmentAnswerCheckVO;
import com.yizhi.assignment.application.vo.apivo.AssignmentTrainingProject;
import com.yizhi.core.application.context.ContextHolder;
import com.yizhi.core.application.context.RequestContext;
import com.yizhi.core.application.vo.DroolsVo;
import com.yizhi.system.application.system.remote.AccountClient;
import com.yizhi.util.application.domain.Response;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @Author: shengchenglong
* @Date: 2018/3/7 13:59
*/
@Api(tags = "ManageAssignmentController", description = "后台管理作业接口")
@RestController(value = "ManageAssignmentControllerRemote")
@RequestMapping("/assignment")
public class ManageAssignmentController {
private static final Logger logger = LoggerFactory.getLogger(ManageAssignmentController.class);
@Autowired
private AssignmentStudentService assignmentStudentService;
@Autowired
private AssignmentContentService assignmentcontentService;
@Autowired
private AssignmentService assignmentService;
@Autowired
private AssignmentFileService assignmentFileService;
@Autowired
private AssignmentAnswerService assignmentAnswerService;
@Autowired
private AssignmentAnswerFileService answerFileService;
@Autowired
private AssignmentAnswerSuggestionService assignmentAnswerSuggestionService;
@Autowired
private AssignmentAuditorService assignmentAuditorService;
@Autowired
private IdGenerator idGenerator;
@Autowired
private AssignmentGradeService assignmentGradeService;
@Autowired
private AssignmentPointService assignmentPointService;
@Autowired
private AccountClient accountClient;
@ApiOperation(value = "生成作业id", notes = "生成作业id")
@GetMapping("/setid")
public Long setId() {
return idGenerator.generate();
}
@ApiOperation(value = "作业新建接口", notes = "新建作业保存")
@PostMapping("/save")
public Boolean save(@ApiParam(name = "AssignmentVo", value = "作业新建入参对象", required = true) @RequestBody AssignmentSaveParamVo assignmentVo) {
return assignmentService.save(assignmentVo);
}
@ApiOperation(value = "作业列表接口", notes = "分页查询作业列表")
@GetMapping("/list")
public Page<AssignmentListVO> list(@RequestParam(value = "currentTime", required = false) String currentTime,
@RequestBody AssignmentListVoTo assignmentListVoTo) {
List<AssignmentListVO> listVo = new ArrayList<AssignmentListVO>();
Page<Assignment> page = assignmentService.assignmentList(currentTime, assignmentListVoTo);
if (page != null) {
List<Assignment> listAssignmentList = page.getRecords();
for (int i = 0; i < listAssignmentList.size(); i++) {
AssignmentListVO assignmentListVO = new AssignmentListVO();
assignmentListVO.setId(listAssignmentList.get(i).getId()); // 作业id
assignmentListVO.setSerialNum(listAssignmentList.get(i).getSerialNum()); // 作业序号
assignmentListVO.setName(listAssignmentList.get(i).getName()); // 作业名字
assignmentListVO.setTraingProjectId(listAssignmentList.get(i).getTrainingProjectId());
assignmentListVO.setStatus(listAssignmentList.get(i).getStatus()); // 作业状态
assignmentListVO.setEndDate(listAssignmentList.get(i).getFinishTime());
assignmentListVO.setVisibleRange(listAssignmentList.get(i).getVisibleRange());
assignmentListVO.setImage(listAssignmentList.get(i).getImage());
assignmentListVO.setSubmitNum(assignmentAnswerService.submitNum(listAssignmentList.get(i).getId(),assignmentListVoTo.getAccountIds())); // 提交数量
assignmentListVO.setNoRead(assignmentAnswerService.noRead(listAssignmentList.get(i).getId(),assignmentListVoTo.getAccountIds()));
listVo.add(assignmentListVO);
}
Page<AssignmentListVO> page1 = new Page<AssignmentListVO>();
page1.setTotal(page.getTotal());
page1.setCurrent(assignmentListVoTo.getPageNo());
page1.setSize(assignmentListVoTo.getPageSize());
page1.setRecords(listVo);
return page1;
}
return new Page<>();
}
@ApiOperation(value = "作业删除接口", notes = "作业删除")
@PostMapping("/delete")
public Boolean delete(@ApiParam(name = "AssignmentDeleteVO", value = "作业删除入参对象", required = true) @RequestBody AssignmentDeleteVO assignmentDelete) {
return assignmentService.updateDelete(assignmentDelete);
}
/* @GetMapping("/content/find")
@ApiOperation(value = "查看老师布置得作业的主键id查看作业具体内容", notes = "查看作业内容")
public AssignmentSelectVo query(@ApiParam(name = "assignmentId", value = "作业id主键", required = true) @RequestParam(name = "assignmentId", required = true) Long assignmentId) {
Assignment assignment = assignmentService.selectById(assignmentId);
AssignmentContent content = assignmentcontentService.findByAssignmentId(assignmentId);
List<AssignmentFile> assignmentFileList = assignmentFileService.listAssignmentFile(assignmentId);
List<AssignmentGrade> listGrade = assignmentGradeService.getListAssignmentGrade(assignmentId);
List<AssignmentPoint> listPoint = assignmentPointService.getListAssignmentPoint(assignmentId);
//组装数据
AssignmentSelectVo assignmentSelectVo = new AssignmentSelectVo();
if (assignment != null) {
assignmentSelectVo.setId(assignment.getId());
assignmentSelectVo.setName(assignment.getName());
assignmentSelectVo.setFinishTime(assignment.getFinishTime());
assignmentSelectVo.setAmendable(assignment.getAmendable());
assignmentSelectVo.setVisibleRange(assignment.getVisibleRange());
assignmentSelectVo.setType(assignment.getType());
assignmentSelectVo.setPassScore(assignment.getPassScore());
assignmentSelectVo.setCount(assignment.getCount());
assignmentSelectVo.setEnableRemind(assignment.getEnableRemind());
assignmentSelectVo.setAnswerAttachmentNumMax(assignment.getAnswerAttachmentNumMax());
assignmentSelectVo.setAnswerAttachmentNumMin(assignment.getAnswerAttachmentNumMin());
assignmentSelectVo.setAnswerCharaterNumMax(assignment.getAnswerCharaterNumMax());
assignmentSelectVo.setAnswerCharaterNumMin(assignment.getAnswerCharaterNumMin());
assignmentSelectVo.setShowRes(assignment.getShowRes());
assignmentSelectVo.setEnableExerciseBook(assignment.getEnableExerciseBook());
assignmentSelectVo.setKeywords(assignment.getKeywords());
assignmentSelectVo.setImage(assignment.getImage());
assignmentSelectVo.setEnableTask(assignment.getEnableTask());
assignmentSelectVo.setTaskStartDate(assignment.getTaskStartDate());
assignmentSelectVo.setTaskEndDate(assignment.getTaskEndDate());
}
if (content != null) {
assignmentSelectVo.setContent(content.getComment());
}
assignmentSelectVo.setAssignmentFiles(assignmentFileList);
assignmentSelectVo.setListGrade(listGrade);
assignmentSelectVo.setListPoint(listPoint);
return assignmentSelectVo;
}
*/
/**
* 问题:根据部门关键字查到这个站点下此部门的员工的id的list accountIdList
*/
@ApiOperation(value = "一个作业学员提交作业列表", notes = "学生作业列表")
@GetMapping(value = "/answer/list")
public Page<AssignmentReadListVO> assignmentAnswerList(
@ApiParam(name = "assignmentId", value = "老师布置作业的id", required = true) @RequestParam(name = "assignmentId", required = true) Long assignmentId,
@ApiParam(name = "state", value = "批阅状态(1:待阅,2:已阅,不传则为所有)", required = false) @RequestParam(name = "state", required = false) Integer state,
@ApiParam(name = "name", value = "用户名/姓名/标签") @RequestParam(name = "name", required = false) String name,
@ApiParam(name = "keywords", value = "部门关键字", required = false)
@RequestParam(name = "keywords", required = false) String keywords,
@RequestParam(name = "type", required = false,defaultValue = "1") Integer type,
@ApiParam(name = "pageNo", value = "要跳转的页数", required = false) @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@ApiParam(name = "pageSize", value = "每页条数,默认:10", required = false) @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
RequestContext context = ContextHolder.get();
Long accountId = context.getAccountId();
logger.info("上下信息1:{}", JSON.toJSON(context));
return assignmentAnswerService.assignmentAnswerList(keywords,name,assignmentId, accountId, state, type, pageNo, pageSize,null);
}
/**
* 查询作业列表
* @param answerListVo
* @return
*/
@PostMapping(value = "/manage/answer/list")
public Page<AssignmentReadListVO> manageAssignmentAnswerList(@RequestBody AnswerListVo answerListVo) {
RequestContext context = ContextHolder.get();
Long accountId = context.getAccountId();
logger.info("上下信息2:{}", JSON.toJSON(context));
logger.info("传参数2:{}",JSON.toJSON(answerListVo));
return assignmentAnswerService.assignmentAnswerList(answerListVo.getKeywords(),answerListVo.getName(),answerListVo.getAssignmentId(),
accountId, answerListVo.getState(), answerListVo.getType(), answerListVo.getPageNo(), answerListVo.getPageSize(),answerListVo.getAccountIds());
}
/*@ApiOperation(value = "获取单个学生答案", notes = "单个作业信息", response = Response.class)
@PostMapping("/marking/select")
public ApiAssignmentAnswerCheckVO getAssignmentAnswer(@ApiParam(name = "AssignmentAnswerMarkingSelectVO", value = "获取单个学生作业信息入参", required = true) @RequestBody AssignmentAnswerMarkingSelectVO assignmentAnswerMarkingSelect) {
RequestContext context = ContextHolder.get();
Long accountId = context.getAccountId();
List<AssignmentReadListVO> assignmentReadListVOList = assignmentAnswerService.getAssignmentAnswerIdList(assignmentAnswerMarkingSelect.getAccountIds(),assignmentAnswerMarkingSelect.getDepartment(), assignmentAnswerMarkingSelect.getName(), assignmentAnswerMarkingSelect.getAssignmentId(), accountId, assignmentAnswerMarkingSelect.getState(), assignmentAnswerMarkingSelect.getType()!=null ? assignmentAnswerMarkingSelect.getType() : 1);
logger.info("返回列表:{}",JSON.toJSON(assignmentReadListVOList));
ApiAssignmentAnswerCheckVO assignmentAnswerCheckVO = new ApiAssignmentAnswerCheckVO();
if (!CollectionUtils.isEmpty(assignmentReadListVOList)) {
List<Long> answerIds = assignmentReadListVOList.parallelStream().map(assignmentReadListVO -> {
return assignmentReadListVO.getId();
}).collect(Collectors.toList());
assignmentAnswerCheckVO.setAnswerIds(answerIds);
logger.info("返回的答案id的列表:{}",JSON.toJSON(answerIds));
}
Assignment assignment = assignmentService.selectById(assignmentAnswerMarkingSelect.getAssignmentId());
AssignmentAnswer assignmentAnswer = assignmentAnswerService.selectAssignmentAnswerById(assignmentAnswerMarkingSelect.getAssignmentAnswerId());
AssignmentAnswerSuggestion assignmentAnswerSuggestion = assignmentAnswerSuggestionService.selectSuggestionByAnswerId(assignmentAnswerMarkingSelect.getAssignmentAnswerId());
//答案文件
List<AssignmentAnswerFile> listAssignmentAnswerFile = answerFileService.listAssignmentAnswerFile(assignmentAnswerMarkingSelect.getAssignmentAnswerId());
//反馈文件
List<AssignmentAnswerFile> listAssignmentAnswerBackFile = answerFileService.listAssignmentAnswerBackFile(assignmentAnswerMarkingSelect.getAssignmentAnswerId());
//上一份答案id 下一份答案id 根据时间排序
// Long prevAnswerId = null;
// Long nextAnswerId = null;
*//*------------开始装数据---------------*//*
// ApiAssignmentAnswerCheckVO assignmentAnswerCheckVO = new ApiAssignmentAnswerCheckVO();
if (assignmentAnswer != null) {
assignmentAnswerCheckVO.setRealName(assignmentAnswer.getRealName() != null ? assignmentAnswer.getRealName() : assignmentAnswer.getAccountName());
assignmentAnswerCheckVO.setScore(assignmentAnswer.getScore());
assignmentAnswerCheckVO.setContent(assignmentAnswer.getContent());
// prevAnswerId = assignmentAnswerService.prevAnswerId(assignmentAnswer.getCreateTime(), assignmentAnswerMarkingSelect.getAssignmentId());
// nextAnswerId = assignmentAnswerService.nextAnswerId(assignmentAnswer.getCreateTime(), assignmentAnswerMarkingSelect.getAssignmentId());
}
if (assignment != null) {
assignmentAnswerCheckVO.setPassScore(assignment.getPassScore());
}
assignmentAnswerCheckVO.setListAssignmentAnswerFile(listAssignmentAnswerFile);
if (assignmentAnswerSuggestion != null) {
assignmentAnswerCheckVO.setSuggestion(assignmentAnswerSuggestion.getSuggestion());
}
assignmentAnswerCheckVO.setListAssignmentAnswerBackFile(listAssignmentAnswerBackFile);
// assignmentAnswerCheckVO.setPrevAnswerId(prevAnswerId);
// assignmentAnswerCheckVO.setNextAnswerId(nextAnswerId);
*//**
* 废弃字段-------????????????
*//*
List<String> fileUrl = new ArrayList<String>();
fileUrl.add("废弃字段1--A");
fileUrl.add("废弃字段1--B");
fileUrl.add("废弃字段1--C");
List<AssignmentGrade> gradesList = new ArrayList<AssignmentGrade>();
AssignmentGrade g1 = new AssignmentGrade();
AssignmentGrade g2 = new AssignmentGrade();
gradesList.add(g1);
gradesList.add(g2);
String grade = "废弃字段3";
assignmentAnswerCheckVO.setFileUrl(fileUrl);
assignmentAnswerCheckVO.setGrades(gradesList);
assignmentAnswerCheckVO.setGrade(grade);
return assignmentAnswerCheckVO;
}
*/
@ApiOperation(value = "学员名单添加学员接口", notes = "添加学员", response = Response.class)
@PostMapping("/student/add")
public Boolean insert(@ApiParam(name = "listStudent", value = "添加学员", required = true) @RequestBody ListStudent listStudent) {
return assignmentStudentService.add(listStudent);
}
/**
* 添加关联学员,之前记录不删除
*
* @param assignmentStudents
* @return
*/
@PostMapping("/student/insert")
public Boolean insertStudentRelation(@RequestBody List<AssignmentStudent> assignmentStudents) {
return assignmentStudentService.insertStudentRelation(assignmentStudents);
}
@ApiOperation(value = "查看已关联的学员名单", notes = "已关联的学员名单")
@GetMapping("/student/relation")
public List<AssignmentStudent> studentRelation(@ApiParam(name = "assignmentId", value = "作业id主键", required = true) @RequestParam(name = "assignmentId", required = true) Long assignmentId) {
return assignmentStudentService.relation(assignmentId);
}
@ApiOperation(value = "上架下架", notes = "上架下架")
@PostMapping("/status/update")
public Boolean update(@ApiParam(name = "assignmentUpAndDown", value = "上架下架", required = true) @RequestBody AssignmentUpAndDownVO assignmentUpAndDown) {
return assignmentService.update(assignmentUpAndDown.getId(), assignmentUpAndDown.getStatus(), assignmentUpAndDown.getAccountId(), assignmentUpAndDown.getAccountName());
}
@ApiOperation(value = "作业批阅接口", notes = "老师批阅学生作业批阅保存")
@PostMapping("/marking/save")
public PointParamVO readSave(@ApiParam(name = "assignmentAnswerContentVO", value = "老师批阅学生作业批阅保存", required = true) @RequestBody AssignmentAnswerContentVO assignmentAnswerContentVO) {
return assignmentService.assignmentReadOverByTeacher(assignmentAnswerContentVO);
}
@ApiOperation(value = "查看评阅人", notes = "查看评阅人")
@GetMapping("/auditor/relation")
public List<Long> getAuditor(@ApiParam(name = "assignmentId", value = "作业id", required = true) @RequestParam(name = "assignmentId", required = true) Long assignmentId) {
return assignmentAuditorService.relationAuditor(assignmentId);
}
@ApiOperation(value = "设置评阅人", notes = "设置评阅人")
@PostMapping("/auditor/insert")
public Boolean setAuditor(@ApiParam(name = "ListAuditor", value = "ListAuditor") @RequestBody ListAuditor listAuditor) {
return assignmentAuditorService.auditorInsert(listAuditor);
}
@ApiOperation(value = "导出作业批阅结果", notes = "导出作业批阅结果")
@PostMapping("/export/suggetion/get")
public AssignmentAnswerListExport exportResultExcel(@RequestBody DownloadAnswerVO vo) {
Long assignmentId = vo.getAssignmentId();
List<Long> answerIds = vo.getAnswerIds();
return assignmentAnswerService.exportResultExcel(assignmentId, answerIds);
}
@ApiOperation(value = "导出未提交作业的名单", notes = "导出未提交作业的名单")
@GetMapping("/export/unsubmit/get")
public AssignmentQXVO getQXSubmitMessage(@ApiParam(value = "作业的Id", name = "作业的Id", required = true) @RequestParam(name = "assignmentId", required = true) Long assignmentId) {
return assignmentService.getQXSubmitMessage(assignmentId);
}
@ApiOperation(value = "批量下载作业", notes = "批量下载作业")
@PostMapping("/export/assignment/get")
public List<AnswersDownVO> exportAssignmentZip(@RequestBody DownloadAnswerVO vo) {
Long assignmentId = vo.getAssignmentId();
List<Long> answerIds = vo.getAnswerIds();
return assignmentAnswerService.getAnswerIdsDown(assignmentId, answerIds);
}
@ApiOperation(value = "下载学生作业", notes = "学生作业id列表")
@GetMapping("/download/batch")
public List<List<AssignmentAnswerFile>> getAssignmentAnswerList(@ApiParam(name = "ids", value = "学生作业主键", required = true) @RequestParam(name = "ids") List<Long> ids) {
return answerFileService.selectAssignmentAnswerFileById(ids);
}
@ApiOperation(value = "根据账号id查询到此学员下的作业个数", notes = "根据账号id查询到此学员下的作业个数")
@GetMapping("/select/assignmentNum/byAccountId")
public Integer selectAssignmentNumByAcountId(@ApiParam(name = "accountId", value = "账号id", required = true) @RequestParam(name = "accountId", required = true) Long accountId) {
return assignmentService.selectAssignmentNumByAccountId(accountId);
}
@ApiOperation(value = "可见范围导出", notes = "可见范围导出")
@GetMapping("/export/visiblRange")
public VisibleRangeExport vsibleRangeExport(@ApiParam(value = "作业的Id", name = "作业的Id", required = true) @RequestParam(name = "assignmentId", required = true) Long assignmentId) {
return assignmentService.vsibleRangeExport(assignmentId);
}
@ApiOperation(value = "作业挂到培训项目")
@PostMapping("/updateTrainingProject/byAssignmentId")
public boolean updateTrainingProjectByAssignmentId(@RequestBody AssignmentTrainingProject atp) {
logger.info(atp.toString());
logger.info("培训项目的id{},培训项目的名字{},培训项目的作业集合{}", atp.getProjectId(), atp.getProjectName(), atp.getListAssignmentIds());
return assignmentService.updateAssignmentTp(atp);
}
@GetMapping(value = "/by/new/server")
public List<Map<String, Object>> getServerByCompanyIdAndIds(@RequestParam("companyId") Long companyId, @RequestParam(value = "ids", required = false) List<Long> ids) {
return assignmentService.getServerByCompanyIdAndIds(companyId, ids);
}
@GetMapping(value = "/by/siteId/and/assignmentId/and/accountId")
public List<Long> getListIdsBySiteIdAndAssignmentIdsAndAccountId(@RequestParam("sitId") Long siteId, @RequestParam("accountId") Long accountId, @RequestParam("ids") List<Long> ids) {
return assignmentAnswerService.getListIdsBySiteIdAndAssignmentIdsAndAccountId(siteId, accountId, ids);
}
@GetMapping(value = "/delete/relation")
public void deleteRelation(@RequestParam(name = "assignmentId", required = true) Long assignmentId) {
assignmentService.delete(assignmentId);
}
/**
* 经验池作业列表
*
* @param name
* @param ids
* @param pageNo
* @param pageSize
* @return
*/
@PostMapping("/experiencePoolList")
public Page<Map<String, Object>> experiencePoolList(@RequestParam(value = "name", required = false) String name,
@RequestBody List<Long> ids,
@RequestParam(value = "pageNo", required = false) Integer pageNo,
@RequestParam(value = "pageSize", required = false) Integer pageSize) {
return assignmentService.experiencePoolList(name, ids, pageNo, pageSize);
}
/**
* 查询作业完成的学员
*
* @param assignmentId
* @return
*/
@GetMapping("/finishAccountIds")
public List<Long> getFinishedAccountIds(@RequestParam("assignmentId") Long assignmentId, @RequestParam("siteId") Long siteId, @RequestParam("companyId") Long companyId) {
return assignmentAnswerService.getFinishedAccountIds(assignmentId, siteId, companyId);
}
/**
* 查询作业分数
*
* @param assignmentId
* @return
*/
@GetMapping("/getScore")
public Integer getScore(@RequestParam("assignmentId") Long assignmentId, @RequestParam("siteId") Long siteId, @RequestParam("companyId") Long companyId, @RequestParam("accountId") Long accountId) {
return assignmentAnswerService.getScore(assignmentId, siteId, companyId, accountId);
}
@GetMapping("/visibleRange")
public List<AssignmentStudent> VisibleRange(@RequestParam("assignmentId") Long assignmentId) {
AssignmentStudent assignmentStudent = new AssignmentStudent();
assignmentStudent.setAssignmentId(assignmentId);
EntityWrapper<AssignmentStudent> wrapper = new EntityWrapper<AssignmentStudent>(assignmentStudent);
return assignmentStudentService.selectList(wrapper);
}
@GetMapping("/get")
public Assignment get(@RequestParam("assignmentId") Long assignmentId) {
return assignmentService.selectById(assignmentId);
}
@PostMapping("/verifyVedio")
public boolean verifyVedio(@RequestBody List<Long> answerFileIds) {
int num = answerFileService.verifyVideo(answerFileIds);
return num == answerFileIds.size();
}
@PostMapping("updateVedioTranscodeUrl")
public boolean updateVedioTranscodeUrl(@RequestBody Map<String, String> map) {
AssignmentAnswerFile file = new AssignmentAnswerFile();
Long id = Long.valueOf(map.get("id"));
file.setId(id);
file.setVideoLd(map.get("ld"));
file.setVideoHd(map.get("hd"));
file.setVideoSd(map.get("sd"));
return answerFileService.updateById(file);
}
@GetMapping("/getPageByDrools")
Page<DroolsVo> getPageByDrools(@RequestParam("field") String field,
@RequestParam(value = "value", required = false) String value,
@RequestParam("pageNo") Integer pageNo,
@RequestParam("pageSize") Integer pageSize) {
Page<DroolsVo> page = new Page<>(pageNo, pageSize);
return assignmentService.getPageByDrools(field, value, page);
}
}
package com.yizhi.application.controller.remote;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.yizhi.assignment.application.vo.PdfPages;
import com.yizhi.comment.application.vo.domain.PdfPagesVo;
import com.yizhi.core.application.context.ContextHolder;
import com.yizhi.application.entity.AssignmentAnswer;
import com.yizhi.application.entity.AssignmentAnswerThumb;
import com.yizhi.application.entity.AssignmentAnswerTipoff;
import com.yizhi.application.entity.AssignmentComment;
import com.yizhi.comment.application.feign.PdfPagesClient;
import com.yizhi.application.mapper.AssignmentAnswerFileMapper;
import com.yizhi.application.mapper.AssignmentAnswerMapper;
import com.yizhi.application.orm.id.IdGenerator;
import com.yizhi.application.service.AssignmentAnswerFileService;
import com.yizhi.application.service.AssignmentAnswerThumbService;
import com.yizhi.system.application.system.remote.AccountClient;
import com.yizhi.util.application.constant.TpActivityType;
import com.yizhi.system.application.vo.AccountVO;
import com.yizhi.assignment.application.vo.AssignmentStudentExerciseBookListVO;
import com.yizhi.assignment.application.vo.apivo.ApiAssignmentCommentVO;
import com.yizhi.assignment.application.vo.apivo.ApiFileVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* @ClassName AssignmentExpriceBookController
* @Description TODO
* @Author shengchenglong
* @DATE 2019-10-22 11:15
* @Version 1.0
*/
@Api("作业本--学员端")
@RestController
@RequestMapping("/remote/api/assignment/exerciseBook")
public class ApiAssignmentExerciseBookController {
@Autowired
private AssignmentAnswerMapper assignmentAnswerMapper;
@Autowired
private AssignmentAnswerFileMapper assignmentAnswerFileMapper;
@Autowired
private AssignmentAnswerThumbService assignmentAnswerThumbService;
@Autowired
private AssignmentAnswerFileService assignmentAnswerFileService;
@Autowired
private AccountClient accountClient;
@Autowired
private IdGenerator idGenerator;
@Autowired
private PdfPagesClient pdfPagesClient;
@GetMapping("/page")
@ApiOperation("作业本列表(每个人对改作业提交的答案)")
public Page<AssignmentStudentExerciseBookListVO> list(
@ApiParam("作业id") @RequestParam("assignmentId") Long assignmentId,
@ApiParam("要跳转的页数") @RequestParam(name = "pageNo", defaultValue = "1") int pageNo,
@ApiParam("每页条数,默认:10") @RequestParam(name = "pageSize", defaultValue = "10") int pageSize) {
AssignmentAnswer answerObj = new AssignmentAnswer();
answerObj.setAssignmentId(assignmentId);
answerObj.setIsDown(0);
answerObj.setDeleted(0);
EntityWrapper<AssignmentAnswer> ew = new EntityWrapper<>(answerObj);
ew.orderBy("create_time", false);
// 提交次数 查询实体工具 obj
AssignmentAnswer answerObjForCommitTimes = new AssignmentAnswer();
answerObjForCommitTimes.setAssignmentId(assignmentId);
// 点赞次数 查询实体工具 obj
AssignmentAnswerThumb assignmentAnswerThumbObj = new AssignmentAnswerThumb();
assignmentAnswerThumbObj.setIsThumb(1);
Page<AssignmentAnswer> page = new Page<>(pageNo, pageSize);
page = answerObj.selectPage(page, ew);
if (page != null && CollectionUtils.isNotEmpty(page.getRecords())) {
List<AssignmentAnswer> answers = page.getRecords();
Page<AssignmentStudentExerciseBookListVO> resultPage = new Page<>(pageNo, pageSize);
resultPage.setTotal(page.getTotal());
List<AssignmentStudentExerciseBookListVO> resultVos = new ArrayList<>();
answers.forEach(answer -> {
AssignmentStudentExerciseBookListVO vo = new AssignmentStudentExerciseBookListVO();
vo.setAssignmentAnswerId(answer.getId());
answerObjForCommitTimes.setAccountId(answer.getAccountId());
vo.setCommitNum(answerObjForCommitTimes.selectCount(new EntityWrapper(answerObjForCommitTimes)));
vo.setCommitTime(answer.getCreateTime());
vo.setContent(answer.getContent());
assignmentAnswerThumbObj.setAssignmentAnswerId(answer.getId());
vo.setThumbpsTimes(assignmentAnswerThumbService.selectCount(new EntityWrapper<>(assignmentAnswerThumbObj)));
assignmentAnswerThumbObj.setAccountId(ContextHolder.get().getAccountId());
vo.setHasThumbUp(assignmentAnswerThumbService.selectCount(new EntityWrapper<>(assignmentAnswerThumbObj)) > 0);
List<ApiFileVo> fileList = assignmentAnswerFileMapper.listAssignmentAnswerFile(answer.getId(), 1);
try {
fileList.forEach(file -> {
exechangePages(file);
/*List<PdfPages> list = pdfPagesClient.list(file.getId(), TpActivityType.TYPE_ASSIGNMENT);
if (CollectionUtils.isNotEmpty(list)) {
file.setPdfPages(list);
}*/
});
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
vo.setFileVos(fileList);
AccountVO accountVO = getAccount(answer.getAccountId());
if (accountVO != null) {
vo.setAccountName(StringUtils.isEmpty(accountVO.getFullName()) ? accountVO.getName() : accountVO.getFullName());
vo.setHeadPortrait(accountVO.getHeadPortrait());
}
resultVos.add(vo);
assignmentAnswerThumbObj.setAssignmentAnswerId(null);
assignmentAnswerThumbObj.setAccountId(null);
});
resultPage.setRecords(resultVos);
return resultPage;
}
return new Page<>(pageNo, pageSize);
}
private void exechangePages(ApiFileVo file) {
List<PdfPagesVo> list1 = pdfPagesClient.list(file.getId(), TpActivityType.TYPE_ASSIGNMENT);
if (CollectionUtils.isNotEmpty(list1)) {
List<PdfPages> list = new ArrayList<>();
list1.forEach(pdfPages -> {
PdfPages pages = new PdfPages();
BeanUtils.copyProperties(pdfPages,pages);
list.add(pages);
});
file.setPdfPages(list);
}
}
@GetMapping("/thumbUp")
public boolean thumbup(@RequestParam("assignmentAnswerId") Long assignmentAnswerId,
@RequestParam("isThumbUp") boolean isThumbUp) {
AssignmentAnswerThumb assignmentAnswerThumbObj = new AssignmentAnswerThumb();
assignmentAnswerThumbObj.setAccountId(ContextHolder.get().getAccountId());
assignmentAnswerThumbObj.setAssignmentAnswerId(assignmentAnswerId);
AssignmentAnswerThumb oldOne = assignmentAnswerThumbObj.selectOne(new EntityWrapper(assignmentAnswerThumbObj));
if (oldOne != null) {
// assignmentAnswerThumbObj = new AssignmentAnswerThumb();
assignmentAnswerThumbObj.setIsThumb(isThumbUp ? 1 : 0);
assignmentAnswerThumbObj.setId(oldOne.getId());
return assignmentAnswerThumbObj.updateById();
}
assignmentAnswerThumbObj.setId(idGenerator.generate());
assignmentAnswerThumbObj.setCreateTime(new Date());
return assignmentAnswerThumbObj.insert();
}
@GetMapping("/comment/page")
@ApiOperation("评论列表")
public Page<ApiAssignmentCommentVO> commentPage(
@RequestParam("assignmentAnswerId") Long assignmentAnswerId,
@ApiParam("要跳转的页数") @RequestParam(name = "pageNo", defaultValue = "1") int pageNo,
@ApiParam("每页条数,默认:10") @RequestParam(name = "pageSize", defaultValue = "10") int pageSize
) {
Page<AssignmentComment> page = new Page(pageNo, pageSize);
AssignmentComment comment = new AssignmentComment();
comment.setAuditStatus(0);
comment.setDeleted(0);
comment.setAssignmentAnswerId(assignmentAnswerId);
EntityWrapper<AssignmentComment> ew = new EntityWrapper<>(comment);
ew.orderBy("create_time", false);
page = comment.selectPage(page, ew);
if (page != null && CollectionUtils.isNotEmpty(page.getRecords())) {
List<ApiAssignmentCommentVO> vos = new ArrayList<>();
page.getRecords().forEach(item -> {
ApiAssignmentCommentVO vo = new ApiAssignmentCommentVO();
vo.setCommentId(item.getId());
vo.setContent(item.getContent());
vo.setCreateTime(item.getCreateTime());
AccountVO accountVO = getAccount(item.getCreateById());
if (accountVO != null) {
vo.setCreateByName(StringUtils.isEmpty(accountVO.getFullName()) ? accountVO.getName() : accountVO.getFullName());
}
if (item.getParentCreateById() != null) {
accountVO = getAccount(item.getParentCreateById());
if (accountVO != null) {
vo.setParentCreateByName(StringUtils.isEmpty(accountVO.getFullName()) ? accountVO.getName() : accountVO.getFullName());
}
}
vos.add(vo);
});
Page<ApiAssignmentCommentVO> resultPage = new Page<>(pageNo, pageSize);
resultPage.setTotal(page.getTotal());
resultPage.setRecords(vos);
return resultPage;
}
return new Page<>(pageNo, pageSize);
}
@GetMapping("/comment/add")
@ApiOperation("进行评论")
public Boolean commentAdd(
@RequestParam("assignmentAnswerId") Long assignmentAnswerId,
@RequestParam(name = "parentCommentId", required = false) Long parentCommentId,
@RequestParam("content") String content
) {
AssignmentComment comment = new AssignmentComment();
comment.setAssignmentAnswerId(assignmentAnswerId);
comment.setCompanyId(ContextHolder.get().getCompanyId());
comment.setContent(content);
comment.setCreateById(ContextHolder.get().getAccountId());
comment.setCreateByName(ContextHolder.get().getAccountName());
comment.setId(idGenerator.generate());
comment.setOrgId(ContextHolder.get().getOrgId());
if (parentCommentId != null) {
AssignmentComment parent = new AssignmentComment();
parent.setId(parentCommentId);
parent = parent.selectById();
if (parent != null) {
comment.setParentId(parentCommentId);
comment.setParentCreateById(parent.getCreateById());
}
}
comment.setCreateTime(new Date());
comment.setSiteId(ContextHolder.get().getSiteId());
return comment.insert();
}
@PostMapping("/tipoff")
public Boolean tipoff(@RequestBody AssignmentAnswerTipoff record) {
record.setId(idGenerator.generate());
record.setCreateById(ContextHolder.get().getAccountId());
record.setCreateByName(ContextHolder.get().getAccountName());
record.setCreateTime(new Date());
record.setIsNew(1);
return record.insert();
}
private AccountVO getAccount(long accountId) {
AccountVO accountVO = accountClient.findById(accountId);
return accountVO;
}
}
package com.yizhi.application.controller.remote;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.yizhi.application.entity.*;
import com.yizhi.application.orm.id.IdGenerator;
import com.yizhi.application.service.*;
import com.yizhi.assignment.application.vo.*;
import com.yizhi.assignment.application.vo.apivo.ApiAssignmentAnswerCheckVO;
import com.yizhi.assignment.application.vo.apivo.AssignmentTrainingProject;
import com.yizhi.core.application.context.ContextHolder;
import com.yizhi.core.application.context.RequestContext;
import com.yizhi.core.application.vo.DroolsVo;
import com.yizhi.system.application.system.remote.AccountClient;
import com.yizhi.util.application.domain.Response;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @Author: shengchenglong
* @Date: 2018/3/7 13:59
*/
@Api(tags = "ManageAssignmentController", description = "后台管理作业接口")
@RestController
@RequestMapping("/remote/assignment")
public class ManageAssignmentController {
private static final Logger logger = LoggerFactory.getLogger(ManageAssignmentController.class);
@Autowired
private AssignmentStudentService assignmentStudentService;
@Autowired
private AssignmentContentService assignmentcontentService;
@Autowired
private AssignmentService assignmentService;
@Autowired
private AssignmentFileService assignmentFileService;
@Autowired
private AssignmentAnswerService assignmentAnswerService;
@Autowired
private AssignmentAnswerFileService answerFileService;
@Autowired
private AssignmentAnswerSuggestionService assignmentAnswerSuggestionService;
@Autowired
private AssignmentAuditorService assignmentAuditorService;
@Autowired
private IdGenerator idGenerator;
@Autowired
private AssignmentGradeService assignmentGradeService;
@Autowired
private AssignmentPointService assignmentPointService;
@Autowired
private AccountClient accountClient;
@ApiOperation(value = "生成作业id", notes = "生成作业id")
@GetMapping("/setid")
public Long setId() {
return idGenerator.generate();
}
@ApiOperation(value = "作业新建接口", notes = "新建作业保存")
@PostMapping("/save")
public Boolean save(@ApiParam(name = "AssignmentVo", value = "作业新建入参对象", required = true) @RequestBody AssignmentSaveParamVo assignmentVo) {
return assignmentService.save(assignmentVo);
}
@ApiOperation(value = "作业列表接口", notes = "分页查询作业列表")
@GetMapping("/list")
public Page<AssignmentListVO> list(@RequestParam(value = "currentTime", required = false) String currentTime,
@RequestBody AssignmentListVoTo assignmentListVoTo) {
List<AssignmentListVO> listVo = new ArrayList<AssignmentListVO>();
Page<Assignment> page = assignmentService.assignmentList(currentTime, assignmentListVoTo);
if (page != null) {
List<Assignment> listAssignmentList = page.getRecords();
for (int i = 0; i < listAssignmentList.size(); i++) {
AssignmentListVO assignmentListVO = new AssignmentListVO();
assignmentListVO.setId(listAssignmentList.get(i).getId()); // 作业id
assignmentListVO.setSerialNum(listAssignmentList.get(i).getSerialNum()); // 作业序号
assignmentListVO.setName(listAssignmentList.get(i).getName()); // 作业名字
assignmentListVO.setTraingProjectId(listAssignmentList.get(i).getTrainingProjectId());
assignmentListVO.setStatus(listAssignmentList.get(i).getStatus()); // 作业状态
assignmentListVO.setEndDate(listAssignmentList.get(i).getFinishTime());
assignmentListVO.setVisibleRange(listAssignmentList.get(i).getVisibleRange());
assignmentListVO.setImage(listAssignmentList.get(i).getImage());
assignmentListVO.setSubmitNum(assignmentAnswerService.submitNum(listAssignmentList.get(i).getId(),assignmentListVoTo.getAccountIds())); // 提交数量
assignmentListVO.setNoRead(assignmentAnswerService.noRead(listAssignmentList.get(i).getId(),assignmentListVoTo.getAccountIds()));
listVo.add(assignmentListVO);
}
Page<AssignmentListVO> page1 = new Page<AssignmentListVO>();
page1.setTotal(page.getTotal());
page1.setCurrent(assignmentListVoTo.getPageNo());
page1.setSize(assignmentListVoTo.getPageSize());
page1.setRecords(listVo);
return page1;
}
return new Page<>();
}
@ApiOperation(value = "作业删除接口", notes = "作业删除")
@PostMapping("/delete")
public Boolean delete(@ApiParam(name = "AssignmentDeleteVO", value = "作业删除入参对象", required = true) @RequestBody AssignmentDeleteVO assignmentDelete) {
return assignmentService.updateDelete(assignmentDelete);
}
@GetMapping("/content/find")
@ApiOperation(value = "查看老师布置得作业的主键id查看作业具体内容", notes = "查看作业内容")
public AssignmentSelectVo query(@ApiParam(name = "assignmentId", value = "作业id主键", required = true) @RequestParam(name = "assignmentId", required = true) Long assignmentId) {
Assignment assignment = assignmentService.selectById(assignmentId);
AssignmentContent content = assignmentcontentService.findByAssignmentId(assignmentId);
List<AssignmentFile> assignmentFileList = assignmentFileService.listAssignmentFile(assignmentId);
List<AssignmentGrade> listGrade = assignmentGradeService.getListAssignmentGrade(assignmentId);
List<AssignmentPoint> listPoint = assignmentPointService.getListAssignmentPoint(assignmentId);
//组装数据
AssignmentSelectVo assignmentSelectVo = new AssignmentSelectVo();
if (assignment != null) {
assignmentSelectVo.setId(assignment.getId());
assignmentSelectVo.setName(assignment.getName());
assignmentSelectVo.setFinishTime(assignment.getFinishTime());
assignmentSelectVo.setAmendable(assignment.getAmendable());
assignmentSelectVo.setVisibleRange(assignment.getVisibleRange());
assignmentSelectVo.setType(assignment.getType());
assignmentSelectVo.setPassScore(assignment.getPassScore());
assignmentSelectVo.setCount(assignment.getCount());
assignmentSelectVo.setEnableRemind(assignment.getEnableRemind());
assignmentSelectVo.setAnswerAttachmentNumMax(assignment.getAnswerAttachmentNumMax());
assignmentSelectVo.setAnswerAttachmentNumMin(assignment.getAnswerAttachmentNumMin());
assignmentSelectVo.setAnswerCharaterNumMax(assignment.getAnswerCharaterNumMax());
assignmentSelectVo.setAnswerCharaterNumMin(assignment.getAnswerCharaterNumMin());
assignmentSelectVo.setShowRes(assignment.getShowRes());
assignmentSelectVo.setEnableExerciseBook(assignment.getEnableExerciseBook());
assignmentSelectVo.setKeywords(assignment.getKeywords());
assignmentSelectVo.setImage(assignment.getImage());
assignmentSelectVo.setEnableTask(assignment.getEnableTask());
assignmentSelectVo.setTaskStartDate(assignment.getTaskStartDate());
assignmentSelectVo.setTaskEndDate(assignment.getTaskEndDate());
}
if (content != null) {
assignmentSelectVo.setContent(content.getComment());
}
List<com.yizhi.assignment.application.vo.entity.AssignmentFile> assignmentVOFileList = new ArrayList<>();
assignmentFileList.forEach(assignmentFile -> {
com.yizhi.assignment.application.vo.entity.AssignmentFile assignmentVO = new com.yizhi.assignment.application.vo.entity.AssignmentFile();
BeanUtils.copyProperties(assignmentFile,assignmentVO);
assignmentVOFileList.add(assignmentVO);
});
List<com.yizhi.assignment.application.vo.entity.AssignmentGrade> listGradeVO = exchangeAssignmentGradesList(listGrade);
List<com.yizhi.assignment.application.vo.entity.AssignmentPoint> listPointVO = new ArrayList<>();
listPoint.forEach(assignmentPoint -> {
com.yizhi.assignment.application.vo.entity.AssignmentPoint assignmentPointVO = new com.yizhi.assignment.application.vo.entity.AssignmentPoint();
BeanUtils.copyProperties(assignmentPoint,assignmentPointVO);
listPointVO.add(assignmentPointVO);
});
assignmentSelectVo.setAssignmentFiles(assignmentVOFileList);
assignmentSelectVo.setListGrade(listGradeVO);
assignmentSelectVo.setListPoint(listPointVO);
return assignmentSelectVo;
}
private List<com.yizhi.assignment.application.vo.entity.AssignmentGrade> exchangeAssignmentGradesList(List<AssignmentGrade> listGrade) {
List<com.yizhi.assignment.application.vo.entity.AssignmentGrade> listGradeVO = new ArrayList<>();
listGrade.forEach(assignmentGrade -> {
com.yizhi.assignment.application.vo.entity.AssignmentGrade assignmentGradeVO = new com.yizhi.assignment.application.vo.entity.AssignmentGrade();
BeanUtils.copyProperties(assignmentGrade,assignmentGradeVO);
listGradeVO.add(assignmentGradeVO);
});
return listGradeVO;
}
/**
* 问题:根据部门关键字查到这个站点下此部门的员工的id的list accountIdList
*/
@ApiOperation(value = "一个作业学员提交作业列表", notes = "学生作业列表")
@GetMapping(value = "/answer/list")
public Page<AssignmentReadListVO> assignmentAnswerList(
@ApiParam(name = "assignmentId", value = "老师布置作业的id", required = true) @RequestParam(name = "assignmentId", required = true) Long assignmentId,
@ApiParam(name = "state", value = "批阅状态(1:待阅,2:已阅,不传则为所有)", required = false) @RequestParam(name = "state", required = false) Integer state,
@ApiParam(name = "name", value = "用户名/姓名/标签") @RequestParam(name = "name", required = false) String name,
@ApiParam(name = "keywords", value = "部门关键字", required = false)
@RequestParam(name = "keywords", required = false) String keywords,
@RequestParam(name = "type", required = false,defaultValue = "1") Integer type,
@ApiParam(name = "pageNo", value = "要跳转的页数", required = false) @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@ApiParam(name = "pageSize", value = "每页条数,默认:10", required = false) @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
RequestContext context = ContextHolder.get();
Long accountId = context.getAccountId();
logger.info("上下信息1:{}", JSON.toJSON(context));
return assignmentAnswerService.assignmentAnswerList(keywords,name,assignmentId, accountId, state, type, pageNo, pageSize,null);
}
/**
* 查询作业列表
* @param answerListVo
* @return
*/
@PostMapping(value = "/manage/answer/list")
public Page<AssignmentReadListVO> manageAssignmentAnswerList(@RequestBody AnswerListVo answerListVo) {
RequestContext context = ContextHolder.get();
Long accountId = context.getAccountId();
logger.info("上下信息2:{}", JSON.toJSON(context));
logger.info("传参数2:{}",JSON.toJSON(answerListVo));
return assignmentAnswerService.assignmentAnswerList(answerListVo.getKeywords(),answerListVo.getName(),answerListVo.getAssignmentId(),
accountId, answerListVo.getState(), answerListVo.getType(), answerListVo.getPageNo(), answerListVo.getPageSize(),answerListVo.getAccountIds());
}
@ApiOperation(value = "获取单个学生答案", notes = "单个作业信息", response = Response.class)
@PostMapping("/marking/select")
public ApiAssignmentAnswerCheckVO getAssignmentAnswer(@ApiParam(name = "AssignmentAnswerMarkingSelectVO", value = "获取单个学生作业信息入参", required = true) @RequestBody AssignmentAnswerMarkingSelectVO assignmentAnswerMarkingSelect) {
RequestContext context = ContextHolder.get();
Long accountId = context.getAccountId();
List<AssignmentReadListVO> assignmentReadListVOList = assignmentAnswerService.getAssignmentAnswerIdList(assignmentAnswerMarkingSelect.getAccountIds(),assignmentAnswerMarkingSelect.getDepartment(), assignmentAnswerMarkingSelect.getName(), assignmentAnswerMarkingSelect.getAssignmentId(), accountId, assignmentAnswerMarkingSelect.getState(), assignmentAnswerMarkingSelect.getType()!=null ? assignmentAnswerMarkingSelect.getType() : 1);
logger.info("返回列表:{}",JSON.toJSON(assignmentReadListVOList));
ApiAssignmentAnswerCheckVO assignmentAnswerCheckVO = new ApiAssignmentAnswerCheckVO();
if (!CollectionUtils.isEmpty(assignmentReadListVOList)) {
List<Long> answerIds = assignmentReadListVOList.parallelStream().map(assignmentReadListVO -> {
return assignmentReadListVO.getId();
}).collect(Collectors.toList());
assignmentAnswerCheckVO.setAnswerIds(answerIds);
logger.info("返回的答案id的列表:{}",JSON.toJSON(answerIds));
}
Assignment assignment = assignmentService.selectById(assignmentAnswerMarkingSelect.getAssignmentId());
AssignmentAnswer assignmentAnswer = assignmentAnswerService.selectAssignmentAnswerById(assignmentAnswerMarkingSelect.getAssignmentAnswerId());
AssignmentAnswerSuggestion assignmentAnswerSuggestion = assignmentAnswerSuggestionService.selectSuggestionByAnswerId(assignmentAnswerMarkingSelect.getAssignmentAnswerId());
//答案文件
List<AssignmentAnswerFile> listAssignmentAnswerFile = answerFileService.listAssignmentAnswerFile(assignmentAnswerMarkingSelect.getAssignmentAnswerId());
//反馈文件
List<AssignmentAnswerFile> listAssignmentAnswerBackFile = answerFileService.listAssignmentAnswerBackFile(assignmentAnswerMarkingSelect.getAssignmentAnswerId());
//上一份答案id 下一份答案id 根据时间排序
// Long prevAnswerId = null;
// Long nextAnswerId = null;
/*------------开始装数据---------------*/
// ApiAssignmentAnswerCheckVO assignmentAnswerCheckVO = new ApiAssignmentAnswerCheckVO();
if (assignmentAnswer != null) {
assignmentAnswerCheckVO.setRealName(assignmentAnswer.getRealName() != null ? assignmentAnswer.getRealName() : assignmentAnswer.getAccountName());
assignmentAnswerCheckVO.setScore(assignmentAnswer.getScore());
assignmentAnswerCheckVO.setContent(assignmentAnswer.getContent());
// prevAnswerId = assignmentAnswerService.prevAnswerId(assignmentAnswer.getCreateTime(), assignmentAnswerMarkingSelect.getAssignmentId());
// nextAnswerId = assignmentAnswerService.nextAnswerId(assignmentAnswer.getCreateTime(), assignmentAnswerMarkingSelect.getAssignmentId());
}
if (assignment != null) {
assignmentAnswerCheckVO.setPassScore(assignment.getPassScore());
}
List<com.yizhi.assignment.application.vo.entity.AssignmentAnswerFile> assignmentAnswerFileVoList = exchangeAssignmentAnswerFile(listAssignmentAnswerFile);
assignmentAnswerCheckVO.setListAssignmentAnswerFile(assignmentAnswerFileVoList);
if (assignmentAnswerSuggestion != null) {
assignmentAnswerCheckVO.setSuggestion(assignmentAnswerSuggestion.getSuggestion());
}
List<com.yizhi.assignment.application.vo.entity.AssignmentAnswerFile> assignmentAnswerBackFileVOList
= exchangeAssignmentAnswerFile(listAssignmentAnswerBackFile);
assignmentAnswerCheckVO.setListAssignmentAnswerBackFile(assignmentAnswerBackFileVOList);
// assignmentAnswerCheckVO.setPrevAnswerId(prevAnswerId);
// assignmentAnswerCheckVO.setNextAnswerId(nextAnswerId);
/**
* 废弃字段-------????????????
*/
List<String> fileUrl = new ArrayList<String>();
fileUrl.add("废弃字段1--A");
fileUrl.add("废弃字段1--B");
fileUrl.add("废弃字段1--C");
List<AssignmentGrade> gradesList = new ArrayList<AssignmentGrade>();
AssignmentGrade g1 = new AssignmentGrade();
AssignmentGrade g2 = new AssignmentGrade();
gradesList.add(g1);
gradesList.add(g2);
String grade = "废弃字段3";
List<com.yizhi.assignment.application.vo.entity.AssignmentGrade> gradeVOList
= exchangeAssignmentGradesList(gradesList);
assignmentAnswerCheckVO.setFileUrl(fileUrl);
assignmentAnswerCheckVO.setGrades(gradeVOList);
assignmentAnswerCheckVO.setGrade(grade);
return assignmentAnswerCheckVO;
}
private List<com.yizhi.assignment.application.vo.entity.AssignmentAnswerFile> exchangeAssignmentAnswerFile(List<AssignmentAnswerFile> listAssignmentAnswerFile) {
List<com.yizhi.assignment.application.vo.entity.AssignmentAnswerFile> assignmentAnswerFileVoList = new ArrayList<>();
listAssignmentAnswerFile.forEach(assignmentAnswerFile -> {
com.yizhi.assignment.application.vo.entity.AssignmentAnswerFile assignmentAnswerFileVO = new com.yizhi.assignment.application.vo.entity.AssignmentAnswerFile();
BeanUtils.copyProperties(assignmentAnswerFile,assignmentAnswerFileVO);
assignmentAnswerFileVoList.add(assignmentAnswerFileVO);
});
return assignmentAnswerFileVoList;
}
@ApiOperation(value = "学员名单添加学员接口", notes = "添加学员", response = Response.class)
@PostMapping("/student/add")
public Boolean insert(@ApiParam(name = "listStudent", value = "添加学员", required = true) @RequestBody ListStudent listStudent) {
return assignmentStudentService.add(listStudent);
}
/**
* 添加关联学员,之前记录不删除
*
* @param assignmentStudents
* @return
*/
@PostMapping("/student/insert")
public Boolean insertStudentRelation(@RequestBody List<AssignmentStudent> assignmentStudents) {
return assignmentStudentService.insertStudentRelation(assignmentStudents);
}
@ApiOperation(value = "查看已关联的学员名单", notes = "已关联的学员名单")
@GetMapping("/student/relation")
public List<AssignmentStudent> studentRelation(@ApiParam(name = "assignmentId", value = "作业id主键", required = true) @RequestParam(name = "assignmentId", required = true) Long assignmentId) {
return assignmentStudentService.relation(assignmentId);
}
@ApiOperation(value = "上架下架", notes = "上架下架")
@PostMapping("/status/update")
public Boolean update(@ApiParam(name = "assignmentUpAndDown", value = "上架下架", required = true) @RequestBody AssignmentUpAndDownVO assignmentUpAndDown) {
return assignmentService.update(assignmentUpAndDown.getId(), assignmentUpAndDown.getStatus(), assignmentUpAndDown.getAccountId(), assignmentUpAndDown.getAccountName());
}
@ApiOperation(value = "作业批阅接口", notes = "老师批阅学生作业批阅保存")
@PostMapping("/marking/save")
public PointParamVO readSave(@ApiParam(name = "assignmentAnswerContentVO", value = "老师批阅学生作业批阅保存", required = true) @RequestBody AssignmentAnswerContentVO assignmentAnswerContentVO) {
return assignmentService.assignmentReadOverByTeacher(assignmentAnswerContentVO);
}
@ApiOperation(value = "查看评阅人", notes = "查看评阅人")
@GetMapping("/auditor/relation")
public List<Long> getAuditor(@ApiParam(name = "assignmentId", value = "作业id", required = true) @RequestParam(name = "assignmentId", required = true) Long assignmentId) {
return assignmentAuditorService.relationAuditor(assignmentId);
}
@ApiOperation(value = "设置评阅人", notes = "设置评阅人")
@PostMapping("/auditor/insert")
public Boolean setAuditor(@ApiParam(name = "ListAuditor", value = "ListAuditor") @RequestBody ListAuditor listAuditor) {
return assignmentAuditorService.auditorInsert(listAuditor);
}
@ApiOperation(value = "导出作业批阅结果", notes = "导出作业批阅结果")
@PostMapping("/export/suggetion/get")
public AssignmentAnswerListExport exportResultExcel(@RequestBody DownloadAnswerVO vo) {
Long assignmentId = vo.getAssignmentId();
List<Long> answerIds = vo.getAnswerIds();
return assignmentAnswerService.exportResultExcel(assignmentId, answerIds);
}
@ApiOperation(value = "导出未提交作业的名单", notes = "导出未提交作业的名单")
@GetMapping("/export/unsubmit/get")
public AssignmentQXVO getQXSubmitMessage(@ApiParam(value = "作业的Id", name = "作业的Id", required = true) @RequestParam(name = "assignmentId", required = true) Long assignmentId) {
return assignmentService.getQXSubmitMessage(assignmentId);
}
@ApiOperation(value = "批量下载作业", notes = "批量下载作业")
@PostMapping("/export/remote/assignment/get")
public List<AnswersDownVO> exportAssignmentZip(@RequestBody DownloadAnswerVO vo) {
Long assignmentId = vo.getAssignmentId();
List<Long> answerIds = vo.getAnswerIds();
return assignmentAnswerService.getAnswerIdsDown(assignmentId, answerIds);
}
@ApiOperation(value = "下载学生作业", notes = "学生作业id列表")
@GetMapping("/download/batch")
public List<List<AssignmentAnswerFile>> getAssignmentAnswerList(@ApiParam(name = "ids", value = "学生作业主键", required = true) @RequestParam(name = "ids") List<Long> ids) {
return answerFileService.selectAssignmentAnswerFileById(ids);
}
@ApiOperation(value = "根据账号id查询到此学员下的作业个数", notes = "根据账号id查询到此学员下的作业个数")
@GetMapping("/select/assignmentNum/byAccountId")
public Integer selectAssignmentNumByAcountId(@ApiParam(name = "accountId", value = "账号id", required = true) @RequestParam(name = "accountId", required = true) Long accountId) {
return assignmentService.selectAssignmentNumByAccountId(accountId);
}
@ApiOperation(value = "可见范围导出", notes = "可见范围导出")
@GetMapping("/export/visiblRange")
public VisibleRangeExport vsibleRangeExport(@ApiParam(value = "作业的Id", name = "作业的Id", required = true) @RequestParam(name = "assignmentId", required = true) Long assignmentId) {
return assignmentService.vsibleRangeExport(assignmentId);
}
@ApiOperation(value = "作业挂到培训项目")
@PostMapping("/updateTrainingProject/byAssignmentId")
public boolean updateTrainingProjectByAssignmentId(@RequestBody AssignmentTrainingProject atp) {
logger.info(atp.toString());
logger.info("培训项目的id{},培训项目的名字{},培训项目的作业集合{}", atp.getProjectId(), atp.getProjectName(), atp.getListAssignmentIds());
return assignmentService.updateAssignmentTp(atp);
}
@GetMapping(value = "/by/new/server")
public List<Map<String, Object>> getServerByCompanyIdAndIds(@RequestParam("companyId") Long companyId, @RequestParam(value = "ids", required = false) List<Long> ids) {
return assignmentService.getServerByCompanyIdAndIds(companyId, ids);
}
@GetMapping(value = "/by/siteId/and/assignmentId/and/accountId")
public List<Long> getListIdsBySiteIdAndAssignmentIdsAndAccountId(@RequestParam("sitId") Long siteId, @RequestParam("accountId") Long accountId, @RequestParam("ids") List<Long> ids) {
return assignmentAnswerService.getListIdsBySiteIdAndAssignmentIdsAndAccountId(siteId, accountId, ids);
}
@GetMapping(value = "/delete/relation")
public void deleteRelation(@RequestParam(name = "assignmentId", required = true) Long assignmentId) {
assignmentService.delete(assignmentId);
}
/**
* 经验池作业列表
*
* @param name
* @param ids
* @param pageNo
* @param pageSize
* @return
*/
@PostMapping("/experiencePoolList")
public Page<Map<String, Object>> experiencePoolList(@RequestParam(value = "name", required = false) String name,
@RequestBody List<Long> ids,
@RequestParam(value = "pageNo", required = false) Integer pageNo,
@RequestParam(value = "pageSize", required = false) Integer pageSize) {
return assignmentService.experiencePoolList(name, ids, pageNo, pageSize);
}
/**
* 查询作业完成的学员
*
* @param assignmentId
* @return
*/
@GetMapping("/finishAccountIds")
public List<Long> getFinishedAccountIds(@RequestParam("assignmentId") Long assignmentId, @RequestParam("siteId") Long siteId, @RequestParam("companyId") Long companyId) {
return assignmentAnswerService.getFinishedAccountIds(assignmentId, siteId, companyId);
}
/**
* 查询作业分数
*
* @param assignmentId
* @return
*/
@GetMapping("/getScore")
public Integer getScore(@RequestParam("assignmentId") Long assignmentId, @RequestParam("siteId") Long siteId, @RequestParam("companyId") Long companyId, @RequestParam("accountId") Long accountId) {
return assignmentAnswerService.getScore(assignmentId, siteId, companyId, accountId);
}
@GetMapping("/visibleRange")
public List<AssignmentStudent> VisibleRange(@RequestParam("assignmentId") Long assignmentId) {
AssignmentStudent assignmentStudent = new AssignmentStudent();
assignmentStudent.setAssignmentId(assignmentId);
EntityWrapper<AssignmentStudent> wrapper = new EntityWrapper<AssignmentStudent>(assignmentStudent);
return assignmentStudentService.selectList(wrapper);
}
@GetMapping("/get")
public Assignment get(@RequestParam("assignmentId") Long assignmentId) {
return assignmentService.selectById(assignmentId);
}
@PostMapping("/verifyVedio")
public boolean verifyVedio(@RequestBody List<Long> answerFileIds) {
int num = answerFileService.verifyVideo(answerFileIds);
return num == answerFileIds.size();
}
@PostMapping("updateVedioTranscodeUrl")
public boolean updateVedioTranscodeUrl(@RequestBody Map<String, String> map) {
AssignmentAnswerFile file = new AssignmentAnswerFile();
Long id = Long.valueOf(map.get("id"));
file.setId(id);
file.setVideoLd(map.get("ld"));
file.setVideoHd(map.get("hd"));
file.setVideoSd(map.get("sd"));
return answerFileService.updateById(file);
}
@GetMapping("/getPageByDrools")
Page<DroolsVo> getPageByDrools(@RequestParam("field") String field,
@RequestParam(value = "value", required = false) String value,
@RequestParam("pageNo") Integer pageNo,
@RequestParam("pageSize") Integer pageSize) {
Page<DroolsVo> page = new Page<>(pageNo, pageSize);
return assignmentService.getPageByDrools(field, value, page);
}
}
package com.yizhi.application.controller.remote;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.yizhi.core.application.context.ContextHolder;
import com.yizhi.core.application.context.RequestContext;
import com.yizhi.application.entity.Assignment;
import com.yizhi.application.entity.AssignmentAnswer;
import com.yizhi.application.entity.AssignmentAnswerTipoff;
import com.yizhi.application.entity.AssignmentComment;
import com.yizhi.application.mapper.AssignmentAnswerMapper;
import com.yizhi.application.mapper.AssignmentAnswerTipoffMapper;
import com.yizhi.application.service.AssignmentExcelExporterService;
import com.yizhi.system.application.system.remote.AccountClient;
import com.yizhi.system.application.vo.AccountVO;
import com.yizhi.assignment.application.vo.TipoffAssignmentListVO;
import com.yizhi.assignment.application.vo.apivo.ApiAssignmentCommentVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.ibatis.session.RowBounds;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* @ClassName AssignmentExpriceBookController
* @Description TODO
* @Author shengchenglong
* @DATE 2019-10-22 11:15
* @Version 1.0
*/
@Api("作业本--管理端")
@RestController(value = "ManageAssignmentExerciseBookControllerRemote")
@RequestMapping("/remote/manage/assignment/exerciseBook")
@Log4j2
public class ManageAssignmentExerciseBookController {
@Autowired
private AccountClient accountClient;
@Autowired
private AssignmentAnswerMapper assignmentAnswerMapper;
@Autowired
private AssignmentAnswerTipoffMapper assignmentAnswerTipoffMapper;
@Autowired
private AssignmentExcelExporterService assignmentExcelExporterService;
@GetMapping("/answer/down")
public boolean answerDown(@RequestParam("answerId") Long answerId, @RequestParam("isDown") Integer isDown) {
AssignmentAnswer answer = new AssignmentAnswer();
answer.setId(answerId);
answer.setIsDown(isDown);
return answer.updateById();
}
/**
* 删除作业
* @param answerId
* @return
*/
@GetMapping("/answer/delete")
public boolean answerDelete(@RequestParam("answerId") Long answerId) {
AssignmentAnswer answer = new AssignmentAnswer();
answer.setId(answerId);
answer.setDeleted(1);
boolean b = answer.updateById();
return b;
}
@GetMapping("/comment/page")
@ApiOperation("评论列表")
public Page<ApiAssignmentCommentVO> commentPage(
@RequestParam("assignmentAnswerId") Long assignmentAnswerId,
@ApiParam("要跳转的页数") @RequestParam(name = "pageNo", defaultValue = "1") int pageNo,
@ApiParam("每页条数,默认:10") @RequestParam(name = "pageSize", defaultValue = "10") int pageSize
) {
Page<AssignmentComment> page = new Page(pageNo, pageSize);
AssignmentComment comment = new AssignmentComment();
// comment.setAuditStatus(0);
comment.setDeleted(0);
comment.setCompanyId(ContextHolder.get().getCompanyId());
comment.setSiteId(ContextHolder.get().getSiteId());
comment.setAssignmentAnswerId(assignmentAnswerId);
EntityWrapper<AssignmentComment> ew = new EntityWrapper<>(comment);
ew.orderBy("create_time", false);
page = comment.selectPage(page, ew);
if (page != null && CollectionUtils.isNotEmpty(page.getRecords())) {
List<ApiAssignmentCommentVO> vos = new ArrayList<>();
page.getRecords().forEach(item -> {
ApiAssignmentCommentVO vo = new ApiAssignmentCommentVO();
vo.setCommentId(item.getId());
vo.setContent(item.getContent());
vo.setCreateTime(item.getCreateTime());
vo.setAuditStatus(item.getAuditStatus());
AccountVO accountVO = getAccount(item.getCreateById());
if (accountVO != null) {
vo.setManageCommentator(accountVO.getName());
vo.setManageCommentatorFullName(accountVO.getFullName());
}
if (item.getParentCreateById() != null) {
accountVO = getAccount(item.getParentCreateById());
if (accountVO != null) {
vo.setParentCreateByName(StringUtils.isEmpty(accountVO.getFullName()) ? accountVO.getName() : accountVO.getFullName());
}
}
vos.add(vo);
});
Page<ApiAssignmentCommentVO> resultPage = new Page<>(pageNo, pageSize);
resultPage.setTotal(page.getTotal());
resultPage.setRecords(vos);
return resultPage;
}
return new Page<>(pageNo, pageSize);
}
@GetMapping("/comment/delete")
public boolean commentDelete(@RequestParam("commentId") Long commentId) {
AssignmentComment comment = new AssignmentComment();
comment.setId(commentId);
comment.setDeleted(1);
return comment.updateById();
}
@GetMapping("/comment/audit")
public boolean commentDelete(@RequestParam("commentId") Long commentId, @RequestParam("auditStatus") Integer auditStatus) {
AssignmentComment comment = new AssignmentComment();
comment.setId(commentId);
comment.setAuditStatus(auditStatus);
return comment.updateById();
}
@GetMapping("/tipoff/answer/page")
public Page<TipoffAssignmentListVO> tipoffAnswerPage(
@RequestParam("assignmentName") String assignmentName,
@ApiParam("要跳转的页数") @RequestParam(name = "pageNo", defaultValue = "1") int pageNo,
@ApiParam("每页条数,默认:10") @RequestParam(name = "pageSize", defaultValue = "10") int pageSize) {
Page<TipoffAssignmentListVO> tipoffAssignmentListVOPage = new Page<>(pageNo,pageSize);
log.info("返回的值:"+ JSON.toJSONString(tipoffAssignmentListVOPage));
List<TipoffAssignmentListVO> vos = assignmentAnswerMapper.tipoffAssignmentList(assignmentName, ContextHolder.get(), new RowBounds(tipoffAssignmentListVOPage.getOffset(), tipoffAssignmentListVOPage.getLimit()));
if (CollectionUtils.isNotEmpty(vos)) {
Page<TipoffAssignmentListVO> page = new Page<>(pageNo, pageSize);
AssignmentAnswerTipoff tipoff = new AssignmentAnswerTipoff();
vos.forEach(item -> {
item.setTipoffTime(assignmentAnswerTipoffMapper.getLastTipoffTime(item.getAnswerId()));
Integer isNew = assignmentAnswerTipoffMapper.lastIsNew(item.getAnswerId());
item.setHasNew(isNew == null ? false : isNew == 1);
AccountVO accountVO = getAccount(item.getAccountId());
if (accountVO != null) {
item.setUsername(accountVO.getName());
item.setFullName(accountVO.getFullName());
}
});
page.setRecords(vos);
page.setTotal(assignmentAnswerMapper.tipoffAssignmentListCount(assignmentName, ContextHolder.get()));
return page;
}
return new Page<>(pageNo, pageSize);
}
@GetMapping("/tipoff/page")
public Page<AssignmentAnswerTipoff> tipoffPage(
@RequestParam("answerId") Long answerId,
@ApiParam("要跳转的页数") @RequestParam(name = "pageNo", defaultValue = "1") int pageNo,
@ApiParam("每页条数,默认:10") @RequestParam(name = "pageSize", defaultValue = "10") int pageSize) {
AssignmentAnswerTipoff tipoff = new AssignmentAnswerTipoff();
tipoff.setAssignmentAnswerId(answerId);
tipoff.setStatus(0);
EntityWrapper<AssignmentAnswerTipoff> ew = new EntityWrapper<>(tipoff);
ew.orderBy("create_time", false);
Page<AssignmentAnswerTipoff> page = new Page<>(pageNo, pageSize);
page = tipoff.selectPage(page, ew);
// 该作业查看过
assignmentAnswerTipoffMapper.updateNotNew(answerId);
return page;
}
@GetMapping("/tipoff/remove")
public Boolean tipoffPage(
@RequestParam("tipoffId") Long tipoffId) {
AssignmentAnswerTipoff tipoff = new AssignmentAnswerTipoff();
tipoff.setId(tipoffId);
tipoff.setAuditorId(ContextHolder.get().getAccountId());
tipoff.setAuditTime(new Date());
tipoff.setStatus(1);
return tipoff.updateById();
}
@GetMapping("/comment/export")
public String commentExport(@RequestParam("answerId") Long answerId) {
RequestContext context = ContextHolder.get();
AssignmentAnswer answer = new AssignmentAnswer();
answer.setId(answerId);
answer = answer.selectById();
if (answer != null) {
Assignment assignment = new Assignment();
assignment.setId(answer.getAssignmentId());
assignment = assignment.selectById();
if (assignment != null) {
String fileNamePattern = answer.getCreateByName() + "的作业-"
+ assignment.getName().replaceAll("/", ".") + "-评论记录" +
DateFormatUtils.format(new Date(), "yyyyMMDDHHmmss");
return assignmentExcelExporterService.doExport(context, answerId, "ASSIGNMENT-COMMENT-EXPORT-", fileNamePattern);
}
}
return null;
}
private AccountVO getAccount(long accountId) {
AccountVO accountVO = accountClient.findById(accountId);
return accountVO;
}
}
package com.yizhi.application.controller.remote;
import com.yizhi.core.application.context.ContextHolder;
import com.yizhi.core.application.context.RequestContext;
import com.yizhi.util.application.num.NumUtil;
import com.yizhi.application.mapper.AssignmentMapper;
import com.yizhi.assignment.application.vo.MinimbaAssignmentVO;
import com.yizhi.assignment.application.vo.MinimbaStudyRecordVO;
import com.yizhi.assignment.application.vo.MinimbaUserDetailParamVO;
import com.yizhi.assignment.application.vo.MinimbaUserDetailVO;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
* @Author: ding
* @Date: 2019/10/24
*/
@RequestMapping("/remote/assignment/minimba")
@RestController
public class MinimbaController {
private static final Logger logger = LoggerFactory.getLogger(MinimbaController.class);
@Autowired
private AssignmentMapper assignmentMapper;
@PostMapping("/userDetails")
public MinimbaUserDetailVO getUserDetails(@RequestBody MinimbaUserDetailParamVO paramVO) {
paramVO.getIsRealTime();
RequestContext context = ContextHolder.get();
MinimbaUserDetailVO vo = assignmentMapper.userDetail(paramVO, context.getSiteId(), context.getCompanyId(), context.getAccountId());
int allNum = assignmentMapper.selectCountAllPlan(paramVO);
int finishedNum = assignmentMapper.selectCountFinishedPlan(context.getAccountId(), paramVO);
String percentage = NumUtil.getPercentage(finishedNum, allNum, 0);
int res = Integer.parseInt(percentage.replace("%", ""));
vo.setPercentage(res);
return vo;
}
@GetMapping("/studyingRecords")
public List<MinimbaStudyRecordVO> getProjectStudyingRecords(Long projectId) {
List<MinimbaStudyRecordVO> vos = assignmentMapper.getMinimbaStudyRecordVO(projectId);
List<MinimbaStudyRecordVO> resultList = new ArrayList<>();
RequestContext res = ContextHolder.get();
if (CollectionUtils.isNotEmpty(vos)) {
vos.forEach(vo -> {
// vo.setCourseScore(assignmentMapper.selectScore(vo.getCourseId()));
// vo.setCourseStudyDuration(String.valueOf(assignmentMapper.selectSeconds(vo.getCourseId())));
List<MinimbaAssignmentVO> assignmentVOList = assignmentMapper.getMinimbaAssignmentVO(vo.getPlanId(), res.getAccountId());
Long examId = assignmentMapper.getPlanExamId(vo.getPlanId());
vo.setExamId(examId);
if (CollectionUtils.isNotEmpty(assignmentVOList)) {
vo.setAssignmentAnswerList(assignmentVOList);
resultList.add(vo);
}
});
}
return resultList;
}
}
package com.yizhi.application.controller.remote;
import com.baomidou.mybatisplus.plugins.Page;
import com.yizhi.application.entity.Assignment;
import com.yizhi.application.entity.AssignmentPoint;
import com.yizhi.application.service.AssignmentAnswerService;
import com.yizhi.application.service.AssignmentPointService;
import com.yizhi.application.service.AssignmentService;
import com.yizhi.application.service.AssignmentStudentService;
import com.yizhi.assignment.application.vo.AssignmentCalendarVO;
import com.yizhi.system.application.vo.CalendarTaskParamVo;
import com.yizhi.assignment.application.vo.apivo.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Author: shengchenglong
* @Date: 2018/3/7 13:59
*/
@Api(tags = "学员端作业接口")
@RestController
@RequestMapping("/remote/api/assignment")
public class StudentAssignmentController {
@Autowired
private AssignmentService assignmentService;
@Autowired
private AssignmentAnswerService assignmentAnswerService;
@Autowired
private AssignmentStudentService assignmentStudentService;
@Autowired
private AssignmentPointService assignmentPointService;
@GetMapping("/my/answer/zip")
public String getStudentAnswerZipByAnswerId(@RequestParam(name="assignmentId")Long assignmentId,@RequestParam("answerId")Long answerId) {
return assignmentAnswerService.getStudentAnswerZipByAnswerId(assignmentId, answerId);
}
@GetMapping("/my/list")
@ApiOperation(value = "分页查询作业列表", notes = "分页查询作业列表")
public Page<ApiAssignmentListResultVO> list(
@ApiParam(name = "type", value = "类型(1:进行中,2:已完成)", required = true) @RequestParam(name = "type", defaultValue = "1") int type,
@ApiParam(name = "pageNo", value = "要跳转的页数", required = false) @RequestParam(name = "pageNo", defaultValue = "1") int pageNo,
@ApiParam(name = "pageSize", value = "每页条数,默认:10", required = false) @RequestParam(name = "pageSize", defaultValue = "10") int pageSize,
@ApiParam(name = "accountId", value = "用户id", required = true) @RequestParam(name = "accountId") Long accountId,
@ApiParam(name = "relationIds", value = "关联ids", required = true) @RequestParam(name = "relationIds") List<Long> relationIds,
@ApiParam(name = "siteId", value = "站点id", required = true) @RequestParam(name = "siteId") Long siteId,
@ApiParam(name = "companyId", value = "公司id", required = true) @RequestParam(name = "companyId") Long companyId) {
Page<ApiAssignmentListResultVO> page = null;
if (type == 1) { page = assignmentService.listUnfinishedAssignment(pageNo, pageSize,accountId,relationIds,companyId,siteId); }
if (type == 2) { page = assignmentService.listFinishedAssignment(pageNo, pageSize,accountId,relationIds,companyId,siteId); }
return page;
}
@GetMapping("/my/list/search")
@ApiOperation(value = "分页查询作业列表(按照条件查 )", notes = "分页查询作业列表(按照条件查)")
public Page<ApiAssignmentListResultVO> listSearch(
@ApiParam(name = "name", value = "关键字", required = false) @RequestParam(name = "name",required=false) String name,
@ApiParam(name = "pageNo", value = "要跳转的页数", required = false) @RequestParam(name = "pageNo", defaultValue = "1") int pageNo,
@ApiParam(name = "pageSize", value = "每页条数,默认:10", required = false) @RequestParam(name = "pageSize", defaultValue = "10") int pageSize,
@ApiParam(name = "accountId", value = "用户id", required = true) @RequestParam(name = "accountId") Long accountId,
@ApiParam(name = "relationIds", value = "关联ids", required = true) @RequestParam(name = "relationIds") List<Long> relationIds,
@ApiParam(name = "siteId", value = "站点id", required = true) @RequestParam(name = "siteId") Long siteId) {
return assignmentService.listAllAssignmentByName(name, pageNo, pageSize,accountId,relationIds,siteId);
}
@GetMapping("/my/answer/list")
@ApiOperation(value = "答案列表", notes = "答案列表")
public ApiAssignmentAnswerResultVo answerList(@RequestParam(name = "assignmentId") Long assignmentId,
@RequestParam(name = "accountId") Long accountId) {
return assignmentAnswerService.getAnswerList(assignmentId, accountId);
}
@GetMapping("/my/getAssignment")
@ApiOperation(value="作业详情列表",notes="作业详情列表")
public ApiAssignmentVO getAssignment(@ApiParam(name = "assignmentId", value = "作业id", required = true) @RequestParam(name = "assignmentId") Long assignmentId,
@ApiParam(name = "accountId", value = "学员账号", required = true) @RequestParam(name = "accountId") Long accountId) {
return assignmentService.getAssignment(assignmentId,accountId);
}
@GetMapping("/my/toAssignment")
@ApiOperation(value = "查看某一份答案详细信息", notes = "查看某一份答案详细信息")
public ApiAssignmentDetailsVo toAssignment(@ApiParam(name = "assignmentId", value = "作业id", required = true) @RequestParam(name = "assignmentId") Long assignmentId,
@ApiParam(name = "answerId", value = "答案Id", required = true) @RequestParam(name = "answerId") Long answerId,
@ApiParam(name = "accountId", value = "学员账号", required = true) @RequestParam(name = "accountId") Long accountId) {
return assignmentAnswerService.toAssignment(assignmentId,answerId,accountId);
}
@PostMapping("/my/can/submit")
@ApiOperation(value="判断作业是都可以提交")
public Integer canSubmit(@RequestBody ApiAssignmentAswerVO assignmentAswerVO) {
return assignmentAnswerService.canSubmitAssignmentAnswer(assignmentAswerVO);
}
@PostMapping("/my/submit")
@ApiOperation(value = "作业提交", notes = "作业提交 ")
public Boolean submit(@RequestBody ApiAssignmentAswerVO assignmentAswerVO) {
return assignmentAnswerService.submitAssignmentAnswer(assignmentAswerVO);
}
/* @GetMapping("/my/suggestion/get")
@ApiOperation(value = "查看作业评阅详细信息", notes = "查看作业评阅详细信息")
public ApiSuggestionVo getSuggesstion(@ApiParam(name = "assignmentId", value = "作业id", required = true) @RequestParam(name = "assignmentId") Long assignmentId,
@ApiParam(name = "accountId", value = "用户id", required = true) @RequestParam(name = "accountId") Long accountId) {
return assignmentAnswerService.getMyAnswerDetailsByAssignmentId(assignmentId,accountId);
}*/
@GetMapping("/my/list/search/others")
@ApiOperation(value = "分页查询作业列表(给门户用)", notes = "分页查询作业列表(给门户用)")
public List<ToOthersApi> listSearchOthers(
@ApiParam(name = "name", value = "关键字", required = false) @RequestParam(name = "name",required=false) String name,
@ApiParam(name = "pageNo", value = "要跳转的页数", required = false) @RequestParam(name = "pageNo", defaultValue = "1") int pageNo,
@ApiParam(name = "pageSize", value = "每页条数,默认:10", required = false) @RequestParam(name = "pageSize", defaultValue = "10") int pageSize,
@ApiParam(name = "accountId", value = "用户id", required = true) @RequestParam(name = "accountId") Long accountId,
@ApiParam(name = "relationIds", value = "关联ids", required = true) @RequestParam(name = "relationIds") List<Long> relationIds,
@ApiParam(name = "siteId", value = "站点id", required = true) @RequestParam(name = "siteId") Long siteId) {
return assignmentService.listSearchOthers(name, pageNo, pageSize, accountId, relationIds, siteId);
}
@GetMapping("/my/assignment/num")
@ApiOperation(value="根据账号id查到分发给此人的作业没有提交答案的个数",notes="根据账号id查到分发给此人的作业没有提交答案的个数")
public Integer getAssignmentNumByAccountId(@ApiParam(name="relationIds",value="关联的账号Ids")@RequestParam(name="relationIds",required=false)List<Long> relationIds,@ApiParam(name="siteId",value="站点id")@RequestParam(name="siteId",required=true)Long siteId,@ApiParam(name="accountId",value="账号id")@RequestParam(name="accountId",required=true)Long accountId) {
return assignmentStudentService.getAssignmentNumByAccountId(relationIds,siteId,accountId);
}
@GetMapping("/my/toAssignmentActivity")
@ApiOperation(value="根据id查到作业,门户用到",notes="根据id查到作业,门户用到")
public Assignment toAssignmentActivity(@RequestParam(name = "assignmentId") Long assignmentId) {
return assignmentService.selectById(assignmentId);
}
/*@PostMapping("/update/trainningProject")
@ApiOperation(value="作业挂靠到培训项目",notes="作业挂靠到培训项目")
public Boolean update(@RequestParam(name = "assignmentId") Long assignmentId) {
return assignmentService.selectById(assignmentId);
}*/
@GetMapping("/training/point")
@ApiOperation(value = "培训项目需要的培训积分")
public Map<String, Integer> getTrainingPoint(@RequestParam(name = "ids") List<Long> ids) {
AssignmentPoint assignmentPoint = assignmentPointService.getTrainingPoint(ids);
Map<String, Integer> map = null;
if (assignmentPoint != null) {
map = new HashMap<String, Integer>(2);
map.put("minPoint", assignmentPoint.getMinScore());
map.put("maxPoint", assignmentPoint.getMaxScore());
}
return map;
}
@PostMapping("/getPageToCalendar")
public Page<AssignmentCalendarVO> getPageToCalendar(@ApiParam("paramVo") @RequestBody CalendarTaskParamVo paramVo){
Page<Assignment> page = new Page(paramVo.getPageNo(), paramVo.getPageSize());
return assignmentService.getPageToCalendar(paramVo.getDate(),page);
}
}
package com.yizhi.application.entity;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 老师布置作业的主表
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
@Data
@TableName("assignment")
public class Assignment extends Model<Assignment> {
private static final long serialVersionUID = 1L;
private Long id;
@TableField("training_project_id")
private Long trainingProjectId;
@TableField("training_project_name")
private String trainingProjectName;
@TableField("serial_num")
private Long serialNum;
private String name;
@TableField("enable_remind")
private Integer enableRemind;
private Integer amendable;
@TableField("visible_range")
private Integer visibleRange;
@TableField("finish_time")
private Date finishTime;
private Integer status;
private Integer count;
@TableField("pass_score")
private Integer passScore;
private Integer type;
@TableField("added_time")
private Date addedTime;
@TableField("company_id")
private Long companyId;
@TableField("site_id")
private Long siteId;
@TableField("org_id")
private Long orgId;
@TableField(value = "create_by_id", fill = FieldFill.INSERT)
private Long createById;
@TableField(value = "create_by_name", fill = FieldFill.INSERT)
private String createByName;
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
@TableField(value = "update_by_id", fill = FieldFill.INSERT)
private Long updateById;
@TableField(value = "update_by_name", fill = FieldFill.INSERT)
private String updateByName;
@TableField(value = "update_time", fill = FieldFill.INSERT)
private Date updateTime;
@TableField("answer_charater_num_min")
private Integer answerCharaterNumMin;
@TableField("answer_charater_num_max")
private Integer answerCharaterNumMax;
@TableField("answer_attachment_num_min")
private Integer answerAttachmentNumMin;
@TableField("answer_attachment_num_max")
private Integer answerAttachmentNumMax;
@TableField("show_res")
private Integer showRes;
@TableField("enable_exercise_book")
private Integer enableExerciseBook;
@TableField("keywords")
private String keywords;
private String image;
@TableField("enable_task")
private Integer enableTask;
@TableField("task_start_date")
private Date taskStartDate;
@TableField("task_end_date")
private Date taskEndDate;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.yizhi.application.entity;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 学员对作业的对应关系
* <p>
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
@Data
@TableName("assignment_answer")
public class AssignmentAnswer extends Model<AssignmentAnswer> {
private static final long serialVersionUID = 1L;
private Long id;
@TableField("assignment_id")
private Long assignmentId;
@TableField("real_name")
private String realName;
@TableField("account_id")
private Long accountId;
@TableField("account_name")
private String accountName;
private String content;
private Integer score;
@TableField("point")
private Integer Point;
@TableField("auditor_id")
private Long auditorId;
@TableField("auditor_time")
private Date auditorTime;
private Integer status;
@TableField("source")
private Integer source;
@TableField("company_id")
private Long companyId;
@TableField("site_id")
private Long siteId;
@TableField("org_id")
private Long orgId;
@TableField(value = "create_by_id", fill = FieldFill.INSERT)
private Long createById;
@TableField(value = "create_by_name", fill = FieldFill.INSERT)
private String createByName;
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
@TableField(value = "update_by_id", fill = FieldFill.INSERT)
private Long updateById;
@TableField(value = "update_by_name", fill = FieldFill.INSERT)
private String updateByName;
@TableField(value = "update_time", fill = FieldFill.INSERT)
private Date updateTime;
@TableField(value="answer_file_zip")
private String answerFileZip;
@TableField("is_down")
private Integer isDown;
private Integer deleted;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.yizhi.application.entity;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 一个学员对一个作业的回复内容
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
@Data
@TableName("assignment_answer_course")
public class AssignmentAnswerCourse extends Model<AssignmentAnswerCourse> {
private static final long serialVersionUID = 1L;
private Long id;
@TableField("answer_id")
private Long answerId;
@TableField("mid")
private Long mid;
@TableField(value = "create_by_id", fill = FieldFill.INSERT)
private Long createById;
@TableField(value = "create_by_name", fill = FieldFill.INSERT)
private String createByName;
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
@TableField(value = "update_by_id", fill = FieldFill.INSERT)
private Long updateById;
@TableField(value = "update_by_name", fill = FieldFill.INSERT)
private String updateByName;
@TableField(value = "update_time", fill = FieldFill.INSERT)
private Date updateTime;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.yizhi.application.entity;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 学员对作业回复可以是文件,存放学员的作业回复的文件的地址
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
@Data
@TableName("assignment_answer_file")
public class AssignmentAnswerFile extends Model<AssignmentAnswerFile> {
private static final long serialVersionUID = 1L;
private Long id;
@TableField("anwser_id")
private Long anwserId;
private Integer type;
@TableField("file_url")
private String fileUrl;
@TableField("file_name")
private String fileName;
private String suffix;
private String size;
private String png;
@TableField(value = "create_by_id", fill = FieldFill.INSERT)
private Long createById;
@TableField(value = "create_by_name", fill = FieldFill.INSERT)
private String createByName;
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
@TableField("video_ld")
private String videoLd;
@TableField("video_sd")
private String videoSd;
@TableField("video_hd")
private String videoHd;
@TableField(value = "is_video")
private Integer isVideo;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.yizhi.application.entity;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 老师对学员做的作业的回复内容
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
@Data
@TableName("assignment_answer_suggestion")
public class AssignmentAnswerSuggestion extends Model<AssignmentAnswerSuggestion> {
private static final long serialVersionUID = 1L;
private Long id;
@TableField("answer_id")
private Long answerId;
private String suggestion;
@TableField(value = "create_by_id", fill = FieldFill.INSERT)
private Long createById;
@TableField(value = "create_by_name", fill = FieldFill.INSERT)
private String createByName;
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
@TableField(value = "update_by_id", fill = FieldFill.INSERT)
private Long updateById;
@TableField(value = "update_by_name", fill = FieldFill.INSERT)
private String updateByName;
@TableField(value = "update_time", fill = FieldFill.INSERT)
private Date updateTime;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.yizhi.application.entity;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @ClassName AssignmentAnswerThumb
* @Description TODO
* @Author shengchenglong
* @DATE 2019-10-22 12:01
* @Version 1.0
*/
@Data
@TableName("assignment_answer_thumb")
public class AssignmentAnswerThumb extends Model<AssignmentAnswerThumb> {
private Long id;
@TableField("assignment_answer_id")
private Long assignmentAnswerId;
@TableField("account_id")
private Long accountId;
@TableField("is_thumb")
private Integer isThumb;
@TableField("create_time")
private Date createTime;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.yizhi.application.entity;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author shengchenglong123
* @since 2019-10-22
*/
@Data
@TableName("assignment_answer_tipoff")
public class AssignmentAnswerTipoff extends Model<AssignmentAnswerTipoff> {
private static final long serialVersionUID = 1L;
private Long id;
@TableField("assignment_answer_id")
private Long assignmentAnswerId;
private String content;
@TableField("img_url")
private String imgUrl;
private String company;
@TableField(value = "create_by_id", fill = FieldFill.INSERT)
private Long createById;
@TableField(value = "create_by_name", fill = FieldFill.INSERT)
private String createByName;
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
private Integer status;
@TableField("auditor_id")
private Long auditorId;
@TableField("audit_content")
private String auditContent;
@TableField("audit_time")
private Date auditTime;
@TableField("is_new")
private Integer isNew;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.yizhi.application.entity;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 作业和评阅人的对应关系
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
@Data
@TableName("assignment_auditor")
public class AssignmentAuditor extends Model<AssignmentAuditor> {
private static final long serialVersionUID = 1L;
private Long id;
@TableField("assignment_id")
private Long assignmentId;
@TableField("account_id")
private Long accountId;
@TableField(value = "create_by_id", fill = FieldFill.INSERT)
private Long createById;
@TableField(value = "create_by_name", fill = FieldFill.INSERT)
private String createByName;
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.yizhi.application.entity;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 作业答案 - 评论
* </p>
*
* @author shengchenglong123
* @since 2019-10-22
*/
@Data
@TableName("assignment_comment")
public class AssignmentComment extends Model<AssignmentComment> {
private static final long serialVersionUID = 1L;
private Long id;
@TableField("assignment_answer_id")
private Long assignmentAnswerId;
private String content;
@TableField("audit_status")
private Integer auditStatus;
@TableField("auditor_id")
private Long auditorId;
@TableField("audit_content")
private String auditContent;
@TableField("auditor_time")
private Date auditorTime;
@TableField(value = "create_by_id", fill = FieldFill.INSERT)
private Long createById;
@TableField(value = "create_by_name", fill = FieldFill.INSERT)
private String createByName;
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
@TableField("parent_id")
private Long parentId;
@TableField("parent_create_by_name")
private String parentCreateByName;
@TableField("parent_create_by_id")
private Long parentCreateById;
@TableField("site_id")
private Long siteId;
@TableField("org_id")
private Long orgId;
@TableField("company_id")
private Long companyId;
@TableField("user_avatar")
private String userAvatar;
//
// private Integer status;
private Integer deleted;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.yizhi.application.entity;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 老师布置的作业的内容
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
@Data
@TableName("assignment_content")
public class AssignmentContent extends Model<AssignmentContent> {
private static final long serialVersionUID = 1L;
private Long id;
@TableField("assignment_id")
private Long assignmentId;
private String comment;
@TableField(value = "create_by_id", fill = FieldFill.INSERT)
private Long createById;
@TableField(value = "create_by_name", fill = FieldFill.INSERT)
private String createByName;
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
@TableField(value = "update_by_id", fill = FieldFill.INSERT)
private Long updateById;
@TableField(value = "update_by_name", fill = FieldFill.INSERT)
private String updateByName;
@TableField(value = "update_time", fill = FieldFill.INSERT)
private Date updateTime;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.yizhi.application.entity;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 老师布置的作业对应多个文件,存放多个文件地址
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
@Data
@TableName("assignment_file")
public class AssignmentFile extends Model<AssignmentFile> {
private static final long serialVersionUID = 1L;
private Long id;
@TableField("assignment_id")
private Long assignmentId;
@TableField("file_url")
private String fileUrl;
@TableField("file_name")
private String fileName;
private String suffix;
/**
* 文件大小
*/
private String size;
@TableField(value = "create_by_id", fill = FieldFill.INSERT)
private Long createById;
@TableField(value = "create_by_name", fill = FieldFill.INSERT)
private String createByName;
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.yizhi.application.entity;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 老师布置的作业等级
* 编号100号作业 可以有多个等级
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
@Data
@TableName("assignment_grade")
public class AssignmentGrade extends Model<AssignmentGrade> {
private static final long serialVersionUID = 1L;
private Long id;
@TableField("assignment_id")
private Long assignmentId;
@TableField("min_score")
private String minScore;
@TableField("max_score")
private String maxScore;
@TableField("description")
private String description;
@TableField(value = "create_by_id", fill = FieldFill.INSERT)
private Long createById;
@TableField(value = "create_by_name", fill = FieldFill.INSERT)
private String createByName;
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.yizhi.application.entity;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author yizhi123
* @since 2018-09-04
*/
@Data
@TableName("assignment_point")
public class AssignmentPoint extends Model<AssignmentPoint> {
private static final long serialVersionUID = 1L;
private Long id;
@TableField("assignment_id")
private Long assignmentId;
@TableField("min_score")
private Integer minScore;
@TableField("max_score")
private Integer maxScore;
@TableField("point")
private Integer point;
@TableField(value = "create_by_id", fill = FieldFill.INSERT)
private Long createById;
@TableField(value = "create_by_name", fill = FieldFill.INSERT)
private String createByName;
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.yizhi.application.entity;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 老师布置作业和学生进行关联。
* 多对多的关系。
* 一个老师布置的作业有多个学生做。
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
@Data
@TableName("assignment_student")
public class AssignmentStudent extends Model<AssignmentStudent> {
private static final long serialVersionUID = 1L;
private Long id;
@TableField("assignment_id")
private Long assignmentId;
@TableField("account_id")
private Long accountId;
@TableField("type")
private Integer type;
@TableField(value = "create_by_id", fill = FieldFill.INSERT)
private Long createById;
@TableField(value = "create_by_name", fill = FieldFill.INSERT)
private String createByName;
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.yizhi.application.entity;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import com.yizhi.util.application.sensitive.annotation.SensitiveWords;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 培训项目 - 评论
* </p>
*
* @author shengchenglong
* @since 2018-03-27
*/
@Data
@TableName("comment")
public class Comment extends Model<Comment> {
private static final long serialVersionUID = 1L;
private Long id;
@TableField("assignment_answer_id")
private Long assignmentAnswerId;
@SensitiveWords
private String content;
@TableField("audit_status")
private String auditStatus;
@TableField("auditor_id")
private Long auditorId;
@TableField("audit_content")
private String auditContent;
@TableField("auditor_time")
private Date auditorTime;
@TableField(value = "create_by_id", fill = FieldFill.INSERT)
private Long createById;
@TableField(value = "create_by_name", fill = FieldFill.INSERT)
private String createByName;
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
@TableField("site_id")
private Long siteId;
@TableField("org_id")
private Long orgId;
@TableField("company_id")
private Long companyId;
@TableField("user_avatar")
private String userAvatar;
@Override
protected Serializable pkVal() {
return this.id;
}
@TableField("state")
private Integer state;
}
package com.yizhi.application.entity;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import com.yizhi.util.application.sensitive.annotation.SensitiveWords;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 培训项目 - 评论回复
* </p>
*
* @author shengchenglong
* @since 2018-03-27
*/
@Data
@TableName("comment_reply")
public class CommentReply extends Model<CommentReply> {
private static final long serialVersionUID = 1L;
private Long id;
@TableField("comment_id")
private Long commentId;
@TableField("assignment_answer_id")
private Long assignmentAnswerId;
@SensitiveWords
private String content;
@TableField("audit_status")
private String auditStatus;
@TableField("auditor_id")
private Long auditorId;
@TableField("auditor_time")
private Date auditorTime;
@TableField(value = "create_by_id", fill = FieldFill.INSERT)
private Long createById;
@TableField(value = "create_by_name", fill = FieldFill.INSERT)
private String createByName;
@TableField(value = "create_by_full_name")
private String createByFullName;
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
@TableField("site_id")
private Long siteId;
@TableField("org_id")
private Long orgId;
@TableField("company_id")
private Long companyId;
@TableField("user_avatar")
private String userAvatar;
@TableField("parent_account_id")
private Long parentAccountId;
@TableField("parent_account_fullName")
private String parentAccountFullName;
@TableField("parent_account_name")
private String parentAccountName;
@TableField("reply_parent_id")
private Long replyParentId;
@Override
protected Serializable pkVal() {
return this.id;
}
@TableField("state")
private Integer state;
}
package com.yizhi.application.entity;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import lombok.Data;
import java.io.Serializable;
/**
* <p>
* 评论点赞记录
* </p>
*
* @author shengchenglong
* @since 2018-03-27
*/
@Data
@TableName("comment_thumbs_up")
public class CommentThumbsUp extends Model<CommentThumbsUp> {
private static final long serialVersionUID = 1L;
private Long id;
@TableField("comment_id")
private Long commentId;
@TableField("account_id")
private Long accountId;
@TableField(exist = false)
private Boolean hasThumbsUp;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.yizhi.application.eum;
/**
* 作业文件类型
*
* @Author: shengchenglong
* @Date: 2018/3/9 17:22
*/
public enum AnswerFileTypeEnum {
/**
* 作业答案
*/
ANSWER(1),
/**
* 评阅回复
*/
REPLY(2);
private int value;
private AnswerFileTypeEnum(int value) {
this.value = value;
}
public int getValue() {
return value;
}
}
package com.yizhi.application.eum;
/**
* 作业评阅状态
*
* @Author: shengchenglong
* @Date: 2018/3/9 17:09
*/
public enum AnswerStatusEnum {
/**
* 待阅
*/
UNCHECKED(1),
/**
* 已阅
*/
CHECKED(2);
private int value;
private AnswerStatusEnum(int value) {
this.value = value;
}
public int getValue() {
return value;
}
}
package com.yizhi.application.mapper;
import com.yizhi.application.entity.AssignmentAnswerCourse;
import com.baomidou.mybatisplus.mapper.BaseMapper;
/**
* <p>
* 一个学员对一个作业的回复内容 Mapper 接口
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
public interface AssignmentAnswerCourseMapper extends BaseMapper<AssignmentAnswerCourse> {
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yizhi.application.mapper.AssignmentAnswerCourseMapper">
<resultMap id="BaseResultMap" type="com.yizhi.application.entity.AssignmentAnswerCourse">
<id column="tb_id" jdbcType="BIGINT" property="id" />
<result column="tb_answer_id" jdbcType="BIGINT" property="answerId" />
<result column="tb_create_by_id" jdbcType="BIGINT" property="createById" />
<result column="tb_create_by_name" jdbcType="VARCHAR" property="createByName" />
<result column="tb_create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="tb_update_by_id" jdbcType="BIGINT" property="updateById" />
<result column="tb_update_by_name" jdbcType="VARCHAR" property="updateByName" />
<result column="tb_update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
tb.id as tb_id, tb.answer_id as tb_answer_id, tb.content as tb_content, tb.create_by_id as tb_create_by_id,
tb.create_by_name as tb_create_by_name, tb.create_time as tb_create_time, tb.update_by_id as tb_update_by_id,
tb.update_by_name as tb_update_by_name, tb.update_time as tb_update_time
</sql>
</mapper>
\ No newline at end of file
package com.yizhi.application.mapper;
import java.util.List;
import com.yizhi.application.entity.AssignmentAnswerFile;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.yizhi.assignment.application.vo.apivo.ApiFileVo;
/**
* <p>
* 学员对作业回复可以是文件,存放学员的作业回复的文件的地址 Mapper 接口
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
public interface AssignmentAnswerFileMapper extends BaseMapper<AssignmentAnswerFile> {
/**
* 根据type类型找到对应的答案文件或者回复文件
* @param answerId
* @param type
* @return
*/
List<ApiFileVo> listAssignmentAnswerFile(@Param("answerId")Long answerId,@Param("type")Integer type);
/**
* 确认文件是视屏文件
* @param ids
* @return
*/
Integer verifyVideo(@Param("ids") List<Long> ids);
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yizhi.application.mapper.AssignmentAnswerFileMapper">
<select id="listAssignmentAnswerFile" resultType="com.yizhi.assignment.application.vo.apivo.ApiFileVo">
select
id,
file_name as fileName,
suffix,
file_url as ossUrl,
size,
DATE_FORMAT(create_time,'%Y-%m-%d %H:%m:%s') as upLoadTime,
is_video as video,
video_sd as videoSd
from assignment_answer_file where anwser_id=#{answerId} and type=#{type}
</select>
<update id="verifyVideo">
update assignment_answer_file
set is_video = 1
where id in
(<foreach collection="ids" separator="," item="id">
#{id}
</foreach>)
</update>
</mapper>
\ No newline at end of file
package com.yizhi.application.mapper;
import java.util.Date;
import java.util.List;
import com.yizhi.application.entity.AssignmentAnswer;
import com.yizhi.assignment.application.vo.TipoffAssignmentListVO;
import com.yizhi.core.application.context.RequestContext;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.yizhi.assignment.application.vo.AssignmentAnswerExport;
import com.yizhi.assignment.application.vo.AssignmentReadListVO;
import com.yizhi.assignment.application.vo.apivo.ApiAssignmentAnswerVo;
import com.yizhi.assignment.application.vo.apivo.ApiSuggestionVo;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.session.RowBounds;
/**
* <p>
* 学员对作业的对应关系
Mapper 接口
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
public interface AssignmentAnswerMapper extends BaseMapper<AssignmentAnswer> {
/**
* 根据作业id和账号id找到最大的分数 学员端 2018-09-07
* @param accountId
* @param assignmentId
* @return
*/
AssignmentAnswer maxGradeByAccountIdAndAssignmentId(@Param("accountId")Long accountId, @Param("assignmentId")Long assignmentId);
/** 管理端 2018-09-07
* 下一份学生作业id
*/
Long getNextAssignmentAnswerId(@Param("createTime")Date createTime,@Param("assignmentId")Long assignmentId);
/**
* 上一份学生作业id 管理端 2018-09-07
*/
Long getPrevAssignmentAnswerId(@Param("createTime")Date createTime,@Param("assignmentId")Long assignmentId);
/**
* 根据条件查询作业列表
* @return
*/
List<AssignmentReadListVO> list(@Param("admin") Integer admin, @Param("accountId")Long accountId, @Param("assignmentId")Long assignmentId,@Param("status") Integer status,@Param("type") Integer type,@Param("accountIdList") List<Long> accountIdList,Page<AssignmentReadListVO> page);
List<AssignmentReadListVO> list(@Param("admin") Integer admin, @Param("accountId")Long accountId, @Param("assignmentId")Long assignmentId,@Param("status") Integer status,@Param("type") Integer type,@Param("accountIdList") List<Long> accountIdList);
List<AssignmentReadListVO> getAnswerIdList(@Param("admin") Integer admin,@Param("accountId")Long accountId, @Param("assignmentId")Long assignmentId,@Param("status") Integer status,@Param("type") Integer type,@Param("accountIdList") List<Long> accountIdList);
/**
* 作业总人数
* @param assignmentId
* @param status
* @param name
* @param accountIdList
* @param start
* @param end
* @return
*/
Integer listNum(@Param("assignmentId")Long assignmentId,@Param("status") Integer status,@Param("name") String name,@Param("accountIdList") List<Long> accountIdList,@Param("start") Integer start,@Param("end") Integer end);
/**
* 批量下载学生作业结果
*/
List<AssignmentAnswerExport> listExport(@Param("answerIds")List<Long> ids);
/**
* 根据答案得到答案详情
*/
ApiSuggestionVo getMyAnswerDetailsByAssignmentId(@Param("assignmentId")Long assignmentId,@Param("accountId")Long accountId);
/**
* 分数制查出来批阅结果
*/
List<AssignmentAnswerExport> exportResultExcelScore(@Param("assignmentId")Long assignmentId,@Param("answerIds")List<Long> answerIds);
/**
* 等级制查出来批阅结果
*/
List<AssignmentAnswerExport> exportResultExcelGrade(@Param("assignmentId")Long assignmentId,@Param("answerIds")List<Long> answerIds);
List<ApiAssignmentAnswerVo> listApiAssignmentAnswerVo(@Param("assignmentId")Long assignmentId,@Param("accountId")Long accountId,@Param("passScore")Integer passScore);
/**
* 导出批阅结果
* @param answerIds
* @return
*/
List<AssignmentAnswerExport> listAssignmentAnswerExport(@Param("answerIds")List<Long> answerIds);
List<Long> getListIdsBySiteIdAndAssignmentIdsAndAccountId(@Param("siteId")Long siteId, @Param("accountId")Long accountId,@Param("ids") List<Long> ids);
//查看是否有压缩包
String getStudentAnswerZipByAnswerId(@Param("answerId")Long answerId);
List<Long> getFinishedAccountIds(@Param("assignmentId")Long assignmentId,@Param("siteId")Long siteId,@Param("companyId")Long companyId);
Integer getScore(@Param("assignmentId") Long assignmentId, @Param("siteId") Long siteId, @Param("companyId") Long companyId, @Param("accountId") Long accountId);
List<TipoffAssignmentListVO> tipoffAssignmentList(@Param("assignmentName") String assignmentName,
@Param("context") RequestContext context, RowBounds rowBounds);
int tipoffAssignmentListCount(@Param("assignmentName") String assignmentName,
@Param("context") RequestContext context);
@Select("select count(*) from (select id " +
"from assignment_answer " +
"where assignment_id = #{assignmentId} and deleted = 0 " +
"group by create_by_id) tb")
int countCommitAccountNum(@Param("assignmentId") Long assignmentId);
List<AssignmentAnswer> getJoinIdsByIds(@Param("siteId") Long siteId, @Param("accountId") Long accountId, @Param("ids")List<Long> ids);
/**
* 作业提交的次数
* @param assignmentId
* @param accountId
* @param status
* @return
*/
Integer selectAnswerCount(@Param("assignmentId")Long assignmentId,@Param("accountId")Long accountId,@Param("status") Integer status);
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace="com.yizhi.application.mapper.AssignmentAnswerMapper">
<resultMap id="BaseResultMap"
type="com.yizhi.application.entity.AssignmentAnswer">
<id column="tb_id" jdbcType="BIGINT" property="id" />
<result column="tb_assignment_id" jdbcType="BIGINT"
property="assignmentId" />
<result column="tb_account_id" jdbcType="BIGINT"
property="accountId" />
<result column="tb_real_name" jdbcType="VARCHAR"
property="realName" />
<result column="tb_score" jdbcType="INTEGER" property="score" />
<result column="tb_grade_id" jdbcType="BIGINT"
property="gradeId" />
<result column="tb_auditor_id" jdbcType="BIGINT"
property="auditorId" />
<result column="tb_status" jdbcType="BIT" property="status" />
<result column="tb_company_id" jdbcType="BIGINT"
property="companyId" />
<result column="tb_account_name" jdbcType="VARCHAR"
property="accountName" />
<result column="tb_site_id" jdbcType="BIGINT" property="siteId" />
<result column="tb_org_id" jdbcType="BIGINT" property="orgId" />
<result column="tb_create_by_id" jdbcType="BIGINT"
property="createById" />
<result column="tb_create_by_name" jdbcType="VARCHAR"
property="createByName" />
<result column="tb_create_time" jdbcType="TIMESTAMP"
property="createTime" />
<result column="tb_update_by_id" jdbcType="BIGINT"
property="updateById" />
<result column="tb_update_by_name" jdbcType="VARCHAR"
property="updateByName" />
<result column="tb_update_time" jdbcType="TIMESTAMP"
property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
tb.id as tb_id, tb.assignment_id as tb_assignment_id, tb.account_id as
tb_account_id,
tb.real_name as tb_real_name, tb.score as tb_score, tb.grade_id as tb_grade_id,
tb.auditor_id as tb_auditor_id,
tb.status as tb_status, tb.company_id as tb_company_id, tb.account_name as
tb_account_name,
tb.site_id as tb_site_id, tb.org_id as tb_org_id, tb.create_by_id as
tb_create_by_id,
tb.create_by_name as tb_create_by_name, tb.create_time as tb_create_time,
tb.update_by_id as tb_update_by_id,
tb.update_by_name as tb_update_by_name, tb.update_time as tb_update_time
</sql>
<select id="list" resultType="com.yizhi.assignment.application.vo.AssignmentReadListVO">
SELECT
DISTINCT aa.id,aa.account_id as accountId,
aa.account_name as accountName,
aa.real_name as realName,
aa.create_time as createTime,
aa.score,
aa.status,
(select count(*) from assignment_answer_thumb aat where aat.assignment_answer_id = aa.id and aat.is_thumb = 1) as thumbupTimes,
(select count(*) from assignment_comment ac where ac.assignment_answer_id = aa.id and ac.deleted = 0) as commentTimes,
aa.is_down as down
FROM assignment_answer aa
LEFT JOIN assignment_auditor aau ON aa.assignment_id=aau.assignment_id
where
aa.assignment_id=#{assignmentId}
<if test="admin == 0 ">
and aau.account_id=#{accountId}
</if>
and aa.deleted = 0
<if test="status!=null">
and aa.status=#{status}
</if>
<if test="accountIdList!=null and accountIdList.size()>0">
and aa.account_id in
<foreach collection="accountIdList" index="index" item="item"
open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="type == 1">
order by aa.create_time desc
</if>
</select>
<select id="getAnswerIdList" resultType="com.yizhi.assignment.application.vo.AssignmentReadListVO">
SELECT
DISTINCT aa.id,aa.account_id as accountId
FROM assignment_answer aa
LEFT JOIN assignment_auditor aau ON aa.assignment_id=aau.assignment_id
where
aa.assignment_id=#{assignmentId}
<if test="admin == 0 ">
and aau.account_id=#{accountId}
</if>
and aa.deleted = 0
<if test="status!=null">
and aa.status=#{status}
</if>
<if test="accountIdList!=null and accountIdList.size()>0">
and aa.account_id in
<foreach collection="accountIdList" index="index" item="item"
open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="type == 1">
order by aa.create_time desc
</if>
</select>
<select id="getNextAssignmentAnswerId"
resultType="java.lang.Long">
SELECT id FROM assignment_answer WHERE assignment_id = #{assignmentId}
and create_time <![CDATA[ < ]]>
#{createTime} ORDER BY create_time desc LIMIT 1
</select>
<select id="getPrevAssignmentAnswerId"
resultType="java.lang.Long">
SELECT id FROM assignment_answer WHERE assignment_id = #{assignmentId}
and create_time <![CDATA[ > ]]>
#{createTime} ORDER BY create_time asc LIMIT 1
</select>
<select id="getMyAnswerDetailsByAssignmentId"
resultType="com.yizhi.assignment.application.vo.apivo.ApiSuggestionVo">
SELECT a.id,a.name as assignmentName,a.finish_time AS
finishTime,aa.status,a.type,aa.score,aa.create_time AS
commitTime,ag.name AS gradeName,aas.suggestion
FROM assignment a
LEFT JOIN assignment_answer aa ON a.id=aa.assignment_id
LEFT JOIN assignment_grade ag ON aa.grade_id=ag.id
LEFT JOIN assignment_answer_suggestion aas ON a.id=aas.answer_id
WHERE aa.assignment_id=#{assignmentId} and aa.account_id=#{accountId}
</select>
<select id="exportResultExcelScore"
resultType="com.yizhi.assignment.application.vo.AssignmentAnswerExport">
SELECT aa.account_id AS
accountId,aa.real_name,aa.account_name,aa.score,aa.STATUS as
state,aa.create_time as commitTime,aa.update_time as
lastReadTime,aas.suggestion
FROM assignment_answer aa
left join assignment_answer_suggestion aas on aa.id=aas.answer_id
where aa.assignment_id=#{assignmentId}
<if test="answerIds!=null">
and aa.id in
<foreach collection="answerIds" index="index" item="item"
open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
<select id="exportResultExcelGrade"
resultType="com.yizhi.assignment.application.vo.AssignmentAnswerExport">
SELECT aa.account_id AS accountId,aa.real_name,aa.account_name,ag.name
as grade,aa.STATUS as state,aa.create_time as
commitTime,aa.update_time as lastReadTime,aas.suggestion
FROM assignment_answer aa
left join assignment_answer_suggestion aas on aa.id=aas.answer_id
left join assignment_grade ag on aa.grade_id=ag.id
where aa.assignment_id=#{assignmentId}
<if test="answerIds!=null">
and aa.id in
<foreach collection="answerIds" index="index" item="item"
open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
<select id="listApiAssignmentAnswerVo" resultType="com.yizhi.assignment.application.vo.apivo.ApiAssignmentAnswerVo">
select
#{assignmentId} as assignmentId,
id as answerId,
create_time as commitTime,
status as status,
score as score,is_down as isDown,
case
when score <![CDATA[ < ]]> #{passScore}
then 2 when score <![CDATA[ >= ]]> #{passScore}
then 1 end as isPass
from assignment_answer
where
assignment_id=#{assignmentId} and deleted = 0
<if test="accountId != null">
and account_id=#{accountId}
</if>
order by create_time desc
</select>
<select id="maxGradeByAccountIdAndAssignmentId"
resultType="com.yizhi.application.entity.AssignmentAnswer">
SELECT * FROM assignment_answer WHERE deleted = 0 and is_down = 0 and assignment_id = #{assignmentId} AND
account_id=#{accountId} ORDER BY score DESC,update_time DESC limit 1
</select>
<select id="listAssignmentAnswerExport"
resultType="com.yizhi.assignment.application.vo.AssignmentAnswerExport">
SELECT aa.id answerId, aa.account_id AS accountId,aa.account_name AS
accountName,aa.real_name AS realName,aa.create_time AS
commitTime,aa.status AS state, aa.auditor_time AS
lastReadTime,aa.score AS score,aa.content AS content,aas.suggestion AS
suggestion FROM assignment_answer aa LEFT JOIN
assignment_answer_suggestion aas ON aa.id=aas.answer_id
where
<if test="answerIds!=null">
aa.id in
<foreach collection="answerIds" index="index" item="item"
open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
<select id="getListIdsBySiteIdAndAssignmentIdsAndAccountId"
resultType="java.lang.Long">
select distinct(assignment_id) from assignment_answer where
site_id=#{siteId} and account_id=#{accountId}
<if test="ids!=null and ids.size()>0">
and assignment_id in
<foreach collection="ids" index="index" item="item" open="("
separator="," close=")">
#{item}
</foreach>
</if>
</select>
<select id="getStudentAnswerZipByAnswerId"
resultType="java.lang.String">
select answer_file_zip from assignment_answer where id=#{answerId};
</select>
<select id="getFinishedAccountIds" resultType="java.lang.Long">
SELECT
a.account_id
FROM
assignment_answer a
WHERE
a.assignment_id = #{assignmentId}
AND a.site_id = #{siteId}
AND a.company_id = #{companyId}
AND a.status=2
GROUP BY
a.account_id
</select>
<select id="getScore" resultType="java.lang.Integer">
SELECT
MAX(a.score)
FROM
assignment_answer a
WHERE
a.account_id = #{accountId}
<if test="companyId != null" >
AND a.company_id = #{companyId}
</if>
<if test="siteId != null">
AND a.site_id = #{siteId}
</if>
AND a.assignment_id = #{assignmentId}
</select>
<select id="tipoffAssignmentList" resultType="com.yizhi.assignment.application.vo.TipoffAssignmentListVO">
select *
from
(select
answer.id as answerId,
a.name as assignmentName,
answer.account_id as accountId,
answer.create_time as commitTime,
count(tipoff.id) as tipoffTimes,
tipoff.create_time as tipoffTime
from
assignment_answer answer
left join assignment a on answer.assignment_id = a.id
left join assignment_answer_tipoff tipoff on tipoff.assignment_answer_id = answer.id
where tipoff.status = 0 and answer.is_down = 0 and a.name like concat('%', #{assignmentName}, '%')
and answer.site_id = #{context.siteId} and answer.company_id = #{context.companyId}
group by answer.id
order by tipoff.create_time desc) tb
where tb.tipoffTimes > 0
</select>
<select id="tipoffAssignmentListCount" resultType="java.lang.Integer">
select count(*)
from
(select
answer.id as answerId,
count(tipoff.id) as tipoffTimes
from
assignment_answer answer
left join assignment a on answer.assignment_id = a.id
left join assignment_answer_tipoff tipoff on tipoff.assignment_answer_id = answer.id
where tipoff.status = 0 and answer.is_down = 0 and a.name like concat('%', #{assignmentName}, '%')
and answer.site_id = #{context.siteId} and answer.company_id = #{context.companyId}
group by answer.id) tb
where tb.tipoffTimes > 0
</select>
<select id="getJoinIdsByIds" resultType="com.yizhi.application.entity.AssignmentAnswer">
SELECT assignment_id as assignmentId,status ,score FROM assignment_answer c
where
c.account_id = #{accountId}
and c.deleted = 0
and c.site_id = #{siteId}
<if test="ids != null and ids.size() > 0">
and c.assignment_id in (<foreach collection="ids" item="item" separator=",">#{item}</foreach>)
</if>
</select>
<select id="selectAnswerCount" resultType="java.lang.Integer">
SELECT count(*) FROM assignment_answer WHERE assignment_id = #{assignmentId}
AND account_id = #{accountId}
<if test="status != null">
AND is_down = #{status}
</if>
</select>
</mapper>
\ No newline at end of file
package com.yizhi.application.mapper;
import com.yizhi.application.entity.AssignmentAnswerSuggestion;
import com.baomidou.mybatisplus.mapper.BaseMapper;
/**
* <p>
* 老师对学员做的作业的回复内容 Mapper 接口
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
public interface AssignmentAnswerSuggestionMapper extends BaseMapper<AssignmentAnswerSuggestion> {
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yizhi.application.mapper.AssignmentAnswerSuggestionMapper">
<resultMap id="BaseResultMap" type="com.yizhi.application.entity.AssignmentAnswerSuggestion">
<id column="tb_id" jdbcType="BIGINT" property="id" />
<result column="tb_answer_id" jdbcType="BIGINT" property="answerId" />
<result column="tb_suggestion" jdbcType="LONGVARCHAR" property="suggestion" />
<result column="tb_create_by_id" jdbcType="BIGINT" property="createById" />
<result column="tb_create_by_name" jdbcType="VARCHAR" property="createByName" />
<result column="tb_create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="tb_update_by_id" jdbcType="BIGINT" property="updateById" />
<result column="tb_update_by_name" jdbcType="VARCHAR" property="updateByName" />
<result column="tb_update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
tb.id as tb_id, tb.answer_id as tb_answer_id, tb.suggestion as tb_suggestion, tb.create_by_id as tb_create_by_id,
tb.create_by_name as tb_create_by_name, tb.create_time as tb_create_time, tb.update_by_id as tb_update_by_id,
tb.update_by_name as tb_update_by_name, tb.update_time as tb_update_time
</sql>
</mapper>
\ No newline at end of file
package com.yizhi.application.mapper;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.yizhi.application.entity.AssignmentAnswerThumb;
/**
* @ClassName AssignmentAnswerThumbMapper
* @Description TODO
* @Author shengchenglong
* @DATE 2019-10-22 14:39
* @Version 1.0
*/
public interface AssignmentAnswerThumbMapper extends BaseMapper<AssignmentAnswerThumb> {
}
package com.yizhi.application.mapper;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.yizhi.application.entity.AssignmentAnswerTipoff;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.Date;
/**
* <p>
* Mapper 接口
* </p>
*
* @author shengchenglong123
* @since 2019-10-22
*/
public interface AssignmentAnswerTipoffMapper extends BaseMapper<AssignmentAnswerTipoff> {
@Select("select is_new from " +
"assignment_answer_tipoff " +
"where assignment_answer_id = #{answerId} " +
"order by create_time desc " +
"limit 1")
Integer lastIsNew(@Param("answerId") Long answerId);
@Update("update assignment_answer_tipoff " +
"set is_new = 0 " +
"where assignment_answer_id = #{answerId}")
Integer updateNotNew(@Param("answerId") Long answerId);
@Select("select create_time " +
"from assignment_answer_tipoff " +
"where assignment_answer_id = #{answerId} " +
"order by create_time desc " +
"limit 1")
Date getLastTipoffTime(@Param("answerId") Long answerId);
}
package com.yizhi.application.mapper;
import com.yizhi.application.entity.AssignmentAuditor;
import com.baomidou.mybatisplus.mapper.BaseMapper;
/**
* <p>
* 作业和评阅人的对应关系 Mapper 接口
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
public interface AssignmentAuditorMapper extends BaseMapper<AssignmentAuditor> {
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yizhi.application.mapper.AssignmentAuditorMapper">
</mapper>
\ No newline at end of file
package com.yizhi.application.mapper;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.yizhi.application.entity.AssignmentComment;
/**
* <p>
* 作业答案 - 评论 Mapper 接口
* </p>
*
* @author shengchenglong123
* @since 2019-10-22
*/
public interface AssignmentCommentMapper extends BaseMapper<AssignmentComment> {
}
package com.yizhi.application.mapper;
import com.yizhi.application.entity.AssignmentContent;
import com.baomidou.mybatisplus.mapper.BaseMapper;
/**
* <p>
* 老师布置的作业的内容 Mapper 接口
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
public interface AssignmentContentMapper extends BaseMapper<AssignmentContent> {
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yizhi.application.mapper.AssignmentContentMapper">
<resultMap id="BaseResultMap" type="com.yizhi.application.entity.AssignmentContent">
<id column="tb_id" jdbcType="BIGINT" property="id" />
<result column="tb_assignment_id" jdbcType="BIGINT" property="assignmentId" />
<result column="tb_comment" jdbcType="LONGVARCHAR" property="comment" />
<result column="tb_create_by_id" jdbcType="BIGINT" property="createById" />
<result column="tb_create_by_name" jdbcType="VARCHAR" property="createByName" />
<result column="tb_create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="tb_update_by_id" jdbcType="BIGINT" property="updateById" />
<result column="tb_update_by_name" jdbcType="VARCHAR" property="updateByName" />
<result column="tb_update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
tb.id as tb_id, tb.assignment_id as tb_assignment_id, tb.comment as tb_comment, tb.create_by_id as tb_create_by_id,
tb.create_by_name as tb_create_by_name, tb.create_time as tb_create_time, tb.update_by_id as tb_update_by_id,
tb.update_by_name as tb_update_by_name, tb.update_time as tb_update_time
</sql>
</mapper>
\ No newline at end of file
package com.yizhi.application.mapper;
import java.util.List;
import com.yizhi.application.entity.AssignmentFile;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.yizhi.assignment.application.vo.apivo.ApiFileVo;
/**
* <p>
* 老师布置的作业对应多个文件,存放多个文件地址 Mapper 接口
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
public interface AssignmentFileMapper extends BaseMapper<AssignmentFile> {
List<ApiFileVo> listApiFileVo(@Param("assignmentId")Long assignmentId);
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yizhi.application.mapper.AssignmentFileMapper">
<resultMap id="BaseResultMap" type="com.yizhi.application.entity.AssignmentFile">
<id column="tb_id" jdbcType="BIGINT" property="id" />
<result column="tb_assignment_id" jdbcType="BIGINT" property="assignmentId" />
<result column="tb_file_url" jdbcType="VARCHAR" property="fileUrl" />
<result column="tb_file_name" jdbcType="VARCHAR" property="fileName" />
<result column="tb_suffix" jdbcType="VARCHAR" property="suffix" />
<result column="size" jdbcType="VARCHAR" property="size" />
<result column="tb_create_by_id" jdbcType="BIGINT" property="createById" />
<result column="tb_create_by_name" jdbcType="VARCHAR" property="createByName" />
<result column="tb_create_time" jdbcType="TIMESTAMP" property="createTime" />
</resultMap>
<select id="listApiFileVo" resultType="com.yizhi.assignment.application.vo.apivo.ApiFileVo">
select file_name as fileName,suffix,file_url as ossUrl,size from assignment_file where assignment_id=#{assignmentId}
</select>
</mapper>
\ No newline at end of file
package com.yizhi.application.mapper;
import com.yizhi.application.entity.AssignmentGrade;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.mapper.BaseMapper;
/**
* <p>
* 老师布置的作业等级
编号100号作业 可以有多个等级 Mapper 接口
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
public interface AssignmentGradeMapper extends BaseMapper<AssignmentGrade> {
void deleteByAssignmentId(@Param("assignmentId")Long assignmentId);
AssignmentGrade getGradeByAssignmentIdAndScore(@Param("assignmentId")Long assignmentId,@Param("score")Integer score);
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yizhi.application.mapper.AssignmentGradeMapper">
<resultMap id="BaseResultMap" type="com.yizhi.application.entity.AssignmentGrade">
<id column="tb_id" jdbcType="BIGINT" property="id" />
<result column="tb_assignment_id" jdbcType="BIGINT" property="assignmentId" />
<result column="tb_name" jdbcType="VARCHAR" property="name" />
<result column="tb_create_by_id" jdbcType="BIGINT" property="createById" />
<result column="tb_create_by_name" jdbcType="VARCHAR" property="createByName" />
<result column="tb_create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="tb_update_by_id" jdbcType="BIGINT" property="updateById" />
<result column="tb_update_by_name" jdbcType="VARCHAR" property="updateByName" />
<result column="tb_update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
tb.id as tb_id, tb.assignment_id as tb_assignment_id, tb.name as tb_name, tb.create_by_id as tb_create_by_id,
tb.create_by_name as tb_create_by_name, tb.create_time as tb_create_time, tb.update_by_id as tb_update_by_id,
tb.update_by_name as tb_update_by_name, tb.update_time as tb_update_time
</sql>
<delete id="deleteByAssignmentId">
DELETE FROM assignment_grade WHERE assignment_id=#{assignmentId}
</delete>
<select id="getGradeByAssignmentIdAndScore" resultType="com.yizhi.application.entity.AssignmentGrade">
select * from assignment_grade where assignment_id=#{assignmentId} and #{score} between min_score and max_score limit 1
</select>
</mapper>
\ No newline at end of file
package com.yizhi.application.mapper;
import java.util.Date;
import java.util.List;
import java.util.Map;
import com.yizhi.application.entity.Assignment;
import com.yizhi.assignment.application.vo.MinimbaAssignmentVO;
import com.yizhi.assignment.application.vo.MinimbaStudyRecordVO;
import com.yizhi.assignment.application.vo.MinimbaUserDetailParamVO;
import com.yizhi.assignment.application.vo.MinimbaUserDetailVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.session.RowBounds;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.yizhi.assignment.application.vo.apivo.ApiListVo;
import com.yizhi.assignment.application.vo.apivo.ToOthersApi;
/**
* <p>
* 老师布置作业的主表 Mapper 接口
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
public interface AssignmentMapper extends BaseMapper<Assignment> {
/**
* 查询已经完成的
* 1.不可以补交:结束时间小于当前时间and未提交
* 2.可以补交: 已经提交
*
* @param accountId 当前登录学员id
* @param date 当前时间
* @param rowBounds 分页参数
* @return
*/
List<ApiListVo> listFinished(@Param("accountId") Long accountId, @Param("assignmentIds") List<Long> assignmentIds, @Param("date") Date date, RowBounds rowBounds);
/**
* 已经完成的数量
*
* @param accountId
* @param assignmentIds
* @param date
* @return
*/
Integer listFinishedNum(@Param("accountId") Long accountId, @Param("assignmentIds") List<Long> assignmentIds, @Param("date") Date date);
/**
* 查询已经进行中的
* 1.结束时间大于当前时间
* 2.结束时间小于当前时间:可以补交and未提交
*
* @param accountId 当前登录学员id
* @param date 当前时间
* @param rowBounds 分页参数
* @return
*/
List<Assignment> listUnfinished(@Param("accountId") Long accountId, @Param("assignmentIds") List<Long> assignmentIds, @Param("date") Date date, RowBounds rowBounds);
/**
* 未完成的数量
*
* @param accountId
* @param assignmentIds
* @param date
* @return
*/
Integer listUnfinishedNum(@Param("accountId") Long accountId, @Param("assignmentIds") List<Long> assignmentIds, @Param("date") Date date);
/**
* 查询所有的作业
*
* @param name
* @param accountId
* @param date
* @param rowBounds
* @return
*/
List<ApiListVo> listAll(@Param("name") String name, @Param("assignmentIds") List<Long> assignmentIds, RowBounds rowBounds);
/**
* 根据账号id查到自己账号下的作业数量
*
* @param accountId
* @return
*/
Integer selectAssignmentNumByAccountId(@Param("accountId") Long accountId);
/**
* 1指定范围为全平台可见 2没有被删除的作业(statues!=0)3站点
*
* @param siteId
* @return
*/
List<Long> listAssignmentBySiteIdNoDeleted(@Param("siteId") Long siteId);
/**
* 给门户用 学员端--------------2018/09/08
*
* @param assignmentIds
* @return
*/
List<ToOthersApi> listToOthersApi(@Param("assignmentIds") List<Long> assignmentIds);
/**
* 根据账号查出来 作业和答案提交次数
*
* @param accountId
* @return
*/
List<Long> getIsOverVO(@Param("accountId") Long accountId, @Param("siteId") Long siteId);
List<Long> getAssignmentIdsOrdersPageLimit(@Param("assignmentIds") List<Long> assignmentIds, RowBounds rowBounds);
List<Long> getAssignmentIdsByProjectId(@Param("projectId") Long projectId);
boolean updateProjectMessageByAssignmentId(@Param("assignmentId") Long assignmentId);
List<Assignment> getAssignmentListByManager(@Param("accountId") Long accountId,
@Param("admin") Integer admin,
@Param("name") String name,
@Param("dateString") String dateString,
@Param("companyId") Long companyId,
@Param("siteId") Long siteId,
@Param("source") Integer source,
@Param("adminIds") List<Long> adminIds,
Page<Assignment> page);
/**
* 取消作业和培训项目的关联
*
* @param assignmentId
* @return
*/
Integer delete(@Param("assignmentId") Long assignmentId);
List<Map<String, Object>> experiencePoolList(@Param("name") String name, @Param("ids") List<Long> ids,
@Param("companyId") Long companyId, @Param("siteId") Long siteId,
Page<Map<String, Object>> page);
/**
* 传培训项目id集合,返回这些项目所有关联的作业该用户的总打卡次数以及总的被赞次数(加一个请求参数,需要区别是取前一天截止的数据还是实时数据)
*
* @param paramVO
* @return
*/
MinimbaUserDetailVO userDetail(@Param("param") MinimbaUserDetailParamVO paramVO, @Param("siteId") Long siteId, @Param("companyId") Long companyId, @Param("accountId") Long accountId);
int updateNum(@Param("assignment") Assignment assignment);
int selectCountFinishedPlan(@Param("accountId") long accountId, @Param("param") MinimbaUserDetailParamVO paramVO);
int selectCountAllPlan(@Param("param") MinimbaUserDetailParamVO paramVO);
List<MinimbaStudyRecordVO> getMinimbaStudyRecordVO(@Param("tpId") long tpId);
@Select("select count(seconds) " +
"from tp_student_activity_record " +
"where relation_id = #{actId}")
int selectSeconds(@Param("actId") long actId);
@Select("select score " +
"from tp_student_activity_record " +
"where relation_id = #{actId} " +
"and finished = 1 " +
"order by finish_date desc " +
"limit 1")
Float selectScore(@Param("actId") long actId);
// @Select("SELECT " +
// "answer.content AS content, " +
// "answer.create_time AS submitTime, " +
// "IFNULL(sum( thumb.is_thumb ),0) AS admireNum, " +
// "count( `comment`.assignment_answer_id ) AS commentNum " +
// "FROM " +
// "assignment_answer answer " +
// "LEFT JOIN assignment_answer_thumb thumb ON answer.id = thumb.assignment_answer_id " +
// "AND thumb.is_thumb = 1 " +
// "LEFT JOIN assignment_comment `comment` ON `comment`.assignment_answer_id = answer.id " +
// "LEFT JOIN assignment_answer_file `file` ON `file`.anwser_id = answer.id "+
// "WHERE " +
// "answer.assignment_id = (select relation_id from tp_plan_activity where tp_plan_id = #{planId} and type = 5 LIMIT 1) " +
// "AND answer.deleted = 0 " +
// "GROUP BY " +
// "answer.id " +
// "ORDER BY " +
// "answer.create_time DESC ")
List<MinimbaAssignmentVO> getMinimbaAssignmentVO(@Param("planId") long planId, @Param("accountId") Long accountId);
/**
* 获取考试id
*
* @param planId
* @return
*/
Long getPlanExamId(@Param("planId") Long planId);
List<Long> getIdsByDate(@Param("currentDate") Date currentDate, @Param("siteId") Long siteId);
List<Assignment> getPageToCalendar(@Param("passIds") List<Long> passIds,
@Param("assignmentIdsFromVisibRange") List<Long> assignmentIdsFromVisibRange,
@Param("currentDate") Date currentDate,
@Param("siteId") Long siteId,
Page page);
Integer getPageToCalendarNum(@Param("passIds") List<Long> passIds,
@Param("assignmentIdsFromVisibRange") List<Long> assignmentIdsFromVisibRange,
@Param("currentDate") Date currentDate,
@Param("siteId") Long siteId);
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yizhi.application.mapper.AssignmentMapper">
<resultMap id="BaseResultMap"
type="com.yizhi.application.entity.Assignment">
<id column="tb_id" jdbcType="BIGINT" property="id" />
<result column="tb_training_project_id" jdbcType="BIGINT"
property="trainingProjectId" />
<result column="tb_training_project_name" jdbcType="VARCHAR"
property="trainingProjectName" />
<result column="tb_serial_num" jdbcType="BIGINT"
property="serialNum" />
<result column="tb_name" jdbcType="VARCHAR" property="name" />
<result column="tb_amendable" jdbcType="BIT"
property="amendable" />
<result column="tb_enable_remind" jdbcType="BIT" property="enableRemind" />
<result column="tb_visible_range" jdbcType="BIT" property="visibleRange" />
<result column="tb_finish_time" jdbcType="TIMESTAMP"
property="finishTime" />
<result column="tb_status" jdbcType="BIT" property="status" />
<result column="tb_type" jdbcType="BIT" property="type" />
<result column="tb_integral_val" jdbcType="INTEGER"
property="integralVal" />
<result column="tb_added_time" jdbcType="TIMESTAMP"
property="addedTime" />
<result column="tb_deleted" jdbcType="BIT" property="deleted" />
<result column="tb_company_id" jdbcType="BIGINT"
property="companyId" />
<result column="tb_site_id" jdbcType="BIGINT" property="siteId" />
<result column="tb_org_id" jdbcType="BIGINT" property="orgId" />
<result column="tb_create_by_id" jdbcType="BIGINT"
property="createById" />
<result column="tb_create_by_name" jdbcType="VARCHAR"
property="createByName" />
<result column="tb_create_time" jdbcType="TIMESTAMP"
property="createTime" />
<result column="tb_update_by_id" jdbcType="BIGINT"
property="updateById" />
<result column="tb_update_by_name" jdbcType="VARCHAR"
property="updateByName" />
<result column="tb_update_time" jdbcType="TIMESTAMP"
property="updateTime" />
<!-- 2019-10-16 作业本 -->
<result column="tb_answer_charater_num_min" property="answerCharaterNumMin" jdbcType="INTEGER" />
<result column="tb_answer_charater_num_max" property="answerCharaterNumMax" jdbcType="INTEGER" />
<result column="tb_answer_attachment_num_min" property="answerAttachmentNumMin" jdbcType="INTEGER" />
<result column="tb_answer_attachment_num_max" property="answerAttachmentNumMax" jdbcType="INTEGER" />
<result column="tb_show_res" property="showRes" jdbcType="INTEGER" />
<result column="tb_enable_exercise_book" property="enableExerciseBook" jdbcType="INTEGER" />
<result column="tb_keywords" property="keywords"/>
<result column="tb_enable_task" property="enableTask" />
<result column="tb_task_start_date" property="taskStartDate" />
<result column="tb_task_end_date" property="taskEndDate" />
<result column="tb_count" property="count" />
<result column="tb_image" property="image" />
</resultMap>
<sql id="Base_Column_List">
tb.id as tb_id, tb.training_project_id as
tb_training_project_id,
tb.training_project_name as
tb_training_project_name,
tb.serial_num as tb_serial_num, tb.name as
tb_name, tb.amendable as tb_amendable,
tb.visible_range as
tb_visible_range, tb.finish_time as
tb_finish_time, tb.status as
tb_status,
tb.enable_remind as tb_enable_remind ,
tb.type as tb_type, tb.integral_val as tb_integral_val,
tb.added_time as
tb_added_time,
tb.deleted as tb_deleted, tb.company_id
as tb_company_id, tb.site_id as
tb_site_id,
tb.org_id as tb_org_id,
tb.create_by_id as tb_create_by_id, tb.create_by_name
as
tb_create_by_name,
tb.create_time as tb_create_time, tb.update_by_id as
tb_update_by_id,
tb.update_by_name as tb_update_by_name,
tb.update_time
as tb_update_time,
<!-- 2019-10-16 作业本 -->
tb.answer_charater_num_min as tb_answer_charater_num_min,
tb.answer_charater_num_max as tb_answer_charater_num_max,
tb.answer_attachment_num_min as tb_answer_attachment_num_min,
tb.answer_attachment_num_max as tb_answer_attachment_num_max,
tb.show_res as tb_show_res, tb.enable_exercise_book as tb_enable_exercise_book,
tb.keywords as tb_keywords
</sql>
<resultMap type="com.yizhi.assignment.application.vo.MinimbaAssignmentVO" id="listMap">
<result column="content" property="content"/>
<result column="submitTime" property="submitTime"/>
<result column="admireNum" property="admireNum"/>
<result column="commentNum" property="commentNum"/>
<collection property="accessoryVOList" ofType="com.yizhi.assignment.application.vo.AccessoryVO" select="getAccessoryList"
column="{answerId = answerId}">
</collection>
</resultMap>
<!-- 查询已经完成的 1 提交了 2 不支持补交 逾期没有提交 -->
<select id="listFinished"
resultType="com.yizhi.assignment.application.vo.apivo.ApiListVo">
select aa.* from
(
(
select
tb.id,tb.training_project_name AS
projectName,tb.name AS assignmentName,tb.amendable as
amendable,tb.finish_time AS finishTime,t_aa.score,t_ga.name AS
gradeName,t_aa.status as status,t_aa.create_time, 1 AS flag
from
assignment tb
left join assignment_answer t_aa
on t_aa.assignment_id =
tb.id
left join assignment_grade t_ga
on t_ga.id=t_aa.grade_id
where
t_aa.account_id = #{accountId} <!-- 提交了 -->
and tb.status=2 <!-- 上架 -->
and tb.id in
<foreach collection="assignmentIds" item="employeeId"
index="index" open="(" close=")" separator=",">
#{employeeId}
</foreach>
)
union all
(
select
tb.id,tb.training_project_name AS projectName,tb.name
AS assignmentName,tb.amendable as
amendable,tb.finish_time AS
finishTime,t_aa.score,t_ga.name AS
gradeName,t_aa.status as
status,tb.create_time, 2 AS flag
from assignment tb
left join
assignment_answer t_aa
on t_aa.assignment_id = tb.id and
t_aa.account_id=#{accountId}
left join assignment_grade t_ga
on
t_ga.id=t_aa.grade_id
where
t_aa.account_id is null <!-- 未提交 -->
and tb.amendable = 0 <!-- 不支持补交 -->
and <![CDATA[ tb.finish_time < #{date} ]]> <!-- 逾期 -->
and tb.status=2 <!-- 上架 -->
and tb.id in
<foreach collection="assignmentIds" item="employeeId"
index="index" open="(" close=")" separator=",">
#{employeeId}
</foreach>
)
) aa order by flag,aa.create_time desc
</select>
<select id="listFinishedNum" resultType="java.lang.Integer">
select count(*) from
(
(
select
tb.id,tb.training_project_name AS
projectName,tb.name AS assignmentName,tb.amendable as
amendable,tb.finish_time AS finishTime,t_aa.score,t_ga.name AS
gradeName,t_aa.status as status
from assignment tb
left join
assignment_answer t_aa
on t_aa.assignment_id = tb.id
left join
assignment_grade t_ga
on t_ga.id=t_aa.grade_id
where
t_aa.account_id =
#{accountId} <!-- 提交了 -->
and tb.status=2 <!-- 上架 -->
and tb.id in
<foreach collection="assignmentIds" item="employeeId"
index="index" open="(" close=")" separator=",">
#{employeeId}
</foreach>
order by t_aa.create_time desc
)
union all
(
select
tb.id,tb.training_project_name AS projectName,tb.name AS
assignmentName,tb.amendable as
amendable,tb.finish_time AS
finishTime,t_aa.score,t_ga.name AS
gradeName,t_aa.status as status
from
assignment tb
left join assignment_answer t_aa
on t_aa.assignment_id =
tb.id and t_aa.account_id=#{accountId}
left join assignment_grade t_ga
on t_ga.id=t_aa.grade_id
where
t_aa.account_id is null <!-- 未提交 -->
and tb.amendable = 0 <!-- 不支持补交 -->
and <![CDATA[ tb.finish_time < #{date} ]]> <!-- 逾期 -->
and tb.status=2 <!-- 上架 -->
and tb.id in
<foreach collection="assignmentIds" item="employeeId"
index="index" open="(" close=")" separator=",">
#{employeeId}
</foreach>
order by tb.create_time desc
)
) aa
</select>
<!-- 1逾期未提交,允许补交 2没有逾期,未提交 -->
<select id="listUnfinished"
resultType="com.yizhi.application.entity.Assignment">
select aa.* from
(
(select
tb.id,tb.training_project_name AS
trainingProjectName,tb.name,tb.finish_time AS
finishTime,tb.added_time
as addedTime,tb.amendable
from assignment tb
left join assignment_answer
t_aa
on t_aa.assignment_id = tb.id
and t_aa.account_id=#{accountId} <!-- 筛选自己没有提交 -->
where
<![CDATA[ tb.finish_time < #{date} ]]> <!-- 逾期 -->
and tb.amendable=1 <!-- 允许补交 -->
and t_aa.id is null
and tb.status=2 <!-- 作业在上架状态 -->
and tb.id in
<foreach collection="assignmentIds" item="employeeId"
index="index" open="(" close=")" separator=",">
#{employeeId}
</foreach>
)
union all
(select
tb.id,tb.training_project_name AS
trainingProjectName,tb.name,tb.finish_time AS
finishTime,tb.added_time
as addedTime,tb.amendable
from assignment tb
left join assignment_answer
t_aa
on t_aa.assignment_id = tb.id
and t_aa.account_id=#{accountId} <!-- 筛选自己没有提交 -->
where
<![CDATA[ tb.finish_time > #{date} ]]> <!-- 未逾期 -->
<!-- 不关心允许不允许补交 -->
and tb.status=2 <!-- 作业在上架状态 -->
and t_aa.id is null
and tb.id in
<foreach collection="assignmentIds" item="employeeId"
index="index" open="(" close=")" separator=",">
#{employeeId}
</foreach>
)
) aa order by aa.addedTime desc
</select>
<select id="listUnfinishedNum" resultType="java.lang.Integer">
select count(*) from
(
(select
tb.id,tb.training_project_name AS
trainingProjectName,tb.name,tb.finish_time AS
finishTime,tb.added_time
as addedTime,tb.amendable
from assignment tb
left join assignment_answer
t_aa
on t_aa.assignment_id = tb.id
and t_aa.account_id=#{accountId} <!-- 筛选自己没有提交 -->
where
<![CDATA[ tb.finish_time < #{date} ]]> <!-- 逾期 -->
and tb.amendable=1 <!-- 允许补交 -->
and tb.status=2 <!-- 作业在上架状态 -->
and t_aa.id is null
and tb.id in
<foreach collection="assignmentIds" item="employeeId"
index="index" open="(" close=")" separator=",">
#{employeeId}
</foreach>
)
union all
(select
tb.id,tb.training_project_name AS
trainingProjectName,tb.name,tb.finish_time AS
finishTime,tb.added_time
as addedTime,tb.amendable
from assignment tb
left join assignment_answer
t_aa
on t_aa.assignment_id = tb.id
and t_aa.account_id=#{accountId} <!-- 筛选自己没有提交 -->
where
<![CDATA[ tb.finish_time > #{date} ]]> <!-- 未逾期 -->
<!-- 不关心允许不允许补交 -->
and tb.status=2 <!-- 作业在上架状态 -->
and t_aa.id is null
and tb.id in
<foreach collection="assignmentIds" item="employeeId"
index="index" open="(" close=")" separator=",">
#{employeeId}
</foreach>
)
) aa
</select>
<!-- 查询所有的 -->
<select id="listAll"
resultType="com.yizhi.assignment.application.vo.apivo.ApiListVo">
select
tb.id,tb.training_project_name AS projectName,tb.name as
assignmentName,tb.amendable as
amendable,t_ac.comment AS
assignmentContent,tb.finish_time AS
finishTime,tb.create_time AS
startTime,t_aa.score,t_ga.name as
gradeName,t_aa.status as status
from
assignment tb
left join assignment_content t_ac ON
tb.id=t_ac.assignment_id
left join assignment_answer t_aa on
t_aa.assignment_id = tb.id
left join assignment_grade t_ga ON
t_ga.id=t_aa.grade_id
where
tb.id in
<foreach collection="assignmentIds" item="employeeId"
index="index" open="(" close=")" separator=",">
#{employeeId}
</foreach>
<if test="name!=null">
and tb.name like concat(concat("%",#{name}),"%")
</if>
</select>
<select id="selectAssignmentNumByAccountId"
resultType="java.lang.Integer">
SELECT COUNT(*) FROM (SELECT a.* FROM assignment
a,assignment_answer aa
WHERE a.id=aa.assignment_id AND a.deleted=1 AND
aa.account_id=#{accountId}) b
</select>
<select id="listAssignmentBySiteIdNoDeleted"
resultType="java.lang.Long">
select id from assignment where status!=0 and
site_id=#{siteId} and
visible_range=1
</select>
<select id="listToOthersApi"
resultType="com.yizhi.assignment.application.vo.apivo.ToOthersApi">
SELECT a.id,a.name,aa.comment AS content,a.status AS
state,CONCAT('/student/assignment/my/toAssignment?assignmentId=',a.id)
AS url,a.added_time AS startTime,a.finish_time AS endTime FROM
assignment a LEFT JOIN assignment_content aa ON a.id=aa.assignment_id
where a.status=2
<if test="assignmentIds!=null and assignmentIds.size()>0">
and a.id in
<foreach collection="assignmentIds" item="assignmentId"
index="index" open="(" close=")" separator=",">
#{assignmentId}
</foreach>
</if>
</select>
<select id="getIsOverVO" resultType="java.lang.Long">
SELECT * FROM (
SELECT a.id,a.count,COUNT(aa.id) AS submitNum FROM
assignment a LEFT JOIN
assignment_answer aa ON a.id=aa.assignment_id
WHERE
aa.account_id=#{accountId} and a.status=2 and a.site_id=#{siteId}
GROUP BY aa.assignment_id,aa.account_id
) AS aaaa WHERE <![CDATA[ aaaa.count<=aaaa.submitNum ]]>
</select>
<select id="getAssignmentIdsOrdersPageLimit"
resultType="java.lang.Long">
select id from assignment where 1=1
<if test="assignmentIds!=null and assignmentIds.size>0">
and id in
<foreach collection="assignmentIds" item="assignmentId"
index="index" open="(" close=")" separator=",">
#{assignmentId}
</foreach>
</if>
order by create_time desc
</select>
<select id="getAssignmentIdsByProjectId"
resultType="java.lang.Long">
select id from assignment where
training_project_id=#{projectId}
</select>
<update id="updateProjectMessageByAssignmentId">
update assignment set training_project_id=0 ,
training_project_name=null
where id=#{assignmentId}
</update>
<select id="getAssignmentListByManager"
resultType="com.yizhi.application.entity.Assignment">
SELECT
DISTINCT a.id AS id,
a.training_project_id AS trainingProjectId,
a.training_project_name AS trainingProjectName,
a.name ,
a.amendable AS amendable,
a.visible_range AS visibleRange,
a.finish_time AS finishTime,
a.status,
a.count,
a.pass_score AS passScore,
a.type ,
a.added_time AS addedTime,
a.enable_exercise_book AS enableExerciseBook,
a.keywords,
a.image
FROM
assignment a
LEFT JOIN assignment_auditor au ON a.id = au.assignment_id
where status != 0
<if test="admin == 0 ">
and ( a.create_by_id = #{accountId} OR au.account_id = #{accountId})
<if test="adminIds!=null and adminIds.size>0">
or a.create_by_id in
<foreach collection="adminIds" item="adminId"
index="index" open="(" close=")" separator=",">
#{adminId}
</foreach>
</if>
</if>
<if test="name!=null">
and (a.name like CONCAT('%',#{name}, '%') or a.keywords like CONCAT('%',#{name}, '%'))
</if>
<if test="companyId!=null">
and a.company_id=#{companyId}
</if>
<if test="siteId!=null">
and a.site_id=#{siteId}
</if>
<if test="source==1">
-- 培训项目的要求 :没有挂靠到培训项目的进行显示,上架状态
and a.status= 2 and a.training_project_id = 0
</if>
<if test="source==2">
-- 投票的要求: 上架状态,日期没有过期
and a.status = 2 and (<![CDATA[ DATE_FORMAT(a.finish_time,'%Y-%m-%d')>=DATE_FORMAT(#{a.dateString,jdbcType=VARCHAR},'%Y-%m-%d') ]]>)
</if>
order by a.create_time desc
</select>
<select id="getAssignmentIdsOrdersPageLimitNew"
resultType="java.lang.Long">
select a.id from (
-- 逾期的 全平台可见 或者指定范围是当前人的
select distinct(a.id) from
assignment a left join assignment_student ast
on a.id=ast.assignment_id
where a.status=2 and a.site_id =#{siteId}
and a.finish_time <![CDATA[ <]]>
now()
and (
( a.visible_range=2 AND a.site_id=#{siteId}
<if test="relationIds!=null and relationIds.size>0">
and ast.account_id IN
<foreach collection="relationIds" item="relationId"
index="index" open="(" close=")" separator=",">
#{relationId}
</foreach>
</if>
)
or
(a.visible_range=1 AND site_id=#{siteId})
)
-- 未逾期的但是提交次数达到上限的
UNION
select distinct(a.id) FROM (
select a.id,count(b.id) AS realNum from (
select distinct(a.id) from assignment a
left join assignment_student
ast
on a.id=ast.assignment_id
where a.status=2 and a.site_id =#{siteId}
and
(
( a.visible_range=2 AND a.site_id=#{siteId}
<if test="relationIds!=null and relationIds.size>0">
and ast.account_id IN
<foreach collection="relationIds" item="relationId"
index="index" open="(" close=")" separator=",">
#{relationId}
</foreach>
</if>
)
or
(a.visible_range=1 AND site_id=#{siteId})
)
and a.finish_time <![CDATA[ >]]>
now()
) as a
left join `assignment_answer` AS b
on a.id=b.assignment_id
AND account_id=#{accountId}
where b.id is not null
group by a.id
) as a
left join assignment AS b
on a.id=b.id WHERE a.realNum>=b.count
) as a
LEFT JOIN assignment AS b
on a.id=b.id and b.site_id=#{siteId}
order by
b.create_time desc
<if test="source==2">
-- 投票的要求: 上架状态,日期没有过期
and status=2 and (<![CDATA[ DATE_FORMAT(finish_time,'%Y-%m-%d')>=DATE_FORMAT(#{dateString,jdbcType=VARCHAR},'%Y-%m-%d') ]]>)
</if>
order by create_time desc
</select>
<update id="delete">
UPDATE assignment a
SET
a.training_project_id=0,a.training_project_name = null WHERE
a.id=#{assignmentId}
</update>
<select id="experiencePoolList" resultType="java.util.HashMap">
select a.id,a.name,a.create_time createTime
from assignment a
WHERE 1= 1
<if test="ids !=null and ids.size() > 0 ">
AND a.id NOT IN
<foreach collection="ids" item="id" index="index" open="("
close=")" separator=",">
#{id}
</foreach>
</if>
<if test="name!=null and name != ''">
AND a.name LIKE CONCAT('%', #{name}, '%')
</if>
AND a.company_id = #{companyId}
AND a.site_id = #{siteId}
AND a.`status` = 2
order by create_time desc
</select>
<select id="userDetail" resultType="com.yizhi.assignment.application.vo.MinimbaUserDetailVO">
SELECT
COUNT( DISTINCT b.id ) AS pushInNum,
COUNT( DISTINCT c.id ) AS praisedNum
FROM
tp_plan_activity a
LEFT JOIN assignment_answer b ON a.type = 5
AND a.relation_id = b.assignment_id
AND b.account_id = #{accountId}
AND b.is_down = 0
AND b.deleted = 0
LEFT JOIN assignment_answer_thumb c ON b.id = c.assignment_answer_id
AND c.is_thumb = 1
WHERE
1 = 1
and a.training_project_id in
(<foreach collection="param.projectIds" item="tpId" separator=",">
#{tpId}
</foreach>)
</select>
<update id="updateNum">
update assignment tb
set
tb.answer_charater_num_min = #{assignment.answerCharaterNumMin},
tb.answer_charater_num_max = #{assignment.answerCharaterNumMax},
tb.answer_attachment_num_min = #{assignment.answerAttachmentNumMin},
tb.answer_attachment_num_max = #{assignment.answerAttachmentNumMax}
where tb.id=#{assignment.id}
</update>
<select id="selectCountFinishedPlan" resultType="java.lang.Integer">
select count(*)
from cloud_trainning_project.tp_student_plan_record
where finished = 1 and account_id = #{accountId}
<if test="param.isRealTime == 0">
and <![CDATA[ DATE_FORMAT(finish_date,'%Y-%m-%d') < DATE_FORMAT(now(),'%Y-%m-%d') ]]>
</if>
and training_project_id in
(<foreach collection="param.projectIds" item="tpId" separator=",">
#{tpId}
</foreach>)
</select>
<select id="selectCountAllPlan" resultType="java.lang.Integer">
select count(*)
from cloud_trainning_project.tp_plan
where training_project_id in
(<foreach collection="param.projectIds" item="tpId" separator=",">
#{tpId}
</foreach>)
</select>
<select id="getMinimbaStudyRecordVO" resultType="com.yizhi.assignment.application.vo.MinimbaStudyRecordVO">
select plan.id as planId, plan.`name` as planName, act.relation_id as courseId
from tp_plan plan
left join tp_plan_activity act on act.tp_plan_id = plan.id and act.type = 0 and act.deleted = 0
where plan.deleted = 0 and act.deleted = 0 and plan.training_project_id = #{tpId}
and act.type = 0
group by plan.id
</select>
<select id="getMinimbaAssignmentVO" resultMap="listMap">
SELECT
answer.id AS answerId,
answer.content AS content,
answer.create_time AS submitTime,
IFNULL(sum( thumb.is_thumb ),0) AS admireNum,
count( `comment`.assignment_answer_id ) AS commentNum
FROM
assignment_answer answer
LEFT JOIN assignment_answer_thumb thumb ON answer.id = thumb.assignment_answer_id
AND thumb.is_thumb = 1
LEFT JOIN assignment_comment `comment` ON `comment`.assignment_answer_id = answer.id
LEFT JOIN assignment_answer_file `file` ON `file`.anwser_id = answer.id
WHERE
answer.assignment_id = (select relation_id from tp_plan_activity where tp_plan_id = #{planId} and type = 5 LIMIT 1)
AND answer.deleted = 0
AND answer.account_id = #{accountId}
GROUP BY
answer.id
ORDER BY
answer.create_time DESC
</select>
<select id="getAccessoryList" resultType="com.yizhi.assignment.application.vo.AccessoryVO">
select file_name AS accessoryName,
file_url AS accessoryUrl,
size AS accessorySize
from assignment_answer_file
where anwser_id = #{answerId}
</select>
<select id="getPlanExamId" resultType="java.lang.Long">
SELECT
relation_id
FROM
tp_plan_activity
WHERE
tp_plan_id = #{planId}
AND deleted = 0
AND type = 1
</select>
<select id="getIdsByDate" resultType="Long">
select id from assignment c
where 1=1
and c.status = 2
and c.enable_task = 1
AND c.`site_id` = #{siteId}
AND <![CDATA[ DATE_FORMAT(c.task_start_date, '%Y-%m-%d') <= DATE_FORMAT(#{currentDate}, '%Y-%m-%d') ]]>
AND <![CDATA[ DATE_FORMAT(c.task_end_date, '%Y-%m-%d') >= DATE_FORMAT(#{currentDate}, '%Y-%m-%d') ]]>
and <![CDATA[ DATE_FORMAT(c.finish_time, '%Y-%m-%d') >= DATE_FORMAT(#{currentDate}, '%Y-%m-%d') ]]>
</select>
<select id="getPageToCalendar" resultMap="BaseResultMap">
select id as tb_id,
count as tb_count,
name as tb_name,
finish_time as tb_finish_time,
task_start_date as tb_task_start_date,
task_end_date as tb_task_end_date
from assignment c
where 1=1
<if test="passIds != null and passIds.size() > 0">
and c.id not in (<foreach collection="passIds" item="id" separator=",">#{id}</foreach>)
</if>
and (c.visible_range = 1
<if test="assignmentIdsFromVisibRange != null and assignmentIdsFromVisibRange.size() > 0">
or c.id in (<foreach collection="assignmentIdsFromVisibRange" item="item" separator=",">#{item}</foreach>)
</if>
)
and c.status = 2
and c.enable_task = 1
AND c.`site_id` = #{siteId}
AND <![CDATA[ DATE_FORMAT(c.task_start_date, '%Y-%m-%d') <= DATE_FORMAT(#{currentDate}, '%Y-%m-%d') ]]>
AND <![CDATA[ DATE_FORMAT(c.task_end_date, '%Y-%m-%d') >= DATE_FORMAT(#{currentDate}, '%Y-%m-%d') ]]>
and <![CDATA[ DATE_FORMAT(c.finish_time, '%Y-%m-%d') >= DATE_FORMAT(#{currentDate}, '%Y-%m-%d') ]]>
order by c.task_start_date desc
</select>
<select id="getPageToCalendarNum" resultType="Integer">
select
count(1)
from assignment c
where 1=1
<if test="passIds != null and passIds.size() > 0">
and c.id not in (<foreach collection="passIds" item="id" separator=",">#{id}</foreach>)
</if>
and (c.visible_range = 1
<if test="assignmentIdsFromVisibRange != null and assignmentIdsFromVisibRange.size() > 0">
or c.id in (<foreach collection="assignmentIdsFromVisibRange" item="item" separator=",">#{item}</foreach>)
</if>
)
and c.status = 2
and c.enable_task = 1
AND c.`site_id` = #{siteId}
AND <![CDATA[ DATE_FORMAT(c.task_start_date, '%Y-%m-%d') <= DATE_FORMAT(#{currentDate}, '%Y-%m-%d') ]]>
AND <![CDATA[ DATE_FORMAT(c.task_end_date, '%Y-%m-%d') >= DATE_FORMAT(#{currentDate}, '%Y-%m-%d') ]]>
and <![CDATA[ DATE_FORMAT(c.finish_time, '%Y-%m-%d') >= DATE_FORMAT(#{currentDate}, '%Y-%m-%d') ]]>
</select>
</mapper>
package com.yizhi.application.mapper;
import java.util.List;
import com.yizhi.application.entity.AssignmentPoint;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author yizhi123
* @since 2018-09-04
*/
public interface AssignmentPointMapper extends BaseMapper<AssignmentPoint> {
AssignmentPoint getPointByAssignmentIdAndScore(@Param("assignmentId")Long assignmentId,@Param("score")Integer score);
AssignmentPoint getTrainingPoint(@Param("ids")List<Long> ids);
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yizhi.application.mapper.AssignmentPointMapper">
<select id="getPointByAssignmentIdAndScore" resultType="com.yizhi.application.entity.AssignmentPoint">
select * from assignment_point where assignment_id=#{assignmentId} and #{score} between min_score and max_score limit 1
</select>
<select id="getTrainingPoint" resultType="com.yizhi.application.entity.AssignmentPoint">
SELECT SUM(minScore) AS minScore,SUM(maxScore) AS maxScore FROM (
SELECT assignment_id,MIN(point) AS minScore,MAX(point) AS maxScore FROM assignment_point
<if test="ids!=null and ids.size()>0">
WHERE assignment_id IN
<foreach collection="ids" item="id" index="index" open="(" close=")" separator=",">
#{id}
</foreach>
</if>
GROUP BY assignment_id) AS tem
</select>
</mapper>
\ No newline at end of file
package com.yizhi.application.mapper;
import com.yizhi.application.entity.AssignmentStudent;
import com.yizhi.assignment.application.vo.apivo.ApiAssignmentListResultVO;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.plugins.Page;
/**
* <p>
* 老师布置作业和学生进行关联。
多对多的关系。
一个老师布置的作业有多个学生做。 Mapper 接口
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
public interface AssignmentStudentMapper extends BaseMapper<AssignmentStudent> {
/**
* 分配給此人的 作业id 已经去重
* @param relationIds
* @return
*/
List<Long> getAssignmentIdsByAccountId(@Param("relationIds")List<Long> relationIds,@Param("siteId")Long siteId,Page<Long> page);
/**
* 分配給此人的 作业id 已经去重 进行中/已结束 学员端----2018/09/08
* @param relationIds
* @param siteId
* @param curDate
* @param Type
* @param page
* @return
*/
List<Long> listUnFinishIds(@Param("relationIds")List<Long> relationIds,@Param("companyId")Long companyId,@Param("siteId")Long siteId,@Param("accountId")Long accountId,Page<Long> page);
List<ApiAssignmentListResultVO> listUnfinish(@Param("companyId")Long companyId,@Param("siteId")Long siteId,@Param("accountId")Long accountId,@Param("assignmentIds")List<Long> assignmentIds );
List<Long> listFinishIds(@Param("relationIds")List<Long> relationIds,@Param("companyId")Long companyId,@Param("siteId")Long siteId,@Param("accountId")Long accountId,Page<Long> pageLimit);
List<ApiAssignmentListResultVO> listFinish(@Param("companyId")Long companyId,@Param("siteId")Long siteId,@Param("accountId")Long accountId,@Param("assignmentIds")List<Long> assignmentIds );
/**
* 根据名字搜索此人全部列表 学员端-------2018/09/08
* @param name
* @param relationIds
* @param siteId
* @param page
* @return
*/
List<Long> myAllListByName(@Param("name")String name,@Param("relationIds")List<Long> relationIds,@Param("siteId")Long siteId,Page<Long> page);
/**
* 分发给此人的作业数量 目录页面 学员端-------2018/09/08
* @param name
* @param relationIds
* @param siteId
* @return
*/
Integer myAllListNum(@Param("relationIds")List<Long> relationIds,@Param("siteId")Long siteId);
List<Long> getUsefulIds(@Param("ids") List<Long> ids,
@Param("relationIds") List<Long> relationIds,
@Param("siteId") Long siteId);
Integer maxGradeByAccountId(@Param("companyId")Long companyId,@Param("siteId")Long siteId,@Param("accountId")Long accountId,@Param("assignmentId")Long assignmentId);
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yizhi.application.mapper.AssignmentStudentMapper">
<resultMap id="BaseResultMap" type="com.yizhi.application.entity.AssignmentStudent">
<id column="tb_id" jdbcType="BIGINT" property="id" />
<result column="tb_assignment_id" jdbcType="BIGINT" property="assignmentId" />
<result column="tb_account_id" jdbcType="BIGINT" property="accountId" />
<result column="tb_create_by_id" jdbcType="BIGINT" property="createById" />
<result column="tb_create_by_name" jdbcType="VARCHAR" property="createByName" />
<result column="tb_create_time" jdbcType="TIMESTAMP" property="createTime" />
</resultMap>
<sql id="Base_Column_List">
tb.id as tb_id, tb.assignment_id as tb_assignment_id, tb.account_id as tb_account_id,
tb.create_by_id as tb_create_by_id, tb.create_by_name as tb_create_by_name, tb.create_time as tb_create_time
</sql>
<select id="getAssignmentIdsByAccountId" resultType="java.lang.Long">
SELECT distinct(a.id) FROM assignment a LEFT JOIN assignment_student ast ON a.id=ast.assignment_id WHERE a.status=2 and a.site_id =#{siteId} and
(
( a.visible_range=2 and ast.account_id in
<foreach collection="relationIds" item="relationId" index="index" open="(" close=")" separator=",">
#{relationId}
</foreach>
)
or
(
a.visible_range=1
)
)
</select>
<select id="listUnFinishIds" resultType="java.lang.Long">
select distinct(a.id) from assignment a left join
assignment_student ast
on a.id=ast.assignment_id
where a.status=2 and a.site_id =#{siteId} and
( -- 指定范围有此人 或者全平台可见的
(a.visible_range=2 and a.site_id=#{siteId}
<if test="relationIds!=null and relationIds.size>0">
and ast.account_id in
<foreach collection="relationIds" item="relationId" index="index" open="(" close=")" separator=",">
#{relationId}
</foreach>
</if>)
or
(a.visible_range=1 and site_id=#{siteId})
)
--进行中的需要 次数没有达到上限的还有时间没有逾期
and a.id in (
select a.id from assignment AS a
left join
(select assignment_id,count(1) AS commitNum from assignment_answer as a where site_id=#{siteId} and account_id=#{accountId} and deleted = 0 group by assignment_id)
as b
on a.id=b.assignment_id
where a.company_id=#{companyId} and a.site_id=#{siteId} and a.status=2
and (<![CDATA[ a.count>commitNum ]]> or commitNum is null)
and <![CDATA[ a.finish_time > now() ]]>
)
order by a.create_time desc
</select>
<select id="listFinishIds" resultType="java.lang.Long">
select a.id from (
-- 逾期的 全平台可见 或者指定范围是当前人的
select distinct(a.id) from assignment a
left join assignment_student ast
on a.id=ast.assignment_id
where a.status=2 and a.site_id =#{siteId}
and a.finish_time <![CDATA[ <]]> now()
and (
( a.visible_range=2 AND a.site_id=#{siteId}
<if test="relationIds!=null and relationIds.size>0">
and ast.account_id IN
<foreach collection="relationIds" item="relationId" index="index" open="(" close=")" separator=",">
#{relationId}
</foreach>
</if>
)
or
(a.visible_range=1 AND site_id=#{siteId})
)
-- 未逾期的但是提交次数达到上限的
UNION
select distinct(a.id) FROM (
select a.id,count(b.id) AS realNum from (
select distinct(a.id) from assignment a
left join assignment_student ast
on a.id=ast.assignment_id
where a.status=2 and a.site_id =#{siteId} and
(
( a.visible_range=2 AND a.site_id=#{siteId}
<if test="relationIds!=null and relationIds.size>0">
and ast.account_id IN
<foreach collection="relationIds" item="relationId" index="index" open="(" close=")" separator=",">
#{relationId}
</foreach>
</if>
)
or
(a.visible_range=1 AND site_id=#{siteId})
)
and a.finish_time <![CDATA[ >]]> now()
) as a
left join `assignment_answer` AS b
on a.id=b.assignment_id AND account_id=#{accountId}
where b.id is not null and b.deleted = 0
group by a.id
) as a left join assignment AS b
on a.id=b.id WHERE <![CDATA[ a.realNum>=b.count ]]>
) as a
LEFT JOIN assignment AS b
on a.id=b.id and b.site_id=#{siteId}
order by b.create_time desc
</select>
<select id="myAllListByName" resultType="java.lang.Long">
SELECT distinct(a.id) FROM assignment a LEFT JOIN assignment_student ast ON a.id=ast.assignment_id WHERE a.status=2 and a.site_id =#{siteId} and
(
( a.visible_range=2 and ast.account_id in
<foreach collection="relationIds" item="relationId" index="index" open="(" close=")" separator=",">
#{relationId}
</foreach>
)
or
(
a.visible_range=1 and site_id=#{siteId}
)
)
<if test="name!=null">
and name like concat(concat("%",#{name},"%"))
</if>
order by a.create_time desc
</select>
<select id="myAllListNum" resultType="java.lang.Integer">
SELECT count(distinct(a.id)) FROM assignment a LEFT JOIN assignment_student ast ON a.id=ast.assignment_id WHERE a.status=2 and a.site_id =#{siteId} and
(
( a.visible_range=2 and ast.account_id in
<foreach collection="relationIds" item="relationId" index="index" open="(" close=")" separator=",">
#{relationId}
</foreach>
)
or
(
a.visible_range=1 and site_id=#{siteId}
)
)
</select>
<select id="listUnfinish" resultType="com.yizhi.assignment.application.vo.apivo.ApiAssignmentListResultVO">
select a.id,a.name as assignmentName,a.training_project_name as projectName,
a.finish_time as finishTime,a.type as isScoreAndGrade,a.pass_score as passScore,
a.count as count,a.amendable as amendable,c.COMMENT as detail,
max(score) as score,min(b.status) as minAnswerStatus,max(b.status) as maxAnswerStatus,count(b.id) as submitCount,b.account_id,
case finish_time>now() when 0 then 2 when 1 then 1 else -1 end as isOverDue
from assignment as a
left join assignment_content as c
on a.id=c.assignment_id
left join (SELECT id,assignment_id,`status`,account_id,score,company_id,site_id FROM assignment_answer WHERE deleted = 0 and is_down = 0 ) as b
on a.id=b.assignment_id and b.company_id=#{companyId} and b.site_id=#{siteId} and b.account_id=#{accountId}
where a.company_id=#{companyId} and a.site_id=#{siteId}
<if test="assignmentIds!=null and assignmentIds.size>0">
and a.id in
<foreach collection="assignmentIds" item="assignmentId" index="index" open="(" close=")" separator=",">
#{assignmentId}
</foreach>
</if>
group by a.id
order by a.create_time desc
</select>
<select id="listFinish" resultType="com.yizhi.assignment.application.vo.apivo.ApiAssignmentListResultVO">
select a.id,b.account_id accountId, a.name as assignmentName,a.training_project_name as projectName,
a.finish_time as finishTime,a.type as isScoreAndGrade,a.pass_score as passScore,
a.count as count,a.amendable as amendable,c.COMMENT as detail,
max(score) as score,min(b.status) as minAnswerStatus,max(b.status) as maxAnswerStatus,count(b.id) as
submitCount,b.account_id,
case finish_time>now() when 0 then 2 when 1 then 1 else -1 end as isOverDue
from assignment as a
left join assignment_content as c
on a.id=c.assignment_id
left join (SELECT id,assignment_id,`status`,account_id,score,company_id,site_id FROM assignment_answer WHERE
deleted = 0 and is_down = 0 ) as b
on a.id=b.assignment_id and b.company_id=#{companyId} and b.site_id=#{siteId} and b.account_id=#{accountId}
where a.company_id=#{companyId} and a.site_id=#{siteId}
<if test="assignmentIds!=null and assignmentIds.size>0">
and a.id in
<foreach collection="assignmentIds" item="assignmentId" index="index" open="(" close=")" separator=",">
#{assignmentId}
</foreach>
</if>
group by a.id
order by a.create_time desc
</select>
<select id="getUsefulIds" resultType="java.lang.Long">
select assignment_id
from assignment_student
<where>
deleted = 0
and account_id in
<foreach collection="relationIds" open="(" close=")" item="item" separator=",">
#{item}
</foreach>
<if test="ids != null and ids.size()>0">
and assignment_id in <foreach collection="ids" open="(" close=")" item="id" separator=","> #{id} </foreach>
</if>
</where>
</select>
<select id="maxGradeByAccountId" resultType="java.lang.Integer">
select ifnull(max(score),0) from assignment_answer where company_id=#{companyId} and site_id=#{siteId} and account_id = #{accountId} and assignment_id=#{assignmentId} and deleted=0
</select>
</mapper>
\ No newline at end of file
package com.yizhi.application.service;
import com.yizhi.application.entity.AssignmentAnswerCourse;
import com.baomidou.mybatisplus.service.IService;
/**
* <p>
* 一个学员对一个作业的回复内容 服务类
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
public interface AssignmentAnswerCourseService extends IService<AssignmentAnswerCourse> {
//AssignmentAnswerContent getAssignmentAnswerContentByAccountIdAndAssignmentId(Long answerId);
}
package com.yizhi.application.service;
import com.baomidou.mybatisplus.service.IService;
import com.yizhi.application.entity.AssignmentAnswerFile;
import java.util.List;
/**
* <p>
* 学员对作业回复可以是文件,存放学员的作业回复的文件的地址 服务类
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
public interface AssignmentAnswerFileService extends IService<AssignmentAnswerFile> {
/*
*//**
* 查询学生对应作业的文件
*
* @param assignmentId
* @return
*//*
List<AssignmentAnswerFile> listByAssignmentIdAndAccountId(@Param("assignmentId") Long assignmentId, RequestContext context);*/
/**
* @param id 作业答案的id
* @return 作业答案对应具体对象
*/
List<List<AssignmentAnswerFile>> selectAssignmentAnswerFileById(List<Long> id);
List<AssignmentAnswerFile> listAssignmentAnswerFile(Long id);
List<AssignmentAnswerFile> listAssignmentAnswerBackFile(Long id);
/**
* 如果是第二次批阅,先干掉第一次批阅文件
*/
Boolean deleteAnswerFile(Long assignmentId);
/**
* 根据老师或者学生得到学生提交的文件/老师的反馈文件
*
* @param answerId
* @return
*/
List<AssignmentAnswerFile> listGetAssignmentAnswerFile(Long answerId, Integer type);
/**
* 确认文件是视屏文件
*
* @param ids
* @return
*/
Integer verifyVideo(List<Long> ids);
}
package com.yizhi.application.service;
import java.util.Date;
import java.util.List;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.IService;
import com.yizhi.application.entity.AssignmentAnswer;
import com.yizhi.assignment.application.vo.AnswersDownVO;
import com.yizhi.assignment.application.vo.AssignmentAnswerExport;
import com.yizhi.assignment.application.vo.AssignmentAnswerListExport;
import com.yizhi.assignment.application.vo.AssignmentReadListVO;
import com.yizhi.assignment.application.vo.apivo.ApiAssignmentAnswerResultVo;
import com.yizhi.assignment.application.vo.apivo.ApiAssignmentAswerVO;
import com.yizhi.assignment.application.vo.apivo.ApiAssignmentDetailsVo;
/**
* <p>
* 学员对作业的对应关系
服务类
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
public interface AssignmentAnswerService extends IService<AssignmentAnswer> {
/**
* 待阅读数量 管理端-----2018、09、08
* @param trainingProjectId
* @return
*/
Integer noRead(Long id,List<Long> accountIds);
/**
* 提交数量 管理端-----2018、09、08
* @param trainingProjectId
* @return
*/
Integer submitNum(Long id,List<Long> accountIds);
Integer canSubmitAssignmentAnswer(ApiAssignmentAswerVO vo);
/**
* 学生提交作业
*
* @return
*/
Boolean submitAssignmentAnswer(ApiAssignmentAswerVO vo);
/**
*
* @param assignmentId 老师布置作业id
* @param pageNo 当前页数
* @param pageSize 每一页存放的数据
* @return
*/
Page<AssignmentReadListVO> assignmentAnswerList(String keywords,String name,Long assignmentId,
Long accountId, Integer state, Integer type, Integer pageNo, Integer pageSize,List<Long> accountIds);
/**
* 回答的id 的列表
* @param keywords
* @param name
* @param assignmentId
* @param accountId
* @param state
* @param type
* @return
*/
List<AssignmentReadListVO> getAssignmentAnswerIdList(List<Long> accountIds,String keywords,String name,Long assignmentId,Long accountId, Integer state, Integer type);
/**
* 学生列表总记录数目
* @param assignmentId
* @param state
* @param name
* @param accountIdList
* @param pageNo
* @param pageSize
* @return
*/
Integer assignmentAnswerListNum(Long assignmentId, Integer state, String name, List<Long> accountIdList, Integer pageNo, Integer pageSize);
/**
*
* @param id 答案id
* @return 返回答案实体
*/
AssignmentAnswer selectAssignmentAnswerById(Long id);
/**
* 老师批阅学生提交的答案
* @param assignmentAnswer
* @return
*/
Boolean insertTeacherToStudent(AssignmentAnswer assignmentAnswer);
/**
* 批量下载作业
* @param id
* @return
*/
List<AssignmentAnswerExport> listExport(List<Long> answerIds);
/**
* 下一份作业id
* @param assignmentAnswerId
* @return
*/
Long nextAnswerId(Date createTime,Long assignmentId);
/**
* 上一份作业id
* @param assignmentAnswerId
* @return
*/
Long prevAnswerId(Date createTime,Long assignmentId);
/**
*
* @param assignmentId
* @param accountId
* @return
*/
List<AssignmentAnswer> getAssignmentAnswer(Long assignmentId,Long accountId);
/**
* 根据账号id和作业id 判断是否已提交
* @param accountId
* @param assignmentId
* @return
*/
AssignmentAnswer isHaveAnswerByAccountIdAndAssignmentId(Long accountId,Long assignmentId);
/* *//**
* @param answerId
* @return
*//*
ApiSuggestionVo getMyAnswerDetailsByAssignmentId(Long assignmentId,Long accountId);*/
/**
* 根据条件导出excel表格
* @return
*/
AssignmentAnswerListExport exportResultExcel(Long assignmentId,List<Long> answerIds);
/**
* 根据answerIds 查找到条件是本地上传的answerIds
* @param answerIds
* @return
*/
List<AnswersDownVO> getAnswerIdsDown(Long assignmentId,List<Long> answerIds);
/**
* 根据作业id和账号id 找到答案
* @param assignmentId
* @param accountId
* @return
*/
AssignmentAnswer getAssignmentAnswerByAccountAssignmentIdAndAccountId(Long assignmentId,Long accountId);
/**
* 作业的答案页面
* @param assignmentId
* @param accountId
* @return
*/
ApiAssignmentAnswerResultVo getAnswerList(Long assignmentId,Long accountId);
/**
* 获取作业信息(包含已经提交的文件)
*
* @param assignmentId
* @return
*/
ApiAssignmentDetailsVo toAssignment(Long assignmentId,Long answerId,Long accountId);
/**
* 2018-09-07
* 根据作业Id和账号Id查找到此人这个作业提交了多少份
* @param assignmentId
* @param accountId
* @return
*/
List<AssignmentAnswer> listAssignmentAnswerByAssignmentIdAndAccountId(Long assignmentId,Long accountId);
/**
* 查询已经答题的次数
* @param assignmentId
* @param accountId
* @return
*/
Integer getAssignmentAnswerCount(Long assignmentId,Long accountId);
List<Long> getListIdsBySiteIdAndAssignmentIdsAndAccountId(Long siteId,Long accountId,List<Long> ids);
String getStudentAnswerZipByAnswerId(Long assignmentId,Long answerId);
List<Long> getFinishedAccountIds(Long assignmentId,Long siteId,Long companyId);
Integer getScore(Long assignmentId,Long siteId,Long companyId,Long accountId);
}
package com.yizhi.application.service;
import com.yizhi.application.entity.AssignmentAnswerSuggestion;
import com.baomidou.mybatisplus.service.IService;
/**
* <p>
* 老师对学员做的作业的回复内容 服务类
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
public interface AssignmentAnswerSuggestionService extends IService<AssignmentAnswerSuggestion> {
/**
* 根据作业答案找到suggestion实体
* @param id
* @return
*/
AssignmentAnswerSuggestion selectSuggestionByAnswerId(Long answerId);
/**
* 如果是第二次批阅,则干掉第一次的批阅
*/
Boolean delectSuggestion(Long answerId);
}
package com.yizhi.application.service;
import com.baomidou.mybatisplus.service.IService;
import com.yizhi.application.entity.AssignmentAnswerThumb;
/**
* @ClassName AssignmentAnswerThumbService
* @Description TODO
* @Author shengchenglong
* @DATE 2019-10-22 14:40
* @Version 1.0
*/
public interface AssignmentAnswerThumbService extends IService<AssignmentAnswerThumb> {
}
package com.yizhi.application.service;
import com.yizhi.application.entity.AssignmentAuditor;
import com.yizhi.assignment.application.vo.ListAuditor;
import java.util.List;
import com.baomidou.mybatisplus.service.IService;
/**
* <p>
* 作业和评阅人的对应关系 服务类
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
public interface AssignmentAuditorService extends IService<AssignmentAuditor> {
/**
* 已关联的评阅人
* @param assignmentId
* @return
*/
List<Long> relationAuditor(Long assignmentId);
/**
* 添加评阅人
* @param assignmentId
* @param list
*/
Boolean auditorInsert(ListAuditor listAuditor);
}
package com.yizhi.application.service;
import com.yizhi.application.entity.AssignmentContent;
import com.baomidou.mybatisplus.service.IService;
/**
* <p>
* 老师布置的作业的内容 服务类
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
public interface AssignmentContentService extends IService<AssignmentContent> {
/**
* 根据id查看作业内容
* @param id
* @return
*/
AssignmentContent findById(Long id);
/**
* 根据作业id(不是主键id)找到作业内容
* @param assignmentId
* @return
*/
AssignmentContent findByAssignmentId(Long assignmentId);
}
package com.yizhi.application.service;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.yizhi.core.application.context.RequestContext;
import com.yizhi.core.application.context.TaskContext;
import com.yizhi.application.entity.AssignmentComment;
import com.yizhi.core.application.file.domain.FileInfo;
import com.yizhi.core.application.file.domain.Template;
import com.yizhi.core.application.file.domain.TemplateColumn;
import com.yizhi.core.application.file.exp.ExcelExportor;
import com.yizhi.core.application.log.LogEventPublisher;
import com.yizhi.application.orm.id.IdGenerator;
import com.yizhi.system.application.system.remote.AccountClient;
import com.yizhi.core.application.task.TaskExecutor;
import com.yizhi.system.application.vo.AccountVO;
import com.yizhi.assignment.application.vo.apivo.ApiAssignmentCommentVO;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* @ClassName AssignmentExcelExporter
* @Description TODO
* @Author shengchenglong
* @DATE 2019-10-25 10:50
* @Version 1.0
*/
@Component
public class AssignmentExcelExporterService {
private static final Logger LOGGER = LoggerFactory.getLogger(AssignmentExcelExporterService.class);
@Autowired
private TaskExecutor taskExecutor;
@Autowired
private IdGenerator idGenerator;
@Autowired
private LogEventPublisher publisher;
@Autowired
private AccountClient accountClient;
public String doExport(RequestContext requestContext, Long answerId, String taskSerialNoPrefix, String fileNamePattern) {
Date now = new Date();
String serialNo = taskSerialNoPrefix + DateFormatUtils.format(now, "yyyyMMdd HH:mm:ss");
TaskContext taskContext = new TaskContext(idGenerator.generate(), serialNo, fileNamePattern, requestContext.getAccountId(),
now, requestContext.getSiteId(), requestContext.getCompanyId());
AssignmentExcelExporter accountExporter = new AssignmentExcelExporter<>(null, null, answerId, requestContext, fileNamePattern);
accountExporter.bindContext(taskContext);
accountExporter.bindPublisher(publisher);
taskExecutor.asynExecute(accountExporter);
LOGGER.info("开始导出异步任务:{}", taskSerialNoPrefix);
return serialNo;
}
private List<ApiAssignmentCommentVO> getData(RequestContext requestContext, Long answerId) {
AssignmentComment comment = new AssignmentComment();
comment.setSiteId(requestContext.getSiteId());
comment.setCompanyId(requestContext.getCompanyId());
comment.setAssignmentAnswerId(answerId);
comment.setDeleted(0);
EntityWrapper<AssignmentComment> ew = new EntityWrapper<>(comment);
ew.orderBy("create_time", false);
List<AssignmentComment> comments = comment.selectList(ew);
if (CollectionUtils.isNotEmpty(comments)) {
List<ApiAssignmentCommentVO> vos = new ArrayList<>();
comments.forEach(item -> {
ApiAssignmentCommentVO vo = new ApiAssignmentCommentVO();
vo.setCommentId(item.getId());
vo.setContent(item.getContent());
vo.setCreateTime(item.getCreateTime());
vo.setAuditStatus(item.getAuditStatus());
AccountVO accountVO = getAccount(item.getCreateById());
if (accountVO != null) {
vo.setManageCommentator(accountVO.getName());
vo.setManageCommentatorFullName(accountVO.getFullName());
}
if (item.getParentCreateById() != null) {
accountVO = getAccount(item.getParentCreateById());
if (accountVO != null) {
vo.setParentCreateByName(StringUtils.isEmpty(accountVO.getFullName()) ? accountVO.getName() : accountVO.getFullName());
}
}
vos.add(vo);
});
return vos;
}
return null;
}
private AccountVO getAccount(long accountId) {
AccountVO accountVO = accountClient.findById(accountId);
return accountVO;
}
private Template buildTemplate(RequestContext requestContext, String fileNamePattern) {
Template template = new Template();
List<TemplateColumn> columns = new ArrayList<>();
columns.add(new TemplateColumn("manageCommentator", "评论人/回复人", 1));
columns.add(new TemplateColumn("manageCommentatorFullName", "姓名", 2));
columns.add(new TemplateColumn("parentCreateByName", "评论对象", 3));
columns.add(new TemplateColumn("content", "评论内容", 4));
columns.add(new TemplateColumn("createTime", "提交时间", 5));
columns.add(new TemplateColumn("auditStatusStr", "状态", 6));
template.setColumns(columns);
template.setFileName(fileNamePattern + DateFormatUtils.format(new Date(), "yyyyMMdd") + ".xls");
template.setBrowserExport(false);
return template;
}
/**
* 导出实现
*
* @param <T>
*/
class AssignmentExcelExporter<T> extends ExcelExportor<T> {
private RequestContext requestContext;
private String fileNamePattern;
private Long answerId;
public AssignmentExcelExporter(Template template, List<T> data, Long answerId, RequestContext requestContext, String fileNamePattern) {
super(template, data);
this.requestContext = requestContext;
this.fileNamePattern = fileNamePattern;
this.answerId = answerId;
}
private void beforeRender() {
Template template = buildTemplate(requestContext, fileNamePattern);
this.template = template;
this.data = (List<T>) getData(requestContext, answerId);
}
@Override
public FileInfo render() {
beforeRender();
return super.render();
}
}
}
package com.yizhi.application.service;
import com.yizhi.application.entity.AssignmentFile;
import java.util.List;
import com.baomidou.mybatisplus.service.IService;
/**
* <p>
* 老师布置的作业对应多个文件,存放多个文件地址 服务类
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
public interface AssignmentFileService extends IService<AssignmentFile> {
/**
* 根据作业id删除老师布置得作业的文件 管理端------2018,09,18
* @param assignmentId
* @return
*/
Boolean deleteFileByAssignmentId(Long assignmentId);
/**
* 根据作业id找到作业文件
* @param assignmentId
* @return
*/
List<AssignmentFile> listAssignmentFile(Long assignmentId);
}
package com.yizhi.application.service;
import com.yizhi.application.entity.AssignmentGrade;
import com.baomidou.mybatisplus.service.IService;
import java.util.List;
/**
* <p>
* 老师布置的作业等级
编号100号作业 可以有多个等级 服务类
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
public interface AssignmentGradeService extends IService<AssignmentGrade> {
/**
*
* @param id 根据老师布置作业的id,查询出所有作业的等级
* @return 返回所有作业的等级
*/
List<AssignmentGrade> getListAssignmentGrade(Long assignmentId);
/**
* 根据提交的作业,找到gradeid,再根据gradeid找到对应的 是优秀还是良好或者不及格
* @param id
* @return
*/
AssignmentGrade getGrade(Long id);
/**
* 根据作业Id删除作业设置的等级 管理端--------2018/09/18
* @param assignmentId
* @return
*/
Boolean deleteAssignmentGradeByAssignmentId(Long assignmentId);
}
package com.yizhi.application.service;
import java.util.List;
import com.baomidou.mybatisplus.service.IService;
import com.yizhi.application.entity.AssignmentPoint;
/**
* <p>
* 服务类
* </p>
*
* @author yizhi123
* @since 2018-09-04
*/
public interface AssignmentPointService extends IService<AssignmentPoint> {
Boolean deleteAssignmentPointByAssignmentId(Long assignmentId);
List<AssignmentPoint> getListAssignmentPoint(Long assignmentId);
/**
* 培训项目得到积分
* @param ids
* @return
*/
AssignmentPoint getTrainingPoint(List<Long> ids);
}
package com.yizhi.application.service;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.IService;
import com.yizhi.application.entity.Assignment;
import com.yizhi.assignment.application.vo.*;
import com.yizhi.assignment.application.vo.apivo.ApiAssignmentListResultVO;
import com.yizhi.assignment.application.vo.apivo.ApiAssignmentVO;
import com.yizhi.assignment.application.vo.apivo.AssignmentTrainingProject;
import com.yizhi.assignment.application.vo.apivo.ToOthersApi;
import com.yizhi.core.application.vo.DroolsVo;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* <p>
* 老师布置作业的主表 服务类
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
public interface AssignmentService extends IService<Assignment> {
Page<ApiAssignmentListResultVO> listUnfinishedAssignment(int pageNo, int pageSize,Long accountId,List<Long> relationIds,Long companyId,Long siteId);
Page<ApiAssignmentListResultVO> listFinishedAssignment(int pageNo, int pageSize,Long accountId,List<Long> relationIds,Long companyId,Long siteId);
ApiAssignmentVO getAssignment(Long assignmentId,Long accountId);
/**
* 新建作业保存/修改作业 管理端----2018/09/18
* @param assignmentVo
* @return
*/
Boolean save(AssignmentSaveParamVo assignmentVo);
/**
* 管理端显示作业列表 管理端-----2018/09/18
* @param name
* @param pageNo
* @param pageSize
* @return
*/
Page<Assignment> assignmentList(String currentTime, AssignmentListVoTo assignmentListVoTo);
/**
* 删除作业
*
* @param assignmentId
* @return
*/
Boolean updateDelete(AssignmentDeleteVO assignmentDelete);
/**
* 根据条件查询所有作业 学员端---2018、09、08
*
* @param pageNo
* @param pageSize
* @return
*/
Page<ApiAssignmentListResultVO> listAllAssignmentByName(String name,int pageNo, int pageSize,Long accountId,List<Long> relationIds,Long siteId);
/**
* 作业上下架接口
* @param id
* @return
*/
Boolean update(Long id,Integer status,Long accountId,String accountName);
/**
* 查看总记录数
*/
//Integer sumNum(String name,Long siteId);
/**
* 根据账号id查到自己账号下的
* @param accountId
* @return
*/
Integer selectAssignmentNumByAccountId(Long accountId);
PointParamVO assignmentReadOverByTeacher(AssignmentAnswerContentVO assignmentAnswerContentVO);
/**
* 全平台可见的作业个数 已上架 visible_range=1 全平台可见
* @param siteId
* @return
*/
Integer getAssignmentCountQXPT(Long siteId);
/**
* 指定的范围
* @param assignmentId
* @return
*/
AssignmentQXVO getQXSubmitMessage(Long assignmentId);
/**
* 给门户用的 学员端-------2018/09/08
* @param name
* @param pageNo
* @param pageSize
* @param accountId
* @param relationIds
* @param siteId
* @return
*/
List<ToOthersApi> listSearchOthers(String name,int pageNo, int pageSize,Long accountId,List<Long> relationIds,Long siteId);
/**
* 范围人员导出 管理端-------2018/09/19
* @param assignmentId
* @return
*/
public VisibleRangeExport vsibleRangeExport(Long assignmentId);
/**
* 修改培訓項目信息
*/
public boolean updateAssignmentTp(AssignmentTrainingProject atp);
List<Map<String, Object>> getServerByCompanyIdAndIds(Long companyId,List<Long> ids);
Integer delete(Long assignmentId);
Page<Map<String, Object>> experiencePoolList(String name, List<Long> ids, Integer pageNo, Integer pageSize);
Page<AssignmentCalendarVO> getPageToCalendar(Date date, Page<Assignment> page);
Page<DroolsVo> getPageByDrools(String field, String value, Page<DroolsVo> page);
}
package com.yizhi.application.service;
import com.yizhi.application.entity.AssignmentStudent;
import com.yizhi.assignment.application.vo.ListStudent;
import java.util.List;
import com.baomidou.mybatisplus.service.IService;
/**
* <p>
* 老师布置作业和学生进行关联。
多对多的关系。
一个老师布置的作业有多个学生做。 服务类
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
public interface AssignmentStudentService extends IService<AssignmentStudent> {
/**
* 添加学员
* @param studentList
* @param assignment_id
*/
Boolean add(ListStudent listStudent);
/**
* 添加学员,之前记录不删除
*
* @param studentList
* @param assignment_id
*/
Boolean insertStudentRelation(List<AssignmentStudent> assignmentStudents);
/**
* 已经关联的学员名单
* @param assignment_id
* @return
*/
List<AssignmentStudent> relation(Long assignmentId);
/**
* 已关联的总人数
* @param assignmentId
* @return
*/
Integer sumNum(Long assignmentId);
/**
* 删除已关联的
* @param assignmentId
* @return
*/
Boolean deleteRelation(Long assignmentId);
/**
* 根据账号id查询这个账号下的作业个数 学员端---目录页面 2018/09/08 13:13
* @param accountId
* @return
*/
Integer getAssignmentNumByAccountId(List<Long> relationIds,Long siteId,Long accountId);
}
package com.yizhi.application.service;
import com.baomidou.mybatisplus.service.IService;
import com.yizhi.application.entity.AssignmentAnswerTipoff;
/**
* <p>
* 服务类
* </p>
*
* @author shengchenglong123
* @since 2019-10-22
*/
public interface IAssignmentAnswerTipoffService extends IService<AssignmentAnswerTipoff> {
}
package com.yizhi.application.service.impl;
import com.yizhi.application.entity.AssignmentAnswerCourse;
import com.yizhi.application.mapper.AssignmentAnswerCourseMapper;
import com.yizhi.application.service.AssignmentAnswerCourseService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 一个学员对一个作业的回复内容 服务实现类
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
@Service
public class AssignmentAnswerCourseServiceImpl extends ServiceImpl<AssignmentAnswerCourseMapper, AssignmentAnswerCourse> implements AssignmentAnswerCourseService {
/*@Override
public AssignmentAnswerContent getAssignmentAnswerContentByAccountIdAndAssignmentId(Long answerId) {
// TODO Auto-generated method stub
AssignmentAnswerContent assignmentAnswerContent=new AssignmentAnswerContent();
assignmentAnswerContent.setAnswerId(answerId);
EntityWrapper<AssignmentAnswerContent> wrapper=new EntityWrapper<AssignmentAnswerContent>(assignmentAnswerContent);
return this.selectOne(wrapper);
}*/
}
package com.yizhi.application.service.impl;
import java.util.ArrayList;
import java.util.List;
import com.yizhi.application.entity.AssignmentAnswerFile;
import com.yizhi.application.mapper.AssignmentAnswerFileMapper;
import com.yizhi.application.service.AssignmentAnswerFileService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
/**
* <p>
* 学员对作业回复可以是文件,存放学员的作业回复的文件的地址 服务实现类
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
@Service
@Transactional
public class AssignmentAnswerFileServiceImpl extends ServiceImpl<AssignmentAnswerFileMapper, AssignmentAnswerFile> implements AssignmentAnswerFileService {
@Override
public List<List<AssignmentAnswerFile>> selectAssignmentAnswerFileById(List<Long> ids) {
List<List<AssignmentAnswerFile>> allList=new ArrayList<List<AssignmentAnswerFile>>();
if(!CollectionUtils.isEmpty(ids)) {
for(int i=0;i<ids.size();i++){
AssignmentAnswerFile assignmentAnswerFile=new AssignmentAnswerFile();
assignmentAnswerFile.setAnwserId(ids.get(i));
assignmentAnswerFile.setType(1);//文件类型(1:作业答案,2:评阅回复)
EntityWrapper<AssignmentAnswerFile> wrapper=new EntityWrapper<AssignmentAnswerFile>(assignmentAnswerFile);
List<AssignmentAnswerFile> answerFiles=selectList(wrapper); //一个学生对应的多个文件
allList.add(answerFiles);
}
return allList;
}
else {
return allList;
}
}
@Override
public List<AssignmentAnswerFile> listAssignmentAnswerFile(Long id) {
// TODO Auto-generated method stub
AssignmentAnswerFile assignmentAnswerFile=new AssignmentAnswerFile();
assignmentAnswerFile.setAnwserId(id);
assignmentAnswerFile.setType(1); //文件类型(1:作业答案,2:评阅回复)
EntityWrapper<AssignmentAnswerFile> wrapper=new EntityWrapper<AssignmentAnswerFile>(assignmentAnswerFile);
List<AssignmentAnswerFile> answerFiles=selectList(wrapper);
return answerFiles;
}
@Override
public List<AssignmentAnswerFile> listAssignmentAnswerBackFile(Long id) {
// TODO Auto-generated method stub
AssignmentAnswerFile assignmentAnswerFile=new AssignmentAnswerFile();
assignmentAnswerFile.setAnwserId(id);
assignmentAnswerFile.setType(2); //文件类型(1:作业答案,2:评阅回复)
EntityWrapper<AssignmentAnswerFile> wrapper=new EntityWrapper<AssignmentAnswerFile>(assignmentAnswerFile);
List<AssignmentAnswerFile> answerFiles=selectList(wrapper);
return answerFiles;
}
@Override
public Boolean deleteAnswerFile(Long assignmentId) {
// TODO Auto-generated method stub
AssignmentAnswerFile assignmentAnswerFile=new AssignmentAnswerFile();
assignmentAnswerFile.setAnwserId(assignmentId);
assignmentAnswerFile.setType(2);
EntityWrapper<AssignmentAnswerFile> wrapper=new EntityWrapper<AssignmentAnswerFile>(assignmentAnswerFile);
return this.delete(wrapper);
}
@Override
public List<AssignmentAnswerFile> listGetAssignmentAnswerFile(Long answerId, Integer type) {
// TODO Auto-generated method stub
AssignmentAnswerFile assignmentAnswerFile=new AssignmentAnswerFile();
assignmentAnswerFile.setAnwserId(answerId);
assignmentAnswerFile.setType(type);
EntityWrapper<AssignmentAnswerFile> wrapper=new EntityWrapper<AssignmentAnswerFile>(assignmentAnswerFile);
List<AssignmentAnswerFile> answerFiles=selectList(wrapper);
return answerFiles;
}
@Override
public Integer verifyVideo(List<Long> ids) {
return this.baseMapper.verifyVideo(ids);
}
}
package com.yizhi.application.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.yizhi.application.entity.*;
import com.yizhi.application.eum.AnswerFileTypeEnum;
import com.yizhi.application.eum.AnswerStatusEnum;
import com.yizhi.comment.application.vo.domain.PdfPagesVo;
import com.yizhi.core.application.event.EventWrapper;
import com.yizhi.comment.application.feign.PdfPagesClient;
import com.yizhi.core.application.file.constant.FileConstant;
import com.yizhi.core.application.file.util.OssUpload;
import com.yizhi.application.mapper.*;
import com.yizhi.application.orm.id.IdGenerator;
import com.yizhi.application.orm.util.QueryUtil;
import com.yizhi.core.application.publish.CloudEventPublisher;
import com.yizhi.application.service.*;
import com.yizhi.system.application.vo.domain.Account;
import com.yizhi.system.application.system.remote.AccountClient;
import com.yizhi.core.application.task.AbstractTaskHandler;
import com.yizhi.core.application.task.TaskExecutor;
import com.yizhi.application.util.FileReadUtil;
import com.yizhi.comment.application.vo.PdfVO;
import com.yizhi.system.application.vo.AuthorizeUsersVO;
import com.yizhi.system.application.vo.UserInfoVO;
import com.yizhi.system.application.vo.domain.Account;
import com.yizhi.util.application.constant.QueueConstant;
import com.yizhi.util.application.constant.TpActivityType;
import com.yizhi.util.application.event.AssignmentMediaTranscodingEvent;
import com.yizhi.util.application.event.TrainingProjectEvent;
import com.yizhi.util.application.zip.ZipUtil;
import com.yizhi.assignment.application.vo.*;
import com.yizhi.assignment.application.vo.apivo.*;
import com.yizhi.core.application.context.ContextHolder;
import com.yizhi.core.application.context.RequestContext;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
* <p>
* 学员对作业的对应关系 服务实现类
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
@Service
public class AssignmentAnswerServiceImpl extends ServiceImpl<AssignmentAnswerMapper, AssignmentAnswer> implements AssignmentAnswerService {
private static final Logger LOG=LoggerFactory.getLogger(AssignmentAnswerServiceImpl.class);
@Autowired
private IdGenerator idGenerator;
@Autowired
private AssignmentAnswerMapper assignmentAnswerMapper;
@Autowired
private AssignmentAnswerFileMapper assignmentAnswerFileMapper;
@Autowired
private AssignmentAnswerCourseMapper assignmentAnswerContentMapper;
@Autowired
private AssignmentAnswerFileService assignmentAnswerFileService;
@Autowired
private AssignmentMapper assignmentMapper;
@Autowired
private AssignmentService assignmentService;
@Autowired
private AssignmentAnswerService assignmentAnswerService;
@Autowired
private AssignmentContentService assignmentContentService;
@Autowired
private AssignmentFileMapper assignmentFileMapper;
@Autowired
private AssignmentAnswerSuggestionService assignmentAnswerSuggestionService;
@Autowired
private AssignmentGradeMapper assignmentGradeMapper;
@Autowired
private TaskExecutor taskExecutor;
@Autowired
private CloudEventPublisher cloudEventPublisher;
@Autowired
private FileReadUtil fileReadUtil;
@Autowired
AccountClient accountClient;
@Autowired
private PdfPagesClient pdfPagesClient;
@Override
@Transactional
public Boolean submitAssignmentAnswer(ApiAssignmentAswerVO vo) {
Boolean isSubmit=true;
Date currentDate=new Date();
Long assignmentId=vo.getAssignmentId();
Long accountId=vo.getAccountId();
Assignment assignment=assignmentService.selectById(assignmentId);
List<AssignmentAnswer> list=assignmentAnswerService.getAssignmentAnswer(assignmentId, accountId);
Long siteId=ContextHolder.get().getSiteId();
/*if(list!=null) {
answerNum=list.size();
}
//提交次数<指定次数
if(answerNum<assignment.getCount()) {
//不限定时间
if(assignment.getFinishTime()==null) {
isSubmit=true;
}
//限定时间 未逾期
if(assignment.getFinishTime()!=null && assignment.getFinishTime().compareTo(currentDate)>0) {
isSubmit=true;
}
//限定时间 逾期 允许补交的
if(assignment.getFinishTime()!=null && assignment.getFinishTime().compareTo(currentDate)<0 && assignment.getAmendable()==1) {
isSubmit=true;
}
}*/
if(isSubmit) {
// 答案主体
AssignmentAnswer answer = new AssignmentAnswer();
answer.setId(idGenerator.generate());
answer.setAccountId(vo.getAccountId());
answer.setRealName(vo.getRealName());
answer.setAccountName(vo.getAccountName());
answer.setAssignmentId(vo.getAssignmentId());
answer.setContent(vo.getContent());
answer.setStatus(AnswerStatusEnum.UNCHECKED.getValue());
answer.setCompanyId(vo.getCompanyId());
answer.setOrgId(vo.getOrgId());
answer.setSiteId(vo.getSiteId());
answer.setCreateById(vo.getAccountId());
answer.setCreateByName(vo.getAccountName());
answer.setCreateTime(currentDate);
answer.setSource(vo.getSource());
assignmentAnswerMapper.insert(answer);
//作业来源(1本地2做课)
// 作业素材内容content 通过做课上传,素材的视频地址或者素材的富媒体的内容, 通过做课上传,不需要内容 只有几个文件
if(vo.getSource()==2&&vo.getCourseId()!=null) {
AssignmentAnswerCourse content = new AssignmentAnswerCourse();
content.setId(idGenerator.generate());
content.setAnswerId(answer.getId());
content.setMid(vo.getCourseId());
content.setCreateById(vo.getAccountId());
content.setCreateByName(vo.getAccountName());
content.setCreateTime(currentDate);
assignmentAnswerContentMapper.insert(content);
}
// 答案附件(文件,可能为多个)
List<ApiFileVo> fileVos = vo.getFileVos();
if (vo.getSource()==1&&!CollectionUtils.isEmpty(fileVos)) {
AssignmentMediaTranscodingEvent event = new AssignmentMediaTranscodingEvent();
List<AssignmentMediaTranscodingEvent.FileDTO> fileDTOS = new ArrayList<>();
List<PdfVO> pdfVOs = new ArrayList<PdfVO>();
for (ApiFileVo fileVo : fileVos) {
AssignmentAnswerFile file = new AssignmentAnswerFile();
PdfVO pdfVO = new PdfVO();
file.setId(idGenerator.generate());
file.setAnwserId(answer.getId());
file.setFileName(fileVo.getFileName());
file.setFileUrl(fileVo.getOssUrl());
file.setSuffix(fileVo.getSuffix());
String size=fileVo.getSize();
if(size==null) {
size="0M";
}
file.setSize(size);
file.setType(AnswerFileTypeEnum.ANSWER.getValue());
file.setCreateById(vo.getAccountId());
file.setCreateByName(vo.getAccountName());
file.setCreateTime(currentDate);
file.setSize(fileVo.getSize());
assignmentAnswerFileMapper.insert(file);
pdfVO.setBizId(file.getId());
pdfVO.setBizType(TpActivityType.TYPE_ASSIGNMENT);
pdfVO.setCompanyId(vo.getCompanyId());
pdfVO.setSiteId(vo.getSiteId());
pdfVO.setCreateById(accountId);
pdfVO.setOriginalFile(file.getFileName());
pdfVO.setOriginalFileUrl(file.getFileUrl());
pdfVOs.add(pdfVO);
fileDTOS.add(event.new FileDTO(file.getId(), file.getFileUrl()));
}
event.setType(TpActivityType.TYPE_ASSIGNMENT);
event.setFiles(fileDTOS);
LOG.info("媒体转码发送消息:"+event.toString());
cloudEventPublisher.publish("assignmentMediaTranscoding",
new EventWrapper(0L, event));
try {
if (CollectionUtils.isNotEmpty(pdfVOs)) {
LOG.info("pdf解析图片发送消息:"+pdfVOs.toString());
cloudEventPublisher.publish("pdfToPng",
new EventWrapper(0L, pdfVOs));
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
LOG.error("pdf解析图片发送消息失败:",e);
}
}
try{
taskExecutor.asynExecute(new AbstractTaskHandler() {
@Override
public void handle() {
try {
cloudEventPublisher.publish(QueueConstant.TRAINING_PROJECT_EVENT_QUEUE,
new EventWrapper<TrainingProjectEvent>(assignmentId,
TrainingProjectEvent.getInstance(assignmentId, TpActivityType.TYPE_ASSIGNMENT, accountId, new Date(),siteId,null,false)));
} catch (Exception e) {
e.printStackTrace();
}
}
});
}catch (Exception e){
LOG.error("培训项目发送消息失败:",e);
}
return true;
}
else {
return false;
}
}
/**
*
*/
@Override
public Integer noRead(Long id,List<Long> accountIds) {
// TODO Auto-generated method stub
AssignmentAnswer assignmentAnswer = new AssignmentAnswer();
assignmentAnswer.setAssignmentId(id);
assignmentAnswer.setStatus(1);
assignmentAnswer.setDeleted(0);
EntityWrapper<AssignmentAnswer> wrapper = new EntityWrapper<AssignmentAnswer>(assignmentAnswer);
wrapper.in("account_id",accountIds);
Integer noReadCount = assignmentAnswerMapper.selectCount(wrapper);
LOG.info("当前的数量noReadCount:{}",noReadCount);
return noReadCount;
}
/**
* 提交数量
*/
@Override
public Integer submitNum(Long id,List<Long> accountIds) {
// TODO Auto-generated method stub
AssignmentAnswer assignmentAnswer = new AssignmentAnswer();
assignmentAnswer.setAssignmentId(id);
assignmentAnswer.setDeleted(0);
EntityWrapper<AssignmentAnswer> wrapper = new EntityWrapper<AssignmentAnswer>(assignmentAnswer);
wrapper.in("account_id",accountIds);
Integer submitNum = assignmentAnswerMapper.selectCount(wrapper);
LOG.info("当前的数量submitNum:{}",submitNum);
return submitNum;
}
@Override
public Page<AssignmentReadListVO> assignmentAnswerList(String keywords, String name, Long assignmentId, Long accountId, Integer state, Integer type,
Integer pageNo, Integer pageSize, List<Long> accountIds) {
RequestContext context = ContextHolder.get();
Integer admin = context.isAdmin() ? 1 : 0 ;
Page<AssignmentReadListVO> page = new Page<AssignmentReadListVO>(pageNo,pageSize);
Assignment assignment=assignmentService.selectById(assignmentId);
List<AssignmentReadListVO> list = new ArrayList<AssignmentReadListVO>();
// 根据部门查询到部门下的所有人
List<Long> accountIdList = new ArrayList<Long>();
List<Account> accounVOtList = new ArrayList<Account>();
if (StringUtils.isEmpty(keywords) && StringUtils.isEmpty(name)) {
List<Long> intersectionAccountIds = new ArrayList<>();
if (type == 2) {
List<AssignmentReadListVO> answerList = assignmentAnswerMapper.list(admin,accountId, assignmentId, state, type, accountIds);
List<Long> userIds = answerList.parallelStream().map(assignmentReadListVO -> {
return assignmentReadListVO.getAccountId();
}).collect(Collectors.toList());
AuthorizeUsersVO authorizeUsersVO = new AuthorizeUsersVO();
authorizeUsersVO.setRoleId(context.getCompanyId());
authorizeUsersVO.setUserIds(userIds);
Map<Long, Account> accountMap = accountClient.getAccountList(authorizeUsersVO);
answerList = answerList.parallelStream().map(assignmentReadListVO -> {
Long userId = assignmentReadListVO.getAccountId();
assignmentReadListVO.setAccountName(accountMap.get(userId)!=null?accountMap.get(userId).getName():"");
assignmentReadListVO.setRealName(accountMap.get(userId)!=null?accountMap.get(userId).getFullName():"");
return assignmentReadListVO;
}).collect(Collectors.toList());
LOG.info("返回列表answerlist:{}",JSON.toJSON(answerList));
if (!CollectionUtils.isEmpty(answerList)){
page.setTotal(answerList.size());
// 查询到答题用户id列表
// List<Long> ids = answerList.parallelStream().map(assignmentReadListVO -> {
// return assignmentReadListVO.getAccountId();
// }).collect(Collectors.toList());
//
// LOG.info("返回列表ids:{}",JSON.toJSON(ids));
// accountId 排序
// if (CollectionUtils.isNotEmpty(ids)) {
// accountIdList = accountClient.selectAccountIdList(ids);
// 列表排序
// setListOrder(accountIdList,answerList);
LOG.info("排序前:{}",JSON.toJSON(answerList));
answerList.sort(Comparator.comparing(AssignmentReadListVO::getAccountName,String.CASE_INSENSITIVE_ORDER).thenComparing(AssignmentReadListVO::getCreateTime, Comparator.reverseOrder()));
LOG.info("排序后:{}",JSON.toJSON(answerList));
// }
List<AssignmentReadListVO> pagingResultMap = getPagingResultMap(answerList, pageNo, pageSize);
LOG.info("返回列表:{}",JSON.toJSON(pagingResultMap));
list.addAll(pagingResultMap);
LOG.info("返回列表3:{}",JSON.toJSON(list));
}
} else if (type ==1 ){
list = assignmentAnswerMapper.list(admin,accountId, assignmentId, state, type, accountIds,page);
} else {
list = Collections.emptyList();
}
} else {
// accountIdList.add(0L);
UserInfoVO userInfoVO = new UserInfoVO();
userInfoVO.setName(name);
userInfoVO.setFullName(name);
userInfoVO.setOrgName(keywords);
userInfoVO.setCompanyId(ContextHolder.get().getCompanyId());
LOG.info("查询参数:{}",JSON.toJSON(userInfoVO));
List<Account> userInfoVOList = accountClient.getUserInfoVOList(userInfoVO);
LOG.info("返回的userInfoVOList结果:{}",JSON.toJSON(userInfoVOList));
accountIdList = userInfoVOList.parallelStream().map(user -> {
return user.getId();
}).collect(Collectors.toList());
if (CollectionUtils.isEmpty(accountIdList)) {
// list = Collections.emptyList();
return new Page<AssignmentReadListVO>();
} else {
LOG.info("获取用户给请求参数的用户id:{}",accountIdList);
List<Long> intersectionAccountIds = new ArrayList<>();
if (CollectionUtils.isNotEmpty(accountIds)) {
intersectionAccountIds = accountIdList.stream().filter(item -> accountIds.contains(item)).collect(Collectors.toList());
LOG.info("取交集后的用户ids:{}",JSON.toJSON(intersectionAccountIds));
if (StringUtils.isNotEmpty(keywords)&&CollectionUtils.isEmpty(intersectionAccountIds)) {
return new Page<AssignmentReadListVO>();
}
} else {
intersectionAccountIds = accountIdList;
}
List<AssignmentReadListVO> answerList = new ArrayList<>();
if (type == 2) {
answerList = assignmentAnswerMapper.list(admin,accountId, assignmentId, state, type, intersectionAccountIds);
if (CollectionUtils.isNotEmpty(answerList)) {
List<Long> userIds = answerList.parallelStream().map(assignmentReadListVO -> {
return assignmentReadListVO.getAccountId();
}).collect(Collectors.toList());
AuthorizeUsersVO authorizeUsersVO = new AuthorizeUsersVO();
authorizeUsersVO.setRoleId(context.getCompanyId());
authorizeUsersVO.setUserIds(userIds);
Map<Long, Account> accountMap = accountClient.getAccountList(authorizeUsersVO);
answerList = answerList.parallelStream().map(assignmentReadListVO -> {
Long userId = assignmentReadListVO.getAccountId();
assignmentReadListVO.setAccountName(accountMap.get(userId)!=null?accountMap.get(userId).getName():"");
assignmentReadListVO.setRealName(accountMap.get(userId)!=null?accountMap.get(userId).getFullName():"");
return assignmentReadListVO;
}).collect(Collectors.toList());
answerList.sort(Comparator.comparing(AssignmentReadListVO::getAccountName,String.CASE_INSENSITIVE_ORDER ).thenComparing(AssignmentReadListVO::getCreateTime, Comparator.reverseOrder()));
}
} else if (type ==1){
answerList = assignmentAnswerMapper.list(admin,accountId, assignmentId, state, type, intersectionAccountIds);
}
List<AssignmentReadListVO> pagingResultMap = getPagingResultMap(answerList, pageNo, pageSize);
LOG.info("返回分页后的结果:{}",JSON.toJSON(pagingResultMap));
list.addAll(pagingResultMap);
page.setTotal(answerList.size());
}
}
if(CollectionUtils.isNotEmpty(list)) {
AssignmentReadListVO assignmentReadListVO=null;
AssignmentGrade assignmentGrade=null;
// 排序
for (int i = 0; i < list.size(); i++) {
assignmentReadListVO=list.get(i);
//已阅
if(assignmentReadListVO!=null&&assignmentReadListVO.getStatus()==2) {
Integer score=assignmentReadListVO.getScore();
assignmentGrade=assignmentGradeMapper.getGradeByAssignmentIdAndScore(assignmentId, score);
if(assignmentGrade!=null) {
assignmentReadListVO.setGradeName(assignmentGrade.getDescription());
}
}
if(assignment!=null) {
assignmentReadListVO.setType(assignment.getType());
}
if (type == 1 ){
Account account = accountClient.getAccountById(assignmentReadListVO.getAccountId());
assignmentReadListVO.setAccountName(account!=null?account.getName():"");
}
}
}
page.setRecords(list);
return page;
}
@Override
public List<AssignmentReadListVO> getAssignmentAnswerIdList(List<Long> accountIds,String keywords,String name,Long assignmentId,Long accountId, Integer state, Integer type) {
Assignment assignment = assignmentService.selectById(assignmentId);
List<AssignmentReadListVO> list = new ArrayList<AssignmentReadListVO>();
List<Long> accountIdList = new ArrayList<Long>();
RequestContext context = ContextHolder.get();
Integer admin = context.isAdmin() ? 1 : 0;
if (org.apache.commons.lang3.StringUtils.isEmpty(keywords) && org.apache.commons.lang3.StringUtils.isEmpty(name)) {
if (type == 2) {
List<AssignmentReadListVO> answerList = assignmentAnswerMapper.getAnswerIdList(admin,accountId, assignmentId, state, type, accountIds);
LOG.info("返回列表answerlist:{}", JSON.toJSON(answerList));
if (!CollectionUtils.isEmpty(answerList)) {
// List<Long> ids = answerList.parallelStream().map(assignmentReadListVO -> {
// return assignmentReadListVO.getAccountId();
// }).collect(Collectors.toList());
//
// LOG.info("返回列表ids:{}", JSON.toJSON(answerList));
// // accountId 排序
// if (CollectionUtils.isNotEmpty(ids)) {
// accountIdList = accountClient.selectAccountIdList(ids);
// // 列表排序
// setListOrder(accountIdList, answerList);
//
// }
List<Long> userIds = answerList.parallelStream().map(assignmentReadListVO -> {
return assignmentReadListVO.getAccountId();
}).collect(Collectors.toList());
AuthorizeUsersVO authorizeUsersVO = new AuthorizeUsersVO();
authorizeUsersVO.setRoleId(context.getCompanyId());
authorizeUsersVO.setUserIds(userIds);
Map<Long, Account> accountMap = accountClient.getAccountList(authorizeUsersVO);
answerList = answerList.parallelStream().map(assignmentReadListVO -> {
Long userId = assignmentReadListVO.getAccountId();
assignmentReadListVO.setAccountName(accountMap.get(userId)!=null?accountMap.get(userId).getName():"");
assignmentReadListVO.setRealName(accountMap.get(userId)!=null?accountMap.get(userId).getFullName():"");
return assignmentReadListVO;
}).collect(Collectors.toList());
LOG.info("排序后的ids:{}", JSON.toJSON(answerList));
answerList.sort(Comparator.comparing(AssignmentReadListVO::getAccountName,String.CASE_INSENSITIVE_ORDER).thenComparing(AssignmentReadListVO::getCreateTime, Comparator.reverseOrder()));
list.addAll(answerList);
LOG.info("返回列表3:{}", JSON.toJSON(list));
}
} else if (type == 1) {
list = assignmentAnswerMapper.getAnswerIdList(admin,accountId, assignmentId, state, type, accountIds);
} else {
list = Collections.emptyList();
}
} else {
UserInfoVO userInfoVO = new UserInfoVO();
userInfoVO.setName(name);
userInfoVO.setFullName(name);
userInfoVO.setOrgName(keywords);
userInfoVO.setCompanyId(ContextHolder.get().getCompanyId());
LOG.info("查询参数:{}", JSON.toJSON(userInfoVO));
List<Account> userInfoVOList = accountClient.getUserInfoVOList(userInfoVO);
LOG.info("返回的userInfoVOList结果:{}", JSON.toJSON(userInfoVOList));
accountIdList = userInfoVOList.parallelStream().map(user -> {
return user.getId();
}).collect(Collectors.toList());
if (CollectionUtils.isEmpty(accountIdList)) {
return Collections.emptyList();
} else {
LOG.info("请求用户id:{}", accountIdList);
List<Long> intersectionAccountIds = new ArrayList<>();
if (CollectionUtils.isNotEmpty(accountIds)) {
intersectionAccountIds = accountIdList.stream().filter(item -> accountIds.contains(item)).collect(Collectors.toList());
if (StringUtils.isNotEmpty(keywords)&&CollectionUtils.isEmpty(intersectionAccountIds)) {
return Collections.emptyList();
}
} else {
intersectionAccountIds = accountIdList;
}
if (CollectionUtils.isNotEmpty(intersectionAccountIds)) {
// accountId 排序
intersectionAccountIds = accountClient.selectAccountIdList(intersectionAccountIds);
}
List<AssignmentReadListVO> answerList = new ArrayList<>();
if (type == 2) {
answerList = assignmentAnswerMapper.getAnswerIdList(admin,accountId, assignmentId, state, type, intersectionAccountIds);
if (CollectionUtils.isNotEmpty(answerList)) {
List<Long> userIds = answerList.parallelStream().map(assignmentReadListVO -> {
return assignmentReadListVO.getAccountId();
}).collect(Collectors.toList());
AuthorizeUsersVO authorizeUsersVO = new AuthorizeUsersVO();
authorizeUsersVO.setRoleId(context.getCompanyId());
authorizeUsersVO.setUserIds(userIds);
Map<Long, Account> accountMap = accountClient.getAccountList(authorizeUsersVO);
answerList = answerList.parallelStream().map(assignmentReadListVO -> {
Long userId = assignmentReadListVO.getAccountId();
assignmentReadListVO.setAccountName(accountMap.get(userId)!=null?accountMap.get(userId).getName():"");
assignmentReadListVO.setRealName(accountMap.get(userId)!=null?accountMap.get(userId).getFullName():"");
return assignmentReadListVO;
}).collect(Collectors.toList());
answerList.sort(Comparator.comparing(AssignmentReadListVO::getAccountName,String.CASE_INSENSITIVE_ORDER).thenComparing(AssignmentReadListVO::getCreateTime, Comparator.reverseOrder()));
}
} else {
answerList = assignmentAnswerMapper.getAnswerIdList(admin,accountId, assignmentId, state, type, intersectionAccountIds);
}
list = answerList;
// 列表排序
// setListOrder(accountIdList,answerList);
LOG.info("返回列表3:{}", JSON.toJSON(list));
}
}
return list;
}
/**
 * @currPageNo  页面传入的页号,从一开始
 * @pageSize每页记录数
 */
public <T> List<T> getPagingResultMap(List<T> list, Integer currPageNo, Integer pageSize) {
Map<String, Object> retMap = new HashMap<>();
int totalRowNum = list.size();
int totalPageNum = (totalRowNum - 1) / pageSize + 1;
int realPageNo = currPageNo;
if (currPageNo > totalPageNum) {
realPageNo = totalPageNum;
} else if (currPageNo < 1) {
realPageNo = 1;
}
int fromIdx = (realPageNo - 1) * pageSize;
int toIdx = realPageNo * pageSize > totalRowNum ? totalRowNum : realPageNo * pageSize;
List<T> result = list.subList(fromIdx, toIdx);
// retMap.put("result", result);
// retMap.put("pageNo", realPageNo);
// retMap.put("pageRowNum", result.size());
// retMap.put("totalRowNum", totalRowNum);
// retMap.put("totalPageNum", totalPageNum);
return result;
}
// public static void setListOrder(List<Long> orderRegulation, List<AssignmentReadListVO> targetList) {
// Collections.sort(targetList, ((o1, o2) -> {
// int io1 = orderRegulation.indexOf(o1.getAccountId());
// int io2 = orderRegulation.indexOf(o2.getAccountId());
//
// if (io1 != -1) {
// io1 = targetList.size() - io1;
// }
// if (io2 != -1) {
// io2 = targetList.size() - io2;
// }
//
// return io2 - io1;
// }));
// }
@Override
public Integer assignmentAnswerListNum(Long assignmentId, Integer state, String name, List<Long> accountIdList,Integer pageNo, Integer pageSize) {
// TODO Auto-generated method stub
Integer start =(pageNo-1)*pageSize;
Integer end=pageNo*pageSize;
return assignmentAnswerMapper.listNum(assignmentId, state, name, accountIdList, start, end);
}
@Override
public AssignmentAnswer selectAssignmentAnswerById(Long id) {
return this.selectById(id);
}
@Override
public Boolean insertTeacherToStudent(AssignmentAnswer assignmentAnswer) {
// TODO Auto-generated method stub
return this.updateById(assignmentAnswer);
}
@Override
public List<AssignmentAnswerExport> listExport(List<Long> answerIds) {
// TODO Auto-generated method stub
return assignmentAnswerMapper.listExport(answerIds);
}
//下一份答案id
@Override
public Long nextAnswerId(Date createTime,Long assignmentId) {
// TODO Auto-generated method stub
return assignmentAnswerMapper.getNextAssignmentAnswerId(createTime,assignmentId);
}
//上一份答案id
@Override
public Long prevAnswerId(Date createTime,Long assignmentId) {
// TODO Auto-generated method stub
return assignmentAnswerMapper.getPrevAssignmentAnswerId(createTime,assignmentId);
}
@Override
public List<AssignmentAnswer> getAssignmentAnswer(Long assignmentId, Long accountId) {
// TODO Auto-generated method stub
AssignmentAnswer assignmentAnswer=new AssignmentAnswer();
assignmentAnswer.setAssignmentId(assignmentId);
assignmentAnswer.setAccountId(accountId);
EntityWrapper<AssignmentAnswer> wrapper=new EntityWrapper<AssignmentAnswer>(assignmentAnswer);
wrapper.orderBy("create_time", false);
return this.selectList(wrapper);
}
@Override
public AssignmentAnswer isHaveAnswerByAccountIdAndAssignmentId(Long accountId, Long assignmentId) {
// TODO Auto-generated method stub
AssignmentAnswer assignmentAnswer=new AssignmentAnswer();
assignmentAnswer.setAccountId(accountId);
assignmentAnswer.setAssignmentId(assignmentId);
EntityWrapper<AssignmentAnswer> wrapper=new EntityWrapper<AssignmentAnswer>(assignmentAnswer);
return this.selectOne(wrapper);
}
/* @Override
public ApiSuggestionVo getMyAnswerDetailsByAssignmentId(Long assignmentId,Long accountId) {
// TODO Auto-generated method stub
//1 得到的基本信息,不包括文件信息
ApiSuggestionVo apiSuggestionVo=assignmentAnswerMapper.getMyAnswerDetailsByAssignmentId(assignmentId,accountId);
if(apiSuggestionVo!=null) {
//2得到老师布置得文件信息
List<AssignmentFile> assignmentFileList=assignmentFileService.listAssignmentFile(assignmentId);
if(!CollectionUtils.isEmpty(assignmentFileList)) {
apiSuggestionVo.setAssignmentFileList(assignmentFileList);
}
Long answerId=apiSuggestionVo.getId(); //sql语句得到的id是答案的id 不是作业的id 和别的vo不一样
//3得到学生提交的答案文件信息
List<AssignmentAnswerFile> answerFileList=assignmentAnswerFileService.listGetAssignmentAnswerFile(answerId, 1);
if(!CollectionUtils.isEmpty(answerFileList)) {
apiSuggestionVo.setAnswerFileList(answerFileList);
}
//4得到老师的反馈文件
List<AssignmentAnswerFile> backFileList=assignmentAnswerFileService.listGetAssignmentAnswerFile(answerId, 2);
if(!CollectionUtils.isEmpty(backFileList))
apiSuggestionVo.setBackFileList(backFileList);
}
return apiSuggestionVo;
}*/
@Override
public AssignmentAnswerListExport exportResultExcel(Long assignmentId, List<Long> answerIds) {
// TODO Auto-generated method stub
//先查出来作业是等级制还是分数制
Assignment assignment=new Assignment();
assignment.setId(assignmentId);
assignment=assignmentMapper.selectOne(assignment);
AssignmentAnswerListExport assignmentAnswerListExport=new AssignmentAnswerListExport();
assignmentAnswerListExport.setName(assignment.getName());
assignmentAnswerListExport.setType(assignment.getType());
if(!CollectionUtils.isEmpty(answerIds)) {
List<AssignmentAnswerExport> listAssignmentAnswerExport=assignmentAnswerMapper.listAssignmentAnswerExport(answerIds);
if(listAssignmentAnswerExport!=null&&listAssignmentAnswerExport.size()>0) {
AssignmentGrade assignmentGrade=null;
for (int i = 0; i < listAssignmentAnswerExport.size(); i++) {
Integer score=listAssignmentAnswerExport.get(i).getScore();
if(score!=null) {
assignmentGrade=assignmentGradeMapper.getGradeByAssignmentIdAndScore(assignmentId, score);
if(assignmentGrade!=null) {
listAssignmentAnswerExport.get(i).setGrade(assignmentGrade.getDescription());
}
}
}
}
assignmentAnswerListExport.setList(listAssignmentAnswerExport);
}
return assignmentAnswerListExport;
}
@Override
public List<AnswersDownVO> getAnswerIdsDown(Long assignmentId, List<Long> answerIds) {
// TODO Auto-generated method stub
Assignment assignment=new Assignment();
assignment=assignmentService.selectById(assignmentId);
String assignmentName=assignment.getName(); //作业名字
List<AnswersDownVO> listAnswersDownVO=new ArrayList<AnswersDownVO>();
for (int i = 0; i < answerIds.size(); i++) {
//用户名
AssignmentAnswer assignmentAnswer=this.selectById(answerIds.get(i));
AnswersDownVO answersDownVO=new AnswersDownVO();
answersDownVO.setAccountName(assignmentAnswer.getAccountName());
answersDownVO.setSource(assignmentAnswer.getSource());
answersDownVO.setAssignmentName(assignmentName);
answersDownVO.setCommitTime(assignmentAnswer.getCreateTime());
//提交的文件
List<AssignmentAnswerFile> list=null;
if(assignmentAnswer.getSource()==1) { //只下载本地上传的
list=assignmentAnswerFileService.listGetAssignmentAnswerFile(answerIds.get(i),1);//1代表本地上传的文件
List<com.yizhi.assignment.application.vo.entity.AssignmentAnswerFile> assignmentAnswerFileVOList
= exchangeAssignmentAnswerFile(list);
answersDownVO.setList(assignmentAnswerFileVOList);
}
listAnswersDownVO.add(answersDownVO);
}
return listAnswersDownVO;
}
private List<com.yizhi.assignment.application.vo.entity.AssignmentAnswerFile> exchangeAssignmentAnswerFile(List<AssignmentAnswerFile> listAssignmentAnswerFile) {
List<com.yizhi.assignment.application.vo.entity.AssignmentAnswerFile> assignmentAnswerFileVoList = new ArrayList<>();
listAssignmentAnswerFile.forEach(assignmentAnswerFile -> {
com.yizhi.assignment.application.vo.entity.AssignmentAnswerFile assignmentAnswerFileVO = new com.yizhi.assignment.application.vo.entity.AssignmentAnswerFile();
BeanUtils.copyProperties(assignmentAnswerFile,assignmentAnswerFileVO);
assignmentAnswerFileVoList.add(assignmentAnswerFileVO);
});
return assignmentAnswerFileVoList;
}
@Override
public AssignmentAnswer getAssignmentAnswerByAccountAssignmentIdAndAccountId(Long assignmentId, Long accountId) {
// TODO Auto-generated method stub
AssignmentAnswer assignmentAnswer=new AssignmentAnswer();
assignmentAnswer.setAccountId(accountId);
assignmentAnswer.setAssignmentId(assignmentId);
EntityWrapper<AssignmentAnswer> wrapper=new EntityWrapper<AssignmentAnswer>(assignmentAnswer);
return this.selectOne(wrapper);
}
/**
*
*/
@Override
public ApiAssignmentAnswerResultVo getAnswerList(Long assignmentId, Long accountId) {
Date curDate=new Date();
//出参VO
ApiAssignmentAnswerResultVo aaarv=new ApiAssignmentAnswerResultVo();
//作业文件
List<ApiFileVo> fileList=assignmentFileMapper.listApiFileVo(assignmentId);
//作业信息
Assignment assignment=assignmentMapper.selectById(assignmentId);
//学员提交列表
List<ApiAssignmentAnswerVo> answerResultList=null;
if(assignment!=null) {
answerResultList=assignmentAnswerMapper.listApiAssignmentAnswerVo(assignmentId, accountId,assignment.getPassScore());
LOG.info("返回的学员提交作业列表:{}", JSON.toJSON(answerResultList));
if(answerResultList!=null&&answerResultList.size()>0) {
ApiAssignmentAnswerVo aaav=null;
for (int i = 0; i < answerResultList.size(); i++) {
aaav=answerResultList.get(i);
aaav.setType(assignment.getType());
if(aaav.getScore()!=null) {
AssignmentGrade assignmentGrade=assignmentGradeMapper.getGradeByAssignmentIdAndScore(assignmentId, aaav.getScore());
if(assignmentGrade!=null) {
aaav.setGrade(assignmentGrade.getDescription());
}
}
}
}
}
AssignmentContent assignmentContent=assignmentContentService.findByAssignmentId(assignmentId);
aaarv.setId(assignmentId);
if(assignment!=null) {
aaarv.setAssignmentName(assignment.getName());
aaarv.setProjectName(assignment.getTrainingProjectName());
aaarv.setFinishTime(assignment.getFinishTime());
aaarv.setCount(assignment.getCount());
aaarv.setPassScore(assignment.getPassScore());
aaarv.setAmendable(assignment.getAmendable());
aaarv.setIsOverDue(assignment.getFinishTime().compareTo(curDate)<0?0:1);
}
if(assignmentContent!=null) {
aaarv.setAssignmentContent(assignmentContent.getComment());
}
aaarv.setFileList(fileList);
aaarv.setAnswerResultList(answerResultList);
aaarv.setSubmitCount(answerResultList!=null?answerResultList.size():0);
AssignmentAnswer assignmentAnswer=assignmentAnswerMapper.maxGradeByAccountIdAndAssignmentId(accountId, assignmentId);
LOG.info("获取最大的分数assignmentAnswer:{}",JSON.toJSON(assignmentAnswer));
Integer grade=null;
if(assignmentAnswer!=null) {
grade=assignmentAnswer.getScore();
}
if(assignment!=null) {
if(grade!=null) {
if(grade.compareTo(assignment.getPassScore())>=0) {
aaarv.setIsPass(1);
}
else{
aaarv.setIsPass(2);
}
}
}
if(answerResultList!=null&&answerResultList.size()>0) {
boolean notRead=false;
for (int i = 0; i < answerResultList.size(); i++) {
if(answerResultList.get(i).getStatus()==2) { //已阅
notRead=false;
continue;
}
if(answerResultList.get(i).getStatus()==1&&answerResultList.get(i).getIsDown() == 0 ) {
notRead=true;
break;
}
}
if(notRead) {
aaarv.setIsScoreOrResult(2);
aaarv.setTag("评阅中");
}
if(!notRead) {
Long answerId=null;
Integer maxGrade=null;
AssignmentAnswerSuggestion assignmentAnswerSuggestion=null;
if(assignmentAnswer!=null) {
maxGrade=assignmentAnswer.getScore();
answerId=assignmentAnswer.getId();
}
LOG.info("参数:{}",answerId);
if (answerId != null) {
assignmentAnswerSuggestion = assignmentAnswerSuggestionService.selectSuggestionByAnswerId(answerId);
if (assignmentAnswerSuggestion != null) {
aaarv.setSuggestion(assignmentAnswerSuggestion.getSuggestion());
}
AssignmentAnswer assignmentAnswer2=assignmentAnswer.selectById(answerId);
aaarv.setCommitTime(assignmentAnswer2.getAuditorTime());
}
if(assignment!=null) {
if(assignment.getType()==1) {
aaarv.setIsScoreOrResult(1);
aaarv.setTag(maxGrade!=null?maxGrade.toString():"");
}
if(assignment.getType()==2) {
aaarv.setIsScoreOrResult(3);
if(maxGrade!=null) {
AssignmentGrade assignmentGrade=assignmentGradeMapper.getGradeByAssignmentIdAndScore(assignmentId, maxGrade);
if(assignmentGrade!=null) {
aaarv.setTag(assignmentGrade.getDescription());
}
}
}
}
}
}
if(answerResultList==null&&assignment!=null&&assignment.getFinishTime().compareTo(curDate)<0) {
aaarv.setIsScoreOrResult(2);
aaarv.setTag("已逾期");
}
return aaarv;
}
@Override
public ApiAssignmentDetailsVo toAssignment(Long assignmentId, Long answerId, Long accountId) {
// TODO Auto-generated method stub
//出参VO
ApiAssignmentDetailsVo aadv=new ApiAssignmentDetailsVo();
Assignment assignment=assignmentMapper.selectById(assignmentId);
AssignmentContent assignmentContent=assignmentContentService.findByAssignmentId(assignmentId);
AssignmentAnswer assignmentAnswer=assignmentAnswerService.selectById(answerId);
List<AssignmentAnswer> listAssignmentAnswer=listAssignmentAnswerByAssignmentIdAndAccountId(assignmentId, accountId);
List<ApiFileVo> fileList=assignmentFileMapper.listApiFileVo(assignmentId);
List<ApiFileVo> answerFileList=assignmentAnswerFileMapper.listAssignmentAnswerFile(answerId, 1);
answerFileList.forEach(file -> {
if (file.isVideo() && StringUtils.isEmpty(file.getVideoSd())) {
file.setState("处理中");
}
try {
List<PdfPagesVo> pdfPageVoList = pdfPagesClient.list(file.getId(), TpActivityType.TYPE_ASSIGNMENT);
List<PdfPages> list = new ArrayList<>();
pdfPageVoList.forEach(pdfPageVo -> {
PdfPages pages = new PdfPages();
BeanUtils.copyProperties(pdfPageVo,pages);
list.add(pages);
});
//List<PdfPages> list = pdfPagesClient.list(file.getId(), TpActivityType.TYPE_ASSIGNMENT);
if (CollectionUtils.isNotEmpty(list)) {
file.setPdfPages(list);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
});
List<ApiFileVo> backFileList=assignmentAnswerFileMapper.listAssignmentAnswerFile(answerId, 2);
AssignmentAnswerSuggestion assignmentAnswerSuggestion=assignmentAnswerSuggestionService.selectSuggestionByAnswerId(answerId);
if(assignment!=null) {
aadv.setId(assignment.getId());
aadv.setAssignmentName(assignment.getName());
aadv.setStartTime(assignment.getCreateTime());
aadv.setFinishTime(assignment.getFinishTime());
aadv.setProjectName(assignment.getTrainingProjectName());
aadv.setPassScore(assignment.getPassScore());
aadv.setCount(assignment.getCount());
aadv.setIsScoreAndGrade(assignment.getType());
aadv.setAnswerAttachmentNumMax(assignment.getAnswerAttachmentNumMax());
aadv.setAnswerAttachmentNumMin(assignment.getAnswerAttachmentNumMin());
aadv.setAnswerCharaterNumMax(assignment.getAnswerCharaterNumMax());
aadv.setAnswerCharaterNumMin(assignment.getAnswerCharaterNumMin());
aadv.setShowRes(assignment.getShowRes());
aadv.setEnableExerciseBook(assignment.getEnableExerciseBook());
aadv.setCommitAccountNum(assignmentAnswerMapper.countCommitAccountNum(assignment.getId()));
}
if(assignmentContent!=null) {
aadv.setAssignmentContent(assignmentContent.getComment());
}
if(assignmentAnswer!=null) {
aadv.setStatus(assignmentAnswer.getStatus());
aadv.setReadTime(assignmentAnswer.getAuditorTime());
aadv.setScore(assignmentAnswer.getScore());
AssignmentGrade assignmentGrade=assignmentGradeMapper.getGradeByAssignmentIdAndScore(assignmentId, assignmentAnswer.getScore());
if(assignmentGrade!=null) {
aadv.setGrade(assignmentGrade.getDescription());
}
aadv.setAnswerContent(assignmentAnswer.getContent());
aadv.setIsDown(assignmentAnswer.getIsDown());
}
if(assignmentAnswerSuggestion!=null) {
aadv.setSuggestion(assignmentAnswerSuggestion.getSuggestion());
}
aadv.setSubmitCount(listAssignmentAnswer!=null?listAssignmentAnswer.size():0);
aadv.setFileList(fileList);
aadv.setAnswerFileList(answerFileList);
aadv.setBackFileList(backFileList);
return aadv;
}
@Override
public List<AssignmentAnswer> listAssignmentAnswerByAssignmentIdAndAccountId(Long assignmentId, Long accountId) {
// TODO Auto-generated method stub
AssignmentAnswer assignmentAnswer=new AssignmentAnswer();
assignmentAnswer.setAccountId(accountId);
assignmentAnswer.setAssignmentId(assignmentId);
assignmentAnswer.setDeleted(0);
EntityWrapper<AssignmentAnswer> wrapper=new EntityWrapper<AssignmentAnswer>(assignmentAnswer);
return this.selectList(wrapper);
}
@Override
public Integer getAssignmentAnswerCount(Long assignmentId, Long accountId) {
AssignmentAnswer assignmentAnswer = new AssignmentAnswer();
assignmentAnswer.setAccountId(accountId);
assignmentAnswer.setAssignmentId(assignmentId);
assignmentAnswer.setDeleted(0);
return this.selectCount(QueryUtil.condition(assignmentAnswer));
}
@Override
public List<Long> getListIdsBySiteIdAndAssignmentIdsAndAccountId(Long siteId, Long accountId, List<Long> ids) {
// TODO Auto-generated method stub
return assignmentAnswerMapper.getListIdsBySiteIdAndAssignmentIdsAndAccountId(siteId, accountId, ids);
}
@Override
public Integer canSubmitAssignmentAnswer(ApiAssignmentAswerVO vo) {
// TODO Auto-generated method stub
Integer isCanSubmit=0;//
if(vo!=null&&vo.getAssignmentId()!=null) {
Assignment assignment=assignmentMapper.selectById(vo.getAssignmentId());
if(assignment!=null) {
Long accountId=vo.getAccountId();
Long assignmentId=vo.getAssignmentId();
Integer submitCountNum=getAssignmentAnswerCount(assignmentId, accountId);
if(submitCountNum==null) {
submitCountNum=0;
}
//没有逾期 没有提交次数
if(assignment.getFinishTime()!=null
&&assignment.getFinishTime().compareTo(new Date())>-1
&&submitCountNum>=assignment.getCount()) {
return 1;
}
//逾期 允许补交 没有提交次数
if(assignment.getFinishTime()!=null
&&assignment.getFinishTime().compareTo(new Date())==-1
&&assignment.getAmendable()==1
&&submitCountNum>=assignment.getCount()) {
return 1;
}
if(assignment.getFinishTime()!=null
&&assignment.getFinishTime().compareTo(new Date())==-1
&&assignment.getAmendable()==0) {
return 2;
}
}
}
return isCanSubmit;
}
@Override
public String getStudentAnswerZipByAnswerId(Long assignmentId,Long answerId) {
// TODO Auto-generated method stub
//先去查看有没有zip包
String answerZipUrl=assignmentAnswerMapper.getStudentAnswerZipByAnswerId(answerId);
if(StringUtils.isNotEmpty(answerZipUrl)) {
return answerZipUrl;
}
else {
List<ApiFileVo> listFile=assignmentAnswerFileMapper.listAssignmentAnswerFile(answerId, 1);
if(!CollectionUtils.isEmpty(listFile)) {
Assignment assignment=assignmentMapper.selectById(assignmentId);
String assignmentName="";
if(assignment!=null) {
assignmentName=assignment.getName();
}
//开始进行压缩插入
return createAnswerFileByAccountId(assignmentName,listFile,answerId);
}
else {
return null;
}
}
}
String createAnswerFileByAccountId(String assignmentName,List<ApiFileVo> list,Long answerId) {
String serverUrlName=FileConstant.SAVE_PATH; //服务器的路径
//String serverUrlName="F://home//file";
File serverPathDir=new File(serverUrlName);
if(!serverPathDir.exists()) {
serverPathDir.mkdir();
}
String idString=idGenerator.generate().toString();
//文件夹名字 jml作业_11002343241200
String parentDicName=assignmentName+"_"+idString;
//文件夹所在完整路径名字,只是名字 /home/file/jml作业_11002343241200
String parentDicPath=serverUrlName+File.separator+parentDicName;
//文件夹 /home/file/11002343241200
//文件夹创建出来
File fileParentDicPath=new File(parentDicPath);
fileParentDicPath.mkdir();
for (ApiFileVo apiFileVo : list) {
String fileUrl=apiFileVo.getOssUrl();
String fileName=apiFileVo.getFileName();
fileReadUtil.read(fileUrl, parentDicPath, fileName);
}
// /home/file/jml作业_11002343241200.zip
String zipPath=parentDicPath+".zip";
try {
//将 F://home//file\jml的新作业_1150611432396677120
//打包成 F://home//file\jml的新作业_1150611432396677120.zip
ZipUtil.zip(parentDicPath,zipPath);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String upload=null;
try {
SimpleDateFormat sdf=new SimpleDateFormat("yyyyMMddHHmmss");
String accountName=ContextHolder.get().getAccountName();
String zipName=assignmentName+"_"+accountName+"作业附件"+".zip";
upload=OssUpload.upload(zipPath, zipName);
AssignmentAnswer aa=new AssignmentAnswer();
aa.setId(answerId);
aa.setAnswerFileZip(upload);
assignmentAnswerMapper.updateById(aa);
} catch (Exception e) {
// TODO: handle exception
}
File pathZipFile=new File(parentDicPath);
File zipFile=new File(zipPath);
try {
FileUtils.deleteDirectory(pathZipFile);
FileUtils.deleteQuietly(zipFile);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return upload;
}
@Override
public List<Long> getFinishedAccountIds(Long assignmentId, Long siteId, Long companyId) {
// TODO Auto-generated method stub
return assignmentAnswerMapper.getFinishedAccountIds(assignmentId, siteId, companyId);
}
@Override
public Integer getScore(Long assignmentId, Long siteId, Long companyId, Long accountId) {
// TODO Auto-generated method stub
return assignmentAnswerMapper.getScore(assignmentId, siteId, companyId, accountId);
}
}
package com.yizhi.application.service.impl;
import com.yizhi.application.entity.AssignmentAnswerSuggestion;
import com.yizhi.application.mapper.AssignmentAnswerSuggestionMapper;
import com.yizhi.application.service.AssignmentAnswerSuggestionService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
/**
* <p>
* 老师对学员做的作业的回复内容 服务实现类
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
@Service
public class AssignmentAnswerSuggestionServiceImpl extends ServiceImpl<AssignmentAnswerSuggestionMapper, AssignmentAnswerSuggestion> implements AssignmentAnswerSuggestionService {
@Override
public AssignmentAnswerSuggestion selectSuggestionByAnswerId(Long answerId) {
AssignmentAnswerSuggestion assignmentAnswerSuggestion=new AssignmentAnswerSuggestion();
assignmentAnswerSuggestion.setAnswerId(answerId);
EntityWrapper<AssignmentAnswerSuggestion> entityWrapper=new EntityWrapper<AssignmentAnswerSuggestion>(assignmentAnswerSuggestion);
return this.selectOne(entityWrapper);
}
@Override
public Boolean delectSuggestion(Long answerId) {
// TODO Auto-generated method stub
AssignmentAnswerSuggestion assignmentAnswerSuggestion=new AssignmentAnswerSuggestion();
assignmentAnswerSuggestion.setAnswerId(answerId);
EntityWrapper<AssignmentAnswerSuggestion> entityWrapper=new EntityWrapper<AssignmentAnswerSuggestion>(assignmentAnswerSuggestion);
return this.delete(entityWrapper);
}
}
package com.yizhi.application.service.impl;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.yizhi.application.entity.AssignmentAnswerThumb;
import com.yizhi.application.mapper.AssignmentAnswerThumbMapper;
import com.yizhi.application.service.AssignmentAnswerThumbService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* @ClassName AssignmentAnswerThumbServiceImpl
* @Description TODO
* @Author shengchenglong
* @DATE 2019-10-22 14:41
* @Version 1.0
*/
@Service
@Transactional
public class AssignmentAnswerThumbServiceImpl extends ServiceImpl<AssignmentAnswerThumbMapper, AssignmentAnswerThumb> implements AssignmentAnswerThumbService {
}
package com.yizhi.application.service.impl;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.yizhi.application.entity.AssignmentAnswerTipoff;
import com.yizhi.application.mapper.AssignmentAnswerTipoffMapper;
import com.yizhi.application.service.IAssignmentAnswerTipoffService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* <p>
* 服务实现类
* </p>
*
* @author shengchenglong123
* @since 2019-10-22
*/
@Service
@Transactional
public class AssignmentAnswerTipoffServiceImpl extends ServiceImpl<AssignmentAnswerTipoffMapper, AssignmentAnswerTipoff> implements IAssignmentAnswerTipoffService {
}
package com.yizhi.application.service.impl;
import com.yizhi.application.entity.AssignmentAuditor;
import com.yizhi.application.mapper.AssignmentAuditorMapper;
import com.yizhi.application.orm.id.IdGenerator;
import com.yizhi.application.service.AssignmentAuditorService;
import com.yizhi.assignment.application.vo.ListAuditor;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* <p>
* 作业和评阅人的对应关系 服务实现类
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
@Transactional
@Service
public class AssignmentAuditorServiceImpl extends ServiceImpl<AssignmentAuditorMapper, AssignmentAuditor> implements AssignmentAuditorService {
@Autowired
private IdGenerator id;
@Override
public List<Long> relationAuditor(Long assignmentId) {
// TODO Auto-generated method stub
AssignmentAuditor assignmentAuditor=new AssignmentAuditor();
assignmentAuditor.setAssignmentId(assignmentId);
EntityWrapper<AssignmentAuditor> wrapper=new EntityWrapper<AssignmentAuditor>(assignmentAuditor);
List<AssignmentAuditor> list=this.selectList(wrapper);
List<Long> listLong=new ArrayList<Long>();
if(list!=null&&list.size()>0) {
for (int i = 0; i < list.size(); i++) {
listLong.add(list.get(i).getAccountId());
}
}
return listLong;
}
@Override
public Boolean auditorInsert(ListAuditor listAuditor) {
// TODO Auto-generated method stub
//先删除再添加新的
AssignmentAuditor assignmentAuditorDelete=new AssignmentAuditor();
assignmentAuditorDelete.setAssignmentId(listAuditor.getAssignmentId());
EntityWrapper<AssignmentAuditor> wrapper=new EntityWrapper<AssignmentAuditor>(assignmentAuditorDelete);
this.delete(wrapper);
List<com.yizhi.assignment.application.vo.entity.AssignmentAuditor> listAuditorVOList = listAuditor.getListAuditor();
List<AssignmentAuditor> list = new ArrayList<>();
listAuditorVOList.forEach(assignmentAuditorVO -> {
AssignmentAuditor assignmentAuditor = new AssignmentAuditor();
BeanUtils.copyProperties(assignmentAuditorVO,assignmentAuditor);
list.add(assignmentAuditor);
});
//List<AssignmentAuditor> list=listAuditor.getListAuditor();
if(list!=null) {
AssignmentAuditor assignmentAuditor=null;
for (int i = 0; i < list.size(); i++) {
assignmentAuditor=new AssignmentAuditor();
assignmentAuditor.setId(id.generate());
assignmentAuditor.setAccountId(list.get(i).getAccountId());
assignmentAuditor.setAssignmentId(listAuditor.getAssignmentId());
assignmentAuditor.setCreateById(listAuditor.getContextHolder().getAccountId());
assignmentAuditor.setCreateByName(listAuditor.getContextHolder().getAccountName());
assignmentAuditor.setCreateTime(new Date());
this.insert(assignmentAuditor);
}
}
return true;
}
}
package com.yizhi.application.service.impl;
import com.yizhi.application.entity.AssignmentContent;
import com.yizhi.application.mapper.AssignmentContentMapper;
import com.yizhi.application.service.AssignmentContentService;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* <p>
* 老师布置的作业的内容 服务实现类
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
@Service
public class AssignmentContentServiceImpl extends ServiceImpl<AssignmentContentMapper, AssignmentContent> implements AssignmentContentService {
@Autowired
private AssignmentContentMapper contentMapper;
public AssignmentContent findById(Long id) {
// TODO Auto-generated method stub
AssignmentContent content=contentMapper.selectById(id);
return content;
}
@Override
public AssignmentContent findByAssignmentId(Long assignmentId) {
// TODO Auto-generated method stub
AssignmentContent assignmentContent=new AssignmentContent();
assignmentContent.setAssignmentId(assignmentId);
EntityWrapper<AssignmentContent> wrapper=new EntityWrapper<AssignmentContent>(assignmentContent);
return this.selectOne(wrapper);
}
}
package com.yizhi.application.service.impl;
import com.yizhi.application.entity.AssignmentFile;
import com.yizhi.application.mapper.AssignmentFileMapper;
import com.yizhi.application.service.AssignmentFileService;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import java.util.List;
import org.springframework.stereotype.Service;
/**
* <p>
* 老师布置的作业对应多个文件,存放多个文件地址 服务实现类
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
@Service
public class AssignmentFileServiceImpl extends ServiceImpl<AssignmentFileMapper, AssignmentFile> implements AssignmentFileService {
@Override
public Boolean deleteFileByAssignmentId(Long assignmentId) {
// TODO Auto-generated method stub
AssignmentFile assignmentFile=new AssignmentFile();
assignmentFile.setAssignmentId(assignmentId);
EntityWrapper<AssignmentFile> wrapper=new EntityWrapper<AssignmentFile>(assignmentFile);
return this.delete(wrapper);
}
@Override
public List<AssignmentFile> listAssignmentFile(Long assignmentId) {
// TODO Auto-generated method stub
AssignmentFile assignmentFile=new AssignmentFile();
assignmentFile.setAssignmentId(assignmentId);
EntityWrapper<AssignmentFile> wrapper=new EntityWrapper<AssignmentFile>(assignmentFile);
return this.selectList(wrapper);
}
}
package com.yizhi.application.service.impl;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.yizhi.application.entity.AssignmentGrade;
import com.yizhi.application.mapper.AssignmentGradeMapper;
import com.yizhi.application.service.AssignmentGradeService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 老师布置的作业等级
编号100号作业 可以有多个等级 服务实现类
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
@Service
public class AssignmentGradeServiceImpl extends ServiceImpl<AssignmentGradeMapper, AssignmentGrade> implements AssignmentGradeService {
@Override
public List<AssignmentGrade> getListAssignmentGrade(Long assignmentId) {
//AssignmentGrade设置条件,作为参数传入。
AssignmentGrade assignmentGrade=new AssignmentGrade();
assignmentGrade.setAssignmentId(assignmentId);
EntityWrapper<AssignmentGrade> entityWrapper=new EntityWrapper<AssignmentGrade>(assignmentGrade);
return this.selectList(entityWrapper);
}
@Override
public AssignmentGrade getGrade(Long id) {
// TODO Auto-generated method stub
return this.selectById(id);
}
@Override
public Boolean deleteAssignmentGradeByAssignmentId(Long assignmentId) {
// TODO Auto-generated method stub
AssignmentGrade assignmentGrade=new AssignmentGrade();
assignmentGrade.setAssignmentId(assignmentId);
EntityWrapper<AssignmentGrade> entityWrapper=new EntityWrapper<AssignmentGrade>(assignmentGrade);
return this.delete(entityWrapper);
}
}
package com.yizhi.application.service.impl;
import java.util.List;
import com.yizhi.application.entity.AssignmentPoint;
import com.yizhi.application.mapper.AssignmentPointMapper;
import com.yizhi.application.service.AssignmentPointService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
/**
* <p>
* 服务实现类
* </p>
*
* @author yizhi123
* @since 2018-09-04
*/
@Service
public class AssignmentPointServiceImpl extends ServiceImpl<AssignmentPointMapper, AssignmentPoint> implements AssignmentPointService {
@Autowired
private AssignmentPointMapper assignmentPointMapper;
@Override
public Boolean deleteAssignmentPointByAssignmentId(Long assignmentId) {
// TODO Auto-generated method stub
AssignmentPoint assignmentPoint=new AssignmentPoint();
assignmentPoint.setAssignmentId(assignmentId);
EntityWrapper<AssignmentPoint> wrapper=new EntityWrapper<AssignmentPoint>(assignmentPoint);
return this.delete(wrapper);
}
@Override
public List<AssignmentPoint> getListAssignmentPoint(Long assignmentId) {
// TODO Auto-generated method stub
AssignmentPoint assignmentPoint=new AssignmentPoint();
assignmentPoint.setAssignmentId(assignmentId);
EntityWrapper<AssignmentPoint> wrapper=new EntityWrapper<AssignmentPoint>(assignmentPoint);
return this.selectList(wrapper);
}
@Override
public AssignmentPoint getTrainingPoint(List<Long> ids) {
// TODO Auto-generated method stub
return assignmentPointMapper.getTrainingPoint(ids);
}
}
package com.yizhi.application.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.yizhi.application.entity.*;
import com.yizhi.application.eum.AnswerFileTypeEnum;
import com.yizhi.application.mapper.*;
import com.yizhi.application.orm.hierarchicalauthorization.HQueryUtil;
import com.yizhi.application.orm.id.IdGenerator;
import com.yizhi.application.orm.util.QueryUtil;
import com.yizhi.application.service.*;
import com.yizhi.application.util.AssignmentEvenSendMessage;
import com.yizhi.assignment.application.vo.*;
import com.yizhi.assignment.application.vo.apivo.*;
import com.yizhi.assignment.application.vo.enums.AssignmentConstant;
import com.yizhi.assignment.application.vo.enums.AssignmentHandleConstant;
import com.yizhi.assignment.application.vo.enums.EvenType;
import com.yizhi.core.application.context.ContextHolder;
import com.yizhi.core.application.context.RequestContext;
import com.yizhi.core.application.enums.TaskParamsEnums;
import com.yizhi.core.application.event.EventWrapper;
import com.yizhi.core.application.publish.CloudEventPublisher;
import com.yizhi.core.application.task.AbstractTaskHandler;
import com.yizhi.core.application.task.TaskExecutor;
import com.yizhi.core.application.vo.DroolsVo;
import com.yizhi.system.application.system.remote.AuthClient;
import com.yizhi.util.application.clazz.ClassUtil;
import com.yizhi.util.application.constant.QueueConstant;
import com.yizhi.util.application.constant.TpActivityType;
import com.yizhi.util.application.enums.i18n.ButtonStatus;
import com.yizhi.util.application.event.TrainingProjectEvent;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* <p>
* 老师布置作业的主表 服务实现类
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
@Service
@Transactional
public class AssignmentServiceImpl extends ServiceImpl<AssignmentMapper, Assignment> implements AssignmentService {
private static final Logger LOG = LoggerFactory.getLogger(AssignmentServiceImpl.class);
@Autowired
private AssignmentMapper assignmentMapper;
@Autowired
private AssignmentFileMapper assignmentFileMapper;
@Autowired
private AssignmentGradeService assignmentGradeService;
@Autowired
private AssignmentContentMapper assignmentContentMapper;
@Autowired
private AssignmentAnswerMapper assignmentAnswerMapper;
@Autowired
private AssignmentAnswerService assignmentAnswerService;
@Autowired
private AssignmentFileService assignmentFileService;
@Autowired
private AssignmentAnswerSuggestionService assignmentAnswerSuggestionService;
@Autowired
private AssignmentAnswerFileService assignmentAnswerFileService;
@Autowired
private AssignmentStudentService assignmentStudentService;
@Autowired
private AssignmentPointService assignmentPointService;
@Autowired
private AssignmentStudentMapper assignmentStudentMapper;
@Autowired
private TaskExecutor taskExecutor;
@Autowired
private CloudEventPublisher cloudEventPublisher;
@Autowired
private AssignmentAuditorService assignmentAuditorService;
@Autowired
private AssignmentContentService assignmentContentService;
@Autowired
private IdGenerator id; // 主键生成器
@Autowired
private AssignmentPointMapper assignmentPointMapper;
@Autowired
private AssignmentGradeMapper assignmentGradeMapper;
@Autowired
private AssignmentEvenSendMessage assignmentEvenSendMessage;
@Transactional
public Boolean save(@RequestBody AssignmentSaveParamVo assignmentVo) {
// TODO Auto-generated method stub
if (assignmentVo.getFinishTime() == null) {
assignmentVo.setFinishTime("2038-01-01 23:59:59");
}
SimpleDateFormat sdm = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date dateFormate = null;
try {
dateFormate = sdm.parse(assignmentVo.getFinishTime() + " 23:59:59");
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Date date = new Date();
Assignment assignment = new Assignment();
// 2019-10-16
assignment.setAnswerAttachmentNumMax(assignmentVo.getAnswerAttachmentNumMax());
assignment.setAnswerAttachmentNumMin(assignmentVo.getAnswerAttachmentNumMin());
assignment.setAnswerCharaterNumMax(assignmentVo.getAnswerCharaterNumMax());
assignment.setAnswerCharaterNumMin(assignmentVo.getAnswerCharaterNumMin());
assignment.setEnableExerciseBook(assignmentVo.getEnableExerciseBook());
assignment.setShowRes(assignmentVo.getShowRes());
assignment.setKeywords(assignmentVo.getKeywords());
assignment.setImage(assignmentVo.getImage());
assignment.setId(assignmentVo.getId()); // 主键
assignment.setSerialNum(id.generate()); // 作业序号
assignment.setName(assignmentVo.getName()); // 项目名字
assignment.setAmendable(assignmentVo.getAmendable()); // 是否支持补交 0代表不支持
assignment.setVisibleRange(assignmentVo.getVisibleRange()); // 支持的可见范围 可见范围(1:平台用户可见,2:指定学员可见),默认平台用户可见
assignment.setType(assignmentVo.getType());
assignment.setFinishTime(dateFormate);
assignment.setStatus(1); // 新建作业默认状态是草稿状态
assignment.setCount(assignmentVo.getCount());
assignment.setEnableRemind(assignmentVo.getEnableRemind());
assignment.setPassScore(assignmentVo.getPassScore());
assignment.setCompanyId(assignmentVo.getCompanyId());
assignment.setSiteId(assignmentVo.getSiteId());
assignment.setOrgId(assignmentVo.getOrgId());
assignment.setEnableTask(assignmentVo.getEnableTask());
if (null != assignmentVo.getEnableTask() && assignmentVo.getEnableTask() == 1) {
assignment.setTaskStartDate(assignmentVo.getTaskStartDate());
assignment.setTaskEndDate(assignmentVo.getTaskEndDate());
}
if (assignmentVo.getStyle() == 1) {
assignment.setCreateById(assignmentVo.getAccountId());
assignment.setCreateByName(assignmentVo.getAccountName());
assignment.setCreateTime(date);
Integer insert = assignmentMapper.insert(assignment);// 作业名字保存
if (insert > 0) {
LOG.info("是否开启提醒:" + assignmentVo.getEnableRemind());
if (assignment != null && assignmentVo.getEnableRemind() == 1) {
//保存作业提醒
RequestContext context = ContextHolder.get();
try {
taskExecutor.asynExecute(new AbstractTaskHandler() {
@Override
public void handle() {
assignmentEvenSendMessage.systemSendMessage(assignment, assignmentVo.getMessageRemindVo(), context);
}
});
} catch (Exception e) {
e.printStackTrace();
LOG.info("作业发消息异常");
}
}
}
}
if (assignmentVo.getStyle() == 2) {
assignment.setUpdateById(assignmentVo.getAccountId());
assignment.setUpdateByName(assignmentVo.getAccountName());
assignment.setUpdateTime(date);
Integer integer = assignmentMapper.updateById(assignment);//作业修改
if (integer > 0) {
LOG.info("是否开启提醒:" + assignmentVo.getEnableRemind());
if (assignment != null) {
//保存作业提醒
RequestContext context = ContextHolder.get();
try {
taskExecutor.asynExecute(new AbstractTaskHandler() {
@Override
public void handle() {
assignmentEvenSendMessage.systemSendMessage(assignment, assignmentVo.getMessageRemindVo(), context);
}
});
} catch (Exception e) {
e.printStackTrace();
LOG.info("作业发消息异常");
}
}
}
// 处理删除数值的情况
assignmentMapper.updateNum(assignment);
}
// 判断老师布置的作业内容是否为空
if (StringUtils.isNotEmpty(assignmentVo.getContent())) {
if (assignmentVo.getStyle() == 1) { //保存
AssignmentContent assignmentContent = new AssignmentContent();
assignmentContent.setId(id.generate());
assignmentContent.setAssignmentId(assignmentVo.getId());
assignmentContent.setComment(assignmentVo.getContent());
assignmentContent.setCreateById(assignmentVo.getAccountId());
assignmentContent.setCreateByName(assignmentVo.getAccountName());
assignmentContent.setCreateTime(date);
assignmentContentMapper.insert(assignmentContent);
}
if (assignmentVo.getStyle() == 2) { //修改
//修改的内容
AssignmentContent assignmentContent = new AssignmentContent();
assignmentContent.setComment(assignmentVo.getContent());
assignmentContent.setUpdateById(assignmentVo.getAccountId());
assignmentContent.setUpdateByName(assignmentVo.getAccountName());
assignmentContent.setUpdateTime(date);
//修改的条件
AssignmentContent assignmentContent2 = new AssignmentContent();
assignmentContent2.setAssignmentId(assignmentVo.getId());
assignmentContentMapper.update(assignmentContent, new EntityWrapper<AssignmentContent>(assignmentContent2));
}
}
if (assignmentVo.getStyle() == 2) { //修改
//先删除原来的文件,再增加新的文件
assignmentFileService.deleteFileByAssignmentId(assignmentVo.getId());
}
AssignmentFile assignmentFile = null; // 布置的作业对应的文件
if (!CollectionUtils.isEmpty(assignmentVo.getFileUrlList())) {
for (int i = 0; i < assignmentVo.getFileUrlList().size(); i++) {
assignmentFile = new AssignmentFile();
assignmentFile.setId(id.generate()); // 主键id
assignmentFile.setAssignmentId(assignmentVo.getId());
assignmentFile.setFileUrl(assignmentVo.getFileUrlList().get(i).getFileUrl());
assignmentFile.setFileName(assignmentVo.getFileUrlList().get(i).getFileName());
assignmentFile.setSuffix(assignmentVo.getFileUrlList().get(i).getSuffix());
assignmentFile.setSize(assignmentVo.getFileUrlList().get(i).getSize());
assignmentFile.setCreateById(assignmentVo.getAccountId());
assignmentFile.setCreateByName(assignmentVo.getAccountName());
assignmentFile.setCreateTime(date);
assignmentFileMapper.insert(assignmentFile);
}
}
/**
* 设置评阅人
*/
if (assignmentVo.getStyle() == 1) {
AssignmentAuditor auditor = new AssignmentAuditor();
auditor.setAssignmentId(id.generate());
auditor.setAssignmentId(assignmentVo.getId());
auditor.setAccountId(assignmentVo.getAccountId());
auditor.setCreateById(assignmentVo.getAccountId());
auditor.setCreateByName(assignmentVo.getAccountName());
auditor.setCreateTime(date);
assignmentAuditorService.insert(auditor);
}
/**
* 设置等级制度
*/
// 保存---等級 直接添加
if (assignmentVo.getStyle() == 1 && assignmentVo.getType() == 2 && assignmentVo.getListGrade().size() > 0) {
AssignmentGrade assignmentGrade = null;
for (int i = 0; i < assignmentVo.getListGrade().size(); i++) {
assignmentGrade = new AssignmentGrade();
com.yizhi.assignment.application.vo.entity.AssignmentGrade assignmentGradeVO = assignmentVo.getListGrade().get(i);
BeanUtils.copyProperties(assignmentGradeVO, assignmentGrade);
//assignmentGrade = assignmentVo.getListGrade().get(i);
assignmentGrade.setId(id.generate());
assignmentGrade.setAssignmentId(assignmentVo.getId());
assignmentGrade.setCreateById(assignmentVo.getAccountId());
assignmentGrade.setCreateByName(assignmentVo.getAccountName());
assignmentGrade.setCreateTime(date);
assignmentGradeService.insert(assignmentGrade);
}
}
// 修改为打分 不管是否有等级都删除
if (assignmentVo.getStyle() == 2 && assignmentVo.getType() == 1) {
assignmentGradeService.deleteAssignmentGradeByAssignmentId(assignmentVo.getId());
}
// 修改为等级 先删除原来的等级,再添加新的等级
if (assignmentVo.getStyle() == 2 && assignmentVo.getType() == 2) {
assignmentGradeService.deleteAssignmentGradeByAssignmentId(assignmentVo.getId());
if (CollectionUtils.isNotEmpty(assignmentVo.getListGrade())) {
AssignmentGrade assignmentGrade = null;
for (int i = 0; i < assignmentVo.getListGrade().size(); i++) {
assignmentGrade = new AssignmentGrade();
com.yizhi.assignment.application.vo.entity.AssignmentGrade assignmentGradeVO = assignmentVo.getListGrade().get(i);
BeanUtils.copyProperties(assignmentGradeVO, assignmentGrade);
//assignmentGrade = assignmentVo.getListGrade().get(i);
if (assignmentGrade.getMinScore() == null || assignmentGrade.getMaxScore() == null || assignmentGrade.getDescription() == null) {
continue;
}
assignmentGrade.setId(id.generate());
assignmentGrade.setAssignmentId(assignmentVo.getId());
assignmentGrade.setMinScore(assignmentGrade.getMinScore());
assignmentGrade.setMaxScore(assignmentGrade.getMaxScore());
assignmentGrade.setDescription(assignmentGrade.getDescription());
assignmentGrade.setCreateById(assignmentVo.getAccountId());
assignmentGrade.setCreateByName(assignmentVo.getAccountName());
assignmentGrade.setCreateTime(date);
assignmentGradeService.insert(assignmentGrade);
}
}
}
/**
* 设置积分
*/
assignmentPointService.deleteAssignmentPointByAssignmentId(assignmentVo.getId());
if (CollectionUtils.isNotEmpty(assignmentVo.getListPoint())) {
AssignmentPoint assignmentPoint = new AssignmentPoint();
for (int i = 0; i < assignmentVo.getListPoint().size(); i++) {
com.yizhi.assignment.application.vo.entity.AssignmentPoint assignmentPointVO = assignmentVo.getListPoint().get(i);
BeanUtils.copyProperties(assignmentPointVO, assignmentPoint);
//assignmentPoint = assignmentVo.getListPoint().get(i);
if (assignmentPoint.getMinScore() == null || assignmentPoint.getMaxScore() == null || assignmentPoint.getPoint() == null) {
continue;
}
assignmentPoint.setId(id.generate());
assignmentPoint.setAssignmentId(assignmentVo.getId());
assignmentPoint.setMinScore(assignmentPoint.getMinScore());
assignmentPoint.setMaxScore(assignmentPoint.getMaxScore());
assignmentPoint.setPoint(assignmentPoint.getPoint());
assignmentPoint.setCreateById(assignmentVo.getAccountId());
assignmentPoint.setCreateByName(assignmentVo.getAccountName());
assignmentPoint.setCreateTime(date);
assignmentPointService.insert(assignmentPoint);
}
}
return true;
}
/**
* 管理端显示作业列表(投票只查询上架的)---
* <p>
* source=0作业直接进来的 要草稿上架下架
* source=1 培训项目进来的 上架 training_project_id=0 training_project_name=null
* status!=null&& status=1 投票來的
*/
@Autowired
AuthClient authClient;
public Page<Assignment> assignmentList(String currentTime, AssignmentListVoTo assignmentListVoTo) {
RequestContext context = ContextHolder.get();
// List<Long> adminIds = authClient.getAdminIdsByAccountId(context.getCompanyId(), context.getSiteId(), context.getAccountId());
List<Long> adminIds = context.getManagerIds();
Date curDate = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String dateString = sdf.format(curDate); //将Date类型转换成String类型
Integer pageNo = assignmentListVoTo.getPageNo();
Integer pageSize = assignmentListVoTo.getPageSize();
String name = assignmentListVoTo.getName();
Integer source = assignmentListVoTo.getSource();//0作业直接进来的 1 培训项目进来的 2投票进来的
// List<Long> orgIds = assignmentListVoTo.getOrgIds();
// Long companyId = assignmentListVoTo.getCompanyId();
// Long siteId = assignmentListVoTo.getSiteId();
//培训项目过滤所需 胡涛写
/* String date = null;
if(StringUtils.isNotBlank(currentTime)){
SimpleDateFormat a = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Long temp = Long.valueOf(currentTime);
date = a.format(temp);
}*/
boolean isAdmin = context.isAdmin();
Integer admin = isAdmin ? 1 : 0;
Page<Assignment> page = new Page<Assignment>(pageNo, pageSize);
// HQueryUtil.startHQ(Assignment.class);
List<Assignment> list = assignmentMapper.getAssignmentListByManager(context.getAccountId(), admin, name,
dateString, context.getCompanyId(), context.getSiteId(), source, adminIds, page);
page.setRecords(list);
return page;
}
/**
* 待阅读数量
*/
public Integer noRead(Long assignmentId) {
// TODO Auto-generated method stub
AssignmentAnswer assignmentAnswer = new AssignmentAnswer();
assignmentAnswer.setAssignmentId(assignmentId);
return assignmentAnswerMapper.selectCount(new EntityWrapper<AssignmentAnswer>(assignmentAnswer));
}
/**
* 管理端删除作业
*/
public Boolean updateDelete(AssignmentDeleteVO updateDelete) {
// TODO Auto-generated method stub
Assignment assignment = new Assignment();
assignment.setId(updateDelete.getAssignmentId());
assignment.setStatus(0); //0代表被删除
assignment.setAddedTime(null);
assignment.setUpdateById(updateDelete.getAccountId());
assignment.setUpdateByName(updateDelete.getAccountName());
assignment.setUpdateTime(new Date());
return assignmentMapper.updateById(assignment) > 0;
}
/* @Override
public Page<ApiAssignmentListResultVO> listUnfinishedAssignment(int pageNo, int pageSize,Long accountId,List<Long> relationIds,Long siteId) {
//查出来哪些作业此人的答案已经达到上限的(作业在上架状态)
List<Long> listOverLimit=assignmentMapper.getIsOverVO(accountId,siteId);
//分配给此人的作业idList
Page<Long> pageLimit = new Page<Long>(pageNo, pageSize);
Date date=new Date();
SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String curDate=simpleDateFormat.format(date);
//listOverLimit 作业id不在这个范围的
List<Long> assignmentIds=assignmentStudentMapper.isOverList(relationIds, siteId, curDate, 1,listOverLimit, pageLimit);
//装数据
List<ApiAssignmentListResultVO> listApiAssignmentListResultVO=new ArrayList<ApiAssignmentListResultVO>();
Page<ApiAssignmentListResultVO> pageRecords=new Page<ApiAssignmentListResultVO>();
//组装数据
if(assignmentIds!=null && assignmentIds.size()>0) {
for (int i = 0; i < assignmentIds.size(); i++) {
//对某一份作业进行组装
ApiAssignmentListResultVO aalrv=new ApiAssignmentListResultVO();
Long assignmentId=assignmentIds.get(i);
List<AssignmentAnswer> listAnswer=assignmentAnswerService.listAssignmentAnswerByAssignmentIdAndAccountId(assignmentId, accountId);
Assignment assignment=assignmentMapper.selectById(assignmentId);
//初始化 合格分数
Integer passScore = null;
if(assignment!=null) {
// 合格分数
passScore = assignment.getPassScore();
aalrv.setId(assignmentId);
aalrv.setAssignmentName(assignment.getName());
aalrv.setProjectName(assignment.getTrainingProjectName());
aalrv.setFinishTime(assignment.getFinishTime());
aalrv.setAmendable(assignment.getAmendable());
aalrv.setCount(assignment.getCount());
aalrv.setSubmitCount(listAnswer==null?0:listAnswer.size());
aalrv.setIsOverDue(1);
aalrv.setPassScore(passScore);
AssignmentContent assignmentContent = new AssignmentContent();
assignmentContent.setAssignmentId(assignmentId);
try {
assignmentContent = assignmentContentService.selectOne(QueryUtil.condition(assignmentContent));
aalrv.setDetail(assignmentContent.getComment());
} catch (Exception e) {
LOG.info("error{}",e);
}
}
//学员也提交了但是未被评阅
if(listAnswer!=null&&listAnswer.size()>0) {
boolean tag=false;
for (int j = 0; j < listAnswer.size(); j++) {
// 答案存在状态为2 表示已经批阅
if(listAnswer.get(j).getStatus()==2) {
tag=false;
Integer answerScore = listAnswer.get(j).getScore();
if (answerScore.compareTo(passScore)>=0) {
aalrv.setStatus(AssignmentConstant.PASS.getCode());
} else {
aalrv.setStatus(AssignmentConstant.NO_PASS.getCode());
}
continue;
}
if(listAnswer.get(j).getStatus()==1) {
tag=true;
break;
}
}
if(tag) {
aalrv.setTag("待评阅");
aalrv.setStatus(AssignmentConstant.MARKING.getCode());
// pc 列表展示
// if(assignment.getAmendable()==1){
if (assignment.getCount()-listAnswer.size()>0) {
aalrv.setHandle(AssignmentHandleConstant.CONTINUEDETAIL.getCode());
} else {
aalrv.setHandle(AssignmentHandleConstant.DETAIL.getCode());
}
// } else {
// aalrv.setHandle(AssignmentHandleConstant.DETAIL.getCode());
// }
}
//全部已经被评阅
if(!tag) {
//获取作业得到的最大分数对象
AssignmentAnswer assignmentAnswer=assignmentAnswerMapper.maxGradeByAccountIdAndAssignmentId(accountId, assignmentId);
// 初始化最大分数
Integer maxGrade=null;
if(assignmentAnswer!=null) {
maxGrade=assignmentAnswer.getScore();
int compareResult = maxGrade.compareTo(passScore);
if (compareResult<0){
// 小于合格分
aalrv.setStatus(AssignmentConstant.NO_PASS.getCode());
} else {
aalrv.setStatus(AssignmentConstant.PASS.getCode());
}
}
// 获取作业答案的分数等级
AssignmentGrade assignmentGrade=assignmentGradeMapper.getGradeByAssignmentIdAndScore(assignmentId, maxGrade);
if(assignmentGrade!=null) {
// 组装等级到对象中
aalrv.setGradeLeval(assignmentGrade.getDescription());
}
// 当前答案显示等级值/分数值
if(assignment!=null) {
aalrv.setIsScoreAndGrade(assignment.getType());
}
aalrv.setScore(maxGrade);
// pc操作里
if(assignment.getAmendable()==1){
if (assignment.getCount()-listAnswer.size()>0) {
aalrv.setHandle(AssignmentHandleConstant.CONTINUEDETAIL.getCode());
} else {
aalrv.setHandle(AssignmentHandleConstant.DETAIL.getCode());
}
} else {
aalrv.setHandle(AssignmentHandleConstant.DETAIL.getCode());
}
}
} else {
// 未提交
aalrv.setTag("待提交");
aalrv.setStatus(AssignmentConstant.SUBMISSION.getCode());
aalrv.setHandle(AssignmentHandleConstant.SUBMIT.getCode());
}
listApiAssignmentListResultVO.add(aalrv);
}
}
pageRecords.setRecords(listApiAssignmentListResultVO);
pageRecords.setTotal(pageLimit.getTotal());
return pageRecords;
}*/
@Override
public Page<ApiAssignmentListResultVO> listAllAssignmentByName(String name, int pageNo, int pageSize, Long accountId, List<Long> relationIds, Long siteId) {
// TODO Auto-generated method stub
List<ApiAssignmentListResultVO> listApiAssignmentListResultVO = new ArrayList<ApiAssignmentListResultVO>();
Page<ApiAssignmentListResultVO> page = new Page<ApiAssignmentListResultVO>(pageNo, pageSize);
//分配给此人的作业idList
Page<Long> pageLimit = new Page<Long>(pageNo, pageSize);
Date date = new Date();
List<Long> assignmentIds = assignmentStudentMapper.myAllListByName(name, relationIds, siteId, pageLimit);
if (assignmentIds != null && assignmentIds.size() > 0) {
for (int i = 0; i < assignmentIds.size(); i++) {
//对某一份作业进行组装
ApiAssignmentListResultVO aalrv = new ApiAssignmentListResultVO();
Long assignmentId = assignmentIds.get(i);
List<AssignmentAnswer> listAnswer = assignmentAnswerService.listAssignmentAnswerByAssignmentIdAndAccountId(assignmentId, accountId);
Assignment assignment = assignmentMapper.selectById(assignmentId);
boolean isYq = false;
if (assignment != null) {
aalrv.setId(assignmentId);
aalrv.setAssignmentName(assignment.getName());
aalrv.setProjectName(assignment.getTrainingProjectName());
aalrv.setFinishTime(assignment.getFinishTime());
aalrv.setAmendable(assignment.getAmendable());
aalrv.setCount(assignment.getCount());
aalrv.setPassScore(assignment.getPassScore());
aalrv.setSubmitCount(listAnswer == null ? 0 : listAnswer.size());
isYq = assignment.getFinishTime().compareTo(date) < 0;
AssignmentContent assignmentContent = new AssignmentContent();
assignmentContent.setAssignmentId(assignmentId);
try {
assignmentContent = assignmentContentService.selectOne(QueryUtil.condition(assignmentContent));
aalrv.setDetail(assignmentContent.getComment());
} catch (Exception e) {
LOG.info("error{}", e);
}
}
if (isYq) {
aalrv.setIsOverDue(2);
}
if (!isYq) {
aalrv.setIsOverDue(1);
}
//未提交 逾期
if (listAnswer == null && isYq) {
aalrv.setTag("已逾期");
}
if (listAnswer != null && listAnswer.size() > 0) {
boolean tag = false;
for (int j = 0; j < listAnswer.size(); j++) {
if (listAnswer.get(j).getStatus() == 2) { //已阅
tag = false;
continue;
}
if (listAnswer.get(j).getStatus() == 1) {
tag = true;
break;
}
}
if (tag) {
aalrv.setTag("评阅中");
}
if (!tag) {
AssignmentAnswer assignmentAnswer = assignmentAnswerMapper.maxGradeByAccountIdAndAssignmentId(accountId, assignmentId);
Integer maxGrade = null;
if (assignmentAnswer != null) {
maxGrade = assignmentAnswer.getScore();
}
AssignmentGrade assignmentGrade = assignmentGradeMapper.getGradeByAssignmentIdAndScore(assignmentId, maxGrade);
if (maxGrade.compareTo(assignment.getPassScore()) >= 0) {
//aalrv.setTag("已提交已完成");
aalrv.setScore(maxGrade);
if (assignmentGrade != null) {
aalrv.setGradeLeval(assignmentGrade.getDescription());
}
if (assignment != null) {
aalrv.setIsScoreAndGrade(assignment.getType());
}
aalrv.setIsPass(1);
} else {
//aalrv.setTag("已提交未完成");
aalrv.setScore(maxGrade);
if (assignmentGrade != null) {
aalrv.setGradeLeval(assignmentGrade.getDescription());
}
if (assignment != null) {
aalrv.setIsScoreAndGrade(assignment.getType());
}
aalrv.setIsPass(2);
}
}
listApiAssignmentListResultVO.add(aalrv);
}
}
}
page.setRecords(listApiAssignmentListResultVO);
page.setTotal(pageLimit.getTotal());
return page;
}
@Override
public Boolean update(Long id, Integer status, Long accountId, String accountName) {
Assignment m = new Assignment();
Date date = new Date();
Integer statue = null;
if (status == 2) { //上架变成下架
statue = 3;
m.setAddedTime(null);
} else if (status == 3 || status == 1) {//草稿或者下架转换为上架
statue = 2;
m.setAddedTime(date);
}
m.setStatus(statue);
m.setId(id);
m.setUpdateById(accountId);
m.setUpdateByName(accountName);
m.setUpdateTime(date);
Integer update = assignmentMapper.updateById(m);
if (update > 0) {
Assignment assignment = this.selectById(id);
RequestContext context = ContextHolder.get();
if (assignment.getEnableRemind() == 1) {
try {
//发消息告知业务状态有变化
MessageRemindVo remindVo = new MessageRemindVo();
remindVo.setTaskStatusUpdate(true);
taskExecutor.asynExecute(new AbstractTaskHandler() {
@Override
public void handle() {
assignmentEvenSendMessage.systemSendMessage(assignment, remindVo, context);
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
}
return update > 0;
}
/*@Override
public Integer sumNum(String name,Long siteId) {
// TODO Auto-generated method stub
Assignment assignment=new Assignment();
assignment.setSiteId(siteId);
EntityWrapper<Assignment> wrapper=new EntityWrapper<Assignment>(assignment);
if(StringUtils.isNotEmpty(name)) {
wrapper.like("name", name);
}
return this.selectCount(wrapper);
}*/
@Override
public Integer selectAssignmentNumByAccountId(Long accountId) {
// TODO Auto-generated method stub
return assignmentMapper.selectAssignmentNumByAccountId(accountId);
}
@Transactional
@Override
public PointParamVO assignmentReadOverByTeacher(AssignmentAnswerContentVO assignmentAnswerContentVO) {
// TODO Auto-generated method stub
Date date = new Date();
//先干掉第一次的建议
assignmentAnswerSuggestionService.delectSuggestion(assignmentAnswerContentVO.getAnswerId());
//先干掉第一次的批阅文件
assignmentAnswerFileService.deleteAnswerFile(assignmentAnswerContentVO.getAnswerId());
//老师给的建议
if (assignmentAnswerContentVO.getComment() != null) {
//插入第二次建议
AssignmentAnswerSuggestion assignmentAnswerSuggestion = new AssignmentAnswerSuggestion();
assignmentAnswerSuggestion.setId(id.generate());
assignmentAnswerSuggestion.setAnswerId(assignmentAnswerContentVO.getAnswerId());
assignmentAnswerSuggestion.setSuggestion(assignmentAnswerContentVO.getComment());
assignmentAnswerSuggestion.setCreateById(assignmentAnswerContentVO.getAccountId());
assignmentAnswerSuggestion.setCreateByName(assignmentAnswerContentVO.getAccountName());
assignmentAnswerSuggestion.setCreateTime(date);
assignmentAnswerSuggestionService.insert(assignmentAnswerSuggestion);
}
//老师给的批阅文件
if (!CollectionUtils.isEmpty(assignmentAnswerContentVO.getListFeedBackFiles())) {
//插入第二次批阅文件
List<com.yizhi.assignment.application.vo.entity.AssignmentAnswerFile> feedBackFileVOList = assignmentAnswerContentVO.getListFeedBackFiles();
List<AssignmentAnswerFile> list = new ArrayList<>();
feedBackFileVOList.forEach(assignmentAnswerFileVO -> {
AssignmentAnswerFile assignmentAnswerFile = new AssignmentAnswerFile();
BeanUtils.copyProperties(assignmentAnswerFileVO, assignmentAnswerFile);
list.add(assignmentAnswerFile);
});
//List<AssignmentAnswerFile> list = assignmentAnswerContentVO.getListFeedBackFiles();
for (int i = 0; i < list.size(); i++) {
AssignmentAnswerFile assignmentAnswerFile = new AssignmentAnswerFile();
assignmentAnswerFile.setId(id.generate());
assignmentAnswerFile.setAnwserId(assignmentAnswerContentVO.getAnswerId());
assignmentAnswerFile.setType(2); //文件类型(1:作业答案,2:评阅回复)
assignmentAnswerFile.setFileUrl(list.get(i).getFileUrl());
assignmentAnswerFile.setFileName(list.get(i).getFileName());
assignmentAnswerFile.setSuffix(list.get(i).getSuffix());
String size = list.get(i).getSize();
if (size == null) {
size = "0M";
}
assignmentAnswerFile.setSize(size);
assignmentAnswerFile.setPng("现在只能存图片");
assignmentAnswerFile.setCreateById(assignmentAnswerContentVO.getAccountId());
assignmentAnswerFile.setCreateByName(assignmentAnswerContentVO.getAccountName());
assignmentAnswerFile.setCreateTime(date);
assignmentAnswerFileService.insert(assignmentAnswerFile);
}
}
// 先看有没有老师批阅过,如果有 是更改 如果没有老师批阅,则插入
//插入 分数 评阅人 改变状态或者等级
AssignmentAnswer assignmentAnswer = new AssignmentAnswer();
assignmentAnswer.setId(assignmentAnswerContentVO.getAnswerId());//作业id 主键
assignmentAnswer.setAuditorId(assignmentAnswerContentVO.getAccountId()); //评阅人id
assignmentAnswer.setAuditorTime(date);
assignmentAnswer.setStatus(2); //状态改为已经阅读
assignmentAnswer.setUpdateById(assignmentAnswerContentVO.getAccountId());
assignmentAnswer.setUpdateByName(assignmentAnswerContentVO.getAccountName());
assignmentAnswer.setScore(assignmentAnswerContentVO.getScore() > 0 ? assignmentAnswerContentVO.getScore() : 0);
/**
* 查询应该给多少积分
*/
AssignmentAnswer assignmentAnswer2 = assignmentAnswerMapper.selectById(assignmentAnswerContentVO.getAnswerId());
AssignmentPoint assignmentPoint = assignmentPointMapper.getPointByAssignmentIdAndScore(assignmentAnswer2.getAssignmentId(), assignmentAnswerContentVO.getScore());
if (assignmentPoint != null) {
assignmentAnswer.setPoint(assignmentPoint.getPoint());
}
assignmentAnswer.setUpdateTime(date);
assignmentAnswerService.insertTeacherToStudent(assignmentAnswer);
//培训项目用到的参数
AssignmentAnswer assignmentAnswerTra = new AssignmentAnswer();
//根据answerId找到作业id和accountId
Long answerId = assignmentAnswerContentVO.getAnswerId();
assignmentAnswerTra = assignmentAnswerService.selectById(answerId);
final Long assignmentId = assignmentAnswerTra.getAssignmentId();
final Long accountId = assignmentAnswerTra.getAccountId();
final Long siteId = assignmentAnswerTra.getSiteId();
//评分转换为float
Float score = 0.0f;
if (assignmentAnswerContentVO.getScore() != null) {
int i = assignmentAnswerContentVO.getScore().intValue();
score = (float) i;
}
Float scoreFloat = (float) score;
Assignment assignmentGetPassScore = assignmentMapper.selectById(assignmentId);
//批阅完成发消息
if (assignmentAnswerContentVO.getScore() != null) {
LOG.info("作业得分:" + assignmentAnswerContentVO.getScore());
LOG.info("作业assignmentAnswerContentVO:" + JSON.toJSONString(assignmentGetPassScore));
if (assignmentGetPassScore != null) {
try {
taskExecutor.asynExecute(new AbstractTaskHandler() {
@Override
public void handle() {
assignmentEvenSendMessage.evenSendMessage(assignmentGetPassScore, accountId, EvenType.ASSIGNMENT_AUDIT_FINISH, assignmentAnswerContentVO.getScore().doubleValue());
}
});
} catch (Exception e) {
e.printStackTrace();
LOG.info("作业批阅完成发消息异常");
}
}
}
if (assignmentAnswerContentVO.getScore() - assignmentGetPassScore.getPassScore() >= 0) {
// 向培训项目发送消息,告知业务已经完成
try {
taskExecutor.asynExecute(new AbstractTaskHandler() {
@Override
public void handle() {
try {
cloudEventPublisher.publish(QueueConstant.TRAINING_PROJECT_EVENT_QUEUE,
new EventWrapper<TrainingProjectEvent>(assignmentId,
TrainingProjectEvent.getInstance(assignmentId, TpActivityType.TYPE_ASSIGNMENT, accountId, new Date(), siteId, scoreFloat, true)));
} catch (Exception e) {
e.printStackTrace();
}
}
});
} catch (Exception e) {
LOG.error("培训项目发送消息失败:", e);
}
} else {//没有通过发false
try {
taskExecutor.asynExecute(new AbstractTaskHandler() {
@Override
public void handle() {
try {
cloudEventPublisher.publish(QueueConstant.TRAINING_PROJECT_EVENT_QUEUE,
new EventWrapper<TrainingProjectEvent>(assignmentId,
TrainingProjectEvent.getInstance(assignmentId, TpActivityType.TYPE_ASSIGNMENT, accountId, new Date(), siteId, scoreFloat, false)));
} catch (Exception e) {
e.printStackTrace();
}
}
});
} catch (Exception e) {
LOG.error("培训项目发送消息失败:", e);
}
}
/**
* 发放积分
*/
AssignmentAnswer assignmentAnswerPoint = assignmentAnswerMapper.selectById(answerId);
Assignment assignment = null;
if (assignmentAnswerPoint != null && assignmentAnswerPoint.getAssignmentId() != null) {
assignment = assignmentMapper.selectById(assignmentAnswerPoint.getAssignmentId());
}
PointParamVO pointParamVO = new PointParamVO();
if (assignment != null) {
pointParamVO.setActivityName(assignment.getName());
pointParamVO.setSourceId(assignment.getId());
}
pointParamVO.setCreatePointTime(date);
if (assignmentPoint != null) {
pointParamVO.setOperatingPoint(assignmentPoint.getPoint());
}
if (assignmentAnswer2 != null) {
pointParamVO.setAccountId(assignmentAnswer2.getAccountId()); //学员ID
pointParamVO.setAccountName(assignmentAnswer2.getAccountName()); //学员名称
pointParamVO.setCompanyId(assignmentAnswer2.getCompanyId()); //企业ID
pointParamVO.setSiteId(assignmentAnswer2.getSiteId()); //站点ID
pointParamVO.setOrgId(assignmentAnswer2.getOrgId());
}
return pointParamVO;
}
private List<com.yizhi.assignment.application.vo.entity.AssignmentAnswerFile> exchangeAssignmentAnswerFile(List<AssignmentAnswerFile> listAssignmentAnswerFile) {
List<com.yizhi.assignment.application.vo.entity.AssignmentAnswerFile> assignmentAnswerFileVoList = new ArrayList<>();
listAssignmentAnswerFile.forEach(assignmentAnswerFile -> {
com.yizhi.assignment.application.vo.entity.AssignmentAnswerFile assignmentAnswerFileVO = new com.yizhi.assignment.application.vo.entity.AssignmentAnswerFile();
BeanUtils.copyProperties(assignmentAnswerFile, assignmentAnswerFileVO);
assignmentAnswerFileVoList.add(assignmentAnswerFileVO);
});
return assignmentAnswerFileVoList;
}
@Override
public Integer getAssignmentCountQXPT(Long siteId) {
// TODO Auto-generated method stub
//全平台可见的作业个数 已上架 visible_range=1 全平台可见
Assignment assignment = new Assignment();
assignment.setVisibleRange(1);
assignment.setSiteId(siteId);
assignment.setStatus(2);
EntityWrapper<Assignment> wrapper = new EntityWrapper<Assignment>(assignment);
return this.selectCount(wrapper);
}
@Override
public AssignmentQXVO getQXSubmitMessage(Long assignmentId) {
// TODO Auto-generated method stub
AssignmentQXVO assignmentUnSubmitVO = new AssignmentQXVO();
List<AssignmentStudent> listStudent = new ArrayList<AssignmentStudent>();
Assignment assignment = new Assignment();
assignment.setId(assignmentId);
EntityWrapper<Assignment> wrapper = new EntityWrapper<Assignment>(assignment);
assignment = this.selectOne(wrapper);
if (assignment != null) {
assignmentUnSubmitVO.setName(assignment.getName());
assignmentUnSubmitVO.setVisibleRange(assignment.getVisibleRange());
//全平台可见 给站点id
assignmentUnSubmitVO.setSiteId(assignment.getSiteId());
if (assignment.getVisibleRange() == 2) { //指定学员可见范围
AssignmentStudent assignmentStudent = new AssignmentStudent();
assignmentStudent.setAssignmentId(assignmentId);
EntityWrapper<AssignmentStudent> wrapper2 = new EntityWrapper<AssignmentStudent>(assignmentStudent);
listStudent = assignmentStudentService.selectList(wrapper2);
if (listStudent != null) {
List<com.yizhi.assignment.application.vo.entity.AssignmentStudent> studentVOList = new ArrayList<>();
listStudent.forEach(assignmentStudent1 -> {
com.yizhi.assignment.application.vo.entity.AssignmentStudent assignmentStudentVO = new com.yizhi.assignment.application.vo.entity.AssignmentStudent();
BeanUtils.copyProperties(assignmentStudent1, assignmentStudentVO);
studentVOList.add(assignmentStudentVO);
});
assignmentUnSubmitVO.setListStudent(studentVOList);
}
}
//已经提交的人员id
AssignmentAnswer assignmentAnswer = new AssignmentAnswer();
assignmentAnswer.setAssignmentId(assignmentId);
EntityWrapper<AssignmentAnswer> wrapper3 = new EntityWrapper<AssignmentAnswer>(assignmentAnswer);
List<AssignmentAnswer> listAssignmentAnswer = assignmentAnswerService.selectList(wrapper3);
List<Long> list = new ArrayList<Long>();
if (listAssignmentAnswer != null) {
for (int i = 0; i < listAssignmentAnswer.size(); i++) {
list.add(listAssignmentAnswer.get(i).getAccountId());
}
assignmentUnSubmitVO.setListSubmitAccountId(list);
}
}
return assignmentUnSubmitVO;
}
@Override
public List<ToOthersApi> listSearchOthers(String name, int pageNo, int pageSize, Long accountId, List<Long> relationIds, Long siteId) {
// TODO Auto-generated method stub
//分配给此人的作业idList
Page<Long> pageLimit = new Page<Long>(pageNo, pageSize);
List<Long> assignmentIds = assignmentStudentMapper.myAllListByName(name, relationIds, siteId, pageLimit);
if (!CollectionUtils.isEmpty(assignmentIds)) {
return assignmentMapper.listToOthersApi(assignmentIds);
} else {
return null;
}
}
@Override
public ApiAssignmentVO getAssignment(Long assignmentId, Long accountId) {
// TODO Auto-generated method stub
Assignment assignment = assignmentMapper.selectById(assignmentId);
AssignmentContent assignmentContent = assignmentContentService.findByAssignmentId(assignmentId);
List<ApiFileVo> fileList = assignmentFileMapper.listApiFileVo(assignmentId);
ApiAssignmentVO apiAssignmentVO = new ApiAssignmentVO();
List<AssignmentAnswer> listAssignmentAnswer = assignmentAnswerService.listAssignmentAnswerByAssignmentIdAndAccountId(assignmentId, accountId);
if (assignment != null) {
apiAssignmentVO.setId(assignment.getId());
apiAssignmentVO.setAssignmentName(assignment.getName());
apiAssignmentVO.setCount(assignment.getCount());
apiAssignmentVO.setProjectName(assignment.getTrainingProjectName());
apiAssignmentVO.setFinishTime(assignment.getFinishTime());
apiAssignmentVO.setPassScore(assignment.getPassScore());
apiAssignmentVO.setSubmitCount(listAssignmentAnswer != null ? listAssignmentAnswer.size() : 0);
apiAssignmentVO.setAmendable(assignment.getAmendable());
apiAssignmentVO.setAnswerAttachmentNumMax(assignment.getAnswerAttachmentNumMax());
apiAssignmentVO.setAnswerAttachmentNumMin(assignment.getAnswerAttachmentNumMin());
apiAssignmentVO.setAnswerCharaterNumMax(assignment.getAnswerCharaterNumMax());
apiAssignmentVO.setAnswerCharaterNumMin(assignment.getAnswerCharaterNumMin());
apiAssignmentVO.setShowRes(assignment.getShowRes());
apiAssignmentVO.setEnableExerciseBook(assignment.getEnableExerciseBook());
apiAssignmentVO.setCommitAccountNum(assignmentAnswerMapper.countCommitAccountNum(assignmentId));
}
if (assignmentContent != null) {
apiAssignmentVO.setAssignmentContent(assignmentContent.getComment());
}
apiAssignmentVO.setFileList(fileList);
return apiAssignmentVO;
}
@Override
public VisibleRangeExport vsibleRangeExport(Long assignmentId) {
// TODO Auto-generated method stub
VisibleRangeExport visibleRangeExport = new VisibleRangeExport();
List<Long> accountIds = new ArrayList<Long>();
List<Long> orgIds = new ArrayList<Long>();
Assignment assignment = assignmentMapper.selectById(assignmentId);
if (assignment != null) {
visibleRangeExport.setBizId(assignment.getId());
visibleRangeExport.setBizName(assignment.getName());
}
List<AssignmentStudent> listStudent = assignmentStudentService.relation(assignmentId);
if (listStudent != null && listStudent.size() > 0) {
AssignmentStudent assignmentStudent = null;
for (int i = 0; i < listStudent.size(); i++) {
assignmentStudent = listStudent.get(i);
if (assignmentStudent != null && assignmentStudent.getType() != null) {
if (assignmentStudent.getType() == 2) {
accountIds.add(assignmentStudent.getAccountId());
}
if (assignmentStudent.getType() == 1) {
orgIds.add(assignmentStudent.getAccountId());
}
}
visibleRangeExport.setAccountIds(accountIds);
visibleRangeExport.setOrgIds(orgIds);
}
}
return visibleRangeExport;
}
@Transactional
@Override
public boolean updateAssignmentTp(AssignmentTrainingProject atp) {
// TODO Auto-generated method stub
Long projectId = atp.getProjectId();
String projectName = atp.getProjectName();
List<Long> assignmentIds = atp.getListAssignmentIds();
Set<Long> set = new HashSet<Long>();
if (!CollectionUtils.isEmpty(assignmentIds)) {
set.addAll(assignmentIds);
}
List<Long> assignmentIdsByProjectId = assignmentMapper.getAssignmentIdsByProjectId(projectId);
set.addAll(assignmentIdsByProjectId);
// 培训项目名字和id设置为空
for (Long assignmentId : set) {
assignmentMapper.updateProjectMessageByAssignmentId(assignmentId);
}
if (!CollectionUtils.isEmpty(assignmentIds)) {
Assignment assignment = new Assignment();
assignment.setTrainingProjectId(projectId);
assignment.setTrainingProjectName(projectName);
for (int i = 0; i < assignmentIds.size(); i++) {
assignment.setId(assignmentIds.get(i));
assignmentMapper.updateById(assignment);
}
}
return true;
}
@Override
public List<Map<String, Object>> getServerByCompanyIdAndIds(Long companyId, List<Long> ids) {
// TODO Auto-generated method stub
List<Map<String, Object>> listMap = null;
Assignment assignment = new Assignment();
assignment.setCompanyId(companyId);
EntityWrapper<Assignment> wrapper = new EntityWrapper<Assignment>(assignment);
if (!CollectionUtils.isEmpty(ids)) {
wrapper.in("id", ids);
}
List<Assignment> listAssignment = this.selectList(wrapper);
Map<String, Object> map = null;
if (!CollectionUtils.isEmpty(listAssignment)) {
listMap = new ArrayList<Map<String, Object>>();
for (Assignment c : listAssignment) {
map = new HashMap<String, Object>();
map.put("catalog", 5);
map.put("id", c.getId());
map.put("name", c.getName());
map.put("logo_url", "");
listMap.add(map);
}
}
return listMap;
}
@Override
public Page<ApiAssignmentListResultVO> listUnfinishedAssignment(int pageNo, int pageSize, Long accountId, List<Long> relationIds, Long companyId, Long siteId) {
// TODO Auto-generated method stub
Page<ApiAssignmentListResultVO> pageRecords = new Page<ApiAssignmentListResultVO>(pageNo, pageSize);
List<ApiAssignmentListResultVO> listApiAssignmentListResultVO = null;
//未完成的作业列表中作业ids
Page<Long> pageLimit = new Page<Long>(pageNo, pageSize);
List<Long> assignmentIds = assignmentStudentMapper.listUnFinishIds(relationIds, companyId, siteId, accountId, pageLimit);
if (CollectionUtils.isNotEmpty(assignmentIds)) {
listApiAssignmentListResultVO = assignmentStudentMapper.listUnfinish(companyId, siteId, accountId, assignmentIds);
if (CollectionUtils.isNotEmpty(listApiAssignmentListResultVO)) {
for (ApiAssignmentListResultVO apiAssignmentListResultVO : listApiAssignmentListResultVO) {
Assignment assignment = assignmentMapper.selectById(apiAssignmentListResultVO.getId());
// apiAssignmentListResultVO.setScore(assignmentStudentMapper.maxGradeByAccountId(companyId, siteId, accountId, apiAssignmentListResultVO.getId()));
apiAssignmentListResultVO.setShowRes(assignment.getShowRes());
//提交过
if (apiAssignmentListResultVO.getSubmitCount() > 0) {
//全部被评阅
if (apiAssignmentListResultVO.getMinAnswerStatus() == 2) {
if (apiAssignmentListResultVO.getScore() >= apiAssignmentListResultVO.getPassScore()) {
apiAssignmentListResultVO.setStatus(AssignmentConstant.PASS.getCode());
apiAssignmentListResultVO.setIsPass(1);
} else {
apiAssignmentListResultVO.setStatus(AssignmentConstant.NO_PASS.getCode());
//aalrv.setTag("已提交未完成");
apiAssignmentListResultVO.setScore(apiAssignmentListResultVO.getScore());
apiAssignmentListResultVO.setIsPass(2);
}
//允许不允许补交
if (apiAssignmentListResultVO.getAmendable() == 1) {
if (apiAssignmentListResultVO.getCount() - apiAssignmentListResultVO.getSubmitCount() > 0) {
apiAssignmentListResultVO.setHandle(AssignmentHandleConstant.CONTINUEDETAIL.getCode());
} else {
apiAssignmentListResultVO.setHandle(AssignmentHandleConstant.DETAIL.getCode());
}
} else {
apiAssignmentListResultVO.setHandle(AssignmentHandleConstant.DETAIL.getCode());
}
// 获取作业答案的分数等级
Long assignmentId = apiAssignmentListResultVO.getId();
Integer maxGrade = apiAssignmentListResultVO.getScore();
AssignmentGrade assignmentGrade = assignmentGradeMapper.getGradeByAssignmentIdAndScore(assignmentId, maxGrade);
if (assignmentGrade != null) {
apiAssignmentListResultVO.setGradeLeval(assignmentGrade.getDescription());
}
}
//只要有一个未被评阅
else {
apiAssignmentListResultVO.setTag("待评阅");
apiAssignmentListResultVO.setStatus(AssignmentConstant.MARKING.getCode());
if (apiAssignmentListResultVO.getCount() > apiAssignmentListResultVO.getSubmitCount()) {
apiAssignmentListResultVO.setHandle(AssignmentHandleConstant.CONTINUEDETAIL.getCode());
} else {
apiAssignmentListResultVO.setHandle(AssignmentHandleConstant.DETAIL.getCode());
}
}
}
//实际提交次数为0
else {
apiAssignmentListResultVO.setTag("待提交");
apiAssignmentListResultVO.setStatus(AssignmentConstant.SUBMISSION.getCode());
apiAssignmentListResultVO.setHandle(AssignmentHandleConstant.SUBMIT.getCode());
Integer submitCount = assignmentAnswerMapper.selectAnswerCount(apiAssignmentListResultVO.getId(), accountId, null);
LOG.info("提交的次数:{}", submitCount);
if (submitCount > 0) {
apiAssignmentListResultVO.setIsPass(2);
apiAssignmentListResultVO.setStatus(AssignmentConstant.NO_PASS.getCode());
apiAssignmentListResultVO.setTag("");
apiAssignmentListResultVO.setScore(-1);
apiAssignmentListResultVO.setHandle(5);
}
}
}
}
}
pageRecords.setRecords(listApiAssignmentListResultVO);
pageRecords.setTotal(pageLimit.getTotal());
return pageRecords;
}
@Override
public Page<ApiAssignmentListResultVO> listFinishedAssignment(int pageNo, int pageSize, Long accountId, List<Long> relationIds, Long companyId, Long siteId) {
List<ApiAssignmentListResultVO> list = null;
Page<ApiAssignmentListResultVO> page = new Page<ApiAssignmentListResultVO>();
Page<Long> pageLimit = new Page<Long>(pageNo, pageSize);
List<Long> assignmentIds = assignmentStudentMapper.listFinishIds(relationIds, companyId, siteId, accountId, pageLimit);
if (CollectionUtils.isNotEmpty(assignmentIds)) {
list = assignmentStudentMapper.listFinish(companyId, siteId, accountId, assignmentIds);
if (CollectionUtils.isNotEmpty(list)) {
for (ApiAssignmentListResultVO apiAssignmentListResultVO : list) {
//提交次数大于0
Assignment assignment = assignmentMapper.selectById(apiAssignmentListResultVO.getId());
// apiAssignmentListResultVO.setScore(assignmentStudentMapper.maxGradeByAccountId(companyId, siteId, accountId, apiAssignmentListResultVO.getId()));
apiAssignmentListResultVO.setShowRes(assignment.getShowRes());
// AssignmentAnswer answer = new AssignmentAnswer();
// answer.setAssignmentId(apiAssignmentListResultVO.getId());
// answer.setDeleted(0);
// int submitCount = assignmentAnswerService.selectCount(QueryUtil.condition(answer));
// LOG.info("提交次数:{}",submitCount);
apiAssignmentListResultVO.getSubmitCount();
if (apiAssignmentListResultVO.getSubmitCount() == 0) {
// if(submitCount==0) {
if (apiAssignmentListResultVO.getIsOverDue() == 2) {
apiAssignmentListResultVO.setTag("已逾期");
apiAssignmentListResultVO.setStatus(AssignmentConstant.Delay.getCode());
if (apiAssignmentListResultVO.getAmendable() == 0) {
// 无补交
apiAssignmentListResultVO.setHandle(AssignmentHandleConstant.NO_HANDLE.getCode());
} else {
// 有补交
if (apiAssignmentListResultVO.getCount() - apiAssignmentListResultVO.getSubmitCount() > 0) {
apiAssignmentListResultVO.setHandle(AssignmentHandleConstant.SUBMIT.getCode());
} else {
apiAssignmentListResultVO.setHandle(AssignmentHandleConstant.NO_HANDLE.getCode());
}
}
}
Integer submitCount = assignmentAnswerMapper.selectAnswerCount(apiAssignmentListResultVO.getId(), accountId, 0);
LOG.info("提交的次数:{}", submitCount);
if (submitCount == apiAssignmentListResultVO.getCount()) {
apiAssignmentListResultVO.setIsPass(2);
apiAssignmentListResultVO.setStatus(AssignmentConstant.NO_PASS.getCode());
apiAssignmentListResultVO.setTag("");
apiAssignmentListResultVO.setScore(-1);
apiAssignmentListResultVO.setHandle(AssignmentConstant.MARKING.getCode());
}
if (submitCount == 0) {
apiAssignmentListResultVO.setIsPass(2);
apiAssignmentListResultVO.setStatus(AssignmentConstant.NO_PASS.getCode());
apiAssignmentListResultVO.setTag("");
apiAssignmentListResultVO.setScore(-1);
apiAssignmentListResultVO.setHandle(AssignmentConstant.MARKING.getCode());
}
}
//提交过
else {
AssignmentAnswer answer = new AssignmentAnswer();
answer.setAssignmentId(apiAssignmentListResultVO.getId());
answer.setIsDown(0);
answer.setAccountId(accountId);
int count = assignmentAnswerService.selectCount(QueryUtil.condition(answer));
LOG.info("当前的未下架数量:{}", count);
if (apiAssignmentListResultVO.getAmendable() == 1) {
Integer currentSubmitCount = assignmentAnswerMapper.selectAnswerCount(apiAssignmentListResultVO.getId(), accountId, null);
LOG.info("总计次数:{}", currentSubmitCount);
if (apiAssignmentListResultVO.getCount() - currentSubmitCount > 0) {
apiAssignmentListResultVO.setHandle(AssignmentHandleConstant.CONTINUEDETAIL.getCode());
} else {
apiAssignmentListResultVO.setHandle(AssignmentHandleConstant.DETAIL.getCode());
}
} else {
apiAssignmentListResultVO.setHandle(AssignmentHandleConstant.DETAIL.getCode());
}
boolean res = apiAssignmentListResultVO.getMinAnswerStatus() == 1;
boolean isYq = apiAssignmentListResultVO.getIsOverDue() == 1;
if (res & isYq) {
apiAssignmentListResultVO.setStatus(AssignmentConstant.MARKING.getCode());
}
boolean minAnswerStatus = apiAssignmentListResultVO.getMinAnswerStatus() == 1;
if (minAnswerStatus) {
apiAssignmentListResultVO.setTag("评阅中");
apiAssignmentListResultVO.setStatus(AssignmentConstant.MARKING.getCode());
}
if (!minAnswerStatus) {
Long assignmentId = apiAssignmentListResultVO.getId();
Integer maxGrade = apiAssignmentListResultVO.getScore();
AssignmentGrade assignmentGrade = assignmentGradeMapper.getGradeByAssignmentIdAndScore(assignmentId, maxGrade);
if (maxGrade.compareTo(apiAssignmentListResultVO.getPassScore()) >= 0) {
//aalrv.setTag("已提交已完成");
apiAssignmentListResultVO.setScore(maxGrade);
if (assignmentGrade != null) {
apiAssignmentListResultVO.setGradeLeval(assignmentGrade.getDescription());
}
apiAssignmentListResultVO.setIsPass(1);
apiAssignmentListResultVO.setStatus(AssignmentConstant.PASS.getCode());
} else {
if (assignmentGrade != null) {
apiAssignmentListResultVO.setGradeLeval(assignmentGrade.getDescription());
}
apiAssignmentListResultVO.setIsPass(2);
apiAssignmentListResultVO.setStatus(AssignmentConstant.NO_PASS.getCode());
}
}
if (count == 0) {
apiAssignmentListResultVO.setIsPass(2);
apiAssignmentListResultVO.setStatus(AssignmentConstant.NO_PASS.getCode());
apiAssignmentListResultVO.setTag("");
apiAssignmentListResultVO.setScore(-1);
}
}
if (apiAssignmentListResultVO.getIsOverDue() == 1 && AnswerFileTypeEnum.ANSWER.equals(apiAssignmentListResultVO.getAmendable())) {
apiAssignmentListResultVO.setStatus(AssignmentConstant.MARKUP.getCode());
}
// if (accountId != null) {
// Integer currentScore = apiAssignmentListResultVO.getScore();
// if (currentScore != null) {
// int maxScore = assignmentAnswerMapper.getScore(apiAssignmentListResultVO.getId(), null, null, accountId);
// LOG.info("返回最大的分数:{}", maxScore);
// apiAssignmentListResultVO.setScore(maxScore);
// }
// }
}
}
}
page.setTotal(pageLimit.getTotal());
page.setRecords(list);
return page;
}
@Override
public Integer delete(Long assignmentId) {
// TODO Auto-generated method stub
return assignmentMapper.delete(assignmentId);
}
@Override
public Page<Map<String, Object>> experiencePoolList(String name, List<Long> ids, Integer pageNo, Integer pageSize) {
// TODO Auto-generated method stub
RequestContext res = ContextHolder.get();
Long companyId = res.getCompanyId();
Long siteId = res.getSiteId();
Page<Map<String, Object>> page = new Page<>(pageNo, pageSize);
List<Map<String, Object>> list = new ArrayList<>();
String name1 = null;
if (StringUtils.isNotBlank(name)) {
name1 = name.trim();
}
HQueryUtil.startHQ(Assignment.class);
list = assignmentMapper.experiencePoolList(name1, ids, companyId, siteId, page);
if (CollectionUtils.isNotEmpty(list)) {
page.setRecords(list);
}
return page;
}
@Override
public Page<AssignmentCalendarVO> getPageToCalendar(Date date, Page<Assignment> page) {
RequestContext context = ContextHolder.get();
Long siteId = context.getSiteId();
Long accountId = context.getAccountId();
Page<AssignmentCalendarVO> voPage = new Page<>();
BeanUtils.copyProperties(page, voPage);
//获取该时间参数的作业ids
List<Long> ids = assignmentMapper.getIdsByDate(date, siteId);
if (CollectionUtils.isEmpty(ids)) {
return voPage;
}
//获取已通过的ids
Set<Long> passIds = new HashSet<>();
//获取未通过的ids
Set<Long> unPassIds = new HashSet<>();
//获取已结束的ids
Set<Long> endIds = new HashSet<>();
//获取待批阅的ids
Set<Long> auditingIds = new HashSet<>();
//获取含有未提交的id的集合
Set<Long> unAnswerIds = new HashSet<>();
unAnswerIds.addAll(ids);
//储存《作业id,允许参加作业的次数》
Map<Long, Integer> canJoinAssignmnetNumMap = new HashMap<>();
//储存《作业id,已参加对应作业的次数》
Map<Long, Integer> hasJoinAssignmnetNumMap = new HashMap<>();
//根据可见范围获取作业ids
List<Long> assignmentIdsFromVisibRange = CollectionUtils.isEmpty(context.getRelationIds()) ? null : assignmentStudentMapper.getUsefulIds(ids, context.getRelationIds(), siteId);
//根据ids获取的相关作业提交记录
List<AssignmentAnswer> joinAssignments = assignmentAnswerMapper.getJoinIdsByIds(siteId, accountId, ids);
if (CollectionUtils.isNotEmpty(joinAssignments)) {
for (AssignmentAnswer a : joinAssignments) {
Assignment assignment = assignmentMapper.selectById(a.getAssignmentId());
if (assignment != null) {
Long assignmentId = assignment.getId();
if (a.getStatus() == 2) {//已阅
if (a.getScore() >= assignment.getPassScore()) {
passIds.add(assignmentId);
} else {
unPassIds.add(assignmentId);
}
} else if (a.getStatus() == 1) {//未阅
auditingIds.add(assignmentId);
}
if (!canJoinAssignmnetNumMap.containsKey(assignmentId)) {
canJoinAssignmnetNumMap.put(assignmentId, assignment.getCount());
}
if (hasJoinAssignmnetNumMap.containsKey(assignmentId)) {
hasJoinAssignmnetNumMap.put(assignmentId, hasJoinAssignmnetNumMap.get(assignmentId) + 1);
} else {
hasJoinAssignmnetNumMap.put(assignmentId, 1);
}
unAnswerIds.remove(a.getAssignmentId());
} else {
LOG.info("该作业为空" + a.getAssignmentId());
}
}
for (Long id : ids) {
Integer canJoinAssignmnetNum = canJoinAssignmnetNumMap.get(id);
Integer hasJoinAssignmnetNum = hasJoinAssignmnetNumMap.get(id);
if (canJoinAssignmnetNum != null && hasJoinAssignmnetNum != null) {
if (hasJoinAssignmnetNum >= canJoinAssignmnetNum) {
endIds.add(id);
}
}
}
}
//展示的数据需要剔除已结束、已通过的作业
endIds.addAll(passIds);
//获取最终数据
List<Assignment> pageToCalendar = assignmentMapper.getPageToCalendar(new ArrayList<>(endIds), assignmentIdsFromVisibRange, date, siteId, page);
voPage.setTotal(assignmentMapper.getPageToCalendarNum(new ArrayList<>(endIds), assignmentIdsFromVisibRange, date, siteId));
voPage.setRecords(buildAssignmentVo(pageToCalendar, auditingIds, unAnswerIds, unPassIds));
return voPage;
}
/**
* 组建作业状态
*
* @return
*/
public List<AssignmentCalendarVO> buildAssignmentVo(List<Assignment> assignments, Set<Long> auditingIds, Set<Long> unAnswerIds, Set<Long> unPassIds) {
List<AssignmentCalendarVO> vos = new ArrayList<>(assignments.size());
if (CollectionUtils.isNotEmpty(assignments)) {
for (Assignment a : assignments) {
AssignmentCalendarVO vo = new AssignmentCalendarVO();
BeanUtils.copyProperties(a, vo);
if (auditingIds.contains(a.getId())) {
vo.setTaskStatus(2);
vo.setTaskTag(ButtonStatus.TO_BE_REVIEWED.getCode());//待批阅
vo.setTaskButtonStatus(Arrays.asList(ButtonStatus.SUMMIT_GO.getCode(), ButtonStatus.VIEW_DETAILS.getCode()));//继续提交、查看详情
} else if (unAnswerIds.contains(a.getId())) {
vo.setTaskStatus(1);
vo.setTaskTag(ButtonStatus.NOT_SUMMITED.getCode());//未提交
vo.setTaskButtonStatus(Arrays.asList(ButtonStatus.SUMMIT.getCode()));//提交作业
} else if (unPassIds.contains(a.getId())) {
vo.setTaskStatus(3);
vo.setTaskTag(ButtonStatus.FAILED.getCode());//未通过
vo.setTaskButtonStatus(Arrays.asList(ButtonStatus.SUMMIT_GO.getCode(), ButtonStatus.VIEW_DETAILS.getCode()));
if (auditingIds.contains(a.getId())) {
vo.setTaskStatus(2);
vo.setTaskTag(ButtonStatus.TO_BE_REVIEWED.getCode());//待批阅
}
}
vos.add(vo);
}
}
return vos;
}
public Integer getNotNull(Integer a) {
a = a == null ? 0 : a;
return a;
}
@Override
public Page<DroolsVo> getPageByDrools(String field, String value, Page<DroolsVo> page) {
if (StringUtils.isBlank(field)) {
LOG.info("列名不能为空!");
return page;
}
if (field.equalsIgnoreCase(TaskParamsEnums.NAME.getCode())) {
return getPage(field, value, page);
} else if (field.equalsIgnoreCase(TaskParamsEnums.KEYWORD.getCode())) {
field = "keywords";
return getPage(field, value, page);
}
return page;
}
public Page getPage(String field, String value, Page<DroolsVo> page) {
RequestContext requestContext = ContextHolder.get();
Long siteId = requestContext.getSiteId();
Long companyId = requestContext.getCompanyId();
Assignment assignment = new Assignment();
assignment.setSiteId(siteId);
assignment.setCompanyId(companyId);
assignment.setStatus(2);
EntityWrapper wrapper = new EntityWrapper(assignment);
wrapper.setSqlSelect("distinct(" + field + ")," + "id ")
.isNotNull(field)
.like(field, value)
.addFilter(field + "!=''")
.orderBy("create_time", false);
String upperField = ClassUtil.getFieldName(field);
List<DroolsVo> voList = null;
List<Assignment> list = this.baseMapper.selectPage(page, wrapper);
if (!CollectionUtils.isEmpty(list)) {
voList = new ArrayList<>(list.size());
for (Assignment a : list) {
DroolsVo vo = new DroolsVo();
vo.setTaskId(a.getId());
vo.setTaskFieldValue(ClassUtil.invokeMethod(a, upperField));
vo.setTaskParamsType(field);
voList.add(vo);
}
page.setRecords(voList);
}
return page;
}
}
package com.yizhi.application.service.impl;
import java.util.Date;
import java.util.List;
import com.yizhi.application.entity.AssignmentStudent;
import com.yizhi.application.mapper.AssignmentStudentMapper;
import com.yizhi.application.service.AssignmentStudentService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.toolkit.CollectionUtils;
import com.yizhi.application.orm.id.IdGenerator;
import com.yizhi.assignment.application.vo.ListStudent;
import com.yizhi.assignment.application.vo.StudentVo;
/**
* <p>
* 老师布置作业和学生进行关联。
* 多对多的关系。
* 一个老师布置的作业有多个学生做。 服务实现类
* </p>
*
* @author 王飞达123
* @since 2018-03-08
*/
@Transactional
@Service
public class AssignmentStudentServiceImpl extends ServiceImpl<AssignmentStudentMapper, AssignmentStudent> implements AssignmentStudentService {
private Logger logger = LoggerFactory.getLogger(AssignmentStudentServiceImpl.class);
@Autowired
private IdGenerator idGenerator;
@Autowired
private AssignmentStudentService assignmentStudentService;
@Autowired
private AssignmentStudentMapper assignmentStudentMapper;
/**
* 学员添加
*/
@Transactional
public Boolean add(ListStudent listStudent) {
//先删除 2再添加
assignmentStudentService.deleteRelation(listStudent.getAssignmentId());
Date date = new Date();
Long createId = listStudent.getAccountId();
String name = listStudent.getAccountName();
Long assignmentId = listStudent.getAssignmentId();
List<StudentVo> listAccountId = listStudent.getListAccountId();
AssignmentStudent assignmentStudent = null;
if (!CollectionUtils.isEmpty(listAccountId) && listAccountId.size() > 0) {
for (int i = 0; i < listAccountId.size(); i++) {
assignmentStudent = new AssignmentStudent();
assignmentStudent.setId(idGenerator.generate());
assignmentStudent.setAssignmentId(assignmentId);
assignmentStudent.setAccountId(listAccountId.get(i).getAdoId());
assignmentStudent.setType(listAccountId.get(i).getType());
assignmentStudent.setCreateById(createId);
assignmentStudent.setCreateByName(name);
assignmentStudent.setCreateTime(date);
this.insert(assignmentStudent);
}
}
return true;
}
/**
* 学员添加,之前记录不删除
*
* @param assignmentStudents
* @return
*/
@Override
@Transactional
public Boolean insertStudentRelation(List<AssignmentStudent> assignmentStudents) {
if (!CollectionUtils.isEmpty(assignmentStudents)) {
Long assignmentId = assignmentStudents.get(0).getAssignmentId();
AssignmentStudent assignmentStudent = new AssignmentStudent();
assignmentStudent.setAssignmentId(assignmentId);
EntityWrapper<AssignmentStudent> entityWrapper = new EntityWrapper<AssignmentStudent>(assignmentStudent);
this.baseMapper.delete(entityWrapper);
for (AssignmentStudent assignmentStudent1 : assignmentStudents) {
assignmentStudent1.setId(idGenerator.generate());
}
return this.insertBatch(assignmentStudents);
} else {
logger.error("列表为空");
return Boolean.FALSE;
}
}
/**
* 已经关联的学员名单
*/
@Override
public List<AssignmentStudent> relation(Long assignmentId) {
// TODO Auto-generated method stub
AssignmentStudent assignmentStudent = new AssignmentStudent();
assignmentStudent.setAssignmentId(assignmentId);
EntityWrapper<AssignmentStudent> wrapper = new EntityWrapper<AssignmentStudent>(assignmentStudent);
return this.selectList(wrapper);
}
/**
* 已关联的总学员名单数量
*/
@Override
public Integer sumNum(Long assignmentId) {
// TODO Auto-generated method stub
AssignmentStudent assignmentStudent = new AssignmentStudent();
assignmentStudent.setAssignmentId(assignmentId);
EntityWrapper<AssignmentStudent> wrapper = new EntityWrapper<AssignmentStudent>(assignmentStudent);
return this.selectCount(wrapper);
}
@Override
public Boolean deleteRelation(Long assignmentId) {
// TODO Auto-generated method stub
AssignmentStudent assignmentStudent = new AssignmentStudent();
assignmentStudent.setAssignmentId(assignmentId);
EntityWrapper<AssignmentStudent> wrapper = new EntityWrapper<AssignmentStudent>(assignmentStudent);
return this.delete(wrapper);
}
@Override
public Integer getAssignmentNumByAccountId(List<Long> relationIds, Long siteId, Long accountId) {
// TODO Auto-generated method stub
return assignmentStudentMapper.myAllListNum(relationIds, siteId);
}
}
//package com.yizhi.application.task;
//
//import com.baomidou.mybatisplus.mapper.EntityWrapper;
//import com.yizhi.core.application.context.TaskContext;
//import CommentReply;
//import com.yizhi.application.file.constant.FileConstant;
//import com.yizhi.application.file.task.AbstractDefaultTask;
//import com.yizhi.application.file.util.OssUpload;
//import com.yizhi.application.service.ICommentReplyService;
//import com.yizhi.application.service.ICommentService;
//import com.yizhi.application.system.remote.AccountClient;
//import com.yizhi.application.vo.AccountVO;
//import AssignmentPageCommentVo;
//import org.apache.poi.ss.usermodel.HorizontalAlignment;
//import org.apache.poi.ss.usermodel.VerticalAlignment;
//import org.apache.poi.ss.util.CellRangeAddress;
//import org.apache.poi.xssf.usermodel.*;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//
//import java.io.File;
//import java.io.FileOutputStream;
//import java.text.SimpleDateFormat;
//import java.util.ArrayList;
//import java.util.Date;
//import java.util.List;
//import java.util.Map;
//
//@Component
//public class CommentListExportAsync extends AbstractDefaultTask<String, Map<String,Object>>{
//
// private static final Logger logger = LoggerFactory.getLogger(CommentListExportAsync.class);
//
// @Autowired
// private ICommentService tpCommentService;
//
// @Autowired
// private ICommentReplyService tpCommentReplyService;
//
// @Autowired
// private AccountClient accountClient;
//
// @Override
// protected String execute(Map<String, Object> arg0) {
// Long accountId=(Long) arg0.get("accountId");
// Long siteId=(Long) arg0.get("siteId");
// Long companyId=(Long) arg0.get("companyId");
// Long taskId=(Long) arg0.get("taskId");
// Date submitTime=(Date) arg0.get("submitTime");
// String serialNo=(String) arg0.get("serialNo");
// String taskName=(String) arg0.get("taskName");
// Long trainingProjectId=(Long) arg0.get("trainingProjectId");
//// String trainingProjectName=(String) arg0.get("trainingProjectName");
// /**
// * 走异步任务
// */
// TaskContext taskContext = new TaskContext(taskId, serialNo, taskName, accountId, submitTime, siteId, companyId);
// working(taskContext);
// String upLoadUrl=null;
// String requestPath=FileConstant.SAVE_PATH;
// File fileDir=new File(requestPath);
// if(!fileDir.exists()) {
// fileDir.mkdir();
// }
// //项目评论开始组装
// List<AssignmentPageCommentVo> list = tpCommentService.getList(trainingProjectId, accountId);
// List<AssignmentPageCommentVo> listVO = new ArrayList<AssignmentPageCommentVo>();
// CommentReply reply=new CommentReply();
// AssignmentPageCommentVo vo = new AssignmentPageCommentVo();
// for(AssignmentPageCommentVo commentVo:list) {
// AccountVO accountVO = accountClient.findById(commentVo.getAccountId());
// commentVo.setCommentator(accountVO.getName());
// commentVo.setCommentatorName(null==accountVO.getFullName()||""==accountVO.getFullName()?accountVO.getName():accountVO.getFullName());
//// commentVo.setReplyName(trainingProjectName);
// reply.setCommentId(commentVo.getId());
// reply.setAuditStatus("0");
// EntityWrapper<CommentReply> wrapper = new EntityWrapper<CommentReply>(reply);
// List<String> time = new ArrayList<String>();
// time.add("createTime");
// wrapper.orderDesc(time);
// List<CommentReply> replyList = tpCommentReplyService.selectList(wrapper);
// listVO.add(commentVo);
// for(CommentReply r:replyList) {
// AssignmentPageCommentVo vo1 = new AssignmentPageCommentVo();
// if (null!=r.getReplyParentId()&&0!=r.getReplyParentId()) {
// CommentReply reply2 = tpCommentReplyService.selectById(r.getReplyParentId());
// if (null!=reply2) {
// AccountVO findById = accountClient.findById(reply2.getCreateById());
// r.setParentAccountFullName(null==findById.getFullName()||""==findById.getFullName()?findById.getName():findById.getFullName());
// }else {
// AccountVO findById = accountClient.findById(tpCommentService.selectById(r.getCommentId()).getCreateById());
// r.setParentAccountFullName(null==findById.getFullName()||""==findById.getFullName()?findById.getName():findById.getFullName());
// }
// }else {
// AccountVO findById = accountClient.findById(tpCommentService.selectById(r.getCommentId()).getCreateById());
// r.setParentAccountFullName(null==findById.getFullName()||""==findById.getFullName()?findById.getName():findById.getFullName());
// }
// logger.info("-----");
// AccountVO findById = accountClient.findById(r.getCreateById());
// vo1.setId(r.getId());
// vo1.setAccountId(r.getCreateById());
// vo1.setCommentator(findById.getName());
// vo1.setCommentatorName(null==findById.getFullName()||""==findById.getFullName()?findById.getName():findById.getFullName());
// vo1.setReplyName(r.getParentAccountFullName());
// vo1.setContent(r.getContent());
// vo1.setCreateTime(r.getCreateTime());
// vo1.setThumbsUps(null);
// vo1.setState(r.getState());
// listVO.add(vo1);
// }
// }
// SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// SimpleDateFormat sf = new SimpleDateFormat("yyyyMMddHHmmss");
// try {
// //excel生成过程: excel-->sheet-->row-->cell
// // 第一步,创建一个Excel文件
// XSSFWorkbook wb = new XSSFWorkbook();
// // 第二步,在webbook中添加一个sheet,对应Excel文件中的sheet
// XSSFSheet sheet = wb.createSheet("评论信息");
// XSSFFont font = wb.createFont();
// font.setFontName("宋体");
// font.setFontHeightInPoints((short) 11);
// font.setBold(true);
// XSSFCellStyle style = wb.createCellStyle();
// style.setFont(font);
// style.setAlignment(HorizontalAlignment.CENTER); // 创建一个居中格式
// style.setVerticalAlignment(VerticalAlignment.CENTER);
// // 第三步,在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制short
// XSSFRow row = sheet.createRow((int) 0);
// row.setHeight((short) (20*20));
// // 合并单元格
// CellRangeAddress cra=new CellRangeAddress(0,0,0,6); // 起始行, 终止行, 起始列, 终止列
// sheet.addMergedRegion(cra);
// XSSFCell cell = row.createCell((short) 0);
// cell.setCellValue("评论记录"+sf.format(submitTime));
// cell.setCellStyle(style);
// // 第三步,在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制short
// XSSFRow row2 = sheet.createRow((int) 1);
// row2.setRowStyle(style);
// row2.setHeight((short) (14*20));
// // 第四步,创建单元格
// row2.createCell((short) 0).setCellValue("评论人/回复人");
// row2.createCell((short) 1).setCellValue("姓名");
// row2.createCell((short) 2).setCellValue("评论对象");
// row2.createCell((short) 3).setCellValue("评论内容");
// row2.createCell((short) 4).setCellValue("提交时间");
// row2.createCell((short) 5).setCellValue("点赞数");
// row2.createCell((short) 6).setCellValue("状态");
// for(int i=0;i<listVO.size();i++) {
// font.setBold(false);
// row = sheet.createRow(i + 2);
// row.setRowStyle(style);
// row.setHeight((short) (13*20));
// // 第四步,创建单元格,并设置值
// vo=listVO.get(i);
// if(vo!=null&&vo.getCommentator()!=null) {
// row.createCell((short) 0).setCellValue(vo.getCommentator());
// }
// if(vo!=null&&vo.getCommentatorName()!=null) {
// row.createCell((short) 1).setCellValue(null==vo.getCommentatorName()?"":vo.getCommentatorName());
// }
// if(vo!=null&&vo.getReplyName()!=null) {
// row.createCell((short) 2).setCellValue(null==vo.getReplyName()?"":vo.getReplyName());
// }
// if(vo!=null&&vo.getContent()!=null) {
// row.createCell((short) 3).setCellValue(vo.getContent());
// }
// if(vo!=null&&vo.getCreateTime()!=null) {
// row.createCell((short) 4).setCellValue(df.format(vo.getCreateTime()));
// }
// if (vo!=null) {
// row.createCell((short) 5).setCellValue(null==vo.getThumbsUps()?"——":vo.getThumbsUps().toString());
// }
// if (vo!=null&&vo.getState()!=null) {
// row.createCell((short) 6).setCellValue(0==vo.getState()?"已上架":"已下架");
// }
// }
//
// // 第五步,写入实体数据 实际应用中这些数据从数据库得到,
// StringBuffer fileNameSb = new StringBuffer().append("作业本评论记录").append(sf.format(submitTime)).append(".xlsx");
// String fileName = fileNameSb.toString();
// String path = new StringBuffer().append(requestPath).append(fileNameSb).toString();
// FileOutputStream os=null;
// File file=null;
// try {
// os= new FileOutputStream(path);
// wb.write(os);
// //阿里云返回url
// upLoadUrl = OssUpload.upload(path, fileName);
// file=new File(path);
// success(taskContext,"成功", upLoadUrl);
// } catch (Exception e1) {
// e1.printStackTrace();
// fail(taskContext, "写入数据到Excel的过程中或者上传到阿里云中发生错误"+e1.getMessage());
// logger.error("写入数据到Excel的过程中或者上传到阿里云中发生错误"+e1.getMessage());
// }
// finally {
// if(os!=null) {
// os.close();
// }
//// if(wb!=null) {
//// wb.close();
//// }
// if(file!=null) {
// file.delete();
// }
// }
// } catch (Exception e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// fail(taskContext, "评论信息导出过程中发生错误,请查看日志"+e.getMessage());
// logger.error("评论信息导出过程中发生错误,请查看日志"+e.getMessage());
// }
// return upLoadUrl;
// }
//
//}
package com.yizhi.application.util;
import com.yizhi.application.entity.Assignment;
import com.yizhi.assignment.application.vo.MessageTaskRemindVo;
import com.yizhi.core.application.context.RequestContext;
import com.yizhi.core.application.event.EventWrapper;
import com.yizhi.core.application.publish.CloudEventPublisher;
import com.yizhi.message.application.constans.Constans;
import com.yizhi.assignment.application.vo.enums.EvenType;
import com.yizhi.message.application.enums.RelationType;
import com.yizhi.message.application.vo.MessageRemindVo;
import com.yizhi.message.application.vo.TaskVo;
import org.apache.commons.lang3.time.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Component
public class AssignmentEvenSendMessage {
@Autowired
private CloudEventPublisher cloudEventPublisher;
private Logger logger = LoggerFactory.getLogger(AssignmentEvenSendMessage.class);
/**
* 触发事件,
*
* @param assignment 业务参数对象
* @param accountId
*/
public void evenSendMessage(Assignment assignment, Long accountId, EvenType evenType, Double score) {
if (assignment != null) {
TaskVo taskVo = new TaskVo();
taskVo.setTaskName(assignment.getName());
taskVo.setTaskScore(score);
taskVo.setTaskEndTime(assignment.getFinishTime());
MessageRemindVo vo = new MessageRemindVo();
vo.setTaskVo(taskVo);
vo.setVisibleRange(assignment.getVisibleRange());
vo.setMessageId(evenType.getKey());
vo.setMessageType(3);
vo.setRelationId(assignment.getId());
vo.setRelationType(RelationType.ZY.getKey());
vo.setSendType(1);
//定时任务默认五分钟执行一次 这里默认6分钟
//定时任务默认五分钟执行一次 这里默认暂时不延迟时间
vo.setSendTime(DateUtils.addMinutes(new Date(), 0));
if (accountId != null) {
vo.setAccountId(accountId);
}
RequestContext requestContext = new RequestContext();
requestContext.setCompanyId(assignment.getCompanyId());
requestContext.setSiteId(assignment.getSiteId());
requestContext.setAccountId(assignment.getCreateById());
requestContext.setAccountName(assignment.getCreateByName());
vo.setRequestContext(requestContext);
try {
//临时取消触发功能
// cloudEventPublisher.publish(Constans.MESSAGE_QUEUE, new EventWrapper<MessageRemindVo>(null, vo));
} catch (Exception e) {
e.printStackTrace();
logger.error("发送消息失败=====================", e);
}
}
}
/**
* 系统模板,发消息
*
* @param assignment 业务参数对象
*/
public void systemSendMessage(Assignment assignment, com.yizhi.assignment.application.vo.MessageRemindVo remindVo, RequestContext context) {
MessageRemindVo vo = new MessageRemindVo();
//共用参数
vo.setMessageType(2);
vo.setRelationId(assignment.getId());
vo.setRelationType(RelationType.ZY.getKey());
vo.setTaskStatus(assignment.getStatus().equals(2) ? 1 : 0);
if (context == null) {
context = new RequestContext();
context.setCompanyId(assignment.getCompanyId());
context.setSiteId(assignment.getSiteId());
context.setAccountName(assignment.getCreateByName());
context.setAccountId(assignment.getCreateById());
}
vo.setRequestContext(context);
if (vo.getMessageType() == null || vo.getRelationId() == null || vo.getRelationType() == null) {
logger.info("messageType:"+remindVo.getMessageType()+"||"+"RelationId:"+remindVo.getRelationId()
+"||"+"RelationType:"+remindVo.getRelationType());
logger.info("相关参数缺失!!");
return;
}
if (remindVo.getHasDeleted()) {
vo.setHasDeleted(remindVo.getHasDeleted());
cloudEventPublisher.publish(Constans.MESSAGE_QUEUE, new EventWrapper<MessageRemindVo>(null, vo));
} else {
if (remindVo.getTaskStatusUpdate()) {
//1 为消息业务可发送状态 0 则不行
vo.setTaskStatusUpdate(remindVo.getTaskStatusUpdate());
cloudEventPublisher.publish(Constans.MESSAGE_QUEUE, new EventWrapper<MessageRemindVo>(null, vo));
logger.info("发送修改业务状态消息成功=====================");
return;
}
if (assignment != null) {
if (!CollectionUtils.isEmpty(remindVo.getMessageTaskRemindVos())) {
TaskVo taskVo = new TaskVo();
taskVo.setTaskName(assignment.getName());
taskVo.setTaskEndTime(assignment.getFinishTime());
vo.setMessageId(remindVo.getMessageId());
vo.setIsChangge(remindVo.getIsChangge());
List<MessageTaskRemindVo> m= remindVo.getMessageTaskRemindVos();
List<com.yizhi.message.application.vo.MessageTaskRemindVo> m2=new ArrayList<>();
for (MessageTaskRemindVo m1:m
) {
com.yizhi.message.application.vo.MessageTaskRemindVo mx=new com.yizhi.message.application.vo.MessageTaskRemindVo();
BeanUtils.copyProperties(m1,mx);
m2.add(mx);
}
vo.setMessageTaskRemindVos(m2);
vo.setSendType(remindVo.getSendType());
vo.setVisibleRange(assignment.getVisibleRange());
vo.setTaskVo(taskVo);
if (vo.getMessageId() == null || vo.getSendType() == null || vo.getVisibleRange() == null) {
logger.info("messageID:"+remindVo.getMessageId()+"||"+"sendType:"+remindVo.getSendType()
+"||"+"VisibleRange:"+remindVo.getVisibleRange());
logger.info("相关参数缺失!!!!!");
return;
}
try {
cloudEventPublisher.publish(Constans.MESSAGE_QUEUE, new EventWrapper<MessageRemindVo>(null, vo));
logger.info("发送消息成功=====================");
} catch (Exception e) {
e.printStackTrace();
logger.error("发送消息失败=====================", e);
}
}
}
}
}
}
package com.yizhi.application.util;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import com.yizhi.core.application.exception.FileReadException;
@Component
public class FileReadUtil {
private static final Logger LOG = LoggerFactory.getLogger(FileReadUtil.class);
public File read(String urlStr, String savePath, String fileName) {
File fileInfo = null;
try {
URL url = new URL(urlStr);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
//得到输入流
InputStream inputStream = conn.getInputStream();
//获取自己数组
byte[] buffer = new byte[1024];
int len = 0;
ByteArrayOutputStream bos = new ByteArrayOutputStream();
while ((len = inputStream.read(buffer)) != -1) {
bos.write(buffer, 0, len);
}
bos.close();
byte[] getData = bos.toByteArray();
//文件保存位置
File saveDir = new File(savePath);
if (!saveDir.exists()) {
saveDir.mkdir();
}
fileInfo = new File(saveDir + File.separator + fileName);
FileOutputStream fos = new FileOutputStream(fileInfo);
fos.write(getData);
if (fos != null) {
fos.close();
}
if (inputStream != null) {
inputStream.close();
}
} catch (Exception e) {
LOG.error("文件拉取失败", e);
throw new FileReadException();
}
return fileInfo;
}
}
server.port=33002
spring.application.name=assignment
ACTIVE=${spring.profiles.active}
spring.profiles.active=prod
# nacos
spring.cloud.nacos.config.shared-dataids=common-${spring.profiles.active}.properties
spring.cloud.nacos.config.namespace=${spring.profiles.active}
spring.cloud.nacos.config.prefix=${spring.application.name}
spring.cloud.nacos.config.file-extension=properties
spring.cloud.nacos.config.server-addr=192.168.0.203:8848
\ No newline at end of file
package com.fulan.application.controller;
import com.fulan.application.controller.api.ApiAssignmentExerciseBookController;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class CourseTest {
@Autowired
private ApiAssignmentExerciseBookController apiAssignmentExerciseBookController;
@Test
public void test() {
apiAssignmentExerciseBookController.thumbup(1190199071147581440L, false);
}
}
package com.fulan.application;
import com.yizhi.application.controller.manage.ManageAssignmentController;
import org.apache.commons.collections.map.HashedMap;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.Map;
@SpringBootTest
@RunWith(SpringRunner.class)
public class CourseTest {
// @Autowired
// private ApiAssignmentExerciseBookController apiAssignmentExerciseBookController;
@Autowired
private ManageAssignmentController manageAssignmentController;
// @Test
// public void test() {
// apiAssignmentExerciseBookController.thumbup(1190199071147581440L, false);
// }
@Test
public void testt() {
Map<String, String> map = new HashedMap();
map.put("id", "1196755770201427968");
map.put("vedioSd", "222222222222");
manageAssignmentController.updateVedioTranscodeUrl(map);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.yizhi</groupId>
<artifactId>wmy-parent</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath />
</parent>
<groupId>com.yizhi</groupId>
<artifactId>assignment-project</artifactId>
<version>1.0-SNAPSHOT</version>
<modules>
<module>cloud-assignment-api</module>
<module>cloud-assignment</module>
</modules>
<packaging>pom</packaging>
<repositories>
<repository>
<id>wmy4.0</id>
<url>http://mvn.km365.pw/nexus/content/groups/wmy4.0-group/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
</project>
\ No newline at end of file
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