diff --git a/pom.xml b/pom.xml index 2d3b361..b7ca58f 100644 --- a/pom.xml +++ b/pom.xml @@ -95,6 +95,11 @@ aliyun-sdk-oss 2.8.2 + + org.springframework.cloud + spring-cloud-starter-openfeign + 2.2.3.RELEASE + org.springframework.boot spring-boot-starter-test diff --git a/src/main/java/com/msdw/tms/api/PersonalFileControllerApi.java b/src/main/java/com/msdw/tms/api/PersonalFileControllerApi.java new file mode 100644 index 0000000..4d1d2f4 --- /dev/null +++ b/src/main/java/com/msdw/tms/api/PersonalFileControllerApi.java @@ -0,0 +1,22 @@ +package com.msdw.tms.api; + +import com.msdw.tms.common.utils.R; +import com.msdw.tms.entity.PersonalFileEntity; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; + +@Api(value = "个人档案管理",tags = "个人档案管理") +public interface PersonalFileControllerApi { + + @ApiOperation(value = "用户的全部档案",notes = "用户的全部档案") + R list(Integer userid); + + @ApiOperation(value = "添加用户个人档案",notes = "添加用户个人档案") + R save(PersonalFileEntity personalFileEntity); + + @ApiOperation(value = "修改用户个人档案",notes = "修改用户个人档案") + R update(PersonalFileEntity personalFileEntity); + + @ApiOperation(value = "删除用户个人档案",notes = "删除用户个人档案") + R delete(Long[] ids); +} diff --git a/src/main/java/com/msdw/tms/api/ProjectControllerApi.java b/src/main/java/com/msdw/tms/api/ProjectControllerApi.java new file mode 100644 index 0000000..42b1042 --- /dev/null +++ b/src/main/java/com/msdw/tms/api/ProjectControllerApi.java @@ -0,0 +1,12 @@ +package com.msdw.tms.api; + +import com.msdw.tms.common.utils.R; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; + +@Api(value = "用户_实验学习",tags = "用户_实验学习") +public interface ProjectControllerApi { + + @ApiOperation(value = "用户_实验学习实验项目",notes = "用户_实验学习实验项目") + R list(Integer userid); +} diff --git a/src/main/java/com/msdw/tms/api/ProjectRcordControllerApi.java b/src/main/java/com/msdw/tms/api/ProjectRcordControllerApi.java new file mode 100644 index 0000000..81a66dc --- /dev/null +++ b/src/main/java/com/msdw/tms/api/ProjectRcordControllerApi.java @@ -0,0 +1,31 @@ +package com.msdw.tms.api; + +import com.msdw.tms.common.utils.R; +import com.msdw.tms.entity.ProjectRecordEntity; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; + +import javax.servlet.http.HttpServletResponse; + +@Api(value = "实验报告",tags = "实验报告") +public interface ProjectRcordControllerApi { + + @ApiOperation(value = "服务端实验报告",notes = "服务端实验报告") + R list( Integer page, Integer size,Integer month,String startTime,String endTime, + Integer recordState,String condition); + + @ApiOperation(value = "用户端实验记录",notes = "用户端实验记录") + R queryUserRecord(Integer page,Integer size,Integer userid); + + @ApiOperation(value = "个人实验概览",notes = "个人实验概览") + R getUserScore(Integer userid); + + @ApiOperation(value = "个人实验记录导出",notes = "个人实验记录导出") + void exportProjectRecord(HttpServletResponse response,Integer userId)throws Exception; + + @ApiOperation(value = "修改实验报告分数",notes = "修改实验报告分数") + R update(ProjectRecordEntity projectRecord); + + @ApiOperation(value = "删除实验报告",notes = "删除实验报告") + R delete(Integer[] recordids); +} diff --git a/src/main/java/com/msdw/tms/api/UserControllerApi.java b/src/main/java/com/msdw/tms/api/UserControllerApi.java new file mode 100644 index 0000000..82a41ae --- /dev/null +++ b/src/main/java/com/msdw/tms/api/UserControllerApi.java @@ -0,0 +1,17 @@ +package com.msdw.tms.api; + +import com.msdw.tms.common.utils.R; +import com.msdw.tms.entity.UserEntity; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; + +@Api(value = "用户个人中心",tags = "用户个人中心信息展示,信息修改") +public interface UserControllerApi { + + @ApiOperation(value = "个人中心信息展示",notes = "个人中心信息展示") + R userInfo(Integer id); + + @ApiOperation(value = "个人中心信息修改",notes = "个人中心信息修改") + R update(UserEntity userEntity); + +} diff --git a/src/main/java/com/msdw/tms/common/utils/Constant.java b/src/main/java/com/msdw/tms/common/utils/Constant.java index 5012c08..5ee4add 100644 --- a/src/main/java/com/msdw/tms/common/utils/Constant.java +++ b/src/main/java/com/msdw/tms/common/utils/Constant.java @@ -342,19 +342,25 @@ public class Constant { } } - public enum Submit{ - SUBMIT (1,"已提交"), - NOT_SUBMIT (0,"未提交"); + /** + * 项目是否提交 + */ + public enum Submit { + SUBMIT(1, "已提交"), + NOT_SUBMIT(0, "未提交"); - private Integer type; - private String desc; - Submit(Integer type, String desc){ + private Integer type; + private String desc; + + Submit(Integer type, String desc) { this.type = type; this.desc = desc; - }; + } + + ; public Integer getType() { return type; @@ -373,18 +379,33 @@ public class Constant { } } + public enum Ascription { + + SYSTEM(1, "系统内置"), + USER(0, "用户自建"); + + private Integer type; + private String desc; + + Ascription(Integer type, String desc) { + this.type = type; + this.desc = desc; + }; + + public Integer getType() { + return type; + } + + public void setType(Integer type) { + this.type = type; + } + + public String getDesc() { + return desc; + } -// public static void main(String[] args) { -// String answer = "A"; -//// System.out.println(answer.length());//3 -//// System.out.println(answer.charAt(2));//E -// -// String str = ""; -// for (int i = 0; i < answer.length(); i++) { -// char c = answer.charAt(i); -// str += c + ","; -// } -// str = str.substring(0, str.length() - 1); -// System.out.println(str); -// } + public void setDesc(String desc) { + this.desc = desc; + } + } } \ No newline at end of file diff --git a/src/main/java/com/msdw/tms/common/utils/date/DateUtils.java b/src/main/java/com/msdw/tms/common/utils/date/DateUtils.java new file mode 100644 index 0000000..1260619 --- /dev/null +++ b/src/main/java/com/msdw/tms/common/utils/date/DateUtils.java @@ -0,0 +1,17 @@ +package com.msdw.tms.common.utils.date; + +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.time.format.DateTimeFormatter; +import java.util.Date; + +public class DateUtils { + + public static String handleTime(Date date) { + Instant instant = date.toInstant(); + ZoneId zoneId = ZoneId.systemDefault(); + LocalDateTime localDateTime = instant.atZone(zoneId).toLocalDateTime(); + return localDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); // 当前日期和时间 + } +} diff --git a/src/main/java/com/msdw/tms/controller/PersonalFileController.java b/src/main/java/com/msdw/tms/controller/PersonalFileController.java new file mode 100644 index 0000000..75980fc --- /dev/null +++ b/src/main/java/com/msdw/tms/controller/PersonalFileController.java @@ -0,0 +1,73 @@ +package com.msdw.tms.controller; + +import com.msdw.tms.common.utils.R; +import com.msdw.tms.entity.PersonalFileEntity; +import com.msdw.tms.entity.vo.PersonalFileVo; +import com.msdw.tms.service.PersonalFileService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Arrays; +import java.util.List; + +@RestController +@RequestMapping("tms/personalFile") +public class PersonalFileController { + + @Autowired + private PersonalFileService personalFileService; + + + /** + * 列表 + */ + @GetMapping("/list/{userId}") + public R list(@PathVariable("userId") Integer userid){ + List personalFileVos = personalFileService.queryPage(userid); + + return R.ok().put("data", personalFileVos); + } + + + /** + * 信息 + */ + @GetMapping("/info/{id}") + public R info(@PathVariable("id") Long id){ + PersonalFileEntity personalFileEntity = personalFileService.getById(id); + + return R.ok().put("growthChangeHistory", personalFileEntity); + } + + /** + * 保存 + */ + @PostMapping("/save") + public R save(@RequestBody PersonalFileEntity personalFileEntity){ + personalFileService.save(personalFileEntity); + + return R.ok(); + } + + /** + * 修改 + */ + @PutMapping("/update") + public R update(@RequestBody PersonalFileEntity personalFileEntity){ + personalFileService.updateById(personalFileEntity); + + return R.ok(); + } + + /** + * 删除 + */ + @DeleteMapping("/delete") + public R delete(@RequestBody Long[] ids){ + personalFileService.removeByIds(Arrays.asList(ids)); + + return R.ok(); + } + + +} diff --git a/src/main/java/com/msdw/tms/controller/ProjectController.java b/src/main/java/com/msdw/tms/controller/ProjectController.java index 8a85f1f..09014af 100644 --- a/src/main/java/com/msdw/tms/controller/ProjectController.java +++ b/src/main/java/com/msdw/tms/controller/ProjectController.java @@ -8,6 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.Arrays; +import java.util.HashMap; import java.util.Map; @@ -28,18 +29,29 @@ public class ProjectController { /** * 列表 */ - @RequestMapping("/list") + @GetMapping("/list") public R list(@RequestParam Map params){ PageUtils page = projectService.queryPage(params); return R.ok().put("page", page); } + /** + * 用户端-实验项目 + * @param userId + * @return + */ + @GetMapping("/projects/info/{userid}") + public R list(@PathVariable("userid") Integer userId){ + HashMap result = projectService.list(userId); + + return R.ok().put("data", result); + } /** * 信息 */ - @RequestMapping("/info/{projectid}") + @GetMapping("/info/{projectid}") public R info(@PathVariable("projectid") Integer projectid){ ProjectEntity project = projectService.getById(projectid); @@ -59,7 +71,7 @@ public class ProjectController { /** * 修改 */ - @RequestMapping("/update") + @PutMapping("/update") public R update(@RequestBody ProjectEntity project){ projectService.updateById(project); @@ -69,7 +81,7 @@ public class ProjectController { /** * 删除 */ - @RequestMapping("/delete") + @DeleteMapping("/delete") public R delete(@RequestBody Integer[] projectids){ projectService.removeByIds(Arrays.asList(projectids)); diff --git a/src/main/java/com/msdw/tms/controller/ProjectRecordController.java b/src/main/java/com/msdw/tms/controller/ProjectRecordController.java index b3f0c8a..156fac3 100644 --- a/src/main/java/com/msdw/tms/controller/ProjectRecordController.java +++ b/src/main/java/com/msdw/tms/controller/ProjectRecordController.java @@ -1,15 +1,17 @@ package com.msdw.tms.controller; +import com.msdw.tms.api.ProjectRcordControllerApi; import com.msdw.tms.common.utils.PageUtils; import com.msdw.tms.common.utils.R; import com.msdw.tms.entity.ProjectRecordEntity; +import com.msdw.tms.entity.vo.ProjectRecordVo; import com.msdw.tms.service.ProjectRecordService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletResponse; import java.util.Arrays; -import java.util.Map; - /** * @@ -20,25 +22,58 @@ import java.util.Map; */ @RestController @RequestMapping("fictitious/projectrecord") -public class ProjectRecordController { +public class ProjectRecordController implements ProjectRcordControllerApi { @Autowired private ProjectRecordService projectRecordService; /** - * 列表 + * 服务端实验报告 */ - @RequestMapping("/list") - public R list(@RequestParam Map params){ - PageUtils page = projectRecordService.queryPage(params); + @GetMapping("/schoolRecord") + public R list(@RequestParam Integer page, @RequestParam Integer size, @RequestParam Integer month,@RequestParam String startTime,@RequestParam String endTime, + @RequestParam Integer recordState,@RequestParam String condition ){ + ProjectRecordVo recordVo = new ProjectRecordVo(); + if(!StringUtils.isEmpty(month)) { + recordVo.setMonth(month); + }if(!StringUtils.isEmpty(startTime)) { + recordVo.setStartTime(startTime); + }if(!StringUtils.isEmpty(endTime)) { + recordVo.setEndTime(endTime); + }if(!StringUtils.isEmpty(recordState)) { + recordVo.setRecordstate(recordState); + }if(!StringUtils.isEmpty(condition)){ + recordVo.setCondition(condition); + } + PageUtils page1 = projectRecordService.querySchoolRecord(page,size,recordVo); + + return R.ok().put("page", page1); + } + + + + @GetMapping("/user/record") + public R queryUserRecord(@RequestParam Integer page,@RequestParam Integer size,@RequestParam Integer userid){ + PageUtils page1 = projectRecordService.queryPage(page,size,userid); - return R.ok().put("page", page); + return R.ok().put("data", page1); } + @GetMapping("/user/score/{userId}") + public R getUserScore(@PathVariable("userId") Integer userid){ + ProjectRecordVo projectRecord = projectRecordService.queryUserScore(userid); + + return R.ok().put("data", projectRecord); + } + + @GetMapping("/user/exportProjectRecord") + public void exportProjectRecord(HttpServletResponse response,@RequestParam("userId") Integer userId)throws Exception{ + projectRecordService.exportProjectRecord(response,userId); + } /** * 信息 */ - @RequestMapping("/info/{recordid}") + @GetMapping("/info/{recordid}") public R info(@PathVariable("recordid") Integer recordid){ ProjectRecordEntity projectRecord = projectRecordService.getById(recordid); @@ -58,17 +93,17 @@ public class ProjectRecordController { /** * 修改 */ - @RequestMapping("/update") + @PutMapping("/update") public R update(@RequestBody ProjectRecordEntity projectRecord){ - projectRecordService.updateById(projectRecord); + boolean result = projectRecordService.updateUserRecord(projectRecord); - return R.ok(); + return R.ok().put("data",result); } /** * 删除 */ - @RequestMapping("/delete") + @DeleteMapping("/delete") public R delete(@RequestBody Integer[] recordids){ projectRecordService.removeByIds(Arrays.asList(recordids)); diff --git a/src/main/java/com/msdw/tms/controller/UserController.java b/src/main/java/com/msdw/tms/controller/UserController.java new file mode 100644 index 0000000..84093be --- /dev/null +++ b/src/main/java/com/msdw/tms/controller/UserController.java @@ -0,0 +1,81 @@ +package com.msdw.tms.controller; + +import com.msdw.tms.api.UserControllerApi; +import com.msdw.tms.common.utils.PageUtils; +import com.msdw.tms.common.utils.R; +import com.msdw.tms.entity.UserEntity; +import com.msdw.tms.entity.vo.UserEntityVo; +import com.msdw.tms.service.UserService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Arrays; +import java.util.Map; + +@RestController +@RequestMapping("tms/user") +public class UserController implements UserControllerApi { + + @Autowired + private UserService userService; + + /** + * 列表 + */ + @GetMapping("/list") + public R list(@RequestParam Map params){ + PageUtils page = userService.queryPage(params); + + return R.ok().put("page", page); + } + + + /** + * 信息 + */ + @GetMapping("/info/{id}") + public R info(@PathVariable("id") Long id){ + UserEntity userEntity = userService.getById(id); + + return R.ok().put("growthChangeHistory", userEntity); + } + + @GetMapping("/userinfo/{id}") + public R userInfo(@PathVariable("id") Integer id){ + UserEntityVo userEntityVo = userService.queryUserId(id); + return R.ok().put("data",userEntityVo); + } + + /** + * 保存 + */ + @RequestMapping("/save") + public R save(@RequestBody UserEntity userEntity){ + userService.save(userEntity); + + return R.ok(); + } + + /** + * 修改 + */ + @PutMapping("/update") + public R update(@RequestBody UserEntity userEntity){ + userService.updateById(userEntity); + + return R.ok(); + } + + /** + * 删除 + */ + @DeleteMapping("/delete") + public R delete(@RequestBody Long[] ids){ + userService.removeByIds(Arrays.asList(ids)); + + return R.ok(); + } + + + +} diff --git a/src/main/java/com/msdw/tms/dao/PersonalFileDao.java b/src/main/java/com/msdw/tms/dao/PersonalFileDao.java new file mode 100644 index 0000000..47066f6 --- /dev/null +++ b/src/main/java/com/msdw/tms/dao/PersonalFileDao.java @@ -0,0 +1,15 @@ +package com.msdw.tms.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.msdw.tms.entity.PersonalFileEntity; +import com.msdw.tms.entity.vo.PersonalFileVo; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface PersonalFileDao extends BaseMapper { + + List getPersonalfiles(PersonalFileEntity PersonalFileEntity); + +} diff --git a/src/main/java/com/msdw/tms/dao/ProjectDao.java b/src/main/java/com/msdw/tms/dao/ProjectDao.java index 595fc38..a365dc1 100644 --- a/src/main/java/com/msdw/tms/dao/ProjectDao.java +++ b/src/main/java/com/msdw/tms/dao/ProjectDao.java @@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.msdw.tms.entity.ProjectEntity; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * * @@ -14,4 +16,8 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface ProjectDao extends BaseMapper { + public List getByUserId(ProjectEntity projectEntity); + + public List querySystem(ProjectEntity projectEntity); + } diff --git a/src/main/java/com/msdw/tms/dao/ProjectRecordDao.java b/src/main/java/com/msdw/tms/dao/ProjectRecordDao.java index ef1642c..ee3d742 100644 --- a/src/main/java/com/msdw/tms/dao/ProjectRecordDao.java +++ b/src/main/java/com/msdw/tms/dao/ProjectRecordDao.java @@ -1,8 +1,14 @@ package com.msdw.tms.dao; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.msdw.tms.entity.ProjectRecordEntity; +import com.msdw.tms.entity.vo.ProjectRecordVo; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * @@ -14,4 +20,14 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface ProjectRecordDao extends BaseMapper { + IPage getByUserRecord(Page page,@Param("pro") ProjectRecordEntity projectRecordEntity); + + List getByUserRecordImport(ProjectRecordEntity projectRecordEntity); + + ProjectRecordVo getByUserScore(@Param("userid") Integer userId,@Param("isdel") Integer isdel); + + IPage getBySchoolRecord(Page page,@Param("pro") ProjectRecordVo projectRecord); + + boolean updateUserRecord(ProjectRecordEntity projectRecord); + } diff --git a/src/main/java/com/msdw/tms/dao/UserDao.java b/src/main/java/com/msdw/tms/dao/UserDao.java new file mode 100644 index 0000000..47a096e --- /dev/null +++ b/src/main/java/com/msdw/tms/dao/UserDao.java @@ -0,0 +1,15 @@ +package com.msdw.tms.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.msdw.tms.entity.UserEntity; +import com.msdw.tms.entity.vo.UserEntityVo; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface UserDao extends BaseMapper { + + UserEntityVo getByUserId(UserEntity userEntity); + + + +} diff --git a/src/main/java/com/msdw/tms/entity/PersonalFileEntity.java b/src/main/java/com/msdw/tms/entity/PersonalFileEntity.java new file mode 100644 index 0000000..bae2693 --- /dev/null +++ b/src/main/java/com/msdw/tms/entity/PersonalFileEntity.java @@ -0,0 +1,43 @@ +package com.msdw.tms.entity; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; + +@Data +@TableName("hr_personal_file") +public class PersonalFileEntity implements Serializable { + + /** + * 个人档案id + */ + @TableId + private Integer personalfileid; + /** + * 个人职业id(1、学生 2、老师) + */ + private Integer personalcareerid; + /** + * 学校id + */ + private Integer schoolid; + /** + * 绑定学科id + */ + private Integer disciplineid; + /** + * 绑定专业类id + */ + private Integer professionalclassid; + /** + * 绑定专业id + */ + private Integer professionalid; + /** + * 绑定专业id + */ + private Integer userid; + +} diff --git a/src/main/java/com/msdw/tms/entity/ProjectEntity.java b/src/main/java/com/msdw/tms/entity/ProjectEntity.java index c6ba9f9..eaa6e5c 100644 --- a/src/main/java/com/msdw/tms/entity/ProjectEntity.java +++ b/src/main/java/com/msdw/tms/entity/ProjectEntity.java @@ -3,6 +3,7 @@ package com.msdw.tms.entity; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; +import lombok.experimental.Accessors; import java.io.Serializable; import java.util.Date; @@ -14,9 +15,10 @@ import java.util.Date; * @email * @date 2020-08-19 16:07:02 */ +@Accessors(chain = true) @Data @TableName("tms_project") -public class ProjectEntity implements Serializable { +public class ProjectEntity implements Serializable, Comparable { private static final long serialVersionUID = 1L; @@ -66,4 +68,9 @@ public class ProjectEntity implements Serializable { */ private Integer isdel; + @Override + public int compareTo(Object o) { + ProjectEntity projectEntity = (ProjectEntity) o; + return this.projectid - projectEntity.projectid; + } } diff --git a/src/main/java/com/msdw/tms/entity/ProjectRecordEntity.java b/src/main/java/com/msdw/tms/entity/ProjectRecordEntity.java index 7ac6665..2ef118b 100644 --- a/src/main/java/com/msdw/tms/entity/ProjectRecordEntity.java +++ b/src/main/java/com/msdw/tms/entity/ProjectRecordEntity.java @@ -1,8 +1,10 @@ package com.msdw.tms.entity; import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; +import lombok.experimental.Accessors; import java.io.Serializable; import java.util.Date; @@ -15,6 +17,7 @@ import java.util.Date; * @date 2020-08-19 16:07:02 */ @Data +@Accessors(chain = true) @TableName("tms_project_record") public class ProjectRecordEntity implements Serializable { private static final long serialVersionUID = 1L; @@ -48,6 +51,10 @@ public class ProjectRecordEntity implements Serializable { * 结束时间 */ private Date endtime; + /** + * 耗时 + */ + private Integer timeSum; /** * 提交时间 */ @@ -55,6 +62,7 @@ public class ProjectRecordEntity implements Serializable { /** * 删除(0未删除 1已删除) */ + @TableLogic(value = "0",delval = "1") private Integer isdel; } diff --git a/src/main/java/com/msdw/tms/entity/UserEntity.java b/src/main/java/com/msdw/tms/entity/UserEntity.java index 69cb3f3..062ed53 100644 --- a/src/main/java/com/msdw/tms/entity/UserEntity.java +++ b/src/main/java/com/msdw/tms/entity/UserEntity.java @@ -1,13 +1,19 @@ package com.msdw.tms.entity; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; +import lombok.experimental.Accessors; +@Accessors(chain = true) @Data +@TableName("hr_user_info") public class UserEntity { //用户id - private Integer userId; + @TableId + private Integer userid; //用户姓名 - private String userName; + private String username; //用户账号 private String account; //用户密码 @@ -15,34 +21,36 @@ public class UserEntity { //国家 private String countries; //绑定省份id - private Integer provinceId; + private Integer provinceid; //绑定城市id - private Integer cityId; + private Integer cityid; //创建时间 - private String creationTime; + private String creationtime; //登陆次数 - private Integer logInNumber; + private Integer loginnumber; //性别 private Integer sex; //证件类型(1、身份证) - private Integer documentType; + private Integer documenttype; //身份证 - private String IDNumber; + private String idnumber; //教育程度(1、研究数及以上) - private Integer educationDegree; + private Integer educationdegree; //电话 private String phone; //微信账号 - private String WeChatID; + private String wechatid; //出生日期 - private String dateBirth; + private String datebirth; //邮箱 private String email; //学校id - private Integer schoolId; + private Integer schoolid; //唯一标示性账号 - private String uniqueIdentificationAccount; + private String uniqueidentificationaccount; //用户头像路径 - private String userAvatars; + private String useravatars; + //是否删除 + private Integer isdel; } diff --git a/src/main/java/com/msdw/tms/entity/request/ProjectRecordImportRequest.java b/src/main/java/com/msdw/tms/entity/request/ProjectRecordImportRequest.java new file mode 100644 index 0000000..b250786 --- /dev/null +++ b/src/main/java/com/msdw/tms/entity/request/ProjectRecordImportRequest.java @@ -0,0 +1,41 @@ +package com.msdw.tms.entity.request; + +import com.msdw.tms.common.utils.poi.ExcelAttribute; +import lombok.Data; + +@Data +public class ProjectRecordImportRequest { + + /** + * 实验项目名称 + */ + @ExcelAttribute(sort = 0) + private String projectName; + /** + * 状态 + */ + @ExcelAttribute(sort = 1) + private String userRecordstate; + + private Integer recordstate; + /** + * 得分 + */ + @ExcelAttribute(sort = 2) + private Integer score; + /** + * 耗时 + */ + @ExcelAttribute(sort = 3) + private Integer timeSum; + /** + * 起始时间 + */ + @ExcelAttribute(sort = 4) + private String startTime; + /** + * 结束时间 + */ + @ExcelAttribute(sort = 5) + private String endTime; +} diff --git a/src/main/java/com/msdw/tms/entity/vo/PersonalFileVo.java b/src/main/java/com/msdw/tms/entity/vo/PersonalFileVo.java new file mode 100644 index 0000000..f4d25ee --- /dev/null +++ b/src/main/java/com/msdw/tms/entity/vo/PersonalFileVo.java @@ -0,0 +1,28 @@ +package com.msdw.tms.entity.vo; + +import com.msdw.tms.entity.PersonalFileEntity; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class PersonalFileVo extends PersonalFileEntity implements Serializable { + + /** + * 学校名称 + */ + private String schoolName; + /** + * 学科名称 + */ + private String disciplineName; + /** + * 专业类名称 + */ + private String professionalClassName; + /** + * 专业名称 + */ + private String professionalName; + +} diff --git a/src/main/java/com/msdw/tms/entity/vo/ProjectEntityVo.java b/src/main/java/com/msdw/tms/entity/vo/ProjectEntityVo.java deleted file mode 100644 index b549376..0000000 --- a/src/main/java/com/msdw/tms/entity/vo/ProjectEntityVo.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.msdw.tms.entity.vo; - -import java.io.Serializable; - -public class ProjectEntityVo implements Serializable { - - private Integer RoleId; - -} diff --git a/src/main/java/com/msdw/tms/entity/vo/ProjectRecordVo.java b/src/main/java/com/msdw/tms/entity/vo/ProjectRecordVo.java new file mode 100644 index 0000000..8cc25c8 --- /dev/null +++ b/src/main/java/com/msdw/tms/entity/vo/ProjectRecordVo.java @@ -0,0 +1,59 @@ +package com.msdw.tms.entity.vo; + +import com.msdw.tms.entity.ProjectRecordEntity; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ProjectRecordVo extends ProjectRecordEntity implements Serializable { + + /** + * 实验项目名称 + */ + private String projectName; + /** + * 学校名称 + */ + private String SchoolName; + /** + * 用户名称 + */ + private String userName; + /** + * 实验次数 + */ + private Integer experimentNumber; + /** + * 总耗时 + */ + private Integer totalTime; + /** + * 平均分 + */ + private double avgScore; + /** + * 几个月 + */ + private Integer month; + /** + * 查询条件 + */ + private String condition; + /** + * 开始时间 + */ + private String startTime; + /** + * 结束时间 + */ + private String endTime; + /** + * 完成数量 + */ + private Integer complete; + /** + * 待评分 + */ + private Integer tobescored; +} diff --git a/src/main/java/com/msdw/tms/feign/UserEntityFeignService.java b/src/main/java/com/msdw/tms/feign/UserEntityFeignService.java new file mode 100644 index 0000000..663b2c9 --- /dev/null +++ b/src/main/java/com/msdw/tms/feign/UserEntityFeignService.java @@ -0,0 +1,13 @@ +package com.msdw.tms.feign; + +import org.springframework.cloud.openfeign.FeignClient; +import com.msdw.tms.common.utils.R; +import org.springframework.web.bind.annotation.RequestMapping; + +@FeignClient +public interface UserEntityFeignService { + + @RequestMapping("userInfo/queryUserInfo") + public R getUser(); + +} diff --git a/src/main/java/com/msdw/tms/service/PersonalFileService.java b/src/main/java/com/msdw/tms/service/PersonalFileService.java new file mode 100644 index 0000000..e508108 --- /dev/null +++ b/src/main/java/com/msdw/tms/service/PersonalFileService.java @@ -0,0 +1,12 @@ +package com.msdw.tms.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.msdw.tms.entity.PersonalFileEntity; +import com.msdw.tms.entity.vo.PersonalFileVo; + +import java.util.List; + +public interface PersonalFileService extends IService { + + List queryPage(Integer userid); +} diff --git a/src/main/java/com/msdw/tms/service/ProjectRecordService.java b/src/main/java/com/msdw/tms/service/ProjectRecordService.java index 663bdc6..eedcfbb 100644 --- a/src/main/java/com/msdw/tms/service/ProjectRecordService.java +++ b/src/main/java/com/msdw/tms/service/ProjectRecordService.java @@ -3,8 +3,9 @@ package com.msdw.tms.service; import com.baomidou.mybatisplus.extension.service.IService; import com.msdw.tms.common.utils.PageUtils; import com.msdw.tms.entity.ProjectRecordEntity; +import com.msdw.tms.entity.vo.ProjectRecordVo; -import java.util.Map; +import javax.servlet.http.HttpServletResponse; /** * @@ -15,6 +16,14 @@ import java.util.Map; */ public interface ProjectRecordService extends IService { - PageUtils queryPage(Map params); + PageUtils queryPage(Integer page,Integer size,Integer userid); + + ProjectRecordVo queryUserScore(Integer userId); + + void exportProjectRecord(HttpServletResponse response,Integer userId)throws Exception; + + PageUtils querySchoolRecord(Integer page,Integer size,ProjectRecordVo projectRecord); + + boolean updateUserRecord(ProjectRecordEntity projectRecord); } diff --git a/src/main/java/com/msdw/tms/service/ProjectService.java b/src/main/java/com/msdw/tms/service/ProjectService.java index accc909..06bde4f 100644 --- a/src/main/java/com/msdw/tms/service/ProjectService.java +++ b/src/main/java/com/msdw/tms/service/ProjectService.java @@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.msdw.tms.common.utils.PageUtils; import com.msdw.tms.entity.ProjectEntity; -import java.util.List; +import java.util.HashMap; import java.util.Map; /** @@ -18,6 +18,6 @@ public interface ProjectService extends IService { PageUtils queryPage(Map params); - public List list(Integer page, Integer size,ProjectEntity project); + HashMap list(Integer userId); } diff --git a/src/main/java/com/msdw/tms/service/UserService.java b/src/main/java/com/msdw/tms/service/UserService.java new file mode 100644 index 0000000..da5422b --- /dev/null +++ b/src/main/java/com/msdw/tms/service/UserService.java @@ -0,0 +1,16 @@ +package com.msdw.tms.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.msdw.tms.common.utils.PageUtils; +import com.msdw.tms.entity.UserEntity; +import com.msdw.tms.entity.vo.UserEntityVo; + +import java.util.Map; + +public interface UserService extends IService { + + PageUtils queryPage(Map params); + + UserEntityVo queryUserId(Integer userId); + +} diff --git a/src/main/java/com/msdw/tms/service/impl/PersonalFileServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/PersonalFileServiceImpl.java new file mode 100644 index 0000000..7233014 --- /dev/null +++ b/src/main/java/com/msdw/tms/service/impl/PersonalFileServiceImpl.java @@ -0,0 +1,24 @@ +package com.msdw.tms.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.msdw.tms.dao.PersonalFileDao; +import com.msdw.tms.entity.PersonalFileEntity; +import com.msdw.tms.entity.vo.PersonalFileVo; +import com.msdw.tms.service.PersonalFileService; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service("personalFileService") +public class PersonalFileServiceImpl extends ServiceImpl implements PersonalFileService { + + @Override + public List queryPage(Integer userid) { + PersonalFileDao baseMapper = this.getBaseMapper(); + PersonalFileEntity entity = new PersonalFileEntity(); + entity.setUserid(userid); + List personalfiles = baseMapper.getPersonalfiles(entity); + return personalfiles; + } + +} diff --git a/src/main/java/com/msdw/tms/service/impl/ProjectRecordServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/ProjectRecordServiceImpl.java index 0430590..558968b 100644 --- a/src/main/java/com/msdw/tms/service/impl/ProjectRecordServiceImpl.java +++ b/src/main/java/com/msdw/tms/service/impl/ProjectRecordServiceImpl.java @@ -1,29 +1,95 @@ package com.msdw.tms.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.msdw.tms.common.utils.Constant; import com.msdw.tms.common.utils.PageUtils; -import com.msdw.tms.common.utils.Query; +import com.msdw.tms.common.utils.poi.ExcelExportUtil; import com.msdw.tms.dao.ProjectRecordDao; import com.msdw.tms.entity.ProjectRecordEntity; +import com.msdw.tms.entity.request.ProjectRecordImportRequest; +import com.msdw.tms.entity.vo.ProjectRecordVo; import com.msdw.tms.service.ProjectRecordService; +import org.apache.poi.ss.formula.functions.T; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.io.ClassPathResource; import org.springframework.stereotype.Service; -import java.util.Map; +import javax.servlet.http.HttpServletResponse; +import java.io.FileInputStream; +import java.util.List; +import java.util.stream.Collectors; @Service("projectRecordService") public class ProjectRecordServiceImpl extends ServiceImpl implements ProjectRecordService { + @Autowired + private ProjectRecordDao baseMapper; + + @Override + public PageUtils queryPage(Integer page,Integer size,Integer userid) { + + ProjectRecordEntity projectRecord = new ProjectRecordEntity().setUserid(userid).setIsdel(Constant.IsDel.NOT_DEL.getType()); + + //分页对象 + Page page1 = new Page<>(page, size); + + IPage projectRecordVos = this.baseMapper.getByUserRecord(page1,projectRecord); + + PageUtils questionsPage = new PageUtils(projectRecordVos); + + return questionsPage; + } + @Override - public PageUtils queryPage(Map params) { - IPage page = this.page( - new Query().getPage(params), - new QueryWrapper() - ); + public ProjectRecordVo queryUserScore(Integer userId) { - return new PageUtils(page); + Integer isdel = Constant.IsDel.NOT_DEL.getType(); + ProjectRecordVo projectRecordVo = this.baseMapper.getByUserScore(userId ,isdel); + + return projectRecordVo; } + @Override + public void exportProjectRecord(HttpServletResponse response,Integer userId)throws Exception{ + //获取数据 + ProjectRecordEntity projectRecord = new ProjectRecordEntity().setUserid(userId).setIsdel(Constant.IsDel.NOT_DEL.getType()); + + List projectRecordVos = this.baseMapper.getByUserRecordImport(projectRecord); + + List importRequests = projectRecordVos.stream().map(project -> { + ProjectRecordImportRequest request = new ProjectRecordImportRequest(); + BeanUtils.copyProperties(project, request); + request.setUserRecordstate(project.getRecordstate().equals(1) ? "已完成":"待评分"); + return request; + }).collect(Collectors.toList()); + + //2.加载模板流数据 + org.springframework.core.io.Resource resource = new ClassPathResource("excel-template/实验报告导出模板.xlsx"); + FileInputStream fis = new FileInputStream(resource.getFile()); + + //3、通过工具类下载文件 + new ExcelExportUtil(ProjectRecordImportRequest.class, Constant.STARTING_ROW, Constant.STYLE_INDEX). + export(response, fis, importRequests, "实验报告导出.xlsx"); + } + + @Override + public PageUtils querySchoolRecord(Integer page, Integer size, ProjectRecordVo projectRecord) { + + //分页对象 + Page page1 = new Page<>(page, size); + projectRecord.setIsdel(Constant.IsDel.NOT_DEL.getType()); + IPage schoolRecord = this.baseMapper.getBySchoolRecord(page1, projectRecord); + PageUtils pageUtils = new PageUtils(schoolRecord); + return pageUtils; + } + + @Override + public boolean updateUserRecord(ProjectRecordEntity projectRecord) { + boolean result = this.baseMapper.updateUserRecord(projectRecord); + return result; + } } \ No newline at end of file diff --git a/src/main/java/com/msdw/tms/service/impl/ProjectServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/ProjectServiceImpl.java index 294626f..399e574 100644 --- a/src/main/java/com/msdw/tms/service/impl/ProjectServiceImpl.java +++ b/src/main/java/com/msdw/tms/service/impl/ProjectServiceImpl.java @@ -11,13 +11,13 @@ import com.msdw.tms.entity.ProjectEntity; import com.msdw.tms.service.ProjectService; import org.springframework.stereotype.Service; -import java.util.List; -import java.util.Map; +import java.util.*; @Service("projectService") public class ProjectServiceImpl extends ServiceImpl implements ProjectService { + @Override public PageUtils queryPage(Map params) { IPage page = this.page( @@ -30,23 +30,30 @@ public class ProjectServiceImpl extends ServiceImpl i } @Override - public List list(Integer page, Integer size,ProjectEntity project) { + public HashMap list(Integer userId) { - //请求包装类 - QueryWrapper queryWrapper = new QueryWrapper<>(); + ProjectDao baseMapper = this.getBaseMapper(); - Integer userid = project.getUserid(); - queryWrapper.eq("is_del", Constant.IsDel.NOT_DEL.getType()) - .eq("projectState", Constant.Submit.SUBMIT.getType()) - .eq("userId",userid); + ProjectEntity project = new ProjectEntity().setUserid(userId) + .setAscription(Constant.Ascription.SYSTEM.getType()) + .setProjectstate(Constant.Submit.SUBMIT.getType()) + .setIsdel(Constant.IsDel.NOT_DEL.getType()); - queryWrapper.select("projectId","projectName").groupBy("projectId"); + List projects = new ArrayList<>(); + List user_projects = baseMapper.getByUserId(project); + List sys_projects = baseMapper.querySystem(project); - IPage projects = this.page( - new Query().getPage(page, size), - queryWrapper - ); + projects.addAll(0,user_projects); + projects.addAll(0, sys_projects); + + Collections.sort(projects); - return null; + HashMap result = new HashMap<>(); + for (ProjectEntity pro : projects ) { + result.put(pro.getProjectid(),pro); + } + + return result; } + } \ No newline at end of file diff --git a/src/main/java/com/msdw/tms/service/impl/UserServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/UserServiceImpl.java new file mode 100644 index 0000000..0525ad5 --- /dev/null +++ b/src/main/java/com/msdw/tms/service/impl/UserServiceImpl.java @@ -0,0 +1,39 @@ +package com.msdw.tms.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.msdw.tms.common.utils.Constant; +import com.msdw.tms.common.utils.PageUtils; +import com.msdw.tms.common.utils.Query; +import com.msdw.tms.dao.UserDao; +import com.msdw.tms.entity.UserEntity; +import com.msdw.tms.entity.vo.UserEntityVo; +import com.msdw.tms.service.UserService; +import org.springframework.stereotype.Service; + +import java.util.Map; + +@Service("userService") +public class UserServiceImpl extends ServiceImpl implements UserService { + + @Override + public PageUtils queryPage(Map params) { + + IPage page = this.page( + new Query().getPage(params), + new QueryWrapper() + ); + return new PageUtils(page); + } + + @Override + public UserEntityVo queryUserId(Integer userId) { + + UserDao userDao = this.getBaseMapper(); + UserEntity userEntity = new UserEntity(); + userEntity.setUserid(userId).setIsdel(Constant.IsDel.NOT_DEL.getType()); + UserEntityVo vo = userDao.getByUserId(userEntity); + return vo; + } +} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index a9643f9..8e3c54e 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,4 +1,6 @@ spring: + jackson: + default-property-inclusion: non_null datasource: url: jdbc:mysql://www.liuwanr.cn:3306/huoran?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai username: super @@ -15,6 +17,9 @@ mybatis-plus: global-config: db-config: id-type: auto + logic-delete-field: is_del + logic-delete-value: 0 + logic-not-delete-value: 1 server: port: 7000 diff --git a/src/main/resources/excel-template/实验报告导出.xlsx b/src/main/resources/excel-template/实验报告导出.xlsx new file mode 100644 index 0000000..d979a8c Binary files /dev/null and b/src/main/resources/excel-template/实验报告导出.xlsx differ diff --git a/src/main/resources/excel-template/实验报告导出模板.xlsx b/src/main/resources/excel-template/实验报告导出模板.xlsx new file mode 100644 index 0000000..03a2749 Binary files /dev/null and b/src/main/resources/excel-template/实验报告导出模板.xlsx differ diff --git a/src/main/resources/mapper/tms/PersonalFileDao.xml b/src/main/resources/mapper/tms/PersonalFileDao.xml new file mode 100644 index 0000000..e465b7d --- /dev/null +++ b/src/main/resources/mapper/tms/PersonalFileDao.xml @@ -0,0 +1,32 @@ + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/mapper/tms/ProjectDao.xml b/src/main/resources/mapper/tms/ProjectDao.xml index 07400aa..42b691a 100644 --- a/src/main/resources/mapper/tms/ProjectDao.xml +++ b/src/main/resources/mapper/tms/ProjectDao.xml @@ -15,8 +15,16 @@ - + + + + + \ No newline at end of file diff --git a/src/main/resources/mapper/tms/ProjectRecordDao.xml b/src/main/resources/mapper/tms/ProjectRecordDao.xml index e4c6ea0..280f230 100644 --- a/src/main/resources/mapper/tms/ProjectRecordDao.xml +++ b/src/main/resources/mapper/tms/ProjectRecordDao.xml @@ -1,10 +1,10 @@ - + - + @@ -12,9 +12,97 @@ - + + + + + + + + + + + update tms_project_record + set isdel = #{isdel} + ,recordstate = #{recordstate} + where recordId=#{recordid} + \ No newline at end of file diff --git a/src/main/resources/mapper/tms/UserDao.xml b/src/main/resources/mapper/tms/UserDao.xml new file mode 100644 index 0000000..d81c90e --- /dev/null +++ b/src/main/resources/mapper/tms/UserDao.xml @@ -0,0 +1,38 @@ + + + + + + + + + \ No newline at end of file