diff --git a/api/pom.xml b/api/pom.xml new file mode 100644 index 0000000..49fde8c --- /dev/null +++ b/api/pom.xml @@ -0,0 +1,24 @@ + + + + huoran + com.huoran.parent + 1.0-SNAPSHOT + + 4.0.0 + + com.huoran.api + api + api模块 + + + + com.huoran.common + common + 0.0.1-SNAPSHOT + + + + \ No newline at end of file diff --git a/api/src/main/java/com/huoran/api/NakadaiClient.java b/api/src/main/java/com/huoran/api/NakadaiClient.java new file mode 100644 index 0000000..9e0e60c --- /dev/null +++ b/api/src/main/java/com/huoran/api/NakadaiClient.java @@ -0,0 +1,117 @@ +package com.huoran.api; + +import com.huoran.api.impl.NakadaiClientImpl; +import com.huoran.common.constant.ServiceNameConstant; +import com.huoran.common.entity.School; +import com.huoran.common.entity.to.JudgmentPointDataTo; +import com.huoran.common.response.R; +import com.huoran.config.FeignSimpleEncoderConfig; +import feign.Headers; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + * @Author cheney + * @DATE 2021/7/15 10:09 + * @Version 1.0 + * 远程调用中台 + */ +@FeignClient(value = ServiceNameConstant.NAKADAI, + fallbackFactory = NakadaiClientImpl.class, configuration = FeignSimpleEncoderConfig.class) +@Headers("Accept: application/json") +public interface NakadaiClient { + + /** + * 查询客户订单 + */ + @Headers({"Content-Type: application/json", "Accept: application/json"}) + @GetMapping(value = "/nakadai/nakadai/order/getCustomerOrder", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) + R getCustomerOrder(@RequestParam("customerId") Integer customerId); + + /** + * 查询订单其他信息 + */ + @Headers({"Content-Type: application/json", "Accept: application/json"}) + @GetMapping(value = "/nakadai/nakadai/orderOther/getOrderOther", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) + R getOrderOther(@RequestParam("orderId") Integer orderId, @RequestParam("authority") Integer authority); + + /** + * 删除多个文件 + * + * @param keys 多个文件完整名称集合 + * @return 返回多个删除的文件名 + */ + // @DeleteMapping("/nakadai/oss/fileDeletion") + // R fileDeletion(@RequestParam("keys") List keys); + + /** + * 上传文件 + * + * @param file 文件 + * @return 文件路径及相关信息 + */ + @PostMapping("/nakadai/nakadai/oss/fileUpload") + R fileUpload(@RequestParam("file") MultipartFile file); + + /** + * 根据学校id获取客户id + * + * @param schoolId + * @return + */ + @GetMapping("/nakadai/nakadai/customer/getCustomerBySchoolId") + Integer getCustomerBySchoolId(@RequestParam("schoolId") Integer schoolId); + + /** + * 根据客户id获取所有的系统id + * + * @param customerId + * @return + */ + @GetMapping("/nakadai/nakadai/curriculum/getSystemIdByCustomerId") + List getSystemIdByCustomerId(@RequestParam("customerId") Integer customerId); + + /** + * 根据系统id获取系统名称 + * + * @param SystemId + * @return + */ + @GetMapping("/nakadai/nakadai/serviceConfiguration/getSystemNameBySystemId") + String getSystemNameBySystemId(@RequestParam("SystemId") Integer SystemId); + + /** + * @Description : 根据学校id获取学校购买的课程id(此处返回逗号拼接格式) + * @Param schoolId + * @Author Rong---2021/11/8 + */ + @GetMapping("/nakadai/nakadai/curriculum/getSchoolCourse") + String getSchoolCourse(@RequestParam("schoolId") Integer schoolId); + + /** + * 查询客户订单信息 + */ + @PostMapping("/nakadai/nakadai/orderOther/getCustomerOrderOther") + JudgmentPointDataTo getCustomerOrderOther(@RequestParam("schoolId") Integer schoolId, @RequestParam("systemId") Integer systemId, @RequestParam("name") String name); + + @DeleteMapping("/nakadai/nakadai/oss/fileDeletion") + R fileDeletion(@RequestParam("keys")List keys,@RequestParam("request") HttpServletRequest request); + + + @GetMapping("/nakadai/nakadai/school/getTheSchoolNameBySchoolId") + School getTheSchoolNameBySchoolId(@RequestParam("schoolId") Integer schoolId); + + @GetMapping("/nakadai/nakadai/school/getTheIdBySchoolName") + School getTheIdBySchoolName(@RequestParam("schoolName") String schoolName); + + @PostMapping("/nakadai/message/refreshPageNotification") + void refreshPageNotification(@RequestParam("username") String username, @RequestParam("to") String to, @RequestParam("content") String content); +} diff --git a/api/src/main/java/com/huoran/api/OccupationlabClient.java b/api/src/main/java/com/huoran/api/OccupationlabClient.java new file mode 100644 index 0000000..cba9fc7 --- /dev/null +++ b/api/src/main/java/com/huoran/api/OccupationlabClient.java @@ -0,0 +1,162 @@ +package com.huoran.api; + +import com.huoran.api.impl.OccupationlabImpl; +import com.huoran.common.constant.ServiceNameConstant; +import com.huoran.common.entity.ExperimentalReport; +import com.huoran.common.entity.ProjectManage; +import com.huoran.common.entity.UserScore; +import com.huoran.common.entity.to.JudgmentPointDataTo; +import com.huoran.common.entity.to.ProjectDataTo; +import com.huoran.common.response.R; +import io.swagger.annotations.ApiOperation; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * @description 职站远程调用客户端 + * @author: Mr.JK + * @create: 2021-09-10 15:03 + **/ +@FeignClient(value = ServiceNameConstant.OCCUPATIONLAB, fallbackFactory = OccupationlabImpl.class) +public interface OccupationlabClient { + + /** + * 添加实验报告 + * + * @param experimentalReport + * @return 添加成功返回主键id + */ + @PostMapping("/occupationlab/occupationlab/experimentalReport/addExperimentalReport") + Integer addExperimentalReport(@RequestBody ExperimentalReport experimentalReport); + + /** + * 添加用户分数 单条 + * + * @param userScore + * @return 添加成功返回主键id + */ + @PostMapping("/occupationlab/occupationlab/userScore/addUserScore") + Integer addUserScore(@RequestBody UserScore userScore); + + /** + * 获取项目管理、判分点关系表分数 + * + * @param projectId 项目id + * @param JudgmentId 判分点id + * @return 分数 + */ + @GetMapping("/occupationlab/occupationlab/projectJudgment/getJudgmentScore") + Integer getJudgmentScore(@RequestParam("projectId") Integer projectId, @RequestParam("JudgmentId") Integer JudgmentId); + + /** + * 根据系统id、项目权限获取系统内置项目 + * + * @param systemId + * @param permissions + * @return + */ + @GetMapping("/occupationlab/occupationlab/projectManage/getInternalProjectBySystemId") + List getInternalProjectBySystemId(@RequestParam Integer systemId, @RequestParam Integer permissions); + + @ApiOperation(value = "根据系统id获取项目(获取课程下与该学校下的所有项目)") + @GetMapping("/occupationlab/occupationlab/projectManage/getProjectBySystemId") + R getProjectBySystemId(@RequestParam String systemId, @RequestHeader String token, @RequestParam Integer permissions, @RequestParam Integer cId, @RequestParam Integer mallId); + + /** + * @Description : 创建客户复制题库 + * @Param schoolId + * @Author Rong---2021/11/2 + */ + @PostMapping("/occupationlab/occupationlab/questions/copyQuestion") + boolean copyQuestion(@RequestParam Integer schoolId, @RequestParam Integer accountId); + + /** + * @Description : 新增客户新增学生管理初始数据 + * @Param req + * @Param accountId + * @Author Rong---2021/11/2 + */ + @PostMapping("/occupationlab/occupationlab/architecture/saveData") + boolean saveData(@RequestParam("schoolId") Integer schoolId); + + /** + * @Description : 添加课程初始数据 + * @Param schoolId + * @Param accountId + * @Author Rong---2021/11/2 + */ + @PostMapping("/occupationlab/occupationlab/management/edu/course/addCourseData") + boolean addCourseData(@RequestParam("schoolId") Integer schoolId, @RequestParam("accountId") Integer accountId); + + /** + * 添加赛事样例数据 + * + * @param schoolId + * @param accountId + * @return + */ + @PostMapping("/occupationlab/occupationlab/enterprise/match/contest/eventSampleData") + boolean eventSampleData(@RequestParam("schoolId") Integer schoolId, @RequestParam("accountId") Integer accountId); + + /*** + * @Description : 添加资讯内置数据 + * @Param + * @Author Rong---2021/11/3 + */ + @PostMapping("/occupationlab/occupationlab/information/article/addArticleData") + boolean addArticleData(@RequestParam("accountId") Integer accountId, @RequestParam("schoolId") Integer schoolId); + + /** + * @Description : 创建客户复制测评规则 + * @Param schoolId + * @Author Rong---2021/11/2 + */ + @PostMapping("/occupationlab/occupationlab/questions/copyEvaluationRules") + boolean copyEvaluationRules(@RequestParam Integer schoolId); + + /** + * @Description : 创建客户添加内置员工组织架构数据 + * @Param schoolId + * @Author Rong---2021/11/11 + */ + @PostMapping("/occupationlab/occupationlab/staff/saveStaffData") + boolean saveStaffData(@RequestParam Integer schoolId); + + @PostMapping("/occupationlab/occupationlab/assessment/submitExam") + boolean submitExam(@RequestParam("assessmentId") Integer assessmentId, + @RequestParam("classId") Integer classId, + @RequestParam("accountId") Integer accountId, + @RequestParam("score") Integer score); + + @GetMapping("/occupationlab/occupationlab/assessment/getTeacherIdByAssessmentId") + Integer getTeacherIdByAssessmentId(@RequestParam("assessmentId") Integer assessmentId); + + /** + * 根据项目id查询判分点 + */ + @PostMapping("/occupationlab/occupationlab/projectManage/getProjectPoints") + JudgmentPointDataTo getProjectPoints(@RequestBody ProjectDataTo projectDataTo); + + + @PostMapping("/occupationlab/occupationlab/theoreticalCourseClassification/builtInCourseClassification") + boolean builtInCourseClassification(@RequestParam("schoolId") Integer schoolId,@RequestParam("accountId") Integer accountId); + + + @GetMapping("/occupationlab/occupationlab/projectManage/getProjectBySystemIdRemoteCall") + List getProjectBySystemIdRemoteCall( + @RequestParam String systemId, + @RequestParam Integer permissions, + @RequestParam Integer cId, + @RequestParam Integer accountId); + + + + /** + * 根据班级id查询班级详情 + */ + @GetMapping("/occupationlab/occupationlab/class/queryClassDetails") + boolean queryClassDetails(@RequestParam("id") Integer id); + +} diff --git a/api/src/main/java/com/huoran/api/UserClient.java b/api/src/main/java/com/huoran/api/UserClient.java new file mode 100644 index 0000000..f7af302 --- /dev/null +++ b/api/src/main/java/com/huoran/api/UserClient.java @@ -0,0 +1,136 @@ +package com.huoran.api; + +import com.huoran.api.impl.UserClientImpl; +import com.huoran.common.constant.ServiceNameConstant; +import com.huoran.common.entity.Role; +import com.huoran.common.entity.UserRole; +import com.huoran.common.response.R; +import feign.Headers; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.http.MediaType; +import org.springframework.stereotype.Component; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestParam; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + *

+ * 远程调用用户服务 + *

+ * + * @author lr + * @since 2021-08-24 + */ +@FeignClient(value = ServiceNameConstant.USERS, fallbackFactory = UserClientImpl.class) +@Headers("Accept: application/json") +public interface UserClient { + + /** + * 根据账号id获取当前账号id所在学校id + */ + @Headers({"Content-Type: application/json", "Accept: application/json"}) + @GetMapping(value = "/users/users/userAccount/getSchoolIdByAccountId", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) + Integer getSchoolIdByAccountId(@RequestParam("accountId") String accountId); + + /** + * 删除职站用户 + */ + @Headers({"Content-Type: application/json", "Accept: application/json"}) + @PostMapping(value = "/users/users/occupationlab/user/delStudent", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) + void delStudent(@RequestParam("accountIds") List accountIds); + + /** + * 删除用户、账户信息表 + */ + @Headers({"Content-Type: application/json", "Accept: application/json"}) + @PostMapping(value = "/users/users/occupationlab/user/delAccountAndUser", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) + void delAccountAndUser(@RequestParam("accountId") Integer accountId); + + /** + * 账号赋予角色 + * + * @param accountId + * @param roleIds + * @return + */ + @Headers({"Content-Type: application/json", "Accept: application/json"}) + @PostMapping(value = "/users/users/user-role/rolePermissionService", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) + R rolePermissionService(@RequestParam("accountId") Integer accountId, @RequestParam("roleIds") List roleIds,@RequestParam(value = "teamId",required = false) Integer teamId); + + /** + * @Description :删除某用户下的某个角色 + * @Param roleId + * @Param accountId + * @Author Rong---2021/10/15 + */ + @Headers({"Content-Type: application/json", "Accept: application/json"}) + @PostMapping(value = "/users/users/role/delRoleByAccountId", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) + R delRoleByAccountId(@RequestParam("roleId") Integer roleId, @RequestParam("accountId") Integer accountId); + + /** + * 为客户添加超管角色等相关操作 + * + * @param schoolId + * @param accountId + * @return + */ + @Headers({"Content-Type: application/json", "Accept: application/json"}) + @PostMapping("/users/users/role/addCustomerAdmin") + boolean addCustomerAdmin(@RequestParam("schoolId") Integer schoolId, @RequestParam("accountId") String accountId); + + /** + * @Description : 判断该角色是否存在 + * @Param roleName + * @Param request + * @Author Rong---2021/10/18 + */ + @Headers({"Content-Type: application/json", "Accept: application/json"}) + @PostMapping(value = "/users/users/role/checkRoleIsExist", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) + Role checkRoleIsExist(@RequestParam("roleName") String roleName, @RequestParam("schoolId") Integer schoolId,@RequestParam("platformId")Integer platformId); + + /** + * @Description : 校验手机号是否存在 + * @Param phone + * @Author Rong---2021/10/18 + */ + @Headers({"Content-Type: application/json", "Accept: application/json"}) + @GetMapping(value = "/users/users/userInfo/checkPhoneOrEmailExist", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) + boolean checkPhoneOrEmailExist(@RequestParam("phone") String phone, @RequestParam("email") String email, @RequestParam("type") Integer type); + + @Headers({"Content-Type: application/json", "Accept: application/json"}) + @PostMapping(value = "/users/users/role/checkIsSuperTube", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) + boolean checkIsSuperTube(@RequestParam("accountId") String accountId); + + /** + * 根据平台获取该用户在该平台的角色 + * + * @param accountId + * @param platformId + * @return + */ + @Headers({"Content-Type: application/json", "Accept: application/json"}) + @PostMapping(value = "/users/users/role/getUserAllRole", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) + String getUserAllRole(@RequestParam("accountId") String accountId, @RequestParam("platformId") Integer platformId); + + /** + * @Description : 根据账号id查询账户名称 + * @Param accountId + * @Author Rong---2021/12/30 + */ + @GetMapping(value = "/users/users/userInfo/getUserName") + String getUserName(@RequestParam("accountId") Integer accountId); + + + @GetMapping(value = "/users/users/user/accountIsDisabled") + boolean accountIsDisabled(@RequestParam("token") String token); + + + @PostMapping(value = "/users/users/role/getAccountIdsBySchoolId") + List getAccountIdsBySchoolId( @RequestParam("schoolId") Integer schoolId, @RequestParam("platformId") Integer platformId); + +} diff --git a/api/src/main/java/com/huoran/api/impl/NakadaiClientImpl.java b/api/src/main/java/com/huoran/api/impl/NakadaiClientImpl.java new file mode 100644 index 0000000..6d1feda --- /dev/null +++ b/api/src/main/java/com/huoran/api/impl/NakadaiClientImpl.java @@ -0,0 +1,94 @@ +package com.huoran.api.impl; + +import com.huoran.api.NakadaiClient; +import com.huoran.common.entity.School; +import com.huoran.common.entity.to.JudgmentPointDataTo; +import com.huoran.common.response.R; +import feign.hystrix.FallbackFactory; +import org.springframework.stereotype.Component; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; + + +/** + * @version 1.1 2021年8月26日15:03:52 JK修改 服务降级处理 + * @Author chen + * @DATE 2021/7/15 11:16 + * @Version 1.0 + */ +@Component +public class NakadaiClientImpl implements FallbackFactory { + + + @Override + public NakadaiClient create(Throwable throwable) { + return new NakadaiClient() { + @Override + public R getCustomerOrder(Integer customerId) { + return R.error("调用服务失败:" + throwable.getMessage()); + } + + @Override + public R getOrderOther(Integer orderId, Integer authority) { + return R.error("调用服务失败:" + throwable.getMessage()); + } + + /*@Override + public R fileDeletion(List keys) { + return R.error("调用服务失败:" + throwable.getMessage()); + } +*/ + @Override + public R fileUpload(MultipartFile file) { + return R.error("调用服务失败:" + throwable.getMessage()); + } + + @Override + public Integer getCustomerBySchoolId(Integer schoolId) { + return -1; + } + + @Override + public List getSystemIdByCustomerId(Integer customerId) { + return null; + } + + @Override + public String getSystemNameBySystemId(Integer SystemId) { + return null; + } + + @Override + public String getSchoolCourse(Integer schoolId) { + return null; + } + + @Override + public JudgmentPointDataTo getCustomerOrderOther(Integer schoolId, Integer systemId,String name) { + return null; + } + + @Override + public R fileDeletion(List keys, HttpServletRequest request) { + return null; + } + + @Override + public School getTheSchoolNameBySchoolId(Integer schoolId) { + return null; + } + + @Override + public School getTheIdBySchoolName(String schoolName) { + return null; + } + + @Override + public void refreshPageNotification(String username, String to, String content) { + + } + }; + } +} diff --git a/api/src/main/java/com/huoran/api/impl/OccupationlabImpl.java b/api/src/main/java/com/huoran/api/impl/OccupationlabImpl.java new file mode 100644 index 0000000..b8fee04 --- /dev/null +++ b/api/src/main/java/com/huoran/api/impl/OccupationlabImpl.java @@ -0,0 +1,117 @@ +package com.huoran.api.impl; + +import com.huoran.api.OccupationlabClient; +import com.huoran.common.entity.ExperimentalReport; +import com.huoran.common.entity.ProjectManage; +import com.huoran.common.entity.UserScore; +import com.huoran.common.entity.to.JudgmentPointDataTo; +import com.huoran.common.entity.to.ProjectDataTo; +import com.huoran.common.response.R; +import feign.hystrix.FallbackFactory; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + * @description 服务降级 + * @author: Mr.JK + * @create: 2021-09-10 15:09 + **/ +@Component +public class OccupationlabImpl implements FallbackFactory { + + @Override + public OccupationlabClient create(Throwable cause) { + return new OccupationlabClient() { + @Override + public Integer addExperimentalReport(ExperimentalReport experimentalReport) { + return null; + } + + @Override + public Integer addUserScore(UserScore userScore) { + return null; + } + + @Override + public Integer getJudgmentScore(Integer projectId, Integer JudgmentId) { + return 0; + } + + @Override + public List getInternalProjectBySystemId(Integer systemId, Integer permissions) { + return null; + } + + @Override + public boolean copyQuestion(Integer schoolId, Integer accountId) { + return false; + } + + @Override + public boolean saveData(Integer schoolId) { + return false; + } + + @Override + public boolean addCourseData(Integer schoolId, Integer accountId) { + return false; + } + + @Override + public boolean eventSampleData(Integer schoolId, Integer accountId) { + return false; + } + + @Override + public boolean addArticleData(Integer accountId, Integer schoolId) { + return false; + } + + @Override + public boolean copyEvaluationRules(Integer schoolId) { + return false; + } + + @Override + public boolean saveStaffData(Integer schoolId) { + return false; + } + + @Override + public boolean submitExam(Integer assessmentId, Integer classId, Integer accountId, Integer score) { + return false; + } + + @Override + public Integer getTeacherIdByAssessmentId(Integer assessmentId) { + return null; + } + + @Override + public JudgmentPointDataTo getProjectPoints(ProjectDataTo projectDataTo) { + return null; + } + + @Override + public boolean builtInCourseClassification(Integer schoolId, Integer accountId) { + return false; + } + + @Override + public List getProjectBySystemIdRemoteCall(String systemId, Integer permissions, Integer cId, Integer accountId) { + return null; + } + + @Override + public boolean queryClassDetails(Integer id) { + return false; + } + + @Override + public R getProjectBySystemId(String systemId, String token, Integer permissions, Integer cId,Integer mallId) { + return null; + } + }; + } +} diff --git a/api/src/main/java/com/huoran/api/impl/UserClientImpl.java b/api/src/main/java/com/huoran/api/impl/UserClientImpl.java new file mode 100644 index 0000000..e145e7c --- /dev/null +++ b/api/src/main/java/com/huoran/api/impl/UserClientImpl.java @@ -0,0 +1,91 @@ +package com.huoran.api.impl; + +import com.huoran.api.UserClient; +import com.huoran.common.entity.Role; +import com.huoran.common.response.R; +import feign.hystrix.FallbackFactory; +import org.springframework.stereotype.Component; +import org.springframework.web.bind.annotation.PostMapping; + +import java.util.List; + +/** + * @Author chen + * @DATE 2021/7/15 11:16 + * @Version 1.0 + */ +@Component +public class UserClientImpl implements FallbackFactory { + + + @Override + public UserClient create(Throwable cause) { + return new UserClient() { + @Override + public Integer getSchoolIdByAccountId(String accountId) { + return -1; + } + + @Override + public void delStudent(List accountIds) { + } + + @Override + public void delAccountAndUser(Integer accountId) { + + } + + @Override + public boolean addCustomerAdmin(Integer schoolId, String accountId) { + return false; + } + + @Override + public R rolePermissionService(Integer accountId, List roleIds,Integer teamId) { + return null; + } + + @Override + public R delRoleByAccountId(Integer roleId, Integer accountId) { + return null; + } + + @Override + public Role checkRoleIsExist(String roleName, Integer schoolId,Integer platformId) { + return null; + } + + @Override + public boolean checkPhoneOrEmailExist(String phone, String email, Integer type) { + return false; + } + + @Override + public boolean checkIsSuperTube(String accountId) { + return false; + } + + @Override + public String getUserAllRole(String accountId, Integer platformId) { + return null; + } + + @Override + public String getUserName(Integer accountId) { + return null; + } + + @PostMapping("/users/users/role/getAccountIdsBySchoolId") + @Override + public List getAccountIdsBySchoolId(Integer schoolId, Integer platformId) { + return null; + } + + @Override + public boolean accountIsDisabled(String token) { + return false; + } + + }; + } +} diff --git a/api/src/main/java/com/huoran/config/FeignSimpleEncoderConfig.java b/api/src/main/java/com/huoran/config/FeignSimpleEncoderConfig.java new file mode 100644 index 0000000..ac8609d --- /dev/null +++ b/api/src/main/java/com/huoran/config/FeignSimpleEncoderConfig.java @@ -0,0 +1,69 @@ +package com.huoran.config; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.serializer.SerializerFeature; +import com.alibaba.fastjson.support.config.FastJsonConfig; +import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter; +import com.alibaba.fastjson.support.springfox.SwaggerJsonSerializer; +import feign.Logger; +import feign.codec.Decoder; +import feign.codec.Encoder; +import org.springframework.beans.factory.ObjectFactory; +import org.springframework.boot.autoconfigure.http.HttpMessageConverters; +import org.springframework.cloud.openfeign.support.SpringDecoder; +import org.springframework.cloud.openfeign.support.SpringEncoder; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.MediaType; + +import java.util.ArrayList; +import java.util.List; + +/** + * @Author chen + * @DATE 2021/7/15 16:52 + * @Version 1.0 + */ +@Configuration +public class FeignSimpleEncoderConfig { + @Bean + Logger.Level feignLoggerLevel() { + //这里记录所有,根据实际情况选择合适的日志level + return Logger.Level.FULL; + } + + @Bean + public Encoder feignEncoder() { + return new SpringEncoder(feignHttpMessageConverter()); + } + + @Bean + public Decoder feignDecoder() { + return new SpringDecoder(feignHttpMessageConverter()); + } + + /** + * 设置解码器为fastjson + * + * @return + */ + private ObjectFactory feignHttpMessageConverter() { + final HttpMessageConverters httpMessageConverters = new HttpMessageConverters(this.getFastJsonConverter()); + return () -> httpMessageConverters; + } + + private FastJsonHttpMessageConverter getFastJsonConverter() { + FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter(); + + List supportedMediaTypes = new ArrayList<>(); + MediaType mediaTypeJson = MediaType.valueOf(MediaType.APPLICATION_JSON_UTF8_VALUE); + supportedMediaTypes.add(mediaTypeJson); + converter.setSupportedMediaTypes(supportedMediaTypes); + FastJsonConfig config = new FastJsonConfig(); + config.getSerializeConfig().put(JSON.class, new SwaggerJsonSerializer()); + config.setSerializerFeatures(SerializerFeature.DisableCircularReferenceDetect); + converter.setFastJsonConfig(config); + + return converter; + } +} diff --git a/common/pom.xml b/common/pom.xml new file mode 100644 index 0000000..49428ec --- /dev/null +++ b/common/pom.xml @@ -0,0 +1,283 @@ + + + + huoran + com.huoran.parent + 1.0-SNAPSHOT + + 4.0.0 + + com.huoran.common + common + 0.0.1-SNAPSHOT + common + 或然项目子工程-公共微服务 + + + 1.8 + UTF-8 + UTF-8 + 2.8.2 + 5.7.0 + 0.7.0 + 8.0.16 + + + + + + + com.alibaba.cloud + spring-cloud-alibaba-dependencies + 2.1.0.RELEASE + pom + import + + + + + + + + com.squareup.okhttp3 + okhttp + 4.9.0 + + + + + org.springframework.boot + spring-boot-starter-validation + + + + + com.alibaba + druid-spring-boot-starter + 1.1.20 + + + + org.springframework.boot + spring-boot-starter-actuator + + + + + + + + + + + + + + + + + org.springframework.boot + spring-boot-starter-cache + + + + + com.aliyun + aliyun-java-sdk-core + + + + com.aliyun + aliyun-sdk-vod-upload + + + + com.aliyun + aliyun-java-sdk-vod + + + + + io.jsonwebtoken + jjwt + ${jwt.version} + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-test + + + + + org.springframework.cloud + spring-cloud-starter-openfeign + + + spring-cloud-netflix-archaius + org.springframework.cloud + + + + + + + org.springframework.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + fastjson + com.alibaba + + + guava + com.google.guava + + + + + + + org.springframework.cloud + spring-cloud-starter-alibaba-nacos-config + + + + + mysql + mysql-connector-java + ${mysql-connector-java.version} + + + + commons-io + commons-io + test + + + + commons-lang + commons-lang + 2.6 + + + + + org.springframework.boot + spring-boot-starter-data-redis + + + + + + + + com.baomidou + mybatis-plus-boot-starter + + + + + + + + + + + + org.projectlombok + lombok + + + + + com.github.xiaoymin + swagger-bootstrap-ui + + + + io.springfox + springfox-swagger-ui + + + + io.springfox + springfox-swagger2 + + + + io.swagger + swagger-annotations + + + io.swagger + swagger-models + + + guava + com.google.guava + + + + + io.swagger + swagger-annotations + + + io.swagger + swagger-models + + + + + + com.alibaba + fastjson + + + + com.aliyun + aliyun-java-sdk-dysmsapi + + + + com.aliyun.oss + aliyun-sdk-oss + + + + + org.apache.commons + commons-email + 1.3.3 + + + + cn.hutool + hutool-all + ${hutool-all.version} + + + + + org.apache.velocity + velocity-engine-core + ${velocity.version} + + + + + \ No newline at end of file diff --git a/common/src/main/java/com/huoran/common/aop/annotation/LimitType.java b/common/src/main/java/com/huoran/common/aop/annotation/LimitType.java new file mode 100644 index 0000000..c9afc9e --- /dev/null +++ b/common/src/main/java/com/huoran/common/aop/annotation/LimitType.java @@ -0,0 +1,7 @@ +package com.huoran.common.aop.annotation; + +public enum LimitType { + + IP, + CUSTOMER; +} diff --git a/common/src/main/java/com/huoran/common/aop/annotation/LogAnnotation.java b/common/src/main/java/com/huoran/common/aop/annotation/LogAnnotation.java new file mode 100644 index 0000000..e91c23e --- /dev/null +++ b/common/src/main/java/com/huoran/common/aop/annotation/LogAnnotation.java @@ -0,0 +1,25 @@ +package com.huoran.common.aop.annotation; + +import java.lang.annotation.*; + +/** + * LogAnnotation + * + * @author cheney + * @version V1.0 + * @date 2022年7月28日 + */ +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface LogAnnotation { + /** + * 模块 + */ + String title() default ""; + + /** + * 功能 + */ + String action() default ""; +} diff --git a/common/src/main/java/com/huoran/common/aop/annotation/NoRepeatSubmit.java b/common/src/main/java/com/huoran/common/aop/annotation/NoRepeatSubmit.java new file mode 100644 index 0000000..93ae0c8 --- /dev/null +++ b/common/src/main/java/com/huoran/common/aop/annotation/NoRepeatSubmit.java @@ -0,0 +1,17 @@ +package com.huoran.common.aop.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * @Description 不重复提交注解 + */ + +@Target(ElementType.METHOD) // 作用到方法上 +@Retention(RetentionPolicy.RUNTIME) // 运行时有效 +public @interface NoRepeatSubmit { + + String name() default "name:"; +} diff --git a/common/src/main/java/com/huoran/common/aop/annotation/RedisLimit.java b/common/src/main/java/com/huoran/common/aop/annotation/RedisLimit.java new file mode 100644 index 0000000..306046d --- /dev/null +++ b/common/src/main/java/com/huoran/common/aop/annotation/RedisLimit.java @@ -0,0 +1,36 @@ +package com.huoran.common.aop.annotation; + +import java.lang.annotation.*; + +@Target({ElementType.METHOD,ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +@Inherited +@Documented +public @interface RedisLimit { + + //count 代表请求总数量 + //period 代表限制时间 + //即 period 时间内,只允许有 count 个请求总数量访问,超过的将被限制不能访问 + + // 资源名称 + String name() default ""; + + // 资源key + String key() default ""; + + // 前缀 + String prefix() default ""; + + // 时间 + int period(); + + // 最多访问次数 + int count(); + + // 类型 + LimitType limitType() default LimitType.CUSTOMER; + + // 提示信息 + String msg() default "系统繁忙,请稍后再试"; + +} diff --git a/common/src/main/java/com/huoran/common/aop/aspect/NoRepeatSubmitAop.java b/common/src/main/java/com/huoran/common/aop/aspect/NoRepeatSubmitAop.java new file mode 100644 index 0000000..3eb5162 --- /dev/null +++ b/common/src/main/java/com/huoran/common/aop/aspect/NoRepeatSubmitAop.java @@ -0,0 +1,67 @@ +package com.huoran.common.aop.aspect; + +import com.huoran.common.aop.annotation.NoRepeatSubmit; +import com.huoran.common.exception.CustomException; +import com.huoran.common.response.R; +import com.huoran.common.utils.JwtUtils; +import lombok.Synchronized; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.StringUtils; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletRequest; +import java.util.concurrent.TimeUnit; + +import static com.huoran.common.exception.ExceptionEnum.LOGIN_INVALID; + + +/** + * @Description aop解析注解 + */ + +@Aspect +@Component +public class NoRepeatSubmitAop { + + private Log logger = LogFactory.getLog(getClass()); + + @Autowired + private RedisServiceAop redisService; + + @Synchronized + @Around("execution(* com.huoran.*.controller.*.*(..)) && @annotation(noRepeatSubmit)") + public Object around(ProceedingJoinPoint pjp, NoRepeatSubmit noRepeatSubmit) throws Throwable { + + ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); + HttpServletRequest request = attributes.getRequest(); + String token = request.getHeader("token"); + //如果header中不存在token,则从参数中获取token + if (StringUtils.isEmpty(token)) { + throw new CustomException(LOGIN_INVALID); + } + // 校验并解析token,如果token过期或者篡改,则会返回null + boolean isVerify = JwtUtils.checkToken(token); + if (!isVerify) { + throw new CustomException(LOGIN_INVALID); + } + String key = token + "-" + request.getServletPath(); + if ( !redisService.haskey(key) ) {// 如果缓存中有这个url视为重复提交 + Object o = pjp.proceed(); + redisService.setCacheObject(key, 0, 1, TimeUnit.SECONDS); + return o; + } else { + redisService.setCacheObject(key, 0, 1, TimeUnit.SECONDS);//点了同样的URL继续限制,直到2次点击中间间隔超过了限制 + return R.error("请勿重复提交或者操作过于频繁!"); + } + + } + + +} diff --git a/common/src/main/java/com/huoran/common/aop/aspect/RateLimiterAspect.java b/common/src/main/java/com/huoran/common/aop/aspect/RateLimiterAspect.java new file mode 100644 index 0000000..d3d3dd6 --- /dev/null +++ b/common/src/main/java/com/huoran/common/aop/aspect/RateLimiterAspect.java @@ -0,0 +1,115 @@ +package com.huoran.common.aop.aspect; +import com.google.common.collect.Maps;import com.google.common.util.concurrent.RateLimiter;import lombok.extern.slf4j.Slf4j;import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect;import org.aspectj.lang.annotation.Pointcut;import org.springframework.stereotype.Component; +import org.springframework.util.StringUtils; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.PrintWriter; +import java.lang.reflect.Method; +import java.util.Map; +import java.util.Objects; +import com.huoran.common.constant.AnRateLimiter; + + +@Slf4j +@Aspect +@Component +public class RateLimiterAspect { + /** + * 使用url做为key,存放令牌桶 防止每次重新创建令牌桶 + */ + + private Map limitMap = Maps.newConcurrentMap(); + @Pointcut("@annotation(com.huoran.common.constant.AnRateLimiter)") + + public void anRateLimiter() { + + } + + @Around("anRateLimiter()") + public Object around(ProceedingJoinPoint joinPoint) throws Throwable { + // 获取request,response + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + HttpServletResponse response = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse(); + // 或者url(存在map集合的key) + String url = request.getRequestURI(); + // 获取自定义注解 + AnRateLimiter rateLimiter = getAnRateLimiter(joinPoint); + if (rateLimiter != null) { + RateLimiter limiter = null; + // 判断map集合中是否有创建有创建好的令牌桶 + if (!limitMap.containsKey(url)) { + // 创建令牌桶 + limiter = RateLimiter.create(rateLimiter.permitsPerSecond()); + limitMap.put(url, limiter); + log.info("<<================= 请求{},创建令牌桶,容量{} 成功!!!", url, rateLimiter.permitsPerSecond()); + } + limiter = (RateLimiter) limitMap.get(url); + // 获取令牌 + boolean acquire = limiter.tryAcquire(rateLimiter.timeout(), rateLimiter.timeunit()); + if (!acquire) { + responseResult(response, 500, rateLimiter.msg()); + return null; + } + } + return joinPoint.proceed(); + + } + + /** + * 获取注解对象 + * + * @param joinPoint 对象 + * @return ten LogAnnotation + */ + + private AnRateLimiter getAnRateLimiter(final JoinPoint joinPoint) { + Method[] methods = joinPoint.getTarget().getClass().getDeclaredMethods(); + String name = joinPoint.getSignature().getName(); + if (!StringUtils.isEmpty(name)) { + for (Method method : methods) { + AnRateLimiter annotation = method.getAnnotation(AnRateLimiter.class); + if (!Objects.isNull(annotation) && name.equals(method.getName())) { + return annotation; + } + } + } + return null; + + } + + /** + * 自定义响应结果 + * + * @param response 响应 + * @param code 响应码 + * @param message 响应信息 + */ + + private void responseResult(HttpServletResponse response, Integer code, String message) { + response.resetBuffer(); + response.setHeader("Access-Control-Allow-Origin", "*"); + response.setHeader("Access-Control-Allow-Credentials", "true"); + response.setContentType("application/json"); + response.setCharacterEncoding("UTF-8"); + PrintWriter writer = null; + try { + writer = response.getWriter(); + writer.println("{\"code\":" + code + " ,\"message\" :\"" + message + "\"}"); + response.flushBuffer(); + } catch (IOException e) { + log.error(" 输入响应出错 e = {}", e.getMessage(), e); + } finally { + if (writer != null) { + writer.flush(); + writer.close(); + } + } + + } +} diff --git a/common/src/main/java/com/huoran/common/aop/aspect/RedisLimitAspect.java b/common/src/main/java/com/huoran/common/aop/aspect/RedisLimitAspect.java new file mode 100644 index 0000000..8b72c1f --- /dev/null +++ b/common/src/main/java/com/huoran/common/aop/aspect/RedisLimitAspect.java @@ -0,0 +1,109 @@ +package com.huoran.common.aop.aspect; + +import com.google.common.collect.ImmutableList; +import com.huoran.common.aop.annotation.LimitType; +import com.huoran.common.aop.annotation.RedisLimit; +import com.huoran.common.exception.CustomException; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.reflect.MethodSignature; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.core.script.DefaultRedisScript; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.lang.reflect.Method; +import java.util.Objects; + +import static com.huoran.common.exception.ExceptionEnum.REDIS_LIMIT; + +@Slf4j +@Aspect +@Configuration +public class RedisLimitAspect { + + @Resource + private final RedisTemplate redisTemplate; + + public RedisLimitAspect(RedisTemplate redisTemplate) { + this.redisTemplate = redisTemplate; + } + + @Around("@annotation(com.huoran.common.aop.annotation.RedisLimit)") + public Object around(ProceedingJoinPoint pjp) throws Throwable { + MethodSignature methodSignature = (MethodSignature)pjp.getSignature(); + Method method = methodSignature.getMethod(); + RedisLimit annotation = method.getAnnotation(RedisLimit.class); + LimitType limitType = annotation.limitType(); + + String name = annotation.name(); + String key; + + int period = annotation.period(); + int count = annotation.count(); + + switch (limitType){ + case IP: + key = getIpAddress(); + break; + case CUSTOMER: + key = annotation.key(); + break; + default: + key = StringUtils.upperCase(method.getName()); + } + ImmutableList keys = ImmutableList.of(StringUtils.join(annotation.prefix(), key)); + String luaScript = buildLuaScript(); + DefaultRedisScript redisScript = new DefaultRedisScript<>(luaScript, Number.class); + Number number = redisTemplate.execute(redisScript, keys, count, period); + log.info("Access try count is {} for name = {} and key = {}", number, name, key); + if(number != null && number.intValue() == 1){ + return pjp.proceed(); + } + throw new CustomException(REDIS_LIMIT); + } + + public String buildLuaScript(){ + return "redis.replicate_commands(); local listLen,time" + + "\nlistLen = redis.call('LLEN', KEYS[1])" + + // 不超过最大值,则直接写入时间 + "\nif listLen and tonumber(listLen) < tonumber(ARGV[1]) then" + + "\nlocal a = redis.call('TIME');" + + "\nredis.call('LPUSH', KEYS[1], a[1]*1000000+a[2])" + + "\nelse" + + // 取出现存的最早的那个时间,和当前时间比较,看是小于时间间隔 + "\ntime = redis.call('LINDEX', KEYS[1], -1)" + + "\nlocal a = redis.call('TIME');" + + "\nif a[1]*1000000+a[2] - time < tonumber(ARGV[2])*1000000 then" + + // 访问频率超过了限制,返回0表示失败 + "\nreturn 0;" + + "\nelse" + + "\nredis.call('LPUSH', KEYS[1], a[1]*1000000+a[2])" + + "\nredis.call('LTRIM', KEYS[1], 0, tonumber(ARGV[1])-1)" + + "\nend" + + "\nend" + + "\nreturn 1;"; + } + + public String getIpAddress(){ + HttpServletRequest request = ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest(); + String ip = request.getHeader("x-forwarded-for"); + if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)){ + ip = request.getHeader("Proxy-Client-IP"); + } + if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)){ + ip = request.getHeader("WL-Client-IP"); + } + if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)){ + ip = request.getRemoteAddr(); + } + return ip; + } + +} \ No newline at end of file diff --git a/common/src/main/java/com/huoran/common/aop/aspect/RedisServiceAop.java b/common/src/main/java/com/huoran/common/aop/aspect/RedisServiceAop.java new file mode 100644 index 0000000..b0d3662 --- /dev/null +++ b/common/src/main/java/com/huoran/common/aop/aspect/RedisServiceAop.java @@ -0,0 +1,228 @@ +package com.huoran.common.aop.aspect; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.*; +import org.springframework.stereotype.Component; + +import java.util.*; +import java.util.concurrent.TimeUnit; + +/** + * @Description RedisService + */ +@Component +@SuppressWarnings(value = {"unchecked", "rawtypes"}) +public class RedisServiceAop { + + @Autowired + public RedisTemplate redisTemplate; + + /** + * 缓存基本的对象,Integer、String、实体类等 + * + * @param key 缓存的键值 + * @param value 缓存的值 + * @return 缓存的对象 + */ + public ValueOperations setCacheObject(String key, T value) { + ValueOperations operation = redisTemplate.opsForValue(); + operation.set(key, value); + return operation; + } + + /** + * 缓存基本的对象,Integer、String、实体类等 + * + * @param key 缓存的键值 + * @param value 缓存的值 + * @param timeout 时间 + * @param timeUnit 时间颗粒度 + * @return 缓存的对象 + */ + public ValueOperations setCacheObject(String key, T value, Integer timeout, TimeUnit timeUnit) { + ValueOperations operation = redisTemplate.opsForValue(); + operation.set(key, value, timeout, timeUnit); + return operation; + } + + /** + * 获得缓存的基本对象。 + * + * @param key 缓存键值 + * @return 缓存键值对应的数据 + */ + public T getCacheObject(String key) { + ValueOperations operation = redisTemplate.opsForValue(); + return operation.get(key); + } + + /** + * 删除单个对象 + * + * @param key + */ + public void deleteObject(String key) { + redisTemplate.delete(key); + } + + /** + * 删除集合对象 + * + * @param collection + */ + public void deleteObject(Collection collection) { + redisTemplate.delete(collection); + } + + /** + * 缓存List数据 + * + * @param key 缓存的键值 + * @param dataList 待缓存的List数据 + * @return 缓存的对象 + */ + public ListOperations setCacheList(String key, List dataList) { + ListOperations listOperation = redisTemplate.opsForList(); + if (null != dataList) { + int size = dataList.size(); + for (int i = 0; i < size; i++) { + listOperation.leftPush(key, dataList.get(i)); + } + } + return listOperation; + } + + /** + * 获得缓存的list对象 + * + * @param key 缓存的键值 + * @return 缓存键值对应的数据 + */ + public List getCacheList(String key) { + List dataList = new ArrayList(); + ListOperations listOperation = redisTemplate.opsForList(); + Long size = listOperation.size(key); + + for (int i = 0; i < size; i++) { + dataList.add(listOperation.index(key, i)); + } + return dataList; + } + + /** + * 缓存Set + * + * @param key 缓存键值 + * @param dataSet 缓存的数据 + * @return 缓存数据的对象 + */ + public BoundSetOperations setCacheSet(String key, Set dataSet) { + BoundSetOperations setOperation = redisTemplate.boundSetOps(key); + Iterator it = dataSet.iterator(); + while (it.hasNext()) { + setOperation.add(it.next()); + } + return setOperation; + } + + /** + * 获得缓存的set + * + * @param key + * @return + */ + public Set getCacheSet(String key) { + Set dataSet = new HashSet(); + BoundSetOperations operation = redisTemplate.boundSetOps(key); + dataSet = operation.members(); + return dataSet; + } + + /** + * 缓存Map + * + * @param key + * @param dataMap + * @return + */ + public HashOperations setCacheMap(String key, Map dataMap) { + HashOperations hashOperations = redisTemplate.opsForHash(); + if (null != dataMap) { + for (Map.Entry entry : dataMap.entrySet()) { + hashOperations.put(key, entry.getKey(), entry.getValue()); + } + } + return hashOperations; + } + + /** + * 获得缓存的Map + * + * @param key + * @return + */ + public Map getCacheMap(String key) { + Map map = redisTemplate.opsForHash().entries(key); + return map; + } + + /** + * 获得缓存的基本对象列表 + * + * @param pattern 字符串前缀 + * @return 对象列表 + */ + public Collection keys(String pattern) { + return redisTemplate.keys(pattern); + } + + /** + * + * @param key + * @return + */ + public boolean haskey(String key){ + return redisTemplate.hasKey(key); + } + + public Long getExpire(String key){ + return redisTemplate.getExpire(key); + } + + + public ValueOperations setBillObject(String key, List> value) { + ValueOperations operation = redisTemplate.opsForValue(); + operation.set(key, (T) value); + return operation; + } + /** + * 缓存list> + * + * @param key 缓存的键值 + * @param value 缓存的值 + * @param timeout 时间 + * @param timeUnit 时间颗粒度 + * @return 缓存的对象 + */ + public ValueOperations setBillObject(String key, List> value, Integer timeout, TimeUnit timeUnit) { + ValueOperations operation = redisTemplate.opsForValue(); + operation.set(key,(T)value, timeout, timeUnit); + return operation; + } + /** + * 缓存Map + * + * @param key + * @param dataMap + * @return + */ + public HashOperations setCKdBillMap(String key, Map dataMap) { + HashOperations hashOperations = redisTemplate.opsForHash(); + if (null != dataMap) { + for (Map.Entry entry : dataMap.entrySet()) { + hashOperations.put(key, entry.getKey(), entry.getValue()); + } + } + return hashOperations; + } +} diff --git a/common/src/main/java/com/huoran/common/config/FallbackHandler.java b/common/src/main/java/com/huoran/common/config/FallbackHandler.java new file mode 100644 index 0000000..43f9a09 --- /dev/null +++ b/common/src/main/java/com/huoran/common/config/FallbackHandler.java @@ -0,0 +1,25 @@ +package com.huoran.common.config; + +import org.springframework.boot.web.reactive.error.ErrorWebExceptionHandler; +import org.springframework.core.io.buffer.DataBuffer; +import org.springframework.http.MediaType; +import org.springframework.stereotype.Component; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.nio.charset.StandardCharsets; + +@Component +public class FallbackHandler implements ErrorWebExceptionHandler { + + @Override + public Mono handle(ServerWebExchange exchange, Throwable ex) { + String message = "服务正在维护,请稍后再试!"; + byte[] bytes = String.format("{\"code\":-1,\"message\":\"%s\",\"data\":null}", + message).getBytes(StandardCharsets.UTF_8); + DataBuffer buffer = exchange.getResponse().bufferFactory().wrap(bytes); + exchange.getResponse().getHeaders().setContentType(MediaType.APPLICATION_JSON); + return exchange.getResponse().writeWith(Flux.just(buffer)); + } +} diff --git a/common/src/main/java/com/huoran/common/config/MyCacheConfig.java b/common/src/main/java/com/huoran/common/config/MyCacheConfig.java new file mode 100644 index 0000000..7573c87 --- /dev/null +++ b/common/src/main/java/com/huoran/common/config/MyCacheConfig.java @@ -0,0 +1,48 @@ +package com.huoran.common.config; + +import org.springframework.boot.autoconfigure.cache.CacheProperties; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.cache.annotation.EnableCaching; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.redis.cache.RedisCacheConfiguration; +import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer; +import org.springframework.data.redis.serializer.RedisSerializationContext; +import org.springframework.data.redis.serializer.StringRedisSerializer; + +/** + * @Author chen + * @DATE 2021/12/28 10:42 + * @Version 1.0 + */ +@EnableConfigurationProperties(CacheProperties.class) +@Configuration +@EnableCaching +public class MyCacheConfig { + + @Bean + RedisCacheConfiguration redisCacheConfiguration(CacheProperties cacheProperties){ + RedisCacheConfiguration config = RedisCacheConfiguration.defaultCacheConfig(); + //修改缓存key、value的序列化机制,返回json数据格式 + config.serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(new StringRedisSerializer())); + config.serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(new GenericJackson2JsonRedisSerializer())); + //读取redis配置文件 + CacheProperties.Redis redisProperties = cacheProperties.getRedis(); + if (redisProperties.getTimeToLive() != null) { + config = config.entryTtl(redisProperties.getTimeToLive()); + } + + if (redisProperties.getKeyPrefix() != null) { + config = config.prefixKeysWith(redisProperties.getKeyPrefix()); + } + + if (!redisProperties.isCacheNullValues()) { + config = config.disableCachingNullValues(); + } + + if (!redisProperties.isUseKeyPrefix()) { + config = config.disableKeyPrefix(); + } + return config; + } +} diff --git a/common/src/main/java/com/huoran/common/config/MybatisPlusConfig.java b/common/src/main/java/com/huoran/common/config/MybatisPlusConfig.java new file mode 100644 index 0000000..7529147 --- /dev/null +++ b/common/src/main/java/com/huoran/common/config/MybatisPlusConfig.java @@ -0,0 +1,33 @@ +package com.huoran.common.config; + +import com.baomidou.mybatisplus.core.injector.ISqlInjector; +import com.baomidou.mybatisplus.extension.injector.LogicSqlInjector; +import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * @description + * @author: Mr.JK + * @create: 2021-06-25 16:31 + **/ +@Configuration +public class MybatisPlusConfig { + /** + * 分页插件 + */ + @Bean + public PaginationInterceptor paginationInterceptor() { + PaginationInterceptor page = new PaginationInterceptor(); + page.setDialectType("mysql"); + return page; + } + + /** + * 逻辑删除插件 + */ + @Bean + public ISqlInjector sqlInjector() { + return new LogicSqlInjector(); + } +} diff --git a/common/src/main/java/com/huoran/common/config/RedisAutoConfiguration.java b/common/src/main/java/com/huoran/common/config/RedisAutoConfiguration.java new file mode 100644 index 0000000..d1e64db --- /dev/null +++ b/common/src/main/java/com/huoran/common/config/RedisAutoConfiguration.java @@ -0,0 +1,125 @@ +package com.huoran.common.config; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.PropertyAccessor; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.data.redis.RedisProperties; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.redis.connection.RedisConnectionFactory; +import org.springframework.data.redis.core.RedisOperations; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; +import org.springframework.data.redis.serializer.RedisSerializer; +import org.springframework.data.redis.serializer.StringRedisSerializer; + +import java.net.UnknownHostException; + +@Configuration +@ConditionalOnClass(RedisOperations.class) +@EnableConfigurationProperties(RedisProperties.class) +//@Import({ LettuceConnectionConfiguration.class, JedisConnectionConfiguration.class }) +public class RedisAutoConfiguration { +// @Bean +// @ConditionalOnMissingBean(name = "redisTemplate") +// public RedisTemplate redisTemplate( +// RedisConnectionFactory redisConnectionFactory) throws UnknownHostException { +// RedisTemplate template = new RedisTemplate<>(); +// template.setConnectionFactory(redisConnectionFactory); +// return template; +// } + + @Bean + @ConditionalOnMissingBean + public StringRedisTemplate stringRedisTemplate( + RedisConnectionFactory redisConnectionFactory) throws UnknownHostException { + StringRedisTemplate template = new StringRedisTemplate(); + template.setConnectionFactory(redisConnectionFactory); + return template; + } + + /** + // * 缓存对象 bean 配置 + // * + // * @param redisConnectionFactory + // * @return + // */ + @Bean(name = "redisTemplate") + @ConditionalOnMissingBean(name = "redisTemplate") + public RedisTemplate redisTemplate(RedisConnectionFactory redisConnectionFactory) { + RedisTemplate template = new RedisTemplate<>(); + template.setConnectionFactory(redisConnectionFactory); + + // key 的序列化规则 默认单节点模式 + RedisSerializer redisKeySerializer = new StringRedisSerializer(); + + template.setKeySerializer(redisKeySerializer); + template.setHashKeySerializer(redisKeySerializer); + + // value 的序列化规则 + // 使用Jackson2JsonRedisSerializer来序列化和反序列化redis的value值 + Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer<>(Object.class); + ObjectMapper om = new ObjectMapper(); + om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); + /// om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL); + om.activateDefaultTyping(LaissezFaireSubTypeValidator.instance, ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.PROPERTY); + // 解决 jackson2 无法反序列化 LocalDateTime 的问题 + om.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + om.registerModule(new JavaTimeModule()); + jackson2JsonRedisSerializer.setObjectMapper(om); + template.setValueSerializer(jackson2JsonRedisSerializer); + template.setHashValueSerializer(jackson2JsonRedisSerializer); + template.afterPropertiesSet(); + return template; + } + + + /** + * 缓存管理器配置 + * + *

缓存注解配置

+ * + * @param factory + * @return + */ +// @Bean +// public CacheManager cacheManager(RedisConnectionFactory factory) { +// // key 的序列化规则 +// RedisSerializer redisKeySerializer = new StringRedisSerializer(); +// +// // vulue 序列化规则 +// Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer<>(Object.class); +// //解决查询缓存转换异常的问题 +// ObjectMapper om = new ObjectMapper(); +// om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); +// om.activateDefaultTyping(LaissezFaireSubTypeValidator.instance, ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.PROPERTY); +// jackson2JsonRedisSerializer.setObjectMapper(om); +// // 解决 jackson2 无法反序列化 LocalDateTime 的问题 +// om.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); +// om.registerModule(new JavaTimeModule()); +// +// +// // 配置序列化(解决乱码的问题) +// RedisCacheConfiguration config = RedisCacheConfiguration.defaultCacheConfig() +// // 设置缓存的默认过期时间,也是使用Duration设置 +// .entryTtl(Duration.ofMinutes(0)) +//// .prefixKeysWith(prefixCacheNameWith) +// // .computePrefixWith(name -> ":") +//// .prefixCacheNameWith(prefixCacheNameWith) +// .serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(redisKeySerializer)) +// .serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(jackson2JsonRedisSerializer)); +//// log.info("redis 分布式缓存管理器注册成功, 可以使用缓存注解进行缓存数据"); +// return RedisCacheManager +// .builder(factory) +// .cacheDefaults(config) +// .build(); +// } +} diff --git a/common/src/main/java/com/huoran/common/config/RedisConfig.java b/common/src/main/java/com/huoran/common/config/RedisConfig.java new file mode 100644 index 0000000..8d9902c --- /dev/null +++ b/common/src/main/java/com/huoran/common/config/RedisConfig.java @@ -0,0 +1,25 @@ +package com.huoran.common.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.redis.connection.RedisConnectionFactory; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer; +import org.springframework.data.redis.serializer.StringRedisSerializer; + +@Configuration +public class RedisConfig { + + @Bean + public RedisTemplate getRedisTemplate(RedisConnectionFactory factory) { + RedisTemplate template = new RedisTemplate<>(); + template.setKeySerializer(new StringRedisSerializer()); + template.setHashKeySerializer(new StringRedisSerializer()); + template.setHashValueSerializer(new GenericJackson2JsonRedisSerializer()); + template.setValueSerializer(new GenericJackson2JsonRedisSerializer()); + template.setEnableTransactionSupport(true); + template.setConnectionFactory(factory); + return template; + } + +} diff --git a/common/src/main/java/com/huoran/common/config/RobotNotification.java b/common/src/main/java/com/huoran/common/config/RobotNotification.java new file mode 100644 index 0000000..be3ad37 --- /dev/null +++ b/common/src/main/java/com/huoran/common/config/RobotNotification.java @@ -0,0 +1,36 @@ +package com.huoran.common.config; + +import okhttp3.*; +import org.springframework.context.annotation.Configuration; + +import java.io.IOException; +@Configuration +public class RobotNotification { + + static String WECHAT_GROUP = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=8d6b7307-2534-4d51-8708-740bc98fc1d7"; + + /** + * @content:要发送的消息 + * WECHAT_GROUP:机器人的webhook + */ + public static String callWeChatBot(String content) { + OkHttpClient client = new OkHttpClient() + .newBuilder() + .build(); + MediaType mediaType = MediaType.parse("application/json"); + RequestBody body = RequestBody.create(content,mediaType); + Request request = new Request.Builder() + .url(WECHAT_GROUP) + .method("POST", body) + .addHeader("Content-Type", "application/json") + .build(); + Response response = null; + try { + response = client.newCall(request).execute(); + } catch (IOException e) { + e.printStackTrace(); + } + return response.message(); + } + +} diff --git a/common/src/main/java/com/huoran/common/config/SentinelConfig.java b/common/src/main/java/com/huoran/common/config/SentinelConfig.java new file mode 100644 index 0000000..6fb5e41 --- /dev/null +++ b/common/src/main/java/com/huoran/common/config/SentinelConfig.java @@ -0,0 +1,37 @@ +/* +package com.huoran.common.config; + +import com.alibaba.csp.sentinel.adapter.servlet.callback.UrlBlockHandler; +import com.alibaba.csp.sentinel.adapter.servlet.callback.WebCallbackManager; +import com.alibaba.csp.sentinel.slots.block.BlockException; +import com.alibaba.fastjson.JSON; +import com.huoran.common.response.R; +import org.springframework.context.annotation.Configuration; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +*/ +/** + * @Author chen + * @DATE 2022/7/11 11:45 + * @Version 1.0 + *//* + +@Configuration +public class SentinelConfig { + + public SentinelConfig(){ + WebCallbackManager.setUrlBlockHandler(new UrlBlockHandler() { + @Override + public void blocked(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, BlockException e) throws IOException { + R error = R.error("流量请求过大!"); + httpServletResponse.setCharacterEncoding("UTF-8"); + httpServletResponse.setContentType("application/json"); + httpServletResponse.getWriter().write(JSON.toJSONString(error)); + } + }); + } +} +*/ diff --git a/common/src/main/java/com/huoran/common/constant/AnRateLimiter.java b/common/src/main/java/com/huoran/common/constant/AnRateLimiter.java new file mode 100644 index 0000000..42f6ef4 --- /dev/null +++ b/common/src/main/java/com/huoran/common/constant/AnRateLimiter.java @@ -0,0 +1,21 @@ +package com.huoran.common.constant; + +import java.lang.annotation.*; + +import java.util.concurrent.TimeUnit; + +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.METHOD}) +@Documented +public @interface AnRateLimiter { + + //以固定数值往令牌桶添加令牌 + double permitsPerSecond(); + //获取令牌最大等待时间 + long timeout(); + // 单位(例:分钟/秒/毫秒) 默认:毫秒 + TimeUnit timeunit() default TimeUnit.MILLISECONDS; + // 无法获取令牌返回提示信息 默认值可以自行修改 + String msg() default "系统繁忙,请稍后再试."; + +} diff --git a/common/src/main/java/com/huoran/common/constant/AssessmentConstant.java b/common/src/main/java/com/huoran/common/constant/AssessmentConstant.java new file mode 100644 index 0000000..166f9d9 --- /dev/null +++ b/common/src/main/java/com/huoran/common/constant/AssessmentConstant.java @@ -0,0 +1,48 @@ +package com.huoran.common.constant; + +/** + * @Author chen + * @DATE 2021/7/1 17:06 + * @Version 1.0 + * @Description 考核常量类 + */ +public interface AssessmentConstant { + + //考试状态(0、未考 1、在考 2、已考 + /** + * 未考 + */ + Integer EXAMINATION_STATE_NOT_START = 0; + + /** + * 在考 + */ + Integer EXAMINATION_STATE_START = 1; + + /** + * 已考-已结束 + */ + Integer EXAMINATION_STATE_STOP = 2; + + + /** + * 指定范围 + */ + Integer IS_SPECIFY = 1; + + /** + * 未指定范围 + */ + Integer NOT_IS_SPECIFY = 0; + + + /** + * 是否启用邀请码 :未启用 + */ + Integer NOT_IS_ENABLE_CODE= 0; + + /** + * 是否启用邀请码 :启用 + */ + Integer IS_ENABLE_CODE = 1; +} diff --git a/common/src/main/java/com/huoran/common/constant/ClassificationOfTheoreticalCoursesConstant.java b/common/src/main/java/com/huoran/common/constant/ClassificationOfTheoreticalCoursesConstant.java new file mode 100644 index 0000000..34b4ad5 --- /dev/null +++ b/common/src/main/java/com/huoran/common/constant/ClassificationOfTheoreticalCoursesConstant.java @@ -0,0 +1,33 @@ +package com.huoran.common.constant; + +/** + * @ProjectName: huorantech + * @Package: com.huoran.data_platform.constant + * @ClassName: DelConstant + * @Description: 理论课程 + * @Author: Maureen.Rong + * @CreateDate: 2021/6/30 16:09 + * @UpdateDate: 2021/6/30 16:09 + * @Version: 1.0 + */ +public class ClassificationOfTheoreticalCoursesConstant { + + //学校分类 + public static final Integer SCHOOL_CLASSIFICATION = 1; + + //中台分类 + public static final Integer NAKADAI_CLASSIFICATION = 0; + + + /** + * 理论课程范围 (0:本校内 1:全平台 2.指定区域、院校) + */ + + //本校 + public static final Integer OUR_SCHOOL = 0; + //全平台 + public static final Integer ALL_PLATFORMS = 1; + //指定范围 + public static final Integer SPECIFIED_RANGE = 2; + +} diff --git a/common/src/main/java/com/huoran/common/constant/DelConstant.java b/common/src/main/java/com/huoran/common/constant/DelConstant.java new file mode 100644 index 0000000..80c63ad --- /dev/null +++ b/common/src/main/java/com/huoran/common/constant/DelConstant.java @@ -0,0 +1,68 @@ +package com.huoran.common.constant; + +/** + * @ProjectName: huorantech + * @Package: com.huoran.data_platform.constant + * @ClassName: DelConstant + * @Description: 逻辑删除 + * @Author: Maureen.Rong + * @CreateDate: 2021/6/30 16:09 + * @UpdateDate: 2021/6/30 16:09 + * @Version: 1.0 + */ +public class DelConstant { + + /** + * 已删除 + */ + public static final Integer IS_DEL = 1; + + /** + * 未删除 + */ + public static final Integer NOT_DEL = 0; + + /** + * 已启用 + */ + public static final Integer IS_ENABLE = 1; + + /** + * 未启用 + */ + public static final Integer NO_ENABLE = 0; + + /** + * 开启 + */ + public static final Integer IS_OPEN = 0; + + /** + * 未开启 + */ + public static final Integer NO_OPEN = 1; + + /** + * 发布状态:1发布 + */ + public static final Integer POST_STATUS = 1; + + + /** + * 发布状态:0未发布 + */ + public static final Integer NOT_RELEASE = 0; + + /** + * 数据平台:普通用户角色 + */ + public static final Integer ROLE_USER = 0; + + + /** + * 发布类型(0默认发布 1批量手动导入) + */ + public static final Integer PUBLICATION_TYPE_DEFAULT = 0; + + public static final Integer PUBLICATION_TYPE_MANUALOPERATION = 1; +} diff --git a/common/src/main/java/com/huoran/common/constant/EnableStatus.java b/common/src/main/java/com/huoran/common/constant/EnableStatus.java new file mode 100644 index 0000000..fc6defb --- /dev/null +++ b/common/src/main/java/com/huoran/common/constant/EnableStatus.java @@ -0,0 +1,12 @@ +package com.huoran.common.constant; + +/** + * @Author chen + * @DATE 2020/10/10 10:30 + * @Version 1.0 + * 课程启用状态常亮类 + */ +public interface EnableStatus { + String ENABLE = "1";//启用 + String NOT_ACTIVATED = "0";//未启用 +} diff --git a/common/src/main/java/com/huoran/common/constant/ExcelConstant.java b/common/src/main/java/com/huoran/common/constant/ExcelConstant.java new file mode 100644 index 0000000..8c80f0c --- /dev/null +++ b/common/src/main/java/com/huoran/common/constant/ExcelConstant.java @@ -0,0 +1,20 @@ +package com.huoran.common.constant; + +/** + * @description excel导出常量类 + * @author: Mr.JK + * @create: 2021-06-10 09:54 + **/ +public class ExcelConstant { + + /** + * 每个sheet存储的记录数 100W + */ + public static final Integer PER_SHEET_ROW_COUNT = 1000000; + + /** + * 每次向EXCEL写入的记录数(查询每页数据大小) 20W + */ + public static final Integer PER_WRITE_ROW_COUNT = 200000; + +} diff --git a/common/src/main/java/com/huoran/common/constant/LoginDistConstant.java b/common/src/main/java/com/huoran/common/constant/LoginDistConstant.java new file mode 100644 index 0000000..9b1fa40 --- /dev/null +++ b/common/src/main/java/com/huoran/common/constant/LoginDistConstant.java @@ -0,0 +1,20 @@ +package com.huoran.common.constant; + +/** + * @Author chen + * @DATE 2021/7/19 9:58 + * @Version 1.0 + * 区分手机号账号登录,1为账号登录,2为手机号或邮箱登录 + */ +public interface LoginDistConstant { + + /** + * 账号登录 + */ + Integer ACCOUNT_LOGIN = 1; + + /** + * 手机号或邮箱登录 + */ + Integer PHONE_EMAIL_LOGIN = 2; +} diff --git a/common/src/main/java/com/huoran/common/constant/ModellConstant.java b/common/src/main/java/com/huoran/common/constant/ModellConstant.java new file mode 100644 index 0000000..55fd2cf --- /dev/null +++ b/common/src/main/java/com/huoran/common/constant/ModellConstant.java @@ -0,0 +1,20 @@ +package com.huoran.common.constant; + + +public class ModellConstant { + //创建来源 系统 or 院校 + /** + * 系统 + */ + public static final Integer SOURCE_SYSTEM = 0; + + + /** + * 院校来源 + */ + public static final Integer SOURCE_INSTITUTION = 1; + + + public static final Integer PUBLICATION_STATUS_PUBLISHED = 1; + +} diff --git a/common/src/main/java/com/huoran/common/constant/OrderConstant.java b/common/src/main/java/com/huoran/common/constant/OrderConstant.java new file mode 100644 index 0000000..c97aa7c --- /dev/null +++ b/common/src/main/java/com/huoran/common/constant/OrderConstant.java @@ -0,0 +1,51 @@ +package com.huoran.common.constant; + +/** + * @Author chen + * @DATE 2021/7/1 17:06 + * @Version 1.0 + * @Description 订单常量类 + */ +public interface OrderConstant { + + /** + * 未发货 + */ + Integer NOT_SHIPPED = 0; + + /** + * 已发货,已完成 + */ + Integer SHIPPED = 1; + + /** + * 启用 + */ + Integer Enable = 1; + + /** + * 不启用 + */ + Integer Not_enabled = 0; + + /** + * 数据平台权限 + */ + Integer DATA_AUTHORITY = 0; + + /** + * 课程权限 + */ + Integer COURSE_AUTHORITY = 1; + + /** + * 订单初签 + */ + Integer FIRST_SIGN = 1; + + /** + * 订单续签 + */ + Integer RENEW = 2; + +} diff --git a/common/src/main/java/com/huoran/common/constant/PlatformConstant.java b/common/src/main/java/com/huoran/common/constant/PlatformConstant.java new file mode 100644 index 0000000..4e5283e --- /dev/null +++ b/common/src/main/java/com/huoran/common/constant/PlatformConstant.java @@ -0,0 +1,35 @@ +package com.huoran.common.constant; + +/** + * @ProjectName: huorantech + * @Package: com.huoran.data_platform.constant + * @ClassName: DelConstant + * @Description: 数据平台平台来源 + * @Author: Maureen.Rong + * @CreateDate: 2021/6/30 16:09 + * @UpdateDate: 2021/6/30 16:09 + * @Version: 1.0 + */ +public class PlatformConstant { + + //职站 + public static final Integer POST_STATION = 1; + + //数据平台id + public static final Integer DATA_PLATFORM = 2; + + //中台 + public static final Integer NAKADAI = 3; + + //合伙人平台 + public static final Integer ACCESSORY = 4; + + //教师端 + public static final Integer TEACHER_SIDE = 0; + + //学生端 + public static final Integer STUDENT_SIDE = 1; + + //无端 + public static final Integer UNPROVOKED = 2; +} diff --git a/common/src/main/java/com/huoran/common/constant/PointConstant.java b/common/src/main/java/com/huoran/common/constant/PointConstant.java new file mode 100644 index 0000000..1d2bd93 --- /dev/null +++ b/common/src/main/java/com/huoran/common/constant/PointConstant.java @@ -0,0 +1,8 @@ +package com.huoran.common.constant; + +public interface PointConstant { + + int PROGRAMMING = 0;//0编程类 + + int PROCESS = 1;//1流程类 +} diff --git a/common/src/main/java/com/huoran/common/constant/RabbitmqConstant.java b/common/src/main/java/com/huoran/common/constant/RabbitmqConstant.java new file mode 100644 index 0000000..5ac26b7 --- /dev/null +++ b/common/src/main/java/com/huoran/common/constant/RabbitmqConstant.java @@ -0,0 +1,19 @@ +package com.huoran.common.constant; + +public interface RabbitmqConstant { + + /** + * 评论交换机常量 + */ + String COMMENT_EXCHANGE = "comment.exchange"; + + /** + * 评论队列常量 + */ + String COMMENT_QUEUE = "commentQueue"; + + /** + * 评论路由键 + */ + String COMMENT_ROUTING_KEY = "commentKey"; +} diff --git a/common/src/main/java/com/huoran/common/constant/SMSTemplate.java b/common/src/main/java/com/huoran/common/constant/SMSTemplate.java new file mode 100644 index 0000000..25a167b --- /dev/null +++ b/common/src/main/java/com/huoran/common/constant/SMSTemplate.java @@ -0,0 +1,34 @@ +package com.huoran.common.constant; + +/** + * @Author chen + * @DATE 2021/7/7 14:14 + * @Version 1.0 + */ +public interface SMSTemplate { + + // 短信签名 + String SMS_SIGNATURE = "或然科技"; + + // 找回密码验证码 + String RETRIEVE_PASSWORD_CODE = "SMS_219310031"; + + // 身份验证验证码 + String AUTHENTICATION_CODE = "SMS_221515019"; + + // 登录确认验证码 + String LOGIN_VERIFICATION_CODE = "SMS_204155296"; + + // 登录异常验证码 + String LOGIN_EXCEPTION_CODE = "SMS_204155295"; + + // 用户注册验证码 + String USER_REGISTRATION_CODE = "SMS_204155294"; + + // 修改密码验证码 + String MODIFY_PASSWORD_CODE = "SMS_204155293"; + + // 信息变更验证码 + String INFORMATION_CHANGE_CODE = "SMS_204155292"; + +} diff --git a/common/src/main/java/com/huoran/common/constant/ServiceNameConstant.java b/common/src/main/java/com/huoran/common/constant/ServiceNameConstant.java new file mode 100644 index 0000000..6a837cf --- /dev/null +++ b/common/src/main/java/com/huoran/common/constant/ServiceNameConstant.java @@ -0,0 +1,44 @@ +package com.huoran.common.constant; + +/** + * @description 服务名称常量类 + * @author: Mr.JK + * @create: 2021-08-26 14:30 + **/ +public class ServiceNameConstant { + + /** + * 数据平台serviceId + */ + public static final String DATA_PLATFORM = "data"; + + /** + * 判分点serviceId + */ + public static final String JUDGMENT_POINT = "judgment"; + + /** + * 中台serviceId + */ + public static final String NAKADAI = "nakadai"; + + /** + * 职站serviceId + */ + public static final String OCCUPATIONLAB = "occupationlab"; + + /** + * 用户管理serviceId + */ + public static final String USERS = "users"; + + /** + * python子系统serviceId + */ + public static final String PYTHON = "python"; + + /** + * 银行子系统serviceId + */ + public static final String BANK = "bank"; +} diff --git a/common/src/main/java/com/huoran/common/constant/TeamCalculationMethodConstant.java b/common/src/main/java/com/huoran/common/constant/TeamCalculationMethodConstant.java new file mode 100644 index 0000000..29a05fd --- /dev/null +++ b/common/src/main/java/com/huoran/common/constant/TeamCalculationMethodConstant.java @@ -0,0 +1,31 @@ +package com.huoran.common.constant; + +/** + * @Author chen + * @DATE 2021/7/1 17:06 + * @Version 1.0 + * @Description 考核常量类 + */ +public interface TeamCalculationMethodConstant { + + //团队成绩计算方式(0:最高分,1:平均分,2:求和) + /** + * 取最高分 + */ + Integer HIGHEST_SCORE_IN_A_TEAM_EVENT = 0; + + /** + * 取平均分 + */ + Integer AVERAGE_SCORE_OF_TEAM_COMPETITION = 1; + + /** + * 取最高分 + */ + Integer SUM_OF_TEAM_COMPETITION = 2; + + + //赛事类型(0为个人赛,1为团队赛)默认为0 + Integer TYPE_OF_EVENT_INDIVIDUAL_COMPETITION = 0; + Integer TYPE_OF_EVENT_TEAM_EVENT = 1; +} diff --git a/common/src/main/java/com/huoran/common/entity/Architecture.java b/common/src/main/java/com/huoran/common/entity/Architecture.java new file mode 100644 index 0000000..a448e95 --- /dev/null +++ b/common/src/main/java/com/huoran/common/entity/Architecture.java @@ -0,0 +1,74 @@ +package com.huoran.common.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + *

+ * 学生组织架构 + *

+ * + * @author lr + * @since 2021-08-24 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_architecture") +@ApiModel(value = "Architecture对象", description = "学生组织架构") +public class Architecture implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "自增id 新增无需传值") + private Integer id; + + @ApiModelProperty(value = "组织名称") + private String organizationName; + + @ApiModelProperty(value = "父id 一级为0", example = "0", name = "parentId") + private Integer parentId; + + + @ApiModelProperty(value = "学校id", example = "1", name = "schoolId") + private Integer schoolId; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "逻辑删除") + @TableLogic + private Integer isDel; + + + @ApiModelProperty(value = "层级") + private Integer level; + + @ApiModelProperty(value = "子级") + @TableField(exist = false) + private List children; + + @ApiModelProperty(value = "层级拼接") + @TableField(exist = false) + private String splicingLevel; + + /*@ApiModelProperty(value = "班級") + @TableField(exist = false) + private List classList;*/ + + +} diff --git a/common/src/main/java/com/huoran/common/entity/BcJudgmentPoint.java b/common/src/main/java/com/huoran/common/entity/BcJudgmentPoint.java new file mode 100644 index 0000000..7701ff7 --- /dev/null +++ b/common/src/main/java/com/huoran/common/entity/BcJudgmentPoint.java @@ -0,0 +1,62 @@ +package com.huoran.common.entity; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + * @description 编程类判分点实体 + * @author: Mr.JK + * @create: 2021-09-01 16:12 + **/ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class BcJudgmentPoint implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "编程类判分点主键") + private Integer bcId; + + @ApiModelProperty(value = "编程类判分点名称") + private String name; + + @ApiModelProperty(value = "实验要求") + private String experimentalRequirements; + + @ApiModelProperty(value = "实验代码") + private String experimentCode; + + @ApiModelProperty(value = "实验要求显示类型") + private String experimentalRequirementsType; + + @ApiModelProperty(value = "实验代码显示类型") + private String experimentCodeType; + + @ApiModelProperty(value = "项目id") + private String projectId; + + @ApiModelProperty(value = "系统id") + private Integer systemId; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "是否开启(0开启 1未开启 默认为0)") + private Integer isOpen; + + @ApiModelProperty(value = "是否删除(0未删除 1已删除 默认为0)") + private Integer isDel; + + @ApiModelProperty(value = "创建时间") + private Date createTime; + + @ApiModelProperty(value = "更新时间") + private Date updateTime; + +} diff --git a/common/src/main/java/com/huoran/common/entity/Class.java b/common/src/main/java/com/huoran/common/entity/Class.java new file mode 100644 index 0000000..3f395fb --- /dev/null +++ b/common/src/main/java/com/huoran/common/entity/Class.java @@ -0,0 +1,52 @@ +package com.huoran.common.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 班级表 + *

+ * + * @author lr + * @since 2021-08-18 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_class") +@ApiModel(value = "Class对象", description = "班级表") +public class Class implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "班级名称") + private String className; + + @ApiModelProperty(value = "学生架构id(ol_architecture表)") + private Integer architectureId; + + @TableLogic + @ApiModelProperty(value = "是否删除(0、未删除 1、已删除)") + private Integer isDel; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "备注") + private String remark; + + +} diff --git a/common/src/main/java/com/huoran/common/entity/ExperimentalReport.java b/common/src/main/java/com/huoran/common/entity/ExperimentalReport.java new file mode 100644 index 0000000..29f51d0 --- /dev/null +++ b/common/src/main/java/com/huoran/common/entity/ExperimentalReport.java @@ -0,0 +1,146 @@ +package com.huoran.common.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + * @description + * @author: Mr.JK + * @create: 2021-09-13 17:13 + **/ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_experimental_report") +@ApiModel(value = "ExperimentalReport对象", description = "存储各子系统的实验报告") +public class ExperimentalReport implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "实验报告主键") + @TableId(value = "report_id", type = IdType.AUTO) + private Integer reportId; + + @ApiModelProperty(value = "项目管理id") + private Integer projectId; + + @ApiModelProperty(value = "班级id") + private Integer classId; + + @ApiModelProperty(value = "课程id(curriculum表主键)") + private Integer curriculumId; + + @ApiModelProperty(value = "考核id(当进入的实验为练习时本列为空)") + private Integer assessmentId; + + @ApiModelProperty(value = "老师名称") + @TableField(exist = false) + private String teacherName; + + @ApiModelProperty(value = "学号") + @TableField(exist = false) + private String workNumber; + + @ApiModelProperty(value = "用户名称 (学生姓名)") + @TableField(exist = false) + private String userName; + + @ApiModelProperty(value = "学生账号id") + private Integer accountId; + + @ApiModelProperty(value = "实验原理") + private String principle; + + @ApiModelProperty(value = "实验内容") + private String content; + + @ApiModelProperty(value = "实验步骤") + private String step; + + @ApiModelProperty(value = "实验数据") + private String data; + + @ApiModelProperty(value = "实验分析") + private String analysis; + + @ApiModelProperty(value = "实验结论") + private String conclusion; + + @ApiModelProperty(value = "实验总结") + private String summarize; + + @ApiModelProperty(value = "实验器材") + private String equipment; + + @ApiModelProperty(value = "实验目的") + private String purpose; + + @ApiModelProperty(value = "对本实验过程方法及手段的改进建议") + private String improvement; + + @ApiModelProperty(value = "绑定教师评语id") + private Integer commentId; + + @ApiModelProperty(value = "教师评语") + private String comment; + + @ApiModelProperty(value = "绑定老师id") + private Integer teacherId; + + @ApiModelProperty(value = "学时") + private String period; + + @ApiModelProperty(value = "实验室名称") + private String laboratory; + + @ApiModelProperty(value = "是否启用教师签名(0不启用,1启用,默认0)") + private Integer isSignature; + + @ApiModelProperty(value = "绑定教师签名id") + private Integer signatureId; + + @ApiModelProperty(value = "指导老师:(考核的自动读取发布考核的老师名称,可修改)") + private String instructor; + + @ApiModelProperty(value = "实验项目名称:(自动读取,可修改)") + private String projectName; + + @ApiModelProperty(value = "学生班级:(自动读取学生班级,可修改)") + private String className; + + @ApiModelProperty(value = "得分") + private Integer score; + + @ApiModelProperty(value = "进入时间") + private Date startTime; + + @ApiModelProperty(value = "结束时间") + private Date endTime; + + @ApiModelProperty(value = "提交时间") + private Date submitTime; + + @ApiModelProperty(value = "耗时") + private Integer timeSum; + + @ApiModelProperty(value = "是否删除(0未删除1已删除 默认0)") + private Integer isDel; + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + @ApiModelProperty(value = "商品id") + private Integer mallId; + + +} \ No newline at end of file diff --git a/common/src/main/java/com/huoran/common/entity/FilesResult.java b/common/src/main/java/com/huoran/common/entity/FilesResult.java new file mode 100644 index 0000000..be40023 --- /dev/null +++ b/common/src/main/java/com/huoran/common/entity/FilesResult.java @@ -0,0 +1,36 @@ +package com.huoran.common.entity; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; + +import java.io.Serializable; + +/** + * @Author chen + * @DATE 2021/7/13 9:52 + * @Version 1.0 + */ +@Data +@ToString +@AllArgsConstructor +@NoArgsConstructor +public class FilesResult implements Serializable { + + private static final long serialVersionUID = 1L; + + // 阿里云存储文件名 + private String ossFileName; + // 文件在储存空间的路径 + private String fileUrl; + // 文件类型 + private String fileType; + // 视频资源Id + private String fileId; + //文件大小 + private String fileSize; + //原传文件名 + private String originalFileName; + +} diff --git a/common/src/main/java/com/huoran/common/entity/LcJudgmentPoint.java b/common/src/main/java/com/huoran/common/entity/LcJudgmentPoint.java new file mode 100644 index 0000000..10062da --- /dev/null +++ b/common/src/main/java/com/huoran/common/entity/LcJudgmentPoint.java @@ -0,0 +1,54 @@ +package com.huoran.common.entity; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + * @description 流程类判分点实体 + * @author: Mr.JK + * @create: 2021-09-01 16:30 + **/ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class LcJudgmentPoint implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "流程类判分点主键") + private Integer lcId; + + @ApiModelProperty(value = "流程类判分点名称") + private String name; + + @ApiModelProperty(value = "实验要求") + private String experimentalRequirements; + + @ApiModelProperty(value = "项目id") + private String projectId; + + @ApiModelProperty(value = "系统id") + private Integer systemId; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "是否开启(0开启 1未开启 默认0)") + private Integer isOpen; + + @ApiModelProperty(value = "是否删除(0未删除 1已删除 默认0)") + private Integer isDel; + + @ApiModelProperty(value = "创建时间") + private Date createTime; + + @ApiModelProperty(value = "更新时间") + private Date updateTime; + + +} \ No newline at end of file diff --git a/common/src/main/java/com/huoran/common/entity/LcJudgmentRuleReq.java b/common/src/main/java/com/huoran/common/entity/LcJudgmentRuleReq.java new file mode 100644 index 0000000..bf45dce --- /dev/null +++ b/common/src/main/java/com/huoran/common/entity/LcJudgmentRuleReq.java @@ -0,0 +1,33 @@ +package com.huoran.common.entity; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + * @description 前端判分规则实体 + * @author: Mr.JK + * @create: 2021-08-18 17:26 + **/ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class LcJudgmentRuleReq { + + @ApiModelProperty(value = "操作id串") + private String operationIds; + + @ApiModelProperty(value = "题目类型(1选择 2判断 3填空 4问答 5指标结果)") + private String type; + + @ApiModelProperty(value = "空格一",notes = "选择题、判断题填subject_id,填空题、问答题、指标结果填需要字段") + private String emptyOne; + + @ApiModelProperty(value = "空格二",notes = "选择题、判断题填item_id,填空题、问答题、指标结果填需要字段") + private String emptyTwo; + + @ApiModelProperty(value = "答案id(缓存使用)") + private String answerId; + +} \ No newline at end of file diff --git a/common/src/main/java/com/huoran/common/entity/LcRuleRecord.java b/common/src/main/java/com/huoran/common/entity/LcRuleRecord.java new file mode 100644 index 0000000..e241a52 --- /dev/null +++ b/common/src/main/java/com/huoran/common/entity/LcRuleRecord.java @@ -0,0 +1,69 @@ +package com.huoran.common.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 流程类判分规则用户答案记录表 + *

+ * + * @author Mr.JK + * @since 2021-09-18 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="LcRuleRecord对象", description="流程类判分规则用户答案记录表") +public class LcRuleRecord implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "规则id") + private Integer ruleId; + + @ApiModelProperty(value = "题目类型(1选择 2判断 3填空 4问答 5指标结果)") + @TableField(exist = false) + private String type; + + @ApiModelProperty(value = "考核点名称") + @TableField(exist = false) + private String name; + + @ApiModelProperty(value = "规则答案") + private String ruleAnswer; + + @ApiModelProperty(value = "用户答案") + private String userAnswer; + + @ApiModelProperty(value = "标识") + private String flag; + + @ApiModelProperty(value = "是否删除") + @TableLogic(value = "0",delval = "1") + private Integer isDel; + + @ApiModelProperty(value = "开始时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @TableField(exist = false) + private String operationIds; + + +} diff --git a/common/src/main/java/com/huoran/common/entity/NewClientManagement.java b/common/src/main/java/com/huoran/common/entity/NewClientManagement.java new file mode 100644 index 0000000..ac192a9 --- /dev/null +++ b/common/src/main/java/com/huoran/common/entity/NewClientManagement.java @@ -0,0 +1,63 @@ +package com.huoran.common.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + *

+ * 企业端客户管理 + *

+ * + * @author Ning + * @since 2020-10-27 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_client_management") +@ApiModel(value = "ClientManagement对象", description = "企业端客户管理") +public class NewClientManagement implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "客户名称") + private String clientName; + + @ApiModelProperty(value = "省份id") + private Integer provinceId; + + @ApiModelProperty(value = "城市id") + private Integer cityId; + + @ApiModelProperty(value = "省份名称") + private String provinceName; + + @ApiModelProperty(value = "城市名称") + private String cityName; + + @ApiModelProperty(value = "联系人姓名") + private String contactPersonName; + + @ApiModelProperty(value = "手机号") + private String phone; + + @ApiModelProperty(value = "客户类型") + private Integer type; + + @ApiModelProperty(value = "是否禁用") + @TableField("is_disable") + private Integer isDisable; +} diff --git a/common/src/main/java/com/huoran/common/entity/ProjectJudgmentVo.java b/common/src/main/java/com/huoran/common/entity/ProjectJudgmentVo.java new file mode 100644 index 0000000..82e514d --- /dev/null +++ b/common/src/main/java/com/huoran/common/entity/ProjectJudgmentVo.java @@ -0,0 +1,46 @@ +package com.huoran.common.entity; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; + +/** + * @description 项目管理判分点中间表增强实体 + * @author: Mr.JK + * @create: 2021-09-01 16:00 + **/ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class ProjectJudgmentVo { + + @ApiModelProperty(value = "主键id") + private Integer id; + + @ApiModelProperty(value = "分数") + @NotNull(message = "分数不能为空!") + private Integer score; + + @ApiModelProperty(value = "项目id") + @NotNull(message = "项目id不能为空!") + private String projectId; + + @ApiModelProperty(value = "判分点id(编程与流程)系统id为11时,是流程类") + @NotNull(message = "判分点id不能为空!") + private Integer judgmentId; + + @ApiModelProperty(value = "实验要求") + private String experimentalRequirements; + + @ApiModelProperty(value = "判分点名称") + private String name; + + @ApiModelProperty(value = "实验要求显示类型") + private String experimentalRequirementsType; + + @ApiModelProperty(value = "实验代码显示类型") + private String experimentCodeType; +} diff --git a/common/src/main/java/com/huoran/common/entity/ProjectManage.java b/common/src/main/java/com/huoran/common/entity/ProjectManage.java new file mode 100644 index 0000000..b5c10a5 --- /dev/null +++ b/common/src/main/java/com/huoran/common/entity/ProjectManage.java @@ -0,0 +1,161 @@ +package com.huoran.common.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 项目管理表 + *

+ * + * @author Mr.JK + * @since 2021-08-26 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_project_manage") +@ApiModel(value = "ProjectManage对象", description = "项目管理表") +public class ProjectManage implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键id") + @TableId(value = "project_id", type = IdType.AUTO) + private Integer projectId; + + @ApiModelProperty(value = "项目名称") + @NotBlank(message = "项目名称不能为空!") + private String projectName; + + @ApiModelProperty(value = "项目权限(0、练习 1、考核 2、竞赛)") + @NotNull(message = "项目权限不能为空!") + private Integer permissions; + + @ApiModelProperty(value = "系统id") + @NotNull(message = "系统id不能为空!") + private Integer systemId; + + @ApiModelProperty(value = "系统名称") + @TableField(exist = false) + private String systemName; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + + @ApiModelProperty(value = "创建人角色(0、系统 1、院校)") + @NotNull(message = "创建人角色不能为空!") + private Integer founder; + + + @ApiModelProperty(value = "创建人") + @TableField(exist = false) + private String creator; + + + @ApiModelProperty(value = "状态(0、草稿箱 1、已发布)") + @NotNull(message = "状态不能为空!") + private Integer state; + + @ApiModelProperty(value = "系统类型(0编程类 1流程类)") + @TableField(exist = false) + private Integer type; + + @ApiModelProperty(value = "实验目标") + private String experimentTarget; + + @ApiModelProperty(value = "实验描述") + private String experimentDescription; + + @ApiModelProperty(value = "实验提示") + private String experimentHint; + + @ApiModelProperty(value = "实验目标显示类型") + private String experimentTargetType; + + @ApiModelProperty(value = "实验描述显示类型") + private String experimentDescriptionType; + + @ApiModelProperty(value = "实验提示显示类型") + private String experimentHintType; + + @ApiModelProperty(value = "实验提示是否开启(0开启 1不开启 默认0)") + private Integer hintOpen; + + @ApiModelProperty(value = "学校实验提示是否开启(0开启 1不开启)") + @TableField(exist = false) + private Integer hintOpenBySchool; + + @ApiModelProperty(value = "是否开启(0开启 1未开启 默认0)") + private Integer isOpen; + + @ApiModelProperty(value = "中台是否开启(0开启 1未开启 默认0)") + private Integer ztOpen; + + @ApiModelProperty(value = "是否删除(0、未删除 1、已删除 默认0)") + @TableLogic(value = "0", delval = "1") + private Integer isDel; + + @ApiModelProperty(value = "中台是否删除(0未删除 1已删除 默认0)") + private Integer ztDel; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "是否为管理员发布 0否 1是") + @TableField(exist = false) + private Integer isAdminRelease; + + @ApiModelProperty(value = "学校名称") + @TableField(exist = false) + private String schoolName; + + @ApiModelProperty(value = "职站是否禁用启用(0启用 1已禁用)") + @TableField(exist = false) + private Integer ccupationlabOpen; + + @ApiModelProperty(value = "创建人") + @TableField(exist = false) + private String createUser; + + @ApiModelProperty(value = "项目发布人角色") + @TableField(exist = false) + private String roleName; + + @ApiModelProperty(value = "备注") + private String remark; + + + @ApiModelProperty(value = "是否学习(0未学习 1已学习)") + @TableField(exist = false) + private Integer whetherToStudyOrNot; + + + @ApiModelProperty(value = "学习进展id") + @TableField(exist = false) + private Integer learningProgressId; + + + @ApiModelProperty(value = "商品id") + private Integer mallId; + + +} diff --git a/common/src/main/java/com/huoran/common/entity/PyAttributesReq.java b/common/src/main/java/com/huoran/common/entity/PyAttributesReq.java new file mode 100644 index 0000000..946528e --- /dev/null +++ b/common/src/main/java/com/huoran/common/entity/PyAttributesReq.java @@ -0,0 +1,36 @@ +package com.huoran.common.entity; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import java.util.Date; +import java.util.List; + +/** + * @Description : python子系统提交答案参数 + * @Author Rong---2021/12/15 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class PyAttributesReq { + + @ApiModelProperty("编程类判分点id") + private Integer bcId; + + @ApiModelProperty("运行结果id") + private Integer codeId; + + @ApiModelProperty("是否提交(0未提交,1为已提交)") + private Integer isSubmit; + + @ApiModelProperty("当前规则用户输入的答案") + private String answer; + + @ApiModelProperty(value = "返回结果(1为正确 0为错误)") + private Integer retResult; + +} diff --git a/common/src/main/java/com/huoran/common/entity/PythonCodeResp.java b/common/src/main/java/com/huoran/common/entity/PythonCodeResp.java new file mode 100644 index 0000000..7704b70 --- /dev/null +++ b/common/src/main/java/com/huoran/common/entity/PythonCodeResp.java @@ -0,0 +1,27 @@ +package com.huoran.common.entity; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "PythonCodeResp", description = "执行返回结果") +public class PythonCodeResp { + + @ApiModelProperty(value = "图片url") + private String photoUrl; + + @ApiModelProperty(value = "执行结果") + private String runResult; + + @ApiModelProperty(value = "返回结果(1为正确 0为错误)") + private Integer retResult; + + @ApiModelProperty(value = "结果") + private Integer codeId; + +} diff --git a/common/src/main/java/com/huoran/common/entity/Role.java b/common/src/main/java/com/huoran/common/entity/Role.java new file mode 100644 index 0000000..1b9ccb2 --- /dev/null +++ b/common/src/main/java/com/huoran/common/entity/Role.java @@ -0,0 +1,57 @@ +package com.huoran.common.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 角色表 + *

+ * + * @author chen + * @since 2021-09-29 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("acl_role") +@ApiModel(value="Role对象", description="角色表") +public class Role implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "角色id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + @ApiModelProperty(value = "角色名称") + private String roleName; + + @ApiModelProperty(value = "角色编码") + private String roleCode; + + @ApiModelProperty(value = "备注") + private String remark; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date updateTime; + +} diff --git a/common/src/main/java/com/huoran/common/entity/RunCode.java b/common/src/main/java/com/huoran/common/entity/RunCode.java new file mode 100644 index 0000000..18af7fc --- /dev/null +++ b/common/src/main/java/com/huoran/common/entity/RunCode.java @@ -0,0 +1,92 @@ +package com.huoran.common.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * python储存实验运行记录 + *

+ * + * @author lr + * @since 2021-09-06 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("python_run_code") +@ApiModel(value = "RunCode对象", description = "python储存实验运行记录") +public class RunCode implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "实验代码主键Id", hidden = true) + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "实验代码", required = true, example = "IMPORT random WORDS = [ \"Python\", \"jumble\", \"easy\", \"difficult\", \"answer\", \"continue\", \"phone\", \"position\", \"pose\", \"game\" ] print ( \"\"\"" + + "欢迎参加猜单词游戏" + + "\"\"\" )" + + "WHILE" + + "TRUE : # 从序列中随机挑出一个单词" + + "word = random.choice ( WORDS ) # 判断玩家是否猜对的变量" + + "correct = word # 保存乱序后的单词" + + "jumble = \"\"" + + "WHILE" + + "word : # 根据 word 长度产生word的随机位置" + + "position = random.randrange ( len ( word ) ) # 将position位置的字母组合乱序后单词" + + "jumble += word [ position ] # 通过切片将position位置的字母从原有单词中删除" + + "word = word [: position ] + word [ ( position + 1 ) :] print ( \"打乱顺序后的单词:\", jumble ) guess = 'q'" + + "IF" + + "guess != 'q' :" + + "WHILE" + + "guess != correct " + + "AND guess != \"\" : print ( \"对不起,不正确!\" ) guess = EXIT ( \"validing:继续猜:\" )" + + "IF" + + "guess == correct : print ( \"恭喜,猜对了!\" ) elif guess == 'q' : print ( '再见!' ) break") + private String code; + + @ApiModelProperty(value = "绑定的项目id", example = "1", required = true) + private Integer projectId; + + @ApiModelProperty(value = "判分点主键Id", example = "1") + private Integer judgmentPointsId; + + @ApiModelProperty(value = "提交状态:默认0未提交,1为已提交", example = "0", hidden = true) + private Integer isSubmit; + + @ApiModelProperty(value = "运行结果", example = "欢迎参加猜单词游戏 打乱顺序后的单词: aersnw 再见!") + private String runResult; + + @ApiModelProperty(value = "运行有没有出现错误(0、运行正确 1、运行错误)", hidden = true) + private Integer isError; + + @ApiModelProperty(value = "绑定账号id", hidden = true) + private Integer accountId; + + @ApiModelProperty(value = "逻辑删除—>默认0未删除,1为已删除", hidden = true) + @TableLogic(value = "0", delval = "1") + private Integer isDel; + + @ApiModelProperty(value = "运行时间", hidden = true) + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "修改时间", hidden = true) + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "实验报告id(ol_experimental_report)", hidden = true) + private Integer reportId; + + @ApiModelProperty(value = "运行的图片") + private String runPhotoUrl; + +} diff --git a/common/src/main/java/com/huoran/common/entity/School.java b/common/src/main/java/com/huoran/common/entity/School.java new file mode 100644 index 0000000..d59c0dd --- /dev/null +++ b/common/src/main/java/com/huoran/common/entity/School.java @@ -0,0 +1,62 @@ +package com.huoran.common.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableField; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 学校表 + *

+ * + * @author lr + * @since 2021-08-10 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_school") +@ApiModel(value="School对象", description="学校表") +public class School implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "学校主键id") + @TableId(value = "schoolId", type = IdType.AUTO) + private Integer schoolId; + + @ApiModelProperty(value = "学校名称") + @TableField("schoolName") + private String schoolName; + + @ApiModelProperty(value = "绑定省份Id") + @TableField("provinceId") + private Integer provinceId; + + @ApiModelProperty(value = "绑定城市Id") + @TableField("cityId") + private Integer cityId; + + @ApiModelProperty(value = "层次(1、本科 2、大专 3、高职 4、中专 5、其他)") + private Integer level; + + @ApiModelProperty(value = "是否删除(0、未删除 1、已删除)") + private String isdel; + + @ApiModelProperty(value = "省份名称") + @TableField("provinceName") + private String provinceName; + + @ApiModelProperty(value = "城市名称") + @TableField("cityName") + private String cityName; + + +} diff --git a/common/src/main/java/com/huoran/common/entity/Student.java b/common/src/main/java/com/huoran/common/entity/Student.java new file mode 100644 index 0000000..5c7e65c --- /dev/null +++ b/common/src/main/java/com/huoran/common/entity/Student.java @@ -0,0 +1,60 @@ +package com.huoran.common.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 学生表 + *

+ * + * @author lr + * @since 2021-08-24 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_student") +@ApiModel(value = "Student对象", description = "学生表") +public class Student implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "班级id(可多个班级逗号隔开,未加入班级的默认为0)") + private String classId; + + + @ApiModelProperty(value = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "学校id(用于区分一个学生可以存在不同的学校)") + private Integer schoolId; + + @ApiModelProperty(value = "更新时间") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + private Integer isDel; + + +} diff --git a/common/src/main/java/com/huoran/common/entity/UserAccount.java b/common/src/main/java/com/huoran/common/entity/UserAccount.java new file mode 100644 index 0000000..2fd415c --- /dev/null +++ b/common/src/main/java/com/huoran/common/entity/UserAccount.java @@ -0,0 +1,87 @@ +package com.huoran.common.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.baomidou.mybatisplus.annotation.TableField; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * @描述:各个平台账号表 + * @作者: Rong + * @日期: 2021-08-25 + */ +@Data +@ApiModel(value = "各个平台账号表") +@TableName("hr_user_account") +public class UserAccount implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "主键id(平台用户id)") + private Integer id; + + @ApiModelProperty(value = "用户表id") + private Integer userId; + + @ApiModelProperty(value = "客户表id") + private Integer customerId; + + @ApiModelProperty(value = "账号") + private String account; + + @ApiModelProperty(value = "密码") + private String password; + + @ApiModelProperty(value = "工号") + private String workNumber; + + @ApiModelProperty(value = "绑定的角色id(0为数据平台普通用户)") + private String roleId; + + @ApiModelProperty(value = "绑定院校id") + private Integer schoolId; + + @ApiModelProperty(value = "所属平台id") + private String platformId; + + @ApiModelProperty(value = "平台(系统)绑定时间") + private Date platformBindTime; + + @ApiModelProperty(value = "平台端区分:0->教师端 1->学生端 2->无端") + private Integer type; + + @ApiModelProperty(value = "电话", example = "17788771965") + private String phone; + + @ApiModelProperty(value = "是否删除(0、未删除 1、已删除)") + private Integer isDel; + + @ApiModelProperty(value = "是否禁用(0->禁用,1->启用)") + private Boolean isEnable; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "班级id") + @TableField(exist = false) + private String classId; + + @ApiModelProperty(value = "班级id") + @TableField(exist = false) + private String userName; + + + @ApiModelProperty(value = "绑定时间") + private String phoneBindingTime; +} \ No newline at end of file diff --git a/common/src/main/java/com/huoran/common/entity/UserInfo.java b/common/src/main/java/com/huoran/common/entity/UserInfo.java new file mode 100644 index 0000000..1b14b1b --- /dev/null +++ b/common/src/main/java/com/huoran/common/entity/UserInfo.java @@ -0,0 +1,104 @@ +package com.huoran.common.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.baomidou.mybatisplus.annotation.TableField; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * @描述:用户信息表 + * @作者: Rong + * @日期: 2021-08-25 + */ +@Data +@ApiModel(value = "用户信息表") +@TableName("hr_user_info") +public class UserInfo implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "用户id") + private Integer userId; + + @ApiModelProperty(value = "用户姓名") + private String userName; + + @ApiModelProperty(value = "唯一标识账号") + private String uniqueIdentification; + + @ApiModelProperty(value = "证件类型(1、身份证)") + private Integer documentType; + + @ApiModelProperty(value = "证件号码") + private String idNumber; + + @ApiModelProperty(value = "绑定省份id") + private Integer provinceId; + + @ApiModelProperty(value = "绑定城市id") + private Integer cityId; + + @ApiModelProperty(value = "国家归属地") + private String countries; + + @ApiModelProperty(value = "出生日期") + private Date dateBirth; + + @ApiModelProperty(value = "教育程度") + private Integer educationDegree; + + @ApiModelProperty(value = "绑定学校id") + private Integer schoolId; + + + @ApiModelProperty(value = "邮箱") + private String email; + + @ApiModelProperty(value = "微信号") + private String wechatId; + + @ApiModelProperty(value = "登陆次数") + private Integer loginNumber; + + @ApiModelProperty(value = "性别(1、男 2、女)") + private Integer sex; + + @ApiModelProperty(value = "用户头像路径") + private String userAvatars; + + @ApiModelProperty(value = "是否删除(0->未删除;1->已删除)") + private Integer isDel; + + @ApiModelProperty(value = "最后登陆时间") + private String lastLoginTime; + + @ApiModelProperty(value = "绑定多个角色id") + private String roleId; + + @ApiModelProperty(value = "组织关系:1->有组织关系;2->无组织关系;") + private Integer organizationalRelation; + + @ApiModelProperty(value = "是否禁用(0->禁用,1->启用)") + private Boolean isEnable; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + + @ApiModelProperty(value = "账户表-电话") + @TableField(exist = false) + private String phone; + + +} \ No newline at end of file diff --git a/common/src/main/java/com/huoran/common/entity/UserRole.java b/common/src/main/java/com/huoran/common/entity/UserRole.java new file mode 100644 index 0000000..f2abbf2 --- /dev/null +++ b/common/src/main/java/com/huoran/common/entity/UserRole.java @@ -0,0 +1,56 @@ +package com.huoran.common.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 用户角色表 + *

+ * + * @author chen + * @since 2021-09-29 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("acl_user_role") +@ApiModel(value="UserRole对象", description="用户角色表") +public class UserRole implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "角色id") + private Integer roleId; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "逻辑删除 1(true)已删除, 0(false)未删除") + @TableLogic + private Boolean isDel; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date updateTime; + + +} diff --git a/common/src/main/java/com/huoran/common/entity/UserScore.java b/common/src/main/java/com/huoran/common/entity/UserScore.java new file mode 100644 index 0000000..d24e243 --- /dev/null +++ b/common/src/main/java/com/huoran/common/entity/UserScore.java @@ -0,0 +1,87 @@ +package com.huoran.common.entity; + +/** + * @description + * @author: Mr.JK + * @create: 2021-09-14 15:01 + **/ + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 用户分数表 + *

+ * + * @author Mr.JK + * @since 2021-09-14 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "UserScore对象", description = "用户分数表") +@TableName("ol_user_score") +public class UserScore implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "分数") + private Integer score; + + @ApiModelProperty(value = "实验报告主键") + private Integer reportId; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "系统id") + private Integer systemId; + + @ApiModelProperty(value = "判分点id(系统11为流程类)") + private Integer judgmentId; + + @ApiModelProperty(value = "用户答案") + private String answer; + + @ApiModelProperty(value = "是否正确") + private Integer isCorrect; + + @ApiModelProperty(value = "是否删除") + @TableLogic + private Integer isDel; + + @ApiModelProperty(value = "创建时间") + private Date createTime; + + @ApiModelProperty(value = "更新时间") + private Date updateTime; + + @ApiModelProperty(value = "赛事id") + private Integer competitionId; + + @ApiModelProperty(value = "赛事阶段id") + private Integer stageId; + + @ApiModelProperty(value = "耗时(用于区分线下赛事的耗时)") + private Integer timeSum; + + @ApiModelProperty(value = "提交时间(用于区分线下赛事的提交时间)") + private Date submitTime; + + @ApiModelProperty(value = "团队id") + private Integer teamId; + + +} \ No newline at end of file diff --git a/common/src/main/java/com/huoran/common/entity/resp/PhoneBindingrResp.java b/common/src/main/java/com/huoran/common/entity/resp/PhoneBindingrResp.java new file mode 100644 index 0000000..c88e465 --- /dev/null +++ b/common/src/main/java/com/huoran/common/entity/resp/PhoneBindingrResp.java @@ -0,0 +1,58 @@ +package com.huoran.common.entity.resp; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @描述: + * @作者: Rong + * @日期: 2022/4/19 17:06 + */ +@Data +public class PhoneBindingrResp { + @ApiModelProperty(value = "用户id") + private Integer userId; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "类型") + private Integer type; + + @ApiModelProperty(value = "用户姓名") + private String userName; + + @ApiModelProperty(value = "唯一标识账号") + private String uniqueIdentificationAccount; + + @ApiModelProperty(value = "电话") + private String phone; + + @ApiModelProperty(value = "账号") + private String account; + + @ApiModelProperty(value = "工号") + private String workNumber; + + @ApiModelProperty(value = "登陆次数") + private Integer logInNumber; + + @ApiModelProperty(value = "平台名称") + private String platformName; + + @ApiModelProperty(value = "是否禁用(0->禁用,1->启用)") + private Integer isEnable; + + @ApiModelProperty(value = "最后登陆时间") + private String lastLoginTime; + + @ApiModelProperty(value = "角色") + private String roleName; + + @ApiModelProperty(value = "绑定组织名称") + private String schoolName; + + @ApiModelProperty(value = "绑定时间") + private String phoneBindingTime; + +} diff --git a/common/src/main/java/com/huoran/common/entity/resp/ProductAndOrderResp.java b/common/src/main/java/com/huoran/common/entity/resp/ProductAndOrderResp.java new file mode 100644 index 0000000..bed37aa --- /dev/null +++ b/common/src/main/java/com/huoran/common/entity/resp/ProductAndOrderResp.java @@ -0,0 +1,40 @@ +package com.huoran.common.entity.resp; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @description + * @author: Mr.JK + * @create: 2021-07-07 16:04 + **/ +@Data +public class ProductAndOrderResp { + + @ApiModelProperty(value = "开始时间") + private String startTime; + + @ApiModelProperty(value = "结束时间") + private String endTime; + + @ApiModelProperty(value = "期限") + private Integer deadline; + + @ApiModelProperty(value = "账号数量") + private Integer accountNum; + + @ApiModelProperty(value = "学校名称") + private String schoolName; + + @ApiModelProperty(value = "订单id") + private Integer orderId; + + @ApiModelProperty(value = "数据产品id") + private Integer dataProductId; + + @ApiModelProperty(value = "产品名称") + private String productName; + + @ApiModelProperty(value = "产品里购买的表id") + private String tableId; +} diff --git a/common/src/main/java/com/huoran/common/entity/to/JudgmentPointDataTo.java b/common/src/main/java/com/huoran/common/entity/to/JudgmentPointDataTo.java new file mode 100644 index 0000000..0222675 --- /dev/null +++ b/common/src/main/java/com/huoran/common/entity/to/JudgmentPointDataTo.java @@ -0,0 +1,19 @@ +package com.huoran.common.entity.to; + +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; + +/** + * @Author chen + * @DATE 2022/2/16 15:33 + * @Version 1.0 + */ +@Data +public class JudgmentPointDataTo implements Serializable { + + private static final long serialVersionUID = 1L; + + private ArrayList judgmentIds; +} diff --git a/common/src/main/java/com/huoran/common/entity/to/ProjectDataTo.java b/common/src/main/java/com/huoran/common/entity/to/ProjectDataTo.java new file mode 100644 index 0000000..c6d337b --- /dev/null +++ b/common/src/main/java/com/huoran/common/entity/to/ProjectDataTo.java @@ -0,0 +1,18 @@ +package com.huoran.common.entity.to; + +import lombok.Data; + +import java.util.HashSet; + +/** + * @Author chen + * @DATE 2022/2/16 15:39 + * @Version 1.0 + */ +@Data +public class ProjectDataTo { + + private HashSet set; + private String name; + private Integer systemId; +} diff --git a/common/src/main/java/com/huoran/common/exception/BusinessException.java b/common/src/main/java/com/huoran/common/exception/BusinessException.java new file mode 100644 index 0000000..e23726a --- /dev/null +++ b/common/src/main/java/com/huoran/common/exception/BusinessException.java @@ -0,0 +1,54 @@ +package com.huoran.common.exception; + +import com.huoran.common.exception.code.BaseResponseCode; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * BusinessException + * + * @author cheney + * @version V1.0 + * @date 2022年7月28日 + */ +@Getter +@NoArgsConstructor +@AllArgsConstructor +public class BusinessException extends RuntimeException { + private BaseResponseCode baseResponseCode; + private int code = 200; //返回码(400) + + private String msg; //返回码对应的消息 + + + public BusinessException(Exception e) { + super(e); + } + + public BusinessException(Exception e, String msg) { + super(e); + this.msg = msg; + } + + public BusinessException(String msg) { + super(); + this.msg = msg; + } + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public String getMsg() { + return msg; + } + + public void setMsg(String msg) { + this.msg = msg; + } +} diff --git a/common/src/main/java/com/huoran/common/exception/CustomException.java b/common/src/main/java/com/huoran/common/exception/CustomException.java new file mode 100644 index 0000000..a144ac0 --- /dev/null +++ b/common/src/main/java/com/huoran/common/exception/CustomException.java @@ -0,0 +1,18 @@ +package com.huoran.common.exception; + +import com.huoran.common.response.R; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * @description 自定义项目异常类 + * @author: Mr.JK + * @create: 2021-06-07 10:26 + **/ +@Getter +@NoArgsConstructor +@AllArgsConstructor +public class CustomException extends RuntimeException{ + private ExceptionEnum ExceptionEnum; +} diff --git a/common/src/main/java/com/huoran/common/exception/CustomExceptionHandler.java b/common/src/main/java/com/huoran/common/exception/CustomExceptionHandler.java new file mode 100644 index 0000000..799c5b0 --- /dev/null +++ b/common/src/main/java/com/huoran/common/exception/CustomExceptionHandler.java @@ -0,0 +1,56 @@ +package com.huoran.common.exception; + +import com.google.common.collect.Maps; +import com.huoran.common.response.R; +import io.jsonwebtoken.ExpiredJwtException; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.MethodArgumentNotValidException; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.RestControllerAdvice; + +import java.util.HashMap; +import java.util.concurrent.atomic.AtomicReference; + +/** + * @description 自定义异常控制器 用于自定义异常抛出后,@ControllerAdvice 默认拦截全部Controller + * 如果发生异常将异常信息返回(异常状态码,异常消息,异常发生时间) + * @author: Mr.JK + * @create: 2021-06-07 10:49 + **/ +@Slf4j +@RestControllerAdvice +public class CustomExceptionHandler { + + /** + * 拦截token异常- ExpiredJwtException + */ + @ExceptionHandler(ExpiredJwtException.class) + public R handleException(ExpiredJwtException e){ + log.error("token已过期"); + return R.error(e.getMessage()); + } + + @ExceptionHandler(CustomException.class) + public R handleException(CustomException e){ + ExceptionEnum em = e.getExceptionEnum(); + return R.error(em.getCode(),em.getMsg()); + } + + /** + * 处理参数格式校验异常 + */ + @ExceptionHandler(value = MethodArgumentNotValidException.class) + public R handleValidException(MethodArgumentNotValidException e){ + log.error("参数格式校验异常"); + BindingResult bindingResult = e.getBindingResult(); + HashMap errorMap = Maps.newHashMap(); + AtomicReference errorMsg = new AtomicReference<>(""); + bindingResult.getFieldErrors().forEach(fieldError -> { + errorMsg.set(fieldError.getDefaultMessage()); + errorMap.put(fieldError.getField(),fieldError.getDefaultMessage()); + }); + return R.error(ExceptionEnum.VALID_EXCEPTION.getCode(), errorMsg).put("data",errorMap); + } + +} diff --git a/common/src/main/java/com/huoran/common/exception/ExceptionEnum.java b/common/src/main/java/com/huoran/common/exception/ExceptionEnum.java new file mode 100644 index 0000000..3f80a75 --- /dev/null +++ b/common/src/main/java/com/huoran/common/exception/ExceptionEnum.java @@ -0,0 +1,156 @@ +package com.huoran.common.exception; + +import lombok.*; + +/** + * @description 异常枚举类 + * @author: Mr.JK + * @create: 2021-06-07 10:30 + * 异常代码枚举 + * 异常代码列表 + * 10 中台主项目 + * 001 参数格式校验 + * 002 密码无改变 + * 003 账号已存在 + * 004 验证码已过期 + * 005 验证码错误 + * 006 密码错误 + * 007 账号禁用 + * 008 账号不存在 + * 009 客户已存在 + * 010 客户无订单 + * 20 数据平台 + * 001 + * 30 用户管理 + * 001 手机号未绑定 + **/ +@Getter +@ToString +@NoArgsConstructor +@AllArgsConstructor +public enum ExceptionEnum { + + + UNKNOWN_EXCEPTION(10000, "未知异常,请联系管理员解决!"), + VALID_EXCEPTION(10001, "参数格式校验异常!"), + NO_CHANGE_EXCEPTION(10002, "密码无改变,更新失败!"), + EXIST_ACCOUNT(10003, "账号已存在,请重新设置!"), + CODE_EXPIRED(10004, "验证码已过期"), + CODE_ERROR(10005, "验证码错误"), + WRONG_PASSWORD(10006, "密码错误"), + ACCOUNT_DISABLED(10007, "账号已禁用"), + ACCOUNT_NOT_EXIST(10008, "账号不存在"), + NOT_AUTHORITY(10008, "无该平台登录权限!"), + PHONE_NOT_EXIST(10008, "手机号不存在"), + MAIL_NOT_EXIST(10008, "邮箱不存在"), + NOT_ALLOWED(10008, "超管只支持账号进行登录!"), + EXIST_CUSTOMER(10009, "客户已存在!"), + NO_ORDER(10010, "该账号下没有订单,请下订单后进行登录!"), + NO_SHIPPED(10011, "订单还未发货,请发货后进行登录!"), + NO_ENABLE(10012, "订单还未启用,请启用后进行登录!"), + MATURITY(10013, "订单到期,请联系管理员续费后进行登录!"), + USER_NOT_EXIST(10014, "用户不存在"), + ACCOUNT_AVALIABLE(10015, "可使用账号数量不足,无法启用账号!"), + SERVICE_CALL_FAILED(10016, "服务调用失败,请稍后再试!"), + TOO_MANY_REQUEST(10017, "请求流量过大,请稍后再试!"), + SERVICE_FAIL(10018, "服务调用失败,请稍后再试!"), + REPEAT_ORDERS(10019, "该时间段与现有订单有效期重叠,请勿重复下单!"), + STUDENT_ID_NOT_EXIST(10020, "学号不存在"), + JOB_ID_NOT_EXIST(10021, "工号不存在"), + DATA_PLATFORM_ACCOUNT_AVALIABLE_FAIL(10022, "当前用户所在的院校在数据平台的可用账号数量不足,是否继续!"), + INVITATION_CODE_EXPIRED(10023, "邀请码已失效"), + USER_ALREADY_EXISTS_GROUP(10024, "用户已存在该团队"), + CANT_JOIN_TEAM(10025, "无法加入自己的团队"), + CANNOT_ADDED_REPEATEDLY(10026, "该用户已经是团队管理员,无法重复添加!"), + DEFAULT_ROLE_NOTEXIST(10027, "默认角色不存在"), + TEAM_NOT_EXIST(10028, "团队不存在"), + PARTNER_REMOVAL(10029, "移除只能移除团队内成员,管理员无法移除!"), + SUPERVISING_ROLE(10030, "该用户存在超管角色,请转移后进行删除!"), + VERIFICATION_CODE_HAS_BEEN_SENT(10031, "验证码已发,请勿重复操作!"), + LOGIN_INVALID(401, "登录已失效,请重新登录"), + ASSOCIATED_PRODUCT(10031, "已关联产品,请在商城管理下架对应产品后再删除!"), + + COURSE_PRODUCTS_HAVE_BEEN_REMOVED(10032, "保存失败,关联课程产品已删除,请更换关联产品!"), + COURSE_PRODUCTS_HAVE_BEEN_REMOVED_FROM_SALE(10033, "保存失败,关联课程产品已下架,请更换关联产品!"), + DATA_PRODUCTS_HAVE_BEEN_REMOVED(10032, "保存失败,关联数据产品已删除,请更换关联产品!"), + DATA_PRODUCTS_HAVE_BEEN_REMOVED_FROM_SALE(10033, "保存失败,关联数据产品已下架,请更换关联产品!"), + + CLASSIFICATION_HAS_NO_MODEL_DATA(10034,"当前选择的分类下的没有满足条件的模型数据可供导入!"), + REDIS_LIMIT(10035,"当前人数较多,请稍后再试!"), + + //数据平台 + DATA_NOT_FOUND(20001, "数据不存在!"), + INVALID_PARAM(20002, "参数错误!"), + TABLE_NO_FOUND(20003, "该表不存在!"), + TABLE_DOWNLOAD_FAIL(20004, "表下载量更新失败!"), + SELECT_TOTAL_IS_ZERO(20005, "查询总数为零!"), + QUERY_TABLE_DATA_FAIL(20006, "查询表数据失败!"), + TABLE_CLICK_FAIL(20007, "表点击量更新失败!"), + SYMBOL_OF_ILLEGAL(20008, "符号非法!"), + + //用户管理 + NO_BIND_PHONE(30001, "未绑定手机号,请绑定后再登录!"), + + //职站 + QUESTION_NUM_INVALID(40001, "测评题目数量设置超出范围!"), + QUESTION_EXISTS(40002, "此题已存在!"), + QUESTION_TYPE_INVALID(40003, "题型错误!"), + EXCEL_INVALID(40004, "excel表内容错误!"), + EXCEL_FILE_INVALID(40005, "上传excel文件错误!"), + EXCEL_FILE_NULL(40006, "导入失败,导入数据为空!"), + EXCEL_FILE_FORMAT_ERROR(40007, "请根据模板使用说明录入正确的题库信息!"), + ASSESSMENT_ENABLE_CODE_NULL(40008, "请输入正确的邀请码!"), + ADD_COLUMNS_FAILED(40009, "栏目最多可添加10个!"), + INSERT_PROJECT_MANAGE_FAIL(40010, "新增项目管理失败!"), + UPDATE_PROJECT_MANAGE_FAIL(40010, "更新项目管理失败!"), + SAVE_ASSESSMENT_FAIL(40011, "新增考核失败!"), + UPDATE_ASSESSMENT_FAIL(40012, "修改考核失败!"), + ENTER_EXAM_FAIL(40013, "进入考试失败!"), + DELETE_JUDGMENT_FAIL(40014, "删除判分点失败"), + EMPTY_SCHOOL(40015,"请选择所属学校"), + EMPTY_ACCOUNT(40015,"账号不能为空"), + EMPTY_WORK_NUMBER(40015,"学号/工号不能为空"), + EMPTY_PARAMETER(40016,"登录参数不完整!"), + + TEAM_LIMIT1(40017,"报名失败,超过团队人数限制!"), + TEAM_LIMIT2(40018,"报名失败,超过赛事团队数上限!"), + TEAM_LIMIT3(40019,"报名失败,超过赛事人数上限!"), + + CODE(40019,"报名失败,报名邀请码错误!"), + HAVE_BEEN_REGISTERED(40020,"你已经报过名啦!"), + UNABLE_TO_REGISTER(40021,"你所在院校不符合参赛要求,无法报名!"), + ENTER_CORRECT_EMAIL(40022,"请输入正确邮箱!"), + THE_REMOTE_FILE_TYPE_IS_UNRECOGNIZED(40023,"远程文件类型无法识别!"), + + REFRESH_THE_LIST(40024,"当前项目状态已被更改,即将刷新列表!"), + + DELETE_REFRESH_LIST(40025,"当前项目已被删除,请刷新列表!"), + + + ACTIVITY_REGISTRATION_FAILURE(40026,"报名失败,超过项目人数上限!"), + + //判分点 + DELETE_JUDGMENT_POINT_FAIL(50001, "删除判分点失败!"), + DELETE_JUDGMENT_POINT_RULE_FAIL(50002, "删除判分点规则失败!"), + ADD_JUDGMENT_POINT_FAIL(50003, "添加判分点失败!"), + ADD_JUDGMENT_POINT_RULE_FAIL(50004, "添加判分点规则失败!"), + SUBJECT_TYPE_IS_NULL(50005, "题目类型为空!"), + UPDATE_JUDGMENT_POINT_FAIL(50006, "判分点更新失败!"), + UPDATE_JUDGMENT_POINT_RULE_FAIL(50007, "判分点规则更新失败!"), + + //python + RUN_TIMEOUT(60001, "当前代码运行超时,请重新再试!!"), + //银行 + ADD_EXPERIMENTAL_REPORT_FAIL(70001, "添加实验报告失败!"), + + REPEAT_SUBMISSION(70004, "重复提交考核!"), + ADD_USER_SCORE_FAIL(70002, "添加用户分数失败!"), + SELECT_JUDGMENT_SCORE_FAIL(70003, "查询判分点分数失败!"), + FALSE_CODE(70005, "非法代码,请检查是否调用系统命令!"), + + + ; + + private int code; + private String msg; +} diff --git a/common/src/main/java/com/huoran/common/exception/ExceptionResult.java b/common/src/main/java/com/huoran/common/exception/ExceptionResult.java new file mode 100644 index 0000000..2ce9cbb --- /dev/null +++ b/common/src/main/java/com/huoran/common/exception/ExceptionResult.java @@ -0,0 +1,24 @@ +package com.huoran.common.exception; + +import lombok.Data; + +/** + * @description 处理异常结果 + * @author: Mr.JK + * @create: 2021-06-07 10:56 + **/ +@Data +public class ExceptionResult { + + private int status; + + private String message; + + private Long timestamp; + + public ExceptionResult(ExceptionEnum em){ + this.status = em.getCode(); + this.message = em.getMsg(); + this.timestamp = System.currentTimeMillis(); + } +} diff --git a/common/src/main/java/com/huoran/common/exception/code/BaseResponseCode.java b/common/src/main/java/com/huoran/common/exception/code/BaseResponseCode.java new file mode 100644 index 0000000..b748e87 --- /dev/null +++ b/common/src/main/java/com/huoran/common/exception/code/BaseResponseCode.java @@ -0,0 +1,69 @@ +package com.huoran.common.exception.code; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.ToString; + +/** + * 错误码 + * + * @author cheney + * @version V1.0 + * @date 2022年7月28日 + */ +@Getter +@ToString +@NoArgsConstructor +@AllArgsConstructor +public enum BaseResponseCode implements ResponseCodeInterface { + /** + * 错误码 + */ + USERNAME_EXISTS(10008, "用户名已存在!"), + KEY_OR_TOMEUNIT(10009, "key or TomeUnit 不能为空!"), + DICTIONARY_DATA_FAILED(10010, "获取字典数据失败"), + UPLOAD_EMPTY(10011, "上传内容为空"), + UPLOAD_FAILED(10012, "上传失败"), + VERIFICATION_CODE_ERROR(10007, "验证码错误!"), + VERIFICATION_CODE_EXPIRED(10006, "验证码已过期!"), + CANNOT_SAME(10005, "新密码不能与旧密码相同!"), + EXCEL_FILE_INVALID(10004, "上传excel文件错误!"), + VALID_EXCEPTION(10003, "参数格式校验异常!"), + OPERATION_ERROR(10002, "操作失败"), + SYSTEM_BUSY(500, "系统繁忙,请稍候再试"), + SUCCESS(200, "success"), + + EXCEL_FILE_FORMAT_ERROR(40007, "请根据模板使用说明录入正确的用户信息!"), + TOKEN_ERROR(401, "登录凭证已过期,请重新登录"), + DATA_ERROR(401003, "传入数据异常"), + NOT_ACCOUNT(401004, "该用户不存在,请先注册"), + USER_LOCK(401005, "该用户已被锁定,请联系运营人员"), + PASSWORD_ERROR(401006, "用户名或密码错误"), + METHOD_ARGUMENT_NOT_VALID_EXCEPTION(400, "请求参数有误"), + UNAUTHORIZED_ERROR(401008, "权鉴校验不通过"), + ROLE_PERMISSION_RELATION(401009, "该菜单权限存在子集关联,不允许删除"), + OLD_PASSWORD_ERROR(401010, "旧密码不正确"), + NOT_PERMISSION_DELETED_DEPT(401011, "该组织机构下还关联着用户,不允许删除"), + DELETE_SUB_DEPARTMENTS_FIRST(401018, "请先删除子级部门!"), + OPERATION_MENU_PERMISSION_CATALOG_ERROR(401012, "操作后的菜单类型是目录,所属菜单必须为默认顶级菜单或者目录"), + OPERATION_MENU_PERMISSION_MENU_ERROR(401013, "操作后的菜单类型是菜单,所属菜单必须为目录类型"), + OPERATION_MENU_PERMISSION_BTN_ERROR(401013, "操作后的菜单类型是按钮,所属菜单必须为菜单类型"), + OPERATION_MENU_PERMISSION_URL_NOT_NULL(401015, "菜单权限的url不能为空"), + OPERATION_MENU_PERMISSION_URL_PERMS_NULL(401016, "菜单权限的标识符不能为空"), + ROLE_ERROR(401017, "账号角色被删,请联系管理员添加角色后再试"), + EXCEL_FILE_NULL(40006, "导入失败,导入数据为空!"), + + DATA_DOES_NOT_EXIST(500, "当前数据不存在"), + ; + + /** + * 错误码 + */ + private int code; + /** + * 错误消息 + */ + private String msg; + +} diff --git a/common/src/main/java/com/huoran/common/exception/code/ResponseCodeInterface.java b/common/src/main/java/com/huoran/common/exception/code/ResponseCodeInterface.java new file mode 100644 index 0000000..22ce56b --- /dev/null +++ b/common/src/main/java/com/huoran/common/exception/code/ResponseCodeInterface.java @@ -0,0 +1,24 @@ +package com.huoran.common.exception.code; + +/** + * ResponseCodeInterface + * + * @author cheney + * @version V1.0 + * @date 2022年7月28日 + */ +public interface ResponseCodeInterface { + /** + * 获取code + * + * @return code + */ + int getCode(); + + /** + * 获取信息 + * + * @return msg + */ + String getMsg(); +} diff --git a/common/src/main/java/com/huoran/common/handler/MyMetaObjectHandler.java b/common/src/main/java/com/huoran/common/handler/MyMetaObjectHandler.java new file mode 100644 index 0000000..61b6c85 --- /dev/null +++ b/common/src/main/java/com/huoran/common/handler/MyMetaObjectHandler.java @@ -0,0 +1,28 @@ +package com.huoran.common.handler; + +import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; +import org.apache.ibatis.reflection.MetaObject; +import org.springframework.stereotype.Component; + +import java.util.Date; + +/** + * @Author cheney + * @DATE 2021/5/10 11:13 + * @Version 1.0 + * 元数据处理,自动更新更新时间及填充创建时间 + */ +@Component +public class MyMetaObjectHandler implements MetaObjectHandler { + + @Override + public void insertFill(MetaObject metaObject) { + this.setFieldValByName("createTime", new Date(), metaObject); + this.setFieldValByName("updateTime", new Date(), metaObject); + } + + @Override + public void updateFill(MetaObject metaObject) { + this.setFieldValByName("updateTime", new Date(), metaObject); + } +} \ No newline at end of file diff --git a/common/src/main/java/com/huoran/common/response/R.java b/common/src/main/java/com/huoran/common/response/R.java new file mode 100644 index 0000000..9e0d4fc --- /dev/null +++ b/common/src/main/java/com/huoran/common/response/R.java @@ -0,0 +1,97 @@ +package com.huoran.common.response; + +import com.huoran.common.exception.ExceptionEnum; +import org.apache.http.HttpStatus; +import org.springframework.lang.Nullable; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @Author chen + * @DATE 2020/9/30 11:18 + * @Version 1.0 + */ +public class R extends HashMap { + + private static final long serialVersionUID = 1L; + + public R() { + put("status", 200); + put("message", "success"); + } + + public static R error() { + return error(HttpStatus.SC_INTERNAL_SERVER_ERROR, "未知异常,请联系管理员"); + } + + public static R error(String msg) { + return error(HttpStatus.SC_INTERNAL_SERVER_ERROR, msg); + } + + public static R error(int code, String msg) { + R r = new R(); + r.put("status", code); + r.put("message", msg); + return r; + } + + @Deprecated + public static R error(int code, @Nullable T msg) { + R r = new R(); + r.put("status", code); + r.put("message", msg); + return r; + } + + public static R ok(String msg) { + R r = new R(); + r.put("message", msg); + return r; + } + + public static R ok(Map map) { + R r = new R(); + r.putAll(map); + return r; + } + + public static R ok(List list) { + R r = new R(); + r.put("list",list); + return r; + } + + public static R ok() { + return new R(); + } + + @Deprecated + public static R ok(@Nullable T msg) { + R r = new R(); + r.put("message", msg); + return r; + } + + public static R error(ExceptionEnum exceptionEnum) { + R r = new R(); + r.put("status",exceptionEnum.getCode()); + r.put("message",exceptionEnum.getMsg()); + return r; + } + + @Override + public R put(String key, Object value) { + super.put(key, value); + return this; + } + + public static R toR(int rows){ + return rows > 0 ? R.ok() : R.error(); + } + + public static R toR(boolean result){ + return result ? R.ok() : R.error(); + } +} diff --git a/common/src/main/java/com/huoran/common/utils/AliyunOssUtil.java b/common/src/main/java/com/huoran/common/utils/AliyunOssUtil.java new file mode 100644 index 0000000..a4eafbd --- /dev/null +++ b/common/src/main/java/com/huoran/common/utils/AliyunOssUtil.java @@ -0,0 +1,447 @@ +package com.huoran.common.utils; + +import cn.hutool.core.date.DateTime; +import cn.hutool.core.util.IdUtil; +import com.aliyun.oss.ClientException; +import com.aliyun.oss.OSS; +import com.aliyun.oss.OSSClientBuilder; +import com.aliyun.oss.OSSException; +import com.aliyun.oss.model.*; +import com.aliyun.vod.upload.impl.UploadVideoImpl; +import com.aliyun.vod.upload.req.UploadStreamRequest; +import com.aliyun.vod.upload.resp.UploadStreamResponse; +import com.aliyuncs.DefaultAcsClient; +import com.aliyuncs.vod.model.v20170321.DeleteVideoRequest; +import com.aliyuncs.vod.model.v20170321.DeleteVideoResponse; +import com.aliyuncs.vod.model.v20170321.GetVideoPlayAuthRequest; +import com.aliyuncs.vod.model.v20170321.GetVideoPlayAuthResponse; +import com.huoran.common.entity.FilesResult; +import org.apache.commons.lang3.StringUtils; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.math.BigDecimal; +import java.net.URLEncoder; +import java.util.List; + +public class AliyunOssUtil { + + /** + * 视频上传 + * @param file 视频文件 + * @return 返回文件信息 + * @throws IOException IO异常 + */ + /*public static FilesResult vodUpload(MultipartFile file) throws IOException { + FilesResult filesResult = new FilesResult(); + //获取文件流 + InputStream inputStream = file.getInputStream(); + String originalFilename = file.getOriginalFilename(); + assert originalFilename != null; + String title = originalFilename.substring(0, originalFilename.lastIndexOf(".")); + // 获取文件尾缀 + String fileType = originalFilename.substring(originalFilename.lastIndexOf(".")+1); + // 文件类型 + filesResult.setFileType(fileType); + + //上传流请求 + UploadStreamRequest request = new UploadStreamRequest(ConstantPropertiesUtil.ACCESS_KEY_ID, + ConstantPropertiesUtil.ACCESS_KEY_SECRET, title, originalFilename, inputStream); + + *//* 是否使用默认水印(可选),指定模板组ID时,根据模板组配置确定是否使用默认水印*//* + //request.setShowWaterMark(true); + *//* 设置上传完成后的回调URL(可选),建议通过点播控制台配置消息监听事件,参见文档 https://help.aliyun.com/document_detail/57029.html *//* + //request.setCallback("http://callback.sample.com"); + *//* 自定义消息回调设置,参数说明参考文档 https://help.aliyun.com/document_detail/86952.html#UserData *//* + //request.setUserData(""{\"Extend\":{\"test\":\"www\",\"localId\":\"xxxx\"},\"MessageCallback\":{\"CallbackURL\":\"http://test.test.com\"}}""); + *//* 视频分类ID(可选) *//* + //request.setCateId(0); + *//* 视频标签,多个用逗号分隔(可选) *//* + //request.setTags("标签1,标签2"); + *//* 视频描述(可选) *//* + //request.setDescription("视频描述"); + *//* 封面图片(可选) *//* + //request.setCoverURL("http://cover.sample.com/sample.jpg"); + *//* 模板组ID(可选) *//* + //request.setTemplateGroupId("8c4792cbc8694e7084fd5330e56a33d"); + *//* 工作流ID(可选) *//* + //request.setWorkflowId("d4430d07361f0*be1339577859b0177b"); + *//* 存储区域(可选) *//* + //request.setStorageLocation("in-201703232118266-5sejdln9o.oss-cn-shanghai.aliyuncs.com"); + *//* 开启默认上传进度回调 *//* + // request.setPrintProgress(true); + *//* 设置自定义上传进度回调 (必须继承 VoDProgressListener) *//* + // request.setProgressListener(new PutObjectProgressListener()); + *//* 设置应用ID*//* + //request.setAppId("app-1000000"); + *//* 点播服务接入点 *//* + //request.setApiRegionId("cn-shanghai"); + *//* ECS部署区域*//* + // request.setEcsRegionId("cn-shanghai"); + + UploadVideoImpl uploader = new UploadVideoImpl(); + UploadStreamResponse response = uploader.uploadStream(request); + + //如果设置回调URL无效,不影响视频上传,可以返回VideoId同时会返回错误码。 + // 其他情况上传失败时,VideoId为空,此时需要根据返回错误码分析具体错误原因 + String videoId = response.getVideoId(); + if (!response.isSuccess()) { + String errorMessage = "阿里云视频上传错误:" + "code:" + response.getCode() + ", message:" + response.getMessage(); + if(StringUtils.isEmpty(videoId)){ + throw new CustomException(ExceptionEnum.UNKNOWN_EXCEPTION); + } + } + filesResult.setFileId(videoId); + return filesResult; + }*/ + + /** + * 根据视频id删除视频 + * + * @param videoId 视频id + */ + public static void removeVideo(String videoId) throws com.aliyuncs.exceptions.ClientException { + + DefaultAcsClient client = AliyunVodSDKUtil.initVodClient( + ConstantPropertiesUtil.ACCESS_KEY_ID, + ConstantPropertiesUtil.ACCESS_KEY_SECRET); + + DeleteVideoRequest request = new DeleteVideoRequest(); + request.setVideoIds(videoId); + DeleteVideoResponse response = client.getAcsResponse(request); + System.out.print("RequestId = " + response.getRequestId() + "\n"); + } + + /** + * 根据视频id批量删除视频 + * + * @param videoIdList 视频id + */ + public static void removeMoreVideo(List videoIdList) throws com.aliyuncs.exceptions.ClientException { + DefaultAcsClient client = AliyunVodSDKUtil.initVodClient( + ConstantPropertiesUtil.ACCESS_KEY_ID, + ConstantPropertiesUtil.ACCESS_KEY_SECRET); + DeleteVideoRequest request = new DeleteVideoRequest(); + //使用工具类将集合转化成指定的字符串 + String videos = StringUtils.join(videoIdList, ","); + request.setVideoIds(videos); + DeleteVideoResponse response = client.getAcsResponse(request); + System.out.print("RequestId = " + response.getRequestId() + "\n"); + } + + /** + * 根据视频id获取播放凭证 + * + * @param videoId 视频id + * @return 返回凭证 + */ + public static String getPlayAuth(String videoId) throws com.aliyuncs.exceptions.ClientException { + + DefaultAcsClient client = AliyunVodSDKUtil.initVodClient(ConstantPropertiesUtil.ACCESS_KEY_ID, ConstantPropertiesUtil.ACCESS_KEY_SECRET); + + GetVideoPlayAuthRequest request = new GetVideoPlayAuthRequest(); + + request.setVideoId(videoId); + + GetVideoPlayAuthResponse response = client.getAcsResponse(request); + //得到播放凭证并返回 + return response.getPlayAuth(); + } + + /** + * 创建存储空间 + * + * @param ossClient oss客户端 + */ + public static void createBucket(OSS ossClient) { + // 判断存储空间是否存在,不存在,则创建 + if (!ossClient.doesBucketExist(ConstantPropertiesUtil.BUCKET_NAME)) { + // 创建CreateBucketRequest对象,设置仓库名称 + CreateBucketRequest bucketRequest = new CreateBucketRequest(ConstantPropertiesUtil.BUCKET_NAME); + // 设置存储空间的权限为公共读,默认是私有。 + bucketRequest.setCannedACL(CannedAccessControlList.PublicRead); + // 此处以设置存储空间的存储类型为标准存储为例。 + // createBucketRequest.setStorageClass(StorageClass.Standard); + // 默认情况下,数据容灾类型为本地冗余存储,即DataRedundancyType.LRS。如果需要设置数据容灾类型为同城冗余存储,请替换为DataRedundancyType.ZRS。 + // createBucketRequest.setDataRedundancyType(DataRedundancyType.ZRS) + // 创建存储空间。 + ossClient.createBucket(bucketRequest); + + } + } + + public static String getFormatSize(double size) { + double kiloByte = size / 1024; + if (kiloByte < 1) { + return size + "Byte(s)"; + } + + double megaByte = kiloByte / 1024; + if (megaByte < 1) { + BigDecimal result1 = new BigDecimal(Double.toString(kiloByte)); + return result1.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString() + "KB"; + } + + double gigaByte = megaByte / 1024; + if (gigaByte < 1) { + BigDecimal result2 = new BigDecimal(Double.toString(megaByte)); + return result2.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString() + "MB"; + } + + double teraBytes = gigaByte / 1024; + if (teraBytes < 1) { + BigDecimal result3 = new BigDecimal(Double.toString(gigaByte)); + return result3.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString() + "GB"; + } + BigDecimal result4 = new BigDecimal(teraBytes); + return result4.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString() + "TB"; + } + + public static void main(String[] args) { + System.out.println(getFormatSize(68160)); + } + + /** + * 上传文件 + * + * @param file 文件 + * @return 返回文件上传结果 + * @throws OSSException oss异常 + * @throws ClientException 客户端异常 + * @throws IOException io异常 + */ + public static FilesResult uploadFile(MultipartFile file) throws OSSException, ClientException, IOException { + + //获取访问key + String endPoint = ConstantPropertiesUtil.END_POINT; + String accessKeyId = ConstantPropertiesUtil.ACCESS_KEY_ID; + String accessKeySecret = ConstantPropertiesUtil.ACCESS_KEY_SECRET; + //创建ossClient + OSS ossClient = new OSSClientBuilder().build(endPoint, accessKeyId, accessKeySecret); + + FilesResult result = new FilesResult(); + // 创建存储空间 + createBucket(ossClient); + + //获取上传文件流 + InputStream inputStream = file.getInputStream(); + //获取当前日期构建日期路径:avatar/2019/02/26/文件名 + String currentDate = new DateTime().toString("yyyyMMdd"); + //获取上传的文件名称 + String fileName = file.getOriginalFilename(); + result.setOriginalFileName(fileName);//原文件名 + + // 获取文件尾缀 + assert fileName != null; + String ext = fileName.substring(fileName.lastIndexOf(".")); + // 获取文件类型,大小 + String fileType = getFileType(ext); + long fileSize = file.getSize(); + //获取随机值 + String snowflakeId = IdUtil.getSnowflake(6, 4).nextIdStr(); + //文件名:雪花算法.文件扩展名 + String newName = snowflakeId + ext; + String sort = ext.substring(ext.lastIndexOf(".") + 1); + result.setFileType(sort); + result.setFileSize(String.valueOf(fileSize)); + //组合新的文件名 + String fileUrl = currentDate + "/" + sort + "/" + newName; + result.setOssFileName(fileUrl); + // 设置上传时存储类型与访问权限 + ObjectMetadata metadata = new ObjectMetadata(); + // 指定该Object被下载时的网页的缓存行为 + metadata.setCacheControl("no-cache"); + // 指定该Object下设置Header + metadata.setHeader("Pragma", "no-cache"); + // 指定该Object被下载时的内容编码格式 + metadata.setContentEncoding("utf-8"); + // 文件的MIME,定义文件的类型及网页编码,决定浏览器将以什么形式、什么编码读取文件。如果用户没有指定则根据Key或文件名的扩展名生成, + // 如果没有扩展名则填默认值application/octet-stream + metadata.setContentType(fileType); + // 指定该Object被下载时的名称(指示MINME用户代理如何显示附加的文件,打开或下载,及文件名称) + metadata.setContentDisposition("filename/filesize=" + file.getName() + "/" + fileSize + "Byte."); + + //上传文件 (上传文件流的形式) + ossClient.putObject(ConstantPropertiesUtil.BUCKET_NAME, fileUrl, inputStream, metadata); + // 关闭OSSClient。 + ossClient.shutdown(); + + // 拼接文件url地址,返回控制层 + String tempEndpoint = ConstantPropertiesUtil.END_POINT; + String endpoint = tempEndpoint.substring(tempEndpoint.lastIndexOf("/") + 1, tempEndpoint.length()); + String url = "https://" + ConstantPropertiesUtil.BUCKET_NAME + "." + endpoint + "/" + fileUrl; + + result.setFileUrl(url); + + // 关闭OSSClient。 + ossClient.shutdown(); + + return result; + } + + /** + * 文件下载 + * + * @param response 响应对象 + * @param ossClient oss客户端 + * @param objectName 文件名 + */ + public static void downloadFiles(HttpServletResponse response, OSS ossClient, + String objectName) throws IOException { + + // ossObject包含文件所在的存储空间名称、文件名称、文件元信息以及一个输入流。 + OSSObject ossObject = ossClient.getObject(ConstantPropertiesUtil.BUCKET_NAME, objectName); + InputStream input = null; + OutputStream outputStream = null; + try { + // 获取文件名 + String fileName = objectName.substring(objectName.lastIndexOf("/") + 1); + //获取输入流 + input = ossObject.getObjectContent(); + // 获取OutputStream输出流 + outputStream = response.getOutputStream(); + byte[] buffer = new byte[input.available()]; + + response.setHeader("content-Type", "application/octet-stream"); + response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8")); + response.flushBuffer(); + + for (int length = 0; (length = input.read(buffer)) > 0; ) { + outputStream.write(buffer, 0, length); + } + + } catch (IOException e) { + e.printStackTrace(); + throw e; + } finally { + if (null != outputStream) { + try { + outputStream.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (null != input) { + try { + input.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + // 关闭OSSClient。 + ossClient.shutdown(); + } + + } + + /** + * *** 谨慎操作 *** + * 删除存储空间 + * + * @param bucketName 存储空间名称 + */ + public static void deleteBucket(String bucketName) { + String endPoint = ConstantPropertiesUtil.END_POINT; + String accessKeyId = ConstantPropertiesUtil.ACCESS_KEY_ID; + String accessKeySecret = ConstantPropertiesUtil.ACCESS_KEY_SECRET; + // 创建OSSClient实例。 + OSS ossClient = new OSSClientBuilder().build(endPoint, accessKeyId, accessKeySecret); + // 删除存储空间。 + ossClient.deleteBucket(bucketName); + // 关闭OSSClient。 + ossClient.shutdown(); + } + + /** + * 创建文件夹 + * + * @param ossClient oss连接 + * @param bucketName 存储空间 + * @param folder 文件夹名,如 "qj_nanjing/" + * @return 返回创建的文件夹名 + */ + public static String createFolder(OSS ossClient, String bucketName, String folder) { + // 判断文件夹是否存在,不存在则创建 + if (!ossClient.doesObjectExist(bucketName, folder)) { + // 创建文件夹 + ossClient.putObject(bucketName, folder, new ByteArrayInputStream(new byte[0])); + // 得到文件夹名 + OSSObject object = ossClient.getObject(bucketName, folder); + return object.getKey(); + } + return folder; + } + + /** + * 批量删除文件。key等同于ObjectName,表示删除OSS文件时需要指定包含文件后缀在内的完整路径,例如abc/efg/123.jpg。 + * + * @param keys 文件完整路径 + */ + public static List deleteFiles(List keys) { + String endPoint = ConstantPropertiesUtil.END_POINT; + String accessKeyId = ConstantPropertiesUtil.ACCESS_KEY_ID; + String accessKeySecret = ConstantPropertiesUtil.ACCESS_KEY_SECRET; + String bucketName = ConstantPropertiesUtil.BUCKET_NAME; + // 创建OSSClient实例。 + OSS ossClient = new OSSClientBuilder().build(endPoint, accessKeyId, accessKeySecret); + + DeleteObjectsResult deleteObjectsResult = ossClient.deleteObjects(new DeleteObjectsRequest(bucketName).withKeys(keys)); + List deletedObjects = deleteObjectsResult.getDeletedObjects(); + // 关闭OSSClient。 + ossClient.shutdown(); + //返回删除成功文件列表 + return deletedObjects; + } + + /** + * 获取文件类型 + * + * @param fileExtension 文件后缀 + * @return 返回类型 + */ + public static String getFileType(String fileExtension) { + if (".bmp".equalsIgnoreCase(fileExtension)) { + return "image/bmp"; + } + if (".gif".equalsIgnoreCase(fileExtension)) { + return "image/gif"; + } + if (".jpeg".equalsIgnoreCase(fileExtension) || ".jpg".equalsIgnoreCase(fileExtension) + || ".png".equalsIgnoreCase(fileExtension)) { + return "image/jpg"; + } + if (".html".equalsIgnoreCase(fileExtension)) { + return "text/html"; + } + if (".txt".equalsIgnoreCase(fileExtension)) { + return "text/plain"; + } + if (".vsd".equalsIgnoreCase(fileExtension)) { + return "application/vnd.visio"; + } + if (".ppt".equalsIgnoreCase(fileExtension) || ".pptx".equalsIgnoreCase(fileExtension)) { + return "application/vnd.ms-powerpoint"; + } + if (".doc".equalsIgnoreCase(fileExtension) || ".docx".equalsIgnoreCase(fileExtension)) { + return "application/msword"; + } + if (".xml".equalsIgnoreCase(fileExtension)) { + return "text/xml"; + } + if (".mp4".equalsIgnoreCase(fileExtension) || ".avi".equalsIgnoreCase(fileExtension)) { + return "video/mp4"; + } + if (".mpg".equalsIgnoreCase(fileExtension) || ".mpeg".equalsIgnoreCase(fileExtension)) { + return "video/mpeg"; + } + if ("pdf".equalsIgnoreCase(fileExtension)) { + return "application/pdf"; + } + return "application/octet-stream"; + } + +} diff --git a/common/src/main/java/com/huoran/common/utils/AliyunVodSDKUtil.java b/common/src/main/java/com/huoran/common/utils/AliyunVodSDKUtil.java new file mode 100644 index 0000000..0b8c19b --- /dev/null +++ b/common/src/main/java/com/huoran/common/utils/AliyunVodSDKUtil.java @@ -0,0 +1,17 @@ +package com.huoran.common.utils; + +import com.aliyuncs.DefaultAcsClient; +import com.aliyuncs.profile.DefaultProfile; + +/** + * @Author chen + * @DATE 2020/10/12 9:10 + * @Version 1.0 + */ +public class AliyunVodSDKUtil { + public static DefaultAcsClient initVodClient(String accessKeyId, String accessKeySecret) { + String regionId = "cn-shanghai"; // 点播服务接入区域 + DefaultProfile profile = DefaultProfile.getProfile(regionId, accessKeyId, accessKeySecret); + return new DefaultAcsClient(profile); + } +} diff --git a/common/src/main/java/com/huoran/common/utils/CacheUtil.java b/common/src/main/java/com/huoran/common/utils/CacheUtil.java new file mode 100644 index 0000000..6420f04 --- /dev/null +++ b/common/src/main/java/com/huoran/common/utils/CacheUtil.java @@ -0,0 +1,143 @@ +package com.huoran.common.utils; + +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; + +/** + * @description 缓存工具类,用于缓存复杂对象 + * @author: Mr.JK + * @create: 2021-09-09 14:46 + **/ +public class CacheUtil { + + //键值对集合 + private final static Map map = new HashMap<>(); + //定时器线程池,用于清除过期缓存 + private final static ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor(); + + /** + * 添加缓存 + *一天时间缓存 + * @param key 键 + * @param data 值 + */ + public synchronized static void put(String key, Object data) { + CacheUtil.put(key, data, 86400000); + } + + /** + * 添加缓存 + * + * @param key 键 + * @param data 值 + * @param expire 过期时间,单位:毫秒, 0表示无限长 + */ + public synchronized static void put(String key, Object data, long expire) { + //清除原键值对 + CacheUtil.remove(key); + //设置过期时间 + if (expire > 0) { + Future future = executor.schedule(new Runnable() { + @Override + public void run() { + //过期后清除该键值对 + synchronized (CacheUtil.class) { + map.remove(key); + } + } + }, expire, TimeUnit.MILLISECONDS); + map.put(key, new Entity(data, future)); + } else { + //不设置过期时间 + map.put(key, new Entity(data, null)); + } + } + + /** + * 读取缓存 + * + * @param key 键 + * @return + */ + public synchronized static Object get(String key) { + Entity entity = map.get(key); + return entity == null ? null : entity.getValue(); + } + + /** + * 读取缓存 + * + * @param key 键 + * * @param clazz 值类型 + * @return + */ + public synchronized static T get(String key, Class clazz) { + return clazz.cast(CacheUtil.get(key)); + } + + /** + * 清除缓存 + * + * @param key + * @return + */ + public synchronized static Object remove(String key) { + //清除原缓存数据 + Entity entity = map.remove(key); + if (entity == null) { + return null; + } + //清除原键值对定时器 + Future future = entity.getFuture(); + if (future != null) { + future.cancel(true); + } + return entity.getValue(); + } + + /** + * 查询当前缓存的键值对数量 + * + * @return + */ + public synchronized static int size() { + return map.size(); + } + + /** + * 缓存实体类 + */ + private static class Entity { + //键值对的value + private Object value; + //定时器Future + private Future future; + + public Entity(Object value, Future future) { + this.value = value; + this.future = future; + } + + /** + * 获取值 + * + * @return + */ + public Object getValue() { + return value; + } + + /** + * 获取Future对象 + * + * @return + */ + public Future getFuture() { + return future; + } + } +} diff --git a/common/src/main/java/com/huoran/common/utils/CheckCodeUtils.java b/common/src/main/java/com/huoran/common/utils/CheckCodeUtils.java new file mode 100644 index 0000000..65a252a --- /dev/null +++ b/common/src/main/java/com/huoran/common/utils/CheckCodeUtils.java @@ -0,0 +1,44 @@ +package com.huoran.common.utils; + +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.Random; + +/** + * @description 验证码工具类 + * @author: Mr.JK + * @create: 2021-06-22 15:56 + **/ +public class CheckCodeUtils { + + /** + * 获取六位随机数验证码 + * @return + */ + public String sendCode(){ + + Random random = new Random(); + String code=""; + for (int i=0;i<6;i++) + { + code+=random.nextInt(10); + } + return code; + } + + /** + * 生成时间 + */ + public String letTimes(int letTime){ + + Calendar instance = Calendar.getInstance(); + instance.add(Calendar.MINUTE,+letTime); + Date time = instance.getTime(); + SimpleDateFormat myFmt=new SimpleDateFormat("yyyy:MM:dd HH:mm:ss"); + String format1 = myFmt.format(time); + + return format1; + } + +} diff --git a/common/src/main/java/com/huoran/common/utils/CheckDateUtil.java b/common/src/main/java/com/huoran/common/utils/CheckDateUtil.java new file mode 100644 index 0000000..65e3a8f --- /dev/null +++ b/common/src/main/java/com/huoran/common/utils/CheckDateUtil.java @@ -0,0 +1,41 @@ +package com.huoran.common.utils; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; + +/** + * @ProjectName: huorantech + * @Package: com.huoran.common.utils + * @ClassName: CheckDateUtil + * @Description: 校验用户输入的时间 + * @Author: Maureen.Rong + * @CreateDate: 2021/8/19 11:12 + * @UpdateDate: 2021/8/19 11:12 + * @Version: 1.0 + */ +public class CheckDateUtil { + /** + * 如果为true表示 + * 校验用户输入的时间 + * + * @param startTime + * @return + */ + public static boolean checStartkTime(String startTime) { + try { + DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + //用户输入的时间 + Date dateTime1 = dateFormat.parse(startTime); + //当前时间 + String DateStr2 = DateUtils.nowTime(); + Date dateTime2 = dateFormat.parse(DateStr2); + int i = dateTime1.compareTo(dateTime2); + boolean ret = false; + ret = i > 0; + return ret; + } catch (Exception e) { + return false; + } + } +} diff --git a/common/src/main/java/com/huoran/common/utils/ConstantPropertiesUtil.java b/common/src/main/java/com/huoran/common/utils/ConstantPropertiesUtil.java new file mode 100644 index 0000000..66a3765 --- /dev/null +++ b/common/src/main/java/com/huoran/common/utils/ConstantPropertiesUtil.java @@ -0,0 +1,39 @@ +package com.huoran.common.utils; + +import org.springframework.beans.factory.InitializingBean; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.PropertySource; +import org.springframework.stereotype.Component; + +/** + * 常量类,读取配置文件application.properties中的配置 + */ +@Component +@PropertySource("classpath:application.properties") +public class ConstantPropertiesUtil implements InitializingBean { + + @Value("${aliyun.oss.file.endpoint}") + private String endpoint; + + @Value("${aliyun.oss.file.keyid}") + private String keyId; + + @Value("${aliyun.oss.file.keysecret}") + private String keySecret; + + @Value("${aliyun.oss.file.bucketname}") + private String bucketName; + + public static String END_POINT; + public static String ACCESS_KEY_ID; + public static String ACCESS_KEY_SECRET; + public static String BUCKET_NAME; + + @Override + public void afterPropertiesSet() throws Exception { + END_POINT = endpoint; + ACCESS_KEY_ID = keyId; + ACCESS_KEY_SECRET = keySecret; + BUCKET_NAME = bucketName; + } +} diff --git a/common/src/main/java/com/huoran/common/utils/DateUtil.java b/common/src/main/java/com/huoran/common/utils/DateUtil.java new file mode 100644 index 0000000..14660b0 --- /dev/null +++ b/common/src/main/java/com/huoran/common/utils/DateUtil.java @@ -0,0 +1,45 @@ +package com.huoran.common.utils; + +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; + +/** + * @Author chen + * @DATE 2020/10/20 10:46 + * @Version 1.0 + */ +public class DateUtil { + + public static String lastDate(Integer month){ + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Calendar c = Calendar.getInstance(); + + if (month==1){ + c.add(Calendar.MONTH,-1); + Date time = c.getTime(); + return format.format(time); + } + if (month==3){ + c.add(Calendar.MONTH,-3); + Date time = c.getTime(); + return format.format(time); + } + if (month==6){ + c.add(Calendar.MONTH,-6); + Date time = c.getTime(); + return format.format(time); + } + return ""; + } + + public static String currentDate(){ + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + return format.format(new Date()); + } + + public static void main(String[] args) { + System.out.println(currentDate()); + } + +} diff --git a/common/src/main/java/com/huoran/common/utils/DateUtils.java b/common/src/main/java/com/huoran/common/utils/DateUtils.java new file mode 100644 index 0000000..d65ccd0 --- /dev/null +++ b/common/src/main/java/com/huoran/common/utils/DateUtils.java @@ -0,0 +1,193 @@ +package com.huoran.common.utils; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.time.format.DateTimeFormatter; +import java.util.Calendar; +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")); // 当前日期和时间 + } + + public static String formatTime(LocalDateTime time) { + String timeStr1 = time.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + return timeStr1; + } + + /** + * 时间类型转换 + * + * @param time + * @return + */ + public static String dateForByStr(String time) { + try { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); + Date date = sdf.parse(time); + //获取String类型的时间 + String createdate = sdf.format(date); + return createdate; + } catch (ParseException e) { + e.printStackTrace(); + return null; + } + + } + + /** + * 获取当前时间 + * + * @return + */ + /*public static String getNowTime(Integer userId) { + + String getDate = template.opsForValue().get("date:userId_" + userId); + SimpleDateFormat tempDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String datetime = tempDate.format(new java.utils.Date()); + //也可以用这个 + String datetimes = tempDate.format(new Date(System.currentTimeMillis())); + return getDate; + }*/ + public static String getNowTime() { + SimpleDateFormat tempDate = new SimpleDateFormat("yyyy-MM-dd HH:mm"); + String datetime = tempDate.format(new Date()); + //也可以用这个 + String datetimes = tempDate.format(new Date(System.currentTimeMillis())); + return datetime; + } + + public static String nowTime() { + SimpleDateFormat tempDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String datetime = tempDate.format(new Date()); + //也可以用这个 + String datetimes = tempDate.format(new Date(System.currentTimeMillis())); + return datetime; + } + + /** + * 获取当前时间往后推几个月 + * + * @param startDate + * @param number + * @return + */ + public static String getAfterDate(Date startDate, int number) { + Calendar c = Calendar.getInstance();//获得一个日历的实例 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + + c.setTime(startDate); + c.add(Calendar.MONTH, number); + + return sdf.format(c.getTime()); + } + + //获取两个日期之间的天数 + public static int getDatePoor(Date endDate, Date nowDate) { + Calendar cal = Calendar.getInstance(); + cal.setTime(endDate); + long time1 = cal.getTimeInMillis(); + cal.setTime(nowDate); + long time2 = cal.getTimeInMillis(); + long between_days = (time2 - time1) / (1000 * 3600 * 24); + int parseInt = Integer.parseInt(String.valueOf(between_days)); + parseInt = parseInt + 1; + return parseInt; + } + + public static void main(String[] args) throws ParseException { + String d1 = "2022-06-09 00:00"; + String d2 = "2022-06-10 23:00"; + + System.out.println(getTheNumberOfDaysBetweenTwoDates(d2, d1)); + } + + public static int getTheNumberOfDaysBetweenTwoDates(String endDate, String nowDate) throws ParseException { + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); + Date date1 = simpleDateFormat.parse(nowDate); + Date date2 = simpleDateFormat.parse(endDate); + int l = (int) (date2.getTime() - date1.getTime()) / (1000 * 24 * 60 * 60); + // System.out.println("两个时间相差" + l + "天"); + return l; + } + + /** + * Date 转换为 String + * + * @param date + * @return + */ + public static String getDateByString(Date date) { + String pattern2 = "yyyy-MM-dd HH:mm:ss"; + SimpleDateFormat sdf2 = new SimpleDateFormat(pattern2); + System.out.println(sdf2.format(date)); + return sdf2.format(date); + } + + public static Date getDateByDay(int day) { + Calendar calendar = Calendar.getInstance(); + // SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + calendar.add(Calendar.DAY_OF_YEAR, day); + return calendar.getTime(); + } + + /*public static long dateDiff(String startTime, String endTime) { + //按照dao传入的格式生成一个simpledateformate对象 + SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm"); + long nd = 1000 * 24 * 60 * 60;//一天的毫秒数 + long nh = 1000 * 60 * 60;//一小时的毫秒数 + long nm = 1000 * 60;//一分钟的毫秒数 + long ns = 1000;//一秒钟的毫秒数 + long diff; + try { + //获得两个时间的毫秒时间差异 + diff = sd.parse(endTime).getTime() - sd.parse(startTime).getTime(); + long day = diff / nd;//计算差多少天 + long hour = diff % nd / nh;//计算差多少小时 + long min = diff % nd % nh / nm;//计算差多少分钟 + long sec = diff % nd % nh % nm / ns;//计算差多少秒//输出结果 + System.out.println("时间相差:" + day + "天" + hour + "小时" + min + "分钟" + sec + "秒。"); + + + long countHour = 0;//统计分钟 + countHour = (day * 24 * 60) + (hour * 60) + min;//天数*24小时 + return countHour; + + } catch (Exception e) { + System.out.println(e.getMessage()); + return 0; + } + }*/ + + public static long dateDiffByLong(String startTime) throws ParseException { + + SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + long start = sd.parse(startTime).getTime(); + + long end = System.currentTimeMillis(); + + long min = (end - start) / (1000 * 60); + + System.out.println(min); + + if (min == 0) { + return 1; + } + return min; + } + + + /*public static void main(String[] args) throws ParseException { + dateDiffByLong("2021-05-28 09:52:05"); + }*/ + +} diff --git a/common/src/main/java/com/huoran/common/utils/DeleteFilesUtil.java b/common/src/main/java/com/huoran/common/utils/DeleteFilesUtil.java new file mode 100644 index 0000000..9990bf6 --- /dev/null +++ b/common/src/main/java/com/huoran/common/utils/DeleteFilesUtil.java @@ -0,0 +1,31 @@ +package com.huoran.common.utils; + +import java.io.File; + +/** + * @描述: + * @作者: Rong + * @日期: 2021/12/17 14:54 + */ +public class DeleteFilesUtil { + + /** + * 删除生成的文件 + * + * @param path + */ + public static void deleteFile(String path) { + File file = new File(path); + // 判断目录或文件是否存在 + if (file.exists()) { // 不存在返回 false + // 判断是否为文件 + if (file.isFile()) { + // 路径为文件且不为空则进行删除 + if (file.isFile() && file.exists()) { + file.delete(); + } + } + } + + } +} diff --git a/common/src/main/java/com/huoran/common/utils/EmailUtils.java b/common/src/main/java/com/huoran/common/utils/EmailUtils.java new file mode 100644 index 0000000..df39b5a --- /dev/null +++ b/common/src/main/java/com/huoran/common/utils/EmailUtils.java @@ -0,0 +1,81 @@ +package com.huoran.common.utils; + +import org.apache.commons.mail.DefaultAuthenticator; +import org.apache.commons.mail.HtmlEmail; + +import javax.mail.Message; +import javax.mail.Session; +import javax.mail.Transport; +import javax.mail.internet.InternetAddress; +import javax.mail.internet.MimeMessage; +import java.util.Properties; + +/** + * @description + * @author: Mr.JK + * @create: 2021-06-22 16:08 + **/ +public class EmailUtils { + + //服务器地址 + private static final String SERVER_ADDRESS = "smtp.mxhichina.com"; + //邮箱地址 + private static final String EMAILADDRESS = "postmaster@huorantech.cn"; + //发生邮箱密码 + private static final String EMAILPASSWORD = "HR111aaa"; + //发送人姓名 + private static final String EMAILUSERNAME = "DataForward"; + //授权码 + //private static final String AUTHORIZATION_CODE = "smtp.mxhichina.com"; + //邮件标题 + private static final String EMAILHEAD = "数据前瞻平台"; + //邮件信息(后接验证码)头部信息 + private static final String EMAILMASSAGEHEAD = "尊敬的用户,欢迎使用数据前瞻平台,您本次的验证码是: "; + //邮件信息(后接验证码)尾部信息 + private static final String EMAILMASSAGETAIL = ",有效时间为5分钟"; + + + //邮箱验证码 + public static boolean sendEmail(String emailaddress,String code){ + try { + HtmlEmail email = new HtmlEmail(); + email.setHostName(SERVER_ADDRESS); + email.setSSLOnConnect(true); //使用ssl加密true + email.setSslSmtpPort("465"); //使用465端口 + email.setCharset("UTF-8"); + email.addTo(emailaddress); + + email.setFrom(EMAILADDRESS, EMAILUSERNAME); +// -- 使用阿里企业邮箱无授权码 +// email.setAuthentication(EMAILADDRESS, AUTHORIZATION_CODE); + + email.setAuthenticator(new DefaultAuthenticator(EMAILADDRESS,EMAILPASSWORD)); + email.setSubject(EMAILHEAD); + email.setMsg( EMAILMASSAGEHEAD + code + EMAILMASSAGETAIL); + + email.send(); + return true; + } + catch(Exception e){ + e.printStackTrace(); + return false; + } + } + + /** + * 描述:是否是邮箱. + * + * @param str 指定的字符串 + * @return 是否是邮箱:是为true,否则false + */ + public static Boolean isEmail(String str) { + Boolean isEmail = false; + String expr = "^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})$"; + + if (str.matches(expr)) { + isEmail = true; + } + return isEmail; + } + +} \ No newline at end of file diff --git a/common/src/main/java/com/huoran/common/utils/HttpContextUtils.java b/common/src/main/java/com/huoran/common/utils/HttpContextUtils.java new file mode 100644 index 0000000..335761a --- /dev/null +++ b/common/src/main/java/com/huoran/common/utils/HttpContextUtils.java @@ -0,0 +1,32 @@ +package com.huoran.common.utils; + +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletRequest; +import java.util.Objects; + +/** + * HttpContextUtils + * + * @author cheney + * @version V1.0 + * @date 2022年7月28日 + */ +public class HttpContextUtils { + + public static HttpServletRequest getHttpServletRequest() { + return ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest(); + } + + public static boolean isAjaxRequest(HttpServletRequest request) { + + String accept = request.getHeader("accept"); + String xRequestedWith = request.getHeader("X-Requested-With"); + + // 如果是异步请求或是手机端,则直接返回信息 + return ((accept != null && accept.contains("application/json") + || (xRequestedWith != null && xRequestedWith.contains("XMLHttpRequest")) + )); + } +} diff --git a/common/src/main/java/com/huoran/common/utils/IPUtils.java b/common/src/main/java/com/huoran/common/utils/IPUtils.java new file mode 100644 index 0000000..14c0a2c --- /dev/null +++ b/common/src/main/java/com/huoran/common/utils/IPUtils.java @@ -0,0 +1,73 @@ +package com.huoran.common.utils; + +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.servlet.http.HttpServletRequest; +import java.net.InetAddress; +import java.net.UnknownHostException; + +/** + * IPUtils + * + * @author cheney + * @version V1.0 + * @date 2022年7月28日 + */ +public class IPUtils { + + private static Logger logger = LoggerFactory.getLogger(IPUtils.class); + + /** + * 获取IP地址 + *

+ * 使用Nginx等反向代理软件, 则不能通过request.getRemoteAddr()获取IP地址 + * 如果使用了多级反向代理的话,X-Forwarded-For的值并不止一个,而是一串IP地址,X-Forwarded-For中第一个非unknown的有效IP字符串,则为真实IP地址 + */ + public static String getIpAddr(HttpServletRequest request) { + String ip = null; + try { + ip = request.getHeader("x-forwarded-for"); + if (StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) { + ip = request.getHeader("Proxy-Client-IP"); + } + if (StringUtils.isEmpty(ip) || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + ip = request.getHeader("WL-Proxy-Client-IP"); + } + if (StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) { + ip = request.getHeader("HTTP_CLIENT_IP"); + } + if (StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) { + ip = request.getHeader("HTTP_X_FORWARDED_FOR"); + } + if (StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) { + ip = request.getRemoteAddr(); + } + } catch (Exception e) { + logger.error("IPUtils ERROR ", e); + } + + // 使用代理,则获取第一个IP地址 + if (!StringUtils.isEmpty(ip) && ip.length() > 15) { + if (ip.indexOf(",") > 0) { + ip = ip.substring(0, ip.indexOf(",")); + } + } + + return ip; + } + + /** + * 获取客户端主机名称 + */ + public static String getHostName() { + try { + return InetAddress.getLocalHost().getHostName(); + } catch (UnknownHostException e) { + logger.error(e.getMessage(), e); + } + return "未知"; + } + +} diff --git a/common/src/main/java/com/huoran/common/utils/JwtUtils.java b/common/src/main/java/com/huoran/common/utils/JwtUtils.java new file mode 100644 index 0000000..7ad49da --- /dev/null +++ b/common/src/main/java/com/huoran/common/utils/JwtUtils.java @@ -0,0 +1,57 @@ +package com.huoran.common.utils; + + +import io.jsonwebtoken.Jwts; +import io.jsonwebtoken.SignatureAlgorithm; +import org.springframework.util.StringUtils; + +import java.util.Date; + +/** + * @author cheney + */ +public class JwtUtils { + + public static final long EXPIRE = 1000 * 60 * 600 * 24;//失效时间 + public static final String APP_SECRET = "HuoRan2021chenHS25666";//hs256对称加密算法 + + public static String getJwtToken(String id){ + + String JwtToken = Jwts.builder() + .setHeaderParam("typ", "JWT") + .setHeaderParam("alg", "HS256") + .setSubject("user") + .setIssuedAt(new Date()) + .setExpiration(new Date(System.currentTimeMillis() + EXPIRE)) + .claim("accountId", id) + .signWith(SignatureAlgorithm.HS256, APP_SECRET) + .compact(); + + return JwtToken; + } + + public static void main(String[] args) { + String jwtToken = getJwtToken("108"); + System.out.println(jwtToken); + +// boolean jwtToken = checkToken("\n" + +// "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1c2VyIiwiaWF0IjoxNjk4OTkwNzc3LCJleHAiOjE2OTk4NTQ3NzcsImFjY291bnRJZCI6IjMxIn0.PkzSpCHaRNtFd2k0ik4zfqg0KhoYR1e-r51lbb1S0nc"); +// System.out.println(jwtToken); + } + + /** + * 判断token是否存在与有效 + */ + public static boolean checkToken(String jwtToken) { + if(StringUtils.isEmpty(jwtToken)) { + return false; + } + try { + Jwts.parser().setSigningKey(APP_SECRET).parseClaimsJws(jwtToken); + } catch (Exception e) { + e.printStackTrace(); + return false; + } + return true; + } +} diff --git a/common/src/main/java/com/huoran/common/utils/MD5.java b/common/src/main/java/com/huoran/common/utils/MD5.java new file mode 100644 index 0000000..f0e0ebb --- /dev/null +++ b/common/src/main/java/com/huoran/common/utils/MD5.java @@ -0,0 +1,34 @@ +package com.huoran.common.utils; + +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; + +public final class MD5 { + public static void main(String[] args) { + System.out.println(encrypt("admin")); + } + + public static String encrypt(String strSrc) { + try { + char hexChars[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', + '9', 'a', 'b', 'c', 'd', 'e', 'f' }; + byte[] bytes = strSrc.getBytes(); + MessageDigest md = MessageDigest.getInstance("MD5"); + md.update(bytes); + bytes = md.digest(); + int j = bytes.length; + char[] chars = new char[j * 2]; + int k = 0; + for (int i = 0; i < bytes.length; i++) { + byte b = bytes[i]; + chars[k++] = hexChars[b >>> 4 & 0xf]; + chars[k++] = hexChars[b & 0xf]; + } + return new String(chars); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + throw new RuntimeException("MD5加密出错!!+" + e); + } + } + +} diff --git a/common/src/main/java/com/huoran/common/utils/PageUtils.java b/common/src/main/java/com/huoran/common/utils/PageUtils.java new file mode 100644 index 0000000..b300d6a --- /dev/null +++ b/common/src/main/java/com/huoran/common/utils/PageUtils.java @@ -0,0 +1,111 @@ +/** + * Copyright (c) 2016-2019 人人开源 All rights reserved. + *

+ * https://www.renren.io + *

+ * 版权所有,侵权必究! + */ + +package com.huoran.common.utils; + + +import com.baomidou.mybatisplus.core.metadata.IPage; + +import java.io.Serializable; +import java.util.List; + +/** + * 分页工具类 + * + * @author Mark sunlightcs@gmail.com + */ +public class PageUtils implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 总记录数 + */ + private int totalCount; + /** + * 每页记录数 + */ + private int pageSize; + /** + * 总页数 + */ + private int totalPage; + /** + * 当前页数 + */ + private int currPage; + /** + * 列表数据 + */ + private List list; + + /** + * 分页 + * @param list 列表数据 + * @param totalCount 总记录数 + * @param pageSize 每页记录数 + * @param currPage 当前页数 + */ + public PageUtils(List list, int totalCount, int pageSize, int currPage) { + this.list = list; + this.totalCount = totalCount; + this.pageSize = pageSize; + this.currPage = currPage; + this.totalPage = (int) Math.ceil((double) totalCount / pageSize); + } + + /** + * 分页 + */ + public PageUtils(IPage page) { + this.list = page.getRecords(); + this.totalCount = (int) page.getTotal(); + this.pageSize = (int) page.getSize(); + this.currPage = (int) page.getCurrent(); + this.totalPage = (int) page.getPages(); + } + + public int getTotalCount() { + return totalCount; + } + + public void setTotalCount(int totalCount) { + this.totalCount = totalCount; + } + + public int getPageSize() { + return pageSize; + } + + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + public int getTotalPage() { + return totalPage; + } + + public void setTotalPage(int totalPage) { + this.totalPage = totalPage; + } + + public int getCurrPage() { + return currPage; + } + + public void setCurrPage(int currPage) { + this.currPage = currPage; + } + + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + +} diff --git a/common/src/main/java/com/huoran/common/utils/RandomUtil.java b/common/src/main/java/com/huoran/common/utils/RandomUtil.java new file mode 100644 index 0000000..5c34a5e --- /dev/null +++ b/common/src/main/java/com/huoran/common/utils/RandomUtil.java @@ -0,0 +1,64 @@ +package com.huoran.common.utils; + +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Random; + +/** + * 获取随机数 + * + * @author cheney + * + */ +public class RandomUtil { + + private static final Random random = new Random(); + + private static final DecimalFormat fourdf = new DecimalFormat("0000"); + + private static final DecimalFormat sixdf = new DecimalFormat("000000"); + + public static String getFourBitRandom() { + return fourdf.format(random.nextInt(10000)); + } + + public static String getSixBitRandom() { + return sixdf.format(random.nextInt(1000000)); + } + + /** + * 给定数组,抽取n个数据 + * @param list + * @param n + * @return + */ + public static ArrayList getRandom(List list, int n) { + + Random random = new Random(); + + HashMap hashMap = new HashMap(); + + // 生成随机数字并存入HashMap + for (int i = 0; i < list.size(); i++) { + + int number = random.nextInt(100) + 1; + + hashMap.put(number, i); + } + + // 从HashMap导入数组 + Object[] robjs = hashMap.values().toArray(); + + ArrayList r = new ArrayList(); + + // 遍历数组并打印数据 + for (int i = 0; i < n; i++) { + r.add(list.get((int) robjs[i])); + System.out.print(list.get((int) robjs[i]) + "\t"); + } + System.out.print("\n"); + return r; + } +} diff --git a/common/src/main/java/com/huoran/common/utils/SendSMSUtils.java b/common/src/main/java/com/huoran/common/utils/SendSMSUtils.java new file mode 100644 index 0000000..04bcc55 --- /dev/null +++ b/common/src/main/java/com/huoran/common/utils/SendSMSUtils.java @@ -0,0 +1,56 @@ +package com.huoran.common.utils; + +import com.alibaba.fastjson.JSONObject; +import com.aliyuncs.CommonRequest; +import com.aliyuncs.CommonResponse; +import com.aliyuncs.DefaultAcsClient; +import com.aliyuncs.IAcsClient; +import com.aliyuncs.exceptions.ClientException; +import com.aliyuncs.http.MethodType; +import com.aliyuncs.profile.DefaultProfile; +import com.huoran.common.constant.SMSTemplate; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; + +import java.util.Map; + +/** + * @description + * @author: Mr.JK + * @create: 2021-06-22 15:58 + **/ +@Slf4j +public class SendSMSUtils { + + public static boolean send(String PhoneNumbers, String templateCode, Map param) { + + if(StringUtils.isEmpty(PhoneNumbers)) { + return false; + } + + DefaultProfile profile = + DefaultProfile.getProfile("default", "LTAI4FzqQHnk4rozqLZ8jCNj", "mveW7B1OyFoKUkHm8WsxmrjHmkJWHq"); + IAcsClient client = new DefaultAcsClient(profile); + + CommonRequest request = new CommonRequest(); + request.setMethod(MethodType.GET); + request.setDomain("dysmsapi.aliyuncs.com"); + request.setVersion("2017-05-25"); + request.setAction("SendSms"); + + request.putQueryParameter("PhoneNumbers", PhoneNumbers); + request.putQueryParameter("SignName", SMSTemplate.SMS_SIGNATURE); + request.putQueryParameter("TemplateCode", templateCode); + request.putQueryParameter("TemplateParam", JSONObject.toJSONString(param)); + + try { + CommonResponse response = client.getCommonResponse(request); + System.out.println(response.getData()); + return response.getHttpResponse().isSuccess(); + } catch (ClientException e) { + e.printStackTrace(); + } + return false; + } + +} diff --git a/common/src/main/java/com/huoran/common/utils/TokenUtils.java b/common/src/main/java/com/huoran/common/utils/TokenUtils.java new file mode 100644 index 0000000..758fe34 --- /dev/null +++ b/common/src/main/java/com/huoran/common/utils/TokenUtils.java @@ -0,0 +1,60 @@ +package com.huoran.common.utils; + +import io.jsonwebtoken.Claims; +import io.jsonwebtoken.Jws; +import io.jsonwebtoken.Jwts; +import org.apache.commons.lang3.StringUtils; + +import javax.servlet.http.HttpServletRequest; + +import static com.huoran.common.utils.JwtUtils.APP_SECRET; + +/** + * @Author chen + * @DATE 2021/7/8 11:21 + * @Version 1.0 + */ +public class TokenUtils { + + /** + * 判断token是否存在与有效 + */ + public static boolean checkToken(HttpServletRequest request) { + try { + String jwtToken = request.getHeader("token"); + if(StringUtils.isEmpty(jwtToken)) { + return false; + } + Jwts.parser().setSigningKey(APP_SECRET).parseClaimsJws(jwtToken); + } catch (Exception e) { + e.printStackTrace(); + return false; + } + return true; + } + + /** + * 根据token获取账号id + */ + public static String getIdByJwtToken(HttpServletRequest request) { + String jwtToken = request.getHeader("token"); + if(StringUtils.isEmpty(jwtToken)) { + return ""; + } + Jws claimsJws = Jwts.parser().setSigningKey(APP_SECRET).parseClaimsJws(jwtToken); + Claims claims = claimsJws.getBody(); + return (String)claims.get("accountId"); + } + + /** + * 根据token获取账号id + */ + public static String getIdByJwtToken(String token) { + if(StringUtils.isEmpty(token)) { + return ""; + } + Jws claimsJws = Jwts.parser().setSigningKey(APP_SECRET).parseClaimsJws(token); + Claims claims = claimsJws.getBody(); + return (String)claims.get("accountId"); + } +} diff --git a/common/src/main/java/com/huoran/common/utils/VideoUtil.java b/common/src/main/java/com/huoran/common/utils/VideoUtil.java new file mode 100644 index 0000000..a9673ed --- /dev/null +++ b/common/src/main/java/com/huoran/common/utils/VideoUtil.java @@ -0,0 +1,18 @@ +package com.huoran.common.utils; + +import java.util.regex.Pattern; + +/** + * @Author chen + * @DATE 2020/10/12 9:47 + * @Version 1.0 + * 正则验证是否为视频文件工具类 + */ +public class VideoUtil { + + public static boolean isVideo(String suffix){ + String reg = "(mp4|flv|avi|rm|rmvb|wmv|qlv)"; + Pattern p = Pattern.compile(reg); + return p.matcher(suffix).find(); + } +} diff --git a/competition/pom.xml b/competition/pom.xml new file mode 100644 index 0000000..b7adb28 --- /dev/null +++ b/competition/pom.xml @@ -0,0 +1,124 @@ + + + + huoran + com.huoran.parent + 1.0-SNAPSHOT + + 4.0.0 + + competition + + + 8 + 8 + UTF-8 + + + + + + + + + + + com.huoran.common + common + 0.0.1-SNAPSHOT + + + + com.huoran.api + api + 1.0-SNAPSHOT + compile + + + + com.alibaba + easyexcel + + + + org.apache.poi + poi-ooxml + + + org.apache.poi + poi + + + + + cn.afterturn + easypoi-base + + + guava + com.google.guava + + + guava + com.google.guava + + + poi-ooxml-schemas + org.apache.poi + + + + + cn.afterturn + easypoi-web + + + cn.afterturn + easypoi-annotation + + + + + + competition-1.0.0 + + + + src/main/java + + **/*.xml + + + + src/main/resources + + **/*.properties + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + true + + + + + + + \ No newline at end of file diff --git a/competition/src/main/java/com/huoran/competition/CompetitionApplication.java b/competition/src/main/java/com/huoran/competition/CompetitionApplication.java new file mode 100644 index 0000000..5a1e81e --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/CompetitionApplication.java @@ -0,0 +1,22 @@ +package com.huoran.competition; + +import org.mybatis.spring.annotation.MapperScan; +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; +import org.springframework.scheduling.annotation.EnableScheduling; +@SpringBootApplication +@EnableDiscoveryClient +@EnableScheduling//定时任务 +@EnableFeignClients(basePackages = "com.huoran.api") +@MapperScan(basePackages = "com.huoran.competition.mapper") +@ComponentScan(basePackages = {"com.huoran"}) +public class CompetitionApplication { + + public static void main(String[] args) { + SpringApplication.run(CompetitionApplication.class, args); + } + +} diff --git a/competition/src/main/java/com/huoran/competition/config/AsyncTaskPoolConfig.java b/competition/src/main/java/com/huoran/competition/config/AsyncTaskPoolConfig.java new file mode 100644 index 0000000..539401a --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/config/AsyncTaskPoolConfig.java @@ -0,0 +1,29 @@ +package com.huoran.competition.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.annotation.AsyncConfigurer; +import org.springframework.scheduling.annotation.EnableAsync; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; + +import java.util.concurrent.ThreadPoolExecutor; + +@Configuration +@EnableAsync +public class AsyncTaskPoolConfig implements AsyncConfigurer { + @Bean(name = "competitionExecutor") + public ThreadPoolTaskExecutor taskExecutor(){ + ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor(); + taskExecutor.setCorePoolSize(300); + taskExecutor.setMaxPoolSize(500); + taskExecutor.setQueueCapacity(800); + taskExecutor.setKeepAliveSeconds(60); + taskExecutor.setThreadNamePrefix("competition-async-"); + taskExecutor.setWaitForTasksToCompleteOnShutdown(true); + taskExecutor.setAwaitTerminationSeconds(60); + taskExecutor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); + taskExecutor.initialize(); + return taskExecutor; + } +} + diff --git a/competition/src/main/java/com/huoran/competition/config/DruidConfig.java b/competition/src/main/java/com/huoran/competition/config/DruidConfig.java new file mode 100644 index 0000000..ef375e0 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/config/DruidConfig.java @@ -0,0 +1,54 @@ +package com.huoran.competition.config; + +import com.alibaba.druid.pool.DruidDataSource; +import com.alibaba.druid.support.http.StatViewServlet; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.web.servlet.ServletRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import javax.sql.DataSource; +import java.util.HashMap; +import java.util.Map; + + +//@Configuration +public class DruidConfig { + + /* + 将自定义的 Druid数据源添加到容器中,不再让 Spring Boot 自动创建 + 绑定全局配置文件中的 druid 数据源属性到 com.alibaba.druid.pool.DruidDataSource从而让它们生效 + @ConfigurationProperties(prefix = "spring.datasource"):作用就是将 全局配置文件中 + 前缀为 spring.datasource的属性值注入到 com.alibaba.druid.pool.DruidDataSource 的同名参数中 + */ + @ConfigurationProperties(prefix = "spring.datasource") + @Bean + public DataSource druidDataSource() { + return new DruidDataSource(); + } + + //配置 Druid 监控管理后台的Servlet; +//内置 Servlet 容器时没有web.xml文件,所以使用 Spring Boot 的注册 Servlet 方式 + @Bean + public ServletRegistrationBean statViewServlet() { + ServletRegistrationBean bean = new ServletRegistrationBean(new StatViewServlet(), "/druid/*"); + + // 这些参数可以在 com.alibaba.druid.support.http.StatViewServlet + // 的父类 com.alibaba.druid.support.http.ResourceServlet 中找到 + Map initParams = new HashMap<>(); + initParams.put("loginUsername", "admin"); //后台管理界面的登录账号 + initParams.put("loginPassword", "123456"); //后台管理界面的登录密码 + + //后台允许谁可以访问 + //initParams.put("allow", "localhost"):表示只有本机可以访问 + //initParams.put("allow", ""):为空或者为null时,表示允许所有访问 + initParams.put("allow", ""); + //deny:Druid 后台拒绝谁访问 + //initParams.put("kuangshen", "192.168.1.20");表示禁止此ip访问 + + //设置初始化参数 + bean.setInitParameters(initParams); + return bean; + } + +} diff --git a/competition/src/main/java/com/huoran/competition/config/SwaggerConfig.java b/competition/src/main/java/com/huoran/competition/config/SwaggerConfig.java new file mode 100644 index 0000000..9565063 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/config/SwaggerConfig.java @@ -0,0 +1,69 @@ +package com.huoran.competition.config; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.ParameterBuilder; +import springfox.documentation.builders.PathSelectors; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.schema.ModelRef; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.service.Parameter; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger.web.DocExpansion; +import springfox.documentation.swagger.web.OperationsSorter; +import springfox.documentation.swagger.web.UiConfiguration; +import springfox.documentation.swagger.web.UiConfigurationBuilder; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author Mr.JK + */ +@Configuration +@EnableSwagger2 +@Profile({"dev","test"}) +public class SwaggerConfig { + + @Bean + public Docket createRestApi() { + // 构造token给测试的时候填写 + ParameterBuilder tokenPar = new ParameterBuilder(); + List pars = new ArrayList(); + tokenPar.name("token").description("用户令牌(不需用户鉴权的不需要传)").modelRef(new ModelRef("string")).parameterType("header") + .required(false).build(); + pars.add(tokenPar.build()); + + return new Docket(DocumentationType.SWAGGER_2) + .apiInfo(apiInfo()) + .select() + .apis(RequestHandlerSelectors.basePackage("com.huoran.competition.controller")) + .apis(RequestHandlerSelectors.withClassAnnotation(Api.class)) + .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) + .paths(PathSelectors.any()) + .build().globalOperationParameters(pars); + } + + + + @Bean + UiConfiguration uiConfig() { + return UiConfigurationBuilder.builder().docExpansion(DocExpansion.LIST).operationsSorter(OperationsSorter.ALPHA).build(); + } + + private ApiInfo apiInfo() { + return new ApiInfoBuilder() + .title("赛事微服务接口文档") + .description("cheney") + .contact("developer@mail.com") + .version("1.0") + .build(); + } + +} \ No newline at end of file diff --git a/competition/src/main/java/com/huoran/competition/controller/CompetitionAnnexController.java b/competition/src/main/java/com/huoran/competition/controller/CompetitionAnnexController.java new file mode 100644 index 0000000..3987116 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/controller/CompetitionAnnexController.java @@ -0,0 +1,51 @@ +package com.huoran.competition.controller; + + +import com.huoran.common.aop.annotation.NoRepeatSubmit; +import com.huoran.common.response.R; +import com.huoran.competition.entity.CompetitionAnnex; +import com.huoran.competition.service.CompetitionAnnexService; +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.*; + +/** + *

+ * 赛事附件表 前端控制器 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +@Api(tags = "赛事附件管理") +@RestController +@RequestMapping("/competition/annex") +public class CompetitionAnnexController { + + @Autowired + private CompetitionAnnexService competitionAnnexService; + @NoRepeatSubmit + @PostMapping("/update") + @ApiOperation(value = "编辑赛事附件",response = CompetitionAnnex.class) + public R update(@RequestBody CompetitionAnnex competitionAnnex) { + boolean update = competitionAnnexService.updateById(competitionAnnex); + return update ? R.ok() : R.error(); + } + @NoRepeatSubmit + @PostMapping("/save") + @ApiOperation(value = "新增赛事附件",response = CompetitionAnnex.class) + public R save(@RequestBody CompetitionAnnex competitionAnnex) { + boolean save = competitionAnnexService.save(competitionAnnex); + return save ? R.ok() : R.error(); + } + @NoRepeatSubmit + @PostMapping("/delete") + @ApiOperation(value = "删除赛事附件",response = CompetitionAnnex.class) + public R delete(@RequestParam("id") @ApiParam(name = "id", value = "附件id", required = true) Integer id) { + boolean del = competitionAnnexService.removeById(id); + return del ? R.ok() : R.error(); + } +} + diff --git a/competition/src/main/java/com/huoran/competition/controller/CompetitionAnnouncementAnnexController.java b/competition/src/main/java/com/huoran/competition/controller/CompetitionAnnouncementAnnexController.java new file mode 100644 index 0000000..bf0441e --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/controller/CompetitionAnnouncementAnnexController.java @@ -0,0 +1,67 @@ +package com.huoran.competition.controller; + + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.common.aop.annotation.NoRepeatSubmit; +import com.huoran.common.constant.DelConstant; +import com.huoran.common.response.R; +import com.huoran.competition.entity.CompetitionAnnouncementAnnex; +import com.huoran.competition.service.CompetitionAnnouncementAnnexService; +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.List; + +/** + *

+ * 赛事公告附件表 前端控制器 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +@Api(tags = "赛事公告附件管理") +@RestController +@RequestMapping("/competition/announcementAnnex") +public class CompetitionAnnouncementAnnexController { + + @Autowired + public CompetitionAnnouncementAnnexService service; + + @PostMapping("/viewAttachments") + @ApiOperation(value = "查看公告下的附件",response = CompetitionAnnouncementAnnex.class) + public R findById(@RequestParam("announcementId") @ApiParam(value = "announcementId") Integer announcementId) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("announcement_id",announcementId); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + List annexList = service.list(queryWrapper); + return R.ok().put("list",annexList); + } + @NoRepeatSubmit + @PostMapping("/save") + @ApiOperation(value = "新增",response = CompetitionAnnouncementAnnex.class) + public R save(@RequestBody CompetitionAnnouncementAnnex competitionAnnouncementAnnex) { + boolean save = service.save(competitionAnnouncementAnnex); + return save ? R.ok() : R.error(); + } + + @NoRepeatSubmit + @PostMapping("/update") + @ApiOperation(value = "修改",response = CompetitionAnnouncementAnnex.class) + public R update(@RequestBody CompetitionAnnouncementAnnex competitionAnnouncementAnnex) { + boolean update = service.updateById(competitionAnnouncementAnnex); + return update ? R.ok() : R.error(); + } + + @NoRepeatSubmit + @PostMapping("/delete") + @ApiOperation(value = "根据主键删除",response = CompetitionAnnouncementAnnex.class) + public R delete(@RequestParam("id") @ApiParam(value = "id")Integer id) { + boolean delete = service.removeById(id); + return delete ? R.ok() : R.error(); + } +} + diff --git a/competition/src/main/java/com/huoran/competition/controller/CompetitionAnnouncementController.java b/competition/src/main/java/com/huoran/competition/controller/CompetitionAnnouncementController.java new file mode 100644 index 0000000..7d85323 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/controller/CompetitionAnnouncementController.java @@ -0,0 +1,114 @@ +package com.huoran.competition.controller; + + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.common.aop.annotation.NoRepeatSubmit; +import com.huoran.common.constant.DelConstant; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.competition.entity.CompetitionAnnouncement; +import com.huoran.competition.entity.CompetitionAnnouncementAnnex; +import com.huoran.competition.service.CompetitionAnnouncementAnnexService; +import com.huoran.competition.service.CompetitionAnnouncementService; +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 javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + *

+ * 赛事公告表 前端控制器 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +@Api(tags = "赛事公告管理") +@RestController +@RequestMapping("/competition/announcement") +public class CompetitionAnnouncementController { + + @Autowired + public CompetitionAnnouncementService service;//公告 + + @Autowired + public CompetitionAnnouncementAnnexService annexService;//大赛公告附件 + + + @PostMapping("/queryAnnouncementDetails") + @ApiOperation(value = "查询公告详情",response = CompetitionAnnouncement.class) + public R findById( + @RequestParam("id") @ApiParam(value = "公告主键") Integer id) { + CompetitionAnnouncement competitionAnnouncement = service.getById(id); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("announcement_id",id); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + List annexList = annexService.list(queryWrapper); + if (annexList.size()>0){ + competitionAnnouncement.setAnnouncementAnnexList(annexList); + } + return R.ok().put("data", competitionAnnouncement); + } + + @NoRepeatSubmit + @PostMapping("/addAnnouncement") + @ApiOperation(value = "新增公告",response = CompetitionAnnouncement.class) + public R save(@RequestBody CompetitionAnnouncement competitionAnnouncement, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + competitionAnnouncement.setAccountId(Integer.valueOf(accountId)); + boolean save = service.save(competitionAnnouncement); + if (competitionAnnouncement.getAnnouncementAnnexList().size() > 0) { + competitionAnnouncement.getAnnouncementAnnexList().forEach(competitionAnnex -> { + competitionAnnex.setAnnouncementId(competitionAnnouncement.getId()); + boolean saveCompetitionAnnex = annexService.save(competitionAnnex);//保存比赛附件 + }); + } + return save ? R.ok() : R.error(); + } + + @NoRepeatSubmit + @PostMapping("/amendmentAnnouncement") + @ApiOperation(value = "修改公告",response = CompetitionAnnouncement.class) + public R update(@RequestBody CompetitionAnnouncement competitionAnnouncement) { + boolean update = service.updateById(competitionAnnouncement); + return update ? R.ok() : R.error(); + } + + @NoRepeatSubmit + @ApiOperation(value = "是否禁用公告") + @PutMapping("/disableAnnouncement") + public R disableAnnouncement(@ApiParam(name = "id", value = "公告主键", required = true) @RequestParam Integer id, + @ApiParam(name = "isDisable", value = "是否开启(0开启 1未开启 默认0)", required = true)@RequestParam Integer isDisable) { + if (isDisable==1 || isDisable==0) { + CompetitionAnnouncement CompetitionAnnouncement = new CompetitionAnnouncement(); + CompetitionAnnouncement.setId(id); + CompetitionAnnouncement.setIsOpen(isDisable); + boolean update = service.updateById(CompetitionAnnouncement); + return update ? R.ok() : R.error(); + } else { + return R.error("启用状态错误"); + } + } + @NoRepeatSubmit + @PostMapping("/deleteAnnouncement") + @ApiOperation(value = "删除公告",response = CompetitionAnnouncement.class) + public R delete(@RequestParam("id") @ApiParam(value = "公告主键") Integer id) { + boolean del = service.removeById(id); + return del ? R.ok() : R.error(); + } + + + @PostMapping("/queryAnnouncementByCompetitionId") + @ApiOperation(value = "根据赛事id查询公告列表(分页)",response = CompetitionAnnouncement.class) + public R queryAnnouncementByCompetitionId( + @RequestParam("competitionId") @ApiParam(value = "赛事id") String competitionId, + @ApiParam(value = "当前页数", required = true) @RequestParam("pageNum") Integer pageNum, + @ApiParam(value = "当前页需要显示的数量", required = true) @RequestParam("pageSize") Integer pageSize) { + return service.queryAnnouncementByCompetitionId(competitionId, pageNum, pageSize); + } +} + diff --git a/competition/src/main/java/com/huoran/competition/controller/CompetitionContentController.java b/competition/src/main/java/com/huoran/competition/controller/CompetitionContentController.java new file mode 100644 index 0000000..68b8eb5 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/controller/CompetitionContentController.java @@ -0,0 +1,58 @@ +package com.huoran.competition.controller; + + +import com.huoran.common.aop.annotation.NoRepeatSubmit; +import com.huoran.common.response.R; +import com.huoran.competition.entity.CompetitionContent; +import com.huoran.competition.entity.req.CompetitionContentReq; +import com.huoran.competition.service.CompetitionContentService; +import com.huoran.competition.service.CompetitionContentService; +import com.huoran.competition.service.CompetitionStageContentSettingService; +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.*; + +/** + *

+ * 前端控制器 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +@Api(tags = "赛事內容管理") +@RestController +@RequestMapping("/competition/content") +public class CompetitionContentController { + + @Autowired + private CompetitionContentService competitionContentService; + @NoRepeatSubmit + @ApiOperation(value = "添加赛事内容") + @PostMapping("/addCompetitionContent") + public R addCompetitionContent( + @ApiParam(name = "competitionContent", value = "赛事内容对象", required = true) + @RequestBody CompetitionContentReq contentReq) { + return competitionContentService.addCompetitionContent(contentReq); + } + + @ApiOperation(value = "根据赛事id查询赛事内容") + @GetMapping("/getCompetitionContent") + public R getCompetitionContent( + @ApiParam(name = "competitionId" , value = "賽事id") + @RequestParam("competitionId") String competitionId) { + return competitionContentService.getCompetitionContent(competitionId); + } + @NoRepeatSubmit + @ApiOperation(value = "编辑赛事内容") + @PostMapping("/editCompetitionContent") + public R editCompetitionContent( + @ApiParam(name = "competitionContent", value = "赛事内容对象", required = true) + @RequestBody CompetitionContentReq contentReq) { + return competitionContentService.editCompetitionContent(contentReq); + } + +} + diff --git a/competition/src/main/java/com/huoran/competition/controller/CompetitionController.java b/competition/src/main/java/com/huoran/competition/controller/CompetitionController.java new file mode 100644 index 0000000..50bd7c2 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/controller/CompetitionController.java @@ -0,0 +1,428 @@ +package com.huoran.competition.controller; + + +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.huoran.api.NakadaiClient; +import com.huoran.api.UserClient; +import com.huoran.common.aop.annotation.NoRepeatSubmit; +import com.huoran.common.constant.DelConstant; +import com.huoran.common.response.R; +import com.huoran.common.utils.DateUtils; +import com.huoran.common.utils.TokenUtils; +import com.huoran.competition.entity.*; +import com.huoran.competition.entity.req.*; +import com.huoran.competition.entity.vo.CompetitionDetailsVO; +import com.huoran.competition.entity.vo.CompetitionVO; +import com.huoran.competition.service.*; +import com.huoran.competition.service.impl.CompetitionContentServiceImpl; +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.data.redis.core.StringRedisTemplate; +import org.springframework.web.bind.annotation.*; + +import javax.script.ScriptException; +import javax.servlet.http.HttpServletRequest; +import java.util.Date; +import java.util.List; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; + +/** + *

+ * 赛事信息表 前端控制器 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +@Api(tags = "赛事信息管理") +@RestController +@RequestMapping("/competition/management") +public class CompetitionController { + @Autowired + private StringRedisTemplate redisTemplate; + @Autowired + private UserClient userClient; + + @Autowired + private CompetitionService competitionService; + + @Autowired + private CompetitionRegistrationService competitionRegistrationService; + + @Autowired + private CompetitionRangeService competitionRangeService; + + @Autowired + private CompetitionAnnexService competitionAnnexService; + + @Autowired + private CompetitionTeamService competitionTeamService; + + @Autowired + private CompetitionRuleService competitionRuleService; + + @Autowired + private CompleteCompetitionSetupService completeCompetitionSetupService; + + @Autowired + private CompetitionStageContentSettingService contentSettingService; + + @Autowired + private CompetitionReleaseTimeService competitionReleaseTimeService; + + @Autowired + CompetitionContentServiceImpl competitionContentService; + + + @Autowired + CompetitionStageFileService stageFileService; + + @Autowired + private NakadaiClient nakadaiClient; + + @NoRepeatSubmit + @ApiOperation(value = "创建赛事") + @PostMapping("/addCompetition") + public R addCompetition(@ApiParam(name = "Competition", value = "赛事对象", required = true) @RequestBody Competition competition, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + competition.setSchoolId(schoolId); + competition.setFounderId(Integer.valueOf(accountId)); + return competitionService.addCompetition(competition); + } + + @NoRepeatSubmit + @ApiOperation(value = "修改赛事") + @PostMapping("/editCompetition") + public R editCompetition(@ApiParam(name = "competition", value = "赛事对象", required = true) @RequestBody Competition competition) { + boolean update = competitionService.updateById(competition); + + //赛事类型为完整赛事,更新其他信息 + if (competition.getCompleteCompetitionSetup() != null) { + completeCompetitionSetupService.updateById(competition.getCompleteCompetitionSetup()); + } + + if (competition.getCompetitionScope() == 2) { + if (competition.getCompetitionRangeList().size() > 0) { + //1.首先删除原有的大赛范围选择 + UpdateWrapper annexUpdateWrapper = new UpdateWrapper<>(); + annexUpdateWrapper.set("is_del", DelConstant.IS_DEL); + annexUpdateWrapper.eq("Competition_id", competition.getId()); + boolean delCompetitionAnnex = competitionRangeService.update(new CompetitionRange(), annexUpdateWrapper); + + //2.重新保存比赛范围 + competition.getCompetitionRangeList().forEach(CompetitionRange -> { + CompetitionRange.setCompetitionId(competition.getId()); + boolean saveCompetitionRange = competitionRangeService.save(CompetitionRange);//保存比赛范围 + }); + } + } + return update ? R.ok() : R.error(); + } + + @NoRepeatSubmit + @ApiOperation(value = "根据id删除赛事") + @PostMapping("/deleteCompetition") + public R deleteCompetition(@ApiParam(name = "competitionId", value = "赛事ID", required = true) @RequestParam Integer competitionId) { + //删除赛事下的定时 + competitionReleaseTimeService.remove(new QueryWrapper().eq("competition_id", competitionId)); + boolean remove = competitionService.removeCompetition(competitionId); + return remove ? R.ok() : R.error(); + } + + @NoRepeatSubmit + @ApiOperation(value = "批量删除赛事") + @PostMapping("/batchDeleteCompetition") + public R deleteCompetition(@ApiParam(name = "competitionIds", value = "赛事ID", required = true) @RequestParam List competitionIds) { + competitionIds.forEach(competitionId -> { + //删除赛事下的定时 + competitionReleaseTimeService.remove(new QueryWrapper().eq("competition_id", competitionId)); + competitionService.removeCompetition(competitionId); + }); + return R.ok(); + } + + @ApiOperation(value = "根据id查询赛事", response = Competition.class) + @PostMapping("/getCompetition") + public R getCompetition(@ApiParam(name = "competitionId", value = "赛事ID", required = true) @RequestParam("competitionId") String competitionId, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Competition competition = competitionService.getById(competitionId); +// 查询赛事报名表 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("competition_id", competitionId); + wrapper.eq("account_id", accountId); + CompetitionRegistration registration = competitionRegistrationService.getOne(wrapper); + if (registration != null) { + CompetitionTeam team = competitionTeamService.getById(registration.getTeamId()); + if (team != null) { + if (team.getCaptain() == 0) { + registration.setTeamId(team.getTeamId()); + } else { + registration.setTeamId(team.getPid()); + } + } + } + competition.setCompetitionRegistration(registration); + List CompetitionAnnexList = competitionAnnexService.getCompetitionAnnexByCompetitionId(competitionId); + List CompetitionRangeList = competitionRangeService.getCompetitionRangeByCompetitionId(competitionId); + if (CompetitionRangeList.size() > 0) { + competition.setCompetitionRangeList(CompetitionRangeList); + } + if (CompetitionAnnexList.size() > 0) { + competition.setCompetitionAnnexList(CompetitionAnnexList); + } + + if (competition.getCompetitionScope() == 1) { + competition.setRange("全平台"); + } else if (competition.getCompetitionScope() == 2) { + competition.setRange("指定范围"); + //依据赛事id查询指定范围的省、市、学校 + competition.setCompetitionRangeRespList(competitionRangeService.getRangeByCompetitionId(competition.getId())); + } +// if (competition.getReleaseType()==1){ + QueryWrapper setupQueryWrapper = new QueryWrapper<>(); + setupQueryWrapper.eq("competition_id", competitionId); + CompleteCompetitionSetup competitionSetup = completeCompetitionSetupService.getOne(setupQueryWrapper); + competition.setCompleteCompetitionSetup(competitionSetup); + + + QueryWrapper ruleQueryWrapper = new QueryWrapper<>(); + ruleQueryWrapper.eq("setup_id", competitionSetup.getSetupId()); + CompetitionRule one = competitionRuleService.getOne(ruleQueryWrapper); + if (one != null) { + competition.setRule(one.getRule()); + } +// } + //查询赛事阶段内容数据 + List stages = competitionService.queryCompetitionStage(competitionId, accountId); + + + + R competitionContent = competitionContentService.getCompetitionContent(competitionId); + List contentList = (List) competitionContent.get("contentList"); + competition.setContentList(contentList); + competition.setCompetitionStage(stages); + if (contentList.size() > 0) { + + for (CompetitionStage stage: stages) { + QueryWrapper queryWrapper1 = new QueryWrapper<>(); + queryWrapper1.eq("competition_id", competitionId); + queryWrapper1.eq("stage_id", stage.getStageId()); + CompetitionStageContentSetting stageContentSetting = contentSettingService.getOne(queryWrapper1); + if (!ObjectUtil.isEmpty(stageContentSetting)) { + //赋值线下内容设置 + stage.setCompetitionStageContentSetting(stageContentSetting); + + QueryWrapper queryWrapper2 = new QueryWrapper<>(); + queryWrapper2.eq("competition_id",competitionId); + queryWrapper2.eq("stage_id", stage.getStageId()); + queryWrapper2.eq("account_id",accountId); + CompetitionStageFile myFile = stageFileService.getOne(queryWrapper2); + if (!ObjectUtil.isEmpty(myFile)){ + stage.setCompetitionStageFile(myFile); + } + } + + } + + } + return R.ok().put("competition", competition); + } + + @NoRepeatSubmit + @ApiOperation(value = "发布赛事") + @PostMapping("/publishCompetition") + public R publishCompetition(@ApiParam(name = "competitionId", value = "赛事ID", required = true) @RequestParam("competitionId") Integer competitionId, @ApiParam(name = "publishStatus", value = "发布状态", required = true) @RequestParam("publishStatus") Integer publishStatus) { + Competition getDetail = competitionService.getById(competitionId); + getDetail.setPublishStatus(publishStatus); + getDetail.setZtOpen(0); + boolean ret = competitionService.updateById(getDetail); + return ret ? R.ok() : R.error(); + } + + @NoRepeatSubmit + @ApiOperation(value = "赛事禁启用", response = CompetitionRange.class) + @PostMapping("/disabledEvents") + public R disabledEvents(@RequestBody DisableEnableCompetitionReq req) { + + Competition getDetail = competitionService.getById(req.getCompetitionId()); + Competition competition = new Competition(); + competition.setId(req.getCompetitionId()); + //禁用平台来源(0中台,1职站) + switch (req.getType()) { + case 0: + competition.setZtOpen(req.getIsOpen()); + break; + case 1: + //原型需求: + // 客户创建的大赛,禁用时职站首页以及学生登录后的大赛模块看不到对应的比赛,创建的老师在大赛管理还是可以看到该大赛,可以编辑,但是无法启用。 + // 即中台禁用的大赛,即使是该院校老师创建的,老师端也不能自己启用,需要中台启用。 + //1.判断当前院校禁启用状态为要启用时候再判断当前赛事中台禁启用的状态 + if (req.getIsOpen() == 0) { + if (getDetail.getZtOpen() == 1) { + return R.error("当前赛事已被平台禁用,请联系平台管理员!"); + } + } + competition.setIsOpen(req.getIsOpen()); + break; + + } + boolean ret = competitionService.updateById(competition); + + //保存的key名 + String key = "competitionDisabled"; + //保存到缓存中 + redisTemplate.opsForValue().set(key, "true"); + return ret ? R.ok() : R.error(); + } + + + @PostMapping("/getRedisCache") + @ApiOperation(value = "获取Redis缓存(返回true 刷新)") + public R getRedisCache() { + //保存的key名 + String key = "competitionDisabled"; + //查看缓存是否有数据 + String returnValue = redisTemplate.opsForValue().get(key); + + //使用缓存返回数据 + if (returnValue != null) { + + //设置key过期时间 + redisTemplate.expire(key, 5000, TimeUnit.MILLISECONDS);//设置过期时间 + return R.ok().put("data", returnValue); + } + + + return R.ok(); + } + + + @ApiOperation(value = "赛事样例数据") + @PostMapping("/eventSampleData") + public boolean eventSampleData(@RequestParam("accountId") @ApiParam(value = "账号id") Integer accountId, @RequestParam("schoolId") @ApiParam(value = "学校id") Integer schoolId) { + Competition competition = new Competition(); + competition.setFounderId(accountId); + competition.setName("样例赛事"); + competition.setCoverUrl("https://huoran.oss-cn-shenzhen.aliyuncs.com/20220509/png/1523606505516457984.png"); + competition.setCarouselUrl("https://huoran.oss-cn-shenzhen.aliyuncs.com/20220310/png/1501818796133343232.png"); + competition.setSponsor("主办方"); + competition.setUndertaker("承办方"); + competition.setDescription("样例赛事,仅供参考!"); + competition.setPublishStatus(1); + competition.setPlayStartTime(DateUtils.getDateByDay(15)); + competition.setPlayEndTime(DateUtils.getDateByDay(18)); + competition.setSignUpStartTime(new Date()); + competition.setSignUpEndTime(DateUtils.getDateByDay(10)); + competition.setSchoolId(schoolId); + competition.setPlatformSource(1);//平台来源(0:中台,1:职站) + competition.setCompetitionScope(0);//大赛范围(0:本校内 1:全平台 2:指定区域、院校) + return competitionService.save(competition); + } + + + @ApiOperation(value = "职站——赛事列表(教师端赛事管理)") + @PostMapping("/competitionPageConditionQueryByOccupationlab") + public R CompetitionPageConditionQueryByOccupationlab(@RequestBody PageCompetitionListReq pageCompetitionListReq, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + pageCompetitionListReq.setSchoolId(schoolId); + if (!accountId.equals("")) { + pageCompetitionListReq.setAccountId(Integer.valueOf(accountId)); + } + return competitionService.competitionPageConditionQueryByOccupationlab(pageCompetitionListReq); + + } + + @ApiOperation(value = "中台——赛事列表分页条件查询(赛事广场)") + @PostMapping("/competitionPageConditionQueryByNakadai") + public R competitionPageConditionQueryByNakadai(@RequestBody PageCompetitionListReq pageCompetitionListReq, HttpServletRequest request) { + return competitionService.competitionPageConditionQueryByNakadai(pageCompetitionListReq); + } + + @ApiOperation(value = "查询赛事状态(返回为false时表示当前赛事在教师端已禁用)") + @PostMapping("/checkTheStatusOfTheCompetition") + public boolean checkTheStatusOfTheCompetition(@ApiParam(name = "competitionId", value = "赛事ID", required = true) @RequestParam String competitionId) { + Competition competition = competitionService.getById(competitionId); + //是否开启(0开启 1未开启 默认0) + return competition.getIsOpen() != 1; + } + + @ApiOperation(value = "职站(学生端)——登录前竞赛", response = CompetitionVO.class) + @PostMapping("/notLoggedInBeforeStudentEvents") + public R notLoggedInBeforeStudentEvents(@RequestBody PageCompetitionListReq pageCompetitionListReq, HttpServletRequest request) throws ExecutionException, InterruptedException { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + if (!accountId.equals("")) { + pageCompetitionListReq.setSchoolId(schoolId); + pageCompetitionListReq.setAccountId(Integer.valueOf(accountId)); + } else { + pageCompetitionListReq.setAccountId(0); + } + Future> pageFuture = competitionService.notLoggedInBeforeStudentEvents(pageCompetitionListReq); + IPage pageList = pageFuture.get(); + return R.ok().put("data",pageList); + + } + + @ApiOperation(value = "职站(学生端)——登录后竞赛", response = CompetitionVO.class) + @PostMapping("/competitionAfterLogin") + public R competitionAfterLogin(@RequestBody AfterLoginPageCompetitionListReq pageCompetitionListReq, HttpServletRequest request) throws ExecutionException, InterruptedException { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + if (!accountId.equals("")) { + pageCompetitionListReq.setSchoolId(schoolId); + pageCompetitionListReq.setAccountId(Integer.valueOf(accountId)); + } + Future> pageFuture = competitionService.competitionAfterLogin(pageCompetitionListReq); + IPage pageList = pageFuture.get(); + return R.ok().put("data",pageList); + } + + + @ApiOperation(value = "大赛阶段详情", response = CompetitionDetailsVO.class) + @PostMapping("/detailsOfCompetitionStage") + public R detailsOfCompetitionStage(@RequestBody CompetitionDetailReq req, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + return competitionService.detailsOfCompetitionStage(req); + + } + + @ApiOperation(value = "是否允许参加赛事(淘汰赛制)", response = CompetitionDetailsVO.class) + @PostMapping("/allowedParticipateCompetition") + public R allowedParticipateCompetition(@RequestBody AllowedParticipateCompetitionReq req, HttpServletRequest request) throws ScriptException { + String accountId = TokenUtils.getIdByJwtToken(request); + req.setAccountId(accountId); + return competitionService.allowedParticipateCompetition(req); + + } + + @ApiOperation(value = "是否为参赛人员(团队赛)", response = CompetitionDetailsVO.class) + @PostMapping("/isParticipant") + public R isParticipant(@RequestBody IsParticipantReq req, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + req.setAccountId(accountId); + return competitionService.isParticipant(req); + } + + @ApiOperation(value = "获取当前时间") + @GetMapping("/getCurrentTime") + public R getCurrentTime() { + return R.ok().put("currentTime",new Date()); + } + +// @XxlJob("competitionStop") +// public void competitionStop() { +// //通知收卷 +// nakadaiClient.refreshPageNotification("系统通知","all","1"); +// } +} + diff --git a/competition/src/main/java/com/huoran/competition/controller/CompetitionPerformanceController.java b/competition/src/main/java/com/huoran/competition/controller/CompetitionPerformanceController.java new file mode 100644 index 0000000..44530ff --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/controller/CompetitionPerformanceController.java @@ -0,0 +1,144 @@ +package com.huoran.competition.controller; + + +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.huoran.api.UserClient; +import com.huoran.common.aop.annotation.NoRepeatSubmit; +import com.huoran.common.constant.DelConstant; +import com.huoran.common.entity.UserScore; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.competition.entity.CompetitionStage; +import com.huoran.competition.entity.req.PageGradeListReq; +import com.huoran.competition.entity.resp.ListOfStageResultsResp; +import com.huoran.competition.entity.vo.GradeExportVO; +import com.huoran.competition.service.CompetitionStageService; +import com.huoran.competition.service.UserScoreService; +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 org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + + +@Api(tags = "赛事成绩管理") +@RestController +@RequestMapping("/competition/performance") +public class CompetitionPerformanceController { + @Autowired + private UserClient userClient; + + @Autowired + private UserScoreService userScoreService; + @Autowired + CompetitionStageService competitionStageService; + + @NoRepeatSubmit + @PostMapping("/batchImportGrades") + @ApiOperation("批量导入大赛成绩") + public R batchImportGrades(@ApiParam(name = "file", value = "文件", required = true) @RequestParam(name = "file") MultipartFile file, @ApiParam(name = "competitionId", value = "赛事ID", required = true) @RequestParam Integer competitionId, @ApiParam(name = "systemId", value = "系统id", required = true) @RequestParam Integer systemId, @ApiParam(name = "stageId", value = "赛事阶段id", required = true) @RequestParam Integer stageId, HttpServletRequest request) throws IOException { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + if (systemId == null) { + systemId = 0; + } + Map map = userScoreService.batchImportGrades(file, competitionId, systemId, stageId, schoolId); + return R.ok().put("data", map); + } + + + @ApiOperation(value = "批量导入成绩管理失败数据导出") + @GetMapping("/exportFailure") + public void exportFailureRecord(HttpServletResponse response, @ApiParam(name = "exportCode", value = "batchImportGrades接口返回的exportCode", required = true) @RequestParam String exportCode) throws Exception { + userScoreService.exportFailureRecord(response, exportCode); + } + + + /** + * 比赛方式(0实操,1理论,2线下) + * 依据赛事比赛方式查询数据:为线下时查询分数表,其余查实验报告表 + *

+ * 已删除的实验报告不计入统计中!!! + * + * @param req + * @return + */ + @ApiOperation(value = "阶段成绩管理", response = ListOfStageResultsResp.class) + @PostMapping("/stageGradeManagementList") + public R stageGradeManagementList(@RequestBody PageGradeListReq req) { + CompetitionStage competitionStage = competitionStageService.getById(req.getStageId()); + if (competitionStage.getMethod() == 2) {//为线下时查询分数表,其余查实验报告表 + return userScoreService.stageGradeManagementList(req); + } + return userScoreService.stageReportOfExperimentList(req); + + } + + @NoRepeatSubmit + @ApiOperation(value = "批量赛事导出实验成绩") + @PostMapping("/exportExperimentalResultsInBatch") + public void exportExperimentalResultsInBatch(@RequestBody List list, HttpServletResponse response) throws IOException { + userScoreService.exportExperimentalResultsInBatch(list, response); + } + + + @ApiOperation(value = "赛事导出全部实验成绩") + @PostMapping("/allExperimentalResultsAreDerived") + public void allExperimentalResultsAreDerived(@RequestBody PageGradeListReq req, HttpServletResponse response) throws IOException { + List list = new ArrayList<>(); + req.setPageSize(100000); + Integer serialNumber = 0; + List getUnpaginatedEventResult = userScoreService.getUnpaginatedEventResults(req); + for (ListOfStageResultsResp resp : getUnpaginatedEventResult) { + GradeExportVO exportVO = new GradeExportVO(); + exportVO.setScore(resp.getScore()); + exportVO.setTeamName(resp.getTeamName()); + exportVO.setSchoolName(resp.getSchoolName()); + exportVO.setTimeSum(resp.getTimeSum()); + exportVO.setWorkNumber(resp.getWorkNumber()); + exportVO.setSerialNumber(++serialNumber); + exportVO.setSubmitTime(resp.getSubmitTime()); + exportVO.setUserName(resp.getUserName()); + list.add(exportVO); + } + userScoreService.exportExperimentalResultsInBatch(list, response); + } + + + /** + * 比赛方式(0实操,1理论,2线下) + * 依据赛事比赛方式删除数据:为线下时删除分数表数据,其余删除实验报告表数据 + *

+ * 已删除的实验报告不计入统计中!!! + * + * @param + * @return + */ + @ApiOperation(value = "删除赛事成绩") + @PostMapping("/batchDeleteContestGrade") + public R deleteContest(@RequestBody PageGradeListReq req) { + CompetitionStage competitionStage = competitionStageService.getById(req.getStageId()); + boolean ret; + if (competitionStage.getMethod() == 2) {//为线下时查询分数表,其余查实验报告表 + + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.set("is_del", DelConstant.IS_DEL); + updateWrapper.in("id", req.getIds()); + + ret = userScoreService.update(new UserScore(), updateWrapper); + } else { + ret = userScoreService.batchDeletionOfExperimentalReports(req.getIds()); + } + return ret ? R.ok() : R.error(); + } + +} + diff --git a/competition/src/main/java/com/huoran/competition/controller/CompetitionProgressController.java b/competition/src/main/java/com/huoran/competition/controller/CompetitionProgressController.java new file mode 100644 index 0000000..707c7a5 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/controller/CompetitionProgressController.java @@ -0,0 +1,78 @@ +package com.huoran.competition.controller; + + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.common.aop.annotation.NoRepeatSubmit; +import com.huoran.common.response.R; +import com.huoran.competition.entity.CompetitionProgress; +import com.huoran.competition.service.CompetitionProgressService; +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.Date; +import java.util.List; + +/** + *

+ * 赛事进展表 前端控制器 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +@Api(tags = "赛事进展管理") +@RestController +@RequestMapping("/competition/progress") +public class CompetitionProgressController { + + @Autowired + private CompetitionProgressService competitionProgressService; + @NoRepeatSubmit + @ApiOperation(value = "添加竞赛进展") + @PostMapping("/addCompetitionProgress") + public R addCompetitionProgress( + @ApiParam(name = "competitionProgress", value = "竞赛进展对象", required = true) + @RequestBody CompetitionProgress competitionProgress) { + //判重 + boolean isRepeat = competitionProgressService.repeat(competitionProgress); + if (isRepeat) { + return R.error("竞赛进展已存在"); + } + boolean save = competitionProgressService.save(competitionProgress); + return save ? R.ok() : R.error(); + } + + @ApiOperation(value = "根据赛事id查询竞赛进展") + @GetMapping("/getCompetitionProgress") + public R getCompetitionProgress( + @ApiParam(name = "competitionId" , value = "賽事id") + @RequestParam("competitionId") String competitionId) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("competition_id", competitionId); + List competitionProgressList = competitionProgressService.list(wrapper); + return R.ok().put("competitionProgressList", competitionProgressList); + } + @NoRepeatSubmit + @ApiOperation(value = "根据id删除竞赛进展") + @DeleteMapping("/deleteCompetitionProgress") + public R deleteCompetitionProgress( + @ApiParam(name = "competitionProgressId", value = "竞赛进展ID", required = true) + @RequestParam Integer competitionProgressId) { + boolean remove = competitionProgressService.removeById(competitionProgressId); + return remove ? R.ok() : R.error(); + } + @NoRepeatSubmit + @ApiOperation(value = "修改竞赛进展") + @PutMapping("/editCompetitionProgress") + public R editCompetitionProgress( + @ApiParam(name = "competitionProgress", value = "赛事进展对象", required = true) + @RequestBody CompetitionProgress competitionProgress) { + boolean update = competitionProgressService.updateById(competitionProgress); + return update ? R.ok() : R.error(); + } + +} + diff --git a/competition/src/main/java/com/huoran/competition/controller/CompetitionRangeController.java b/competition/src/main/java/com/huoran/competition/controller/CompetitionRangeController.java new file mode 100644 index 0000000..508f308 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/controller/CompetitionRangeController.java @@ -0,0 +1,66 @@ +package com.huoran.competition.controller; + + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.common.response.R; +import com.huoran.competition.entity.CompetitionRange; +import com.huoran.competition.entity.resp.SchoolResp; +import com.huoran.competition.service.CompetitionRangeService; +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.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.List; + +/** + *

+ * 赛事范围表 前端控制器 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +@Api(value = "赛事范围管理") +@RestController +@RequestMapping("/competition/range") +public class CompetitionRangeController { + + @Autowired + private CompetitionRangeService competitionRangeService; + + @ApiOperation(value = "查询赛事指定范围内学校") + @GetMapping("/schoolsInCompetitionArea") + public R schoolsInCompetitionArea( + @ApiParam(name = "competitionId" , value = "賽事id") + @RequestParam("competitionId") String competitionId) { + //赛事范围(0:本校内 1:全平台 2.指定区域、院校) + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("competition_id",competitionId); + List list = competitionRangeService.list(wrapper); + List schools = new ArrayList<>(); + for (CompetitionRange competitionRange : list) { + if (competitionRange.getSchoolId()!=null){ + List school = competitionRangeService.getSchool(competitionRange.getSchoolId()); + schools.addAll(school); + } + if (competitionRange.getCityId()!=null&&competitionRange.getSchoolId()==null ){ + List city = competitionRangeService.getCity(competitionRange.getCityId(), competitionRange.getProvinceId()); + schools.addAll(city); + } + //都为空查询省份 + if (competitionRange.getProvinceId()!=null&&competitionRange.getCityId()==null&&competitionRange.getSchoolId()==null){ + List province = competitionRangeService.getProvince(competitionRange.getProvinceId()); + schools.addAll(province); + } + } + return R.ok().put("schools", schools); + } + +} + diff --git a/competition/src/main/java/com/huoran/competition/controller/CompetitionRankingController.java b/competition/src/main/java/com/huoran/competition/controller/CompetitionRankingController.java new file mode 100644 index 0000000..d1638c6 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/controller/CompetitionRankingController.java @@ -0,0 +1,410 @@ +package com.huoran.competition.controller; + + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.huoran.common.aop.annotation.NoRepeatSubmit; +import com.huoran.common.constant.DelConstant; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.competition.entity.CompetitionRanking; +import com.huoran.competition.entity.CompetitionReleaseTime; +import com.huoran.competition.entity.CompleteCompetitionSetup; +import com.huoran.competition.entity.req.*; +import com.huoran.competition.entity.resp.DetailsOfTotalTeamScoresResp; +import com.huoran.competition.entity.resp.ListOfStageResultsResp; +import com.huoran.competition.entity.vo.GradeExportVO; +import com.huoran.competition.entity.vo.PersonageRankingExportVO; +import com.huoran.competition.entity.vo.RankingExportVO; +import com.huoran.competition.service.CompetitionRankingService; +import com.huoran.competition.service.CompetitionReleaseTimeService; +import com.huoran.competition.service.CompetitionStageService; +import com.huoran.competition.service.CompleteCompetitionSetupService; +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.data.redis.core.StringRedisTemplate; +import org.springframework.data.redis.core.ValueOperations; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.script.ScriptException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Api(tags = "赛事排名管理") +@RestController +@RequestMapping("/competition/rank") +public class CompetitionRankingController { + + @Autowired + private CompleteCompetitionSetupService completeCompetitionSetupService; + + @Autowired + private CompetitionStageService stagService; + + @Autowired + private CompetitionRankingService rankingService; + + @Autowired + private StringRedisTemplate redisTemplate; + + @Autowired + private CompetitionReleaseTimeService timeService; + + /** + * 2023-11-30更改需求:阶段用时以及总分排名用时更改:如下 + * 算法应该跟比赛规则一样,比如阶段取最高分,用时就是最高分的人的时间。此处规则是团队的成绩之和,因此用时也应该按成员的用时之和来算。 + * 总排名的用时,如果是积分赛有权重的,也要加上权重去算出耗时,如果别的阶段没有录入耗时的,默认对应阶段全体耗时为0。 + * @param req + * @return + */ + @ApiOperation(value = "中台积分赛总排名") + @PostMapping("/overallStandingsInThePointsRace") + public R overallStandingsInThePointsRace(@RequestBody OverallStandingsInThePointsRaceReq req) { + //1.总成绩权重为0表示当前阶段成绩不计入总分排名中。 + //2.总排名依据总成绩计算方式以及占其成绩的权重比计 + return stagService.overallRanking(req); + } + + + + @ApiOperation(value = "团队赛导出排名") + @PostMapping("/derivedRanking") + public void derivedRanking(@RequestBody List rankingExportVOS, HttpServletResponse response) throws IOException, ScriptException { + stagService.derivedRanking(rankingExportVOS, response); + } + + @ApiOperation(value = "个人导出排名") + @PostMapping("/individualDerivedRanking") + public void individualDerivedRanking(@RequestBody List rankingExportVOS, HttpServletResponse response) throws IOException, ScriptException { + stagService.individualDerivedRanking(rankingExportVOS, response); + } + + + + + + @ApiOperation(value = "阶段赛事排名(基础/单个阶段的排名)") + @PostMapping("/stageRaceRanking") + public R stageRaceRanking( + @ApiParam(name = "competitionId", value = "赛事ID", required = true) + @RequestParam Integer competitionId, + @ApiParam(name = "stageId", value = "阶段ID", required = true) + @RequestParam Integer stageId, + @ApiParam(value = "当前页数", required = true) + @RequestParam("pageNum") Integer pageNum, + @ApiParam(value = "当前页需要显示的数量", required = true) + @RequestParam("pageSize") Integer pageSize, + @ApiParam(value = " 发布类型(0默认发布 1批量手动导入) ", required = true) + @RequestParam("publicationType") Integer publicationType) throws ScriptException { + return stagService.stageRaceRanking(competitionId, stageId, pageNum, pageSize, publicationType); + } + + + @ApiOperation(value = "单个阶段团队得分详情") + @PostMapping("/stageTeamScoreDetails") + public R stageTeamScoreDetails(@RequestBody StageTeamScoreDetailsReq req) { + return stagService.stageTeamScoreDetails(req); + } + + @ApiOperation(value = "多个阶段团队得分详情") + @PostMapping("/multipleStageTeamScoreDetails") + public R multipleStageTeamScoreDetails(@RequestBody StageTeamScoreDetailsReq req) { + return stagService.multipleStageTeamScoreDetails(req); + } + + + @ApiOperation(value = "发布排名") + @PostMapping("/publishRanking") + public R publishRanking(@RequestBody List rankingList) { + return rankingService.publishRanking(rankingList); + } + + + @ApiOperation(value = "批量发布(批量上传后更改还未发布的状态)") + @PostMapping("/batchRelease") + public R batchRelease(@RequestBody List ids) { + if (ids.size() <= 0) { + return R.error("列表没有数据!请上传数据后发布。"); + } + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.in("id", ids); + List rankingList = rankingService.list(queryWrapper); + + //查询本次要发布的排名 + Integer publicationType = rankingList.get(0).getPublicationType();//publicationType 发布类型(0默认发布 1批量手动导入) + Integer getCompetitionId = rankingList.get(0).getCompetitionId(); + Integer getIsOverallRanking = rankingList.get(0).getIsOverallRanking();//是否为总分排名(1为是 默认0不是) + Integer getStageId = rankingList.get(0).getStageId(); + + QueryWrapper queryWrapper1 = new QueryWrapper<>(); + queryWrapper1.eq("competition_id", getCompetitionId); + queryWrapper1.eq("is_release", DelConstant.POST_STATUS);//已发布 + //如果为总分排名时,默认删除上一次发布的总分排名 + if (getIsOverallRanking == 1) { + queryWrapper1.eq("is_overall_ranking", getIsOverallRanking); + } else { + //如果为阶段排名时候,则删除上一次的阶段排名 + if (publicationType == 0) { + queryWrapper1.eq("publication_type", 1); + } else { + queryWrapper1.eq("publication_type", 0); + } + queryWrapper1.eq("stage_id", getStageId); + } + rankingService.remove(queryWrapper1); + + + for (Integer id : ids) { + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.set("is_release", DelConstant.POST_STATUS); + updateWrapper.eq("id", id); + rankingService.update(new CompetitionRanking(), updateWrapper); + } + return R.ok(); + } + + + @PostMapping("/batchImportRanking") + @ApiOperation("手动发布排名(批量上传Excel)") + public R batchImportRanking(@ApiParam(name = "file", value = "文件", required = true) @RequestParam(name = "file") MultipartFile file, + @ApiParam(name = "competitionId", value = "赛事ID", required = true) @RequestParam Integer competitionId, + @ApiParam(name = "stageId", value = "赛事阶段id", required = true) @RequestParam Integer stageId, + @ApiParam(name = "isOverallRanking", value = "是否为总分排名(1为是 默认0不是)", required = true) @RequestParam Integer isOverallRanking, + @ApiParam(name = "schoolId", value = "学校id", required = false) @RequestParam Integer schoolId, + HttpServletRequest request) throws IOException { + String accountId = TokenUtils.getIdByJwtToken(request); + //查看赛事类型是个人赛还是团队赛事 + CompleteCompetitionSetup competitionSetup = completeCompetitionSetupService.getRaceSettingsByRaceId(competitionId); + Map map = new HashMap<>(); + switch (competitionSetup.getCompetitionType()) { + case 0: + //个人 + map = rankingService.importIndividualRankingsInBulk(file, competitionId, stageId, isOverallRanking, schoolId); + break; + case 1: + map = rankingService.batchImportRanking(file, competitionId, stageId, isOverallRanking, schoolId); + break; + } + + + return R.ok().put("data", map); + } + + @ApiOperation(value = "批量导入排名管理失败数据导出") + @GetMapping("/exportFailure") + public void exportFailureRecord(HttpServletResponse response, @ApiParam(name = "exportCode", value = "batchImportRanking接口返回的exportCode", required = true) @RequestParam String exportCode, @ApiParam(name = "exportCode", value = "大赛id", required = true) @RequestParam Integer competitionId) throws Exception { + rankingService.exportFailureRecord(response, exportCode, competitionId); + } + + + /** + * 成绩是设置规则多少小时候公布,排名是发布就有排名 + * + * @param req + * @return + */ + @ApiOperation(value = "前台大赛排名") + @PostMapping("/frontOfficeCompetitionRanking") + public R frontOfficeCompetitionRanking(@RequestBody FrontDeskStageTeamScoreDetailsReq req, HttpServletRequest request) { + String id = TokenUtils.getIdByJwtToken(request); + if (req.getType() != null && req.getType() == 1) { + req.setAccountId(id); + } + + + return rankingService.frontOfficeCompetitionRanking(req); + } + + + @ApiOperation(value = "批量导入后取消导入") + @PostMapping("/cancelImport") + public R cancelImport(@RequestBody List ids) { + return rankingService.removeByIds(ids) ? R.ok() : R.error(); + } + + + /*@ApiOperation(value = "前台竞赛阶段") + @PostMapping("/frontStageCompetition") + public R frontStageCompetition(@RequestBody FrontStageCompetitionReq req) { + return R.ok(rankingService.frontStageCompetition(req)); + }*/ + + + @ApiOperation(value = "前台积分赛总排名(前台展示的是中台发布后的)") + @PostMapping("/frontDeskOverallRanking") + public R frontDeskOverallRanking(@RequestBody OverallStandingsInThePointsRaceReq req) { + //1.总成绩权重为0表示当前阶段成绩不计入总分排名中。 + //2.总排名依据总成绩计算方式以及占其成绩的权重比计 + return rankingService.frontDeskOverallRanking(req); + } + + + @ApiOperation(value = "总分团队得分详情(前台发布后才展示只用于前台)", response = DetailsOfTotalTeamScoresResp.class) + @PostMapping("/detailsOfTotalTeamScores") + public R detailsOfTotalTeamScores(@RequestBody DetailsOfTotalTeamScoresReq req) { + return rankingService.detailsOfTotalTeamScores(req); + } + + @ApiOperation(value = "取消排名") + @PostMapping("/cancelRanking") + public R cancelRanking( + @ApiParam(name = "competitionId", value = "赛事ID", required = true) + @RequestParam Integer competitionId, + @ApiParam(name = "stageIds", value = "多个阶段Id", required = true) + @RequestParam List stageIds, + @ApiParam(name = "isOverallRanking", value = "是否为总分排名(1为是 默认0不是)", required = true) + @RequestParam Integer isOverallRanking, + @ApiParam(name = "releaseId", value = "定时id", required = true) + @RequestParam Integer releaseId) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("competition_id", competitionId); + + if (isOverallRanking == 0) { + queryWrapper.in("stage_id", stageIds); + } + + queryWrapper.eq("is_overall_ranking", isOverallRanking); + boolean ret = rankingService.remove(queryWrapper); + + //删除定时id + timeService.removeById(releaseId); + + + return ret ? R.ok() : R.error(); + } + + + @ApiOperation(value = "发布前删除上一次的排名") + @PostMapping("/deleteLastPublication") + public R deleteLastPublication(@RequestBody DelCompetitionRankingReq req) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("competition_id", req.getCompetitionId()); + if (req.getIsOverallRanking() == 0) { + queryWrapper.in("stage_id", req.getStageIds()); + } + queryWrapper.eq("is_overall_ranking", req.getIsOverallRanking()); + + boolean ret = rankingService.remove(queryWrapper); + return ret ? R.ok() : R.error(); + } + + @ApiOperation(value = "判断是否发布过排名没有(返回whetherToPublish:TRUE为已经发布过 FALSE未发布)") + @PostMapping("/whetherToPublish") + public R whetherToPublish(@ApiParam(name = "competitionId", value = "赛事ID", required = true) @RequestParam Integer competitionId, @ApiParam(name = "stageId", value = "阶段Id", required = true) @RequestParam Integer stageId, @ApiParam(name = "isOverallRanking", value = "是否为总分排名(1为是 默认0不是)", required = true) @RequestParam Integer isOverallRanking, @ApiParam(name = "publicationType", value = "发布类型(0默认发布 1批量手动导入)", required = true) @RequestParam Integer publicationType) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("competition_id", competitionId); + queryWrapper.eq("stage_id", stageId); + queryWrapper.eq("is_release", DelConstant.POST_STATUS); + queryWrapper.eq("is_overall_ranking", isOverallRanking); + queryWrapper.eq("publication_type", publicationType); + List ranking = rankingService.list(queryWrapper); + if (ranking.size() > 0) { + return R.ok().put("whetherToPublish", true); + } + return R.ok().put("whetherToPublish", false); + } + + + /** + * 需求如下: + * 发布前要提示:默认排序已发布,是否要取消默认排序的发布内容,替换为手动发布的内容? + * + * @param competitionId + * @param stageId + * @param isOverallRanking + * @return + */ + @ApiOperation(value = "点击发布时校验(丢redis中判断)") + @PostMapping("/releaseVerification") + public R releaseVerification(@ApiParam(name = "competitionId", value = "赛事ID", required = true) @RequestParam Integer competitionId, @ApiParam(name = "stageId", value = "阶段Id(字符串类型 可传多个且以逗号隔开)", required = true) @RequestParam String stageId, @ApiParam(name = "isOverallRanking", value = "是否为总分排名(1为是 默认0不是)", required = true) @RequestParam Integer isOverallRanking, @ApiParam(name = "whetherToManuallyPublish", value = "是否手动发布(1为是 0不是)", required = true) @RequestParam Integer whetherToManuallyPublish) { + + ValueOperations opsForString = redisTemplate.opsForValue(); + //保存的key名 + String key = "releaseVerification:competitionId:" + competitionId + "stageId:" + stageId + "isOverallRanking:" + isOverallRanking; + //将数据存入缓存 + opsForString.set(key, whetherToManuallyPublish + ""); + return R.ok(); + } + + + @ApiOperation(value = "查询发布上一次排名的来源——>默认顺序或者手动发布(返回数据:是否手动发布(1为是,0不是))") + @PostMapping("/queryPublicationSource") + public R queryPublicationSource(@ApiParam(name = "competitionId", value = "赛事ID", required = true) @RequestParam Integer competitionId, @ApiParam(name = "stageId", value = "阶段Id(字符串类型 可传多个且以逗号隔开)", required = true) @RequestParam String stageId, @ApiParam(name = "isOverallRanking", value = "是否为总分排名(1为是 默认0不是)", required = true) @RequestParam Integer isOverallRanking) { + ValueOperations opsForString = redisTemplate.opsForValue(); + //保存的key名 + String key = "releaseVerification:competitionId:" + competitionId + "stageId:" + stageId + "isOverallRanking:" + isOverallRanking; + + //查看缓存是否有数据 + String returnValue = opsForString.get(key); + //使用缓存返回数据 + if (returnValue != null) { + return R.ok().put("source", returnValue); + } + return R.ok().put("source", 0); + } + + + @ApiOperation(value = "总分排名下的得分详情(只用于后台)", response = DetailsOfTotalTeamScoresResp.class) + @PostMapping("/totalRankingScoreDetails") + public R totalRankingScoreDetails(@RequestBody StageTeamScoreDetailsReq req) { + return stagService.totalRankingScoreDetails(req); + } + + + /* @ApiOperation(value = "手动上传的列表") + @PostMapping("/manuallyRankTheUploadList") + public R whetherToPublish(@RequestBody BatchUploadListCompetitionReq req) { + return rankingService.manuallyRankTheUploadList(req); + }*/ + + @ApiOperation(value = "后台手动上传的排名(不论发布还是没有发布的)", response = ListOfStageResultsResp.class) + @PostMapping("/manuallyUploadedRankings") + public R manuallyUploadedRankings(@RequestBody BatchUploadListCompetitionReq req) { + return rankingService.manuallyRankTheUploadList(req); + + } + + + @ApiOperation(value = "更换选中排序方式(丢redis中)") + @PostMapping("/toggleTheSortingMode") + public R toggleTheSortingMode(@ApiParam(name = "competitionId", value = "赛事ID", required = true) @RequestParam Integer competitionId, @ApiParam(name = "stageId", value = "阶段Id(字符串类型 可传多个且以逗号隔开)", required = true) @RequestParam String stageId, @ApiParam(name = "isOverallRanking", value = "是否为总分排名(1为是 默认0不是)", required = true) @RequestParam Integer isOverallRanking, @ApiParam(name = "whetherToManuallyPublish", value = "是否手动发布(1为是 0不是)", required = true) @RequestParam Integer whetherToManuallyPublish) { + ValueOperations opsForString = redisTemplate.opsForValue(); + //保存的key名 + String key = "toggleTheSortingMode:competitionId:" + competitionId + "stageId:" + stageId + "isOverallRanking:" + isOverallRanking; + //将数据存入缓存 + opsForString.set(key, whetherToManuallyPublish + ""); + + String returnValue = opsForString.get(key); + //使用缓存返回数据 + if (returnValue == null) { + return R.ok().put("source", returnValue); + } + return R.ok(); + } + + + @ApiOperation(value = "返回选中上次排序状态(丢redis中)/返回的数据source为:(0默认 1手动)") + @PostMapping("/selectTheLastSortStatus") + public R selectTheLastSortStatus(@ApiParam(name = "competitionId", value = "赛事ID", required = true) @RequestParam Integer competitionId, @ApiParam(name = "stageId", value = "阶段Id(字符串类型 可传多个且以逗号隔开)", required = true) @RequestParam String stageId, @ApiParam(name = "isOverallRanking", value = "是否为总分排名(1为是 默认0不是)", required = true) @RequestParam Integer isOverallRanking) { + ValueOperations opsForString = redisTemplate.opsForValue(); + //保存的key名 + String key = "toggleTheSortingMode:competitionId:" + competitionId + "stageId:" + stageId + "isOverallRanking:" + isOverallRanking; + //查看缓存是否有数据 + String returnValue = opsForString.get(key); + //使用缓存返回数据 + if (returnValue != null) { + return R.ok().put("source", returnValue); + } + return R.ok().put("source", 0); + } + +} + diff --git a/competition/src/main/java/com/huoran/competition/controller/CompetitionRegistrationController.java b/competition/src/main/java/com/huoran/competition/controller/CompetitionRegistrationController.java new file mode 100644 index 0000000..119b9ba --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/controller/CompetitionRegistrationController.java @@ -0,0 +1,121 @@ +package com.huoran.competition.controller; + + +import com.huoran.common.aop.annotation.NoRepeatSubmit; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.competition.entity.CompetitionRegistration; +import com.huoran.competition.entity.req.PageRegistrationStaffReq; +import com.huoran.competition.entity.vo.RegistrationVO; +import com.huoran.competition.service.CompetitionRegistrationService; +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 javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; + +/** + *

+ * 赛事报名人员表 前端控制器 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +@Api(tags = "赛事报名人员管理") +@RestController +@RequestMapping("/competition/registration") +public class CompetitionRegistrationController { + + @Autowired + private CompetitionRegistrationService competitionRegistrationService; + @NoRepeatSubmit + @ApiOperation(value = "是否禁用报名人员") + @PutMapping("/disableRegistration") + public R disableRegistration( + @ApiParam(name = "competitionRegistrationId", value = "报名人员id", required = true) + @RequestParam Integer competitionRegistrationId, + @ApiParam(name = "isDisable", value = "是否禁用", required = true) + @RequestParam Integer isDisable) { + CompetitionRegistration competitionRegistration = new CompetitionRegistration(); + competitionRegistration.setId(competitionRegistrationId); + competitionRegistration.setIsDisable(isDisable); + boolean update = competitionRegistrationService.updateById(competitionRegistration); + return update ? R.ok() : R.error(); + } + @NoRepeatSubmit + @ApiOperation(value = "个人赛事报名") + @PostMapping("/addCompetitionRegistration") + public R addCompetitionRegistration( + @ApiParam(name = "competitionRegistration", value = "报名人员对象", required = true) + @RequestBody CompetitionRegistration competitionRegistration, HttpServletRequest request) { + if (competitionRegistration.getAccountId()==null){ + String accountId = TokenUtils.getIdByJwtToken(request); + competitionRegistration.setAccountId(Integer.valueOf(accountId)); + } + return competitionRegistrationService.apply(competitionRegistration); + } + + + @ApiOperation(value = "报名人员分页条件查询", response = RegistrationVO.class) + @PostMapping("/queryRegistrationByCondition") + public R registrationPageList( + @RequestBody PageRegistrationStaffReq req, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + return competitionRegistrationService.registrationPageConditionQuery(req); + } + + + @ApiOperation(value = "批量禁用人员参赛") + @PutMapping("/disableContests") + public R disableContests( + @ApiParam(name = "ids", value = "多个id", required = true) + @RequestParam("ids") List ids) { + if (ids != null && ids.size() != 0) { + boolean delete = competitionRegistrationService.disableContests(ids); + return delete ? R.ok() : R.error(); + } else { + return R.error(); + } + } + + @ApiOperation(value = "导出全部数据", response = RegistrationVO.class) + @GetMapping("/excelExport") + public void excelExport( + @ApiParam(name = "competitionId", value = "赛事ID", required = true) + @RequestParam("competitionId") String competitionId, HttpServletResponse response) { + try { + PageRegistrationStaffReq req = new PageRegistrationStaffReq(); + req.setCompetitionId(competitionId); + req.setPageNum(1); + req.setPageSize(1000); + competitionRegistrationService.export(response, req); + } catch (IOException e) { + e.printStackTrace(); + } + } + + @ApiOperation(value = "批量导出数据") + @PostMapping(value = "/exportDataInBatches", produces = "application/json;multipart/form-data;charset=utf-8") + public void exportSubscribedRecords( + @RequestBody List listOfExportSub, + HttpServletResponse response, HttpServletRequest request) throws Exception { + competitionRegistrationService.exportDataInBatches(listOfExportSub, response); + } + + @ApiOperation(value = "取消报名") + @PostMapping(value = "/cancelRegistration") + public R cancelRegistration( + @ApiParam(name = "competitionId", value = "赛事ID", required = true) + @RequestParam("competitionId") String competitionId, HttpServletRequest request) throws Exception { + String accountId = TokenUtils.getIdByJwtToken(request); + return competitionRegistrationService.cancelRegistration(competitionId, Integer.valueOf(accountId)); + } + +} + diff --git a/competition/src/main/java/com/huoran/competition/controller/CompetitionReleaseTimeController.java b/competition/src/main/java/com/huoran/competition/controller/CompetitionReleaseTimeController.java new file mode 100644 index 0000000..5f6b98f --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/controller/CompetitionReleaseTimeController.java @@ -0,0 +1,216 @@ +package com.huoran.competition.controller; + + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.huoran.common.constant.DelConstant; +import com.huoran.common.response.R; +import com.huoran.competition.entity.CompetitionRanking; +import com.huoran.competition.entity.CompetitionReleaseTime; +import com.huoran.competition.entity.resp.ListOfStageResultsResp; +import com.huoran.competition.service.CompetitionRankingService; +import com.huoran.competition.service.CompetitionReleaseTimeService; +import com.huoran.competition.service.CompetitionStageService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.web.bind.annotation.*; + +import javax.script.ScriptException; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +/** + *

+ * 赛事排名定时发布表 前端控制器 + *

+ * + * @author cheney + * @since 2023-05-30 + */ +@Api(tags = "赛事排名定时管理") +@RestController +@RequestMapping("/competitionReleaseTime") +public class CompetitionReleaseTimeController { + + @Autowired + private CompetitionReleaseTimeService competitionReleaseTimeService; + + @Autowired + private CompetitionRankingService rankingService; + + @Autowired + private CompetitionStageService stagService; + + @ApiOperation(value = "添加赛事阶段排名定时") + @PostMapping("/addCompetitionStageRankingTime") + public R addCompetitionStageRankingTime( + @ApiParam(name = "competitionReleaseTime", value = "事阶段排名定时", required = true) + @RequestBody CompetitionReleaseTime competitionReleaseTime) { + + QueryWrapper queryWrapper = new QueryWrapper<>(); + + if (competitionReleaseTime.getIsOverallRanking() == 0) { + queryWrapper.eq("stage_id", competitionReleaseTime.getStageId()); + } + + queryWrapper.eq("competition_id", competitionReleaseTime.getCompetitionId()); + /* queryWrapper.eq("publication_type", competitionReleaseTime.getPublicationType());*/ + queryWrapper.eq("is_overall_ranking", competitionReleaseTime.getIsOverallRanking()); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + CompetitionReleaseTime releaseTime = competitionReleaseTimeService.getOne(queryWrapper); + + if (releaseTime != null) { + //如果定时存在则覆盖更新时间 + releaseTime.setReleaseTime(competitionReleaseTime.getReleaseTime()); + releaseTime.setPublicationType(competitionReleaseTime.getPublicationType()); + if (competitionReleaseTime.getIsOverallRanking() == 1) { + releaseTime.setStageId(competitionReleaseTime.getStageId()); + } + competitionReleaseTimeService.updateById(releaseTime); + return R.ok(); + } + + boolean save = competitionReleaseTimeService.save(competitionReleaseTime); + return save ? R.ok() : R.error(); + } + + @ApiOperation(value = "获取赛事阶段排名定时") + @PostMapping("/getCompetitionStageRankingTime") + public R getCompetitionStageRankingTime( + @ApiParam(name = "competitionReleaseTime", value = "事阶段排名定时", required = true) + @RequestBody CompetitionReleaseTime competitionReleaseTime) { + CompetitionReleaseTime one = competitionReleaseTimeService.getOne( + new QueryWrapper(). + eq("competition_id", competitionReleaseTime.getCompetitionId()). + eq("stage_id", competitionReleaseTime.getStageId()). + eq("publication_type", competitionReleaseTime.getPublicationType()). + eq("is_del", DelConstant.NOT_DEL). + eq("is_overall_ranking", competitionReleaseTime.getIsOverallRanking())); + return R.ok().put("releaseTime", one); + } + + @ApiOperation(value = "取消赛事阶段排名定时") + @PostMapping("/cancelCompetitionStageRankingTime") + public R cancelCompetitionStageRankingTime( + @ApiParam(name = "releaseId", value = "定时id", required = true) + @RequestParam Integer releaseId, + @ApiParam(name = "competitionId", value = "赛事ID", required = true) + @RequestParam Integer competitionId, + @ApiParam(name = "stageId", value = "阶段Id", required = true) + @RequestParam Integer stageId, + @ApiParam(name = "isOverallRanking", value = "是否为总分排名(1为是 默认0不是)", required = true) + @RequestParam Integer isOverallRanking) { + boolean remove = competitionReleaseTimeService.removeById(releaseId); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("competition_id", competitionId); + if (isOverallRanking == 0) { + queryWrapper.eq("stage_id", stageId); + } + queryWrapper.eq("is_overall_ranking", isOverallRanking); + List list = rankingService.list(queryWrapper); + if (list != null && list.size() > 0) { + rankingService.remove(queryWrapper); + } + + return remove ? R.ok() : R.error(); + } + + /* @ApiOperation(value = "定时执行发布排名任务(每分钟自动执行)") +// @Scheduled(cron = "0 * * * * ?") + @Scheduled(fixedRate = 30000) + public void publishRankingTasks() throws ScriptException { + List list = competitionReleaseTimeService. + list(new QueryWrapper().eq("is_del", 0)); + if (list != null && list.size() > 0) { + //获取当前时间 + Date date = new Date(); + System.out.println("当前时间为:" + date); + for (CompetitionReleaseTime competitionReleaseTime : list) { + boolean after = date.after(competitionReleaseTime.getReleaseTime()); + //查询排名数据,发布排名 + if (after) { + *//*以下处理定时发布总分排名 BEGIN*//* + if (competitionReleaseTime.getIsOverallRanking() == 1) { + //1.查询当前有待发布的总分排名的数据 判断有没有已经发布过的 有的话删除上一次已经发布的再将本次的发布 + QueryWrapper queryWrapper1 = new QueryWrapper<>(); + queryWrapper1.eq("competition_id", competitionReleaseTime.getCompetitionId()); + queryWrapper1.eq("is_release", DelConstant.POST_STATUS);//已发布 + //如果为总分排名时,默认删除上一次发布的总分排名 + queryWrapper1.eq("is_overall_ranking", 1); + rankingService.remove(queryWrapper1); + + + //重新发布排名 + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.set("is_release", DelConstant.POST_STATUS); + updateWrapper.eq("competition_id", competitionReleaseTime.getCompetitionId()); + updateWrapper.eq("is_overall_ranking", 1);// + updateWrapper.eq("stage_id",competitionReleaseTime.getStageId()); + //发布类型(0默认发布 1批量手动导入) + updateWrapper.eq("publication_type",competitionReleaseTime.getPublicationType()); + rankingService.update(new CompetitionRanking(),updateWrapper); + + + //删除定时的 + competitionReleaseTimeService.removeById(competitionReleaseTime.getId()); + *//*以下处理定时发布总分排名 END*//* + + + + } else if (competitionReleaseTime.getPublicationType() == 0 && competitionReleaseTime.getIsOverallRanking() == 0) { + R r = stagService.stageRaceRanking( + competitionReleaseTime.getCompetitionId(), + competitionReleaseTime.getStageId(), + 1, 100, + competitionReleaseTime.getPublicationType()); + List respList = (List) r.get("page"); + if (respList != null && respList.size() > 0) { + List rankingList = new ArrayList<>(); + for (ListOfStageResultsResp resultsResp : respList) { + CompetitionRanking competitionRanking = new CompetitionRanking(); + BeanUtils.copyProperties(resultsResp, competitionRanking); + BeanUtils.copyProperties(competitionReleaseTime, competitionRanking); + rankingList.add(competitionRanking); + } + R ranking = rankingService.publishRanking(rankingList); + //发布成功,删除定时 + if (ranking != null && ranking.get("message").equals("success")) { + competitionReleaseTime.setIsDel(1); + competitionReleaseTimeService.updateById(competitionReleaseTime); + } + } + //查询手动导入数据 + } else if (competitionReleaseTime.getPublicationType() == 1 && competitionReleaseTime.getIsOverallRanking() == 0) { + + } + } + } + } + }*/ + + + /*@ApiOperation(value = "定时执行发布排名任务(每1秒执行一次)") + @Scheduled(fixedRate = 1000) + public void publishRankingTasks() throws ScriptException { + List list = competitionReleaseTimeService. + list(new QueryWrapper().eq("is_del", 0).last(" and TIMESTAMPDIFF( SECOND, now( ), ( release_time ) ) <= 0")); + if (list != null && list.size() > 0) { + //获取当前时间 + Date date = new Date(); + System.out.println("当前时间为:" + date); + for (CompetitionReleaseTime competitionReleaseTime : list) { + boolean after = date.after(competitionReleaseTime.getReleaseTime()); + //删除此条时间 + competitionReleaseTimeService.removeById(competitionReleaseTime.getId()); + + } + } + }*/ + +} + diff --git a/competition/src/main/java/com/huoran/competition/controller/CompetitionRuleController.java b/competition/src/main/java/com/huoran/competition/controller/CompetitionRuleController.java new file mode 100644 index 0000000..8807b14 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/controller/CompetitionRuleController.java @@ -0,0 +1,55 @@ +package com.huoran.competition.controller; + + +import com.huoran.common.aop.annotation.NoRepeatSubmit; +import com.huoran.common.response.R; +import com.huoran.competition.entity.CompetitionRule; +import com.huoran.competition.service.CompetitionRuleService; +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.*; + +/** + *

+ * 赛事规则表 前端控制器 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +@Api(tags = "赛事规则管理") +@RestController +@RequestMapping("/competition/rule") +public class CompetitionRuleController { + + @Autowired + private CompetitionRuleService competitionRuleService; + @NoRepeatSubmit + @ApiOperation(value = "添加赛事规则") + @PostMapping("/addCompetitionRule") + public R addCompetitionRule( + @ApiParam(name = "competitionRule", value = "赛事规则对象", required = true) + @RequestBody CompetitionRule competitionRule) { + return competitionRuleService.addCompetitionRule(competitionRule); + } + + @ApiOperation(value = "根据赛事id查询赛事规则") + @GetMapping("/getCompetitionRule") + public R getCompetitionRule( + @ApiParam(name = "competitionId" , value = "賽事id") + @RequestParam("competitionId") String competitionId) { + return competitionRuleService.getCompetitionRule(competitionId); + } + @NoRepeatSubmit + @ApiOperation(value = "编辑赛事规则") + @PostMapping("/editCompetitionRule") + public R editCompetitionRule( + @ApiParam(name = "competitionRule", value = "赛事规则对象", required = true) + @RequestBody CompetitionRule competitionRule) { + return competitionRuleService.editCompetitionRule(competitionRule); + } + +} + diff --git a/competition/src/main/java/com/huoran/competition/controller/CompetitionStageController.java b/competition/src/main/java/com/huoran/competition/controller/CompetitionStageController.java new file mode 100644 index 0000000..2ca0d7b --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/controller/CompetitionStageController.java @@ -0,0 +1,44 @@ +package com.huoran.competition.controller; + + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.competition.entity.CompetitionStage; +import com.huoran.competition.entity.CompetitionTeam; +import com.huoran.competition.entity.CompleteCompetitionSetup; +import com.huoran.competition.service.CompetitionStageService; +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 javax.servlet.http.HttpServletRequest; +import java.text.ParseException; + +/** + *

+ * 赛事阶段设置表 前端控制器 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +@Api(tags = "赛事阶段设置管理") +@RestController +@RequestMapping("/competition/stage") +public class CompetitionStageController { + + @Autowired + CompetitionStageService competitionStageService; + + @PostMapping("/queryCompetitionStageBySetupId") + @ApiOperation(value = "查询完整赛事阶段数据") + public R queryCompetitionStageBySetupId(@RequestParam Integer setupId) { + return competitionStageService.queryCompetitionStageBySetupId(setupId); + } + + +} + diff --git a/competition/src/main/java/com/huoran/competition/controller/CompetitionStageFileController.java b/competition/src/main/java/com/huoran/competition/controller/CompetitionStageFileController.java new file mode 100644 index 0000000..23c4901 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/controller/CompetitionStageFileController.java @@ -0,0 +1,138 @@ +package com.huoran.competition.controller; + +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.api.UserClient; +import com.huoran.common.utils.TokenUtils; +import com.huoran.competition.entity.CompetitionStage; +import com.huoran.competition.entity.req.ContestStageFileReq; +import com.huoran.competition.service.CompetitionStageFileService; +import com.huoran.competition.service.CompetitionStageService; +import com.huoran.competition.utils.ZipUtil; +import io.swagger.annotations.*; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.common.response.R; +import org.springframework.beans.factory.annotation.Autowired; +import org.apache.commons.lang.StringUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.Api; +import org.springframework.web.bind.annotation.RequestParam; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import com.huoran.competition.service.CompetitionStageFileService; +import com.huoran.competition.entity.CompetitionStageFile; + +import java.io.File; +import java.io.IOException; +import java.util.List; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * @描述:赛事阶段文件控制类 + * @作者: Rong + * @日期: 2023-11-13 + */ +@RestController +@RequestMapping("/cCompetitionStageFile") +@Api(value = "赛事阶段文件:CCompetitionStageFileController", tags = "赛事线下阶段文件") +public class CompetitionStageFileController { + + @Autowired + public CompetitionStageFileService service; + + @Autowired + CompetitionStageService competitionStageService; + + @Autowired + private UserClient userClient; + + @PostMapping("/listByEntity") + @ApiOperation(value = "分页查询", response = CompetitionStageFile.class) + public R listByEntity(@RequestBody ContestStageFileReq req) { + return service.stageFile(req); + } + + + @PostMapping("/findById") + @ApiOperation(value = "查询详情", response = CompetitionStageFile.class) + public R findById(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { + CompetitionStageFile cCompetitionStageFile = service.getById(id); + return R.ok().put("data", cCompetitionStageFile); + } + + @PostMapping("/save") + @ApiOperation(value = "新增", response = CompetitionStageFile.class) + public R save(@RequestBody @ApiParam(name = "赛事阶段文件对象", value = "传入json格式", required = true) CompetitionStageFile file, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + file.setAccountId(Integer.valueOf(accountId)); + file.setSchoolId(schoolId); + + CompetitionStageFile stageFile = service.checkWhetherTheFileHasBeenUploaded(file); + if (!ObjectUtil.isEmpty(stageFile)) { + return R.error("当前已上传文件或正在上传文件,请先删除已有文件!"); + } + + boolean addState = service.save(file); + return addState ? R.ok(file.getId()) : R.error("新增失败"); + } + + + @PostMapping("/update") + @ApiOperation(value = "修改", response = CompetitionStageFile.class) + public R update(@RequestBody @ApiParam(name = "赛事阶段文件对象", value = "传入json格式", required = true) CompetitionStageFile file, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + file.setAccountId(Integer.valueOf(accountId)); + file.setSchoolId(schoolId); + boolean updateState = service.updateById(file); + return updateState ? R.ok() : R.error("编辑失败"); + } + + + @PostMapping("/batchDeletion") + @ApiOperation(value = "批量删除", response = CompetitionStageFile.class) + public R batchDeletion(@ApiParam(name = "ids", value = "主键", required = true) @RequestBody List ids) { + boolean delState = service.removeByIds(ids); + return delState ? R.ok() : R.error("删除失败"); + } + + @PostMapping("/deriveAll") + @ApiOperation(value = "导出", response = CompetitionStageFile.class) + public void deriveAll(@RequestBody ContestStageFileReq req, HttpServletRequest request, HttpServletResponse response) { + try { + + CompetitionStage stage = competitionStageService.getById(req.getStageId()); + List files = service.stageAllFiles(req); + + ZipUtil zipUtil = new ZipUtil(); + + for (CompetitionStageFile url : files) { + zipUtil.downloadFile(url.getFilePath()); + } + //把下载的图片文件夹压缩 + zipUtil.downloadZip(request, response, stage.getStageName() + "下载压缩文件.zip"); + + + for (CompetitionStageFile url : files) { + String userName = service.getStudentName(url.getAccountId()); + String downloadUrl = url.getFilePath(); +// String filePath = ZipUtil.downloadDir + "/" + downloadUrl.substring(downloadUrl.lastIndexOf("/")); + String filePath = ZipUtil.downloadDir + "/" + userName + "-" + url.getFileName(); + File file = new File(filePath); + ZipUtil.deleteDirectory(file); + } + + + } catch (IOException e) { + e.printStackTrace(); + } + + } +} + diff --git a/competition/src/main/java/com/huoran/competition/controller/CompetitionTeamController.java b/competition/src/main/java/com/huoran/competition/controller/CompetitionTeamController.java new file mode 100644 index 0000000..7769639 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/controller/CompetitionTeamController.java @@ -0,0 +1,377 @@ +package com.huoran.competition.controller; + + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.huoran.common.aop.annotation.NoRepeatSubmit; +import com.huoran.common.aop.aspect.RedisServiceAop; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.competition.entity.*; +import com.huoran.competition.entity.req.TransferTeamReq; +import com.huoran.competition.service.*; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; + +import javax.script.ScriptException; +import javax.servlet.http.HttpServletRequest; +import javax.validation.Valid; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +/** + *

+ * 赛事团队表 前端控制器 + *

+ * + * @author cheney + * @since 2022-12-02 + */ +@Api(tags = "赛事团队管理") +@RestController +@RequestMapping("/competition/team") +public class CompetitionTeamController { + + @Autowired + private CompetitionTeamService competitionTeamService; + + @Autowired + private CompetitionService competitionService; + + @Autowired + private TeamParticipantService teamParticipantService; + + @Autowired + private CompleteCompetitionSetupService completeCompetitionSetupService; + + @Autowired + private CompetitionRegistrationService competitionRegistrationService; + + @Autowired + private RedisServiceAop redisService; + + @GetMapping("/searchTeam") + @ApiOperation(value = "搜索团队") + public R searchTeam(@RequestParam String teamName,Integer competitionId) throws ParseException { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("competition_id",competitionId); + wrapper.eq("captain",0); + if (StringUtils.isNotBlank(teamName)){ + wrapper.like("team_name",teamName); + } + wrapper.last("ORDER BY CONVERT( team_name USING gbk ) COLLATE gbk_chinese_ci ASC"); + List list = competitionTeamService.list(wrapper); + return R.ok().put("teamList",list); + } + @NoRepeatSubmit + @PostMapping("/editCompetitionTeam") + @ApiOperation(value = "编辑赛事团队") + @Transactional + public R editCompetitionTeam(@RequestBody CompetitionTeam competitionTeam, HttpServletRequest request) { + String accountId = ""; + if (competitionTeam.getIdentification() !=null && competitionTeam.getIdentification()==1){ + accountId = competitionTeam.getAccountId().toString(); + }else { + accountId = TokenUtils.getIdByJwtToken(request); + } + + competitionTeam.setAccountId(Integer.valueOf(accountId)); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("team_name",competitionTeam.getTeamName()); + queryWrapper.eq("competition_id",competitionTeam.getCompetitionId()); + queryWrapper.eq("team_id",competitionTeam.getTeamId()); + //查询团队成员 + QueryWrapper teamQueryWrapper = new QueryWrapper<>(); + teamQueryWrapper.eq("competition_id",competitionTeam.getCompetitionId()); + teamQueryWrapper.eq("pid",competitionTeam.getTeamId()); + List list = competitionTeamService.list(teamQueryWrapper); + + if (competitionTeam.getTeamId() != null) { + queryWrapper.last(" and team_id != " + competitionTeam.getTeamId()); + } + int count = competitionTeamService.count(queryWrapper); + if (count>list.size()){ + return R.error("团队已存在!"); + } + boolean update = competitionTeamService.updateById(competitionTeam); + + return update ? R.ok() : R.error(); + } + @NoRepeatSubmit + @PostMapping("/addCompetitionTeam") + @ApiOperation(value = "新增赛事团队并报名") + @Transactional + public R addCompetitionTeam(@RequestBody CompetitionTeam competitionTeam, HttpServletRequest request) throws ParseException { + String accountId = ""; + if (competitionTeam.getIdentification() !=null && competitionTeam.getIdentification()==1){ + accountId = competitionTeam.getAccountId().toString(); + }else { + accountId = TokenUtils.getIdByJwtToken(request); + boolean signingUp = this.signingUp(competitionTeam.getCompetitionId()); + if (!signingUp){ + return R.error("未在报名时间内!"); + } + } + + competitionTeam.setAccountId(Integer.valueOf(accountId)); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("team_name",competitionTeam.getTeamName()); + queryWrapper.eq("competition_id",competitionTeam.getCompetitionId()); + queryWrapper.eq("captain",0); + int count = competitionTeamService.count(queryWrapper); + if (count>0){ + return R.error("团队已存在!"); + } + + QueryWrapper teamQueryWrapper = new QueryWrapper<>(); + teamQueryWrapper.eq("account_id",accountId); + teamQueryWrapper.eq("competition_id",competitionTeam.getCompetitionId()); + CompetitionTeam one = competitionTeamService.getOne(teamQueryWrapper); + if (one!=null){ + if (one.getCaptain()==0){ + return R.error("您已创建团队无法再次创建!"); + } + return R.error("您已报名加入团队,无法另外创建团队,请退出团队后再创建自己的团队!"); + } + + boolean save = competitionTeamService.save(competitionTeam); + + if (competitionTeam.getWhetherSignUp()==1){ + //验证报名邀请码 +/* boolean verifyRegistrationCode = this.verifyRegistrationCode(competitionTeam.getCompetitionId(), competitionTeam.getRegistrationInvitationCode()); + if (!verifyRegistrationCode && competitionTeam.getIdentification() !=null && competitionTeam.getIdentification()!=1){ + throw new CustomException(ExceptionEnum.CODE); + }*/ + //创建并加入 + CompetitionRegistration competitionRegistration = new CompetitionRegistration(); + if (competitionTeam.getIdentification() !=null && competitionTeam.getIdentification()==1){ + competitionRegistration.setIdentification(1); + } + competitionRegistration.setAccountId(Integer.valueOf(accountId)); + competitionRegistration.setCompetitionId(competitionTeam.getCompetitionId()); + competitionRegistration.setRegistrationInvitationCode(competitionTeam.getRegistrationInvitationCode()); + competitionRegistration.setTeamId(competitionTeam.getTeamId()); + competitionRegistration.setJoin(true); + return competitionRegistrationService.apply(competitionRegistration); + } + return save ? R.ok() : R.error(); + } + + public boolean signingUp(Integer competitionId) throws ParseException { + //查询赛事是否在报名时间,在时间范围内允许加入 + Competition competition = competitionService.getById(competitionId); + Date startTime = competition.getSignUpStartTime(); + Date endTime = competition.getSignUpEndTime(); + + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String day = sdf.format(Calendar.getInstance().getTime()); + Date today = sdf.parse(day); + //判断today是否在startTime之后 + boolean after = today.after(startTime); + //判断 today是否在endTime之前 + boolean before = today.before(endTime); + //当true == after 和 true == before 同时成立时就是在此日期区间内 + return after && before; + } + + public boolean verifyRegistrationCode(Integer competitionId,String registrationInvitationCode) { + //查询赛事设置,验证报名邀请码 + QueryWrapper setupQueryWrapper = new QueryWrapper<>(); + setupQueryWrapper.eq("competition_id",competitionId); + CompleteCompetitionSetup setup = completeCompetitionSetupService.getOne(setupQueryWrapper); + + //是否需要报名邀请码 + Integer code = setup.getIsNeedCode(); + if (code==1){ + //验证报名邀请码 + return setup.getInvitationCode().equals(registrationInvitationCode); + }else { + return true; + } + } + @NoRepeatSubmit + @PostMapping("/joinCompetitionTeam") + @ApiOperation(value = "加入赛事团队并报名") + @Transactional + public R joinCompetitionTeam(@RequestBody CompetitionTeam competitionTeam, HttpServletRequest request) throws ParseException { + String accountId = ""; + if (competitionTeam.getIdentification() !=null && competitionTeam.getIdentification()==1){ + accountId = competitionTeam.getAccountId().toString(); + }else { + accountId = TokenUtils.getIdByJwtToken(request); + } + CompetitionTeam team = competitionTeamService.getById(competitionTeam.getTeamId()); + CompetitionRegistration competitionRegistration = new CompetitionRegistration(); + QueryWrapper teamQueryWrapper1 = new QueryWrapper<>(); + teamQueryWrapper1.eq("competition_id",competitionTeam.getCompetitionId()); + teamQueryWrapper1.eq("account_id",accountId); + CompetitionTeam team1 = competitionTeamService.getOne(teamQueryWrapper1); + if (team1!=null){ + if (team1.getCaptain()==0){ + return R.error("您已创建团队无法再次加入!"); + } + //如果是队员,并且是后台进行修改,可以直接修改团队 + if (competitionTeam.getIdentification() !=null && competitionTeam.getIdentification()==1){ + //删除之前所在团队数据 + competitionTeamService.removeById(team1); + //加入新团队,更新报名信息 + competitionTeam.setCaptain(1); + competitionTeam.setPid(team.getTeamId()); + competitionTeam.setTeamName(team.getTeamName()); + competitionTeam.setAccountId(Integer.valueOf(accountId)); + boolean save = competitionTeamService.save(competitionTeam); + + UpdateWrapper wrapper = new UpdateWrapper<>(); + wrapper.eq("competition_id",competitionTeam.getCompetitionId()); + wrapper.eq("account_id",accountId); + wrapper.set("team_id",team.getTeamId()); + competitionRegistrationService.update(competitionRegistration,wrapper); + + //参赛人员清空 + QueryWrapper participantQueryWrapper = new QueryWrapper<>(); + participantQueryWrapper.eq("competition_id",competitionTeam.getCompetitionId()); + participantQueryWrapper.eq("account_id",accountId); + teamParticipantService.remove(participantQueryWrapper); + return R.ok(); + } + return R.error("您已报名加入团队,无法加入其他团队,请退出团队后再加入!"); + } + + //查询赛事设置 + QueryWrapper setupQueryWrapper = new QueryWrapper<>(); + setupQueryWrapper.eq("competition_id",competitionTeam.getCompetitionId()); + CompleteCompetitionSetup setup = completeCompetitionSetupService.getOne(setupQueryWrapper); + if (competitionTeam.getIdentification() ==null || competitionTeam.getIdentification() != 1) { + //查询赛事是否在报名时间,在时间范围内允许加入 + boolean signingUp = this.signingUp(competitionTeam.getCompetitionId()); + if (!signingUp){ + return R.error("未在报名时间内!"); + } + + if (setup.getIsNeedCode()==1){ + //验证报名邀请码 + boolean verifyRegistrationCode = this.verifyRegistrationCode(competitionTeam.getCompetitionId(), competitionTeam.getRegistrationInvitationCode()); + if (!verifyRegistrationCode){ + return R.error("报名邀请码错误!"); + } + } + + //团队存在,验证邀请码 + if (!team.getInvitationCode().equals(competitionTeam.getInvitationCode())){ + return R.error("团队邀请码错误!"); + } + }else { + competitionRegistration.setIdentification(1); + } + //查询是否团队有人数限制 + if (setup.getMaxTeamSize()!=null){ + //查询当前团队人数 + QueryWrapper teamQueryWrapper = new QueryWrapper<>(); + teamQueryWrapper.eq("pid",competitionTeam.getTeamId()); + int count = competitionTeamService.count(teamQueryWrapper); + int total = count+1; + if (total>=setup.getMaxTeamSize()){ + return R.error("加入失败,团队人数限制"+setup.getMaxTeamSize()+"人!"); + } + } + + //加入团队,录入报名信息 + competitionTeam.setCaptain(1); + competitionTeam.setPid(team.getTeamId()); + competitionTeam.setTeamName(team.getTeamName()); + competitionTeam.setAccountId(Integer.valueOf(accountId)); + boolean save = competitionTeamService.save(competitionTeam); + + competitionRegistration.setAccountId(Integer.valueOf(accountId)); + competitionRegistration.setCompetitionId(competitionTeam.getCompetitionId()); + competitionRegistration.setRegistrationInvitationCode(competitionTeam.getRegistrationInvitationCode()); + competitionRegistration.setTeamId(team.getTeamId()); + competitionRegistration.setJoin(false); + return competitionRegistrationService.apply(competitionRegistration); + } + @NoRepeatSubmit + @PostMapping("/captainOfTransfer") + @ApiOperation(value = "转让队长") + public R captainOfTransfer(@RequestBody @Valid TransferTeamReq transferTeamReq) { + return competitionTeamService.captainOfTransfer(transferTeamReq); + } + @NoRepeatSubmit + @PostMapping("/removeTheLine") + @ApiOperation(value = "移除队伍") + public R removeTheLine( + @ApiParam(name = "teamId", value = "团队ID", required = true) + @RequestParam(value = "teamId") Integer teamId, + @ApiParam(name = "competitionId", value = "赛事id", required = true) + @RequestParam(value = "competitionId") Integer competitionId, + @ApiParam(name = "accountId", value = "账号ID", required = true) + @RequestParam(value = "accountId") Integer accountId) { + Competition byId = competitionService.getById(competitionId); + //添加移除标识 + String key = accountId+"removeTheLine"; + redisService.setCacheObject(key,byId.getName()); + //报名删除 + QueryWrapper registrationQueryWrapper = new QueryWrapper<>(); + registrationQueryWrapper.eq("competition_id",competitionId); + registrationQueryWrapper.eq("account_id",accountId); + registrationQueryWrapper.eq("team_id",teamId); + competitionRegistrationService.remove(registrationQueryWrapper); + + //参赛人员清空 + QueryWrapper participantQueryWrapper = new QueryWrapper<>(); + participantQueryWrapper.eq("competition_id",competitionId); + participantQueryWrapper.eq("account_id",accountId); + participantQueryWrapper.eq("team_id",teamId); + teamParticipantService.remove(participantQueryWrapper); + + QueryWrapper teamQueryWrapper = new QueryWrapper<>(); + teamQueryWrapper.eq("competition_id",competitionId); + teamQueryWrapper.eq("account_id",accountId); + teamQueryWrapper.eq("pid",teamId); + boolean remove = competitionTeamService.remove(teamQueryWrapper); + return remove ? R.ok() : R.error(); + } + + @PostMapping("/promptRemoval") + @ApiOperation(value = "是否提示移除") + public R promptRemoval(HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + String name = redisService.getCacheObject(accountId+"removeTheLine"); + if (name!=null){ + //清除缓存 + redisService.deleteObject(accountId); + return R.ok().put("prompt","你报名的"+name+"大赛,已被队长踢出队伍,请重新报名加入别的团队!"); + } + return R.ok(); + } + + @PostMapping("/entryInformation") + @ApiOperation(value = "用户参赛信息") + public R entryInformation( + @ApiParam(name = "competitionId", value = "赛事ID", required = true) + @RequestParam Integer competitionId, + @ApiParam(name = "accountId", value = "账号id", required = false) + @RequestParam(required = false) String accountId, + HttpServletRequest request) throws ScriptException { + String account; + int background; + if (accountId!=null){ + account = accountId; + //后台标识,查询参赛信息只返回队长信息 + background = 1; + }else { + account = TokenUtils.getIdByJwtToken(request); + background = 0; + } + return competitionTeamService.entryInformation(competitionId,account,background); + } + +} + diff --git a/competition/src/main/java/com/huoran/competition/controller/CompleteCompetitionSetupController.java b/competition/src/main/java/com/huoran/competition/controller/CompleteCompetitionSetupController.java new file mode 100644 index 0000000..90aee98 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/controller/CompleteCompetitionSetupController.java @@ -0,0 +1,23 @@ +package com.huoran.competition.controller; + + +import io.swagger.annotations.Api; +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 完整赛事设置 前端控制器 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +@Api(tags = "完整赛事管理") +@RestController +@RequestMapping("/complete/competitionSetup") +public class CompleteCompetitionSetupController { + +} + diff --git a/competition/src/main/java/com/huoran/competition/controller/TeamInstructorController.java b/competition/src/main/java/com/huoran/competition/controller/TeamInstructorController.java new file mode 100644 index 0000000..87fc3e3 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/controller/TeamInstructorController.java @@ -0,0 +1,74 @@ +package com.huoran.competition.controller; + + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.common.aop.annotation.NoRepeatSubmit; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.competition.entity.TeamInstructor; +import com.huoran.competition.service.TeamInstructorService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import javax.validation.Valid; + +/** + *

+ * 赛事指导老师表 前端控制器 + *

+ * + * @author cheney + * @since 2022-12-02 + */ +@Api(tags = "赛事指导老师管理") +@RestController +@RequestMapping("/competition/teamInstructor") +public class TeamInstructorController { + + @Autowired + private TeamInstructorService teamInstructorService; + @NoRepeatSubmit + @PostMapping("/addAnAdvisor") + @ApiOperation(value = "添加/编辑指导老师") + public R addAnAdvisor(@RequestBody @Valid TeamInstructor teamInstructor,HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + teamInstructor.setAccountId(Integer.valueOf(accountId)); + if (teamInstructor.getTeamId()!=null){ + queryWrapper.eq("competition_id",teamInstructor.getCompetitionId()); + queryWrapper.eq("team_id",teamInstructor.getTeamId()); + }else { + queryWrapper.eq("competition_id",teamInstructor.getCompetitionId()); + queryWrapper.eq("account_id",accountId); + } + int count = teamInstructorService.count(queryWrapper); + if (count >= 5){ + return R.error("添加失败,超出限制!"); + } + queryWrapper.eq("name",teamInstructor.getName()); + + if (teamInstructor.getId() != null) { + queryWrapper.last(" and id != " + teamInstructor.getId()); + } + int count1 = teamInstructorService.count(queryWrapper); + if (count1 > 0 ){ + return R.error("名字已存在!"); + } + boolean save = teamInstructorService.saveOrUpdate(teamInstructor); + return save ? R.ok().put("id",teamInstructor.getId()) : R.error(); + } + @NoRepeatSubmit + @PostMapping("/deleteAnAdvisor") + @ApiOperation(value = "删除指导老师") + public R deleteAnAdvisor(@RequestParam Integer id) { + boolean remove = teamInstructorService.removeById(id); + return remove ? R.ok() : R.error(); + } + + +} + diff --git a/competition/src/main/java/com/huoran/competition/controller/TeamParticipantController.java b/competition/src/main/java/com/huoran/competition/controller/TeamParticipantController.java new file mode 100644 index 0000000..f7170d8 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/controller/TeamParticipantController.java @@ -0,0 +1,90 @@ +package com.huoran.competition.controller; + + +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.common.aop.annotation.NoRepeatSubmit; +import com.huoran.common.response.R; +import com.huoran.competition.entity.TeamParticipant; +import com.huoran.competition.service.TeamParticipantService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +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.RestController; + +import javax.validation.Valid; +import java.text.ParseException; +import java.util.List; + +/** + *

+ * 团队阶段参赛人员表 前端控制器 + *

+ * + * @author cheney + * @since 2022-12-05 + */ +@Api(tags = "团队阶段指定参赛人员表") +@RestController +@RequestMapping("/competition/teamParticipant") +public class TeamParticipantController { + + @Autowired + private TeamParticipantService teamParticipantService; + @NoRepeatSubmit + @PostMapping("/stageSelectParticipants") + @ApiOperation(value = "选择阶段参赛人员") + public R stageSelectParticipants( + @RequestBody @Valid TeamParticipant teamInstructor) throws ParseException { + //后台不传值,学生修改判断修改时间 + if (teamInstructor.getPlatformId()!=null && teamInstructor.getPlatformId()==1){ +// 查询阶段比赛时间 + boolean ok = teamParticipantService.inTheGame(teamInstructor.getStageId()); +// 阶段在比赛中不允许修改参数人员 + if (ok){ + return R.error("比赛开始无法修改参数人员!"); + } + } +// 清空之前数据 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("stage_id",teamInstructor.getStageId()); + queryWrapper.eq("competition_id",teamInstructor.getCompetitionId()); + queryWrapper.eq("team_id",teamInstructor.getTeamId()); + teamParticipantService.remove(queryWrapper); +// 添加参数人员数据 + int insert = 0; + List accountIds = teamInstructor.getAccountIds(); + if (ObjectUtil.isNotNull(accountIds)){ + for (Integer accountId : accountIds) { + TeamParticipant teamParticipant = new TeamParticipant(); + teamParticipant.setTeamId(teamInstructor.getTeamId()); + teamParticipant.setStageId(teamInstructor.getStageId()); + teamParticipant.setCompetitionId(teamInstructor.getCompetitionId()); + teamParticipant.setAccountId(accountId); + teamParticipantService.save(teamParticipant); + insert++; + } + } + return R.ok(); + } + + @NoRepeatSubmit + @PostMapping("/cancelParticipant") + @ApiOperation(value = "取消参赛人员") + public R cancelParticipant(@RequestBody @Valid TeamParticipant teamInstructor) { + //参赛人员清空 + QueryWrapper participantQueryWrapper = new QueryWrapper<>(); + participantQueryWrapper.eq("competition_id",teamInstructor.getCompetitionId()); + participantQueryWrapper.eq("account_id",teamInstructor.getAccountId()); + participantQueryWrapper.eq("team_id",teamInstructor.getTeamId()); + participantQueryWrapper.eq("stage_id",teamInstructor.getStageId()); + teamParticipantService.remove(participantQueryWrapper); + return R.ok(); + } + + +} + diff --git a/competition/src/main/java/com/huoran/competition/entity/Competition.java b/competition/src/main/java/com/huoran/competition/entity/Competition.java new file mode 100644 index 0000000..ec29418 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/Competition.java @@ -0,0 +1,139 @@ +package com.huoran.competition.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; +import java.io.Serializable; +import java.util.List; + +import com.huoran.competition.entity.resp.CompetitionRangeResp; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 赛事信息表 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("c_competition") +@ApiModel(value="Competition对象", description="赛事信息表") +public class Competition implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "创建人Id", example = "1") + private Integer founderId; + + @ApiModelProperty(value = "创建人名称", example = "张三李四王五") + private String founderName; + + @ApiModelProperty(value = "竞赛名称", example = "数据库数据库色即是空") + private String name; + + @ApiModelProperty(value = "竞赛封面图", example = "http://localhost:9400/occupationlab/doc.html") + private String coverUrl; + + @ApiModelProperty(value = "竞赛轮播图", example = "http://localhost:9400/occupationlab/doc.html") + private String carouselUrl; + + @ApiModelProperty(value = "主办方", example = "或然科技") + private String sponsor; + + @ApiModelProperty(value = "承办方", example = "或然科技") + private String undertaker; + + @ApiModelProperty(value = "竞赛描述", example = "或然科技赛事") + private String description; + + @ApiModelProperty(value = "发布状态(0未发布,1已发布)", example = "0") + private Integer publishStatus; + + @ApiModelProperty(value = "竞赛开始时间", example = "2021-09-09 16:24:24") + private Date playStartTime; + + @ApiModelProperty(value = "竞赛结束时间", example = "2021-09-20 16:24:24") + private Date playEndTime; + + @ApiModelProperty(value = "报名开始时间", example = "2021-09-10 16:24:24") + private Date signUpStartTime; + + @ApiModelProperty(value = "报名结束时间", example = "2021-09-20 16:24:24") + private Date signUpEndTime; + + @ApiModelProperty(value = "学校id", example = "0") + private Integer schoolId; + + @ApiModelProperty(value = "平台来源(0:中台,1:职站)", example = "0") + private Integer platformSource; + + @ApiModelProperty(value = "大赛范围(0:本校内 1:全平台 2:指定区域、院校)", example = "0") + private Integer competitionScope; + + @ApiModelProperty(value = "中台是否开启(0开启 1未开启 默认0)", example = "0") + private Integer ztOpen; + + @ApiModelProperty(value = "是否开启(0开启 1未开启 默认0)", example = "0") + private Integer isOpen; + + @ApiModelProperty(value = "发布类型(0发布信息,1完整比赛)默认为0") + private Integer releaseType; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "赛事附件") + @TableField(exist = false) + private List competitionAnnexList; + + @ApiModelProperty(value = "大赛范围选择") + @TableField(exist = false) + private List competitionRangeList; + + @ApiModelProperty(value = "比赛内容") + @TableField(exist = false) + private List contentList; + + @ApiModelProperty(value = "比赛范围") + @TableField(exist = false) + private String range; + + @ApiModelProperty(value = "赛制") + @TableField(exist = false) + private Integer rule; + + @ApiModelProperty(value = "比赛范围(省市学校集合)") + @TableField(exist = false) + private List competitionRangeRespList; + + @ApiModelProperty(value = "比赛报名信息") + @TableField(exist = false) + private CompetitionRegistration competitionRegistration; + + @ApiModelProperty(value = "完整赛事设置信息") + @TableField(exist = false) + private CompleteCompetitionSetup completeCompetitionSetup; + + @ApiModelProperty(value = "赛事阶段内容信息") + @TableField(exist = false) + private List competitionStage; + + +} diff --git a/competition/src/main/java/com/huoran/competition/entity/CompetitionAnnex.java b/competition/src/main/java/com/huoran/competition/entity/CompetitionAnnex.java new file mode 100644 index 0000000..8e54c1f --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/CompetitionAnnex.java @@ -0,0 +1,56 @@ +package com.huoran.competition.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 赛事附件表 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("c_competition_annex") +@ApiModel(value="CompetitionAnnex对象", description="赛事附件表") +public class CompetitionAnnex implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "赛事附件主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "赛事主键(c_competition表主键)") + private Integer competitionId; + + @ApiModelProperty(value = "文件名称") + private String fileName; + + @ApiModelProperty(value = "文件路径") + private String filePath; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "是否删除(默认0 1为已删除)") + @TableLogic + private Integer isDel; + + +} diff --git a/competition/src/main/java/com/huoran/competition/entity/CompetitionAnnouncement.java b/competition/src/main/java/com/huoran/competition/entity/CompetitionAnnouncement.java new file mode 100644 index 0000000..4fc6998 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/CompetitionAnnouncement.java @@ -0,0 +1,75 @@ +package com.huoran.competition.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; +import java.io.Serializable; +import java.util.List; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 赛事公告表 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("c_competition_announcement") +@ApiModel(value="CompetitionAnnouncement对象", description="赛事公告表") +public class CompetitionAnnouncement implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "赛事公告主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "赛事主键(c_competition表主键)") + private Integer competitionId; + + @ApiModelProperty(value = "公告标题") + private String announcementTitle; + + @ApiModelProperty(value = "公告正文") + private String announcementText; + + @ApiModelProperty(value = "0草稿 1为已发布") + private Integer status; + + @ApiModelProperty(value = "是否开启(0开启 1未开启 默认0)") + private Integer isOpen; + + @ApiModelProperty(value = "创建人") + private Integer accountId; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "是否删除(默认0 1为已删除)") + @TableLogic + private Integer isDel; + + @ApiModelProperty(value = "创建人(列表展示)") + @TableField(exist = false) + private String founderName; + + @ApiModelProperty(value = "大赛公告附件存储集合") + @TableField(exist = false) + private List announcementAnnexList; + + +} diff --git a/competition/src/main/java/com/huoran/competition/entity/CompetitionAnnouncementAnnex.java b/competition/src/main/java/com/huoran/competition/entity/CompetitionAnnouncementAnnex.java new file mode 100644 index 0000000..726c117 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/CompetitionAnnouncementAnnex.java @@ -0,0 +1,56 @@ +package com.huoran.competition.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 赛事公告附件表 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("c_competition_announcement_annex") +@ApiModel(value="CompetitionAnnouncementAnnex对象", description="赛事公告附件表") +public class CompetitionAnnouncementAnnex implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "赛事附件主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "赛事公告主键(c_competition_announcement表主键)") + private Integer announcementId; + + @ApiModelProperty(value = "文件名称") + private String fileName; + + @ApiModelProperty(value = "文件路径") + private String filePath; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "是否删除(默认0 1为已删除)") + @TableLogic + private Integer isDel; + + +} diff --git a/competition/src/main/java/com/huoran/competition/entity/CompetitionContent.java b/competition/src/main/java/com/huoran/competition/entity/CompetitionContent.java new file mode 100644 index 0000000..8004e65 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/CompetitionContent.java @@ -0,0 +1,101 @@ +package com.huoran.competition.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author cheney + * @since 2022-11-16 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("c_competition_content") +@ApiModel(value="CompetitionContent对象", description="") +public class CompetitionContent implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键id") + @TableId(value = "content_id", type = IdType.AUTO) + private Integer contentId; + + @ApiModelProperty(value = "阶段id(取c_competition_stage主键id)") + private Integer stageId; + + @ApiModelProperty(value = "赛事开始时间") + private Date startTime; + + @ApiModelProperty(value = "赛事结束时间") + private Date endTime; + + @ApiModelProperty(value = "课程id") + private Integer cid; + + @ApiModelProperty(value = "商品id") + private Integer mallId; + + @ApiModelProperty(value = "课程名称") + @TableField(exist = false) + private String cName; + + @ApiModelProperty(value = "考核配置id") + private Integer assessmentId; + + @ApiModelProperty(value = "系统id") + private Integer systemId; + + @ApiModelProperty(value = "系统名称") + @TableField(exist = false) + private String systemName; + + @ApiModelProperty(value = "项目管理表id") + private Integer projectId; + + @ApiModelProperty(value = "项目名称") + @TableField(exist = false) + private String projectName; + + @ApiModelProperty(value = "线上地址") + private String onlineAddress; + + @ApiModelProperty(value = "线下地址") + private String offlineAddress; + + @ApiModelProperty(value = "线上地址展示(默认为0不展示)") + private Integer onlineButton; + + @ApiModelProperty(value = "线下地址展示(默认为0不展示)") + private Integer offlineButton; + + @ApiModelProperty(value = "比赛内容描述") + private String contentDescription; + + @ApiModelProperty(value = "评分规则") + private String scoreRule; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "线下内容设置信息") + @TableField(exist = false) + private CompetitionStageContentSetting competitionStageContentSetting; + + +} diff --git a/competition/src/main/java/com/huoran/competition/entity/CompetitionProgress.java b/competition/src/main/java/com/huoran/competition/entity/CompetitionProgress.java new file mode 100644 index 0000000..064d0a5 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/CompetitionProgress.java @@ -0,0 +1,55 @@ +package com.huoran.competition.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 赛事进展表 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("c_competition_progress") +@ApiModel(value="CompetitionProgress对象", description="赛事进展表") +public class CompetitionProgress implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "赛事进展标题") + private String title; + + @ApiModelProperty(value = "赛事主键Id(c_competition表主键)") + private Integer competitionId; + + @ApiModelProperty(value = "赛事进展状态(0未完成,1进行中,2已完成)") + private Integer status; + + @ApiModelProperty(value = "赛事进展描述") + private String description; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + +} diff --git a/competition/src/main/java/com/huoran/competition/entity/CompetitionRange.java b/competition/src/main/java/com/huoran/competition/entity/CompetitionRange.java new file mode 100644 index 0000000..fa140ba --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/CompetitionRange.java @@ -0,0 +1,55 @@ +package com.huoran.competition.entity; + +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 赛事范围表 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("c_competition_range") +@ApiModel(value="CompetitionRange对象", description="赛事范围表") +public class CompetitionRange implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "赛事主键(c_competition表主键)") + private Integer competitionId; + + @ApiModelProperty(value = "省") + private Integer provinceId; + + @ApiModelProperty(value = "市") + private Integer cityId; + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + @ApiModelProperty(value = "范围类型(0为学校 1为地区)") + private Integer type; + + @ApiModelProperty(value = "是否删除(默认0 ,1为已删除)") + @TableLogic + private Integer isDel; + + +} diff --git a/competition/src/main/java/com/huoran/competition/entity/CompetitionRanking.java b/competition/src/main/java/com/huoran/competition/entity/CompetitionRanking.java new file mode 100644 index 0000000..13b03d4 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/CompetitionRanking.java @@ -0,0 +1,87 @@ +package com.huoran.competition.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 赛事排名表 + *

+ * + * @author cheney + * @since 2023-01-03 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("c_competition_ranking") +@ApiModel(value = "CompetitionRanking对象", description = "赛事排名表") +public class CompetitionRanking implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "主键") + private Integer id; + + @ApiModelProperty(value = "实验报告id") + private Integer reportId; + + @ApiModelProperty(value = "团队id") + private Integer teamId; + + @ApiModelProperty(value = "赛事id") + private Integer competitionId; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "赛事阶段id(c_competition_stage赛事阶段设置表)") + private Integer stageId; + + @ApiModelProperty(value = "是否为总分排名(1为是 默认0不是)") + private Integer isOverallRanking; + + @ApiModelProperty(value = "分数") + private String score; + + @ApiModelProperty(value = "耗时") + private String timeSum; + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "是否发布(默认0未发布 1已发布)") + private Integer isRelease; + + @ApiModelProperty(value = "发布类型(0默认发布 1批量手动导入)") + private Integer publicationType; + + + @ApiModelProperty(value = "团队名称") + @TableField(exist = false) + private String teamName; + + + @ApiModelProperty(value = "队长") + @TableField(exist = false) + private String leaderName; + + @ApiModelProperty(value = "学校") + @TableField(exist = false) + private String schoolName; + + +} diff --git a/competition/src/main/java/com/huoran/competition/entity/CompetitionRegistration.java b/competition/src/main/java/com/huoran/competition/entity/CompetitionRegistration.java new file mode 100644 index 0000000..9871e83 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/CompetitionRegistration.java @@ -0,0 +1,82 @@ +package com.huoran.competition.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 赛事报名人员表 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("c_competition_registration") +@ApiModel(value="CompetitionRegistration对象", description="赛事报名人员表") +public class CompetitionRegistration implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "赛事主键Id(c_competition表主键)") + private Integer competitionId; + + @ApiModelProperty(value = "用户主键Id") + private Integer userId; + + @ApiModelProperty(value = "是否禁用(0未禁用,1禁用)") + private Integer isDisable; + + @ApiModelProperty(value = "报名邀请码") + @TableField(exist = false) + private String registrationInvitationCode; + + @ApiModelProperty("内部标识") + private Integer identification; + + @ApiModelProperty(value = "用户名称") + private String username; + + @ApiModelProperty(value = "学校名称") + private String school; + + @ApiModelProperty(value = "账号") + private Integer account; + + @ApiModelProperty(value = "手机号") + private String phone; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "学号") + private Integer workNumber; + + @ApiModelProperty(value = "团队id,默认为0无团队") + private Integer teamId; + + @TableField(exist = false) + private boolean join; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + +} diff --git a/competition/src/main/java/com/huoran/competition/entity/CompetitionReleaseTime.java b/competition/src/main/java/com/huoran/competition/entity/CompetitionReleaseTime.java new file mode 100644 index 0000000..60c811e --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/CompetitionReleaseTime.java @@ -0,0 +1,56 @@ +package com.huoran.competition.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 赛事排名定时发布表 + *

+ * + * @author cheney + * @since 2023-05-30 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("c_competition_release_time") +@ApiModel(value="CompetitionReleaseTime对象", description="赛事排名定时发布表") +public class CompetitionReleaseTime implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "阶段id") + private Integer stageId; + + @ApiModelProperty(value = "赛事id") + private Integer competitionId; + + @ApiModelProperty(value = "发布类型(0默认发布 1批量手动导入)") + private Integer publicationType; + + @ApiModelProperty(value = "是否为总分排名(1为是 默认0不是)") + private Integer isOverallRanking; + + @ApiModelProperty(value = "发布时间") + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") + private Date releaseTime; + + @ApiModelProperty(value = "是否删除(默认0 1为已删除)") +// @TableLogic + private Integer isDel; + + +} diff --git a/competition/src/main/java/com/huoran/competition/entity/CompetitionRule.java b/competition/src/main/java/com/huoran/competition/entity/CompetitionRule.java new file mode 100644 index 0000000..27aab03 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/CompetitionRule.java @@ -0,0 +1,63 @@ +package com.huoran.competition.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; +import java.io.Serializable; +import java.util.List; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 赛事规则表 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("c_competition_rule") +@ApiModel(value="CompetitionRule对象", description="赛事规则表") +public class CompetitionRule implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键id") + @TableId(value = "rule_id", type = IdType.AUTO) + private Integer ruleId; + + @ApiModelProperty(value = "完整赛事设置id(取c_complete_competition_setup表主键)") + private Integer setupId; + + @ApiModelProperty(value = "赛制(0为积分赛,1为淘汰赛,2为单项赛)") + private Integer rule; + + @ApiModelProperty(value = "阶段数") + private Integer stageNum; + + @ApiModelProperty(value = "团队限制参加赛项(0不限制,1限制)默认为0") + private Integer teamLimit; + + @ApiModelProperty(value = "总成绩计算方式(0:各阶段加权求和,1:各阶段成绩求和,2:各阶段成绩平均值)") + private Integer resultCalculationMethod; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "各阶段设置") + @TableField(exist = false) + private List competitionStageList; + +} diff --git a/competition/src/main/java/com/huoran/competition/entity/CompetitionStage.java b/competition/src/main/java/com/huoran/competition/entity/CompetitionStage.java new file mode 100644 index 0000000..5226aed --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/CompetitionStage.java @@ -0,0 +1,214 @@ +package com.huoran.competition.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 赛事阶段设置表 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("c_competition_stage") +@ApiModel(value="CompetitionStage对象", description="赛事阶段设置表") +public class CompetitionStage implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "stage_id", type = IdType.AUTO) + private Integer stageId; + + @ApiModelProperty(value = "规则id(c_competition_rule表主键)") + private Integer ruleId; + + @ApiModelProperty(value = "阶段名称") + private String stageName; + + @ApiModelProperty(value = "序号(第几阶段)") + private Integer number; + + @ApiModelProperty(value = "比赛方式(0实操,1理论,2线下)默认为0") + private Integer method; + + @ApiModelProperty(value = "权重(积分赛,所有阶段权和为1)") + private Double pointWeight; + + @ApiModelProperty(value = "排名晋级人数限制(淘汰赛)") + private String peopleLimit; + + @ApiModelProperty(value = "排名晋级百分比限制(淘汰赛)") + private Double percentageLimit; + + @ApiModelProperty(value = "排名晋级分数限制(淘汰赛)") + private String scoreLimit; + + @ApiModelProperty(value = "成绩公布时间") + @TableField(strategy = FieldStrategy.IGNORED) + private Integer resultAnnouncementTime; + + @ApiModelProperty(value = "是否公布成绩详情(0为公布,1不公布)默认为1") + private Integer resultsDetails; + + @ApiModelProperty(value = "参数标识,大于0表示参加过比赛") + @TableField(exist = false) + private Integer count; + + @ApiModelProperty(value = "团队参赛人数限制(0表示不限制)默认为0") + private Integer teamNumLimit; + + @ApiModelProperty(value = "团队成绩计算方式(0:最高分,1:平均分,2:总分)") + private String teamCalculationMethod; + + @ApiModelProperty(value = "参赛人员名称(用户姓名)") + @TableField(exist = false) + private String teamParticipantIds; + + @ApiModelProperty(value = "参赛人员ids(账号id)") + @TableField(exist = false) + private String participantAccountIds; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "主键id") + @TableField(exist = false) + private Integer contentId; + + @ApiModelProperty(value = "赛事开始时间") + @TableField(exist = false) + private Date startTime; + + @ApiModelProperty(value = "赛事结束时间") + @TableField(exist = false) + private Date endTime; + + @ApiModelProperty(value = "课程id") + @TableField(exist = false) + private Integer cid; + + @ApiModelProperty(value = "商品id") + @TableField(exist = false) + private Integer mallId; + + @ApiModelProperty(value = "考核配置id") + @TableField(exist = false) + private Integer assessmentId; + + @ApiModelProperty(value = "系统id") + @TableField(exist = false) + private Integer systemId; + + @ApiModelProperty(value = "项目管理表id") + @TableField(exist = false) + private Integer projectId; + + @ApiModelProperty(value = "线上地址") + @TableField(exist = false) + private String onlineAddress; + + @ApiModelProperty(value = "线下地址") + @TableField(exist = false) + private String offlineAddress; + + @ApiModelProperty(value = "线上地址展示(默认为0不展示)") + @TableField(exist = false) + private Integer onlineButton; + + @ApiModelProperty(value = "线下地址展示(默认为0不展示)") + @TableField(exist = false) + private Integer offlineButton; + + @ApiModelProperty(value = "比赛内容描述") + @TableField(exist = false) + private String contentDescription; + + @ApiModelProperty(value = "评分规则") + @TableField(exist = false) + private String scoreRule; + + @ApiModelProperty(value = "分数") + @TableField(exist = false) + private Double score; + + @ApiModelProperty(value = "分数报告id") + @TableField(exist = false) + private Integer reportId; + + @ApiModelProperty(value = "课程系统名称") + @TableField(exist = false) + private String systemName; + + @ApiModelProperty(value = "赛事内容") + @TableField(exist = false) + private CompetitionContent competitionContent; + + @ApiModelProperty(value = "线下内容设置信息") + @TableField(exist = false) + private CompetitionStageContentSetting competitionStageContentSetting; + + @ApiModelProperty(value = "学生上传的线下文件") + @TableField(exist = false) + private CompetitionStageFile competitionStageFile; + + @ApiModelProperty(value = "系统链接") + @TableField(exist = false) + private String systemLink; + + @ApiModelProperty(value = "说明") + @TableField(exist = false) + private String stageExplain; + + @ApiModelProperty(value = "是否支持上传文件(默认0:不支持,1:支持)") + @TableField(exist = false) + private Integer whetherToUploadFiles; + + @ApiModelProperty(value = "文件路径") + @TableField(exist = false) + private String fileUrl; + + @ApiModelProperty(value = "文件路径") + @TableField(exist = false) + private String fileName; + + @ApiModelProperty(value = "用户文件名称") + @TableField(exist = false) + private String userFileName; + + @ApiModelProperty(value = "文件大小") + @TableField(exist = false) + private String fileSize; + + @ApiModelProperty(value = "文件格式") + @TableField(exist = false) + private String fileFormat; + + @ApiModelProperty(value = "oss文件名") + @TableField(exist = false) + private String ossFileName; + + @ApiModelProperty(value = "文件路径") + @TableField(exist = false) + private String filePath; + + @ApiModelProperty(value = "用户文件id") + @TableField(exist = false) + private Integer userFileId; +} \ No newline at end of file diff --git a/competition/src/main/java/com/huoran/competition/entity/CompetitionStageContentSetting.java b/competition/src/main/java/com/huoran/competition/entity/CompetitionStageContentSetting.java new file mode 100644 index 0000000..7b8944b --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/CompetitionStageContentSetting.java @@ -0,0 +1,54 @@ +package com.huoran.competition.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 赛事阶段内容设置 + *

+ * + * @author cheney + * @since 2023-11-13 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("c_competition_stage_content_setting") +@ApiModel(value="CompetitionStageContentSetting对象", description="赛事线下阶段内容设置") +public class CompetitionStageContentSetting implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "赛事id") + private Integer competitionId; + + @ApiModelProperty(value = "阶段id") + private Integer stageId; + + @ApiModelProperty(value = "系统链接") + private String systemLink; + + @ApiModelProperty(value = "说明") + private String stageExplain; + + @ApiModelProperty(value = "是否支持上传文件(默认0:不支持,1:支持)") + private Integer whetherToUploadFiles; + + @ApiModelProperty(value = "文件路径") + private String fileUrl; + + @ApiModelProperty(value = "文件路径") + private String fileName; +} diff --git a/competition/src/main/java/com/huoran/competition/entity/CompetitionStageFile.java b/competition/src/main/java/com/huoran/competition/entity/CompetitionStageFile.java new file mode 100644 index 0000000..8931246 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/CompetitionStageFile.java @@ -0,0 +1,71 @@ +package com.huoran.competition.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; + +import java.io.Serializable; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 赛事阶段文件 + *

+ * + * @author cheney + * @since 2023-11-13 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("c_competition_stage_file") +@ApiModel(value = "CompetitionStageFile对象", description = "赛事阶段文件") +public class CompetitionStageFile implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "赛事id") + private Integer competitionId; + + @ApiModelProperty(value = "阶段id") + private Integer stageId; + + @ApiModelProperty(value = "团队id") + private Integer teamId; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + @ApiModelProperty(value = "文件名") + private String fileName; + + @ApiModelProperty(value = "文件大小") + private String fileSize; + + @ApiModelProperty(value = "文件格式") + private String fileFormat; + + @ApiModelProperty(value = "oss文件名") + private String ossFileName; + + @ApiModelProperty(value = "文件路径") + private String filePath; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + +} diff --git a/competition/src/main/java/com/huoran/competition/entity/CompetitionTeam.java b/competition/src/main/java/com/huoran/competition/entity/CompetitionTeam.java new file mode 100644 index 0000000..268523e --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/CompetitionTeam.java @@ -0,0 +1,99 @@ +package com.huoran.competition.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; +import java.io.Serializable; +import java.util.List; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 赛事团队表 + *

+ * + * @author cheney + * @since 2022-12-02 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("c_competition_team") +@ApiModel(value="CompetitionTeam对象", description="赛事团队表") +public class CompetitionTeam implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "team_id", type = IdType.AUTO) + private Integer teamId; + + @ApiModelProperty(value = "赛事id") + private Integer competitionId; + + @ApiModelProperty(value = "团队名称") + private String teamName; + + @ApiModelProperty(value = "邀请码") + private String invitationCode; + + @ApiModelProperty(value = "报名邀请码") + @TableField(exist = false) + private String registrationInvitationCode; + + @ApiModelProperty(value = "父id") + private Integer pid; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "队长(0是队长,1为队员)默认为0") + private Integer captain; + + @ApiModelProperty(value = "是否报名,0不报名,1报名") + @TableField(exist = false) + private Integer whetherSignUp; + +/* @ApiModelProperty(value = "报名相关信息") + @TableField(exist = false) + private CompetitionRegistration competitionRegistration;*/ + + @ApiModelProperty(value = "用户名称") + @TableField(exist = false) + private String userName; + + @ApiModelProperty(value = "学号") + @TableField(exist = false) + private String workNumber; + + @ApiModelProperty(value = "学校id") + @TableField(exist = false) + private Integer schoolId; + + @ApiModelProperty(value = "学校名称") + @TableField(exist = false) + private String schoolName; + + @ApiModelProperty("内部标识") + @TableField(exist = false) + private Integer identification; + + @ApiModelProperty(value = "是否删除(默认0 ,1为已删除)") + @TableLogic + private Integer isDel; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + +} diff --git a/competition/src/main/java/com/huoran/competition/entity/CompleteCompetitionSetup.java b/competition/src/main/java/com/huoran/competition/entity/CompleteCompetitionSetup.java new file mode 100644 index 0000000..5707678 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/CompleteCompetitionSetup.java @@ -0,0 +1,64 @@ +package com.huoran.competition.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 完整赛事设置 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("c_complete_competition_setup") +@ApiModel(value="CompleteCompetitionSetup对象", description="完整赛事设置") +public class CompleteCompetitionSetup implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "setup_id", type = IdType.AUTO) + private Integer setupId; + + @ApiModelProperty(value = "赛事id(c_competition表主键)") + private Integer competitionId; + + @ApiModelProperty(value = "赛事类型(0为个人赛,1为团队赛)默认为0") + private Integer competitionType; + + @ApiModelProperty(value = "数量上限限制") + private Integer quantityLimit; + + @ApiModelProperty(value = "团队人数下限") + private Integer minTeamSize; + + @ApiModelProperty(value = "团队人数上限") + private Integer maxTeamSize; + + @ApiModelProperty(value = "邀请码") + private String invitationCode; + + @ApiModelProperty(value = "是否需要邀请码(0不需要,1需要)默认为0") + private Integer isNeedCode; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + +} diff --git a/competition/src/main/java/com/huoran/competition/entity/TeamInstructor.java b/competition/src/main/java/com/huoran/competition/entity/TeamInstructor.java new file mode 100644 index 0000000..dfb6a5c --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/TeamInstructor.java @@ -0,0 +1,64 @@ +package com.huoran.competition.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; + +/** + *

+ * 团队指导老师表 + *

+ * + * @author cheney + * @since 2022-12-02 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("c_team_instructor") +@ApiModel(value="TeamInstructor对象", description="团队指导老师表") +public class TeamInstructor implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "团队id(取c_competition主键)") + @NotNull(message = "大赛不能为空") + private Integer competitionId; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "团队id") + private Integer teamId; + + @ApiModelProperty(value = "姓名") + private String name; + + @ApiModelProperty(value = "手机号") + private String phone; + + @ApiModelProperty(value = "职务") + private String position; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + +} diff --git a/competition/src/main/java/com/huoran/competition/entity/TeamParticipant.java b/competition/src/main/java/com/huoran/competition/entity/TeamParticipant.java new file mode 100644 index 0000000..9ab93f9 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/TeamParticipant.java @@ -0,0 +1,58 @@ +package com.huoran.competition.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.List; + +/** + *

+ * 团队阶段参赛人员表 + *

+ * + * @author cheney + * @since 2022-12-05 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("c_team_participant") +@ApiModel(value="TeamParticipant对象", description="团队阶段参赛人员表") +public class TeamParticipant implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "赛事阶段id(c_competition_stage)") + private Integer stageId; + + @ApiModelProperty(value = "赛事id(c_competition)") + private Integer competitionId; + + @ApiModelProperty(value = "允许参赛人员账号") + private Integer accountId; + + @ApiModelProperty(value = "选择参赛人员账号") + @TableField(exist = false) + private List accountIds; + + @ApiModelProperty(value = "平台id") + @TableField(exist = false) + private Integer platformId; + + @ApiModelProperty(value = "团队id(c_competition_team)") + private Integer teamId; + + +} diff --git a/competition/src/main/java/com/huoran/competition/entity/req/AfterLoginPageCompetitionListReq.java b/competition/src/main/java/com/huoran/competition/entity/req/AfterLoginPageCompetitionListReq.java new file mode 100644 index 0000000..be342e8 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/req/AfterLoginPageCompetitionListReq.java @@ -0,0 +1,37 @@ +package com.huoran.competition.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @描述:竞赛管理表 + * @作者: Rong + * @日期: 2022-06-16 + */ +@Data +@ApiModel(value = "登录后赛事列表分页") +public class AfterLoginPageCompetitionListReq extends PageReq{ + + @ApiModelProperty(value = "关键词(竞赛名称/创建人)",example = "事") + private String keyWord; + + @ApiModelProperty(value = "大赛范围(0:本校内 1:全平台 2.指定区域、院校 3.不限)",example = "3") + private String competitionScope; + + @ApiModelProperty(value = "省") + private Integer provinceId; + + @ApiModelProperty(value = "市") + private Integer cityId; + + @ApiModelProperty(value = "排序(1:近期排名 2.最近更新)") + private Integer sequence; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "赛事类型(1.本校赛事/2.赛事广场/3.已报名赛事)") + private Integer eventType; + +} \ No newline at end of file diff --git a/competition/src/main/java/com/huoran/competition/entity/req/AllowedParticipateCompetitionReq.java b/competition/src/main/java/com/huoran/competition/entity/req/AllowedParticipateCompetitionReq.java new file mode 100644 index 0000000..cb7e5ea --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/req/AllowedParticipateCompetitionReq.java @@ -0,0 +1,24 @@ +package com.huoran.competition.entity.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class AllowedParticipateCompetitionReq { + + @ApiModelProperty(value = "大赛id") + private Integer competitionId; + + @ApiModelProperty(value = "大赛阶段id") + private Integer stageId; + + @ApiModelProperty(value = "序号(第几阶段)") + private Integer number; + + @ApiModelProperty(value = "账号(无需传值)") + private String accountId; + + @ApiModelProperty(value = "团队id") + private Integer teamId; + +} diff --git a/competition/src/main/java/com/huoran/competition/entity/req/BatchUploadListCompetitionReq.java b/competition/src/main/java/com/huoran/competition/entity/req/BatchUploadListCompetitionReq.java new file mode 100644 index 0000000..8c7e9df --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/req/BatchUploadListCompetitionReq.java @@ -0,0 +1,24 @@ +package com.huoran.competition.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + + +@Data +@ApiModel(value = "批量上传分页列表") +public class BatchUploadListCompetitionReq extends PageReq implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "大赛Id") + private Integer competitionId; + + @ApiModelProperty(value = "阶段Id") + private Integer stageId; + + @ApiModelProperty(value = "是否为总分排名(1为是 默认0不是)") + private Integer isOverallRanking; +} \ No newline at end of file diff --git a/competition/src/main/java/com/huoran/competition/entity/req/CompetitionContentReq.java b/competition/src/main/java/com/huoran/competition/entity/req/CompetitionContentReq.java new file mode 100644 index 0000000..bb0e526 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/req/CompetitionContentReq.java @@ -0,0 +1,14 @@ +package com.huoran.competition.entity.req; + +import com.huoran.competition.entity.CompetitionContent; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +@Data +public class CompetitionContentReq { + + @ApiModelProperty(value = "多个赛事内容", required = true) + List competitionContents; +} diff --git a/competition/src/main/java/com/huoran/competition/entity/req/CompetitionDetailReq.java b/competition/src/main/java/com/huoran/competition/entity/req/CompetitionDetailReq.java new file mode 100644 index 0000000..4f4b83b --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/req/CompetitionDetailReq.java @@ -0,0 +1,21 @@ +package com.huoran.competition.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @描述:竞赛管理表 + * @作者: Rong + * @日期: 2022-06-16 + */ +@Data +@ApiModel(value = "大赛详情请求参数") +public class CompetitionDetailReq extends PageReq{ + + @ApiModelProperty(value = "大赛id") + private Integer contestId; + + + +} \ No newline at end of file diff --git a/competition/src/main/java/com/huoran/competition/entity/req/ContestStageFileReq.java b/competition/src/main/java/com/huoran/competition/entity/req/ContestStageFileReq.java new file mode 100644 index 0000000..1d225c3 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/req/ContestStageFileReq.java @@ -0,0 +1,28 @@ +package com.huoran.competition.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + + +@Data +@ApiModel(value = "阶段文件管理") +public class ContestStageFileReq extends PageReq { + + + @ApiModelProperty(value = "大赛Id") + private Integer competitionId; + + @ApiModelProperty(value = "阶段id") + private Integer stageId; + + @ApiModelProperty(value = "选择要导出的文件",required = false) + private List ids; + + @ApiModelProperty(value = "关键字") + private String keyWord; + + +} \ No newline at end of file diff --git a/competition/src/main/java/com/huoran/competition/entity/req/DelCompetitionRankingReq.java b/competition/src/main/java/com/huoran/competition/entity/req/DelCompetitionRankingReq.java new file mode 100644 index 0000000..81f47a8 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/req/DelCompetitionRankingReq.java @@ -0,0 +1,27 @@ +package com.huoran.competition.entity.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.util.List; + + +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class DelCompetitionRankingReq { + + + @ApiModelProperty(value = "赛事id") + private Integer competitionId; + + @ApiModelProperty(value = "阶段id(集合)") + private List stageIds; + + @ApiModelProperty(value = "是否为总分排名(1为是 默认0不是)") + private Integer isOverallRanking; + + +} diff --git a/competition/src/main/java/com/huoran/competition/entity/req/DetailsOfTotalTeamScoresReq.java b/competition/src/main/java/com/huoran/competition/entity/req/DetailsOfTotalTeamScoresReq.java new file mode 100644 index 0000000..57658f7 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/req/DetailsOfTotalTeamScoresReq.java @@ -0,0 +1,31 @@ +package com.huoran.competition.entity.req; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.util.Date; +import java.util.List; + + +@Data +@ApiModel(value = "团队得分详情") +public class DetailsOfTotalTeamScoresReq { + + @ApiModelProperty(value = "大赛Id") + private Integer competitionId; + + @ApiModelProperty(value = "要查询的阶段id(多个)") + private List stageIds; + + + @JsonIgnore + @ApiModelProperty(value = "阶段id") + private Integer stageId; + + @ApiModelProperty(value = "团队id") + private Integer teamId; + +} diff --git a/competition/src/main/java/com/huoran/competition/entity/req/DisableEnableCompetitionReq.java b/competition/src/main/java/com/huoran/competition/entity/req/DisableEnableCompetitionReq.java new file mode 100644 index 0000000..7d7fa0e --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/req/DisableEnableCompetitionReq.java @@ -0,0 +1,25 @@ +package com.huoran.competition.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @描述:竞赛管理表 + * @作者: Rong + * @日期: 2022-06-16 + */ +@Data +@ApiModel(value = "禁用启用赛事所需参数") +public class DisableEnableCompetitionReq { + + @ApiModelProperty(value = "禁用平台来源(0中台,1职站)",example = "1") + private Integer type; + + @ApiModelProperty(value = "禁用的赛事id",example = "1") + private Integer competitionId; + + @ApiModelProperty(value = "是否开启(默认0启用 1禁用)", example = "0") + private Integer isOpen; + +} \ No newline at end of file diff --git a/competition/src/main/java/com/huoran/competition/entity/req/ExcelImpGradeReq.java b/competition/src/main/java/com/huoran/competition/entity/req/ExcelImpGradeReq.java new file mode 100644 index 0000000..3bebb7c --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/req/ExcelImpGradeReq.java @@ -0,0 +1,51 @@ +package com.huoran.competition.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + + +@Data +@ApiModel(value = "批量导入大赛成绩所需") +public class ExcelImpGradeReq { + + @ApiModelProperty(value = "姓名") + @NotNull(message = "姓名不能为空!") + private String userName; + + + @ApiModelProperty(value = "学号") + @NotNull(message = "学号不能为空!") + private String workNumber; + + @ApiModelProperty(value = "分数") + @NotNull(message = "分数不能为空!") + private String score; + + @ApiModelProperty(value = "耗时") + private String timeSum; + + @ApiModelProperty(value = "学校名称") + private String schoolName; + + /** + * 耗时:不填默认为0 + * @return + */ + public String getTimeSum() { + if ("".equals(timeSum) || timeSum == null) { + return "0"; + } + return timeSum; + } + + /*@ApiModelProperty(value = "提交时间(用于区分线下赛事的提交时间)") + @NotNull(message = "提交时间不能为空!") + private Date submitTime;*/ + + @ApiModelProperty(value = "团队名称") + private String teamName; + +} diff --git a/competition/src/main/java/com/huoran/competition/entity/req/ExcelImpRankReq.java b/competition/src/main/java/com/huoran/competition/entity/req/ExcelImpRankReq.java new file mode 100644 index 0000000..bdccb8a --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/req/ExcelImpRankReq.java @@ -0,0 +1,46 @@ +package com.huoran.competition.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.util.Date; + + +@Data +@ApiModel(value = "批量导入大赛排名所需") +public class ExcelImpRankReq { + + @ApiModelProperty(value = "团队名称") + private String teamName; + + + @ApiModelProperty(value = "姓名") + @NotNull(message = "姓名不能为空!") + private String userName; + + @ApiModelProperty(value = "学号") + private String workNumber; + + @ApiModelProperty(value = "学校不能为空") + @NotNull(message = "学校不能为空!") + private String schoolName; + + + @ApiModelProperty(value = "分数") + @NotNull(message = "分数不能为空!") + private String score; + + @ApiModelProperty(value = "耗时") + private String timeSum; + + public String getTimeSum() { + if ("".equals(timeSum) || timeSum == null) { + return "0"; + } + return timeSum; + } + + +} diff --git a/competition/src/main/java/com/huoran/competition/entity/req/FrontDeskStageRankingReq.java b/competition/src/main/java/com/huoran/competition/entity/req/FrontDeskStageRankingReq.java new file mode 100644 index 0000000..08e7d32 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/req/FrontDeskStageRankingReq.java @@ -0,0 +1,30 @@ +package com.huoran.competition.entity.req; + +import com.huoran.competition.entity.CompetitionStage; +import com.huoran.competition.entity.CompleteCompetitionSetup; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +@Data +@ApiModel(value = "前台阶段排名要求") +public class FrontDeskStageRankingReq extends PageReq { + + + @ApiModelProperty(value = "大赛Id") + private Integer competitionId; + + @ApiModelProperty(value = "当前的阶段id") + private Integer stageId; + + + @ApiModelProperty(value = "团队id(逗号隔开)") + private String teamIds; + + @ApiModelProperty(value = "完整赛事设置") + private CompleteCompetitionSetup competitionSetup; + + @ApiModelProperty(value = "赛事阶段设置表") + private CompetitionStage competitionStage; +} \ No newline at end of file diff --git a/competition/src/main/java/com/huoran/competition/entity/req/FrontDeskStageTeamScoreDetailsReq.java b/competition/src/main/java/com/huoran/competition/entity/req/FrontDeskStageTeamScoreDetailsReq.java new file mode 100644 index 0000000..f1c7b8d --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/req/FrontDeskStageTeamScoreDetailsReq.java @@ -0,0 +1,40 @@ +package com.huoran.competition.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +@Data +@ApiModel(value = "积分赛总排名") +public class FrontDeskStageTeamScoreDetailsReq extends PageReq{ + + + @ApiModelProperty(value = "大赛Id") + private Integer competitionId; + + @ApiModelProperty(value = "当前的阶段id") + private Integer stageId; + + + @ApiModelProperty(value = "多个阶段id(逗号隔开)") + private String stageIds; + + @ApiModelProperty(value = "团队id") + private Integer teamId; + + @ApiModelProperty(value = "是否为总分排名(1为是 默认0不是)") + private Integer isOverallRanking; + + @ApiModelProperty(value = "查询成绩详情类型标识,查询类型为1") + private Integer type; + + @ApiModelProperty(value = "账号id") + private String accountId; + + @ApiModelProperty(value = "赛事类型(0为个人赛,1为团队赛)默认为0",hidden = true) + private Integer competitionType; +/* + @ApiModelProperty(value = "要查询的阶段id(多个)") + private List stageIds;*/ +} \ No newline at end of file diff --git a/competition/src/main/java/com/huoran/competition/entity/req/FrontStageCompetitionReq.java b/competition/src/main/java/com/huoran/competition/entity/req/FrontStageCompetitionReq.java new file mode 100644 index 0000000..ec8b267 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/req/FrontStageCompetitionReq.java @@ -0,0 +1,20 @@ +package com.huoran.competition.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +@Data +@ApiModel(value = "前台竞赛阶段参数") +public class FrontStageCompetitionReq { + + + @ApiModelProperty(value = "大赛Id") + private Integer competitionId; + + @ApiModelProperty(value = "团队id") + private Integer teamId; + + +} \ No newline at end of file diff --git a/competition/src/main/java/com/huoran/competition/entity/req/IsParticipantReq.java b/competition/src/main/java/com/huoran/competition/entity/req/IsParticipantReq.java new file mode 100644 index 0000000..ec693f7 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/req/IsParticipantReq.java @@ -0,0 +1,20 @@ +package com.huoran.competition.entity.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class IsParticipantReq { + + @ApiModelProperty(value = "大赛id") + private Integer competitionId; + + @ApiModelProperty(value = "大赛阶段id") + private Integer stageId; + + @ApiModelProperty(value = "账号(无需传值)") + private String accountId; + + @ApiModelProperty(value = "团队id") + private Integer teamId; +} diff --git a/competition/src/main/java/com/huoran/competition/entity/req/ManualPublishingParameterReq.java b/competition/src/main/java/com/huoran/competition/entity/req/ManualPublishingParameterReq.java new file mode 100644 index 0000000..c7c64cc --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/req/ManualPublishingParameterReq.java @@ -0,0 +1,23 @@ +package com.huoran.competition.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +@Data +@ApiModel(value = "手动发布的参数") +public class ManualPublishingParameterReq extends PageReq{ + + + @ApiModelProperty(value = "大赛Id") + private Integer competitionId; + + @ApiModelProperty(value = "当前的阶段id") + private Integer stageId; + + + @ApiModelProperty(value = "是否为总分排名(1为是 默认0不是)") + private Integer isOverallRanking; + +} \ No newline at end of file diff --git a/competition/src/main/java/com/huoran/competition/entity/req/OverallStandingsInThePointsRaceReq.java b/competition/src/main/java/com/huoran/competition/entity/req/OverallStandingsInThePointsRaceReq.java new file mode 100644 index 0000000..b37833e --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/req/OverallStandingsInThePointsRaceReq.java @@ -0,0 +1,29 @@ +package com.huoran.competition.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + + +@Data +@ApiModel(value = "积分赛总排名") +public class OverallStandingsInThePointsRaceReq extends PageReq { + + + @ApiModelProperty(value = "大赛Id") + private Integer competitionId; + + @ApiModelProperty(value = "要查询的阶段id(多个)") + private List stageIds; + + @ApiModelProperty(value = "发布类型(0默认发布 1批量手动导入)") + private Integer publicationType; + + @ApiModelProperty(value = "当前定位阶段Id") + private Integer locationStageId; + + + +} \ No newline at end of file diff --git a/competition/src/main/java/com/huoran/competition/entity/req/PageCompetitionListReq.java b/competition/src/main/java/com/huoran/competition/entity/req/PageCompetitionListReq.java new file mode 100644 index 0000000..52e02d7 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/req/PageCompetitionListReq.java @@ -0,0 +1,56 @@ +package com.huoran.competition.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @描述:竞赛管理表 + * @作者: Rong + * @日期: 2022-06-16 + */ +@Data +@ApiModel(value = "赛事列表分页") +public class PageCompetitionListReq extends PageReq{ + + + + + @ApiModelProperty(value = "关键词(竞赛名称/创建人)",example = "事") + private String keyWord; + + @ApiModelProperty(value = "发布状态(0未发布,1已发布)") + private Integer publishStatus; + + + @ApiModelProperty(value = "大赛来源(0中台,1职站)",example = "1") + private String platformSource; + + @ApiModelProperty(value = "大赛范围(0:本校内 1:全平台 2.指定区域、院校)",example = "0") + private String competitionScope; + + + @ApiModelProperty(value = "开始时间") + private String startTime; + + @ApiModelProperty(value = "结束时间") + private String endTime; + + + @ApiModelProperty(value = "省") + private Integer provinceId; + + + @ApiModelProperty(value = "市") + private Integer cityId; + + + @ApiModelProperty(value = "排序(1:近期排名 2.最近更新)") + private Integer sequence; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "是否登录:-1未登录/1已登录") + private Integer isLogin; +} \ No newline at end of file diff --git a/competition/src/main/java/com/huoran/competition/entity/req/PageGradeListReq.java b/competition/src/main/java/com/huoran/competition/entity/req/PageGradeListReq.java new file mode 100644 index 0000000..9636025 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/req/PageGradeListReq.java @@ -0,0 +1,36 @@ +package com.huoran.competition.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.util.Date; +import java.util.List; + + +@Data +@ApiModel(value = "阶段成绩列表所需参数") +public class PageGradeListReq extends PageReq { + + @ApiModelProperty(value = "关键字") + private String keyWord; + + + @ApiModelProperty(value = "赛事阶段id") + private Integer stageId; + + + @ApiModelProperty(value = "赛事id") + private Integer competitionId; + + + @ApiModelProperty(value = "reportId或者scoreId") + private List ids; + + @ApiModelProperty(value = "是否为中台(0为否 1为是)") + private Integer isNakadai; + + @ApiModelProperty(value = "团队id") + private Integer teamId; +} diff --git a/competition/src/main/java/com/huoran/competition/entity/req/PageRegistrationStaffReq.java b/competition/src/main/java/com/huoran/competition/entity/req/PageRegistrationStaffReq.java new file mode 100644 index 0000000..7be3f28 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/req/PageRegistrationStaffReq.java @@ -0,0 +1,35 @@ +package com.huoran.competition.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @描述:竞赛管理表 + * @作者: Rong + * @日期: 2022-06-16 + */ +@Data +@ApiModel(value = "报名人员分页参数列表") +public class PageRegistrationStaffReq extends PageReq{ + + @ApiModelProperty(value = "关键词(学生姓名/手机号)",example = "18818574533") + private String keyWord; + + @ApiModelProperty(value = "赛事ID",example = "1485860415656255489") + private String competitionId; + + private Integer pageNum; + + private Integer pageSize; + + @ApiModelProperty(value = "禁用启用0未禁用,1禁用",example = "0") + private Integer isDisable; + + @ApiModelProperty(value = "学校排序标识",example = "1正序,2倒序") + private Integer schoolOrder; + + @ApiModelProperty(value = "团队排序标识",example = "null") + private Integer teamOrder; + +} \ No newline at end of file diff --git a/competition/src/main/java/com/huoran/competition/entity/req/PageReq.java b/competition/src/main/java/com/huoran/competition/entity/req/PageReq.java new file mode 100644 index 0000000..91dc953 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/req/PageReq.java @@ -0,0 +1,27 @@ +package com.huoran.competition.entity.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @ProjectName: huorantech + * @Package: com.huoran.occupationlab.entity.req + * @ClassName: PageReq + * @Description: 分页 + * @Author: Maureen.Rong + * @CreateDate: 2021/8/12 15:10 + * @UpdateDate: 2021/8/12 15:10 + * @Version: 1.0 + */ +@Data +public class PageReq { + + @ApiModelProperty(value = "当前页数", name = "pageNum", example = "1", required = true) + private Integer pageNum; + @ApiModelProperty(value = "当前页需要显示的数量", name = "pageSize", example = "10", required = true) + private Integer pageSize; + + @ApiModelProperty(hidden = true) + private Integer schoolId; + +} diff --git a/competition/src/main/java/com/huoran/competition/entity/req/StageRankingReq.java b/competition/src/main/java/com/huoran/competition/entity/req/StageRankingReq.java new file mode 100644 index 0000000..407a13c --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/req/StageRankingReq.java @@ -0,0 +1,35 @@ +package com.huoran.competition.entity.req; + + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + + +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class StageRankingReq { + + + @ApiModelProperty(value = "赛事id") + private Integer competitionId; + + @ApiModelProperty(value = "赛事阶段id") + private Integer stageId; + + @ApiModelProperty(value = "团队id") + private Integer teamId; + + + @ApiModelProperty(value = "多团队id(逗号隔开)") + private String teamIds; +} \ No newline at end of file diff --git a/competition/src/main/java/com/huoran/competition/entity/req/StageTeamScoreDetailsReq.java b/competition/src/main/java/com/huoran/competition/entity/req/StageTeamScoreDetailsReq.java new file mode 100644 index 0000000..dc24c6d --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/req/StageTeamScoreDetailsReq.java @@ -0,0 +1,35 @@ +package com.huoran.competition.entity.req; + +import com.huoran.competition.entity.CompetitionStage; +import com.huoran.competition.entity.CompleteCompetitionSetup; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + + +@Data +@ApiModel(value = "积分赛总排名") +public class StageTeamScoreDetailsReq extends PageReq{ + + + @ApiModelProperty(value = "大赛Id") + private Integer competitionId; + + @ApiModelProperty(value = "当前的阶段id") + private Integer stageId; + + + /*@ApiModelProperty(value = "多个阶段id(逗号隔开)") + private String stageIds;*/ + + @ApiModelProperty(value = "团队id") + private Integer teamId; + + @ApiModelProperty(value = "是否为总分排名(1为是 默认0不是)") + private Integer isOverallRanking; + + @ApiModelProperty(value = "要查询的阶段id(多个)") + private List stageIds; +} \ No newline at end of file diff --git a/competition/src/main/java/com/huoran/competition/entity/req/TransferTeamReq.java b/competition/src/main/java/com/huoran/competition/entity/req/TransferTeamReq.java new file mode 100644 index 0000000..cbd3a18 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/req/TransferTeamReq.java @@ -0,0 +1,20 @@ +package com.huoran.competition.entity.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Author chen + * @DATE 2022/6/14 18:21 + * @Version 1.0 + */ +@Data +public class TransferTeamReq { + + @ApiModelProperty(value = "队长id") + private Integer captainId; + + @ApiModelProperty(value = "队员id") + private Integer playerId; + +} diff --git a/competition/src/main/java/com/huoran/competition/entity/req/WhetherToPublishParameterReq.java b/competition/src/main/java/com/huoran/competition/entity/req/WhetherToPublishParameterReq.java new file mode 100644 index 0000000..ff7d5e3 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/req/WhetherToPublishParameterReq.java @@ -0,0 +1,29 @@ +package com.huoran.competition.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +@Data +@ApiModel(value = "排名是否发布参数") +public class WhetherToPublishParameterReq { + + + @ApiModelProperty(value = "大赛Id") + private Integer competitionId; + + @ApiModelProperty(value = "当前的阶段id") + private Integer stageId; + + + @ApiModelProperty(value = "是否为总分排名(1为是 默认0不是)") + private Integer isOverallRanking; + + @ApiModelProperty(value = "是否发布(默认0未发布 1已发布)") + private Integer isRelease; + + @ApiModelProperty(value = "发布类型(0默认发布 1批量手动导入)") + private Integer publicationType; + +} \ No newline at end of file diff --git a/competition/src/main/java/com/huoran/competition/entity/resp/CompetitionRangeResp.java b/competition/src/main/java/com/huoran/competition/entity/resp/CompetitionRangeResp.java new file mode 100644 index 0000000..04b5634 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/resp/CompetitionRangeResp.java @@ -0,0 +1,27 @@ +package com.huoran.competition.entity.resp; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +@Data +@ApiModel(value = "大赛范围选择") +public class CompetitionRangeResp { + + @ApiModelProperty(value = "竞赛主键") + private String contestId; + + @ApiModelProperty(value = "省") + private String provinceName; + + @ApiModelProperty(value = "市") + private String cityName; + + @ApiModelProperty(value = "学校id") + private String schoolName; + + @ApiModelProperty(value = "范围类型(0为学校 1为地区)") + private Integer type; + +} \ No newline at end of file diff --git a/competition/src/main/java/com/huoran/competition/entity/resp/CompetitionRangeTeamCountResp.java b/competition/src/main/java/com/huoran/competition/entity/resp/CompetitionRangeTeamCountResp.java new file mode 100644 index 0000000..6f11f46 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/resp/CompetitionRangeTeamCountResp.java @@ -0,0 +1,18 @@ +package com.huoran.competition.entity.resp; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + + +@Data +public class CompetitionRangeTeamCountResp { + + List scoreList; + + + List timeSum; + +} \ No newline at end of file diff --git a/competition/src/main/java/com/huoran/competition/entity/resp/CompetitionRuleResp.java b/competition/src/main/java/com/huoran/competition/entity/resp/CompetitionRuleResp.java new file mode 100644 index 0000000..a36d0e3 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/resp/CompetitionRuleResp.java @@ -0,0 +1,75 @@ +package com.huoran.competition.entity.resp; + +import com.baomidou.mybatisplus.annotation.*; +import com.huoran.competition.entity.CompetitionStage; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + + +@Data +@EqualsAndHashCode(callSuper = false) +public class CompetitionRuleResp { + + + @ApiModelProperty(value = "主键id") + @TableId(value = "rule_id", type = IdType.AUTO) + private Integer ruleId; + + @ApiModelProperty(value = "完整赛事设置id(取c_complete_competition_setup表主键)") + private Integer setupId; + + @ApiModelProperty(value = "赛制(0为积分赛,1为淘汰赛,2为单项赛)") + private Integer rule; + + @ApiModelProperty(value = "阶段数") + private Integer stageNum; + + @ApiModelProperty(value = "团队限制参加赛项(0不限制,1限制)默认为0") + private Integer teamLimit; + + @ApiModelProperty(value = "成绩计算方式(0:各阶段加权求和,1:各阶段成绩求和,2:各阶段成绩平均值)") + private Integer resultCalculationMethod; + + @ApiModelProperty(value = "阶段id") + private Integer stageId; + + + @ApiModelProperty(value = "阶段名称") + private String stageName; + + @ApiModelProperty(value = "序号(第几阶段)") + private Integer number; + + @ApiModelProperty(value = "比赛方式(0实操,1理论,2线下)默认为0") + private Integer method; + + @ApiModelProperty(value = "权重(积分赛,所有阶段权和为1)") + private Double pointWeight; + + @ApiModelProperty(value = "排名晋级人数限制(淘汰赛)") + private String peopleLimit; + + @ApiModelProperty(value = "排名晋级百分比限制(淘汰赛)") + private Double percentageLimit; + + @ApiModelProperty(value = "排名晋级分数限制(淘汰赛)") + private String scoreLimit; + + @ApiModelProperty(value = "成绩公布时间") + private Double resultAnnouncementTime; + + @ApiModelProperty(value = "赛事id(c_competition表主键)") + private Integer competitionId; + + @ApiModelProperty(value = "团队成绩计算方式(0:最高分,1:平均分,2:总分)") + private String teamCalculationMethod; + + +} diff --git a/competition/src/main/java/com/huoran/competition/entity/resp/CompetitionStageFileResp.java b/competition/src/main/java/com/huoran/competition/entity/resp/CompetitionStageFileResp.java new file mode 100644 index 0000000..2bfcb6f --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/resp/CompetitionStageFileResp.java @@ -0,0 +1,84 @@ +package com.huoran.competition.entity.resp; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 赛事阶段文件 + *

+ * + * @author cheney + * @since 2023-11-13 + */ +@Data +@ApiModel(value = "CompetitionStageFile对象", description = "赛事阶段文件列标") +public class CompetitionStageFileResp implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "赛事id") + private Integer competitionId; + + @ApiModelProperty(value = "阶段id") + private Integer stageId; + + @ApiModelProperty(value = "团队id") + private Integer teamId; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + @ApiModelProperty(value = "文件名") + private String fileName; + + @ApiModelProperty(value = "文件大小") + private String fileSize; + + @ApiModelProperty(value = "文件格式") + private String fileFormat; + + @ApiModelProperty(value = "oss文件名") + private String ossFileName; + + @ApiModelProperty(value = "文件路径") + private String filePath; + + @ApiModelProperty(value = "创建时间") + private Date createTime; + + @ApiModelProperty(value = "团队名称") + private String teamName; + + @ApiModelProperty(value = "学生名称") + private String userName; + + @ApiModelProperty(value = "学号") + private String workNumber; + + + + @ApiModelProperty(value = "队长") + private String captain; + + + @ApiModelProperty(value = "学校") + private String schoolName; + +} diff --git a/competition/src/main/java/com/huoran/competition/entity/resp/DetailsOfTotalTeamScoresResp.java b/competition/src/main/java/com/huoran/competition/entity/resp/DetailsOfTotalTeamScoresResp.java new file mode 100644 index 0000000..70c93bf --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/resp/DetailsOfTotalTeamScoresResp.java @@ -0,0 +1,51 @@ +package com.huoran.competition.entity.resp; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.List; + +/** + *

+ * 赛事排名表 + *

+ * + * @author cheney + * @since 2023-01-03 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class DetailsOfTotalTeamScoresResp { + @ApiModelProperty(value = "阶段id") + private Integer stageId; + + @ApiModelProperty(value = "阶段名称") + private String stageName; + + @ApiModelProperty(value = "权重(积分赛,所有阶段权和为1)") + private Double pointWeight; + + @ApiModelProperty(value = "团队成绩计算方式(0:最高分,1:平均分,2:总分)") + private String teamCalculationMethod; + + @ApiModelProperty(value = "团队成绩分数") + private Double teamScore; + + + @ApiModelProperty(value = "赛事规则") + private CompetitionRuleResp competitionRules; + + + @ApiModelProperty(value = "本阶段参赛的团队信息") + private List stageTeamInformation; + + +} diff --git a/competition/src/main/java/com/huoran/competition/entity/resp/FractionalSegmentResp.java b/competition/src/main/java/com/huoran/competition/entity/resp/FractionalSegmentResp.java new file mode 100644 index 0000000..51a8920 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/resp/FractionalSegmentResp.java @@ -0,0 +1,48 @@ +package com.huoran.competition.entity.resp; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + + +@Data +public class FractionalSegmentResp { + + + @ApiModelProperty(value = "0-10") + private Integer num1; + + @ApiModelProperty(value = "11-20") + private Integer num2; + + @ApiModelProperty(value = "21-30") + private Integer num3; + + @ApiModelProperty(value = "31-40") + private Integer num4; + + @ApiModelProperty(value = "41-50") + private Integer num5; + + @ApiModelProperty(value = "51-60") + private Integer num6; + + @ApiModelProperty(value = "61-70") + private Integer num7; + + @ApiModelProperty(value = "71-80") + private Integer num8; + + @ApiModelProperty(value = "81-90") + private Integer num9; + + @ApiModelProperty(value = "91-100") + private Integer num10; + + @ApiModelProperty(value = "实验人数") + private Integer totalNumber; + + @ApiModelProperty(value = "平均分") + private double avgScore; + +} diff --git a/competition/src/main/java/com/huoran/competition/entity/resp/FrontStageCompetitionResp.java b/competition/src/main/java/com/huoran/competition/entity/resp/FrontStageCompetitionResp.java new file mode 100644 index 0000000..c37b455 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/resp/FrontStageCompetitionResp.java @@ -0,0 +1,51 @@ +package com.huoran.competition.entity.resp; + +import com.baomidou.mybatisplus.annotation.*; +import com.huoran.competition.entity.CompetitionContent; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 赛事阶段设置表 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "前台竞赛阶段", description = "前台竞赛阶段") +public class FrontStageCompetitionResp { + + + @ApiModelProperty(value = "主键") + @TableId(value = "stage_id", type = IdType.AUTO) + private Integer stageId; + + + @ApiModelProperty(value = "阶段名称") + private String stageName; + + @ApiModelProperty(value = "序号(第几阶段)") + private Integer number; + + @ApiModelProperty(value = "比赛方式(0实操,1理论,2线下)默认为0") + private Integer method; + + @ApiModelProperty(value = "权重(积分赛,所有阶段权和为1)") + private Double pointWeight; + + + @ApiModelProperty(value = "团队成绩计算方式(0:最高分,1:平均分,2:总分)") + private String teamCalculationMethod; + + +} diff --git a/competition/src/main/java/com/huoran/competition/entity/resp/ListOfStageResultsResp.java b/competition/src/main/java/com/huoran/competition/entity/resp/ListOfStageResultsResp.java new file mode 100644 index 0000000..7baae2e --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/resp/ListOfStageResultsResp.java @@ -0,0 +1,101 @@ +package com.huoran.competition.entity.resp; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + + +@Data +@ApiModel(value = "阶段成绩列表返回值") +public class ListOfStageResultsResp implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "排名表主键id") + private Integer id; + + @ApiModelProperty(value = "序号") + private Integer serialNumber; + + @ApiModelProperty(value = "分数表id") + private Integer scoreId; + + @ApiModelProperty(value = "分数") + private String score; + + + @ApiModelProperty(value = "团队名称") + private String teamName; + + @ApiModelProperty(value = "团队id") + private Integer teamId; + + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + + @ApiModelProperty("耗时") + private String timeSum; + + @ApiModelProperty(value = "帐户Id") + private String accountId; + + @ApiModelProperty(value = "学号") + private String workNumber; + + @ApiModelProperty(value = "提交时间") + private String submitTime; + + @ApiModelProperty(value = "阶段id") + private Integer stageId; + + @ApiModelProperty(value = "阶段名称") + private String stageName; + + @ApiModelProperty(value = "用户名") + private String userName; + + @ApiModelProperty(value = "学校名称") + private String schoolName; + + @ApiModelProperty(value = "队长") + private String leaderName; + + @ApiModelProperty(value = "实验报告id(删除传)") + private Integer reportId; + + @ApiModelProperty(value = "平均分", hidden = true) + @JsonIgnore + private String avgScore; + + @ApiModelProperty(value = "总分", hidden = true) + @JsonIgnore + private String sumScore; + + @ApiModelProperty(value = "最高分", hidden = true) + @JsonIgnore + private String maxScore; + + @ApiModelProperty(value = "序号(第几阶段)") + private Integer number; + + @ApiModelProperty(value = "成绩计算方式(0:各阶段加权求和,1:各阶段成绩求和,2:各阶段成绩平均值)") + private Integer resultCalculationMethod; + + @ApiModelProperty(value = "权重(积分赛,所有阶段权和为1)") + private Double pointWeight; + + @ApiModelProperty(value = "是否发布(默认0未发布 1已发布)") + private Integer isRelease; + + @ApiModelProperty(value = "发布类型(0默认发布 1批量手动导入)") + private Integer publicationType; + + @ApiModelProperty(value = "是否考试(0未考 1已考)") + private Integer testOrNot; + +} \ No newline at end of file diff --git a/competition/src/main/java/com/huoran/competition/entity/resp/OverallEventRankingResp.java b/competition/src/main/java/com/huoran/competition/entity/resp/OverallEventRankingResp.java new file mode 100644 index 0000000..5404d1e --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/resp/OverallEventRankingResp.java @@ -0,0 +1,29 @@ +package com.huoran.competition.entity.resp; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + + +@Data +@ApiModel(value = "赛事总分排名") +public class OverallEventRankingResp { + + @ApiModelProperty(value = "阶段id") + private Integer stageId; + + @ApiModelProperty(value = "阶段名称") + private String stageName; + + @ApiModelProperty(value = "权重(积分赛,所有阶段权和为1)") + private Double pointWeight; + + /* @ApiModelProperty(value = "赛事类型(0为个人赛,1为团队赛)默认为0") + private Integer competitionType;*/ + + + @ApiModelProperty(value = "本阶段参赛的团队信息(已经依据当前阶段成绩计算方式计算后的)") + private List stageTeamInformation; +} \ No newline at end of file diff --git a/competition/src/main/java/com/huoran/competition/entity/resp/OverallRankingResp.java b/competition/src/main/java/com/huoran/competition/entity/resp/OverallRankingResp.java new file mode 100644 index 0000000..2cae10f --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/resp/OverallRankingResp.java @@ -0,0 +1,26 @@ +package com.huoran.competition.entity.resp; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + + +@Data +@ApiModel(value = "总排名") +public class OverallRankingResp { + + + + @ApiModelProperty(value = "团队id") + private Integer teamId; + + @ApiModelProperty(value = "分数") + private String score; + + + private List overallRankingRespList; + + +} \ No newline at end of file diff --git a/competition/src/main/java/com/huoran/competition/entity/resp/SchoolResp.java b/competition/src/main/java/com/huoran/competition/entity/resp/SchoolResp.java new file mode 100644 index 0000000..ed5e303 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/resp/SchoolResp.java @@ -0,0 +1,9 @@ +package com.huoran.competition.entity.resp; + +import lombok.Data; + +@Data +public class SchoolResp { + private String schoolId; + private String schoolName; +} diff --git a/competition/src/main/java/com/huoran/competition/entity/resp/ScoreReportResp.java b/competition/src/main/java/com/huoran/competition/entity/resp/ScoreReportResp.java new file mode 100644 index 0000000..56720a0 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/resp/ScoreReportResp.java @@ -0,0 +1,9 @@ +package com.huoran.competition.entity.resp; + +import lombok.Data; + +@Data +public class ScoreReportResp { + private Integer score; + private Integer reportId; +} diff --git a/competition/src/main/java/com/huoran/competition/entity/resp/StageRankingResp.java b/competition/src/main/java/com/huoran/competition/entity/resp/StageRankingResp.java new file mode 100644 index 0000000..4a1827e --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/resp/StageRankingResp.java @@ -0,0 +1,39 @@ +package com.huoran.competition.entity.resp; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +@Data +@ApiModel(value = "阶段赛排名") +public class StageRankingResp { + + @ApiModelProperty(value = "排名") + private Integer ranking; + + + @ApiModelProperty(value = "团队名称") + private String teamName; + + + @ApiModelProperty(value = "队长") + private String captain; + + + @ApiModelProperty(value = "学校") + private String schoolName; + + + @ApiModelProperty(value = "耗时(用于区分线下赛事的耗时)") + private String timeSum; + + + @ApiModelProperty(value = "分数") + private String score; + + + @ApiModelProperty(value = "实验报告Id") + private Integer reportId; + +} \ No newline at end of file diff --git a/competition/src/main/java/com/huoran/competition/entity/resp/TeamAndLeaderResp.java b/competition/src/main/java/com/huoran/competition/entity/resp/TeamAndLeaderResp.java new file mode 100644 index 0000000..66fc8c5 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/resp/TeamAndLeaderResp.java @@ -0,0 +1,35 @@ +package com.huoran.competition.entity.resp; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +@Data +public class TeamAndLeaderResp { + + + @ApiModelProperty(value = "团队Id") + private Integer teamId; + + @ApiModelProperty(value = "团队名称") + private String teamName; + + + @ApiModelProperty(value = "队长") + private String teamLeader; + + + @ApiModelProperty(value = "赛事主键(c_competition表主键)") + private Integer competitionId; + + + @ApiModelProperty(value = "大赛名称") + private String competitionName; + + @ApiModelProperty(value = "学校") + private String schoolName; + + +} \ No newline at end of file diff --git a/competition/src/main/java/com/huoran/competition/entity/resp/TimeConsumingCalculationResp.java b/competition/src/main/java/com/huoran/competition/entity/resp/TimeConsumingCalculationResp.java new file mode 100644 index 0000000..b1b18e5 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/resp/TimeConsumingCalculationResp.java @@ -0,0 +1,28 @@ +package com.huoran.competition.entity.resp; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + + +@Data +@ApiModel(value = "耗时计算") +public class TimeConsumingCalculationResp { + + + @ApiModelProperty(value = "平均耗时", hidden = true) + @JsonIgnore + private String averageTimeConsuming; + + @ApiModelProperty(value = "总耗时", hidden = true) + @JsonIgnore + private String totalTimeSpent; + + @ApiModelProperty(value = "最多耗时", hidden = true) + @JsonIgnore + private String maximumTimeConsuming; + +} \ No newline at end of file diff --git a/competition/src/main/java/com/huoran/competition/entity/resp/TotalRankingScoreDetailsResp.java b/competition/src/main/java/com/huoran/competition/entity/resp/TotalRankingScoreDetailsResp.java new file mode 100644 index 0000000..0cc698a --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/resp/TotalRankingScoreDetailsResp.java @@ -0,0 +1,44 @@ +package com.huoran.competition.entity.resp; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.util.List; + +/** + *

+ * 赛事排名表 + *

+ * + * @author cheney + * @since 2023-01-03 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class TotalRankingScoreDetailsResp { + + @ApiModelProperty(value = "阶段id") + private Integer stageId; + + @ApiModelProperty(value = "阶段名称") + private String stageName; + + @ApiModelProperty(value = "权重(积分赛,所有阶段权和为1)") + private Double pointWeight; + + @ApiModelProperty(value = "团队成绩计算方式(0:最高分,1:平均分,2:总分)") + private String teamCalculationMethod; + + + @ApiModelProperty(value = "赛事规则") + private CompetitionRuleResp competitionRules; + + + @ApiModelProperty(value = "本阶段参赛的团队信息") + private List stageTeamInformation; + + +} diff --git a/competition/src/main/java/com/huoran/competition/entity/resp/UserAccountResp.java b/competition/src/main/java/com/huoran/competition/entity/resp/UserAccountResp.java new file mode 100644 index 0000000..e69b744 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/resp/UserAccountResp.java @@ -0,0 +1,81 @@ +package com.huoran.competition.entity.resp; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @描述:各个平台账号表 + * @作者: Rong + * @日期: 2021-08-25 + */ +@Data +@ApiModel(value = "各个平台账号表") +@TableName("hr_user_account") +public class UserAccountResp implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "主键id(平台用户id)") + private Integer id; + + @ApiModelProperty(value = "用户表id") + private Integer userId; + + @ApiModelProperty(value = "客户表id") + private Integer customerId; + + @ApiModelProperty(value = "账号") + private String account; + + @ApiModelProperty("手机号(平台唯一标识)") + private String phone; + + @ApiModelProperty(value = "密码") + private String password; + + @ApiModelProperty(value = "工号") + private String workNumber; + + @ApiModelProperty(value = "绑定的角色id(0为数据平台普通用户)") + private String roleId; + + @ApiModelProperty(value = "绑定院校id") + private Integer schoolId; + + @ApiModelProperty(value = "所属平台id") + private String platformId; + + @ApiModelProperty(value = "平台(系统)绑定时间") + private Date platformBindTime; + + @ApiModelProperty(value = "平台端区分:0->教师端 1->学生端 2->无端") + private Integer type; + + @ApiModelProperty(value = "是否删除(0、未删除 1、已删除)") + private Integer isDel; + + @ApiModelProperty(value = "是否禁用(0->禁用,1->启用)") + private Boolean isEnable; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "班级id") + @TableField(exist = false) + private String classId; + + @ApiModelProperty(value = "班级id") + @TableField(exist = false) + private String userName; +} \ No newline at end of file diff --git a/competition/src/main/java/com/huoran/competition/entity/vo/CompetitionDetailsVO.java b/competition/src/main/java/com/huoran/competition/entity/vo/CompetitionDetailsVO.java new file mode 100644 index 0000000..4d182e7 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/vo/CompetitionDetailsVO.java @@ -0,0 +1,54 @@ +package com.huoran.competition.entity.vo; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.huoran.competition.entity.resp.CompetitionRangeResp; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + + +@Data +public class CompetitionDetailsVO { + + + @ApiModelProperty(value = "大赛id") + private Integer contestId; + + @ApiModelProperty(value = "大赛名称") + private String contestName; + + @ApiModelProperty(value = "比赛形式(0为个人赛,1为团队赛)默认为0") + private Integer competitionType; + + @ApiModelProperty(value = "赛制(0为积分赛,1为淘汰赛,2为单项赛)") + private Integer rule; + + @ApiModelProperty(value = "阶段数") + private Integer stageNum; + + @ApiModelProperty(value = "赛事开始时间") + private String startTime; + + @ApiModelProperty(value = "赛事结束时间") + private String endTime; + + @ApiModelProperty(value = "比赛方式(0实操,1理论,2线下)默认为0") + private Integer method; + + + @ApiModelProperty(value = "序号(第几阶段)") + private Integer number; + + @ApiModelProperty(value = "阶段名称") + private String stageName; + + @ApiModelProperty(value = "阶段Id") + private Integer stageId; + + + +} diff --git a/competition/src/main/java/com/huoran/competition/entity/vo/CompetitionVO.java b/competition/src/main/java/com/huoran/competition/entity/vo/CompetitionVO.java new file mode 100644 index 0000000..5b8001f --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/vo/CompetitionVO.java @@ -0,0 +1,145 @@ +package com.huoran.competition.entity.vo; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.huoran.competition.entity.CompetitionContent; +import com.huoran.competition.entity.CompetitionStage; +import com.huoran.competition.entity.CompleteCompetitionSetup; +import com.huoran.competition.entity.resp.CompetitionRangeResp; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * @Author chen + * @DATE 2020/10/16 17:13 + * @Version 1.0 + */ +@Data +public class CompetitionVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + private String id; + + @ApiModelProperty(value = "竞赛名称") + private String competitionName; + + @ApiModelProperty(value = "创建人") + private String founderName; + + @ApiModelProperty(value = "大赛范围(0:本校内 1:全平台 2:指定区域、院校)", example = "0") + private Integer competitionScope; + + @ApiModelProperty(value = "平台来源(0:中台,1:职站)", example = "0") + private Integer platformSource; + + @ApiModelProperty(value = "发布状态(0未发布,1已发布)") + private Integer publishStatus; + + @ApiModelProperty(value = "中台是否开启(0开启 1未开启 默认0)", example = "0") + private Integer ztOpen; + + @ApiModelProperty(value = "是否开启(0开启 1未开启 默认0)", example = "0") + private Integer isOpen; + + @ApiModelProperty(value = "报名人数") + private String applicantNum; + + @ApiModelProperty(value = "竞赛开始时间") + private Date playStartTime; + + @ApiModelProperty(value = "竞赛结束时间") + private Date playEndTime; + + @ApiModelProperty(value = "创建时间") + private Date createTime; + + @ApiModelProperty(value = "比赛范围") + private String range; + + @ApiModelProperty(value = "比赛范围(省市学校集合)") + private List contestRangeRespList; + + @ApiModelProperty(value = "比赛阶段") + private List competitionStageList; + + @ApiModelProperty(value = "比赛内容") + private List contentList; + + @ApiModelProperty(value = "赛事设置") + private CompleteCompetitionSetup setup; + + @ApiModelProperty(value = "主办方", example = "或然科技") + private String sponsor; + + @ApiModelProperty(value = "承办方", example = "或然科技") + private String undertaker; + + @ApiModelProperty(value = "竞赛描述", example = "或然科技赛事") + private String description; + + @ApiModelProperty(value = "报名开始时间", example = "2021-09-10 16:24:24") + private Date signUpStartTime; + + @ApiModelProperty(value = "报名结束时间", example = "2021-09-20 16:24:24") + private Date signUpEndTime; + + @ApiModelProperty(value = "创建人Id", example = "1") + private String founderId; + + @ApiModelProperty(value = "竞赛名称", example = "数据库数据库色即是空") + private String name; + + @ApiModelProperty(value = "竞赛封面图", example = "http://localhost:9400/occupationlab/doc.html") + private String coverUrl; + + @ApiModelProperty(value = "竞赛轮播图", example = "http://localhost:9400/occupationlab/doc.html") + private String carouselUrl; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "学校id", example = "0") + private Integer schoolId; + + @ApiModelProperty(value = "是否报名(0为已报名 1为未报名)", example = "0") + private Integer whetherToSignUp; + + @ApiModelProperty(value = "是否禁用,0不禁用,1禁止点击") + private Integer isDisable; + + @ApiModelProperty(value = "团队id") + private Integer teamId; + + @ApiModelProperty(value = "赛事赛制") + private Integer rule; + + @ApiModelProperty(value = "赛事规则id") + private Integer ruleId; + + @ApiModelProperty(value = "报名时间") + private Date registrationTime; + + @ApiModelProperty(value = "发布类型(0发布信息,1完整比赛)默认为0") + private Integer releaseType; + + @ApiModelProperty(value = "赛事类型(0为个人赛,1为团队赛)默认为0") + private Integer competitionType; + + @ApiModelProperty(value = "邀请码") + private Integer invitationCode; + + @ApiModelProperty(value = "是否需要邀请码(0不需要,1需要)默认为0") + private Integer isNeedCode; + + @ApiModelProperty(value = "指定区域名称") + private String locations; + + +} diff --git a/competition/src/main/java/com/huoran/competition/entity/vo/ExcelData.java b/competition/src/main/java/com/huoran/competition/entity/vo/ExcelData.java new file mode 100644 index 0000000..de568fc --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/vo/ExcelData.java @@ -0,0 +1,45 @@ +package com.huoran.competition.entity.vo; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Author chen + * @DATE 2020/10/19 15:34 + * @Version 1.0 + */ +@Data +public class ExcelData { + + @ApiModelProperty(value = "序号") + @Excel(name = "序号", orderNum = "1", isImportField = "rownum", width = 30) + private Integer rownum; + + @ApiModelProperty(value = "学校") + @Excel(name = "学校", orderNum = "2", mergeVertical = true, isImportField = "school", width = 30) + private String school; + + @ApiModelProperty(value = "学生姓名") + @Excel(name = "学生姓名", orderNum = "3", mergeVertical = true, isImportField = "username", width = 30) + private String username; + + + @ApiModelProperty(value = "手机号") + @Excel(name = "手机号", orderNum = "4", mergeVertical = true, isImportField = "phone", width = 30) + private String phone; + + + @ApiModelProperty(value = "学号") + @Excel(name = "学号", orderNum = "5", mergeVertical = true, isImportField = "workNumber", width = 30) + private String workNumber; + + + @ApiModelProperty(value = "报名时间") + @Excel(name = "报名时间", orderNum = "6", mergeVertical = true, isImportField = "createTime", width = 30) + private String createTime; + + @ApiModelProperty(value = "团队名称") + @Excel(name = "团队名称", orderNum = "7", mergeVertical = true, isImportField = "teamName", width = 30) + private String teamName; +} diff --git a/competition/src/main/java/com/huoran/competition/entity/vo/GradeExportVO.java b/competition/src/main/java/com/huoran/competition/entity/vo/GradeExportVO.java new file mode 100644 index 0000000..b80f718 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/vo/GradeExportVO.java @@ -0,0 +1,46 @@ +package com.huoran.competition.entity.vo; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GradeExportVO { + + @ApiModelProperty(value = "序号") + @Excel(name = "序号", orderNum = "1", isImportField = "serialNumber", width = 30) + private Integer serialNumber; + + + @ApiModelProperty(value = "学校名称") + @Excel(name = "学校名称", orderNum = "2", mergeVertical = true, isImportField = "schoolName", width = 30) + private String schoolName; + + @ApiModelProperty(value = "团队名称") + @Excel(name = "团队名称", orderNum = "3", mergeVertical = true, isImportField = "teamName", width = 30, isColumnHidden = false) + private String teamName; + + + @ApiModelProperty(value = "学生姓名") + @Excel(name = "学生姓名", orderNum = "4", mergeVertical = true, isImportField = "userName", width = 30) + private String userName; + + + @ApiModelProperty(value = "学号") + @Excel(name = "学号", orderNum = "5", mergeVertical = true, isImportField = "workNumber", width = 30) + private String workNumber; + + @ApiModelProperty(value = "分数") + @Excel(name = "分数", orderNum = "6", mergeVertical = false, isImportField = "score", width = 30) + private String score; + + @ApiModelProperty("耗时") + @Excel(name = "耗时", orderNum = "7", mergeVertical = false, isImportField = "timeSum", width = 30) + private String timeSum; + + + @ApiModelProperty(value = "提交时间") + @Excel(name = "提交时间", orderNum = "8", mergeVertical = false, isImportField = "submitTime", width = 30) + private String submitTime; + +} diff --git a/competition/src/main/java/com/huoran/competition/entity/vo/ImportCompetitionGradeFailureVO.java b/competition/src/main/java/com/huoran/competition/entity/vo/ImportCompetitionGradeFailureVO.java new file mode 100644 index 0000000..9f41372 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/vo/ImportCompetitionGradeFailureVO.java @@ -0,0 +1,54 @@ +package com.huoran.competition.entity.vo; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import cn.afterturn.easypoi.excel.annotation.ExcelTarget; +import com.huoran.competition.utils.poi.ExcelAttribute; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.ToString; +import lombok.experimental.Accessors; + +@Data +@ToString +@Accessors(chain = true) +@ExcelTarget("ImportCompetitionGradeFailureVo") +public class ImportCompetitionGradeFailureVO { + + //第几行 + private Long index; + + @Excel(name = "团队", orderNum = "1", isImportField = "teamName", width = 30) + @ApiModelProperty(value = "团队") + private String teamName; + + @ApiModelProperty(value = "学生姓名") + @Excel(name = "学生姓名", orderNum = "2", isImportField = "userName", width = 30) + private String userName; + + + @ApiModelProperty(value = "学号") + @Excel(name = "学号", orderNum = "3", isImportField = "workNumber", width = 30) + private String workNumber; + + + @ApiModelProperty(value = "分数") + @Excel(name = "分数", orderNum = "4", isImportField = "score", width = 30) + private String score; + + + @ApiModelProperty(value = "耗时") + @Excel(name = "耗时", orderNum = "5", isImportField = "timeSum", width = 30) + private String timeSum; + + + /*@ApiModelProperty(value = "提交时间") + @Excel(name = "提交时间", orderNum = "6", isImportField = "submitTime", width = 30) + private String submitTime;*/ + @ApiModelProperty(value = "耗时") + @Excel(name = "学校名", orderNum = "7", isImportField = "schoolName", width = 30) + private String schoolName; + + @ExcelAttribute(sort = 8) + @Excel(name = "失败原因", orderNum = "8", isImportField = "failureMsg", width = 50) + private String failureMsg; +} diff --git a/competition/src/main/java/com/huoran/competition/entity/vo/ImportCompetitionRankingFailureVO.java b/competition/src/main/java/com/huoran/competition/entity/vo/ImportCompetitionRankingFailureVO.java new file mode 100644 index 0000000..be9af75 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/vo/ImportCompetitionRankingFailureVO.java @@ -0,0 +1,45 @@ +package com.huoran.competition.entity.vo; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import cn.afterturn.easypoi.excel.annotation.ExcelTarget; +import com.huoran.competition.utils.poi.ExcelAttribute; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.ToString; +import lombok.experimental.Accessors; + +@Data +@ToString +@Accessors(chain = true) +@ExcelTarget("ImportCompetitionRankingFailureVO") +public class ImportCompetitionRankingFailureVO { + + //第几行 + private Long index; + + @Excel(name = "团队", orderNum = "1", isImportField = "teamName", width = 30) + @ApiModelProperty(value = "团队") + private String teamName; + + @ApiModelProperty(value = "队长姓名") + @Excel(name = "队长姓名", orderNum = "2", isImportField = "teamLeader", width = 30) + private String teamLeader; + + @ApiModelProperty(value = "学校名称") + @Excel(name = "学校名称", orderNum = "3", isImportField = "schoolName", width = 30) + private String schoolName; + + + + @ApiModelProperty(value = "耗时") + @Excel(name = "耗时", orderNum = "4", isImportField = "timeSum", width = 30) + private String timeSum; + + @ApiModelProperty(value = "分数") + @Excel(name = "分数", orderNum = "5", isImportField = "score", width = 30) + private String score; + + @ExcelAttribute(sort = 8) + @Excel(name = "失败原因", orderNum = "6", isImportField = "failureMsg", width = 50) + private String failureMsg; +} diff --git a/competition/src/main/java/com/huoran/competition/entity/vo/ImportIndividualRankingFailureVO.java b/competition/src/main/java/com/huoran/competition/entity/vo/ImportIndividualRankingFailureVO.java new file mode 100644 index 0000000..727dc0c --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/vo/ImportIndividualRankingFailureVO.java @@ -0,0 +1,46 @@ +package com.huoran.competition.entity.vo; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import cn.afterturn.easypoi.excel.annotation.ExcelTarget; +import com.huoran.competition.utils.poi.ExcelAttribute; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.ToString; +import lombok.experimental.Accessors; + +@Data +@ToString +@Accessors(chain = true) +@ExcelTarget("ImportIndividualRankingFailureVO") +public class ImportIndividualRankingFailureVO { + + //第几行 + private Long index; + + + @ApiModelProperty(value = "学生姓名") + @Excel(name = "学生姓名", orderNum = "1", isImportField = "userName", width = 30) + private String userName; + + + + @ApiModelProperty(value = "学号") + @Excel(name = "学号", orderNum = "2", isImportField = "workNumber", width = 30) + private String workNumber; + + @ApiModelProperty(value = "学校名称") + @Excel(name = "学校名称", orderNum = "3", isImportField = "schoolName", width = 30) + private String schoolName; + + @ApiModelProperty(value = "耗时") + @Excel(name = "耗时", orderNum = "4", isImportField = "timeSum", width = 30) + private String timeSum; + + @ApiModelProperty(value = "分数") + @Excel(name = "分数", orderNum = "5", isImportField = "score", width = 30) + private String score; + + @ExcelAttribute(sort = 8) + @Excel(name = "失败原因", orderNum = "6", isImportField = "failureMsg", width = 50) + private String failureMsg; +} diff --git a/competition/src/main/java/com/huoran/competition/entity/vo/PersonageRankingExportVO.java b/competition/src/main/java/com/huoran/competition/entity/vo/PersonageRankingExportVO.java new file mode 100644 index 0000000..a269da0 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/vo/PersonageRankingExportVO.java @@ -0,0 +1,34 @@ +package com.huoran.competition.entity.vo; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class PersonageRankingExportVO { + + @ApiModelProperty(value = "序号") + @Excel(name = "序号", orderNum = "1", isImportField = "serialNumber", width = 30) + private Integer serialNumber; + + @ApiModelProperty(value = "学生姓名") + @Excel(name = "学生姓名", orderNum = "2", isImportField = "userName", width = 30) + private String userName; + + + + @ApiModelProperty(value = "学校名称") + @Excel(name = "学校名称", orderNum = "3", isImportField = "schoolName", width = 30) + private String schoolName; + + + @ApiModelProperty("耗时") + @Excel(name = "耗时", orderNum = "4", isImportField = "timeSum", width = 30) + private String timeSum; + + @ApiModelProperty(value = "分数") + @Excel(name = "分数", orderNum = "5", isImportField = "score", width = 30) + private String score; + + +} diff --git a/competition/src/main/java/com/huoran/competition/entity/vo/PersonalDetailVO.java b/competition/src/main/java/com/huoran/competition/entity/vo/PersonalDetailVO.java new file mode 100644 index 0000000..82ed72a --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/vo/PersonalDetailVO.java @@ -0,0 +1,20 @@ +package com.huoran.competition.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class PersonalDetailVO { + + @ApiModelProperty(value = "用户名称") + private String userName; + + @ApiModelProperty(value = "学号") + private String workNumber; + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + @ApiModelProperty(value = "学校名称") + private String schoolName; +} diff --git a/competition/src/main/java/com/huoran/competition/entity/vo/PersonalExcelData.java b/competition/src/main/java/com/huoran/competition/entity/vo/PersonalExcelData.java new file mode 100644 index 0000000..2836cce --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/vo/PersonalExcelData.java @@ -0,0 +1,37 @@ +package com.huoran.competition.entity.vo; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class PersonalExcelData { + + @ApiModelProperty(value = "序号") + @Excel(name = "序号", orderNum = "1", isImportField = "rownum", width = 30) + private Integer rownum; + + @ApiModelProperty(value = "学校") + @Excel(name = "学校", orderNum = "2", mergeVertical = true, isImportField = "school", width = 30) + private String school; + + @ApiModelProperty(value = "学生姓名") + @Excel(name = "学生姓名", orderNum = "3", mergeVertical = true, isImportField = "username", width = 30) + private String username; + + + @ApiModelProperty(value = "手机号") + @Excel(name = "手机号", orderNum = "4", mergeVertical = true, isImportField = "phone", width = 30) + private String phone; + + + @ApiModelProperty(value = "学号") + @Excel(name = "学号", orderNum = "5", mergeVertical = true, isImportField = "workNumber", width = 30) + private String workNumber; + + + @ApiModelProperty(value = "报名时间") + @Excel(name = "报名时间", orderNum = "6", mergeVertical = true, isImportField = "createTime", width = 30) + private String createTime; + +} diff --git a/competition/src/main/java/com/huoran/competition/entity/vo/RankingExportVO.java b/competition/src/main/java/com/huoran/competition/entity/vo/RankingExportVO.java new file mode 100644 index 0000000..1650038 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/vo/RankingExportVO.java @@ -0,0 +1,41 @@ +package com.huoran.competition.entity.vo; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class RankingExportVO { + + @ApiModelProperty(value = "序号") + @Excel(name = "序号", orderNum = "1", isImportField = "serialNumber", width = 30) + private Integer serialNumber; + + @ApiModelProperty(value = "学生姓名") + @Excel(name = "学生姓名", orderNum = "2", isImportField = "userName", width = 30) + private String userName; + + @ApiModelProperty(value = "团队名称") + @Excel(name = "团队名称", orderNum = "3", isImportField = "teamName", width = 30, isColumnHidden = false) + private String teamName; + + + @ApiModelProperty(value = "队长") + @Excel(name = "队长", orderNum = "4", isImportField = "leaderName", width = 30) + private String leaderName; + + @ApiModelProperty(value = "学校名称") + @Excel(name = "学校名称", orderNum = "5", isImportField = "schoolName", width = 30) + private String schoolName; + + + @ApiModelProperty("耗时") + @Excel(name = "耗时", orderNum = "6", isImportField = "timeSum", width = 30) + private String timeSum; + + @ApiModelProperty(value = "分数") + @Excel(name = "分数", orderNum = "7", isImportField = "score", width = 30) + private String score; + + +} diff --git a/competition/src/main/java/com/huoran/competition/entity/vo/RegistrationVO.java b/competition/src/main/java/com/huoran/competition/entity/vo/RegistrationVO.java new file mode 100644 index 0000000..205e08e --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/vo/RegistrationVO.java @@ -0,0 +1,66 @@ +package com.huoran.competition.entity.vo; + +import ch.qos.logback.core.rolling.helper.IntegerTokenConverter; +import cn.afterturn.easypoi.excel.annotation.Excel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class RegistrationVO { + + @ApiModelProperty(value = "序号") + @Excel(name = "序号", orderNum = "1", isImportField = "id", width = 30) + private Integer rownum; + + + @ApiModelProperty(value = "学校") + @Excel(name = "学校", orderNum = "2", mergeVertical = true, isImportField = "school", width = 30) + private String school; + + @ApiModelProperty(value = "学生姓名") + @Excel(name = "学生姓名", orderNum = "3", mergeVertical = true, isImportField = "username", width = 30) + private String username; + + + @ApiModelProperty(value = "手机号") + @Excel(name = "手机号", orderNum = "4", mergeVertical = true, isImportField = "phone", width = 30) + private String phone; + + + @ApiModelProperty(value = "学号") + @Excel(name = "学号", orderNum = "5", mergeVertical = true, isImportField = "workNumber", width = 30) + private String workNumber; + + + @ApiModelProperty(value = "报名时间") + @Excel(name = "报名时间", orderNum = "6", mergeVertical = true, isImportField = "createTime", width = 30) + private String createTime; + + @ApiModelProperty(value = "团队名称") + @Excel(name = "团队名称", orderNum = "7", mergeVertical = true, isImportField = "teamName", width = 30) + private String teamName; + + @ApiModelProperty(value = "团队id") + private Integer teamId; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "用户id") + private Integer userId; + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + @ApiModelProperty(value = "报名id") + private Integer id; + + @ApiModelProperty(value = "是否禁用") + private Integer isDisable; + + @ApiModelProperty(value = "是否队长") + private Integer captain; + + @ApiModelProperty(value = "内部标识") + private Integer identification; +} diff --git a/competition/src/main/java/com/huoran/competition/mapper/CompetitionAnnexMapper.java b/competition/src/main/java/com/huoran/competition/mapper/CompetitionAnnexMapper.java new file mode 100644 index 0000000..a3e29d7 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/mapper/CompetitionAnnexMapper.java @@ -0,0 +1,16 @@ +package com.huoran.competition.mapper; + +import com.huoran.competition.entity.CompetitionAnnex; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 赛事附件表 Mapper 接口 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +public interface CompetitionAnnexMapper extends BaseMapper { + +} diff --git a/competition/src/main/java/com/huoran/competition/mapper/CompetitionAnnouncementAnnexMapper.java b/competition/src/main/java/com/huoran/competition/mapper/CompetitionAnnouncementAnnexMapper.java new file mode 100644 index 0000000..a441751 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/mapper/CompetitionAnnouncementAnnexMapper.java @@ -0,0 +1,16 @@ +package com.huoran.competition.mapper; + +import com.huoran.competition.entity.CompetitionAnnouncementAnnex; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 赛事公告附件表 Mapper 接口 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +public interface CompetitionAnnouncementAnnexMapper extends BaseMapper { + +} diff --git a/competition/src/main/java/com/huoran/competition/mapper/CompetitionAnnouncementMapper.java b/competition/src/main/java/com/huoran/competition/mapper/CompetitionAnnouncementMapper.java new file mode 100644 index 0000000..c2d5fb1 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/mapper/CompetitionAnnouncementMapper.java @@ -0,0 +1,20 @@ +package com.huoran.competition.mapper; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.competition.entity.CompetitionAnnouncement; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 赛事公告表 Mapper 接口 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +public interface CompetitionAnnouncementMapper extends BaseMapper { + + IPage queryAnnouncementByCompetitionId(Page page,@Param("competitionId") String competitionId); +} diff --git a/competition/src/main/java/com/huoran/competition/mapper/CompetitionContentMapper.java b/competition/src/main/java/com/huoran/competition/mapper/CompetitionContentMapper.java new file mode 100644 index 0000000..c0f84bb --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/mapper/CompetitionContentMapper.java @@ -0,0 +1,27 @@ +package com.huoran.competition.mapper; + +import com.huoran.common.response.R; +import com.huoran.competition.entity.CompetitionContent; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +public interface CompetitionContentMapper extends BaseMapper { + + List selectCompetitionContent(@Param("competitionId") String competitionId); + + String selectProjectName(@Param("pid")Integer pid); + + String selectCid(@Param("cid")Integer cid); + + String selectSystem(@Param("systemId")Integer systemId); +} diff --git a/competition/src/main/java/com/huoran/competition/mapper/CompetitionMapper.java b/competition/src/main/java/com/huoran/competition/mapper/CompetitionMapper.java new file mode 100644 index 0000000..ba1ef9a --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/mapper/CompetitionMapper.java @@ -0,0 +1,52 @@ +package com.huoran.competition.mapper; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.competition.entity.Competition; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.competition.entity.CompetitionStage; +import com.huoran.competition.entity.req.AfterLoginPageCompetitionListReq; +import com.huoran.competition.entity.req.CompetitionDetailReq; +import com.huoran.competition.entity.req.PageCompetitionListReq; +import com.huoran.competition.entity.vo.CompetitionDetailsVO; +import com.huoran.competition.entity.vo.CompetitionVO; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 赛事信息表 Mapper 接口 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +public interface CompetitionMapper extends BaseMapper { + + IPage contestPageConditionQueryByOccupationlab(Page page,@Param("req") PageCompetitionListReq pageCompetitionListReq); + + IPage contestPageConditionQueryByNakadai(Page page, @Param("req") PageCompetitionListReq pageCompetitionListReq); + + IPage allContestsByStu(Page page,@Param("req") PageCompetitionListReq pageCompetitionListReq); + + IPage designatedRangeCompetitionByStu(Page page, @Param("req") PageCompetitionListReq req); + + //本校赛事 + IPage schoolCompetition(Page page, @Param("req") AfterLoginPageCompetitionListReq req); + + //赛事广场 + IPage tournamentSquare(Page page, @Param("req") AfterLoginPageCompetitionListReq req); + + IPage registeredBySchoolAndAllPlatforms(Page page,@Param("req") AfterLoginPageCompetitionListReq pageCompetitionListReq); + + IPage registeredBySpecifiedRange(Page page,@Param("req") AfterLoginPageCompetitionListReq pageCompetitionListReq); + + IPage detailsOfCompetitionStage(Page page, @Param("req") CompetitionDetailReq req); + + List selectCompetitionStage(@Param("id") String id,@Param("accountId") Integer accountId); + + IPage tournamentSquareNew(Page page, @Param("req") AfterLoginPageCompetitionListReq pageCompetitionListReq); + + List selectCompetitionStageNew(@Param("ruleId")Integer ruleId,@Param("accountId") Integer accountId); +} diff --git a/competition/src/main/java/com/huoran/competition/mapper/CompetitionProgressMapper.java b/competition/src/main/java/com/huoran/competition/mapper/CompetitionProgressMapper.java new file mode 100644 index 0000000..cc14400 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/mapper/CompetitionProgressMapper.java @@ -0,0 +1,16 @@ +package com.huoran.competition.mapper; + +import com.huoran.competition.entity.CompetitionProgress; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 赛事进展表 Mapper 接口 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +public interface CompetitionProgressMapper extends BaseMapper { + +} diff --git a/competition/src/main/java/com/huoran/competition/mapper/CompetitionRangeMapper.java b/competition/src/main/java/com/huoran/competition/mapper/CompetitionRangeMapper.java new file mode 100644 index 0000000..c37bc58 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/mapper/CompetitionRangeMapper.java @@ -0,0 +1,32 @@ +package com.huoran.competition.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.competition.entity.CompetitionRange; +import com.huoran.competition.entity.resp.CompetitionRangeResp; +import com.huoran.competition.entity.resp.SchoolResp; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 赛事范围表 Mapper 接口 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +public interface CompetitionRangeMapper extends BaseMapper { + + List getRangeByCompetitionId(Integer id); + + List getRangeByContestId(String id); + + List getCity(@Param("cityId") Integer cityId,@Param("provinceId") Integer provinceId); + + List getProvince(@Param("provinceId") Integer provinceId); + + List getSchool(@Param("schoolId") Integer schoolId); + + List getRangeByContestIdNew(@Param("contestId") String id); +} diff --git a/competition/src/main/java/com/huoran/competition/mapper/CompetitionRankingMapper.java b/competition/src/main/java/com/huoran/competition/mapper/CompetitionRankingMapper.java new file mode 100644 index 0000000..dd4ea3a --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/mapper/CompetitionRankingMapper.java @@ -0,0 +1,47 @@ +package com.huoran.competition.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.common.entity.School; +import com.huoran.common.entity.UserScore; +import com.huoran.competition.entity.CompetitionRanking; +import com.huoran.competition.entity.req.BatchUploadListCompetitionReq; +import com.huoran.competition.entity.req.FrontDeskStageTeamScoreDetailsReq; +import com.huoran.competition.entity.req.WhetherToPublishParameterReq; +import com.huoran.competition.entity.resp.ListOfStageResultsResp; +import com.huoran.competition.entity.resp.TeamAndLeaderResp; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 赛事排名表 Mapper 接口 + *

+ * + * @author cheney + * @since 2023-01-03 + */ +public interface CompetitionRankingMapper extends BaseMapper { + + UserScore getexperimentalReportInfo(@Param("req") UserScore userScore); + + + List frontOfficeCompetitionRanking(@Param("req") FrontDeskStageTeamScoreDetailsReq req); + + + School obtainSchoolInformation(@Param("schoolName")String schoolName); + + + TeamAndLeaderResp queryTeamLeaderAndTeamInformation(@Param("resp")TeamAndLeaderResp resp); + + + IPage manuallyRankTheUploadList(Page page, @Param("req") BatchUploadListCompetitionReq req); + + List whetherToPublish(@Param("req") WhetherToPublishParameterReq req); + + List whetherToPublishTheOverallScoreRanking(@Param("req") WhetherToPublishParameterReq req); + + +} diff --git a/competition/src/main/java/com/huoran/competition/mapper/CompetitionRegistrationMapper.java b/competition/src/main/java/com/huoran/competition/mapper/CompetitionRegistrationMapper.java new file mode 100644 index 0000000..1ed5d77 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/mapper/CompetitionRegistrationMapper.java @@ -0,0 +1,35 @@ +package com.huoran.competition.mapper; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.common.entity.School; +import com.huoran.competition.entity.CompetitionRegistration; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.competition.entity.req.PageRegistrationStaffReq; +import com.huoran.competition.entity.vo.RegistrationVO; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 赛事报名人员表 Mapper 接口 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +public interface CompetitionRegistrationMapper extends BaseMapper { + + School selectSchool(Integer schoolId); + + IPage selectRegistrationByCondition(Page page,@Param("req") PageRegistrationStaffReq req); + + int disableByIds(List ids); + + boolean cancelRegistration(@Param("contestId")String contestId, @Param("accountId")Integer accountId); + + IPage selectApplicantByCondition(Page page,@Param("req") PageRegistrationStaffReq req); + + String selectSchoolName(@Param("accountId")String accountId); +} diff --git a/competition/src/main/java/com/huoran/competition/mapper/CompetitionReleaseTimeMapper.java b/competition/src/main/java/com/huoran/competition/mapper/CompetitionReleaseTimeMapper.java new file mode 100644 index 0000000..7661c66 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/mapper/CompetitionReleaseTimeMapper.java @@ -0,0 +1,16 @@ +package com.huoran.competition.mapper; + +import com.huoran.competition.entity.CompetitionReleaseTime; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 赛事排名定时发布表 Mapper 接口 + *

+ * + * @author cheney + * @since 2023-05-30 + */ +public interface CompetitionReleaseTimeMapper extends BaseMapper { + +} diff --git a/competition/src/main/java/com/huoran/competition/mapper/CompetitionRuleMapper.java b/competition/src/main/java/com/huoran/competition/mapper/CompetitionRuleMapper.java new file mode 100644 index 0000000..82aa0bb --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/mapper/CompetitionRuleMapper.java @@ -0,0 +1,25 @@ +package com.huoran.competition.mapper; + +import com.huoran.competition.entity.CompetitionRule; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.competition.entity.CompleteCompetitionSetup; +import com.huoran.competition.entity.resp.CompetitionRuleResp; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 赛事规则表 Mapper 接口 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +public interface CompetitionRuleMapper extends BaseMapper { + CompetitionRule getTheRulesOfTheRaceByTheRaceId(@Param("competitionId") Integer competitionId); + + List acquisitionWeightRatio(@Param("competitionId") Integer competitionId); + + CompetitionRuleResp obtainTheRulesOfTheEvent(@Param("competitionId") Integer competitionId); +} diff --git a/competition/src/main/java/com/huoran/competition/mapper/CompetitionStageContentSettingMapper.java b/competition/src/main/java/com/huoran/competition/mapper/CompetitionStageContentSettingMapper.java new file mode 100644 index 0000000..a7c9cc7 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/mapper/CompetitionStageContentSettingMapper.java @@ -0,0 +1,18 @@ +package com.huoran.competition.mapper; + +import com.huoran.competition.entity.CompetitionStageContentSetting; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + *

+ * 赛事阶段内容设置 Mapper 接口 + *

+ * + * @author cheney + * @since 2023-11-13 + */ +@Mapper +public interface CompetitionStageContentSettingMapper extends BaseMapper { + +} diff --git a/competition/src/main/java/com/huoran/competition/mapper/CompetitionStageFileMapper.java b/competition/src/main/java/com/huoran/competition/mapper/CompetitionStageFileMapper.java new file mode 100644 index 0000000..192c45a --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/mapper/CompetitionStageFileMapper.java @@ -0,0 +1,29 @@ +package com.huoran.competition.mapper; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.common.response.R; +import com.huoran.competition.entity.CompetitionStageFile; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.competition.entity.req.BatchUploadListCompetitionReq; +import com.huoran.competition.entity.req.ContestStageFileReq; +import com.huoran.competition.entity.resp.CompetitionStageFileResp; +import com.huoran.competition.entity.resp.ListOfStageResultsResp; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 赛事阶段文件 Mapper 接口 + *

+ * + * @author cheney + * @since 2023-11-13 + */ +public interface CompetitionStageFileMapper extends BaseMapper { + IPage stageFile(Page page, @Param("req") ContestStageFileReq req); + + String getStudentName(@Param("accountId") Integer accountId); + + + +} diff --git a/competition/src/main/java/com/huoran/competition/mapper/CompetitionStageMapper.java b/competition/src/main/java/com/huoran/competition/mapper/CompetitionStageMapper.java new file mode 100644 index 0000000..985b43f --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/mapper/CompetitionStageMapper.java @@ -0,0 +1,24 @@ +package com.huoran.competition.mapper; + +import com.huoran.competition.entity.CompetitionStage; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.competition.entity.req.DetailsOfTotalTeamScoresReq; +import com.huoran.competition.entity.resp.ListOfStageResultsResp; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 赛事阶段设置表 Mapper 接口 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +public interface CompetitionStageMapper extends BaseMapper { + + List selectCompetitionStageBySetupId(@Param("setupId") Integer setupId); + + List stageTeamInformation(@Param("req")DetailsOfTotalTeamScoresReq req); +} diff --git a/competition/src/main/java/com/huoran/competition/mapper/CompetitionTeamMapper.java b/competition/src/main/java/com/huoran/competition/mapper/CompetitionTeamMapper.java new file mode 100644 index 0000000..f1ba32e --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/mapper/CompetitionTeamMapper.java @@ -0,0 +1,83 @@ +package com.huoran.competition.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.competition.entity.CompetitionStage; +import com.huoran.competition.entity.CompetitionTeam; +import com.huoran.competition.entity.req.FrontDeskStageRankingReq; +import com.huoran.competition.entity.req.StageRankingReq; +import com.huoran.competition.entity.req.StageTeamScoreDetailsReq; +import com.huoran.competition.entity.resp.ListOfStageResultsResp; +import com.huoran.competition.entity.resp.ScoreReportResp; +import com.huoran.competition.entity.resp.TimeConsumingCalculationResp; +import com.huoran.competition.entity.vo.PersonalDetailVO; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 赛事团队表 Mapper 接口 + *

+ * + * @author cheney + * @since 2022-12-02 + */ +public interface CompetitionTeamMapper extends BaseMapper { + + List competitionStage(@Param("competitionId") Integer competitionId, @Param("accountId") String accountId, @Param("teamId") Integer teamId); + + List teamDetail(@Param("ids") List accountIds, @Param("competitionId") Integer competitionId); + + PersonalDetailVO personalDetail(@Param("accountId") String accountId); + + //校验当前学生是否存在团队中 + CompetitionTeam verifyThatStudentsAreInTeam(@Param("team") CompetitionTeam team); + + + //获取团队赛事下的队长所在的团队名称 + String getTheTeamName(@Param("competitionId") Integer competitionId, @Param("teamName") String teamName); + + String getTeamInformation(@Param("competitionId") Integer competitionId); + + + List onlineTeamPointsContest(@Param("req") StageRankingReq req); + + //团队赛求和 + double teamSum(@Param("req") StageRankingReq req); + + //网上个人积分比赛 + List onlineIndividualPointsCompetition(@Param("req") StageRankingReq req); + + + //线下团队得分成绩 + IPage offlineTeamScores(Page page, @Param("req") StageTeamScoreDetailsReq req); + + List offLineTeamPointsCompetition(@Param("req") StageRankingReq req); + + TimeConsumingCalculationResp functionAcquisitionTime(@Param("req") StageRankingReq req); + + TimeConsumingCalculationResp highestScoreTakesTheLeastTime(@Param("req") StageRankingReq req); + + + //线下个人积分赛 + List offlineIndividualPointsCompetition(@Param("req") StageRankingReq req); + + + IPage stageTeamScoreDetails(Page page, @Param("req") StageTeamScoreDetailsReq req); + + IPage multipleStageTeamScoreDetails(Page page, @Param("req") StageTeamScoreDetailsReq req); + + IPage frontDeskIndividualStageRanking(Page page, @Param("req") FrontDeskStageRankingReq req); + + + IPage frontOfficeTeamStageRanking(Page page, @Param("req") FrontDeskStageRankingReq req); + + ScoreReportResp queryResults(@Param("stageId") Integer stageId, @Param("competitionId") Integer competitionId, @Param("accountId") String accountId, @Param("teamId") Integer teamId); + + ListOfStageResultsResp teamLeaderInformation(@Param("competitionId") Integer competitionId, @Param("accountId") Integer accountId); + + + List multipleStageTeamScoreDetails(@Param("req") StageTeamScoreDetailsReq req); +} diff --git a/competition/src/main/java/com/huoran/competition/mapper/CompleteCompetitionSetupMapper.java b/competition/src/main/java/com/huoran/competition/mapper/CompleteCompetitionSetupMapper.java new file mode 100644 index 0000000..00bf67a --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/mapper/CompleteCompetitionSetupMapper.java @@ -0,0 +1,18 @@ +package com.huoran.competition.mapper; + +import com.huoran.competition.entity.CompleteCompetitionSetup; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; +import org.springframework.web.bind.annotation.RequestParam; + +/** + *

+ * 完整赛事设置 Mapper 接口 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +public interface CompleteCompetitionSetupMapper extends BaseMapper { + CompleteCompetitionSetup getRaceSettingsByRaceId(@Param("competitionId") Integer competitionId); +} diff --git a/competition/src/main/java/com/huoran/competition/mapper/TeamInstructorMapper.java b/competition/src/main/java/com/huoran/competition/mapper/TeamInstructorMapper.java new file mode 100644 index 0000000..ef23e18 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/mapper/TeamInstructorMapper.java @@ -0,0 +1,16 @@ +package com.huoran.competition.mapper; + +import com.huoran.competition.entity.TeamInstructor; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 团队指导老师表 Mapper 接口 + *

+ * + * @author cheney + * @since 2022-12-02 + */ +public interface TeamInstructorMapper extends BaseMapper { + +} diff --git a/competition/src/main/java/com/huoran/competition/mapper/TeamParticipantMapper.java b/competition/src/main/java/com/huoran/competition/mapper/TeamParticipantMapper.java new file mode 100644 index 0000000..f3cfaf1 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/mapper/TeamParticipantMapper.java @@ -0,0 +1,16 @@ +package com.huoran.competition.mapper; + +import com.huoran.competition.entity.TeamParticipant; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 团队阶段参赛人员表 Mapper 接口 + *

+ * + * @author cheney + * @since 2022-12-05 + */ +public interface TeamParticipantMapper extends BaseMapper { + +} diff --git a/competition/src/main/java/com/huoran/competition/mapper/UserScoreMapper.java b/competition/src/main/java/com/huoran/competition/mapper/UserScoreMapper.java new file mode 100644 index 0000000..073fd96 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/mapper/UserScoreMapper.java @@ -0,0 +1,33 @@ +package com.huoran.competition.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.common.entity.UserScore; +import com.huoran.competition.entity.req.PageGradeListReq; +import com.huoran.competition.entity.resp.ListOfStageResultsResp; +import com.huoran.competition.entity.resp.UserAccountResp; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @描述:用户分数表 Mapper 接口 + * @作者: Rong + * @日期: 2022-12-08 + */ +@Mapper +public interface UserScoreMapper extends BaseMapper { + + UserAccountResp checkStudentNumberAndName(@Param("userName")String userName,@Param("workNumber")String workNumber,@Param("schoolId")Integer schoolId); + IPage stageGradeManagementList(Page page, @Param("req") PageGradeListReq req); + + IPage stageReportOfExperimentList(Page page, @Param("req") PageGradeListReq req); + + Integer batchDeletionOfExperimentalReports(@Param("ids")List ids); + + String getsTheStartTimeOfThePhase(@Param("stageId") Integer stageId); + + +} \ No newline at end of file diff --git a/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionAnnexMapper.xml b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionAnnexMapper.xml new file mode 100644 index 0000000..c64d2b1 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionAnnexMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionAnnouncementAnnexMapper.xml b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionAnnouncementAnnexMapper.xml new file mode 100644 index 0000000..a909b5e --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionAnnouncementAnnexMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionAnnouncementMapper.xml b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionAnnouncementMapper.xml new file mode 100644 index 0000000..154240e --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionAnnouncementMapper.xml @@ -0,0 +1,18 @@ + + + + + + diff --git a/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionContentMapper.xml b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionContentMapper.xml new file mode 100644 index 0000000..085e720 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionContentMapper.xml @@ -0,0 +1,24 @@ + + + + + + + + + diff --git a/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionMapper.xml b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionMapper.xml new file mode 100644 index 0000000..4a4fa79 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionMapper.xml @@ -0,0 +1,662 @@ + + + + + + + + + + + + + + + + + + + diff --git a/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionProgressMapper.xml b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionProgressMapper.xml new file mode 100644 index 0000000..4e838a3 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionProgressMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionRangeMapper.xml b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionRangeMapper.xml new file mode 100644 index 0000000..ce799a2 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionRangeMapper.xml @@ -0,0 +1,112 @@ + + + + + + + + + + + diff --git a/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionRankingMapper.xml b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionRankingMapper.xml new file mode 100644 index 0000000..80cd38c --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionRankingMapper.xml @@ -0,0 +1,211 @@ + + + + + + + + + + + + + + diff --git a/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionRegistrationMapper.xml b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionRegistrationMapper.xml new file mode 100644 index 0000000..fd58202 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionRegistrationMapper.xml @@ -0,0 +1,137 @@ + + + + + update c_competition_registration set is_disable = 1 where id in + + #{id} + + + + DELETE + FROM c_competition_registration + WHERE competition_id = #{contestId} + and account_id = #{accountId} + + + + + + + diff --git a/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionReleaseTimeMapper.xml b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionReleaseTimeMapper.xml new file mode 100644 index 0000000..ebed9e3 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionReleaseTimeMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionRuleMapper.xml b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionRuleMapper.xml new file mode 100644 index 0000000..432ba0f --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionRuleMapper.xml @@ -0,0 +1,39 @@ + + + + + + + + diff --git a/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionStageContentSettingMapper.xml b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionStageContentSettingMapper.xml new file mode 100644 index 0000000..a503da6 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionStageContentSettingMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionStageFileMapper.xml b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionStageFileMapper.xml new file mode 100644 index 0000000..d6b26af --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionStageFileMapper.xml @@ -0,0 +1,93 @@ + + + + + + + diff --git a/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionStageMapper.xml b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionStageMapper.xml new file mode 100644 index 0000000..5f86802 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionStageMapper.xml @@ -0,0 +1,35 @@ + + + + + + + diff --git a/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionTeamMapper.xml b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionTeamMapper.xml new file mode 100644 index 0000000..751edaa --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionTeamMapper.xml @@ -0,0 +1,546 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/competition/src/main/java/com/huoran/competition/mapper/xml/CompleteCompetitionSetupMapper.xml b/competition/src/main/java/com/huoran/competition/mapper/xml/CompleteCompetitionSetupMapper.xml new file mode 100644 index 0000000..058a8b7 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/mapper/xml/CompleteCompetitionSetupMapper.xml @@ -0,0 +1,10 @@ + + + + + + diff --git a/competition/src/main/java/com/huoran/competition/mapper/xml/TeamInstructorMapper.xml b/competition/src/main/java/com/huoran/competition/mapper/xml/TeamInstructorMapper.xml new file mode 100644 index 0000000..d995179 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/mapper/xml/TeamInstructorMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/competition/src/main/java/com/huoran/competition/mapper/xml/TeamParticipantMapper.xml b/competition/src/main/java/com/huoran/competition/mapper/xml/TeamParticipantMapper.xml new file mode 100644 index 0000000..d6cd3b9 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/mapper/xml/TeamParticipantMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/competition/src/main/java/com/huoran/competition/mapper/xml/UserScoreMapper.xml b/competition/src/main/java/com/huoran/competition/mapper/xml/UserScoreMapper.xml new file mode 100644 index 0000000..f7329a8 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/mapper/xml/UserScoreMapper.xml @@ -0,0 +1,236 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + update ol_experimental_report + set is_del = 1 + WHERE report_id in + + #{id} + + + + + + + + + + + + \ No newline at end of file diff --git a/competition/src/main/java/com/huoran/competition/service/CompetitionAnnexService.java b/competition/src/main/java/com/huoran/competition/service/CompetitionAnnexService.java new file mode 100644 index 0000000..ff9f0ce --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/service/CompetitionAnnexService.java @@ -0,0 +1,19 @@ +package com.huoran.competition.service; + +import com.huoran.competition.entity.CompetitionAnnex; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + *

+ * 赛事附件表 服务类 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +public interface CompetitionAnnexService extends IService { + + List getCompetitionAnnexByCompetitionId(String competitionId); +} diff --git a/competition/src/main/java/com/huoran/competition/service/CompetitionAnnouncementAnnexService.java b/competition/src/main/java/com/huoran/competition/service/CompetitionAnnouncementAnnexService.java new file mode 100644 index 0000000..05d920a --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/service/CompetitionAnnouncementAnnexService.java @@ -0,0 +1,16 @@ +package com.huoran.competition.service; + +import com.huoran.competition.entity.CompetitionAnnouncementAnnex; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 赛事公告附件表 服务类 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +public interface CompetitionAnnouncementAnnexService extends IService { + +} diff --git a/competition/src/main/java/com/huoran/competition/service/CompetitionAnnouncementService.java b/competition/src/main/java/com/huoran/competition/service/CompetitionAnnouncementService.java new file mode 100644 index 0000000..55ab707 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/service/CompetitionAnnouncementService.java @@ -0,0 +1,18 @@ +package com.huoran.competition.service; + +import com.huoran.common.response.R; +import com.huoran.competition.entity.CompetitionAnnouncement; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 赛事公告表 服务类 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +public interface CompetitionAnnouncementService extends IService { + + R queryAnnouncementByCompetitionId(String competitionId, Integer pageNum, Integer pageSize); +} diff --git a/competition/src/main/java/com/huoran/competition/service/CompetitionContentService.java b/competition/src/main/java/com/huoran/competition/service/CompetitionContentService.java new file mode 100644 index 0000000..0c80df2 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/service/CompetitionContentService.java @@ -0,0 +1,23 @@ +package com.huoran.competition.service; + +import com.huoran.common.response.R; +import com.huoran.competition.entity.CompetitionContent; +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.competition.entity.req.CompetitionContentReq; + +/** + *

+ * 服务类 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +public interface CompetitionContentService extends IService { + + R addCompetitionContent(CompetitionContentReq contentReq); + + R getCompetitionContent(String competitionId); + + R editCompetitionContent(CompetitionContentReq contentReq); +} diff --git a/competition/src/main/java/com/huoran/competition/service/CompetitionProgressService.java b/competition/src/main/java/com/huoran/competition/service/CompetitionProgressService.java new file mode 100644 index 0000000..aec6fff --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/service/CompetitionProgressService.java @@ -0,0 +1,17 @@ +package com.huoran.competition.service; + +import com.huoran.competition.entity.CompetitionProgress; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 赛事进展表 服务类 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +public interface CompetitionProgressService extends IService { + + boolean repeat(CompetitionProgress competitionProgress); +} diff --git a/competition/src/main/java/com/huoran/competition/service/CompetitionRangeService.java b/competition/src/main/java/com/huoran/competition/service/CompetitionRangeService.java new file mode 100644 index 0000000..4ae990f --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/service/CompetitionRangeService.java @@ -0,0 +1,32 @@ +package com.huoran.competition.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.common.entity.School; +import com.huoran.competition.entity.CompetitionRange; +import com.huoran.competition.entity.resp.CompetitionRangeResp; +import com.huoran.competition.entity.resp.SchoolResp; + +import java.util.List; + +/** + *

+ * 赛事范围表 服务类 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +public interface CompetitionRangeService extends IService { + + List getCompetitionRangeByCompetitionId(String competitionId); + + List getRangeByCompetitionId(Integer id); + + boolean checkWhetherToParticipate(School school, Integer competitionId); + + List getCity(Integer cityId,Integer provinceId); + + List getProvince(Integer provinceId); + + List getSchool(Integer schoolId); +} diff --git a/competition/src/main/java/com/huoran/competition/service/CompetitionRankingService.java b/competition/src/main/java/com/huoran/competition/service/CompetitionRankingService.java new file mode 100644 index 0000000..205264d --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/service/CompetitionRankingService.java @@ -0,0 +1,53 @@ +package com.huoran.competition.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.common.response.R; +import com.huoran.competition.entity.CompetitionRanking; +import com.huoran.competition.entity.req.BatchUploadListCompetitionReq; +import com.huoran.competition.entity.req.DetailsOfTotalTeamScoresReq; +import com.huoran.competition.entity.req.FrontDeskStageTeamScoreDetailsReq; +import com.huoran.competition.entity.req.OverallStandingsInThePointsRaceReq; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + *

+ * 赛事排名表 服务类 + *

+ * + * @author cheney + * @since 2023-01-03 + */ +public interface CompetitionRankingService extends IService { + Map batchImportRanking(MultipartFile file, Integer competitionId, Integer stageId, Integer isOverallRanking,Integer schoolId) throws IOException; + + Map importIndividualRankingsInBulk(MultipartFile file, Integer competitionId, Integer stageId, Integer isOverallRanking,Integer schoolId) throws IOException; + + void exportFailureRecord(HttpServletResponse response, String token, Integer competitionId) throws Exception; + + R frontOfficeCompetitionRanking(@RequestBody FrontDeskStageTeamScoreDetailsReq req); + +// List frontStageCompetition(@RequestBody FrontStageCompetitionReq req); + + R frontDeskOverallRanking(OverallStandingsInThePointsRaceReq req); + + R detailsOfTotalTeamScores(DetailsOfTotalTeamScoresReq req); + + R manuallyRankTheUploadList(BatchUploadListCompetitionReq req); + + //是否发布阶段排名 + List whetherToPublish(Integer competitionId, Integer stageId, Integer isRelease, Integer publicationType,Integer whetherToPublish); + + + //是否发布总分排名 + List whetherToPublishTheOverallScoreRanking(Integer competitionId, Integer isRelease, Integer publicationType,Integer isOverallRanking); + + R publishRanking(List rankingList); + + +} diff --git a/competition/src/main/java/com/huoran/competition/service/CompetitionRegistrationService.java b/competition/src/main/java/com/huoran/competition/service/CompetitionRegistrationService.java new file mode 100644 index 0000000..491b9d0 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/service/CompetitionRegistrationService.java @@ -0,0 +1,37 @@ +package com.huoran.competition.service; + +import com.huoran.common.entity.School; +import com.huoran.common.response.R; +import com.huoran.competition.entity.CompetitionRegistration; +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.competition.entity.req.PageRegistrationStaffReq; +import com.huoran.competition.entity.vo.RegistrationVO; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; + +/** + *

+ * 赛事报名人员表 服务类 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +public interface CompetitionRegistrationService extends IService { + + School getSchool(Integer schoolId); + + R registrationPageConditionQuery(PageRegistrationStaffReq req); + + boolean disableContests(List ids); + + R cancelRegistration(String contestId, Integer valueOf); + + void export(HttpServletResponse response, PageRegistrationStaffReq req) throws IOException; + + void exportDataInBatches(List listOfExportSub, HttpServletResponse response) throws IOException; + + R apply(CompetitionRegistration competitionRegistration); +} diff --git a/competition/src/main/java/com/huoran/competition/service/CompetitionReleaseTimeService.java b/competition/src/main/java/com/huoran/competition/service/CompetitionReleaseTimeService.java new file mode 100644 index 0000000..32dfc45 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/service/CompetitionReleaseTimeService.java @@ -0,0 +1,16 @@ +package com.huoran.competition.service; + +import com.huoran.competition.entity.CompetitionReleaseTime; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 赛事排名定时发布表 服务类 + *

+ * + * @author cheney + * @since 2023-05-30 + */ +public interface CompetitionReleaseTimeService extends IService { + +} diff --git a/competition/src/main/java/com/huoran/competition/service/CompetitionRuleService.java b/competition/src/main/java/com/huoran/competition/service/CompetitionRuleService.java new file mode 100644 index 0000000..4587afa --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/service/CompetitionRuleService.java @@ -0,0 +1,22 @@ +package com.huoran.competition.service; + +import com.huoran.common.response.R; +import com.huoran.competition.entity.CompetitionRule; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 赛事规则表 服务类 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +public interface CompetitionRuleService extends IService { + + R addCompetitionRule(CompetitionRule competitionRule); + + R getCompetitionRule(String competitionId); + + R editCompetitionRule(CompetitionRule competitionRule); +} diff --git a/competition/src/main/java/com/huoran/competition/service/CompetitionService.java b/competition/src/main/java/com/huoran/competition/service/CompetitionService.java new file mode 100644 index 0000000..8b9fe35 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/service/CompetitionService.java @@ -0,0 +1,46 @@ +package com.huoran.competition.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.huoran.common.response.R; +import com.huoran.competition.entity.Competition; +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.competition.entity.CompetitionStage; +import com.huoran.competition.entity.req.*; +import com.huoran.competition.entity.vo.CompetitionVO; + +import javax.script.ScriptException; +import java.util.List; +import java.util.concurrent.Future; + +/** + *

+ * 赛事信息表 服务类 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +public interface CompetitionService extends IService { + + boolean repeat(Competition competition); + + boolean removeCompetition(Integer competitionId); + + R competitionPageConditionQueryByOccupationlab(PageCompetitionListReq pageCompetitionListReq); + + R competitionPageConditionQueryByNakadai(PageCompetitionListReq pageCompetitionListReq); + + Future> notLoggedInBeforeStudentEvents(PageCompetitionListReq pageCompetitionListReq); + + Future> competitionAfterLogin(AfterLoginPageCompetitionListReq pageCompetitionListReq); + + R addCompetition(Competition competition); + + R detailsOfCompetitionStage(CompetitionDetailReq req); + + R allowedParticipateCompetition(AllowedParticipateCompetitionReq req) throws ScriptException; + + List queryCompetitionStage(String competitionId, String accountId); + + R isParticipant(IsParticipantReq req); +} diff --git a/competition/src/main/java/com/huoran/competition/service/CompetitionStageContentSettingService.java b/competition/src/main/java/com/huoran/competition/service/CompetitionStageContentSettingService.java new file mode 100644 index 0000000..b52f710 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/service/CompetitionStageContentSettingService.java @@ -0,0 +1,16 @@ +package com.huoran.competition.service; + +import com.huoran.competition.entity.CompetitionStageContentSetting; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 赛事阶段内容设置 服务类 + *

+ * + * @author cheney + * @since 2023-11-13 + */ +public interface CompetitionStageContentSettingService extends IService { + +} diff --git a/competition/src/main/java/com/huoran/competition/service/CompetitionStageFileService.java b/competition/src/main/java/com/huoran/competition/service/CompetitionStageFileService.java new file mode 100644 index 0000000..d4ac9bb --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/service/CompetitionStageFileService.java @@ -0,0 +1,30 @@ +package com.huoran.competition.service; + +import com.huoran.common.response.R; +import com.huoran.competition.entity.CompetitionStageFile; +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.competition.entity.req.ContestStageFileReq; +import com.huoran.competition.entity.req.OverallStandingsInThePointsRaceReq; + +import java.util.List; + +/** + *

+ * 赛事阶段文件 服务类 + *

+ * + * @author cheney + * @since 2023-11-13 + */ +public interface CompetitionStageFileService extends IService { + + R stageFile(ContestStageFileReq req); + + List stageAllFiles(ContestStageFileReq req); + + CompetitionStageFile obtainTheFileUploadedInThisPhaseByStu(Integer accountId, Integer competitionId, Integer stageId); + + String getStudentName(Integer accountId); + + CompetitionStageFile checkWhetherTheFileHasBeenUploaded(CompetitionStageFile competitionStageFile); +} diff --git a/competition/src/main/java/com/huoran/competition/service/CompetitionStageService.java b/competition/src/main/java/com/huoran/competition/service/CompetitionStageService.java new file mode 100644 index 0000000..7191d4a --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/service/CompetitionStageService.java @@ -0,0 +1,44 @@ +package com.huoran.competition.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.common.response.R; +import com.huoran.competition.entity.CompetitionStage; +import com.huoran.competition.entity.req.OverallStandingsInThePointsRaceReq; +import com.huoran.competition.entity.req.StageTeamScoreDetailsReq; +import com.huoran.competition.entity.vo.GradeExportVO; +import com.huoran.competition.entity.vo.PersonageRankingExportVO; +import com.huoran.competition.entity.vo.RankingExportVO; + +import javax.script.ScriptException; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; + +/** + *

+ * 赛事阶段设置表 服务类 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +public interface CompetitionStageService extends IService { + + R queryCompetitionStageBySetupId(Integer setupId); + + R stageRaceRanking(Integer competitionId,Integer stageId,Integer pageNum,Integer pageSize,Integer publicationType) throws ScriptException; + + //总分排名 + R overallRanking(OverallStandingsInThePointsRaceReq req); + + R stageTeamScoreDetails(StageTeamScoreDetailsReq req); + R multipleStageTeamScoreDetails(StageTeamScoreDetailsReq req); + + //总分排名得分详情 + R totalRankingScoreDetails(StageTeamScoreDetailsReq req); + + void derivedRanking(List list, HttpServletResponse response) throws IOException; + + void individualDerivedRanking(List list, HttpServletResponse response) throws IOException; + +} diff --git a/competition/src/main/java/com/huoran/competition/service/CompetitionTeamService.java b/competition/src/main/java/com/huoran/competition/service/CompetitionTeamService.java new file mode 100644 index 0000000..9e8efe9 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/service/CompetitionTeamService.java @@ -0,0 +1,23 @@ +package com.huoran.competition.service; + +import com.huoran.common.response.R; +import com.huoran.competition.entity.CompetitionTeam; +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.competition.entity.req.TransferTeamReq; + +import javax.script.ScriptException; + +/** + *

+ * 赛事团队表 服务类 + *

+ * + * @author cheney + * @since 2022-12-02 + */ +public interface CompetitionTeamService extends IService { + + R captainOfTransfer(TransferTeamReq transferTeamReq); + + R entryInformation(Integer competitionId,String accountId,int background) throws ScriptException; +} diff --git a/competition/src/main/java/com/huoran/competition/service/CompleteCompetitionSetupService.java b/competition/src/main/java/com/huoran/competition/service/CompleteCompetitionSetupService.java new file mode 100644 index 0000000..903e12b --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/service/CompleteCompetitionSetupService.java @@ -0,0 +1,16 @@ +package com.huoran.competition.service; + +import com.huoran.competition.entity.CompleteCompetitionSetup; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 完整赛事设置 服务类 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +public interface CompleteCompetitionSetupService extends IService { + CompleteCompetitionSetup getRaceSettingsByRaceId(Integer competitionId); +} diff --git a/competition/src/main/java/com/huoran/competition/service/TeamInstructorService.java b/competition/src/main/java/com/huoran/competition/service/TeamInstructorService.java new file mode 100644 index 0000000..ff02a59 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/service/TeamInstructorService.java @@ -0,0 +1,16 @@ +package com.huoran.competition.service; + +import com.huoran.competition.entity.TeamInstructor; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 团队指导老师表 服务类 + *

+ * + * @author cheney + * @since 2022-12-02 + */ +public interface TeamInstructorService extends IService { + +} diff --git a/competition/src/main/java/com/huoran/competition/service/TeamParticipantService.java b/competition/src/main/java/com/huoran/competition/service/TeamParticipantService.java new file mode 100644 index 0000000..15a96de --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/service/TeamParticipantService.java @@ -0,0 +1,19 @@ +package com.huoran.competition.service; + +import com.huoran.competition.entity.TeamParticipant; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.text.ParseException; + +/** + *

+ * 团队阶段参赛人员表 服务类 + *

+ * + * @author cheney + * @since 2022-12-05 + */ +public interface TeamParticipantService extends IService { + + boolean inTheGame(Integer stageId) throws ParseException; +} diff --git a/competition/src/main/java/com/huoran/competition/service/UserScoreService.java b/competition/src/main/java/com/huoran/competition/service/UserScoreService.java new file mode 100644 index 0000000..af58c64 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/service/UserScoreService.java @@ -0,0 +1,40 @@ +package com.huoran.competition.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.common.entity.UserScore; +import com.huoran.common.response.R; +import com.huoran.competition.entity.req.PageGradeListReq; +import com.huoran.competition.entity.resp.ListOfStageResultsResp; +import com.huoran.competition.entity.vo.GradeExportVO; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * @描述:用户分数表 service接口 + * @作者: Rong + * @日期: 2022-12-08 + */ +public interface UserScoreService extends IService { + Map batchImportGrades(MultipartFile file,Integer competitionId,Integer systemId,Integer stageId,Integer schoolId) throws IOException; + //批量导入失败 + void exportFailureRecord(HttpServletResponse response, String token) throws Exception; + + R stageGradeManagementList(PageGradeListReq req); + + R stageReportOfExperimentList(PageGradeListReq req); + + void exportExperimentalResultsInBatch(List list, HttpServletResponse response) throws IOException; + + + boolean batchDeletionOfExperimentalReports(List ids); + + List getUnpaginatedEventResults(PageGradeListReq req); + + + + +} \ No newline at end of file diff --git a/competition/src/main/java/com/huoran/competition/service/impl/CompetitionAnnexServiceImpl.java b/competition/src/main/java/com/huoran/competition/service/impl/CompetitionAnnexServiceImpl.java new file mode 100644 index 0000000..35f95d0 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/service/impl/CompetitionAnnexServiceImpl.java @@ -0,0 +1,29 @@ +package com.huoran.competition.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.common.constant.DelConstant; +import com.huoran.competition.entity.CompetitionAnnex; +import com.huoran.competition.mapper.CompetitionAnnexMapper; +import com.huoran.competition.service.CompetitionAnnexService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 赛事附件表 服务实现类 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +@Service +public class CompetitionAnnexServiceImpl extends ServiceImpl implements CompetitionAnnexService { + @Override + public List getCompetitionAnnexByCompetitionId(String competitionId) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("competition_id",competitionId); + return baseMapper.selectList(queryWrapper); + } +} diff --git a/competition/src/main/java/com/huoran/competition/service/impl/CompetitionAnnouncementAnnexServiceImpl.java b/competition/src/main/java/com/huoran/competition/service/impl/CompetitionAnnouncementAnnexServiceImpl.java new file mode 100644 index 0000000..4d7aac0 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/service/impl/CompetitionAnnouncementAnnexServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.competition.service.impl; + +import com.huoran.competition.entity.CompetitionAnnouncementAnnex; +import com.huoran.competition.mapper.CompetitionAnnouncementAnnexMapper; +import com.huoran.competition.service.CompetitionAnnouncementAnnexService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 赛事公告附件表 服务实现类 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +@Service +public class CompetitionAnnouncementAnnexServiceImpl extends ServiceImpl implements CompetitionAnnouncementAnnexService { + +} diff --git a/competition/src/main/java/com/huoran/competition/service/impl/CompetitionAnnouncementServiceImpl.java b/competition/src/main/java/com/huoran/competition/service/impl/CompetitionAnnouncementServiceImpl.java new file mode 100644 index 0000000..57de676 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/service/impl/CompetitionAnnouncementServiceImpl.java @@ -0,0 +1,28 @@ +package com.huoran.competition.service.impl; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.common.response.R; +import com.huoran.competition.entity.CompetitionAnnouncement; +import com.huoran.competition.mapper.CompetitionAnnouncementMapper; +import com.huoran.competition.service.CompetitionAnnouncementService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 赛事公告表 服务实现类 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +@Service +public class CompetitionAnnouncementServiceImpl extends ServiceImpl implements CompetitionAnnouncementService { + @Override + public R queryAnnouncementByCompetitionId(String competitionId, Integer pageNum, Integer pageSize) { + Page page = new Page(pageNum, pageSize); + IPage pageList = baseMapper.queryAnnouncementByCompetitionId(page, competitionId); + return R.ok().put("data", pageList); + } +} diff --git a/competition/src/main/java/com/huoran/competition/service/impl/CompetitionContentServiceImpl.java b/competition/src/main/java/com/huoran/competition/service/impl/CompetitionContentServiceImpl.java new file mode 100644 index 0000000..e021d40 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/service/impl/CompetitionContentServiceImpl.java @@ -0,0 +1,117 @@ +package com.huoran.competition.service.impl; + +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.common.response.R; +import com.huoran.competition.entity.CompetitionContent; +import com.huoran.competition.entity.CompetitionStageContentSetting; +import com.huoran.competition.entity.req.CompetitionContentReq; +import com.huoran.competition.mapper.CompetitionContentMapper; +import com.huoran.competition.mapper.CompetitionStageContentSettingMapper; +import com.huoran.competition.service.CompetitionContentService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 服务实现类 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +@Service +public class CompetitionContentServiceImpl extends ServiceImpl implements CompetitionContentService { + + @Autowired + CompetitionStageContentSettingMapper stageContentSettingMapper; + +// @Autowired +// private XxlJobService xxlJobService; + + @Override + public R addCompetitionContent(CompetitionContentReq contentReq) { + List competitionContents = contentReq.getCompetitionContents(); + competitionContents.forEach(competitionContent -> { + + if (!ObjectUtil.isEmpty(competitionContent.getCompetitionStageContentSetting())){ + //添加线下赛事内容 + stageContentSettingMapper.insert(competitionContent.getCompetitionStageContentSetting()); + } + baseMapper.insert(competitionContent); + //新增定时关闭 +// if (competitionContent.getEndTime()!=null && competitionContent.getEndTime().after(new Date())) { +// DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); +// Integer stopTaskId = null; +// try { +// stopTaskId = xxlJobService.addJustExecuteOnceJob(competitionContent.getStageId()+"stop", dateFormat.parse(dateFormat.format(competitionContent.getEndTime())),competitionContent.getStageId().toString(), "competitionStop"); +// } catch (ParseException e) { +// throw new RuntimeException(e); +// } +// //开始运行停止考核任务 +// xxlJobService.start(stopTaskId); +// } + }); + return R.ok(); + } + + @Override + public R getCompetitionContent(String competitionId) { + List contentList = baseMapper.selectCompetitionContent(competitionId); + contentList.forEach(competitionContent -> { + String cName = baseMapper.selectCid(competitionContent.getCid()); + String projectName = baseMapper.selectProjectName(competitionContent.getProjectId()); + competitionContent.setCName(cName); + competitionContent.setProjectName(projectName); + }); + + return R.ok().put("contentList",contentList); + } + + @Override + public R editCompetitionContent(CompetitionContentReq contentReq) { + List competitionContents = contentReq.getCompetitionContents(); + competitionContents.forEach(competitionContent -> { + if (competitionContent.getContentId()==null){ + baseMapper.insert(competitionContent); + }else{ + if (!ObjectUtil.isEmpty(competitionContent.getCompetitionStageContentSetting())){ + //编辑线下赛事内容 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("stage_id",competitionContent.getStageId()); + CompetitionStageContentSetting stageContentSetting = stageContentSettingMapper.selectOne(queryWrapper); + if (!ObjectUtil.isEmpty(stageContentSetting)){ + stageContentSettingMapper.updateById(competitionContent.getCompetitionStageContentSetting()); + }else { + //新增线下赛事内容 + stageContentSettingMapper.insert(competitionContent.getCompetitionStageContentSetting()); + } + + } + baseMapper.updateById(competitionContent); + //删除已存在的考核定时任务 +// Integer removeStopTaskId = xxlJobService.getJobIdByCustomId(competitionContent.getStageId() + "stop"); + //删除任务 +// if (!ObjectUtils.isEmpty(removeStopTaskId)) { +// xxlJobService.remove(removeStopTaskId); +// } +// //新增定时关闭,结束时间不为空并且结束时间晚于当前时间 +// if (competitionContent.getEndTime()!=null && competitionContent.getEndTime().after(new Date())) { +// DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); +// Integer stopTaskId = null; +// try { +// stopTaskId = xxlJobService.addJustExecuteOnceJob(competitionContent.getStageId()+"stop", dateFormat.parse(dateFormat.format(competitionContent.getEndTime())),competitionContent.getStageId().toString(), "competitionStop"); +// } catch (ParseException e) { +// throw new RuntimeException(e); +// } +// //开始运行停止赛事任务 +// xxlJobService.start(stopTaskId); +// } + } + }); + return R.ok(); + } +} diff --git a/competition/src/main/java/com/huoran/competition/service/impl/CompetitionProgressServiceImpl.java b/competition/src/main/java/com/huoran/competition/service/impl/CompetitionProgressServiceImpl.java new file mode 100644 index 0000000..ff5aa06 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/service/impl/CompetitionProgressServiceImpl.java @@ -0,0 +1,28 @@ +package com.huoran.competition.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.competition.entity.CompetitionProgress; +import com.huoran.competition.mapper.CompetitionProgressMapper; +import com.huoran.competition.service.CompetitionProgressService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 赛事进展表 服务实现类 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +@Service +public class CompetitionProgressServiceImpl extends ServiceImpl implements CompetitionProgressService { + @Override + public boolean repeat(CompetitionProgress competitionProgress) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("title", competitionProgress.getTitle()); + wrapper.eq("competition_id", competitionProgress.getCompetitionId()); + Integer count = baseMapper.selectCount(wrapper); + return count > 0; + } +} diff --git a/competition/src/main/java/com/huoran/competition/service/impl/CompetitionRangeServiceImpl.java b/competition/src/main/java/com/huoran/competition/service/impl/CompetitionRangeServiceImpl.java new file mode 100644 index 0000000..a0bded5 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/service/impl/CompetitionRangeServiceImpl.java @@ -0,0 +1,86 @@ +package com.huoran.competition.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.common.entity.School; +import com.huoran.competition.entity.CompetitionRange; +import com.huoran.competition.entity.resp.CompetitionRangeResp; +import com.huoran.competition.entity.resp.SchoolResp; +import com.huoran.competition.mapper.CompetitionRangeMapper; +import com.huoran.competition.service.CompetitionRangeService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 赛事范围表 服务实现类 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +@Service +public class CompetitionRangeServiceImpl extends ServiceImpl implements CompetitionRangeService { + + @Override + public List getCompetitionRangeByCompetitionId(String competitionId) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("competition_id", competitionId); + return baseMapper.selectList(queryWrapper); + } + + @Override + public List getRangeByCompetitionId(Integer id) { + return baseMapper.getRangeByCompetitionId(id); + } + + @Override + public boolean checkWhetherToParticipate(School school, Integer competitionId) { + //校验地区范围为学校的标准 + QueryWrapper queryWrapper1 = new QueryWrapper<>(); + queryWrapper1.eq("type", 0); + queryWrapper1.eq("is_del", 0); + queryWrapper1.eq("school_id", school.getSchoolId()); + queryWrapper1.eq("competition_id", competitionId); + List schoolList1 = baseMapper.selectList(queryWrapper1); + + //校验地区范围为省的标准 + QueryWrapper queryWrapper2 = new QueryWrapper<>(); + queryWrapper2.eq("competition_id", competitionId); + queryWrapper2.eq("type", 1); + queryWrapper2.eq("is_del", 0); + queryWrapper2.eq("province_id", school.getProvinceId()); + List schoolList2 = baseMapper.selectList(queryWrapper2); + + //校验地区范围为市的标准 + QueryWrapper queryWrapper3 = new QueryWrapper<>(); + queryWrapper3.eq("type", 1); + queryWrapper3.eq("is_del", 0); + queryWrapper3.eq("province_id", school.getProvinceId()); + queryWrapper3.eq("city_id", school.getCityId()); + queryWrapper3.eq("competition_id", competitionId); + List schoolList3 = baseMapper.selectList(queryWrapper3); + + if (schoolList1.size() <= 0 && schoolList2.size() <= 0 && schoolList3.size() <= 0) { + return true; //你所在院校不符合参赛要求,无法报名! + } + + return false; + } + + @Override + public List getCity(Integer cityId,Integer provinceId) { + return baseMapper.getCity(cityId,provinceId); + } + + @Override + public List getProvince(Integer provinceId) { + return baseMapper.getProvince(provinceId); + } + + @Override + public List getSchool(Integer schoolId) { + return baseMapper.getSchool(schoolId); + } +} diff --git a/competition/src/main/java/com/huoran/competition/service/impl/CompetitionRankingServiceImpl.java b/competition/src/main/java/com/huoran/competition/service/impl/CompetitionRankingServiceImpl.java new file mode 100644 index 0000000..ccf9788 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/service/impl/CompetitionRankingServiceImpl.java @@ -0,0 +1,999 @@ +package com.huoran.competition.service.impl; + +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.entity.ExportParams; +import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.TypeReference; +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.huoran.common.constant.DelConstant; +import com.huoran.common.constant.TeamCalculationMethodConstant; +import com.huoran.common.entity.School; +import com.huoran.common.exception.CustomException; +import com.huoran.common.exception.ExceptionEnum; +import com.huoran.common.response.R; +import com.huoran.competition.entity.CompetitionRanking; +import com.huoran.competition.entity.CompetitionRule; +import com.huoran.competition.entity.CompetitionStage; +import com.huoran.competition.entity.CompleteCompetitionSetup; +import com.huoran.competition.entity.req.*; +import com.huoran.competition.entity.resp.*; +import com.huoran.competition.entity.vo.ImportCompetitionRankingFailureVO; +import com.huoran.competition.entity.vo.ImportIndividualRankingFailureVO; +import com.huoran.competition.mapper.*; +import com.huoran.competition.service.CompetitionRankingService; +import com.huoran.competition.utils.ExcelImporEventResultstHelper; +import com.huoran.competition.utils.ExcelStyleUtil; +import com.huoran.competition.utils.poi.CommonCode; +import com.huoran.competition.utils.poi.ExceptionCast; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.data.redis.core.ValueOperations; +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.net.URLEncoder; +import java.util.*; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +/** + *

+ * 赛事排名表 服务实现类 + *

+ * + * @author cheney + * @since 2023-01-03 + */ +@Service +public class CompetitionRankingServiceImpl extends ServiceImpl implements CompetitionRankingService { + @Autowired + private UserScoreMapper userScoreMapper; + + @Resource + StringRedisTemplate stringRedisTemplate; + @Autowired + private CompetitionTeamMapper teamMapper; + @Autowired + CompleteCompetitionSetupMapper competitionSetupMapper; + @Autowired + CompetitionRuleMapper ruleMapper; + @Autowired + CompetitionStageMapper stageMapper; + + /** + * 团队批量导入排名 + * + * @param file + * @param competitionId + * @param stageId + * @param isOverallRanking + * @return + * @throws IOException + */ + @Override + public Map batchImportRanking(MultipartFile file, Integer competitionId, Integer stageId, Integer isOverallRanking, Integer schoolId) throws IOException { + List impGradeReqList = ExcelImporEventResultstHelper.readRanking(file); + List returnedSet = new ArrayList<>(); + if (impGradeReqList.size() <= 0) { + //小于等于0为上传空模板的情况下 抛出异常 + throw new CustomException(ExceptionEnum.EXCEL_FILE_FORMAT_ERROR); + } + int count = 0; + List failVo1 = new ArrayList(); + // 参数合法性校验,只能上传.xlsx后缀的文件 + if (org.apache.commons.lang3.StringUtils.isBlank(file.getOriginalFilename()) || !file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")).equals(".xlsx")) { + ExceptionCast.cast(CommonCode.EXCEL_FILE_INVALID); + } + int size = impGradeReqList.size(); + Map map = new HashMap<>(); + Long ii = 1L;//用于记录序列号 + Integer countNum = 0;//用于失败原因排序 eg:1、XXXXX 2、XXXXXXX + try { + Integer countSuccess = 0;//统计成功次数 + Integer countError = 0;//统计失败次数 + + List workNumberList = new ArrayList<>();//用来储存新增前用户在excel中输入的所有工号用于excel中的数据判重 + for (int i = 0; i < impGradeReqList.size(); i++) { + boolean ret = true; + ++ii; + ExcelImpRankReq req = impGradeReqList.get(i); + + ImportCompetitionRankingFailureVO vo1 = new ImportCompetitionRankingFailureVO(); + + String errMsg = ""; + //去除Excel中的全角半角空格 + + //团队名称 + String getTeamName = req.getTeamName().replaceAll("\\u00A0", "").trim(); + //队长名称 + String teamLeader = req.getUserName().replaceAll("\\u00A0", "").trim(); + String getSchoolName = req.getSchoolName().replaceAll("\\u00A0", "").trim(); + String getScore = req.getScore().replaceAll("\\u00A0", "").trim(); + String getTimeSum = req.getTimeSum().replaceAll("\\u00A0", "").trim(); + + + vo1.setIndex(ii); + + + //检验团队名称 + if (getTeamName.equals("")) { + ++countNum; + vo1.setTeamName(getTeamName + " *必填项:(团队不能为空) "); + errMsg += countNum + "必填项:(团队不能为空)"; + ret = false; + countError++; + } else { + vo1.setTeamName(getTeamName); + } + + //检验姓名 + if (teamLeader.equals("")) { + ++countNum; + vo1.setTeamLeader(teamLeader + " *必填项:(队长姓名不能为空) "); + errMsg += countNum + "必填项:(队长姓名不能为空)"; + ret = false; + countError++; + } else { + vo1.setTeamLeader(teamLeader); + } + + + //检验学校名称 + if (getSchoolName.equals("")) { + ++countNum; + vo1.setSchoolName(getSchoolName + " *必填项:(学校不能为空) "); + errMsg += countNum + "必填项:(学校不能为空)"; + ret = false; + countError++; + } else { + vo1.setSchoolName(getSchoolName); + } + + + School school = baseMapper.obtainSchoolInformation(getSchoolName); + if (school == null) { + ++countNum; + vo1.setSchoolName(getSchoolName + " *必填项:(该学校不存在) "); + errMsg += countNum + "必填项:(该学校不存在)"; + ret = false; + countError++; + } + + + //检验分数 + if (getScore.equals("")) { + ++countNum; + vo1.setScore(getScore + " *必填项:(分数不能为空) "); + errMsg += countNum + "必填项:(分数不能为空)"; + ret = false; + countError++; + } else { + vo1.setScore(getScore); + } + + + //检验耗时 + if (getTimeSum.equals("")) { + ++countNum; + vo1.setScore(getTimeSum + " *必填项:(耗时不能为空) "); + errMsg += countNum + "必填项:(耗时不能为空)"; + ret = false; + countError++; + } else { + vo1.setTimeSum(getTimeSum); + } + + + if (!getTimeSum.equals("")) { + if (isLong(getTimeSum) == false) { + ++countNum; + vo1.setTimeSum(getTimeSum + " *必填项:(耗时请填写整数,不含小数点) "); + errMsg += countNum + "必填项:(耗时请填写整数,不含小数点)"; + ret = false; + countError++; + } else { + vo1.setTimeSum(getTimeSum); + } + } + TeamAndLeaderResp resp = null; + + //检验团队信息和队长以及大赛 + if (!getTeamName.equals("") && !teamLeader.equals("")) { + TeamAndLeaderResp query = new TeamAndLeaderResp(); + query.setCompetitionId(competitionId); + query.setTeamLeader(teamLeader); + query.setTeamName(getTeamName); + resp = baseMapper.queryTeamLeaderAndTeamInformation(query); + + if (resp == null) { + ++countNum; + vo1.setTeamLeader(teamLeader + " *必填项:(团队信息和队长信息不匹配) "); + vo1.setTeamName(getTeamName + " *必填项:(团队信息和队长信息不匹配) "); + errMsg += countNum + "必填项:(团队信息和队长信息不匹配,请输入正确的团队以及队长信息)"; + ret = false; + countError++; + } else { + vo1.setTeamLeader(teamLeader); + vo1.setTeamName(getTeamName); + } + + + } + + + vo1.setFailureMsg(errMsg); + countNum = 0; + + failVo1.add(vo1); + + //ret判断 新增成功的插入到ol_user_score表 否则则不新增至数据库 + if (ret) { + /*//执行新增到操作 + CompetitionRanking ranking = new CompetitionRanking(); + ranking.setScore(getScore); + ranking.setCompetitionId(competitionId);//赛事id + ranking.setTimeSum(Integer.valueOf(getTimeSum));//耗时 + ranking.setStageId(stageId); + ranking.setIsOverallRanking(isOverallRanking); + if (school.getSchoolId() != null) { + ranking.setSchoolId(school.getSchoolId()); + } + baseMapper.insert(ranking); + //countSuccess:统计累计成功次数 + countSuccess++;*/ + + + //notice:存到list中返回给前端 点击确认发布排名后传入list再发布(批量导入后不直接存入数据库要再次确认才发布) + CompetitionRanking ranking = new CompetitionRanking(); + ranking.setScore(getScore); + ranking.setCompetitionId(competitionId);//赛事id + ranking.setTimeSum(getTimeSum);//耗时 + ranking.setStageId(stageId); + ranking.setPublicationType(DelConstant.PUBLICATION_TYPE_MANUALOPERATION); + + ranking.setIsOverallRanking(isOverallRanking); + if (resp != null) { + ranking.setTeamId(resp.getTeamId()); + ranking.setLeaderName(resp.getTeamLeader()); + ranking.setTeamName(resp.getTeamName()); + } + + if (school.getSchoolId() != null) { + ranking.setSchoolId(school.getSchoolId()); + ranking.setSchoolName(resp.getSchoolName()); + } + returnedSet.add(ranking); + } + } + String exportCode = ""; + + + Integer numberOfSuccesses = 0; + if (returnedSet != null) { + //降序排列 + //多条件-先年龄升序、后分数升序 + Collections.sort(returnedSet, new Comparator() { + public int compare(CompetitionRanking s1, CompetitionRanking s2) { + int i = Double.valueOf(s2.getScore()).compareTo(Double.valueOf(s1.getScore())); + if (i == 0) { + i = s1.getTimeSum().compareTo(s2.getTimeSum()); + } + return i; + } + }); + + for (CompetitionRanking r : returnedSet) { + Integer ret = baseMapper.insert(r); + if (ret == 1) { + numberOfSuccesses++; + } + } + + + } + + + // 有导入失败的数据,才会存入redis + if (countError > 0) { + //生成token + exportCode = "FAILURE_IMPORT" + UUID.randomUUID().toString().replace("-", ""); + ValueOperations ops = stringRedisTemplate.opsForValue(); + + List collect = failVo1.stream().filter(importStaffFailureVo -> { + return !importStaffFailureVo.getFailureMsg().equals(""); + }).collect(Collectors.toList()); + + String failureVOJson = JSON.toJSONString(collect); + ops.set(exportCode, failureVOJson, 30 * 60, TimeUnit.SECONDS); + } + + + map.put("exportCode", exportCode);//返回导出code + map.put("successNum", numberOfSuccesses + "");//本次新增成功数量 + map.put("failureNum", countError);//本次新增失败数量 + map.put("data", returnedSet); + return map; + } catch (RuntimeException e) { + System.err.println(e.getMessage()); + throw new RuntimeException(); + } + } + + @Override + public Map importIndividualRankingsInBulk(MultipartFile file, Integer competitionId, Integer stageId, Integer isOverallRanking, Integer schoolId) throws IOException { + List impGradeReqList = ExcelImporEventResultstHelper.readIndividualRanking(file); + + if (impGradeReqList.size() <= 0) { + //小于等于0为上传空模板的情况下 抛出异常 + throw new CustomException(ExceptionEnum.EXCEL_FILE_FORMAT_ERROR); + } + int count = 0; + List failVo1 = new ArrayList(); + // 参数合法性校验,只能上传.xlsx后缀的文件 + if (org.apache.commons.lang3.StringUtils.isBlank(file.getOriginalFilename()) || !file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")).equals(".xlsx")) { + ExceptionCast.cast(CommonCode.EXCEL_FILE_INVALID); + } + + List returnedSet = new ArrayList<>(); + int size = impGradeReqList.size(); + Map map = new HashMap<>(); + Long ii = 1L;//用于记录序列号 + Integer countNum = 0;//用于失败原因排序 eg:1、XXXXX 2、XXXXXXX + try { + Integer countSuccess = 0;//统计成功次数 + Integer countError = 0;//统计失败次数 + + List workNumberList = new ArrayList<>();//用来储存新增前用户在excel中输入的所有工号用于excel中的数据判重 + for (int i = 0; i < impGradeReqList.size(); i++) { + boolean ret = true; + ++ii; + ExcelImpRankReq req = impGradeReqList.get(i); + + ImportIndividualRankingFailureVO vo1 = new ImportIndividualRankingFailureVO(); + + String errMsg = ""; + //去除Excel中的全角半角空格 + String getUserName = req.getUserName().replaceAll("\\u00A0", "").trim(); + String getWorkNumber = req.getWorkNumber().replaceAll("\\u00A0", "").trim(); + String getSchoolName = req.getSchoolName().replaceAll("\\u00A0", "").trim(); + String getScore = req.getScore().replaceAll("\\u00A0", "").trim(); + String getTimeSum = req.getTimeSum().replaceAll("\\u00A0", "").trim(); + + + vo1.setIndex(ii); + + if (!workNumberList.contains(req.getWorkNumber())) { + workNumberList.add(req.getWorkNumber()); + } else { + if (!getWorkNumber.equals("")) { + //包含excel数据中存在相同工号 + ++countNum; + vo1.setWorkNumber(getWorkNumber + " *必填项:(当前Excel数据中该工号已存在重复的!)"); + errMsg += countNum + " *必填项:(当前Excel数据中该工号已存在重复的)"; + ret = false; + } + + } + + + //检验姓名 + if (getUserName.equals("")) { + ++countNum; + vo1.setUserName(getUserName + " *必填项:(姓名不能为空) "); + errMsg += countNum + "必填项:(姓名不能为空)"; + ret = false; + countError++; + } else { + vo1.setUserName(getUserName); + } + + + //检验学校名称 + if (getSchoolName.equals("")) { + ++countNum; + vo1.setSchoolName(getSchoolName + " *必填项:(学校不能为空) "); + errMsg += countNum + "必填项:(学校不能为空)"; + ret = false; + countError++; + } else { + vo1.setSchoolName(getSchoolName); + } + + + //校验学号是否存在汉字 + if (!getWorkNumber.trim().equals("")) { + if (ExcelImporEventResultstHelper.isContainChinese(getWorkNumber)) { + ++countNum; + vo1.setWorkNumber(getWorkNumber + "* 学号不能存在汉字!"); + errMsg += countNum + " * 学号不能存在汉字!"; + ret = false; + countError++; + } + } + + + //检验工号 + if (getWorkNumber.equals("")) { + ++countNum; + vo1.setWorkNumber(getWorkNumber + " *必填项:(学号不能为空)"); + errMsg += countNum + " *必填项:(学号不能为空)"; + ret = false; + countError++; + } else { + vo1.setWorkNumber(getWorkNumber); + } + + + //检验姓名 + if (getUserName.equals("")) { + ++countNum; + vo1.setUserName(getUserName + " *必填项:(姓名不能为空) "); + errMsg += countNum + "必填项:(姓名不能为空)"; + ret = false; + countError++; + } else { + vo1.setUserName(getUserName); + } + + School school = baseMapper.obtainSchoolInformation(getSchoolName); + if (school == null) { + ++countNum; + vo1.setSchoolName(getSchoolName + " *必填项:(该学校不存在) "); + errMsg += countNum + "必填项:(该学校不存在)"; + ret = false; + countError++; + } + + UserAccountResp checkStudentNumberAndName = null; + //校验学号和姓名是否为同一个人 如果是同一人则获取到账号id + if (!getUserName.equals("") && !getWorkNumber.equals("")) { + //checkStudentNumberAndName检测用户名和学号以及学校是否是同一人 + if (school!=null){ + checkStudentNumberAndName = userScoreMapper.checkStudentNumberAndName(getUserName, getWorkNumber, school.getSchoolId()); + } + + + if (checkStudentNumberAndName == null) { + if (!getUserName.equals("") && !getWorkNumber.equals("")) { + ++countNum; + vo1.setWorkNumber(getWorkNumber + " *必填项:(学号与学生姓名不匹配)"); + vo1.setUserName(getUserName + " *必填项:(学生姓名与学号不匹配!)"); + errMsg += countNum + " *必填项:(学号与学生姓名不匹配!)"; + ret = false; + countError++; + } + } + } + + + //检验分数 + if (getScore.equals("")) { + ++countNum; + vo1.setScore(getScore + " *必填项:(分数不能为空) "); + errMsg += countNum + "必填项:(分数不能为空)"; + ret = false; + countError++; + } else { + vo1.setScore(getScore); + } + + + //检验耗时 + if (getTimeSum.equals("")) { + ++countNum; + vo1.setScore(getTimeSum + " *必填项:(耗时不能为空) "); + errMsg += countNum + "必填项:(耗时不能为空)"; + ret = false; + countError++; + } else { + vo1.setTimeSum(getTimeSum); + } + + + if (!getTimeSum.equals("")) { + if (isLong(getTimeSum) == false) { + ++countNum; + vo1.setTimeSum(getTimeSum + " *必填项:(耗时请填写整数,不含小数点) "); + errMsg += countNum + "必填项:(耗时请填写整数,不含小数点)"; + ret = false; + countError++; + } else { + vo1.setTimeSum(getTimeSum); + } + } + + + vo1.setFailureMsg(errMsg); + countNum = 0; + + failVo1.add(vo1); + + //ret判断 新增成功的插入到ol_user_score表 否则则不新增至数据库 + if (ret) { + /* + //执行新增到操作 + CompetitionRanking ranking = new CompetitionRanking(); + ranking.setScore(getScore); + ranking.setCompetitionId(competitionId);//赛事id + ranking.setTimeSum(Integer.valueOf(getTimeSum));//耗时 + ranking.setStageId(stageId); + ranking.setIsOverallRanking(isOverallRanking); + ranking.setAccountId(checkStudentNumberAndName.getId()); + if (school.getSchoolId() != null) { + ranking.setSchoolId(school.getSchoolId()); + } + baseMapper.insert(ranking); + //countSuccess:统计累计成功次数 + countSuccess++;*/ + + //notice:存到list中返回给前端 点击确认发布排名后传入list再发布(批量导入后不直接存入数据库要再次确认才发布) + CompetitionRanking ranking = new CompetitionRanking(); + ranking.setScore(getScore); + ranking.setCompetitionId(competitionId);//赛事id + ranking.setTimeSum(getTimeSum);//耗时 + ranking.setStageId(stageId); + ranking.setIsOverallRanking(isOverallRanking); + ranking.setAccountId(checkStudentNumberAndName.getId()); + //ranking.setIsRelease(1);//是否发布(默认0未发布 1已发布) + ranking.setPublicationType(1); + if (school.getSchoolId() != null) { + ranking.setSchoolId(school.getSchoolId()); + } + + + returnedSet.add(ranking); + + } + } + String exportCode = ""; + + // 有导入失败的数据,才会存入redis + if (countError > 0) { + //生成token + exportCode = "FAILURE_IMPORT" + UUID.randomUUID().toString().replace("-", ""); + ValueOperations ops = stringRedisTemplate.opsForValue(); + + List collect = failVo1.stream().filter(importStaffFailureVo -> { + return !importStaffFailureVo.getFailureMsg().equals(""); + }).collect(Collectors.toList()); + + String failureVOJson = JSON.toJSONString(collect); + ops.set(exportCode, failureVOJson, 30 * 60, TimeUnit.SECONDS); + } + + Integer numberOfSuccesses = 0; + if (returnedSet != null) { + //Collections.sort(returnedSet, Comparator.comparingInt(CompetitionRanking::getScore)); + //降序排列 + //多条件-先年龄升序、后分数升序 + /*Collections.sort(returnedSet, new Comparator() { + public int compare(CompetitionRanking s1, CompetitionRanking s2) { + int i = (int)(Double.valueOf(s2.getScore()) -Double.valueOf(s1.getScore())); + // int i = s2.getScore().compareTo(s1.getScore()); + if (i == 0) { + //i = (int)Double.valueOf(s1.getTimeSum())-(Double.valueOf(s2.getTimeSum())); + i = s1.getTimeSum() - s2.getTimeSum(); + } + return i; + } + }); +*/ + + + returnedSet.sort(new Comparator() { + @Override + public int compare(CompetitionRanking o1, CompetitionRanking o2) { + if ((Double.valueOf(o2.getScore()) - Double.valueOf(o1.getScore())) > 0) { + return 1; + } else if (Double.valueOf(o1.getScore()) - Double.valueOf(o2.getScore()) == 0) { + if (Double.valueOf(o2.getTimeSum()) - Double.valueOf(o1.getTimeSum()) < 0) { + return 1; + } + } + return -1; + } + + + }); + + + for (CompetitionRanking r : returnedSet) { + Integer ret = baseMapper.insert(r); + if (ret == 1) { + numberOfSuccesses++; + } + } + + + } + map.put("exportCode", exportCode);//返回导出code + map.put("successNum", numberOfSuccesses + "");//本次新增成功数量 + map.put("failureNum", countError);//本次新增失败数量 + map.put("data", returnedSet);//本次要上传确认的数据 + return map; + } catch (RuntimeException e) { + System.err.println(e.getMessage()); + throw new RuntimeException(); + } + } + + + /** + * 判断字符串是否是long类型 + */ + public static boolean isLong(String value) { + try { + Long.valueOf(value); + return true; + } catch (NumberFormatException e) { + return false; + } + } + + public static void main(String[] args) { + System.out.println(isLong("12.")); + } + + + @Override + public void exportFailureRecord(HttpServletResponse response, String token, Integer competitionId) throws Exception { + if (org.apache.commons.lang3.StringUtils.isEmpty(token)) { + return; + } + ValueOperations ops = stringRedisTemplate.opsForValue(); + //获取数据 + String record = ops.get(token); + if (org.apache.commons.lang3.StringUtils.isEmpty(record)) { + return; + } + + // 告诉浏览器用什么软件可以打开此文件 + response.setHeader("content-Type", "application/vnd.ms-excel"); + // 下载文件的默认名称 + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("赛事排名导入失败数据表", "UTF-8") + ".xls"); + //编码 + response.setCharacterEncoding("UTF-8"); + Workbook workbook = null; + CompleteCompetitionSetup competitionSetup = competitionSetupMapper.getRaceSettingsByRaceId(competitionId); + //赛事类型(0为个人赛,1为团队赛) + if (competitionSetup.getCompetitionType() == 1) { + List parse = JSON.parseObject(record, new TypeReference>() { + }); + parse.sort(Comparator.comparing(ImportCompetitionRankingFailureVO::getIndex)); + workbook = ExcelExportUtil.exportExcel(new ExportParams(), ImportCompetitionRankingFailureVO.class, parse); + } else { + List parse = JSON.parseObject(record, new TypeReference>() { + }); + parse.sort(Comparator.comparing(ImportIndividualRankingFailureVO::getIndex)); + workbook = ExcelExportUtil.exportExcel(new ExportParams(), ImportIndividualRankingFailureVO.class, parse); + } + ExportParams exportParams = new ExportParams(null, "delivery", ExcelType.XSSF); + exportParams.setStyle(ExcelStyleUtil.class); + workbook.write(response.getOutputStream()); + } + + @Override + public R frontOfficeCompetitionRanking(FrontDeskStageTeamScoreDetailsReq req) { + List frontOfficeCompetitionRanking = baseMapper.frontOfficeCompetitionRanking(req); + return R.ok(frontOfficeCompetitionRanking); + } + + + /** + * 前台竞赛阶段 + * + * @param req + * @return + */ + /* @Override + public List frontStageCompetition(FrontStageCompetitionReq req) { + //获取本竞赛下的阶段信息以及权重比 + List acquisitionWeightRatio = ruleMapper.acquisitionWeightRatio(req.getCompetitionId()); + //查看赛事类型是个人赛还是团队赛事 + + + List newList = new ArrayList<>(); + List list = new ArrayList<>(); + CompleteCompetitionSetup competitionSetup = competitionSetupMapper.getRaceSettingsByRaceId(req.getCompetitionId()); + for (CompetitionRuleResp ruleResp : acquisitionWeightRatio) { + // 获取阶段信息 + CompetitionStage competitionStage = stageMapper.selectById(ruleResp.getStageId()); + FrontStageCompetitionResp frontStageCompetitionResp = new FrontStageCompetitionResp(); + frontStageCompetitionResp.setPointWeight(ruleResp.getPointWeight()); + //复制属性 + BeanUtils.copyProperties(competitionStage, frontStageCompetitionResp); + //赛事类型(0为个人赛,1为团队赛)默认为0 + //个人赛 + if (competitionSetup.getCompetitionType() == TeamCalculationMethodConstant.TYPE_OF_EVENT_INDIVIDUAL_COMPETITION) { + + //比赛方式(0实操,1理论,2线下) + if (competitionStage.getMethod() == 2) { + list = teamMapper.offlineIndividualPointsCompetition(new StageRankingReq(). + setStageId(frontStageCompetitionResp.getStageId()). + setCompetitionId(req.getCompetitionId())); + } else { + list = teamMapper.onlineIndividualPointsCompetition(new StageRankingReq(). + setStageId(frontStageCompetitionResp.getStageId()). + setCompetitionId(req.getCompetitionId())); + } + + } + newList.addAll(list); + } + + //个人赛 + List individualCompetition = new ArrayList<>(); + if (competitionSetup.getCompetitionType()==1){ + + }else{ + + Map> listMap = newList.stream().collect(Collectors.groupingBy(ListOfStageResultsResp::getAccountId)); + List retList = new ArrayList<>(); + + for (String accountId : listMap.keySet()) { + System.out.println("key的值是:" + accountId + "=============" + "value的值是:" + listMap.get(accountId)); + List resultsRespList = listMap.get(accountId); + retList = merge(resultsRespList); + individualCompetition.addAll(retList); + } + individualCompetition.sort(new Comparator() { + @Override + public int compare(ListOfStageResultsResp o1, ListOfStageResultsResp o2) { + return (int) (Double.valueOf(o2.getScore()) - Double.valueOf(o1.getScore())); + } + }); + } + return individualCompetition; + + } + + */ + + /** + * 将id进行合并nums, sums 相加道回合并后的集合使用Java8的流进行处理 + *//* + + public static List merge(List list) { + List result = list.stream() + .collect(Collectors.toMap(ListOfStageResultsResp::getAccountId, a -> a, (o1, o2) -> { + Double score = Double.valueOf(o1.getScore()) + Double.valueOf(o2.getScore()); + Integer time = Integer.valueOf(o1.getTimeSum()) + Integer.valueOf(o2.getTimeSum()); + o1.setScore(score + ""); + o1.setTimeSum(time + ""); + o1.setTeamId(null); + return o1; + })).values().stream().collect(Collectors.toList()); + + return result; + + }*/ + @Override + public R frontDeskOverallRanking(OverallStandingsInThePointsRaceReq req) { + CompetitionRule competitionRule = ruleMapper.getTheRulesOfTheRaceByTheRaceId(req.getCompetitionId()); + List overallEventRankingRespList = new ArrayList<>(); + //查看赛事类型是个人赛还是团队赛事 + CompleteCompetitionSetup competitionSetup = competitionSetupMapper.getRaceSettingsByRaceId(req.getCompetitionId()); + for (Integer stageId : req.getStageIds()) { + OverallEventRankingResp rankingResp = new OverallEventRankingResp(); + // 获取阶段信息 + CompetitionStage competitionStage = stageMapper.selectById(stageId); + + FrontDeskStageRankingReq frontDeskStageRankingReq = new FrontDeskStageRankingReq(); + frontDeskStageRankingReq.setCompetitionId(req.getCompetitionId()); + frontDeskStageRankingReq.setCompetitionStage(competitionStage); + frontDeskStageRankingReq.setCompetitionSetup(competitionSetup); + frontDeskStageRankingReq.setPageNum(req.getPageNum()); + frontDeskStageRankingReq.setPageSize(req.getPageSize()); + frontDeskStageRankingReq.setStageId(competitionStage.getStageId()); + //获取每个阶段的团队、个人成绩列表 + IPage list = pointRace(frontDeskStageRankingReq); + rankingResp.setStageName(competitionStage.getStageName()); + rankingResp.setStageId(competitionStage.getStageId()); + rankingResp.setStageTeamInformation(list.getRecords()); + rankingResp.setPointWeight(competitionStage.getPointWeight()); + overallEventRankingRespList.add(rankingResp); + + } + + //成绩计算方式(0:各阶段加权求和,1:各阶段成绩求和,2:各阶段成绩平均值 + String teamScore = "0"; + + List returnTotalSet = new ArrayList<>();//返回的集合 + + for (OverallEventRankingResp rankingResp : overallEventRankingRespList) { + double calculateScores = 0.0; + CompetitionStageServiceImpl.evaluationAtEachStage(competitionRule, returnTotalSet, rankingResp); + } + + Map> map = new HashMap<>(); + for (OverallEventRankingResp item : overallEventRankingRespList) { + for (ListOfStageResultsResp l : item.getStageTeamInformation()) { + List scoreList = new ArrayList<>(); + if (map.get(l.getTeamId()) != null) { + scoreList = map.get(l.getTeamId()); + } + scoreList.add(l.getScore()); + map.put(l.getTeamId(), scoreList); + } + } + List stageTeamInformation = overallEventRankingRespList.get(overallEventRankingRespList.size() - 1).getStageTeamInformation(); + Set set = map.keySet(); + for (ListOfStageResultsResp l : stageTeamInformation) { + for (Integer str : set) { + if (str == l.getTeamId()) { + List in = map.get(str); + List dList = in.stream().map((d) -> { + return Double.valueOf(d + ""); + }).collect(Collectors.toList()); + + CompetitionStageServiceImpl.ScoreProcessing(competitionRule, l, dList); + } + + } + } + + + stageTeamInformation.sort(new Comparator() { + @Override + public int compare(ListOfStageResultsResp o1, ListOfStageResultsResp o2) { + return (int) (Double.valueOf(o2.getScore()) - Double.valueOf(o1.getScore())); + } + }); + + //总数 + int total = stageTeamInformation.size(); + //总页数 + int pageSum = total % req.getPageSize() == 0 ? total / req.getPageSize() : total / req.getPageSize() + 1; + + //分页 + List subList = stageTeamInformation.stream().skip((req.getPageNum() - 1) * req.getPageSize()).limit(req.getPageSize()).collect(Collectors.toList()); + return R.ok().put("page", subList).put("pageSum", pageSum).put("total", total); + } + + @Override + public R detailsOfTotalTeamScores(DetailsOfTotalTeamScoresReq req) { + + List teamScoresRespList = new ArrayList<>(); + for (Integer stageId : req.getStageIds()) { + DetailsOfTotalTeamScoresResp resp = new DetailsOfTotalTeamScoresResp(); + CompetitionStage competitionStage = stageMapper.selectById(stageId); + resp.setStageName(competitionStage.getStageName()); + resp.setPointWeight(competitionStage.getPointWeight()); + resp.setTeamCalculationMethod(competitionStage.getTeamCalculationMethod()); + resp.setStageId(stageId); + req.setStageId(stageId); + List information = stageMapper.stageTeamInformation(req); + resp.setStageTeamInformation(information); + teamScoresRespList.add(resp); + } + return R.ok().put("data", teamScoresRespList).put("resultCalculationMethod", ruleMapper.obtainTheRulesOfTheEvent(req.getCompetitionId()).getResultCalculationMethod()); + } + + @Override + public R manuallyRankTheUploadList(BatchUploadListCompetitionReq req) { + + Page page = new Page(req.getPageNum(), req.getPageSize()); + IPage pageList = baseMapper.manuallyRankTheUploadList(page, req); + + WhetherToPublishParameterReq parameterReq = new WhetherToPublishParameterReq(); + parameterReq.setIsRelease(DelConstant.POST_STATUS); + parameterReq.setCompetitionId(req.getCompetitionId()); + parameterReq.setPublicationType(DelConstant.PUBLICATION_TYPE_MANUALOPERATION); + parameterReq.setIsOverallRanking(req.getIsOverallRanking()); + if (req.getStageId() != null) { + parameterReq.setStageId(req.getStageId()); + } + + + //返回判断是否默认发布过 + List rankingList = baseMapper.whetherToPublishTheOverallScoreRanking(parameterReq); + boolean publishStatus = false; + if (rankingList.size() > 0) { + //发布过 + publishStatus = true; + } + + return R.ok(pageList).put("publishStatus", publishStatus).put("page",pageList.getRecords()); + } + + @Override + public List whetherToPublish(Integer competitionId, Integer stageId, Integer isRelease, Integer publicationType, Integer isOverallRanking) { + + WhetherToPublishParameterReq parameterReq = new WhetherToPublishParameterReq(); + parameterReq.setIsRelease(isRelease); + parameterReq.setCompetitionId(competitionId); + parameterReq.setPublicationType(publicationType); + parameterReq.setIsOverallRanking(isOverallRanking); + parameterReq.setStageId(stageId); + return baseMapper.whetherToPublish(parameterReq); + } + + @Override + public List whetherToPublishTheOverallScoreRanking(Integer competitionId, Integer isRelease, Integer publicationType, Integer isOverallRanking) { + WhetherToPublishParameterReq parameterReq = new WhetherToPublishParameterReq(); + parameterReq.setIsRelease(isRelease); + parameterReq.setCompetitionId(competitionId); + parameterReq.setPublicationType(publicationType); + parameterReq.setIsOverallRanking(isOverallRanking); + return baseMapper.whetherToPublishTheOverallScoreRanking(parameterReq); + } + + @Override + public R publishRanking(List rankingList) { + if (rankingList.size() <= 0) { + return R.error("请选择要发布的数据!"); + } + + Integer publicationType = rankingList.get(0).getPublicationType();//publicationType 发布类型(0默认发布 1批量手动导入) + Integer getCompetitionId = rankingList.get(0).getCompetitionId(); + Integer getIsOverallRanking = rankingList.get(0).getIsOverallRanking();//是否为总分排名(1为是 默认0不是) + Integer getStageId = rankingList.get(0).getStageId(); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("competition_id", getCompetitionId); + queryWrapper.eq("is_release", DelConstant.POST_STATUS);//已发布 + //如果为总分排名时,默认删除上一次发布的总分排名 + if (getIsOverallRanking == 1) { + queryWrapper.eq("is_overall_ranking", getIsOverallRanking); + } else { + //如果为阶段排名时候,则删除上一次的阶段排名 + if (publicationType == 0) { + queryWrapper.eq("publication_type", 1); + } else { + queryWrapper.eq("publication_type", 0); + } + queryWrapper.eq("stage_id", getStageId); + } + baseMapper.delete(queryWrapper); + for (CompetitionRanking ranking : rankingList) { + ranking.setIsRelease(DelConstant.POST_STATUS); + baseMapper.insert(ranking); + } + return R.ok(); + } + + public IPage pointRace(FrontDeskStageRankingReq req) { + IPage pageList = null; + //赛事类型(0为个人赛,1为团队赛)默认为0 + if (req.getCompetitionSetup().getCompetitionType() == TeamCalculationMethodConstant.TYPE_OF_EVENT_INDIVIDUAL_COMPETITION) {//个人赛 + Page page = new Page(req.getPageNum(), req.getPageSize()); + pageList = teamMapper.frontDeskIndividualStageRanking(page, req); + return pageList; + } else if (req.getCompetitionSetup().getCompetitionType() == TeamCalculationMethodConstant.TYPE_OF_EVENT_TEAM_EVENT) {//团队赛 + //团队排名:用时以及分数依据当前阶段成绩的计算方式(最高分、平均分、求和)取 + //如:当前阶段赛事成绩计算方式为取最高分,则用户用时以及分数取得是当前团队下的最高分当前成绩的用时以及分数 + //团队成绩计算方式(0:最高分,1:平均分,2:求和) + + //1.获取参与该大赛的团队 + String teamIds = teamMapper.getTeamInformation(req.getCompetitionId()); + if (teamIds != null || teamIds.length() >= 0) { + req.setTeamIds(teamIds); + Page page = new Page(req.getPageNum(), req.getPageSize()); + pageList = teamMapper.frontOfficeTeamStageRanking(page, req); + for (ListOfStageResultsResp resp : pageList.getRecords()) { + //团队成绩计算方式(0:最高分,1:平均分,2:总分) + if (req.getCompetitionStage().getTeamCalculationMethod().equals("0")) { + resp.setScore(resp.getMaxScore()); + } else if (req.getCompetitionStage().getTeamCalculationMethod().equals("1")) { + resp.setScore(resp.getAvgScore()); + } else if (req.getCompetitionStage().getTeamCalculationMethod().equals("2")) { + resp.setScore(resp.getSumScore()); + } + } + + return pageList; + + + } + } + return null; + } +} diff --git a/competition/src/main/java/com/huoran/competition/service/impl/CompetitionRegistrationServiceImpl.java b/competition/src/main/java/com/huoran/competition/service/impl/CompetitionRegistrationServiceImpl.java new file mode 100644 index 0000000..a0edb8d --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/service/impl/CompetitionRegistrationServiceImpl.java @@ -0,0 +1,286 @@ +package com.huoran.competition.service.impl; + +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.entity.ExportParams; +import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; +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.huoran.api.UserClient; +import com.huoran.common.entity.School; +import com.huoran.common.exception.CustomException; +import com.huoran.common.exception.ExceptionEnum; +import com.huoran.common.response.R; +import com.huoran.competition.entity.*; +import com.huoran.competition.entity.req.PageRegistrationStaffReq; +import com.huoran.competition.entity.vo.ExcelData; +import com.huoran.competition.entity.vo.PersonalExcelData; +import com.huoran.competition.entity.vo.RegistrationVO; +import com.huoran.competition.mapper.*; +import com.huoran.competition.service.CompetitionRangeService; +import com.huoran.competition.service.CompetitionRegistrationService; +import com.huoran.competition.service.CompetitionTeamService; +import com.huoran.competition.service.TeamParticipantService; +import com.huoran.competition.utils.ExcelStyleUtil; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.List; + +/** + *

+ * 赛事报名人员表 服务实现类 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +@Service +public class CompetitionRegistrationServiceImpl extends ServiceImpl implements CompetitionRegistrationService { + + @Autowired + private UserClient userClient; + + @Autowired + CompetitionMapper competitionMapper; + + @Autowired + CompetitionTeamMapper competitionTeamMapper; + + @Autowired + CompleteCompetitionSetupMapper completeCompetitionSetupMapper; + + @Autowired + CompetitionStageMapper competitionStageMapper; + + @Autowired + CompetitionRangeService competitionRangeService; + + @Autowired + private TeamParticipantService teamParticipantService; + @Autowired + private CompetitionTeamService competitionTeamService; + + @Override + public School getSchool(Integer schoolId) { + return baseMapper.selectSchool(schoolId); + } + + @Override + public R registrationPageConditionQuery(PageRegistrationStaffReq req) { + Page page = new Page(req.getPageNum(), req.getPageSize()); + IPage pageList = baseMapper.selectRegistrationByCondition(page, req); + return R.ok().put("data", pageList); + } + + @Override + public boolean disableContests(List ids) { + int updates = baseMapper.disableByIds(ids); + return updates > 0; + } + + @Override + @Transactional + public R cancelRegistration(String contestId, Integer accountId) { + //删除团队 + QueryWrapper setupQueryWrapper = new QueryWrapper<>(); + setupQueryWrapper.eq("competition_id",contestId); + CompleteCompetitionSetup setup = completeCompetitionSetupMapper.selectOne(setupQueryWrapper); + //团队赛类型 + if (setup.getCompetitionType()==1){ + QueryWrapper teamQueryWrapper = new QueryWrapper<>(); + teamQueryWrapper.eq("account_id",accountId); + teamQueryWrapper.eq("competition_id",contestId); + CompetitionTeam one = competitionTeamService.getOne(teamQueryWrapper); + if (one!=null){ + if (one.getCaptain()==0){ + QueryWrapper competitionTeamQueryWrapper = new QueryWrapper<>(); + competitionTeamQueryWrapper.eq("pid",one.getTeamId()); + competitionTeamQueryWrapper.eq("competition_id",contestId); + List list = competitionTeamService.list(competitionTeamQueryWrapper); + if (list!=null && list.size()>0){ + return R.error("取消失败,需要把成员移除后取消!"); + } + competitionTeamService.removeById(one); + } + competitionTeamService.removeById(one); + } + } + boolean ret = baseMapper.cancelRegistration(contestId, accountId); + + return ret ? R.ok() : R.error(); + } + + @Override + public void export(HttpServletResponse response, PageRegistrationStaffReq req) throws IOException { + Page page = new Page(req.getPageNum(), req.getPageSize()); + IPage applicantVOList = baseMapper.selectApplicantByCondition(page, req); + QueryWrapper setupQueryWrapper = new QueryWrapper<>(); + setupQueryWrapper.eq("competition_id",req.getCompetitionId()); + CompleteCompetitionSetup setup = completeCompetitionSetupMapper.selectOne(setupQueryWrapper); + List excelDataList = new ArrayList<>(); + List personalExcelData = new ArrayList<>(); + //导出团队名称 + if (setup.getCompetitionType()==1){ + applicantVOList.getRecords().forEach(registrationVO -> { + QueryWrapper teamQueryWrapper = new QueryWrapper<>(); + teamQueryWrapper.eq("competition_id",req.getCompetitionId()); + teamQueryWrapper.eq("account_id",registrationVO.getAccountId()); + CompetitionTeam team = competitionTeamMapper.selectOne(teamQueryWrapper); + if (team!=null && team.getCaptain()==0){ + registrationVO.setTeamName(team.getTeamName()); + }else if (team!=null){ + CompetitionTeam team1 = competitionTeamMapper.selectById(team.getPid()); + registrationVO.setTeamName(team1.getTeamName()); + } + }); + applicantVOList.getRecords().forEach(applicantVO -> { + ExcelData excelData = new ExcelData(); + BeanUtils.copyProperties(applicantVO, excelData); + excelDataList.add(excelData); + }); + }else { + //个人导出列 + applicantVOList.getRecords().forEach(applicantVO -> { + PersonalExcelData personalExcelData1 = new PersonalExcelData(); + BeanUtils.copyProperties(applicantVO, personalExcelData1); + personalExcelData.add(personalExcelData1); + }); + } + + // 告诉浏览器用什么软件可以打开此文件 + response.setHeader("content-Type", "application/vnd.ms-excel"); + // 下载文件的默认名称 + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("报名人员导出", "UTF-8") + ".xls"); + //编码 + response.setCharacterEncoding("UTF-8"); + + Workbook workbook; + if (setup.getCompetitionType()==1){ + workbook=ExcelExportUtil.exportExcel(new ExportParams(), ExcelData.class, excelDataList); + }else { + workbook=ExcelExportUtil.exportExcel(new ExportParams(), PersonalExcelData.class, personalExcelData); + } + ExportParams exportParams = new ExportParams(null, "delivery", ExcelType.XSSF); + exportParams.setStyle(ExcelStyleUtil.class); + workbook.write(response.getOutputStream()); + } + + @Override + public void exportDataInBatches(List listOfExportSub, HttpServletResponse response) throws IOException { + // 告诉浏览器用什么软件可以打开此文件 + response.setHeader("content-Type", "application/vnd.ms-excel"); + // 下载文件的默认名称 + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("报名人员导出", "UTF-8") + ".xls"); + //编码 + response.setCharacterEncoding("UTF-8"); + Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), RegistrationVO.class, listOfExportSub); + ExportParams exportParams = new ExportParams(null, "delivery", ExcelType.XSSF); + exportParams.setStyle(ExcelStyleUtil.class); + workbook.write(response.getOutputStream()); + } + + @Override + @Transactional + public R apply(CompetitionRegistration competitionRegistration) { + //查询赛事设置 + QueryWrapper setupQueryWrapper = new QueryWrapper<>(); + setupQueryWrapper.eq("competition_id",competitionRegistration.getCompetitionId()); + CompleteCompetitionSetup setup = completeCompetitionSetupMapper.selectOne(setupQueryWrapper); + //团队赛限制验证 + if (setup.getCompetitionType()==1){ + if (competitionRegistration.getTeamId()!=null){ + //团队数量限制 + if (setup.getQuantityLimit()!=null){ + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("competition_id",competitionRegistration.getCompetitionId()); + wrapper.groupBy("team_id"); + List competitionRegistrations = baseMapper.selectList(wrapper); + if (competitionRegistrations!=null && competitionRegistration.isJoin() && competitionRegistrations.size()>=setup.getQuantityLimit()){ + throw new CustomException(ExceptionEnum.TEAM_LIMIT2); + } + } + + //团队人数限制 + if (setup.getMaxTeamSize()!=null){ + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("competition_id",competitionRegistration.getCompetitionId()); + wrapper.eq("team_id",competitionRegistration.getTeamId()); + List competitionRegistrations = baseMapper.selectList(wrapper); + if (competitionRegistrations!=null && competitionRegistration.isJoin() && competitionRegistrations.size()>=setup.getMaxTeamSize()){ + throw new CustomException(ExceptionEnum.TEAM_LIMIT1); + } + } + } + + }else { + //个人赛人数限制 + if (setup.getQuantityLimit()!=null){ + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("competition_id",competitionRegistration.getCompetitionId()); + List competitionRegistrations = baseMapper.selectList(wrapper); + if (competitionRegistrations!=null && competitionRegistrations.size()>=setup.getQuantityLimit()){ + throw new CustomException(ExceptionEnum.TEAM_LIMIT3); + } + } + } + + //内部添加,一路绿灯 + if (competitionRegistration.getIdentification() ==null || competitionRegistration.getIdentification() != 1) { + //是否需要报名邀请码 + Integer code = setup.getIsNeedCode(); + if (code == 1) { + //验证报名邀请码 + if (!setup.getInvitationCode().equals(competitionRegistration.getRegistrationInvitationCode())) { + throw new CustomException(ExceptionEnum.CODE); + } + } + } + + Integer accountId = competitionRegistration.getAccountId(); + Integer competitionId = competitionRegistration.getCompetitionId(); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("account_id", accountId); + wrapper.eq("competition_id", competitionId); + int count = baseMapper.selectCount(wrapper); + //添加前判断是否已报名 + if (count > 0) { + throw new CustomException(ExceptionEnum.HAVE_BEEN_REGISTERED); + } else { + Competition competition = competitionMapper.selectById(competitionId); + //大赛范围(0:本校内 1:全平台 2:指定区域、院校) + if (competition.getCompetitionScope() == 2) { + Integer schoolId = userClient.getSchoolIdByAccountId(accountId.toString()); + //拿到当前用户所在学校省市信息 + School school = this.getSchool(schoolId); + if (school!=null){ + boolean check = competitionRangeService.checkWhetherToParticipate(school, competitionId); + if (check) { + throw new CustomException(ExceptionEnum.UNABLE_TO_REGISTER); + } + } + } + //报名成功后每个阶段添加为默认参数人员 + List competitionStages = competitionStageMapper.selectCompetitionStageBySetupId(setup.getSetupId()); + for (CompetitionStage competitionStage : competitionStages) { + TeamParticipant teamParticipant = new TeamParticipant(); + teamParticipant.setTeamId(competitionRegistration.getTeamId()); + teamParticipant.setStageId(competitionStage.getStageId()); + teamParticipant.setCompetitionId(competitionRegistration.getCompetitionId()); + teamParticipant.setAccountId(accountId); + teamParticipantService.save(teamParticipant); + } + int save = baseMapper.insert(competitionRegistration); + return save > 0 ? R.ok() : R.error(); + } + } +} diff --git a/competition/src/main/java/com/huoran/competition/service/impl/CompetitionReleaseTimeServiceImpl.java b/competition/src/main/java/com/huoran/competition/service/impl/CompetitionReleaseTimeServiceImpl.java new file mode 100644 index 0000000..6841a62 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/service/impl/CompetitionReleaseTimeServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.competition.service.impl; + +import com.huoran.competition.entity.CompetitionReleaseTime; +import com.huoran.competition.mapper.CompetitionReleaseTimeMapper; +import com.huoran.competition.service.CompetitionReleaseTimeService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 赛事排名定时发布表 服务实现类 + *

+ * + * @author cheney + * @since 2023-05-30 + */ +@Service +public class CompetitionReleaseTimeServiceImpl extends ServiceImpl implements CompetitionReleaseTimeService { + +} diff --git a/competition/src/main/java/com/huoran/competition/service/impl/CompetitionRuleServiceImpl.java b/competition/src/main/java/com/huoran/competition/service/impl/CompetitionRuleServiceImpl.java new file mode 100644 index 0000000..9b46063 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/service/impl/CompetitionRuleServiceImpl.java @@ -0,0 +1,138 @@ +package com.huoran.competition.service.impl; + +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.common.response.R; +import com.huoran.competition.entity.*; +import com.huoran.competition.mapper.*; +import com.huoran.competition.service.CompetitionRuleService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 赛事规则表 服务实现类 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +@Service +public class CompetitionRuleServiceImpl extends ServiceImpl implements CompetitionRuleService { + + @Autowired + CompetitionStageMapper competitionStageMapper; + + @Autowired + CompleteCompetitionSetupMapper completeCompetitionSetupMapper; + + @Autowired + TeamParticipantMapper teamParticipantMapper; + + @Autowired + CompetitionContentMapper competitionContentMapper; + + @Autowired + CompetitionStageContentSettingMapper competitionStageContentSettingMapper; + + @Autowired + CompetitionStageFileMapper competitionStageFileMapper; + + @Autowired + CompetitionRankingMapper competitionRankingMapper; + + @Autowired + CompetitionReleaseTimeMapper competitionReleaseTimeMapper; + + @Override + public R addCompetitionRule(CompetitionRule competitionRule) { +// 添加赛事规则 + int insert = baseMapper.insert(competitionRule); + Integer ruleId = competitionRule.getRuleId(); + if (!competitionRule.getCompetitionStageList().isEmpty()){ + List competitionStageList = competitionRule.getCompetitionStageList(); + competitionStageList.forEach(competitionStage -> { + competitionStage.setRuleId(ruleId); + competitionStageMapper.insert(competitionStage); + }); + } + return insert>0 ? R.ok(): R.error(); + } + + @Override + public R getCompetitionRule(String competitionId) { + QueryWrapper setupQueryWrapper = new QueryWrapper<>(); + setupQueryWrapper.eq("competition_id",competitionId); + CompleteCompetitionSetup setup = completeCompetitionSetupMapper.selectOne(setupQueryWrapper); + + CompetitionRule competitionRule = null; + if (ObjectUtil.isNotNull(setup)){ + QueryWrapper ruleQueryWrapper = new QueryWrapper<>(); + ruleQueryWrapper.eq("setup_id",setup.getSetupId()); + competitionRule = baseMapper.selectOne(ruleQueryWrapper); + if (ObjectUtil.isNotNull(competitionRule)){ + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("rule_id",competitionRule.getRuleId()); + List competitionStages = competitionStageMapper.selectList(queryWrapper); + competitionRule.setCompetitionStageList(competitionStages); + } + } + + return R.ok().put("competitionRule",competitionRule); + } + + @Override + public R editCompetitionRule(CompetitionRule competitionRule) { + // 更新赛事规则 + int update = baseMapper.updateById(competitionRule); +// 更新阶段数据 + List updatedStages = competitionRule.getCompetitionStageList(); + + //查询当前赛事的所有阶段 + List existingStages = competitionStageMapper.selectList( + new QueryWrapper().eq("rule_id",competitionRule.getRuleId()) + ); + // 新增或更新阶段 + updatedStages .forEach(competitionStage -> { + if (competitionStage.getStageId()!=null){ + //存在进行编辑 + competitionStageMapper.updateById(competitionStage); + }else { + //新增添加阶段 + competitionStageMapper.insert(competitionStage); + } + }); + + // 删除阶段及相关联数据 + for (CompetitionStage existingStage : existingStages) { + boolean exists = updatedStages.stream().anyMatch(s -> s.getStageId().equals(existingStage.getStageId())); + if (!exists) { + // 如果更新的阶段数据中没有该阶段,则删除 + competitionStageMapper.deleteById(existingStage.getStageId()); + //删除阶段内容数据c_competition_content + competitionContentMapper.delete( + new QueryWrapper().eq("stage_id",existingStage.getStageId())); + //删除赛事阶段内容设置c_competition_stage_content_setting + competitionStageContentSettingMapper.delete( + new QueryWrapper().eq("stage_id",existingStage.getStageId())); + //赛事阶段文件c_competition_stage_file + competitionStageFileMapper.delete( + new QueryWrapper().eq("stage_id",existingStage.getStageId())); + //赛事排名表c_competition_ranking + competitionRankingMapper.delete( + new QueryWrapper().eq("stage_id",existingStage.getStageId())); + //赛事排名定时发布表c_competition_release_time + competitionReleaseTimeMapper.delete( + new QueryWrapper().eq("stage_id",existingStage.getStageId())); + //团队阶段参赛人员表c_team_participant + teamParticipantMapper.delete( + new QueryWrapper().eq("stage_id",existingStage.getStageId())); + } + } + + return update>0 ? R.ok(): R.error(); + } +} diff --git a/competition/src/main/java/com/huoran/competition/service/impl/CompetitionServiceImpl.java b/competition/src/main/java/com/huoran/competition/service/impl/CompetitionServiceImpl.java new file mode 100644 index 0000000..fb116db --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/service/impl/CompetitionServiceImpl.java @@ -0,0 +1,604 @@ +package com.huoran.competition.service.impl; + +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.ObjectUtil; +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.huoran.common.response.R; +import com.huoran.competition.entity.*; +import com.huoran.competition.entity.req.*; +import com.huoran.competition.entity.resp.ListOfStageResultsResp; +import com.huoran.competition.entity.vo.CompetitionDetailsVO; +import com.huoran.competition.entity.vo.CompetitionVO; +import com.huoran.competition.mapper.*; +import com.huoran.competition.service.CompetitionService; +import com.huoran.competition.service.CompetitionStageFileService; +import com.huoran.competition.service.TeamParticipantService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Async; +import org.springframework.scheduling.annotation.AsyncResult; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; +import org.springframework.stereotype.Service; + +import javax.script.ScriptEngine; +import javax.script.ScriptEngineManager; +import javax.script.ScriptException; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.Future; +import java.util.stream.Collectors; + +/** + *

+ * 赛事信息表 服务实现类 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +@Service +public class CompetitionServiceImpl extends ServiceImpl implements CompetitionService { + + @Autowired + CompetitionStageContentSettingMapper competitionStageContentSettingMapper; + @Autowired + CompetitionRegistrationMapper competitionRegistrationMapper; + + @Autowired + CompetitionProgressMapper competitionProgressMapper; + + @Autowired + CompetitionRangeMapper competitionRangeMapper; + + @Autowired + CompetitionAnnexMapper competitionAnnexMapper; + + @Autowired + CompetitionRuleMapper competitionRuleMapper; + + @Autowired + CompleteCompetitionSetupMapper completeCompetitionSetupMapper; + + @Autowired + CompetitionStageMapper competitionStageMapper; + + @Autowired + CompetitionRankingServiceImpl competitionStageService; + + @Autowired + CompetitionTeamMapper competitionTeamMapper; + + @Autowired + CompetitionContentMapper competitionContentMapper; + + @Autowired + CompetitionContentServiceImpl competitionContentService; + + @Autowired + CompetitionStageFileService stageFileService; + + @Autowired + TeamParticipantService teamParticipantService; + + @Autowired + ThreadPoolTaskExecutor competitionExecutor; + + @Override + public boolean repeat(Competition competition) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("name", competition.getName()); + //大赛范围(0:本校内 1:全平台 2:指定区域、院校) + switch (competition.getCompetitionScope()) { + case 0: + wrapper.eq("school_id", competition.getSchoolId()); + break; + } + if (competition.getId() != null) { + wrapper.last(" and id != " + competition.getId()); + } + Integer count = baseMapper.selectCount(wrapper); + return count > 0; + } + + @Override + public boolean removeCompetition(Integer competitionId) { + Competition competition = baseMapper.selectById(competitionId); + + // 删除该赛事报名人员数 + QueryWrapper applicantWrapper = new QueryWrapper<>(); + applicantWrapper.eq("competition_id", competitionId); + applicantWrapper.select("id"); + List applicants = competitionRegistrationMapper.selectList(applicantWrapper); + if (applicants != null && applicants.size() != 0) { + List applicantIds = applicants.stream().map(CompetitionRegistration::getId).collect(Collectors.toList()); + competitionRegistrationMapper.deleteBatchIds(applicantIds); + } + // 删除赛事进展 + QueryWrapper contestProgressWrapper = new QueryWrapper<>(); + contestProgressWrapper.eq("competition_id", competitionId); + contestProgressWrapper.select("id"); + List contestProgressList = competitionProgressMapper.selectList(contestProgressWrapper); + if (contestProgressList != null && contestProgressList.size() != 0) { + List contestProgressIds = contestProgressList.stream().map(CompetitionProgress::getId).collect(Collectors.toList()); + competitionProgressMapper.deleteBatchIds(contestProgressIds); + } + + if (competition.getReleaseType() == 1) { + //删除完整赛事其他信息 + QueryWrapper setupQueryWrapper = new QueryWrapper<>(); + setupQueryWrapper.eq("competition_id", competitionId); + CompleteCompetitionSetup completeCompetitionSetup = completeCompetitionSetupMapper.selectOne(setupQueryWrapper); + completeCompetitionSetupMapper.delete(setupQueryWrapper); + + if (ObjectUtil.isNotNull(completeCompetitionSetup)) { + QueryWrapper ruleQueryWrapper = new QueryWrapper<>(); + ruleQueryWrapper.eq("setup_id", completeCompetitionSetup.getSetupId()); + CompetitionRule competitionRule = competitionRuleMapper.selectOne(ruleQueryWrapper); + competitionRuleMapper.delete(ruleQueryWrapper); + + if (ObjectUtil.isNotNull(competitionRule)) { + QueryWrapper stageQueryWrapper = new QueryWrapper<>(); + stageQueryWrapper.eq("rule_id", competitionRule.getRuleId()); + List competitionStages = competitionStageMapper.selectList(stageQueryWrapper); + if (ObjectUtil.isNotNull(competitionStages)) { + competitionStages.forEach(competitionStage -> { + QueryWrapper competitionContentQueryWrapper = new QueryWrapper<>(); + competitionContentQueryWrapper.eq("stage_id", competitionStage.getStageId()); + competitionContentMapper.delete(competitionContentQueryWrapper); + }); + } + competitionStageMapper.delete(stageQueryWrapper); + } + } + } + + // 删除赛事 + int delete = baseMapper.deleteById(competitionId); + return delete > 0; + } + + @Override + public R competitionPageConditionQueryByOccupationlab(PageCompetitionListReq pageCompetitionListReq) { + Page page = new Page<>(pageCompetitionListReq.getPageNum(), pageCompetitionListReq.getPageSize()); + IPage pageList = baseMapper.contestPageConditionQueryByOccupationlab(page, pageCompetitionListReq); + return getR(pageList); + } + + @Override + public R competitionPageConditionQueryByNakadai(PageCompetitionListReq pageCompetitionListReq) { + Page page = new Page<>(pageCompetitionListReq.getPageNum(), pageCompetitionListReq.getPageSize()); + IPage pageList = baseMapper.contestPageConditionQueryByNakadai(page, pageCompetitionListReq); + return getR(pageList); + } + + @Override + @Async(value = "competitionExecutor") + public Future> notLoggedInBeforeStudentEvents(PageCompetitionListReq pageCompetitionListReq) { + Page page = new Page<>(pageCompetitionListReq.getPageNum(), pageCompetitionListReq.getPageSize()); + IPage pageList = null; + //大赛范围(0:本校内 1:全平台 2.指定区域、院校) 3表示不限 + if ("2".equals(pageCompetitionListReq.getCompetitionScope())) { + pageList = baseMapper.designatedRangeCompetitionByStu(page, pageCompetitionListReq); + } else { + pageList = baseMapper.allContestsByStu(page, pageCompetitionListReq); + } + Integer accountId = 0; + if (pageCompetitionListReq.getAccountId() != null) { + accountId = pageCompetitionListReq.getAccountId(); + } + for (CompetitionVO contest : pageList.getRecords()) { + if (contest.getCompetitionScope() == 1) { + contest.setRange("全平台"); + } else if (contest.getCompetitionScope() == 2) { + contest.setRange("指定范围"); + } else if (contest.getCompetitionScope() == 0) { + contest.setRange("本校内"); + } + //查询赛事阶段数据 + List stages = baseMapper.selectCompetitionStageNew(contest.getRuleId(), accountId); + contest.setCompetitionStageList(stages); + } + + return new AsyncResult<>(pageList); + } + + + + +// @Override +// public R competitionAfterLogin1(AfterLoginPageCompetitionListReq pageCompetitionListReq) { +// Page page = new Page<>(pageCompetitionListReq.getPageNum(), pageCompetitionListReq.getPageSize()); +// IPage pageList = null; +// //赛事类型(1.本校赛事/2.赛事广场/3.已报名赛事) +// switch (pageCompetitionListReq.getEventType()) { +// case 1: +// pageList = baseMapper.schoolCompetition(page, pageCompetitionListReq); +// break; +// case 2: +// if (pageCompetitionListReq.getCompetitionScope().equals("3")) { +// pageCompetitionListReq.setCompetitionScope(null); +// } +// pageList = baseMapper.tournamentSquare(page, pageCompetitionListReq); +// break; +// case 3: +// +// switch (pageCompetitionListReq.getCompetitionScope()) {//大赛范围(0:本校内 1:全平台 2.指定区域、院校 3.不限) +// //已报名赛事——修改为依据学生报名时间排序 +// case "0": +// case "1": +// case "3": +// if (pageCompetitionListReq.getCompetitionScope().equals("3")) { +// pageCompetitionListReq.setCompetitionScope(null); +// } +// pageList = baseMapper.registeredBySchoolAndAllPlatforms(page, pageCompetitionListReq); +// break; +// case "2": +// pageList = baseMapper.registeredBySpecifiedRange(page, pageCompetitionListReq); +// break; +// } +// break; +// } +// +// return getR(pageList, pageCompetitionListReq.getAccountId()); +// } + + + @Override + @Async + public Future> competitionAfterLogin(AfterLoginPageCompetitionListReq pageCompetitionListReq) { + return CompletableFuture.supplyAsync(() -> { + Page page = new Page<>(pageCompetitionListReq.getPageNum(), pageCompetitionListReq.getPageSize()); + IPage pageList = null; + //赛事类型(1.本校赛事/2.赛事广场/3.已报名赛事) + switch (pageCompetitionListReq.getEventType()) { + case 1: + pageList = baseMapper.schoolCompetition(page, pageCompetitionListReq); + break; + case 2: + if (pageCompetitionListReq.getCompetitionScope().equals("3")) { + pageCompetitionListReq.setCompetitionScope(null); + } + pageList = baseMapper.tournamentSquareNew(page, pageCompetitionListReq); + break; + case 3: + //大赛范围(0:本校内 1:全平台 2.指定区域、院校 3.不限) + //已报名赛事——修改为依据学生报名时间排序 + if ("2".equals(pageCompetitionListReq.getCompetitionScope())) { + pageList = baseMapper.registeredBySpecifiedRange(page, pageCompetitionListReq); + } else { + if (pageCompetitionListReq.getCompetitionScope().equals("3")) { + pageCompetitionListReq.setCompetitionScope(null); + } + pageList = baseMapper.registeredBySchoolAndAllPlatforms(page, pageCompetitionListReq); + } + break; + } + + assert pageList != null; + pageList.getRecords().forEach(contest -> { + if (contest.getCompetitionScope() == 1) { + contest.setRange("全平台"); + } else if (contest.getCompetitionScope() == 2) { + contest.setRange("指定范围"); + } else if (contest.getCompetitionScope() == 0) { + contest.setRange("本校内"); + } + //查询赛事阶段数据 + List stages = baseMapper.selectCompetitionStageNew(contest.getRuleId(), pageCompetitionListReq.getAccountId()); + contest.setCompetitionStageList(stages); + }); + return pageList; + }, competitionExecutor); + } + + private R getR(IPage pageList) { + pageList.getRecords().forEach(contest -> { + if (contest.getCompetitionScope() == 1) { + contest.setRange("全平台"); + } else if (contest.getCompetitionScope() == 2) { + contest.setRange("指定范围"); + //依据赛事id查询指定范围的省、市、学校 + contest.setContestRangeRespList(competitionRangeMapper.getRangeByContestId(contest.getId())); + } else if (contest.getCompetitionScope() == 0) { + contest.setRange("本校内"); + } + //查询赛事阶段数据 + List stages = baseMapper.selectCompetitionStage(contest.getId(), 0); + + R competitionContent = competitionContentService.getCompetitionContent(contest.getId()); + List contentList = (List) competitionContent.get("contentList"); + + contest.setCompetitionStageList(stages); + contest.setContentList(contentList); + + if (contentList.size() > 0) { + + for (CompetitionStage stage: stages) { + QueryWrapper queryWrapper1 = new QueryWrapper<>(); + queryWrapper1.eq("competition_id", contest.getId()); + queryWrapper1.eq("stage_id", stage.getStageId()); + CompetitionStageContentSetting stageContentSetting = competitionStageContentSettingMapper.selectOne(queryWrapper1); + if (!ObjectUtil.isEmpty(stageContentSetting)) { + //赋值线下内容设置 + stage.setCompetitionStageContentSetting(stageContentSetting); + + QueryWrapper queryWrapper2 = new QueryWrapper<>(); + queryWrapper2.eq("competition_id",contest.getId()); + queryWrapper2.eq("stage_id", stage.getStageId()); + queryWrapper2.eq("account_id", 0); + CompetitionStageFile myFile = stageFileService.getOne(queryWrapper2); + if (!ObjectUtil.isEmpty(myFile)){ + stage.setCompetitionStageFile(myFile); + } + + } + + } + + } + + //查询完整赛事设置 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("competition_id", contest.getId()); + CompleteCompetitionSetup setup = completeCompetitionSetupMapper.selectOne(wrapper); + if (setup != null) { + setup.setInvitationCode(null); + contest.setSetup(setup); + //查询用户当前赛事的团队id + if (setup.getCompetitionType() == 1) { + QueryWrapper teamQueryWrapper = new QueryWrapper<>(); + teamQueryWrapper.eq("competition_id", contest.getId()); + teamQueryWrapper.eq("account_id", 0); + CompetitionTeam team = competitionTeamMapper.selectOne(teamQueryWrapper); + if (team != null) { + if (team.getCaptain() == 0) { + contest.setTeamId(team.getTeamId()); + } else { + contest.setTeamId(team.getPid()); + } + } + } + //查询赛制 + QueryWrapper ruleQueryWrapper = new QueryWrapper<>(); + ruleQueryWrapper.eq("setup_id", setup.getSetupId()); + CompetitionRule competitionRule = competitionRuleMapper.selectOne(ruleQueryWrapper); + if (competitionRule != null) { + contest.setRule(competitionRule.getRule()); + } + } + }); + return R.ok().put("data", pageList); + } + + @Override + public R addCompetition(Competition competition) { + //平台来源(0:中台,1:职站) + if (competition.getPlatformSource() == 0) { + competition.setFounderName("平台创建"); + } + //判重: + // 2022-06.16 当前判重逻辑——>比赛范围为非本校内的比赛,名字要全平台判重。本校内的竞赛名字,只需要本校内判重 + boolean isRepeat = repeat(competition); + if (isRepeat) { + return R.error("赛事已存在"); + } + int insert = baseMapper.insert(competition); + + if (competition.getCompetitionAnnexList().size() > 0) { + competition.getCompetitionAnnexList().forEach(CompetitionAnnex -> { + CompetitionAnnex.setCompetitionId(competition.getId()); + competitionAnnexMapper.insert(CompetitionAnnex);//保存比赛附件 + }); + + } + if (competition.getCompetitionRangeList().size() > 0) { + competition.getCompetitionRangeList().forEach(competitionRange -> { + Integer getCompetitionId = competition.getId(); + competitionRange.setCompetitionId(getCompetitionId); + competitionRangeMapper.insert(competitionRange);//保存比赛范围 + }); + } + Integer setupId = 0; + //赛事类型为完整赛事,保存其他信息 +// if (competition.getReleaseType()==1){ + competition.getCompleteCompetitionSetup().setCompetitionId(competition.getId()); + int insert1 = completeCompetitionSetupMapper.insert(competition.getCompleteCompetitionSetup()); + if (insert1 > 0) { + setupId = competition.getCompleteCompetitionSetup().getSetupId(); + } +// } + + return insert > 0 ? R.ok().put("setupId", setupId).put("competitionId", competition.getId()) : R.error(); + } + + @Override + public R detailsOfCompetitionStage(CompetitionDetailReq req) { + //1.本次竞赛参加了该阶段的全部团队,用于与参加本阶段比赛的数据作对比 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("competition_id", req.getContestId()); + queryWrapper.eq("captain", 0); + queryWrapper.eq("is_del", 0); + List competitionTeams = competitionTeamMapper.selectList(queryWrapper); + Page page = new Page(req.getPageNum(), req.getPageSize()); + IPage pageList = baseMapper.detailsOfCompetitionStage(page, req); + return R.ok().put("page", pageList).put("applicantSize", competitionTeams.size()); + } + + @Override + public R allowedParticipateCompetition(AllowedParticipateCompetitionReq req) throws ScriptException { + //第一阶段无需处理,第二阶段查询第一阶段淘汰规则,以此类推 + if (req.getNumber() == 1) { + return R.ok(); + } + + CompetitionStage competitionStage = competitionStageMapper.selectById(req.getStageId() - 1); + String peopleLimit = competitionStage.getPeopleLimit();//人数限制 + Double percentageLimit = competitionStage.getPercentageLimit();//百分比限制 + String scoreLimit = competitionStage.getScoreLimit();//分数限制 + + //获取阶段信息 + FrontDeskStageTeamScoreDetailsReq detailsReq = new FrontDeskStageTeamScoreDetailsReq(); + detailsReq.setCompetitionId(req.getCompetitionId()); + detailsReq.setStageId(req.getStageId() - 1); + detailsReq.setIsOverallRanking(0); + //获取阶段信息 + R r = competitionStageService.frontOfficeCompetitionRanking(detailsReq); + List respList = (List) r.get("list"); + if (respList != null && respList.size() > 0) { + //查询完整赛事设置 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("competition_id", req.getCompetitionId()); + CompleteCompetitionSetup setup = completeCompetitionSetupMapper.selectOne(wrapper); + + int limitPeo = 0; + //查询团队淘汰规则 + if (StringUtils.isNotBlank(peopleLimit) && Integer.parseInt(peopleLimit) <= respList.size()) { + limitPeo = Integer.parseInt(peopleLimit); + } + //排名 + int limitPer = 0; + if (percentageLimit != null) { + double v = (percentageLimit / 100) * respList.size(); + limitPer = (int) Math.round(v); + } + + int limitS = 0; + if (StringUtils.isNotBlank(scoreLimit)) { + for (int i = 0; i < respList.size(); i++) { + String s = "a" + scoreLimit; + ScriptEngineManager manager = new ScriptEngineManager(); + ScriptEngine engine = manager.getEngineByName("js"); + String score = respList.get(i).getScore(); + engine.put("a", score); + boolean result = (boolean) engine.eval(s); + if (result) { + limitS = i + 1; + } + } + } + int min = this.minimum(limitPeo, limitPer, limitS); + + List sub = CollectionUtil.sub(respList, 0, min); + + //赛事类型(0为个人赛,1为团队赛) + if (setup.getCompetitionType() == 0) { + List list = new ArrayList<>(); + for (ListOfStageResultsResp resultsResp : sub) { + if (resultsResp.getAccountId() != null) { + list.add(resultsResp.getAccountId()); + } + } + boolean contains = list.contains(req.getAccountId()); + return contains ? R.ok() : R.error("无法参加比赛,你已被淘汰!"); + } else { + List list = new ArrayList<>(); + for (ListOfStageResultsResp resultsResp : sub) { + if (resultsResp.getTeamId() != null) { + list.add(resultsResp.getTeamId()); + } + } + boolean contains = list.contains(req.getTeamId()); + return contains ? R.ok() : R.error("无法参加比赛,你所在团队已被淘汰!"); + } + } + return R.error("晋级名单尚未发布,请等发布后再进入!"); + } + + /* 返回三个数中的非0最小值,全为零则返回0 */ + int minimum(int num1, int num2, int num3) { + if (num1 == 0) { + if (num2 == 0) { + if (num3 == 0) return 0; + else return num3; + } else { + if (num3 == 0) return num2; + else return (num2 < num3) ? num2 : num3; + } + } else { + if (num2 == 0) { + if (num3 == 0) return num1; + else return (num1 < num3) ? num1 : num3; + } else { + if (num3 == 0) return (num1 < num2) ? num1 : num2; + else { + int min = (num1 < num2) ? num1 : num2; + min = (min < num3) ? min : num3; + + return min; + } + } + } + + } + + public static void main(String[] args) throws ScriptException { + + String str = "a>=5"; + ScriptEngineManager manager = new ScriptEngineManager(); + ScriptEngine engine = manager.getEngineByName("js"); + engine.put("a", 5); + Object result = engine.eval(str); + System.out.println("结果类型:" + result.getClass().getName() + ",计算结果:" + result); + + } + + @Override + public List queryCompetitionStage(String competitionId, String accountId) { + if (StringUtils.isEmpty(accountId)) { + accountId = "0"; + } + //查询赛事阶段数据 + return baseMapper.selectCompetitionStage(competitionId, Integer.valueOf(accountId)); + } + + @Override + public R isParticipant(IsParticipantReq req) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("pid", req.getTeamId()); + List competitionTeams = competitionTeamMapper.selectList(queryWrapper); + int teamSize = competitionTeams.size() + 1; + + QueryWrapper setupQueryWrapper = new QueryWrapper<>(); + setupQueryWrapper.eq("competition_id", req.getCompetitionId()); + CompleteCompetitionSetup setup = completeCompetitionSetupMapper.selectOne(setupQueryWrapper); + if (teamSize < setup.getMinTeamSize()) { + return R.error("团队人数不满足要求,无法参加比赛!"); + } + QueryWrapper teamQueryWrapper = new QueryWrapper<>(); + teamQueryWrapper.eq("competition_id", req.getCompetitionId()); + teamQueryWrapper.eq("account_id", req.getAccountId()); + CompetitionTeam team = competitionTeamMapper.selectOne(teamQueryWrapper); + //查询参赛人员是否有数据 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("team_id", req.getTeamId()); + wrapper.eq("competition_id", req.getCompetitionId()); + wrapper.eq("stage_id", req.getStageId()); + List list = teamParticipantService.list(wrapper); + if (list != null && list.size() > 0) { + //有团队限制 + for (TeamParticipant teamParticipant : list) { + if (teamParticipant.getAccountId() == Integer.parseInt(req.getAccountId())) { + return R.ok(); + } + } + return R.error("不是当前阶段指定参赛人员,无法参加比赛!"); + } else { + //如果阶段有设置团队成员参赛限制人数的,没有指派就不能参加,如果阶段没有设置限制人数的,没有指派,设置指定才可以参加 + CompetitionStage competitionStage = competitionStageMapper.selectById(req.getStageId()); + if (competitionStage.getTeamNumLimit() != null && competitionStage.getTeamNumLimit() == 0) { + if (team.getCaptain() == 0) { + return R.error("无法参加比赛,前往参数信息设置指定团队成员参赛!"); + } + return R.error("无法参加比赛"); + } + } + if (team.getCaptain() == 0) { + return R.error("无法参加比赛,前往参数信息设置指定团队成员参赛!"); + } + return R.error("无法参加比赛"); + } +} diff --git a/competition/src/main/java/com/huoran/competition/service/impl/CompetitionStageContentSettingServiceImpl.java b/competition/src/main/java/com/huoran/competition/service/impl/CompetitionStageContentSettingServiceImpl.java new file mode 100644 index 0000000..b3efe3c --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/service/impl/CompetitionStageContentSettingServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.competition.service.impl; + +import com.huoran.competition.entity.CompetitionStageContentSetting; +import com.huoran.competition.mapper.CompetitionStageContentSettingMapper; +import com.huoran.competition.service.CompetitionStageContentSettingService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 赛事阶段内容设置 服务实现类 + *

+ * + * @author cheney + * @since 2023-11-13 + */ +@Service +public class CompetitionStageContentSettingServiceImpl extends ServiceImpl implements CompetitionStageContentSettingService { + +} diff --git a/competition/src/main/java/com/huoran/competition/service/impl/CompetitionStageFileServiceImpl.java b/competition/src/main/java/com/huoran/competition/service/impl/CompetitionStageFileServiceImpl.java new file mode 100644 index 0000000..8d4cca1 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/service/impl/CompetitionStageFileServiceImpl.java @@ -0,0 +1,83 @@ +package com.huoran.competition.service.impl; + + +import cn.hutool.core.util.ObjectUtil; +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.huoran.common.response.R; +import com.huoran.competition.entity.CompetitionStageFile; +import com.huoran.competition.entity.req.ContestStageFileReq; +import com.huoran.competition.entity.req.OverallStandingsInThePointsRaceReq; +import com.huoran.competition.entity.resp.CompetitionStageFileResp; +import com.huoran.competition.entity.resp.ListOfStageResultsResp; +import com.huoran.competition.mapper.CompetitionStageFileMapper; +import com.huoran.competition.service.CompetitionStageFileService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 赛事阶段文件 服务实现类 + *

+ * + * @author cheney + * @since 2023-11-13 + */ +@Service +public class CompetitionStageFileServiceImpl extends ServiceImpl implements CompetitionStageFileService { + + @Override + public R stageFile(ContestStageFileReq req) { + Page page = new Page(req.getPageNum(), req.getPageSize()); + IPage pageList = baseMapper.stageFile(page, req); + return R.ok().put("data", pageList); + } + + @Override + public List stageAllFiles(ContestStageFileReq req) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("competition_id", req.getCompetitionId()); + queryWrapper.eq("stage_id", req.getStageId()); + + String ids = ""; + if (!ObjectUtil.isEmpty(req.getIds())) { + for (Integer id : req.getIds()) { + ids += id + ","; + } + ids = ids.substring(0, ids.length() - 1); + queryWrapper.last(" AND FIND_IN_SET( id, " + ids + " )"); + } + + return baseMapper.selectList(queryWrapper); + } + + @Override + public CompetitionStageFile obtainTheFileUploadedInThisPhaseByStu(Integer accountId, Integer competitionId, Integer stageId) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("competition_id", competitionId); + queryWrapper.eq("stage_id", stageId); + queryWrapper.eq("account_id", accountId); + return baseMapper.selectOne(queryWrapper); + } + + @Override + public String getStudentName(Integer accountId) { + return baseMapper.getStudentName(accountId); + } + + @Override + public CompetitionStageFile checkWhetherTheFileHasBeenUploaded(CompetitionStageFile competitionStageFile) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("competition_id", competitionStageFile.getCompetitionId()); + queryWrapper.eq("stage_id", competitionStageFile.getStageId()); + queryWrapper.eq("account_id", competitionStageFile.getAccountId()); + queryWrapper.eq("school_id", competitionStageFile.getSchoolId()); + + CompetitionStageFile verify = baseMapper.selectOne(queryWrapper); + + return verify; + } +} diff --git a/competition/src/main/java/com/huoran/competition/service/impl/CompetitionStageServiceImpl.java b/competition/src/main/java/com/huoran/competition/service/impl/CompetitionStageServiceImpl.java new file mode 100644 index 0000000..1d89bd3 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/service/impl/CompetitionStageServiceImpl.java @@ -0,0 +1,1218 @@ +package com.huoran.competition.service.impl; + +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.entity.ExportParams; +import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.ObjectUtil; +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.huoran.api.NakadaiClient; +import com.huoran.api.UserClient; +import com.huoran.common.constant.DelConstant; +import com.huoran.common.constant.TeamCalculationMethodConstant; +import com.huoran.common.response.R; +import com.huoran.competition.entity.*; +import com.huoran.competition.entity.req.*; +import com.huoran.competition.entity.resp.*; +import com.huoran.competition.entity.vo.PersonageRankingExportVO; +import com.huoran.competition.entity.vo.RankingExportVO; +import com.huoran.competition.entity.vo.RegistrationVO; +import com.huoran.competition.mapper.*; +import com.huoran.competition.service.CompetitionStageService; +import com.huoran.competition.utils.ExcelStyleUtil; +import com.huoran.competition.utils.RankUtil; +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.script.ScriptEngine; +import javax.script.ScriptEngineManager; +import javax.script.ScriptException; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.net.URLEncoder; +import java.text.DecimalFormat; +import java.util.*; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.stream.Collectors; + +/** + *

+ * 赛事阶段设置表 服务实现类 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +@Service +public class CompetitionStageServiceImpl extends ServiceImpl implements CompetitionStageService { + + @Autowired + CompleteCompetitionSetupMapper competitionSetupMapper; + + @Autowired + CompetitionContentMapper competitionContentMapper; + + @Autowired + CompetitionTeamMapper teamMapper; + + @Autowired + CompetitionRuleMapper ruleMapper; + + @Autowired + CompetitionRankingMapper rankingMapper; + + @Autowired + CompetitionRegistrationMapper competitionRegistrationMapper; + + @Autowired + CompetitionStageContentSettingMapper competitionStageContentSettingMapper; + + @Autowired + UserClient userClient; + @Autowired + NakadaiClient nakadaiClient; + + @Override + public R queryCompetitionStageBySetupId(Integer setupId) { + List competitionStages = baseMapper.selectCompetitionStageBySetupId(setupId); + + + competitionStages.forEach(competitionStage -> { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("stage_id", competitionStage.getStageId()); + CompetitionContent competitionContent = competitionContentMapper.selectOne(queryWrapper); + if (competitionContent != null) { + String systemName = competitionContentMapper.selectSystem(competitionContent.getSystemId()); + String projectName = competitionContentMapper.selectProjectName(competitionContent.getProjectId()); + competitionContent.setSystemName(systemName); + competitionContent.setProjectName(projectName); + competitionStage.setCompetitionContent(competitionContent); + + + QueryWrapper queryWrapper1 = new QueryWrapper<>(); + queryWrapper1.eq("competition_id", setupId); + queryWrapper1.eq("stage_id", competitionStage.getStageId()); + CompetitionStageContentSetting stageContentSetting = competitionStageContentSettingMapper.selectOne(queryWrapper1); + if (!ObjectUtil.isEmpty(stageContentSetting)) { + //赋值线下内容设置 + competitionContent.setCompetitionStageContentSetting(stageContentSetting); + } + + } + }); + return R.ok().put("competitionStages", competitionStages); + } + + /** + * 阶段赛事排名 + * + * @param competitionId + * @param stageId + * @return + */ + @Override + public R stageRaceRanking(Integer competitionId, Integer stageId, Integer pageNum, Integer pageSize, Integer publicationType) throws ScriptException { + + //查看赛事类型是个人赛还是团队赛事 + CompleteCompetitionSetup competitionSetup = competitionSetupMapper.getRaceSettingsByRaceId(competitionId); + //获取阶段信息 + CompetitionStage competitionStage = baseMapper.selectById(stageId); + + + //1.本次竞赛参加了该阶段的全部团队,用于与参加本阶段比赛的数据作对比 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("competition_id", competitionId); + queryWrapper.eq("captain", 0); + queryWrapper.eq("is_del", 0); + List competitionTeams = teamMapper.selectList(queryWrapper); + + //2.本阶段参赛的数据 + List list = pointRace(competitionId, stageId, competitionSetup, competitionStage); + + + boolean publishStatus = false; + + //返回判断是否默认发布过(用于给前端判断显示是否发布/取消按钮) + WhetherToPublishParameterReq parameterReq = new WhetherToPublishParameterReq(); + parameterReq.setIsRelease(DelConstant.POST_STATUS); + parameterReq.setCompetitionId(competitionId); + parameterReq.setPublicationType(publicationType); + parameterReq.setStageId(stageId); + parameterReq.setIsOverallRanking(0); + List rankingList = rankingMapper.whetherToPublish(parameterReq); + if (rankingList.size() > 0) { + //发布过 + publishStatus = true; + } + if (competitionTeams.size() == 0 && list == null) { + //总数 + int total = competitionTeams.size(); + //总页数 + int pageSum = total % pageSize == 0 ? total / pageSize : total / pageSize + 1; + //分页 + List subList = competitionTeams.stream().skip((pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); + return R.ok().put("page", subList).put("pageSum", pageSum).put("total", total).put("publishStatus", publishStatus); + } + + + //判断当前阶段比赛是否开始 (防止出现比赛还没开始数据就已经存在了) + QueryWrapper queryWrapper1 = new QueryWrapper<>(); + queryWrapper1.eq("stage_id", stageId); + queryWrapper1.last(" AND unix_timestamp( start_time ) <= unix_timestamp( NOW( ) ) " + " AND unix_timestamp( end_time ) <= unix_timestamp( NOW( ) )"); + CompetitionContent competitionContent = competitionContentMapper.selectOne(queryWrapper1); + + + if (competitionContent == null) {//阶段赛未结束前的处理(没有进入比赛的人员 分数为—) + if (competitionSetup.getCompetitionType() == 0) { + + //个人赛 + PageRegistrationStaffReq registrationStaffReq = new PageRegistrationStaffReq(); + registrationStaffReq.setCompetitionId(competitionId + ""); + Page page = new Page(1, 10000); + List applicantVOList = competitionRegistrationMapper.selectApplicantByCondition(page, registrationStaffReq).getRecords(); + list = new RankUtil().singleStageMatchingSetPersonage(applicantVOList, list); + } else { + list = new RankUtil().singleStageMatchingSet(competitionTeams, list); + } + + } else { //阶段赛已完成后的处理 + //赛事类型(0为个人赛,1为团队赛)默认为0 + if (competitionSetup.getCompetitionType() == 1) { + // 1循环报名的全部团队 2循环阶段团队数据对比报名团队,没有对应的团队时,生成一条该团队数据,并给分数为0 + list = new RankUtil().matchingSet(competitionTeams, list); + //处理团队赛的耗时 + + + } else if (competitionSetup.getCompetitionType() == 0) { + + + PageRegistrationStaffReq registrationStaffReq = new PageRegistrationStaffReq(); + registrationStaffReq.setCompetitionId(competitionId + ""); + Page page = new Page(1, 10000); + List applicantVOList = competitionRegistrationMapper.selectApplicantByCondition(page, registrationStaffReq).getRecords(); + list = new RankUtil().matchingSetPersonage(applicantVOList, list); + } + + //对淘汰赛校验 超过第二阶段的情况下才需要校验去除被淘汰的队伍 + if (competitionStage.getNumber() != 1) { + competitionStage = baseMapper.selectById(stageId - 1); + String peopleLimit = competitionStage.getPeopleLimit();//人数限制 + Double percentageLimit = competitionStage.getPercentageLimit();//百分比限制 + String scoreLimit = competitionStage.getScoreLimit();//分数限制 + //查看赛事赛制 赛制(0为积分赛,1为淘汰赛,2为单项赛) + QueryWrapper ruleQueryWrapper = new QueryWrapper<>(); + ruleQueryWrapper.eq("setup_id", competitionSetup.getSetupId()); + CompetitionRule rule = ruleMapper.selectOne(ruleQueryWrapper); + if (rule.getRule() == 1) {//rule 赛制(0为积分赛,1为淘汰赛,2为单项赛) + if (list != null && list.size() > 0) { + //查询完整赛事设置 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("competition_id", competitionId); + + int limitPeo = 0; + //查询团队淘汰规则 + if (StringUtils.isNotBlank(peopleLimit) && Integer.parseInt(peopleLimit) <= list.size()) { + limitPeo = Integer.parseInt(peopleLimit); + } + //排名 + int limitPer = 0; + if (percentageLimit != null) { + double v = (percentageLimit / 100) * list.size(); + limitPer = (int) Math.round(v); + } + + int limitS = 0; + if (StringUtils.isNotBlank(scoreLimit)) { + for (int i = 0; i < list.size(); i++) { + String s = "a" + scoreLimit; + ScriptEngineManager manager = new ScriptEngineManager(); + ScriptEngine engine = manager.getEngineByName("js"); + String score = list.get(i).getScore(); + engine.put("a", score); + boolean result = (boolean) engine.eval(s); + if (result) { + limitS = i + 1; + } + } + } + int min = this.minimum(limitPeo, limitPer, limitS); + + list = CollectionUtil.sub(list, 0, min); + + + } + } + } + + } + + /*list = list.stream().sorted(Comparator.comparing(resp -> Double.parseDouble(resp.getScore().toString()))) + .collect(Collectors.toList());*/ + /*list.stream().sorted(Comparator.comparing(ListOfStageResultsResp::getScore,Comparator.comparingDouble(Double::parseDouble)) + .reversed()).sorted(Comparator.comparing(ListOfStageResultsResp::getTimeSum,Comparator.comparingDouble(Double::parseDouble))) + .collect(Collectors.toList());*/ + + + if (list != null) { + //总数 + int total = list.size(); + //总页数 + int pageSum = total % pageSize == 0 ? total / pageSize : total / pageSize + 1; + + + //是否考试(0未考 1已考) + /* list.stream() + .peek(r -> r.setTestOrNot(r.getReportId() == null ? 0 : 1)) + .collect(Collectors.toList()); + + + + List subList = list.stream() + .sorted(Comparator.comparing(ListOfStageResultsResp::getScore, Comparator.comparingDouble(Double::parseDouble)) + .reversed().thenComparing(ListOfStageResultsResp::getTimeSum, Comparator.comparingDouble(Double::parseDouble))) + .collect(Collectors.toList()).stream().skip((pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); + */ + + //是否考试(0未考 1已考) + /* list.stream().peek(r -> r.setTestOrNot(r.getReportId() == null ? 0 : 1)).collect(Collectors.toList()).sort( + Comparator.comparing(ListOfStageResultsResp::getTestOrNot, Comparator.comparingInt(Integer::intValue).reversed()). + thenComparing(Comparator.comparing(ListOfStageResultsResp::getScore, Comparator.comparingDouble(Double::parseDouble).reversed()) + .thenComparing(ListOfStageResultsResp::getTimeSum, Comparator.comparingDouble(Double::parseDouble))) + );*/ + + + if (!list.stream().peek(r -> r.setTestOrNot(r.getReportId() == null ? 0 : 1)).collect(Collectors.toList()).contains("-")) { + return processingPaging(pageNum, pageSize, list, publishStatus, total, pageSum); + } else { + //是否考试(0未考 1已考) + list.stream().peek(r -> r.setTestOrNot(r.getReportId() == null ? 0 : 1)).collect(Collectors.toList()); + //分数降序、耗时升序 + list = list.stream().sorted(Comparator.comparing(ListOfStageResultsResp::getTestOrNot, Comparator.comparingInt(Integer::intValue).reversed()).thenComparing(ListOfStageResultsResp::getScore, Comparator.comparingDouble(Double::parseDouble).reversed()).thenComparing(ListOfStageResultsResp::getTimeSum, Comparator.comparingDouble(Double::parseDouble))).collect(Collectors.toList()); + } + + + /*//是否考试(0未考 1已考) + list.stream().peek(r -> r.setTestOrNot(r.getReportId() == null ? 0 : 1)).collect(Collectors.toList()); + //分数降序、耗时升序 + list = list.stream().sorted(Comparator.comparing(ListOfStageResultsResp::getTestOrNot, Comparator.comparingInt(Integer::intValue).reversed()).thenComparing(ListOfStageResultsResp::getScore, Comparator.comparingDouble(Double::parseDouble).reversed()).thenComparing(ListOfStageResultsResp::getTimeSum, Comparator.comparingDouble(Double::parseDouble))).collect(Collectors.toList()); + +*/ + //分页 + return processingPaging(pageNum, pageSize, list, publishStatus, total, pageSum); + } + return R.ok(); + + } + + + private R processingPaging(Integer pageNum, Integer pageSize, List list, boolean publishStatus, int total, int pageSum) { + int startIndex = (pageNum - 1) * pageSize; + int endIndex = startIndex + pageSize; + List subList = list.stream().skip(startIndex).limit(pageSize).collect(Collectors.toList()); + return R.ok().put("page", subList).put("pageSum", pageSum).put("total", total).put("publishStatus", publishStatus); + } + + + /*private List dataProcessing(List competitionTeams, List pointRace, Integer stageId) { + + + //参赛全部队伍 A集合 + List allTeam = competitionTeams.stream().map(CompetitionTeam::getTeamId).collect(Collectors.toList()); + + //参与本次阶段,有成绩的队伍 B集合 + List teamWithResults = pointRace.stream().map(ListOfStageResultsResp::getTeamId).collect(Collectors.toList()); + + + //falseData:假数据,用于区分大赛没有参加团队的但是要给一条数据 + List falseData = new ArrayList<>(); + + // 对比 + for (Integer id : allTeam) { + if (!teamWithResults.contains(id)) { + // A集合中,B集合没有的对象id + System.err.println(id); + //判断B中没有的团队id,则加入到要返回的list中 + + ListOfStageResultsResp addTeamId = new ListOfStageResultsResp(); + addTeamId.setTeamId(id); + addTeamId.setScore("-"); + addTeamId.setTimeSum("-"); + falseData.add(addTeamId); + } + } + + pointRace.addAll(falseData); + + for (ListOfStageResultsResp l : pointRace) { + CompetitionTeam team = teamMapper.selectById(l.getTeamId()); + if (team != null) { + if (l.getTeamName() == null) { + + l.setTeamName(team.getTeamName()); + } + + if (l.getLeaderName() == null) { + l.setLeaderName(userClient.getUserName(team.getAccountId())); + } + + if (l.getSchoolId() == null) { + Integer schoolId = userClient.getSchoolIdByAccountId(team.getAccountId() + ""); + l.setSchoolName(nakadaiClient.getTheSchoolNameBySchoolId(schoolId).getSchoolName()); + } + } + } + return pointRace; + }*/ + + + /** + * 找出list2中不存在的元素并新增该记录 + * (list1中的挪过去) + * + * @return 处理后的List2 + */ + private List addNonExistData(List competitionTeams, List selectApplicantByCondition, List pointRace, Integer stageId, Integer competitionType) { + + + if (competitionType == 0) { //0:个人赛 + //报名本次大赛的全部人员 A集合 + List allApplicants = selectApplicantByCondition.stream().map(RegistrationVO::getAccountId).collect(Collectors.toList()); + //参与本次阶段,有成绩的队伍 B集合 + List teamWithResults = pointRace.stream().map(ListOfStageResultsResp::getAccountId).collect(Collectors.toList()); + List intClusterIds = teamWithResults.stream().mapToInt(Integer::parseInt).boxed().collect(Collectors.toList()); + //falseData:假数据,用于区分大赛没有参加团队的但是要给一条数据 + List falseData = new ArrayList<>(); + + // 对比 + for (Integer id : allApplicants) { + if (!intClusterIds.contains(id)) { + // A集合中,B集合没有的对象id + ////System.err.println(id); + //判断B中没有的账号id,则加入到要返回的list中 + ListOfStageResultsResp addTeamId = new ListOfStageResultsResp(); + addTeamId.setScore("0"); + addTeamId.setTimeSum("0"); + addTeamId.setAccountId(id + ""); + falseData.add(addTeamId); + } + } + if (pointRace != null) { + pointRace.addAll(falseData); + + for (ListOfStageResultsResp l : pointRace) { + if (l.getSchoolId() == null) { + Integer schoolId = userClient.getSchoolIdByAccountId(l.getAccountId() + ""); + l.setSchoolId(schoolId); + l.setSchoolName(nakadaiClient.getTheSchoolNameBySchoolId(schoolId).getSchoolName()); + } + + if (l.getLeaderName() == null) { + l.setAccountId(l.getAccountId()); + l.setUserName(userClient.getUserName(Integer.valueOf(l.getAccountId()))); + } + + } + } + } else if (competitionType == 1) {//团队赛 + //参赛全部队伍 A集合 + List allTeam = competitionTeams.stream().map(CompetitionTeam::getTeamId).collect(Collectors.toList()); + + List teamWithResults = null; + if (pointRace != null) { + //参与本次阶段,有成绩的队伍 B集合 + teamWithResults = pointRace.stream().map(ListOfStageResultsResp::getTeamId).collect(Collectors.toList()); + } + + //falseData:假数据,用于区分大赛没有参加团队的但是要给一条数据 + List falseData = new ArrayList<>(); + + // 对比 + for (Integer id : allTeam) { + if (!teamWithResults.contains(id)) { + // A集合中,B集合没有的对象id + System.err.println(id); + //判断B中没有的团队id,则加入到要返回的list中 + + ListOfStageResultsResp addTeamId = new ListOfStageResultsResp(); + addTeamId.setTeamId(id); + addTeamId.setScore("0"); + addTeamId.setTimeSum("0"); + falseData.add(addTeamId); + } + } + + + if (pointRace != null) { + pointRace.addAll(falseData); + + for (ListOfStageResultsResp l : pointRace) { + CompetitionTeam team = teamMapper.selectById(l.getTeamId()); + if (team != null) { + if (l.getTeamName() == null) { + + l.setTeamName(team.getTeamName()); + } + + if (l.getLeaderName() == null) { + l.setLeaderName(userClient.getUserName(team.getAccountId())); + l.setAccountId(team.getAccountId() + ""); + } + + if (l.getSchoolId() == null) { + Integer schoolId = userClient.getSchoolIdByAccountId(team.getAccountId() + ""); + l.setSchoolName(nakadaiClient.getTheSchoolNameBySchoolId(schoolId).getSchoolName()); + l.setSchoolId(schoolId); + } + } + } + } + + } + return pointRace; + } + + @Override + public R overallRanking(OverallStandingsInThePointsRaceReq req) { + //获取大赛总分排名设置规则 + CompetitionRule competitionRule = ruleMapper.getTheRulesOfTheRaceByTheRaceId(req.getCompetitionId()); + + + List overallEventRankingRespList = new ArrayList<>(); + //todo 1循环报名的全部团队 2循环阶段团队数据对比报名团队,没有对应的团队时,生成一条该团队数据,并给分数为0 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("captain", 0); + queryWrapper.eq("is_del", 0); + queryWrapper.eq("competition_id", req.getCompetitionId()); + List competitionTeams = teamMapper.selectList(queryWrapper); + //查看赛事类型是个人赛还是团队赛事 + CompleteCompetitionSetup competitionSetup = competitionSetupMapper.getRaceSettingsByRaceId(req.getCompetitionId()); + Integer competitionType = competitionSetup.getCompetitionType(); + + for (Integer stageId : req.getStageIds()) { + OverallEventRankingResp rankingResp = new OverallEventRankingResp(); + // 获取阶段信息 + CompetitionStage competitionStage = baseMapper.selectById(stageId); + //获取每个阶段的团队、个人成绩列表 + List pointRace = pointRace(req.getCompetitionId(), stageId, competitionSetup, competitionStage); + + //判断当前阶段比赛是否开始 (防止出现比赛还没开始数据就已经存在了) + QueryWrapper queryWrapper1 = new QueryWrapper<>(); + queryWrapper1.eq("stage_id", stageId); + queryWrapper1.last(" AND start_time <= now()"); + CompetitionContent competitionContent = competitionContentMapper.selectOne(queryWrapper1); + + //个人赛 + PageRegistrationStaffReq registrationStaffReq = new PageRegistrationStaffReq(); + registrationStaffReq.setCompetitionId(req.getCompetitionId() + ""); + Page page = new Page(1, 10000); + List applicantVOList = competitionRegistrationMapper.selectApplicantByCondition(page, registrationStaffReq).getRecords(); + + if (competitionContent != null) { + pointRace = addNonExistData(competitionTeams, applicantVOList, pointRace, stageId, competitionType); + } + + rankingResp.setStageName(competitionStage.getStageName()); + rankingResp.setStageId(competitionStage.getStageId()); + if (pointRace != null) { + rankingResp.setStageTeamInformation(pointRace); + } + + rankingResp.setPointWeight(competitionStage.getPointWeight()); + overallEventRankingRespList.add(rankingResp); + + } + + //成绩计算方式(0:各阶段加权求和,1:各阶段成绩求和,2:各阶段成绩平均值 + String teamScore = "0"; + + List returnTotalSet = new ArrayList<>();//返回的集合 + + //总成绩计算方式(0:各阶段加权求和,1:各阶段成绩求和,2:各阶段成绩平均值) + Integer resultCalculationMethod = competitionRule.getResultCalculationMethod(); + for (OverallEventRankingResp rankingResp : overallEventRankingRespList) { + if (rankingResp.getStageTeamInformation() != null) { + //各阶段求值 权重、求和、平均等等 + totalStageScoreCalculation(competitionRule, returnTotalSet, rankingResp); + } + } + + + if (competitionType == 1) { + Map map = new HashMap<>(); + for (OverallEventRankingResp item : overallEventRankingRespList) { + if (item.getStageTeamInformation() != null) { + for (ListOfStageResultsResp l : item.getStageTeamInformation()) { + + CompetitionRangeTeamCountResp rangeTeamCountResp = new CompetitionRangeTeamCountResp(); + + List scoreList = new ArrayList<>(); + List timeSum = new ArrayList<>(); + if (map.get(l.getTeamId()) != null) { + CompetitionRangeTeamCountResp rangeTeamCountResp2 = map.get(l.getTeamId()); + scoreList = rangeTeamCountResp2.getScoreList(); + timeSum = rangeTeamCountResp2.getTimeSum(); + } + + scoreList.add(l.getScore()); + timeSum.add(l.getTimeSum()); + + rangeTeamCountResp.setScoreList(scoreList); + rangeTeamCountResp.setTimeSum(timeSum); + map.put(l.getTeamId(), rangeTeamCountResp); + } + } + } + //List stageTeamInformation = overallEventRankingRespList.get(overallEventRankingRespList.size() - 1).getStageTeamInformation(); + List stageTeamInformation = null; + + for (OverallEventRankingResp res : overallEventRankingRespList) { + stageTeamInformation = res.getStageTeamInformation(); + Set set = map.keySet(); + if (stageTeamInformation != null) { + for (ListOfStageResultsResp l : stageTeamInformation) { + for (Integer str : set) { + if (str == l.getTeamId()) { + CompetitionRangeTeamCountResp in = map.get(str); + + //统计各个多阶段分数 + List dList = in.getScoreList().stream().map((d) -> { + return Double.valueOf(d + ""); + }).collect(Collectors.toList()); + + ScoreProcessing(competitionRule, l, dList); + + + //统计耗时 + List timeList = in.getTimeSum().stream().map((d) -> { + return Double.valueOf(d + ""); + }).collect(Collectors.toList()); + Double time = 0.0; + /**根据赛事规则选择的总成绩计算方式处理耗时*/ + time = timeList.stream().mapToDouble(Double::doubleValue).sum(); + //总成绩计算方式(0:各阶段加权求和,1:各阶段成绩求和,2:各阶段成绩平均值) + switch (resultCalculationMethod) { + case 0: + + break; + case 1: + time = time; + break; + case 2: + time = Double.valueOf(time) / timeList.size(); + break; + } + + + //处理保留两位小数 + + DecimalFormat decimal = new DecimalFormat("0.00"); + decimal.setRoundingMode(RoundingMode.DOWN); + String strTime = decimal.format(Double.valueOf(time)); + + l.setTimeSum(strTime + ""); + + } + + } + } + stageTeamInformation.sort((o1, o2) -> (int) (Double.valueOf(o2.getScore()) - Double.valueOf(o1.getScore()))); + //拿到报名名单的全部数据,对比每个阶段的分数数据, + + //总数 + int total = stageTeamInformation.size(); + //总页数 + int pageSum = total % req.getPageSize() == 0 ? total / req.getPageSize() : total / req.getPageSize() + 1; + + + //分页 + // List subList = stageTeamInformation.stream().skip((req.getPageNum() - 1) * req.getPageSize()).limit(req.getPageSize()).collect(Collectors.toList()); + + //分页 + List subList = stageTeamInformation.stream().sorted(Comparator.comparing(ListOfStageResultsResp::getScore, Comparator.comparingDouble(Double::parseDouble)).reversed().thenComparing(ListOfStageResultsResp::getTimeSum, Comparator.comparingDouble(Double::parseDouble))).collect(Collectors.toList()).stream().skip((req.getPageNum() - 1) * req.getPageSize()).limit(req.getPageSize()).collect(Collectors.toList()); + + WhetherToPublishParameterReq parameterReq = getToPublishParameterReq(req); + + //返回判断是否默认发布过 + List rankingList = rankingMapper.whetherToPublishTheOverallScoreRanking(parameterReq); + + boolean publishStatus = false; + if (rankingList.size() > 0) { + //发布过 + publishStatus = true; + } + //处理保留两位小数 + subList.forEach(data -> { + DecimalFormat decimal = new DecimalFormat("0.00"); + decimal.setRoundingMode(RoundingMode.DOWN); + String str = decimal.format(Double.valueOf(data.getScore())); + data.setScore(str); + }); + /*subList = new RankUtil().matchingSet(competitionTeams, subList);*/ + return R.ok().put("page", subList).put("pageSum", pageSum).put("total", total).put("publishStatus", publishStatus); + } + } + + + return R.ok(); + + } else { + //个人赛 + List individualCompetition = new ArrayList<>(); + Map> listMap = returnTotalSet.stream().collect(Collectors.groupingBy(ListOfStageResultsResp::getAccountId)); + List retList = new ArrayList<>(); + + for (String accountId : listMap.keySet()) { + // System.out.println("key的值是:" + accountId + "=============" + "value的值是:" + listMap.get(accountId)); + List resultsRespList = listMap.get(accountId); + retList = merge(resultsRespList); + + individualCompetition.addAll(retList); + + } + + // /*return R.ok(individualCompetition);*/ + + PageRegistrationStaffReq registrationStaffReq = new PageRegistrationStaffReq(); + registrationStaffReq.setCompetitionId(req.getCompetitionId() + ""); + Page page = new Page(1, 10000); + List applicantVOList = competitionRegistrationMapper.selectApplicantByCondition(page, registrationStaffReq).getRecords(); + individualCompetition = new RankUtil().matchingSetPersonage(applicantVOList, individualCompetition); + + individualCompetition.sort(new Comparator() { + @Override + public int compare(ListOfStageResultsResp o1, ListOfStageResultsResp o2) { + return (int) (Double.valueOf(o2.getScore()) - Double.valueOf(o1.getScore())); + } + }); + + + // + + //总数 + int total = individualCompetition.size(); + //总页数 + int pageSum = total % req.getPageSize() == 0 ? total / req.getPageSize() : total / req.getPageSize() + 1; + + //分页 + List subList = individualCompetition.stream().skip((req.getPageNum() - 1) * req.getPageSize()).limit(req.getPageSize()).collect(Collectors.toList()); + + + WhetherToPublishParameterReq parameterReq = new WhetherToPublishParameterReq(); + parameterReq.setIsRelease(DelConstant.POST_STATUS); + parameterReq.setCompetitionId(req.getCompetitionId()); + //parameterReq.setPublicationType(DelConstant.PUBLICATION_TYPE_MANUALOPERATION); + parameterReq.setIsOverallRanking(1); + parameterReq.setPublicationType(req.getPublicationType()); + if (req.getLocationStageId() != null) { + parameterReq.setStageId(req.getLocationStageId()); + } + + + //返回判断是否默认发布过 + List rankingList = rankingMapper.whetherToPublishTheOverallScoreRanking(parameterReq); + + boolean publishStatus = false; + if (rankingList.size() > 0) { + //发布过 + publishStatus = true; + } + if (subList.size() > 0) { + //处理保留两位小数 + subList.forEach(data -> { + double parseDouble = Double.parseDouble(data.getScore()); + DecimalFormat df = new DecimalFormat("######0.00"); + String str = df.format(parseDouble); + data.setScore(str); + }); + } + return R.ok().put("page", subList).put("pageSum", pageSum).put("total", total).put("publishStatus", publishStatus); + } + + } + + static void ScoreProcessing(CompetitionRule competitionRule, ListOfStageResultsResp l, List dList) { + switch (competitionRule.getResultCalculationMethod()) { + case 0://0:各阶段加权求和 + case 1://1:各阶段成绩求和 + // java8 集合求和 + Double sum = dList.stream().mapToDouble(Double::doubleValue).sum(); + l.setScore(sum + ""); + break; + case 2://2:各阶段成绩平均值 + DoubleSummaryStatistics statistics = dList.stream().mapToDouble(Number::doubleValue).summaryStatistics(); + Double avg = statistics.getAverage(); + l.setScore(avg + ""); + break; + } + } + + private static WhetherToPublishParameterReq getToPublishParameterReq(OverallStandingsInThePointsRaceReq req) { + WhetherToPublishParameterReq parameterReq = new WhetherToPublishParameterReq(); + parameterReq.setIsRelease(DelConstant.POST_STATUS); + parameterReq.setCompetitionId(req.getCompetitionId()); + parameterReq.setPublicationType(req.getPublicationType()); + parameterReq.setIsOverallRanking(1); + if (req.getLocationStageId() != null) { + parameterReq.setStageId(req.getLocationStageId()); + } + return parameterReq; + } + + + //总分阶段成绩计算 + static void totalStageScoreCalculation(CompetitionRule competitionRule, List returnTotalSet, OverallEventRankingResp rankingResp) { + String teamScore; + String teamTime; + switch (competitionRule.getResultCalculationMethod()) { + case 0://0:各阶段加权求和 + for (ListOfStageResultsResp list : rankingResp.getStageTeamInformation()) { + //获取权重比乘以分数得到本团队该阶段的分数 + teamScore = (rankingResp.getPointWeight() / 100) * Double.valueOf(list.getScore()) + ""; + teamTime = (rankingResp.getPointWeight() / 100) * Double.valueOf(list.getTimeSum()) + ""; + + list.setScore(teamScore); + list.setTimeSum(teamTime); + returnTotalSet.add(list); + } + break; + case 1://1:各阶段成绩求和 + + break; + + case 2://2:各阶段成绩平均值 + for (ListOfStageResultsResp list : rankingResp.getStageTeamInformation()) { + //获取权重比乘以分数得到本团队该阶段的分数 + list.setScore(list.getScore()); + list.setTimeSum(list.getTimeSum()); + returnTotalSet.add(list); + } + break; + } + } + + + static void evaluationAtEachStage(CompetitionRule competitionRule, List returnTotalSet, OverallEventRankingResp rankingResp) { + String teamScore; + String teamTime; + switch (competitionRule.getResultCalculationMethod()) { + case 0://0:各阶段加权求和 + for (ListOfStageResultsResp list : rankingResp.getStageTeamInformation()) { + //获取权重比乘以分数得到本团队该阶段的分数 + teamScore = (rankingResp.getPointWeight() / 100) * Double.valueOf(list.getScore()) + ""; + teamTime = (rankingResp.getPointWeight() / 100) * Double.valueOf(list.getTimeSum()) + ""; + + list.setScore(teamScore); + list.setTimeSum(teamTime); + returnTotalSet.add(list); + } + break; + case 1://1:各阶段成绩求和 + case 2://2:各阶段成绩平均值 + for (ListOfStageResultsResp list : rankingResp.getStageTeamInformation()) { + //获取权重比乘以分数得到本团队该阶段的分数 + list.setScore(list.getScore()); + list.setTimeSum(list.getTimeSum()); + returnTotalSet.add(list); + } + break; + } + } + + /** + * 将id进行合并nums, sums 相加道回合并后的集合使用Java8的流进行处理 + */ + + public static List merge(List list) { + List result = list.stream().collect(Collectors.toMap(ListOfStageResultsResp::getAccountId, a -> a, (o1, o2) -> { + Double score = Double.valueOf(o1.getScore()) + Double.valueOf(o2.getScore()); + Double time = Double.valueOf(o1.getTimeSum()) + Double.valueOf(o2.getTimeSum()); + o1.setScore(score + ""); + o1.setTimeSum(time + ""); + o1.setTeamId(null); + return o1; + })).values().stream().collect(Collectors.toList()); + + return result; + + } + + + /** + * 积分赛 + * 个人赛: + * 当前阶段的排名就是按照个人在当前阶段的成绩来(成绩一样比用时) + * 当前阶段的总分就还是按照它本身设置的阶段之和还是阶段平均什么的来 + * + * @param competitionId + * @param stageId + * @param competitionSetup + * @return + */ + public List pointRace(Integer competitionId, Integer stageId, CompleteCompetitionSetup competitionSetup, CompetitionStage competitionStage) { + + //赛事类型(0为个人赛,1为团队赛)默认为0 + if (competitionSetup.getCompetitionType() == TeamCalculationMethodConstant.TYPE_OF_EVENT_INDIVIDUAL_COMPETITION) {//个人赛 + + if (competitionStage.getMethod() == 2) { //比赛方式(0实操,1理论,2线下) + List offlineIndividualPointsCompetition = teamMapper.offlineIndividualPointsCompetition(new StageRankingReq().setStageId(stageId).setCompetitionId(competitionId)); + offlineIndividualPointsCompetition.sort(new Comparator() { + @Override + public int compare(ListOfStageResultsResp o1, ListOfStageResultsResp o2) { + return (int) (Double.valueOf(o2.getScore()) - Double.valueOf(o1.getScore())); + } + }); + return offlineIndividualPointsCompetition; + } else { + List onlineIndividualPointsCompetition = teamMapper.onlineIndividualPointsCompetition(new StageRankingReq().setStageId(stageId).setCompetitionId(competitionId)); + + onlineIndividualPointsCompetition.sort(new Comparator() { + @Override + public int compare(ListOfStageResultsResp o1, ListOfStageResultsResp o2) { + return (int) (Double.valueOf(o2.getScore()) - Double.valueOf(o1.getScore())); + } + }); + return onlineIndividualPointsCompetition; + } + } else if (competitionSetup.getCompetitionType() == TeamCalculationMethodConstant.TYPE_OF_EVENT_TEAM_EVENT) {//团队赛 + + //团队排名:用时以及分数依据当前阶段成绩的计算方式(最高分、平均分、求和)取 + //如:当前阶段赛事成绩计算方式为取最高分,则用户用时以及分数取得是当前团队下的最高分当前成绩的用时以及分数 + //团队成绩计算方式(0:最高分,1:平均分,2:求和) + + //1.获取参与该大赛的团队 + String teamIds = teamMapper.getTeamInformation(competitionId); + if (teamIds != null) { + List offLineTeamPointsCompetition; + if (competitionStage.getMethod() == 2) { //比赛方式为线下时候查询的ol_user_score表统计分数,线下比赛是没有实验报告 + //团队积分赛线下 ———— 求各个团队的最高分、平均分、总和 + offLineTeamPointsCompetition = teamMapper.offLineTeamPointsCompetition(new StageRankingReq().setStageId(stageId).setCompetitionId(competitionId).setTeamIds(teamIds)); + + + for (ListOfStageResultsResp resp : offLineTeamPointsCompetition) { + + //计算耗时 + TimeConsumingCalculationResp timeConsuming = teamMapper.functionAcquisitionTime(new StageRankingReq().setStageId(stageId).setCompetitionId(competitionId).setTeamId(resp.getTeamId())); + + //团队成绩计算方式(0:最高分,1:平均分,2:总分)stageName = "决赛,不限制人,取最高。公布" + if (competitionStage.getTeamCalculationMethod().equals("0")) { + resp.setScore(resp.getMaxScore()); + if (!ObjectUtil.isEmpty(timeConsuming)) { + resp.setTimeSum(timeConsuming.getMaximumTimeConsuming()); + } + + } else if (competitionStage.getTeamCalculationMethod().equals("1")) { + resp.setScore(resp.getAvgScore()); + + if (!ObjectUtil.isEmpty(timeConsuming)) { + resp.setTimeSum(timeConsuming.getAverageTimeConsuming()); + } + } else if (competitionStage.getTeamCalculationMethod().equals("2")) { + resp.setScore(resp.getSumScore()); + + if (!ObjectUtil.isEmpty(timeConsuming)) { + resp.setTimeSum(timeConsuming.getTotalTimeSpent()); + } + + } + + } + + // System.out.println("5.2.按学号降序、年龄降序 (先以年龄升序,再进行年龄升序,结果进行(学号&年龄)降序)"); + /* offLineTeamPointsCompetition + .stream() + .sorted(Comparator.comparingDouble(ListOfStageResultsResp::getScore) + .thenComparingInt(ListOfStageResultsResp::getTimeSum) + .reversed()) + .collect(Collectors.toList()) + .forEach(System.out::println);*/ + + /*offLineTeamPointsCompetition.sort(new Comparator() { + @Override + public int compare(ListOfStageResultsResp o1, ListOfStageResultsResp o2) { + return (int) (Double.valueOf(o2.getScore()) - Double.valueOf(o1.getScore())); + } + + @Override + public int compare(ListOfStageResultsResp o1, ListOfStageResultsResp o2) { + return (int) (Double.valueOf(o2.getTimeSum()) - Double.valueOf(o1.getTimeSum())); + } + });*/ + + + } else { + //团队积分赛线上 ———— 求各个在队伍线上的最高分、平均分、总和 + offLineTeamPointsCompetition = teamMapper.onlineTeamPointsContest(new StageRankingReq().setStageId(stageId).setCompetitionId(competitionId).setTeamIds(teamIds)); + + for (ListOfStageResultsResp resp : offLineTeamPointsCompetition) { + + //计算耗时 + TimeConsumingCalculationResp timeConsuming = teamMapper.functionAcquisitionTime(new StageRankingReq().setStageId(stageId).setCompetitionId(competitionId).setTeamId(resp.getTeamId())); + + //团队成绩计算方式(0:最高分,1:平均分,2:总分) + if (competitionStage.getTeamCalculationMethod().equals("0")) { + resp.setScore(resp.getMaxScore()); + + //查询最高分,最短耗时的分数 + TimeConsumingCalculationResp maxTime = teamMapper.highestScoreTakesTheLeastTime(new StageRankingReq().setStageId(stageId).setCompetitionId(competitionId).setTeamId(resp.getTeamId())); + + + resp.setTimeSum(maxTime.getMaximumTimeConsuming()); + + } else if (competitionStage.getTeamCalculationMethod().equals("1")) { + resp.setScore(resp.getAvgScore()); + resp.setTimeSum(timeConsuming.getAverageTimeConsuming()); + } else if (competitionStage.getTeamCalculationMethod().equals("2")) { + + + double score = teamMapper.teamSum(new StageRankingReq().setStageId(stageId).setCompetitionId(competitionId).setTeamId(resp.getTeamId())); + resp.setScore(score + ""); + resp.setTimeSum(timeConsuming.getTotalTimeSpent()); + + } + } + //顺序不能更改,上面分数需要赋值 否则异常 + /* offLineTeamPointsCompetition.sort(new Comparator() { + @Override + public int compare(ListOfStageResultsResp o1, ListOfStageResultsResp o2) { + return (int) (Double.valueOf(o2.getScore()) - Double.valueOf(o1.getScore())); + } + });*/ + offLineTeamPointsCompetition = offLineTeamPointsCompetition.stream().sorted(Comparator.comparing(ListOfStageResultsResp::getScore).thenComparing(Comparator.comparing(ListOfStageResultsResp::getTimeSum))).collect(Collectors.toList()); + + + } + return offLineTeamPointsCompetition; + } + } + return null; + } + + + /** + * 单个阶段团队得分详情 + * 需要区分线上、线下情况 + * + * @param req + * @return + */ + @Override + public R stageTeamScoreDetails(StageTeamScoreDetailsReq req) { + // 获取阶段信息 + CompetitionStage competitionStage = baseMapper.selectById(req.getStageId()); + //比赛方式(0实操,1理论,2线下)默认为0" + Page page = new Page(req.getPageNum(), req.getPageSize()); + IPage pageList = null; + switch (competitionStage.getMethod()) { + case 0: + case 1: + pageList = teamMapper.stageTeamScoreDetails(page, req); + break; + case 2: + pageList = teamMapper.offlineTeamScores(page, req); + break; + + } + return R.ok().put("page", pageList); + + } + + /** + * 多阶段 + * + * @param req + * @return + */ + @Override + public R multipleStageTeamScoreDetails(StageTeamScoreDetailsReq req) { + Page page = new Page(req.getPageNum(), req.getPageSize()); + IPage pageList = teamMapper.multipleStageTeamScoreDetails(page, req); + return R.ok().put("page", pageList); + } + + /** + * 总分排名得分详情 + * + * @param req + * @return + */ + @Override + public R totalRankingScoreDetails(StageTeamScoreDetailsReq req) { + List stageTeamInformation = new ArrayList(); + AtomicBoolean isPointWeight = new AtomicBoolean(false); + req.getStageIds().forEach(stageId -> { + //获取阶段信息 + DetailsOfTotalTeamScoresResp resp = new DetailsOfTotalTeamScoresResp(); + CompetitionStage competitionStage = baseMapper.selectById(stageId); + resp.setStageName(competitionStage.getStageName()); + resp.setPointWeight(competitionStage.getPointWeight()); + resp.setTeamCalculationMethod(competitionStage.getTeamCalculationMethod()); + resp.setStageId(stageId); + req.setStageId(stageId); + //req.setStageIds(Collections.singletonList(stageId)); + + Page page = new Page(1, 1000); + IPage information = null; + //获取线上线下的团队得分成绩 + switch (competitionStage.getMethod()) { + case 0: + case 1: + information = teamMapper.stageTeamScoreDetails(page, req); + + + break; + case 2: + information = teamMapper.offlineTeamScores(page, req); + break; + } + + resp.setStageTeamInformation(information.getRecords()); + stageTeamInformation.add(resp); + Double score = 0.0; + List upSort = new ArrayList<>(); + if (information.getRecords().size() > 0) { + //累计分数 + Integer count = 0; + for (ListOfStageResultsResp resultsResp : information.getRecords()) { + score += new Double(resultsResp.getScore()); + count++; + upSort.add(new Double(resultsResp.getScore())); + } + + double fractionalValue = 0.0; + double teamScore = 0.0; + + + //团队成绩计算方式(0:最高分,1:平均分,2:总分(求和) + if (!ObjectUtil.isEmpty(competitionStage.getPointWeight())) { + //团队成绩计算方式(0:最高分,1:平均分,2:总分(求和) + switch (competitionStage.getTeamCalculationMethod()) { + case "0": + Optional max = upSort.stream().max(Comparator.comparingDouble(Double::longValue)); + Double maxValue = max.get(); + fractionalValue = maxValue * (resp.getPointWeight() / 100); + break; + case "1": + + + fractionalValue = div(score, count, 2) * (resp.getPointWeight() / 100); + + + break; + case "2": + fractionalValue = score * (resp.getPointWeight() / 100); + break; + } + BigDecimal bigDecimal = new BigDecimal(fractionalValue); + teamScore = bigDecimal.setScale(2, BigDecimal.ROUND_DOWN).doubleValue(); + isPointWeight.set(true); + } else { + switch (competitionStage.getTeamCalculationMethod()) { + case "0": + Optional max = upSort.stream().max(Comparator.comparingDouble(Double::longValue)); + Double maxValue = max.get(); + teamScore = maxValue; + break; + case "1": + teamScore = score / count; + break; + case "2": + teamScore = score; + break; + } + isPointWeight.set(false); + } + + + resp.setTeamScore(teamScore); + } + }); + + + return R.ok().put("data", stageTeamInformation).put("isPointWeight", isPointWeight); + + } + + /** + * Double精确的除法运算, 当出现除不尽的情况时, 精确到小数点以后10位, 以后的数字四舍五入 + * + * @param d1 被除数 + * @param d2 除数 + * @param scale 表示需要精确到小数点的后几位 + * @return 两个参数的商 + */ + public static double div(double d1, double d2, int scale) { + if (scale < 0) { + throw new IllegalArgumentException("参数[scale]必须是正整数或者零"); + } + BigDecimal value1 = new BigDecimal(Double.toString(d1)); + BigDecimal value2 = new BigDecimal(Double.toString(d2)); + return value1.divide(value2, scale, BigDecimal.ROUND_DOWN).doubleValue(); + } + + @Override + public void derivedRanking(List list, HttpServletResponse response) throws IOException { + // 告诉浏览器用什么软件可以打开此文件 + response.setHeader("content-Type", "application/vnd.ms-excel"); + // 下载文件的默认名称 + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("赛事阶段成绩导出", "UTF-8") + ".xls"); + //编码 + response.setCharacterEncoding("UTF-8"); + Workbook workbook = null; + workbook = ExcelExportUtil.exportExcel(new ExportParams(), RankingExportVO.class, list); + ExportParams exportParams = new ExportParams("团队成绩排名表", "sheet1", ExcelType.XSSF); + exportParams.setStyle(ExcelStyleUtil.class); + workbook.write(response.getOutputStream()); + } + + @Override + public void individualDerivedRanking(List list, HttpServletResponse response) throws IOException { + // 告诉浏览器用什么软件可以打开此文件 + response.setHeader("content-Type", "application/vnd.ms-excel"); + // 下载文件的默认名称 + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("赛事阶段成绩导出", "UTF-8") + ".xls"); + //编码 + response.setCharacterEncoding("UTF-8"); + Workbook workbook = null; + workbook = ExcelExportUtil.exportExcel(new ExportParams(), PersonageRankingExportVO.class, list); + ExportParams exportParams = new ExportParams("个人成绩排名表", "sheet1", ExcelType.XSSF); + exportParams.setStyle(ExcelStyleUtil.class); + workbook.write(response.getOutputStream()); + } + + + /* 返回三个数中的非0最小值,全为零则返回0 */ + int minimum(int num1, int num2, int num3) { + if (num1 == 0) { + if (num2 == 0) { + if (num3 == 0) return 0; + else return num3; + } else { + if (num3 == 0) return num2; + else return (num2 < num3) ? num2 : num3; + } + } else { + if (num2 == 0) { + if (num3 == 0) return num1; + else return (num1 < num3) ? num1 : num3; + } else { + if (num3 == 0) return (num1 < num2) ? num1 : num2; + else { + int min = (num1 < num2) ? num1 : num2; + min = (min < num3) ? min : num3; + + return min; + } + } + } + + } +} + + diff --git a/competition/src/main/java/com/huoran/competition/service/impl/CompetitionTeamServiceImpl.java b/competition/src/main/java/com/huoran/competition/service/impl/CompetitionTeamServiceImpl.java new file mode 100644 index 0000000..d9b4048 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/service/impl/CompetitionTeamServiceImpl.java @@ -0,0 +1,299 @@ +package com.huoran.competition.service.impl; + +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.google.common.collect.Maps; +import com.huoran.common.response.R; +import com.huoran.competition.entity.*; +import com.huoran.competition.entity.req.BatchUploadListCompetitionReq; +import com.huoran.competition.entity.req.FrontDeskStageTeamScoreDetailsReq; +import com.huoran.competition.entity.req.TransferTeamReq; +import com.huoran.competition.entity.resp.ListOfStageResultsResp; +import com.huoran.competition.entity.resp.ScoreReportResp; +import com.huoran.competition.entity.vo.PersonalDetailVO; +import com.huoran.competition.mapper.CompetitionRuleMapper; +import com.huoran.competition.mapper.CompetitionTeamMapper; +import com.huoran.competition.mapper.CompleteCompetitionSetupMapper; +import com.huoran.competition.mapper.TeamInstructorMapper; +import com.huoran.competition.service.CompetitionRankingService; +import com.huoran.competition.service.CompetitionStageService; +import com.huoran.competition.service.CompetitionTeamService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.script.ScriptException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Objects; + +/** + *

+ * 赛事团队表 服务实现类 + *

+ * + * @author cheney + * @since 2022-12-02 + */ +@Service +public class CompetitionTeamServiceImpl extends ServiceImpl implements CompetitionTeamService { + + @Autowired + TeamInstructorMapper teamInstructorMapper; + + @Autowired + CompetitionRuleMapper competitionRuleMapper; + + @Autowired + CompleteCompetitionSetupMapper completeCompetitionSetupMapper; + + @Autowired + CompetitionRankingServiceImpl competitionRankingService; + + @Autowired + UserScoreServiceImpl userScoreService; + + @Autowired + private CompetitionStageService stagService; + + @Autowired + private CompetitionRankingService rankingService; + + @Override + public R captainOfTransfer(TransferTeamReq transferTeamReq) { + //队长id + Integer captainId = transferTeamReq.getCaptainId(); + //队员id + Integer playerId = transferTeamReq.getPlayerId(); + + CompetitionTeam team = baseMapper.selectById(captainId); + CompetitionTeam team1 = baseMapper.selectById(playerId); + Integer accountId = team.getAccountId(); + Integer accountId1 = team1.getAccountId(); + //账号id互换 + team.setAccountId(accountId1); + baseMapper.updateById(team); + team1.setAccountId(accountId); + int update = baseMapper.updateById(team1); + return update > 0 ? R.ok() : R.error(); + } + + @Override + public R entryInformation(Integer competitionId,String accountId,int background) throws ScriptException { + HashMap data = Maps.newHashMap(); +// 查询赛事类型 + QueryWrapper setupQueryWrapper = new QueryWrapper<>(); + setupQueryWrapper.eq("competition_id",competitionId); + CompleteCompetitionSetup setup = completeCompetitionSetupMapper.selectOne(setupQueryWrapper); +// 赛事类型(0为个人赛,1为团队赛)默认为0 + Integer competitionType = setup.getCompetitionType(); + //查询团队是否有限制成员参加一项阶段赛事 + QueryWrapper ruleQueryWrapper = new QueryWrapper<>(); + ruleQueryWrapper.eq("setup_id",setup.getSetupId()); + CompetitionRule competitionRule = competitionRuleMapper.selectOne(ruleQueryWrapper); + + Integer teamId = 0; + if (competitionType == 1){ +// 查询团队基本信息、团队成员 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("competition_id",competitionId); + queryWrapper.eq("account_id",accountId); + CompetitionTeam team = baseMapper.selectOne(queryWrapper); + if (ObjectUtil.isNotNull(team)){ + + Integer captain = team.getCaptain(); +// 队长(0是队长,1为队员)默认为0,查询全队的账号信息 + List accountIds = new ArrayList<>(); + if (captain==0){ + accountIds.add(team.getAccountId()); + QueryWrapper queryWrapper2 = new QueryWrapper<>(); + queryWrapper2.eq("pid",team.getTeamId()); + teamId = team.getTeamId(); + List competitionTeams = baseMapper.selectList(queryWrapper2); + if (!competitionTeams.isEmpty()){ + for (CompetitionTeam competitionTeam : competitionTeams) { + accountIds.add(competitionTeam.getAccountId()); + } + } + }else { + CompetitionTeam team1 = baseMapper.selectById(team.getPid()); + accountIds.add(team1.getAccountId()); + QueryWrapper queryWrapper2 = new QueryWrapper<>(); + if (background == 1){ + team = team1; + queryWrapper2.eq("pid",team.getTeamId()); + teamId = team.getTeamId(); + }else { + queryWrapper2.eq("pid",team.getPid()); + teamId = team.getPid(); + team.setInvitationCode(team1.getInvitationCode()); + team.setTeamName(team1.getTeamName()); + } + List competitionTeams = baseMapper.selectList(queryWrapper2); + if (!competitionTeams.isEmpty()){ + for (CompetitionTeam competitionTeam : competitionTeams) { + accountIds.add(competitionTeam.getAccountId()); + } + } + } +// 团队详情信息 + List competitionTeams = baseMapper.teamDetail(accountIds,competitionId); + data.put("teamDetail",competitionTeams); + } + +// 限制提示 + boolean teamLimit = competitionRule.getTeamLimit() == 1; + + data.put("teamId",teamId); + data.put("team",team); + data.put("teamLimit",teamLimit); + + }else { +// 个人信息 + PersonalDetailVO personalDetail = baseMapper.personalDetail(accountId); + data.put("personalDetail",personalDetail); + } + + QueryWrapper queryWrapper3 = new QueryWrapper<>(); + if (competitionType == 0){ + queryWrapper3.eq("competition_id",competitionId); + queryWrapper3.eq("account_id",accountId); + }else { + queryWrapper3.eq("competition_id",competitionId); + queryWrapper3.eq("team_id",teamId); + } +// 查询指导老师 + List teamInstructors = teamInstructorMapper.selectList(queryWrapper3); + +// 竞赛阶段信息 + List stages = null; + if (competitionType == 0){ + stages = baseMapper.competitionStage(competitionId,accountId,null); + }else { + stages = baseMapper.competitionStage(competitionId,accountId,teamId); + } + + //阶段展示成绩分数 + for (CompetitionStage stage : stages) { + //查询成绩、报告id需要判重,学生可能没资格参加 b是否公布成绩 + boolean b = userScoreService.publicationResult(stage.getStageId()); + if (competitionType == 0){ + teamId = null; + } + + if (b){ + //积分赛制,查询总分 + if (competitionRule.getRule()==0){ + List stageList = baseMapper.competitionStage(competitionId, accountId, teamId); + StringBuffer sb = new StringBuffer(); +// List stages = new ArrayList<>(); + if (stageList!=null && stageList.size()>0){ + for (CompetitionStage competitionStage : stageList) { + sb.append(competitionStage.getStageId()).append(","); +// stages.add(competitionStage.getStageId()); + } + sb.deleteCharAt(sb.length()-1); + } + + FrontDeskStageTeamScoreDetailsReq req = new FrontDeskStageTeamScoreDetailsReq(); + req.setStageIds(sb.toString()); + req.setCompetitionId(competitionId); + req.setIsOverallRanking(1); + if (competitionType == 0){ + req.setType(1); + req.setAccountId(accountId); + }else { + req.setTeamId(teamId); + } + req.setPageNum(1); + req.setPageSize(1000); + R r = competitionRankingService.frontOfficeCompetitionRanking(req); + double totalScore = 0; + List respList =(List) r.get("list"); + //排名发布数据,无发布数据取系统数据 + if (respList.size()>0){ + for (ListOfStageResultsResp resultsResp : respList) { + totalScore += Double.valueOf(resultsResp.getScore()); + } + } + + data.put("totalScore",totalScore); + } + + //团队赛返回 + if (competitionType == 1){ + + double score = 0; + + //查询手动上传数据 + BatchUploadListCompetitionReq req = new BatchUploadListCompetitionReq(); + req.setCompetitionId(competitionId); + req.setStageId(stage.getStageId()); + req.setPageSize(100); + req.setPageNum(1); + req.setIsOverallRanking(0); + R r1 = rankingService.manuallyRankTheUploadList(req); + boolean publishStatus = (boolean) r1.get("publishStatus"); + if (publishStatus){ + List respList = (List) r1.get("page"); + for (ListOfStageResultsResp resultsResp : respList) { + if (resultsResp.getTeamId().equals(teamId)){ + score += Double.valueOf(resultsResp.getScore()); + if (stage.getResultsDetails()==0){ + stage.setReportId(resultsResp.getReportId()); + } + } + } + }else { + //没有发布数据取系统 + R r = stagService.stageRaceRanking(competitionId, stage.getStageId(), 1, 100, 0); + List subList1 = (List) r.get("page"); + for (ListOfStageResultsResp resultsResp : subList1) { + if (resultsResp.getTeamId().equals(teamId)){ + score += Double.valueOf(resultsResp.getScore()); + if (stage.getResultsDetails()==0){ + stage.setReportId(resultsResp.getReportId()); + } + } + } + } + stage.setScore(score); + + }else { + //查询成绩、成绩报告id(发布排名数据) + ScoreReportResp reportResp = baseMapper.queryResults(stage.getStageId(),competitionId,accountId,teamId); + //公布成绩,排名表无数据,查询系统数据 + if (reportResp!=null && reportResp.getScore()!=null){ + stage.setScore(reportResp.getScore().doubleValue()); + if (stage.getResultsDetails()==0){ + stage.setReportId(reportResp.getReportId()); + } + }else { + R r = stagService.stageRaceRanking(competitionId, stage.getStageId(), 1, 100, 0); + List subList1 = (List) r.get("page"); + double score = 0; + if (subList1.size()>0){ + for (ListOfStageResultsResp resultsResp : subList1) { + if (Objects.equals(resultsResp.getAccountId(), accountId)){ + score += Double.valueOf(resultsResp.getScore()); + if (stage.getResultsDetails()==0){ + stage.setReportId(resultsResp.getReportId()); + } + } + } + } + stage.setScore(score); + } + } + + }else { + stage.setScore(-1d); + } + } + + data.put("stages",stages); + data.put("teamInstructors",teamInstructors); + return R.ok().put("entryInformation",data); + } +} diff --git a/competition/src/main/java/com/huoran/competition/service/impl/CompleteCompetitionSetupServiceImpl.java b/competition/src/main/java/com/huoran/competition/service/impl/CompleteCompetitionSetupServiceImpl.java new file mode 100644 index 0000000..0024ae4 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/service/impl/CompleteCompetitionSetupServiceImpl.java @@ -0,0 +1,26 @@ +package com.huoran.competition.service.impl; + +import com.huoran.competition.entity.CompleteCompetitionSetup; +import com.huoran.competition.mapper.CompleteCompetitionSetupMapper; +import com.huoran.competition.service.CompleteCompetitionSetupService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; +import org.springframework.web.bind.annotation.RequestParam; + +/** + *

+ * 完整赛事设置 服务实现类 + *

+ * + * @author cheney + * @since 2022-11-16 + */ +@Service +public class CompleteCompetitionSetupServiceImpl extends ServiceImpl implements CompleteCompetitionSetupService { + + + @Override + public CompleteCompetitionSetup getRaceSettingsByRaceId(Integer competitionId) { + return baseMapper.getRaceSettingsByRaceId(competitionId); + } +} diff --git a/competition/src/main/java/com/huoran/competition/service/impl/TeamInstructorServiceImpl.java b/competition/src/main/java/com/huoran/competition/service/impl/TeamInstructorServiceImpl.java new file mode 100644 index 0000000..76d8947 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/service/impl/TeamInstructorServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.competition.service.impl; + +import com.huoran.competition.entity.TeamInstructor; +import com.huoran.competition.mapper.TeamInstructorMapper; +import com.huoran.competition.service.TeamInstructorService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 团队指导老师表 服务实现类 + *

+ * + * @author cheney + * @since 2022-12-02 + */ +@Service +public class TeamInstructorServiceImpl extends ServiceImpl implements TeamInstructorService { + +} diff --git a/competition/src/main/java/com/huoran/competition/service/impl/TeamParticipantServiceImpl.java b/competition/src/main/java/com/huoran/competition/service/impl/TeamParticipantServiceImpl.java new file mode 100644 index 0000000..6167a56 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/service/impl/TeamParticipantServiceImpl.java @@ -0,0 +1,38 @@ +package com.huoran.competition.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.competition.entity.CompetitionContent; +import com.huoran.competition.entity.TeamParticipant; +import com.huoran.competition.mapper.CompetitionContentMapper; +import com.huoran.competition.mapper.TeamParticipantMapper; +import com.huoran.competition.service.TeamParticipantService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; + +/** + *

+ * 团队阶段参赛人员表 服务实现类 + *

+ * + * @author cheney + * @since 2022-12-05 + */ +@Service +public class TeamParticipantServiceImpl extends ServiceImpl implements TeamParticipantService { + + @Autowired + CompetitionContentMapper competitionContentMapper; + + @Override + public boolean inTheGame(Integer stageId) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("stage_id",stageId); + CompetitionContent competitionContent = competitionContentMapper.selectOne(wrapper); + //当前时间大于开始时间,无法修改人员 + return new Date().after(competitionContent.getStartTime()); + } + +} diff --git a/competition/src/main/java/com/huoran/competition/service/impl/UserScoreServiceImpl.java b/competition/src/main/java/com/huoran/competition/service/impl/UserScoreServiceImpl.java new file mode 100644 index 0000000..f95ac36 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/service/impl/UserScoreServiceImpl.java @@ -0,0 +1,583 @@ +package com.huoran.competition.service.impl; + +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.entity.ExportParams; +import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.TypeReference; +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.huoran.api.NakadaiClient; +import com.huoran.common.entity.School; +import com.huoran.common.entity.UserScore; +import com.huoran.common.exception.CustomException; +import com.huoran.common.exception.ExceptionEnum; +import com.huoran.common.response.R; +import com.huoran.competition.entity.CompetitionContent; +import com.huoran.competition.entity.CompetitionStage; +import com.huoran.competition.entity.CompetitionTeam; +import com.huoran.competition.entity.req.ExcelImpGradeReq; +import com.huoran.competition.entity.req.PageGradeListReq; +import com.huoran.competition.entity.resp.FractionalSegmentResp; +import com.huoran.competition.entity.resp.ListOfStageResultsResp; +import com.huoran.competition.entity.resp.UserAccountResp; +import com.huoran.competition.entity.vo.GradeExportVO; +import com.huoran.competition.entity.vo.ImportCompetitionGradeFailureVO; +import com.huoran.competition.mapper.CompetitionContentMapper; +import com.huoran.competition.mapper.CompetitionStageMapper; +import com.huoran.competition.mapper.CompetitionTeamMapper; +import com.huoran.competition.mapper.UserScoreMapper; +import com.huoran.competition.service.UserScoreService; +import com.huoran.competition.utils.DateUtil; +import com.huoran.competition.utils.ExcelImporEventResultstHelper; +import com.huoran.competition.utils.ExcelStyleUtil; +import com.huoran.competition.utils.ScoreGroupingUtil; +import com.huoran.competition.utils.poi.CommonCode; +import com.huoran.competition.utils.poi.EasyPoiUtil; +import com.huoran.competition.utils.poi.ExceptionCast; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.data.redis.core.ValueOperations; +import org.springframework.stereotype.Service; +import org.springframework.util.ObjectUtils; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.net.URLEncoder; +import java.util.*; +import java.util.concurrent.TimeUnit; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + +/** + * @描述:用户分数表 服务类 + * @作者: Rong + * @日期: 2022-12-08 + */ +@Service +public class UserScoreServiceImpl extends ServiceImpl implements UserScoreService { + @Resource + StringRedisTemplate stringRedisTemplate; + @Autowired + private UserScoreMapper mapper; + + @Autowired + private CompetitionTeamMapper teamMapper; + + @Autowired + private CompetitionStageMapper competitionStageMapper; + + @Autowired + private CompetitionContentMapper competitionContentMapper; + + @Autowired + private NakadaiClient nakadaiClient; + + @Override + public Map batchImportGrades(MultipartFile file, Integer competitionId, Integer systemId, Integer stageId, Integer schoolId) throws IOException { + List impGradeReqList = ExcelImporEventResultstHelper.readGrade(file); + if (impGradeReqList.size() <= 0) { + //小于等于0为上传空模板的情况下 抛出异常 + throw new CustomException(ExceptionEnum.EXCEL_FILE_FORMAT_ERROR); + } + int count = 0; + List failVo1 = new ArrayList(); + // 参数合法性校验,只能上传.xlsx后缀的文件 + if (org.apache.commons.lang3.StringUtils.isBlank(file.getOriginalFilename()) || !file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")).equals(".xlsx")) { + ExceptionCast.cast(CommonCode.EXCEL_FILE_INVALID); + } + int size = impGradeReqList.size(); + Map map = new HashMap<>(); + Long ii = 1L;//用于记录序列号 + Integer countNum = 0;//用于失败原因排序 eg:1、XXXXX 2、XXXXXXX + try { + Integer countSuccess = 0;//统计成功次数 + Integer countError = 0;//统计失败次数 + + List workNumberList = new ArrayList<>();//用来储存新增前用户在excel中输入的所有工号用于excel中的数据判重 + for (int i = 0; i < impGradeReqList.size(); i++) { + boolean ret = true; + ++ii; + ExcelImpGradeReq req = impGradeReqList.get(i); + + ImportCompetitionGradeFailureVO vo1 = new ImportCompetitionGradeFailureVO(); + + String errMsg = ""; + //去除Excel中的全角半角空格 + String getTeamName = req.getTeamName().replaceAll("\\u00A0", "").trim(); + String getUserName = req.getUserName().replaceAll("\\u00A0", "").trim(); + String getWorkNumber = req.getWorkNumber().replaceAll("\\u00A0", "").trim(); + String getScore = req.getScore().replaceAll("\\u00A0", "").trim(); + String getTimeSum = req.getTimeSum().replaceAll("\\u00A0", "").trim(); + String getSchoolName = req.getSchoolName().replaceAll("\\u00A0", "").trim(); + //todo 增加学校字段 (根据学校名称查询学校id) + School school = nakadaiClient.getTheIdBySchoolName(getSchoolName); + if (school != null) { + schoolId = school.getSchoolId(); + } + +// Date getSubmitTime = req.getSubmitTime(); +// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); +// String format = sdf.format(getSubmitTime); + if (!workNumberList.contains(req.getWorkNumber())) { + workNumberList.add(req.getWorkNumber()); + } else { + if (!getWorkNumber.equals("")) { + //包含excel数据中存在相同工号 + ++countNum; + vo1.setWorkNumber(getWorkNumber + " *必填项:(当前Excel数据中该学号已存在重复的!)"); + errMsg += countNum + " *必填项:(当前Excel数据中该学号已存在重复的)"; + ret = false; + } + + } + + + vo1.setIndex(ii); + + //校验学号是否存在汉字 + if (!getWorkNumber.trim().equals("")) { + if (isContainChinese(getWorkNumber)) { + ++countNum; + vo1.setWorkNumber(getWorkNumber + "* 学号不能存在汉字!"); + errMsg += countNum + " * 学号不能存在汉字!"; + ret = false; + countError++; + } + } + + + //检验工号 + if (getWorkNumber.equals("")) { + ++countNum; + vo1.setWorkNumber(getWorkNumber + " *必填项:(学号不能为空)"); + errMsg += countNum + " *必填项:(学号不能为空)"; + ret = false; + countError++; + } else { + vo1.setWorkNumber(getWorkNumber); + } + + + //检验姓名 + if (getUserName.equals("")) { + ++countNum; + vo1.setUserName(getUserName + " *必填项:(姓名不能为空) "); + errMsg += countNum + "必填项:(姓名不能为空)"; + ret = false; + countError++; + } else { + vo1.setUserName(getUserName); + } + + UserAccountResp checkStudentNumberAndName = null; + //校验学号和姓名是否为同一个人 如果是同一人则获取到账号id + if (!getUserName.equals("") && !getWorkNumber.equals("")) { + //checkStudentNumberAndName检测用户名和学号是否是同一人 + checkStudentNumberAndName = baseMapper.checkStudentNumberAndName(getUserName, getWorkNumber, schoolId); + if (checkStudentNumberAndName == null) { + if (!getUserName.equals("") && !getWorkNumber.equals("")) { + ++countNum; + vo1.setWorkNumber(getWorkNumber + " *必填项:(学号与学生姓名不匹配)"); + vo1.setUserName(getUserName + " *必填项:(学生姓名与学号不匹配!)"); + errMsg += countNum + " *必填项:(学号与学生姓名不匹配!)"; + ret = false; + countError++; + /*if (!getTeamName.equals("")) { + ++countNum; + vo1.setTeamName(getTeamName + "* 请填入正确的用户信息以及团队信息!"); + errMsg += countNum + " * 请填入正确的用户信息以及团队信息!"; + ret = false; + countError++; + }else { + vo1.setTeamName(getTeamName); + }*/ + } + } + } + CompetitionTeam verifyThatStudentsAreInTeam = null; + + + //校验依据大赛查团队信息以及该用户是否存在该团队中 + if (!getTeamName.equals("")) { + if (checkStudentNumberAndName != null) { + CompetitionTeam team = new CompetitionTeam(); + team.setAccountId(checkStudentNumberAndName.getId()); + team.setCompetitionId(competitionId); + + verifyThatStudentsAreInTeam = teamMapper.verifyThatStudentsAreInTeam(team); + //判断改团队是否存在 + String teamName = teamMapper.getTheTeamName(competitionId, getTeamName); + + if (ObjectUtils.isEmpty(verifyThatStudentsAreInTeam)) { + ++countNum; + vo1.setTeamName(getTeamName + "* 该用户不在此团队中!"); + errMsg += countNum + " * 该用户不在此团队中!"; + ret = false; + countError++; + } else { + vo1.setTeamName(getTeamName); + } + + + if ( ObjectUtils.isEmpty(teamName)) { + if (!teamName.equals(verifyThatStudentsAreInTeam.getTeamName())) { + ++countNum; + vo1.setTeamName(getTeamName + "* 该用户不在此团队中!"); + errMsg += countNum + " -* 该用户不在此团队中!"; + ret = false; + countError++; + + } else { + vo1.setTeamName(getTeamName); + } + + } + } else { + vo1.setTeamName(getTeamName); + } + + } + + + //检验分数 + if (getScore.equals("")) { + ++countNum; + vo1.setScore(getScore + " *必填项:(分数不能为空) "); + errMsg += countNum + "必填项:(分数不能为空)"; + ret = false; + countError++; + } else { + vo1.setScore(getScore); + } + + + //检验耗时 + if (getTimeSum.equals("")) { + ++countNum; + vo1.setScore(getTimeSum + " *必填项:(耗时不能为空) "); + errMsg += countNum + "必填项:(耗时不能为空)"; + ret = false; + countError++; + } else { + vo1.setTimeSum(getTimeSum); + } + + //检验提交时间 + /*if (getSubmitTime == null || getSubmitTime.equals("")) { + ++countNum; + + vo1.setScore(format + " *必填项:(提交时间不能为空) "); + errMsg += countNum + "必填项:(提交时间不能为空)"; + ret = false; + countError++; + } else { + vo1.setSubmitTime(format); + }*/ + + + vo1.setFailureMsg(errMsg); + countNum = 0; + + failVo1.add(vo1); + + //ret判断 新增成功的插入到ol_user_score表 否则则不新增至数据库 + if (ret) { + //执行新增到操作 + + UserScore userScore = new UserScore(); + userScore.setScore(Integer.valueOf(getScore)); + if (verifyThatStudentsAreInTeam != null) { + if (verifyThatStudentsAreInTeam.getCaptain() == 0) { + userScore.setTeamId(verifyThatStudentsAreInTeam.getTeamId()); + } else { + /* QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("id",verifyThatStudentsAreInTeam.getPid()); + queryWrapper.eq("is_del", DelConstant.NOT_DEL);*/ + CompetitionTeam team = teamMapper.selectById(verifyThatStudentsAreInTeam.getPid()); + userScore.setTeamId(team.getTeamId()); + } + + } + + + userScore.setAccountId(checkStudentNumberAndName.getId()); + userScore.setSystemId(systemId); + userScore.setCompetitionId(competitionId);//赛事id + userScore.setTimeSum(Integer.valueOf(getTimeSum));//耗时 + + String getsTheStartTimeOfThePhase = baseMapper.getsTheStartTimeOfThePhase(stageId); + Date time = DateUtil.addDateMinute(getsTheStartTimeOfThePhase, Integer.valueOf(getTimeSum)); + userScore.setSubmitTime(time);//提交时间 + + userScore.setStageId(stageId); + userScore.setCreateTime(new Date()); + userScore.setUpdateTime(new Date()); + + //上传前判断是都存在 存在则覆盖老数据 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("competition_id", competitionId); + queryWrapper.eq("stage_id", userScore.getStageId()); + queryWrapper.eq("account_id", userScore.getAccountId()); + if (userScore.getTeamId() != null) { + queryWrapper.eq("team_id", userScore.getTeamId()); + } + UserScore checkWhetherItExists = baseMapper.selectOne(queryWrapper); + if (checkWhetherItExists != null) { + //删除老的数据 + baseMapper.deleteById(checkWhetherItExists.getId()); + } + + baseMapper.insert(userScore); + + + //countSuccess:统计累计成功次数 + countSuccess++; + }/* else { + //countError:累计失败次数 + countError++; + }*/ + } + String exportCode = ""; + + // 有导入失败的数据,才会存入redis + if (countError > 0) { + //生成token + exportCode = "FAILURE_IMPORT" + UUID.randomUUID().toString().replace("-", ""); + ValueOperations ops = stringRedisTemplate.opsForValue(); + + List collect = failVo1.stream().filter(importStaffFailureVo -> { + return !importStaffFailureVo.getFailureMsg().equals(""); + }).collect(Collectors.toList()); + + String failureVOJson = JSON.toJSONString(collect); + ops.set(exportCode, failureVOJson, 30 * 60, TimeUnit.SECONDS); + } + map.put("exportCode", exportCode);//返回导出code + map.put("successNum", countSuccess + "");//本次新增成功数量 + map.put("failureNum", countError + "");//本次新增失败数量 + return map; + } catch (RuntimeException e) { + System.err.println(e.getMessage()); + throw new RuntimeException(); + } + } + + @Override + public void exportFailureRecord(HttpServletResponse response, String token) throws Exception { + if (org.apache.commons.lang3.StringUtils.isEmpty(token)) { + return; + } + ValueOperations ops = stringRedisTemplate.opsForValue(); + //获取数据 + String record = ops.get(token); + if (org.apache.commons.lang3.StringUtils.isEmpty(record)) { + return; + } + List parse = JSON.parseObject(record, new TypeReference>() { + }); + + parse.sort(Comparator.comparing(ImportCompetitionGradeFailureVO::getIndex)); + + // 告诉浏览器用什么软件可以打开此文件 + response.setHeader("content-Type", "application/vnd.ms-excel"); + // 下载文件的默认名称 + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("赛事成绩导入失败数据表", "UTF-8") + ".xls"); + //编码 + response.setCharacterEncoding("UTF-8"); + Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), ImportCompetitionGradeFailureVO.class, parse); + ExportParams exportParams = new ExportParams(null, "delivery", ExcelType.XSSF); + exportParams.setStyle(ExcelStyleUtil.class); + workbook.write(response.getOutputStream()); + } + + @Override + public R stageGradeManagementList(PageGradeListReq req) { + if (req.getIsNakadai() == 0) { + boolean result = publicationResult(req.getStageId()); + if (result) { + req.setIsNakadai(1); + } + } + Page page = new Page(req.getPageNum(), req.getPageSize()); + PageGradeListReq statistics = new PageGradeListReq(); + BeanUtils.copyProperties(req, statistics); + statistics.setKeyWord(null); + Integer setTotalNumber = Math.toIntExact(mapper.stageGradeManagementList(page, req).getTotal()); + + IPage scoreGrouping = mapper.stageGradeManagementList(page, statistics); + FractionalSegmentResp data = ScoreGroupingUtil.scoreGrouping(scoreGrouping); + data.setTotalNumber(setTotalNumber); + IPage pageList = mapper.stageGradeManagementList(page, req); + pageList.getRecords().sort(new Comparator() { + @Override + public int compare(ListOfStageResultsResp o1, ListOfStageResultsResp o2) { + return (int) (Double.valueOf(o2.getScore()) - Double.valueOf(o1.getScore())); + } + }); + return R.ok().put("page", pageList).put("data", data); + + + } + + /** + * 添加日期小时 + */ + public Date addDateHour(Date date, int hour) { + Calendar cal = Calendar.getInstance(); + cal.setTime(date); + cal.add(Calendar.HOUR, hour);// 24小时制 +// cal.add(Calendar.MINUTE, hour);// 分钟 + date = cal.getTime(); + //释放对象 + cal = null; + return date; + } + + /** + * 是否公布成绩 + */ + public boolean publicationResult(Integer stageId) { + CompetitionStage competitionStage = competitionStageMapper.selectById(stageId); + if (competitionStage.getResultAnnouncementTime()==null){ + return false; + } + //成绩公布时间 + int resultAnnouncementTime = competitionStage.getResultAnnouncementTime(); + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("stage_id", stageId); + CompetitionContent competitionContent = competitionContentMapper.selectOne(wrapper); + if (competitionContent != null) { + Date endTime = competitionContent.getEndTime(); + + Date date = addDateHour(endTime, resultAnnouncementTime); + //公布时间 + long publicationTime = date.getTime(); + //当前系统时间 + long currentTimeMillis = System.currentTimeMillis(); + return currentTimeMillis >= publicationTime; + } + return false; + } + + + @Override + public R stageReportOfExperimentList(PageGradeListReq req) { + if (req.getIsNakadai() == 0) { + boolean result = publicationResult(req.getStageId()); + if (result) { + req.setIsNakadai(1); + } + } + + Page page = new Page(req.getPageNum(), req.getPageSize()); + PageGradeListReq statistics = new PageGradeListReq(); + BeanUtils.copyProperties(req, statistics); + statistics.setKeyWord(null); + Integer setTotalNumber = Math.toIntExact(mapper.stageReportOfExperimentList(page, statistics).getTotal()); + IPage scoreGrouping = mapper.stageReportOfExperimentList(page, statistics); + + Page page1 = new Page(1, setTotalNumber); + IPage allScoreGrouping = mapper.stageReportOfExperimentList(page1, statistics); + + + + FractionalSegmentResp data = ScoreGroupingUtil.scoreGrouping(allScoreGrouping); + IPage pageList = mapper.stageReportOfExperimentList(page, req); + data.setTotalNumber(setTotalNumber); + pageList.getRecords().sort(new Comparator() { + @Override + public int compare(ListOfStageResultsResp o1, ListOfStageResultsResp o2) { + return (int) (Double.valueOf(o2.getScore()) - Double.valueOf(o1.getScore())); + } + }); + return R.ok().put("page", pageList).put("data", data); + } + + @Override + public List getUnpaginatedEventResults(PageGradeListReq req) { + Page page = new Page(req.getPageNum(), req.getPageSize()); + PageGradeListReq statistics = new PageGradeListReq(); + BeanUtils.copyProperties(req, statistics); + statistics.setKeyWord(null); + Integer setTotalNumber = Math.toIntExact(mapper.stageReportOfExperimentList(page, statistics).getTotal()); + IPage scoreGrouping = mapper.stageReportOfExperimentList(page, statistics); + FractionalSegmentResp data = ScoreGroupingUtil.scoreGrouping(scoreGrouping); + IPage pageList = mapper.stageReportOfExperimentList(page, req); + data.setTotalNumber(setTotalNumber); + pageList.getRecords().sort(new Comparator() { + @Override + public int compare(ListOfStageResultsResp o1, ListOfStageResultsResp o2) { + return (int) (Double.valueOf(o2.getScore()) - Double.valueOf(o1.getScore())); + } + }); + return pageList.getRecords(); + } + + + @Override + public void exportExperimentalResultsInBatch(List list, HttpServletResponse response) throws IOException { + // 告诉浏览器用什么软件可以打开此文件 + response.setHeader("content-Type", "application/vnd.ms-excel"); + // 下载文件的默认名称 + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("赛事阶段成绩导出", "UTF-8") + ".xls"); + //编码 + response.setCharacterEncoding("UTF-8"); + /** + * 动态隐藏列 + */ + Integer count =0; + for (GradeExportVO item : list) { + item.setSerialNumber(++count); + EasyPoiUtil easyPoiUtil = new EasyPoiUtil<>(); + easyPoiUtil.t = item; + try { + if (item.getTeamName() == null || "".equals(item.getTeamName())) { + //隐藏bean 字段为teamName的列 + easyPoiUtil.hihdColumn("teamName", true); + } else { + easyPoiUtil.hihdColumn("teamName", false); + } + } catch (Exception e) { + System.out.println("列隐藏转换失败:{}" + e.getMessage()); + e.printStackTrace(); + } + } + Workbook workbook = null; + workbook = ExcelExportUtil.exportExcel(new ExportParams(), GradeExportVO.class, list); + ExportParams exportParams = new ExportParams("阶段成绩管理表", "sheet1", ExcelType.XSSF); + exportParams.setStyle(ExcelStyleUtil.class); + workbook.write(response.getOutputStream()); + } + + @Override + public boolean batchDeletionOfExperimentalReports(List ids) { + Integer ret = baseMapper.batchDeletionOfExperimentalReports(ids); + return ret > 0; + } + + + /** + * @Description :校验是否存在文字 为true表示存在 false表示不存在 + * @Param str + * @Author Rong---2021/11/4 + */ + public static boolean isContainChinese(String str) { + Pattern p = Pattern.compile("[\u4e00-\u9fa5]"); + Matcher m = p.matcher(str); + if (m.find()) { + return true; + } + return false; + } +} + + + diff --git a/competition/src/main/java/com/huoran/competition/utils/CalculationOfCompetitionRulesUtil.java b/competition/src/main/java/com/huoran/competition/utils/CalculationOfCompetitionRulesUtil.java new file mode 100644 index 0000000..e1ac5ca --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/utils/CalculationOfCompetitionRulesUtil.java @@ -0,0 +1,14 @@ +package com.huoran.competition.utils; + +/** + * 赛事规则计算 + */ +public class CalculationOfCompetitionRulesUtil { + + /** + * 团队积分 + */ + public static void teamPoints() { + + } +} diff --git a/competition/src/main/java/com/huoran/competition/utils/CollectionUtil.java b/competition/src/main/java/com/huoran/competition/utils/CollectionUtil.java new file mode 100644 index 0000000..b506557 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/utils/CollectionUtil.java @@ -0,0 +1,69 @@ +package com.huoran.competition.utils; + +import java.util.*; + +/** + * @Author chen + * @DATE 2022/4/1 11:36 + * @Version 1.0 + * 该类提供对集合类的高效操作 + */ +public class CollectionUtil { + /** + * 不允许实例化 + */ + private CollectionUtil() { + } + + /** + * 获取两个集合的不同元素 + * @param collmax + * @param collmin + * @return + */ + @SuppressWarnings({ "rawtypes", "unchecked" }) + public static Collection getDifferent(Collection collmax, Collection collmin) + { + //使用LinkedList防止差异过大时,元素拷贝 + Collection csReturn = new LinkedList(); + Collection max = collmax; + Collection min = collmin; + //先比较大小,这样会减少后续map的if判断次数 + if(collmax.size() map = new HashMap(max.size()); + for (Object object : max) { + map.put(object, 1); + } + for (Object object : min) { + if(map.get(object)==null) + { + csReturn.add(object); + }else{ + map.put(object, 2); + } + } + for (Map.Entry entry : map.entrySet()) { + if(entry.getValue()==1) + { + csReturn.add(entry.getKey()); + } + } + return csReturn; + } + /** + * 获取两个集合的不同元素,去除重复 + * @param collMax + * @param collMin + * @return + */ + @SuppressWarnings({ "rawtypes", "unchecked" }) + public static Collection getDifferentNoDuplicate (Collection collMax,Collection collMin) + { + return new HashSet(getDifferent(collMax, collMin)); + } +} diff --git a/competition/src/main/java/com/huoran/competition/utils/Constant.java b/competition/src/main/java/com/huoran/competition/utils/Constant.java new file mode 100644 index 0000000..66c09b0 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/utils/Constant.java @@ -0,0 +1,339 @@ +/** + * Copyright (c) 2016-2019 人人开源 All rights reserved. + *

+ * https://www.renren.io + *

+ * 版权所有,侵权必究! + */ + +package com.huoran.competition.utils; + +/** + * 常量 + * + * @author Rong + */ +public class Constant { + + /** + * 测评是否通过 1、通过/0、未通过 + */ + public static final String EVALUATIONN_PASSED = "通过"; + public static final String EVALUATIONN_NOT_PASSED = "未通过"; + + /** + * 及格分数 + */ + public static final int PASSING_SCORE = 60; + + /** + * 当前题目答案是否正确 1、正确/0、错误 + */ + public enum QuestionIsTure { + + TRUE(1, "正确"), + FALSE(0, "错误"); + + private Integer type; + private String desc; + + QuestionIsTure(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 void setDesc(String desc) { + this.desc = desc; + } + } + + /** + * 试题类型 + */ + public enum QuestionType { + /** + * 单选题 + */ + SINGLE_CHOICE("1", "单选题"), + /** + * 多选题 + */ + MULTIPLE_CHOICE("2", "多选题"), + /** + * 判断题 + */ + TRUE_OR_FALSE("3", "判断题"); + + private String type; //类型 + private String desc; //描述 + + QuestionType(String type, String desc) { + this.type = type; + this.desc = desc; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } + + } + + /** + * 项目是否提交1:已提交/0:未提交 + */ + public enum Submit { + + SUBMIT(1, "已提交"), + NOT_SUBMIT(0, "未提交"); + + + private Integer type; + private String desc; + + Submit(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 void setDesc(String desc) { + this.desc = desc; + } + } + + /** + * 是否删除:0使用,1删除,默认0使用 + */ + public enum IsDel { + /** + * 删除 + */ + DEL(1, "已删除"), + /** + * 不删除 + */ + NOT_DEL(0, "不删除"); + + private Integer type; //类型 + private String desc; //描述 + + IsDel(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 void setDesc(String desc) { + this.desc = desc; + } + } + + + /** + * 是否启用 + */ + public enum IsEnable { + /** + * 启用 + */ + ENABLE(1, "启用"), + /** + * 不启用 + */ + NOT_ENABLE(0, "不启用"); + + private Integer type; //类型 + private String desc; //描述 + + IsEnable(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 void setDesc(String desc) { + this.desc = desc; + } + } + + /** + * 评测规则类型 + */ + public enum RulesType { + /** + * 随机 + */ + RANDOM(1, "随机"), + /** + * 自定义 + */ + CUSTOMIZE(0, "自定义"); + + private Integer type; //类型 + private String desc; //描述 + + RulesType(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 void setDesc(String desc) { + this.desc = desc; + } + } + + + /** + * 当前题目状态 1、已作/0、未作 + */ + public enum QuestionStatus { + + MADE(1, "已作"), + NOT_MADE(0, "未作"); + + private Integer type; + private String desc; + + QuestionStatus(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 void setDesc(String desc) { + this.desc = desc; + } + } + + /** + * 试题选项A + */ + public static final String A = "A"; + /** + * 试题选项B + */ + public static final String B = "B"; + /** + * 试题选项C + */ + public static final String C = "C"; + /** + * 试题选项D + */ + public static final String D = "D"; + /** + * 试题选项E + */ + public static final String E = "E"; + /** + * 试题选项F + */ + public static final String F = "F"; + + /** + * 通过excel批量导入试题数据时起始行 + */ + public static final int CELL_INDEX = 0; + /** + * 需要提取的样式所在的行号 + */ + public static final int STYLE_INDEX = 2; + + + /** + * 通过excel批量导入试题数据时起始行(专门用于练习,考核报告的) + */ + public static final int ROW_INDEX_REPORT = 3; + + + /** + * 通过excel批量导入试题数据时起始行 + */ + public static final int ROW_INDEX = 2; + + + /** + * 测评规则表id + */ + public static final int EVALUATION_RULES_ID = 1; +} \ No newline at end of file diff --git a/competition/src/main/java/com/huoran/competition/utils/DateUtil.java b/competition/src/main/java/com/huoran/competition/utils/DateUtil.java new file mode 100644 index 0000000..51d7e12 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/utils/DateUtil.java @@ -0,0 +1,95 @@ +package com.huoran.competition.utils; + +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; + +/** + * @Author chen + * @DATE 2020/10/20 10:46 + * @Version 1.0 + */ +public class DateUtil { + + + public static String lastDate(Integer month) { + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Calendar c = Calendar.getInstance(); + + if (month == 1) { + c.add(Calendar.MONTH, -1); + Date time = c.getTime(); + return format.format(time); + } + if (month == 3) { + c.add(Calendar.MONTH, -3); + Date time = c.getTime(); + return format.format(time); + } + if (month == 6) { + c.add(Calendar.MONTH, -6); + Date time = c.getTime(); + return format.format(time); + } + return ""; + } + + public static String currentDate() { + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + return format.format(new Date()); + } + + + public static String addDays(Integer num) { + Date d = new Date(); + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String currdate = format.format(d); + System.out.println("现在的日期是:" + currdate); + + Calendar ca = Calendar.getInstance(); + ca.add(Calendar.DATE, num);// num为增加的天数,可以改变的 + d = ca.getTime(); + String enddate = format.format(d); + System.out.println("增加天数以后的日期:" + enddate); + return enddate; + } + + + /** + * 日期添加到分钟得到新时间 + * + * @param day 开始时间 + * @param x 相隔分钟数 + * @return + */ + public static Date addDateMinute(String day, int x) { + //入参的格式 + // 24小时制 + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Date date = null; + try { + date = format.parse(day); + } catch (Exception ex) { + ex.printStackTrace(); + } + if (date == null) { + return null; + } + System.out.println("front:" + format.format(date)); + Calendar cal = Calendar.getInstance(); + cal.setTime(date); + // 24小时制 + cal.add(Calendar.MINUTE, x); + //得到结算后的结果 yyyy-MM-dd HH:mm + date = cal.getTime(); + System.out.println("after:" + format.format(date)); + cal = null; + return date; + } + + + public static void main(String[] args) { + System.out.println(addDateMinute( "2023-02-01 14:54:20", 9)); + } + +} diff --git a/competition/src/main/java/com/huoran/competition/utils/DelTagsUtil.java b/competition/src/main/java/com/huoran/competition/utils/DelTagsUtil.java new file mode 100644 index 0000000..5558647 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/utils/DelTagsUtil.java @@ -0,0 +1,55 @@ +package com.huoran.competition.utils; + +/** + * @描述: + * @作者: Rong + * @日期: 2022/3/24 16:36 + */ +public class DelTagsUtil { + /** + * 去除html代码中含有的标签 + * + * @param htmlStr + * @return + */ + public static String delHtmlTags(String htmlStr) { + //定义script的正则表达式,去除js可以防止注入 + String scriptRegex = "]*?>[\\s\\S]*?<\\/script>"; + //定义style的正则表达式,去除style样式,防止css代码过多时只截取到css样式代码 + String styleRegex = "]*?>[\\s\\S]*?<\\/style>"; + //定义HTML标签的正则表达式,去除标签,只提取文字内容 + String htmlRegex = "<[^>]+>"; + //定义空格,回车,换行符,制表符 + String spaceRegex = "\\s*|\t|\r|\n"; + + // 过滤script标签 + htmlStr = htmlStr.replaceAll(scriptRegex, ""); + // 过滤style标签 + htmlStr = htmlStr.replaceAll(styleRegex, ""); + // 过滤html标签 + htmlStr = htmlStr.replaceAll(htmlRegex, ""); + // 过滤空格等 + htmlStr = htmlStr.replaceAll(spaceRegex, ""); + return htmlStr.trim(); // 返回文本字符串 + } + + /** + * 获取HTML代码里的内容 + * + * @param htmlStr + * @return + */ + public static String getTextFromHtml(String htmlStr) { + //去除html标签 + htmlStr = delHtmlTags(htmlStr); + //去除空格" " + htmlStr = htmlStr.replaceAll(" ", ""); + return htmlStr; + } + + public static void main(String[] args) { + String htmlStr = "import requests\nimport json\n\ndef get_sogou_img():\n    category = '卡通'\n    length = 5\n    imgs = requests.get(\n        'https://pic.sogou.com/pics/channel/getAllRecomPicByTag.jsp?category=%E5%A3%81%E7%BA%B8&tag=' + category + '&start=0&len=' + str(\n            length) + '&width=1920&height=1080')\n    jd = json.loads(imgs.text)\n    jd = jd['all_items']\n    imgs_url = []\n    for j in jd:\n        imgs_url.append(j['pic_url'])\n    print(imgs_url)\n1111111111111111111111111111\n\n\n\n\nif __name__ == \"__main__\":\n    get_sogou_img()\n" + ; + System.out.println(getTextFromHtml(htmlStr)); + } +} diff --git a/competition/src/main/java/com/huoran/competition/utils/EasyExcelUtil.java b/competition/src/main/java/com/huoran/competition/utils/EasyExcelUtil.java new file mode 100644 index 0000000..aaf369a --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/utils/EasyExcelUtil.java @@ -0,0 +1,21 @@ +package com.huoran.competition.utils; + +import com.alibaba.excel.EasyExcel; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; + +/** + * @Author chen + * @DATE 2020/10/19 14:45 + * @Version 1.0 + */ +public class EasyExcelUtil { + public static void download(HttpServletResponse response, Class head, List list) throws IOException { + response.setContentType("application/vnd.ms-excel"); + response.setCharacterEncoding("utf-8"); + response.setHeader("Content-disposition", "attachment;filename=applican.xlsx"); + EasyExcel.write(response.getOutputStream(), head).sheet("人员列表").doWrite(list); + } +} diff --git a/competition/src/main/java/com/huoran/competition/utils/ExcelImporEventResultstHelper.java b/competition/src/main/java/com/huoran/competition/utils/ExcelImporEventResultstHelper.java new file mode 100644 index 0000000..b25defd --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/utils/ExcelImporEventResultstHelper.java @@ -0,0 +1,389 @@ +package com.huoran.competition.utils; + +import com.huoran.common.exception.CustomException; +import com.huoran.common.exception.ExceptionEnum; +import com.huoran.competition.entity.req.ExcelImpGradeReq; +import com.huoran.competition.entity.req.ExcelImpRankReq; +import org.apache.commons.lang.StringUtils; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.*; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.springframework.web.multipart.MultipartFile; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class ExcelImporEventResultstHelper { + + /** + * 读取Excel列表成绩 + * + * @param file + * @return + */ + public static List readGrade(MultipartFile file) { + List list = new ArrayList(); + + Workbook workbook = getWorkbook(file); + ExcelImpGradeReq excelImpStaffReq = null; + // 循环工作表Sheet + for (int numSheet = 0; numSheet < workbook.getNumberOfSheets(); numSheet++) { + Sheet hssfSheet = workbook.getSheetAt(numSheet); + if (hssfSheet == null) { + continue; + } + + int count = 1; + // 循环行Row//开始行2 + for (int rowNum = 2; rowNum <= hssfSheet.getLastRowNum(); rowNum++) { + Row row = hssfSheet.getRow(rowNum); + + if (isRowEmpty(row)) { + count++; + if (count == hssfSheet.getLastRowNum()) { + throw new CustomException(ExceptionEnum.EXCEL_FILE_NULL); + } + continue; + } + + Cell schoolName;//学校名称 + Cell teamName;//团队名称 + Cell userName;//学生姓名 + Cell workNumber;//学号 + Cell score;//分数 + Cell timeSum;//耗时 +// Cell submitTime;//提交时间 + if (row != null) { + + excelImpStaffReq = new ExcelImpGradeReq(); + + + if (row.getCell(5) != null) { + row.getCell(5).setCellType(CellType.STRING); + schoolName = row.getCell(5); + } else { + schoolName = row.createCell(5); + } + + + if (row.getCell(4) != null) { + row.getCell(4).setCellType(CellType.STRING); + timeSum = row.getCell(4); + } else { + timeSum = row.createCell(4); + } + + if (row.getCell(3) != null) { + row.getCell(3).setCellType(CellType.STRING); + score = row.getCell(3); + } else { + score = row.createCell(3); + } + + if (row.getCell(2) != null) { + row.getCell(2).setCellType(CellType.STRING); + workNumber = row.getCell(2); + } else { + workNumber = row.createCell(2); + } + + if (row.getCell(1) != null) { + row.getCell(1).setCellType(CellType.STRING); + userName = row.getCell(1); + } else { + userName = row.createCell(1); + } + + + if (row.getCell(0) != null) { + row.getCell(0).setCellType(CellType.STRING); + teamName = row.getCell(0); + } else { + teamName = row.createCell(0); + } + + excelImpStaffReq.setTeamName(teamName.getStringCellValue()); + excelImpStaffReq.setUserName(userName.getStringCellValue()); + excelImpStaffReq.setWorkNumber(workNumber.getStringCellValue()); + excelImpStaffReq.setScore(score.getStringCellValue()); + excelImpStaffReq.setTimeSum(timeSum.getStringCellValue()); + excelImpStaffReq.setSchoolName(schoolName.getStringCellValue()); + + /*if (!submitTime.getStringCellValue().equals("")) { + Date date = HSSFDateUtil.getJavaDate(Double.parseDouble(submitTime.getStringCellValue())); + excelImpStaffReq.setSubmitTime(date); + }*/ + list.add(excelImpStaffReq); + } + } + + } + + return list; + } + + + /** + * 读取Excel列表排名 + * + * @param file + * @return + */ + public static List readRanking(MultipartFile file) { + List list = new ArrayList(); + + Workbook workbook = getWorkbook(file); + ExcelImpRankReq excelImpStaffReq = null; + // 循环工作表Sheet + for (int numSheet = 0; numSheet < workbook.getNumberOfSheets(); numSheet++) { + Sheet hssfSheet = workbook.getSheetAt(numSheet); + if (hssfSheet == null) { + continue; + } + + int count = 1; + // 循环行Row//开始行2 + for (int rowNum = 2; rowNum <= hssfSheet.getLastRowNum(); rowNum++) { + Row row = hssfSheet.getRow(rowNum); + + if (isRowEmpty(row)) { + count++; + if (count == hssfSheet.getLastRowNum()) { + throw new CustomException(ExceptionEnum.EXCEL_FILE_NULL); + } + continue; + } + + Cell teamName;//团队名称 + Cell userName;//学生姓名 +// Cell workNumber;//学号 + Cell schoolName;//学校 + Cell score;//分数 + Cell timeSum;//耗时 + if (row != null) { + + excelImpStaffReq = new ExcelImpRankReq(); + + + + + if (row.getCell(4) != null) { + row.getCell(4).setCellType(CellType.STRING); + score = row.getCell(4); + } else { + score = row.createCell(4); + } + + if (row.getCell(3) != null) { + row.getCell(3).setCellType(CellType.STRING); + timeSum = row.getCell(3); + } else { + timeSum = row.createCell(3); + } + + if (row.getCell(2) != null) { + row.getCell(2).setCellType(CellType.STRING); + schoolName = row.getCell(2); + } else { + schoolName = row.createCell(2); + } + + if (row.getCell(1) != null) { + row.getCell(1).setCellType(CellType.STRING); + userName = row.getCell(1); + } else { + userName = row.createCell(1); + } + + + if (row.getCell(0) != null) { + row.getCell(0).setCellType(CellType.STRING); + teamName = row.getCell(0); + } else { + teamName = row.createCell(0); + } + + excelImpStaffReq.setTeamName(teamName.getStringCellValue()); + excelImpStaffReq.setUserName(userName.getStringCellValue()); +// excelImpStaffReq.setWorkNumber(workNumber.getStringCellValue()); + excelImpStaffReq.setSchoolName(schoolName.getStringCellValue()); + excelImpStaffReq.setScore(score.getStringCellValue()); + excelImpStaffReq.setTimeSum(timeSum.getStringCellValue()); + + + list.add(excelImpStaffReq); + } + } + + } + + return list; + } + + + + + + /** + * 读取Excel个人列表排名 + * + * @param file + * @return + */ + public static List readIndividualRanking(MultipartFile file) { + List list = new ArrayList(); + + Workbook workbook = getWorkbook(file); + ExcelImpRankReq excelImpStaffReq = null; + // 循环工作表Sheet + for (int numSheet = 0; numSheet < workbook.getNumberOfSheets(); numSheet++) { + Sheet hssfSheet = workbook.getSheetAt(numSheet); + if (hssfSheet == null) { + continue; + } + + int count = 1; + // 循环行Row//开始行2 + for (int rowNum = 2; rowNum <= hssfSheet.getLastRowNum(); rowNum++) { + Row row = hssfSheet.getRow(rowNum); + + if (isRowEmpty(row)) { + count++; + if (count == hssfSheet.getLastRowNum()) { + throw new CustomException(ExceptionEnum.EXCEL_FILE_NULL); + } + continue; + } + + Cell userName;//学生姓名 + Cell workNumber;//学号 + Cell schoolName;//学校 + Cell score;//分数 + Cell timeSum;//耗时 + if (row != null) { + + excelImpStaffReq = new ExcelImpRankReq(); + + + + + if (row.getCell(4) != null) { + row.getCell(4).setCellType(CellType.STRING); + score = row.getCell(4); + } else { + score = row.createCell(4); + } + + if (row.getCell(3) != null) { + row.getCell(3).setCellType(CellType.STRING); + timeSum = row.getCell(3); + } else { + timeSum = row.createCell(2); + } + + if (row.getCell(2) != null) { + row.getCell(2).setCellType(CellType.STRING); + schoolName = row.getCell(2); + } else { + schoolName = row.createCell(2); + } + + if (row.getCell(1) != null) { + row.getCell(1).setCellType(CellType.STRING); + workNumber = row.getCell(1); + } else { + workNumber = row.createCell(1); + } + + if (row.getCell(0) != null) { + row.getCell(0).setCellType(CellType.STRING); + userName = row.getCell(0); + } else { + userName = row.createCell(0); + } + + + + excelImpStaffReq.setUserName(userName.getStringCellValue()); + excelImpStaffReq.setSchoolName(schoolName.getStringCellValue()); + excelImpStaffReq.setScore(score.getStringCellValue()); + excelImpStaffReq.setTimeSum(timeSum.getStringCellValue()); + excelImpStaffReq.setWorkNumber(workNumber.getStringCellValue()); + + + list.add(excelImpStaffReq); + } + } + + } + + return list; + } + + + //判断row是否为空 + public static boolean isRowEmpty(Row row) { + if (null == row) { + return true; + } + int firstCellNum = row.getFirstCellNum(); //第一个列位置 + int lastCellNum = row.getLastCellNum(); //最后一列位置 + int nullCellNum = 0; //空列数量 + for (int c = firstCellNum; c < lastCellNum; c++) { + Cell cell = row.getCell(c); + if (null == cell || CellType.BLANK == cell.getCellType()) { + nullCellNum++; + continue; + } + cell.setCellType(CellType.STRING); + String cellValue = cell.getStringCellValue().trim(); + if (StringUtils.isEmpty(cellValue)) { + nullCellNum++; + } + } + //所有列都为空 + if (nullCellNum == (lastCellNum - firstCellNum)) { + return true; + } + return false; + } + + private static Workbook getWorkbook(MultipartFile file) { + String fileName = file.getOriginalFilename(); + Workbook workbook = null; + + if (fileName.endsWith("xlsx")) { + try { + workbook = new XSSFWorkbook(file.getInputStream()); + } catch (IOException e) { + e.printStackTrace(); + } + } else if (fileName.endsWith("xls")) { + try { + workbook = new HSSFWorkbook(file.getInputStream()); + } catch (IOException e) { + e.printStackTrace(); + } + } + return workbook; + } + + + /** + * @Description :校验是否存在文字 为true表示存在 false表示不存在 + * @Param str + * @Author Rong---2021/11/4 + */ + public static boolean isContainChinese(String str) { + Pattern p = Pattern.compile("[\u4e00-\u9fa5]"); + Matcher m = p.matcher(str); + if (m.find()) { + return true; + } + return false; + } + +} diff --git a/competition/src/main/java/com/huoran/competition/utils/ExcelStyleUtil.java b/competition/src/main/java/com/huoran/competition/utils/ExcelStyleUtil.java new file mode 100644 index 0000000..dc2efc6 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/utils/ExcelStyleUtil.java @@ -0,0 +1,187 @@ +package com.huoran.competition.utils; + +import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity; +import cn.afterturn.easypoi.excel.entity.params.ExcelForEachParams; +import cn.afterturn.easypoi.excel.export.styler.IExcelExportStyler; +import org.apache.poi.ss.usermodel.*; + +/** + * @ProjectName: huorantech + * @Package: com.huoran.common.utils + * @ClassName: ExcelStyleUtil + * @Description: easy poi导出设置样式 + * @Author: Maureen.Rong + * @CreateDate: 2021/9/1 14:29 + * @UpdateDate: 2021/9/1 14:29 + * @Version: 1.0 + */ +public class ExcelStyleUtil implements IExcelExportStyler { + private static final short STRING_FORMAT = (short) BuiltinFormats.getBuiltinFormat("TEXT"); + private static final short FONT_SIZE_TEN = 9; + private static final short FONT_SIZE_ELEVEN = 10; + private static final short FONT_SIZE_TWELVE = 50; + + /** + * 大标题样式 + */ + private CellStyle headerStyle; + /** + * 每列标题样式 + */ + private CellStyle titleStyle; + /** + * 数据行样式 + */ + private CellStyle styles; + + public ExcelStyleUtil(Workbook workbook) { + this.init(workbook); + } + + /** + * 初始化样式 + * + * @param workbook + */ + private void init(Workbook workbook) { + this.headerStyle = initHeaderStyle(workbook); + this.titleStyle = initTitleStyle(workbook); + this.styles = initStyles(workbook); + } + + /** + * 大标题样式 + * + * @param color + * @return + */ + @Override + public CellStyle getHeaderStyle(short color) { + return headerStyle; + } + + /** + * 每列标题样式 + * + * @param color + * @return + */ + @Override + public CellStyle getTitleStyle(short color) { + return titleStyle; + } + + /** + * 数据行样式 + * + * @param parity 可以用来表示奇偶行 + * @param entity 数据内容 + * @return 样式 + */ + @Override + public CellStyle getStyles(boolean parity, ExcelExportEntity entity) { + return styles; + } + + /** + * 获取样式方法 + * + * @param dataRow 数据行 + * @param obj 对象 + * @param data 数据 + */ + @Override + public CellStyle getStyles(Cell cell, int dataRow, ExcelExportEntity entity, Object obj, Object data) { + return getStyles(true, entity); + } + + /** + * 模板使用的样式设置 + */ + @Override + public CellStyle getTemplateStyles(boolean isSingle, ExcelForEachParams excelForEachParams) { + return null; + } + + /** + * 初始化--大标题样式 + * + * @param workbook + * @return + */ + private CellStyle initHeaderStyle(Workbook workbook) { + CellStyle style = getBaseCellStyle(workbook); + style.setFont(getFont(workbook, FONT_SIZE_TWELVE, true)); + return style; + } + + /** + * 初始化--每列标题样式 + * + * @param workbook + * @return + */ + private CellStyle initTitleStyle(Workbook workbook) { + CellStyle style = getBaseCellStyle(workbook); + style.setFont(getFont(workbook, FONT_SIZE_ELEVEN, false)); + //背景色 + style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); + style.setFillPattern(FillPatternType.SOLID_FOREGROUND); + return style; + } + + /** + * 初始化--数据行样式 + * + * @param workbook + * @return + */ + private CellStyle initStyles(Workbook workbook) { + CellStyle style = getBaseCellStyle(workbook); + style.setFont(getFont(workbook, FONT_SIZE_TEN, false)); + style.setDataFormat(STRING_FORMAT); + return style; + } + + /** + * 基础样式 + * + * @return + */ + private CellStyle getBaseCellStyle(Workbook workbook) { + CellStyle style = workbook.createCellStyle(); + //下边框 + style.setBorderBottom(BorderStyle.THIN); + //左边框 + style.setBorderLeft(BorderStyle.THIN); + //上边框 + style.setBorderTop(BorderStyle.THIN); + //右边框 + style.setBorderRight(BorderStyle.THIN); + //水平居中 + style.setAlignment(HorizontalAlignment.CENTER); + //上下居中 + style.setVerticalAlignment(VerticalAlignment.CENTER); + //设置自动换行 + style.setWrapText(true); + return style; + } + + /** + * 字体样式 + * + * @param size 字体大小 + * @param isBold 是否加粗 + * @return + */ + private Font getFont(Workbook workbook, short size, boolean isBold) { + Font font = workbook.createFont(); + //字体样式 + font.setFontName("宋体"); + //是否加粗 + font.setBold(isBold); + //字体大小 + font.setFontHeightInPoints(size); + return font; + } +} diff --git a/competition/src/main/java/com/huoran/competition/utils/RankUtil.java b/competition/src/main/java/com/huoran/competition/utils/RankUtil.java new file mode 100644 index 0000000..f3d73d3 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/utils/RankUtil.java @@ -0,0 +1,266 @@ +package com.huoran.competition.utils; + +import com.huoran.api.NakadaiClient; +import com.huoran.api.UserClient; +import com.huoran.competition.entity.CompetitionTeam; +import com.huoran.competition.entity.resp.ListOfStageResultsResp; +import com.huoran.competition.entity.vo.RegistrationVO; +import com.huoran.competition.mapper.CompetitionRegistrationMapper; +import com.huoran.competition.mapper.CompetitionTeamMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.annotation.PostConstruct; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.stream.Collectors; + +@Component +public class RankUtil { + @Autowired + UserClient userClient; + @Autowired + NakadaiClient nakadaiClient; + + @Autowired + private CompetitionTeamMapper teamMapper; + + @Autowired + private CompetitionRegistrationMapper registrationMapper; + + + public static RankUtil rankUtil; + + + @PostConstruct + public void init() { + rankUtil = this; + rankUtil.teamMapper = this.teamMapper; + rankUtil.nakadaiClient = this.nakadaiClient; + rankUtil.userClient = this.userClient; + rankUtil.registrationMapper = this.registrationMapper; + } + + + /** + * 团队赛是拿参比比赛的全部队伍与参加比赛并且获得成绩的团队比对 + * + * @param competitionTeams + * @param list + * @return + */ + public List matchingSet(List competitionTeams, List list) { + //参赛全部队伍 A集合 + List allTeam = competitionTeams.stream().map(CompetitionTeam::getTeamId).collect(Collectors.toList()); + + //参与本次阶段,有成绩的队伍 B集合 + List teamWithResults = list.stream().map(ListOfStageResultsResp::getTeamId).collect(Collectors.toList()); + + //falseData:假数据,用于区分大赛没有参加团队的但是要给一条数据 + List falseData = new ArrayList<>(); + + // 对比 + for (Integer id : allTeam) { + if (!teamWithResults.contains(id)) { + // A集合中,B集合没有的对象id + //System.err.println(id); + //判断B中没有的团队id,则加入到要返回的list中 + + ListOfStageResultsResp addTeamId = new ListOfStageResultsResp(); + addTeamId.setTeamId(id); + addTeamId.setScore("0"); + addTeamId.setTimeSum("0"); + falseData.add(addTeamId); + } + } + + list.addAll(falseData); + + for (ListOfStageResultsResp l : list) { + CompetitionTeam team = rankUtil.teamMapper.selectById(l.getTeamId()); + if (team != null) { + if (l.getTeamName() == null) { + + l.setTeamName(team.getTeamName()); + } + + if (l.getLeaderName() == null) { + l.setLeaderName(rankUtil.userClient.getUserName(team.getAccountId())); + l.setAccountId(team.getAccountId() + ""); + } + + if (l.getSchoolId() == null) { + Integer schoolId = rankUtil.userClient.getSchoolIdByAccountId(team.getAccountId() + ""); + l.setSchoolName(rankUtil.nakadaiClient.getTheSchoolNameBySchoolId(schoolId).getSchoolName()); +// String schoolName = registrationMapper.selectSchoolName(l.getAccountId()); +// l.setSchoolName(schoolName); + l.setSchoolId(schoolId); + } + } + } + + return list; + } + + + public List matchingSetPersonage(List selectApplicantByCondition, List list) { + //报名本次大赛的全部人员 A集合 + List allApplicants = selectApplicantByCondition.stream().map(RegistrationVO::getAccountId).collect(Collectors.toList()); + + //参与本次阶段,有成绩的队伍 B集合 + List teamWithResults = list.stream().map(ListOfStageResultsResp::getAccountId).collect(Collectors.toList()); + + List intClusterIds = teamWithResults.stream().mapToInt(Integer::parseInt).boxed().collect(Collectors.toList()); + + + //falseData:假数据,用于区分大赛没有参加团队的但是要给一条数据 + List falseData = new ArrayList<>(); + + // 对比 + for (Integer id : allApplicants) { + if (!intClusterIds.contains(id)) { + // A集合中,B集合没有的对象id + //System.err.println(id); + //判断B中没有的账号id,则加入到要返回的list中 + ListOfStageResultsResp addTeamId = new ListOfStageResultsResp(); + addTeamId.setScore("0"); + addTeamId.setTimeSum("0"); + addTeamId.setAccountId(id + ""); + falseData.add(addTeamId); + } + } + + list.addAll(falseData); + + for (ListOfStageResultsResp l : list) { + if (l.getSchoolId() == null) { + Integer schoolId = rankUtil.userClient.getSchoolIdByAccountId(l.getAccountId() + ""); + l.setSchoolName(rankUtil.nakadaiClient.getTheSchoolNameBySchoolId(schoolId).getSchoolName()); +/* String schoolName = registrationMapper.selectSchoolName(l.getAccountId()); + l.setSchoolName(schoolName);*/ + l.setSchoolId(schoolId); + } + + if (l.getLeaderName() == null) { + l.setUserName(rankUtil.userClient.getUserName(Integer.valueOf(l.getAccountId()))); + } + + } + + Collections.sort(list, new Comparator() { + public int compare(ListOfStageResultsResp s1, ListOfStageResultsResp s2) { + int i = Double.valueOf(s2.getScore()).compareTo(Double.valueOf(s1.getScore())); + if (i == 0) { + i = s1.getTimeSum().compareTo(s2.getTimeSum()); + } + return i; + } + }); + + return list; + } + + + public List singleStageMatchingSetPersonage(List selectApplicantByCondition, List list) { + //报名本次大赛的全部人员 A集合 + List allApplicants = selectApplicantByCondition.stream().map(RegistrationVO::getAccountId).collect(Collectors.toList()); + + //参与本次阶段,有成绩的队伍 B集合 + List teamWithResults = list.stream().map(ListOfStageResultsResp::getAccountId).collect(Collectors.toList()); + + List intClusterIds = teamWithResults.stream().mapToInt(Integer::parseInt).boxed().collect(Collectors.toList()); + + + //falseData:假数据,用于区分大赛没有参加团队的但是要给一条数据 + List falseData = new ArrayList<>(); + + // 对比 + for (Integer id : allApplicants) { + if (!intClusterIds.contains(id)) { + // A集合中,B集合没有的对象id + ////System.err.println(id); + //判断B中没有的账号id,则加入到要返回的list中 + ListOfStageResultsResp addTeamId = new ListOfStageResultsResp(); + addTeamId.setScore("—"); + addTeamId.setTimeSum("—"); + addTeamId.setAccountId(id + ""); + falseData.add(addTeamId); + } + } + + list.addAll(falseData); + + for (ListOfStageResultsResp l : list) { + if (l.getSchoolId() == null) { + Integer schoolId = rankUtil.userClient.getSchoolIdByAccountId(l.getAccountId() + ""); + l.setSchoolName(rankUtil.nakadaiClient.getTheSchoolNameBySchoolId(schoolId).getSchoolName()); +/* String schoolName = registrationMapper.selectSchoolName(l.getAccountId()); + l.setSchoolName(schoolName);*/ + } + + if (l.getLeaderName() == null) { + l.setUserName(rankUtil.userClient.getUserName(Integer.valueOf(l.getAccountId()))); + l.setAccountId(l.getAccountId()); + } + + } + + return list; + } + + + public List singleStageMatchingSet(List competitionTeams, List list) { + //参赛全部队伍 A集合 + List allTeam = competitionTeams.stream().map(CompetitionTeam::getTeamId).collect(Collectors.toList()); + + //参与本次阶段,有成绩的队伍 B集合 + List teamWithResults = list.stream().map(ListOfStageResultsResp::getTeamId).collect(Collectors.toList()); + + //falseData:假数据,用于区分大赛没有参加团队的但是要给一条数据 + List falseData = new ArrayList<>(); + + // 对比 + for (Integer id : allTeam) { + if (!teamWithResults.contains(id)) { + // A集合中,B集合没有的对象id + //System.err.println(id); + //判断B中没有的团队id,则加入到要返回的list中 + + ListOfStageResultsResp addTeamId = new ListOfStageResultsResp(); + addTeamId.setTeamId(id); + addTeamId.setScore("—"); + addTeamId.setTimeSum("—"); + falseData.add(addTeamId); + } + } + + list.addAll(falseData); + + for (ListOfStageResultsResp l : list) { + CompetitionTeam team = rankUtil.teamMapper.selectById(l.getTeamId()); + if (team != null) { + if (l.getTeamName() == null) { + + l.setTeamName(team.getTeamName()); + } + + if (l.getLeaderName() == null) { + l.setLeaderName(rankUtil.userClient.getUserName(team.getAccountId())); + l.setAccountId(team.getAccountId() + ""); + } + + if (l.getSchoolId() == null) { + Integer schoolId = rankUtil.userClient.getSchoolIdByAccountId(team.getAccountId() + ""); + l.setSchoolId(schoolId); + l.setSchoolName(rankUtil.nakadaiClient.getTheSchoolNameBySchoolId(schoolId).getSchoolName()); + } + } + } + + return list; + } + + +} diff --git a/competition/src/main/java/com/huoran/competition/utils/ScoreGroupingUtil.java b/competition/src/main/java/com/huoran/competition/utils/ScoreGroupingUtil.java new file mode 100644 index 0000000..9b8dfb6 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/utils/ScoreGroupingUtil.java @@ -0,0 +1,81 @@ +package com.huoran.competition.utils; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.huoran.competition.entity.resp.FractionalSegmentResp; +import com.huoran.competition.entity.resp.ListOfStageResultsResp; + +public class ScoreGroupingUtil { + + public static FractionalSegmentResp scoreGrouping(IPage iPageList) { + FractionalSegmentResp data = new FractionalSegmentResp(); + Integer num1 = 0; + Integer num2 = 0; + Integer num3 = 0; + Integer num4 = 0; + Integer num5 = 0; + Integer num6 = 0; + Integer num7 = 0; + Integer num8 = 0; + Integer num9 = 0; + Integer num10 = 0; + + Double totalPoints = 0.0; + Integer time = 0; + + for (ListOfStageResultsResp resp : iPageList.getRecords()) { + time++; + totalPoints += Double.valueOf(resp.getScore()); + if (Double.valueOf(resp.getScore()) >= 0 && Double.valueOf(resp.getScore()) <= 10) { + num1++; + } + if (Double.valueOf(resp.getScore()) > 11 && Double.valueOf(resp.getScore()) <= 20) { + num2++; + } + if (Double.valueOf(resp.getScore()) > 21 && Double.valueOf(resp.getScore()) <= 30) { + num3++; + } + if (Double.valueOf(resp.getScore()) > 31 && Double.valueOf(resp.getScore()) <= 40) { + num4++; + } + if (Double.valueOf(resp.getScore()) > 41 && Double.valueOf(resp.getScore()) <= 50) { + num5++; + } + if (Double.valueOf(resp.getScore()) > 51 && Double.valueOf(resp.getScore()) <= 60) { + num6++; + + } + if (Double.valueOf(resp.getScore()) > 61 && Double.valueOf(resp.getScore()) <= 70) { + num7++; + } + if (Double.valueOf(resp.getScore()) > 71 && Double.valueOf(resp.getScore()) <= 80) { + num8++; + } + if (Double.valueOf(resp.getScore()) > 81 && Double.valueOf(resp.getScore()) <= 90) { + num9++; + } + if (Double.valueOf(resp.getScore()) > 91 && Double.valueOf(resp.getScore()) <= 100) { + num10++; + } + } + data.setNum1(num1++); + data.setNum2(num2++); + data.setNum3(num3++); + data.setNum4(num4++); + data.setNum5(num5++); + data.setNum6(num6++); + data.setNum7(num7++); + data.setNum8(num8++); + data.setNum9(num9++); + data.setNum10(num10++); + + if (Double.isNaN(totalPoints/time)){ + data.setAvgScore(0); + }else { + data.setAvgScore(totalPoints/time); + } + + + + return data; + } +} diff --git a/competition/src/main/java/com/huoran/competition/utils/SemesterDateUtils.java b/competition/src/main/java/com/huoran/competition/utils/SemesterDateUtils.java new file mode 100644 index 0000000..1ab2ff5 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/utils/SemesterDateUtils.java @@ -0,0 +1,151 @@ +package com.huoran.competition.utils; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class SemesterDateUtils { + + /* public static void main(String[] args) { + + Calendar calendar = Calendar.getInstance(); + // 获取当前年 + int year = calendar.get(Calendar.YEAR); + // 获取当前月 + int month = calendar.get(Calendar.MONTH) + 1; + + //打印出当前学期 + System.out.println(getCurrentSemester(year, month)); + + + } + + //获取当前学期 + public static String getCurrentSemester(Integer year, Integer month) { + StringBuilder sb = new StringBuilder(); + String num = "上"; //默认设成第一学期 + //如果是当前的9月1日到1月30之间,就是本年加上下一年的学期,学期是第一学期 + if (month >= 9 && month <= 12) { //当年的9至12月份 + // sb.append(year); + // sb.append("-"); + sb.append(year + 1); + } else if (month == 1 || month == 2) { //1,2月份为上学期 + // sb.append(year - 1); + // sb.append("-"); + sb.append(year); + + } else if (month >= 2 && month < 9) { //下学期 //如果是2至8月,那它就是上一年加上本年的学期,学期是下学期 + // sb.append(year - 1); + // sb.append("-"); + sb.append(year); + num = "下"; + } + //sb.append("第"); + sb.append(num); + sb.append("学期"); + return sb.toString(); + }*/ + + + public static String getYear(String content) { + + String year = null; + + if (content != null) { + + //正则表达式 + + String pat = "\\d{4}-\\d{2}-\\d{2}"; + + Pattern pattern = Pattern.compile(pat); // 实例化Pattern类 + + Matcher m = pattern.matcher(content); // 实例化Matcher类 + + if (m.matches()) { // 进行验证的匹配,使用正则 + + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + + Date date = null; + + try { + + date = format.parse(content); + + Calendar cal = Calendar.getInstance(); + + cal.setTime(date); + + year = "" + cal.get(Calendar.YEAR); + + } catch (ParseException e) { + + e.printStackTrace(); + + } + + } + + } + + return year; + + } + + public static String getMonth(String content) { + + String month = null; + + if (content != null) { + + //正则表达式 + + String pat = "\\d{4}-\\d{2}-\\d{2}"; + + Pattern pattern = Pattern.compile(pat); // 实例化Pattern类 + + Matcher m = pattern.matcher(content); // 实例化Matcher类 + + if (m.matches()) { // 进行验证的匹配,使用正则 + + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + + Date date = null; + + try { + + date = format.parse(content); + + Calendar cal = Calendar.getInstance(); + + cal.setTime(date); + + int num = cal.get(Calendar.MONTH) + 1; + + month = "" + num; + + } catch (ParseException e) { + + e.printStackTrace(); + + } + + } + + } + + return month; + + } + + public static void main(String[] args) { + + + System.out.println("month is:" + getMonth("2022-09-07")); + + System.out.println("year is:" + getYear("2022-09-07")); + + } +} diff --git a/competition/src/main/java/com/huoran/competition/utils/StatusConverter.java b/competition/src/main/java/com/huoran/competition/utils/StatusConverter.java new file mode 100644 index 0000000..98c7531 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/utils/StatusConverter.java @@ -0,0 +1,64 @@ +package com.huoran.competition.utils; + +import com.alibaba.excel.converters.Converter; +import com.alibaba.excel.enums.CellDataTypeEnum; +import com.alibaba.excel.metadata.CellData; +import com.alibaba.excel.metadata.GlobalConfiguration; +import com.alibaba.excel.metadata.property.ExcelContentProperty; + +/** + * @Author chen + * @DATE 2020/10/19 15:44 + * @Version 1.0 + * 状态转换器 + */ +public class StatusConverter implements Converter { + + @Override + public Class supportJavaTypeKey() { + return Integer.class; + } + + @Override + public CellDataTypeEnum supportExcelTypeKey() { + return CellDataTypeEnum.STRING; + } + + /** + * 这里读的时候会调用 + * + * @param cellData NotNull + * @param contentProperty Nullable + * @param globalConfiguration NotNull + * @return + */ + @Override + public Integer convertToJavaData(CellData cellData, ExcelContentProperty contentProperty, + GlobalConfiguration globalConfiguration) { + return 0; + } + + /** + * 这里是写的时候会调用 + * + * @param value NotNull + * @param contentProperty Nullable + * @param globalConfiguration NotNull + * @return + */ + @Override + public CellData convertToExcelData(Integer value, ExcelContentProperty contentProperty, + GlobalConfiguration globalConfiguration) { + + switch (value) { + case 0: + return new CellData("已禁用"); + case 1: + return new CellData("未禁用"); + default: + return new CellData(String.valueOf(value)); + } + + } + +} diff --git a/competition/src/main/java/com/huoran/competition/utils/ZipUtil.java b/competition/src/main/java/com/huoran/competition/utils/ZipUtil.java new file mode 100644 index 0000000..b9c522f --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/utils/ZipUtil.java @@ -0,0 +1,285 @@ +package com.huoran.competition.utils; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.competition.entity.CompetitionStageFile; +import com.huoran.competition.service.CompetitionStageFileService; +import com.huoran.competition.service.impl.CompetitionStageFileServiceImpl; +import io.lettuce.core.dynamic.annotation.Command; +import io.swagger.annotations.Api; +import lombok.extern.slf4j.Slf4j; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.PostConstruct; +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.*; +import java.net.HttpURLConnection; +import java.net.URL; +import java.net.URLEncoder; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; + +@Slf4j +@Component +public class ZipUtil { + + private static Logger logger = LoggerFactory.getLogger(ZipUtil.class); + /** + * 需要压缩的文件夹 + */ + public final static String downloadDir = "download"; + /** + * 打包后的文件夹 + */ + public final static String downloadZip = "downloadZip"; + + + @Resource + private CompetitionStageFileService service; + + public static ZipUtil zipUtil; + + @PostConstruct + public void init() { + zipUtil = this; + } + + /** + * 通过图片url下载图片到指定文件夹 + * + * @param downloadUrl 图片url + */ + public void downloadFile(String downloadUrl) { + InputStream inputStream = null; + OutputStream outputStream = null; + try { + //获取连接 + URL url = new URL(downloadUrl); + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + connection.setConnectTimeout(3 * 1000); + //设置请求头 + connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.110 Safari/537.36"); + //获取输入流 + inputStream = connection.getInputStream(); + + File fileDir = new File(downloadDir); + if (!fileDir.exists()) {//如果文件夹不存在 + fileDir.mkdir();//创建文件夹 + } + +// String delFile = downloadDir + downloadUrl; + + + //截取文件名称,可以把 / 换成需要的规则 + String filePath = downloadDir + "/" + downloadUrl.substring(downloadUrl.lastIndexOf("/")); + + + String processFileName = downloadUrl.substring(downloadUrl.lastIndexOf("/")); + System.err.printf("处理后的路径:" + processFileName + "\n"); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.like("file_path", processFileName); + CompetitionStageFile stageFile = zipUtil.service.getOne(queryWrapper); + + String userName = zipUtil.service.getStudentName(stageFile.getAccountId()); + String newPath = downloadDir + "/" + userName + "-" + stageFile.getFileName(); + + File file = new File(newPath); + + file.createNewFile();//创建文件,存在覆盖 + + outputStream = new FileOutputStream(file); + int len = 0; + byte[] buf = new byte[1024]; + while ((len = inputStream.read(buf, 0, 1024)) != -1) { + outputStream.write(buf, 0, len); + } + outputStream.flush(); + + + /* String downloadDirFilePath = filePath.replace("//","\\"); + //删除download文件下的文件 + deleteFile(downloadDirFilePath);*/ + + } catch (Exception e) { + logger.error("文件下载出错:" + e); + } finally { + try { + if (inputStream != null) { + inputStream.close(); + } + if (outputStream != null) { + outputStream.close(); + } + } catch (IOException e) { + logger.error("关闭流出错:" + e); + } + } + } + + + // 删除文件夹 + public static void deleteDirectory(File file) { + if (file.isFile()) {// 表示该文件不是文件夹 + file.delete(); + } else { + // 首先得到当前的路径 + String[] childFilePaths = file.list(); + for (String childFilePath : childFilePaths) { + File childFile = new File(file.getAbsolutePath() + "/" + childFilePath); + deleteDirectory(childFile); + } + file.delete(); + } + } + + + public static void main(String[] args) { + String s = "/1724641147097735168.png"; + System.out.printf(s.substring(0, s.length() - 1)); + } + + /** + * 下载压缩包 + */ + public void downloadZip(HttpServletRequest request, HttpServletResponse res, String zipName) throws IOException { + OutputStream out = null; + File zip = null; + try { + //多个文件进行压缩,批量打包下载文件 + //创建压缩文件需要的空的zip包 + //String zipName = "测试压缩包.zip"; + String zipFilePath = downloadZip + File.separator + zipName; + + + File fileDir = new File(downloadZip); + if (!fileDir.exists()) {//如果文件夹不存在 + fileDir.mkdir();//创建文件夹 + } + + //压缩文件 + zip = new File(zipFilePath); + zip.createNewFile();//创建文件,存在覆盖 + + //创建zip文件输出流 + ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zip)); + this.zipFile(downloadDir, zos); + + zos.close(); + + //将打包后的文件写到客户端,输出的方法同上,使用缓冲流输出 + BufferedInputStream bis = new BufferedInputStream(new FileInputStream(zipFilePath)); + byte[] buff = new byte[bis.available()]; + bis.read(buff); + bis.close(); + + //IO流实现下载的功能 + res.setCharacterEncoding("UTF-8"); //设置编码字符 + res.setContentType("application/octet-stream;charset=UTF-8"); //设置下载内容类型application/octet-stream(二进制流,未知文件类型); + //防止文件名乱码 + String userAgent = request.getHeader("USER-AGENT"); + if (userAgent.contains("Firefox") || userAgent.contains("firefox")) {//火狐浏览器 + zipName = new String(zipName.getBytes(), "ISO8859-1"); + } else { + zipName = URLEncoder.encode(zipName, "UTF-8");//其他浏览器 + } + +// res.setHeader("Content-disposition", "attachment;filename=" + zipName);//设置下载的压缩文件名称 + + // 告诉浏览器用什么软件可以打开此文件 + res.setHeader("content-Type", "application/vnd.ms-excel"); + // 下载文件的默认名称 + res.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(zipName)); + //编码 + res.setCharacterEncoding("UTF-8"); + out = res.getOutputStream(); //创建页面返回方式为输出流,会自动弹出下载框 + out.write(buff);//输出数据文件 + + //删除zip压缩文件 + System.out.printf("zipFilePath:" + zipFilePath); + deleteFile(zipFilePath); + + } catch (Exception e) { + logger.error("压缩包下载出错:" + e); + } finally { + if (out != null) { + out.flush();//释放缓存 + out.close();//关闭输出流 + } + } + } + + /** + * 压缩文件 + * + * @param filePath 需要压缩的文件夹 + * @param zos zip文件输出流 + */ + private void zipFile(String filePath, ZipOutputStream zos) throws IOException { + File inputFile = new File(filePath); //根据文件路径创建文件 + if (inputFile.exists()) { //判断文件是否存在 + if (inputFile.isFile()) { //判断是否属于文件,还是文件夹 + //创建输入流读取文件 + BufferedInputStream bis = new BufferedInputStream(new FileInputStream(inputFile)); + + //将文件写入zip内,即将文件进行打包 + zos.putNextEntry(new ZipEntry(inputFile.getName())); + + //写入文件的方法,同上 + int size = 0; + byte[] buffer = new byte[1024]; //设置读取数据缓存大小 + while ((size = bis.read(buffer)) > 0) { + zos.write(buffer, 0, size); + } + //关闭输入输出流 + zos.closeEntry(); + bis.close(); + + } else { //如果是文件夹,则使用穷举的方法获取文件,写入zip + try { + File[] files = inputFile.listFiles(); + for (File fileTem : files) { + zipFile(fileTem.toString(), zos); + } + } catch (Exception e) { + logger.error("压缩文件出错:" + e); + } + } + } + } + + + /** + * 判断指定的文件删除是否成功 + * + * @param fileName 文件路径 + * @return true or false 成功返回true,失败返回false + */ + public static boolean deleteFile(String fileName) { + File file = new File(fileName);//根据指定的文件名创建File对象 + if (file.exists() && file.isFile()) { //要删除的文件存在且是文件 + if (file.delete()) { + System.out.println("文件" + fileName + "删除成功!"); + return true; + } else { + System.out.println("文件" + fileName + "删除失败!"); + return false; + } + } else { + System.out.println("文件" + fileName + "不存在,删除失败!"); + return false; + } + + + } + + +} + + diff --git a/competition/src/main/java/com/huoran/competition/utils/oss/AliyunOssUtil.java b/competition/src/main/java/com/huoran/competition/utils/oss/AliyunOssUtil.java new file mode 100644 index 0000000..6042d5a --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/utils/oss/AliyunOssUtil.java @@ -0,0 +1,287 @@ +package com.huoran.competition.utils.oss; + +import cn.hutool.core.util.IdUtil; +import com.aliyun.oss.ClientException; +import com.aliyun.oss.OSS; +import com.aliyun.oss.OSSClientBuilder; +import com.aliyun.oss.OSSException; +import com.aliyun.oss.model.*; +import com.huoran.common.entity.FilesResult; +import com.huoran.common.utils.ConstantPropertiesUtil; +import org.apache.commons.lang.StringUtils; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.URLEncoder; +import java.util.List; + +public class AliyunOssUtil { + + /** + * 创建存储空间 + * + * @param ossClient oss客户端 + */ + public static void createBucket(OSS ossClient) { + // 判断存储空间是否存在,不存在,则创建 + if (!ossClient.doesBucketExist(ConstantPropertiesUtil.BUCKET_NAME)) { + // 创建CreateBucketRequest对象,设置仓库名称 + CreateBucketRequest bucketRequest = new CreateBucketRequest(ConstantPropertiesUtil.BUCKET_NAME); + // 设置存储空间的权限为公共读,默认是私有。 + bucketRequest.setCannedACL(CannedAccessControlList.PublicRead); + // 此处以设置存储空间的存储类型为标准存储为例。 + // createBucketRequest.setStorageClass(StorageClass.Standard); + // 默认情况下,数据容灾类型为本地冗余存储,即DataRedundancyType.LRS。如果需要设置数据容灾类型为同城冗余存储,请替换为DataRedundancyType.ZRS。 + // createBucketRequest.setDataRedundancyType(DataRedundancyType.ZRS) + // 创建存储空间。 + ossClient.createBucket(bucketRequest); + + } + } + + /** + * 上传文件 + * + * @param file 文件 + * @return 返回文件上传结果 + * @throws OSSException oss异常 + * @throws ClientException 客户端异常 + * @throws IOException io异常 + */ + public static FilesResult uploadFile(MultipartFile file, String tableName) throws OSSException, ClientException, IOException { + + //获取访问key + String endPoint = ConstantPropertiesUtil.END_POINT; + String accessKeyId = ConstantPropertiesUtil.ACCESS_KEY_ID; + String accessKeySecret = ConstantPropertiesUtil.ACCESS_KEY_SECRET; + //创建ossClient + OSS ossClient = new OSSClientBuilder().build(endPoint, accessKeyId, accessKeySecret); + + FilesResult result = new FilesResult(); + // 创建存储空间 + createBucket(ossClient); + + //获取上传文件流 + InputStream inputStream = file.getInputStream(); + //获取当前日期构建日期路径:PythonDataExcel/文件名 +// String currentDate = new DateTime().toString("yyyyMMdd"); + //获取上传的文件名称(此处filename直接取的TableName) +// String fileName = file.getOriginalFilename(); + + String fileName = tableName; + result.setOriginalFileName(StringUtils.substringBefore(fileName,".")); + + // 获取文件尾缀 + assert fileName != null; + String ext = fileName.substring(fileName.lastIndexOf(".")); + // 获取文件类型,大小 + String fileType = getFileType(ext); + long fileSize = file.getSize(); + + result.setFileType(fileType); + result.setFileSize(String.valueOf(fileSize)); + //获取随机值 + String snowflakeId = IdUtil.getSnowflake(6, 4).nextIdStr(); + //文件名:雪花算法.文件扩展名 +// String newName = snowflakeId + ext; + String sort = ext.substring(ext.lastIndexOf(".") + 1); + result.setFileType(sort); + //组合新的文件名 + String fileUrl = "PythonDataExcel/" + fileName; + result.setOssFileName(fileUrl); + // 设置上传时存储类型与访问权限 + ObjectMetadata metadata = new ObjectMetadata(); + // 指定该Object被下载时的网页的缓存行为 + metadata.setCacheControl("no-cache"); + // 指定该Object下设置Header + metadata.setHeader("Pragma", "no-cache"); + // 指定该Object被下载时的内容编码格式 + metadata.setContentEncoding("utf-8"); + // 文件的MIME,定义文件的类型及网页编码,决定浏览器将以什么形式、什么编码读取文件。如果用户没有指定则根据Key或文件名的扩展名生成, + // 如果没有扩展名则填默认值application/octet-stream + metadata.setContentType(fileType); + // 指定该Object被下载时的名称(指示MINME用户代理如何显示附加的文件,打开或下载,及文件名称) + metadata.setContentDisposition("filename/filesize=" + file.getName() + "/" + fileSize + "Byte."); + + //上传文件 (上传文件流的形式) + ossClient.putObject(ConstantPropertiesUtil.BUCKET_NAME, fileUrl, inputStream, metadata); + // 关闭OSSClient。 + ossClient.shutdown(); + + // 拼接文件url地址,返回控制层 + String tempEndpoint = ConstantPropertiesUtil.END_POINT; + String endpoint = tempEndpoint.substring(tempEndpoint.lastIndexOf("/") + 1, tempEndpoint.length()); + String url = "https://" + ConstantPropertiesUtil.BUCKET_NAME + "." + endpoint + "/" + fileUrl; + + result.setFileUrl(url); + + // 关闭OSSClient。 + ossClient.shutdown(); + + return result; + } + + /** + * 文件下载 + * + * @param response 响应对象 + * @param ossClient oss客户端 + * @param objectName 文件名 + */ + public static void downloadFiles(HttpServletResponse response, OSS ossClient, String objectName) throws IOException { + + // ossObject包含文件所在的存储空间名称、文件名称、文件元信息以及一个输入流。 + OSSObject ossObject = ossClient.getObject(ConstantPropertiesUtil.BUCKET_NAME, objectName); + InputStream input = null; + OutputStream outputStream = null; + try { + // 获取文件名 + String fileName = objectName.substring(objectName.lastIndexOf("/") + 1); + //获取输入流 + input = ossObject.getObjectContent(); + // 获取OutputStream输出流 + outputStream = response.getOutputStream(); + byte[] buffer = new byte[input.available()]; + + response.setHeader("content-Type", "application/octet-stream"); + response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8")); + response.flushBuffer(); + + for (int length = 0; (length = input.read(buffer)) > 0; ) { + outputStream.write(buffer, 0, length); + } + + } catch (IOException e) { + e.printStackTrace(); + throw e; + } finally { + if (null != outputStream) { + try { + outputStream.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (null != input) { + try { + input.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + // 关闭OSSClient。 + ossClient.shutdown(); + } + + } + + /** + * *** 谨慎操作 *** + * 删除存储空间 + * + * @param bucketName 存储空间名称 + */ + public static void deleteBucket(String bucketName) { + String endPoint = ConstantPropertiesUtil.END_POINT; + String accessKeyId = ConstantPropertiesUtil.ACCESS_KEY_ID; + String accessKeySecret = ConstantPropertiesUtil.ACCESS_KEY_SECRET; + // 创建OSSClient实例。 + OSS ossClient = new OSSClientBuilder().build(endPoint, accessKeyId, accessKeySecret); + // 删除存储空间。 + ossClient.deleteBucket(bucketName); + // 关闭OSSClient。 + ossClient.shutdown(); + } + + /** + * 创建文件夹 + * + * @param ossClient oss连接 + * @param bucketName 存储空间 + * @param folder 文件夹名,如 "qj_nanjing/" + * @return 返回创建的文件夹名 + */ + public static String createFolder(OSS ossClient, String bucketName, String folder) { + // 判断文件夹是否存在,不存在则创建 + if (!ossClient.doesObjectExist(bucketName, folder)) { + // 创建文件夹 + ossClient.putObject(bucketName, folder, new ByteArrayInputStream(new byte[0])); + // 得到文件夹名 + OSSObject object = ossClient.getObject(bucketName, folder); + return object.getKey(); + } + return folder; + } + + /** + * 批量删除文件。key等同于ObjectName,表示删除OSS文件时需要指定包含文件后缀在内的完整路径,例如abc/efg/123.jpg。 + * + * @param keys 文件完整路径 + */ + public static List deleteFiles(List keys) { + String endPoint = ConstantPropertiesUtil.END_POINT; + String accessKeyId = ConstantPropertiesUtil.ACCESS_KEY_ID; + String accessKeySecret = ConstantPropertiesUtil.ACCESS_KEY_SECRET; + String bucketName = ConstantPropertiesUtil.BUCKET_NAME; + // 创建OSSClient实例。 + OSS ossClient = new OSSClientBuilder().build(endPoint, accessKeyId, accessKeySecret); + + DeleteObjectsResult deleteObjectsResult = ossClient.deleteObjects(new DeleteObjectsRequest(bucketName).withKeys(keys)); + List deletedObjects = deleteObjectsResult.getDeletedObjects(); + // 关闭OSSClient。 + ossClient.shutdown(); + //返回删除成功文件列表 + return deletedObjects; + } + + /** + * 获取文件类型 + * + * @param fileExtension 文件后缀 + * @return 返回类型 + */ + public static String getFileType(String fileExtension) { + if (".bmp".equalsIgnoreCase(fileExtension)) { + return "image/bmp"; + } + if (".gif".equalsIgnoreCase(fileExtension)) { + return "image/gif"; + } + if (".jpeg".equalsIgnoreCase(fileExtension) || ".jpg".equalsIgnoreCase(fileExtension) || ".png".equalsIgnoreCase(fileExtension)) { + return "image/jpg"; + } + if (".html".equalsIgnoreCase(fileExtension)) { + return "text/html"; + } + if (".txt".equalsIgnoreCase(fileExtension)) { + return "text/plain"; + } + if (".vsd".equalsIgnoreCase(fileExtension)) { + return "application/vnd.visio"; + } + if (".ppt".equalsIgnoreCase(fileExtension) || ".pptx".equalsIgnoreCase(fileExtension)) { + return "application/vnd.ms-powerpoint"; + } + if (".doc".equalsIgnoreCase(fileExtension) || ".docx".equalsIgnoreCase(fileExtension)) { + return "application/msword"; + } + if (".xml".equalsIgnoreCase(fileExtension)) { + return "text/xml"; + } + if (".mp4".equalsIgnoreCase(fileExtension) || ".avi".equalsIgnoreCase(fileExtension)) { + return "video/mp4"; + } + if (".mpg".equalsIgnoreCase(fileExtension) || ".mpeg".equalsIgnoreCase(fileExtension)) { + return "video/mpeg"; + } + if ("pdf".equalsIgnoreCase(fileExtension)) { + return "application/pdf"; + } + return "application/octet-stream"; + } + +} diff --git a/competition/src/main/java/com/huoran/competition/utils/oss/AliyunVodSDKUtil.java b/competition/src/main/java/com/huoran/competition/utils/oss/AliyunVodSDKUtil.java new file mode 100644 index 0000000..c41891b --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/utils/oss/AliyunVodSDKUtil.java @@ -0,0 +1,17 @@ +package com.huoran.competition.utils.oss; + +import com.aliyuncs.DefaultAcsClient; +import com.aliyuncs.profile.DefaultProfile; + +/** + * @Author chen + * @DATE 2020/10/12 9:10 + * @Version 1.0 + */ +public class AliyunVodSDKUtil { + public static DefaultAcsClient initVodClient(String accessKeyId, String accessKeySecret) { + String regionId = "cn-shanghai"; // 点播服务接入区域 + DefaultProfile profile = DefaultProfile.getProfile(regionId, accessKeyId, accessKeySecret); + return new DefaultAcsClient(profile); + } +} diff --git a/competition/src/main/java/com/huoran/competition/utils/poi/CommonCode.java b/competition/src/main/java/com/huoran/competition/utils/poi/CommonCode.java new file mode 100644 index 0000000..7042e69 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/utils/poi/CommonCode.java @@ -0,0 +1,53 @@ +package com.huoran.competition.utils.poi; + +import lombok.ToString; + +@ToString +public enum CommonCode implements ResultCode { + + + SUCCESS(true, 10000, "操作成功!"), + UNAUTHENTICATED(false, 10001, "此操作需要登陆系统!"), + UNAUTHORISE(false, 10002, "权限不足,无权操作!"), + QUESTIONTYPE_INVALID(false, 10006, "题型错误!"), + INVALID_PARAM(false, 10003, "非法参数!"), + QUESTION_NUM_INVALID(false, 10004, "测评题目数量设置超出范围!"), + QUESTION_EXISTS(false, 10005, "此题已存在!"), + QUESTION_TYPE_INVALID(false, 10006, "题型错误!"), + EXCEL_INVALID(false, 10007, "excel表内容错误!"), + EVALUATION_TIME_INVALID(false, 10008, "测评时间错误!"), + EXCEL_FILE_INVALID(false, 10009, "上传excel文件错误!"), + REPEAT_INEXCEL(false, 10010, "试题在excel表中重复!"), + EVALUATION_QUESTION_NUM_INVALID(false, 10011, "当前测评题数设置为0,请先设置测评题数!"), + FAIL(false, 11111, "操作失败!"), + SERVER_ERROR(false, 99999, "抱歉,系统繁忙,请稍后重试!"); + //操作是否成功 + boolean success; + //操作代码 + int code; + //提示信息 + String message; + + CommonCode(boolean success, int code, String message) { + this.success = success; + this.code = code; + this.message = message; + } + + @Override + public boolean success() { + return success; + } + + @Override + public int code() { + return code; + } + + @Override + public String message() { + return message; + } + + +} diff --git a/competition/src/main/java/com/huoran/competition/utils/poi/CustomException.java b/competition/src/main/java/com/huoran/competition/utils/poi/CustomException.java new file mode 100644 index 0000000..8cff490 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/utils/poi/CustomException.java @@ -0,0 +1,25 @@ +package com.huoran.competition.utils.poi; + +/** + * @author 世杰 + * @date 2020/3/24 22:47 + */ +public class CustomException extends RuntimeException { + private ResultCode resultCode; + + public CustomException(Integer code, String message) { + //异常信息为错误代码+异常信息 + super("错误代码:" + code + "错误信息:" + message); + this.resultCode = resultCode; + } + + public CustomException(ResultCode resultCode) { + //异常信息为错误代码+异常信息 + super("错误代码:" + resultCode.code() + "错误信息:" + resultCode.message()); + this.resultCode = resultCode; + } + + public ResultCode getResultCode() { + return this.resultCode; + } +} diff --git a/competition/src/main/java/com/huoran/competition/utils/poi/EasyPoiUtil.java b/competition/src/main/java/com/huoran/competition/utils/poi/EasyPoiUtil.java new file mode 100644 index 0000000..a4e3607 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/utils/poi/EasyPoiUtil.java @@ -0,0 +1,47 @@ +package com.huoran.competition.utils.poi; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import com.aliyuncs.utils.StringUtils; + +import java.lang.reflect.Field; +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Proxy; +import java.util.Map; + +/** + * 动态显示Excel导出列 + * + * @param + */ +public class EasyPoiUtil { + /** + * 需要被反射的对象,使用泛型规范传入对象 + */ + public T t; + + /** + * 动态更改EasyPoi中控制列显示的值 * * @param columnName 需要转换的列属性名称 * @param target 默认true * @throws NoSuchFieldException * @throws IllegalAccessException + */ + public void hihdColumn(String columnName, Boolean target) throws Exception { + if (t == null) { + throw new ClassNotFoundException("TARGET OBJECT NOT FOUNT"); + } + if (StringUtils.isEmpty(columnName)) { + throw new NullPointerException("COLUMN NAME NOT NULL"); + } + if (target == null) { + target = true; + } + //获取目标对象的属性值 + Field field = t.getClass().getDeclaredField(columnName); + //获取注解反射对象 + Excel excelAnnon = field.getAnnotation(Excel.class); + //获取代理 + InvocationHandler invocationHandler = Proxy.getInvocationHandler(excelAnnon); + Field excelField = invocationHandler.getClass().getDeclaredField("memberValues"); + excelField.setAccessible(true); + Map memberValues = (Map) excelField.get(invocationHandler); + memberValues.put("isColumnHidden", target); + + } +} diff --git a/competition/src/main/java/com/huoran/competition/utils/poi/ExcelAttribute.java b/competition/src/main/java/com/huoran/competition/utils/poi/ExcelAttribute.java new file mode 100644 index 0000000..b28ca7d --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/utils/poi/ExcelAttribute.java @@ -0,0 +1,25 @@ +package com.huoran.competition.utils.poi; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) +public @interface ExcelAttribute { + /** + * 对应的列名称 + */ + String name() default ""; + + /** + * excel列的索引 + */ + int sort(); + + /** + * 字段类型对应的格式 + */ + String format() default ""; +} diff --git a/competition/src/main/java/com/huoran/competition/utils/poi/ExceptionCast.java b/competition/src/main/java/com/huoran/competition/utils/poi/ExceptionCast.java new file mode 100644 index 0000000..4ac8aa0 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/utils/poi/ExceptionCast.java @@ -0,0 +1,12 @@ +package com.huoran.competition.utils.poi; + +/** + * @author 世杰 + * @date 2020/3/24 23:04 + */ +public class ExceptionCast { + //使用此静态方法抛出自定义异常 + public static void cast(ResultCode resultCode) { + throw new CustomException(resultCode); + } +} diff --git a/competition/src/main/java/com/huoran/competition/utils/poi/ResultCode.java b/competition/src/main/java/com/huoran/competition/utils/poi/ResultCode.java new file mode 100644 index 0000000..e06f2d0 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/utils/poi/ResultCode.java @@ -0,0 +1,21 @@ +package com.huoran.competition.utils.poi; + +/** + * Created by mrt on 2018/3/5. + * 10000-- 通用错误代码 + * 22000-- 媒资错误代码 + * 23000-- 用户中心错误代码 + * 24000-- cms错误代码 + * 25000-- 文件系统 + */ +public interface ResultCode { + //操作是否成功,true为成功,false操作失败 + boolean success(); + + //操作代码 + int code(); + + //提示信息 + String message(); + +} diff --git a/competition/src/main/resources/bootstrap.properties b/competition/src/main/resources/bootstrap.properties new file mode 100644 index 0000000..3b64a12 --- /dev/null +++ b/competition/src/main/resources/bootstrap.properties @@ -0,0 +1,36 @@ +# project-name +spring.application.name=competition + +#addr +spring.cloud.nacos.config.server-addr=127.0.0.1:8848 + +#namespace +spring.cloud.nacos.config.namespace=kindergarten-microservice-configuration-namespace + +# 某些类对象无法序列化的时候,是否报错 +#spring.jackson.serialization.fail-on-empty-beans=true +## json对象中有不存在的属性时候,是否报错 +#spring.jackson.deserialization.fail-on-unknown-properties=true + +#druid连接池配置 +spring.datasource.druid.initialSize=10 +spring.datasource.druid.maxActive=20 +spring.datasource.druid.maxWait=60000 +spring.datasource.druid.minIdle=1 +spring.datasource.druid.timeBetweenEvictionRunsMillis=60000 +spring.datasource.druid.minEvictableIdleTimeMillis=300000 +spring.datasource.druid.testWhileIdle=true +spring.datasource.druid.testOnBorrow=true +spring.datasource.druid.testOnReturn=false +spring.datasource.druid.poolPreparedStatements=true +spring.datasource.druid.maxOpenPreparedStatements=20 +spring.datasource.druid.validationQuery=SELECT 1 +spring.datasource.druid.validation-query-timeout=500 +spring.datasource.druid.filters=stat +#面板开启 +spring.datasource.druid.stat-view-servlet.enabled=true +spring.datasource.druid.stat-view-servlet.url-pattern=/druid/* +spring.datasource.druid.stat-view-servlet.reset-enable=true +spring.datasource.druid.stat-view-servlet.login-username=admin +spring.datasource.druid.stat-view-servlet.login-password=admin + diff --git a/competition/src/main/resources/logback-spring.xml b/competition/src/main/resources/logback-spring.xml new file mode 100644 index 0000000..a831a51 --- /dev/null +++ b/competition/src/main/resources/logback-spring.xml @@ -0,0 +1,158 @@ + + + + + + + logback + + + + + + + + + + + + + + + + + + INFO + + + ${CONSOLE_LOG_PATTERN} + + UTF-8 + + + + + + + ${log.path}/log_info.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + ${log.path}/info/log-info-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + INFO + ACCEPT + DENY + + + + + + + ${log.path}/log_warn.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${log.path}/warn/log-warn-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + warn + ACCEPT + DENY + + + + + + + + ${log.path}/log_error.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${log.path}/error/log-error-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + ERROR + ACCEPT + DENY + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/competition/src/test/java/CodeGenerator.java b/competition/src/test/java/CodeGenerator.java new file mode 100644 index 0000000..efff9c3 --- /dev/null +++ b/competition/src/test/java/CodeGenerator.java @@ -0,0 +1,80 @@ +import com.baomidou.mybatisplus.annotation.DbType; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.generator.AutoGenerator; +import com.baomidou.mybatisplus.generator.config.DataSourceConfig; +import com.baomidou.mybatisplus.generator.config.GlobalConfig; +import com.baomidou.mybatisplus.generator.config.PackageConfig; +import com.baomidou.mybatisplus.generator.config.StrategyConfig; +import com.baomidou.mybatisplus.generator.config.rules.DateType; +import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; +import org.junit.Test; + +/** + * @Author chen + * @DATE 2021/8/10 15:42 + * @Version 1.0 + */ +public class CodeGenerator { + + @Test + public void run() { + + // 1、创建代码生成器 + AutoGenerator mpg = new AutoGenerator(); + + // 2、全局配置 + GlobalConfig gc = new GlobalConfig(); + String projectPath = System.getProperty("user.dir"); + gc.setOutputDir(projectPath + "/src/main/java"); + + + gc.setAuthor("cheney");//设置作者 + gc.setOpen(false); //生成后是否打开资源管理器 + gc.setFileOverride(false); //重新生成时文件是否覆盖 + gc.setServiceName("%sService"); //去掉Service接口的首字母I + gc.setIdType(IdType.AUTO); //主键策略 + gc.setDateType(DateType.ONLY_DATE);//定义生成的实体类中日期类型 + gc.setSwagger2(true);//开启Swagger2模式 + + mpg.setGlobalConfig(gc); + + // 3、数据源配置 + DataSourceConfig dsc = new DataSourceConfig(); + dsc.setUrl("jdbc:mysql://139.9.47.170:3306/occupationlab?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8"); + dsc.setDriverName("com.mysql.cj.jdbc.Driver"); + dsc.setUsername("root"); + dsc.setPassword("HuoRan@2021"); + dsc.setDbType(DbType.MYSQL); + mpg.setDataSource(dsc); + + // 4、包配置 + PackageConfig pc = new PackageConfig(); + pc.setParent("com.huoran.competition"); + //pc.setModuleName("occupationlab"); //模块名 + pc.setController("controller"); + pc.setEntity("entity"); + pc.setService("service"); + pc.setServiceImpl("service.impl"); + pc.setMapper("mapper"); + mpg.setPackageInfo(pc); + + // 5、策略配置 + StrategyConfig strategy = new StrategyConfig(); + strategy.setInclude("c_competition_release_time"); + + strategy.setNaming(NamingStrategy.underline_to_camel);//数据库表映射到实体的命名策略 + strategy.setTablePrefix("c_"); //生成实体时去掉表前缀 + + strategy.setColumnNaming(NamingStrategy.underline_to_camel);//数据库表字段映射到实体的命名策略 + strategy.setEntityLombokModel(true); // lombok 模型 @Accessors(chain = true) setter链式操作 + + strategy.setRestControllerStyle(true); //restful api风格控制器 + strategy.setControllerMappingHyphenStyle(true); //url中驼峰转连字符 + + mpg.setStrategy(strategy); + + + // 6、执行 + mpg.execute(); + } +} diff --git a/gateway/deploy/gateway-deploy.yaml b/gateway/deploy/gateway-deploy.yaml new file mode 100644 index 0000000..5842415 --- /dev/null +++ b/gateway/deploy/gateway-deploy.yaml @@ -0,0 +1,66 @@ +kind: Deployment +apiVersion: apps/v1 +metadata: + name: gateway + namespace: huoranmicro + labels: + app: gateway + version: v1 +spec: + replicas: 1 + selector: + matchLabels: + app: gateway + version: v1 + template: + metadata: + labels: + app: gateway + version: v1 + spec: + containers: + - name: gateway + image: $REGISTRY/$DOCKERHUB_NAMESPACE/$APP_NAME:$TAG_NAME + ports: + - containerPort: 8080 + protocol: TCP + resources: + limits: + cpu: 1000m + memory: 1000Mi + requests: + cpu: 100m + memory: 100Mi + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + imagePullPolicy: IfNotPresent + restartPolicy: Always + terminationGracePeriodSeconds: 30 + serviceName: gateway + podManagementPolicy: OrderedReady + updateStrategy: + type: RollingUpdate + rollingUpdate: + partition: 0 + revisionHistoryLimit: 10 + +--- +kind: Service +apiVersion: v1 +metadata: + name: gateway + namespace: huoranmicro + labels: + app: gateway + version: v1 +spec: + ports: + - name: http + protocol: TCP + port: 8080 + targetPort: 8080 + nodePort: 20001 + selector: + app: gateway + type: NodePort + sessionAffinity: None \ No newline at end of file diff --git a/gateway/pom.xml b/gateway/pom.xml new file mode 100644 index 0000000..071b3e2 --- /dev/null +++ b/gateway/pom.xml @@ -0,0 +1,118 @@ + + + + huoran + com.huoran.parent + 1.0-SNAPSHOT + + 4.0.0 + + com.huoran.common + gateway + 1.0.0 + gateway + 或然项目子工程-网关微服务 + + + 1.8 + UTF-8 + UTF-8 + + + + + + + + com.huoran.common + common + 0.0.1-SNAPSHOT + + + spring-boot-starter-web + org.springframework.boot + + + com.alibaba.cloud + spring-cloud-starter-alibaba-sentinel + + + + + + com.huoran.api + api + 1.0-SNAPSHOT + + + spring-boot-starter-web + org.springframework.boot + + + compile + + + + + org.springframework.cloud + spring-cloud-starter-gateway + + + + + org.springframework.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + + + org.springframework.cloud + spring-cloud-starter-alibaba-nacos-config + + + + + org.springframework.cloud + spring-cloud-starter-openfeign + + + + + + + + + + org.springframework.cloud + spring-cloud-starter-loadbalancer + + + + + + com.google.code.gson + gson + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + \ No newline at end of file diff --git a/gateway/src/main/java/com/huoran/gateway/GatewayApplication.java b/gateway/src/main/java/com/huoran/gateway/GatewayApplication.java new file mode 100644 index 0000000..292152c --- /dev/null +++ b/gateway/src/main/java/com/huoran/gateway/GatewayApplication.java @@ -0,0 +1,26 @@ +package com.huoran.gateway; + +import com.alibaba.druid.pool.DruidDataSource; +import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; +import org.springframework.cloud.openfeign.EnableFeignClients; + +import javax.sql.DataSource; + +/** + * @description + * @author: Mr.JK + * @create: 2021-06-16 15:04 + **/ +@EnableFeignClients(basePackages = "com.huoran.api") +@EnableDiscoveryClient +@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, DruidDataSourceAutoConfigure.class}) +public class GatewayApplication { + + public static void main(String[] args) { + SpringApplication.run(GatewayApplication.class,args); + } +} diff --git a/gateway/src/main/java/com/huoran/gateway/config/CorsConfig.java b/gateway/src/main/java/com/huoran/gateway/config/CorsConfig.java new file mode 100644 index 0000000..23543f4 --- /dev/null +++ b/gateway/src/main/java/com/huoran/gateway/config/CorsConfig.java @@ -0,0 +1,29 @@ +package com.huoran.gateway.config; + + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.cors.CorsConfiguration; +import org.springframework.web.cors.reactive.CorsWebFilter; +import org.springframework.web.cors.reactive.UrlBasedCorsConfigurationSource; +import org.springframework.web.util.pattern.PathPatternParser; + +/** + * 处理跨域 + */ +@Configuration +public class CorsConfig { + @Bean + public CorsWebFilter corsFilter() { + CorsConfiguration config = new CorsConfiguration(); + config.addAllowedMethod("*"); + config.addAllowedOrigin("*"); + config.addAllowedHeader("*"); + + UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(new PathPatternParser()); + source.registerCorsConfiguration("/**", config); + + return new CorsWebFilter(source); + } +} + diff --git a/gateway/src/main/java/com/huoran/gateway/config/SentinelGatewayConfig.java b/gateway/src/main/java/com/huoran/gateway/config/SentinelGatewayConfig.java new file mode 100644 index 0000000..9f333d4 --- /dev/null +++ b/gateway/src/main/java/com/huoran/gateway/config/SentinelGatewayConfig.java @@ -0,0 +1,33 @@ +package com.huoran.gateway.config; + + +/*import com.alibaba.csp.sentinel.adapter.gateway.sc.callback.BlockRequestHandler; +import com.alibaba.csp.sentinel.adapter.gateway.sc.callback.GatewayCallbackManager; +import com.alibaba.fastjson.JSON; +import com.huoran.common.response.R; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.reactive.function.server.ServerResponse; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Mono; + +*//** + * @Author chen + * @DATE 2022/7/11 15:27 + * @Version 1.0 + * 网关限流,调用此方法 + *//* +@Configuration +public class SentinelGatewayConfig { + + public SentinelGatewayConfig(){ + GatewayCallbackManager.setBlockHandler(new BlockRequestHandler() { + @Override + public Mono handleRequest(ServerWebExchange serverWebExchange, Throwable throwable) { + R error = R.error("网关限流!"); + String errorJson = JSON.toJSONString(error); + Mono body = ServerResponse.ok().body(Mono.just(errorJson), String.class); + return body; + } + }); + } +}*/ diff --git a/gateway/src/main/java/com/huoran/gateway/config/SwaggerHandler.java b/gateway/src/main/java/com/huoran/gateway/config/SwaggerHandler.java new file mode 100644 index 0000000..2a2226d --- /dev/null +++ b/gateway/src/main/java/com/huoran/gateway/config/SwaggerHandler.java @@ -0,0 +1,59 @@ +package com.huoran.gateway.config; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import reactor.core.publisher.Mono; +import springfox.documentation.swagger.web.*; + +import java.util.Optional; + +/** + * @description + * @author: Mr.JK + * @create: 2021-07-09 17:03 + **/ +@RestController +public class SwaggerHandler { + @Autowired(required = false) + private SecurityConfiguration securityConfiguration; + @Autowired(required = false) + private UiConfiguration uiConfiguration; + private final SwaggerResourcesProvider swaggerResources; + + @Autowired + public SwaggerHandler(SwaggerResourcesProvider swaggerResources) { + this.swaggerResources = swaggerResources; + } + + + @GetMapping("/swagger-resources/configuration/security") + public Mono> securityConfiguration() { + return Mono.just(new ResponseEntity<>( + Optional.ofNullable(securityConfiguration).orElse(SecurityConfigurationBuilder.builder().build()), HttpStatus.OK)); + } + + @GetMapping("/swagger-resources/configuration/ui") + public Mono> uiConfiguration() { + return Mono.just(new ResponseEntity<>( + Optional.ofNullable(uiConfiguration).orElse(UiConfigurationBuilder.builder().build()), HttpStatus.OK)); + } + + @GetMapping("/swagger-resources") + public Mono swaggerResources() { + return Mono.just((new ResponseEntity<>(swaggerResources.get(), HttpStatus.OK))); + } + + @GetMapping("/") + public Mono swaggerResourcesN() { + return Mono.just((new ResponseEntity<>(swaggerResources.get(), HttpStatus.OK))); + } + + @GetMapping("/csrf") + public Mono swaggerResourcesCsrf() { + return Mono.just((new ResponseEntity<>(swaggerResources.get(), HttpStatus.OK))); + } +} diff --git a/gateway/src/main/java/com/huoran/gateway/config/SwaggerProvider.java b/gateway/src/main/java/com/huoran/gateway/config/SwaggerProvider.java new file mode 100644 index 0000000..41ea1fa --- /dev/null +++ b/gateway/src/main/java/com/huoran/gateway/config/SwaggerProvider.java @@ -0,0 +1,50 @@ +package com.huoran.gateway.config; + +import lombok.AllArgsConstructor; +import org.springframework.cloud.gateway.config.GatewayProperties; +import org.springframework.cloud.gateway.route.RouteLocator; +import org.springframework.cloud.gateway.support.NameUtils; +import org.springframework.context.annotation.Primary; +import org.springframework.stereotype.Component; +import springfox.documentation.swagger.web.SwaggerResource; +import springfox.documentation.swagger.web.SwaggerResourcesProvider; + +import java.util.ArrayList; +import java.util.List; +/** + * @description + * @author: Mr.JK + * @create: 2021-07-09 16:05 + **/ +@Component +@Primary +@AllArgsConstructor +public class SwaggerProvider implements SwaggerResourcesProvider { + public static final String API_URI = "/v2/api-docs"; + private final RouteLocator routeLocator; + private final GatewayProperties gatewayProperties; + + + @Override + public List get() { + List resources = new ArrayList<>(); + List routes = new ArrayList<>(); + routeLocator.getRoutes().subscribe(route -> routes.add(route.getId())); + gatewayProperties.getRoutes().stream().filter(routeDefinition -> routes.contains(routeDefinition.getId())) + .forEach(routeDefinition -> routeDefinition.getPredicates().stream() + .filter(predicateDefinition -> ("Path").equalsIgnoreCase(predicateDefinition.getName())) + .forEach(predicateDefinition -> resources.add(swaggerResource(routeDefinition.getId(), + predicateDefinition.getArgs().get(NameUtils.GENERATED_NAME_PREFIX + "0") + .replace("/**", API_URI))))); + return resources; + } + + private SwaggerResource swaggerResource(String name, String location) { + + SwaggerResource swaggerResource = new SwaggerResource(); + swaggerResource.setName(name); + swaggerResource.setLocation(location); + swaggerResource.setSwaggerVersion("2.0"); + return swaggerResource; + } +} \ No newline at end of file diff --git a/gateway/src/main/java/com/huoran/gateway/filter/AuthGlobalFilter.java b/gateway/src/main/java/com/huoran/gateway/filter/AuthGlobalFilter.java new file mode 100644 index 0000000..7c27229 --- /dev/null +++ b/gateway/src/main/java/com/huoran/gateway/filter/AuthGlobalFilter.java @@ -0,0 +1,107 @@ +package com.huoran.gateway.filter; + +import com.alibaba.fastjson.JSONObject; +import com.huoran.common.utils.JwtUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.cloud.gateway.filter.GatewayFilterChain; +import org.springframework.cloud.gateway.filter.GlobalFilter; +import org.springframework.context.annotation.PropertySource; +import org.springframework.core.Ordered; +import org.springframework.core.io.buffer.DataBuffer; +import org.springframework.http.HttpStatus; +import org.springframework.http.server.reactive.ServerHttpRequest; +import org.springframework.http.server.reactive.ServerHttpResponse; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Mono; + +import java.nio.charset.StandardCharsets; +import java.util.List; + +/** + * @Author cheney + * @Version 1.0 + * 全局Filter,统一处理用户登录与外部不允许访问的服务 + */ +@Component +@PropertySource(value = "classpath:jwt.properties") +public class AuthGlobalFilter implements GlobalFilter, Ordered { + + /** + * 不进行token校验的请求地址 + */ + @Value("#{'${jwt.ignoreUrlList}'.split(',')}") + public List ignoreUrl; + + /*@Autowired + private UserClient userClient;*/ + + /** + * 拦截所有的请求头 + */ + @Override + public Mono filter(ServerWebExchange exchange, GatewayFilterChain chain) { + //获取请求路径 + String requestUrl = exchange.getRequest().getPath().toString(); + //路径比较 + boolean status = CollectionUtils.contains(ignoreUrl.iterator(), requestUrl); + if (requestUrl.contains("/nakadai/nakadai/oss/getPlayAuth")||requestUrl.contains("/nakadai/nakadai/curriculum/chapter/queryChaptersAndSubsections")){ + status = true; + } + if (!status){ + //获取token值 + String token = exchange.getRequest().getHeaders().getFirst("token"); + ServerHttpResponse response = exchange.getResponse(); + //没有数据 + if (StringUtils.isBlank(token)) { + JSONObject message = new JSONObject(); + message.put("status", "401"); + message.put("message", "请先登录"); + byte[] bits = message.toString().getBytes(StandardCharsets.UTF_8); + DataBuffer buffer = response.bufferFactory().wrap(bits); + response.setStatusCode(HttpStatus.UNAUTHORIZED); + response.getHeaders().add("Content-Type", "text/json;charset=UTF-8"); + return response.writeWith(Mono.just(buffer)); + //有数据 + }else { + //校验token + boolean isVerify = JwtUtils.checkToken(token); + if (isVerify){ + /*boolean disabled = userClient.accountIsDisabled(token); + if (disabled){ + JSONObject message = new JSONObject(); + message.put("message", "用户已禁用,请联系管理员进行处理!"); + message.put("status", "402"); + byte[] bits = message.toString().getBytes(StandardCharsets.UTF_8); + DataBuffer buffer = response.bufferFactory().wrap(bits); + response.setStatusCode(HttpStatus.UNAUTHORIZED); + response.getHeaders().add("Content-Type", "text/json;charset=UTF-8"); + return response.writeWith(Mono.just(buffer)); + }*/ + }else { + JSONObject message = new JSONObject(); + message.put("message", "登录已失效,请重新登录"); + message.put("status", "401"); + byte[] bits = message.toString().getBytes(StandardCharsets.UTF_8); + DataBuffer buffer = response.bufferFactory().wrap(bits); + response.setStatusCode(HttpStatus.UNAUTHORIZED); + response.getHeaders().add("Content-Type", "text/json;charset=UTF-8"); + return response.writeWith(Mono.just(buffer)); + } + //将现在的request,添加当前身份 + ServerHttpRequest mutableReq = exchange.getRequest().mutate().header("Authorization", token).build(); + ServerWebExchange mutableExchange = exchange.mutate().request(mutableReq).build(); + return chain.filter(mutableExchange); + } + } + return chain.filter(exchange); + } + + @Override + public int getOrder() { + return 0; + } + +} diff --git a/gateway/src/main/resources/bootstrap.properties b/gateway/src/main/resources/bootstrap.properties new file mode 100644 index 0000000..16d60f2 --- /dev/null +++ b/gateway/src/main/resources/bootstrap.properties @@ -0,0 +1,13 @@ +spring.application.name=gateway + +#addr +spring.cloud.nacos.config.server-addr=127.0.0.1:8848 + +#namespace +spring.cloud.nacos.config.namespace=kindergarten-microservice-configuration-namespace + +# 某些类对象无法序列化的时候,是否报错 +#spring.jackson.serialization.fail-on-empty-beans=true +## json对象中有不存在的属性时候,是否报错 +#spring.jackson.deserialization.fail-on-unknown-properties=true + diff --git a/gateway/src/main/resources/bootstrap.yml b/gateway/src/main/resources/bootstrap.yml new file mode 100644 index 0000000..9e4f6ba --- /dev/null +++ b/gateway/src/main/resources/bootstrap.yml @@ -0,0 +1,17 @@ +hystrix: + command: + default: + execution: + timeout: + enabled: true + isolation: + thread: + timeoutInMilliseconds: 60000 + +ribbon: + ReadTimeout: 10000 + ConnectTimeout: 10000 + MaxAutoRetries: 0 + MaxAutoRetriesNextServer: 1 + eureka: + enabled: true \ No newline at end of file diff --git a/gateway/src/main/resources/jwt.properties b/gateway/src/main/resources/jwt.properties new file mode 100644 index 0000000..0743393 --- /dev/null +++ b/gateway/src/main/resources/jwt.properties @@ -0,0 +1,102 @@ +jwt.ignoreUrlList=/users/users/user/captcha,\ + /users/users/user/login,\ + /data/v2/api-docs,\ + /nakadai/v2/api-docs,\ + /users/v2/api-docs,\ + /occupationlab/v2/api-docs,\ + /python/v2/api-docs,\ + /judgment/v2/api-docs,\ + /bank/v2/api-docs,\ + /competition/v2/api-docs,\ + /product/v2/api-docs,\ + /users/users/user/getOtherAccount,\ + /data/data/table/getTableByCondition,\ + /data/data/preview,\ + /data/data/visualPreview,\ + /users/users/userAccount/bindPhoneOrEmail,\ + /users/users/userAccount/sendPhoneOrEmailCode,\ + /occupationlab/occupationlab/questions/importQuestion,\ + /occupationlab/occupationlab/questions/exportFailure,\ + /occupationlab/occupationlab/architecture/importStudent,\ + /occupationlab/occupationlab/architecture/exportFailure,\ + /occupationlab/occupationlab/achievement/exportPracticeInfo,\ + /occupationlab/occupationlab/achievement/exportAssessmentInfo,\ + /occupationlab/occupationlab/achievement/exportPracticeByStudentDetail,\ + /occupationlab/occupationlab/staff/importStaff,\ + /occupationlab/occupationlab/staff/exportFailure,\ + /data/data/dataRecord/queryDatabaseInfo,\ + /data/data/multipleTablePreview,\ + /nakadai/nakadai/log/platformLogList,\ + /nakadai/nakadai/backstageStaff/importStaff,\ + /nakadai/nakadai/backstageStaff/exportFailure,\ + /nakadai/nakadai/school/querySchool,\ + /users/users/user/sendPhoneVerificationCode,\ + /users/users/user/getToken,\ + /users/users/user/getOtherAccountByPhone,\ + /users/users/user/unbindAccounts,\ + /users/users/user/isClient,\ + /nakadai/nakadai/partnerAccount/savePartnerAccount,\ + /users/users/user/weChatAppletCallbackByOperation,\ + /users/users/user/weChatAppletCallbackByPartner,\ + /users/users/user/getSessionKey,\ + /users/users/user/loginByOpenid,\ + /users/users/user/userBinding,\ + /nakadai/nakadai/partner-team/queryUserInfoByPhone,\ + /nakadai/nakadai/partnerAccount/transferAdmin,\ + /nakadai/nakadai/province/queryProvince,\ + /nakadai/nakadai/city/queryCity,\ + /competition/competition/progress/getCompetitionProgress,\ + /competition/competition/management/getCompetition,\ + /competition/competition/announcement/queryAnnouncementByContestId,\ + /competition/competition/contest/announcement/queryAnnouncementDetails,\ + /competition/competition/management/notLoggedInBeforeStudentEvents,\ + /occupationlab/occupationlab/theoreticalCourse/studentLoginPreCourse,\ + /occupationlab/occupationlab/management/edu/courseChapter/queryChaptersAndSubsections,\ + /occupationlab/occupationlab/information/column/queryAllColumns,\ + /occupationlab/occupationlab/information/article/queryArticleByCondition/1/10,\ + /occupationlab/occupationlab/information/article/getArticle,\ + /occupationlab/occupationlab/theoreticalCourseSubsection/getSubsection,\ + /occupationlab/occupationlab/theoreticalCourse/studentLoginPreCourse,\ + /occupationlab/occupationlab/theoreticalCourseChapter/queryChaptersAndSubsections,\ + /occupationlab/occupationlab/theoreticalCourseClassification/pagingQuery,\ + /occupationlab/occupationlab/theoreticalCourse/findById,\ + /occupationlab/occupationlab/theoreticalCourse/getRedisCache,\ + /occupationlab/occupationlab/architecture/checkWorkNumOrAccount,\ + /oss/manage/getPlayAuth/*,\ + /users/users/register/studentAccountApplication,\ + /nakadai/nakadai/customer/getCustomerBySchoolId,\ + /competition/competition/team/searchTeam,\ + /competition/competition/announcement/queryAnnouncementByCompetitionId,\ + /users/users/userInfo/checkPhoneOrEmailExist,\ + /nakadai/nakadai/customer/getCustomerBySchoolId,\ + /competition/competition/management/getCompetition,\ + /competition/competition/management/getCurrentTime,\ + /competition/competition/announcement/queryAnnouncementByCompetitionId,\ + /competition/competition/team/searchTeam,\ + /competition/competition/team/entryInformation,\ + /users/users/userAccount/enquireAboutSchoolStudents,\ + /users/users/user/publicConfiguration,\ + /nakadai/nakadai/partnerAccount/partnerAccountApplication,\ + /nakadai/nakadai/partnerAccount/queryPartnerAccount,\ + /occupationlab/occupationlab/data/kanban/academicLeadersRanking,\ + /occupationlab/occupationlab/data/kanban/activityRanking,\ + /occupationlab/occupationlab/data/kanban/courseRankings,\ + /occupationlab/occupationlab/data/kanban/examStatistics,\ + /occupationlab/occupationlab/data/kanban/getTheMostUsedCoursesInOurSchool,\ + /occupationlab/occupationlab/data/kanban/monthlyAverageOnlineTime,\ + /occupationlab/occupationlab/data/kanban/overviewOfOurSchoolData,\ + /occupationlab/occupationlab/data/kanban/studentAssessSchievement,\ + /occupationlab/occupationlab/data/kanban/studentGradeDistribution,\ + /nakadai/nakadai/curriculum/schoolCourse,\ + /users/users/user/platformLoginStatistics,\ + /nakadai/nakadai/curriculum/curriculumListForBeforeLogin,\ + /nakadai/mall/listOfGoods,\ + /nakadai/mall/detailsOfGoods,\ + /nakadai/websocket/*,\ + /nakadai/mall/websiteProductList,\ + /nakadai/mall/goodsSchemeClassification,\ + /nakadai/nakadai/mall/marketing/promotion/pagingQueryList,\ + /nakadai/nakadai/subject/subjectCategoryCited,\ + /nakadai/productType/productTypeList,\ + /nakadai/tags/tagsList,\ + /nakadai/nakadai/partner/schemeManagement/schemeList diff --git a/nakadai/deploy/nakadai-deploy.yaml b/nakadai/deploy/nakadai-deploy.yaml new file mode 100644 index 0000000..63e3455 --- /dev/null +++ b/nakadai/deploy/nakadai-deploy.yaml @@ -0,0 +1,66 @@ +kind: Deployment +apiVersion: apps/v1 +metadata: + name: nakadai + namespace: huoranmicro + labels: + app: nakadai + version: v1 +spec: + replicas: 1 + selector: + matchLabels: + app: nakadai + version: v1 + template: + metadata: + labels: + app: nakadai + version: v1 + spec: + containers: + - name: nakadai + image: $REGISTRY/$DOCKERHUB_NAMESPACE/$APP_NAME:$TAG_NAME + ports: + - containerPort: 8080 + protocol: TCP + resources: + limits: + cpu: 1000m + memory: 1000Mi + requests: + cpu: 100m + memory: 100Mi + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + imagePullPolicy: IfNotPresent + restartPolicy: Always + terminationGracePeriodSeconds: 30 + serviceName: nakadai + podManagementPolicy: OrderedReady + updateStrategy: + type: RollingUpdate + rollingUpdate: + partition: 0 + revisionHistoryLimit: 10 + +--- +kind: Service +apiVersion: v1 +metadata: + name: nakadai + namespace: huoranmicro + labels: + app: nakadai + version: v1 +spec: + ports: + - name: http + protocol: TCP + port: 8080 + targetPort: 8080 + nodePort: 20002 + selector: + app: nakadai + type: NodePort + sessionAffinity: None \ No newline at end of file diff --git a/nakadai/pom.xml b/nakadai/pom.xml new file mode 100644 index 0000000..a262848 --- /dev/null +++ b/nakadai/pom.xml @@ -0,0 +1,171 @@ + + + 4.0.0 + + huoran + com.huoran.parent + 1.0-SNAPSHOT + + + com.huoran + nakadai + 1.0 + nakadai + 或然中台 + + + 1.8 + UTF-8 + UTF-8 + + + + + + com.huoran.parent + websocket + 1.0-SNAPSHOT + + + + org.springframework.boot + spring-boot-starter-actuator + + + + org.springframework.boot + spring-boot-starter-amqp + + + + + com.google.zxing + javase + 3.2.0 + + + + com.huoran.common + common + 0.0.1-SNAPSHOT + + + + com.huoran.api + api + 1.0-SNAPSHOT + compile + + + + + + + + + + + org.springframework.boot + spring-boot-starter + + + + org.springframework.boot + spring-boot-starter-test + test + + + com.baomidou + mybatis-plus-generator + 3.0.5 + + + org.freemarker + freemarker + 2.3.28 + compile + + + + + com.alibaba + easyexcel + + + + org.apache.poi + poi-ooxml + + + org.apache.poi + poi + + + + cn.afterturn + easypoi-base + + + guava + com.google.guava + + + guava + com.google.guava + + + poi-ooxml-schemas + org.apache.poi + + + + + cn.afterturn + easypoi-web + + + cn.afterturn + easypoi-annotation + + + + + + nakadai-1.0.0 + + + + src/main/java + + **/*.xml + + + + src/main/resources + + + **/*.* + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + true + + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/NakadaiApplication.java b/nakadai/src/main/java/com/huoran/nakadai/NakadaiApplication.java new file mode 100644 index 0000000..b3be7f9 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/NakadaiApplication.java @@ -0,0 +1,41 @@ +package com.huoran.nakadai; + +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.amqp.rabbit.config.RabbitListenerConfigUtils; +import org.springframework.amqp.rabbit.listener.RabbitListenerEndpointRegistry; +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.ConfigurableApplicationContext; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.scheduling.annotation.EnableScheduling; + +@SpringBootApplication +@EnableDiscoveryClient +@EnableScheduling +//@EnableRabbit//开启rabbitmq +@EnableFeignClients(basePackages = "com.huoran.api") +@MapperScan(basePackages = "com.huoran.nakadai.mapper") +@ComponentScan(basePackages = {"com.huoran","com.huoran.nakadai.config.interceptor"}) +public class NakadaiApplication { + + public static void main(String[] args) { + ConfigurableApplicationContext applicationContext = SpringApplication.run(NakadaiApplication.class, args); + + Runtime.getRuntime().addShutdownHook(new Thread() { + public void run() { + try { + RabbitListenerEndpointRegistry rabbitListenerEndpointRegistry = applicationContext.getBean( + RabbitListenerConfigUtils.RABBIT_LISTENER_ENDPOINT_REGISTRY_BEAN_NAME,RabbitListenerEndpointRegistry.class); + rabbitListenerEndpointRegistry.stop(); +// log.info("kill -15 主动结束"); + Thread.sleep(20000); +// log.info("结束完毕"); + } catch (Throwable e) { + e.printStackTrace(); + } + } + }); + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/config/EnvironmentConfig.java b/nakadai/src/main/java/com/huoran/nakadai/config/EnvironmentConfig.java new file mode 100644 index 0000000..a434e9e --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/config/EnvironmentConfig.java @@ -0,0 +1,50 @@ +package com.huoran.nakadai.config; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +/** + * 此配置类用于区分正式、测试环境相关配置,如有需要配置变量等自行添加 + * + * @author Mr.JK + * @date 2021年4月23日10:27:49 + */ + +@Configuration +@ConfigurationProperties(prefix = "environment") +public class EnvironmentConfig { + + //python生成的图片储存地址 + public static String imageURL; + + //python脚本地址 + public static String pythonURL; + + //编码 + public static String coding; + + //项目图片地址 + public static String projectImgUrl; + + @Value("${environment.imageUrl}") + public void setENVIRONMENTURL(String imageURL) { + this.imageURL = imageURL; + } + + @Value("${environment.pythonURL}") + public void setPythonURL(String pythonURL) { + this.pythonURL = pythonURL; + } + + @Value("${environment.coding}") + public void setCoding(String coding) { + this.coding = coding; + } + + @Value("${environment.projectImgUrl}") + public void setProjectImgUrl(String projectImgUrl) { + EnvironmentConfig.projectImgUrl = projectImgUrl; + } +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/config/InterceptorConfig.java b/nakadai/src/main/java/com/huoran/nakadai/config/InterceptorConfig.java new file mode 100644 index 0000000..112de2b --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/config/InterceptorConfig.java @@ -0,0 +1,42 @@ +package com.huoran.nakadai.config; + +import com.huoran.nakadai.config.interceptor.UserInterceptor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.InterceptorRegistration; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +/** + * @Author chen + * @DATE 2022/6/24 11:54 + * @Version 1.0 + */ +@Configuration +public class InterceptorConfig implements WebMvcConfigurer { + + // 这个方法是用来配置静态资源的,比如html,js,css等等 + @Override + public void addResourceHandlers(ResourceHandlerRegistry registry) { + } + + // 这个方法用来注册拦截器,我们自己写好的拦截器需要通过这里添加注册才能生效 + @Override + public void addInterceptors(InterceptorRegistry registry) { + //注册拦截器 + InterceptorRegistration ir=registry.addInterceptor(new UserInterceptor()); + //配置拦截路径 + ir.addPathPatterns( + "/nakadai/partnerAccount/**", + "/nakadai/partnerClassification/**", + "/nakadai/partner-team/**", + "/nakadai/applets/**", + "/nakadai/nakadai/order/**", + "/nakadai/nakadai/orderOther/**", + "/nakadai/nakadai/customer/**");//加拦截路径才会走配置的拦截器(进行相关业务判断) + //配置不拦截路径 + // ir.excludePathPatterns("/login"); + + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/config/MyThreadConfig.java b/nakadai/src/main/java/com/huoran/nakadai/config/MyThreadConfig.java new file mode 100644 index 0000000..8f15a9d --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/config/MyThreadConfig.java @@ -0,0 +1,46 @@ +package com.huoran.nakadai.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.annotation.EnableAsync; + +import java.util.concurrent.Executors; +import java.util.concurrent.LinkedBlockingDeque; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +/** + * @Author chen + * @DATE 2021/12/28 17:48 + * @Version 1.0 + */ +@Configuration +@EnableAsync//开启异步事件的支持 +public class MyThreadConfig { + + @Bean + public ThreadPoolExecutor threadPoolExecutor(){ + return new ThreadPoolExecutor(20, + 300, + 10, + TimeUnit.SECONDS, + new LinkedBlockingDeque<>(), + Executors.defaultThreadFactory(), + new ThreadPoolExecutor.AbortPolicy()); + } + +// @Bean(name = "threadAsyncExecutor") +// public ThreadPoolTaskExecutor taskExecutor(){ +// ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor(); +// taskExecutor.setCorePoolSize(300); +// taskExecutor.setMaxPoolSize(500); +// taskExecutor.setQueueCapacity(800); +// taskExecutor.setKeepAliveSeconds(60); +// taskExecutor.setThreadNamePrefix("n-async-"); +// taskExecutor.setWaitForTasksToCompleteOnShutdown(true); +// taskExecutor.setAwaitTerminationSeconds(60); +// taskExecutor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); +// taskExecutor.initialize(); +// return taskExecutor; +// } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/config/RabbitConfig.java b/nakadai/src/main/java/com/huoran/nakadai/config/RabbitConfig.java new file mode 100644 index 0000000..873822b --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/config/RabbitConfig.java @@ -0,0 +1,73 @@ +package com.huoran.nakadai.config; + +import com.huoran.common.constant.RabbitmqConstant; +import org.springframework.amqp.core.*; +import org.springframework.amqp.rabbit.connection.ConnectionFactory; +import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer; +import org.springframework.amqp.support.ConsumerTagStrategy; +import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter; +import org.springframework.amqp.support.converter.MessageConverter; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; + +import java.util.UUID; + +/** + * 初始化消息队列,创建交换机、队列以及绑定关系 + */ +//@Configuration +public class RabbitConfig { + + @Autowired + RabbitTemplate rabbitTemplate; + +/** + * mq消息转换json格式 + * @return json*/ + @Bean + public MessageConverter messageConverter(){ + return new Jackson2JsonMessageConverter(); + } + + @Bean + public Exchange commentExchange(){ + return new DirectExchange(RabbitmqConstant.COMMENT_EXCHANGE,true,false); + } + + @Bean + public Queue commentQueue(){ + return new Queue(RabbitmqConstant.COMMENT_QUEUE,true,false,false); + } + + @Bean + public Binding commentBind(){ + return new Binding(RabbitmqConstant.COMMENT_QUEUE, + Binding.DestinationType.QUEUE, + RabbitmqConstant.COMMENT_EXCHANGE, + RabbitmqConstant.COMMENT_ROUTING_KEY,null); + } + + @Bean + public SimpleMessageListenerContainer simpleMessageListenerContainer(ConnectionFactory connectionFactory){ + SimpleMessageListenerContainer listenerContainer = new SimpleMessageListenerContainer(connectionFactory); + listenerContainer.setConcurrentConsumers(1); // 设置当前消费者为1 + listenerContainer.setMaxConcurrentConsumers(5);// 设置最大消费者5 + listenerContainer.setDefaultRequeueRejected(false);// 设置是否重回队列 + listenerContainer.setAcknowledgeMode(AcknowledgeMode.MANUAL);//设置接收方式,AUTO-自动接收,MANUAL-手动接收,NULL-不接收 + listenerContainer.setConsumerTagStrategy(new ConsumerTagStrategy() { //设置消费者标签策略 + @Override + public String createConsumerTag(String s) { + return s+"_"+ UUID.randomUUID().toString(); + } + }); + listenerContainer.setMessageListener(new MessageListener() { // 监听消息 + @Override + public void onMessage(Message message) { +/* String msg = new String(message.getBody()); + System.out.println("消息:"+msg);*/ + } + }); + return listenerContainer; + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/config/SensitiveWordInit.java b/nakadai/src/main/java/com/huoran/nakadai/config/SensitiveWordInit.java new file mode 100644 index 0000000..ebedfda --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/config/SensitiveWordInit.java @@ -0,0 +1,85 @@ +package com.huoran.nakadai.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.core.io.ClassPathResource; +import java.io.*; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +//屏蔽敏感词初始化 +@Configuration +@SuppressWarnings({ "rawtypes", "unchecked" }) +public class SensitiveWordInit { + // 字符编码 + private String ENCODING = "UTF-8"; + // 初始化敏感字库 + public Map initKeyWord() throws IOException { + // 读取敏感词库 ,存入Set中 + Set wordSet = readSensitiveWordFile(); + // 将敏感词库加入到HashMap中//确定有穷自动机DFA + return addSensitiveWordToHashMap(wordSet); + } + + // 读取敏感词库 ,存入HashMap中 + private Set readSensitiveWordFile() throws IOException { + Set wordSet = null; + ClassPathResource classPathResource = new ClassPathResource("sensitive/censorword.txt"); + InputStream inputStream = classPathResource.getInputStream(); + + //敏感词库 + try { + // 读取文件输入流 + InputStreamReader read = new InputStreamReader(inputStream, ENCODING); + // 文件是否是文件 和 是否存在 + wordSet = new HashSet(); + // StringBuffer sb = new StringBuffer(); + // BufferedReader是包装类,先把字符读到缓存里,到缓存满了,再读入内存,提高了读的效率。 + BufferedReader br = new BufferedReader(read); + String txt = null; + // 读取文件,将文件内容放入到set中 + while ((txt = br.readLine()) != null) { + wordSet.add(txt); + } + br.close(); + // 关闭文件流 + read.close(); + } catch (Exception e) { + e.printStackTrace(); + } + return wordSet; + } + // 将HashSet中的敏感词,存入HashMap中 + private Map addSensitiveWordToHashMap(Set wordSet) { + // 初始化敏感词容器,减少扩容操作 + Map wordMap = new HashMap(wordSet.size()); + for (String word : wordSet) { + Map nowMap = wordMap; + for (int i = 0; i < word.length(); i++) { + // 转换成char型 + char keyChar = word.charAt(i); + // 获取 + Object tempMap = nowMap.get(keyChar); + // 如果存在该key,直接赋值 + if (tempMap != null) { + nowMap = (Map) tempMap; + } + // 不存在则,则构建一个map,同时将isEnd设置为0,因为他不是最后一个 + else { + // 设置标志位 + Map newMap = new HashMap(); + newMap.put("isEnd", "0"); + // 添加到集合 + nowMap.put(keyChar, newMap); + nowMap = newMap; + } + // 最后一个 + if (i == word.length() - 1) { + nowMap.put("isEnd", "1"); + } + } + } + return wordMap; + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/config/SwaggerConfig.java b/nakadai/src/main/java/com/huoran/nakadai/config/SwaggerConfig.java new file mode 100644 index 0000000..3ae20c0 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/config/SwaggerConfig.java @@ -0,0 +1,66 @@ +package com.huoran.nakadai.config; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.ParameterBuilder; +import springfox.documentation.builders.PathSelectors; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.schema.ModelRef; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.service.Parameter; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger.web.DocExpansion; +import springfox.documentation.swagger.web.OperationsSorter; +import springfox.documentation.swagger.web.UiConfiguration; +import springfox.documentation.swagger.web.UiConfigurationBuilder; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +import java.util.ArrayList; +import java.util.List; + +@Configuration +@EnableSwagger2 +@Profile({"dev","test"}) +public class SwaggerConfig { + + @Bean + public Docket createRestApi() { + // 构造token给测试的时候填写 + ParameterBuilder tokenPar = new ParameterBuilder(); + List pars = new ArrayList(); + tokenPar.name("token").description("用户令牌(不需用户鉴权的不需要传)").modelRef(new ModelRef("string")).parameterType("header") + .required(false).build(); + pars.add(tokenPar.build()); + + return new Docket(DocumentationType.SWAGGER_2) + .apiInfo(apiInfo()) + .select() + .apis(RequestHandlerSelectors.basePackage("com.huoran.nakadai.controller")) + .apis(RequestHandlerSelectors.withClassAnnotation(Api.class)) + .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) + .paths(PathSelectors.any()) + .build().globalOperationParameters(pars); + } + + + + @Bean + UiConfiguration uiConfig() { + return UiConfigurationBuilder.builder().docExpansion(DocExpansion.LIST).operationsSorter(OperationsSorter.ALPHA).build(); + } + + private ApiInfo apiInfo() { + return new ApiInfoBuilder() + .title("中台微服务接口文档") + .description("Rong") + .contact("developer@mail.com") + .version("1.0") + .build(); + } + +} \ No newline at end of file diff --git a/nakadai/src/main/java/com/huoran/nakadai/config/filter/SensitiveFilter.java b/nakadai/src/main/java/com/huoran/nakadai/config/filter/SensitiveFilter.java new file mode 100644 index 0000000..bf86bb7 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/config/filter/SensitiveFilter.java @@ -0,0 +1,147 @@ +package com.huoran.nakadai.config.filter; + +import com.huoran.nakadai.config.SensitiveWordInit; + +import java.io.IOException; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; + +//敏感词过滤器:利用DFA算法 进行敏感词过滤 +public class SensitiveFilter { + //敏感词过滤器:利用DFA算法 进行敏感词过滤 + private Map sensitiveWordMap = null; + + // 最小匹配规则 + public static int minMatchType = 1; + + // 最大匹配规则 + public static int maxMatchType = 2; + + // 单例 + private static SensitiveFilter instance = null; + + // 构造函数,初始化敏感词库 + private SensitiveFilter() throws IOException { + sensitiveWordMap = new SensitiveWordInit().initKeyWord(); + } + + // 获取单例 + public static SensitiveFilter getInstance() throws IOException { + if (null == instance) { + instance = new SensitiveFilter(); + } + return instance; + } + + // 获取文字中的敏感词 + public Set getSensitiveWord(String txt, int matchType) { + Set sensitiveWordList = new HashSet(); + for (int i = 0; i < txt.length(); i++) { + // 判断是否包含敏感字符 + int length = CheckSensitiveWord(txt, i, matchType); + // 存在,加入list中 + if (length > 0) { + sensitiveWordList.add(txt.substring(i, i + length)); + // 减1的原因,是因为for会自增 + i = i + length - 1; + } + } + return sensitiveWordList; + } + // 替换敏感字字符 + public String replaceSensitiveWord(String txt, int matchType, + String replaceChar) { + String resultTxt = txt; + // 获取所有的敏感词 + Set set = getSensitiveWord(txt, matchType); + Iterator iterator = set.iterator(); + String word = null; + String replaceString = null; + while (iterator.hasNext()) { + word = iterator.next(); + replaceString = getReplaceChars(replaceChar, word.length()); + resultTxt = resultTxt.replaceAll(word, replaceString); + } + return resultTxt; + } + + /** + * 获取替换字符串 + * + * @param replaceChar + * @param length + * @return + */ + private String getReplaceChars(String replaceChar, int length) { + String resultReplace = replaceChar; + for (int i = 1; i < length; i++) { + resultReplace += replaceChar; + } + return resultReplace; + } + + /** + * 检查文字中是否包含敏感字符,检查规则如下:
+ * 如果存在,则返回敏感词字符的长度,不存在返回0 + * @param txt + * @param beginIndex + * @param matchType + * @return + */ + public int CheckSensitiveWord(String txt, int beginIndex, int matchType) { + // 敏感词结束标识位:用于敏感词只有1位的情况 + boolean flag = false; + // 匹配标识数默认为0 + int matchFlag = 0; + Map nowMap = sensitiveWordMap; + for (int i = beginIndex; i < txt.length(); i++) { + char word = txt.charAt(i); + // 获取指定key + nowMap = (Map) nowMap.get(word); + // 存在,则判断是否为最后一个 + if (nowMap != null) { + // 找到相应key,匹配标识+1 + matchFlag++; + // 如果为最后一个匹配规则,结束循环,返回匹配标识数 + if ("1".equals(nowMap.get("isEnd"))) { + // 结束标志位为true + flag = true; + // 最小规则,直接返回,最大规则还需继续查找 + if (SensitiveFilter.minMatchType == matchType) { + break; + } + } + } + // 不存在,直接返回 + else { + break; + } + } + + if (SensitiveFilter.maxMatchType == matchType){ + if(matchFlag < 2 || !flag){ //长度必须大于等于1,为词 + matchFlag = 0; + } + } + if (SensitiveFilter.minMatchType == matchType){ + if(matchFlag < 2 && !flag){ //长度必须大于等于1,为词 + matchFlag = 0; + } + } + return matchFlag; + } + + public static void main(String[] args) throws IOException { + SensitiveFilter filter = SensitiveFilter.getInstance(); + String txt = "词语,支持 台湾今天太年轻,卫星,学生,不查全部"; + //如果需要过滤则用“”替换 + //如果需要屏蔽,则用“*”替换 + String hou = filter.replaceSensitiveWord(txt, 2, "*"); + System.out.println("替换前的文字为:" + txt); + System.out.println("替换后的文字为:" + hou); + + + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/config/interceptor/UserInterceptor.java b/nakadai/src/main/java/com/huoran/nakadai/config/interceptor/UserInterceptor.java new file mode 100644 index 0000000..4f67586 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/config/interceptor/UserInterceptor.java @@ -0,0 +1,78 @@ +package com.huoran.nakadai.config.interceptor; + +import com.huoran.common.exception.CustomException; +import com.huoran.common.exception.ExceptionEnum; +import com.huoran.common.utils.JwtUtils; +import com.huoran.common.utils.TokenUtils; +import com.huoran.nakadai.mapper.PartnerTeamMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.web.servlet.HandlerInterceptor; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * @Author chen + * @DATE 2022/6/24 11:50 + * @Version 1.0 + * 用户信息拦截器 + */ +@Component +public class UserInterceptor implements HandlerInterceptor { + + @Autowired + private PartnerTeamMapper partnerTeamMapper; + + /** + * 进入controller方法之前 + * @param request + * @param response + * @param handler + * @return + * @throws Exception + */ + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { + /*String id = TokenUtils.getIdByJwtToken(request); + String platform = partnerTeamMapper.selectPlatform(id); + System.out.println("拦截器进行拦截============="+platform); + if (platform==null){ + throw new CustomException(ExceptionEnum.USER_NOT_EXIST); + } + //是否是合伙人平台,进行验证 + if ("4".equals(platform)){ + //合伙人操作查询是否有团队 + Integer exist = partnerTeamMapper.selectTeam(id); + return exist > 0; + }*/ + return true; + } + + /** + * 方法内部处理完成,页面渲染之前 + * @param request + * @param response + * @param handler + * @param modelAndView + * @throws Exception + */ + @Override + public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { + + } + + /** + * 页面渲染之后 + * @param request + * @param response + * @param handler + * @param ex + * @throws Exception + */ + @Override + public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { + + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/AppletsCustomerController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/AppletsCustomerController.java new file mode 100644 index 0000000..7173acb --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/AppletsCustomerController.java @@ -0,0 +1,132 @@ + package com.huoran.nakadai.controller; + + import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; + import com.huoran.common.constant.DelConstant; + import com.huoran.common.exception.ExceptionEnum; + import com.huoran.common.response.R; + import com.huoran.common.utils.PageUtils; + import com.huoran.common.utils.TokenUtils; + import com.huoran.nakadai.entity.*; + import com.huoran.nakadai.entity.req.CustomerListReq; + import com.huoran.nakadai.entity.req.CustomerReq; + import com.huoran.nakadai.entity.req.ListOfClientCommercialManagersReq; + import com.huoran.nakadai.entity.res.*; + import com.huoran.nakadai.mapper.CustomerMapper; + import com.huoran.nakadai.mapper.HrStaffMapper; + import com.huoran.nakadai.service.*; + 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 javax.servlet.http.HttpServletRequest; + import javax.validation.Valid; + import java.util.ArrayList; + import java.util.List; + import java.util.UUID; + import java.util.concurrent.ExecutionException; + + + @Api(value = "小程序-客户管理", tags = "小程序-客户管理") + @RestController + @RequestMapping("/nakadai/applets/customer") + public class AppletsCustomerController { + + @Autowired + private ICustomerService iCustomerService; + + @Autowired + private PartnerAccountService partnerAccountService; + + + @Autowired + private PartnerTeamService partnerTeamService; + + + @Autowired + private PartnerClassificationService partnerClassificationService; + + + + @ApiOperation(value = "我的客户/团队全部客户",response = AppletsMyClientsForBusinessResp.class) + @PostMapping("/customerList") + public R allClientsOfTheTeam(@RequestBody ListOfClientCommercialManagersReq req) { + return iCustomerService.getCustomerListBasedOnBusinessManagerId(req); + } + + + + + + /* @ApiOperation(value = "根据商务经理id获取客户列表", notes = "根据商务经理id获取客户列表",response = AppletsMyClientsForBusinessResp.class) + @PostMapping("/getCustomerListBasedOnBusinessManagerId") + public R getCustomerListBasedOnBusinessManagerId(@RequestBody ListOfClientCommercialManagersReq req) { + return iCustomerService.getCustomerListBasedOnBusinessManagerId(req); + } + + + @ApiOperation(value = "团队全部客户", notes = "团队全部客户所需参数:(businessManagerIds、keywords、customerType及分页参数)",response = AppletsMyClientsForBusinessResp.class) + @PostMapping("/allClientsOfTheTeam") + public R allClientsOfTheTeam(@RequestBody ListOfClientCommercialManagersReq req) { + //根据团队id获取团队下所有成员的商务经理id + List getMembersUnderTheSameTeam = partnerTeamService.getMembersUnderTheSameTeam(req.getClassificationId()); + req.setBusinessManagerIds(getMembersUnderTheSameTeam); + + return iCustomerService.getCustomerListBasedOnBusinessManagerId(req); + }*/ + + + @ApiOperation(value = "根据token获取当前用户的团队信息", notes = "根据token获取当前用户的团队信息",response = PartnerAccountResp.class) + @PostMapping("/getTeamsByAccountId") + public R getTeamsByAccountId(HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + if (accountId.equals("")){ + return R.error("Token不存在"); + } + return partnerAccountService.getTeamsByAccountId(Integer.valueOf(accountId)); + } + + /*@ApiOperation("依据团队id查询团队下的全部商务经理(集合)") + @PostMapping("/getTheBusinessManagerIdsUnderTheTeam") + public List selectCategoryChildById(Integer id) { + List businessManagerIds = new ArrayList<>(); + //1 创建list集合,用于封装所有删除菜单id值 + List idList = new ArrayList<>(); + //2 向idList集合设置删除菜单id + this.selectCategoryChildById(id + "", idList);//找到当前菜单的子菜单 把结果id封装到idlist里面去 + //把当前id封装到list里面 + idList.add(id);//现在把当前id封装进去 之前都是子菜单的id + String str = ""; + for (Integer idstr : idList) { + str += idstr + ","; + } + + if (!str.equals("")){ + //依据团队id查询商务经理id(集合) + businessManagerIds = partnerClassificationService.queryBusinessManagerIdBasedOnTeamId(str.substring(0,str.length()-1)); + } + return businessManagerIds; + } + + //2 根据当前菜单id,查询菜单里面子菜单id,封装到list集合 + public void selectCategoryChildById(String id, List idList) { + //查询菜单里面子菜单id + QueryWrapper wrapper = new QueryWrapper(); + wrapper.eq("parent_id", id); + wrapper.eq("is_del", 0); + wrapper.eq("is_team", 0); + wrapper.select("id");//我们只想查询id 所以只需要查询指定列的值 + List childIdList = partnerClassificationService.list(wrapper);//当前菜单的所有子菜单 + //把childIdList里面菜单id值获取出来,封装idList里面,做递归查询 + childIdList.stream().forEach(item -> {//遍历集合得到每一个对象item + //封装idList里面 + idList.add(item.getId()); + //递归查询 + this.selectCategoryChildById(item.getId() + "", idList); + }); + }*/ + + + + } diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/AppletsOrderController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/AppletsOrderController.java new file mode 100644 index 0000000..4c556f8 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/AppletsOrderController.java @@ -0,0 +1,56 @@ +package com.huoran.nakadai.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.Order; +import com.huoran.nakadai.entity.req.DeleteIds; +import com.huoran.nakadai.entity.req.ListOfClientCommercialManagersReq; +import com.huoran.nakadai.entity.req.OrderListReq; +import com.huoran.nakadai.entity.req.OrderRecordParametersReq; +import com.huoran.nakadai.entity.res.AppletsMyClientsForBusinessResp; +import com.huoran.nakadai.entity.res.ExportSubscribedRecordsResp; +import com.huoran.nakadai.entity.vo.OrderVo; +import com.huoran.nakadai.service.IOrderService; +import com.huoran.nakadai.service.PartnerTeamService; +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 javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import java.util.HashMap; +import java.util.List; +import java.util.concurrent.ExecutionException; + + +@Api(value = "小程序-订单", tags = "小程序-订单") +@RestController +@RequestMapping("/nakadai/applets/order") +public class AppletsOrderController { + + @Autowired + private IOrderService orderService; + + @Autowired + private PartnerTeamService partnerTeamService; + + + @ApiOperation(value = "我的订单/团队订单",response = Order.class) + @PostMapping("/orderList") + public R allTeamOrders(@RequestBody ListOfClientCommercialManagersReq req) { + return orderService.getOrderBasedOnBusinessManagerId(req); + } + + + @ApiOperation(value = "小程序订单记录",response = Order.class) + @PostMapping("/miniProgramOrderRecord") + public R miniProgramOrderRecord(@RequestBody OrderRecordParametersReq req) { + return orderService.miniProgramOrderRecord(req); + } + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/AppletsPartnerController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/AppletsPartnerController.java new file mode 100644 index 0000000..7e89bbb --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/AppletsPartnerController.java @@ -0,0 +1,118 @@ +package com.huoran.nakadai.controller; + +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.nakadai.entity.PartnerArticleFile; +import com.huoran.nakadai.entity.PartnerArticleManagement; +import com.huoran.nakadai.entity.PartnerArticleStatistic; +import com.huoran.nakadai.entity.req.SalesProgressReq; +import com.huoran.nakadai.entity.res.AnnualOperatingAnalysisResp; +import com.huoran.nakadai.service.*; +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.data.redis.core.StringRedisTemplate; +import org.springframework.data.redis.core.ValueOperations; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; + + +@Api(value = "小程序-合伙人", tags = "小程序-合伙人") +@RestController +@RequestMapping("/nakadai/applets/partner") +public class AppletsPartnerController { + + @Autowired + private ICustomerService iCustomerService; + + @Autowired + private PartnerAccountService partnerAccountService; + + + @Autowired + private PartnerTeamService partnerTeamService; + + @Autowired + public PartnerArticleManagementService articleManagementService; + @Autowired + public PartnerArticleFileService fileService; + + @Autowired + public PartnerArticleLabelService labelService; + + + @Autowired + public PartnerArticleStatisticService articleStatisticService; + + @Autowired + public PartnerArticleClassificationService articleClassificationService; + + @Autowired + private StringRedisTemplate redisTemplate; + @Autowired + private PartnerClassificationService partnerClassificationService; + + @ApiOperation(value = "销售进展") + @PostMapping("/salesProgress") + public R salesProgress(@RequestBody SalesProgressReq req) { + + //customerType 客户类型(1、正式 2、试用 3、到期 + req.setCustomerType(2); + //试用产品 + Integer trialProduct = iCustomerService.newProductAddedToOrder(req); + //试用用户 + Integer trialUser = iCustomerService.newCustomerOnOrder(req); + req.setCustomerType(1); + //正式用户 + Integer regularUser = iCustomerService.newCustomerOnOrder(req); + //正式产品 + Integer officialProduct = iCustomerService.newProductAddedToOrder(req); + + return R.ok().put("trialUser", trialUser). + put("regularUser", regularUser). + put("trialProduct", trialProduct). + put("officialProduct", officialProduct); + } + + + @ApiOperation(value = "预览学习(增加浏览次数)") + @PostMapping("/browse") + public R browse(@ApiParam(name = "contentId", value = "文章id", required = true) @RequestParam Integer contentId, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + List fileList = fileService.getFileByContentId(contentId); + PartnerArticleManagement partnerArticleManagement = articleManagementService.getById(contentId); + partnerArticleManagement.setFileList(fileList); + partnerArticleManagement.setClassificationNameList(articleClassificationService.categoryIdsQueriesCategoryInformation(partnerArticleManagement.getClassificationId() + "")); + partnerArticleManagement.setLabelNameList((labelService.idsQueriesLabelInformation(partnerArticleManagement.getLableId() + ""))); + partnerArticleManagement.setTotalBrowsing(articleStatisticService.statisticsOfVisitors(contentId)); + + //存浏览的文章 用于返回上次浏览的文章 + ValueOperations opsForString = redisTemplate.opsForValue(); + String key = "browse:accountId=" + accountId; + //将数据存入缓存 + opsForString.set(key, contentId + ""); + + //增加浏览记录 + PartnerArticleStatistic statistic = new PartnerArticleStatistic(); + statistic.setAccountId(Integer.valueOf(accountId)); + statistic.setContentId(contentId); + //判断是否存在浏览记录过 返回true表示可新增 需求:已学习人数即一个用户点多次只算一次,不重复计算 + boolean flag = articleStatisticService.checkForExistence(statistic); + if (flag) { + articleStatisticService.save(statistic); + } + return R.ok(partnerArticleManagement); + } + + + @ApiOperation(value = "年度经营分析", response = AnnualOperatingAnalysisResp.class) + @PostMapping("/annualOperatingAnalysis") + public R annualOperatingAnalysis(@RequestBody SalesProgressReq req, HttpServletRequest request) { + String jwtToken = request.getHeader("token"); + System.out.println("token:{}{}{}{}{}"+jwtToken); + return R.ok().put("data", iCustomerService.annualOperatingAnalysis(req)); + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/CityController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/CityController.java new file mode 100644 index 0000000..d1b434a --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/CityController.java @@ -0,0 +1,44 @@ +package com.huoran.nakadai.controller; + + +import com.huoran.common.response.R; +import com.huoran.common.utils.PageUtils; +import com.huoran.nakadai.entity.City; +import com.huoran.nakadai.entity.req.CustomerListReq; +import com.huoran.nakadai.service.ICityService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import org.springframework.stereotype.Controller; + +import java.util.List; + +/** + *

+ * 城市 前端控制器 + *

+ * + * @author huoran + * @since 2021-06-29 + */ +@Api(value = "城市管理", tags = "城市管理") +@RestController +@RequestMapping("/nakadai/city") +public class CityController { + + @Autowired + private ICityService iCityService; + + /** + * 根据省份查询城市信息 + * @return + */ + @ApiOperation(value = "根据省份查询城市信息",notes = "根据省份查询城市信息") + @GetMapping("/queryCity") + public R queryCity(@RequestParam Integer provinceId) { + List list = iCityService.queryCityList(provinceId); + return R.ok(list); + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/CommentController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/CommentController.java new file mode 100644 index 0000000..362c5c0 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/CommentController.java @@ -0,0 +1,122 @@ +package com.huoran.nakadai.controller; + + +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.api.UserClient; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.nakadai.config.filter.SensitiveFilter; +import com.huoran.nakadai.entity.Comment; +import com.huoran.nakadai.entity.Notify; +import com.huoran.nakadai.entity.res.CommentRes; +import com.huoran.nakadai.service.CommentService; +import com.huoran.nakadai.service.NotifyService; +import com.huoran.websocket.model.dto.WebsocketMsgDTO; +import com.huoran.websocket.service.WebsocketService; +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 javax.servlet.http.HttpServletRequest; +import java.io.IOException; + +/** + *

+ * 课程评论回复表 前端控制器 + *

+ * + * @author chen + * @since 2023-05-25 + */ +@Api(value = "C-课程评论回复管理", tags = "C-课程评论回复管理") +@RestController +@RequestMapping("/comment") +public class CommentController { + + @Autowired + private CommentService commentService; + + @Autowired + private NotifyService notifyService; + + @Autowired + private WebsocketService webSocketService; + + @Autowired + private UserClient userClient; + + @ApiOperation(value = "课程评论树列表", response = CommentRes.class) + @GetMapping("/commentTreeList") + public R commentTreeList( + @ApiParam(name = "mallId", value = "商品id", required = true) + @RequestParam Integer mallId, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + return commentService.commentTreeList(mallId,schoolId,accountId); + } + + @ApiOperation(value = "添加课程评论") + @PostMapping("/addComment") + public R addComment( + @ApiParam(name = "comment", value = "评论内容", required = true) + @RequestBody Comment comment, HttpServletRequest request) throws IOException { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + comment.setSchoolId(schoolId); + comment.setCreateAccountId(Integer.valueOf(accountId)); + SensitiveFilter filter = SensitiveFilter.getInstance(); + //需要过滤则用“”替换,如果需要屏蔽,则用“*”替换 + String content = filter.replaceSensitiveWord(comment.getContent(), 2, "*"); + comment.setContent(content); + boolean save = commentService.save(comment); + + if (save && comment.getReplyAccountId()!=null && !comment.getReplyAccountId().equals(Integer.valueOf(accountId))){ + //添加回复通知 + if (comment.getStatus()==2){ + //同一条评论消息未读,再次评论不通知 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("is_read",0); + wrapper.eq("comment_id",comment.getReplyCommentId()); + wrapper.eq("account_id",comment.getReplyAccountId()); + wrapper.eq("comment_account_id",Integer.valueOf(accountId)); + Notify one = notifyService.getOne(wrapper); + if (ObjectUtil.isNull(one)){ + Notify notify = new Notify(); + notify.setType(2); + notify.setAccountId(comment.getReplyAccountId()); + notify.setCommentId(comment.getReplyCommentId()); + notify.setCommentAccountId(Integer.valueOf(accountId)); + notifyService.save(notify); + } + } + } + + // 发送webSocket消息 + if (comment.getReplyAccountId()!=null){ + WebsocketMsgDTO websocketMsgDTO = new WebsocketMsgDTO(); + websocketMsgDTO.setForm(accountId); + websocketMsgDTO.setUsername(accountId); + websocketMsgDTO.setTo(comment.getReplyAccountId().toString()); + websocketMsgDTO.setContent(comment.getContent()); + websocketMsgDTO.setExtras(null); + webSocketService.send(websocketMsgDTO); + } + + return save ? R.ok() : R.error(); + } + + + @ApiOperation(value = "删除评论") + @PostMapping("/deleteAComment") + public R deleteAComment( + @ApiParam(name = "commentId", value = "评论id", required = true) + @RequestParam Integer commentId) { + return commentService.removeChildById(commentId); + } + + +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/CommentLikeController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/CommentLikeController.java new file mode 100644 index 0000000..4482491 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/CommentLikeController.java @@ -0,0 +1,87 @@ +package com.huoran.nakadai.controller; + + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.nakadai.entity.Comment; +import com.huoran.nakadai.entity.CommentLike; +import com.huoran.nakadai.entity.Notify; +import com.huoran.nakadai.service.CommentLikeService; +import com.huoran.nakadai.service.CommentService; +import com.huoran.nakadai.service.NotifyService; +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.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletRequest; + +/** + *

+ * 课程评论点赞表 前端控制器 + *

+ * + * @author chen + * @since 2023-05-25 + */ +@Api(value = "C-课程评论点赞管理", tags = "C-课程评论点赞管理") +@RestController +@RequestMapping("/commentLike") +public class CommentLikeController { + + @Autowired + private CommentLikeService commentLikeService; + + @Autowired + private CommentService commentService; + + @Autowired + private NotifyService notifyService; + + @ApiOperation(value = "评论点赞") + @PostMapping("/commentAndLike") + public R commentAndLike( + @ApiParam(name = "commentId", value = "评论id", required = true) + @RequestParam Integer commentId, HttpServletRequest request) { + CommentLike commentLike = new CommentLike(); + commentLike.setCommentId(commentId); + String accountId = TokenUtils.getIdByJwtToken(request); + commentLike.setAccountId(Integer.valueOf(accountId)); + boolean save = commentLikeService.save(commentLike); + + if (save){ + Comment comment = commentService.getById(commentId); + //添加点赞通知 + Notify notify = new Notify(); + notify.setType(1); + notify.setAccountId(comment.getCreateAccountId()); + notify.setCommentId(comment.getCommentId()); + notify.setCommentAccountId(Integer.valueOf(accountId)); + notifyService.save(notify); + + } + return save ? R.ok() : R.error(); + } + + @ApiOperation(value = "取消点赞") + @PostMapping("/unlike") + public R unlike( + @ApiParam(name = "commentId", value = "评论id", required = true) + @RequestParam Integer commentId, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + boolean remove = commentLikeService.remove(new QueryWrapper().eq("comment_id", commentId). + eq("account_id", accountId)); + + //删除点赞通知 + notifyService.remove(new QueryWrapper().eq("comment_id", commentId). + eq("comment_account_id", accountId)); + return remove ? R.ok() : R.error(); + } + +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/CurriculumChapterController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/CurriculumChapterController.java new file mode 100644 index 0000000..88310c8 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/CurriculumChapterController.java @@ -0,0 +1,84 @@ +package com.huoran.nakadai.controller; + + +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.CurriculumChapter; +import com.huoran.nakadai.entity.vo.ChapterVO; +import com.huoran.nakadai.entity.vo.SortVO; +import com.huoran.nakadai.service.CurriculumChapterService; +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.Date; +import java.util.List; + +/** + *

+ * 企业课程章节表 前端控制器 + *

+ * + * @author lr + * @since 2021-09-26 + */ +@Api(description = "课程章节管理", tags = "课程章节管理") +@RestController +@RequestMapping("/nakadai/curriculum/chapter") +public class CurriculumChapterController { + @Autowired + private CurriculumChapterService curriculumChapterService; + + @ApiOperation(value = "根据课程id查询章节小节,树状结构") + @GetMapping("/queryChaptersAndSubsections/{courseId}") + public R queryChaptersAndSubsections( + @ApiParam(name = "courseId", value = "课程ID", required = true) + @PathVariable String courseId) { + List chapterList = curriculumChapterService.getChapterTree(courseId); + return R.ok().put("chapterList", chapterList); + } + + @ApiOperation(value = "编辑排序") + @PostMapping("/reorder") + public R chapterReorder( + @ApiParam(name = "sortVO", value = "章节小节重排序对象", required = true) + @RequestBody SortVO sortVO) { + boolean update = curriculumChapterService.updateSort(sortVO); + return update ? R.ok() : R.error(); + + } + + @ApiOperation(value = "添加章节") + @PostMapping("/addChapter") + public R addChapter( + @ApiParam(name = "courseChapter", value = "章节对象", required = true) + @RequestBody CurriculumChapter chapter) { + //判重 + boolean isRepeat = curriculumChapterService.repeat(chapter); + if (isRepeat) { + return R.error("章节已存在"); + } + boolean save = curriculumChapterService.saveChapter(chapter); + return save ? R.ok() : R.error(); + } + + @ApiOperation(value = "修改章节") + @PutMapping("/editChapter") + public R editChapter( + @ApiParam(name = "courseChapter", value = "章节对象", required = true) + @RequestBody CurriculumChapter chapter) { + boolean update = curriculumChapterService.updateById(chapter); + return update ? R.ok() : R.error(); + } + + @ApiOperation(value = "根据id删除章节") + @DeleteMapping("/deleteChapter/{chapterId}") + public R deleteChapter( + @ApiParam(name = "chapterId", value = "章节ID", required = true) + @PathVariable Integer chapterId) { + boolean remove = curriculumChapterService.removeChapter(chapterId); + return remove ? R.ok() : R.error(); + } +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/CurriculumController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/CurriculumController.java new file mode 100644 index 0000000..9679720 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/CurriculumController.java @@ -0,0 +1,246 @@ +package com.huoran.nakadai.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.api.UserClient; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.nakadai.entity.Curriculum; +import com.huoran.nakadai.entity.CurriculumConfigure; +import com.huoran.nakadai.entity.CurriculumRecentUse; +import com.huoran.nakadai.entity.req.AddCurriculumReq; +import com.huoran.nakadai.entity.req.ModifyCurriculumReq; +import com.huoran.nakadai.entity.req.PageCurriculumRecentUseReq; +import com.huoran.nakadai.entity.req.PageCurriculumReq; +import com.huoran.nakadai.service.CurriculumRecentUseService; +import com.huoran.nakadai.service.ICurriculumConfigureService; +import com.huoran.nakadai.service.ICurriculumService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.apache.ibatis.annotations.Param; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import java.util.Date; +import java.util.List; + +/** + * @描述:课程管理控制类 + * @作者: Rong + * @日期: 2021-09-16 + */ +@RestController +@RequestMapping("/nakadai/curriculum") +@Api(value = "API - 课程管理", tags = "课程管理") +public class CurriculumController { + + @Autowired + public ICurriculumService service; + + @Autowired + public ICurriculumConfigureService configureService; + + @Autowired + private UserClient userClient; + + @Autowired + private CurriculumRecentUseService restoreUseService; + + /** + * @Description: 创建课程 + * @auther: Rong + * @date: 2021/9/17 10:42 + */ + @PostMapping("/createCurriculum") + @ApiOperation(value = "创建课程", response = Curriculum.class) + public R createCurriculum(@RequestBody @Valid AddCurriculumReq curriculum, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + curriculum.setAccountId(Integer.valueOf(accountId)); + curriculum.setSchoolId(schoolId); + return service.createCurriculum(curriculum); + } + + /** + * @Description: 编辑课程 + * @auther: Rong + * @date: 2021/9/22 14:54 + */ + @PostMapping("/modifyCourse") + @ApiOperation(value = "编辑课程", response = Curriculum.class) + public R modifyCourse(@RequestBody @Valid ModifyCurriculumReq curriculum, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + curriculum.setAccountId(Integer.valueOf(accountId)); + return service.modifyCourse(curriculum); + } + + + @PostMapping("/isDisable") + @ApiOperation(value = "禁启用课程", response = Curriculum.class) + public R isDisable(@RequestParam @Param(value = "课程id") Integer cid, @RequestParam @Param(value = "是否启用(0启用,1未启用)") Integer isEnable, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + boolean ret = service.updateById(new Curriculum().setIsEnable(isEnable).setCid(cid)); + return ret ? R.ok() : R.error(); + } + + @PostMapping("/isShelves") + @ApiOperation(value = "上下架课程", response = Curriculum.class) + public R isShelves(@RequestParam @Param(value = "课程id") Integer cid, @RequestParam @Param(value = "上下架(0下架 1上架 默认 1)") Integer isShelves, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + boolean ret = service.updateById(new Curriculum().setIsShelves(isShelves).setCid(cid)); + return ret ? R.ok() : R.error(); + } + + /** + * @Description: 删除课程 + * @auther: Rong + * @date: 2021/9/22 14:54 + */ + @PostMapping("/delCourse") + @ApiOperation(value = "单个、批量删除课程", response = Curriculum.class) + public R delCourse(@RequestParam List cids, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + return service.delCourse(cids); + } + + @PostMapping("/deleteCoursePrompt") + @ApiOperation(value = "删除课程提示", response = Curriculum.class) + public R deleteCoursePrompt(@RequestParam List cids) { + return service.deleteCoursePrompt(cids); + } + + @PostMapping("/curriculumList") + @ApiOperation(value = "课程列表", response = Curriculum.class) + public R createCourse(@RequestBody @Valid PageCurriculumReq req, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + req.setAccountId(Integer.valueOf(accountId)); + req.setSchoolId(schoolId); + return service.curriculumList(req); + } + + + @PostMapping("/curriculumListForBeforeLogin") + @ApiOperation(value = "课程列表", response = Curriculum.class) + public R curriculumListForBeforeLogin(@RequestBody @Valid PageCurriculumReq req) { + return service.curriculumList(req); + } + + @GetMapping("/schoolCourse") + @ApiOperation(value = "获取学校购买订单后的课程", response = Curriculum.class) + public R schoolCourse(HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + return service.schoolCourse(schoolId); + } + + + @GetMapping("/getSchoolEffectiveCourse") + @ApiOperation(value = "获取学校有效期内购买订单后的课程(变更后为产品)", response = Curriculum.class) + public R getSchoolEffectiveCourse(HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + return service.getSchoolEffectiveCourse(schoolId); + } + + @GetMapping("/schoolCourseByAchievement") + @ApiOperation(value = "仅用于教师端成绩管理及学生端实验记录下拉框-获取学校购买订单后的课程", response = Curriculum.class) + public R schoolCourseByAchievement(HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + return service.schoolCourseByAchievement(schoolId); + } + + /** + * + * @param request + * @param mallId + * @return + */ + @GetMapping("/whetherToRenewTheFee") + @ApiOperation(value = "根据商品id查询是否要续费(原:根据课程id查询是否要续费)", response = Curriculum.class) + public R whetherToRenewTheFee(HttpServletRequest request, @RequestParam @Param(value = "商品id(mallId)") Integer mallId) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + return service.whetherToRenewTheFee(schoolId, mallId); + } + + @GetMapping("/projectListByCourseId") + @ApiOperation(value = "根据课程id获取实训项目列表", response = Curriculum.class) + public R projectListByCourseId(@RequestParam @Param(value = "课程id(cid)") Integer cid, + @RequestParam @Param(value = "项目权限(0、练习 1、考核)") Integer permissions, + @RequestParam(required = false) @Param(value = "项目名称") String projectName, + HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + return configureService.projectListByCourseId(cid, permissions, projectName); + } + + @PostMapping("/curriculumDetail") + @ApiOperation(value = "课程详情", response = Curriculum.class) + public R curriculumDetail(@RequestParam @Param(value = "课程id(cid)") Integer cid, + @RequestParam(required = false) Integer mallId, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + + return service.curriculumDetail(cid, mallId); + } + + @GetMapping("/getSystemIdByCustomerId") + @ApiOperation("得到客户所有的系统id openfeign") + public List getSystemIdByCustomerId(@RequestParam Integer customerId) { + return service.getSystemIdByCustomerId(customerId); + } + + @GetMapping("/getSchoolCourse") + @ApiOperation(value = "获取学校购买订单下的产品所绑定的课程(该接口为远程调用接口)", response = Curriculum.class) + public String getSchoolCourse(@RequestParam @Param(value = "schoolId") Integer schoolId) { + return service.getSchoolCourse(schoolId); + } + + @GetMapping("/checkConfig") + @ApiOperation(value = "校验某个项目是否包含在课程配置中", response = CurriculumConfigure.class) + public R checkConfig(@RequestParam @Param(value = "projectId") Integer projectId) { + return configureService.checkConfig(projectId); + } + + + @PostMapping("/recordRecentUsage") + @ApiOperation(value = "记录最近使用", response = CurriculumRecentUse.class) + public R recordRecentUsage(@RequestParam("mallId") @ApiParam(value = "商品id", required = true) @NotNull(message = "商品id不能为空") Integer mallId, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("mall_id", mallId); + queryWrapper.eq("account_id", accountId); + CurriculumRecentUse details = restoreUseService.getOne(queryWrapper); + + if (details == null) { + //新增 + CurriculumRecentUse recentUse = new CurriculumRecentUse(); + recentUse.setEntryTime(new Date()); + recentUse.setMallId(mallId); + recentUse.setAccountId(Integer.valueOf(accountId)); + restoreUseService.save(recentUse); + } else { + details.setEntryTime(new Date()); + restoreUseService.updateById(details); + } + return R.ok(); + } + + @PostMapping("/recentUse") + @ApiOperation(value = "实验台最近使用", response = CurriculumRecentUse.class) + public R recentUse(@RequestBody PageCurriculumRecentUseReq req, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + req.setAccountId(Integer.valueOf(accountId)); + req.setSchoolId(schoolId); + return restoreUseService.recentUse(req); + } +} + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/CurriculumLearningProgressController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/CurriculumLearningProgressController.java new file mode 100644 index 0000000..6ef2b19 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/CurriculumLearningProgressController.java @@ -0,0 +1,157 @@ +package com.huoran.nakadai.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.api.OccupationlabClient; +import com.huoran.api.UserClient; +import com.huoran.common.entity.ProjectManage; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.nakadai.entity.CurriculumLearningProgress; +import com.huoran.nakadai.entity.vo.ChapterVO; +import com.huoran.nakadai.service.CurriculumChapterService; +import com.huoran.nakadai.service.CurriculumLearningProgressService; +import com.huoran.nakadai.service.ICurriculumConfigureService; +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 javax.servlet.http.HttpServletRequest; +import java.math.BigDecimal; +import java.util.List; + + +/** + * @描述:课程学习进度控制类 + * @作者: Rong + * @日期: 2023-04-25 + */ +@RestController +@RequestMapping("/nakadai/curriculum/learning/progressprogress") +@Api(value = "R-课程学习进度", tags = "R-课程学习进度") +public class CurriculumLearningProgressController { + + @Autowired + private CurriculumChapterService curriculumChapterService; + + @Autowired + public CurriculumLearningProgressService service; + + @Autowired + private UserClient userClient; + @Autowired + public ICurriculumConfigureService configureService; + + + @Autowired + public OccupationlabClient occupationlabClient; + + @ApiOperation(value = "根据课程id查询课程下的项目(含当前用户学习进度)", response = ChapterVO.class) + @PostMapping("/courseLearningProgress") + public R courseLearningProgress(@ApiParam(name = "courseId", value = "课程ID", required = true) @RequestParam String courseId, + @ApiParam(name = "systemId", value = "系统ID", required = true) @RequestParam String systemId, + @ApiParam(name = "mallId", value = "商品id", required = true) @RequestParam Integer mallId + , HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); +// List chapterList = curriculumChapterService.getChapterTree(courseId); + + + //查询课程下绑定的全部项目 (根据课程id获取实训项目列表) String systemId, Integer accountId, Integer permissions, Integer cId, Integer mallId,Integer schoolId + List courseList = configureService.getProjectBySystemIdRemoteCall(systemId, Integer.valueOf(accountId), 0, Integer.valueOf(courseId), mallId, schoolId); + //统计本课程下全部项目数量 + double statisticalSummary = 0; + if (courseList != null) { + statisticalSummary = courseList.size(); + } + + + //统计已经记录的本课程下的项目数量 + double learningQuantity = 0; + + //查询本人学习当前课程下已经学习的项目学习记录 + List curriculumLearningProgresses = service.curriculumLearningProgresses(Integer.valueOf(accountId), courseId); + for (ProjectManage infoRes : courseList) { + if (curriculumLearningProgresses.size() > 0) { + for (CurriculumLearningProgress programProgress : curriculumLearningProgresses) { + if (infoRes.getProjectId().equals(programProgress.getProjectId())) { + //是否学习(0未学习 1已学习) + infoRes.setWhetherToStudyOrNot(1); + infoRes.setLearningProgressId(programProgress.getId()); + learningQuantity++; + + } + + + } + } + } + double schedule = 0.0; + if (learningQuantity != 0.0 && statisticalSummary != 0.0) { + schedule = (learningQuantity / statisticalSummary) * 100; + } + + BigDecimal bg = new BigDecimal(schedule); + double f1 = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); + return R.ok(courseList).put("schedule", f1 + "%").put("plan", (int) learningQuantity + "/" + (int) statisticalSummary); + } + + + @PostMapping("/findById") + @ApiOperation(value = "查询详情", response = CurriculumLearningProgress.class) + public R findById(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { + CurriculumLearningProgress curriculumLearningProgress = service.getById(id); + return R.ok().put("data", curriculumLearningProgress); + } + + + @PostMapping("/save") + @ApiOperation(value = "新增", response = CurriculumLearningProgress.class) + public R save(@RequestBody @ApiParam(name = "课程学习进度对象", value = "传入json格式", required = true) CurriculumLearningProgress curriculumLearningProgress, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + curriculumLearningProgress.setSchoolId(schoolId); + curriculumLearningProgress.setAccountId(Integer.valueOf(accountId)); + + QueryWrapper qwrap = new QueryWrapper<>(); + qwrap.eq("cid", curriculumLearningProgress.getCid()); + /*qwrap.eq("chapter_id", curriculumLearningProgress.getChapterId()); + qwrap.eq("subsection_id", curriculumLearningProgress.getSubsectionId());*/ + qwrap.eq("project_id", curriculumLearningProgress.getProjectId()); + qwrap.eq("account_id", accountId); + qwrap.eq("school_id", schoolId); + + List list = service.list(qwrap); + if (list.size() > 0) { + return R.error("当前项目已被勾选!请刷新重试"); + } + + + boolean addState = service.save(curriculumLearningProgress); + return addState ? R.ok() : R.error("新增失败"); + } + + + @PostMapping("/update") + @ApiOperation(value = "修改", response = CurriculumLearningProgress.class) + public R update(@RequestBody @ApiParam(name = "课程学习进度对象", value = "传入json格式", required = true) CurriculumLearningProgress curriculumLearningProgress, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + curriculumLearningProgress.setSchoolId(schoolId); + curriculumLearningProgress.setAccountId(Integer.valueOf(accountId)); + boolean updateState = service.updateById(curriculumLearningProgress); + return updateState ? R.ok() : R.error("编辑失败"); + } + + + @PostMapping("/delete") + @ApiOperation(value = "删除", response = CurriculumLearningProgress.class) + public R delete(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { + boolean delState = service.removeById(id); + return delState ? R.ok() : R.error("删除失败"); + } + + +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/CurriculumNotesController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/CurriculumNotesController.java new file mode 100644 index 0000000..ef16a58 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/CurriculumNotesController.java @@ -0,0 +1,94 @@ +package com.huoran.nakadai.controller; + + +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.nakadai.entity.CurriculumNotes; +import com.huoran.nakadai.service.CurriculumNotesService; +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 javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + *

+ * 课程笔记表 前端控制器 + *

+ * + * @author chen + * @since 2023-05-04 + */ +@Api(value = "课程笔记管理", tags = "课程笔记管理") +@RestController +@RequestMapping("/curriculumNotes") +public class CurriculumNotesController { + + @Autowired + private CurriculumNotesService curriculumNotesService; + + @ApiOperation(value = "添加笔记") + @PostMapping("/addNote") + public R addNote( + @ApiParam(name = "notes", value = "笔记内容", required = true) + @RequestBody CurriculumNotes notes, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + //名称判重 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("note_name",notes.getNoteName()); + queryWrapper.eq("account_id",accountId); + queryWrapper.eq("cid",notes.getCid()); + CurriculumNotes one = curriculumNotesService.getOne(queryWrapper); + if (ObjectUtil.isNotNull(one)){ + return R.error("笔记名称已存在!"); + } + //新增笔记 + notes.setAccountId(Integer.valueOf(accountId)); + boolean save = curriculumNotesService.save(notes); + return save ? R.ok() : R.error(); + } + + @ApiOperation(value = "更新笔记") + @PostMapping("/updateNote") + public R updateNote( + @ApiParam(name = "notes", value = "笔记内容", required = true) + @RequestBody CurriculumNotes notes) { + boolean update = curriculumNotesService.updateById(notes); + return update ? R.ok() : R.error(); + } + + @ApiOperation(value = "课程笔记列表") + @GetMapping("/curriculumNoteList") + public R curriculumNoteList( + @ApiParam(name = "search", value = "查询条件",required = false) + @RequestParam(required = false) String search, + @ApiParam(name = "cid", value = "课程id") + @RequestParam Integer cid, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("account_id",accountId); + queryWrapper.eq("cid",cid); + queryWrapper.orderByDesc("create_time"); + if (search!=null){ + queryWrapper.like("note_name",search); + } + List curriculumNotes = curriculumNotesService.list(queryWrapper); + return R.ok().put("curriculumNotes",curriculumNotes); + } + + @ApiOperation(value = "删除课程笔记") + @PostMapping("/deleteNotes") + public R deleteNotes( + @ApiParam(name = "noteId", value = "课程笔记id", required = true) + @RequestParam Integer noteId) { + boolean remove = curriculumNotesService.removeById(noteId); + return remove ? R.ok() : R.error(); + } + +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/CurriculumSubsectionController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/CurriculumSubsectionController.java new file mode 100644 index 0000000..3b9f652 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/CurriculumSubsectionController.java @@ -0,0 +1,81 @@ +package com.huoran.nakadai.controller; + + +import com.aliyuncs.exceptions.ClientException; +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.CurriculumSubsection; +import com.huoran.nakadai.service.CurriculumSubsectionService; +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.Date; + +/** + *

+ * 企业课程小节表 前端控制器 + *

+ * + * @author lr + * @since 2021-09-26 + */ +@RestController +@Api(description = "课程小节管理", tags = "课程小节管理") +@RequestMapping("/nakadai/curriculum/subsection") +public class CurriculumSubsectionController { + @Autowired + private CurriculumSubsectionService curriculumSubsectionService; + + @ApiOperation(value = "添加小节") + @PostMapping("/addSubsection") + public R addSubsection( + @ApiParam(name = "courseSubsection", value = "小节对象", required = true) + @RequestBody CurriculumSubsection curriculumSubsection) { + //判重 + boolean isRepeat = curriculumSubsectionService.repeat(curriculumSubsection); + if (isRepeat) { + return R.error("小节已存在"); + } + boolean save = curriculumSubsectionService.saveSubsection(curriculumSubsection); + return save ? R.ok() : R.error(); + } + + @ApiOperation(value = "修改小节") + @PutMapping("/editSubsection") + public R editSubsection( + @ApiParam(name = "courseSubsection", value = "小节对象", required = true) + @RequestBody CurriculumSubsection courseSubsection) { + boolean update = curriculumSubsectionService.updateById(courseSubsection); + return update ? R.ok() : R.error(); + } + + @ApiOperation(value = "根据id删除小节") + @DeleteMapping("/deleteSubsection/{subsectionId}") + public R deleteSubsection( + @ApiParam(name = "subsectionId", value = "小节ID", required = true) + @PathVariable String subsectionId) throws ClientException { + boolean remove = curriculumSubsectionService.removeSubsection(subsectionId); + return remove ? R.ok() : R.error(); + } + + @ApiOperation(value = "根据小节id获取预览文件地址") + @GetMapping("/getSubsection/{subsectionId}") + public R getSubsection( + @ApiParam(name = "subsectionId", value = "小节ID", required = true) + @PathVariable String subsectionId) { + String officeUrl = "https://view.officeapps.live.com/op/view.aspx?src="; + // String xDocUrl = "http://view.xdocin.com/xdoc?_xdoc="; + CurriculumSubsection courseSubsection = curriculumSubsectionService.getById(subsectionId); + if (courseSubsection != null) { + String fileUrl = courseSubsection.getFileUrl(); + String previewUrl = officeUrl + fileUrl; + return R.ok().put("previewUrl", previewUrl); + } else { + return R.error(); + } + } + +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/CustomerController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/CustomerController.java new file mode 100644 index 0000000..ac1a907 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/CustomerController.java @@ -0,0 +1,358 @@ +package com.huoran.nakadai.controller; + +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.entity.ExportParams; +import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.api.NakadaiClient; +import com.huoran.api.UserClient; +import com.huoran.common.constant.DelConstant; +import com.huoran.common.exception.ExceptionEnum; +import com.huoran.common.response.R; +import com.huoran.common.utils.PageUtils; +import com.huoran.common.utils.TokenUtils; +import com.huoran.nakadai.entity.*; +import com.huoran.nakadai.entity.req.CustomerListReq; +import com.huoran.nakadai.entity.req.CustomerReq; +import com.huoran.nakadai.entity.req.GetTheSystemUnderTheProductReq; +import com.huoran.nakadai.entity.req.ListOfClientCommercialManagersReq; +import com.huoran.nakadai.entity.res.BusinessManagerOrderResp; +import com.huoran.nakadai.entity.res.CustomerDetailRes; +import com.huoran.nakadai.entity.res.CustomerListRes; +import com.huoran.nakadai.entity.res.ListOfClientCommercialManagersResp; +import com.huoran.nakadai.mapper.CustomerMapper; +import com.huoran.nakadai.mapper.HrStaffMapper; +import com.huoran.nakadai.service.ICustomerService; +import com.huoran.nakadai.service.IOrderService; +import com.huoran.nakadai.utils.ExcelStyleUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.apache.ibatis.annotations.Param; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import java.net.URLEncoder; +import java.util.List; +import java.util.UUID; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ThreadPoolExecutor; + +/** + *

+ * 客户表 前端控制器 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@Api(value = "客户管理", tags = "客户管理") +@RestController +@RequestMapping("/nakadai/customer") +public class CustomerController { + + @Autowired + private ICustomerService iCustomerService; + + @Autowired + private CustomerMapper mapper; + + @Autowired + private HrStaffMapper staffMapper; + + @Autowired + private IOrderService orderService; + + @Autowired + private UserClient userClient; + + + @Autowired + private NakadaiClient nakadaiClient; + + /** + * 客户登录次数补充 + */ + @ApiOperation(value = "客户登录次数补充", notes = "客户登录次数补充") + @PostMapping("/supplementaryCustomerLogins") + public R supplementaryCustomerLogins() { + List list = iCustomerService.list(new QueryWrapper()); + for (Customer customer : list) { + UserAccount userAccount = mapper.selectCustomerAccount(customer.getCustomerId()); + + if (userAccount != null) { + //添加客户默认用户信息 + com.huoran.nakadai.entity.UserInfo userInfo = new UserInfo(); + // userInfo.setUserName();用户姓名默认为空 + userInfo.setUniqueIdentification(UUID.randomUUID().toString()); + staffMapper.addUserInfo(userInfo); + + userAccount.setUserId(userInfo.getUserId()); + + mapper.updateAccountCustomer(userAccount); + } + + } + return R.ok(); + } + + /** + * 添加客户 + * + * @return + */ + @ApiOperation(value = "添加客户", notes = "添加客户") + @PostMapping("/addCustomer") + public R addCustomer(@RequestBody @Valid CustomerReq customerReq) { + int result = 0; + try { + result = iCustomerService.addCustomer(customerReq); + } catch (ExecutionException | InterruptedException e) { + e.printStackTrace(); + } + return result > 0 ? R.ok().put("customerId", customerReq.getCustomerId()).put("schoolId", customerReq.getSchoolId()) : R.error(); + } + + /** + * 查询客户管理列表 + * + * @param customerListReq + * @return + */ + @ApiOperation(value = "查询客户管理列表", notes = "查询客户管理列表") + @PostMapping("/queryCustomer") + public R queryCustomer(@RequestBody CustomerListReq customerListReq) { + PageUtils data = iCustomerService.queryPage(customerListReq.getPage(), customerListReq.getSize(), customerListReq); + return R.ok(data); + } + + + + + @ApiOperation(value = "批量导出客户(不用给分页,其余参数与列表一样)") + @PostMapping(value = "/exportClient", produces = "application/json;multipart/form-data;charset=utf-8") + public void exportProductPracticeResults( + @RequestBody CustomerListReq customerListReq, + HttpServletResponse response) throws Exception { + /*iCustomerService.exportClient(req, response);*/ + + PageUtils data = iCustomerService.queryPage(1, 10000, customerListReq); + // 告诉浏览器用什么软件可以打开此文件 + response.setHeader("content-Type", "application/vnd.ms-excel"); + + // 下载文件的默认名称 + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("客户列表", "UTF-8") + ".xls"); + //编码 + response.setCharacterEncoding("UTF-8"); + + Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), CustomerListRes.class, data.getList()); + ExportParams exportParams = new ExportParams(null, "客户列表", ExcelType.XSSF); + exportParams.setStyle(ExcelStyleUtil.class); + workbook.write(response.getOutputStream()); + } + + /** + * 密码重置,重置密码为1122aa + */ + @ApiOperation(value = "密码重置", notes = "密码重置") + @GetMapping("/resetPwd") + public R resetPwd(@RequestParam("customerId") Integer customerId) { + int result = iCustomerService.resetPwd(customerId); + return result > 0 ? R.ok() : R.error(); + } + + /** + * 删除客户 + */ + @ApiOperation(value = "删除客户", notes = "删除客户") + @PostMapping("/delCustomer") + public R delCustomer(@RequestBody Integer customerId) { + int result = iCustomerService.delCustomer(customerId); + return result > 0 ? R.ok() : R.error(); + } + + /** + * 批量删除客户信息 + * + * @param ids + * @return + */ + @PostMapping("/delCustomers") + @ApiOperation(value = "批量删除客户信息") + public R delCustomers(@RequestBody List ids) { + int result = iCustomerService.delCustomers(ids); + return result > 0 ? R.ok("删除成功!") : R.error(); + } + + /** + * 查看客户详情 + */ + @ApiOperation(value = "查看客户详情", notes = "查看客户详情", response = CustomerDetailRes.class) + @GetMapping("/queryCustomerDetails") + public R queryCustomerDetails(@RequestParam("customerId") Integer customerId) { + CustomerDetailRes result = iCustomerService.queryCustomerDetails(customerId); + return R.ok().put("result", result); + } + + /** + * 修改课程权限启用禁用 + * @param coursePermissionsId + * @return + */ +// @ApiOperation(value = "修改课程权限启用禁用",notes = "修改课程权限启用禁用") +// @GetMapping("/updateCourseEnabled") +// public R updateCourseEnabled(@RequestParam("coursePermissionsId") Integer coursePermissionsId,@RequestParam("isEnabled") Integer isEnabled) { +// int result = iCustomerService.updateCourseEnabled(coursePermissionsId,isEnabled); +// return result>0 ? R.ok() : R.error(); +// } + + /** + * 修改数据平台权限启用禁用 + * @param dataPermissionsId + * @return + */ +// @ApiOperation(value = "修改数据平台权限启用禁用",notes = "修改数据平台权限启用禁用") +// @GetMapping("/updateDataEnabled") +// public R updateDataEnabled(@RequestParam("dataPermissionsId") Integer dataPermissionsId,@RequestParam("isEnabled") Integer isEnabled) { +// int result = iCustomerService.updateDataEnabled(dataPermissionsId,isEnabled); +// return result>0 ? R.ok() : R.error(); +// } + + /** + * 修改数据平台权限/课程权限启用禁用 + * + * @param id 主键id + * @return + */ + @ApiOperation(value = "修改数据平台权限/课程权限启用禁用", notes = "修改数据平台权限/课程权限启用禁用") + @GetMapping("/updateEnabled") + public R updateEnabled(@RequestParam("id") Integer id, @RequestParam("isEnable") @ApiParam(value = "是否开启(0不开启,1开启,发货后,默认开启)") Integer isEnable) { + int result = iCustomerService.updateEnabled(id, isEnable); + return result > 0 ? R.ok() : R.error(); + } + + /** + * 修改客户 + * + * @return + */ + @ApiOperation(value = "修改客户", notes = "修改客户") + @PostMapping("/updateCustomer") + public R updateCustomer(@RequestBody @Valid CustomerReq customerReq) { + int result = iCustomerService.updateCustomer(customerReq); + return result > 0 ? R.ok() : R.error(); + } + + /** + * 修改客户角色Id + * + * @return + */ + @ApiOperation(value = "修改客户角色Id", notes = "修改客户角色Id") + @PostMapping("/updateCustomerByRoleId") + public R updateCustomerByRoleId(@RequestParam("customerId") @ApiParam(value = "客户id") Integer customerId, + @RequestParam("roleId") @ApiParam(value = "角色id") String roleId + ) { + int result = iCustomerService.updateCustomerByRoleId(customerId, roleId); + return result > 0 ? R.ok() : R.error(); + } + + /** + * 客户判重 + * + * @param schoolId + * @return + */ + @ApiOperation(value = "查看客户是否存在", notes = "查看客户是否存在") + @GetMapping("/queryCustomerIsExists") + public R queryCustomerIsExists(@RequestParam Integer schoolId) { + int result = iCustomerService.queryCustomerIsExists(schoolId); + return result > 0 ? R.error().put("code", ExceptionEnum.EXIST_CUSTOMER.getCode()).put("message", ExceptionEnum.EXIST_CUSTOMER.getMsg()) : R.ok(); + } + + /** + * 根据学校id获取客户id + * + * @param schoolId + * @return + */ + @ApiOperation(value = "根据学校id获取客户id", notes = "根据学校id获取客户id") + @GetMapping("/getCustomerBySchoolId") + public Integer getCustomerBySchoolId(@RequestParam Integer schoolId) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("school_id", schoolId); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + Customer one = iCustomerService.getOne(queryWrapper); + if (one==null){ + return 0; + } + return one.getCustomerId(); + } + + @PostMapping("/checkEmailOrPhone") + @ApiOperation(value = "新增客户前:校验手机号或者邮箱", response = Customer.class) + public R checkEmailAndPhone(@ApiParam(name = "phone", value = "手机号(一次校验只传一个参数)") @RequestParam(required = false) String phone, + @ApiParam(name = "email", value = "邮 箱(一次校验只传一个参数)") @RequestParam(required = false) String email + , @ApiParam(name = "customerId", value = "编辑传:被编辑客户id") @RequestParam(value = "customerId", required = false) Integer customerId) { + + Customer customer = new Customer(); + + customer.setPhone(phone); + customer.setEmail(email); + if (customerId != null) { + customer.setCustomerId(customerId); + } + + List customerList = iCustomerService.checkEmailOrPhone(customer); + String msg = ""; + if (customerList.size() > 0) { + if (phone != null && !phone.equals("")) { + msg = "该手机号已存在!"; + } else if (email != null && !email.equals("")) { + msg = "该Email已存在!"; + } + + return R.error(msg); + } + return R.ok(); + } + + @ApiOperation(value = "根据客户id获取客户已订阅的产品", notes = "根据客户id获取客户已订阅的产品",response = OrderOther.class) + @GetMapping("/getProductsSubscribedByCustomers") + public R getProductsSubscribedByCustomers(@RequestParam Integer customeId) { + return orderService.getProductsSubscribedByCustomers(customeId); + } + + + @ApiOperation(value = "根据客户id获取客户绑定的商务经理列表", notes = "根据客户id获取客户绑定的商务经理列表",response = ListOfClientCommercialManagersResp.class) + @PostMapping("/getAListOfClientBusinessManagers") + public R getAListOfClientBusinessManagers(@RequestBody ListOfClientCommercialManagersReq req) { + return orderService.getAListOfClientBusinessManagers(req); + } + + @ApiOperation(value = "获取业务经理订单", notes = "获取业务经理订单",response = BusinessManagerOrderResp.class) + @PostMapping("/getBusinessManagerOrder") + public R getBusinessManagerOrder(@RequestBody ListOfClientCommercialManagersReq req) { + return orderService.getBusinessManagerOrder(req); + } + + + @ApiOperation(value = "获取客户购买的产品包含的系统", notes = "获取客户购买的产品包含的系统",response = ServiceConfiguration.class) + @PostMapping("/getSystemByCustomers") + public R getSystemByCustomers(@RequestBody GetTheSystemUnderTheProductReq req,HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + Integer customeId = nakadaiClient.getCustomerBySchoolId(schoolId); + + req.setCustomerId(customeId); + return orderService.getSystemByCustomers(req); + } + + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/CustomsPassController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/CustomsPassController.java new file mode 100644 index 0000000..b0d3f01 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/CustomsPassController.java @@ -0,0 +1,233 @@ +package com.huoran.nakadai.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.huoran.api.UserClient; +import com.huoran.common.constant.DelConstant; +import com.huoran.common.constant.PlatformConstant; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.nakadai.entity.CustomsPass; +import com.huoran.nakadai.entity.req.PageCustomsPass; +import com.huoran.nakadai.service.CustomsPassService; +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.util.ObjectUtils; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.util.Date; +import java.util.List; + +/** + * @描述:沙盘-关卡表控制类 + * @作者: Rong + * @日期: 2023-10-26 + */ +@RestController +@RequestMapping("/nakadai/customsPass") +@Api(value = "沙盘-关卡表:CustomsPassController", tags = "沙盘-关卡表") +public class CustomsPassController { + + @Autowired + public CustomsPassService service; + + @Autowired + private UserClient userClient; + + + @PostMapping("/checkPointListByStu") + @ApiOperation(value = "学生端:关卡列表(用于学生端,需结合收藏表回显收藏id)", response = CustomsPass.class) + public R checkPointListByStu(@ApiParam(name = "projectId", value = "项目id", required = true) @RequestParam Integer projectId, + @ApiParam(name = "displayCollection", value = "显示收藏(为1表示仅展示已收藏)") @RequestParam(required = false) Integer displayCollection, + HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + return service.checkPointList(schoolId, Integer.valueOf(accountId), projectId, displayCollection); + } + + + + @PostMapping("/checkpointList") + @ApiOperation(value = "关卡列表", response = CustomsPass.class) + public R checkpointList(@RequestBody PageCustomsPass customsPass) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + + + if (customsPass.getPlatformId().equals(PlatformConstant.POST_STATION)) { + //职站(前台只展示启用的关卡) + queryWrapper.eq("is_enable", DelConstant.IS_ENABLE); + } else { + //中台 + if (!ObjectUtils.isEmpty(customsPass.getCustomsPassName())) { + queryWrapper.like("customs_pass_name", customsPass.getCustomsPassName()); + } + + if (!ObjectUtils.isEmpty(customsPass.getIsEnable())) { + queryWrapper.eq("is_enable", customsPass.getIsEnable()); + } + } + + + queryWrapper.orderByAsc("serial_number"); + + List customsPassList = service.list(queryWrapper); + for (CustomsPass object : customsPassList) { + String creator = userClient.getUserName(object.getAccountId()); + object.setCreator(creator); + } + return R.ok().put("data", customsPassList); + } + + + @PostMapping("/save") + @ApiOperation(value = "新增关卡", response = CustomsPass.class) + public R save(@RequestBody @ApiParam(name = "沙盘-关卡表对象", value = "传入json格式", required = true) List customsPassList, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer sequenceNumber = service.maximumSequenceNumber(); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + + for (CustomsPass customsPass : customsPassList) { + customsPass.setAccountId(Integer.valueOf(accountId)); + customsPass.setSchoolId(Integer.valueOf(schoolId)); + customsPass.setSerialNumber(++sequenceNumber); + customsPass.setCreateTime(new Date()); + customsPass.setUpdateTime(new Date()); + service.save(customsPass); + } + + return R.ok(); + } + + + @PostMapping("/update") + @ApiOperation(value = "修改", response = CustomsPass.class) + public R update(@RequestBody @ApiParam(name = "沙盘-关卡表对象", value = "传入json格式", required = true) List customsPassList, HttpServletRequest request) { + for (CustomsPass customsPass : customsPassList) { + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + if (!ObjectUtils.isEmpty(customsPass.getSerialNumber())) { + updateWrapper.set("serial_number", customsPass.getSerialNumber()); + } + + if (!ObjectUtils.isEmpty(customsPass.getCustomsPassName())) { + updateWrapper.set("customs_pass_name", customsPass.getCustomsPassName()); + } + + if (!ObjectUtils.isEmpty(customsPass.getIsEnable())) { + updateWrapper.set("is_enable", customsPass.getIsEnable()); + } + + if (!ObjectUtils.isEmpty(customsPass.getIsDel())) { + updateWrapper.set("is_del", customsPass.getIsDel()); + } + updateWrapper.set("update_time", new Date()); + + updateWrapper.eq("checkpoint_id", customsPass.getCheckpointId()); + + service.update(new CustomsPass(), updateWrapper); + } + + return R.ok(); + } + +/* @PostMapping("/update") + @ApiOperation(value = "修改",response= CustomsPass.class) + public R update(@RequestBody @ApiParam(name="沙盘-关卡表对象",value="传入json格式",required=true) CustomsPass customsPass, HttpServletRequest request){ + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + customsPass.setAccountId(Integer.valueOf(accountId)); + boolean updateState = service.updateById(customsPass); + return updateState? R.ok():R.error("编辑失败"); + }*/ + + /* @PostMapping("/sort") + @ApiOperation(value = "排序", response = CustomsPass.class) + public R sort(@RequestBody @ApiParam(name = "沙盘-关卡表对象", value = "传入json格式", required = true) List sortReqs, HttpServletRequest request) { + + for (CustomsPassSortReq req : sortReqs) { + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.set("serial_number", req.getSerialNumber()); + updateWrapper.eq("checkpoint_id", req.getCheckpointId()); + service.update(new CustomsPass(), updateWrapper); + } + + return R.ok(); + } +*/ + + /*@ApiOperation(value = "更新开启状态") + @PostMapping("/updateIsOpen") + public R updateIsOpen(@ApiParam(name = "checkpointId", value = "关卡id", required = true) @RequestParam Integer checkpointId, @ApiParam(name = "isEnable", value = "是否禁用(默认0:禁用,1:启用)", required = true) @RequestParam Integer isEnable, @RequestHeader String token) { + String accountId = TokenUtils.getIdByJwtToken(token); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + service.updateIsOpen(checkpointId, isEnable); + return R.ok(); + }*/ + + + /* @ApiOperation(value = "编辑关卡名") + @PostMapping("/updateByName") + public R updateByName(@ApiParam(name = "checkpointId", value = "关卡id", required = true) @RequestParam Integer checkpointId, @ApiParam(name = "customsPassName", value = "关卡名", required = true) @RequestParam String customsPassName, @RequestHeader String token) { + String accountId = TokenUtils.getIdByJwtToken(token); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.set("customs_pass_name", customsPassName); + updateWrapper.eq("checkpoint_id", checkpointId); + boolean ret = service.update(new CustomsPass(), updateWrapper); + return ret ? R.ok() : R.error(); + }*/ + + + /*@ApiOperation(value = "排序") + @PostMapping("/sort") + public R sort(@ApiParam(name = "checkpointId", value = "关卡id", required = true) @RequestParam Integer checkpointId, @ApiParam(name = "type", value = "1.上移 2下移 3置顶 4置底", required = true) @RequestParam Integer type, @RequestHeader String token) { + String accountId = TokenUtils.getIdByJwtToken(token); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + CustomsPass customsPass = service.getById(checkpointId); + + + //上移 + if (type.equals(2)) { + if (customsPass.getSerialNumber() == 1) { + return R.error("已经在最上面啦,不能移动啦~"); + } + + //查询下一条记录Id和sort + Integer nextId = service.selectNextId(customsPass); + CustomsPass nextNotice = service.getById(nextId); + //更新下一条记录的sort为当前值 + customsPass.setCheckpointId(nextId); + service.updateSortById(customsPass); + //更新当前记录的sort为下一条 + nextNotice.setCheckpointId(checkpointId); + service.updateSortById(nextNotice); + } + // 3、下移 + if (type.equals(1)) { + //查询上一条记录Id和sort + Integer previousId = service.selectPreviousId(customsPass); + CustomsPass previousNotice = service.getById(previousId); + //更新上一条记录的sort为当前值 + customsPass.setCheckpointId(previousId); + service.updateSortById(customsPass); + //更新当前记录的sort为上一条 + previousNotice.setCheckpointId(checkpointId); + service.updateSortById(previousNotice); + } + + + return R.ok(); + }*/ + + + /* @PostMapping("/batchDeletion") + @ApiOperation(value = "批量删除", response = CustomsPass.class) + public R batchDeletion(@ApiParam(name = "ids", value = "主键", required = true) @RequestBody List ids) { + boolean delState = service.removeByIds(ids); + return delState ? R.ok() : R.error("删除失败"); + }*/ +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/DataProductController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/DataProductController.java new file mode 100644 index 0000000..93795e9 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/DataProductController.java @@ -0,0 +1,45 @@ +package com.huoran.nakadai.controller; + + +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.nakadai.entity.Curriculum; +import com.huoran.nakadai.entity.DataProduct; +import com.huoran.nakadai.entity.Discipline; +import com.huoran.nakadai.entity.req.AddCurriculumReq; +import com.huoran.nakadai.entity.req.MiniProgramProductsReq; +import com.huoran.nakadai.entity.res.AppletsDataProductResp; +import com.huoran.nakadai.service.ICustomerService; +import com.huoran.nakadai.service.IDataProductService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import javax.validation.Valid; +import java.util.List; + +/** + *

+ * 数据平台产品表 前端控制器 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@RestController +@RequestMapping("/nakadai/dataProduct") +@Api(value = "产品", tags = "产品") +public class DataProductController { + + + @Autowired + private IDataProductService dataProductService; + + @PostMapping("/AppletsDataProductList") + @ApiOperation(value = "小程序数据产品列表", response = AppletsDataProductResp.class) + public R AppletsDataProductList(@RequestBody MiniProgramProductsReq req) { + return dataProductService.AppletsDataProductList(req); + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/DisciplineController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/DisciplineController.java new file mode 100644 index 0000000..7a38ec2 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/DisciplineController.java @@ -0,0 +1,75 @@ +package com.huoran.nakadai.controller; + + +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.Discipline; +import com.huoran.nakadai.entity.Professional; +import com.huoran.nakadai.entity.ProfessionalClass; +import com.huoran.nakadai.service.IDisciplineService; +import com.huoran.nakadai.service.IProfessionalClassService; +import com.huoran.nakadai.service.IProfessionalService; +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.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.List; + +/** + * @Description: java方法作用描述 + * @auther: Rong + * @date: 2021/9/17 15:44 + */ +@RestController +@RequestMapping("/nakadai/subject") +@Api(value = "API - 课程管理三级联查", tags = "课程管理三级联查") +public class DisciplineController { + @Autowired + public IDisciplineService service; + + @Autowired + public IProfessionalClassService classService; + + @Autowired + public IProfessionalService professionalService; + + @GetMapping("/subjectCategoryCited") + @ApiOperation(value = "教师端展示引用的学科类别(三级数据)", response = Discipline.class) + public R subjectCategoryCited() { + List list = service.subjectCategoryCited(); + return R.ok().put("list", list); + } + + + @GetMapping("/courseDiscipline") + @ApiOperation(value = "课程学科类别", response = Discipline.class) + public R courseDiscipline() { + List list = service.disciplineLevel(); + return R.ok().put("list", list); + } + + + @GetMapping("/courseProfessionalClass") + @ApiOperation(value = "课程专业类", response = ProfessionalClass.class) + public R disciplineList( + @ApiParam(value = "disciplineId", required = true) + @RequestParam("disciplineId") Integer disciplineId) { + List list = classService.professionalClassLevel(disciplineId); + return R.ok().put("list", list); + } + + + @GetMapping("/courseProfessional") + @ApiOperation(value = "课程专业", response = Professional.class) + public R courseProfessional( + @ApiParam(value = "professionalClassId", required = true) + @RequestParam("professionalClassId") Integer professionalClassId) { + List list = professionalService.professionalLevel(professionalClassId); + return R.ok().put("list", list); + } +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/DisciplineLevelController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/DisciplineLevelController.java new file mode 100644 index 0000000..1c5a505 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/DisciplineLevelController.java @@ -0,0 +1,21 @@ +package com.huoran.nakadai.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 学科层次 前端控制器 + *

+ * + * @author huoran + * @since 2021-07-09 + */ +@RestController +@RequestMapping("/nakadai/disciplineLevel") +public class DisciplineLevelController { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/EduCurriculumChapterController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/EduCurriculumChapterController.java new file mode 100644 index 0000000..ab36809 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/EduCurriculumChapterController.java @@ -0,0 +1,21 @@ +package com.huoran.nakadai.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 课程章节 前端控制器 + *

+ * + * @author lr + * @since 2021-09-26 + */ +@RestController +@RequestMapping("/nakadai/edu-curriculum-chapter") +public class EduCurriculumChapterController { + +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/HrContractInformationController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/HrContractInformationController.java new file mode 100644 index 0000000..05e70b6 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/HrContractInformationController.java @@ -0,0 +1,20 @@ +package com.huoran.nakadai.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 合同信息表 前端控制器 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@RestController +@RequestMapping("/nakadai/contractInformation") +public class HrContractInformationController { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/HrCoursePermissionsController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/HrCoursePermissionsController.java new file mode 100644 index 0000000..0a5bfd0 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/HrCoursePermissionsController.java @@ -0,0 +1,20 @@ +package com.huoran.nakadai.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 课程权限表 前端控制器 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@RestController +@RequestMapping("/nakadai/coursePermissions") +public class HrCoursePermissionsController { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/HrDataPermissionsController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/HrDataPermissionsController.java new file mode 100644 index 0000000..7a8fd7d --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/HrDataPermissionsController.java @@ -0,0 +1,20 @@ +package com.huoran.nakadai.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 数据平台权限表 前端控制器 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@RestController +@RequestMapping("/nakadai/dataPermissions") +public class HrDataPermissionsController { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/HrIndustryClassController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/HrIndustryClassController.java new file mode 100644 index 0000000..70add0f --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/HrIndustryClassController.java @@ -0,0 +1,46 @@ +package com.huoran.nakadai.controller; + + +import com.huoran.common.exception.ExceptionEnum; +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.HrIndustryClass; +import com.huoran.nakadai.service.IHrIndustryClassService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + *

+ * 行业类 前端控制器 + *

+ * + * @author huoran + * @since 2021-06-29 + */ +@Api(value = "行业类管理", tags = "行业类管理") +@RestController +@RequestMapping("/nakadai/hrIndustryClass") +public class HrIndustryClassController { + + @Autowired + private IHrIndustryClassService iHrIndustryClassService; + + /** + * 查询行业类 + * @return + */ + @ApiOperation(value = "查询行业类",notes = "查询行业类") + @GetMapping("/queryIndustryClass") + public R queryIndustryClass() { + List result = iHrIndustryClassService.queryIndustryClass(); + return R.ok(result); + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/HrIndustryController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/HrIndustryController.java new file mode 100644 index 0000000..ae9c0fd --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/HrIndustryController.java @@ -0,0 +1,47 @@ +package com.huoran.nakadai.controller; + + +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.HrIndustry; +import com.huoran.nakadai.entity.HrIndustryClass; +import com.huoran.nakadai.service.IHrIndustryService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + *

+ * 行业 前端控制器 + *

+ * + * @author huoran + * @since 2021-06-29 + */ +@Api(value = "行业管理", tags = "行业管理") +@RestController +@RequestMapping("/nakadai/hrIndustry") +public class HrIndustryController { + + @Autowired + private IHrIndustryService iHrIndustryService; + + /** + * 查询行业 + * @return + */ + @ApiOperation(value = "查询行业",notes = "查询行业") + @GetMapping("/queryIndustry") + public R queryIndustry(@RequestParam Integer industryClassId) { + List result = iHrIndustryService.queryIndustry(industryClassId); + return R.ok(result); + } + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/HrLogController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/HrLogController.java new file mode 100644 index 0000000..e0da36c --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/HrLogController.java @@ -0,0 +1,276 @@ +package com.huoran.nakadai.controller; + + +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.nakadai.entity.HrLog; +import com.huoran.nakadai.entity.LogContent; +import com.huoran.nakadai.entity.vo.LogManagementListVo; +import com.huoran.nakadai.entity.vo.OrderVo; +import com.huoran.nakadai.service.HrLogService; +import com.huoran.nakadai.service.LogContentService; +import com.huoran.nakadai.utils.CollectionUtil; +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.data.redis.core.RedisTemplate; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; +import java.util.List; + +/** + *

+ * 前端控制器 + *

+ * + * @author chen + * @since 2022-03-04 + */ +@Api(tags = "日志管理") +@RestController +@RequestMapping("/nakadai/log") +public class HrLogController { + + @Autowired + private HrLogService logService; + + @Autowired + private LogContentService logContentService; + + @Autowired + private RedisTemplate redisTemplate; + + + @ApiOperation(value = "名称查重") + @GetMapping("/checkRepeat") + public R logManagementList( + @ApiParam(name = "versionName", value = "名称") @RequestParam String versionName, + @ApiParam(name = "platformId", value = "平台id") @RequestParam String platformId) { + //名称判重 + QueryWrapper logQueryWrapper = new QueryWrapper<>(); + logQueryWrapper.eq("version_name",versionName). + eq("platform_id",platformId); + HrLog hrLog = logService.getOne(logQueryWrapper); + if (ObjectUtil.isNotNull(hrLog)){ + return R.error("版本名称已存在!"); + } + return R.ok(); + } + + @ApiOperation(value = "日志通知") + @GetMapping("/logNotification") + public R logNotification( + @ApiParam(name = "platformId", value = "平台id") + String platformId,HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + String notification = redisTemplate.opsForValue().get(accountId+platformId); + //读取完该用户删除通知标识 + redisTemplate.delete(accountId+platformId); + return R.ok().put("notification",notification); + } + + @ApiOperation(value = "日志撤回") + @GetMapping("/logWithdrawal") + public R logWithdrawal( + @ApiParam(name = "platformId", value = "平台id") + Integer platformId, + @ApiParam(name = "logId", value = "日志id") + Integer logId) { + HrLog log = new HrLog(); + log.setLogId(logId); + log.setOpen(1); + log.setWithdraw(1); + log.setWithdrawNum(1); + //禁用日志 + logService.updateById(log); + + //获取平台所有存在用户,清空该平台所有通知对象 + List accountIds = logService.queryAllAccount(platformId); + accountIds.forEach(accountId -> { + if (redisTemplate.hasKey(accountId.toString() + platformId)){ + //存在删除该用户通知标识 + redisTemplate.delete(accountId.toString()+platformId); + } + }); + return R.ok(); + } + + @ApiOperation(value = "添加日志") + @PostMapping("/add") + public R add( + @ApiParam(name = "log", value = "日志数据", required = true) + @RequestBody @Valid HrLog log) { + //发布状态判断 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("draft",1).eq("platform_id",log.getPlatformId()); + HrLog one = logService.getOne(queryWrapper); + if (ObjectUtil.isNotNull(one)){ + return R.error("还有未发布的更新日志,请发布后进行新增!"); + } + //名称判重 + QueryWrapper logQueryWrapper = new QueryWrapper<>(); + logQueryWrapper.eq("version_name",log.getVersionName()). + eq("platform_id",log.getPlatformId()); + HrLog hrLog = logService.getOne(logQueryWrapper); + if (ObjectUtil.isNotNull(hrLog)){ + return R.error("版本名称已存在!"); + } + if (log.getDraft()==0){ + log.setDraftTime(new Date()); + log.setVersion(1); + } + boolean save = logService.save(log); + //发布状态,通知该平台所有存在用户 + if (log.getDraft()==0){ + List accountIds = logService.queryAllAccount(log.getPlatformId()); + accountIds.forEach(accountId -> { + redisTemplate.opsForValue().set(accountId.toString()+log.getPlatformId(),"true"); + }); + } + if (save){ + //新增内容 + List logContents = log.getLogContents(); + logContents.forEach(logContent -> { + logContent.setLogId(log.getLogId()); + logContentService.save(logContent); + }); + } + return save ? R.ok() : R.error(); + } + + @ApiOperation(value = "日志管理列表",response = LogManagementListVo.class) + @GetMapping("/logManagementList") + public R logManagementList( + @ApiParam(name = "search", value = "查询条件") + @RequestParam String search) { + List logManagementListVo = logService.managementList(search); + return R.ok().put("logManagementListVo",logManagementListVo); + } + + @ApiOperation(value = "平台日志列表",response = HrLog.class) + @GetMapping("/platformLogList") + public R platformLogList( + @ApiParam(name = "versionName", value = "版本查询", required = true) + @RequestParam String versionName, + @ApiParam(name = "port", value = "分端查询,前台查看传值1,只查询开启日志") + Integer port, + @ApiParam(name = "platformId", value = "平台id") Integer platformId) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.like("version_name",versionName). + eq("platform_id",platformId). + orderByDesc("create_time"); + //前台查看传值1,只查询开启日志 + if (port!=null && port==1){ + queryWrapper.eq("open",0); + } + List logList = logService.list(queryWrapper); + + logList.forEach(log -> { + QueryWrapper logContentQueryWrapper = new QueryWrapper<>(); + logContentQueryWrapper.eq("log_id",log.getLogId()); + List list = logContentService.list(logContentQueryWrapper); + log.setLogContents(list); + }); + return R.ok().put("logList",logList); + } + + + @ApiOperation(value = "日志详情",response = OrderVo.class) + @GetMapping("/get") + public R get( + @ApiParam(name = "logId", value = "日志id", required = true) + @RequestParam @Valid @NotNull Integer logId) { + HrLog log = logService.getById(logId); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("log_id",logId); + List list = logContentService.list(queryWrapper); + log.setLogContents(list); + return R.ok().put("log",log); + } + + @ApiOperation(value = "删除日志") + @PostMapping("/delete") + public R delete( + @ApiParam(name = "logId", value = "日志id", required = true) + @RequestParam Integer logId) { + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("log_id",logId); + logContentService.remove(queryWrapper); + + boolean remove = logService.removeById(logId); + + return remove ? R.ok() : R.error(); + } + + @ApiOperation(value = "更新日志") + @PostMapping("/update") + public R update( + @ApiParam(name = "log", value = "日志数据", required = true) + @RequestBody HrLog log) { + + if (log.getLogContents()!=null){ + ArrayList before = new ArrayList<>(); + ArrayList after = new ArrayList<>(); + //获取该平台最新数据 + HrLog one = logService.getOne(new QueryWrapper(). + eq("platform_id", log.getPlatformId()). + orderByDesc("log_id").last("limit 1")); + + //更新之前查询日志数据 + List contentList = logContentService. + list(new QueryWrapper().eq("log_id", log.getLogId())); + for (LogContent logContent : contentList) { + before.add(logContent.getId()); + } + + //更新内容 + List logContents = log.getLogContents(); + logContents.forEach(logContent -> { + if (logContent.getId()!=null){ + logContentService.updateById(logContent); + after.add(logContent.getId()); + }else { + logContent.setLogId(log.getLogId()); + logContentService.save(logContent); + } + }); + //长度变化,表示有删减 + if (before.size()!=after.size()){ + Collection differentNoDuplicate = CollectionUtil.getDifferentNoDuplicate(before, after); + logContentService.removeByIds(differentNoDuplicate); + } + + HrLog byId = logService.getById(log.getLogId()); + if (log.getDraft()==0 && byId.getVersion()<1){ + log.setDraftTime(new Date()); + log.setVersion(1); + } + + //更新为发布状态且之前状态为撤回且之前版本更新不通知,通知该平台所有存在用户 + if (log.getDraft()==0 & log.getLogId().equals(one.getLogId()) & one.getWithdraw()==1){ + //重新发布允许撤回该日志 + log.setWithdrawNum(0); + List accountIds = logService.queryAllAccount(log.getPlatformId()); + accountIds.forEach(accountId -> { + redisTemplate.opsForValue().set(accountId.toString()+log.getPlatformId(),"true"); + }); + } + } + + boolean update = logService.updateById(log); + return update ? R.ok() : R.error(); + } + +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/HrMallMarketingPromotionController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/HrMallMarketingPromotionController.java new file mode 100644 index 0000000..0dd8c1d --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/HrMallMarketingPromotionController.java @@ -0,0 +1,113 @@ +package com.huoran.nakadai.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.api.UserClient; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.nakadai.entity.HrMallMarketingPromotion; +import com.huoran.nakadai.entity.PartnerArticleManagement; +import com.huoran.nakadai.entity.req.MarketingPromotionPageReq; +import com.huoran.nakadai.service.HrMallMarketingPromotionService; +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 javax.servlet.http.HttpServletRequest; +import java.util.List; + + +/** + * @描述:控制类 + * @作者: Rong + * @日期: 2023-04-25 + */ +@RestController +@RequestMapping("/nakadai/mall/marketing/promotion") +@Api(value = ":HrMallMarketingPromotionController", tags = "R-营销推广管理") + +public class HrMallMarketingPromotionController { + + @Autowired + public HrMallMarketingPromotionService service; + @Autowired + private UserClient userClient; + + @PostMapping("/pagingQueryList") + @ApiOperation(value = "分页查询", response = HrMallMarketingPromotion.class) + public R pagingQueryList(@RequestBody MarketingPromotionPageReq req) { + Page page = new Page(req.getPageNum(), req.getPageSize()); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + if (req.getTitle() != null && !req.getTitle().equals("")) { + queryWrapper.like("title", req.getTitle()); + } + + if (req.getIsOpen() != null && !req.getIsOpen().equals("")) { + queryWrapper.eq("is_open", req.getIsOpen()); + } + queryWrapper.orderByDesc("create_time"); + IPage pagingQueryList = service.page(page, queryWrapper); + return R.ok().put("page", pagingQueryList); + } + + + @PostMapping("/findById") + @ApiOperation(value = "查询详情", response = HrMallMarketingPromotion.class) + public R findById(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { + HrMallMarketingPromotion hrMallMarketingPromotion = service.getById(id); + return R.ok().put("data", hrMallMarketingPromotion); + } + + + @PostMapping("/save") + @ApiOperation(value = "新增", response = HrMallMarketingPromotion.class) + public R save(@RequestBody @ApiParam(name = "对象", value = "传入json格式", required = true) HrMallMarketingPromotion hrMallMarketingPromotion, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + hrMallMarketingPromotion.setAccountId(Integer.valueOf(accountId)); + boolean addState = service.save(hrMallMarketingPromotion); + return addState ? R.ok() : R.error("新增失败"); + } + + + @PostMapping("/update") + @ApiOperation(value = "修改", response = HrMallMarketingPromotion.class) + public R update(@RequestBody @ApiParam(name = "对象", value = "传入json格式", required = true) HrMallMarketingPromotion hrMallMarketingPromotion, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + hrMallMarketingPromotion.setAccountId(Integer.valueOf(accountId)); + boolean updateState = service.updateById(hrMallMarketingPromotion); + return updateState ? R.ok() : R.error("编辑失败"); + } + + + @PostMapping("/delete") + @ApiOperation(value = "删除", response = HrMallMarketingPromotion.class) + public R delete(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { + boolean delState = service.removeById(id); + return delState ? R.ok() : R.error("删除失败"); + } + + @PostMapping("/batchDeletion") + @ApiOperation(value = "批量删除", response = HrMallMarketingPromotion.class) + public R batchDeletion(@ApiParam(name = "id", value = "主键", required = true) @RequestParam List ids) { + boolean delState = service.removeByIds(ids); + return delState ? R.ok() : R.error("删除失败"); + } + + + @PostMapping("/bannerEnableOrDisable") + @ApiOperation(value = "banner启用禁用", response = PartnerArticleManagement.class) + public R bannerEnableOrDisable(@ApiParam(name = "id", value = "banner id", required = true) @RequestParam Integer id, @ApiParam(name = "isDisable", value = "是否禁用(0默认,0启用 1禁用)", required = true) @RequestParam Integer isDisable) { + UpdateWrapper updateWrapper = new UpdateWrapper(); + updateWrapper.set("is_open", isDisable); + updateWrapper.eq("id", id); + boolean ret = service.update(new HrMallMarketingPromotion(), updateWrapper); + return ret ? R.ok() : R.error("禁用/启用失败"); + } + +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/HrStaffAccountArchitectureController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/HrStaffAccountArchitectureController.java new file mode 100644 index 0000000..67f00f7 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/HrStaffAccountArchitectureController.java @@ -0,0 +1,92 @@ +package com.huoran.nakadai.controller; + +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.HrStaffAccountArchitecture; +import com.huoran.nakadai.entity.req.ArchitectureAddReq; +import com.huoran.nakadai.service.HrStaffAccountArchitectureService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.*; + +/** + *

+ * 中台账号组织架构 前端控制器 + *

+ * + * @author chen + * @since 2022-03-22 + */ +@Api(tags = "中台账号组织架构") +@RestController +@RequestMapping("/nakadai/staffAccountArchitecture") +public class HrStaffAccountArchitectureController { + + @Autowired + public HrStaffAccountArchitectureService architectureService; + + /** + * 新增中台组织架构 + */ + @PostMapping("/save") + @ApiOperation(value = "新增中台组织架构") + public R save(@RequestBody @Valid ArchitectureAddReq architectureAddReq) { + + if (architectureAddReq.getLevel() > 6) { + return R.error("暂不支持" + architectureAddReq.getLevel() + "层级"); + } + HrStaffAccountArchitecture architecture = new HrStaffAccountArchitecture(); + BeanUtils.copyProperties(architectureAddReq, architecture); + + boolean ok = architectureService.checkRepeat(architecture); + if (ok) { + return R.error("同级下已存在相同的名称:" + architectureAddReq.getOrganizationName()); + } + boolean save = architectureService.save(architecture); + return save ? R.ok().put("id", architecture.getId()) : R.error(); + + } + + /** + * 编辑中台组织架构 + */ + @PostMapping("/update") + @ApiOperation(value = "编辑中台组织架构") + public R update(@RequestBody @Valid HrStaffAccountArchitecture architecture) { + boolean ok = architectureService.checkRepeat(architecture); + if (ok) { + return R.error("同级下已存在相同的名称:" + architecture.getOrganizationName()); + } else { + boolean update = architectureService.updateById(architecture); + return update ? R.ok() : R.error(); + } + } + + /** + * 删除组织架构 + */ + @PostMapping("/delete") + @ApiOperation(value = "删除中台组织架构") + public R delete(@ApiParam(name = "id", value = "架构id", required = true) @RequestParam Integer id) { + //级联删除子部门 + boolean remove = architectureService.removeOrganization(id); + return remove ? R.ok() : R.error(); + } + + /** + * 中台组织架构树形列表 + */ + @PostMapping("/treeList") + @ApiOperation(value = "中台组织架构树形列表", response = HrStaffAccountArchitecture.class) + public R treeList() { + List list = architectureService.treeList(); + return R.ok().put("treeList", list); + } + +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/HrStaffController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/HrStaffController.java new file mode 100644 index 0000000..2b1f461 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/HrStaffController.java @@ -0,0 +1,106 @@ +package com.huoran.nakadai.controller; + + +import com.huoran.common.response.R; + +import com.huoran.nakadai.entity.req.StaffAddReq; +import com.huoran.nakadai.entity.req.StaffListReq; +import com.huoran.nakadai.entity.req.StaffUpdateReq; +import com.huoran.nakadai.entity.res.StaffResp; +import com.huoran.nakadai.service.HrStaffService; +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 org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; + +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + *

+ * 中台后台员工账号表 前端控制器 + *

+ * + * @author chen + * @since 2022-03-22 + */ +@Api(tags = "中台后台员工账号") +@RestController +@RequestMapping("/nakadai/backstageStaff") +public class HrStaffController { + + @Autowired + public HrStaffService staffService; + + /** + * 新增员工 + */ + @PostMapping("/saveStaff") + @ApiOperation(value = "新增员工") + public R saveStaff(@RequestBody @Valid StaffAddReq staffReq) throws Exception { + return staffService.saveStaff(staffReq); + } + + /** + * 员工列表 + */ + @PostMapping("/staffList") + @ApiOperation(value = "员工列表", response = StaffResp.class) + public R staffList(@RequestBody @Valid StaffListReq req) { + return staffService.pageStaffList(req); + } + + /** + * 员工详情 + */ + @GetMapping("/staffDetail") + @ApiOperation(value = "员工详情", response = StaffResp.class) + public R staffDetail(@ApiParam(name = "accountId", value = "员工账号id") @RequestParam Integer accountId) { + return staffService.staffDetail(accountId); + } + + /** + * 编辑员工 + */ + @PostMapping("/modifyStaff") + @ApiOperation(value = "编辑员工") + public R modifyStaff(@RequestBody @Valid StaffUpdateReq updateReq) { + return staffService.modifyStaff(updateReq); + } + + /** + * 删除员工 + */ + @PostMapping("/delStaff") + @ApiOperation(value = "删除员工") + public R delStaff(@ApiParam(name = "accountIds", value = "要删除的账号id") @RequestParam List accountIds) { + return staffService.delStaff(accountIds); + } + + /** + * 批量导入员工 + */ + @PostMapping("/importStaff") + @ApiOperation("批量导入员工") + public R importStaff(@RequestParam(name = "file") MultipartFile file, HttpServletRequest request) throws IOException { + Map map = staffService.importStaff(file); + return R.ok().put("data", map); + } + + /** + * 批量导入员工失败数据导出 + */ + @ApiOperation(value = "批量导入员工失败数据导出") + @GetMapping("/exportFailure") + public void exportFailureRecord(HttpServletResponse response, @ApiParam(name = "exportCode", value = "importQuestion接口返回的exportCode", required = true) @RequestParam String exportCode) throws Exception { + staffService.exportFailureRecord(response, exportCode); + } +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/HrStaffDepartmentController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/HrStaffDepartmentController.java new file mode 100644 index 0000000..3034c8b --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/HrStaffDepartmentController.java @@ -0,0 +1,23 @@ +package com.huoran.nakadai.controller; + + +import io.swagger.annotations.Api; +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 前端控制器 + *

+ * + * @author chen + * @since 2022-03-23 + */ +@Api(tags = "员工部门") +@RestController +@RequestMapping("/nakadai/staffDepartment") +public class HrStaffDepartmentController { + +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/LogContentController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/LogContentController.java new file mode 100644 index 0000000..bc0d0a0 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/LogContentController.java @@ -0,0 +1,21 @@ +package com.huoran.nakadai.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 前端控制器 + *

+ * + * @author chen + * @since 2022-03-08 + */ +@RestController +@RequestMapping("/nakadai/log-content") +public class LogContentController { + +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/MallAnnexController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/MallAnnexController.java new file mode 100644 index 0000000..0965ce5 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/MallAnnexController.java @@ -0,0 +1,21 @@ +package com.huoran.nakadai.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 商品附件表 前端控制器 + *

+ * + * @author chen + * @since 2023-05-06 + */ +@RestController +@RequestMapping("/mall-annex") +public class MallAnnexController { + +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/MallClassificationController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/MallClassificationController.java new file mode 100644 index 0000000..fd94ede --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/MallClassificationController.java @@ -0,0 +1,20 @@ +package com.huoran.nakadai.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 商品分类关联表 前端控制器 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@RestController +@RequestMapping("/mallClassification") +public class MallClassificationController { + +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/MallController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/MallController.java new file mode 100644 index 0000000..5207e63 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/MallController.java @@ -0,0 +1,215 @@ +package com.huoran.nakadai.controller; + + +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.api.UserClient; +import com.huoran.common.exception.CustomException; +import com.huoran.common.exception.ExceptionEnum; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.nakadai.entity.*; +import com.huoran.nakadai.entity.req.GoodsListReq; +import com.huoran.nakadai.entity.res.GoodsRes; +import com.huoran.nakadai.entity.vo.GoodsVo; +import com.huoran.nakadai.mapper.CurriculumMapper; +import com.huoran.nakadai.mapper.DataProductMapper; +import com.huoran.nakadai.service.MallClassificationService; +import com.huoran.nakadai.service.MallService; +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.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import java.util.Date; +import java.util.List; +import java.util.concurrent.ExecutionException; +import java.util.stream.Collectors; + +/** + *

+ * 商城管理表 前端控制器 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@Api(value = "M-商城商品管理", tags = "M-商城商品管理") +@RestController +@RequestMapping("/mall") +public class MallController { + + @Autowired + private MallService mallService; + + @Autowired + private MallClassificationService mallClassificationService; + + @Autowired + private CurriculumMapper curriculumMapper; + + @Autowired + private DataProductMapper dataProductMapper; + + @Autowired + private UserClient userClient; + + @ApiOperation(value = "添加商品") + @PostMapping("/addGoods") + public R addGoods( + @ApiParam(name = "goodsVo", value = "商品数据", required = true) + @RequestBody @Valid GoodsVo goodsVo, HttpServletRequest request) throws ExecutionException, InterruptedException { + String accountId = TokenUtils.getIdByJwtToken(request); + goodsVo.getMall().setAccountId(accountId); + //保存上架时间 + if (goodsVo.getMall().getState()==0){ + goodsVo.getMall().setShelfTime(new Date()); + } + return mallService.addGoods(goodsVo); + } + + @ApiOperation(value = "商品列表", response = GoodsRes.class) + @PostMapping("/listOfGoods") + public R listOfGoods( + @ApiParam(name = "orderListReq", value = "查询条件", required = true) + @RequestBody GoodsListReq goodsListReq,HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + goodsListReq.setSchoolId(schoolId); + return mallService.listOfGoods(goodsListReq); + } + + @ApiOperation(value = "职站商城", response = GoodsRes.class) + @PostMapping("/stationShoppingMall") + public R stationShoppingMall( + @ApiParam(name = "orderListReq", value = "查询条件", required = true) + @RequestBody GoodsListReq goodsListReq) { + return mallService.stationShoppingMall(goodsListReq); + } + + @GetMapping("/schoolGoods") + @ApiOperation(value = "获取学校购买订单后的商品id") + public List schoolGoods(HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + return mallService.schoolGoods(schoolId); + } + + @ApiOperation(value = "商品详情") + @GetMapping("/detailsOfGoods") + public R detailsOfGoods( + @ApiParam(name = "mallId", value = "商品id", required = true) + @RequestParam @Valid @NotNull Integer mallId,@RequestHeader(required = false) String token) { + GoodsVo goodsDetails = mallService.detailsOfGoods(mallId,token); + return R.ok().put("orderDetails", goodsDetails); + } + + + @ApiOperation(value = "商品上下架") + @PostMapping("/goodsOffTheShelf") + @Transactional +// @CacheEvict(value = "n_listOfGoods", allEntries = true) + public R goodsOffTheShelf( + @ApiParam(name = "mallId", value = "商品id", required = true) + @RequestParam Integer mallId, + @ApiParam(name = "isShelves", value = "上下架(1下架 0上架 默认0)", required = true) + @RequestParam Integer isShelves, + HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Mall mall = mallService.getById(mallId); + + //关联了课程产品并上架 + if (mall.getIsAssociatedProduct()==0 && isShelves==0){ + + List classifications = mallClassificationService.list(new QueryWrapper().eq("mall_id", mallId)); + List classificationIds = classifications.stream().map(MallClassification::getClassificationId).collect(Collectors.toList()); + + if (classificationIds.contains(1)||classificationIds.contains(2)){ + //查询课程 + Curriculum curriculum = curriculumMapper.selectById(mall.getAssociatedProduct()); + if (ObjectUtil.isNull(curriculum)){ + throw new CustomException(ExceptionEnum.COURSE_PRODUCTS_HAVE_BEEN_REMOVED); + }else { + if (curriculum.getIsShelves()==0){ + throw new CustomException(ExceptionEnum.COURSE_PRODUCTS_HAVE_BEEN_REMOVED_FROM_SALE); + } + } + //关联了数据平台 + }else if (classificationIds.contains(5)){ + DataProduct dataProduct = dataProductMapper.selectById(mall.getAssociatedProduct()); + if (ObjectUtil.isNull(dataProduct)){ + throw new CustomException(ExceptionEnum.DATA_PRODUCTS_HAVE_BEEN_REMOVED); + }else { + if (dataProduct.getStatus()==0){ + throw new CustomException(ExceptionEnum.DATA_PRODUCTS_HAVE_BEEN_REMOVED_FROM_SALE); + } + } + } + } + + if (isShelves==0){ + mall.setShelfTime(new Date()); + } + + boolean ret = mallService.updateById(mall.setIsShelves(isShelves).setAccountId(accountId).setState(isShelves)); + return ret ? R.ok() : R.error(); + } + + @ApiOperation(value = "商品精选") + @PostMapping("/goodsSelection") +// @CacheEvict(value = "n_listOfGoods", allEntries = true) + public R goodsSelection( + @ApiParam(name = "mallId", value = "商品id", required = true) + @RequestParam Integer mallId, + @ApiParam(name = "selected", value = "0不精选,1为精选 默认0", required = true) + @RequestParam Integer selected, + HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Mall mall = mallService.getById(mallId); + boolean ret = mallService.updateById(mall.setSelected(selected).setAccountId(accountId)); + return ret ? R.ok() : R.error(); + } + + @ApiOperation(value = "删除商品") + @PostMapping("/deletionOfGoods") + public R deletionOfGoods( + @ApiParam(name = "mallId", value = "商品id", required = true) + @RequestBody Integer mallId) { + boolean delete = mallService.deletionOfGoods(mallId); + return delete ? R.ok() : R.error(); + } + + @ApiOperation(value = "更新商品") + @PostMapping("/renewalOfGoods") + public R renewalOfGoods( + @ApiParam(name = "goodsVo", value = "商品数据", required = true) + @RequestBody @Valid GoodsVo goodsVo,HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + goodsVo.getMall().setAccountId(accountId); + boolean update = mallService.renewalOfGoods(goodsVo); + return update ? R.ok() : R.error(); + } + + @ApiOperation(value = "解决方案分类-商品") + @GetMapping("/goodsSchemeClassification") + public R goodsSchemeClassification() { + List list = mallService.goodsSchemeClassification(); + return R.ok().put("data", list); + } + + @ApiOperation(value = "或然官网-商品列表",response = GoodsRes.class) + @PostMapping("/websiteProductList") + public R websiteProductList( + @ApiParam(name = "orderListReq", value = "查询条件", required = true) + @RequestBody GoodsListReq goodsListReq) { + return mallService.websiteProductList(goodsListReq); + } + + +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/MallCourseLearningRecordController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/MallCourseLearningRecordController.java new file mode 100644 index 0000000..d04363f --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/MallCourseLearningRecordController.java @@ -0,0 +1,61 @@ +package com.huoran.nakadai.controller; + + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.api.UserClient; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.nakadai.entity.MallCourseLearningRecord; +import com.huoran.nakadai.service.MallCourseLearningRecordService; +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.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletRequest; + +/** + *

+ * 商品课程学习记录 前端控制器 + *

+ * + * @author chen + * @since 2023-04-26 + */ +@Api(value = "M-商品课程学习记录", tags = "M-商品课程学习记录") +@RestController +@RequestMapping("/mallCourseLearningRecord") +public class MallCourseLearningRecordController { + + @Autowired + private MallCourseLearningRecordService recordService; + + @Autowired + private UserClient userClient; + + @ApiOperation(value = "添加学习记录(进入实验调用)") + @PostMapping("/addLearningRecord") + public R addLearningRecord( + @ApiParam(name = "mallId", value = "商品id", required = true) + @RequestParam Integer mallId, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + //查询记录,进入过实验,下次进入不再记录数据 + MallCourseLearningRecord one = recordService.getOne(new QueryWrapper(). + eq("mall_id", mallId).eq("account_id", accountId)); + if (one==null){ + MallCourseLearningRecord record = new MallCourseLearningRecord(); + record.setMallId(mallId); + record.setAccountId(Integer.valueOf(accountId)); + record.setSchoolId(schoolId); + recordService.save(record); + } + return R.ok(); + } + +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/MallDisciplineController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/MallDisciplineController.java new file mode 100644 index 0000000..0af4efb --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/MallDisciplineController.java @@ -0,0 +1,41 @@ +package com.huoran.nakadai.controller; + + +import com.huoran.common.response.R; +import com.huoran.nakadai.service.MallDisciplineService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +/** + *

+ * 商品学科类别关联表 前端控制器 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@Api(value = "M-商城商品学科类别管理", tags = "M-商城商品学科类别管理") +@RestController +@RequestMapping("/mallDiscipline") +public class MallDisciplineController { + + @Autowired + private MallDisciplineService mallDisciplineService; + + /** + * 批量导入学科类别 + */ + @PostMapping("/importSubjectCategoriesInBatches") + @ApiOperation("批量导入学科类别") + public R importSubjectCategoriesInBatches(@RequestParam(name = "file") MultipartFile file) { + return mallDisciplineService.importSubjectCategoriesInBatches(file); + } + +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/MallNonAssociatedLinksController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/MallNonAssociatedLinksController.java new file mode 100644 index 0000000..d1963e7 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/MallNonAssociatedLinksController.java @@ -0,0 +1,21 @@ +package com.huoran.nakadai.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 非关联产品链接 前端控制器 + *

+ * + * @author chen + * @since 2023-05-15 + */ +@RestController +@RequestMapping("/mall-non-associated-links") +public class MallNonAssociatedLinksController { + +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/MallPriceController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/MallPriceController.java new file mode 100644 index 0000000..36b2b20 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/MallPriceController.java @@ -0,0 +1,76 @@ +package com.huoran.nakadai.controller; + + +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.MallPrice; +import com.huoran.nakadai.service.MallPriceService; +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.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 商品价格表 前端控制器 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@Api(value = "M-商城商品价格管理", tags = "M-商城商品价格管理") +@RestController +@RequestMapping("/mallPrice") +public class MallPriceController { + + @Autowired + private MallPriceService mallPriceService; + + @ApiOperation(value = "查询商品所在省份城市结算价",response = MallPrice.class) + @PostMapping("/queryCitySettlementPrice") + public R queryCitySettlementPrice( + @ApiParam(name = "provinceId", value = "省份id", required = true) + @RequestParam Integer provinceId, + @ApiParam(name = "cityId", value = "城市id", required = true) + @RequestParam Integer cityId, + @ApiParam(name = "mallId", value = "商品id", required = true) + @RequestParam Integer mallId) { + QueryWrapper cityPriceQueryWrapper = new QueryWrapper<>(); + cityPriceQueryWrapper.eq("settlement_price_type",1) + .eq("mall_id",mallId) + .eq("city_id",cityId); + //查询城市价格,没有查询省份 + MallPrice one = mallPriceService.getOne(cityPriceQueryWrapper); + if (ObjectUtil.isNotNull(one)){ + return R.ok().put("mallPrice",one); + } + //查询省份价格,没有查询平台价 + QueryWrapper provinceQueryWrapper = new QueryWrapper<>(); + provinceQueryWrapper.eq("settlement_price_type",1) + .eq("mall_id",mallId) + .eq("area",provinceId); + MallPrice two = mallPriceService.getOne(provinceQueryWrapper); + if (ObjectUtil.isNotNull(two)){ + return R.ok().put("mallPrice",two); + } + //查询平台价 + QueryWrapper platformQueryWrapper = new QueryWrapper<>(); + platformQueryWrapper.eq("settlement_price_type",1) + .eq("mall_id",mallId) + .eq("area",0); + MallPrice three = mallPriceService.getOne(platformQueryWrapper); + if (ObjectUtil.isNotNull(three)){ + return R.ok().put("mallPrice",three); + }else { + return R.error("该商品还未设置平台结算价,联系管理员设置价格再下订单!"); + } + + } + +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/MallSupplierController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/MallSupplierController.java new file mode 100644 index 0000000..cdb517c --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/MallSupplierController.java @@ -0,0 +1,21 @@ +package com.huoran.nakadai.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 商品供应商关联表 前端控制器 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@RestController +@RequestMapping("/mallSupplier") +public class MallSupplierController { + +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/MallTagsController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/MallTagsController.java new file mode 100644 index 0000000..7b80e13 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/MallTagsController.java @@ -0,0 +1,21 @@ +package com.huoran.nakadai.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 商品分类标签关联表 前端控制器 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@RestController +@RequestMapping("/mallTags") +public class MallTagsController { + +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/MallTypeController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/MallTypeController.java new file mode 100644 index 0000000..02b5393 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/MallTypeController.java @@ -0,0 +1,21 @@ +package com.huoran.nakadai.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 商品类型关联表 前端控制器 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@RestController +@RequestMapping("/mallType") +public class MallTypeController { + +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/MessageController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/MessageController.java new file mode 100644 index 0000000..5879ae9 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/MessageController.java @@ -0,0 +1,99 @@ +package com.huoran.nakadai.controller; + +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.nakadai.service.MessageService; +import com.huoran.websocket.model.dto.WebsocketMsgDTO; +import com.huoran.websocket.model.vo.SendMsgVO; +import com.huoran.websocket.service.WebsocketService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.apache.commons.lang3.StringUtils; +import org.springframework.amqp.core.AmqpAdmin; +import org.springframework.amqp.core.DirectExchange; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; + +@Api(value = "或然中台消息管理", tags = "或然中台消息管理") +@RestController +@RequestMapping("/message") +public class MessageController { + + @Autowired + private AmqpAdmin amqpAdmin; + + @Autowired + private MessageService messageService; + + @Autowired + private WebsocketService webSocketService; + + @ApiOperation(value = "所有在线用户接收消息通知",response = SendMsgVO.class) + @PostMapping("/refreshPageNotification") + public void refreshPageNotification( + @ApiParam(name = "username", value = "发送者名称", required = false) + @RequestParam(required = false) String username, + @ApiParam(name = "to", value = "发给谁(默认发送给所有在线用户)", required = false) + @RequestParam(required = false) String to, + @ApiParam(name = "content", value = "消息通知", required = false) + @RequestParam(required = false) String content) { + WebsocketMsgDTO websocketMsgDTO = new WebsocketMsgDTO(); + websocketMsgDTO.setForm("系统消息"); + if (StringUtils.isEmpty(username)){ + websocketMsgDTO.setUsername("系统通知机器人"); + }else { + websocketMsgDTO.setUsername(username); + } + if (StringUtils.isEmpty(to)){ + websocketMsgDTO.setTo("all"); + }else { + websocketMsgDTO.setTo(to); + } + if (StringUtils.isEmpty(content)){ + websocketMsgDTO.setContent("refresh"); + }else { + websocketMsgDTO.setContent(content); + } + websocketMsgDTO.setExtras(null); + webSocketService.send(websocketMsgDTO); + } + + /** + * 发送指定的用户队列 + */ + @ApiOperation(value = "发送消息给指定的用户") + @GetMapping("/sendMessageToUser") + public void sendMessageToUser(String message, String accountId) { + messageService.sendMessageToUser(message,accountId); + } + + + @ApiOperation(value = "接收消息") + @GetMapping("/receiveMessages") + public R receiveMessages(HttpServletRequest request,Long deliveryTag) { + String accountId = TokenUtils.getIdByJwtToken(request); + return messageService.messagesListener(accountId,deliveryTag); + } + + + + @ApiOperation(value = "创建交换机") + @GetMapping("/creatExchange") + public void creatExchange( + @ApiParam(name = "exchangeName", value = "交换机名称", required = true) + @RequestParam String exchangeName) { + DirectExchange directExchange = new DirectExchange(exchangeName,true,false); + amqpAdmin.declareExchange(directExchange); + } + + + @ApiOperation(value = "创建队列") + @GetMapping("/createQueue") + public void createQueue(String accountId) { + messageService.createQueue(accountId); + } + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/ModelDemoHiddenController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/ModelDemoHiddenController.java new file mode 100644 index 0000000..4bde5ef --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/ModelDemoHiddenController.java @@ -0,0 +1,72 @@ +package com.huoran.nakadai.controller; + + +import com.huoran.api.UserClient; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.nakadai.entity.ModelDemoHidden; +import com.huoran.nakadai.service.ModelDemoHiddenService; +import com.huoran.nakadai.service.ModelReferenceDemoService; +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.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + *

+ * 此表是在教师端系统管理,可对于系统内置模型统一管理 前端控制器 + *

+ * + * @author chen + * @since 2023-06-03 + */ +@RestController +@RequestMapping("/model/demo/hidden") + +@Api(value = "API - 中台:教师端可对于系统内置模型统一管理", tags = "中台:教师端可对于系统内置模型统一管理") +public class ModelDemoHiddenController { + @Autowired + private UserClient userClient; + @Autowired + public ModelDemoHiddenService service; + + @PostMapping("/batchShutdown") + @ApiOperation(value = "批量关闭(用于教师端读取系统内置模型—关闭模型) 集合传的是模型id") + public R delete(@RequestBody List ids, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + for (Integer modelId : ids) { + ModelDemoHidden details = service.viewDetails(modelId, schoolId); + if (details==null){ + ModelDemoHidden hidden = new ModelDemoHidden(); + hidden.setModelId(modelId); + hidden.setIsClose(1); + hidden.setSchoolId(schoolId); + service.save(hidden); + } + } + return R.ok(); + } + + @PostMapping("/batchOpen") + @ApiOperation(value = "批量打开(用于教师端读取系统内置模型—打开模型) 集合传的是模型id") + public R batchOpen(@RequestBody List ids, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + for (Integer modelId : ids) { + ModelDemoHidden hidden = service.viewDetails(modelId, schoolId); + service.removeById(hidden.getId()); + } + return R.ok(); + } + +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/ModelReferenceCategoryController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/ModelReferenceCategoryController.java new file mode 100644 index 0000000..7c6a771 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/ModelReferenceCategoryController.java @@ -0,0 +1,122 @@ +package com.huoran.nakadai.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.api.UserClient; +import com.huoran.common.constant.DelConstant; +import com.huoran.common.constant.ModellConstant; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.nakadai.entity.ModelReferenceCategory; +import com.huoran.nakadai.entity.ModelSysCategory; +import com.huoran.nakadai.service.ModelReferenceCategoryService; +import com.huoran.nakadai.service.ModelSysCategoryService; +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.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + *

+ * 引用模型-分类表 前端控制器 + *

+ * + * @author chen + * @since 2022-03-04 + */ +@RestController +@RequestMapping("/nakadai/model/reference") +@Api(value = "API - 中台:ModelReferenceCategoryController", tags = "中台:模型分类") +public class ModelReferenceCategoryController { + @Autowired + private UserClient userClient; + @Autowired + public ModelReferenceCategoryService service; + + @PostMapping("/saveReferenceCategory") + @ApiOperation(value = "新增模型分类") + public R saveReferenceCategory(@RequestBody @Validated ModelReferenceCategory modelSysCategory, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + modelSysCategory.setAccountId(Integer.valueOf(accountId)); + if (modelSysCategory.getFounder() == ModellConstant.SOURCE_INSTITUTION) { + //创建来源为院校时候赋值学校id + modelSysCategory.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); + } else { + + } + boolean checkRepeat = service.checkRepeat(modelSysCategory, 0); + if (checkRepeat) { + return R.error("该层级下已有重复的分类名称了!"); + } + boolean ret = service.save(modelSysCategory); + return ret ? R.ok().put("referenceCategoryId", modelSysCategory.getId()) : R.error(); + } + + @PostMapping("/modelClassList") + @ApiOperation(value = "模型分类列表(中台、职站教师端通用)") + public R modelClassList(@RequestParam("systemId") @ApiParam(value = "系统id") Integer systemId + , @RequestParam("founder") @ApiParam(value = "创建人来源(0、系统 1、院校)") Integer founder, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = null; + if (founder == ModellConstant.SOURCE_INSTITUTION) { + //创建来源为院校时候赋值学校id + schoolId = userClient.getSchoolIdByAccountId(accountId); + } + + List list = service.modelClassList(systemId, founder, schoolId); + return R.ok().put("data", list); + } + + + @PostMapping("/builtInClassificationByNakadai") + @ApiOperation(value = "职站源模型—(读取的是中台引用模型分类表的数据)") + public R builtInClassificationByOccupationlab(@RequestParam("systemId") @ApiParam(value = "系统id") Integer systemId, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + List list = service.builtInClassificationByNakadai(systemId); + return R.ok().put("data", list); + } + + + @PostMapping("/deleteModelClass") + @ApiOperation(value = "删除模型分类") + public R deleteModelClass(@RequestParam("categoryId") @ApiParam(value = "分类id") Integer categoryId) { + return service.deleteModelClass(categoryId); + } + + @PostMapping("/updateModelClass") + @ApiOperation(value = "编辑模型分类") + public R updateModelClass(@RequestBody ModelReferenceCategory modelSysCategory, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + modelSysCategory.setAccountId(Integer.valueOf(accountId)); + boolean checkRepeat = service.checkRepeat(modelSysCategory, 1); + if (checkRepeat) { + return R.error("该层级下已有重复的分类名称了!"); + } + boolean ret = service.updateById(modelSysCategory); + return ret ? R.ok() : R.error(); + } + + @PostMapping("/checkIsShowBySystemId") + @ApiOperation(value = "根据系统id查询模型是否展示", response = ModelReferenceCategory.class) + public R checkIsShowBySystemId(@RequestParam("systemId") @ApiParam(value = "系统id") Integer systemId) { + return service.checkIsShowBySystemId(systemId); + } + + /*@PostMapping("/modifyIsShowState") + @ApiOperation(value = "更改内置模型按钮前台展示") + public R modifyIsShowState(@RequestParam("systemId") @ApiParam(value = "系统id") Integer systemId, + @RequestParam("isShow") @ApiParam(value = "是否展示->默认0为展示 1为不展示") Integer isShow) { + return service.modifyIsShowState(systemId, isShow); + }*/ + + + + + + +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/ModelReferenceDemoController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/ModelReferenceDemoController.java new file mode 100644 index 0000000..81add18 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/ModelReferenceDemoController.java @@ -0,0 +1,271 @@ +package com.huoran.nakadai.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.api.UserClient; +import com.huoran.common.constant.ModellConstant; +import com.huoran.common.constant.PlatformConstant; +import com.huoran.common.entity.PythonCodeResp; +import com.huoran.common.exception.CustomException; +import com.huoran.common.exception.ExceptionEnum; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.nakadai.entity.ModelReferenceDemo; +import com.huoran.nakadai.entity.ModelSysCategory; +import com.huoran.nakadai.entity.ModelSysDemo; +import com.huoran.nakadai.entity.req.PageImportModelReq; +import com.huoran.nakadai.entity.req.PageModelReq; +import com.huoran.nakadai.entity.req.PythonCodeRunReq; +import com.huoran.nakadai.entity.res.ModeCategoryResp; +import com.huoran.nakadai.service.ModelReferenceDemoService; +import com.huoran.nakadai.service.ModelSysCategoryService; +import com.huoran.nakadai.service.ModelSysDemoService; +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.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +/** + *

+ * 引用模型代码记录表 前端控制器 + *

+ * + * @author chen + * @since 2022-03-04 + */ +@RestController +@RequestMapping("/nakadai/model/reference/demo") +@Api(value = "API - 中台:ModelReferenceDemoController", tags = "中台:模型代码记录") +public class ModelReferenceDemoController { + + @Autowired + private UserClient userClient; + @Autowired + public ModelReferenceDemoService service; + + + @Autowired + public ModelSysCategoryService sysCategoryService; + @Autowired + public ModelSysDemoService sysDemoService; + + @PostMapping("/saveReferenceDemo") + @ApiOperation(value = "导入模型") + public R saveReferenceDemo(@RequestBody @Validated List listReference, HttpServletRequest request) { + + if (listReference.size() <= 0) { + //当前选择的分类下的没有满足条件的模型! + throw new CustomException(ExceptionEnum.CLASSIFICATION_HAS_NO_MODEL_DATA); + } + + String accountId = TokenUtils.getIdByJwtToken(request); + String roleName = userClient.getUserAllRole(accountId, PlatformConstant.NAKADAI);//获取当前用户的角色 + Integer count = 0; + for (ModelReferenceDemo referenceDemo : listReference) { + referenceDemo.setModifyAccountId(Integer.valueOf(accountId)); + if (roleName != null) { + referenceDemo.setSchoolId(0); + referenceDemo.setFounder(0); + } else { + referenceDemo.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); + referenceDemo.setFounder(1); + } + + + referenceDemo.setAccountId(Integer.valueOf(accountId)); + boolean ret = service.save(referenceDemo); + if (ret) { + count++; + } + } + return count == listReference.size() ? R.ok() : R.error(); + } + + + @PostMapping("/save") + @ApiOperation(value = "新增源模型分类") + public R save(@RequestBody @Validated ModelReferenceDemo modelSysCategory, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + modelSysCategory.setAccountId(Integer.valueOf(accountId)); + modelSysCategory.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); + modelSysCategory.setModifyAccountId(Integer.valueOf(accountId)); + if (modelSysCategory.getFounder() == ModellConstant.SOURCE_INSTITUTION) { + //创建来源为院校时候赋值学校id + modelSysCategory.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); + } + + boolean ret = service.save(modelSysCategory); + return ret ? R.ok() : R.error(); + } + + + @PostMapping("/findById") + @ApiOperation(value = "根据主键查询", response = ModelReferenceDemo.class) + public R findById(@RequestParam("id") @ApiParam(value = "序号") Integer id) { + ModelReferenceDemo referenceDemo = service.getById(id); + ModelSysDemo modelSysDemo = sysDemoService.getById(referenceDemo.getCopyId()); + referenceDemo.setModelName(modelSysDemo.getModelName()); + referenceDemo.setModelDemo(modelSysDemo.getModelDemo()); + return R.ok().put("data", referenceDemo); + } + + @PostMapping("/referenceDemoList") + @ApiOperation(value = "模型列表", response = ModelReferenceDemo.class) + public R listByEntity(@RequestBody @Validated PageModelReq req, HttpServletRequest request) { + return service.referenceDemoList(req); + } + + @PostMapping("/sortReadingModelByTeacherSideSystem") + @ApiOperation(value = "教师端——依据分类读取系统模型", response = ModelReferenceDemo.class) + public R sortReadingModelByTeacherSideSystem(@RequestBody @Validated PageModelReq req, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + req.setSchoolId(schoolId); + return service.sortReadingModelByTeacherSideSystem(req); + } + + + @PostMapping("/referenceDemoListByNakadai") + @ApiOperation(value = "职站——系统内置模型列表(读取自中台的引用且启用的模型)", response = ModelReferenceDemo.class) + public R referenceDemoListByOccupationlab(@RequestBody PageModelReq req, HttpServletRequest request) { + return service.referenceDemoListByNakadai(req); + } + + @PostMapping("/deleteReferenceDemo") + @ApiOperation(value = "批量移除") + public R delete(@RequestBody List ids) { + boolean ret = service.removeByIds(ids); + return ret ? R.ok() : R.error(); + } + + @PostMapping("/delModelInfoBySystemId") + @ApiOperation(value = "同步模型前删除原有数据") + public R delModelInfoBySystemId(@RequestParam("systemId") @ApiParam(value = "系统id") Integer systemId, + @RequestParam("founder") @ApiParam(value = "创建人来源(0、系统 1、院校)") Integer founder, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + if (founder == ModellConstant.SOURCE_SYSTEM) { + schoolId = null; + } + return service.delModelInfoBySystemId(systemId, founder, schoolId); + } + + + @PostMapping("/getAllModelList") + @ApiOperation(value = "查询全部模型列表", response = ModelReferenceDemo.class) + public R getAllModelList(@RequestBody @Validated PageImportModelReq req, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + String roleName = userClient.getUserAllRole(accountId, PlatformConstant.NAKADAI);//获取当前用户的角色 + if (req.getFounder() == ModellConstant.SOURCE_SYSTEM) { + req.setIsAdmin(1); + } else { + if (roleName != null) { + req.setIsAdmin(1); + } else { + req.setIsAdmin(0); + if (req.getIsAdmin() == 0) { + req.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); + } + + } + } + + return service.getAllModelList(req); + } + + + @PostMapping("/teacherModelList") + @ApiOperation(value = "教师端模型列表", response = ModelReferenceDemo.class) + public R teacherModelList(@RequestBody @Validated PageImportModelReq req, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + req.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); + return service.teacherModelList(req); + } + + + @PostMapping("systemModelByTeacher") + @ApiOperation(value = "教师端——读取系统模型(该系统模型为中台的模型列表)", response = ModelReferenceDemo.class) + public R systemModelByTeacher(@RequestBody @Validated PageImportModelReq req, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + req.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); + return service.systemModelByTeacher(req); + } + + + @PostMapping("/synchronizationMdel") + @ApiOperation(value = "中台同步模型至引用模型(模型列表)") + public R synchronizationMdel(@RequestParam("systemId") @ApiParam(value = "系统id") Integer systemId, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + return service.synchronizationMdel(systemId, Integer.valueOf(accountId)); + } + + + @PostMapping("/synchronizationMdelByOccupationlab") + @ApiOperation(value = "职站同步模型至引用模型(模型列表)") + public R synchronizationMdelByOccupationlab(@RequestParam("systemId") @ApiParam(value = "系统id") Integer systemId, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + return service.synchronizationMdelByOccupationlab(systemId, schoolId, Integer.valueOf(accountId)); + } + + + /*@PostMapping("/mergeModel") + @ApiOperation(value = "合并模型") + public R mergeModel(@RequestBody @Validated List modeCategoryRespList, HttpServletRequest request) { + + if (modeCategoryRespList.size() <= 0) { + //当前选择的分类下的没有满足条件的模型! + throw new CustomException(ExceptionEnum.CLASSIFICATION_HAS_NO_MODEL_DATA); + } + + return R.ok(); + } +*/ + + + + /*@ApiOperation("根据分类id查询该分类下的所有子分类id") + @PostMapping("/selectCategoryChildById") + public String selectCategoryChildById(Integer id) { + + //1 创建list集合,用于封装所有删除菜单id值 + List idList = new ArrayList<>(); + //2 向idList集合设置删除菜单id + this.selectCategoryChildById(id + "", idList);//找到当前菜单的子菜单 把结果id封装到idlist里面去 + //把当前id封装到list里面 + idList.add(id);//现在把当前id封装进去 之前都是子菜单的id + String str = ""; + for (Integer idstr : idList) { + str += idstr + ","; + } + return str.substring(0, str.length()-1); + } + + //2 根据当前菜单id,查询菜单里面子菜单id,封装到list集合 + public void selectCategoryChildById(String id, List idList) { + //查询菜单里面子菜单id + QueryWrapper wrapper = new QueryWrapper(); + wrapper.eq("founder", 1); + wrapper.eq("school_id", id); + wrapper.eq("is_del", 0); + + wrapper.select("id");//我们只想查询id 所以只需要查询指定列的值 + List childIdList = sysCategoryService.list(wrapper);//当前菜单的所有子菜单 + //把childIdList里面菜单id值获取出来,封装idList里面,做递归查询 + childIdList.stream().forEach(item -> {//遍历集合得到每一个对象item + //封装idList里面 + idList.add(item.getId()); + //递归查询 + this.selectCategoryChildById(item.getId() + "", idList); + }); + }*/ + + +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/ModelSysCategoryController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/ModelSysCategoryController.java new file mode 100644 index 0000000..73f0849 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/ModelSysCategoryController.java @@ -0,0 +1,153 @@ +package com.huoran.nakadai.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.api.UserClient; +import com.huoran.common.constant.DelConstant; +import com.huoran.common.constant.ModellConstant; +import com.huoran.common.utils.TokenUtils; +import com.huoran.nakadai.entity.Customer; +import com.huoran.nakadai.entity.ModelReferenceCategory; +import com.huoran.nakadai.entity.ModelSysCategory; +import com.huoran.nakadai.entity.ModelSysDemo; +import com.huoran.nakadai.entity.req.ModelSysDemoReq; +import com.huoran.nakadai.service.ICustomerService; +import com.huoran.nakadai.service.ModelSysCategoryService; +import io.swagger.annotations.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import com.huoran.common.response.R; + +import javax.servlet.http.HttpServletRequest; +import java.util.ArrayList; +import java.util.List; + +/** + * @描述:源模型-分类表控制类 + * @作者: Rong + * @日期: 2022-03-03 + */ +@RestController +@RequestMapping("/nakadai/model/category") +@Api(value = "API - 中台:ModelSysCategoryController", tags = "中台:源模型分类") +public class ModelSysCategoryController { + @Autowired + private UserClient userClient; + @Autowired + public ModelSysCategoryService service; + @Autowired + public ICustomerService customerService; + @PostMapping("/save") + @ApiOperation(value = "新增源模型分类") + public R save(@RequestBody @Validated ModelSysCategory modelSysCategory, HttpServletRequest request) { + boolean checkRepeat = service.checkRepeat(modelSysCategory, 0); + String accountId = TokenUtils.getIdByJwtToken(request); + modelSysCategory.setAccountId(Integer.valueOf(accountId)); + modelSysCategory.setSchoolId(0); + if (modelSysCategory.getFounder() == ModellConstant.SOURCE_INSTITUTION) { + //创建来源为院校时候赋值学校id + modelSysCategory.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); + } + + if (checkRepeat) { + return R.error("该层级下已有重复的分类名称了!"); + } + boolean ret = service.save(modelSysCategory); + return ret ? R.ok() : R.error(); + } + + @PostMapping("/sourceModelClassification") + @ApiOperation(value = "源模型分类列表") + public R sourceModelClassification(@RequestParam("founder") @ApiParam(value = "创建人来源(0、系统 1、院校)") Integer founder, HttpServletRequest request) { + + ModelSysDemoReq req = new ModelSysDemoReq(); + req.setFounder(founder); + if (founder == ModellConstant.SOURCE_INSTITUTION) { + String accountId = TokenUtils.getIdByJwtToken(request); + //创建来源为院校时候赋值学校id + req.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); + } + List sourceModelClassification = service.sourceModelClassification(req); + return R.ok().put("data", sourceModelClassification); + } + + @PostMapping("/primaryClassification") + @ApiOperation(value = "一级分类") + public R primaryClassification() { + List primaryClassification = service.primaryClassification(); + return R.ok().put("data", primaryClassification); + } + + @PostMapping("/classificationByPid") + @ApiOperation(value = "根据父id查询分类下的分类") + public R classificationByPid(@RequestParam("parentId") @ApiParam(value = "分类父id") Integer parentId) { + List primaryClassification = service.classificationByPid(parentId); + return R.ok().put("data", primaryClassification); + } + + @PostMapping("/deleteSourceModelCategory") + @ApiOperation(value = "删除源模型分类") + public R deleteSourceModelCategory(@RequestParam("categoryId") @ApiParam(value = "分类id") Integer categoryId) { + return service.deleteSourceModelCategory(categoryId); + } + + @PostMapping("/updateSourceModelCategory") + @ApiOperation(value = "编辑源模型分类") + public R update(@RequestBody ModelSysCategory modelSysCategory, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + modelSysCategory.setAccountId(Integer.valueOf(accountId)); + boolean checkRepeat = service.checkRepeat(modelSysCategory, 1); + + if (checkRepeat) { + return R.error("该层级下已有重复的分类名称了!"); + } + boolean ret = service.updateById(modelSysCategory); + return ret ? R.ok() : R.error(); + } + + + @PostMapping("/builtInModelClassification") + @ApiOperation(value = "学校模型内置分类(用于新增订单后给学校内置数据)") + public R builtInModelClassification(@RequestParam("schoolId") @ApiParam(value = "学校id") Integer schoolId) { + ModelSysCategory modelSysCategory = new ModelSysCategory(); + modelSysCategory.setCategoryName("全部"); + modelSysCategory.setParentId(0); + modelSysCategory.setLevel(0); + modelSysCategory.setFounder(ModellConstant.SOURCE_INSTITUTION); + modelSysCategory.setIsOpen(0); + modelSysCategory.setSchoolId(schoolId); + modelSysCategory.setAccountId(1); + boolean ret = service.save(modelSysCategory); + return ret ? R.ok() : R.error(); + } + + @PostMapping("/batchBuiltInModelClassification") + @ApiOperation(value = "学校模型内置分类(用于新增订单后给学校内置数据)") + public R batchBuiltInModelClassification() { + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("is_del",0); + queryWrapper.last(" GROUP BY school_id"); + List list = customerService.list(queryWrapper); + for (Customer customer: list ) { + ModelSysCategory modelSysCategory = new ModelSysCategory(); + modelSysCategory.setCategoryName("全部"); + modelSysCategory.setParentId(0); + modelSysCategory.setLevel(0); + modelSysCategory.setFounder(ModellConstant.SOURCE_INSTITUTION); + modelSysCategory.setIsOpen(0); + modelSysCategory.setSchoolId(customer.getSchoolId()); + modelSysCategory.setAccountId(1); + boolean ret = service.save(modelSysCategory); + } + return R.ok() ; + } + + +} + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/ModelSysDemoController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/ModelSysDemoController.java new file mode 100644 index 0000000..afc8757 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/ModelSysDemoController.java @@ -0,0 +1,405 @@ +package com.huoran.nakadai.controller; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.huoran.api.UserClient; +import com.huoran.common.aop.annotation.NoRepeatSubmit; +import com.huoran.common.constant.ModellConstant; +import com.huoran.common.constant.PlatformConstant; +import com.huoran.common.entity.PythonCodeResp; +import com.huoran.common.exception.CustomException; +import com.huoran.common.exception.ExceptionEnum; +import com.huoran.common.utils.TokenUtils; +import com.huoran.nakadai.entity.DataProduct; +import com.huoran.nakadai.entity.ModelReferenceDemo; +import com.huoran.nakadai.entity.ModelSysDemo; +import com.huoran.nakadai.entity.req.CopyTheModelToTheNakadaiReq; +import com.huoran.nakadai.entity.req.DisableEnableModelReq; +import com.huoran.nakadai.entity.req.PageModelReq; +import com.huoran.nakadai.entity.req.PythonCodeRunReq; +import com.huoran.nakadai.service.ModelSysDemoService; +import io.swagger.annotations.*; +import org.apache.commons.lang.StringUtils; +import org.apache.ibatis.annotations.Param; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import com.huoran.common.response.R; + +import javax.servlet.http.HttpServletRequest; +import javax.validation.Valid; +import java.io.IOException; +import java.util.List; + +/** + * @描述:源模型代码记录表控制类 + * @作者: Rong + * @日期: 2022-03-04 + */ +@RestController +@RequestMapping("/nakadai/model/demo") +@Api(value = "API - 中台:ModelSysDemoController", tags = "中台:源模型代码记录") +public class ModelSysDemoController { + @Autowired + private UserClient userClient; + @Autowired + public ModelSysDemoService service; + + @Autowired + private StringRedisTemplate redisTemplate; + + @PostMapping("/saveSysModelDemo") + @ApiOperation(value = "新增源模型") + public R save(@RequestBody @Validated ModelSysDemo modelSysDemo, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + modelSysDemo.setAccountId(Integer.valueOf(accountId)); + modelSysDemo.setModifyAccountId(Integer.valueOf(accountId)); + if (modelSysDemo.getFounder() == ModellConstant.SOURCE_INSTITUTION) { + //创建来源为院校时候赋值学校id + modelSysDemo.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); + } + + boolean ret = service.save(modelSysDemo); + return ret ? R.ok() : R.error(); + } + + @PostMapping("/updateSysModelDemo") + @ApiOperation(value = "修改") + public R update(@RequestBody ModelSysDemo modelSysDemo, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + + + ModelSysDemo sysDemo = service.getById(modelSysDemo.getId()); + //(0、系统 1、院校) + if (modelSysDemo.getIsAdmin() == null) { + modelSysDemo.setModifyAccountId(Integer.valueOf(accountId)); + } + + + boolean ret = service.updateById(modelSysDemo); + return ret ? R.ok() : R.error(); + } + + @PostMapping("/deleteSysModelDemo") + @ApiOperation(value = "批量删除") + public R delete(@RequestBody List ids) { + boolean ret = service.removeByIds(ids); + return ret ? R.ok() : R.error(); + } + + /* @PostMapping("/bulkDisable") + @ApiOperation(value = "批量禁用启用") + public R bulkDisable(@RequestParam(value = "isOpen") @ApiParam(value = "启用状态(0开启 1禁用 默认0)") Integer isOpen, @RequestBody List ids, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer count = 0; + for (Integer id : ids) { + ModelSysDemo modelSysDemo = new ModelSysDemo(); + modelSysDemo.setModifyAccountId(Integer.valueOf(accountId)); + modelSysDemo.setIsOpen(isOpen); + modelSysDemo.setId(id); + boolean ret = service.updateById(modelSysDemo); + if (ret) { + count++; + } + + } + + return count == ids.size() ? R.ok() : R.error(); + }*/ + + @PostMapping("/findById") + @ApiOperation(value = "根据主键查询", response = ModelSysDemo.class) + public R findById(@RequestParam("id") @ApiParam(value = "序号") Integer id) { + ModelSysDemo modelSysDemo = service.getById(id); + return R.ok().put("data", modelSysDemo); + } + + @PostMapping("/sysModelDemoList") + @ApiOperation(value = "源模型列表(依据分类id查的模型列表)", response = ModelSysDemo.class) + public R listByEntity(@RequestBody @Validated PageModelReq req, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + String roleName = userClient.getUserAllRole(accountId, PlatformConstant.NAKADAI);//获取当前用户的角色 + if (roleName != null) { + req.setIsAdmin(1); + } else { + req.setIsAdmin(0); + req.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); + } + return service.sysModelDemoList(req); + } + + @PostMapping("/runPythonCode") + @ApiOperation(value = "运行python代码", response = PythonCodeResp.class) + public R runPythonCode(@RequestBody @Validated PythonCodeRunReq req) throws IOException { + return service.runCode(req.getCode()); + } + + @PostMapping("/getAllModelListBySys") + @ApiOperation(value = "源模型-查询全部模型列表", response = ModelSysDemo.class) + public R getAllModelListBySys(@RequestBody PageModelReq req, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + if (req.getFounder() == ModellConstant.SOURCE_INSTITUTION) { + //创建来源为院校时候赋值学校id + req.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); + } + return service.getAllModelListBySys(req); + } + + + /** + * 中台端读取院校模型 未删除、未禁用的模型。 + * + * @param req + * @param request + * @return + */ + @PostMapping("/InstitutionSourceModel") + @ApiOperation(value = "中台端——院校源模型/教师端——源模型", response = ModelSysDemo.class) + public R InstitutionSourceModel(@RequestBody PageModelReq req, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + String roleName = userClient.getUserAllRole(accountId, PlatformConstant.NAKADAI);//获取当前用户的角色 + if (roleName != null) { + req.setIsAdmin(1); + } else { + req.setIsAdmin(0); + req.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); + } + return service.InstitutionSourceModel(req); + } + + + @NoRepeatSubmit + @ApiOperation(value = "模型禁启用", response = ModelSysDemo.class) + @PostMapping("/disabledEvents") + public R disabledEvents(@RequestBody List list, HttpServletRequest request) { + boolean ret = false; + for (DisableEnableModelReq req : list) { + String accountId = TokenUtils.getIdByJwtToken(request); + //modelSysDemo:查看当前模型禁启用状态 + ModelSysDemo modelSysDemo = service.getById(req.getModelId()); + ModelSysDemo sysDemo = new ModelSysDemo(); + sysDemo.setId(req.getModelId()); + //禁用平台来源(0中台,1职站教师端 2.职站学生端) + switch (req.getType()) { + case 0: + sysDemo.setZtOpen(req.getIsOpen()); +// sysDemo.setIsOpen(req.getIsOpen()); + break; + case 1: + // 客户创建的模型,禁用时职站首页以及学生登录后的模型模块看不到对应的模型,创建的老师在模型管理还是可以看到该模型,可以编辑,但是无法启用。 + // 即中台禁用的模型,即使是该院校老师创建的,老师端也不能自己启用,需要中台启用。 + //1.判断当前院校禁启用状态为要启用时候再判断当前赛事中台禁启用的状态 + if (req.getIsOpen() == 0) { + if (modelSysDemo.getZtOpen() == 1) { + return R.error("当前模型已被平台禁用,请联系平台管理员!"); + } + } + sysDemo.setIsOpen(req.getIsOpen()); + break; + + } + ret = service.updateById(sysDemo); + } + + + //保存的key名 + String key = "modelDisabled"; + //以时间戳方式保存到缓存中 + redisTemplate.opsForValue().set(key, System.currentTimeMillis() + ""); + return R.ok(); + } + + + /** + * 禁用/启用的时候,把时间戳写入那个key,前端第一次调用的时候,把时间戳写入本地缓存 + * 然后前端通过定时器获取这个redis缓存的接口 + * 只要获取到的值跟本地缓存的不一致就刷新列表 + * + * @return + */ + @PostMapping("/getRedisCache") + @ApiOperation(value = "获取Redis缓存(返回的时间戳只要获取到的值跟本地缓存的不一致就刷新列表)") + public R getRedisCache() { + //保存的key名 + String key = "modelDisabled"; + //查看缓存是否有数据 + String returnValue = redisTemplate.opsForValue().get(key); + + //使用缓存返回数据 + if (returnValue != null) { + return R.ok().put("data", returnValue); + } + + + return R.ok(); + } + + + @PostMapping("/copyTheModelToTheNakadai") + @ApiOperation(value = "中台端复制院校模型", response = ModelSysDemo.class) + public R copyTheModelToTheNakadai(@RequestBody CopyTheModelToTheNakadaiReq req, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + req.setAccountId(Integer.valueOf(accountId)); + return service.copyTheModelToTheNakadai(req); + } + + + @PostMapping("/controlPasteCode") + @ApiOperation(value = "控制是否学生端可以粘贴代码") + public R controlPasteCode(@RequestParam("systemId") @ApiParam(value = "系统id") Integer systemId, + @RequestParam("isShow") @ApiParam(value = "是否展示->默认true为展示 false为不展示") String isShow, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + //保存的key名 + String key = "controlPasteCode:systemId:" + systemId + "schoolId:" + schoolId; + redisTemplate.opsForValue().set(key, isShow); + return R.ok(); + } + + + @PostMapping("/whetherCanPaste") + @ApiOperation(value = "查询是否能粘贴") + public R whetherCanPaste(@RequestParam("systemId") @ApiParam(value = "系统id") Integer systemId, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + //保存的key名 + String key = "controlPasteCode:systemId:" + systemId + "schoolId:" + schoolId; + //查看缓存是否有数据 + String returnValue = redisTemplate.opsForValue().get(key); + + //使用缓存返回数据 + if (returnValue != null) { + return R.ok().put("data", returnValue); + } + redisTemplate.opsForValue().set(key, "true"); + return R.ok().put("data", "true"); + } + + + @PostMapping("/builtInModelButtonDisplayByNakadai") + @ApiOperation(value = "中台控制教师端内置模型按钮展示(用于中台禁用按钮后控制教师端的模型按钮)") + public R builtInModelButtonDisplayByNakadai(@RequestParam("systemId") @ApiParam(value = "系统id") Integer systemId, + @RequestParam("isShow") @ApiParam(value = "是否展示->默认true为展示 false为不展示") String isShow) { + //保存的key名 + String key = "builtInModelButtonDisplay:systemId:" + systemId; + redisTemplate.opsForValue().set(key, isShow); + + //查看缓存是否有数据 + String returnValue = redisTemplate.opsForValue().get(key); + //没有则内置数据 + if (returnValue == null) { + redisTemplate.opsForValue().set(key, "true"); + } + + return R.ok(); + } + + + @PostMapping("/builtInModelState") + @ApiOperation(value = "中台显示内置模型状态") + public R builtInModelState(@RequestParam("systemId") @ApiParam(value = "系统id") Integer systemId) { + //保存的key名 + String key = "builtInModelButtonDisplay:systemId:" + systemId; + //查看缓存是否有数据 + String returnValue = redisTemplate.opsForValue().get(key); + //没有则内置数据 + if (returnValue == null) { + redisTemplate.opsForValue().set(key, "true"); + } + + return R.ok(returnValue); + } + + + @PostMapping("/builtInModelStateByTeacher") + @ApiOperation(value = "职站教师端显示内置模型状态(基于中台禁用、启用后教师端的模型列表以及源模型列表展示依据该接口展示)") + public R builtInModelStateByTeacher(@RequestParam("systemId") @ApiParam(value = "系统id") Integer systemId, HttpServletRequest request) { + //保存的key名 + String key = "builtInModelButtonDisplay:systemId:" + systemId; + //查看缓存是否有数据 + String returnValue = redisTemplate.opsForValue().get(key); + //没有则内置数据 + if (returnValue == null) { + redisTemplate.opsForValue().set(key, "true"); + } + + return R.ok(returnValue); + } + + @PostMapping("/displayListOrNotByTeacher") + @ApiOperation(value = "职站教师端是否展示模型列表以及源模型管理(true表示展示 false不展示)") + public R displayListOrNotByTeacher(@RequestParam("systemId") @ApiParam(value = "系统id") Integer systemId, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + //保存的key名 + String key = "builtInModelButtonDisplayByTeacher:systemId:" + systemId + "schoolId:" + schoolId; + //查看缓存是否有数据 + String returnValue = redisTemplate.opsForValue().get(key); + if (returnValue == null) { + //没有则内置数据 + redisTemplate.opsForValue().set(key, "true"); + return R.ok().put("teacherButtonStatus", "true"); + } + //使用缓存返回数据 + return R.ok().put("teacherButtonStatus", returnValue); + + } + + + @PostMapping("/builtInModelButtonDisplayByTeacher") + @ApiOperation(value = "教师端控制学生端内置模型按钮展示") + public R builtInModelButtonDisplayByTeacher(@RequestParam("systemId") @ApiParam(value = "系统id") Integer systemId, + @RequestParam("isShow") @ApiParam(value = "是否展示->默认true为展示 false为不展示") String isShow, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + //保存的key名 + String key = "builtInModelButtonDisplayByTeacher:systemId:" + systemId + "schoolId:" + schoolId; + redisTemplate.opsForValue().set(key, isShow); + //查看缓存是否有数据 + String returnValue = redisTemplate.opsForValue().get(key); + //没有则内置数据 + if (returnValue == null) { + redisTemplate.opsForValue().set(key, "true"); + } + return R.ok(returnValue); + } + + + @PostMapping("/displayListOrNotByStudent") + @ApiOperation(value = "学生端是否展示模型列表以及源模型管理(true表示展示 false不展示)") + public R displayListOrNotByStudent(@RequestParam("systemId") @ApiParam(value = "系统id") Integer systemId, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + + + //中台控制的key + String middleConsoleControlKey = "builtInModelButtonDisplay:systemId:" + systemId; + //查看中台缓存是否有数据 + String returnValueByNakadai = redisTemplate.opsForValue().get(middleConsoleControlKey); + //没有则内置数据 + if (returnValueByNakadai == null) { + redisTemplate.opsForValue().set(middleConsoleControlKey, "true"); + returnValueByNakadai = redisTemplate.opsForValue().get(middleConsoleControlKey); + } + + String key = "builtInModelButtonDisplayByTeacher:systemId:" + systemId + "schoolId:" + schoolId; + String returnValue = redisTemplate.opsForValue().get(key); + //没有则内置数据 + if (returnValue == null) { + redisTemplate.opsForValue().set(key, "true"); + returnValue = redisTemplate.opsForValue().get(key); + } + + + //中台和职站一并开启才能启用 + if (returnValueByNakadai.equals("true") && returnValue.equals("true")) { + return R.ok().put("studentSideShowsTheStatus", "true"); + } + return R.ok().put("studentSideShowsTheStatus", "false"); + + } +} + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/NotifyController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/NotifyController.java new file mode 100644 index 0000000..7ceecbf --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/NotifyController.java @@ -0,0 +1,59 @@ +package com.huoran.nakadai.controller; + + +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.nakadai.entity.Notify; +import com.huoran.nakadai.entity.vo.MessageNotificationVo; +import com.huoran.nakadai.service.NotifyService; +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 javax.servlet.http.HttpServletRequest; + +/** + *

+ * 消息通知表 前端控制器 + *

+ * + * @author chen + * @since 2023-05-29 + */ +@Api(value = "消息通知管理", tags = "消息通知管理") +@RestController +@RequestMapping("/notify") +public class NotifyController { + + @Autowired + private NotifyService notifyService; + + @ApiOperation(value = "消息通知列表", response = MessageNotificationVo.class) + @GetMapping("/messageNotificationList") + public R commentTreeList( + @ApiParam(name = "type", value = "通知类型", required = false) + @RequestParam(required = false) Integer type, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + return notifyService.messageNotificationList(accountId,type); + } + + @ApiOperation(value = "通知已读") + @PostMapping("/noticeRead") + public R noticeRead( + @ApiParam(name = "isRead", value = "是否已读", required = true) + @RequestParam Integer isRead, + @ApiParam(name = "noticeId", value = "多个通知id", required = true) + @RequestParam String notifyId) { + String[] strArray = notifyId.split(","); + // 注意foreach循环的用法 + for (String id : strArray) { + Notify notify = notifyService.getById(Integer.valueOf(id)); + notifyService.updateById(notify.setIsRead(isRead)); + } + return R.ok(); + } + +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/OSSFileController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/OSSFileController.java new file mode 100644 index 0000000..c46084b --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/OSSFileController.java @@ -0,0 +1,100 @@ +package com.huoran.nakadai.controller; + +import com.huoran.common.entity.FilesResult; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.nakadai.service.OSSFileService; +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 org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import java.io.IOException; +import java.util.List; + +/** + * @Author chen + * @DATE 2021/7/13 10:09 + * @Version 1.0 + */ +@Api(tags = "阿里云文件/视频管理") +@RestController +@RequestMapping("/nakadai/oss") +public class OSSFileController { + + @Autowired + private OSSFileService ossFileService; + + @ApiOperation(value = "文件上传") + @PostMapping("/fileUpload") + public R fileUpload( + @ApiParam(name = "file", value = "文件", required = true) + @RequestParam("file") MultipartFile file, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + if (file == null) { + return R.error("请选择文件"); + } + try { + //获取上传路径 + FilesResult filesResult = ossFileService.upload(file); + return R.ok().put("filesResult", filesResult); + } catch (IOException e) { + e.printStackTrace(); + return R.error(); + } + } + + /** + * 批量删除文件 + * + * @param keys 多个文件完整名称集合 + */ + @ApiOperation(value = "删除OSS文件") + @DeleteMapping("/fileDeletion") + public R fileDeletion( + @ApiParam(name = "keys", value = "文件完整名称集合", required = true) + @RequestParam("keys") List keys, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + if (keys != null && keys.size() != 0) { + List deletedObjects = ossFileService.fileDeletion(keys); + return R.ok().put("deletedObjects", deletedObjects); + } else { + return R.error(); + } + } + + + @ApiOperation(value = "获取播放凭证") + @GetMapping("getPlayAuth/{videoId}") + public R getVideoPlayAuth( + @ApiParam(name = "videoId", value = "视频Id", required = true) + @PathVariable("videoId") String videoId) { + + try { + String playAuth = ossFileService.getPlayAuth(videoId); + return R.ok().put("playAuth", playAuth); + } catch (com.aliyuncs.exceptions.ClientException e) { + e.printStackTrace(); + return R.error(e.getMessage()); + } + + } + + @ApiOperation(value = "删除视频文件") + @DeleteMapping("/removeVideo/{videoId}") + public R removeVideo( + @ApiParam(name = "videoId", value = "视频Id", required = true) + @PathVariable String videoId){ + try { + ossFileService.removeVideo(videoId); + return R.ok("删除视频成功"); + } catch (com.aliyuncs.exceptions.ClientException e) { + e.printStackTrace(); + return R.error(e.getMessage()); + } + } + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/OrderController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/OrderController.java new file mode 100644 index 0000000..c8a8a1c --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/OrderController.java @@ -0,0 +1,140 @@ +package com.huoran.nakadai.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.Mall; +import com.huoran.nakadai.entity.Order; +import com.huoran.nakadai.entity.OrderOther; +import com.huoran.nakadai.entity.PartnerTeam; +import com.huoran.nakadai.entity.req.DeleteIds; +import com.huoran.nakadai.entity.req.OrderListReq; +import com.huoran.nakadai.entity.res.ExportSubscribedRecordsResp; +import com.huoran.nakadai.entity.vo.OrderVo; +import com.huoran.nakadai.service.IOrderService; +import com.huoran.nakadai.service.MallService; +import com.huoran.nakadai.service.OrderOtherService; +import com.huoran.nakadai.service.PartnerTeamService; +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 javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.List; +import java.util.concurrent.ExecutionException; + +/** + *

+ * 订单表 前端控制器 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@Api(tags = "订单管理") +@RestController +@RequestMapping("/nakadai/order") +public class OrderController { + + @Autowired + private IOrderService orderService; + + @Autowired + private OrderOtherService orderOtherService; + + @Autowired + private MallService mallService; + + @Autowired + private PartnerTeamService partnerTeamService; + + @ApiOperation(value = "添加订单") + @PostMapping("/add") + public R add( + @ApiParam(name = "orderVo", value = "订单数据", required = true) + @RequestBody @Valid OrderVo orderVo) throws ExecutionException, InterruptedException { + return orderService.addOrder(orderVo); + } + + @ApiOperation(value = "订单列表", response = IPage.class) + @PostMapping("/list") + public R list(@ApiParam(name = "orderListReq", value = "查询条件", required = true) @RequestBody OrderListReq orderListReq) { + HashMap orderPage = orderService.orderList(orderListReq); + return R.ok().put("orderPage", orderPage); + } + + @ApiOperation(value = "订单详情", response = OrderVo.class) + @GetMapping("/get") + public R get(@ApiParam(name = "orderId", value = "订单id", required = true) @RequestParam @Valid @NotNull Integer orderId) { + OrderVo orderDetails = orderService.queryOrderDetails(orderId); + PartnerTeam rateInformation = null; + if (orderDetails.getOrder().getBusinessManagerId() != null && orderDetails.getOrder().getTeamId() != null) { + //查询费率 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("classification_id", orderDetails.getOrder().getTeamId()); + rateInformation = partnerTeamService.getOne(queryWrapper); + } + + BigDecimal annualMarketingFee = null; + if (rateInformation!=null && rateInformation.getAnnualMarketingFee() != null) { + annualMarketingFee = rateInformation.getAnnualMarketingFee().divide(new BigDecimal(100)); + } + + return R.ok().put("orderDetails", orderDetails).put("annualMarketingFee",annualMarketingFee ); + } + + @ApiOperation(value = "批量删除订单") + @PostMapping("/delete") + public R delete(@ApiParam(name = "orderIds", value = "订单ids", required = true) @RequestBody DeleteIds orderIds) { + boolean delete = orderService.deleteOrders(orderIds.getIds()); + return delete ? R.ok() : R.error(); + } + + @ApiOperation(value = "更新订单") + @PostMapping("/update") + public R update(@ApiParam(name = "orderVo", value = "订单数据", required = true) @RequestBody @Valid OrderVo orderVo) { + boolean update = orderService.updateOrder(orderVo); + return update ? R.ok() : R.error(); + } + + /** + * 查询客户订单 + * + * @param customerId 客户id + */ + @GetMapping("/getCustomerOrder") + public R getCustomerOrder(Integer customerId) { + List orderList = orderService.list(new QueryWrapper().eq("customer_id", customerId)); + return R.ok().put("orderList", orderList); + } + + @ApiOperation(value = "中台-导出Excel已订阅记录") + @PostMapping(value = "/exportSubscribedRecords", produces = "application/json;multipart/form-data;charset=utf-8") + public void exportSubscribedRecords(@RequestBody List listOfExportSub, HttpServletResponse response, HttpServletRequest request) throws Exception { + orderService.exportSubscribedRecords(listOfExportSub, response); + } + + @ApiOperation(value = "历史订单补充产品数据") + @PostMapping(value = "/supplementaryMallId") + public void supplementaryMallId() { + List list = orderOtherService.list(new QueryWrapper().eq("is_del",1)); + for (OrderOther orderOther : list) { + if (orderOther.getMallId()==null){ + //根据订单名称查询对应的商品id + Mall mall = mallService.getOne(new QueryWrapper().eq("associated_product_name", orderOther.getProductName())); + if (mall!=null){ + orderOther.setMallId(mall.getMallId()); + orderOtherService.updateById(orderOther); + } + } + } + } + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/OrderOtherController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/OrderOtherController.java new file mode 100644 index 0000000..eca92d4 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/OrderOtherController.java @@ -0,0 +1,141 @@ +package com.huoran.nakadai.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.common.entity.to.JudgmentPointDataTo; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.nakadai.entity.OrderOther; +import com.huoran.nakadai.entity.req.BulkShipOrdersReq; +import com.huoran.nakadai.entity.req.QueryTimeReq; +import com.huoran.nakadai.entity.vo.OrderRenewVo; +import com.huoran.nakadai.service.OrderOtherService; +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.scheduling.annotation.Scheduled; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.util.ArrayList; +import java.util.List; + +/** + *

+ * 订单其他信息(包含课程权限、数据平台权限、合同信息等) 前端控制器 + *

+ * + * @author cheney + * @since 2021-07-01 + */ +@Api(tags = "订单内容管理") +@RestController +@RequestMapping("/nakadai/orderOther") +public class OrderOtherController { + + @Autowired + private OrderOtherService orderOtherService; + + @ApiOperation(value = "订单发货") + @PostMapping("/ship") + public R ship(@RequestBody OrderOther orderOther) { + boolean update = orderOtherService.ship(orderOther); + return update ? R.ok() : R.error(); + } + + @ApiOperation(value = "批量发货") + @PostMapping("/bulkShipping") + public R bulkShipping(@RequestBody BulkShipOrdersReq bulkShipOrdersReq) { + boolean update = orderOtherService.bulkShipping(bulkShipOrdersReq); + return update ? R.ok() : R.error(); + } + + @ApiOperation(value = "是否启用订单") + @PostMapping("/enable") + public R enable( + @ApiParam(name = "id", value = "货品id", required = true) + @RequestParam @Valid @NotNull(message = "货品id不能为空") Integer id, + @ApiParam(name = "flag", value = "标识", required = true) + @RequestParam @Valid @Size(max = 1) Integer flag) { + boolean update = orderOtherService.enable(id, flag); + return update ? R.ok() : R.error(); + } + + @ApiOperation(value = "续费查询之前产品信息") + @PostMapping("/renew") + public R renew(@RequestBody @Valid OrderRenewVo orderRenewVo) { + ArrayList orderOthers = orderOtherService.renew(orderRenewVo); + return R.ok().put("orderOthers", orderOthers); + } + + /** + * 查询订单其他信息 + */ + @GetMapping("/getOrderOther") + public R getOrderOther(Integer orderId, Integer authority) { + List orderOtherList = orderOtherService. + list(new QueryWrapper().eq("order_id", orderId).eq("authority", authority)); + return R.ok().put("orderOtherList", orderOtherList); + } + + /** + * 查询客户订单信息 + */ + @ApiOperation(value = "查询客户订单信息") + @PostMapping("/getCustomerOrderOther") + public JudgmentPointDataTo getCustomerOrderOther(@RequestParam Integer schoolId, @RequestParam Integer systemId, @RequestParam String name) { + return orderOtherService.getCustomerOrderOther(schoolId, systemId, name); + } + + /** + * 查询订单内容时间 + */ + @ApiOperation(value = "查询订单内容时间") + @PostMapping("/getOrderOtherTime") + public R getOrderOtherTime(@RequestBody QueryTimeReq queryTimeReq) { + String newTime = orderOtherService.getOrderOtherTime(queryTimeReq); + return R.ok().put("endTime", newTime); + } + + /** + * 定时任务处理剩余期限(每日凌晨一点执行一遍) + */ + @Scheduled(cron = "0 0 1 * * ?") + // @ApiOperation(value = "定时任务处理剩余期限") + // @PostMapping("/remainingPeriod") + public void remainingPeriod() { + orderOtherService.remainingPeriod(); + } + + /** + * 定时任务处理客户到期时间(每日凌晨两点执行一遍) + */ + @Scheduled(cron = "0 0 2 * * ?") + // @PostMapping("/remainingPeriod") + public void customerExpiration() { + orderOtherService.customerExpiration(); + } + + @PostMapping("/orderBulkDisableEnable") + @ApiOperation(value = "订单批量禁用启用") + public R orderBulkDisableEnable(@RequestParam(value = "isOpen") @ApiParam(value = "是否开启(0不开启,1开启,发货后,默认开启)") Integer isOpen, @RequestBody List ids, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer count = 0; + for (Integer id : ids) { + OrderOther orderOther = new OrderOther(); + orderOther.setIsEnable(isOpen); + orderOther.setId(id); + boolean ret = orderOtherService.updateById(orderOther); + if (ret) { + count++; + } + + } + + return count == ids.size() ? R.ok() : R.error(); + } +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/PartnerAccountController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/PartnerAccountController.java new file mode 100644 index 0000000..f5468fd --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/PartnerAccountController.java @@ -0,0 +1,217 @@ +package com.huoran.nakadai.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.common.exception.CustomException; +import com.huoran.common.exception.ExceptionEnum; +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.PartnerAccount; +import com.huoran.nakadai.entity.PartnerClassification; +import com.huoran.nakadai.entity.PartnerTeam; +import com.huoran.nakadai.entity.req.*; +import com.huoran.nakadai.entity.res.PartnerAccountResp; +import com.huoran.nakadai.entity.vo.TeamMemberVo; +import com.huoran.nakadai.service.PartnerAccountService; +import com.huoran.nakadai.service.PartnerClassificationService; +import com.huoran.nakadai.service.PartnerTeamService; +import com.huoran.nakadai.utils.GenerateCodeUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.util.concurrent.TimeUnit; + +/** + *

+ * 合伙人账号表 前端控制器 + *

+ * + * @author chen + * @since 2022-05-18 + */ +@Api(tags = "合伙人账号管理") +@RestController +@RequestMapping("/nakadai/partnerAccount") +public class PartnerAccountController { + + @Autowired + public PartnerAccountService partnerAccountService; + + @Autowired + public PartnerTeamService partnerTeamService; + + @Autowired + public PartnerClassificationService partnerClassificationService; + + @Autowired + private RedisTemplate redisTemplate; + + /** + * 生成专属邀请码 + */ + @PostMapping("/generateInvitationCode") + @ApiOperation(value = "生成专属邀请码") + public R generateInvitationCode(@RequestParam("accountId") String accountId) { + //存在直接返回邀请码 + String code = redisTemplate.opsForValue().get(accountId+"invitationCode"); + if (StringUtils.isEmpty(code)){ + code = GenerateCodeUtil.generateCode(); + redisTemplate.opsForValue().set(accountId+"invitationCode",code,7, TimeUnit.DAYS); + } + //过期时间 + Long expireTime = redisTemplate.opsForValue().getOperations().getExpire(accountId+"invitationCode"); + return R.ok().put("invitationCode",code).put("expireTime",expireTime); + } + + @ApiOperation(value = "邀请二维码生成") + @GetMapping(value = "/generationQrCode",produces = "image/png") + public void generationQrCode( + @ApiParam(name = "url", value = "链接", required = true) + @RequestParam String url, HttpServletResponse response){ + partnerAccountService.generationQrCode(url,response); + } + + /** + * 新增合伙人账号 + */ + @PostMapping("/savePartnerAccount") + @ApiOperation(value = "新增合伙人账号") + public R savePartnerAccount(@RequestBody @Valid PartnerAccountAddReq partnerAccountAddReq) { + return partnerAccountService.savePartnerAccount(partnerAccountAddReq); + } + + /** + * 合伙人账号列表 + */ + @PostMapping("/partnerAccountList") + @ApiOperation(value = "合伙人账号列表(查询分类下所有团队及成员)", response = PartnerAccountResp.class) + public R partnerAccountList(@RequestBody @Valid PartnerAccountListReq req) { + return partnerAccountService.pagePartnerAccountList(req); + } + + @PostMapping("/partnerAccountMergeList") + @ApiOperation(value = "合伙人账号列表--合并数据查询(以账号为维度查询合并-中台调用)", response = PartnerAccountResp.class) + public R partnerAccountMergeList(@RequestBody @Valid PartnerAccountListReq req) { + return partnerAccountService.partnerAccountMergeList(req); + } + + @PostMapping("/teamPartnerList") + @ApiOperation(value = "团队合伙人列表(以团队维度查询-小程序调用)", response = PartnerAccountResp.class) + public R teamPartnerList(@RequestBody @Valid PartnerAccountListReq req) { + return partnerAccountService.teamPartnerList(req); + } + + @PostMapping("/queryTeamMembers") + @ApiOperation(value = "查询团队成员", response = PartnerAccountResp.class) + public R queryTeamMembers(@RequestBody TeamMemberVo teamMemberVo) { + return partnerAccountService.queryTeamMembers(teamMemberVo); + } + + /** + * 合伙人账号详情 + */ + @GetMapping("/partnerAccountDetail") + // @ApiOperation(value = "合伙人账号详情", response = PartnerAccountResp.class) + public R partnerAccountDetail(@ApiParam(name = "accountId", value = "合伙人账号账号id") + @RequestParam Integer accountId) { + return partnerAccountService.partnerAccountDetail(accountId); + } + + /** + * 编辑合伙人账号 + */ + @PostMapping("/modifyPartnerAccount") + // @ApiOperation(value = "编辑合伙人账号") + public R modifyPartnerAccount(@RequestBody @Valid PartnerAccountUpdateReq updateReq) { + return partnerAccountService.modifyPartnerAccount(updateReq); + } + + /** + * 生成转让邀请码 + */ + @PostMapping("/generateTransferCode") + @ApiOperation(value = "生成转让邀请码") + public R generateTransferCode(@RequestParam("accountId") String accountId) { + //存在直接返回邀请码 + String code = redisTemplate.opsForValue().get(accountId+"transferCode"); + if (StringUtils.isEmpty(code)){ + code = GenerateCodeUtil.generateCode(); + redisTemplate.opsForValue().set(accountId+"transferCode",code,1, TimeUnit.DAYS); + } + //过期时间 + Long expireTime = redisTemplate.opsForValue().getOperations().getExpire(accountId+"transferCode"); + return R.ok().put("transferCode",code).put("expireTime",expireTime); + } + + @PostMapping("/transferAdmin") + @ApiOperation(value = "新增转让超管") + public R transferAdmin(@RequestBody @Valid TransferAdminReq transferAdminReq) { + return partnerAccountService.transferAdmin(transferAdminReq); + } + + @PostMapping("/transferTeam") + @ApiOperation(value = "团队内转让超管") + public R transferTeam(@RequestBody @Valid TransferTeamReq transferTeamReq) { + return partnerAccountService.transferTeam(transferTeamReq); + } + + /** + * 删除团队 + */ + @PostMapping("/delPartnerAccount") + @ApiOperation(value = "删除合伙人") + public R delPartnerAccount( + @ApiParam(name = "accountId", value = "账号id") + @RequestParam Integer accountId) { + return partnerAccountService.delPartnerAccount(accountId); + } + + /** + * 移除团队 + */ + @GetMapping("/partnerRemoval") + @ApiOperation(value = "移除团队") + public R partnerRemoval( + @ApiParam(name = "teamId", value = "团队id") + @RequestParam String teamId, + @ApiParam(name = "partnerId", value = "合伙人id") + @RequestParam String partnerId) { + PartnerClassification partnerClassification = partnerClassificationService.getById(teamId); + if (partnerClassification.getIsTeam() == 1) { + throw new CustomException(ExceptionEnum.PARTNER_REMOVAL); + } + PartnerAccount partnerAccount = partnerAccountService.getById(partnerId); + //删除团队成员 + partnerClassificationService.removeById(Integer.parseInt(teamId)); + //同步删除该团队相关角色信息 + partnerClassificationService.removeRole(teamId,partnerAccount.getAccountId()); + return partnerTeamService.remove(new QueryWrapper(). + eq("partner_id", partnerId). + eq("classification_id", teamId)) ? R.ok() : R.error(); + } + + @PostMapping("/mailFileSend") + @ApiOperation(value = "邮箱文案发送") + public R mailFileSend(@RequestBody FileSendReq fileSendReq) { + return partnerAccountService.mailFileSend(fileSendReq); + } + + + @ApiOperation(value = "查询合伙人账号信息") + @PostMapping("/queryPartnerAccount") + public R queryPartnerAccount(@RequestParam String phone) { + return partnerAccountService.queryPartnerAccount(phone); + } + + @ApiOperation(value = "合伙人账号申请注册") + @PostMapping("/partnerAccountApplication") + public R partnerAccountApplication(@RequestBody @Valid PartnerRegisterReq registerReq) { + return partnerAccountService.partnerAccountApplication(registerReq); + } +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/PartnerArticleClassificationController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/PartnerArticleClassificationController.java new file mode 100644 index 0000000..c2ebb72 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/PartnerArticleClassificationController.java @@ -0,0 +1,99 @@ +package com.huoran.nakadai.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.nakadai.entity.PartnerArticleClassification; +import com.huoran.nakadai.service.PartnerArticleClassificationService; +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 javax.servlet.http.HttpServletRequest; +import java.util.List; + + +/** + * @描述:合伙人——文章管理——文章所属分类控制类 + * @作者: Rong + * @日期: 2023-03-16 + */ +@RestController +@RequestMapping("/nakadai/partner/article/classification") +@Api(value = "合伙人——文章管理——文章所属分类:PartnerArticleClassificationController", tags = "R-合伙人——文章所属分类") +public class PartnerArticleClassificationController { + + @Autowired + public PartnerArticleClassificationService service; + + + @PostMapping("/queryClassificationByType") + @ApiOperation(value = "依据类型查询分类", response = PartnerArticleClassification.class) + public R allTheQuery(@ApiParam(name = "typeId", value = "类型(1.学习2.资讯3.方案)", required = true) @RequestParam Integer typeId) { + List list = service.list(new QueryWrapper() + .eq("type_id", typeId)); + return R.ok().put("data",list); + } + + + @PostMapping("/findById") + @ApiOperation(value = "查询详情", response = PartnerArticleClassification.class) + public R findById(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { + PartnerArticleClassification partnerArticleClassification = service.getById(id); + return R.ok().put("data", partnerArticleClassification); + } + + + @PostMapping("/checkForHeavy") + @ApiOperation(value = "分类校验判重", response = PartnerArticleClassification.class) + public R checkForHeavy(@ApiParam(name = "typeId", value = "类型(1.学习2.资讯", required = true) @RequestParam Integer typeId, + @ApiParam(name = "classificationName", value = "分类名称", required = true) @RequestParam String classificationName, + @ApiParam(name = "classificationId", value = "分类id(新增不传,编辑传)", required = false) @RequestParam Integer classificationId) { + + QueryWrapper queryWrapper = new QueryWrapper().eq("type_id", typeId). + eq("classification_name", classificationName); + + //id不得空表示编辑校验 + if (classificationId != null) { + queryWrapper.last(" and id != " + classificationId); + } + PartnerArticleClassification sysContentClassification = service.getOne(queryWrapper); + if (sysContentClassification != null) { + return R.error("当前分类名称已存在!"); + } + return R.ok(); + + } + + + @PostMapping("/save") + @ApiOperation(value = "新增", response = PartnerArticleClassification.class) + public R save(@RequestBody @ApiParam(name = "合伙人——文章管理——文章所属分类对象", value = "传入json格式", required = true) PartnerArticleClassification partnerArticleClassification, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + partnerArticleClassification.setFounderId(Integer.parseInt(accountId)); + partnerArticleClassification.setEditorId(Integer.parseInt(accountId)); + boolean addState = service.save(partnerArticleClassification); + return addState ? R.ok() : R.error("新增失败"); + } + + + @PostMapping("/update") + @ApiOperation(value = "修改", response = PartnerArticleClassification.class) + public R update(@RequestBody @ApiParam(name = "合伙人——文章管理——文章所属分类对象", value = "传入json格式", required = true) PartnerArticleClassification partnerArticleClassification, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + partnerArticleClassification.setEditorId(Integer.parseInt(accountId)); + boolean updateState = service.updateById(partnerArticleClassification); + return updateState ? R.ok() : R.error("编辑失败"); + } + + + @PostMapping("/batchDeletion") + @ApiOperation(value = "批量删除", response = PartnerArticleClassification.class) + public R batchDeletion(@ApiParam(name = "id", value = "主键", required = true) @RequestParam List ids) { + boolean delState = service.removeByIds(ids); + return delState ? R.ok() : R.error("删除失败"); + } +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/PartnerArticleFileController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/PartnerArticleFileController.java new file mode 100644 index 0000000..df2bc6f --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/PartnerArticleFileController.java @@ -0,0 +1,80 @@ +package com.huoran.nakadai.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.nakadai.entity.PartnerArticleFile; +import com.huoran.nakadai.service.PartnerArticleFileService; +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 javax.servlet.http.HttpServletRequest; +import java.util.List; + + +/** + * @描述:合伙人——文章管理——文章附件管理表控制类 + * @作者: Rong + * @日期: 2023-03-16 + */ +@RestController +@RequestMapping("/nakadai/partner/article/file") +@Api(value = "合伙人——文章管理——文章附件管理表:PartnerArticleFileController", tags = "R-合伙人——文章附件管理表") +public class PartnerArticleFileController { + + @Autowired + public PartnerArticleFileService service; + + + @PostMapping("/theAttachmentUnderTheQueryColumn") + @ApiOperation(value = "查询文章id下的附件", response = PartnerArticleFile.class) + public R theAttachmentUnderTheQueryColumn(@ApiParam(name = "contentId", value = "文章id", required = true) @RequestParam Integer contentId) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("content_id",contentId); + List sysContentFile = service.list(queryWrapper); + return R.ok().put("data",sysContentFile); + } + + + + + @PostMapping("/findById") + @ApiOperation(value = "查询详情", response = PartnerArticleFile.class) + public R findById(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { + PartnerArticleFile partnerArticleFile = service.getById(id); + return R.ok().put("data", partnerArticleFile); + } + + + @PostMapping("/save") + @ApiOperation(value = "新增", response = PartnerArticleFile.class) + public R save(@RequestBody @ApiParam(name = "合伙人——文章管理——文章附件管理表对象", value = "传入json格式", required = true) PartnerArticleFile partnerArticleFile, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + partnerArticleFile.setFounderId(Integer.parseInt(accountId)); + partnerArticleFile.setEditorId(Integer.parseInt(accountId)); + boolean addState = service.save(partnerArticleFile); + return addState ? R.ok() : R.error("新增失败"); + } + + + @PostMapping("/update") + @ApiOperation(value = "修改", response = PartnerArticleFile.class) + public R update(@RequestBody @ApiParam(name = "合伙人——文章管理——文章附件管理表对象", value = "传入json格式", required = true) PartnerArticleFile partnerArticleFile, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + partnerArticleFile.setEditorId(Integer.parseInt(accountId)); + boolean updateState = service.updateById(partnerArticleFile); + return updateState ? R.ok() : R.error("编辑失败"); + } + + + @PostMapping("/batchDeletion") + @ApiOperation(value = "批量删除", response = PartnerArticleFile.class) + public R batchDeletion(@ApiParam(name = "id", value = "主键", required = true) @RequestParam List ids) { + boolean delState = service.removeByIds(ids); + return delState ? R.ok() : R.error("删除失败"); + } +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/PartnerArticleLabelController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/PartnerArticleLabelController.java new file mode 100644 index 0000000..ece2882 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/PartnerArticleLabelController.java @@ -0,0 +1,95 @@ +package com.huoran.nakadai.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.nakadai.entity.PartnerArticleLabel; +import com.huoran.nakadai.service.PartnerArticleLabelService; +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 javax.servlet.http.HttpServletRequest; +import java.util.List; + + +/** + * @描述:合伙人——文章管理——文章主题标签控制类 + * @作者: Rong + * @日期: 2023-03-16 + */ +@RestController +@RequestMapping("/nakadai/partner/article/label") +@Api(value = "合伙人——文章管理——文章主题标签:PartnerArticleLabelController", tags = "R-合伙人——文章主题标签") +public class PartnerArticleLabelController { + + @Autowired + public PartnerArticleLabelService service; + + + @PostMapping("/queryAllArticleSubjectTags") + @ApiOperation(value = "查询全部文章主题标签(文章主题标签不区分)", response = PartnerArticleLabel.class) + public R queryAllArticleSubjectTags() { + List list = service.list(null); + return R.ok().put("data", list); + } + + + @PostMapping("/findById") + @ApiOperation(value = "查询详情", response = PartnerArticleLabel.class) + public R findById(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { + PartnerArticleLabel partnerArticleLabel = service.getById(id); + return R.ok().put("data", partnerArticleLabel); + } + + + @PostMapping("/save") + @ApiOperation(value = "新增", response = PartnerArticleLabel.class) + public R save(@RequestBody @ApiParam(name = "合伙人——文章管理——文章主题标签对象", value = "传入json格式", required = true) PartnerArticleLabel partnerArticleLabel, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + partnerArticleLabel.setFounderId(Integer.parseInt(accountId)); + partnerArticleLabel.setEditorId(Integer.parseInt(accountId)); + boolean addState = service.save(partnerArticleLabel); + return addState ? R.ok() : R.error("新增失败"); + } + + + @PostMapping("/checkForHeavy") + @ApiOperation(value = "标签校验判重", response = PartnerArticleLabel.class) + public R checkForHeavy( @ApiParam(name = "labelName", value = "标签名称", required = true) @RequestParam String labelName, @ApiParam(name = "labelId", value = "标签id(新增不传,编辑传)", required = false) @RequestParam Integer labelId) { + + QueryWrapper queryWrapper = new QueryWrapper().eq("label_name", labelName); + + //id不得空表示编辑校验 + if (labelId != null) { + queryWrapper.last(" and id != " + labelId); + } + PartnerArticleLabel contentLabel = service.getOne(queryWrapper); + if (contentLabel != null) { + return R.error("当前标签名称已存在!"); + } + return R.ok(); + + } + + + @PostMapping("/update") + @ApiOperation(value = "修改", response = PartnerArticleLabel.class) + public R update(@RequestBody @ApiParam(name = "合伙人——文章管理——文章主题标签对象", value = "传入json格式", required = true) PartnerArticleLabel partnerArticleLabel, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + partnerArticleLabel.setEditorId(Integer.parseInt(accountId)); + boolean updateState = service.updateById(partnerArticleLabel); + return updateState ? R.ok() : R.error("编辑失败"); + } + + + @PostMapping("/batchDeletion") + @ApiOperation(value = "批量删除", response = PartnerArticleLabel.class) + public R batchDeletion(@ApiParam(name = "id", value = "主键", required = true) @RequestParam List ids) { + boolean delState = service.removeByIds(ids); + return delState ? R.ok() : R.error("删除失败"); + } +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/PartnerArticleManagementController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/PartnerArticleManagementController.java new file mode 100644 index 0000000..63d1905 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/PartnerArticleManagementController.java @@ -0,0 +1,216 @@ +package com.huoran.nakadai.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.huoran.api.UserClient; +import com.huoran.common.constant.DelConstant; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.nakadai.entity.PartnerArticleFile; +import com.huoran.nakadai.entity.PartnerArticleManagement; +import com.huoran.nakadai.entity.PartnerArticleManagementCollect; +import com.huoran.nakadai.entity.req.PagePartnerArticleManagementReq; +import com.huoran.nakadai.entity.res.PartnerArticleManagementResp; +import com.huoran.nakadai.entity.vo.ContentHeavyTitleReqVO; +import com.huoran.nakadai.service.*; +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 javax.servlet.http.HttpServletRequest; +import javax.validation.Valid; +import java.util.Date; +import java.util.List; + + +/** + * @描述:合伙人——文章管理控制类 + * @作者: Rong + * @日期: 2023-03-16 + */ +@RestController +@RequestMapping("/nakadai/partner/article/management") +@Api(value = "合伙人——文章管理:PartnerArticleManagementController", tags = "R-合伙人——文章管理") +public class PartnerArticleManagementController { + + @Autowired + public PartnerArticleManagementService service; + + @Autowired + public PartnerArticleManagementCollectService articleManagementCollectService; + + @Autowired + public PartnerArticleClassificationService classificationService; + + @Autowired + public PartnerArticleFileService fileService; + + @Autowired + public PartnerArticleLabelService labelService; + @Autowired + private UserClient userClient; + + @PostMapping("/partnerOperatingList") + @ApiOperation(value = "合伙人运营列表", response = PartnerArticleManagementResp.class) + public R partnerOperatingList(@RequestBody PagePartnerArticleManagementReq partnerArticleManagement, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + partnerArticleManagement.setAccountId(Integer.valueOf(accountId)); + return service.partnerOperatingList(partnerArticleManagement); + } + + + @PostMapping("/findById") + @ApiOperation(value = "查询详情", response = PartnerArticleManagement.class) + public R findById(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { + PartnerArticleManagement partnerArticleManagement = service.getById(id); + List fileList = fileService.getFileByContentId(id); + partnerArticleManagement.setFileList(fileList); + partnerArticleManagement.setClassificationNameList(classificationService.categoryIdsQueriesCategoryInformation(partnerArticleManagement.getClassificationId() + "")); + partnerArticleManagement.setLabelNameList((labelService.idsQueriesLabelInformation(partnerArticleManagement.getLableId() + ""))); + return R.ok().put("data", partnerArticleManagement); + } + + + @PostMapping("/save") + @ApiOperation(value = "新增", response = PartnerArticleManagement.class) + public R save(@RequestBody @ApiParam(name = "合伙人文章管理对象", value = "传入json格式", required = true) PartnerArticleManagement articleManagement, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + articleManagement.setFounderId(Integer.parseInt(accountId)); + articleManagement.setEditorId(Integer.parseInt(accountId)); + /* + QueryWrapper queryWrap = new QueryWrapper<>(); + queryWrap.eq("type_id", articleManagement.getTypeId()); + Integer count = service.count(queryWrap); + if (count == 0) { + count = 1; + }*/ +// articleManagement.setSequence(count + 1); + boolean addState = service.save(articleManagement); + //附件新增数据处理 + if (articleManagement.getFileList().size() > 0) { + for (PartnerArticleFile partnerArticleFile : articleManagement.getFileList()) { + partnerArticleFile.setContentId(articleManagement.getId()); + partnerArticleFile.setFounderId(Integer.parseInt(accountId)); + partnerArticleFile.setEditorId(Integer.parseInt(accountId)); + fileService.save(partnerArticleFile); + } + } + return addState ? R.ok() : R.error("新增失败"); + } + + + @PostMapping("/update") + @ApiOperation(value = "修改", response = PartnerArticleManagement.class) + public R update(@RequestBody @ApiParam(name = "合伙人——文章管理对象", value = "传入json格式", required = true) PartnerArticleManagement partnerArticleManagement, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); +// partnerArticleManagement.setFounderId(Integer.parseInt(accountId)); + partnerArticleManagement.setEditorId(Integer.parseInt(accountId)); + ContentHeavyTitleReqVO content = new ContentHeavyTitleReqVO(); + content.setTitle(partnerArticleManagement.getTitle()); + content.setTypeId(partnerArticleManagement.getTypeId()); + content.setId(partnerArticleManagement.getId()); + boolean verify = service.checkIfTheTitleIsRepeat(content); + if (verify == false) { + return R.error("该标题已重复"); + } + + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.set("is_del", DelConstant.IS_DEL); + updateWrapper.eq("content_id", partnerArticleManagement.getId()); + fileService.update(new PartnerArticleFile(), updateWrapper); + + + //附件新增数据处理 + if (partnerArticleManagement.getFileList().size() > 0) { + for (PartnerArticleFile partnerArticleFile : partnerArticleManagement.getFileList()) { + partnerArticleFile.setContentId(partnerArticleManagement.getId()); + partnerArticleFile.setFounderId(Integer.parseInt(accountId)); + partnerArticleFile.setEditorId(Integer.parseInt(accountId)); + fileService.save(partnerArticleFile); + } + } + + boolean updateState = service.updateById(partnerArticleManagement); + return updateState ? R.ok() : R.error("编辑失败"); + } + + + @PostMapping("/batchDeletion") + @ApiOperation(value = "批量删除", response = PartnerArticleManagement.class) + public R batchDeletion(@ApiParam(name = "id", value = "主键", required = true) @RequestParam List ids) { + + boolean delState = service.removeByIds(ids); + return delState ? R.ok() : R.error("删除失败"); + } + + @PostMapping("/articleEnableOrDisable") + @ApiOperation(value = "文章启用禁用", response = PartnerArticleManagement.class) + public R articleEnableOrDisable(@ApiParam(name = "id", value = "文章id", required = true) @RequestParam Integer id, @ApiParam(name = "isDisable", value = "是否禁用(0默认,0启用 1禁用)", required = true) @RequestParam Integer isDisable) { + UpdateWrapper updateWrapper = new UpdateWrapper(); + updateWrapper.set("is_disable", isDisable); + updateWrapper.eq("id", id); + boolean ret = service.update(new PartnerArticleManagement(), updateWrapper); + return ret ? R.ok() : R.error("禁用/启用失败"); + } + + + @PostMapping("/checkIfTheTitleIsRepeat") + @ApiOperation(value = "标题判重——只对已发布的判重(新增,编辑,点击发布时候都要调用判断))", response = PartnerArticleManagement.class) + public R checkIfTheTitleIsRepeat(@RequestBody @Valid ContentHeavyTitleReqVO content) { + return service.checkIfTheTitleIsRepeat(content) ? R.ok() : R.error("该标题已重复!"); + } + + + @PostMapping("/articleTopOperation") + @ApiOperation(value = "文章置顶/取消置顶", response = PartnerArticleManagement.class) + public R articleTopOperation(@ApiParam(name = "isTop", value = "是否置顶(默认为0 不置顶 1为置顶)", required = true) @RequestParam Integer isTop, @ApiParam(name = "articleId", value = "文章Id", required = true) @RequestParam Integer articleId) { + //是否置顶(默认为0 不置顶 1为置顶) + UpdateWrapper updateWrap = new UpdateWrapper<>(); + updateWrap.set("is_top", isTop); + if (isTop == 1) { + updateWrap.set("top_time", new Date());//置顶时间(置顶一次更新一次) + } else { + updateWrap.set("top_time", null); + } + updateWrap.eq("id", articleId); + boolean ret = service.update(new PartnerArticleManagement(), updateWrap); + return ret ? R.ok() : R.error("操作失败"); + + } + + + @PostMapping("/collectCourse") + @ApiOperation(value = "收藏课程", response = PartnerArticleManagement.class) + public R collectCourse(@ApiParam(name = "contentId", value = "文章id", required = true) @RequestParam Integer contentId, @ApiParam(name = "state", value = "操作状态(state = 1收藏,0取消收藏)", required = true) @RequestParam Integer state, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + QueryWrapper queryWrapper = new QueryWrapper(); + queryWrapper.eq("content_id", contentId); + queryWrapper.eq("account_id", accountId); + + PartnerArticleManagementCollect detail = articleManagementCollectService.getOne(queryWrapper); + switch (state) { + case 0://取消收藏 + if (detail != null) { + articleManagementCollectService.removeById(detail.getId()); + } + break; + + case 1://收藏 + if (detail != null) { + return R.ok("已经收藏过了!"); + } + PartnerArticleManagementCollect courseCollect = new PartnerArticleManagementCollect(); + courseCollect.setContentId(contentId); + courseCollect.setCollectionTime(new Date()); + courseCollect.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); + courseCollect.setAccountId(Integer.valueOf(accountId)); + articleManagementCollectService.save(courseCollect); + break; + } + return R.ok(); + } + +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/PartnerClassificationController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/PartnerClassificationController.java new file mode 100644 index 0000000..f0e9717 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/PartnerClassificationController.java @@ -0,0 +1,119 @@ +package com.huoran.nakadai.controller; + + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.PartnerClassification; +import com.huoran.nakadai.entity.req.PartnerClassificationAddReq; +import com.huoran.nakadai.service.PartnerClassificationService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.List; + +/** + *

+ * 合伙人分类表 前端控制器 + *

+ * + * @author chen + * @since 2022-05-18 + */ +@Api(tags = "合伙人分类管理") +@RestController +@RequestMapping("/nakadai/partnerClassification") +public class PartnerClassificationController { + + @Autowired + public PartnerClassificationService partnerClassificationService; + + /** + * 新增合伙人分类 + */ + @PostMapping("/save") + @ApiOperation(value = "新增合伙人分类") + public R save(@RequestBody @Valid PartnerClassificationAddReq PartnerClassificationAddReq) { + + //暂时无限制 +/* if (PartnerClassificationAddReq.getLevel() > 6) { + return R.error("暂不支持" + PartnerClassificationAddReq.getLevel() + "层级"); + }*/ + + PartnerClassification partnerClassification = new PartnerClassification(); + BeanUtils.copyProperties(PartnerClassificationAddReq, partnerClassification); + + boolean ok = partnerClassificationService.checkRepeat(partnerClassification); + if (ok) { + return R.error("同级下已存在相同的名称:" + PartnerClassificationAddReq.getPartnerClassificationName()); + } + boolean save = partnerClassificationService.save(partnerClassification); + return save ? R.ok().put("id", partnerClassification.getId()) : R.error(); + + } + + /** + * 编辑合伙人分类 + */ + @PostMapping("/update") + @ApiOperation(value = "编辑合伙人分类") + public R update(@RequestBody @Valid PartnerClassification partnerClassification) { + boolean ok = false; + PartnerClassification byId = partnerClassificationService.getById(partnerClassification.getId()); + //名字未修改,不用进行判重 + if (!byId.getPartnerClassificationName().equals(partnerClassification.getPartnerClassificationName())){ + //全部分类进行判重 + ok = partnerClassificationService.checkRepeatAll(partnerClassification); + } + if (ok) { + return R.error("已存在相同的名称:" + partnerClassification.getPartnerClassificationName()); + } else { + boolean update = partnerClassificationService.updateById(partnerClassification); + if (partnerClassification.getIsTeam()==1){ + //更新团员所属团队名称 + List partnerClassifications = partnerClassificationService.list(new QueryWrapper(). + eq("parent_id", partnerClassification.getId())); + partnerClassifications.forEach(partnerClassification1 -> { + partnerClassification1.setPartnerClassificationName(partnerClassification.getPartnerClassificationName()); + partnerClassificationService.updateById(partnerClassification1); + }); + } + return update ? R.ok() : R.error(); + } + } + + /** + * 删除合伙人分类 + */ + @PostMapping("/delete") + @ApiOperation(value = "删除合伙人分类") + public R delete(@ApiParam(name = "id", value = "分类id", required = true) @RequestParam Integer id) { + //级联删除子分类 + boolean remove = partnerClassificationService.removeClassification(id); + return remove ? R.ok() : R.error(); + } + + /** + * 合伙人分类树形列表 + */ + @PostMapping("/treeList") + @ApiOperation(value = "合伙人分类树形列表", response = PartnerClassification.class) + public R treeList(@ApiParam(name = "applet", value = "小程序标识", required = false) + @RequestParam(required = false) Integer applet) { + List list = partnerClassificationService.treeList(applet); + return R.ok().put("treeList", list); + } + + @GetMapping("/getAllTeam") + @ApiOperation(value = "查询所有团队") + public R getAllTeam() { + List team = partnerClassificationService.list(new QueryWrapper(). + eq("is_team", 1)); + return R.ok().put("team",team) ; + } +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/PartnerSchemeManagementController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/PartnerSchemeManagementController.java new file mode 100644 index 0000000..cea53b5 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/PartnerSchemeManagementController.java @@ -0,0 +1,138 @@ +package com.huoran.nakadai.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.nakadai.entity.PartnerSchemeManagement; +import com.huoran.nakadai.entity.PartnerSchemeManagementProductConfig; +import com.huoran.nakadai.entity.req.PagePartnerArticleManagementReq; +import com.huoran.nakadai.service.PartnerSchemeManagementProductConfigService; +import com.huoran.nakadai.service.PartnerSchemeManagementService; +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 javax.servlet.http.HttpServletRequest; +import java.util.List; + + +/** + * @描述:合伙人——方案管理控制类 + * @作者: Rong + * @日期: 2023-03-20 + */ +@RestController +@RequestMapping("/nakadai/partner/schemeManagement") +@Api(value = "合伙人——方案管理", tags = "R-合伙人——方案管理") +public class PartnerSchemeManagementController { + + @Autowired + public PartnerSchemeManagementService service; + @Autowired + public PartnerSchemeManagementProductConfigService productConfigService; + + @PostMapping("/schemeList") + @ApiOperation(value = "方案列表分页查询", response = PartnerSchemeManagement.class) + public R schemeList(@RequestBody PagePartnerArticleManagementReq partnerSchemeManagement) { + return service.schemeList(partnerSchemeManagement); + } + + + @PostMapping("/findById") + @ApiOperation(value = "查询详情", response = PartnerSchemeManagement.class) + public R findById(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { + PartnerSchemeManagement partnerSchemeManagement = service.getById(id); + //isRelease:是否发布(0:草稿 1:已发布) + Integer isRelease = partnerSchemeManagement.getIsRelease(); + List list = productConfigService.obtainProductsAccordingToTheScheme(id, isRelease); + if (list.size() > 0) { + partnerSchemeManagement.setProductList(list); + + } + return R.ok().put("data", partnerSchemeManagement); + } + + + @PostMapping("/save") + @ApiOperation(value = "新增", response = PartnerSchemeManagement.class) + public R save(@RequestBody @ApiParam(name = "合伙人——方案管理对象", value = "传入json格式", required = true) PartnerSchemeManagement partnerSchemeManagement, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + partnerSchemeManagement.setFounderId(Integer.parseInt(accountId)); + partnerSchemeManagement.setEditorId(Integer.parseInt(accountId)); + boolean addState = service.save(partnerSchemeManagement); + if (partnerSchemeManagement.getProductList().size() > 0) { + //新增到产品配置表 + for (PartnerSchemeManagementProductConfig productConfig : partnerSchemeManagement.getProductList()) { + productConfig.setSchemeId(partnerSchemeManagement.getId()); + productConfigService.save(productConfig); + } + + } + + + return addState ? R.ok() : R.error("新增失败"); + } + + + @PostMapping("/update") + @ApiOperation(value = "修改", response = PartnerSchemeManagement.class) + public R update(@RequestBody @ApiParam(name = "合伙人——方案管理对象", value = "传入json格式", required = true) PartnerSchemeManagement partnerSchemeManagement, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + partnerSchemeManagement.setEditorId(Integer.parseInt(accountId)); + + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(PartnerSchemeManagementProductConfig::getSchemeId, partnerSchemeManagement.getId()); + productConfigService.remove(lambdaQueryWrapper); + + if (partnerSchemeManagement.getProductList().size() > 0) { + //新增到产品配置表 + for (PartnerSchemeManagementProductConfig productConfig : partnerSchemeManagement.getProductList()) { + productConfigService.save(productConfig); + } + + } + + boolean updateState = service.updateById(partnerSchemeManagement); + return updateState ? R.ok() : R.error("编辑失败"); + } + + + @PostMapping("/delete") + @ApiOperation(value = "删除", response = PartnerSchemeManagement.class) + public R delete(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { + boolean delState = service.removeById(id); + return delState ? R.ok() : R.error("删除失败"); + } + + @PostMapping("/batchDeletion") + @ApiOperation(value = "批量删除", response = PartnerSchemeManagement.class) + public R batchDeletion(@ApiParam(name = "id", value = "主键", required = true) @RequestParam List ids) { + boolean delState = service.removeByIds(ids); + return delState ? R.ok() : R.error("删除失败"); + } + + + @PostMapping("/enableOrDisable") + @ApiOperation(value = "启用禁用", response = PartnerSchemeManagement.class) + public R enableOrDisable(@ApiParam(name = "id", value = "id", required = true) @RequestParam Integer id, + @ApiParam(name = "isDisable", value = "是否禁用(0默认,0启用 1禁用)", required = true) @RequestParam Integer isDisable) { + UpdateWrapper updateWrapper = new UpdateWrapper(); + updateWrapper.set("is_disable", isDisable); + updateWrapper.eq("id", id); + boolean ret = service.update(new PartnerSchemeManagement(), updateWrapper); + return ret ? R.ok() : R.error("禁用/启用失败"); + } + + + /*@PostMapping("/modifiedArticleSort") + @ApiOperation(value = "修改文章排序", response = PartnerSchemeManagement.class) + public R modifiedSort(@RequestBody List reqList) { + return service.modifiedSort(reqList); + }*/ + +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/PartnerSchemeManagementProductConfigController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/PartnerSchemeManagementProductConfigController.java new file mode 100644 index 0000000..64305ce --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/PartnerSchemeManagementProductConfigController.java @@ -0,0 +1,61 @@ +package com.huoran.nakadai.controller; + + +import com.huoran.nakadai.entity.PartnerSchemeManagementProductConfig; +import com.huoran.nakadai.service.PartnerSchemeManagementProductConfigService; +import org.springframework.web.bind.annotation.RequestMapping; +import com.huoran.api.UserClient; +import com.huoran.common.utils.TokenUtils; +import io.swagger.annotations.*; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.common.response.R; +import org.springframework.beans.factory.annotation.Autowired; +import org.apache.commons.lang.StringUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.Api; +import org.springframework.web.bind.annotation.RequestParam; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; + +import java.util.List; +import javax.servlet.http.HttpServletRequest; + +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 合伙人——方案管理——产品配置表 前端控制器 + *

+ * + * @author chen + * @since 2023-06-28 + */ + +/** + * @描述:合伙人——方案管理——产品配置表控制类 + * @作者: Rong + * @日期: 2023-06-28 + */ +@RestController +@RequestMapping("/partnerSchemeManagementProductConfig") +@Api(value = "合伙人——方案管理——产品配置表:PartnerSchemeManagementProductConfigController", tags = "R-合伙人——方案管理——产品配置表") +public class PartnerSchemeManagementProductConfigController { + + @Autowired + public PartnerSchemeManagementProductConfigService service; + + @Autowired + private UserClient userClient; + + + @PostMapping("/batchDeletion") + @ApiOperation(value = "批量删除", response = PartnerSchemeManagementProductConfig.class) + public R batchDeletion(@ApiParam(name = "id", value = "主键", required = true) @RequestBody List ids) { + boolean delState = service.removeByIds(ids); + return delState ? R.ok() : R.error("删除失败"); + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/PartnerTeamController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/PartnerTeamController.java new file mode 100644 index 0000000..87f6ae8 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/PartnerTeamController.java @@ -0,0 +1,199 @@ +package com.huoran.nakadai.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.huoran.api.UserClient; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.nakadai.entity.PartnerAccount; +import com.huoran.nakadai.entity.PartnerClassification; +import com.huoran.nakadai.entity.PartnerTeam; +import com.huoran.nakadai.entity.req.EditProvinceCityReq; +import com.huoran.nakadai.entity.req.PartnerTeamRateReq; +import com.huoran.nakadai.entity.vo.CheckVo; +import com.huoran.nakadai.service.PartnerAccountService; +import com.huoran.nakadai.service.PartnerClassificationService; +import com.huoran.nakadai.service.PartnerTeamService; +import com.huoran.nakadai.service.impl.PartnerAccountServiceImpl; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import javax.validation.Valid; +import java.util.List; + +/** + *

+ * 合伙人团队表(合伙人账号与分类中间表) 前端控制器 + *

+ * + * @author chen + * @since 2022-05-18 + */ +@Api(tags = "团队管理") +@RestController +@RequestMapping("/nakadai/partner-team") +public class PartnerTeamController { + + @Autowired + public PartnerTeamService partnerTeamService; + + @Autowired + public PartnerAccountService accountService; + + @Autowired + public PartnerAccountServiceImpl accountServiceImpl; + + @Autowired + public PartnerClassificationService classificationService; + + @Autowired + private UserClient userClient; + + /*@ApiOperation(value = "团队成员列表") + @GetMapping(value = "/teamList") + public R teamList( + @ApiParam(name = "id", value = "团队id", required = true) + @RequestParam String id, + @ApiParam(name = "current", value = "当前页码", required = true) + @RequestParam int current, + @ApiParam(name = "pageSize", value = "每页记录数", required = true) + @RequestParam int pageSize, + @ApiParam(name = "name", value = "成员名称", required = false) + @RequestParam(value = "name") String name){ + List teamList = partnerTeamService.selectTeamList(id,current,pageSize,name); + return R.ok().put("teamList",teamList); + }*/ + + @ApiOperation(value = "我的") + @GetMapping(value = "/my") + public R my( + @ApiParam(name = "partnerId", value = "商务经理id", required = false) + @RequestParam(required = false) String partnerId, + @ApiParam(name = "teamId", value = "团队id", required = false) + @RequestParam(required = false) String teamId, HttpServletRequest request){ + int platformId = 3; + if (StringUtils.isNotEmpty(partnerId)||StringUtils.isNotEmpty(teamId)){ + platformId = 4; + } + String id = TokenUtils.getIdByJwtToken(request); + String phone = partnerTeamService.getPhone(id,platformId); + + return partnerTeamService.queryUserInfoByPhone(phone,partnerId,teamId); + } + + @ApiOperation(value = "查询手机号用户") + @GetMapping(value = "/queryUserInfoByPhone") + public R queryUserInfoByPhone( + @ApiParam(name = "phone", value = "手机号", required = true) + @RequestParam String phone ){ + return partnerTeamService.queryPhone(phone); + } + + @ApiOperation(value = "更新邮箱") + @PostMapping("/updateMyEmail") + public R updateMyEmail(@RequestBody CheckVo checkVo, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + checkVo.setAccountId(accountId); + return partnerTeamService.updateMyEmail(checkVo); + } + + @ApiOperation(value = "邮箱验证码发送") + @PostMapping("/mailCodeSend") + public R mailCodeSend(@RequestBody CheckVo checkVo, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + checkVo.setAccountId(accountId); + boolean send = partnerTeamService.mailCodeSend(checkVo); + return send ? R.ok() : R.error(); + } + + @ApiOperation(value = "编辑合伙人信息") + @PostMapping("/editProvinceCity") + public R editProvinceCity(@RequestBody @Valid EditProvinceCityReq provinceCityReq) { + if (provinceCityReq.getUserName()!=null){ + boolean res = partnerTeamService.checkName(provinceCityReq); + if (res){ + return R.error("合伙人姓名已存在!"); + } + //修改用户姓名 + partnerTeamService.editUsername(provinceCityReq); + } + //更新角色 + if (provinceCityReq.getRoleList() != null) { + //团队成员不能赋予超管角色 + if (provinceCityReq.getIsTeam()!=null && provinceCityReq.getIsTeam()!=1){ + for (Integer integer : provinceCityReq.getRoleList()) { + //测试|正式 + if (integer==172||integer==123){ + return R.error("团体成员无法设置超管角色!"); + } + } + } + + // 负责人角色从未认证改为超管后,成员未认证修改 + if (provinceCityReq.getRoleName()!=null && provinceCityReq.getRoleName().contains("未认证")){ + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("parent_id",provinceCityReq.getClassificationId()); + queryWrapper.eq("is_team",0); + List list = classificationService.list(queryWrapper); + for (PartnerClassification partnerClassification : list) { + QueryWrapper teamQueryWrapper = new QueryWrapper<>(); + teamQueryWrapper.eq("classification_id",partnerClassification.getId()); + PartnerTeam one = partnerTeamService.getOne(teamQueryWrapper); + PartnerAccount partnerAccount = accountService.getById(one.getPartnerId()); + + //删除该账号在所在团队的角色 + partnerTeamService.delRoleByAccountIdAndTeamId(partnerAccount.getAccountId(),partnerClassification.getId()); + //账号赋予团队成员角色 + accountServiceImpl.assignTeamMemberRoles(partnerAccount.getAccountId(),0,partnerClassification.getId()); + } + } + //删除该账号在所在团队的角色 + partnerTeamService.delRoleByAccountIdAndTeamId(provinceCityReq.getAccountId(),provinceCityReq.getClassificationId()); + //账号赋予所在团队角色 + userClient.rolePermissionService(provinceCityReq.getAccountId(), provinceCityReq.getRoleList(),provinceCityReq.getClassificationId()); + } + if (provinceCityReq.getProvinceId()!=null||provinceCityReq.getCityId()!=null){ + //更新省份城市 + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.set("province_id",provinceCityReq.getProvinceId()); + updateWrapper.set("city_id",provinceCityReq.getCityId()); + updateWrapper.eq("classification_id",provinceCityReq.getClassificationId()); + updateWrapper.eq("partner_id",provinceCityReq.getPartnerId()); + partnerTeamService.update(new PartnerTeam(), updateWrapper); + } + return R.ok(); + } + + @ApiOperation(value = "编辑合伙人团队费率") + @PostMapping("/editPartnerTeamRates") + public R editPartnerTeamRates(@RequestBody @Valid PartnerTeamRateReq teamRateReq) { + //更新费率 + UpdateWrapper updateWrapper = new UpdateWrapper<>(); +/* if (teamRateReq.getAnnualTeamFee()!=null){ + }*/ + updateWrapper.set("annual_team_fee",teamRateReq.getAnnualTeamFee()); + updateWrapper.set("annual_marketing_fee",teamRateReq.getAnnualMarketingFee()); +// if (teamRateReq.getAnnualMarketingFee()!=null){ +// } + updateWrapper.eq("classification_id",teamRateReq.getTeamId()); + updateWrapper.eq("partner_id",teamRateReq.getPartnerId()); + boolean update = partnerTeamService.update(new PartnerTeam(), updateWrapper); + return update ? R.ok() : R.error(); + } + + @ApiOperation(value = "查询合伙人团队费率") + @PostMapping("/getPartnerTeamRates") + public R getPartnerTeamRates(@RequestBody @Valid PartnerTeamRateReq teamRateReq) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("classification_id",teamRateReq.getTeamId()); + PartnerTeam one = partnerTeamService.getOne(queryWrapper); + return R.ok().put("teamRates",one); + } + +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/ProductClassificationController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/ProductClassificationController.java new file mode 100644 index 0000000..9e4ad41 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/ProductClassificationController.java @@ -0,0 +1,76 @@ +package com.huoran.nakadai.controller; + + +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.ProductClassification; +import com.huoran.nakadai.service.ProductClassificationService; +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.List; + +/** + *

+ * 产品分类表 前端控制器 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@Api(value = "M-商品产品分类管理", tags = "M-商品产品分类管理") +@RestController +@RequestMapping("/productClassification") +public class ProductClassificationController { + + @Autowired + private ProductClassificationService classificationService; + + @ApiOperation(value = "添加产品分类") + @PostMapping("/addProductCategory") + public R addProductCategory( + @ApiParam(name = "classificationName", value = "分类名称", required = true) + @RequestParam String classificationName) { + //名称判重 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("classification_name",classificationName); + ProductClassification one = classificationService.getOne(queryWrapper); + if (ObjectUtil.isNotNull(one)){ + return R.error("产品分类已存在!"); + } + //新增产品分类 + ProductClassification classification = new ProductClassification(); + classification.setClassificationName(classificationName); + boolean save = classificationService.save(classification); + return save ? R.ok() : R.error(); + } + + @ApiOperation(value = "产品分类列表") + @GetMapping("/productCategoryList") + public R productCategoryList( + @ApiParam(name = "search", value = "查询条件",required = false) + @RequestParam(required = false) String search) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + if (search!=null){ + queryWrapper.like("classification_name",search); + } + List classificationList = classificationService.list(queryWrapper); + return R.ok().put("classificationList",classificationList); + } + + @ApiOperation(value = "删除产品分类") + @PostMapping("/deleteProductCategory") + public R deleteProductCategory( + @ApiParam(name = "categoryId", value = "分类id", required = true) + @RequestParam Integer categoryId) { + boolean remove = classificationService.removeById(categoryId); + return remove ? R.ok() : R.error(); + } + + +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/ProductThemeController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/ProductThemeController.java new file mode 100644 index 0000000..6ef40a0 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/ProductThemeController.java @@ -0,0 +1,55 @@ +package com.huoran.nakadai.controller; + +import com.huoran.api.UserClient; +import com.huoran.common.utils.TokenUtils; +import io.swagger.annotations.*; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.common.response.R; +import org.springframework.beans.factory.annotation.Autowired; +import org.apache.commons.lang.StringUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.Api; +import org.springframework.web.bind.annotation.RequestParam; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import com.huoran.nakadai.service.ProductThemeService; +import com.huoran.nakadai.entity.ProductTheme; +import org.apache.commons.io.FileUtils; +import org.apache.commons.io.IOUtils; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.List; +import javax.servlet.http.HttpServletRequest; + +/** + * @描述:控制类 + * @作者: Rong + * @日期: 2023-08-22 + */ +@RestController +@RequestMapping("/productTheme") +@Api(value = "产品主题:ProductThemeController", tags = "R-产品主题") +public class ProductThemeController { + + @Autowired + public ProductThemeService service; + + @PostMapping("/allSubjects") + @ApiOperation(value = "全部主题", response = ProductTheme.class) + public R allSubjects() { + List list = service.list(null); + return R.ok().put("data", list); + } + +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/ProductTypeController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/ProductTypeController.java new file mode 100644 index 0000000..ae5d490 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/ProductTypeController.java @@ -0,0 +1,91 @@ +package com.huoran.nakadai.controller; + + +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.ProductType; +import com.huoran.nakadai.service.ProductTypeService; +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.List; + +/** + *

+ * 产品类型表 前端控制器 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@Api(value = "M-商品产品类型管理", tags = "M-商品产品类型管理") +@RestController +@RequestMapping("/productType") +public class ProductTypeController { + + @Autowired + private ProductTypeService typeService; + + @ApiOperation(value = "添加产品类型") + @PostMapping("/addProductType") + public R addProductType( + @ApiParam(name = "typeName", value = "类型名称", required = true) + @RequestParam String typeName) { + //名称判重 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("type_name",typeName); + ProductType one = typeService.getOne(queryWrapper); + if (ObjectUtil.isNotNull(one)){ + return R.error("产品类型已存在!"); + } + //新增产品分类 + ProductType type = new ProductType(); + type.setTypeName(typeName); + boolean save = typeService.save(type); + return save ? R.ok() : R.error(); + } + + @ApiOperation(value = "更新产品类型") + @PostMapping("/updateProductType") + public R updateProductType( + @ApiParam(name = "type", value = "类型", required = true) + @RequestBody ProductType type) { + //名称判重 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("type_name",type.getTypeName()).notInSql("type_id",type.getTypeId().toString()); + ProductType one = typeService.getOne(queryWrapper); + if (ObjectUtil.isNotNull(one)){ + return R.error("产品类型已存在!"); + } + boolean save = typeService.updateById(type); + return save ? R.ok() : R.error(); + } + + @ApiOperation(value = "产品类型列表") + @GetMapping("/productTypeList") + public R productTypeList( + @ApiParam(name = "search", value = "查询条件",required = false) + @RequestParam(required = false) String search) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + if (search!=null){ + queryWrapper.like("type_name",search); + } + List typeList = typeService.list(queryWrapper); + return R.ok().put("typeList",typeList); + } + + @ApiOperation(value = "删除产品类型") + @PostMapping("/deleteProductType") + public R deleteProductType( + @ApiParam(name = "typeId", value = "类型id", required = true) + @RequestParam Integer typeId) { + boolean remove = typeService.removeById(typeId); + return remove ? R.ok() : R.error(); + } + +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/ProfessionalClassController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/ProfessionalClassController.java new file mode 100644 index 0000000..424d29d --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/ProfessionalClassController.java @@ -0,0 +1,42 @@ +package com.huoran.nakadai.controller; + + +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.ProfessionalClass; +import com.huoran.nakadai.entity.res.CustomerDetailRes; +import com.huoran.nakadai.service.IProfessionalClassService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + *

+ * 前端控制器 + *

+ * + * @author huoran + * @since 2021-07-09 + */ +@Api(value = "专业类管理", tags = "专业类管理") +@RestController +@RequestMapping("/nakadai/professionalClass") +public class ProfessionalClassController { + + @Autowired + private IProfessionalClassService iProfessionalClassService; + + /** + * 查询专业类 + * @param disciplineIds + * @return + */ + @ApiOperation(value = "查询专业类",notes = "查询专业类",response = ProfessionalClass.class) + @PostMapping("/queryProfessionalClass") + public R queryProfessionalClass(@RequestBody List disciplineIds) { + List result = iProfessionalClassService.queryProfessionalClass(disciplineIds); + return R.ok().put("result",result); + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/ProfessionalController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/ProfessionalController.java new file mode 100644 index 0000000..6eec4e3 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/ProfessionalController.java @@ -0,0 +1,39 @@ +package com.huoran.nakadai.controller; + + +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.Professional; +import com.huoran.nakadai.entity.ProfessionalClass; +import com.huoran.nakadai.service.IProfessionalService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import org.springframework.stereotype.Controller; + +import java.util.List; + +/** + *

+ * 专业 前端控制器 + *

+ * + * @author huoran + * @since 2021-07-09 + */ +@Api(value = "专业管理", tags = "专业管理") +@RestController +@RequestMapping("/nakadai/professional") +public class ProfessionalController { + + @Autowired + private IProfessionalService iProfessionalService; + + @ApiOperation(value = "查询专业",notes = "查询专业",response = Professional.class) + @GetMapping("/queryProfessional") + public R queryProfessional(@RequestParam Integer professionalClassId) { + List result = iProfessionalService.queryProfessional(professionalClassId); + return R.ok().put("result",result); + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/ProgramShoppingCartController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/ProgramShoppingCartController.java new file mode 100644 index 0000000..8b0123c --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/ProgramShoppingCartController.java @@ -0,0 +1,65 @@ +package com.huoran.nakadai.controller; + +import com.huoran.api.UserClient; +import com.huoran.common.utils.TokenUtils; +import com.huoran.nakadai.entity.ProgramShoppingCart; +import com.huoran.nakadai.entity.req.ProgramShoppingCartReq; +import com.huoran.nakadai.service.ProgramShoppingCartService; +import io.swagger.annotations.*; +import com.huoran.common.response.R; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.Api; +import org.springframework.web.bind.annotation.RequestParam; +import io.swagger.annotations.ApiOperation; + +import java.util.List; +import javax.servlet.http.HttpServletRequest; + +/** + * @描述:小程序—购物车控制类 + * @作者: Rong + * @日期: 2023-06-09 + */ +@RestController +@RequestMapping("/mini/program/shopping/cart") +@Api(value = "小程序—购物车:ProgramShoppingCartController", tags = "R-小程序—购物车") +public class ProgramShoppingCartController { + + @Autowired + public ProgramShoppingCartService service; + + @Autowired + private UserClient userClient; + + @PostMapping("/shoppingCartList") + @ApiOperation(value = "购物车列表", response = ProgramShoppingCart.class) + public R shoppingCartList(@RequestBody ProgramShoppingCartReq req, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + req.setAccountId(Integer.valueOf(accountId)); + return service.shoppingCartList(req); + } + + + @PostMapping("/addToShoppingCart") + @ApiOperation(value = "加入购物车", response = ProgramShoppingCart.class) + public R save(@RequestBody @ApiParam(name = "小程序—购物车对象", value = "传入json格式", required = true) ProgramShoppingCart ProgramShoppingCart, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + ProgramShoppingCart.setAccountId(Integer.valueOf(accountId)); + boolean addState = service.save(ProgramShoppingCart); + return addState ? R.ok() : R.error("新增失败"); + } + + + + @PostMapping("/batchDeletion") + @ApiOperation(value = "批量删除购物车产品", response = ProgramShoppingCart.class) + public R batchDeletion(@ApiParam(name = "id", value = "主键", required = true) @RequestBody List ids) { + boolean delState = service.removeByIds(ids); + return delState ? R.ok() : R.error("删除失败"); + } +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/ProvinceController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/ProvinceController.java new file mode 100644 index 0000000..83b6bb7 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/ProvinceController.java @@ -0,0 +1,46 @@ +package com.huoran.nakadai.controller; + + +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.City; +import com.huoran.nakadai.entity.Province; +import com.huoran.nakadai.service.IProvinceService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + *

+ * 省份表 前端控制器 + *

+ * + * @author huoran + * @since 2021-07-08 + */ +@Api(value = "省份管理", tags = "省份管理") +@RestController +@RequestMapping("/nakadai/province") +public class ProvinceController { + + @Autowired + private IProvinceService iProvinceService; + + /** + * 查询省份 + * @return + */ + @ApiOperation(value = "查询省份",notes = "查询省份") + @GetMapping("/queryProvince") + public R queryProvince() { + List list = iProvinceService.queryProvince(); + return R.ok(list); + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/SchoolController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/SchoolController.java new file mode 100644 index 0000000..ca8600b --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/SchoolController.java @@ -0,0 +1,126 @@ +package com.huoran.nakadai.controller; + + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.common.constant.DelConstant; +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.City; +import com.huoran.nakadai.entity.Province; +import com.huoran.nakadai.entity.School; +import com.huoran.nakadai.service.ICityService; +import com.huoran.nakadai.service.IProvinceService; +import com.huoran.nakadai.service.ISchoolService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.data.redis.core.StringRedisTemplate; +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.List; + +/** + *

+ * 学校表 前端控制器 + *

+ * + * @author huoran + * @since 2021-06-29 + */ +@Api(value = "学校管理", tags = "学校管理") +@RestController +@RequestMapping("/nakadai/school") +public class SchoolController { + + @Autowired + private ISchoolService iSchoolService; + + @Autowired + private ICityService iCityService; + + @Autowired + private StringRedisTemplate redisTemplate; + @Autowired + private IProvinceService iProvinceService; + + + @ApiOperation(value = "查询学校列表", notes = "查询学校列表") + @GetMapping("/querySchool") + public R querySchool(@RequestParam(required = false) String schoolName, @RequestParam(required = false) Integer provinceId, @RequestParam(required = false) Integer cityId) { + List data = iSchoolService.querySchool(schoolName, provinceId, cityId); + return R.ok(data); + } + + + @ApiOperation(value = "按省市份获取学校", notes = "按省市获取学校") + @GetMapping("/getSchoolsByProvince") + public R getSchoolsByProvince(@RequestParam(required = false) String schoolName, @RequestParam(required = false) Integer provinceId, @RequestParam(required = false) Integer cityId) { + List data = iSchoolService.getSchoolsByProvince(schoolName, provinceId, cityId); + return R.ok(data); + } + + + @ApiOperation(value = "按学校id获取学校名称", notes = "按学校id获取学校名称") + @GetMapping("/getTheSchoolNameBySchoolId") + public School getTheSchoolNameBySchoolId(@RequestParam(required = false) Integer schoolId) { + + School school = iSchoolService.getById(schoolId); + return school; + } + + @ApiOperation(value = "按学校名称获取id", notes = "按学校名称获取id") + @GetMapping("/getTheIdBySchoolName") + public School getTheIdBySchoolName(@RequestParam(required = false) String schoolName) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("school_name", schoolName); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + School school = iSchoolService.getOne(queryWrapper); + return school; + } + + + @ApiOperation(value = "自行新增客户或者学校", notes = "自行新增客户或者学校") + @CacheEvict(value = "n_school_", key = "'querySchool'") + @GetMapping("/addNewCustomersByOneself") + public R addNewCustomersByOneself(@RequestParam(required = false) String schoolName, @RequestParam(required = false) String provinceName, @RequestParam(required = false) String cityName) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("school_name", schoolName); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + School school = iSchoolService.getOne(queryWrapper); + + + QueryWrapper provinceQueryWrapper = new QueryWrapper<>(); + provinceQueryWrapper.eq("province_name", provinceName); + provinceQueryWrapper.eq("is_del", DelConstant.NOT_DEL); + Province province = iProvinceService.getOne(provinceQueryWrapper); + + + QueryWrapper cityQueryWrapper = new QueryWrapper<>(); + cityQueryWrapper.eq("city_name", cityName); + cityQueryWrapper.eq("is_del", DelConstant.NOT_DEL); + City city = iCityService.getOne(cityQueryWrapper); + + + if (school == null) { + //新增 + if (province != null && city != null) { + School school1 = new School(); + school1.setCityId(city.getCityId()); + school1.setProvinceId(province.getProvinceId()); + school1.setSchoolName(schoolName); + school1.setProvinceName(provinceName); + school1.setCityName(cityName); + school1.setLevel(0); + school1.setIsDel("0"); + //删除缓存 n_school_::querySchool + redisTemplate.delete("querySchool"); + + return iSchoolService.save(school1) ? R.ok().put("schoolId",school1.getSchoolId()) : R.error(); + } + } + return R.error("当前客户/学校已存在!"); + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/ServiceConfigurationController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/ServiceConfigurationController.java new file mode 100644 index 0000000..943e573 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/ServiceConfigurationController.java @@ -0,0 +1,48 @@ +package com.huoran.nakadai.controller; + + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.ServiceConfiguration; +import com.huoran.nakadai.entity.req.ServiceConfigurationReq; +import com.huoran.nakadai.service.IServiceConfigurationService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import org.springframework.stereotype.Controller; + +import javax.validation.Valid; +import java.util.List; + +/** + *

+ * 服务配置表 前端控制器 + *

+ * + * @author Mr.JK + * @since 2021-09-08 + */ +@RestController +@RequestMapping("/nakadai/serviceConfiguration") +@Api(tags = "服务配置") +public class ServiceConfigurationController { + + @Autowired + private IServiceConfigurationService serviceConfigurationService; + + @ApiOperation(value = "服务配置列表") + @PostMapping("/getAllService") + public R getAllService(@RequestBody @Valid ServiceConfigurationReq serviceReq){ + IPage serviceList = serviceConfigurationService.getAllService(serviceReq); + return R.ok().put("serviceList",serviceList); + } + + @ApiOperation(value = "根据系统id获取系统名称 Feign") + @GetMapping("/getSystemNameBySystemId") + public String getSystemNameBySystemId(@RequestParam Integer SystemId){ + return serviceConfigurationService.getSystemNameBySystemId(SystemId); + } + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/StudentModelCorrelationController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/StudentModelCorrelationController.java new file mode 100644 index 0000000..793a88b --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/StudentModelCorrelationController.java @@ -0,0 +1,91 @@ +package com.huoran.nakadai.controller; + +import com.huoran.api.UserClient; +import com.huoran.common.constant.DelConstant; +import com.huoran.common.constant.ModellConstant; +import com.huoran.common.constant.PlatformConstant; +import com.huoran.common.exception.CustomException; +import com.huoran.common.exception.ExceptionEnum; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.nakadai.entity.ModelReferenceCategory; +import com.huoran.nakadai.entity.ModelReferenceDemo; +import com.huoran.nakadai.entity.ModelSysDemo; +import com.huoran.nakadai.entity.req.PageImportModelReq; +import com.huoran.nakadai.entity.req.PageModelReq; +import com.huoran.nakadai.service.ModelReferenceCategoryService; +import com.huoran.nakadai.service.ModelReferenceDemoService; +import com.huoran.nakadai.service.ModelSysDemoService; +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.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + *

+ * 引用模型代码记录表 前端控制器 + *

+ * + * @author chen + * @since 2022-03-04 + */ +@RestController +@RequestMapping("/nakadai/model/student/") +@Api(value = "API - 学生端:ModelReferenceDemoController", tags = "中台:学生端模型相关") +public class StudentModelCorrelationController { + + @Autowired + private UserClient userClient; + @Autowired + public ModelReferenceDemoService service; + + @Autowired + public ModelSysDemoService sysDemoService; + + + @Autowired + public ModelReferenceCategoryService referenceCategoryService; + + @PostMapping("/studentModelList") + @ApiOperation(value = "学生端:读取教师端模型列表") + public R studentModelList(@RequestBody @Validated PageImportModelReq req, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + req.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); + return service.studentModelList(req); + + } + + + @PostMapping("/studentModelListBySystem") + @ApiOperation(value = "学生端:读取教师端系统模型") + public R studentModelListBySystem(@RequestBody @Validated PageImportModelReq req, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + req.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); + req.setIsOpen(DelConstant.IS_OPEN); + return service.systemModelByTeacher(req); + + } + + + @PostMapping("/modelClassListByStudent") + @ApiOperation(value = "学生端模型分类") + public R modelClassListByStudent(@RequestParam("systemId") @ApiParam(value = "系统id") Integer systemId, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + //schoolClassification学校共享出来的分类 + List schoolClassification = referenceCategoryService.modelClassList(systemId, ModellConstant.SOURCE_INSTITUTION, schoolId); + + //系统内置分类 + List systemBuiltInClassification = referenceCategoryService.builtInClassificationByNakadai(systemId); + + return R.ok().put("systemBuiltInClassification", systemBuiltInClassification).put("schoolClassification", schoolClassification); + } + + +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/SupplierController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/SupplierController.java new file mode 100644 index 0000000..5b79705 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/SupplierController.java @@ -0,0 +1,75 @@ +package com.huoran.nakadai.controller; + + +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.Supplier; +import com.huoran.nakadai.service.SupplierService; +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.List; + +/** + *

+ * 供应商表 前端控制器 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@Api(value = "M-商品供应商管理", tags = "M-商品供应商管理") +@RestController +@RequestMapping("/supplier") +public class SupplierController { + + @Autowired + private SupplierService supplierService; + + @ApiOperation(value = "添加供应商") + @PostMapping("/addSupplier") + public R addSupplier( + @ApiParam(name = "supplierName", value = "供应商名称", required = true) + @RequestParam String supplierName) { + //名称判重 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("supplier_name",supplierName); + Supplier one = supplierService.getOne(queryWrapper); + if (ObjectUtil.isNotNull(one)){ + return R.error("供应商已存在!"); + } + //新增产品分类 + Supplier supplier = new Supplier(); + supplier.setSupplierName(supplierName); + boolean save = supplierService.save(supplier); + return save ? R.ok() : R.error(); + } + + @ApiOperation(value = "供应商列表") + @GetMapping("/supplierList") + public R supplierList( + @ApiParam(name = "search", value = "查询条件",required = false) + @RequestParam(required = false) String search) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + if (search!=null){ + queryWrapper.like("supplier_name",search); + } + List supplierList = supplierService.list(queryWrapper); + return R.ok().put("supplierList",supplierList); + } + + @ApiOperation(value = "删除供应商") + @PostMapping("/deleteSupplier") + public R deleteSupplier( + @ApiParam(name = "supplierId", value = "供应商id", required = true) + @RequestParam Integer supplierId) { + boolean remove = supplierService.removeById(supplierId); + return remove ? R.ok() : R.error(); + } + +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/TagsController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/TagsController.java new file mode 100644 index 0000000..3bc4fba --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/TagsController.java @@ -0,0 +1,103 @@ +package com.huoran.nakadai.controller; + + +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.Tags; +import com.huoran.nakadai.entity.req.TagsReq; +import com.huoran.nakadai.service.TagsService; +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.List; + +/** + *

+ * 分类标签表 前端控制器 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@Api(value = "M-商品分类标签管理", tags = "M-商品分类标签管理") +@RestController +@RequestMapping("/tags") +public class TagsController { + + @Autowired + private TagsService tagsService; + + @ApiOperation(value = "添加分类标签") + @PostMapping("/addTags") + public R addTags( + @ApiParam(name = "tagsName", value = "分类标签名称", required = true) + @RequestParam String tagsName) { + //名称判重 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("tags_name",tagsName); + Tags one = tagsService.getOne(queryWrapper); + if (ObjectUtil.isNotNull(one)){ + return R.error("分类标签已存在!"); + } + //新增产品分类 + Tags tags = new Tags(); + tags.setTagsName(tagsName); + tags.setSort(tagsService.count(null)); + boolean save = tagsService.save(tags); + return save ? R.ok() : R.error(); + } + + @ApiOperation(value = "更新分类标签") + @PostMapping("/updateTags") + public R updateTags( + @ApiParam(name = "tags", value = "分类标签", required = true) + @RequestBody Tags tags) { + //名称判重 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("tags_name",tags.getTagsName()).notInSql("tags_id", tags.getTagsId().toString()); + Tags one = tagsService.getOne(queryWrapper); + if (ObjectUtil.isNotNull(one)){ + return R.error("分类标签已存在!"); + } + boolean save = tagsService.updateById(tags); + return save ? R.ok() : R.error(); + } + + @ApiOperation(value = "更新标签排序") + @PostMapping("/updateTagsSort") + public R updateTagsSort( + @ApiParam(name = "tagsReq", value = "标签集合", required = true) + @RequestBody TagsReq tagsReq) { + boolean updateBatchById = tagsService.updateBatchById(tagsReq.getTagsList()); + return updateBatchById ? R.ok() : R.error(); + } + + @ApiOperation(value = "分类标签列表") + @GetMapping("/tagsList") + public R tagsList( + @ApiParam(name = "search", value = "查询条件",required = false) + @RequestParam(required = false) String search) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + if (search!=null){ + queryWrapper.like("tags_name",search); + } + queryWrapper.orderByAsc("sort"); + List tagsList = tagsService.list(queryWrapper); + return R.ok().put("tagsList",tagsList); + } + + @ApiOperation(value = "删除分类标签") + @PostMapping("/deleteTags") + public R deleteTags( + @ApiParam(name = "tagsId", value = "标签id", required = true) + @RequestParam Integer tagsId) { + boolean remove = tagsService.removeById(tagsId); + return remove ? R.ok() : R.error(); + } + +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/ValueModuleManagementController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/ValueModuleManagementController.java new file mode 100644 index 0000000..ca6794d --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/ValueModuleManagementController.java @@ -0,0 +1,114 @@ +package com.huoran.nakadai.controller; + + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.api.UserClient; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.nakadai.entity.Customer; +import com.huoran.nakadai.entity.Order; +import com.huoran.nakadai.entity.OrderOther; +import com.huoran.nakadai.entity.ValueModuleManagement; +import com.huoran.nakadai.service.ICustomerService; +import com.huoran.nakadai.service.IOrderService; +import com.huoran.nakadai.service.OrderOtherService; +import com.huoran.nakadai.service.ValueModuleManagementService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +/** + *

+ * 增值模块管理表 前端控制器 + *

+ * + * @author chen + * @since 2023-01-30 + */ +@Api(tags = "增值模块管理") +@RestController +@RequestMapping("/nakadai/valueModuleManagement") +public class ValueModuleManagementController { + + @Autowired + private ValueModuleManagementService valueModuleManagementService; + + @Autowired + private IOrderService orderService; + + + @Autowired + private UserClient userClient; + + @Autowired + private ICustomerService customerService; + + @Autowired + private OrderOtherService orderOtherService; + + @ApiOperation(value = "增值模块列表") + @PostMapping("/getValueModule") + public R getAllService(@RequestParam Integer platformId){ + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("platform_id",platformId); + List list = valueModuleManagementService.list(wrapper); + List valueList = valueModuleManagementService.selectProductModule(); + for (ValueModuleManagement valueModuleManagement : list) { + if (valueList.contains(valueModuleManagement.getId())){ + valueModuleManagement.setAssociatedProductIdentification(true); + } + } + return R.ok().put("valueList",list); + } + + + @ApiOperation(value = "查询客户增值模块") + @GetMapping("/getCustomerOrder") + public R getCustomerOrder(HttpServletRequest request) { + Integer customerId; + String id = TokenUtils.getIdByJwtToken(request); + //查询学校id + Integer schoolId = userClient.getSchoolIdByAccountId(id); + //根据学校查询客户id + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("school_id",schoolId); + Customer one = customerService.getOne(wrapper); + if (one!=null){ + customerId = one.getCustomerId(); + }else { + return R.ok().put("show", false); + } + + List orderList = orderService.list(new QueryWrapper().eq("customer_id", customerId)); + if (orderList!=null && orderList.size()<1){ + return R.ok().put("show", false); + } + ArrayList orderIdList = new ArrayList<>(); + orderList.forEach(order -> { + orderIdList.add(order.getOrderId()); + }); + + QueryWrapper orderOtherQueryWrapper = new QueryWrapper<>(); + orderOtherQueryWrapper.eq("is_enable",1); + orderOtherQueryWrapper.eq("authority",2); + orderOtherQueryWrapper.eq("ship",1); + orderOtherQueryWrapper.in("order_id",orderIdList); + List list = orderOtherService.list(orderOtherQueryWrapper); + if (list!=null && list.size()>0){ + for (OrderOther orderOther : list) { + //结束时间大于当前时间,当前模块还在使用期间 + if (orderOther.getEndTime().getTime() > new Date().getTime()){ + return R.ok().put("show",true); + } + } + } + return R.ok().put("show", false); + } +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/Article.java b/nakadai/src/main/java/com/huoran/nakadai/entity/Article.java new file mode 100644 index 0000000..ed0c9f0 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/Article.java @@ -0,0 +1,34 @@ +package com.huoran.nakadai.entity; + +public class Article implements Comparable
{ + private String title; + private int index; + + public Article(String title, int index) { + this.title = title; + this.index = index; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getTitle() { + return title; + } + + public void setIndex(int index) { + this.index = index; + } + + public int getIndex() { + return index; + } + + + + @Override + public int compareTo(Article o) { + return Integer.compare(this.index, o.getIndex()); + } +} \ No newline at end of file diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/City.java b/nakadai/src/main/java/com/huoran/nakadai/entity/City.java new file mode 100644 index 0000000..119e0a8 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/City.java @@ -0,0 +1,47 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 城市 + *

+ * + * @author huoran + * @since 2021-06-29 + */ +@Data +@TableName("city") +public class City implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 城市主键ID + */ + @TableId(value = "city_id", type = IdType.AUTO) + private Integer cityId; + + /** + * 城市名称 + */ + private String cityName; + + /** + * 绑定省份ID + */ + private Integer provinceId; + + /** + * 是否删除(0、未删除 1、已删除) + */ + private Integer isDel; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/Comment.java b/nakadai/src/main/java/com/huoran/nakadai/entity/Comment.java new file mode 100644 index 0000000..6ec353e --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/Comment.java @@ -0,0 +1,66 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 课程评论回复表 + *

+ * + * @author chen + * @since 2023-05-25 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("hr_comment") +@ApiModel(value="Comment对象", description="课程评论回复表") +public class Comment implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "comment_id", type = IdType.AUTO) + private Integer commentId; + + @ApiModelProperty(value = "父id") + private Integer pid; + + @ApiModelProperty(value = "回复用户id") + private Integer replyAccountId; + + @ApiModelProperty(value = "内容") + private String content; + + @ApiModelProperty(value = "状态:1评论,2评论回复") + private Integer status; + + @ApiModelProperty("创建时间") + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "创建人") + private Integer createAccountId; + + @ApiModelProperty(value = "商品id") + private Integer mallId; + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + @ApiModelProperty(value = "回复评论id") + @TableField(exist = false) + private Integer replyCommentId; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/CommentLike.java b/nakadai/src/main/java/com/huoran/nakadai/entity/CommentLike.java new file mode 100644 index 0000000..506460a --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/CommentLike.java @@ -0,0 +1,47 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 课程评论点赞表 + *

+ * + * @author chen + * @since 2023-05-25 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("hr_comment_like") +@ApiModel(value="CommentLike对象", description="课程评论点赞表") +public class CommentLike implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "like_id", type = IdType.AUTO) + private Integer likeId; + + @ApiModelProperty(value = "评论id") + private Integer commentId; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty("创建时间") + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/Course.java b/nakadai/src/main/java/com/huoran/nakadai/entity/Course.java new file mode 100644 index 0000000..33939de --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/Course.java @@ -0,0 +1,86 @@ +package com.huoran.nakadai.entity; + +import java.math.BigDecimal; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + *

+ * 课程表 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@Data +@TableName("course") +public class Course implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("课程主键id") + @TableId(value = "course_id", type = IdType.AUTO) + private Integer courseId; + + @ApiModelProperty("课程名称") + private String courseName; + + @ApiModelProperty("课程类别(实训课程 、理论课程)") + private String courseType; + + @ApiModelProperty("绑定学科ID") + private Integer disciplineId; + + @ApiModelProperty("绑定专业类ID") + private Integer professionalClassId; + + @ApiModelProperty("绑定专业ID") + private Integer professionalId; + + @ApiModelProperty("预计课时(32 、64学时,目前只有这个两个学时)") + private Integer courseHours; + + @ApiModelProperty("市场价格") + private BigDecimal marketPrice; + + @ApiModelProperty("课程简介") + private String courseIntroduction; + + @ApiModelProperty("教学目标") + private String teachingGoal; + + @ApiModelProperty("是否删除(0、未删除 1、已删除)") + @TableLogic(value = "0",delval = "1") + private int isDel; + + @ApiModelProperty("员工表中的id") + private Integer staffId; + + @ApiModelProperty("绑定系统id") + private String systemId; + + @ApiModelProperty("是否上架(0、上架 1、下架)") + private int isShelves; + + @ApiModelProperty("绑定项目id") + private String projectId; + + @ApiModelProperty("更新时间") + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty("创建时间") + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/Curriculum.java b/nakadai/src/main/java/com/huoran/nakadai/entity/Curriculum.java new file mode 100644 index 0000000..64aea08 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/Curriculum.java @@ -0,0 +1,143 @@ +package com.huoran.nakadai.entity; + +import java.math.BigDecimal; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; + +import java.io.Serializable; +import java.util.List; + +import com.huoran.nakadai.entity.res.CurriculumDetailRes; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 课程管理 + *

+ * + * @author lr + * @since 2021-09-16 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "Curriculum对象", description = "课程管理") +public class Curriculum implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "主键") + private Integer cid; + + @ApiModelProperty(value = "创建人id") + private Integer accountId; + + @ApiModelProperty(value = "课程名称") + private String curriculumName; + + @ApiModelProperty(value = "课程封面图片路径") + private String coverUrl; + + @ApiModelProperty(value = "课程类别(0->理论 1-实训)") + private Integer curriculumType; + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + @ApiModelProperty(value = "学科类别id") + private Integer categoryId; + + @ApiModelProperty(value = "专业类id") + private Integer professionalCategoryId; + + @ApiModelProperty(value = "专业id") + private Integer professionalId; + + @ApiModelProperty(value = "预计课时") + private String expectedCourse; + + @ApiModelProperty(value = "市场价格") + private BigDecimal marketPrice; + + @ApiModelProperty(value = "简介") + private String briefIntroduction; + + @ApiModelProperty(value = "教学目标") + private String teachingObjectives; + + @ApiModelProperty(value = "练习配置id") + private Integer practiceId; + + @ApiModelProperty(value = "考核配置id") + private Integer assessmentId; + + @ApiModelProperty(value = "资源配置id") + private Integer resourcesId; + + @ApiModelProperty(value = "区分标识:1为企业端课程,0为管理端课程") + private Integer distinguish; + + @ApiModelProperty(value = "是否启用(0启用,1未启用)") + private Integer isEnable; + + @ApiModelProperty(value = "上下架(0下架 1上架 默认 1)") + private Integer isShelves; + + + @ApiModelProperty(value = "是否删除(默认0未删 1为已删)") + @TableLogic + private Integer isDel; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "编辑时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "练习配置") + @TableField(exist = false) + private List practiceConfig; + + @ApiModelProperty(value = "考核配置") + @TableField(exist = false) + private List assessmentConfig; + + @ApiModelProperty(value = "竞赛配置") + @TableField(exist = false) + private List competitionConfig; + + @ApiModelProperty(value = "系统id") + @TableField(exist = false) + private String systemIds; + + @ApiModelProperty(value = "结算方式,0为单价,1为分成") + private String settlementMethod; + + @ApiModelProperty(value = "供应商id") + private String supplier; + + @ApiModelProperty(value = "供应商名称") + @TableField(exist = false) + private String supplierName; + + @ApiModelProperty(value = "结算单价") + private BigDecimal settlementPrice; + + @ApiModelProperty(value = "商务占比") + private String businessProportion; + + @ApiModelProperty(value = "厂商占比") + private String manufacturerProportion; + + @ApiModelProperty(value = "小程序图片地址") + private String miniProgramPictureAddress; +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/CurriculumChapter.java b/nakadai/src/main/java/com/huoran/nakadai/entity/CurriculumChapter.java new file mode 100644 index 0000000..452a71b --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/CurriculumChapter.java @@ -0,0 +1,57 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; + +import java.util.Date; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; + +import java.io.Serializable; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 企业课程章节表 + *

+ * + * @author lr + * @since 2021-09-26 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "CurriculumChapter对象", description = "企业课程章节表") +public class CurriculumChapter implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "章节ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "章节名称") + private String name; + + @ApiModelProperty(value = "课程ID") + private Integer cid; + + @ApiModelProperty(value = "显示排序") + private Integer sort; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "编辑时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/CurriculumConfigure.java b/nakadai/src/main/java/com/huoran/nakadai/entity/CurriculumConfigure.java new file mode 100644 index 0000000..61d2de9 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/CurriculumConfigure.java @@ -0,0 +1,56 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; + +import java.io.Serializable; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 课程配置表 + *

+ * + * @author lr + * @since 2021-09-17 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "CurriculumConfigure对象", description = "课程配置表") +public class CurriculumConfigure implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "config_id", type = IdType.AUTO) + private Integer configId; + + @ApiModelProperty(value = "课程表主键id(curriculum表主键) 关联查询用") + private Integer cid; + + @ApiModelProperty(value = "系统id") + private Integer systemId; + + @ApiModelProperty(value = "项目管理表id") + private Integer projectId; + + @ApiModelProperty(value = "排序(对项目展示进行排序)") + private Integer sort; + + @ApiModelProperty(value = "项目权限(0、练习 1、考核)") + private Integer permissions; + + @ApiModelProperty(value = "是否展示(默认0展示 1为不展示)") + private Integer isShow; + + @ApiModelProperty(value = "是否删除(默认0未删 1为已删除)") + private Integer isDel; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/CurriculumLearningProgress.java b/nakadai/src/main/java/com/huoran/nakadai/entity/CurriculumLearningProgress.java new file mode 100644 index 0000000..a6fe889 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/CurriculumLearningProgress.java @@ -0,0 +1,53 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + *

+ * 课程学习进度 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="CurriculumLearningProgress对象", description="课程学习进度") +public class CurriculumLearningProgress implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "课程id") + private Integer cid; + + /* @ApiModelProperty(value = "章节id") + private Integer chapterId; + + @ApiModelProperty(value = "小结id") + private Integer subsectionId;*/ + + @ApiModelProperty(value = "项目id") + private Integer projectId; + + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/CurriculumNotes.java b/nakadai/src/main/java/com/huoran/nakadai/entity/CurriculumNotes.java new file mode 100644 index 0000000..75886db --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/CurriculumNotes.java @@ -0,0 +1,61 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 课程笔记表 + *

+ * + * @author chen + * @since 2023-05-04 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="CurriculumNotes对象", description="课程笔记表") +public class CurriculumNotes implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "note_id", type = IdType.AUTO) + private Integer noteId; + + @ApiModelProperty(value = "笔记名称") + private String noteName; + + @ApiModelProperty(value = "笔记内容") + private String noteContent; + + @ApiModelProperty(value = "账号id",hidden = true) + private Integer accountId; + + @ApiModelProperty(value = "课程id") + private Integer cid; + + @ApiModelProperty(value = "是否删除(0、未删除 1、已删除)") + @TableLogic(value = "0",delval = "1") + private int isDel; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date updateTime; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date createTime; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/CurriculumRecentUse.java b/nakadai/src/main/java/com/huoran/nakadai/entity/CurriculumRecentUse.java new file mode 100644 index 0000000..1022d5e --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/CurriculumRecentUse.java @@ -0,0 +1,49 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author chen + * @since 2023-04-19 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "CurriculumRecentUse对象", description = "") +public class CurriculumRecentUse implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "课程id") + private Integer cid; + + @ApiModelProperty(value = "商品id") + @NotNull(message = "商品id不能为空!") + private Integer mallId; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "进入时间") + private Date entryTime; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/CurriculumSubsection.java b/nakadai/src/main/java/com/huoran/nakadai/entity/CurriculumSubsection.java new file mode 100644 index 0000000..597a178 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/CurriculumSubsection.java @@ -0,0 +1,75 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; + +import java.util.Date; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; + +import java.io.Serializable; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 企业课程小节表 + *

+ * + * @author lr + * @since 2021-09-26 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "CurriculumSubsection对象", description = "企业课程小节表") +public class CurriculumSubsection implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "小节ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "小节名称") + private String name; + + @ApiModelProperty(value = "课程ID") + private Integer cid; + + @ApiModelProperty(value = "章节ID") + private Integer chapterId; + + @ApiModelProperty(value = "资源文件ID") + private String fileId; + + @ApiModelProperty(value = "文件存储路径") + private String fileUrl; + + @ApiModelProperty(value = "资源文件类型") + private String fileType; + + @ApiModelProperty(value = "阿里云文件名称") + private String fileName; + + @ApiModelProperty(value = "原始文件名称") + private String originalFileName; + + @ApiModelProperty(value = "排序字段") + private Integer sort; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "编辑时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/Customer.java b/nakadai/src/main/java/com/huoran/nakadai/entity/Customer.java new file mode 100644 index 0000000..6634d51 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/Customer.java @@ -0,0 +1,138 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + *

+ * 客户表 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@Data +@TableName("customer") +public class Customer implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键ID + */ + @ApiModelProperty("主键ID") + @TableId(value = "customer_id", type = IdType.AUTO) + private Integer customerId; + + /** + * 国家 + */ + @ApiModelProperty("国家") + private String countries; + + /** + * 客户类型(1、正式 2、试用 3、到期) + */ + @ApiModelProperty("客户类型(1、正式 2、试用 3、到期)") + private Integer customerType; + + /** + * 省份ID + */ + @ApiModelProperty("省份ID") + private Integer provinceId; + + /** + * 城市ID + */ + @ApiModelProperty("城市ID") + private Integer cityId; + + /** + * 到期时间 + */ + @ApiModelProperty("到期时间") + private Date expireDate; + + /** + * 客户名称(学校名称) + */ + @ApiModelProperty("客户名称(学校名称)") + private String customerName; + + /** + * 绑定行业ID + */ + @ApiModelProperty("绑定行业ID") + private Integer industryId; + + /** + * 绑定行业类ID + */ + @ApiModelProperty("绑定行业类ID") + private Integer industryClassId; + + @ApiModelProperty("绑定学校ID") + private Integer schoolId; + + @ApiModelProperty("数据复制,默认0不复制数据") + private Integer dataCopy; + + /** + * 行业 + */ + @ApiModelProperty("行业") + private String industry; + + /** + * 联系人姓名 + */ + @ApiModelProperty("联系人姓名") + private String name; + + /** + * 手机号 + */ + @ApiModelProperty("手机号") + private String phone; + + /** + * 职务 + */ + @ApiModelProperty("职务") + private String position; + + /** + * 邮箱 + */ + @ApiModelProperty("邮箱") + private String email; + + /** + * 是否删除(0、未删除 1、已删除) + */ + @ApiModelProperty("是否删除(0、未删除 1、已删除)") + @TableLogic(value = "0",delval = "1") + private Integer isDel; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + /** + * 修改时间 + */ + @ApiModelProperty("修改时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/CustomsPass.java b/nakadai/src/main/java/com/huoran/nakadai/entity/CustomsPass.java new file mode 100644 index 0000000..a1119f0 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/CustomsPass.java @@ -0,0 +1,82 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 沙盘-关卡表 + *

+ * + * @author chen + * @since 2023-10-26 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("s_customs_pass") +@ApiModel(value = "CustomsPass对象", description = "沙盘-关卡表") +public class CustomsPass implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "关卡id") + private Integer checkpointId; + + @ApiModelProperty(value = "序号") + private Integer serialNumber; + + @ApiModelProperty(value = "关卡名称") + private String customsPassName; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + @ApiModelProperty(value = "是否禁用(默认0:禁用,1:启用)") + private Integer isEnable; + + @ApiModelProperty(value = "是否删除(默认0:未删除,1:已删除)") + @TableLogic + private Integer isDel; + + + @ApiModelProperty(value = "引用中台的关卡id(用于复制checkpoint_id所用)") + private Integer copyId; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "编辑时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + + + @ApiModelProperty(value = "创建人") + @TableField(exist = false) + private String creator; + + @ApiModelProperty(value = "是否收藏") + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @TableField(exist = false) + private boolean isCollect; + + @ApiModelProperty(value = "收藏id") + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @TableField(exist = false) + private Integer favoriteId; +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/DataProduct.java b/nakadai/src/main/java/com/huoran/nakadai/entity/DataProduct.java new file mode 100644 index 0000000..1643807 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/DataProduct.java @@ -0,0 +1,79 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + * @描述:数据平台产品表 + * @作者: Rong + * @日期: 2021-06-28 + */ +@Data +@ApiModel(value = "数据平台产品表") +@TableName("data_product") +public class DataProduct implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "主键") + private Integer id; + + @ApiModelProperty(value = "用户账户id(hr_user_account表主键)") + private Integer accountId; + + @ApiModelProperty(value = "用户名称") + private String userName; + + @ApiModelProperty(value = "表数据量") + private String tableNum; + + @ApiModelProperty(value = "可改变表id(sys_table主键) 用逗号隔开") + private String tableId; + + @ApiModelProperty(value = "产品名称") + private String productName; + + @ApiModelProperty(value = "订单数量") + private Integer orderNum; + + @ApiModelProperty(value = "市场价") + private String market; + + @ApiModelProperty(value = "上下架(0下架 1上架 默认 0)") + private Integer status; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "逻辑删除(默认0,1为删除)") + @TableLogic + private Integer isDel; + + @ApiModelProperty(value = "结算方式,0为单价,1为分成") + private String settlementMethod; + + @ApiModelProperty(value = "供应厂商") + private String supplier; + + @ApiModelProperty(value = "结算单价") + private BigDecimal settlementPrice; + + @ApiModelProperty(value = "商务占比") + private String businessProportion; + + @ApiModelProperty(value = "厂商占比") + private String manufacturerProportion; + +} \ No newline at end of file diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/Discipline.java b/nakadai/src/main/java/com/huoran/nakadai/entity/Discipline.java new file mode 100644 index 0000000..ba6dc05 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/Discipline.java @@ -0,0 +1,47 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.List; + +/** + *

+ * 学科 + *

+ * + * @author lr + * @since 2021-09-17 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "Discipline对象", description = "学科") +public class Discipline implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键id") + @TableId(value = "discipline_id", type = IdType.AUTO) + private Integer disciplineId; + + @ApiModelProperty(value = "学科名称") + private String disciplineName; + + @ApiModelProperty(value = "引用次数") + @TableField(exist = false) + private Integer level; + + @ApiModelProperty(value = "引用专类类") + @TableField(exist = false) + private List professionalClasses; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/DisciplineLevel.java b/nakadai/src/main/java/com/huoran/nakadai/entity/DisciplineLevel.java new file mode 100644 index 0000000..8ccde3a --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/DisciplineLevel.java @@ -0,0 +1,37 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 学科层次 + *

+ * + * @author huoran + * @since 2021-07-09 + */ +@Data +@TableName("discipline_level") +public class DisciplineLevel implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 学科层次主键id + */ + @TableId(value = "discipline_level_id", type = IdType.AUTO) + private Integer disciplineLevelId; + + /** + * 学科层次名称 + */ + private String disciplineLevelName; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/EduCurriculumChapter.java b/nakadai/src/main/java/com/huoran/nakadai/entity/EduCurriculumChapter.java new file mode 100644 index 0000000..e8dd535 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/EduCurriculumChapter.java @@ -0,0 +1,49 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import java.util.Date; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 课程章节 + *

+ * + * @author lr + * @since 2021-09-26 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="EduCurriculumChapter对象", description="课程章节") +public class EduCurriculumChapter implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "章节ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "章节名称") + private String name; + + @ApiModelProperty(value = "课程ID") + private Integer cid; + + @ApiModelProperty(value = "显示排序") + private Integer sort; + + @ApiModelProperty(value = "创建时间") + private Date createTime; + + @ApiModelProperty(value = "更新时间") + private Date updateTime; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/HrContractInformation.java b/nakadai/src/main/java/com/huoran/nakadai/entity/HrContractInformation.java new file mode 100644 index 0000000..0e63c45 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/HrContractInformation.java @@ -0,0 +1,68 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + *

+ * 合同信息表 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@Data +@TableName("hr_contract_information") +public class HrContractInformation implements Serializable { + + private static final long serialVersionUID = 631451344681123441L; + + @ApiModelProperty(value = "合同主键id") + @TableId(value = "contract_id", type = IdType.AUTO) + private Integer contractId; + + @ApiModelProperty(value = "合同名称") + private String contractName; + + @ApiModelProperty(value = "合同编号") + private String contractNumber; + + @ApiModelProperty(value = "合同金额") + private String contractMoney; + + @ApiModelProperty(value = "合同文件") + private String contractFile; + + @ApiModelProperty(value = "绑定订单Id") + private Integer orderId; + + @ApiModelProperty(value = "是否删除(0、未删除 1、已删除)") + @TableLogic + private Integer isDel; + + @ApiModelProperty(value = "合同期限(起)") + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date startTime; + + @ApiModelProperty(value = "合同期限(止)") + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date endTime; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date createTime; + + @ApiModelProperty(value = "修改时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date updateTime; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/HrCoursePermissions.java b/nakadai/src/main/java/com/huoran/nakadai/entity/HrCoursePermissions.java new file mode 100644 index 0000000..a74f98c --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/HrCoursePermissions.java @@ -0,0 +1,110 @@ +package com.huoran.nakadai.entity; + +import java.math.BigDecimal; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; + +import lombok.Data; + +import java.io.Serializable; + +/** + *

+ * 课程权限表 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@Data +@TableName("hr_course_permissions") +public class HrCoursePermissions implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 课程权限主键Id + */ + @TableId(value = "course_permissions_id", type = IdType.AUTO) + private Integer coursePermissionsId; + + /** + * 使用期限(月) + */ + private Integer usePeriod; + + /** + * 市场价格 + */ + private BigDecimal marketPrice; + + /** + * 交易价格 + */ + private BigDecimal transactionPrice; + + /** + * 折扣率 + */ + private Integer discount; + + /** + * 绑定端口地址id + */ + private Integer portAddressId; + + /** + * 是否发货(0、未发货 1、已发货) + */ + private Integer isDeliverGoods; + + /** + * 发货日期 + */ + private Date deliveryDate; + + /** + * 截止日期 + */ + private Date deadlineDate; + + /** + * 剩余期限(天) + */ + private Integer remainPeriod; + + /** + * 是否删除(0、未删除 1、已删除) + */ + private Integer isDel; + + /** + * 绑定课程id + */ + private Integer courseId; + + /** + * 绑定订单id + */ + private Integer orderId; + + /** + * 是否启用 + */ + private Integer isEnabled; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + /** + * 修改时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/HrDataPermissions.java b/nakadai/src/main/java/com/huoran/nakadai/entity/HrDataPermissions.java new file mode 100644 index 0000000..2469de5 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/HrDataPermissions.java @@ -0,0 +1,120 @@ +package com.huoran.nakadai.entity; + +import java.math.BigDecimal; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; + +import lombok.Data; + +import java.io.Serializable; + +/** + *

+ * 数据平台权限表 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@Data +@TableName("hr_data_permissions") +public class HrDataPermissions implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 数据权限主键Id + */ + @TableId(value = "data_permissions_id", type = IdType.AUTO) + private Integer dataPermissionsId; + + /** + * 使用期限(月) + */ + private Integer usePeriod; + + /** + * 市场价格 + */ + private BigDecimal marketPrice; + + /** + * 交易价格 + */ + private BigDecimal transactionPrice; + + /** + * 折扣率 + */ + private Integer discount; + + /** + * 绑定端口地址id + */ + private Integer portAddressId; + + /** + * 是否发货(0、未发货 1、已发货) + */ + private Integer isDeliverGoods; + + /** + * 发货日期 + */ + private Date deliveryDate; + + /** + * 截止日期 + */ + private Date deadlineDate; + + /** + * 剩余期限(天) + */ + private Integer remainPeriod; + + /** + * 是否删除(0、未删除 1、已删除) + */ + private Integer isDel; + + /** + * 绑定数据平台id + */ + private Integer dataPlatformId; + + /** + * 绑定订单id + */ + private Integer orderId; + + /** + * 账号数 + */ + private Integer countNumber; + + /** + * 总金额 + */ + private BigDecimal sumMoney; + + /** + * 是否启用 + */ + private Integer isEnabled; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + /** + * 修改时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/HrIndustry.java b/nakadai/src/main/java/com/huoran/nakadai/entity/HrIndustry.java new file mode 100644 index 0000000..a8729f6 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/HrIndustry.java @@ -0,0 +1,42 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 行业 + *

+ * + * @author huoran + * @since 2021-06-29 + */ +@Data +@TableName("hr_industry") +public class HrIndustry implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 行业ID + */ + @TableId(value = "industry_id", type = IdType.AUTO) + private Integer industryId; + + /** + * 绑定行业类ID + */ + private Integer industryClassId; + + /** + * 行业名称 + */ + private String industryName; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/HrIndustryClass.java b/nakadai/src/main/java/com/huoran/nakadai/entity/HrIndustryClass.java new file mode 100644 index 0000000..26b600c --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/HrIndustryClass.java @@ -0,0 +1,37 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 行业类 + *

+ * + * @author huoran + * @since 2021-06-29 + */ +@Data +@TableName("hr_industry_class") +public class HrIndustryClass implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 行业类主键ID + */ + @TableId(value = "industry_class_id", type = IdType.AUTO) + private Integer industryClassId; + + /** + * 行业类名称 + */ + private String industryClassName; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/HrLog.java b/nakadai/src/main/java/com/huoran/nakadai/entity/HrLog.java new file mode 100644 index 0000000..abd648b --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/HrLog.java @@ -0,0 +1,88 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; + +import java.io.Serializable; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; + +/** + *

+ * + *

+ * + * @author chen + * @since 2022-03-04 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="HrLog对象", description="") +public class HrLog implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "log_id", type = IdType.AUTO) + private Integer logId; + + @ApiModelProperty(value = "平台名称(1职站,2数据,3中台)") + private Integer platformId; + + @ApiModelProperty(value = "版本名称") + @NotNull(message = "版本标题不能为空") + private String versionName; + + @ApiModelProperty(value = "更新内容") + @TableField(exist = false) + @NotNull(message = "更新内容不能为空") + private List logContents; + + @ApiModelProperty(value = "封面图片地址") + private String coverUrl; + + @ApiModelProperty(value = "是否为草稿,默认为0不是草稿,1为草稿") + private Integer draft; + + @ApiModelProperty(value = "撤回(默认为0,1为撤回)") + private Integer withdraw; + + @ApiModelProperty(value = "撤回次数") + private Integer withdrawNum; + + @ApiModelProperty(value = "是否开启,默认为0开启,1为关闭") + private Integer open; + + @ApiModelProperty(value = "版本更新标识") + private Integer version; + + @ApiModelProperty(value = "是否删除(0、未删除 1、已删除)") + @TableLogic(value = "0",delval = "1") + private int isDel; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date updateTime; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date createTime; + + @ApiModelProperty(value = "发布时间") + @TableField(fill = FieldFill.INSERT) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date draftTime; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/HrMallMarketingPromotion.java b/nakadai/src/main/java/com/huoran/nakadai/entity/HrMallMarketingPromotion.java new file mode 100644 index 0000000..241d093 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/HrMallMarketingPromotion.java @@ -0,0 +1,59 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author chen + * @since 2023-04-25 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="HrMallMarketingPromotion对象", description="营销推广管理") +public class HrMallMarketingPromotion implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "banner图") + private String banner; + + @ApiModelProperty(value = "标题") + private String title; + + @ApiModelProperty(value = "副标题") + private String subheading; + + @ApiModelProperty(value = "链接") + private String url; + + @ApiModelProperty(value = "是否开启(0开启 1未开启 默认0)") + private Integer isOpen; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/HrStaff.java b/nakadai/src/main/java/com/huoran/nakadai/entity/HrStaff.java new file mode 100644 index 0000000..e377831 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/HrStaff.java @@ -0,0 +1,44 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import java.util.List; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 中台后台员工账号表 + *

+ * + * @author chen + * @since 2022-03-22 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="HrStaff对象", description="中台后台员工账号表") +public class HrStaff implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "员工主键ID") + @TableId(value = "staff_id", type = IdType.AUTO) + private Integer staffId; + + @ApiModelProperty(value = "组织架构id(多个部门id)") + private List staffArchitectureId; + + @ApiModelProperty(value = "绑定账号id") + private Integer accountId; + + @ApiModelProperty(value = "是否删除(0、未删除 1、已删除)") + private Integer isDel; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/HrStaffAccountArchitecture.java b/nakadai/src/main/java/com/huoran/nakadai/entity/HrStaffAccountArchitecture.java new file mode 100644 index 0000000..981a70b --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/HrStaffAccountArchitecture.java @@ -0,0 +1,70 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; + +import java.io.Serializable; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.huoran.common.entity.Architecture; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 中台账号组织架构 + *

+ * + * @author chen + * @since 2022-03-22 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="HrStaffAccountArchitecture对象", description="中台账号组织架构") +public class HrStaffAccountArchitecture implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "组织名称") + private String organizationName; + + @ApiModelProperty(value = "父id 一级为0", example = "0", name = "parentId") + private Integer parentId; + + @ApiModelProperty(value = "层级") + private Integer level; + + @ApiModelProperty(value = "子级") + @TableField(exist = false) + private List children; + + @ApiModelProperty(value = "层级拼接") + @TableField(exist = false) + private String splicingLevel; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date updateTime; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date createTime; + + @ApiModelProperty(value = "逻辑删除") + @TableLogic + private Integer isDel; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/HrStaffDepartment.java b/nakadai/src/main/java/com/huoran/nakadai/entity/HrStaffDepartment.java new file mode 100644 index 0000000..8abf36d --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/HrStaffDepartment.java @@ -0,0 +1,39 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * + *

+ * + * @author chen + * @since 2022-03-23 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="HrStaffDepartment对象", description="") +public class HrStaffDepartment implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "员工id") + private Integer staffId; + + @ApiModelProperty(value = "部门id,对应组织架构id") + private Integer departmentId; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/HrUserAccount.java b/nakadai/src/main/java/com/huoran/nakadai/entity/HrUserAccount.java new file mode 100644 index 0000000..dd71e16 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/HrUserAccount.java @@ -0,0 +1,113 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 各个平台账号表 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@Data +@TableName("hr_user_account") +public class HrUserAccount implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键id(平台用户id) + */ + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + /** + * 用户表id + */ + private Integer userId; + + private Integer customerId; + + /** + * 账号 + */ + private String account; + + /** + * 密码 + */ + private String password; + + /** + * 工号 + */ + private String workNumber; + + /** + * 绑定的角色id + */ + private String roleId; + + /** + * 绑定院校id + */ + private Integer schoolId; + + @TableField(exist = false) + private String schoolName; + + /** + * 所属平台:1->职站 2->数据平台 + */ + private String platformId; + + @TableField(exist = false) + private String platformName; + + /** + * 平台(系统)绑定时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private Date platformBindTime; + + /** + * 平台端区分:0->教师端 1->学生端 + */ + private Integer type; + + @TableField(exist = false) + private String typeName; + + /** + * 是否删除(0、未删除 1、已删除) + */ + @TableLogic + private Integer isDel; + + /** + * 是否禁用(0->禁用,1->启用) + */ + private Integer isEnable; + + + /** + * 创建时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + /** + * 修改时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/LogContent.java b/nakadai/src/main/java/com/huoran/nakadai/entity/LogContent.java new file mode 100644 index 0000000..4aef264 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/LogContent.java @@ -0,0 +1,63 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; +import java.util.Date; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; + +/** + *

+ * + *

+ * + * @author chen + * @since 2022-03-08 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="LogContent对象", description="") +public class LogContent implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "日志id") + private Integer logId; + + @ApiModelProperty(value = "更新内容") + @NotNull(message = "更新内容不能为空") + private String content; + + @ApiModelProperty(value = "更新类型(0-新功能,1-修复,2-优化)") + @NotNull(message = "更新类型不能为空") + private Integer type; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date updateTime; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date createTime; + + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/Mall.java b/nakadai/src/main/java/com/huoran/nakadai/entity/Mall.java new file mode 100644 index 0000000..cf0012c --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/Mall.java @@ -0,0 +1,113 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + *

+ * 商城管理表 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("hr_mall") +@ApiModel(value = "Mall对象", description = "商城管理表") +public class Mall implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "商城主键id") + @TableId(value = "mall_id", type = IdType.AUTO) + private Integer mallId; + + @ApiModelProperty(value = "关联产品(产品表为的课程、数据产品、职站增值模块)") + private Integer associatedProduct; + + @ApiModelProperty(value = "是否关联产品,默认为0关联,1不关联") + private Integer isAssociatedProduct; + + @ApiModelProperty(value = "关联产品名称") + private String associatedProductName; + + @ApiModelProperty(value = "区分产品权限(0为数据平台权限,1为课程权限,2为职站增值模块,3为实训课程(非集成),4为实验工具,对应id为商城管理中的产品)") + private Integer authority; + + + @ApiModelProperty(value = "主题id") + private Integer themeId; + + @ApiModelProperty(value = "产品名称") + private String productName; + + @ApiModelProperty(value = "匹配课程") + private String matchingCourse; + + @ApiModelProperty(value = "课程耗时") + private String courseHours; + + @ApiModelProperty(value = "适用场景") + private String applicationScenario; + + @ApiModelProperty(value = "封面图") + private String coverDrawing; + + @ApiModelProperty(value = "界面图(支持上传4张,使用逗号分隔)") + private String interfaceDiagram; + + @ApiModelProperty(value = "小程序图标") + private String appletIcon; + + @ApiModelProperty(value = "市场建议单价") + private BigDecimal marketUnitPrice; + + @ApiModelProperty(value = "产品简介") + private String productIntroduction; + + @ApiModelProperty(value = "详情介绍") + private String detailedIntroduction; + + @ApiModelProperty(value = "是否删除(0、未删除 1、已删除)") + @TableLogic(value = "0", delval = "1") + private int isDel; + + @ApiModelProperty(value = "上下架(0上架 1下架 默认0上架)") + private int isShelves; + + @ApiModelProperty(value = "编辑人") + private String accountId; + + @ApiModelProperty(value = "是否精选,默认0不精选,1为精选") + private int selected; + + @ApiModelProperty(value = "商品状态,默认0正常,1为草稿") + private int state; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd") + private Date updateTime; + + @ApiModelProperty(value = "上架时间") + @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd") + private Date shelfTime; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd") + private Date createTime; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/MallAnnex.java b/nakadai/src/main/java/com/huoran/nakadai/entity/MallAnnex.java new file mode 100644 index 0000000..0ea8ef0 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/MallAnnex.java @@ -0,0 +1,59 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 商品附件表 + *

+ * + * @author chen + * @since 2023-05-06 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("hr_mall_annex") +@ApiModel(value="MallAnnex对象", description="商品附件表") +public class MallAnnex implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "商品附件主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "商品id") + private Integer mallId; + + @ApiModelProperty(value = "文件名称") + private String fileName; + + @ApiModelProperty(value = "文件路径") + private String filePath; + + @ApiModelProperty(value = "是否删除(0、未删除 1、已删除)") + @TableLogic(value = "0",delval = "1") + private int isDel; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date updateTime; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date createTime; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/MallClassification.java b/nakadai/src/main/java/com/huoran/nakadai/entity/MallClassification.java new file mode 100644 index 0000000..a4d6e50 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/MallClassification.java @@ -0,0 +1,41 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 商品分类关联表 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("hr_mall_classification") +@ApiModel(value="MallClassification对象", description="商品分类关联表") +public class MallClassification implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "商城产品分类关联表") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "分类id《hr_product_classification》") + private Integer classificationId; + + @ApiModelProperty(value = "商品id《hr_mall》") + private Integer mallId; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/MallCourseLearningRecord.java b/nakadai/src/main/java/com/huoran/nakadai/entity/MallCourseLearningRecord.java new file mode 100644 index 0000000..3609a28 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/MallCourseLearningRecord.java @@ -0,0 +1,55 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 商品课程学习记录 + *

+ * + * @author chen + * @since 2023-04-26 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("hr_mall_course_learning_record") +@ApiModel(value="MallCourseLearningRecord对象", description="商品课程学习记录") +public class MallCourseLearningRecord implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "商品课程学习记录") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "商品id") + private Integer mallId; + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date updateTime; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date createTime; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/MallDiscipline.java b/nakadai/src/main/java/com/huoran/nakadai/entity/MallDiscipline.java new file mode 100644 index 0000000..d4f0015 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/MallDiscipline.java @@ -0,0 +1,47 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 商品学科类别关联表 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("hr_mall_discipline") +@ApiModel(value="MallDiscipline对象", description="商品学科类别关联表") +public class MallDiscipline implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "商品学科专业关联表") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "商品id《hr_mall》") + private Integer mallId; + + @ApiModelProperty(value = "学科类别id《discipline》") + private Integer categoryId; + + @ApiModelProperty(value = "专业类id《professional_class》") + private Integer professionalCategoryId; + + @ApiModelProperty(value = "专业id《professional》") + private Integer professionalId; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/MallNonAssociatedLinks.java b/nakadai/src/main/java/com/huoran/nakadai/entity/MallNonAssociatedLinks.java new file mode 100644 index 0000000..a2573c0 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/MallNonAssociatedLinks.java @@ -0,0 +1,55 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 非关联产品链接 + *

+ * + * @author chen + * @since 2023-05-15 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("hr_mall_non_associated_links") +@ApiModel(value="MallNonAssociatedLinks对象", description="非关联产品链接") +public class MallNonAssociatedLinks implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "商品id") + private Integer mallId; + + @ApiModelProperty(value = "链接名称") + private String urlName; + + @ApiModelProperty(value = "链接") + private String url; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date updateTime; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date createTime; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/MallPrice.java b/nakadai/src/main/java/com/huoran/nakadai/entity/MallPrice.java new file mode 100644 index 0000000..5269628 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/MallPrice.java @@ -0,0 +1,58 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.math.BigDecimal; + +/** + *

+ * 商品价格表 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("hr_mall_price") +@ApiModel(value="MallPrice对象", description="商品价格表") +public class MallPrice implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "商品价格主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "结算价类型,0为厂商结算价,1为平台结算价") + private Integer settlementPriceType; + + @ApiModelProperty(value = "地区id,为省份id,0表示普适地区,默认为0") + private Integer area; + + @ApiModelProperty(value = "城市id") + private Integer cityId; + + @ApiModelProperty(value = "结算价") + private BigDecimal settlementPrice; + + @ApiModelProperty(value = "录入类型,0为手动录入,1为折扣价,默认为0") + private Integer entryType; + + @ApiModelProperty(value = "折扣率") + private BigDecimal discountRate; + + @ApiModelProperty(value = "商品id《hr_mall》") + private Integer mallId; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/MallSupplier.java b/nakadai/src/main/java/com/huoran/nakadai/entity/MallSupplier.java new file mode 100644 index 0000000..7ba4f07 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/MallSupplier.java @@ -0,0 +1,41 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 商品供应商关联表 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("hr_mall_supplier") +@ApiModel(value="MallSupplier对象", description="商品供应商关联表") +public class MallSupplier implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "商品产品类型关联主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "商品id《hr_mall》") + private Integer mallId; + + @ApiModelProperty(value = "供应商id《hr_supplier》") + private Integer supplierId; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/MallTags.java b/nakadai/src/main/java/com/huoran/nakadai/entity/MallTags.java new file mode 100644 index 0000000..8302f4d --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/MallTags.java @@ -0,0 +1,41 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 商品分类标签关联表 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("hr_mall_tags") +@ApiModel(value="MallTags对象", description="商品分类标签关联表") +public class MallTags implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "商城分类标签关联表") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "商品id《hr_mall》") + private Integer mallId; + + @ApiModelProperty(value = "分类标签id《hr_tags》") + private Integer tagsId; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/MallType.java b/nakadai/src/main/java/com/huoran/nakadai/entity/MallType.java new file mode 100644 index 0000000..2bd32b6 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/MallType.java @@ -0,0 +1,41 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 商品类型关联表 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("hr_mall_type") +@ApiModel(value="MallType对象", description="商品类型关联表") +public class MallType implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "商品产品类型关联主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "商品id《hr_mall》") + private Integer mallId; + + @ApiModelProperty(value = "类型id《hr_product_type》") + private Integer typeId; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/ModelDemoHidden.java b/nakadai/src/main/java/com/huoran/nakadai/entity/ModelDemoHidden.java new file mode 100644 index 0000000..a36f16b --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/ModelDemoHidden.java @@ -0,0 +1,54 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; +import java.util.Date; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 此表是在教师端系统管理,可对于系统内置模型统一管理 + *

+ * + * @author chen + * @since 2023-06-03 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="ModelDemoHidden对象", description="此表是在教师端系统管理,可对于系统内置模型统一管理") +public class ModelDemoHidden implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "id(对应model_reference_demo主键)") + private Integer modelId; + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + @ApiModelProperty(value = "是否关闭(1关闭)") + private Integer isClose; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/ModelReferenceCategory.java b/nakadai/src/main/java/com/huoran/nakadai/entity/ModelReferenceCategory.java new file mode 100644 index 0000000..eb93b1a --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/ModelReferenceCategory.java @@ -0,0 +1,83 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; + +import java.io.Serializable; +import java.util.List; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; + +/** + *

+ * 引用模型-分类表 + *

+ * + * @author chen + * @since 2022-03-04 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "ModelReferenceCategory对象", description = "引用模型-分类表") +public class ModelReferenceCategory implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "分类名称") + private String categoryName; + + @ApiModelProperty(value = "父id") + private Integer parentId; + + @ApiModelProperty(value = "系统id") + @NotNull(message = "系统id不能为空") + private Integer systemId; + + @ApiModelProperty(value = "级别") + private Integer level; + + @ApiModelProperty(value = "创建人") + private Integer accountId; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "源模型分类表主键(引用id)") + private Integer copyId; + + @ApiModelProperty(value = "用于前台展示(默认0为展示 1为不展示)") + private Integer isShow; + + @ApiModelProperty(value = "是否删除") + @TableLogic + private Integer isDel; + + + @ApiModelProperty(value = "创建人角色(0、系统 1、院校)") + @NotNull(message = "创建人来源传值不能为空") + private Integer founder; + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + @ApiModelProperty(value = "子级") + private transient List children; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/ModelReferenceDemo.java b/nakadai/src/main/java/com/huoran/nakadai/entity/ModelReferenceDemo.java new file mode 100644 index 0000000..42e9d7f --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/ModelReferenceDemo.java @@ -0,0 +1,107 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; + +import java.io.Serializable; +import java.util.List; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; + +/** + *

+ * 引用模型代码记录表 + *

+ * + * @author chen + * @since 2022-03-04 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "ModelReferenceDemo对象", description = "引用模型代码记录表") +public class ModelReferenceDemo implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "主键") + private Integer id; + + @ApiModelProperty(value = "分类id") + private Integer categoryId; + + @ApiModelProperty(value = "创建人id") + private Integer accountId; + + @ApiModelProperty(value = "逻辑删除(默认0 1为已删)") + @TableLogic + private Integer isDel; + + @ApiModelProperty(value = "源模型代码记录表主键(引用id)") + private Integer copyId; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "编辑时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "系统id") + private Integer systemId; + + + + @ApiModelProperty(value = "模型名称") + @TableField(exist = false) + private String modelName; + + @ApiModelProperty(value = "分类名称") + @TableField(exist = false) + private String categoryName; + + + @ApiModelProperty(value = "模型代码") + @TableField(exist = false) + private String modelDemo; + + + @ApiModelProperty(value = "创建人来源(0、系统 1、院校)") + @NotNull(message = "创建人来源传值不能为空") + private Integer founder; + + @ApiModelProperty(value = "学校id(不用传)") + private Integer schoolId; + + @ApiModelProperty(value = "编辑人id") + private Integer modifyAccountId; + + @ApiModelProperty(value = "编辑人") + @TableField(exist = false) + private String editor; + + + @ApiModelProperty(value = "启用状态(0开启 1未开启 默认0)") + @TableField(exist = false) + private Integer isOpen; + + @ApiModelProperty(value = "中台端是否开启(0开启,1未开启 默认0)") + @TableField(exist = false) + private Integer ztOpen; + + + @ApiModelProperty(value = "教师端是否关闭系统当前内置模型(0未关闭 1已关闭)") + @TableField(exist = false) + private Integer isClose; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/ModelSysCategory.java b/nakadai/src/main/java/com/huoran/nakadai/entity/ModelSysCategory.java new file mode 100644 index 0000000..53b721d --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/ModelSysCategory.java @@ -0,0 +1,79 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; + +import java.io.Serializable; +import java.util.List; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; + +/** + *

+ * 源模型-分类表 + *

+ * + * @author chen + * @since 2022-03-03 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "ModelSysCategory对象", description = "源模型-分类表") +public class ModelSysCategory implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "父id") + @NotNull(message = "父id不能为空") + private Integer parentId; + + @ApiModelProperty(value = "分类名称") + @NotNull(message = "分类名称不能为空") + private String categoryName; + + @ApiModelProperty(value = "级别") + @NotNull(message = "等级不能为空") + private Integer level; + + @ApiModelProperty(value = "创建人") + private Integer accountId; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + + @ApiModelProperty(value = "创建人角色(0、系统 1、院校)") + @NotNull(message = "创建人来源传值不能为空") + private Integer founder; + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + + @ApiModelProperty(value = "是否开启(0开启,1未开启 默认0)") + private Integer isOpen; + + @ApiModelProperty(value = "是否删除(0未删除,1已删除 默认0)") + @TableLogic + private Integer isDel; + + @ApiModelProperty(value = "子级") + private transient List children; +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/ModelSysDemo.java b/nakadai/src/main/java/com/huoran/nakadai/entity/ModelSysDemo.java new file mode 100644 index 0000000..5891668 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/ModelSysDemo.java @@ -0,0 +1,108 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; + +import java.io.Serializable; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; + +/** + *

+ * + *

+ * + * @author chen + * @since 2022-03-04 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "ModelSysDemo对象", description = "") +public class ModelSysDemo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "模型名称") + @NotNull(message = "模型名称不能为空") + private String modelName; + + @ApiModelProperty(value = "模型代码") + @NotNull(message = "模型代码不能为空") + private String modelDemo; + + @ApiModelProperty(value = "分类id") + @NotNull(message = "分类id不能为空") + private Integer categoryId; + + @ApiModelProperty(value = "发布状态(0草稿 1发布)") + @NotNull(message = "发布状态不能为空") + private Integer postStatus; + + @ApiModelProperty(value = "创建人id") + private Integer accountId; + + @ApiModelProperty(value = "编辑人id") + private Integer modifyAccountId; + + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "最新编辑时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + + @ApiModelProperty(value = "创建人来源(0、系统 1、院校)") + @NotNull(message = "创建人来源传值不能为空") + private Integer founder; + + @ApiModelProperty(value = "学校id(不用传)") + private Integer schoolId; + + + @ApiModelProperty(value = "院校端是否开启(0开启,1未开启 默认0)") + private Integer isOpen; + + @ApiModelProperty(value = "中台端是否开启(0开启,1未开启 默认0)") + private Integer ztOpen; + + @ApiModelProperty(value = "院校端是否删除(0未删除,1已删除 默认0)") + @TableLogic + private Integer isDel; + + @ApiModelProperty(value = "中台端是否删除(0未删除,1已删除 默认0)") + private Integer ztDel; + + + @ApiModelProperty(value = "编辑人") + @TableField(exist = false) + private String modifyName; + + @ApiModelProperty(value = "分类名称") + @TableField(exist = false) + private String categoryName; + + + @ApiModelProperty(value = "学校名称") + @TableField(exist = false) + private String schoolName; + + @ApiModelProperty(value = "是否为中台操作(1:是)") + @TableField(exist = false) + private Integer isAdmin; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/Notify.java b/nakadai/src/main/java/com/huoran/nakadai/entity/Notify.java new file mode 100644 index 0000000..445858e --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/Notify.java @@ -0,0 +1,55 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 消息通知表 + *

+ * + * @author chen + * @since 2023-05-29 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("hr_notify") +@ApiModel(value="Notify对象", description="消息通知表") +public class Notify implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "通知id") + @TableId(value = "notify_id", type = IdType.AUTO) + private Integer notifyId; + + @ApiModelProperty(value = "消息类型:1、点赞 2、回复 ") + private Integer type; + + @ApiModelProperty(value = "消息是否已读 0未读 1已读") + private Integer isRead; + + @ApiModelProperty(value = "评论id") + private Integer commentId; + + @ApiModelProperty("创建时间") + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "评论账号id") + private Integer commentAccountId; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/Order.java b/nakadai/src/main/java/com/huoran/nakadai/entity/Order.java new file mode 100644 index 0000000..581eef7 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/Order.java @@ -0,0 +1,131 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + *

+ * 订单表 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@Data +@TableName("hr_order") +public class Order implements Serializable { + + private static final long serialVersionUID = -6471558434681123441L; + + @ApiModelProperty(value = "主键Id") + @TableId(value = "order_id", type = IdType.AUTO) + private Integer orderId; + + @ApiModelProperty(value = "订单编号") + private String orderNumber; + + @ApiModelProperty(value = "订单内容") + @TableField(exist = false) + private String orderContent; + + @ApiModelProperty(value = "绑定客户id") + private Integer customerId; + + @ApiModelProperty(value = "订单客户名称") + @NotNull(message = "客户名称不能为空") + private String customerName; + + @ApiModelProperty(value = "订单金额") + @NotNull(message = "订单金额不能为空") + private String orderAmount; + + @ApiModelProperty(value = "订单名称") + private String orderName; + + @ApiModelProperty(value = "订单类型(1、正式 2、试用)") + @NotNull(message = "订单类型不能为空") + private Integer orderType; + + @ApiModelProperty(value = "订单状态(0、待发货 1、已完成 2、已取消)") + private Integer orderStatus; + + @ApiModelProperty(value = "订单性质(1、初签 2、续签)") + private Integer orderNature; + + @ApiModelProperty(value = "省份id") + @NotNull(message = "省份不能为空") + private Integer provinceId; + + @ApiModelProperty(value = "省份名") + @TableField(exist = false) + private String provinceName; + + @ApiModelProperty(value = "城市id") + @NotNull(message = "城市不能为空") + private Integer cityId; + + @ApiModelProperty(value = "城市名") + @TableField(exist = false) + private String cityName; + + @ApiModelProperty(value = "团队名") + @TableField(exist = false) + private String teamName; + + @ApiModelProperty(value = "订单联系人") + private String orderContact; + + @ApiModelProperty(value = "电话") + private String phone; + + @ApiModelProperty(value = "邮箱") + private String email; + + @ApiModelProperty(value = "是否删除(0、未删除 1、已删除)") + @TableLogic(value = "0",delval = "1") + private int isDel; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date updateTime; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date createTime; + + @ApiModelProperty(value = "商务经理id") + private String businessManagerId; + + @ApiModelProperty(value = "商务经理名称") + @TableField(exist = false) + private String businessManagerName; + + @ApiModelProperty(value = "团队id") + private Integer teamId; + + @ApiModelProperty(value = "小程序通知次数 ,默认为0") + private Integer notification; + + @ApiModelProperty(value = "利润") + private BigDecimal profit; + + @ApiModelProperty(value = "采购成本") + private BigDecimal purchaseCost; + + @ApiModelProperty(value = "数据产品或课程名称") + @TableField(exist = false) + private String productName; + + @ApiModelProperty(value = "openid") + @TableField(exist = false) + private String openid; +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/OrderOther.java b/nakadai/src/main/java/com/huoran/nakadai/entity/OrderOther.java new file mode 100644 index 0000000..c5598ff --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/OrderOther.java @@ -0,0 +1,196 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.huoran.nakadai.entity.res.PermissiontogetordersResp; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.Size; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +/** + *

+ * 订单其他信息(包含课程权限、数据平台权限、合同信息等) + *

+ * + * @author cheney + * @since 2021-07-01 + */ +@Data + +@TableName("order_other") +@ApiModel(value = "OrderOther对象", description = "订单其他信息(包含课程权限、数据平台权限、合同信息等)") +public class OrderOther implements Serializable { + + private static final long serialVersionUID = 6473128434681123441L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "商品主键id") + private Integer mallId; + + @ApiModelProperty(value = "订单id") + private Integer orderId; + + @ApiModelProperty(value = "数据产品或课程id(根据权限authority字段判断)") + private Integer dataOrCourseId; + + @ApiModelProperty(value = "数据产品或课程名称") + private String productName; + + @ApiModelProperty(value = "端口id(预留处理)") + private Integer portId; + + @ApiModelProperty(value = "使用期限(以月为单位)") + @NotEmpty(message = "期限不能为空") + private Integer periodOfUse; + + @ApiModelProperty(value = "剩余期限(以天为单位)") + private Integer remainingPeriod; + + @ApiModelProperty(value = "成交价(以万位单位)") + @NotEmpty(message = "成交价不能为空") + private BigDecimal finalPrice; + + @ApiModelProperty(value = "成交单价(数据产品)") + private BigDecimal finalValue; + + @ApiModelProperty(value = "总金额(以万为单位)") + @NotEmpty(message = "总金额不能为空") + private BigDecimal totalAmount; + + @ApiModelProperty(value = "市场价(以万为单位)") + private BigDecimal marketValue; + + @ApiModelProperty(value = "产品市场价(以万为单位)") + @TableField(exist = false) + private BigDecimal marketPrice; + + @ApiModelProperty(value = "折扣率(百分比)") + private String discountRate; + + @ApiModelProperty(value = "是否发货(0未发货,1已发货,默认不发货)") + @Size(max = 1) + private Integer ship; + + @ApiModelProperty(value = "区分权限(0为数据平台权限,1为课程权限,2为职站增值模块,3为实训课程(非集成),4为实验工具,对应id为商城管理中的产品)") + @Size(max = 4) + private Integer authority; + + @ApiModelProperty(value = "是否开启(0不开启,1开启,发货后,默认开启)") + @Size(max = 1) + private Integer isEnable; + + @ApiModelProperty(value = "账号数") + @NotEmpty(message = "账号数不能为空") + private Integer accountNum; + + @ApiModelProperty(value = "是否删除(0、未删除 1、已删除)") + @TableLogic(value = "0", delval = "1") + private Integer isDel; + + @ApiModelProperty(value = "使用期限单位选择0日,1月,2年") + private Integer options; + + @ApiModelProperty(value = "使用开始时间") + @TableField(fill = FieldFill.INSERT) + @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd") + private Date startTime; + + @ApiModelProperty(value = "使用结束时间") + @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd") + private Date endTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd") + private Date updateTime; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd") + private Date createTime; + + @ApiModelProperty(value = "结算价(以万位单位)") + @NotEmpty(message = "结算价不能为空") + private BigDecimal settlementPrice; + + @ApiModelProperty(value = "原产品结算价(以万位单位)") + @TableField(exist = false) + private BigDecimal originalSettlementPrice; + + @ApiModelProperty(value = "结算方式,0为单价,1为分成") + @TableField(exist = false) + private String settlementMethod; + + @ApiModelProperty(value = "供应厂商") + @TableField(exist = false) + private String supplier; + + @ApiModelProperty(value = "商务占比") + @TableField(exist = false) + private String businessProportion; + + @ApiModelProperty(value = "厂商占比") + @TableField(exist = false) + private String manufacturerProportion; + + @ApiModelProperty(value = "起止时间列表") + @TableField(exist = false) + private List startAndEndTimeList; + + @ApiModelProperty(value = "未生效的起止时间列表") + @TableField(exist = false) + private List notActiveList; + + @ApiModelProperty(value = "产品类型(0->理论 1-实训 3-数据产品)") + @TableField(exist = false) + private Integer productType; + + @ApiModelProperty(value = "产品删除状态(0未删除 1已删除)") + @TableField(exist = false) + private Integer productDel; + + @ApiModelProperty(value = "小程序图片地址") + @TableField(exist = false) + private String miniProgramPictureAddress; + + @ApiModelProperty(value = "上下架(0下架 1上架 默认 1)") + @TableField(exist = false) + private Integer isShelves; + + @ApiModelProperty(value = "商品分类(1实训课程,2理论课程)") + @TableField(exist = false) + private Integer mallClassificationId; + + @ApiModelProperty(value = "类型id") + @TableField(exist = false) + private Integer typeId; + + @ApiModelProperty(value = "类型名称") + @TableField(exist = false) + private String typeName; + + @ApiModelProperty(value = "商品名称") + @TableField(exist = false) + private String goodsName; + + @ApiModelProperty(value = "发货时间") + private Date shipTime; + + @ApiModelProperty(value = "非集成到职站的产品发货需要填写发货内容300字内") + private String shipContent; + + @ApiModelProperty(value = "产品链接") + @TableField(exist = false) + private List mallNonAssociatedLinks; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/PartnerAccount.java b/nakadai/src/main/java/com/huoran/nakadai/entity/PartnerAccount.java new file mode 100644 index 0000000..53a9ada --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/PartnerAccount.java @@ -0,0 +1,46 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + *

+ * 合伙人账号表 + *

+ * + * @author chen + * @since 2022-05-18 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("hr_partner_account") +@ApiModel(value="PartnerAccount对象", description="合伙人账号表") +public class PartnerAccount implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "合伙人主键ID") + @TableId(value = "partner_id", type = IdType.AUTO) + private Integer partnerId; + + @ApiModelProperty(value = "绑定账号id") + private Integer accountId; + + @ApiModelProperty(value = "邀请账号") + private String invitationAccount; + + @ApiModelProperty(value = "是否删除(0、未删除 1、已删除)") + @TableLogic + private Integer isDel; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/PartnerArticleClassification.java b/nakadai/src/main/java/com/huoran/nakadai/entity/PartnerArticleClassification.java new file mode 100644 index 0000000..8c4ca95 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/PartnerArticleClassification.java @@ -0,0 +1,56 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @描述:合伙人——文章管理——文章所属分类 + * @作者: Rong + * @日期: 2023-03-16 + */ +@Data +@ApiModel(value = "合伙人——文章管理——文章所属分类") +@TableName("partner_article_classification") +public class PartnerArticleClassification implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "主键") + private Integer id; + + @ApiModelProperty(value = "分类名称") + private String classificationName; + + @ApiModelProperty(value = "创建人id") + private Integer founderId; + + @ApiModelProperty(value = "编辑人id") + private Integer editorId; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "是否删除(默认0未删除;1为已删除)",example = "0") + @TableLogic + private Integer isDel; + + @ApiModelProperty(value = "类型(1.学习2.资讯)",example = "1") + private Integer typeId; + + @ApiModelProperty(value = "关联方案id") + @TableField(exist = false) + private String schemeId; + + @ApiModelProperty(value = "关联商品id") + @TableField(exist = false) + private String mallId; + + +} \ No newline at end of file diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/PartnerArticleFile.java b/nakadai/src/main/java/com/huoran/nakadai/entity/PartnerArticleFile.java new file mode 100644 index 0000000..cec233e --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/PartnerArticleFile.java @@ -0,0 +1,60 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @描述:合伙人——文章管理——文章附件管理表 + * @作者: Rong + * @日期: 2023-03-16 + */ +@Data +@ApiModel(value = "合伙人——文章管理——文章附件管理表") +@TableName("partner_article_file") +public class PartnerArticleFile implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "主键") + private Integer id; + + @ApiModelProperty(value = "文章id") + private Integer contentId; + + @ApiModelProperty(value = "文件名") + private String fileName; + + @ApiModelProperty(value = "创建人id") + private Integer founderId; + + @ApiModelProperty(value = "编辑人id") + private Integer editorId; + + @ApiModelProperty(value = "文件大小") + private String fileSize; + + @ApiModelProperty(value = "文件格式") + private String fileFormat; + + @ApiModelProperty(value = "oss文件名") + private String ossFileName; + + @ApiModelProperty(value = "文件路径") + private String filePath; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "是否删除(默认0未删除;1为已删除)") + @TableLogic + private Integer isDel; + + +} \ No newline at end of file diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/PartnerArticleLabel.java b/nakadai/src/main/java/com/huoran/nakadai/entity/PartnerArticleLabel.java new file mode 100644 index 0000000..c71169b --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/PartnerArticleLabel.java @@ -0,0 +1,45 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @描述:合伙人——文章管理——文章主题标签 + * @作者: Rong + * @日期: 2023-03-16 + */ +@Data +@ApiModel(value = "合伙人——文章管理——文章主题标签") +@TableName("partner_article_label") +public class PartnerArticleLabel implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "主键") + private Integer id; + + @ApiModelProperty(value = "标签名称") + private String labelName; + + @ApiModelProperty(value = "创建人id") + private Integer founderId; + + @ApiModelProperty(value = "编辑人id") + private Integer editorId; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "是否删除(默认0未删除;1为已删除)") + @TableLogic + private Integer isDel; + + +} \ No newline at end of file diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/PartnerArticleManagement.java b/nakadai/src/main/java/com/huoran/nakadai/entity/PartnerArticleManagement.java new file mode 100644 index 0000000..6cbcd45 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/PartnerArticleManagement.java @@ -0,0 +1,126 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.util.Date; +import java.util.List; + +/** + * @描述:合伙人——文章管理 + * @作者: Rong + * @日期: 2023-03-16 + */ +@Data +@ApiModel(value = "合伙人——文章管理") +@TableName("partner_article_management") +public class PartnerArticleManagement { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "文章id") + private Integer id; + + @ApiModelProperty(value = "文章标题(依据站点判重)") + private String title; + + @ApiModelProperty(value = "是否删除(默认0未删除;1为已删除)") + @TableLogic + private Integer isDel; + + @ApiModelProperty(value = "标题图") + private String titleImg; + + @ApiModelProperty(value = "封面图") + private String bannerImg; + + @ApiModelProperty(value = "来源") + private String source; + + @ApiModelProperty(value = "发布时间(不要时分秒)") + private String releaseTime; + + @ApiModelProperty(value = "摘要") + private String summary; + + /*@ApiModelProperty(value = "文章模板(前端自定义)") + private Integer articleTemplate;*/ + + @ApiModelProperty(value = "正文") + private String mainBody; + + @ApiModelProperty(value = "作者") + private String author; + + @ApiModelProperty(value = "审核") + private String audit; + + @ApiModelProperty(value = "是否发布(0:草稿 1:已发布)") + private Integer isRelease; + + @ApiModelProperty(value = "创建人id") + private Integer founderId; + + @ApiModelProperty(value = "编辑人id") + private Integer editorId; + + @ApiModelProperty(value = "文件") + private String file; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "文章总浏览量") + private Integer totalBrowsing; + + + @ApiModelProperty(value = "编辑") + private String edit; + + @ApiModelProperty(value = "主题标签(partner_article_label表外键) 可多选逗号隔开") + private String lableId; + + @ApiModelProperty(value = "所属分类(partner_article_classification表外键)") + @NotNull(message = "请选择所属分类!") + private Integer classificationId; + + @ApiModelProperty(value = "是否禁用(0默认,0启用 1禁用)") + private Integer isDisable; + + /*@ApiModelProperty(value = "序号") + private Integer sequence;*/ + + @ApiModelProperty(value = "类型(1.学习2.资讯)") + private Integer typeId; + + @ApiModelProperty(value = "文章附件") + @TableField(exist = false) + List fileList; + + @ApiModelProperty(value = "分类名称") + @TableField(exist = false) + private List classificationNameList; + @ApiModelProperty(value = "标签名称") + @TableField(exist = false) + private List labelNameList; + /* @Override + public int compareTo(PartnerArticleManagement o) { + return Integer.compare(this.sequence, o.getSequence()); + } +*/ + + @ApiModelProperty(value = "是否置顶(默认为0 不置顶 1为置顶)") + private Integer isTop; + + @ApiModelProperty(value = "置顶时间") + private Date topTime; +} \ No newline at end of file diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/PartnerArticleManagementCollect.java b/nakadai/src/main/java/com/huoran/nakadai/entity/PartnerArticleManagementCollect.java new file mode 100644 index 0000000..f131eae --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/PartnerArticleManagementCollect.java @@ -0,0 +1,47 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 合伙人——学习收藏表 + *

+ * + * @author chen + * @since 2023-04-18 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="PartnerArticleManagementCollect对象", description="合伙人——学习收藏表") +public class PartnerArticleManagementCollect implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "文章收藏id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "文章id") + private Integer contentId; + + @ApiModelProperty(value = "收藏时间") + private Date collectionTime; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/PartnerArticleStatistic.java b/nakadai/src/main/java/com/huoran/nakadai/entity/PartnerArticleStatistic.java new file mode 100644 index 0000000..5fb434d --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/PartnerArticleStatistic.java @@ -0,0 +1,39 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @描述:合伙人——文章管理——文章浏览记录 + * @作者: Rong + * @日期: 2023-03-17 + */ +@Data +@ApiModel(value = "合伙人——文章管理——文章浏览记录") +@TableName("partner_article_statistic") +public class PartnerArticleStatistic implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "主键") + private Integer id; + + @ApiModelProperty(value = "文章id") + private Integer contentId; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + + +} \ No newline at end of file diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/PartnerClassification.java b/nakadai/src/main/java/com/huoran/nakadai/entity/PartnerClassification.java new file mode 100644 index 0000000..8d9dee2 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/PartnerClassification.java @@ -0,0 +1,75 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; +import java.io.Serializable; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 合伙人分类表 + *

+ * + * @author chen + * @since 2022-05-18 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("hr_partner_classification") +@ApiModel(value="PartnerClassification对象", description="合伙人分类表") +public class PartnerClassification implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "合伙人分类名称") + private String partnerClassificationName; + + @ApiModelProperty(value = "父id 一级为0", example = "0", name = "parentId") + private Integer parentId; + + @ApiModelProperty(value = "层级") + private Integer level; + + @ApiModelProperty(value = "子级") + @TableField(exist = false) + private List children; + + @ApiModelProperty(value = "层级拼接") + @TableField(exist = false) + private String splicingLevel; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date updateTime; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date createTime; + + @ApiModelProperty(value = "逻辑删除") + @TableLogic + private Integer isDel; + + @ApiModelProperty(value = "是否为团队(默认0不是团体,1为团队)") + private Integer isTeam; + + @ApiModelProperty(value = "合伙人主键id") + @TableField(exist = false) + private Integer partnerId; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/PartnerSchemeManagement.java b/nakadai/src/main/java/com/huoran/nakadai/entity/PartnerSchemeManagement.java new file mode 100644 index 0000000..f45d8cc --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/PartnerSchemeManagement.java @@ -0,0 +1,85 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + *

+ * 合伙人——方案管理 + *

+ * + * @author chen + * @since 2023-03-20 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "PartnerSchemeManagement对象", description = "合伙人——方案管理") +public class PartnerSchemeManagement implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键(方案id)") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "文章标题(判重)") + private String title; + + @ApiModelProperty(value = "是否删除(默认0未删除;1为已删除)") + @TableLogic + private Integer isDel; + + @ApiModelProperty(value = "产品介绍") + private String product; + + @ApiModelProperty(value = "适用专业") + private String applicableMajor; + + @ApiModelProperty(value = "是否发布(0:草稿 1:已发布)") + private Integer isRelease; + + @ApiModelProperty(value = "创建人id") + private Integer founderId; + + @ApiModelProperty(value = "编辑人id") + private Integer editorId; + + @ApiModelProperty(value = "方案文件") + private String schemeFile; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "所属分类(partner_article_classification表外键)") + private Integer classificationId; + + @ApiModelProperty(value = "是否禁用(0默认,0启用 1禁用)") + private Integer isDisable; + + + @ApiModelProperty(value = "方案简介") + private String schemeIntroduction; + + @ApiModelProperty(value = "文件名") + private String fileName; + + + @ApiModelProperty(value = "产品") + @TableField(exist = false) + private List productList; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/PartnerSchemeManagementProductConfig.java b/nakadai/src/main/java/com/huoran/nakadai/entity/PartnerSchemeManagementProductConfig.java new file mode 100644 index 0000000..b476016 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/PartnerSchemeManagementProductConfig.java @@ -0,0 +1,55 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; + +import java.io.Serializable; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 合伙人——方案管理——产品配置表 + *

+ * + * @author chen + * @since 2023-06-28 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "PartnerSchemeManagementProductConfig对象", description = "合伙人——方案管理——产品配置表") +@TableName("partner_scheme_management_product_config") +public class PartnerSchemeManagementProductConfig implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "主键") + private Integer id; + + @ApiModelProperty(value = "关联的产品id") + private Integer mallId; + + @ApiModelProperty(value = "方案id") + private Integer schemeId; + + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "产品名称") + @TableField(exist = false) + private String productName; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/PartnerTeam.java b/nakadai/src/main/java/com/huoran/nakadai/entity/PartnerTeam.java new file mode 100644 index 0000000..1a50c60 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/PartnerTeam.java @@ -0,0 +1,92 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + *

+ * 合伙人团队表(合伙人账号与分类中间表) + *

+ * + * @author chen + * @since 2022-05-18 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("hr_partner_team") +@ApiModel(value="PartnerTeam对象", description="合伙人团队表(合伙人账号与分类中间表)") +public class PartnerTeam implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "合伙人团队主键id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "合伙人主键id") + private Integer partnerId; + + @ApiModelProperty(value = "合伙人分类id") + private Integer classificationId; + + @ApiModelProperty(value = "省份id") + private Integer provinceId; + + @ApiModelProperty(value = "城市id") + private Integer cityId; + + @ApiModelProperty(value = "团队年费") + private BigDecimal annualTeamFee; + + @ApiModelProperty(value = "市场服务年费") + private BigDecimal annualMarketingFee; + + @ApiModelProperty(value = "省份名称") + @TableField(exist = false) + private String provinceName; + + @ApiModelProperty(value = "团队名称") + @TableField(exist = false) + private String teamName; + + @ApiModelProperty(value = "城市名称") + @TableField(exist = false) + private String cityName; + + @ApiModelProperty(value = "用户名称") + @TableField(exist = false) + private String userName; + + @ApiModelProperty(value = "账号名称") + @TableField(exist = false) + private String accountName; + + @ApiModelProperty(value = "是否团队") + @TableField(exist = false) + private int isTeam; + + @ApiModelProperty(value = "teamId") + @TableField(exist = false) + private Integer teamId; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty("是否删除(0、未删除 1、已删除)") + @TableLogic(value = "0",delval = "1") + private Integer isDel; +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/ProductClassification.java b/nakadai/src/main/java/com/huoran/nakadai/entity/ProductClassification.java new file mode 100644 index 0000000..3f5aff8 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/ProductClassification.java @@ -0,0 +1,38 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 产品分类表 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("hr_product_classification") +@ApiModel(value="ProductClassification对象", description="产品分类表") +public class ProductClassification implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "商城产品分类主键id") + @TableId(value = "classification_id", type = IdType.AUTO) + private Integer classificationId; + + @ApiModelProperty(value = "分类名称") + private String classificationName; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/ProductTheme.java b/nakadai/src/main/java/com/huoran/nakadai/entity/ProductTheme.java new file mode 100644 index 0000000..f7987e2 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/ProductTheme.java @@ -0,0 +1,36 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * @描述: + * @作者: Rong + * @日期: 2023-08-22 + */ +@Data +@ApiModel(value = "") +@TableName("sys_product_theme") +public class ProductTheme implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "主题id") + private Integer id; + + @ApiModelProperty(value = "主题图片") + private String url; + + +} \ No newline at end of file diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/ProductType.java b/nakadai/src/main/java/com/huoran/nakadai/entity/ProductType.java new file mode 100644 index 0000000..d03eda8 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/ProductType.java @@ -0,0 +1,38 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 产品类型表 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("hr_product_type") +@ApiModel(value="ProductType对象", description="产品类型表") +public class ProductType implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "产品类型主键") + @TableId(value = "type_id", type = IdType.AUTO) + private Integer typeId; + + @ApiModelProperty(value = "类型名称") + private String typeName; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/Professional.java b/nakadai/src/main/java/com/huoran/nakadai/entity/Professional.java new file mode 100644 index 0000000..27f1f75 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/Professional.java @@ -0,0 +1,47 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + *

+ * 专业 + *

+ * + * @author huoran + * @since 2021-07-09 + */ +@Data +@TableName("professional") +public class Professional implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 专业主键id + */ + @TableId(value = "professional_id", type = IdType.AUTO) + private Integer professionalId; + + /** + * 专业名称 + */ + private String professionalName; + + /** + * 专业类id + */ + private Integer professionalClassId; + + @ApiModelProperty(value = "引用次数") + @TableField(exist = false) + private Integer level; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/ProfessionalClass.java b/nakadai/src/main/java/com/huoran/nakadai/entity/ProfessionalClass.java new file mode 100644 index 0000000..74873b3 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/ProfessionalClass.java @@ -0,0 +1,55 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + *

+ * + *

+ * + * @author huoran + * @since 2021-07-09 + */ +@Data +@TableName("professional_class") +public class ProfessionalClass implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 专业类主键id + */ + @ApiModelProperty(value = "专业类主键id") + @TableId(value = "professional_class_id", type = IdType.AUTO) + private Integer professionalClassId; + + /** + * 专业类名称 + */ + @ApiModelProperty(value = "专业类名称") + private String professionalClassName; + + /** + * 学科层次id + */ + @ApiModelProperty(value = "学科层次id") + private Integer disciplineId; + + @ApiModelProperty(value = "引用次数") + @TableField(exist = false) + private Integer level; + + @ApiModelProperty(value = "引用专业") + @TableField(exist = false) + private List professionals; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/ProgramShoppingCart.java b/nakadai/src/main/java/com/huoran/nakadai/entity/ProgramShoppingCart.java new file mode 100644 index 0000000..ec83633 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/ProgramShoppingCart.java @@ -0,0 +1,53 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 小程序—购物车 + *

+ * + * @author chen + * @since 2023-06-09 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("mini_program_shopping_cart") +@ApiModel(value="ProgramShoppingCart对象", description="小程序—购物车") +public class ProgramShoppingCart implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "购物车主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "商品主键") + private Integer mallId; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "编辑时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "是否删除(默认0未删,1为已删)") + @TableLogic + private Integer isDel; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/Province.java b/nakadai/src/main/java/com/huoran/nakadai/entity/Province.java new file mode 100644 index 0000000..6444d7b --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/Province.java @@ -0,0 +1,42 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 省份表 + *

+ * + * @author huoran + * @since 2021-07-08 + */ +@Data +@TableName("province") +public class Province implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 省份主键ID + */ + @TableId(value = "province_id", type = IdType.AUTO) + private Integer provinceId; + + /** + * 省份名称 + */ + private String provinceName; + + /** + * 是否删除(0、为删除 1、已删除) + */ + private Integer isDel; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/School.java b/nakadai/src/main/java/com/huoran/nakadai/entity/School.java new file mode 100644 index 0000000..8a1a1ed --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/School.java @@ -0,0 +1,69 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 学校表 + *

+ * + * @author huoran + * @since 2021-06-29 + */ +@Data +@TableName("school") +public class School implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 学校主键id + */ + @TableId(value = "school_id", type = IdType.AUTO) + private Integer schoolId; + + /** + * 学校名称 + */ + private String schoolName; + + /** + * 绑定省份Id + */ + private Integer provinceId; + + /** + * 绑定城市Id + */ + private Integer cityId; + + /** + * 学历(1、本科 2、大专 3、高职 4、中专 5、其他) + */ + private Integer level; + + /** + * 是否删除(0、未删除 1、已删除) + */ + @TableLogic + private String isDel; + + /** + * 省份名称 + */ + private String provinceName; + + /** + * 城市名称 + */ + private String cityName; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/SchoolCurriculum.java b/nakadai/src/main/java/com/huoran/nakadai/entity/SchoolCurriculum.java new file mode 100644 index 0000000..11c1acd --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/SchoolCurriculum.java @@ -0,0 +1,54 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; +import java.util.Date; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 学校内置课程表 + *

+ * + * @author lr + * @since 2021-09-26 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="SchoolCurriculum对象", description="学校内置课程表") +public class SchoolCurriculum implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "唯一标识") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + @ApiModelProperty(value = "课程id") + private Integer cid; + + @ApiModelProperty(value = "是否启用(0启用,1未启用)") + private Integer isEnable; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "编辑时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/ServiceConfiguration.java b/nakadai/src/main/java/com/huoran/nakadai/entity/ServiceConfiguration.java new file mode 100644 index 0000000..88808d0 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/ServiceConfiguration.java @@ -0,0 +1,91 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 服务配置表 + *

+ * + * @author Mr.JK + * @since 2021-09-08 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("service_configuration") +public class ServiceConfiguration implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @TableId(value = "id", type = IdType.AUTO) + @ApiModelProperty(value = "主键id") + private Integer id; + + /** + * 系统id + */ + @ApiModelProperty(value = "系统id",required = false) + private String systemId; + + /** + * 系统名称 + */ + @ApiModelProperty(value = "系统名称",required = false) + private String systemName; + + /** + * 系统类型 + */ + @ApiModelProperty(value = "系统类型(0编程类 1流程类)") + private Integer type; + + /** + * 系统归属 + */ + @ApiModelProperty(value = "系统归属(0内部产品 1外部产品)") + private Integer belong; + + /** + * 系统状态(0 进行中 默认0) + */ + @ApiModelProperty(value = "系统状态(0 进行中 默认0)") + private Integer state; + + /** + * 是否删除(0未删除 1已删除 默认0) + */ + @ApiModelProperty(value = "是否删除(0未删除 1已删除 默认0)") + @TableLogic(value = "0",delval = "1") + private Integer isDel; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date updateTime; + + @ApiModelProperty(value = "供应商id") + private Integer supplierId; + + @ApiModelProperty(value = "供应商名称") + @TableField(exist = false) + private String supplierName; + +} \ No newline at end of file diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/Supplier.java b/nakadai/src/main/java/com/huoran/nakadai/entity/Supplier.java new file mode 100644 index 0000000..8339912 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/Supplier.java @@ -0,0 +1,49 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 供应商表 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("hr_supplier") +@ApiModel(value="Supplier对象", description="供应商表") +public class Supplier implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键id") + @TableId(value = "supplier_id", type = IdType.AUTO) + private Integer supplierId; + + @ApiModelProperty(value = "供应商名称") + private String supplierName; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date updateTime; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date createTime; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/Tags.java b/nakadai/src/main/java/com/huoran/nakadai/entity/Tags.java new file mode 100644 index 0000000..5c14222 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/Tags.java @@ -0,0 +1,42 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + *

+ * 分类标签表 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("hr_tags") +@ApiModel(value="Tags对象", description="分类标签表") +public class Tags implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "分类标签主键") + @TableId(value = "tags_id", type = IdType.AUTO) + private Integer tagsId; + + @ApiModelProperty(value = "标签名称") + private String tagsName; + + @ApiModelProperty(value = "序号") + private Integer sort; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/UserAccount.java b/nakadai/src/main/java/com/huoran/nakadai/entity/UserAccount.java new file mode 100644 index 0000000..0a18d23 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/UserAccount.java @@ -0,0 +1,84 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @描述:各个平台账号表 + * @作者: Rong + * @日期: 2021-08-25 + */ +@Data +@ApiModel(value = "各个平台账号表") +@TableName("hr_user_account") +public class UserAccount implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "主键id(平台用户id)") + private Integer id; + + @ApiModelProperty(value = "用户表id") + private Integer userId; + + @ApiModelProperty(value = "客户表id") + private Integer customerId; + + @ApiModelProperty(value = "账号") + private String account; + + @ApiModelProperty("手机号(平台唯一标识)") + private String phone; + + @ApiModelProperty(value = "密码") + private String password; + + @ApiModelProperty(value = "工号") + private String workNumber; + + @ApiModelProperty(value = "绑定的角色id(0为数据平台普通用户)") + private String roleId; + + @ApiModelProperty(value = "绑定院校id") + private Integer schoolId; + + @ApiModelProperty(value = "所属平台id") + private String platformId; + + @ApiModelProperty(value = "所属平台id") + private String appOpenId; + + @ApiModelProperty(value = "平台(系统)绑定时间") + private Date platformBindTime; + + @ApiModelProperty(value = "平台端区分:0->教师端 1->学生端 2->无端") + private Integer type; + + @ApiModelProperty(value = "是否删除(0、未删除 1、已删除)") + private Integer isDel; + + @ApiModelProperty(value = "是否禁用(0->禁用,1->启用)") + private Boolean isEnable; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "班级id") + @TableField(exist = false) + private String classId; + + @ApiModelProperty(value = "班级id") + @TableField(exist = false) + private String userName; +} \ No newline at end of file diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/UserInfo.java b/nakadai/src/main/java/com/huoran/nakadai/entity/UserInfo.java new file mode 100644 index 0000000..b3d1256 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/UserInfo.java @@ -0,0 +1,98 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @描述:用户信息表 + * @作者: Rong + * @日期: 2021-08-25 + */ +@Data +@ApiModel(value = "用户信息表") +@TableName("hr_user_info") +public class UserInfo implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "用户id") + private Integer userId; + + @ApiModelProperty(value = "用户姓名") + private String userName; + + @ApiModelProperty(value = "唯一标识账号") + private String uniqueIdentification; + + @ApiModelProperty(value = "证件类型(1、身份证)") + private Integer documentType; + + @ApiModelProperty(value = "证件号码") + private String idNumber; + + @ApiModelProperty(value = "绑定省份id") + private Integer provinceId; + + @ApiModelProperty(value = "绑定城市id") + private Integer cityId; + + @ApiModelProperty(value = "国家归属地") + private String countries; + + @ApiModelProperty(value = "出生日期") + private Date dateBirth; + + @ApiModelProperty(value = "教育程度") + private Integer educationDegree; + + @ApiModelProperty(value = "绑定学校id") + private Integer schoolId; + + /*@ApiModelProperty(value = "电话") + private String phone;*/ + + @ApiModelProperty(value = "邮箱") + private String email; + + @ApiModelProperty(value = "微信号") + private String wechatId; + + @ApiModelProperty(value = "登陆次数") + private Integer loginNumber; + + @ApiModelProperty(value = "性别(1、男 2、女)") + private Integer sex; + + @ApiModelProperty(value = "用户头像路径") + private String userAvatars; + + @ApiModelProperty(value = "是否删除(0->未删除;1->已删除)") + private Integer isDel; + + @ApiModelProperty(value = "最后登陆时间") + private Date lastLoginTime; + + @ApiModelProperty(value = "绑定多个角色id") + private String roleId; + + @ApiModelProperty(value = "组织关系:1->有组织关系;2->无组织关系;") + private Integer organizationalRelation; + + @ApiModelProperty(value = "是否禁用(0->禁用,1->启用)") + private Boolean isEnable; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + +} \ No newline at end of file diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/ValueModuleManagement.java b/nakadai/src/main/java/com/huoran/nakadai/entity/ValueModuleManagement.java new file mode 100644 index 0000000..a11070f --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/ValueModuleManagement.java @@ -0,0 +1,48 @@ +package com.huoran.nakadai.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + *

+ * 增值模块管理表 + *

+ * + * @author chen + * @since 2023-01-30 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="ValueModuleManagement对象", description="增值模块管理表") +public class ValueModuleManagement implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "平台名称") + private String platformName; + + @ApiModelProperty(value = "模块名称") + private String moduleName; + + @ApiModelProperty(value = "平台id") + private Integer platformId; + + @ApiModelProperty(value = "关联产品标识") + @TableField(exist = false) + private boolean associatedProductIdentification; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/AddCurriculumReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/AddCurriculumReq.java new file mode 100644 index 0000000..17b4edd --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/AddCurriculumReq.java @@ -0,0 +1,103 @@ +package com.huoran.nakadai.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; +import java.util.List; + +/** + *

+ * 课程管理 + *

+ * + * @author lr + * @since 2021-09-16 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "创建课程所需参数", description = "创建课程所需参数") +public class AddCurriculumReq { + + + @ApiModelProperty(value = "创建人id", hidden = true) + private Integer accountId; + + @ApiModelProperty(value = "课程名称", required = true, example = "小贷业务实训课程") + @NotNull(message = "课程名称不能为空!") + private String curriculumName; + + @ApiModelProperty(value = "课程类别(0->理论 1-实训)", required = true, example = "0") + @NotNull(message = "课程类别不能为空!") + private Integer curriculumType; + + @ApiModelProperty(value = "学科类别id", required = true, example = "1") + @NotNull(message = "学科类别不能为空!") + private Integer categoryId; + + @ApiModelProperty(value = "专业类id", required = true, example = "1") + @NotNull(message = "专业类不能为空!") + private Integer professionalCategoryId; + + @ApiModelProperty(value = "专业id", required = true, example = "1") + @NotNull(message = "专业不能为空!") + private Integer professionalId; + + @ApiModelProperty(value = "预计课时", required = true, example = "64课时") + @NotNull(message = "预计课时不能为空!") + private String expectedCourse; + + @ApiModelProperty(value = "市场价格", required = true, example = "99.98") +// @NotNull(message = "市场价格不能为空!") + private BigDecimal marketPrice; + + @ApiModelProperty(value = "课程简介", required = true, example = "课程简介........") + @NotNull(message = "课程简介不能为空!") + private String briefIntroduction; + + @ApiModelProperty(value = "教学目标", required = true, example = "教学目标.......") + @NotNull(message = "教学目标不能为空!") + private String teachingObjectives; + + @ApiModelProperty(value = "练习配置") + private List systemIdByPractice; + + @ApiModelProperty(value = "考核配置") + private List systemIdByAssessment; + + @ApiModelProperty(value = "竞赛配置") + private List systemIdByCompetition; + + @ApiModelProperty(value = "资源配置id") + private Integer resourcesId; + + @ApiModelProperty(value = "学校id", hidden = true) + private Integer schoolId; + +// @NotNull(message = "封面图片路径不能为空") + @ApiModelProperty(value = "课程封面图片路径", required = true, example = "https://huoran.oss-cn-shenzhen.aliyuncs.com/20210926/jpg/1441973739251589120.jpg") + private String coverUrl; + + @ApiModelProperty(value = "结算方式,0为单价,1为分成") + private String settlementMethod; + + @ApiModelProperty(value = "供应厂商") + private String supplier; + + @ApiModelProperty(value = "结算单价") + private BigDecimal settlementPrice; + + @ApiModelProperty(value = "商务占比") + private String businessProportion; + + @ApiModelProperty(value = "厂商占比") + private String manufacturerProportion; + + @ApiModelProperty(value = "小程序图片地址") + private String miniProgramPictureAddress; +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/ArchitectureAddReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/ArchitectureAddReq.java new file mode 100644 index 0000000..28b47c7 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/ArchitectureAddReq.java @@ -0,0 +1,30 @@ +package com.huoran.nakadai.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * @Author chen + * @DATE 2022/3/22 10:48 + * @Version 1.0 + */ +@Data +@ApiModel(value = "新增组织架构请求参数", description = "新增组织架构请求参数") +public class ArchitectureAddReq { + + @ApiModelProperty(value = "组织名称") + @NotNull(message = "组织名称不能为空") + private String organizationName; + + @ApiModelProperty(value = "父id 一级为0") + @NotNull(message = "父id不能为空") + private Integer parentId; + + @ApiModelProperty(value = "层级") + @NotNull(message = "层级不能为空") + private Integer level; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/BulkShipOrdersReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/BulkShipOrdersReq.java new file mode 100644 index 0000000..03ffe33 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/BulkShipOrdersReq.java @@ -0,0 +1,19 @@ +package com.huoran.nakadai.entity.req; + +import com.huoran.nakadai.entity.OrderOther; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @Author chen + * @DATE 2022/7/29 15:57 + * @Version 1.0 + */ +@Data +public class BulkShipOrdersReq { + + @ApiModelProperty(value = "订单信息") + private List orderOthers; +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/ConfigurationReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/ConfigurationReq.java new file mode 100644 index 0000000..d28b7ca --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/ConfigurationReq.java @@ -0,0 +1,35 @@ +package com.huoran.nakadai.entity.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + * @ProjectName: huorantech + * @Package: com.huoran.occupationlab.entity.req + * @ClassName: ConfigurationReq + * @Description: java类作用描述 + * @Author: Maureen.Rong + * @CreateDate: 2021/9/28 14:12 + * @UpdateDate: 2021/9/28 14:12 + * @Version: 1.0 + * @create: 2021-09-28 14:12 + */ +@Data +public class ConfigurationReq { + @ApiModelProperty(value = "项目id") + private Integer projectId; + + @ApiModelProperty(value = "排序") + private Integer sort; + + @ApiModelProperty(value = "系统id") + @NotNull(message = "系统id必填") + private Integer systemId; + + + @ApiModelProperty(value = "是否展示") + private Integer isShow; +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/CopyTheModelToTheNakadaiReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/CopyTheModelToTheNakadaiReq.java new file mode 100644 index 0000000..c5a4218 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/CopyTheModelToTheNakadaiReq.java @@ -0,0 +1,33 @@ +package com.huoran.nakadai.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; + +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "复制模型所需参数", description = "复制模型所需参数") +public class CopyTheModelToTheNakadaiReq { + + @ApiModelProperty(value = "模型名称") + @NotNull(message = "模型名称不能为空") + private String modelName; + + @ApiModelProperty(value = "要复制到中台的哪个分类ID下(分类id)") + @NotNull(message = "分类id不能为空") + private Integer categoryId; + + @ApiModelProperty(value = "系统id") + private Integer systemId; + + @ApiModelProperty(value = "账号id(不用传,能通过token解析)") + private Integer accountId; + + @ApiModelProperty(value = "当前被复制的院校的模型Id") + private Integer beCopiedModelId; +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/CourseLearningProgressReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/CourseLearningProgressReq.java new file mode 100644 index 0000000..bfc4ac2 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/CourseLearningProgressReq.java @@ -0,0 +1,17 @@ +package com.huoran.nakadai.entity.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class CourseLearningProgressReq { + + + @ApiModelProperty("主键ID") + private String customerId; + + + @ApiModelProperty(value = "账号id",hidden = true) + private Integer accountId; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/CustomerListReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/CustomerListReq.java new file mode 100644 index 0000000..ce11fcb --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/CustomerListReq.java @@ -0,0 +1,81 @@ +package com.huoran.nakadai.entity.req; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; +import java.util.List; + +/** + *

+ * 客户表 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +//@Data +@Getter +@Setter +@TableName("customer") +public class CustomerListReq implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键ID + */ + @TableId(value = "customer_id", type = IdType.AUTO) + @ApiModelProperty("主键ID") + private Integer customerId; + + /** + * 国家 + */ + @ApiModelProperty("国家") + private String countries; + + /** + * 省份ID + */ + @ApiModelProperty("省份ID") + private Integer provinceId; + + /** + * 城市ID + */ + @ApiModelProperty("城市ID") + private Integer cityId; + + @TableField(exist = false) + private Integer page; + + @TableField(exist = false) + private Integer size; + + @ApiModelProperty("搜索内容") + private String searchContent; + + @ApiModelProperty(value = "供应商id", required = false) + @TableField(exist = false) + private String supplierId; + + @ApiModelProperty(value = "客户id", hidden = true) + @TableField(exist = false) + private List customerIds; + + + @ApiModelProperty(value = "要导出的客户id") + @TableField(exist = false) + private List exportCustomerIds; + + @ApiModelProperty("客户类型(1、正式 2、试用 3、到期)") + private Integer customerType; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/CustomerReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/CustomerReq.java new file mode 100644 index 0000000..706880a --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/CustomerReq.java @@ -0,0 +1,154 @@ +package com.huoran.nakadai.entity.req; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Pattern; +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 客户表 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@Data +@TableName("customer") +public class CustomerReq implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键ID + */ + @ApiModelProperty("主键ID") + @TableId(value = "customer_id", type = IdType.AUTO) + private Integer customerId; + + /** + * 国家 + */ + @ApiModelProperty("国家") + @NotNull(message = "国家不能为空!") + private String countries; + + /** + * 客户类型(1、正式 2、试用 3、到期) + */ + @ApiModelProperty("客户类型(1、正式 2、试用 3、到期)") + // @NotNull(message = "客户类型不能为空!") + private Integer customerType; + + /** + * 省份ID + */ + @ApiModelProperty("省份ID") + @NotNull(message = "省份不能为空!") + private Integer provinceId; + + /** + * 城市ID + */ + @ApiModelProperty("城市ID") + @NotNull(message = "城市不能为空!") + private Integer cityId; + + /** + * 到期时间 + */ + @ApiModelProperty("到期时间") + private Date expireDate; + + /** + * 客户名称(学校名称) + */ + @ApiModelProperty("客户名称(学校名称)") + @NotNull(message = "客户名称不能为空!") + private String customerName; + + @ApiModelProperty("学校ID") + @NotNull(message = "学校id不能为空!") + private Integer schoolId; + + /** + * 行业 + */ + @ApiModelProperty("行业(忽略)") + private String industry; + + @ApiModelProperty("行业") + @NotNull(message = "行业不能为空!") + private Integer industryId; + + @ApiModelProperty("行业类型") + @NotNull(message = "行业类型不能为空!") + private Integer industryClassId; + + /** + * 联系人姓名 + */ + @ApiModelProperty("联系人姓名") + @NotBlank(message = "联系人姓名不能为空!") + private String name; + + /** + * 手机号 + */ + @Pattern(regexp = "^$|^1(3\\d|4[5-8]|5[0-35-9]|6[567]|7[01345-8]|8\\d|9[025-9])\\d{8}$",message = "手机号格式不正确!") + @ApiModelProperty("手机号") + private String phone; + + /** + * 账号 + */ + @ApiModelProperty("账号") + @NotNull(message = "账号不能为空!") + private String account; + + /** + * 密码 + */ + @ApiModelProperty("密码") + private String password; + + /** + * 职务 + */ + @ApiModelProperty("职务") + private String position; + + /** + * 邮箱 + */ + + @Pattern(regexp = "^$|^([a-zA-Z]|[0-9])(\\w|\\-)+@[a-zA-Z0-9]+\\.([a-zA-Z]{2,4})$",message = "邮箱格式不正确!") + @ApiModelProperty("邮箱") + private String email; + + /** + * 是否删除(0、未删除 1、已删除) + */ + @ApiModelProperty("是否删除(0、未删除 1、已删除)") + private Integer isDel; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + /** + * 修改时间 + */ + @ApiModelProperty("修改时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/CustomerSubscribedReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/CustomerSubscribedReq.java new file mode 100644 index 0000000..2367a9e --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/CustomerSubscribedReq.java @@ -0,0 +1,27 @@ +package com.huoran.nakadai.entity.req; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Pattern; +import java.io.Serializable; +import java.util.Date; + +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "已订阅产品所需参数", description = "已订阅产品所需参数") +public class CustomerSubscribedReq extends PageReq { + + + @ApiModelProperty("客户id") + private Integer customerId; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/CustomsPassSortReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/CustomsPassSortReq.java new file mode 100644 index 0000000..0cf3749 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/CustomsPassSortReq.java @@ -0,0 +1,30 @@ +package com.huoran.nakadai.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 沙盘-关卡表 + *

+ * + * @author rong + * @since 2023-10-26 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "CustomsPassSortReq", description = "沙盘-排序") +public class CustomsPassSortReq { + + @ApiModelProperty(value = "关卡id") + private Integer checkpointId; + + @ApiModelProperty(value = "序号") + private Integer serialNumber; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/DeleteIds.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/DeleteIds.java new file mode 100644 index 0000000..81efe47 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/DeleteIds.java @@ -0,0 +1,15 @@ +package com.huoran.nakadai.entity.req; + +import lombok.Data; + +import java.util.List; + +/** + * @Author chen + * @DATE 2021/7/9 11:49 + * @Version 1.0 + */ +@Data +public class DeleteIds { + private List ids; +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/DisableEnableModelReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/DisableEnableModelReq.java new file mode 100644 index 0000000..ab485ae --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/DisableEnableModelReq.java @@ -0,0 +1,23 @@ +package com.huoran.nakadai.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +@Data +@ApiModel(value = "禁用启用模型所需参数") +public class DisableEnableModelReq { + + @ApiModelProperty(value = "禁用平台来源(0中台,1职站教师端 2.职站学生端)",example = "1") + private Integer type; + + @ApiModelProperty(value = "禁用的模型id",example = "1") + private Integer modelId; + + @ApiModelProperty(value = "是否开启(默认0启用 1禁用)", example = "0") + private Integer isOpen; + + @ApiModelProperty(value = "是否是本校超管以及管理员(0为否 1为是)", hidden = true) + private Integer isAdmin; +} \ No newline at end of file diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/EditProvinceCityReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/EditProvinceCityReq.java new file mode 100644 index 0000000..10ae74f --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/EditProvinceCityReq.java @@ -0,0 +1,40 @@ +package com.huoran.nakadai.entity.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.util.List; + +@Data +public class EditProvinceCityReq { + + @ApiModelProperty(value = "省份id") + private Integer provinceId; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "城市id") + private Integer cityId; + + @ApiModelProperty(value = "合伙人id") + private Integer partnerId; + + @ApiModelProperty(value = "分类id") + @NotNull(message = "团队id不能为空") + private Integer classificationId; + + @ApiModelProperty(value = "是否为队长") + private Integer isTeam; + + @ApiModelProperty(value = "姓名") + private String userName; + + @ApiModelProperty(value = "角色名称") + private String roleName; + + @ApiModelProperty(value = "账号角色信息") + private List roleList; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/ExcelImpStaffReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/ExcelImpStaffReq.java new file mode 100644 index 0000000..f1b210c --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/ExcelImpStaffReq.java @@ -0,0 +1,42 @@ +package com.huoran.nakadai.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * @Author chen + * @DATE 2022/3/24 17:03 + * @Version 1.0 + */ +@Data +@ApiModel(value = "批量导入员工数据") +public class ExcelImpStaffReq { + + @ApiModelProperty(value = "姓名") + @NotNull(message = "姓名不能为空!") + private String userName; + + @NotNull(message = "账号不能为空!") + @ApiModelProperty(value = "账号") + private String account; + + @ApiModelProperty(value = "角色") + @NotNull(message = "角色不能为空!") + private String roleName; + + @ApiModelProperty(value = "工号") + @NotNull(message = "工号不能为空!") + private String workNumber; + + @ApiModelProperty(value = "所在部门") + private String dept; + + @ApiModelProperty(value = "手机号码") + private String phone; + + @ApiModelProperty(value = "邮箱") + private String email; +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/FileSendReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/FileSendReq.java new file mode 100644 index 0000000..38ccbd0 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/FileSendReq.java @@ -0,0 +1,27 @@ +package com.huoran.nakadai.entity.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @Author chen + * @DATE 2022/6/22 14:36 + * @Version 1.0 + */ +@Data +public class FileSendReq { + + @ApiModelProperty(value = "文案名称") + private String copyWriting; + + @ApiModelProperty(value = "文案链接") + private List urls; + + @ApiModelProperty(value = "文件名称") + private List fileName; + + @ApiModelProperty(value = "邮箱") + private String mail; +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/GetTheSystemUnderTheProductReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/GetTheSystemUnderTheProductReq.java new file mode 100644 index 0000000..6c073e5 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/GetTheSystemUnderTheProductReq.java @@ -0,0 +1,31 @@ +package com.huoran.nakadai.entity.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +@Data +public class GetTheSystemUnderTheProductReq extends PageReq { + + + @ApiModelProperty(value = "客户ID",hidden = true) + private Integer customerId; + /** + * 系统名称 + */ + @ApiModelProperty(value = "系统名称",required = false) + private String systemName; + + /** + * 系统类型 + */ + @ApiModelProperty(value = "系统类型(0编程类 1流程类)") + private Integer type; + + /** + * 系统归属 + */ + @ApiModelProperty(value = "系统归属(0内部产品 1外部产品)") + private Integer belong; +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/GoodsListReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/GoodsListReq.java new file mode 100644 index 0000000..772a047 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/GoodsListReq.java @@ -0,0 +1,66 @@ +package com.huoran.nakadai.entity.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +@Data +public class GoodsListReq { + @ApiModelProperty(value = "产品名称", example = "xxx") + private String productName; + + @ApiModelProperty(value = "上下架(0为上架)") + private Integer isShelves; + + @ApiModelProperty(value = "商品精选(1为精选)") + private Integer selection; + + @ApiModelProperty(value = "购买状态(1已购买,2未购买)") + private Integer purchaseStatus; + + @ApiModelProperty(value = "排序(0创建时间倒序,1按订单量来排序所有产品,2按照上架时间倒排序,3按照精选排序,4按照不精选排序,5按照上架时间顺排序)") + private Integer sort; + + @ApiModelProperty(value = "产品分类", example = "1") + private Integer productClassification; + + @ApiModelProperty(value = "产品类型", example = "1") + private Integer productType; + + @ApiModelProperty(value = "热门标签(默认传1,2(查询标签不为空的产品)", example = "1") + private Integer hotTag; + + @ApiModelProperty(value = "标签id", example = "1") + private Integer tagId; + + @ApiModelProperty(value = "学科类别id", example = "1") + private Integer categoryId; + + @ApiModelProperty(value = "专业类id", example = "1") + private Integer professionalCategoryId; + + @ApiModelProperty(value = "专业id", example = "1") + private Integer professionalId; + + @ApiModelProperty(value = "1为查询关联产品的商品(只查询实训课程和理论课程,中台赛事内容传值)", example = "1") + private Integer isAssociatedProduct; + + @ApiModelProperty(value = "页码") + private Integer pageNum; + + @ApiModelProperty(value = "页数") + private Integer pageSize; + + @ApiModelProperty(value = "学校id",hidden = true) + private Integer schoolId; + + @ApiModelProperty(value = "学校id",hidden = true) + private Integer schoolPurchaseSign; + + @ApiModelProperty(value = "商品id",hidden = true) + private List mallIds; + + @ApiModelProperty(value = "官网商品id") + private String websiteMallId; +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/ListOfClientCommercialManagersReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/ListOfClientCommercialManagersReq.java new file mode 100644 index 0000000..c28f1b7 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/ListOfClientCommercialManagersReq.java @@ -0,0 +1,48 @@ +package com.huoran.nakadai.entity.req; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class ListOfClientCommercialManagersReq extends PageReq { + + + @ApiModelProperty("主键ID") + private Integer customerId; + + @ApiModelProperty("商务经理id") + private Integer businessManagerId; + + @ApiModelProperty("商务经理id列表") + private List businessManagerIds; + + @ApiModelProperty("搜索内容") + private String keywords; + + @ApiModelProperty(value = "客户类型(1、正式 2、试用 3、到期") + private Integer customerType; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "sort【desc(降序)/asc(升序】", example = "desc") + private String sort; + + @ApiModelProperty(value = "订单状态(0、待发货 1、已完成") + private Integer orderStatus; + + @ApiModelProperty(value = "团队id/分类id") + private Integer classificationId; + + @ApiModelProperty(value = "团队id") + private Integer teamId; + + @ApiModelProperty(value = "用于区分->团队:1 / 个人:0") + private Integer type; +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/MarketingPromotionPageReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/MarketingPromotionPageReq.java new file mode 100644 index 0000000..fea9e6e --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/MarketingPromotionPageReq.java @@ -0,0 +1,24 @@ +package com.huoran.nakadai.entity.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @ProjectName: huorantech + * @Package: com.huoran.occupationlab.entity.req + * @ClassName: PageReq + * @Description: 分页 + * @Author: Maureen.Rong + * @CreateDate: 2021/8/12 15:10 + * @UpdateDate: 2021/8/12 15:10 + * @Version: 1.0 + */ +@Data +public class MarketingPromotionPageReq extends PageReq { + @ApiModelProperty("标题") + private String title; + + @ApiModelProperty(value = "是否开启(0开启 1未开启 默认0)") + private Integer isOpen; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/MiniProgramProductsReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/MiniProgramProductsReq.java new file mode 100644 index 0000000..3919fc7 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/MiniProgramProductsReq.java @@ -0,0 +1,33 @@ +package com.huoran.nakadai.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 课程管理 + *

+ * + * @author lr + * @since 2021-09-16 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class MiniProgramProductsReq extends PageReq { + + @ApiModelProperty(value = "关键词", example = "系统") + private String keywords; + + + @ApiModelProperty(value = "sort【desc(降序)/asc(升序】", example = "desc") + private String sort; + + @ApiModelProperty(value = "产品类型", example = "0") + private String productType; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/ModelSysDemoReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/ModelSysDemoReq.java new file mode 100644 index 0000000..c4c63db --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/ModelSysDemoReq.java @@ -0,0 +1,37 @@ +package com.huoran.nakadai.entity.req; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author chen + * @since 2022-03-04 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "ModelSysDemo对象", description = "") +public class ModelSysDemoReq { + + + @ApiModelProperty(value = "创建人来源(0、系统 1、院校)") + @NotNull(message = "创建人来源传值不能为空") + private Integer founder; + + @ApiModelProperty(value = "学校id(不用传)") + private Integer schoolId; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/ModifyCurriculumReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/ModifyCurriculumReq.java new file mode 100644 index 0000000..5bdb3c4 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/ModifyCurriculumReq.java @@ -0,0 +1,104 @@ +package com.huoran.nakadai.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; +import java.util.List; + +/** + *

+ * 课程管理 + *

+ * + * @author lr + * @since 2021-09-16 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "编辑课程所需参数", description = "编辑课程所需参数") +public class ModifyCurriculumReq { + + + @ApiModelProperty(value = "主键") + private Integer cid; + + @ApiModelProperty(value = "创建人id", hidden = true) + private Integer accountId; + + @ApiModelProperty(value = "课程名称", required = true, example = "小贷业务实训课程") + @NotNull(message = "课程名称不能为空!") + private String curriculumName; + + @ApiModelProperty(value = "课程类别(0->理论 1-实训)", required = true, example = "0") + @NotNull(message = "课程类别不能为空!") + private Integer curriculumType; + + @ApiModelProperty(value = "学科类别id", required = true, example = "1") + @NotNull(message = "学科类别不能为空!") + private Integer categoryId; + + @ApiModelProperty(value = "专业类id", required = true, example = "1") + @NotNull(message = "专业类不能为空!") + private Integer professionalCategoryId; + + @ApiModelProperty(value = "专业id", required = true, example = "1") + @NotNull(message = "专业不能为空!") + private Integer professionalId; + + @ApiModelProperty(value = "预计课时", required = true, example = "64课时") + @NotNull(message = "预计课时不能为空!") + private String expectedCourse; + + @ApiModelProperty(value = "市场价格", required = true, example = "99.98") +// @NotNull(message = "市场价格不能为空!") + private BigDecimal marketPrice; + + @ApiModelProperty(value = "课程简介", required = true, example = "课程简介........") + @NotNull(message = "课程简介不能为空!") + private String briefIntroduction; + + @ApiModelProperty(value = "教学目标", required = true, example = "教学目标.......") + @NotNull(message = "教学目标不能为空!") + private String teachingObjectives; + + @ApiModelProperty(value = "练习配置") + private List systemIdByPractice; + + @ApiModelProperty(value = "考核配置") + private List systemIdByAssessment; + + @ApiModelProperty(value = "竞赛配置") + private List systemIdByCompetition; + + @ApiModelProperty(value = "资源配置id") + private Integer resourcesId; + +// @NotNull(message = "封面图片路径不能为空") + @ApiModelProperty(value = "课程封面图片路径", required = true, example = "https://huoran.oss-cn-shenzhen.aliyuncs.com/20210926/jpg/1441973739251589120.jpg") + private String coverUrl; + + @ApiModelProperty(value = "结算方式,0为单价,1为分成") + private String settlementMethod; + + @ApiModelProperty(value = "供应厂商") + private String supplier; + + @ApiModelProperty(value = "结算单价") + private BigDecimal settlementPrice; + + @ApiModelProperty(value = "商务占比") + private String businessProportion; + + @ApiModelProperty(value = "厂商占比") + private String manufacturerProportion; + + @ApiModelProperty(value = "小程序图片地址") + private String miniProgramPictureAddress; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/OrderListReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/OrderListReq.java new file mode 100644 index 0000000..4be2202 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/OrderListReq.java @@ -0,0 +1,46 @@ +package com.huoran.nakadai.entity.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.HashSet; + +/** + * @Author chen + * @DATE 2021/7/1 17:55 + * @Version 1.0 + */ +@Data +public class OrderListReq { + + @ApiModelProperty(value = "省份id") + private Integer provinceId; + + @ApiModelProperty(value = "城市id") + private Integer cityId; + + @ApiModelProperty(value = "页码") + private Integer pageNo; + + @ApiModelProperty(value = "页数") + private Integer pageSize; + + @ApiModelProperty(value = "订单类型") + private Integer orderType; + + @ApiModelProperty(value = "订单状态") + private Integer orderStatus; + + @ApiModelProperty(value = "客户名称") + private String customerName; + + @ApiModelProperty(value = "供应商id") + private String supplierId; + + @ApiModelProperty(value = "订单id",hidden = true) + private HashSet orderIds; + + @ApiModelProperty(value = "排序(0默认降序 1升序)") + private Integer sort; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/OrderRecordParametersReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/OrderRecordParametersReq.java new file mode 100644 index 0000000..b2cda95 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/OrderRecordParametersReq.java @@ -0,0 +1,29 @@ +package com.huoran.nakadai.entity.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +@Data +public class OrderRecordParametersReq extends PageReq { + + + @ApiModelProperty("主键ID") + private Integer customerId; + + @ApiModelProperty("商务经理id") + private Integer businessManagerId; + + @ApiModelProperty("团队id") + private Integer teamId; + + @ApiModelProperty(value = "是否是管理员(0否 1是)") + private Integer isAdmin; + + @ApiModelProperty(value = "搜索内容",example = "关键词") + private String keywords; + + @ApiModelProperty(value = "订单状态(0、待发货 1、已完成") + private int orderStatus; +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/PageCurriculumRecentUseReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/PageCurriculumRecentUseReq.java new file mode 100644 index 0000000..d5210ea --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/PageCurriculumRecentUseReq.java @@ -0,0 +1,26 @@ +package com.huoran.nakadai.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 课程管理 + *

+ * + * @author lr + * @since 2021-09-16 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "近期使用所需参数", description = "近期使用所需参数") +public class PageCurriculumRecentUseReq extends PageReq { + + @ApiModelProperty(value = "创建人id", hidden = true) + private Integer accountId; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/PageCurriculumReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/PageCurriculumReq.java new file mode 100644 index 0000000..5dc7b8c --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/PageCurriculumReq.java @@ -0,0 +1,58 @@ +package com.huoran.nakadai.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.util.List; + +/** + *

+ * 课程管理 + *

+ * + * @author lr + * @since 2021-09-16 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "筛选课程所需参数", description = "筛选课程所需参数") +public class PageCurriculumReq extends PageReq { + + @ApiModelProperty(value = "创建人id", hidden = true) + private Integer accountId; + + @ApiModelProperty(value = "课程名称", example = "小贷业务实训课程") + private String curriculumName; + + @ApiModelProperty(value = "课程类别(0->理论 1-实训)", example = "0") + private Integer curriculumType; + + @ApiModelProperty(value = "学科类别id", example = "1") + private Integer categoryId; + + @ApiModelProperty(value = "专业类id", example = "1") + private Integer professionalCategoryId; + + @ApiModelProperty(value = "专业id", example = "1") + private Integer professionalId; + + @ApiModelProperty(value = "是否启用(0启用,1未启用)") + private Integer isEnable; + + @ApiModelProperty(value = "上下架(0下架 1上架 默认 1)") + private Integer isShelves; + + @ApiModelProperty(value = "供应商id",required = false) + private String supplierId; + + @ApiModelProperty(value = "权限id",required = false) + private Integer permissions; + + @ApiModelProperty(value = "课程ids") + private List cIds; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/PageCustomsPass.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/PageCustomsPass.java new file mode 100644 index 0000000..a1339d4 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/PageCustomsPass.java @@ -0,0 +1,37 @@ +package com.huoran.nakadai.entity.req; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 沙盘-关卡表 + *

+ * + * @author chen + * @since 2023-10-26 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("st_customs_pass") +@ApiModel(value = "PageCustomsPass", description = "沙盘-列表筛选") +public class PageCustomsPass { + + + @ApiModelProperty(value = "关卡名称") + private String customsPassName; + + + @ApiModelProperty(value = "是否禁用(默认0:禁用,1:启用)") + private Integer isEnable; + + + @ApiModelProperty(value = "平台:职站->1 中台->3") + private Integer platformId; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/PageImportModelReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/PageImportModelReq.java new file mode 100644 index 0000000..ffd33b9 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/PageImportModelReq.java @@ -0,0 +1,37 @@ +package com.huoran.nakadai.entity.req; + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; + +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "筛选模型所需参数", description = "筛选模型所需参数") +public class PageImportModelReq extends PageReq { + + @ApiModelProperty(value = "模型名称") + private String modelName; + + @ApiModelProperty(value = "分类id") + private Integer categoryId; + + @ApiModelProperty(value = "系统id") + private Integer systemId; + + + @ApiModelProperty(value = "创建人来源(0、系统 1、院校)") + @NotNull(message = "创建人来源传值不能为空") + private Integer founder; + + @ApiModelProperty(value = "是否为中台用户", hidden = true) + private Integer isAdmin; + + @ApiModelProperty(value = "用于导入筛选启用状态(0开启 1未开启 默认0)") + private Integer isOpen; +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/PageModelReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/PageModelReq.java new file mode 100644 index 0000000..2d248d4 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/PageModelReq.java @@ -0,0 +1,46 @@ +package com.huoran.nakadai.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; + +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "筛选模型所需参数", description = "筛选模型所需参数") +public class PageModelReq extends PageReq { + + @ApiModelProperty(value = "模型名称") + private String modelName; + + @ApiModelProperty(value = "分类id") + @NotNull(message = "分类id不能为空") + private Integer categoryId; + + @ApiModelProperty(value = "系统id") + private Integer systemId; + + + @ApiModelProperty(value = "创建人来源(0、系统 1、院校)") + @NotNull(message = "创建人来源传值不能为空") + private Integer founder; + + + @ApiModelProperty(value = "发布状态(0草稿 1发布)") + private Integer postStatus; + + @ApiModelProperty(value = "是否开启(默认0启用 1禁用)", example = "0") + private Integer isOpen; + + + @ApiModelProperty(value = "中台端是否开启(0开启,1未开启 默认0)") + private Integer ztOpen; + + + @ApiModelProperty(value = "是否为中台用户",hidden = true) + private Integer isAdmin; +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/PagePartnerArticleManagementReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/PagePartnerArticleManagementReq.java new file mode 100644 index 0000000..815c4a4 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/PagePartnerArticleManagementReq.java @@ -0,0 +1,78 @@ +package com.huoran.nakadai.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @描述:合伙人——文章管理 + * @作者: Rong + * @日期: 2023-03-16 + */ +@Data +@ApiModel(value = "合伙人——文章管理分页请求参数") +public class PagePartnerArticleManagementReq extends PageReq { + + + @ApiModelProperty(value = "文章id") + private Integer contentId; + + @ApiModelProperty(value = "文章标题") + private String title; + + @ApiModelProperty(value = "创建人") + private String founderName; + + @ApiModelProperty(value = "编辑人") + private String editorName; + + @ApiModelProperty(value = "所属分类排序(升序:asc 倒序:desc)") + private String classificationNameSort; + + + @ApiModelProperty(value = "文章名排序(升序:asc 倒序:desc)") + private String articleNameSort; + + + @ApiModelProperty(value = "所属分类Id") + private Integer classificationId; + + @ApiModelProperty(value = "编辑时间排序(升序:asc 倒序:desc)") + private String editTimeSort; + + @ApiModelProperty(value = "发布日期排序(升序:asc 倒序:desc)") + private String releaseDateSort; + + @ApiModelProperty(value = "创建时间排序(升序:asc 倒序:desc)") + private String createTimeSort; + + @ApiModelProperty(value = "序号排序(升序:asc 倒序:desc)") + private String sequenceSort; + + + @ApiModelProperty(value = "置顶排序(升序:asc 倒序:desc)") + private String topSort; + + @ApiModelProperty(value = "序号") + private Integer sequence; + + @ApiModelProperty(value = "类型(1.学习2.资讯)") + private Integer typeId; + + + /** + * 关键词(小程序条件查询使用) + */ + @ApiModelProperty(value = "关键词(小程序条件查询使用)") + private String keyWord; + + /** + * 中台、小程序共用 用此字段区分 取决于sys_platform表中的平台id + */ + @ApiModelProperty(value = "查询来源(3.中台 4.合伙人小程序) 取自:sys_platform表中的平台id") + private Integer querySource; + + @ApiModelProperty(value = "账号id",hidden = true) + private Integer accountId; + +} \ No newline at end of file diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/PageReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/PageReq.java new file mode 100644 index 0000000..19216bb --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/PageReq.java @@ -0,0 +1,27 @@ +package com.huoran.nakadai.entity.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @ProjectName: huorantech + * @Package: com.huoran.occupationlab.entity.req + * @ClassName: PageReq + * @Description: 分页 + * @Author: Maureen.Rong + * @CreateDate: 2021/8/12 15:10 + * @UpdateDate: 2021/8/12 15:10 + * @Version: 1.0 + */ +@Data +public class PageReq { + + @ApiModelProperty(value = "当前页数", name = "pageNum", example = "1", required = true) + private Integer pageNum; + @ApiModelProperty(value = "当前页需要显示的数量", name = "pageSize", example = "10", required = true) + private Integer pageSize; + + @ApiModelProperty(hidden = true) + private Integer schoolId; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/PartnerAccountAddReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/PartnerAccountAddReq.java new file mode 100644 index 0000000..3b8b5d1 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/PartnerAccountAddReq.java @@ -0,0 +1,64 @@ +package com.huoran.nakadai.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + * @Author chen + * @DATE 2022/5/18 16:54 + * @Version 1.0 + */ +@Data +@ApiModel(value = "PartnerAccountAddReq对象", description = "新增合伙人账号") +public class PartnerAccountAddReq { + + @ApiModelProperty(value = "accountId,账号id") + private String id; + + @ApiModelProperty(value = "手机验证码") + private String code; + + //----------------------------用户表相关字段Start---------------------------- + @ApiModelProperty(value = "用户姓名", example = "example") + @NotNull(message = "用户姓名不能为空") + private String userName; + + @ApiModelProperty(value = "唯一标识账号", example = "example") + @NotNull(message = "唯一标识账号不能为空") + private String uniqueIdentification; + + @ApiModelProperty(value = "电话") + private String phone; + + @ApiModelProperty(value = "邮箱") + private String email; + + @ApiModelProperty(value = "分类id") + private Integer partnerClassificationId; + + @ApiModelProperty(value = "账号角色信息,新增默认分配") + private List roleList; + + //----------------------------用户表相关字段End---------------------------- + + //----------------------------账户表相关字段Start---------------------------- + @ApiModelProperty(value = "新增账号") + private String account; + + @ApiModelProperty(value = "工号") + private String workNumber; + //----------------------------账户表相关字段End---------------------------- + + @ApiModelProperty(value = "是否为团队(0为分类或成员(团队之上为分类,之下为成员),1为团队)") + private Integer isTeam; + + @ApiModelProperty(value = "省份id") + private Integer provinceId; + + @ApiModelProperty(value = "城市id") + private Integer cityId; +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/PartnerAccountListReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/PartnerAccountListReq.java new file mode 100644 index 0000000..a2cf1c7 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/PartnerAccountListReq.java @@ -0,0 +1,33 @@ +package com.huoran.nakadai.entity.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.ArrayList; + +/** + * @Author chen + * @DATE 2022/5/18 17:15 + * @Version 1.0 + */ +@Data +public class PartnerAccountListReq { + + @ApiModelProperty(value = "类型:必填一个(1.团队合伙人 2.未加入团队的合伙人)", required = true, example = "1") + private Integer type; + + @ApiModelProperty(value = "搜索关键词", example = "1") + private String keyWord; + + @ApiModelProperty(value = "合伙人分类主键ID", example = "2") + private String partnerClassificationId; + + @ApiModelProperty(value = "当前页数", name = "pageNum", example = "1", required = true) + private Integer pageNum; + + @ApiModelProperty(value = "当前页需要显示的数量", name = "pageSize", example = "10", required = true) + private Integer pageSize; + + //合伙人id + private ArrayList ids; +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/PartnerAccountUpdateReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/PartnerAccountUpdateReq.java new file mode 100644 index 0000000..41bf739 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/PartnerAccountUpdateReq.java @@ -0,0 +1,44 @@ +package com.huoran.nakadai.entity.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + * @Author chen + * @DATE 2022/5/18 17:18 + * @Version 1.0 + */ +@Data +public class PartnerAccountUpdateReq { + + @ApiModelProperty(value = "合伙人id") + private Integer partnerId; + + @ApiModelProperty(value = "合伙人账号id", example = "503") + private Integer accountId; + + @ApiModelProperty(value = "合伙人分类id(多个团队id)") + private List partnerClassificationId; + + @ApiModelProperty(value = "账号", example = "90000") + private String account; + + @ApiModelProperty(value = "用户姓名", example = "遛遛") + private String userName; + + @ApiModelProperty(value = "工号", example = "90000") + private String workNumber; + + @ApiModelProperty(value = "电话", example = "17788771965") + private String phone; + + @ApiModelProperty(value = "邮箱", example = "17788771965@qq.com") + private String email; + + @ApiModelProperty(value = "账号角色信息") + @NotNull(message = "账号角色不能为空") + private List roleList; +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/PartnerClassificationAddReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/PartnerClassificationAddReq.java new file mode 100644 index 0000000..d215d6e --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/PartnerClassificationAddReq.java @@ -0,0 +1,30 @@ +package com.huoran.nakadai.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * @Author chen + * @DATE 2022/5/18 15:54 + * @Version 1.0 + */ +@Data +@ApiModel(value = "新增合伙人分类请求参数", description = "新增合伙人分类请求参数") +public class PartnerClassificationAddReq { + + @ApiModelProperty(value = "分类名称") + @NotNull(message = "分类名称不能为空") + private String partnerClassificationName; + + @ApiModelProperty(value = "父id 一级为0") + @NotNull(message = "父id不能为空") + private Integer parentId; + + @ApiModelProperty(value = "层级") + @NotNull(message = "层级不能为空") + private Integer level; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/PartnerRegisterReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/PartnerRegisterReq.java new file mode 100644 index 0000000..8e1f27a --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/PartnerRegisterReq.java @@ -0,0 +1,49 @@ +package com.huoran.nakadai.entity.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +@Data +public class PartnerRegisterReq { + + @ApiModelProperty(value = "姓名") + @NotNull(message = "姓名不能为空!") + private String userName; + + @ApiModelProperty(value = "账号") + private String account; + + @ApiModelProperty(value = "密码") + private String password; + + @ApiModelProperty(value = "唯一标识账号") + @NotNull(message = "唯一标识不能为空!") + private String uniqueIdentification; + + @ApiModelProperty(value = "手机号") + @NotNull(message = "手机号不能为空") + private String phone; + + @ApiModelProperty(value = "邮箱") + private String email; + + @ApiModelProperty(value = "openid") + private String appOpenId; + + @ApiModelProperty(value = "意向省份") + private Integer provinceId; + + @ApiModelProperty(value = "意向城市") + private Integer cityId; + + @ApiModelProperty(value = "openId") + private String openId; + + +/* @ApiModelProperty("验证码") + private String code; + + @ApiModelProperty("内部标识") + private Integer identification;*/ +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/PartnerTeamRateReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/PartnerTeamRateReq.java new file mode 100644 index 0000000..b73522d --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/PartnerTeamRateReq.java @@ -0,0 +1,23 @@ +package com.huoran.nakadai.entity.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class PartnerTeamRateReq { + + @ApiModelProperty(value = "合伙人ID") + private Integer partnerId; + + @ApiModelProperty(value = "团队id") + private Integer teamId; + + @ApiModelProperty(value = "团队年费") + private BigDecimal annualTeamFee; + + @ApiModelProperty(value = "市场服务年费") + private BigDecimal annualMarketingFee; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/ProgramShoppingCartReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/ProgramShoppingCartReq.java new file mode 100644 index 0000000..7f42b21 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/ProgramShoppingCartReq.java @@ -0,0 +1,38 @@ +package com.huoran.nakadai.entity.req; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 小程序—购物车 + *

+ * + * @author chen + * @since 2023-06-09 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class ProgramShoppingCartReq extends PageReq { + + + @ApiModelProperty(value = "购物车主键") + private Integer shoppingCartId; + + @ApiModelProperty(value = "商品主键") + private Integer mallId; + + @ApiModelProperty(value = "账号id(无需给)",hidden = true) + private Integer accountId; + + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/PythonCodeRunReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/PythonCodeRunReq.java new file mode 100644 index 0000000..b9f5a85 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/PythonCodeRunReq.java @@ -0,0 +1,21 @@ +package com.huoran.nakadai.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; + +/** + * @描述:新增缓存 + * @作者: Rong + * @日期: 2021/12/13 11:27 + */ +@Data +@Accessors(chain = true) +public class PythonCodeRunReq { + + @ApiModelProperty(value = "代码", name = "代码") + private String code; +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/QueryTimeReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/QueryTimeReq.java new file mode 100644 index 0000000..c0082b0 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/QueryTimeReq.java @@ -0,0 +1,19 @@ +package com.huoran.nakadai.entity.req; + +import io.swagger.annotations.ApiParam; +import lombok.Data; + +/** + * @Author chen + * @DATE 2022/2/24 17:09 + * @Version 1.0 + */ +@Data +public class QueryTimeReq { + private Integer id; + private Integer customerId; + @ApiParam(value = "0为数据平台权限,1为课程权限") + private Integer authority; + private String startTime; + private String endTime; +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/SalesProgressReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/SalesProgressReq.java new file mode 100644 index 0000000..3e92d43 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/SalesProgressReq.java @@ -0,0 +1,26 @@ +package com.huoran.nakadai.entity.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class SalesProgressReq { + + @ApiModelProperty("商务经理id") + private Integer businessManagerId; + + + @ApiModelProperty("团队id") + private Integer teamId; + + + @ApiModelProperty(value = "客户类型(1、正式 2、试用 3、到期", hidden = true) + private Integer customerType; + + /*@ApiModelProperty(value = "团队年费") + private Integer annualTeamFee; +*/ + /* @ApiModelProperty(value = "市场服务年费") + private Double annualMarketingFee;*/ + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/ServiceConfigurationReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/ServiceConfigurationReq.java new file mode 100644 index 0000000..fe18aca --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/ServiceConfigurationReq.java @@ -0,0 +1,62 @@ +package com.huoran.nakadai.entity.req; + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + * @description + * @author: Mr.JK + * @create: 2021-09-08 14:46 + **/ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class ServiceConfigurationReq implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 系统id + */ + @ApiModelProperty(value = "系统id",required = false) + private String systemId; + + /** + * 系统名称 + */ + @ApiModelProperty(value = "系统名称",required = false) + private String systemName; + + @ApiModelProperty(value = "供应商id",required = false) + private String supplierId; + + /** + * 系统类型 + */ + @ApiModelProperty(value = "系统类型(0编程类 1流程类)") + private Integer type; + + /** + * 系统归属 + */ + @ApiModelProperty(value = "系统归属(0内部产品 1外部产品)") + private Integer belong; + + /** + * 页码 + */ + @ApiModelProperty(value = "页码") + private Integer pageNum; + + /** + * 页数 + */ + @ApiModelProperty(value = "页数") + private Integer pageSize; +} \ No newline at end of file diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/StaffAddReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/StaffAddReq.java new file mode 100644 index 0000000..cedf4fe --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/StaffAddReq.java @@ -0,0 +1,55 @@ +package com.huoran.nakadai.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + * @Author chen + * @DATE 2022/3/22 14:41 + * @Version 1.0 + */ +@Data +@ApiModel(value = "StaffAddReq对象", description = "新增员工") +public class StaffAddReq { + @ApiModelProperty(value = "绑定账号id", hidden = true) + private Integer accountId; + + //----------------------------用户表相关字段Start---------------------------- + @ApiModelProperty(value = "用户姓名", example = "example") + @NotNull(message = "用户姓名不能为空") + private String userName; + + @ApiModelProperty(value = "唯一标识账号", example = "example") + @NotNull(message = "唯一标识账号不能为空") + private String uniqueIdentification; + + @ApiModelProperty(value = "电话") + private String phone; + + @ApiModelProperty(value = "邮箱") + private String email; + + @ApiModelProperty(value = "账号角色信息") + @NotNull(message = "账号角色不能为空") + private List roleList; + + @ApiModelProperty(value = "组织架构id(多个部门id)") + private List staffArchitectureId; + + @ApiModelProperty(value = "用户头像路径") + private String userAvatars; + + //----------------------------用户表相关字段End---------------------------- + + //----------------------------账户表相关字段Start---------------------------- + @ApiModelProperty(value = "账号") + private String account; + + @ApiModelProperty(value = "工号") + private String workNumber; + //----------------------------账户表相关字段End---------------------------- +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/StaffListReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/StaffListReq.java new file mode 100644 index 0000000..4d033e0 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/StaffListReq.java @@ -0,0 +1,28 @@ +package com.huoran.nakadai.entity.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Author chen + * @DATE 2022/3/22 16:23 + * @Version 1.0 + */ +@Data +public class StaffListReq { + + @ApiModelProperty(value = "类型:必填一个(1.所有员工 2.未加入部门的员工)", required = true, example = "1") + private Integer type; + + @ApiModelProperty(value = "搜索关键词", example = "1") + private String keyWord; + + @ApiModelProperty(value = "员工部门主键ID", example = "2") + private String staffArchitectureId; + + @ApiModelProperty(value = "当前页数", name = "pageNum", example = "1", required = true) + private Integer pageNum; + + @ApiModelProperty(value = "当前页需要显示的数量", name = "pageSize", example = "10", required = true) + private Integer pageSize; +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/StaffUpdateReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/StaffUpdateReq.java new file mode 100644 index 0000000..a252977 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/StaffUpdateReq.java @@ -0,0 +1,49 @@ +package com.huoran.nakadai.entity.req; + +import com.baomidou.mybatisplus.annotation.FieldStrategy; +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + * @Author chen + * @DATE 2022/3/22 17:35 + * @Version 1.0 + */ +@Data +public class StaffUpdateReq { + + @ApiModelProperty(value = "员工id") + private Integer staffId; + + @ApiModelProperty(value = "员工账号id", example = "503") + private Integer accountId; + + @ApiModelProperty(value = "组织架构id(多个部门id)") + private List staffArchitectureId; + + @ApiModelProperty(value = "账号", example = "90000") + private String account; + + @ApiModelProperty(value = "用户姓名", example = "遛遛") + private String userName; + + @ApiModelProperty(value = "工号", example = "90000") + private String workNumber; + + @ApiModelProperty(value = "电话", example = "17788771965") + @TableField(strategy = FieldStrategy.IGNORED) + private String phone; + + @ApiModelProperty(value = "邮箱", example = "17788771965@qq.com") + @TableField(strategy = FieldStrategy.IGNORED) + private String email; + + @ApiModelProperty(value = "账号角色信息") + @NotNull(message = "账号角色不能为空") + private List roleList; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/TagsReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/TagsReq.java new file mode 100644 index 0000000..711b055 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/TagsReq.java @@ -0,0 +1,13 @@ +package com.huoran.nakadai.entity.req; + +import com.huoran.nakadai.entity.Tags; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +@Data +public class TagsReq { + @ApiModelProperty(value = "标签集合") + List tagsList; +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/TransferAdminReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/TransferAdminReq.java new file mode 100644 index 0000000..c6d0651 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/TransferAdminReq.java @@ -0,0 +1,50 @@ +package com.huoran.nakadai.entity.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * @Author chen + * @DATE 2022/6/15 11:56 + * @Version 1.0 + */ +@Data +public class TransferAdminReq { + @ApiModelProperty(value = "accountId") + private String id; + + @ApiModelProperty(value = "手机验证码") + private String code; + + @ApiModelProperty(value = "用户姓名", example = "example") + @NotNull(message = "用户姓名不能为空") + private String userName; + + @ApiModelProperty(value = "唯一标识账号", example = "example") + @NotNull(message = "唯一标识账号不能为空") + private String uniqueIdentification; + + @ApiModelProperty(value = "电话") + private String phone; + + @ApiModelProperty(value = "邮箱") + private String email; + + @ApiModelProperty(value = "分类id") + private String partnerClassificationId; + + @ApiModelProperty(value = "新增账号") + private String account; + + @ApiModelProperty(value = "工号") + private String workNumber; + + @ApiModelProperty(value = "省份id") + private Integer provinceId; + + @ApiModelProperty(value = "城市id") + private Integer cityId; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/TransferTeamReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/TransferTeamReq.java new file mode 100644 index 0000000..817f1d5 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/TransferTeamReq.java @@ -0,0 +1,35 @@ +package com.huoran.nakadai.entity.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Author chen + * @DATE 2022/6/14 18:21 + * @Version 1.0 + */ +@Data +public class TransferTeamReq { + + @ApiModelProperty(value = "管理员合伙人id") + private Integer adminPartnerId; + + @ApiModelProperty(value = "管理员团队id") + private Integer adminTeamId; + + @ApiModelProperty(value = "成员合伙人id") + private Integer memberPartnerId; + + @ApiModelProperty(value = "成员团队id") + private Integer memberTeamId; + + @ApiModelProperty(value = "成员姓名") + private String memberName; + + @ApiModelProperty(value = "省份id") + private Integer provinceId; + + @ApiModelProperty(value = "城市id") + private Integer cityId; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/res/AnnualOperatingAnalysisResp.java b/nakadai/src/main/java/com/huoran/nakadai/entity/res/AnnualOperatingAnalysisResp.java new file mode 100644 index 0000000..2650e59 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/res/AnnualOperatingAnalysisResp.java @@ -0,0 +1,37 @@ +package com.huoran.nakadai.entity.res; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.huoran.nakadai.utils.BigDecimalSerializer; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.math.BigDecimal; + + +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "年度经营分析", description = "年度经营分析") +public class AnnualOperatingAnalysisResp { + + + @ApiModelProperty(value = "总成交金额:全年订单产品的成交价之和") + @JsonSerialize(using = BigDecimalSerializer.class) + private BigDecimal finalPrice; + + @ApiModelProperty(value = "总结算金额:全年订单产品的结算价之和") + @JsonSerialize(using = BigDecimalSerializer.class) + private BigDecimal settlementPrice; + + + @ApiModelProperty(value = "市场服务费 = 市场服务费率项目抽成的金额,为产品全年销售金额(即成交金额之和)*所填入的费率") + @JsonSerialize(using = BigDecimalSerializer.class) + private BigDecimal marketingServiceCharge; + + @ApiModelProperty(value = "项目收益:总成交金额-总结算金额-总市场服务费") + @JsonSerialize(using = BigDecimalSerializer.class) + private BigDecimal projectBenefit; +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/res/AnnualOperatingAnalysisToStringResp.java b/nakadai/src/main/java/com/huoran/nakadai/entity/res/AnnualOperatingAnalysisToStringResp.java new file mode 100644 index 0000000..693a8e3 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/res/AnnualOperatingAnalysisToStringResp.java @@ -0,0 +1,29 @@ +package com.huoran.nakadai.entity.res; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + + +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "年度经营分析", description = "年度经营分析") +public class AnnualOperatingAnalysisToStringResp { + + + @ApiModelProperty(value = "总成交金额:全年订单产品的成交价之和") + private String finalPrice; + + @ApiModelProperty(value = "总结算金额:全年订单产品的结算价之和") + private String settlementPrice; + + + @ApiModelProperty(value = "市场服务费 = 市场服务费率项目抽成的金额,为产品全年销售金额(即成交金额之和)*所填入的费率") + private String marketingServiceCharge; + + @ApiModelProperty(value = "项目收益:总成交金额-总结算金额-总市场服务费") + private String projectBenefit; +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/res/AppletsDataProductResp.java b/nakadai/src/main/java/com/huoran/nakadai/entity/res/AppletsDataProductResp.java new file mode 100644 index 0000000..36691fc --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/res/AppletsDataProductResp.java @@ -0,0 +1,60 @@ +package com.huoran.nakadai.entity.res; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +@ApiModel(value = "小程序全部产品展示") +public class AppletsDataProductResp { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "主键") + private Integer id; + + + @ApiModelProperty(value = "产品名称") + private String productName; + + @ApiModelProperty(value = "表数据量") + private String briefIntroduction; + + @ApiModelProperty(value = "市场价") + private String marketPrice; + + @ApiModelProperty(value = "结算方式,0为单价,1为分成") + private Integer settlementMethod; + + @ApiModelProperty(value = "供应厂商") + private String supplier; + + @ApiModelProperty(value = "供应厂商") + private String supplierName; + + @ApiModelProperty(value = "产品类型 (0->理论 1-实训 2->数据产品) ") + private Integer productType; + + @ApiModelProperty(value = "产品封面") + private String coverUrl; + + @ApiModelProperty(value = "创建时间") + private String createTime; + + @ApiModelProperty(value = "结算单价") + private String settlementPrice; + + @ApiModelProperty(value = "商务占比") + private String businessProportion; + + @ApiModelProperty(value = "小程序图片地址") + private String miniProgramPictureAddress; + + @ApiModelProperty(value = "厂商占比") + private String manufacturerProportion; + + +} \ No newline at end of file diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/res/AppletsMyClientsForBusinessResp.java b/nakadai/src/main/java/com/huoran/nakadai/entity/res/AppletsMyClientsForBusinessResp.java new file mode 100644 index 0000000..1b979ed --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/res/AppletsMyClientsForBusinessResp.java @@ -0,0 +1,55 @@ +package com.huoran.nakadai.entity.res; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.math.BigDecimal; +import java.util.Date; + + +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "小程序商务经理-我的客户", description = "小程序商务经理-我的客户") +public class AppletsMyClientsForBusinessResp { + + + + @ApiModelProperty(value = "商务经理id(partner_id)") + private Integer businessManagerId; + + @ApiModelProperty(value = "订单id") + private Integer orderId; + + @ApiModelProperty(value = "绑定客户id") + private Integer customerId; + + @ApiModelProperty(value = "客户类型(1、正式 2、试用 3、到期") + private Integer customerType; + + @ApiModelProperty(value = "产品到期时间") + private Date expireDate; + + @ApiModelProperty(value = "账号") + private String account; + + @ApiModelProperty(value = "客户名称") + private String customerName; + + @ApiModelProperty(value = "订单联系人") + private String orderContact; + + @ApiModelProperty(value = "businessManagerName") + private String businessManagerName; + + + + + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/res/BusinessManagerOrderResp.java b/nakadai/src/main/java/com/huoran/nakadai/entity/res/BusinessManagerOrderResp.java new file mode 100644 index 0000000..44f59e5 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/res/BusinessManagerOrderResp.java @@ -0,0 +1,62 @@ +package com.huoran.nakadai.entity.res; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; +import java.util.Date; + + +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "商务经理订单列表", description = "商务经理订单列表") +public class BusinessManagerOrderResp { + + + + @ApiModelProperty(value = "商务经理id(partner_id)") + private Integer businessManagerId; + + @ApiModelProperty(value = "订单id") + private Integer orderId; + + @ApiModelProperty(value = "订单编号") + private String orderNumber; + + @ApiModelProperty(value = "产品内容") + private String productName; + + @ApiModelProperty(value = "绑定客户id") + private Integer customerId; + + + @ApiModelProperty(value = "订单类型(1、正式 2、试用)") + private Integer orderType; + + @ApiModelProperty(value = "订单状态(1、待发货 2、已完成 3、已取消)") + private Integer orderStatus; + + @ApiModelProperty(value = "订单性质(1、初签 2、续签)") + private Integer orderNature; + + @ApiModelProperty(value = "总金额") + private BigDecimal orderAmount; + + @ApiModelProperty(value = "订单时间") + @TableField(fill = FieldFill.INSERT) +// @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd") + private Date createTime; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/res/CommentRes.java b/nakadai/src/main/java/com/huoran/nakadai/entity/res/CommentRes.java new file mode 100644 index 0000000..3c5638e --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/res/CommentRes.java @@ -0,0 +1,83 @@ +package com.huoran.nakadai.entity.res; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; +import java.util.List; + +@Data +public class CommentRes { + + @ApiModelProperty(value = "评论id") + private Integer commentId; + + @ApiModelProperty(value = "父id") + private Integer pid; + + @ApiModelProperty(value = "回复用户id") + private Integer replyAccountId; + + @ApiModelProperty(value = "回复用户名称") + private String replyUsername; + + @ApiModelProperty(value = "回复评论账号名称头像") + private String replyUserAvatars; + + @ApiModelProperty(value = "回复评论账号角色",hidden = true) + private String replyRoleName; + + @ApiModelProperty(value = "回复评论账号老师标识") + private Integer teacherIDOfReplyAccount; + + @ApiModelProperty(value = "内容") + private String content; + + @ApiModelProperty(value = "状态:1评论未读,2评论已读,3回复未读,4回复已读") + private Integer status; + + @ApiModelProperty("创建时间") + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") + private Date createTime; + + @ApiModelProperty(value = "创建人") + private Integer createAccountId; + + @ApiModelProperty(value = "创建人名称") + private String createUsername; + + @ApiModelProperty(value = "创建人账号名称头像") + private String createUserAvatars; + + @ApiModelProperty(value = "创建人账号角色",hidden = true) + private String createRoleName; + + @ApiModelProperty(value = "创建人账号老师标识") + private Integer teacherIDOfCreateAccount; + + @ApiModelProperty(value = "课程id") + private Integer mallId; + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + @ApiModelProperty(value = "当前登录id") + private String currentAccountId; + + @ApiModelProperty(value = "当前登录角色") + private String currentRoleName; + + @ApiModelProperty(value = "点赞数量") + private Integer likeCount; + + @ApiModelProperty(value = "层级") + private Integer level; + + @ApiModelProperty(value = "是否点赞,0未点赞,1点赞") + private Integer isLike; + + @ApiModelProperty(value = "下级评论") + private List children; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/res/ContractInformationsRes.java b/nakadai/src/main/java/com/huoran/nakadai/entity/res/ContractInformationsRes.java new file mode 100644 index 0000000..9d581b5 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/res/ContractInformationsRes.java @@ -0,0 +1,58 @@ +package com.huoran.nakadai.entity.res; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.huoran.nakadai.entity.Customer; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 客户表 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@Data +public class ContractInformationsRes implements Serializable { + + //合同信息主键id + @ApiModelProperty("合同信息主键id") + private Integer contractId; + //合同名称 + @ApiModelProperty("合同名称") + private String contractName; + //合同编号 + @ApiModelProperty("合同编号") + private String contractNumber; + //合同金额 + @ApiModelProperty("合同金额") + private String contractMoney; + //合同文件链接 + @ApiModelProperty("合同文件链接") + private String contractFile; + //绑定订单id + @ApiModelProperty("绑定订单id") + private Integer orderId; + + @ApiModelProperty("合同期限(起)") + private Date startTime; + + @ApiModelProperty("合同期限(止)") + private Date endTime; + + @ApiModelProperty("数据产品或课程id") + private Integer dataOrCourseId; + + @ApiModelProperty("数据产品或课程名称") + private String dataOrCourseName; + + @ApiModelProperty("区分权限(0为数据平台权限,1为课程权限)") + private Integer authority; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/res/CourseByProjectInfoRes.java b/nakadai/src/main/java/com/huoran/nakadai/entity/res/CourseByProjectInfoRes.java new file mode 100644 index 0000000..633ea24 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/res/CourseByProjectInfoRes.java @@ -0,0 +1,41 @@ +package com.huoran.nakadai.entity.res; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @ProjectName: huorantech + * @Package: com.huoran.nakadai.entity.res + * @ClassName: SchoolCourseRes + * @Description: 学校课程展示 + * @Author: Maureen.Rong + * @CreateDate: 2021/9/28 15:21 + * @UpdateDate: 2021/9/28 15:21 + * @Version: 1.0 + * @create: 2021-09-28 15:21 + */ +@Data +public class CourseByProjectInfoRes { + @ApiModelProperty(value = "课程id") + private Integer cid; + + @ApiModelProperty(value = "项目名称") + private String projectName; + + @ApiModelProperty(value = "项目权限(0、练习 1、考核 2、竞赛)") + private Integer projectPermissions; + + @ApiModelProperty(value = "创建人") + private String createUser; + + @ApiModelProperty(value = "创建时间") + private String createTime; + + @ApiModelProperty(value = "项目id") + private Integer projectId; + + @ApiModelProperty(value = "配置id") + private Integer configId; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/res/CoursePermissionssRes.java b/nakadai/src/main/java/com/huoran/nakadai/entity/res/CoursePermissionssRes.java new file mode 100644 index 0000000..654986a --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/res/CoursePermissionssRes.java @@ -0,0 +1,74 @@ +package com.huoran.nakadai.entity.res; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 客户表 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@Data +@TableName("customer") +public class CoursePermissionssRes implements Serializable { + + //课程权限主键id + @ApiModelProperty("课程权限主键id") + private Integer id; + //课程名称 + @ApiModelProperty("课程名称") + private String courseName; + //使用期限 + @ApiModelProperty("使用期限") + private Integer periodOfUse; + //市场价 + @ApiModelProperty("市场价") + private double marketValue; + //交易价格 + @ApiModelProperty("成交价") + private double finalPrice; + //折扣率 + @ApiModelProperty("折扣率") + private String discountRate; + //绑定端口地址id + @ApiModelProperty("绑定端口地址id") + private Integer portId; + //是否发货 + @ApiModelProperty("是否发货") + private Integer ship; + //绑定课程id + @ApiModelProperty("绑定课程id") + private Integer dataOrCourseId; + //绑定订单id + @ApiModelProperty("绑定订单id") + private Integer orderId; + + //起始时间 + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @ApiModelProperty("起始时间") + private Date startTime; + + //结束时间 + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @ApiModelProperty("结束时间") + private Date endTime; + + //剩余期限 + @ApiModelProperty("剩余期限") + private Integer remainingPeriod; + + @ApiModelProperty("是否开启(0不开启,1开启,发货后,默认开启)") + private Integer isEnable; + + @ApiModelProperty(value = "使用期限单位选择0日,1月,2年") + private Integer options; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/res/CurriculumDetailRes.java b/nakadai/src/main/java/com/huoran/nakadai/entity/res/CurriculumDetailRes.java new file mode 100644 index 0000000..6f1a6ff --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/res/CurriculumDetailRes.java @@ -0,0 +1,51 @@ +package com.huoran.nakadai.entity.res; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @ProjectName: huorantech + * @Package: com.huoran.nakadai.entity.res + * @ClassName: CurriculumDetailRes + * @Description: java类作用描述 + * @Author: Maureen.Rong + * @CreateDate: 2021/9/29 10:50 + * @UpdateDate: 2021/9/29 10:50 + * @Version: 1.0 + * @create: 2021-09-29 10:50 + */ +@Data +public class CurriculumDetailRes { + @ApiModelProperty(value = "课程id") + private Integer cid; + + @ApiModelProperty(value = "项目名称") + private String projectName; + + @ApiModelProperty(value = "项目权限(0、练习 1、考核 2、竞赛)") + private Integer permissions; + + @ApiModelProperty(value = "应用名称") + private String applicationName; + + @ApiModelProperty(value = "排序(对项目展示进行排序)") + private Integer sort; + + @ApiModelProperty(value = "项目id") + private Integer projectId; + + @ApiModelProperty(value = "配置id") + private Integer configId; + + @ApiModelProperty(value = "是否展示(默认0展示 1为不展示)") + private Integer isShow; + + @ApiModelProperty(value = "系统id") + private Integer systemId; + + @ApiModelProperty(value = "系统类型") + private Integer type; + + @ApiModelProperty(value = "备注") + private String remark; +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/res/CurriculumRes.java b/nakadai/src/main/java/com/huoran/nakadai/entity/res/CurriculumRes.java new file mode 100644 index 0000000..de2d7db --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/res/CurriculumRes.java @@ -0,0 +1,85 @@ +package com.huoran.nakadai.entity.res; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.math.BigDecimal; + +/** + *

+ * 课程管理 + *

+ * + * @author lr + * @since 2021-09-16 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "Curriculum对象", description = "课程管理") +public class CurriculumRes { + + + @ApiModelProperty(value = "主键") + @TableId(value = "cid", type = IdType.AUTO) + private Integer cid; + + @ApiModelProperty(value = "课程名称") + private String curriculumName; + + @ApiModelProperty(value = "课程类别(0->理论 1-实训)") + private Integer curriculumType; + + @ApiModelProperty(value = "预计课时") + private String expectedCourse; + + @ApiModelProperty(value = "订单量") + private Integer orderVolume; + + @ApiModelProperty(value = "是否上架(默认0上架 1为下架)") + private Integer isEnable; + + @ApiModelProperty(value = "配置的实训应用") + private String sysName; + + @ApiModelProperty(value = "创建人") + private String userName; + + @ApiModelProperty(value = "系统id") + private String sysId; + + @ApiModelProperty(value = "市场价格") + private String marketPrice; + + @ApiModelProperty(value = "结算方式,0为单价,1为分成") + private String settlementMethod; + + @ApiModelProperty(value = "供应厂商") + private String supplier; + + @ApiModelProperty(value = "供应商名称") + private String supplierName; + + @ApiModelProperty(value = "结算单价") + private BigDecimal settlementPrice; + + @ApiModelProperty(value = "商务占比") + private String businessProportion; + + @ApiModelProperty(value = "厂商占比") + private String manufacturerProportion; + + @ApiModelProperty(value = "小程序图片地址") + private String miniProgramPictureAddress; + + @ApiModelProperty(value = "上下架(0下架 1上架 默认 1)") + private Integer isShelves; + + @ApiModelProperty(value = "关联产品标识") + private boolean associatedProductIdentification; +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/res/CustomerDetailRes.java b/nakadai/src/main/java/com/huoran/nakadai/entity/res/CustomerDetailRes.java new file mode 100644 index 0000000..660b5b2 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/res/CustomerDetailRes.java @@ -0,0 +1,46 @@ +package com.huoran.nakadai.entity.res; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.huoran.nakadai.entity.Customer; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + *

+ * 客户表 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@Data +@TableName("customer") +public class CustomerDetailRes implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键ID + */ + @ApiModelProperty("客户id") + @TableId(value = "customer_id", type = IdType.AUTO) + private Integer customerId; + + @ApiModelProperty("客户对象") + private CustomerRes customer; + + @ApiModelProperty("合同详细") + private List contractInformations; + + @ApiModelProperty("课程权限") + private List coursePermissionss; + + @ApiModelProperty("数据平台权限") + private List dataPermissionss; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/res/CustomerListRes.java b/nakadai/src/main/java/com/huoran/nakadai/entity/res/CustomerListRes.java new file mode 100644 index 0000000..291c75a --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/res/CustomerListRes.java @@ -0,0 +1,122 @@ +package com.huoran.nakadai.entity.res; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + *

+ * 客户表 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@Data +@TableName("customer") +public class CustomerListRes implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "序号") + @Excel(name = "序号", orderNum = "1", isImportField = "rownum", width = 30) + private Integer rownum; + + /** + * 主键ID + */ + @ApiModelProperty("主键ID") + @TableId(value = "customer_id", type = IdType.AUTO) + private Integer customerId; + + /** + * 国家 + */ + @ApiModelProperty("国家") + private String countries; + + + + + + /** + * 客户名称(学校名称) + */ + @ApiModelProperty("客户名称(学校名称)") + @Excel(name = "客户名称", orderNum = "2", isImportField = "customerName", width = 30) + private String customerName; + + /** + * 绑定行业ID + */ + @ApiModelProperty("绑定行业ID") + private Integer industryId; + + /** + * 行业 + */ + @ApiModelProperty("行业") + @Excel(name = "行业", orderNum = "3", isImportField = "industryName", width = 30) + private String industryName; + + @ApiModelProperty("客户类型(1、正式 2、试用 3、到期)") + @Excel(name = "客户类型", orderNum = "4", isImportField = "customerTypeStr", width = 30) + private String customerTypeStr; + + + + /** + * 省份 + */ + @ApiModelProperty("省份") + @Excel(name = "省份", orderNum = "5", isImportField = "provinceName", width = 30) + private String provinceName; + + /** + * 城市ID + */ + @ApiModelProperty("城市") + @Excel(name = "城市", orderNum = "6", isImportField = "cityName", width = 30) + private String cityName; + + /** + * 联系人姓名 + */ + @ApiModelProperty("联系人姓名") + @Excel(name = "联系人", orderNum = "7", isImportField = "name", width = 30) + private String name; + + /** + * 账号 + */ + @ApiModelProperty("账号") + @Excel(name = "账号", orderNum = "8", isImportField = "account", width = 30) + private String account; + + @ApiModelProperty("登录次数") + @Excel(name = "登录次数", orderNum = "9", isImportField = "loginNumber", width = 30) + @TableField(exist = false) + private String loginNumber; + + @ApiModelProperty("学校id") + private Integer schoolId; + + + @ApiModelProperty("联系人") + private String contacts; + + @ApiModelProperty("产品到期时间") + private String expireDate; + + @ApiModelProperty("客户类型(1、正式 2、试用 3、到期)") + private Integer customerType; + + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/res/CustomerRes.java b/nakadai/src/main/java/com/huoran/nakadai/entity/res/CustomerRes.java new file mode 100644 index 0000000..059776c --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/res/CustomerRes.java @@ -0,0 +1,157 @@ +package com.huoran.nakadai.entity.res; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 客户表 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@Data +@TableName("customer") +public class CustomerRes implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键ID + */ + @ApiModelProperty("主键ID") + @TableId(value = "customer_id", type = IdType.AUTO) + private Integer customerId; + + /** + * 国家 + */ + @ApiModelProperty("国家") + private String countries; + + + @ApiModelProperty("省份名称") + private String provinceName; + + + @ApiModelProperty("城市名") + private String cityName; + + + + /** + * 客户类型(1、正式 2、试用 3、到期) + */ + @ApiModelProperty("客户类型(1、正式 2、试用 3、到期)") + private Integer customerType; + + /** + * 省份ID + */ + @ApiModelProperty("省份ID") + private Integer provinceId; + + /** + * 城市ID + */ + @ApiModelProperty("城市ID") + private Integer cityId; + + /** + * 到期时间 + */ + @ApiModelProperty("到期时间") + private Date expireDate; + + /** + * 客户名称(学校名称) + */ + @ApiModelProperty("客户名称(学校名称)") + private String customerName; + + + @ApiModelProperty("学校名称") + private String schoolName; + + /** + * 绑定行业ID + */ + @ApiModelProperty("绑定行业ID") + private Integer industryId; + + /** + * 绑定行业类ID + */ + @ApiModelProperty("绑定行业类ID") + private Integer industryClassId; + + @ApiModelProperty("行业类名") + @TableField(exist = false) + private String industryClassName; + + @ApiModelProperty("行业名") + @TableField(exist = false) + private String industryName; + + @ApiModelProperty("绑定学校ID") + private Integer schoolId; + + /** + * 行业 + */ + @ApiModelProperty("行业") + private String industry; + + /** + * 联系人姓名 + */ + @ApiModelProperty("联系人姓名") + private String name; + + /** + * 手机号 + */ + @ApiModelProperty("手机号") + private String phone; + + /** + * 职务 + */ + @ApiModelProperty("职务") + private String position; + + /** + * 邮箱 + */ + @ApiModelProperty("邮箱") + private String email; + + @ApiModelProperty("账号") + private String account; + + /** + * 是否删除(0、未删除 1、已删除) + */ + @ApiModelProperty("是否删除(0、未删除 1、已删除)") + private Integer isDel; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + /** + * 修改时间 + */ + @ApiModelProperty("修改时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/res/DataPermissionssRes.java b/nakadai/src/main/java/com/huoran/nakadai/entity/res/DataPermissionssRes.java new file mode 100644 index 0000000..1054579 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/res/DataPermissionssRes.java @@ -0,0 +1,82 @@ +package com.huoran.nakadai.entity.res; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + *

+ * 客户表 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@Data +public class DataPermissionssRes implements Serializable { + + //数据平台权限主键id + @ApiModelProperty("数据平台权限主键id") + private Integer id; + //产品名称 + @ApiModelProperty("产品名称") + private String productName; + //使用期限 + @ApiModelProperty("使用期限") + private Integer periodOfUse; + //市场价 + @ApiModelProperty("市场价") + private double marketValue; + //交易价格 + @ApiModelProperty("交易价格") + private double finalPrice; + //折扣率 + @ApiModelProperty("折扣率") + private String discountRate; + //绑定端口地址id + @ApiModelProperty("绑定端口地址id") + private Integer portId; + //是否发货 + @ApiModelProperty("是否发货") + private Integer ship; + //绑定数据平台id + @ApiModelProperty("绑定数据平台id") + private Integer dataOrCourseId; + //绑定订单id + @ApiModelProperty("绑定订单id") + private Integer orderId; + + //起始时间 + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @ApiModelProperty("起始时间") + private Date startTime; + + //结束时间 + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @ApiModelProperty("结束时间") + private Date endTime; + + //剩余期限 + @ApiModelProperty("剩余期限") + private Integer remainingPeriod; + + //账号数 + @ApiModelProperty("账号数") + private Integer accountNum; + + //总金额 + @ApiModelProperty("总金额") + private BigDecimal totalAmount; + + @ApiModelProperty("是否开启(0不开启,1开启,发货后,默认开启)") + private Integer isEnable; + + @ApiModelProperty(value = "使用期限单位选择0日,1月,2年") + private Integer options; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/res/ExportSubscribedRecordsResp.java b/nakadai/src/main/java/com/huoran/nakadai/entity/res/ExportSubscribedRecordsResp.java new file mode 100644 index 0000000..188f493 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/res/ExportSubscribedRecordsResp.java @@ -0,0 +1,43 @@ +package com.huoran.nakadai.entity.res; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.Size; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +@Data +public class ExportSubscribedRecordsResp { + + @ApiModelProperty(value = "(产品名称)数据产品或课程名称") + @Excel(name = "产品名称", orderNum = "1", mergeVertical = true, isImportField = "productName", width = 30) + private String productName; + + @ApiModelProperty(value = "产品类型") + @Excel(name = "产品类型", orderNum = "2", mergeVertical = true, isImportField = "productType", width = 30) + private String productType; + + @ApiModelProperty(value = "起止时间") + @Excel(name = "起止时间", orderNum = "3", mergeVertical = true, isImportField = "startAndEndTime", width = 30) + private String startAndEndTime; + + @ApiModelProperty(value = "剩余期限") + @Excel(name = "剩余期限", orderNum = "4", mergeVertical = true, isImportField = "remainingPeriod", width = 30) + private String remainingPeriod; + + @ApiModelProperty(value = "订阅状态") + @Excel(name = "订阅状态", orderNum = "5", mergeVertical = true, isImportField = "subscriptionStatus", width = 30) + private String subscriptionStatus; + + @ApiModelProperty(value = "产品状态") + @Excel(name = "产品状态", orderNum = "6", mergeVertical = true, isImportField = "productStatus", width = 30) + private String productStatus; +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/res/GoodsRes.java b/nakadai/src/main/java/com/huoran/nakadai/entity/res/GoodsRes.java new file mode 100644 index 0000000..9b5d989 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/res/GoodsRes.java @@ -0,0 +1,101 @@ +package com.huoran.nakadai.entity.res; + +import com.huoran.nakadai.entity.MallNonAssociatedLinks; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +@Data +public class GoodsRes implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "产品名称") + private String productName; + + @ApiModelProperty(value = "商品id") + private Integer mallId; + + @ApiModelProperty(value = "产品类型") + private String typeName; + + @ApiModelProperty(value = "厂商名称") + private String supplierName; + + @ApiModelProperty(value = "关联产品名称") + private String associatedProductName; + + @ApiModelProperty(value = "关联产品id") + private String associatedProduct; + + @ApiModelProperty(value = "状态") + private Integer state; + + @ApiModelProperty(value = "编辑人") + private String userName; + + @ApiModelProperty(value = "精选") + private Integer selected; + + @ApiModelProperty(value = "上架状态") + private Integer isShelves; + + @ApiModelProperty(value = "学习次数") + private Integer learningCount; + + @ApiModelProperty(value = "订单量") + private Integer orderQuantity; + + @ApiModelProperty(value = "学科") + private String disciplineName; + + @ApiModelProperty(value = "专业类") + private String professionalClassName; + + @ApiModelProperty(value = "专业") + private String professionalName; + + @ApiModelProperty(value = "上架时间") + private Date shelfTime; + + @ApiModelProperty(value = "市场建议单价") + private BigDecimal marketUnitPrice; + + @ApiModelProperty(value = "我校标识") + private boolean logoOfOurSchool; + + @ApiModelProperty(value = "封面图") + private String coverDrawing; + + @ApiModelProperty(value = "界面图(支持上传4张,使用逗号分隔)") + private String interfaceDiagram; + + @ApiModelProperty(value = "小程序图标") + private String appletIcon; + + @ApiModelProperty(value = "产品简介") + private String productIntroduction; + + @ApiModelProperty(value = "产品分类") + private String classificationName; + + @ApiModelProperty(value = "产品分类id") + private Integer classificationId; + + @ApiModelProperty(value = "产品标签") + private String tagsName; + + @ApiModelProperty(value = "系统id") + private String systemId; + + @ApiModelProperty(value = "是否关联产品,默认为0关联,1不关联 (0表示平台官方)") + private Integer isAssociatedProduct; + + @ApiModelProperty(value = "产品链接") + private List mallNonAssociatedLinks; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/res/ListOfClientCommercialManagersResp.java b/nakadai/src/main/java/com/huoran/nakadai/entity/res/ListOfClientCommercialManagersResp.java new file mode 100644 index 0000000..f93e7df --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/res/ListOfClientCommercialManagersResp.java @@ -0,0 +1,68 @@ +package com.huoran.nakadai.entity.res; + +import com.huoran.nakadai.entity.req.ConfigurationReq; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; +import java.util.List; + + +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "中台客户下商务经理列表", description = "中台客户下商务经理列表") +public class ListOfClientCommercialManagersResp { + + @ApiModelProperty(value = "姓名") + private String userName; + + @ApiModelProperty(value = "商务经理id(partner_id)") + private Integer businessManagerId; + + @ApiModelProperty(value = "账号id" ) + private Integer accountId; + + + @ApiModelProperty(value = "团队id" ) + private Integer teamId; + + + @ApiModelProperty(value = "用户id" ) + private Integer userId; + + @ApiModelProperty(value = "头像" ) + private String userAvatars; + + @ApiModelProperty(value = "手机号" ) + private String phone; + + @ApiModelProperty(value = "合伙人分类名称") + private String partnerClassificationName; + + @ApiModelProperty(value = "最近一次订单时间") + private String latestTime; + + @ApiModelProperty(value = "订购数量") + private Integer quantityOfOrder; + + @ApiModelProperty(value = "产品名称") + private String productName; + + + /*@ApiModelProperty(value = "团队删除状态") + private Integer teamDel;*/ + + @ApiModelProperty(value = "成员删除状态") + private Integer peopleDel; + + @ApiModelProperty(value = "团队信息") + private List teamInformationRespList; + + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/res/ModeCategoryResp.java b/nakadai/src/main/java/com/huoran/nakadai/entity/res/ModeCategoryResp.java new file mode 100644 index 0000000..0fd6ac8 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/res/ModeCategoryResp.java @@ -0,0 +1,47 @@ +package com.huoran.nakadai.entity.res; + +import com.baomidou.mybatisplus.annotation.*; +import com.huoran.nakadai.entity.ModelReferenceDemo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + *

+ * 源模型-分类表 + *

+ * + * @author chen + * @since 2022-03-03 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class ModeCategoryResp { + + + + + @ApiModelProperty(value = "分类名称") + @NotNull(message = "分类名称不能为空") + private String categoryName; + + @ApiModelProperty(value = "级别") + @NotNull(message = "等级不能为空") + private Integer level; + + + @ApiModelProperty(value = "模型子级") + private transient List referenceDemoList; + + + /*@ApiModelProperty(value = "子级") + private transient List children;*/ +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/res/ModelCategoryResp.java b/nakadai/src/main/java/com/huoran/nakadai/entity/res/ModelCategoryResp.java new file mode 100644 index 0000000..23b65b9 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/res/ModelCategoryResp.java @@ -0,0 +1,36 @@ +package com.huoran.nakadai.entity.res; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + *

+ * 源模型-分类表 + *

+ * + * @author chen + * @since 2022-03-03 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class ModelCategoryResp { + + @ApiModelProperty(value = "分类名称") + private String categoryName; + + @ApiModelProperty(value = "等级") + private Integer level; + + @ApiModelProperty(value = "子级") + private List children; +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/res/OrderOtherResp.java b/nakadai/src/main/java/com/huoran/nakadai/entity/res/OrderOtherResp.java new file mode 100644 index 0000000..156ea74 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/res/OrderOtherResp.java @@ -0,0 +1,110 @@ +package com.huoran.nakadai.entity.res; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.Size; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + *

+ * 订单其他信息(包含课程权限、数据平台权限、合同信息等) + *

+ * + * @author cheney + * @since 2021-07-01 + */ +@Data + +@TableName("order_other") +@ApiModel(value = "OrderOther对象", description = "订单其他信息(包含课程权限、数据平台权限、合同信息等)") +public class OrderOtherResp implements Serializable { + + private static final long serialVersionUID = 6473128434681123441L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "订单id") + private Integer orderId; + + @ApiModelProperty(value = "数据产品或课程id(根据权限authority字段判断)") + private Integer dataOrCourseId; + + @ApiModelProperty(value = "数据产品或课程名称") + private String productName; + + @ApiModelProperty(value = "端口id(预留处理)") + private Integer portId; + + @ApiModelProperty(value = "使用期限(以月为单位)") + @NotEmpty(message = "期限不能为空") + private Integer periodOfUse; + + @ApiModelProperty(value = "剩余期限(以天为单位)") + private Integer remainingPeriod; + + @ApiModelProperty(value = "成交价(以万位单位)") + @NotEmpty(message = "成交价不能为空") + private BigDecimal finalPrice; + + @ApiModelProperty(value = "总金额(以万为单位)") + @NotEmpty(message = "总金额不能为空") + private BigDecimal totalAmount; + + @ApiModelProperty(value = "市场价(以万为单位)") + private BigDecimal marketValue; + + @ApiModelProperty(value = "折扣率(百分比)") + private String discountRate; + + @ApiModelProperty(value = "是否发货(0未发货,1已发货,默认不发货)") + @Size(max = 1) + private Integer ship; + + @ApiModelProperty(value = "区分权限(0为数据平台权限,1为课程权限,对应data_or_course_id)") + @Size(max = 1) + private Integer authority; + + @ApiModelProperty(value = "是否开启(0不开启,1开启,发货后,默认开启)") + @Size(max = 1) + private Integer isEnable; + + @ApiModelProperty(value = "账号数") + @NotEmpty(message = "账号数不能为空") + private Integer accountNum; + + @ApiModelProperty(value = "是否删除(0、未删除 1、已删除)") + @TableLogic(value = "0", delval = "1") + private Integer isDel; + + @ApiModelProperty(value = "使用开始时间") + @TableField(fill = FieldFill.INSERT) + @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd") + private Date startTime; + + @ApiModelProperty(value = "使用结束时间") + @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd") + private Date endTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd") + private Date updateTime; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd") + private Date createTime; + + @ApiModelProperty(value = "剩余天数") + private Integer remainingDay; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/res/PartnerAccountResp.java b/nakadai/src/main/java/com/huoran/nakadai/entity/res/PartnerAccountResp.java new file mode 100644 index 0000000..28d8b19 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/res/PartnerAccountResp.java @@ -0,0 +1,117 @@ +package com.huoran.nakadai.entity.res; + +import com.huoran.nakadai.entity.PartnerClassification; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.math.BigDecimal; +import java.util.List; + +/** + * @Author chen + * @DATE 2022/5/18 17:04 + * @Version 1.0 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "PartnerAccountResp", description = "合伙人列表") +public class PartnerAccountResp { + + @ApiModelProperty(value = "合伙人主键ID/商务经理id") + private Integer partnerId; + + @ApiModelProperty(value = "父id") + private Integer parentId; + + @ApiModelProperty(value = "邀请人") + private String invitationAccount; + + @ApiModelProperty(value = "合伙人分类id") + private String partnerClassificationId; + + @ApiModelProperty(value = "合伙人分类名称(团队名称)") + private String partnerClassificationName; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "职工姓名") + private String userName; + + @ApiModelProperty(value = "职工工号") + private String workNumber; + + @ApiModelProperty(value = "唯一标识账号") + private String uniqueIdentification; + + @ApiModelProperty("用户头像路径") + private String userAvatars; + + @ApiModelProperty(value = "电话") + private String phone; + + @ApiModelProperty(value = "邮箱") + private String email; + + //用于列表逗号隔开展示 + @ApiModelProperty(value = "角色") + private String roleName; + + @ApiModelProperty(value = "角色id") + private String roleId; + + @ApiModelProperty(value = "账号") + private String account; + + @ApiModelProperty(value = "登陆次数") + private Integer loginNumber; + + @ApiModelProperty(value = "最后登陆时间") + private String lastLoginTime; + + @ApiModelProperty(value = "用户id") + private Integer userId; + + @ApiModelProperty(value = "团队id") + private Integer teamId; + + @ApiModelProperty(value = "商务经理ids") + private List businessManagerIds; + + @ApiModelProperty(value = "团队信息") + private PartnerClassification partnerClassificationList; + + @ApiModelProperty(value = "是否是团队") + private String isTeam; + + @ApiModelProperty(value = "区域") + private String area; + + @ApiModelProperty(value = "团队数") + private Integer teamSize; + + @ApiModelProperty(value = "团队名称") + private String teamName; + + @ApiModelProperty(value = "省份id") + private Integer provinceId; + + @ApiModelProperty(value = "城市id") + private Integer cityId; + + @ApiModelProperty(value = "省份名称") + private String provinceName; + + @ApiModelProperty(value = "城市名称") + private String cityName; + + @ApiModelProperty(value = "团队年费") + private BigDecimal annualTeamFee; + + @ApiModelProperty(value = "市场服务年费") + private BigDecimal annualMarketingFee; +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/res/PartnerArticleManagementResp.java b/nakadai/src/main/java/com/huoran/nakadai/entity/res/PartnerArticleManagementResp.java new file mode 100644 index 0000000..f85fec5 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/res/PartnerArticleManagementResp.java @@ -0,0 +1,116 @@ +package com.huoran.nakadai.entity.res; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +/** + * @描述:合伙人——文章管理 + * @作者: Rong + * @日期: 2023-03-16 + */ +@Data +@ApiModel(value = "分页文章管理") +public class PartnerArticleManagementResp { + + + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "文章id") + private Integer id; + + @ApiModelProperty(value = "文章标题(依据站点判重)") + private String title; + + @ApiModelProperty(value = "来源") + private String source; + + @ApiModelProperty(value = "标题图") + private String titleImg; + + @ApiModelProperty(value = "封面图") + private String bannerImg; + + + @ApiModelProperty(value = "发布时间(不要时分秒)") + private String releaseTime; + + @ApiModelProperty(value = "摘要") + private String summary; + + @ApiModelProperty(value = "正文") + private String mainBody; + + + @ApiModelProperty(value = "是否发布(0:草稿 1:已发布)") + private Integer isRelease; + + @ApiModelProperty(value = "创建人") + private String founderName; + + @ApiModelProperty(value = "编辑人") + private String editorName; + + + @ApiModelProperty(value = "创建时间") + private Date createTime; + + @ApiModelProperty(value = "更新时间") + private Date updateTime; + + @ApiModelProperty(value = "文章总浏览量") + private Integer totalBrowsing; + + + @ApiModelProperty(value = "编辑") + private String edit; + + @ApiModelProperty(value = "主题标签,可多选逗号隔开") + private String labelName; + + @ApiModelProperty(value = "所属分类名称") + private String classificationName; + + @ApiModelProperty(value = "是否禁用(0默认,0启用 1禁用)") + private Integer isDisable; + + @ApiModelProperty(value = "序号") + private Integer sequence; + + @ApiModelProperty(value = "类型(1.学习2.资讯)") + private Integer typeId; + + @ApiModelProperty(value = "学习人数量") + private Integer learnerNumber; + + @ApiModelProperty(value = "上次阅读") + private boolean lastReading; + + @ApiModelProperty(value = "产品介绍") + private String product; + + @ApiModelProperty(value = "适用专业") + private String applicableMajor; + + @ApiModelProperty(value = "方案简介") + private String schemeIntroduction; + + @ApiModelProperty(value = "是否置顶(默认为0 不置顶 1为置顶)") + private Integer isTop; + + @ApiModelProperty(value = "是否收藏:(state = 1收藏,0:未收藏)") + private Integer collectionStatus; + + @ApiModelProperty(value = "收藏人数") + private Integer collectionNumber; + + @ApiModelProperty(value = "产品id(逗号隔开多个)") + private String mallIds; + + + @ApiModelProperty(value = "产品名(多个逗号隔开)") + private String productNames; + +} \ No newline at end of file diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/res/PermissiontogetordersResp.java b/nakadai/src/main/java/com/huoran/nakadai/entity/res/PermissiontogetordersResp.java new file mode 100644 index 0000000..aca112b --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/res/PermissiontogetordersResp.java @@ -0,0 +1,52 @@ +package com.huoran.nakadai.entity.res; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.Size; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + *

+ * 订单其他信息(包含课程权限、数据平台权限、合同信息等) + *

+ * + * @author cheney + * @since 2021-07-01 + */ +@Data +public class PermissiontogetordersResp { + + @ApiModelProperty(value = "数据产品或课程id(根据权限authority字段判断)") + private Integer dataOrCourseId; + + @ApiModelProperty(value = "订单id") + private Integer orderId; + + @ApiModelProperty(value = "订单其他信息主键") + private Integer id; + + @ApiModelProperty(value = "区分权限(0为数据平台权限,1为课程权限,对应data_or_course_id)") + @Size(max = 1) + private Integer authority; + + @ApiModelProperty(value = "是否开启(0不开启,1开启,发货后,默认开启)") + @Size(max = 1) + private Integer isEnable; + + @ApiModelProperty(value = "使用开始时间") + @TableField(fill = FieldFill.INSERT) + @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd") + private String startTime; + + @ApiModelProperty(value = "使用结束时间") + @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd") + private String endTime; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/res/ProgramShoppingCartResp.java b/nakadai/src/main/java/com/huoran/nakadai/entity/res/ProgramShoppingCartResp.java new file mode 100644 index 0000000..4fa0deb --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/res/ProgramShoppingCartResp.java @@ -0,0 +1,93 @@ +package com.huoran.nakadai.entity.res; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + *

+ * 小程序—购物车 + *

+ * + * @author chen + * @since 2023-06-09 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class ProgramShoppingCartResp { + + @ApiModelProperty(value = "购物车主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "商品主键") + private Integer mallId; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "编辑时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "是否删除(默认0未删,1为已删)") + @TableLogic + private Integer isDel; + + @ApiModelProperty(value = "关联产品(产品表为的课程、数据产品、职站增值模块)") + private Integer associatedProduct; + + @ApiModelProperty(value = "是否关联产品,默认为0关联,1不关联") + private Integer isAssociatedProduct; + + @ApiModelProperty(value = "关联产品名称") + private String associatedProductName; + + @ApiModelProperty(value = "区分产品权限(0为数据平台权限,1为课程权限,2为职站增值模块,3为实训课程(非集成),4为实验工具,对应id为商城管理中的产品)") + private Integer authority; + + @ApiModelProperty(value = "产品名称") + private String productName; + + @ApiModelProperty(value = "匹配课程") + private String matchingCourse; + + @ApiModelProperty(value = "课程耗时") + private String courseHours; + + @ApiModelProperty(value = "适用场景") + private String applicationScenario; + + @ApiModelProperty(value = "封面图") + private String coverDrawing; + + @ApiModelProperty(value = "界面图(支持上传4张,使用逗号分隔)") + private String interfaceDiagram; + + @ApiModelProperty(value = "小程序图标") + private String appletIcon; + + @ApiModelProperty(value = "市场建议单价") + private BigDecimal marketUnitPrice; + + @ApiModelProperty(value = "产品简介") + private String productIntroduction; + + @ApiModelProperty(value = "详情介绍") + private String detailedIntroduction; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/res/SchoolCourseRes.java b/nakadai/src/main/java/com/huoran/nakadai/entity/res/SchoolCourseRes.java new file mode 100644 index 0000000..665d582 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/res/SchoolCourseRes.java @@ -0,0 +1,55 @@ +package com.huoran.nakadai.entity.res; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.Size; + +/** + * @ProjectName: huorantech + * @Package: com.huoran.nakadai.entity.res + * @ClassName: SchoolCourseRes + * @Description: 学校课程展示 + * @Author: Maureen.Rong + * @CreateDate: 2021/9/28 15:21 + * @UpdateDate: 2021/9/28 15:21 + * @Version: 1.0 + * @create: 2021-09-28 15:21 + */ +@Data +public class SchoolCourseRes { + @ApiModelProperty(value = "主键") + private Integer cid; + + @ApiModelProperty(value = "课程名称") + private String curriculumName; + + @ApiModelProperty(value = "订单id") + private Integer orderId; + + @ApiModelProperty(value = "区分权限(0为数据平台权限,1为课程权限,对应data_or_course_id)") + @Size(max = 1) + private Integer authority; + + @ApiModelProperty(value = "数据产品或课程id(根据权限authority字段判断)") + private Integer dataOrCourseId; + + @ApiModelProperty(value = "课程地址") + private String coverUrl; + + @ApiModelProperty(value = "系统id") + private String systemId; + + @ApiModelProperty(value = "商品id") + private Integer mallId; + + @ApiModelProperty(value = "系统名称") + private String systemName; + + @ApiModelProperty(value = "商品名字") + private String goodsName; + + @ApiModelProperty(value = "商品id") + private Integer goodsId; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/res/StaffResp.java b/nakadai/src/main/java/com/huoran/nakadai/entity/res/StaffResp.java new file mode 100644 index 0000000..e4ed3b8 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/res/StaffResp.java @@ -0,0 +1,75 @@ +package com.huoran.nakadai.entity.res; + + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + + +/** + * @Author chen + * @DATE 2021/10/13 15:51 + * @Version 1.0 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "StaffResp", description = "员工列表") +public class StaffResp { + + @ApiModelProperty(value = "员工主键ID") + private Integer staffId; + + @ApiModelProperty(value = "组织架构ID") + private String staffArchitectureId; + + @ApiModelProperty(value = "组织架构名称(部门名称)") + private String staffArchitectureName; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "职工姓名") + private String userName; + + @ApiModelProperty(value = "职工工号") + private String workNumber; + + @ApiModelProperty(value = "唯一标识账号") + private String uniqueIdentification; + + @ApiModelProperty(value = "电话") + private String phone; + + @ApiModelProperty(value = "邮箱") + private String email; + + //用于列表逗号隔开展示 + @ApiModelProperty(value = "角色") + private String roleName; + + @ApiModelProperty(value = "角色id") + private String roleId; + + //用于查看详情是否角色选中 + /*@ApiModelProperty(value = "角色列表") + private List roleList;*/ + + @ApiModelProperty(value = "账号") + private String account; + + @ApiModelProperty(value = "登陆次数") + private Integer logInNumber; + + @ApiModelProperty(value = "最后登陆时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private String lastLoginTime; + + @ApiModelProperty(value = "用户id") + private Integer userId; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/res/TeamInformationResp.java b/nakadai/src/main/java/com/huoran/nakadai/entity/res/TeamInformationResp.java new file mode 100644 index 0000000..a399826 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/res/TeamInformationResp.java @@ -0,0 +1,29 @@ +package com.huoran.nakadai.entity.res; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + + +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "团队信息及团队删除状态", description = "团队信息及团队删除状态") +public class TeamInformationResp { + + + + + @ApiModelProperty(value = "团队id") + private Integer teamId; + + @ApiModelProperty(value = "团队名称") + private String partnerClassificationName; + + @ApiModelProperty(value = "团队删除状态") + private Integer teamDel; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/res/UserInfoByPhoneRes.java b/nakadai/src/main/java/com/huoran/nakadai/entity/res/UserInfoByPhoneRes.java new file mode 100644 index 0000000..94ba711 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/res/UserInfoByPhoneRes.java @@ -0,0 +1,28 @@ +package com.huoran.nakadai.entity.res; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Author chen + * @DATE 2022/6/8 14:58 + * @Version 1.0 + */ +@Data +public class UserInfoByPhoneRes { + + @ApiModelProperty(value = "账号") + private String account; + + @ApiModelProperty(value = "用户姓名") + private String userName; + + @ApiModelProperty(value = "手机号") + private String phone; + + @ApiModelProperty(value = "邮箱") + private String email; + + @ApiModelProperty(value = "头像") + private String userAvatars; +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/vo/ChapterVO.java b/nakadai/src/main/java/com/huoran/nakadai/entity/vo/ChapterVO.java new file mode 100644 index 0000000..d7124ca --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/vo/ChapterVO.java @@ -0,0 +1,32 @@ +package com.huoran.nakadai.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * @Author chen + * @DATE 2020/10/10 9:37 + * @Version 1.0 + * 章节封装对象 + */ +@Data +public class ChapterVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "章节ID") + private Integer id; + + @ApiModelProperty(value = "章节名称") + private String name; + + @ApiModelProperty(value = "排序号") + private Integer sort; + + @ApiModelProperty(value = "小节集合") + private List subsectionList = new ArrayList<>(); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/vo/CheckVo.java b/nakadai/src/main/java/com/huoran/nakadai/entity/vo/CheckVo.java new file mode 100644 index 0000000..0d991fd --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/vo/CheckVo.java @@ -0,0 +1,42 @@ +package com.huoran.nakadai.entity.vo; + +/** + * @description + * @author: Mr.JK + * @create: 2021-07-05 18:25 + **/ + + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + * @description + * @author: Mr.JK + * @create: 2021-06-22 15:47 + **/ +@Data +@Accessors(chain = true) +@ApiModel(value = "CheckVo",description = "验证码校验参数") +public class CheckVo implements Serializable { + + private static final long serialVersionUID = 1L; + + //用户的邮箱地址 + @ApiModelProperty("用户的邮箱地址") + private String email; + + @ApiModelProperty("用户输入的验证码") + private String code; + + @ApiModelProperty(value = "平台id") + private String platformId; + + private String accountId; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/vo/ContentHeavyTitleReqVO.java b/nakadai/src/main/java/com/huoran/nakadai/entity/vo/ContentHeavyTitleReqVO.java new file mode 100644 index 0000000..9a29e39 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/vo/ContentHeavyTitleReqVO.java @@ -0,0 +1,33 @@ +package com.huoran.nakadai.entity.vo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * @描述:文章管理 + * @作者: Rong + * @日期: 2022-08-05 + */ +@Data +@ApiModel(value = "文章标题判重") +public class ContentHeavyTitleReqVO { + + + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "主键(编辑时需要传)",required = false) + private Integer id; + + @ApiModelProperty(value = "标题(全库判重)",required = true) + @NotNull(message = "标题不能为空") + private String title; + + @ApiModelProperty(value = "类型(1.学习2.资讯)") + @NotNull(message = "类型不能为空") + private Integer typeId; + +} \ No newline at end of file diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/vo/CourseVO.java b/nakadai/src/main/java/com/huoran/nakadai/entity/vo/CourseVO.java new file mode 100644 index 0000000..c92114b --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/vo/CourseVO.java @@ -0,0 +1,60 @@ +package com.huoran.nakadai.entity.vo; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Author chen + * @DATE 2020/10/4 12:20 + * @Version 1.0 + */ +@ApiModel(value = "课程vo", description = "课程vo封装") +@Data +public class CourseVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "课程ID") + private String cid; + + @ApiModelProperty(value = "课程名称") + private String name; + + @ApiModelProperty(value = "创建时间") + private Date createTime; + + + @ApiModelProperty(value = "创建人") + private String founder; + + @ApiModelProperty(value = "章节数") + private Integer chapterNum; + + @ApiModelProperty(value = "课程封面图片路径") + private String coverUrl; + + @ApiModelProperty(value = "课程描述") + private String description; + + @ApiModelProperty(value = "区分标识:1为企业端课程,0为管理端课程") + private Integer distinguish; + + @ApiModelProperty(value = "课程分类id") + private String classificationId; + + @ApiModelProperty(value = "小节数") + private Integer subsectionNum; + + @ApiModelProperty(value = "分类名称") + private String classification; + + @ApiModelProperty(value = "是否开启") + private Integer isEnable; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/vo/DisciplineExcelVo.java b/nakadai/src/main/java/com/huoran/nakadai/entity/vo/DisciplineExcelVo.java new file mode 100644 index 0000000..8d478a6 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/vo/DisciplineExcelVo.java @@ -0,0 +1,22 @@ +package com.huoran.nakadai.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +@Data +public class DisciplineExcelVo { + + @ApiModelProperty(value = "序号") + private String serialNumber; + + @NotNull(message = "门类") + private String category; + + @ApiModelProperty(value = "专业类") + private String majorCategory; + + @ApiModelProperty(value = "专业") + private String major; +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/vo/GoodsVo.java b/nakadai/src/main/java/com/huoran/nakadai/entity/vo/GoodsVo.java new file mode 100644 index 0000000..c556cb3 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/vo/GoodsVo.java @@ -0,0 +1,56 @@ +package com.huoran.nakadai.entity.vo; + +import com.huoran.nakadai.entity.*; +import com.huoran.nakadai.entity.res.GoodsRes; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.util.List; + +@Data +public class GoodsVo implements Serializable { + + private static final long serialVersionUID = 6471558434681123441L; + + @ApiModelProperty(value = "商品基本数据") + private Mall mall; + + @ApiModelProperty(value = "实验项目数量") + private Integer numberOfExperimentalItems; + + @ApiModelProperty(value = "系统id") + private String systemId; + + @ApiModelProperty(value = "商品详情数据") + private GoodsRes goodsRes; + + @ApiModelProperty(value = "产品分类id") + @NotEmpty(message = "产品分类不能为空") + private List classificationIds; + + @ApiModelProperty(value = "产品类型id") + @NotEmpty(message = "产品类型不能为空") + private List typeIds; + + @ApiModelProperty(value = "分类标签id") + private List tagsIds; + + @ApiModelProperty(value = "供应商id") + private List supplierIds; + + @ApiModelProperty(value = "适用学科专业集") + private List mallDisciplines; + + @ApiModelProperty(value = "商品结算价格集") + private List mallPrices; + + @ApiModelProperty(value = "产品参数(附件)") + private List mallAnnex; + + @ApiModelProperty(value = "非关联产品链接") + private List mallNonAssociatedLinks; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/vo/ImportStaffFailureVo.java b/nakadai/src/main/java/com/huoran/nakadai/entity/vo/ImportStaffFailureVo.java new file mode 100644 index 0000000..9d2edb0 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/vo/ImportStaffFailureVo.java @@ -0,0 +1,51 @@ +package com.huoran.nakadai.entity.vo; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import cn.afterturn.easypoi.excel.annotation.ExcelTarget; +import com.huoran.nakadai.utils.ExcelAttribute; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.ToString; +import lombok.experimental.Accessors; + +@Data +@ToString +@Accessors(chain = true) +@ExcelTarget("ImportStaffFailureVo") +public class ImportStaffFailureVo { + + //第几行 + private Long index; + + @Excel(name = "姓名", orderNum = "1", isImportField = "id", width = 30) + @ApiModelProperty(value = "姓名") + private String userName; + + @ApiModelProperty(value = "账号") + @Excel(name = "账号", orderNum = "2", mergeVertical = false, isImportField = "account", width = 30) + private String account; + + @ApiModelProperty(value = "角色") + @Excel(name = "角色", orderNum = "3", isImportField = "roleName", width = 30) + private String roleName; + + @ApiModelProperty(value = "工号") + @Excel(name = "工号", orderNum = "4", isImportField = "workNumber", width = 30) + private String workNumber; + + @ApiModelProperty(value = "所在部门") + @Excel(name = "所在部门", orderNum = "5", isImportField = "dept", width = 30) + private String dept; + + @ApiModelProperty(value = "手机号码") + @Excel(name = "手机号码", orderNum = "6", isImportField = "phone", width = 20) + private String phone; + + @ApiModelProperty(value = "邮箱") + @Excel(name = "邮箱", orderNum = "7", isImportField = "email", width = 20) + private String email; + + @ExcelAttribute(sort = 8) + @Excel(name = "失败原因", orderNum = "8", isImportField = "failureMsg", width = 50) + private String failureMsg; +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/vo/LogManagementListVo.java b/nakadai/src/main/java/com/huoran/nakadai/entity/vo/LogManagementListVo.java new file mode 100644 index 0000000..e988584 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/vo/LogManagementListVo.java @@ -0,0 +1,32 @@ +package com.huoran.nakadai.entity.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +/** + * @Author chen + * @DATE 2022/3/7 16:45 + * @Version 1.0 + */ +@Data +public class LogManagementListVo { + + @ApiModelProperty(value = "平台名称(1职站,2数据,3中台)") + private Integer platformId; + + @ApiModelProperty(value = "最新版本名称") + private String versionName; + + @ApiModelProperty(value = "版本状态,0已发布,1为草稿") + private Integer draft; + + @ApiModelProperty(value = "版本数") + private String versionNum; + + @ApiModelProperty(value = "更新时间") + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date updateTime; +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/vo/MessageNotificationVo.java b/nakadai/src/main/java/com/huoran/nakadai/entity/vo/MessageNotificationVo.java new file mode 100644 index 0000000..a5a2e5f --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/vo/MessageNotificationVo.java @@ -0,0 +1,34 @@ +package com.huoran.nakadai.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +@Data +public class MessageNotificationVo { + + @ApiModelProperty(value = "通知ids") + private String notifyId; + + @ApiModelProperty(value = "消息类型:1、点赞 2、回复 ") + private Integer type; + + @ApiModelProperty(value = "消息是否已读 0未读 1已读") + private Integer isRead; + + @ApiModelProperty(value = "评论id") + private Integer commentId; + + @ApiModelProperty("回复时间") + private Date createTime; + + @ApiModelProperty(value = "回复评论账号名称") + private String commentUsername; + + @ApiModelProperty(value = "课程id") + private Integer mallId; + + @ApiModelProperty(value = "评论内容") + private String content; +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/vo/OrderRenewVo.java b/nakadai/src/main/java/com/huoran/nakadai/entity/vo/OrderRenewVo.java new file mode 100644 index 0000000..72fb92b --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/vo/OrderRenewVo.java @@ -0,0 +1,35 @@ +package com.huoran.nakadai.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + * @Author chen + * @DATE 2021/8/2 14:43 + * @Version 1.0 + */ +@Data +public class OrderRenewVo { + + private static final long serialVersionUID = 64715584341L; + + @ApiModelProperty(value = "客户id") + @NotNull(message = "请先选择客户再选择产品") + private Integer customerId; + + @ApiModelProperty(value = "0为数据平台权限,1为课程权限") + @NotNull(message = "权限不能为空") + private Integer authority; + + @ApiModelProperty(value = "订单id") + private Integer orderId; + + @ApiModelProperty(value = "产品 id") + @NotEmpty(message = "产品id不能为空") + private List productId; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/vo/OrderVo.java b/nakadai/src/main/java/com/huoran/nakadai/entity/vo/OrderVo.java new file mode 100644 index 0000000..f75a65d --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/vo/OrderVo.java @@ -0,0 +1,33 @@ +package com.huoran.nakadai.entity.vo; + +import com.huoran.nakadai.entity.HrContractInformation; +import com.huoran.nakadai.entity.Order; +import com.huoran.nakadai.entity.OrderOther; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.util.List; + +/** + * @Author chen + * @DATE 2021/7/1 15:09 + * @Version 1.0 + */ +@Data +public class OrderVo implements Serializable { + + private static final long serialVersionUID = 6471558434681123441L; + + @ApiModelProperty(value = "订单基本数据") + private Order order; + + @ApiModelProperty(value = "订单其他数据") + @NotEmpty(message = "产品不能为空") + private List orderOther; + + @ApiModelProperty(value = "合同信息") + private HrContractInformation contractInformation; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/vo/SortVO.java b/nakadai/src/main/java/com/huoran/nakadai/entity/vo/SortVO.java new file mode 100644 index 0000000..6c21085 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/vo/SortVO.java @@ -0,0 +1,19 @@ +package com.huoran.nakadai.entity.vo; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Author chen + * @DATE 2020/10/15 9:01 + * @Version 1.0 + */ +@Data +public class SortVO implements Serializable { + + private static final long serialVersionUID = 1L; + + private List chapterVOList; +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/vo/SubsectionVO.java b/nakadai/src/main/java/com/huoran/nakadai/entity/vo/SubsectionVO.java new file mode 100644 index 0000000..13ddc2c --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/vo/SubsectionVO.java @@ -0,0 +1,58 @@ +package com.huoran.nakadai.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author chen + * @DATE 2020/10/10 9:37 + * @Version 1.0 + * 小节封装对象 + */ +@Data +public class SubsectionVO implements Serializable { + + private static final long serialVersionUID = 1L; + + + @ApiModelProperty(value = "小节ID") + private Integer id; + + @ApiModelProperty(value = "章节ID") + private Integer chapterId; + + @ApiModelProperty(value = "小节名称") + private String name; + + @ApiModelProperty(value = "原始文件名称") + private String originalFileName; + + @ApiModelProperty(value = "阿里云文件名称") + private String fileName; + + @ApiModelProperty(value = "资源文件ID") + private String fileId; + + @ApiModelProperty(value = "文件存储路径") + private String fileUrl; + + @ApiModelProperty(value = "资源文件类型") + private String fileType; + + @ApiModelProperty(value = "排序字段") + private Integer sort; + + + @ApiModelProperty(value = "是否学习(0未学习 1已学习)") + private Integer whetherToStudyOrNot; + + + + + @ApiModelProperty(value = "学习进展id") + private Integer learningProgressId; + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/vo/TeamMemberVo.java b/nakadai/src/main/java/com/huoran/nakadai/entity/vo/TeamMemberVo.java new file mode 100644 index 0000000..ace39d4 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/vo/TeamMemberVo.java @@ -0,0 +1,9 @@ +package com.huoran.nakadai.entity.vo; + +import lombok.Data; + +@Data +public class TeamMemberVo { + Integer teamId; + String name; +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/vo/WxMssVo.java b/nakadai/src/main/java/com/huoran/nakadai/entity/vo/WxMssVo.java new file mode 100644 index 0000000..e5d813c --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/vo/WxMssVo.java @@ -0,0 +1,35 @@ +package com.huoran.nakadai.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.HashMap; + +@Data +public class WxMssVo { + //小程序用户的OpenId + @ApiModelProperty("openId") + private String touser; + //模板id + @ApiModelProperty("模板ID") + private String template_id; + //跳转首页 + @ApiModelProperty("跳转首页route") + private String page; + //接口凭证 + @ApiModelProperty("接口凭证") + private String access_token; + //环境状态 + @ApiModelProperty("环境状态") + private String miniprogram_state; + //语言 + @ApiModelProperty("语言") + private String lang; + //请求路径 + @ApiModelProperty("请求路径") + private String request_url; + //放置数据 + @ApiModelProperty("详细内容") + private HashMap map = new HashMap<>(3); + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/CityMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/CityMapper.java new file mode 100644 index 0000000..ecca806 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/CityMapper.java @@ -0,0 +1,18 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.nakadai.entity.City; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + *

+ * 城市 Mapper 接口 + *

+ * + * @author huoran + * @since 2021-06-29 + */ +@Mapper +public interface CityMapper extends BaseMapper { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/CommentLikeMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/CommentLikeMapper.java new file mode 100644 index 0000000..05ac251 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/CommentLikeMapper.java @@ -0,0 +1,16 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.nakadai.entity.CommentLike; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 课程评论点赞表 Mapper 接口 + *

+ * + * @author chen + * @since 2023-05-25 + */ +public interface CommentLikeMapper extends BaseMapper { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/CommentMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/CommentMapper.java new file mode 100644 index 0000000..533d64c --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/CommentMapper.java @@ -0,0 +1,23 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.nakadai.entity.Comment; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.nakadai.entity.res.CommentRes; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 课程评论回复表 Mapper 接口 + *

+ * + * @author chen + * @since 2023-05-25 + */ +public interface CommentMapper extends BaseMapper { + + List findByParentId(@Param("pid") int pid,@Param("mallId") Integer mallId,@Param("schoolId") Integer schoolId,@Param("accountId") String accountId); + + String selectTeacherAdministrator(@Param("accountId") String accountId); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/CourseMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/CourseMapper.java new file mode 100644 index 0000000..cc1cc76 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/CourseMapper.java @@ -0,0 +1,18 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.nakadai.entity.Course; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + *

+ * 课程表 Mapper 接口 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@Mapper +public interface CourseMapper extends BaseMapper { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/CurriculumChapterMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/CurriculumChapterMapper.java new file mode 100644 index 0000000..67ea7b8 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/CurriculumChapterMapper.java @@ -0,0 +1,34 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.nakadai.entity.CurriculumChapter; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 企业课程章节表 Mapper 接口 + *

+ * + * @author lr + * @since 2021-09-26 + */ +public interface CurriculumChapterMapper extends BaseMapper { + Integer selectMaxSort(); + + Integer selectMinSort(); + + /** + * 查询上一章节 + * + * @param currentChapterId 当前章节id + * @return 上一章节id + */ + String selectPreviousChapter(String currentChapterId); + + /** + * 查询下一章节 + * + * @param currentChapterId 当前章节id + * @return 下一章节id + */ + String selectNextChapter(String currentChapterId); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/CurriculumConfigureMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/CurriculumConfigureMapper.java new file mode 100644 index 0000000..5f7c990 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/CurriculumConfigureMapper.java @@ -0,0 +1,43 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.common.entity.ProjectManage; +import com.huoran.nakadai.entity.Curriculum; +import com.huoran.nakadai.entity.CurriculumConfigure; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.nakadai.entity.res.CourseByProjectInfoRes; +import com.huoran.nakadai.entity.res.CurriculumDetailRes; +import org.apache.ibatis.annotations.Param; +import org.springframework.web.bind.annotation.RequestParam; + +import java.util.List; + +/** + *

+ * 课程配置表 Mapper 接口 + *

+ * + * @author lr + * @since 2021-09-17 + */ +public interface CurriculumConfigureMapper extends BaseMapper { + List projectListByCourseId(@RequestParam @Param("cid") Integer cid, + @RequestParam @Param("permissions") Integer permissions, + @RequestParam @Param("projectName") String projectName); + + List getCurriculumConfigure(@RequestParam @Param("cid") Integer cid, @RequestParam @Param("permissions") Integer permissions); + + String checkConfig(@RequestParam @Param("projectId") Integer projectId); + + String getConfigureSystemId(@RequestParam @Param("cid") Integer cid); + + List getProjectBySystemIdRemoteCall(@Param("systemId")String systemId, + @Param("accountId") Integer accountId, + @Param("permissions")Integer permissions, + @Param("cid")Integer cId, + @Param("mallId")Integer mallId, + @Param("schoolId")Integer schoolId); + + List selectCurriculumProject(@Param("schoolId") Integer schoolId, @Param("systemId") String systemId, @Param("permissions") Integer permissions, @Param("cId") Integer cId); + + ProjectManage projectIdGetDetails(@Param("projectId") Integer projectId); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/CurriculumLearningProgressMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/CurriculumLearningProgressMapper.java new file mode 100644 index 0000000..bbe2a4d --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/CurriculumLearningProgressMapper.java @@ -0,0 +1,16 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.nakadai.entity.CurriculumLearningProgress; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 课程学习进度 Mapper 接口 + *

+ * + * @author chen + * @since 2023-04-25 + */ +public interface CurriculumLearningProgressMapper extends BaseMapper { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/CurriculumMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/CurriculumMapper.java new file mode 100644 index 0000000..8363573 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/CurriculumMapper.java @@ -0,0 +1,45 @@ +package com.huoran.nakadai.mapper; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.nakadai.entity.Curriculum; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.nakadai.entity.req.PageCurriculumReq; +import com.huoran.nakadai.entity.res.CurriculumRes; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Set; + +/** + *

+ * 课程管理 Mapper 接口 + *

+ * + * @author lr + * @since 2021-09-16 + */ +public interface CurriculumMapper extends BaseMapper { + + IPage curriculumList(Page page, @Param("req") PageCurriculumReq req); + + + /** + * 根据客户id获取订单中所有的系统 + * @param customerId + * @return + */ + Set getSystemIdByCustomerId(Integer customerId); + + Curriculum selectCurriculum(@Param("cid") Integer cid); + + List selectCurriculumBySupplier(@Param("supplierId") String supplierId); + + int selectAssociatedListedGoods(@Param("cid")Integer cid); + + String selectDetailedIntroduction(@Param("cid")Integer cid); + + Curriculum courseListDeletedNotDeleted(@Param("cid")Integer cid); + + List selectProductCurriculum(); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/CurriculumNotesMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/CurriculumNotesMapper.java new file mode 100644 index 0000000..b6217dd --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/CurriculumNotesMapper.java @@ -0,0 +1,16 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.nakadai.entity.CurriculumNotes; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 课程笔记表 Mapper 接口 + *

+ * + * @author chen + * @since 2023-05-04 + */ +public interface CurriculumNotesMapper extends BaseMapper { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/CurriculumRecentUseMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/CurriculumRecentUseMapper.java new file mode 100644 index 0000000..2cab24b --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/CurriculumRecentUseMapper.java @@ -0,0 +1,21 @@ +package com.huoran.nakadai.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.nakadai.entity.CurriculumRecentUse; +import com.huoran.nakadai.entity.req.PageCurriculumRecentUseReq; +import com.huoran.nakadai.entity.res.SchoolCourseRes; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author chen + * @since 2023-04-19 + */ +public interface CurriculumRecentUseMapper extends BaseMapper { + IPage recentUse(Page page, @Param("req") PageCurriculumRecentUseReq req); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/CurriculumSubsectionMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/CurriculumSubsectionMapper.java new file mode 100644 index 0000000..5dbedd6 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/CurriculumSubsectionMapper.java @@ -0,0 +1,34 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.nakadai.entity.CurriculumSubsection; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 企业课程小节表 Mapper 接口 + *

+ * + * @author lr + * @since 2021-09-26 + */ +public interface CurriculumSubsectionMapper extends BaseMapper { + Integer selectMaxSort(); + + Integer selectMinSort(); + + /** + * 查询上一小节 + * + * @param currentSubsectionId 当前小节id + * @return 上一小节id + */ + String selectPreviousSubsection(String currentSubsectionId); + + /** + * 查询下一小节 + * + * @param currentSubsectionId 当前小节id + * @return 下一小节id + */ + String selectNextSubsection(String currentSubsectionId); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/CustomerMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/CustomerMapper.java new file mode 100644 index 0000000..d04e274 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/CustomerMapper.java @@ -0,0 +1,85 @@ +package com.huoran.nakadai.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.nakadai.entity.Customer; +import com.huoran.nakadai.entity.HrUserAccount; +import com.huoran.nakadai.entity.UserAccount; +import com.huoran.nakadai.entity.req.CustomerListReq; +import com.huoran.nakadai.entity.req.ListOfClientCommercialManagersReq; +import com.huoran.nakadai.entity.req.SalesProgressReq; +import com.huoran.nakadai.entity.res.AnnualOperatingAnalysisResp; +import com.huoran.nakadai.entity.res.AppletsMyClientsForBusinessResp; +import com.huoran.nakadai.entity.res.CustomerListRes; +import com.huoran.nakadai.entity.res.CustomerRes; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.HashSet; +import java.util.List; + +/** + *

+ * 客户表 Mapper 接口 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@Mapper +public interface CustomerMapper extends BaseMapper { + + IPage pageByCondition(@Param("page") Page page, @Param("customerListReq") CustomerListReq customerListReq); + + CustomerRes selectCustomer(Integer customerId); + + int delCustomers(@Param("ids") List ids); + + boolean insertUserAccount(HrUserAccount account); + + int queryAccountExists(String account); + + int updatePwdByCustomerId(HrUserAccount hrUserAccount); + + boolean updateDelById(Integer customerId); + + boolean updateAccountById(@Param("customerId") Integer customerId, @Param("account") String account); + + boolean delAccountsById(@Param("ids") List ids); + + boolean delDataRecords(@Param("schoolId") Integer schoolId); + + boolean updateUserInfo(@Param("schoolId") Integer schoolId); + + boolean updateAccount(Integer schoolId); + + List selectSchoolIds(@Param("ids") List ids); + + boolean delDataRecordsBySchoolIds(@Param("schoolIds") List schoolIds); + + boolean updateUserInfoBySchoolIds(@Param("schoolIds") List schoolIds); + + boolean updateAccountBySchoolIds(@Param("schoolIds") List schoolIds); + + int updateCustomerByRoleId(@Param("customerId") Integer customerId, @Param("roleId") String roleId); + + List checkEmailOrPhone(@Param("customer")Customer customer); + + UserAccount selectCustomerAccount(Integer customerId); + + void updateAccountCustomer(UserAccount userAccount); + + + IPage getCustomerListBasedOnBusinessManagerId(Page page, @Param("req") ListOfClientCommercialManagersReq req); + + List selectDataPermissionCustomer(@Param("orderIds") HashSet orderIds); + + //订单新增客户 + Integer getNewCustomerOnOrder(@Param("req")SalesProgressReq req); + + //订单新增产品 + Integer getNewProductAddedToOrder(@Param("req")SalesProgressReq req); + + AnnualOperatingAnalysisResp annualOperatingAnalysis(@Param("req")SalesProgressReq req); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/CustomsPassMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/CustomsPassMapper.java new file mode 100644 index 0000000..ede71bc --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/CustomsPassMapper.java @@ -0,0 +1,22 @@ +package com.huoran.nakadai.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.nakadai.entity.CustomsPass; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 沙盘-关卡表 Mapper 接口 + *

+ * + * @author chen + * @since 2023-10-26 + */ +public interface CustomsPassMapper extends BaseMapper { + + List checkPointList(@Param("schoolId") Integer schoolId, @Param("accountId") Integer accountId, + @Param("projectId") Integer projectId, @Param("displayCollection") Integer displayCollection); + Integer maximumSequenceNumber(); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/DataProductMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/DataProductMapper.java new file mode 100644 index 0000000..12356b5 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/DataProductMapper.java @@ -0,0 +1,25 @@ +package com.huoran.nakadai.mapper; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.nakadai.entity.DataProduct; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.nakadai.entity.req.MiniProgramProductsReq; +import com.huoran.nakadai.entity.res.AppletsDataProductResp; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 数据平台产品表 Mapper 接口 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@Mapper +public interface DataProductMapper extends BaseMapper { + + IPage AppletsDataProductList(Page page, @Param("req") MiniProgramProductsReq req); + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/DisciplineLevelMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/DisciplineLevelMapper.java new file mode 100644 index 0000000..c217893 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/DisciplineLevelMapper.java @@ -0,0 +1,18 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.nakadai.entity.DisciplineLevel; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + *

+ * 学科层次 Mapper 接口 + *

+ * + * @author huoran + * @since 2021-07-09 + */ +@Mapper +public interface DisciplineLevelMapper extends BaseMapper { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/DisciplineMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/DisciplineMapper.java new file mode 100644 index 0000000..da093c1 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/DisciplineMapper.java @@ -0,0 +1,23 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.nakadai.entity.Discipline; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.mapstruct.Mapper; + +import java.util.List; + +/** + *

+ * 学科 Mapper 接口 + *

+ * + * @author lr + * @since 2021-09-17 + */ +@Mapper +public interface DisciplineMapper extends BaseMapper { + + List disciplineLevel(); + + List subjectCategoryCited(); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/EduCurriculumChapterMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/EduCurriculumChapterMapper.java new file mode 100644 index 0000000..d4e7c37 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/EduCurriculumChapterMapper.java @@ -0,0 +1,16 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.nakadai.entity.EduCurriculumChapter; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 课程章节 Mapper 接口 + *

+ * + * @author lr + * @since 2021-09-26 + */ +public interface EduCurriculumChapterMapper extends BaseMapper { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/HrContractInformationMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/HrContractInformationMapper.java new file mode 100644 index 0000000..942e3b8 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/HrContractInformationMapper.java @@ -0,0 +1,22 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.nakadai.entity.HrContractInformation; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.nakadai.entity.res.ContractInformationsRes; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + *

+ * 合同信息表 Mapper 接口 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@Mapper +public interface HrContractInformationMapper extends BaseMapper { + + List selectContractInfo(Integer customerId); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/HrCoursePermissionsMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/HrCoursePermissionsMapper.java new file mode 100644 index 0000000..659dbf2 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/HrCoursePermissionsMapper.java @@ -0,0 +1,22 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.nakadai.entity.HrCoursePermissions; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.nakadai.entity.res.CoursePermissionssRes; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + *

+ * 课程权限表 Mapper 接口 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@Mapper +public interface HrCoursePermissionsMapper extends BaseMapper { + +// List seletCoursePermissions(Integer customerId); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/HrDataPermissionsMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/HrDataPermissionsMapper.java new file mode 100644 index 0000000..5e83a1c --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/HrDataPermissionsMapper.java @@ -0,0 +1,22 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.nakadai.entity.HrDataPermissions; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.nakadai.entity.res.DataPermissionssRes; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + *

+ * 数据平台权限表 Mapper 接口 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@Mapper +public interface HrDataPermissionsMapper extends BaseMapper { + +// List seletDataPermissions(Integer customerId); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/HrIndustryClassMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/HrIndustryClassMapper.java new file mode 100644 index 0000000..0443712 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/HrIndustryClassMapper.java @@ -0,0 +1,18 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.nakadai.entity.HrIndustryClass; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + *

+ * 行业类 Mapper 接口 + *

+ * + * @author huoran + * @since 2021-06-29 + */ +@Mapper +public interface HrIndustryClassMapper extends BaseMapper { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/HrIndustryMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/HrIndustryMapper.java new file mode 100644 index 0000000..2ad3003 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/HrIndustryMapper.java @@ -0,0 +1,18 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.nakadai.entity.HrIndustry; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + *

+ * 行业 Mapper 接口 + *

+ * + * @author huoran + * @since 2021-06-29 + */ +@Mapper +public interface HrIndustryMapper extends BaseMapper { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/HrLogMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/HrLogMapper.java new file mode 100644 index 0000000..755e450 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/HrLogMapper.java @@ -0,0 +1,22 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.nakadai.entity.HrLog; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.nakadai.entity.vo.LogManagementListVo; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author chen + * @since 2022-03-04 + */ +public interface HrLogMapper extends BaseMapper { + + List selectManagementList(); + + List selectAllAccount(Integer platformId); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/HrMallMarketingPromotionMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/HrMallMarketingPromotionMapper.java new file mode 100644 index 0000000..f46004d --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/HrMallMarketingPromotionMapper.java @@ -0,0 +1,16 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.nakadai.entity.HrMallMarketingPromotion; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author chen + * @since 2023-04-25 + */ +public interface HrMallMarketingPromotionMapper extends BaseMapper { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/HrStaffAccountArchitectureMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/HrStaffAccountArchitectureMapper.java new file mode 100644 index 0000000..ffcea82 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/HrStaffAccountArchitectureMapper.java @@ -0,0 +1,19 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.nakadai.entity.HrStaffAccountArchitecture; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +import java.util.List; + +/** + *

+ * 中台账号组织架构 Mapper 接口 + *

+ * + * @author chen + * @since 2022-03-22 + */ +public interface HrStaffAccountArchitectureMapper extends BaseMapper { + + List selectIdByPid(Integer id); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/HrStaffDepartmentMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/HrStaffDepartmentMapper.java new file mode 100644 index 0000000..3196a14 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/HrStaffDepartmentMapper.java @@ -0,0 +1,16 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.nakadai.entity.HrStaffDepartment; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author chen + * @since 2022-03-23 + */ +public interface HrStaffDepartmentMapper extends BaseMapper { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/HrStaffMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/HrStaffMapper.java new file mode 100644 index 0000000..8ebaa8c --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/HrStaffMapper.java @@ -0,0 +1,48 @@ +package com.huoran.nakadai.mapper; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.nakadai.entity.HrStaff; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.nakadai.entity.UserAccount; +import com.huoran.nakadai.entity.UserInfo; +import com.huoran.nakadai.entity.req.StaffListReq; +import com.huoran.nakadai.entity.res.StaffResp; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 中台后台员工账号表 Mapper 接口 + *

+ * + * @author chen + * @since 2022-03-22 + */ +public interface HrStaffMapper extends BaseMapper { + + int addUserInfo(UserInfo userInfo); + + int addUserAccount(UserAccount userAccount); + + IPage staffList(Page page, @Param("req") StaffListReq req); + + StaffResp staffDetail(Integer accountId); + + Integer getUserId(Integer accountId); + + boolean modifyUserInfo(UserInfo userInfo); + + boolean modifyUserAccount(UserAccount userAccount); + + Integer delRoleByAccountId(Integer accountId); + + List checkUserAccount(UserAccount checkAccount); + + String selectUserNameById(Integer userId); + + List selectRolesByAccountId(Integer accountId1); + + Integer checkAccount(String account); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/LogContentMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/LogContentMapper.java new file mode 100644 index 0000000..11459e5 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/LogContentMapper.java @@ -0,0 +1,16 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.nakadai.entity.LogContent; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author chen + * @since 2022-03-08 + */ +public interface LogContentMapper extends BaseMapper { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/MallAnnexMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/MallAnnexMapper.java new file mode 100644 index 0000000..ef87fcb --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/MallAnnexMapper.java @@ -0,0 +1,16 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.nakadai.entity.MallAnnex; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 商品附件表 Mapper 接口 + *

+ * + * @author chen + * @since 2023-05-06 + */ +public interface MallAnnexMapper extends BaseMapper { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/MallClassificationMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/MallClassificationMapper.java new file mode 100644 index 0000000..d744c37 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/MallClassificationMapper.java @@ -0,0 +1,18 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.nakadai.entity.MallClassification; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + *

+ * 商品分类关联表 Mapper 接口 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@Mapper +public interface MallClassificationMapper extends BaseMapper { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/MallCourseLearningRecordMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/MallCourseLearningRecordMapper.java new file mode 100644 index 0000000..2e2b1b0 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/MallCourseLearningRecordMapper.java @@ -0,0 +1,16 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.nakadai.entity.MallCourseLearningRecord; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 商品课程学习记录 Mapper 接口 + *

+ * + * @author chen + * @since 2023-04-26 + */ +public interface MallCourseLearningRecordMapper extends BaseMapper { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/MallDisciplineMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/MallDisciplineMapper.java new file mode 100644 index 0000000..d4efb20 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/MallDisciplineMapper.java @@ -0,0 +1,18 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.nakadai.entity.MallDiscipline; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + *

+ * 商品学科类别关联表 Mapper 接口 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@Mapper +public interface MallDisciplineMapper extends BaseMapper { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/MallMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/MallMapper.java new file mode 100644 index 0000000..826bb16 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/MallMapper.java @@ -0,0 +1,45 @@ +package com.huoran.nakadai.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.nakadai.entity.Mall; +import com.huoran.nakadai.entity.PartnerArticleClassification; +import com.huoran.nakadai.entity.req.GoodsListReq; +import com.huoran.nakadai.entity.res.GoodsRes; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 商城管理表 Mapper 接口 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@Mapper +public interface MallMapper extends BaseMapper { + + IPage goodsList(Page page,@Param("req") GoodsListReq goodsListReq); + + List schoolGoods(@Param("schoolId")Integer schoolId); + + GoodsRes selectGoods(@Param("mallId")Integer mallId); + + String selectSystem(@Param("cid")Integer cid, @Param("permissions")int permissions); + + List selectGoodsList(); + + List schoolCourseIds(@Param("schoolId")Integer schoolId); + + String selectMallSystem(@Param("associatedProduct") String associatedProduct); + + List selectAssociationScheme(); + + String selectAssociationMall(@Param("schemeId")String schemeId); + + IPage websiteProductList(Page page, @Param("req") GoodsListReq goodsListReq); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/MallNonAssociatedLinksMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/MallNonAssociatedLinksMapper.java new file mode 100644 index 0000000..443bb6c --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/MallNonAssociatedLinksMapper.java @@ -0,0 +1,18 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.nakadai.entity.MallNonAssociatedLinks; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.mapstruct.Mapper; + +/** + *

+ * 非关联产品链接 Mapper 接口 + *

+ * + * @author chen + * @since 2023-05-15 + */ +@Mapper +public interface MallNonAssociatedLinksMapper extends BaseMapper { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/MallPriceMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/MallPriceMapper.java new file mode 100644 index 0000000..bb3417e --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/MallPriceMapper.java @@ -0,0 +1,18 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.nakadai.entity.MallPrice; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + *

+ * 商品价格表 Mapper 接口 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@Mapper +public interface MallPriceMapper extends BaseMapper { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/MallSupplierMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/MallSupplierMapper.java new file mode 100644 index 0000000..30abdf7 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/MallSupplierMapper.java @@ -0,0 +1,18 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.nakadai.entity.MallSupplier; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + *

+ * 商品供应商关联表 Mapper 接口 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@Mapper +public interface MallSupplierMapper extends BaseMapper { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/MallTagsMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/MallTagsMapper.java new file mode 100644 index 0000000..3df2914 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/MallTagsMapper.java @@ -0,0 +1,18 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.nakadai.entity.MallTags; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + *

+ * 商品分类标签关联表 Mapper 接口 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@Mapper +public interface MallTagsMapper extends BaseMapper { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/MallTypeMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/MallTypeMapper.java new file mode 100644 index 0000000..9f6b850 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/MallTypeMapper.java @@ -0,0 +1,18 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.nakadai.entity.MallType; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + *

+ * 商品类型关联表 Mapper 接口 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@Mapper +public interface MallTypeMapper extends BaseMapper { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/ModelDemoHiddenMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/ModelDemoHiddenMapper.java new file mode 100644 index 0000000..51f2312 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/ModelDemoHiddenMapper.java @@ -0,0 +1,16 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.nakadai.entity.ModelDemoHidden; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 此表是在教师端系统管理,可对于系统内置模型统一管理 Mapper 接口 + *

+ * + * @author chen + * @since 2023-06-03 + */ +public interface ModelDemoHiddenMapper extends BaseMapper { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/ModelReferenceCategoryMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/ModelReferenceCategoryMapper.java new file mode 100644 index 0000000..d258dfc --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/ModelReferenceCategoryMapper.java @@ -0,0 +1,16 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.nakadai.entity.ModelReferenceCategory; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 引用模型-分类表 Mapper 接口 + *

+ * + * @author chen + * @since 2022-03-04 + */ +public interface ModelReferenceCategoryMapper extends BaseMapper { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/ModelReferenceDemoMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/ModelReferenceDemoMapper.java new file mode 100644 index 0000000..a36f91b --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/ModelReferenceDemoMapper.java @@ -0,0 +1,37 @@ +package com.huoran.nakadai.mapper; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.nakadai.entity.ModelReferenceDemo; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.nakadai.entity.ModelSysDemo; +import com.huoran.nakadai.entity.req.PageImportModelReq; +import com.huoran.nakadai.entity.req.PageModelReq; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 引用模型代码记录表 Mapper 接口 + *

+ * + * @author chen + * @since 2022-03-04 + */ +public interface ModelReferenceDemoMapper extends BaseMapper { + IPage referenceDemoList(Page page, @Param("req") PageModelReq req); + + IPage sortReadingModelByTeacherSideSystem(Page page, @Param("req") PageModelReq req); + + IPage getAllModelList(Page page, @Param("req") PageImportModelReq req); + + IPage teacherModelList(Page page, @Param("req") PageImportModelReq req); + + + IPage referenceDemoListByNakadai(Page page, @Param("req") PageModelReq req); + + IPage studentModelList(Page page, @Param("req") PageImportModelReq req); + + + //教师端:读取中台的模型列表的数据 + IPage systemModelByTeacher(Page page, @Param("req") PageImportModelReq req); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/ModelSysCategoryMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/ModelSysCategoryMapper.java new file mode 100644 index 0000000..7adc2e7 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/ModelSysCategoryMapper.java @@ -0,0 +1,28 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.nakadai.entity.ModelSysCategory; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 源模型-分类表 Mapper 接口 + *

+ * + * @author chen + * @since 2022-03-03 + */ +public interface ModelSysCategoryMapper extends BaseMapper { + List getCategoryByLevel(Integer level); + + Integer getMaxLevel(); + + ModelSysCategory getLevelByZero(Integer level); + + List primaryClassification(); + + + List getsTheChildLevelUnderTheParent( @Param("schoolId")Integer schoolId); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/ModelSysDemoMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/ModelSysDemoMapper.java new file mode 100644 index 0000000..7910dad --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/ModelSysDemoMapper.java @@ -0,0 +1,32 @@ +package com.huoran.nakadai.mapper; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.ModelSysDemo; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.nakadai.entity.req.PageCurriculumReq; +import com.huoran.nakadai.entity.req.PageModelReq; +import com.huoran.nakadai.entity.res.CurriculumRes; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author chen + * @since 2022-03-04 + */ +public interface ModelSysDemoMapper extends BaseMapper { + + IPage sysModelDemoList(Page page, @Param("req") PageModelReq req); + + IPage getAllModelListBySys(Page page, @Param("req") PageModelReq req); + + IPage InstitutionSourceModel(Page page, @Param("req") PageModelReq req); + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/NotifyMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/NotifyMapper.java new file mode 100644 index 0000000..a2c78d1 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/NotifyMapper.java @@ -0,0 +1,23 @@ +package com.huoran.nakadai.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.nakadai.entity.Notify; +import com.huoran.nakadai.entity.vo.MessageNotificationVo; +import org.apache.ibatis.annotations.Param; +import org.mapstruct.Mapper; + +import java.util.List; + +/** + *

+ * 消息通知表 Mapper 接口 + *

+ * + * @author chen + * @since 2023-05-29 + */ +@Mapper +public interface NotifyMapper extends BaseMapper { + + List messageNotificationList(@Param("accountId") String accountId, @Param("type")Integer type); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/OrderMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/OrderMapper.java new file mode 100644 index 0000000..41023e7 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/OrderMapper.java @@ -0,0 +1,75 @@ +package com.huoran.nakadai.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.nakadai.entity.Order; +import com.huoran.nakadai.entity.req.ListOfClientCommercialManagersReq; +import com.huoran.nakadai.entity.req.OrderListReq; +import com.huoran.nakadai.entity.req.OrderRecordParametersReq; +import com.huoran.nakadai.entity.req.SalesProgressReq; +import com.huoran.nakadai.entity.res.AnnualOperatingAnalysisResp; +import com.huoran.nakadai.entity.res.SchoolCourseRes; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.HashSet; +import java.util.List; + +/** + *

+ * 订单表 Mapper 接口 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@Mapper +public interface OrderMapper extends BaseMapper { + + List selectOrderPage(OrderListReq orderListReq); + + int selectTotalNum(OrderListReq orderListReq); + + List schoolCourse(@Param("schoolId") Integer schoolId); + + List getSchoolEffectiveCourse(@Param("schoolId") Integer schoolId); + + List schoolCourseByAchievement(@Param("schoolId") Integer schoolId); + + void updateCustomer(@Param("customerId")Integer customerId,@Param("platformId")String platformId); + + String selectCustomerPlatformId(Integer customerId); + + int selectCustomerPlatformPermission(@Param("customerId")Integer customerId,@Param("platformId") Integer platformId); + + int selectCustomerSchool(@Param("customerId")Integer customerId); + + String selectCustomerIdByAccountId(@Param("customerId")Integer customerId); + + String selectCustomerExpireDate(Integer customerId); + + IPage getOrderBasedOnBusinessManagerId(Page page, @Param("req") ListOfClientCommercialManagersReq req); + + String selectCity(Integer cityId,Integer provinceId); + + String selectProvince(Integer provinceId); + + + IPage miniProgramOrderRecord(Page page, @Param("req") OrderRecordParametersReq req); + + + SchoolCourseRes whetherToRenewTheFee(@Param("schoolId") Integer schoolId,@Param("mallId") Integer mallId); + + HashSet dataPermissionOrderId(@Param("cIds") List cIds); + + HashSet dataPermissionOrderIdByDataProduct(@Param("supplierId") String supplierId); + + HashSet valuePermissionOrderIds(); + + AnnualOperatingAnalysisResp income(@Param("req") SalesProgressReq req); + + String selectOpenid(@Param("accountId")Integer accountId); + + HashSet selectGoodsOrderId(@Param("supplierId")String supplierId); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/OrderOtherMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/OrderOtherMapper.java new file mode 100644 index 0000000..f971384 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/OrderOtherMapper.java @@ -0,0 +1,56 @@ +package com.huoran.nakadai.mapper; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.ModelSysDemo; +import com.huoran.nakadai.entity.OrderOther; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.nakadai.entity.ServiceConfiguration; +import com.huoran.nakadai.entity.req.GetTheSystemUnderTheProductReq; +import com.huoran.nakadai.entity.req.ListOfClientCommercialManagersReq; +import com.huoran.nakadai.entity.req.QueryTimeReq; +import com.huoran.nakadai.entity.res.*; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.springframework.web.bind.annotation.RequestParam; + +import java.util.List; + +/** + *

+ * 订单其他信息(包含课程权限、数据平台权限、合同信息等) Mapper 接口 + *

+ * + * @author cheney + * @since 2021-07-01 + */ +@Mapper +public interface OrderOtherMapper extends BaseMapper { + + List selectCoursePermissions(Integer customerId); + + List selectDataPermissions(Integer customerId); + + //查询剩余天数 + List remainingDay(); + + Integer isTimePeriod(QueryTimeReq queryTimeReq); + + String OrderOtherEndTime(QueryTimeReq queryTimeReq); + + List selectOtherList(QueryTimeReq queryTimeReq); + + List getProductsSubscribedByCustomers(@Param("customerId") Integer customerId); + + List permissionToGetOrders(@Param("customerId") Integer customerId, @Param("authority") Integer authority, @Param("mallId") Integer mallId); + + IPage getAListOfClientBusinessManagersByCustomerId(Page page, @Param("req")ListOfClientCommercialManagersReq req); + + String getTheProductPurchasedByTheBusinessManager(@Param("businessManagerId")Integer businessManagerId,@Param("customerId") Integer customerId,@Param("teamIds")List teamIds); + + IPage getBusinessManagerOrder(Page page, @Param("req")ListOfClientCommercialManagersReq req); + + + IPage getSystemByCustomers(Page page,@Param("req") GetTheSystemUnderTheProductReq req); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/PartnerAccountMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/PartnerAccountMapper.java new file mode 100644 index 0000000..2e43b14 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/PartnerAccountMapper.java @@ -0,0 +1,72 @@ +package com.huoran.nakadai.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.nakadai.entity.PartnerAccount; +import com.huoran.nakadai.entity.PartnerTeam; +import com.huoran.nakadai.entity.req.PartnerAccountListReq; +import com.huoran.nakadai.entity.res.PartnerAccountResp; +import org.apache.ibatis.annotations.Param; + +import java.util.ArrayList; +import java.util.List; + +/** + *

+ * 合伙人账号表 Mapper 接口 + *

+ * + * @author chen + * @since 2022-05-18 + */ +public interface PartnerAccountMapper extends BaseMapper { + + IPage pagePartnerAccountList(Page page, PartnerAccountListReq req); + + PartnerAccountResp partnerAccountDetail(Integer accountId); + + List getTeamsByAccountId(@Param("accountId") Integer accountId); + + Integer selectAdmin(@Param("platform") Integer platform,@Param("port") Integer port,@Param("roleName") String roleName); + + Integer selectAccount(String phone); + + Integer checkAccount(String account); + + Integer selectMember(@Param("platform") Integer platform,@Param("port") Integer port); + + Integer selectRoleExist(@Param("accountId")Integer accountId,@Param("roleId") Integer roleId,@Param("teamId")Integer teamId); + + IPage pagePartnerNotTeamList(Page page, PartnerAccountListReq req); + + String selectTeamRole(@Param("adminTeamId")Integer adminTeamId, @Param("accountId")Integer accountId); + + Integer updateTeamRole(@Param("userRoleId")String userRoleId,@Param("accountId") Integer accountId); + + IPage partnerAccountMergeList(Page page, PartnerAccountListReq req); + + String selectUsername(@Param("accountId")String id); + + IPage teamPartnerList(Page page, PartnerAccountListReq req); + + String area(@Param("teamId")Integer teamId); + + Integer teamSize(@Param("teamId")Integer teamId); + + List teamMembers(@Param("teamId")Integer teamId); + + List selectTeamMembersDetails(@Param("ids")List ids,@Param("name")String name); + + ArrayList selectTeamIdByClassificationId(@Param("partnerClassificationId")String partnerClassificationId); + + Integer selectTeamManager(@Param("accountId") Integer accountId); + + PartnerTeam selectProvinceCity(@Param("partnerId")Integer partnerId,@Param("classificationId") Integer id); + + String selectAccountName(@Param("accountId")String toString); + + List selectUserRole(@Param("accountId")Integer accountId,@Param("teamId") String partnerClassificationId); + + PartnerAccount selectAccountByPartnerId(@Param("partnerId")String businessManagerId); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/PartnerArticleClassificationMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/PartnerArticleClassificationMapper.java new file mode 100644 index 0000000..31620c5 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/PartnerArticleClassificationMapper.java @@ -0,0 +1,20 @@ +package com.huoran.nakadai.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.nakadai.entity.PartnerArticleClassification; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @描述:合伙人——文章管理——文章所属分类 Mapper 接口 + * @作者: Rong + * @日期: 2023-03-16 + */ +@Mapper +public interface PartnerArticleClassificationMapper extends BaseMapper { + + + List categoryIdsQueriesCategoryInformation(@Param("ids") String ids); +} \ No newline at end of file diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/PartnerArticleFileMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/PartnerArticleFileMapper.java new file mode 100644 index 0000000..d1532e3 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/PartnerArticleFileMapper.java @@ -0,0 +1,16 @@ +package com.huoran.nakadai.mapper; + +import org.apache.ibatis.annotations.Mapper; + +import com.huoran.nakadai.entity.PartnerArticleFile; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @描述:合伙人——文章管理——文章附件管理表 Mapper 接口 + * @作者: Rong + * @日期: 2023-03-16 + */ +@Mapper +public interface PartnerArticleFileMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/PartnerArticleLabelMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/PartnerArticleLabelMapper.java new file mode 100644 index 0000000..cb339cb --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/PartnerArticleLabelMapper.java @@ -0,0 +1,18 @@ +package com.huoran.nakadai.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.nakadai.entity.PartnerArticleLabel; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @描述:合伙人——文章管理——文章主题标签 Mapper 接口 + * @作者: Rong + * @日期: 2023-03-16 + */ +@Mapper +public interface PartnerArticleLabelMapper extends BaseMapper { + List idsQueriesLabelInformation(@Param("ids") String ids); +} \ No newline at end of file diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/PartnerArticleManagementCollectMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/PartnerArticleManagementCollectMapper.java new file mode 100644 index 0000000..55f4cb5 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/PartnerArticleManagementCollectMapper.java @@ -0,0 +1,16 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.nakadai.entity.PartnerArticleManagementCollect; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 合伙人——学习收藏表 Mapper 接口 + *

+ * + * @author chen + * @since 2023-04-18 + */ +public interface PartnerArticleManagementCollectMapper extends BaseMapper { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/PartnerArticleManagementMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/PartnerArticleManagementMapper.java new file mode 100644 index 0000000..2a28b3b --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/PartnerArticleManagementMapper.java @@ -0,0 +1,23 @@ +package com.huoran.nakadai.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.nakadai.entity.PartnerArticleManagement; +import com.huoran.nakadai.entity.req.PagePartnerArticleManagementReq; +import com.huoran.nakadai.entity.res.PartnerArticleManagementResp; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @描述:合伙人——文章管理 Mapper 接口 + * @作者: Rong + * @日期: 2023-03-16 + */ +@Mapper +public interface PartnerArticleManagementMapper extends BaseMapper { + + List partnerOperatingList(@Param("req") PagePartnerArticleManagementReq req); + + Integer partnerOperatingListCount( @Param("req") PagePartnerArticleManagementReq req); +} \ No newline at end of file diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/PartnerArticleStatisticMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/PartnerArticleStatisticMapper.java new file mode 100644 index 0000000..9ae207e --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/PartnerArticleStatisticMapper.java @@ -0,0 +1,17 @@ +package com.huoran.nakadai.mapper; + +import org.apache.ibatis.annotations.Mapper; + +import com.huoran.nakadai.entity.PartnerArticleStatistic; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; + +/** + * @描述:合伙人——文章管理——文章浏览记录 Mapper 接口 + * @作者: Rong + * @日期: 2023-03-17 + */ +@Mapper +public interface PartnerArticleStatisticMapper extends BaseMapper { + Integer statisticsOfVisitors(@Param("contentId") Integer contentId); +} \ No newline at end of file diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/PartnerClassificationMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/PartnerClassificationMapper.java new file mode 100644 index 0000000..1fc987b --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/PartnerClassificationMapper.java @@ -0,0 +1,36 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.nakadai.entity.PartnerClassification; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.nakadai.entity.res.TeamInformationResp; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 合伙人分类表 Mapper 接口 + *

+ * + * @author chen + * @since 2022-05-18 + */ +public interface PartnerClassificationMapper extends BaseMapper { + + List selectIdByPid(@Param("id") Integer id,@Param("type") Integer type); + + List getBusinessManagersUnderTheSameTeam( @Param("parentId") Integer parentId); + + List queryBusinessManagerIdBasedOnTeamId(@Param("teamId")String teamId); + + //根据商务经理id查询该用户所在的团队信息(一个商务经理可在多个团队) + List getTeamInformation(@Param("parentId")Integer parentId); + + PartnerClassification getParentInformationBasedOnChild(@Param("id") Integer id); + + void updateRole(@Param("teamId")String teamId, @Param("accountId")Integer accountId); + + List getTeamInformationByCustomerId(@Param("customerId")Integer customerId,@Param("businessManagerId")Integer businessManagerId); + + PartnerClassification selectTeamNameById(@Param("teamId")Integer teamId); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/PartnerSchemeManagementMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/PartnerSchemeManagementMapper.java new file mode 100644 index 0000000..03d5354 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/PartnerSchemeManagementMapper.java @@ -0,0 +1,22 @@ +package com.huoran.nakadai.mapper; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.nakadai.entity.PartnerSchemeManagement; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.nakadai.entity.req.PagePartnerArticleManagementReq; +import com.huoran.nakadai.entity.res.PartnerArticleManagementResp; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 合伙人——方案管理 Mapper 接口 + *

+ * + * @author chen + * @since 2023-03-20 + */ +public interface PartnerSchemeManagementMapper extends BaseMapper { + IPage schemeList(Page page, @Param("req") PagePartnerArticleManagementReq req); + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/PartnerSchemeManagementProductConfigMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/PartnerSchemeManagementProductConfigMapper.java new file mode 100644 index 0000000..75f29e6 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/PartnerSchemeManagementProductConfigMapper.java @@ -0,0 +1,22 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.nakadai.entity.PartnerSchemeManagementProductConfig; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 合伙人——方案管理——产品配置表 Mapper 接口 + *

+ * + * @author chen + * @since 2023-06-28 + */ +public interface PartnerSchemeManagementProductConfigMapper extends BaseMapper { + + + List obtainProductsAccordingToTheScheme(@Param("schemeId")Integer schemeId,@Param("isRelease")Integer isRelease); + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/PartnerTeamMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/PartnerTeamMapper.java new file mode 100644 index 0000000..ee36cdc --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/PartnerTeamMapper.java @@ -0,0 +1,43 @@ +package com.huoran.nakadai.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.nakadai.entity.PartnerTeam; +import com.huoran.nakadai.entity.res.PartnerAccountResp; +import com.huoran.nakadai.entity.res.UserInfoByPhoneRes; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 合伙人团队表(合伙人账号与分类中间表) Mapper 接口 + *

+ * + * @author chen + * @since 2022-05-18 + */ +public interface PartnerTeamMapper extends BaseMapper { + List getMembersUnderTheSameTeam(Integer classificationId); + + List selectTeamInfo(@Param("ids") List ids,@Param("current")int current,@Param("pageSize")int pageSize,@Param("name")String name); + + UserInfoByPhoneRes selectInfo(@Param("phone")String phone); + + String queryPhone(@Param("id")String id,@Param("platformId")int platformId); + + Integer queryUserId(String accountId); + + Integer updateUserMail(@Param("userId")Integer userId, @Param("email") String email); + + Integer selectTeam(String id); + + String selectPlatform(String id); + + UserInfoByPhoneRes selectInfoByPlatformId(@Param("phone")String phone,@Param("platformId")Integer platformId); + + Integer queryUsername(@Param("accountId")Integer accountId, @Param("userName")String userName); + + void editUsername(@Param("userId")Integer userId, @Param("userName")String userName); + + void delRoleByAccountIdAndTeamId(@Param("accountId")Integer accountId,@Param("teamId") Integer classificationId); +} \ No newline at end of file diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/ProductClassificationMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/ProductClassificationMapper.java new file mode 100644 index 0000000..3d0b727 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/ProductClassificationMapper.java @@ -0,0 +1,18 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.nakadai.entity.ProductClassification; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + *

+ * 产品分类表 Mapper 接口 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@Mapper +public interface ProductClassificationMapper extends BaseMapper { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/ProductThemeMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/ProductThemeMapper.java new file mode 100644 index 0000000..148e238 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/ProductThemeMapper.java @@ -0,0 +1,16 @@ +package com.huoran.nakadai.mapper; + +import org.apache.ibatis.annotations.Mapper; + +import com.huoran.nakadai.entity.ProductTheme; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @描述: Mapper 接口 + * @作者: Rong + * @日期: 2023-08-22 + */ +@Mapper +public interface ProductThemeMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/ProductTypeMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/ProductTypeMapper.java new file mode 100644 index 0000000..d940e44 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/ProductTypeMapper.java @@ -0,0 +1,18 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.nakadai.entity.ProductType; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + *

+ * 产品类型表 Mapper 接口 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@Mapper +public interface ProductTypeMapper extends BaseMapper { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/ProfessionalClassMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/ProfessionalClassMapper.java new file mode 100644 index 0000000..bcd0ac9 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/ProfessionalClassMapper.java @@ -0,0 +1,26 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.nakadai.entity.ProfessionalClass; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author huoran + * @since 2021-07-09 + */ +@Mapper +public interface ProfessionalClassMapper extends BaseMapper { + + List queryProfessionalClass(@Param(value = "disciplineIds") List disciplineIds); + + List professionalClassLevel(@Param(value = "disciplineId") Integer disciplineId); + + List professionalClassLevelNoLeft(@Param(value = "disciplineId") Integer disciplineId); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/ProfessionalMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/ProfessionalMapper.java new file mode 100644 index 0000000..2ff788d --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/ProfessionalMapper.java @@ -0,0 +1,24 @@ +package com.huoran.nakadai.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.nakadai.entity.Professional; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 专业 Mapper 接口 + *

+ * + * @author huoran + * @since 2021-07-09 + */ +@Mapper +public interface ProfessionalMapper extends BaseMapper { + + List professionalLevel(@Param(value = "professionalClassId") Integer professionalClassId); + + List professionalLevelNoLeft(@Param(value = "professionalClassId") Integer professionalClassId); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/ProgramShoppingCartMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/ProgramShoppingCartMapper.java new file mode 100644 index 0000000..057299e --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/ProgramShoppingCartMapper.java @@ -0,0 +1,23 @@ +package com.huoran.nakadai.mapper; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.nakadai.entity.ProgramShoppingCart; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.nakadai.entity.req.PagePartnerArticleManagementReq; +import com.huoran.nakadai.entity.req.ProgramShoppingCartReq; +import com.huoran.nakadai.entity.res.PartnerArticleManagementResp; +import com.huoran.nakadai.entity.res.ProgramShoppingCartResp; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 小程序—购物车 Mapper 接口 + *

+ * + * @author chen + * @since 2023-06-09 + */ +public interface ProgramShoppingCartMapper extends BaseMapper { + IPage shoppingCartList(Page page, @Param("req") ProgramShoppingCartReq req); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/ProvinceMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/ProvinceMapper.java new file mode 100644 index 0000000..52ed6b0 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/ProvinceMapper.java @@ -0,0 +1,18 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.nakadai.entity.Province; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + *

+ * 省份表 Mapper 接口 + *

+ * + * @author huoran + * @since 2021-07-08 + */ +@Mapper +public interface ProvinceMapper extends BaseMapper { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/SchoolCurriculumMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/SchoolCurriculumMapper.java new file mode 100644 index 0000000..b9d58bb --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/SchoolCurriculumMapper.java @@ -0,0 +1,16 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.nakadai.entity.SchoolCurriculum; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 学校内置课程表 Mapper 接口 + *

+ * + * @author lr + * @since 2021-09-26 + */ +public interface SchoolCurriculumMapper extends BaseMapper { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/SchoolMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/SchoolMapper.java new file mode 100644 index 0000000..e76c50d --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/SchoolMapper.java @@ -0,0 +1,21 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.nakadai.entity.School; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + *

+ * 学校表 Mapper 接口 + *

+ * + * @author huoran + * @since 2021-06-29 + */ +@Mapper +public interface SchoolMapper extends BaseMapper { + + List querySchool(String schoolName, Integer provinceId, Integer cityId); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/ServiceConfigurationMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/ServiceConfigurationMapper.java new file mode 100644 index 0000000..c7916a4 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/ServiceConfigurationMapper.java @@ -0,0 +1,21 @@ +package com.huoran.nakadai.mapper; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.nakadai.entity.ServiceConfiguration; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.nakadai.entity.req.ServiceConfigurationReq; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 服务配置表 Mapper 接口 + *

+ * + * @author Mr.JK + * @since 2021-09-08 + */ +public interface ServiceConfigurationMapper extends BaseMapper { + + IPage serviceConfigurationList(Page page,@Param("req") ServiceConfigurationReq serviceReq); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/SupplierMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/SupplierMapper.java new file mode 100644 index 0000000..ad91491 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/SupplierMapper.java @@ -0,0 +1,18 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.nakadai.entity.Supplier; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + *

+ * 供应商表 Mapper 接口 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@Mapper +public interface SupplierMapper extends BaseMapper { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/TagsMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/TagsMapper.java new file mode 100644 index 0000000..2c6c58b --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/TagsMapper.java @@ -0,0 +1,18 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.nakadai.entity.Tags; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + *

+ * 分类标签表 Mapper 接口 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@Mapper +public interface TagsMapper extends BaseMapper { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/ValueModuleManagementMapper.java b/nakadai/src/main/java/com/huoran/nakadai/mapper/ValueModuleManagementMapper.java new file mode 100644 index 0000000..8008e53 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/ValueModuleManagementMapper.java @@ -0,0 +1,21 @@ +package com.huoran.nakadai.mapper; + +import com.huoran.nakadai.entity.ValueModuleManagement; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.mapstruct.Mapper; + +import java.util.List; + +/** + *

+ * 增值模块管理表 Mapper 接口 + *

+ * + * @author chen + * @since 2023-01-30 + */ +@Mapper +public interface ValueModuleManagementMapper extends BaseMapper { + + List selectProductModule(); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CityMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CityMapper.xml new file mode 100644 index 0000000..04f3cf8 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CityMapper.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CommentLikeMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CommentLikeMapper.xml new file mode 100644 index 0000000..a34acf4 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CommentLikeMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CommentMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CommentMapper.xml new file mode 100644 index 0000000..e65322d --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CommentMapper.xml @@ -0,0 +1,30 @@ + + + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CourseMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CourseMapper.xml new file mode 100644 index 0000000..6cff4db --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CourseMapper.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CurriculumChapterMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CurriculumChapterMapper.xml new file mode 100644 index 0000000..045a851 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CurriculumChapterMapper.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CurriculumConfigureMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CurriculumConfigureMapper.xml new file mode 100644 index 0000000..8900482 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CurriculumConfigureMapper.xml @@ -0,0 +1,174 @@ + + + + + + + + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CurriculumLearningProgressMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CurriculumLearningProgressMapper.xml new file mode 100644 index 0000000..1aa4a94 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CurriculumLearningProgressMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CurriculumMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CurriculumMapper.xml new file mode 100644 index 0000000..a847310 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CurriculumMapper.xml @@ -0,0 +1,179 @@ + + + + + + + + + + + + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CurriculumNotesMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CurriculumNotesMapper.xml new file mode 100644 index 0000000..a690492 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CurriculumNotesMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CurriculumRecentUseMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CurriculumRecentUseMapper.xml new file mode 100644 index 0000000..1befade --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CurriculumRecentUseMapper.xml @@ -0,0 +1,86 @@ + + + + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CurriculumSubsectionMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CurriculumSubsectionMapper.xml new file mode 100644 index 0000000..14a7e13 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CurriculumSubsectionMapper.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CustomerMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CustomerMapper.xml new file mode 100644 index 0000000..4c5a6fc --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CustomerMapper.xml @@ -0,0 +1,387 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + UPDATE customer set is_del=1 + WHERE customer_id IN + + #{ids} + + + + + insert into hr_user_account(customer_id, user_id, account, password, school_id, role_id, create_time, + update_time, platform_id) + values (#{customerId}, #{userId}, #{account}, #{password}, #{schoolId}, #{roleId}, now(), now(), #{platformId}) + + + + + + + UPDATE hr_user_account + set password = #{password} + WHERE customer_id = #{customerId} + + + + UPDATE hr_user_account + set is_del = 1 + WHERE customer_id = #{customerId} + + + + UPDATE hr_user_account + set account = #{account} + WHERE customer_id = #{customerId} + + + + UPDATE hr_user_account set is_del=1 + WHERE customer_id IN + + #{ids} + + + + + update python_db.sys_data_record + set is_del = 1 + where school_id = #{schoolId} + + + + UPDATE hr_user_info + set is_del = 1 + WHERE school_id = #{schoolId} + + + + UPDATE hr_user_account + set is_del = 1 + WHERE school_id = #{schoolId} + + + + + + + update python_db.sys_data_record set is_del = 1 where school_id in + + #{schoolIds} + + + + + UPDATE hr_user_info set is_del = 1 + WHERE school_id in + + #{schoolIds} + + + + + UPDATE hr_user_account set is_del = 1 + WHERE school_id in + + #{schoolIds} + + + + + UPDATE hr_user_account + set role_id = #{roleId} + WHERE customer_id = #{customerId} + + + + update hr_user_account + set user_id = #{userId} + WHERE customer_id = #{customerId} + + + + + + + + + + + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CustomsPassMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CustomsPassMapper.xml new file mode 100644 index 0000000..e2f3240 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CustomsPassMapper.xml @@ -0,0 +1,37 @@ + + + + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/DataProductMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/DataProductMapper.xml new file mode 100644 index 0000000..02bc8f5 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/DataProductMapper.xml @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/DisciplineLevelMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/DisciplineLevelMapper.xml new file mode 100644 index 0000000..e2fc308 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/DisciplineLevelMapper.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/DisciplineMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/DisciplineMapper.xml new file mode 100644 index 0000000..ae8a1c0 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/DisciplineMapper.xml @@ -0,0 +1,24 @@ + + + + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/EduCurriculumChapterMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/EduCurriculumChapterMapper.xml new file mode 100644 index 0000000..ac70898 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/EduCurriculumChapterMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/HrContractInformationMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/HrContractInformationMapper.xml new file mode 100644 index 0000000..cb4b9ed --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/HrContractInformationMapper.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/HrCoursePermissionsMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/HrCoursePermissionsMapper.xml new file mode 100644 index 0000000..133d92f --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/HrCoursePermissionsMapper.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/HrDataPermissionsMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/HrDataPermissionsMapper.xml new file mode 100644 index 0000000..b4bb08b --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/HrDataPermissionsMapper.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/HrIndustryClassMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/HrIndustryClassMapper.xml new file mode 100644 index 0000000..b2bb81d --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/HrIndustryClassMapper.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/HrIndustryMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/HrIndustryMapper.xml new file mode 100644 index 0000000..b013282 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/HrIndustryMapper.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/HrLogMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/HrLogMapper.xml new file mode 100644 index 0000000..1f83a2f --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/HrLogMapper.xml @@ -0,0 +1,22 @@ + + + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/HrMallMarketingPromotionMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/HrMallMarketingPromotionMapper.xml new file mode 100644 index 0000000..5250ec3 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/HrMallMarketingPromotionMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/HrStaffAccountArchitectureMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/HrStaffAccountArchitectureMapper.xml new file mode 100644 index 0000000..0324640 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/HrStaffAccountArchitectureMapper.xml @@ -0,0 +1,16 @@ + + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/HrStaffDepartmentMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/HrStaffDepartmentMapper.xml new file mode 100644 index 0000000..f214531 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/HrStaffDepartmentMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/HrStaffMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/HrStaffMapper.xml new file mode 100644 index 0000000..555e70d --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/HrStaffMapper.xml @@ -0,0 +1,176 @@ + + + + + + + INSERT INTO nakadai.hr_user_info (user_name, unique_identification, email,role_id,school_id,create_time, + update_time,user_avatars) + VALUES (#{userName}, #{uniqueIdentification}, #{email},0,0,now(), now(),#{userAvatars}) + + + + + INSERT INTO nakadai.hr_user_account(user_id, account,phone , password, work_number, school_id, platform_id, + type, create_time, update_time,app_open_id) + VALUES (#{userId}, #{account},#{phone}, #{password}, #{workNumber}, 0, #{platformId}, #{type}, + now(), now(),#{appOpenId}) + + + + update hr_user_info + set user_name = #{userName}, + email = #{email} + where user_id = #{userId} + + + + UPDATE nakadai.hr_user_account + + + work_number = #{workNumber}, + + + account = #{account}, + + + phone = #{phone}, + + + + + id=#{id} + + + + + + update acl_user_role set is_del = 1 where account_id = #{accountId} + + + + + + + + + + + + + + + + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/LogContentMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/LogContentMapper.xml new file mode 100644 index 0000000..4780e72 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/LogContentMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/MallAnnexMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/MallAnnexMapper.xml new file mode 100644 index 0000000..2a50acf --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/MallAnnexMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/MallClassificationMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/MallClassificationMapper.xml new file mode 100644 index 0000000..6833277 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/MallClassificationMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/MallCourseLearningRecordMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/MallCourseLearningRecordMapper.xml new file mode 100644 index 0000000..96828ff --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/MallCourseLearningRecordMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/MallDisciplineMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/MallDisciplineMapper.xml new file mode 100644 index 0000000..75a2f40 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/MallDisciplineMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/MallMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/MallMapper.xml new file mode 100644 index 0000000..3ed269d --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/MallMapper.xml @@ -0,0 +1,368 @@ + + + + + + + + + + + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/MallNonAssociatedLinksMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/MallNonAssociatedLinksMapper.xml new file mode 100644 index 0000000..d050a61 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/MallNonAssociatedLinksMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/MallPriceMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/MallPriceMapper.xml new file mode 100644 index 0000000..eb642d4 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/MallPriceMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/MallSupplierMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/MallSupplierMapper.xml new file mode 100644 index 0000000..fb98b1e --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/MallSupplierMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/MallTagsMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/MallTagsMapper.xml new file mode 100644 index 0000000..328dfec --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/MallTagsMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/MallTypeMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/MallTypeMapper.xml new file mode 100644 index 0000000..0ac3191 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/MallTypeMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/ModelDemoHiddenMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/ModelDemoHiddenMapper.xml new file mode 100644 index 0000000..db438e0 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/ModelDemoHiddenMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/ModelReferenceCategoryMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/ModelReferenceCategoryMapper.xml new file mode 100644 index 0000000..264daa0 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/ModelReferenceCategoryMapper.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/ModelReferenceDemoMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/ModelReferenceDemoMapper.xml new file mode 100644 index 0000000..7e02984 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/ModelReferenceDemoMapper.xml @@ -0,0 +1,229 @@ + + + + + + + + + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/ModelSysCategoryMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/ModelSysCategoryMapper.xml new file mode 100644 index 0000000..b60d43b --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/ModelSysCategoryMapper.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/ModelSysDemoMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/ModelSysDemoMapper.xml new file mode 100644 index 0000000..1210aca --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/ModelSysDemoMapper.xml @@ -0,0 +1,122 @@ + + + + + + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/NotifyMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/NotifyMapper.xml new file mode 100644 index 0000000..2782ef4 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/NotifyMapper.xml @@ -0,0 +1,40 @@ + + + + + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/OrderMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/OrderMapper.xml new file mode 100644 index 0000000..923e2aa --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/OrderMapper.xml @@ -0,0 +1,474 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + update hr_user_account + set platform_id = #{platformId} + where customer_id = #{customerId} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/OrderOtherMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/OrderOtherMapper.xml new file mode 100644 index 0000000..49b4417 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/OrderOtherMapper.xml @@ -0,0 +1,368 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PartnerAccountMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PartnerAccountMapper.xml new file mode 100644 index 0000000..8364cb0 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PartnerAccountMapper.xml @@ -0,0 +1,376 @@ + + + + + update acl_user_role set account_id = #{accountId} where id = #{userRoleId} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PartnerArticleClassificationMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PartnerArticleClassificationMapper.xml new file mode 100644 index 0000000..706fe10 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PartnerArticleClassificationMapper.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PartnerArticleFileMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PartnerArticleFileMapper.xml new file mode 100644 index 0000000..32b5664 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PartnerArticleFileMapper.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PartnerArticleLabelMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PartnerArticleLabelMapper.xml new file mode 100644 index 0000000..377026c --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PartnerArticleLabelMapper.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PartnerArticleManagementCollectMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PartnerArticleManagementCollectMapper.xml new file mode 100644 index 0000000..9407b8a --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PartnerArticleManagementCollectMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PartnerArticleManagementMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PartnerArticleManagementMapper.xml new file mode 100644 index 0000000..6b2c26b --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PartnerArticleManagementMapper.xml @@ -0,0 +1,306 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PartnerArticleStatisticMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PartnerArticleStatisticMapper.xml new file mode 100644 index 0000000..8fa5739 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PartnerArticleStatisticMapper.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PartnerClassificationMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PartnerClassificationMapper.xml new file mode 100644 index 0000000..9d35927 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PartnerClassificationMapper.xml @@ -0,0 +1,101 @@ + + + + + update acl_user_role set is_del = 1 where team_id = #{teamId} and account_id = #{accountId} + + + + + + + + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PartnerSchemeManagementMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PartnerSchemeManagementMapper.xml new file mode 100644 index 0000000..fb027dd --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PartnerSchemeManagementMapper.xml @@ -0,0 +1,124 @@ + + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PartnerSchemeManagementProductConfigMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PartnerSchemeManagementProductConfigMapper.xml new file mode 100644 index 0000000..379776c --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PartnerSchemeManagementProductConfigMapper.xml @@ -0,0 +1,18 @@ + + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PartnerTeamMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PartnerTeamMapper.xml new file mode 100644 index 0000000..4afeac2 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PartnerTeamMapper.xml @@ -0,0 +1,91 @@ + + + + + update hr_user_info set email = #{email} where user_id = #{userId} + + + update hr_user_info set user_name = #{userName} where user_id = #{userId} + + + update acl_user_role set is_del = 1 where account_id = #{accountId} and team_id = #{teamId} + + + + + + + + + + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/ProductClassificationMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/ProductClassificationMapper.xml new file mode 100644 index 0000000..6edde11 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/ProductClassificationMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/ProductThemeMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/ProductThemeMapper.xml new file mode 100644 index 0000000..6335059 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/ProductThemeMapper.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/ProductTypeMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/ProductTypeMapper.xml new file mode 100644 index 0000000..d827b81 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/ProductTypeMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/ProfessionalClassMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/ProfessionalClassMapper.xml new file mode 100644 index 0000000..6d94a0f --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/ProfessionalClassMapper.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/ProfessionalMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/ProfessionalMapper.xml new file mode 100644 index 0000000..1479572 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/ProfessionalMapper.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/ProgramShoppingCartMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/ProgramShoppingCartMapper.xml new file mode 100644 index 0000000..ebc38a1 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/ProgramShoppingCartMapper.xml @@ -0,0 +1,18 @@ + + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/ProvinceMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/ProvinceMapper.xml new file mode 100644 index 0000000..363388e --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/ProvinceMapper.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/SchoolCurriculumMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/SchoolCurriculumMapper.xml new file mode 100644 index 0000000..75f89f3 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/SchoolCurriculumMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/SchoolMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/SchoolMapper.xml new file mode 100644 index 0000000..73ac903 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/SchoolMapper.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/ServiceConfigurationMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/ServiceConfigurationMapper.xml new file mode 100644 index 0000000..054f62f --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/ServiceConfigurationMapper.xml @@ -0,0 +1,31 @@ + + + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/SupplierMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/SupplierMapper.xml new file mode 100644 index 0000000..0f996d3 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/SupplierMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/TagsMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/TagsMapper.xml new file mode 100644 index 0000000..329649e --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/TagsMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/ValueModuleManagementMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/ValueModuleManagementMapper.xml new file mode 100644 index 0000000..ef3fae2 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/ValueModuleManagementMapper.xml @@ -0,0 +1,17 @@ + + + + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/CommentLikeService.java b/nakadai/src/main/java/com/huoran/nakadai/service/CommentLikeService.java new file mode 100644 index 0000000..eb0c562 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/CommentLikeService.java @@ -0,0 +1,16 @@ +package com.huoran.nakadai.service; + +import com.huoran.nakadai.entity.CommentLike; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 课程评论点赞表 服务类 + *

+ * + * @author chen + * @since 2023-05-25 + */ +public interface CommentLikeService extends IService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/CommentService.java b/nakadai/src/main/java/com/huoran/nakadai/service/CommentService.java new file mode 100644 index 0000000..ce6e663 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/CommentService.java @@ -0,0 +1,20 @@ +package com.huoran.nakadai.service; + +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.Comment; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 课程评论回复表 服务类 + *

+ * + * @author chen + * @since 2023-05-25 + */ +public interface CommentService extends IService { + + R commentTreeList(Integer mallId, Integer schoolId,String accountId); + + R removeChildById(Integer commentId); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/CurriculumChapterService.java b/nakadai/src/main/java/com/huoran/nakadai/service/CurriculumChapterService.java new file mode 100644 index 0000000..4994d2c --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/CurriculumChapterService.java @@ -0,0 +1,29 @@ +package com.huoran.nakadai.service; + +import com.huoran.nakadai.entity.CurriculumChapter; +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.nakadai.entity.vo.ChapterVO; +import com.huoran.nakadai.entity.vo.SortVO; + +import java.util.List; + +/** + *

+ * 企业课程章节表 服务类 + *

+ * + * @author lr + * @since 2021-09-26 + */ +public interface CurriculumChapterService extends IService { + + List getChapterTree(String courseId); + + boolean removeChapter(Integer chapterId); + + boolean saveChapter(CurriculumChapter courseChapter); + + boolean updateSort(SortVO sortVO); + + boolean repeat(CurriculumChapter courseChapter); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/CurriculumLearningProgressService.java b/nakadai/src/main/java/com/huoran/nakadai/service/CurriculumLearningProgressService.java new file mode 100644 index 0000000..10d3e1c --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/CurriculumLearningProgressService.java @@ -0,0 +1,19 @@ +package com.huoran.nakadai.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.nakadai.entity.CurriculumLearningProgress; + +import java.util.List; + +/** + *

+ * 课程学习进度 服务类 + *

+ * + * @author chen + * @since 2023-04-25 + */ +public interface CurriculumLearningProgressService extends IService { + + List curriculumLearningProgresses(Integer accountId,String cid); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/CurriculumNotesService.java b/nakadai/src/main/java/com/huoran/nakadai/service/CurriculumNotesService.java new file mode 100644 index 0000000..326d5dc --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/CurriculumNotesService.java @@ -0,0 +1,16 @@ +package com.huoran.nakadai.service; + +import com.huoran.nakadai.entity.CurriculumNotes; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 课程笔记表 服务类 + *

+ * + * @author chen + * @since 2023-05-04 + */ +public interface CurriculumNotesService extends IService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/CurriculumRecentUseService.java b/nakadai/src/main/java/com/huoran/nakadai/service/CurriculumRecentUseService.java new file mode 100644 index 0000000..527640d --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/CurriculumRecentUseService.java @@ -0,0 +1,18 @@ +package com.huoran.nakadai.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.CurriculumRecentUse; +import com.huoran.nakadai.entity.req.PageCurriculumRecentUseReq; + +/** + *

+ * 服务类 + *

+ * + * @author chen + * @since 2023-04-19 + */ +public interface CurriculumRecentUseService extends IService { + R recentUse(PageCurriculumRecentUseReq curriculum); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/CurriculumSubsectionService.java b/nakadai/src/main/java/com/huoran/nakadai/service/CurriculumSubsectionService.java new file mode 100644 index 0000000..948981b --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/CurriculumSubsectionService.java @@ -0,0 +1,21 @@ +package com.huoran.nakadai.service; + +import com.aliyuncs.exceptions.ClientException; +import com.huoran.nakadai.entity.CurriculumSubsection; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 企业课程小节表 服务类 + *

+ * + * @author lr + * @since 2021-09-26 + */ +public interface CurriculumSubsectionService extends IService { + boolean removeSubsection(String subsectionId) throws ClientException; + + boolean saveSubsection(CurriculumSubsection courseSubsection); + + boolean repeat(CurriculumSubsection courseSubsection); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/CustomsPassService.java b/nakadai/src/main/java/com/huoran/nakadai/service/CustomsPassService.java new file mode 100644 index 0000000..024853b --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/CustomsPassService.java @@ -0,0 +1,23 @@ +package com.huoran.nakadai.service; + +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.CustomsPass; +import com.baomidou.mybatisplus.extension.service.IService; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 沙盘-关卡表 服务类 + *

+ * + * @author chen + * @since 2023-10-26 + */ +public interface CustomsPassService extends IService { + + Integer maximumSequenceNumber(); + + + R checkPointList(Integer schoolId, Integer accountId, Integer projectId, Integer displayCollection); + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/EduCurriculumChapterService.java b/nakadai/src/main/java/com/huoran/nakadai/service/EduCurriculumChapterService.java new file mode 100644 index 0000000..17ffd82 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/EduCurriculumChapterService.java @@ -0,0 +1,16 @@ +package com.huoran.nakadai.service; + +import com.huoran.nakadai.entity.EduCurriculumChapter; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 课程章节 服务类 + *

+ * + * @author lr + * @since 2021-09-26 + */ +public interface EduCurriculumChapterService extends IService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/HrLogService.java b/nakadai/src/main/java/com/huoran/nakadai/service/HrLogService.java new file mode 100644 index 0000000..5bb6315 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/HrLogService.java @@ -0,0 +1,22 @@ +package com.huoran.nakadai.service; + +import com.huoran.nakadai.entity.HrLog; +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.nakadai.entity.vo.LogManagementListVo; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author chen + * @since 2022-03-04 + */ +public interface HrLogService extends IService { + + List managementList(String search); + + List queryAllAccount(Integer platformId); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/HrMallMarketingPromotionService.java b/nakadai/src/main/java/com/huoran/nakadai/service/HrMallMarketingPromotionService.java new file mode 100644 index 0000000..18ecf06 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/HrMallMarketingPromotionService.java @@ -0,0 +1,16 @@ +package com.huoran.nakadai.service; + +import com.huoran.nakadai.entity.HrMallMarketingPromotion; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author chen + * @since 2023-04-25 + */ +public interface HrMallMarketingPromotionService extends IService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/HrStaffAccountArchitectureService.java b/nakadai/src/main/java/com/huoran/nakadai/service/HrStaffAccountArchitectureService.java new file mode 100644 index 0000000..ad08b14 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/HrStaffAccountArchitectureService.java @@ -0,0 +1,25 @@ +package com.huoran.nakadai.service; + +import com.huoran.common.entity.Architecture; +import com.huoran.nakadai.entity.HrStaffAccountArchitecture; +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.nakadai.entity.req.ArchitectureAddReq; + +import java.util.List; + +/** + *

+ * 中台账号组织架构 服务类 + *

+ * + * @author chen + * @since 2022-03-22 + */ +public interface HrStaffAccountArchitectureService extends IService { + + boolean checkRepeat(HrStaffAccountArchitecture architecture); + + List treeList(); + + boolean removeOrganization(Integer id); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/HrStaffDepartmentService.java b/nakadai/src/main/java/com/huoran/nakadai/service/HrStaffDepartmentService.java new file mode 100644 index 0000000..0201c87 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/HrStaffDepartmentService.java @@ -0,0 +1,16 @@ +package com.huoran.nakadai.service; + +import com.huoran.nakadai.entity.HrStaffDepartment; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author chen + * @since 2022-03-23 + */ +public interface HrStaffDepartmentService extends IService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/HrStaffService.java b/nakadai/src/main/java/com/huoran/nakadai/service/HrStaffService.java new file mode 100644 index 0000000..7305a61 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/HrStaffService.java @@ -0,0 +1,39 @@ +package com.huoran.nakadai.service; + +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.HrStaff; +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.nakadai.entity.req.StaffAddReq; +import com.huoran.nakadai.entity.req.StaffListReq; +import com.huoran.nakadai.entity.req.StaffUpdateReq; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + *

+ * 中台后台员工账号表 服务类 + *

+ * + * @author chen + * @since 2022-03-22 + */ +public interface HrStaffService extends IService { + + R saveStaff(StaffAddReq staffReq); + + R pageStaffList(StaffListReq req); + + R staffDetail(Integer accountId); + + R modifyStaff(StaffUpdateReq updateReq); + + R delStaff(List accountIds); + + Map importStaff(MultipartFile file); + + void exportFailureRecord(HttpServletResponse response, String exportCode) throws IOException; +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/ICityService.java b/nakadai/src/main/java/com/huoran/nakadai/service/ICityService.java new file mode 100644 index 0000000..4804dae --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/ICityService.java @@ -0,0 +1,19 @@ +package com.huoran.nakadai.service; + +import com.huoran.nakadai.entity.City; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + *

+ * 城市 服务类 + *

+ * + * @author huoran + * @since 2021-06-29 + */ +public interface ICityService extends IService { + + List queryCityList(Integer provinceId); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/ICourseService.java b/nakadai/src/main/java/com/huoran/nakadai/service/ICourseService.java new file mode 100644 index 0000000..0d63611 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/ICourseService.java @@ -0,0 +1,16 @@ +package com.huoran.nakadai.service; + +import com.huoran.nakadai.entity.Course; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 课程表 服务类 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +public interface ICourseService extends IService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/ICurriculumConfigureService.java b/nakadai/src/main/java/com/huoran/nakadai/service/ICurriculumConfigureService.java new file mode 100644 index 0000000..6e9cb13 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/ICurriculumConfigureService.java @@ -0,0 +1,30 @@ +package com.huoran.nakadai.service; + +import com.huoran.common.entity.ProjectManage; +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.CurriculumConfigure; +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.nakadai.entity.res.CourseByProjectInfoRes; +import com.huoran.nakadai.entity.res.CurriculumDetailRes; +import org.apache.ibatis.annotations.Param; +import org.springframework.web.bind.annotation.RequestParam; + +import java.util.List; + +/** + *

+ * 课程配置表 服务类 + *

+ * + * @author lr + * @since 2021-09-17 + */ +public interface ICurriculumConfigureService extends IService { + R projectListByCourseId(Integer cid, Integer permissions, String projectName); + + List getCurriculumConfigure(Integer cid,Integer permissions); + + R checkConfig(Integer projectId); + + List getProjectBySystemIdRemoteCall(String systemId, Integer accountId, Integer permissions, Integer cId, Integer mallId,Integer schoolId); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/ICurriculumService.java b/nakadai/src/main/java/com/huoran/nakadai/service/ICurriculumService.java new file mode 100644 index 0000000..5b71f15 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/ICurriculumService.java @@ -0,0 +1,45 @@ +package com.huoran.nakadai.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.Curriculum; +import com.huoran.nakadai.entity.req.AddCurriculumReq; +import com.huoran.nakadai.entity.req.ModifyCurriculumReq; +import com.huoran.nakadai.entity.req.PageCurriculumReq; + +import java.util.List; + +/** + *

+ * 课程管理 服务类 + *

+ * + * @author lr + * @since 2021-09-16 + */ +public interface ICurriculumService extends IService { + + R createCurriculum(AddCurriculumReq curriculum); + + R modifyCourse(ModifyCurriculumReq curriculum); + + R delCourse(List cids); + + R curriculumList(PageCurriculumReq req); + + R schoolCourse(Integer schoolId);//获取学校购买过的课程(包含生效、过期的) + + R getSchoolEffectiveCourse(Integer schoolId);//获取学校购买过的课程(只包含在有效期内的) + + R schoolCourseByAchievement(Integer schoolId); + + R curriculumDetail(Integer cid,Integer mallId); + + List getSystemIdByCustomerId(Integer customerId); + + String getSchoolCourse(Integer schoolId); + + R whetherToRenewTheFee(Integer schoolId, Integer cid); + + R deleteCoursePrompt(List cids); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/ICustomerService.java b/nakadai/src/main/java/com/huoran/nakadai/service/ICustomerService.java new file mode 100644 index 0000000..fc3e80f --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/ICustomerService.java @@ -0,0 +1,71 @@ +package com.huoran.nakadai.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.common.response.R; +import com.huoran.common.utils.PageUtils; +import com.huoran.nakadai.entity.Customer; +import com.huoran.nakadai.entity.req.CustomerListReq; +import com.huoran.nakadai.entity.req.CustomerReq; +import com.huoran.nakadai.entity.req.ListOfClientCommercialManagersReq; +import com.huoran.nakadai.entity.req.SalesProgressReq; +import com.huoran.nakadai.entity.res.AnnualOperatingAnalysisResp; +import com.huoran.nakadai.entity.res.AnnualOperatingAnalysisToStringResp; +import com.huoran.nakadai.entity.res.CustomerDetailRes; +import org.apache.ibatis.annotations.Param; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.concurrent.ExecutionException; + +/** + *

+ * 客户表 服务类 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +public interface ICustomerService extends IService { + + int addCustomer(CustomerReq customerReq) throws ExecutionException, InterruptedException; + + PageUtils queryPage(Integer page, Integer size, CustomerListReq customerListReq); + + int resetPwd(Integer customerId); + + int delCustomer(Integer customerId); + + CustomerDetailRes queryCustomerDetails(Integer customerId); + + int updateCourseEnabled(Integer coursePermissionsId, Integer isEnabled); + + int updateDataEnabled(Integer dataPermissionsId, Integer isEnabled); + + int updateCustomer(CustomerReq customerReq); + + int updateCustomerByRoleId(@Param("customerId") Integer customerId, @Param("roleId") String roleId); + + int updateEnabled(Integer id, Integer isEnable); + + int queryCustomerIsExists(Integer schoolId); + + int delCustomers(List ids); + + List checkEmailOrPhone(Customer customer); + + R getCustomerListBasedOnBusinessManagerId(@Param("req") ListOfClientCommercialManagersReq req); + + //订单新增客户 + Integer newCustomerOnOrder(SalesProgressReq req); + + + //订单新增产品 + Integer newProductAddedToOrder(SalesProgressReq req); + + + AnnualOperatingAnalysisResp annualOperatingAnalysis(SalesProgressReq req); + + + void exportClient(CustomerListReq req, HttpServletResponse response) throws Exception; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/IDataProductService.java b/nakadai/src/main/java/com/huoran/nakadai/service/IDataProductService.java new file mode 100644 index 0000000..1994f61 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/IDataProductService.java @@ -0,0 +1,26 @@ +package com.huoran.nakadai.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.DataProduct; +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.nakadai.entity.req.ListOfClientCommercialManagersReq; +import com.huoran.nakadai.entity.req.MiniProgramProductsReq; +import com.huoran.nakadai.entity.req.PageCurriculumReq; +import com.huoran.nakadai.entity.res.AppletsDataProductResp; +import com.huoran.nakadai.entity.res.BusinessManagerOrderResp; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 数据平台产品表 服务类 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +public interface IDataProductService extends IService { + + R AppletsDataProductList( @Param("req") MiniProgramProductsReq req); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/IDisciplineLevelService.java b/nakadai/src/main/java/com/huoran/nakadai/service/IDisciplineLevelService.java new file mode 100644 index 0000000..495ef94 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/IDisciplineLevelService.java @@ -0,0 +1,16 @@ +package com.huoran.nakadai.service; + +import com.huoran.nakadai.entity.DisciplineLevel; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 学科层次 服务类 + *

+ * + * @author huoran + * @since 2021-07-09 + */ +public interface IDisciplineLevelService extends IService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/IDisciplineService.java b/nakadai/src/main/java/com/huoran/nakadai/service/IDisciplineService.java new file mode 100644 index 0000000..f0a58cf --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/IDisciplineService.java @@ -0,0 +1,21 @@ +package com.huoran.nakadai.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.nakadai.entity.Discipline; + +import java.util.List; + +/** + *

+ * 学科 服务类 + *

+ * + * @author lr + * @since 2021-09-17 + */ +public interface IDisciplineService extends IService { + + List disciplineLevel(); + + List subjectCategoryCited(); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/IHrContractInformationService.java b/nakadai/src/main/java/com/huoran/nakadai/service/IHrContractInformationService.java new file mode 100644 index 0000000..a1f7f3c --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/IHrContractInformationService.java @@ -0,0 +1,16 @@ +package com.huoran.nakadai.service; + +import com.huoran.nakadai.entity.HrContractInformation; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 合同信息表 服务类 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +public interface IHrContractInformationService extends IService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/IHrCoursePermissionsService.java b/nakadai/src/main/java/com/huoran/nakadai/service/IHrCoursePermissionsService.java new file mode 100644 index 0000000..24fe343 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/IHrCoursePermissionsService.java @@ -0,0 +1,16 @@ +package com.huoran.nakadai.service; + +import com.huoran.nakadai.entity.HrCoursePermissions; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 课程权限表 服务类 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +public interface IHrCoursePermissionsService extends IService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/IHrDataPermissionsService.java b/nakadai/src/main/java/com/huoran/nakadai/service/IHrDataPermissionsService.java new file mode 100644 index 0000000..843cca8 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/IHrDataPermissionsService.java @@ -0,0 +1,16 @@ +package com.huoran.nakadai.service; + +import com.huoran.nakadai.entity.HrDataPermissions; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 数据平台权限表 服务类 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +public interface IHrDataPermissionsService extends IService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/IHrIndustryClassService.java b/nakadai/src/main/java/com/huoran/nakadai/service/IHrIndustryClassService.java new file mode 100644 index 0000000..0e61f7f --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/IHrIndustryClassService.java @@ -0,0 +1,19 @@ +package com.huoran.nakadai.service; + +import com.huoran.nakadai.entity.HrIndustryClass; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + *

+ * 行业类 服务类 + *

+ * + * @author huoran + * @since 2021-06-29 + */ +public interface IHrIndustryClassService extends IService { + + List queryIndustryClass(); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/IHrIndustryService.java b/nakadai/src/main/java/com/huoran/nakadai/service/IHrIndustryService.java new file mode 100644 index 0000000..55b3607 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/IHrIndustryService.java @@ -0,0 +1,19 @@ +package com.huoran.nakadai.service; + +import com.huoran.nakadai.entity.HrIndustry; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + *

+ * 行业 服务类 + *

+ * + * @author huoran + * @since 2021-06-29 + */ +public interface IHrIndustryService extends IService { + + List queryIndustry(Integer industryClassId); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/IOrderService.java b/nakadai/src/main/java/com/huoran/nakadai/service/IOrderService.java new file mode 100644 index 0000000..2a625ec --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/IOrderService.java @@ -0,0 +1,52 @@ +package com.huoran.nakadai.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.Order; +import com.huoran.nakadai.entity.req.GetTheSystemUnderTheProductReq; +import com.huoran.nakadai.entity.req.ListOfClientCommercialManagersReq; +import com.huoran.nakadai.entity.req.OrderListReq; +import com.huoran.nakadai.entity.req.OrderRecordParametersReq; +import com.huoran.nakadai.entity.res.ExportSubscribedRecordsResp; +import com.huoran.nakadai.entity.vo.OrderVo; +import org.springframework.web.bind.annotation.RequestParam; + +import javax.servlet.http.HttpServletResponse; +import java.util.HashMap; +import java.util.List; +import java.util.concurrent.ExecutionException; + +/** + *

+ * 订单表 服务类 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +public interface IOrderService extends IService { + + R addOrder(OrderVo orderVo) throws ExecutionException, InterruptedException; + + HashMap orderList(OrderListReq orderListReq); + + OrderVo queryOrderDetails(Integer orderId); + + boolean deleteOrders(List orderIds); + + boolean updateOrder(OrderVo orderVo); + + R getProductsSubscribedByCustomers(@RequestParam Integer customeId); + + void exportSubscribedRecords(List listOfExportSub, HttpServletResponse response) throws Exception; + + R getAListOfClientBusinessManagers(ListOfClientCommercialManagersReq req); + + R getBusinessManagerOrder(ListOfClientCommercialManagersReq req); + + R getOrderBasedOnBusinessManagerId(ListOfClientCommercialManagersReq req); + + R miniProgramOrderRecord( OrderRecordParametersReq req); + + R getSystemByCustomers( GetTheSystemUnderTheProductReq req); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/IProfessionalClassService.java b/nakadai/src/main/java/com/huoran/nakadai/service/IProfessionalClassService.java new file mode 100644 index 0000000..a32c6d7 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/IProfessionalClassService.java @@ -0,0 +1,21 @@ +package com.huoran.nakadai.service; + +import com.huoran.nakadai.entity.ProfessionalClass; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author huoran + * @since 2021-07-09 + */ +public interface IProfessionalClassService extends IService { + + List queryProfessionalClass(List disciplineIds); + + List professionalClassLevel(Integer disciplineId); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/IProfessionalService.java b/nakadai/src/main/java/com/huoran/nakadai/service/IProfessionalService.java new file mode 100644 index 0000000..db09f6a --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/IProfessionalService.java @@ -0,0 +1,21 @@ +package com.huoran.nakadai.service; + +import com.huoran.nakadai.entity.Professional; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + *

+ * 专业 服务类 + *

+ * + * @author huoran + * @since 2021-07-09 + */ +public interface IProfessionalService extends IService { + + List queryProfessional(Integer professionalClassId); + + List professionalLevel(Integer professionalClassId); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/IProvinceService.java b/nakadai/src/main/java/com/huoran/nakadai/service/IProvinceService.java new file mode 100644 index 0000000..80aa8fe --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/IProvinceService.java @@ -0,0 +1,19 @@ +package com.huoran.nakadai.service; + +import com.huoran.nakadai.entity.Province; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + *

+ * 省份表 服务类 + *

+ * + * @author huoran + * @since 2021-07-08 + */ +public interface IProvinceService extends IService { + + List queryProvince(); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/ISchoolService.java b/nakadai/src/main/java/com/huoran/nakadai/service/ISchoolService.java new file mode 100644 index 0000000..25bb841 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/ISchoolService.java @@ -0,0 +1,21 @@ +package com.huoran.nakadai.service; + +import com.huoran.nakadai.entity.School; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + *

+ * 学校表 服务类 + *

+ * + * @author huoran + * @since 2021-06-29 + */ +public interface ISchoolService extends IService { + + List querySchool(String schoolName, Integer provinceId, Integer cityId); + + List getSchoolsByProvince(String schoolName, Integer provinceId, Integer cityId); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/IServiceConfigurationService.java b/nakadai/src/main/java/com/huoran/nakadai/service/IServiceConfigurationService.java new file mode 100644 index 0000000..ba27238 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/IServiceConfigurationService.java @@ -0,0 +1,23 @@ +package com.huoran.nakadai.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.huoran.nakadai.entity.ServiceConfiguration; +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.nakadai.entity.req.ServiceConfigurationReq; + +import java.util.List; + +/** + *

+ * 服务配置表 服务类 + *

+ * + * @author Mr.JK + * @since 2021-09-08 + */ +public interface IServiceConfigurationService extends IService { + + IPage getAllService(ServiceConfigurationReq serviceReq); + + String getSystemNameBySystemId(Integer systemId); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/LogContentService.java b/nakadai/src/main/java/com/huoran/nakadai/service/LogContentService.java new file mode 100644 index 0000000..c292434 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/LogContentService.java @@ -0,0 +1,16 @@ +package com.huoran.nakadai.service; + +import com.huoran.nakadai.entity.LogContent; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author chen + * @since 2022-03-08 + */ +public interface LogContentService extends IService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/MallAnnexService.java b/nakadai/src/main/java/com/huoran/nakadai/service/MallAnnexService.java new file mode 100644 index 0000000..ece692f --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/MallAnnexService.java @@ -0,0 +1,16 @@ +package com.huoran.nakadai.service; + +import com.huoran.nakadai.entity.MallAnnex; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 商品附件表 服务类 + *

+ * + * @author chen + * @since 2023-05-06 + */ +public interface MallAnnexService extends IService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/MallClassificationService.java b/nakadai/src/main/java/com/huoran/nakadai/service/MallClassificationService.java new file mode 100644 index 0000000..d90fb2e --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/MallClassificationService.java @@ -0,0 +1,16 @@ +package com.huoran.nakadai.service; + +import com.huoran.nakadai.entity.MallClassification; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 商品分类关联表 服务类 + *

+ * + * @author chen + * @since 2023-04-25 + */ +public interface MallClassificationService extends IService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/MallCourseLearningRecordService.java b/nakadai/src/main/java/com/huoran/nakadai/service/MallCourseLearningRecordService.java new file mode 100644 index 0000000..5efaf82 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/MallCourseLearningRecordService.java @@ -0,0 +1,16 @@ +package com.huoran.nakadai.service; + +import com.huoran.nakadai.entity.MallCourseLearningRecord; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 商品课程学习记录 服务类 + *

+ * + * @author chen + * @since 2023-04-26 + */ +public interface MallCourseLearningRecordService extends IService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/MallDisciplineService.java b/nakadai/src/main/java/com/huoran/nakadai/service/MallDisciplineService.java new file mode 100644 index 0000000..0cafb08 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/MallDisciplineService.java @@ -0,0 +1,19 @@ +package com.huoran.nakadai.service; + +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.MallDiscipline; +import com.baomidou.mybatisplus.extension.service.IService; +import org.springframework.web.multipart.MultipartFile; + +/** + *

+ * 商品学科类别关联表 服务类 + *

+ * + * @author chen + * @since 2023-04-25 + */ +public interface MallDisciplineService extends IService { + + R importSubjectCategoriesInBatches(MultipartFile file); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/MallNonAssociatedLinksService.java b/nakadai/src/main/java/com/huoran/nakadai/service/MallNonAssociatedLinksService.java new file mode 100644 index 0000000..b7288c5 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/MallNonAssociatedLinksService.java @@ -0,0 +1,16 @@ +package com.huoran.nakadai.service; + +import com.huoran.nakadai.entity.MallNonAssociatedLinks; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 非关联产品链接 服务类 + *

+ * + * @author chen + * @since 2023-05-15 + */ +public interface MallNonAssociatedLinksService extends IService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/MallPriceService.java b/nakadai/src/main/java/com/huoran/nakadai/service/MallPriceService.java new file mode 100644 index 0000000..b1435d7 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/MallPriceService.java @@ -0,0 +1,16 @@ +package com.huoran.nakadai.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.nakadai.entity.MallPrice; + +/** + *

+ * 商品价格表 服务类 + *

+ * + * @author chen + * @since 2023-04-25 + */ +public interface MallPriceService extends IService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/MallService.java b/nakadai/src/main/java/com/huoran/nakadai/service/MallService.java new file mode 100644 index 0000000..0afccf5 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/MallService.java @@ -0,0 +1,40 @@ +package com.huoran.nakadai.service; + +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.Mall; +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.nakadai.entity.PartnerArticleClassification; +import com.huoran.nakadai.entity.req.GoodsListReq; +import com.huoran.nakadai.entity.vo.GoodsVo; + +import java.util.List; +import java.util.concurrent.ExecutionException; + +/** + *

+ * 商城管理表 服务类 + *

+ * + * @author chen + * @since 2023-04-25 + */ +public interface MallService extends IService { + + R addGoods(GoodsVo goodsVo) throws ExecutionException, InterruptedException; + + R listOfGoods(GoodsListReq goodsListReq); + + GoodsVo detailsOfGoods(Integer mallId,String token); + + boolean deletionOfGoods(Integer mallId); + + boolean renewalOfGoods(GoodsVo goodsVo); + + List schoolGoods(Integer schoolId); + + List goodsSchemeClassification(); + + R websiteProductList(GoodsListReq goodsListReq); + + R stationShoppingMall(GoodsListReq goodsListReq); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/MallSupplierService.java b/nakadai/src/main/java/com/huoran/nakadai/service/MallSupplierService.java new file mode 100644 index 0000000..f0d010c --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/MallSupplierService.java @@ -0,0 +1,16 @@ +package com.huoran.nakadai.service; + +import com.huoran.nakadai.entity.MallSupplier; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 商品供应商关联表 服务类 + *

+ * + * @author chen + * @since 2023-04-25 + */ +public interface MallSupplierService extends IService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/MallTagsService.java b/nakadai/src/main/java/com/huoran/nakadai/service/MallTagsService.java new file mode 100644 index 0000000..3943f02 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/MallTagsService.java @@ -0,0 +1,16 @@ +package com.huoran.nakadai.service; + +import com.huoran.nakadai.entity.MallTags; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 商品分类标签关联表 服务类 + *

+ * + * @author chen + * @since 2023-04-25 + */ +public interface MallTagsService extends IService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/MallTypeService.java b/nakadai/src/main/java/com/huoran/nakadai/service/MallTypeService.java new file mode 100644 index 0000000..dcb534e --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/MallTypeService.java @@ -0,0 +1,16 @@ +package com.huoran.nakadai.service; + +import com.huoran.nakadai.entity.MallType; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 商品类型关联表 服务类 + *

+ * + * @author chen + * @since 2023-04-25 + */ +public interface MallTypeService extends IService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/MessageService.java b/nakadai/src/main/java/com/huoran/nakadai/service/MessageService.java new file mode 100644 index 0000000..25895e6 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/MessageService.java @@ -0,0 +1,11 @@ +package com.huoran.nakadai.service; + +import com.huoran.common.response.R; + +public interface MessageService { + void createQueue(String accountId); + + void sendMessageToUser(String message, String accountId); + + R messagesListener(String accountId,Long deliveryTag); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/ModelDemoHiddenService.java b/nakadai/src/main/java/com/huoran/nakadai/service/ModelDemoHiddenService.java new file mode 100644 index 0000000..498813f --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/ModelDemoHiddenService.java @@ -0,0 +1,16 @@ +package com.huoran.nakadai.service; + +import com.huoran.nakadai.entity.ModelDemoHidden; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 此表是在教师端系统管理,可对于系统内置模型统一管理 服务类 + *

+ * + * @author chen + * @since 2023-06-03 + */ +public interface ModelDemoHiddenService extends IService { + ModelDemoHidden viewDetails(Integer modelId,Integer schoolId); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/ModelReferenceCategoryService.java b/nakadai/src/main/java/com/huoran/nakadai/service/ModelReferenceCategoryService.java new file mode 100644 index 0000000..fb0643d --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/ModelReferenceCategoryService.java @@ -0,0 +1,37 @@ +package com.huoran.nakadai.service; + +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.ModelReferenceCategory; +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.nakadai.entity.ModelSysCategory; +import io.swagger.annotations.ApiParam; +import org.springframework.web.bind.annotation.RequestParam; + +import java.util.List; + +/** + *

+ * 引用模型-分类表 服务类 + *

+ * + * @author chen + * @since 2022-03-04 + */ +public interface ModelReferenceCategoryService extends IService { + //模型列表 + List modelClassList(Integer systemId,Integer founder,Integer schoolId); + + //删除模型分类及分类下的python模型记录 + R deleteModelClass(@RequestParam("categoryId") @ApiParam(value = "分类id") Integer categoryId); + + boolean checkRepeat(ModelReferenceCategory modelSysCategory, Integer type); + + R checkIsShowBySystemId( Integer systemId); + + R modifyIsShowState( Integer systemId, Integer isShow); + + + //读取的是中台创建的引用模型分类 + List builtInClassificationByNakadai(Integer systemId); + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/ModelReferenceDemoService.java b/nakadai/src/main/java/com/huoran/nakadai/service/ModelReferenceDemoService.java new file mode 100644 index 0000000..418e927 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/ModelReferenceDemoService.java @@ -0,0 +1,52 @@ +package com.huoran.nakadai.service; + +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.ModelReferenceDemo; +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.nakadai.entity.req.PageImportModelReq; +import com.huoran.nakadai.entity.req.PageModelReq; + +/** + *

+ * 引用模型代码记录表 服务类 + *

+ * + * @author chen + * @since 2022-03-04 + */ +public interface ModelReferenceDemoService extends IService { + + //模型列表 + R referenceDemoList(PageModelReq req); + + R sortReadingModelByTeacherSideSystem(PageModelReq req); + + //同步原始模型前删除原有数据 + R delModelInfoBySystemId(Integer systemId,Integer founder,Integer schoolId); + + //查询全部模型 + R getAllModelList(PageImportModelReq req); + + R teacherModelList(PageImportModelReq req); + + + //同步模型 + R synchronizationMdel(Integer systemId, Integer accountId); + + + //职站同步模型 + R synchronizationMdelByOccupationlab(Integer systemId,Integer schoolId,Integer accountId); + + + + //职站读取系统内置模型列表 读取自中台引用模型的数据 + R referenceDemoListByNakadai(PageModelReq req); + + R studentModelList(PageImportModelReq req); + + + //教师端:读取中台的模型列表的数据 + R systemModelByTeacher(PageImportModelReq req); + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/ModelSysCategoryService.java b/nakadai/src/main/java/com/huoran/nakadai/service/ModelSysCategoryService.java new file mode 100644 index 0000000..4d314f7 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/ModelSysCategoryService.java @@ -0,0 +1,33 @@ +package com.huoran.nakadai.service; + +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.ModelReferenceCategory; +import com.huoran.nakadai.entity.ModelSysCategory; +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.nakadai.entity.req.ModelSysDemoReq; +import io.swagger.annotations.ApiParam; +import org.springframework.web.bind.annotation.RequestParam; + +import java.util.List; + +/** + *

+ * 源模型-分类表 服务类 + *

+ * + * @author chen + * @since 2022-03-03 + */ +public interface ModelSysCategoryService extends IService { + List sourceModelClassification(ModelSysDemoReq req); + + R deleteSourceModelCategory(@RequestParam("categoryId") @ApiParam(value = "分类id") Integer categoryId); + + boolean checkRepeat(ModelSysCategory modelSysCategory, Integer type); + + List primaryClassification(); + + List classificationByPid(Integer parentId); + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/ModelSysDemoService.java b/nakadai/src/main/java/com/huoran/nakadai/service/ModelSysDemoService.java new file mode 100644 index 0000000..f4967fe --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/ModelSysDemoService.java @@ -0,0 +1,32 @@ +package com.huoran.nakadai.service; + +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.ModelSysDemo; +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.nakadai.entity.req.CopyTheModelToTheNakadaiReq; +import com.huoran.nakadai.entity.req.PageCurriculumReq; +import com.huoran.nakadai.entity.req.PageModelReq; +import org.springframework.web.bind.annotation.RequestBody; + +import java.io.IOException; + +/** + *

+ * 服务类 + *

+ * + * @author chen + * @since 2022-03-04 + */ +public interface ModelSysDemoService extends IService { + R sysModelDemoList(PageModelReq req); + + //运行代码 + R runCode(String code) throws IOException; + + R getAllModelListBySys(PageModelReq req); + + R InstitutionSourceModel(PageModelReq req); + + R copyTheModelToTheNakadai(CopyTheModelToTheNakadaiReq req); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/NotifyService.java b/nakadai/src/main/java/com/huoran/nakadai/service/NotifyService.java new file mode 100644 index 0000000..6f3e9a2 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/NotifyService.java @@ -0,0 +1,18 @@ +package com.huoran.nakadai.service; + +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.Notify; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 消息通知表 服务类 + *

+ * + * @author chen + * @since 2023-05-29 + */ +public interface NotifyService extends IService { + + R messageNotificationList(String accountId,Integer type); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/OSSFileService.java b/nakadai/src/main/java/com/huoran/nakadai/service/OSSFileService.java new file mode 100644 index 0000000..9958a4d --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/OSSFileService.java @@ -0,0 +1,27 @@ +package com.huoran.nakadai.service; + +import com.aliyuncs.exceptions.ClientException; +import com.huoran.common.entity.FilesResult; +import org.springframework.web.multipart.MultipartFile; + +import java.io.IOException; +import java.util.List; + +/** + * @Author chen + * @DATE 2020/9/1 22:01 + * @Version 1.0 + */ +public interface OSSFileService { + + FilesResult upload(MultipartFile file) throws IOException; + + FilesResult fileUpload(MultipartFile file) throws IOException; + + List fileDeletion(List keys); + + String getPlayAuth(String videoId) throws ClientException; + + void removeVideo(String videoId) throws ClientException; + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/OrderOtherService.java b/nakadai/src/main/java/com/huoran/nakadai/service/OrderOtherService.java new file mode 100644 index 0000000..6134680 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/OrderOtherService.java @@ -0,0 +1,37 @@ +package com.huoran.nakadai.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.common.entity.to.JudgmentPointDataTo; +import com.huoran.nakadai.entity.OrderOther; +import com.huoran.nakadai.entity.req.BulkShipOrdersReq; +import com.huoran.nakadai.entity.req.QueryTimeReq; +import com.huoran.nakadai.entity.vo.OrderRenewVo; + +import java.util.ArrayList; + +/** + *

+ * 订单其他信息(包含课程权限、数据平台权限、合同信息等) 服务类 + *

+ * + * @author cheney + * @since 2021-07-01 + */ +public interface OrderOtherService extends IService { + + boolean ship(OrderOther orderOther); + + boolean enable(Integer id, Integer flag); + + void remainingPeriod(); + + ArrayList renew(OrderRenewVo orderRenewVo); + + void customerExpiration(); + + JudgmentPointDataTo getCustomerOrderOther(Integer schoolId, Integer systemId,String name); + + String getOrderOtherTime(QueryTimeReq queryTimeReq); + + boolean bulkShipping(BulkShipOrdersReq bulkShipOrdersReq); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/PartnerAccountService.java b/nakadai/src/main/java/com/huoran/nakadai/service/PartnerAccountService.java new file mode 100644 index 0000000..e61088f --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/PartnerAccountService.java @@ -0,0 +1,52 @@ +package com.huoran.nakadai.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.PartnerAccount; +import com.huoran.nakadai.entity.req.*; +import com.huoran.nakadai.entity.vo.TeamMemberVo; + +import javax.servlet.http.HttpServletResponse; + +/** + *

+ * 合伙人账号表 服务类 + *

+ * + * @author chen + * @since 2022-05-18 + */ +public interface PartnerAccountService extends IService { + + R savePartnerAccount(PartnerAccountAddReq partnerAccountAddReq); + + R pagePartnerAccountList(PartnerAccountListReq req); + + R partnerAccountDetail(Integer accountId); + + R modifyPartnerAccount(PartnerAccountUpdateReq updateReq); + + R delPartnerAccount(Integer accountId); + + void generationQrCode(String url, HttpServletResponse response); + + R getTeamsByAccountId( Integer accountId); + + R transferTeam(TransferTeamReq transferTeamReq); + + R transferAdmin(TransferAdminReq transferAdminReq); + + R partnerAccountMergeList(PartnerAccountListReq req); + + R mailFileSend(FileSendReq fileSendReq); + + String checkRepeatClassName(String teamName); + + R teamPartnerList(PartnerAccountListReq req); + + R queryTeamMembers(TeamMemberVo teamMemberVo); + + R queryPartnerAccount(String phone); + + R partnerAccountApplication(PartnerRegisterReq registerReq); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/PartnerArticleClassificationService.java b/nakadai/src/main/java/com/huoran/nakadai/service/PartnerArticleClassificationService.java new file mode 100644 index 0000000..742f9e2 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/PartnerArticleClassificationService.java @@ -0,0 +1,17 @@ +package com.huoran.nakadai.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.nakadai.entity.PartnerArticleClassification; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @描述:合伙人——文章管理——文章所属分类 service接口 + * @作者: Rong + * @日期: 2023-03-16 + */ +public interface PartnerArticleClassificationService extends IService { + + List categoryIdsQueriesCategoryInformation(@Param("ids") String ids); +} \ No newline at end of file diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/PartnerArticleFileService.java b/nakadai/src/main/java/com/huoran/nakadai/service/PartnerArticleFileService.java new file mode 100644 index 0000000..f742096 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/PartnerArticleFileService.java @@ -0,0 +1,16 @@ +package com.huoran.nakadai.service; + +import com.huoran.nakadai.entity.PartnerArticleFile; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + * @描述:合伙人——文章管理——文章附件管理表 service接口 + * @作者: Rong + * @日期: 2023-03-16 + */ +public interface PartnerArticleFileService extends IService { + List getFileByContentId(Integer contentId); + +} \ No newline at end of file diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/PartnerArticleLabelService.java b/nakadai/src/main/java/com/huoran/nakadai/service/PartnerArticleLabelService.java new file mode 100644 index 0000000..80257fa --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/PartnerArticleLabelService.java @@ -0,0 +1,17 @@ +package com.huoran.nakadai.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.nakadai.entity.PartnerArticleLabel; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @描述:合伙人——文章管理——文章主题标签 service接口 + * @作者: Rong + * @日期: 2023-03-16 + */ +public interface PartnerArticleLabelService extends IService { + List idsQueriesLabelInformation(@Param("ids") String ids); + +} \ No newline at end of file diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/PartnerArticleManagementCollectService.java b/nakadai/src/main/java/com/huoran/nakadai/service/PartnerArticleManagementCollectService.java new file mode 100644 index 0000000..25ff819 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/PartnerArticleManagementCollectService.java @@ -0,0 +1,16 @@ +package com.huoran.nakadai.service; + +import com.huoran.nakadai.entity.PartnerArticleManagementCollect; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 合伙人——学习收藏表 服务类 + *

+ * + * @author chen + * @since 2023-04-18 + */ +public interface PartnerArticleManagementCollectService extends IService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/PartnerArticleManagementService.java b/nakadai/src/main/java/com/huoran/nakadai/service/PartnerArticleManagementService.java new file mode 100644 index 0000000..ca06771 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/PartnerArticleManagementService.java @@ -0,0 +1,27 @@ +package com.huoran.nakadai.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.PartnerArticleManagement; +import com.huoran.nakadai.entity.req.PagePartnerArticleManagementReq; +import com.huoran.nakadai.entity.vo.ContentHeavyTitleReqVO; + +/** + * @描述:合伙人——文章管理 service接口 + * @作者: Rong + * @日期: 2023-03-16 + */ +public interface PartnerArticleManagementService extends IService { + + R partnerOperatingList(PagePartnerArticleManagementReq req); + + /** + * 新增栏目前,标题全库判重 + * @param content + * @return + */ + boolean checkIfTheTitleIsRepeat(ContentHeavyTitleReqVO content); + + /*R modifiedSort(Integer sequenceNumber, Integer articleId);*/ + +} \ No newline at end of file diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/PartnerArticleStatisticService.java b/nakadai/src/main/java/com/huoran/nakadai/service/PartnerArticleStatisticService.java new file mode 100644 index 0000000..4c720f6 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/PartnerArticleStatisticService.java @@ -0,0 +1,18 @@ +package com.huoran.nakadai.service; + +import com.huoran.nakadai.entity.PartnerArticleStatistic; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * @描述:合伙人——文章管理——文章浏览记录 service接口 + * @作者: Rong + * @日期: 2023-03-17 + */ +public interface PartnerArticleStatisticService extends IService { + + //检验是否已经浏览过 + boolean checkForExistence(PartnerArticleStatistic partnerArticleStatistics); + + Integer statisticsOfVisitors(Integer contentId); + +} \ No newline at end of file diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/PartnerClassificationService.java b/nakadai/src/main/java/com/huoran/nakadai/service/PartnerClassificationService.java new file mode 100644 index 0000000..662b304 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/PartnerClassificationService.java @@ -0,0 +1,29 @@ +package com.huoran.nakadai.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.nakadai.entity.PartnerClassification; + +import java.util.List; + +/** + *

+ * 合伙人分类表 服务类 + *

+ * + * @author chen + * @since 2022-05-18 + */ +public interface PartnerClassificationService extends IService { + + boolean checkRepeat(PartnerClassification partnerClassification); + + boolean removeClassification(Integer id); + + List treeList(Integer applet); + + List queryBusinessManagerIdBasedOnTeamId(String teamId); + + void removeRole(String teamId, Integer accountId); + + boolean checkRepeatAll(PartnerClassification partnerClassification); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/PartnerSchemeManagementProductConfigService.java b/nakadai/src/main/java/com/huoran/nakadai/service/PartnerSchemeManagementProductConfigService.java new file mode 100644 index 0000000..07eb1d7 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/PartnerSchemeManagementProductConfigService.java @@ -0,0 +1,20 @@ +package com.huoran.nakadai.service; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.huoran.nakadai.entity.PartnerSchemeManagementProductConfig; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + *

+ * 合伙人——方案管理——产品配置表 服务类 + *

+ * + * @author chen + * @since 2023-06-28 + */ +public interface PartnerSchemeManagementProductConfigService extends IService { + + List obtainProductsAccordingToTheScheme(Integer schemeId,Integer isRelease); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/PartnerSchemeManagementService.java b/nakadai/src/main/java/com/huoran/nakadai/service/PartnerSchemeManagementService.java new file mode 100644 index 0000000..d0c7ef3 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/PartnerSchemeManagementService.java @@ -0,0 +1,18 @@ +package com.huoran.nakadai.service; + +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.PartnerSchemeManagement; +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.nakadai.entity.req.PagePartnerArticleManagementReq; + +/** + *

+ * 合伙人——方案管理 服务类 + *

+ * + * @author chen + * @since 2023-03-20 + */ +public interface PartnerSchemeManagementService extends IService { + R schemeList(PagePartnerArticleManagementReq req); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/PartnerTeamService.java b/nakadai/src/main/java/com/huoran/nakadai/service/PartnerTeamService.java new file mode 100644 index 0000000..7c93280 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/PartnerTeamService.java @@ -0,0 +1,46 @@ +package com.huoran.nakadai.service; + +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.PartnerTeam; +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.nakadai.entity.req.EditProvinceCityReq; +import com.huoran.nakadai.entity.res.PartnerAccountResp; +import com.huoran.nakadai.entity.vo.CheckVo; + +import java.math.BigDecimal; +import java.util.List; + +/** + *

+ * 合伙人团队表(合伙人账号与分类中间表) 服务类 + *

+ * + * @author chen + * @since 2022-05-18 + */ +public interface PartnerTeamService extends IService { + + List getMembersUnderTheSameTeam(Integer classificationId); + + List selectTeamList(String id,int current,int pageSize,String name); + + BigDecimal teamIncome(String id); + + BigDecimal myIncome(); + + R queryUserInfoByPhone(String phone,String partnerId,String teamId); + + String getPhone(String id, int platformId); + + R queryPhone(String phone); + + R updateMyEmail(CheckVo checkVo); + + boolean mailCodeSend(CheckVo checkVo); + + boolean checkName(EditProvinceCityReq provinceCityReq); + + void editUsername(EditProvinceCityReq provinceCityReq); + + void delRoleByAccountIdAndTeamId(Integer accountId, Integer classificationId); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/ProductClassificationService.java b/nakadai/src/main/java/com/huoran/nakadai/service/ProductClassificationService.java new file mode 100644 index 0000000..cb1dd6b --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/ProductClassificationService.java @@ -0,0 +1,16 @@ +package com.huoran.nakadai.service; + +import com.huoran.nakadai.entity.ProductClassification; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 产品分类表 服务类 + *

+ * + * @author chen + * @since 2023-04-25 + */ +public interface ProductClassificationService extends IService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/ProductThemeService.java b/nakadai/src/main/java/com/huoran/nakadai/service/ProductThemeService.java new file mode 100644 index 0000000..66bf120 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/ProductThemeService.java @@ -0,0 +1,14 @@ +package com.huoran.nakadai.service; + +import com.huoran.nakadai.entity.ProductTheme; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * @描述: service接口 + * @作者: Rong + * @日期: 2023-08-22 + */ +public interface ProductThemeService extends IService { + + +} \ No newline at end of file diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/ProductTypeService.java b/nakadai/src/main/java/com/huoran/nakadai/service/ProductTypeService.java new file mode 100644 index 0000000..b8f2e3f --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/ProductTypeService.java @@ -0,0 +1,16 @@ +package com.huoran.nakadai.service; + +import com.huoran.nakadai.entity.ProductType; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 产品类型表 服务类 + *

+ * + * @author chen + * @since 2023-04-25 + */ +public interface ProductTypeService extends IService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/ProgramShoppingCartService.java b/nakadai/src/main/java/com/huoran/nakadai/service/ProgramShoppingCartService.java new file mode 100644 index 0000000..2141d3d --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/ProgramShoppingCartService.java @@ -0,0 +1,22 @@ +package com.huoran.nakadai.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.ProgramShoppingCart; +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.nakadai.entity.req.ProgramShoppingCartReq; +import com.huoran.nakadai.entity.res.ProgramShoppingCartResp; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 小程序—购物车 服务类 + *

+ * + * @author chen + * @since 2023-06-09 + */ +public interface ProgramShoppingCartService extends IService { + R shoppingCartList( ProgramShoppingCartReq req); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/SchoolCurriculumService.java b/nakadai/src/main/java/com/huoran/nakadai/service/SchoolCurriculumService.java new file mode 100644 index 0000000..2fb5c94 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/SchoolCurriculumService.java @@ -0,0 +1,16 @@ +package com.huoran.nakadai.service; + +import com.huoran.nakadai.entity.SchoolCurriculum; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 学校内置课程表 服务类 + *

+ * + * @author lr + * @since 2021-09-26 + */ +public interface SchoolCurriculumService extends IService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/SupplierService.java b/nakadai/src/main/java/com/huoran/nakadai/service/SupplierService.java new file mode 100644 index 0000000..9baaa41 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/SupplierService.java @@ -0,0 +1,16 @@ +package com.huoran.nakadai.service; + +import com.huoran.nakadai.entity.Supplier; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 供应商表 服务类 + *

+ * + * @author chen + * @since 2023-04-25 + */ +public interface SupplierService extends IService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/TagsService.java b/nakadai/src/main/java/com/huoran/nakadai/service/TagsService.java new file mode 100644 index 0000000..ffea4d4 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/TagsService.java @@ -0,0 +1,16 @@ +package com.huoran.nakadai.service; + +import com.huoran.nakadai.entity.Tags; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 分类标签表 服务类 + *

+ * + * @author chen + * @since 2023-04-25 + */ +public interface TagsService extends IService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/ValueModuleManagementService.java b/nakadai/src/main/java/com/huoran/nakadai/service/ValueModuleManagementService.java new file mode 100644 index 0000000..7810ca0 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/ValueModuleManagementService.java @@ -0,0 +1,19 @@ +package com.huoran.nakadai.service; + +import com.huoran.nakadai.entity.ValueModuleManagement; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + *

+ * 增值模块管理表 服务类 + *

+ * + * @author chen + * @since 2023-01-30 + */ +public interface ValueModuleManagementService extends IService { + + List selectProductModule(); +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/CityServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/CityServiceImpl.java new file mode 100644 index 0000000..14e167a --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/CityServiceImpl.java @@ -0,0 +1,31 @@ +package com.huoran.nakadai.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.nakadai.entity.City; +import com.huoran.nakadai.mapper.CityMapper; +import com.huoran.nakadai.service.ICityService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 城市 服务实现类 + *

+ * + * @author huoran + * @since 2021-06-29 + */ +@Service +public class CityServiceImpl extends ServiceImpl implements ICityService { + + @Override + // @Cacheable(value = {"n_city_"},key = "#root.methodName") + public List queryCityList(Integer provinceId) { + List list= this.baseMapper.selectList(new QueryWrapper() + .eq("is_del",0).eq("province_id",provinceId).orderByAsc("city_id")); + return list; + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/CommentLikeServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/CommentLikeServiceImpl.java new file mode 100644 index 0000000..5bc052c --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/CommentLikeServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.nakadai.service.impl; + +import com.huoran.nakadai.entity.CommentLike; +import com.huoran.nakadai.mapper.CommentLikeMapper; +import com.huoran.nakadai.service.CommentLikeService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 课程评论点赞表 服务实现类 + *

+ * + * @author chen + * @since 2023-05-25 + */ +@Service +public class CommentLikeServiceImpl extends ServiceImpl implements CommentLikeService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/CommentServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/CommentServiceImpl.java new file mode 100644 index 0000000..fb916a0 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/CommentServiceImpl.java @@ -0,0 +1,123 @@ +package com.huoran.nakadai.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.Comment; +import com.huoran.nakadai.entity.CommentLike; +import com.huoran.nakadai.entity.Notify; +import com.huoran.nakadai.entity.res.CommentRes; +import com.huoran.nakadai.mapper.CommentLikeMapper; +import com.huoran.nakadai.mapper.CommentMapper; +import com.huoran.nakadai.mapper.NotifyMapper; +import com.huoran.nakadai.service.CommentService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +/** + *

+ * 课程评论回复表 服务实现类 + *

+ * + * @author chen + * @since 2023-05-25 + */ +@Service +public class CommentServiceImpl extends ServiceImpl implements CommentService { + + @Autowired + CommentLikeMapper commentLikeMapper; + + @Autowired + NotifyMapper notifyMapper; + + @Override + public R commentTreeList(Integer mallId, Integer schoolId,String accountId) { + //查询所有顶级评论 + List rootComments = baseMapper.findByParentId(0,mallId,schoolId,accountId); + for (CommentRes rootComment : rootComments) { + rootComment.setCurrentAccountId(accountId); + rootComment.setMallId(mallId); + rootComment.setSchoolId(schoolId); + rootComment.setLevel(1); + if (rootComment.getCreateRoleName() !=null && rootComment.getCreateRoleName().contains("老师")){ + rootComment.setTeacherIDOfCreateAccount(1); + } + if (rootComment.getCreateUsername()==null){ + rootComment.setCreateUsername("超级管理员"); + } + if (rootComment.getReplyUsername()==null){ + rootComment.setReplyUsername("超级管理员"); + } + setChildren(rootComment); + } + //查询当前账号是否为老师管理员账号 + String roleName = baseMapper.selectTeacherAdministrator(accountId); + boolean deleteIdentity = false; + if (roleName!=null){ + if (roleName.contains("老师")||roleName.contains("管理员")){ + deleteIdentity = true; + } + } + return R.ok().put("rootComments",rootComments).put("deleteIdentity",deleteIdentity); + } + + /** + * 递归获取 + * @param commentRes 参数 + */ + public void setChildren(CommentRes commentRes){ + List children = baseMapper.findByParentId(commentRes.getCommentId(),commentRes.getMallId(),commentRes.getSchoolId(),commentRes.getCurrentAccountId()); + if (!children.isEmpty()) { + commentRes.setChildren(children); + for (CommentRes child : children) { + child.setLevel(commentRes.getLevel()+1); + if (child.getCreateRoleName() !=null && child.getCreateRoleName().contains("老师")){ + child.setTeacherIDOfCreateAccount(1); + } + if (child.getReplyRoleName()!=null && child.getReplyRoleName().contains("老师")){ + child.setTeacherIDOfReplyAccount(1); + } + if (child.getCreateUsername()==null){ + child.setCreateUsername("超级管理员"); + } + if (child.getReplyUsername()==null){ + child.setReplyUsername("超级管理员"); + } + child.setCurrentAccountId(commentRes.getCurrentAccountId()); + setChildren(child); + } + } + } + + /** + * 递归删除 + * @param commentId 参数 + */ + @Override + public R removeChildById(Integer commentId) { + List idList = new ArrayList<>(); + this.selectChildListById(commentId, idList); + idList.add(commentId); + + for (Integer id : idList) { + //删除点赞 + commentLikeMapper.delete(new QueryWrapper().eq("comment_id", id)); + //删除通知 + notifyMapper.delete(new QueryWrapper().eq("comment_id", id)); + } + int i = baseMapper.deleteBatchIds(idList); + return i>0 ? R.ok() : R.error(); + } + + private void selectChildListById(Integer id, List idList) { + List childList = baseMapper.selectList(new QueryWrapper().eq("pid", id).select("comment_id")); + childList.forEach(item -> { + idList.add(item.getCommentId()); + this.selectChildListById(item.getCommentId(), idList); + }); + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/CourseServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/CourseServiceImpl.java new file mode 100644 index 0000000..129c894 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/CourseServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.nakadai.service.impl; + +import com.huoran.nakadai.entity.Course; +import com.huoran.nakadai.mapper.CourseMapper; +import com.huoran.nakadai.service.ICourseService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 课程表 服务实现类 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@Service +public class CourseServiceImpl extends ServiceImpl implements ICourseService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/CurriculumChapterServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/CurriculumChapterServiceImpl.java new file mode 100644 index 0000000..c4888df --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/CurriculumChapterServiceImpl.java @@ -0,0 +1,157 @@ +package com.huoran.nakadai.service.impl; + +import com.aliyuncs.exceptions.ClientException; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.common.utils.AliyunOssUtil; +import com.huoran.common.utils.VideoUtil; +import com.huoran.nakadai.entity.CurriculumChapter; +import com.huoran.nakadai.entity.CurriculumSubsection; +import com.huoran.nakadai.entity.vo.ChapterVO; +import com.huoran.nakadai.entity.vo.SortVO; +import com.huoran.nakadai.entity.vo.SubsectionVO; +import com.huoran.nakadai.mapper.CurriculumChapterMapper; +import com.huoran.nakadai.mapper.CurriculumMapper; +import com.huoran.nakadai.mapper.CurriculumSubsectionMapper; +import com.huoran.nakadai.service.CurriculumChapterService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +/** + *

+ * 企业课程章节表 服务实现类 + *

+ * + * @author lr + * @since 2021-09-26 + */ +@Service +public class CurriculumChapterServiceImpl extends ServiceImpl implements CurriculumChapterService { + @Autowired + private CurriculumSubsectionMapper curriculumSubsectionMapper; + + @Override + public List getChapterTree(String courseId) { + // 根据课程ID查询所有章节 + QueryWrapper chapterWrapper = new QueryWrapper<>(); + chapterWrapper.eq("cid", courseId); + //降序查询 + chapterWrapper.orderByAsc("sort"); + List chapters = baseMapper.selectList(chapterWrapper); + + // 根据课程ID查询所有小节 + QueryWrapper subsectionWrapper = new QueryWrapper<>(); + subsectionWrapper.eq("cid", courseId); + //降序查询 + subsectionWrapper.orderByAsc("sort"); + List subsections = curriculumSubsectionMapper.selectList(subsectionWrapper); + + List chapterVOList = new ArrayList<>(); + // 遍历封装 + for (CurriculumChapter c : chapters) { + ChapterVO chapterVO = new ChapterVO(); + //属性复制 + BeanUtils.copyProperties(c, chapterVO); + chapterVOList.add(chapterVO); + + List subsectionVOList = new ArrayList<>(); + for (CurriculumSubsection s : subsections) { + //判断小节是否属于某一章节 + if (c.getId().equals(s.getChapterId())) { + SubsectionVO subsectionVO = new SubsectionVO(); + BeanUtils.copyProperties(s, subsectionVO); + subsectionVOList.add(subsectionVO); + } + } + //设置小节 + chapterVO.setSubsectionList(subsectionVOList); + } + return chapterVOList; + } + + @Override + public boolean removeChapter(Integer chapterId) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("chapter_id", chapterId); + List courseSubsections = curriculumSubsectionMapper.selectList(wrapper); + + if (courseSubsections != null && courseSubsections.size() != 0) { + //循环删除小节 + courseSubsections.forEach(subsection -> { + //删除资源 + boolean isVideo = VideoUtil.isVideo(subsection.getFileType()); + if (isVideo) { + try { + AliyunOssUtil.removeVideo(subsection.getFileId()); + } catch (ClientException e) { + e.printStackTrace(); + } + } else { + List keys = new ArrayList<>(); + keys.add(subsection.getFileName()); + try { + AliyunOssUtil.removeMoreVideo(keys); + } catch (ClientException e) { + e.printStackTrace(); + } + } + curriculumSubsectionMapper.deleteById(subsection.getId()); + }); + } + int count = baseMapper.deleteById(chapterId); + return count > 0; + } + + @Override + public boolean saveChapter(CurriculumChapter courseChapter) { + //查询课程章节的总数 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("cid", courseChapter.getCid()); + int count = baseMapper.selectCount(wrapper); + if (count == 0) { + courseChapter.setSort(1); + } else { + //查询课程章节最大排序数 + count = baseMapper.selectMaxSort(); + courseChapter.setSort(count + 1); + } + int insert = baseMapper.insert(courseChapter); + return insert > 0; + } + + @Override + public boolean updateSort(SortVO sortVO) { + List chapterVOList = sortVO.getChapterVOList(); + if (chapterVOList != null && chapterVOList.size() != 0) { + chapterVOList.forEach(chapterVO -> { + List subsectionList = chapterVO.getSubsectionList(); + if (subsectionList != null && subsectionList.size() != 0) { + subsectionList.forEach(subsectionVO -> { + CurriculumSubsection courseSubsection = new CurriculumSubsection(); + BeanUtils.copyProperties(subsectionVO,courseSubsection); + curriculumSubsectionMapper.updateById(courseSubsection); + }); + } + CurriculumChapter courseChapter = new CurriculumChapter(); + BeanUtils.copyProperties(chapterVO,courseChapter); + baseMapper.updateById(courseChapter); + }); + return true; + } + return false; + } + + @Override + public boolean repeat(CurriculumChapter courseChapter) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("cid", courseChapter.getCid()); + wrapper.eq("name", courseChapter.getName()); + Integer count = baseMapper.selectCount(wrapper); + return count > 0; + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/CurriculumConfigureServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/CurriculumConfigureServiceImpl.java new file mode 100644 index 0000000..b9809f0 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/CurriculumConfigureServiceImpl.java @@ -0,0 +1,67 @@ +package com.huoran.nakadai.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.common.constant.DelConstant; +import com.huoran.common.entity.ProjectManage; +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.CurriculumConfigure; +import com.huoran.nakadai.entity.res.CourseByProjectInfoRes; +import com.huoran.nakadai.entity.res.CurriculumDetailRes; +import com.huoran.nakadai.mapper.CurriculumConfigureMapper; +import com.huoran.nakadai.service.ICurriculumConfigureService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +/** + *

+ * 课程配置表 服务实现类 + *

+ * + * @author lr + * @since 2021-09-17 + */ +@Service +public class CurriculumConfigureServiceImpl extends ServiceImpl implements ICurriculumConfigureService { + + @Override + public R projectListByCourseId(Integer cid, Integer permissions, String projectName) { + return R.ok().put("data", baseMapper.projectListByCourseId(cid, permissions, projectName)); + } + + @Override + public List getCurriculumConfigure(Integer cid, Integer permissions) { + return baseMapper.getCurriculumConfigure(cid, permissions); + } + + @Override + public R checkConfig(Integer projectId) { + + String curriculumName = baseMapper.checkConfig(projectId); + if (curriculumName != null) { + return R.ok("项目权限已更改,请在课程管理重新配置" + curriculumName + "的课程项目!"); + } + + return R.ok(); + + } + + @Override + public List getProjectBySystemIdRemoteCall(String systemId, Integer accountId, Integer permissions, Integer cId, Integer mallId, Integer schoolId) { + + List projectManages = baseMapper.getProjectBySystemIdRemoteCall(systemId, accountId, permissions, cId, mallId, schoolId); + + //课程排序优于老师创建的项目 + List projectManageList = new ArrayList<>(); + List projectIds = baseMapper.selectCurriculumProject(schoolId, systemId, permissions, cId); + + for (Integer projectId : projectIds) { + ProjectManage manage = baseMapper.projectIdGetDetails(projectId); + projectManageList.add(manage); + } + projectManageList.addAll(projectManages); + return projectManageList; + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/CurriculumLearningProgressServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/CurriculumLearningProgressServiceImpl.java new file mode 100644 index 0000000..cc73070 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/CurriculumLearningProgressServiceImpl.java @@ -0,0 +1,31 @@ +package com.huoran.nakadai.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.nakadai.entity.CurriculumLearningProgress; +import com.huoran.nakadai.mapper.CurriculumLearningProgressMapper; +import com.huoran.nakadai.service.CurriculumLearningProgressService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 课程学习进度 服务实现类 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@Service +public class CurriculumLearningProgressServiceImpl extends ServiceImpl implements CurriculumLearningProgressService { + + @Override + public List curriculumLearningProgresses(Integer accountId, String cid) { + QueryWrapper qwrap = new QueryWrapper<>(); + qwrap.eq("cid",cid); + qwrap.eq("account_id",accountId); + List list = baseMapper.selectList(qwrap); + return list; + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/CurriculumNotesServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/CurriculumNotesServiceImpl.java new file mode 100644 index 0000000..99e7157 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/CurriculumNotesServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.nakadai.service.impl; + +import com.huoran.nakadai.entity.CurriculumNotes; +import com.huoran.nakadai.mapper.CurriculumNotesMapper; +import com.huoran.nakadai.service.CurriculumNotesService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 课程笔记表 服务实现类 + *

+ * + * @author chen + * @since 2023-05-04 + */ +@Service +public class CurriculumNotesServiceImpl extends ServiceImpl implements CurriculumNotesService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/CurriculumRecentUseServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/CurriculumRecentUseServiceImpl.java new file mode 100644 index 0000000..0d6f91b --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/CurriculumRecentUseServiceImpl.java @@ -0,0 +1,32 @@ +package com.huoran.nakadai.service.impl; + +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.huoran.common.response.R; +import com.huoran.nakadai.entity.CurriculumRecentUse; +import com.huoran.nakadai.entity.req.PageCurriculumRecentUseReq; +import com.huoran.nakadai.entity.res.SchoolCourseRes; +import com.huoran.nakadai.mapper.CurriculumRecentUseMapper; +import com.huoran.nakadai.service.CurriculumRecentUseService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author chen + * @since 2023-04-19 + */ +@Service +public class CurriculumRecentUseServiceImpl extends ServiceImpl implements CurriculumRecentUseService { + + @Override + public R recentUse(PageCurriculumRecentUseReq req) { + + Page page = new Page<>(req.getPageNum(), req.getPageSize()); + IPage pageList = baseMapper.recentUse(page, req); + return R.ok().put("page",pageList); + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/CurriculumServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/CurriculumServiceImpl.java new file mode 100644 index 0000000..9cd1d41 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/CurriculumServiceImpl.java @@ -0,0 +1,354 @@ +package com.huoran.nakadai.service.impl; + +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +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.huoran.api.OccupationlabClient; +import com.huoran.common.constant.DelConstant; +import com.huoran.common.exception.CustomException; +import com.huoran.common.exception.ExceptionEnum; +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.*; +import com.huoran.nakadai.entity.req.AddCurriculumReq; +import com.huoran.nakadai.entity.req.ModifyCurriculumReq; +import com.huoran.nakadai.entity.req.PageCurriculumReq; +import com.huoran.nakadai.entity.res.CurriculumDetailRes; +import com.huoran.nakadai.entity.res.CurriculumRes; +import com.huoran.nakadai.entity.res.SchoolCourseRes; +import com.huoran.nakadai.mapper.*; +import com.huoran.nakadai.service.ICurriculumService; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + +/** + *

+ * 课程管理 服务实现类 + *

+ * + * @author lr + * @since 2021-09-16 + */ +@Service +public class CurriculumServiceImpl extends ServiceImpl implements ICurriculumService { + + @Autowired + private OccupationlabClient occupationlabClient; + @Autowired + private CurriculumConfigureMapper configureMapper; + @Autowired + private SchoolCurriculumMapper schoolCurriculumMapper; + @Autowired + private OrderMapper orderMapper; + @Autowired + private CurriculumChapterMapper chapterMapper; + + @Autowired + private CurriculumMapper curriculumMapper; + + @Autowired + private MallMapper mallMapper; + + /** + * @Description: 创建课程 + * @auther: Rong + * @date: 2021/9/17 11:49 + */ + @Override + public R createCurriculum(AddCurriculumReq req) { + Curriculum curriculum = new Curriculum(); + BeanUtils.copyProperties(req, curriculum); + int ret = baseMapper.insert(curriculum); + //练习系统id 因为选择应用配置时可以选择多个系统的练习项目 + if (req.getSystemIdByPractice().size() > 0) { + req.getSystemIdByPractice().stream().forEach(practice -> { + configureMapper.insert(new CurriculumConfigure() + .setSort(practice.getSort()) + .setProjectId(practice.getProjectId()) + .setSystemId(practice.getSystemId()) + .setCid(curriculum.getCid()) + .setPermissions(0) + .setIsShow(practice.getIsShow()) + ); + }); + } + //考核系统id 因为选择应用配置时可以选择多个系统下的考核项目 + if (req.getSystemIdByAssessment().size() > 0) { + req.getSystemIdByAssessment().stream().forEach(assessment -> { + configureMapper.insert(new CurriculumConfigure() + .setSort(assessment.getSort()) + .setProjectId(assessment.getProjectId()) + .setSystemId(assessment.getSystemId()) + .setCid(curriculum.getCid()) + .setPermissions(1) + .setIsShow(assessment.getIsShow()) + ); + }); + }//竞赛系统id 因为选择应用配置时可以选择多个系统下的考核项目 + if (req.getSystemIdByCompetition().size() > 0) { + req.getSystemIdByCompetition().stream().forEach(assessment -> { + configureMapper.insert(new CurriculumConfigure() + .setSort(assessment.getSort()) + .setProjectId(assessment.getProjectId()) + .setSystemId(assessment.getSystemId()) + .setCid(curriculum.getCid()) + .setPermissions(2) + .setIsShow(assessment.getIsShow()) + ); + }); + } + //默认添加第一章 + CurriculumChapter chapter = new CurriculumChapter(); + chapter.setCid(curriculum.getCid()); + chapter.setSort(1); + chapter.setName("第一章"); + chapterMapper.insert(chapter); + + Integer cid = curriculum.getCid(); + Integer schoolId = curriculum.getSchoolId(); + + //学校id不为空,学校端添加课程对应学校关系 + if (req.getSchoolId() != null) { + SchoolCurriculum schoolCurriculum = new SchoolCurriculum(); + schoolCurriculum.setCid(cid); + schoolCurriculum.setSchoolId(schoolId); + schoolCurriculumMapper.insert(schoolCurriculum); + } + + return ret > 0 ? R.ok().put("cid", cid) : R.error(); + } + + @Override + public R modifyCourse(ModifyCurriculumReq req) { + Curriculum curriculum = new Curriculum(); + BeanUtils.copyProperties(req, curriculum); + + //当考核练习系统id不为空时,对已有的记录进行逻辑删除操作 重新新增 + //考核系统id + if (req.getSystemIdByAssessment() != null) { + //根据课程id删除课程配置表的记录 + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.set("is_del", DelConstant.IS_DEL); + updateWrapper.eq("permissions", 1); + updateWrapper.eq("cid", req.getCid()); + configureMapper.update(new CurriculumConfigure(), updateWrapper); + + //考核系统id 因为选择应用配置时可以选择多个系统下的考核项目 + if (req.getSystemIdByAssessment().size() > 0) { + req.getSystemIdByAssessment().stream().forEach(assessment -> { + configureMapper.insert(new CurriculumConfigure() + .setSort(assessment.getSort()) + .setProjectId(assessment.getProjectId()) + .setSystemId(assessment.getSystemId()) + .setCid(curriculum.getCid()) + .setPermissions(1) + .setIsShow(assessment.getIsShow()) + ); + }); + } + } + + //练习系统id + if (req.getSystemIdByPractice() != null) { + + //根据课程id删除课程配置表的练习记录 + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.set("is_del", DelConstant.IS_DEL); + updateWrapper.eq("cid", req.getCid()); + updateWrapper.eq("permissions", 0); + configureMapper.update(new CurriculumConfigure(), updateWrapper); + //练习系统id 因为选择应用配置时可以选择多个系统的练习项目 + if (req.getSystemIdByPractice().size() > 0) { + req.getSystemIdByPractice().stream().forEach(practice -> { + configureMapper.insert(new CurriculumConfigure() + .setSort(practice.getSort()) + .setProjectId(practice.getProjectId()) + .setSystemId(practice.getSystemId()) + .setCid(curriculum.getCid()) + .setPermissions(0) + .setIsShow(practice.getIsShow()) + ); + }); + } + } + + //竞赛系统id + if (req.getSystemIdByCompetition() != null) { + + //根据课程id删除课程配置表的练习记录 + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.set("is_del", DelConstant.IS_DEL); + updateWrapper.eq("cid", req.getCid()); + updateWrapper.eq("permissions", 2); + configureMapper.update(new CurriculumConfigure(), updateWrapper); + //练习系统id 因为选择应用配置时可以选择多个系统的练习项目 + if (req.getSystemIdByCompetition().size() > 0) { + req.getSystemIdByCompetition().stream().forEach(practice -> { + configureMapper.insert(new CurriculumConfigure() + .setSort(practice.getSort()) + .setProjectId(practice.getProjectId()) + .setSystemId(practice.getSystemId()) + .setCid(curriculum.getCid()) + .setPermissions(2) + .setIsShow(practice.getIsShow()) + ); + }); + } + } + + int ret = baseMapper.updateById(curriculum); + + return ret > 0 ? R.ok() : R.error(); + + } + + @Override + public R delCourse(List cids) { + + //先删除课程配置信息,再删除课程信息 + if (cids.size() > 0) { + cids.forEach(cid -> { + //查询是否有关联上架商品,有提示无法删 + int count = baseMapper.selectAssociatedListedGoods(cid); + if (count > 0){ + throw new CustomException(ExceptionEnum.ASSOCIATED_PRODUCT); + } + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.set("is_del", DelConstant.IS_DEL); + updateWrapper.eq("cid", cid); + configureMapper.update(new CurriculumConfigure(), updateWrapper); + }); + } + + int deleteBatchIds = baseMapper.deleteBatchIds(cids); + + return deleteBatchIds > 0 ? R.ok() : R.error(); + } + + @Override + public R deleteCoursePrompt(List cids) { + //先删除课程配置信息,再删除课程信息 + StringBuilder stringBuilder = new StringBuilder(); + int i = 0; + for (Integer cid : cids) { + //查询是否有关联上架商品,有提示无法删 + int count = baseMapper.selectAssociatedListedGoods(cid); + if (count > 0){ + Curriculum curriculum = baseMapper.selectById(cid); + stringBuilder.append(curriculum.getCurriculumName()+"、"); + i++; + } + } + if (i>0){ + return R.error(stringBuilder.substring(0,stringBuilder.toString().length()-1)+"已关联产品,请在商城管理下架对应产品后再删除!"); + } + return R.ok(); + } + + @Override + public R curriculumList(PageCurriculumReq req) { + if (req.getSupplierId().length()==1 && "1".equals(req.getSupplierId())){ + return R.ok().put("page",null); + } + Page page = new Page<>(req.getPageNum(), req.getPageSize()); + //查询包含供应商配置的课程 + List cIds = baseMapper.selectCurriculumBySupplier(req.getSupplierId()); + if (!cIds.isEmpty()){ + req.setCIds(cIds); + } + //查询已经关联产品的课程id + List ids = baseMapper.selectProductCurriculum(); + IPage curriculumResIPage = baseMapper.curriculumList(page, req); + for (CurriculumRes curriculumRes : curriculumResIPage.getRecords()) { + if (ids.contains(curriculumRes.getCid())){ + curriculumRes.setAssociatedProductIdentification(true); + } + } + return R.ok().put("page", curriculumResIPage); + } + + @Override + public R schoolCourse(Integer schoolId) { + + List schoolCourse = orderMapper.schoolCourse(schoolId); + /*for (SchoolCourseRes res : schoolCourse) { + res.setSystemId(configureMapper.getConfigureSystemId(res.getCid())); + }*/ + return R.ok().put("data", schoolCourse); + } + + @Override + public R getSchoolEffectiveCourse(Integer schoolId) { + List schoolCourse = orderMapper.getSchoolEffectiveCourse(schoolId); + return R.ok().put("data", schoolCourse); + } + + @Override + public R schoolCourseByAchievement(Integer schoolId) { + + List schoolCourse = orderMapper.schoolCourseByAchievement(schoolId); + for (SchoolCourseRes res : schoolCourse) { + res.setSystemId(configureMapper.getConfigureSystemId(res.getCid())); + } + return R.ok().put("data", schoolCourse); + } + + /** + * @Description: 课程详情 + * @auther: Rong + * @date: 2021/9/29 10:45 + */ + @Override + public R curriculumDetail(Integer cid,Integer mallId) { + Curriculum curriculum = baseMapper.selectCurriculum(cid); + //读取商品详情介绍 + if (mallId!=null){ + Mall mall = mallMapper.selectById(mallId); + curriculum.setBriefIntroduction(mall.getDetailedIntroduction()); + } + + String systemIds = configureMapper.getConfigureSystemId(cid); + + curriculum.setSystemIds(systemIds); + List practice = configureMapper.getCurriculumConfigure(cid, 0); + List assessment = configureMapper.getCurriculumConfigure(cid, 1); +// 竞赛配置 + List competition = configureMapper.getCurriculumConfigure(cid, 2); + + curriculum.setPracticeConfig(practice); + curriculum.setAssessmentConfig(assessment); + curriculum.setCompetitionConfig(competition); + return R.ok().put("data", curriculum); + } + + @Override + public List getSystemIdByCustomerId(Integer customerId) { + Set systemIds = curriculumMapper.getSystemIdByCustomerId(customerId); + return new ArrayList<>(systemIds); + } + + @Override + public String getSchoolCourse(Integer schoolId) { + String str = ""; + List list = orderMapper.schoolCourse(schoolId); + for (SchoolCourseRes s : list) { + str += s.getCid() + ","; + } + return str.substring(0, str.length() - 1); + } + + @Override + public R whetherToRenewTheFee(Integer schoolId, Integer mallId) { + SchoolCourseRes res = orderMapper.whetherToRenewTheFee(schoolId,mallId); + //返回是否续费 0表示没有该月订单的课程(显示续约按钮) 1表示正常显示课程 + if (res==null){ + return R.ok().put("isRenew",0); + } + return R.ok().put("isRenew",1); + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/CurriculumSubsectionServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/CurriculumSubsectionServiceImpl.java new file mode 100644 index 0000000..c389420 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/CurriculumSubsectionServiceImpl.java @@ -0,0 +1,76 @@ +package com.huoran.nakadai.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.common.utils.AliyunOssUtil; +import com.huoran.nakadai.entity.CurriculumSubsection; +import com.huoran.nakadai.mapper.CurriculumSubsectionMapper; +import com.huoran.nakadai.service.CurriculumSubsectionService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.List; + +/** + *

+ * 企业课程小节表 服务实现类 + *

+ * + * @author lr + * @since 2021-09-26 + */ +@Service +public class CurriculumSubsectionServiceImpl extends ServiceImpl implements CurriculumSubsectionService { + + /** + * 删除小节及资源 + * + * @param subsectionId 小节id + */ + @Transactional + @Override + public boolean removeSubsection(String subsectionId) { + CurriculumSubsection courseSubsection = baseMapper.selectById(subsectionId); +// String fileType = courseSubsection.getFileType(); +// //删除资源 +// boolean isVideo = VideoUtil.isVideo(fileType); +// if (isVideo) { +// AliyunOssUtil.removeVideo(courseSubsection.getFileId()); +// } else { +// } + List keys = new ArrayList<>(); + keys.add(courseSubsection.getFileName()); + AliyunOssUtil.deleteFiles(keys); + //删除小节 + int count = baseMapper.deleteById(Integer.valueOf(subsectionId)); + return count > 0; + } + + @Override + public boolean saveSubsection(CurriculumSubsection courseSubsection) { + //查询章节小节的总数 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("chapter_id", courseSubsection.getChapterId()); + int count = baseMapper.selectCount(wrapper); + if (count == 0) { + courseSubsection.setSort(1); + } else { + //查询章节小节最大排序数 + count = baseMapper.selectMaxSort(); + courseSubsection.setSort(count + 1); + } + int insert = baseMapper.insert(courseSubsection); + return insert > 0; + } + + @Override + public boolean repeat(CurriculumSubsection courseSubsection) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("chapter_id", courseSubsection.getChapterId()); + wrapper.eq("cid", courseSubsection.getCid()); + wrapper.eq("name", courseSubsection.getName()); + Integer count = baseMapper.selectCount(wrapper); + return count > 0; + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/CustomerServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/CustomerServiceImpl.java new file mode 100644 index 0000000..44032fc --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/CustomerServiceImpl.java @@ -0,0 +1,474 @@ +package com.huoran.nakadai.service.impl; + +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.entity.ExportParams; +import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; +import cn.hutool.core.util.ObjectUtil; +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.huoran.api.OccupationlabClient; +import com.huoran.api.UserClient; +import com.huoran.common.exception.CustomException; +import com.huoran.common.exception.ExceptionEnum; +import com.huoran.common.response.R; +import com.huoran.common.utils.MD5; +import com.huoran.common.utils.PageUtils; +import com.huoran.nakadai.entity.*; +import com.huoran.nakadai.entity.req.CustomerListReq; +import com.huoran.nakadai.entity.req.CustomerReq; +import com.huoran.nakadai.entity.req.ListOfClientCommercialManagersReq; +import com.huoran.nakadai.entity.req.SalesProgressReq; +import com.huoran.nakadai.entity.res.*; +import com.huoran.nakadai.mapper.*; +import com.huoran.nakadai.service.ICustomerService; +import com.huoran.nakadai.utils.ExcelStyleUtil; +import org.apache.commons.lang3.StringUtils; +import org.apache.ibatis.annotations.Param; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.math.BigDecimal; +import java.net.URLEncoder; +import java.util.HashSet; +import java.util.List; +import java.util.UUID; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ThreadPoolExecutor; + +/** + *

+ * 客户表 服务实现类 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@Service +public class CustomerServiceImpl extends ServiceImpl implements ICustomerService { + + @Autowired + private HrContractInformationMapper hrContractInformationMapper; + + @Autowired + private HrCoursePermissionsMapper hrCoursePermissionsMapper; + + @Autowired + private HrDataPermissionsMapper hrDataPermissionsMapper; + + @Autowired + private OrderOtherMapper orderOtherMapper; + + @Autowired + private OrderMapper orderMapper; + + @Autowired + private UserClient userClient; + + @Resource + private RedisTemplate stringRedisTemplate; + + @Autowired + private OccupationlabClient occupationlabClient; + + @Autowired + private SchoolMapper schoolMapper; + + @Autowired + private HrStaffMapper staffMapper; + + @Autowired + private CurriculumMapper curriculumMapper; + + @Autowired + ThreadPoolExecutor executor; + @Autowired + private PartnerTeamMapper teamMapper; + + @Override + public int addCustomer(CustomerReq customerReq) throws ExecutionException, InterruptedException { + //账号去重 + int count = baseMapper.queryAccountExists(customerReq.getAccount()); + if (count > 0) { + throw new CustomException(ExceptionEnum.EXIST_ACCOUNT); + } + + //添加客户、账号基本信息 + CompletableFuture customerAccountFuture = CompletableFuture.supplyAsync(() -> { + //添加客户默认用户信息 + UserInfo userInfo = new UserInfo(); + // userInfo.setUserName();用户姓名默认为空 + /*if (customerReq.getPhone()==null){ + userInfo.setPhone("18888888888"); + }else { + userInfo.setPhone(customerReq.getPhone()); + }*/ + userInfo.setUniqueIdentification(UUID.randomUUID().toString()); + userInfo.setUserName("学校超管");//设置客户默认名称 + staffMapper.addUserInfo(userInfo); + + Customer customer = new Customer(); + BeanUtils.copyProperties(customerReq, customer); + baseMapper.insert(customer); + + //将账号密码以及学校id添加到账号表 + HrUserAccount account = new HrUserAccount(); + account.setAccount(customerReq.getAccount()); + account.setPassword(MD5.encrypt("1122aa")); + account.setSchoolId(customerReq.getSchoolId()); + account.setUserId(userInfo.getUserId()); + account.setCustomerId(customer.getCustomerId()); + account.setPlatformId("1,2"); + customerReq.setCustomerId(customer.getCustomerId()); + customerReq.setSchoolId(customer.getSchoolId()); + baseMapper.insertUserAccount(account); + + return account.getId(); + }, executor); + + //为客户添加各模块之间数据 + CompletableFuture questionFuture = customerAccountFuture.thenAcceptAsync(res -> { + //添加测评管理数据 + occupationlabClient.copyQuestion(customerReq.getSchoolId(), res); + }, executor); + + CompletableFuture studentFuture = customerAccountFuture.thenAcceptAsync(res -> { + //添加学生管理数据 + occupationlabClient.saveData(customerReq.getSchoolId()); + }, executor); + + CompletableFuture courseFuture = customerAccountFuture.thenAcceptAsync(res -> { + //添加理论课程管理数据 + occupationlabClient.addCourseData(customerReq.getSchoolId(), res); + }, executor); + + CompletableFuture articleFuture = customerAccountFuture.thenAcceptAsync(res -> { + //添加咨询管理数据 + occupationlabClient.addArticleData(res, customerReq.getSchoolId()); + }, executor); + + CompletableFuture sampleFuture = customerAccountFuture.thenAcceptAsync(res -> { + //添加赛事管理数据 + occupationlabClient.eventSampleData(customerReq.getSchoolId(), res); + }, executor); + + CompletableFuture evaluationFuture = customerAccountFuture.thenAcceptAsync(res -> { + //增加测评规则内置数据 + occupationlabClient.copyEvaluationRules(customerReq.getSchoolId()); + }, executor); + + CompletableFuture authorityFuture = customerAccountFuture.thenAcceptAsync(res -> { + //添加职站及数据平台权限 + userClient.addCustomerAdmin(customerReq.getSchoolId(), res.toString()); + }, executor); + + CompletableFuture staffFuture = customerAccountFuture.thenAcceptAsync(res -> { + //添加员工组织架构内置数据 + occupationlabClient.saveStaffData(customerReq.getSchoolId()); + }, executor); + + CompletableFuture builtInCourseClassification = customerAccountFuture.thenAcceptAsync(res -> { + //添加理论课程分类内置数据 + occupationlabClient.builtInCourseClassification(customerReq.getSchoolId(), res); + }, executor); + + //等待所有任务都完成 + CompletableFuture.allOf(questionFuture, studentFuture, courseFuture, articleFuture, sampleFuture, evaluationFuture, authorityFuture, staffFuture, builtInCourseClassification).get(); + + return customerAccountFuture.get(); + } + + @Override + public PageUtils queryPage(Integer page, Integer size, CustomerListReq customerListReq) { + //分页参数 + if (page <= 0) { + page = 1; + } + if (size <= 0) { + size = 10; + } + if (!StringUtils.isEmpty(customerListReq.getSupplierId())) { + //查询包含供应商配置的课程 + List cIds = curriculumMapper.selectCurriculumBySupplier(customerListReq.getSupplierId()); + //根据数据权限查询客户 + //查询课程的数据权限订单id + HashSet orderIds = new HashSet<>(); + if (!cIds.isEmpty()) { + orderIds = orderMapper.dataPermissionOrderId(cIds); + } + //查询数据产品的数据权限订单id + HashSet dataProductOrderIds = orderMapper.dataPermissionOrderIdByDataProduct(customerListReq.getSupplierId()); + orderIds.addAll(dataProductOrderIds); + //查询增值权限订单id + HashSet valueOrderIds = orderMapper.valuePermissionOrderIds(); + orderIds.addAll(valueOrderIds); + List customerIds = baseMapper.selectDataPermissionCustomer(orderIds); + customerListReq.setCustomerIds(customerIds); + } + IPage positionVO = baseMapper.pageByCondition(new Page(page, size), customerListReq); + return new PageUtils(positionVO); + } + + @Override + public int resetPwd(Integer customerId) { + //根据客户id修改所有的账号密码 + HrUserAccount hrUserAccount = new HrUserAccount(); + hrUserAccount.setCustomerId(customerId); + hrUserAccount.setPassword(MD5.encrypt("1122aa")); + return baseMapper.updatePwdByCustomerId(hrUserAccount); + } + + @Override + public int delCustomer(Integer customerId) { + + //根据客户id查询学校id,根据学校id删除 数据操作记录表 + Customer customer1 = this.baseMapper.selectOne(new QueryWrapper().eq("customer_id", customerId)); + boolean a = this.baseMapper.delDataRecords(customer1.getSchoolId()); + + boolean c = this.baseMapper.updateUserInfo(customer1.getSchoolId()); + + boolean d = this.baseMapper.updateAccount(customer1.getSchoolId()); + + Customer customer = new Customer(); + customer.setIsDel(1); + //删除所有客户对应的账号 + boolean b = this.baseMapper.updateDelById(customerId); + return baseMapper.update(customer, new QueryWrapper().eq("customer_id", customerId)); + } + + @Override + public CustomerDetailRes queryCustomerDetails(Integer customerId) { + //根据customerId获取customer + CustomerRes customer = this.baseMapper.selectCustomer(customerId); + + //根据客户id查询绑定的合同信息 + List contractList = hrContractInformationMapper.selectContractInfo(customerId); + + //根据客户id查询绑定的课程权限 + List courseList = orderOtherMapper.selectCoursePermissions(customerId); + + //根据客户id查询绑定的数据平台权限 + List dataPlatformList = orderOtherMapper.selectDataPermissions(customerId); + + CustomerDetailRes res = new CustomerDetailRes(); + res.setCustomer(customer); + res.setContractInformations(contractList); + res.setCoursePermissionss(courseList); + res.setDataPermissionss(dataPlatformList); + return res; + } + + @Override + public int updateCourseEnabled(Integer coursePermissionsId, Integer isEnabled) { + HrCoursePermissions hrCoursePermissions = new HrCoursePermissions(); + hrCoursePermissions.setIsEnabled(isEnabled); + hrCoursePermissions.setCoursePermissionsId(coursePermissionsId); + return hrCoursePermissionsMapper.updateById(hrCoursePermissions); + } + + @Override + public int updateDataEnabled(Integer dataPermissionsId, Integer isEnabled) { + HrDataPermissions hrDataPermissions = new HrDataPermissions(); + hrDataPermissions.setIsEnabled(isEnabled); + hrDataPermissions.setDataPermissionsId(dataPermissionsId); + return hrDataPermissionsMapper.updateById(hrDataPermissions); + } + + @Override + public int updateCustomer(CustomerReq customerReq) { + + Customer customer = new Customer(); + BeanUtils.copyProperties(customerReq, customer); + //根据客户id修改账号表的账号 + boolean b = this.baseMapper.updateAccountById(customer.getCustomerId(), customerReq.getAccount()); + + return this.baseMapper.updateById(customer); + } + + @Override + public int updateCustomerByRoleId(@Param("customerId") Integer customerId, @Param("roleId") String roleId) { + return this.baseMapper.updateCustomerByRoleId(customerId, roleId); + } + + @Override + public int updateEnabled(Integer id, Integer isEnable) { + OrderOther orderOther = new OrderOther(); + orderOther.setIsEnable(isEnable); + orderOther.setId(id); + return orderOtherMapper.updateById(orderOther); + } + + @Override + public int queryCustomerIsExists(Integer schoolId) { + + return this.baseMapper.selectCount(new QueryWrapper().eq("is_del", 0).eq("school_id", schoolId)); + } + + @Override + @CacheEvict(value = "n_school_", key = "'querySchool'") + public int delCustomers(List ids) { + //根据客户id查询学校id,根据学校id删除 数据操作记录表 + List schoolIds = this.baseMapper.selectSchoolIds(ids); + //删除学校表该学校 然后新增一条一样的数据(为了避免出现删除该校后再新增该校还会有之前该校的数据) + for (Integer schoolId : schoolIds) { + //同时再新增一个学校信息 + School school = schoolMapper.selectById(schoolId); + if (ObjectUtil.isNotNull(school)) { + schoolMapper.insert(school); + } + //删除学校 + schoolMapper.deleteById(schoolId); + } + + boolean a = this.baseMapper.delDataRecordsBySchoolIds(schoolIds); + + boolean c = this.baseMapper.updateUserInfoBySchoolIds(schoolIds); + + boolean d = this.baseMapper.updateAccountBySchoolIds(schoolIds); + + //根据key删除redis中的缓存 + for (Integer schoolId : schoolIds) { + System.out.println("清空缓存~~~~"); + stringRedisTemplate.delete("databaseInfo:" + schoolId + "+1000-01-01 01:01:01+9999-01-01 01:01:01"); + } + + //删除所有客户对应的账号 + boolean b = this.baseMapper.delAccountsById(ids); + return baseMapper.delCustomers(ids); + } + + @Override + public List checkEmailOrPhone(Customer customer) { + return baseMapper.checkEmailOrPhone(customer); + } + + @Override + public R getCustomerListBasedOnBusinessManagerId(@Param("req") ListOfClientCommercialManagersReq req) { + Page page = new Page(req.getPageNum(), req.getPageSize()); + IPage pageList = baseMapper.getCustomerListBasedOnBusinessManagerId(page, req); + return R.ok().put("data", pageList); + } + + @Override + public Integer newCustomerOnOrder(SalesProgressReq req) { + return baseMapper.getNewCustomerOnOrder(req); + } + + @Override + public Integer newProductAddedToOrder(SalesProgressReq req) { + return baseMapper.getNewProductAddedToOrder(req); + } + + @Override + public AnnualOperatingAnalysisResp annualOperatingAnalysis(SalesProgressReq req) { + //查询费率 + QueryWrapper queryWrapper = new QueryWrapper<>(); + + queryWrapper.eq("classification_id", req.getTeamId()); +// queryWrapper.eq("partner_id", req.getBusinessManagerId()); + PartnerTeam partnerTeam = teamMapper.selectOne(queryWrapper); + + + /** + * 1、查询当前用户所在团队本人本年内的已完成的订单,已删除的订单不计算在内; + * 2、总成交金额:全年订单产品的成交价之和 + * 3、总结算金额:全年订单产品的结算价之和; + * 4、总市场服务费:市场服务费率项目抽成的金额,为产品全年销售金额(即成交金额之和)*所填入的费率; + * 5、项目收益:总成交金额-总结算金额-总市场服务费。 + */ + AnnualOperatingAnalysisResp resp = baseMapper.annualOperatingAnalysis(req); + if (resp != null) { + if (partnerTeam != null) { + if (partnerTeam.getAnnualMarketingFee() != null) { + BigDecimal bigDecimal = resp.getFinalPrice().multiply((partnerTeam.getAnnualMarketingFee().divide(new BigDecimal(100)))); + //市场服务费 = 即成交金额之和 * 所填入的费率/100; + resp.setMarketingServiceCharge(bigDecimal); + } else { + resp.setMarketingServiceCharge(new BigDecimal(0)); + } + + if (resp.getMarketingServiceCharge() != null) { + //项目收益:总成交金额-总结算金额-总市场服务费 + resp.setProjectBenefit(resp.getFinalPrice().subtract(resp.getSettlementPrice()).subtract(resp.getMarketingServiceCharge())); + } + } + } + + /*AnnualOperatingAnalysisToStringResp toStringResp = new AnnualOperatingAnalysisToStringResp(); + if (resp != null) { + + + if (resp.getMarketingServiceCharge() != null) { + toStringResp.setMarketingServiceCharge(RelativeNumberFormatTool.relativeNumberFormat(resp.getMarketingServiceCharge(), "PY")); + } + + if (resp.getFinalPrice() != null) { + toStringResp.setFinalPrice(RelativeNumberFormatTool.relativeNumberFormat(resp.getFinalPrice(), "PY")); + } + + if (resp.getProjectBenefit() != null) { + toStringResp.setProjectBenefit(RelativeNumberFormatTool.relativeNumberFormat(resp.getProjectBenefit(), "PY")); + } + + if (resp.getSettlementPrice() != null) { + toStringResp.setSettlementPrice(RelativeNumberFormatTool.relativeNumberFormat(resp.getSettlementPrice(), "PY")); + } + + }*/ + + return resp; + } + + @Override + public void exportClient(CustomerListReq customerListReq, HttpServletResponse response) throws Exception { + + + if (!StringUtils.isEmpty(customerListReq.getSupplierId())) { + //查询包含供应商配置的课程 + List cIds = curriculumMapper.selectCurriculumBySupplier(customerListReq.getSupplierId()); + //根据数据权限查询客户 + //查询课程的数据权限订单id + HashSet orderIds = new HashSet<>(); + if (!cIds.isEmpty()) { + orderIds = orderMapper.dataPermissionOrderId(cIds); + } + //查询数据产品的数据权限订单id + HashSet dataProductOrderIds = orderMapper.dataPermissionOrderIdByDataProduct(customerListReq.getSupplierId()); + orderIds.addAll(dataProductOrderIds); + //查询增值权限订单id + HashSet valueOrderIds = orderMapper.valuePermissionOrderIds(); + orderIds.addAll(valueOrderIds); + List customerIds = baseMapper.selectDataPermissionCustomer(orderIds); + customerListReq.setCustomerIds(customerIds); + } +// IPage positionVO = baseMapper.pageByCondition(new Page(customerListReq.getPage(), customerListReq.getSize()), customerListReq); + + + Page assessPage = new Page(1, 100000); + customerListReq.setSize(10000); + customerListReq.setPage(1); + IPage positionVO = baseMapper.pageByCondition(assessPage, customerListReq); + // 告诉浏览器用什么软件可以打开此文件 + response.setHeader("content-Type", "application/vnd.ms-excel"); + + // 下载文件的默认名称 + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("客户列表", "UTF-8") + ".xls"); + //编码 + response.setCharacterEncoding("UTF-8"); + + Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), CustomerListRes.class, positionVO.getRecords()); + ExportParams exportParams = new ExportParams(null, "客户列表", ExcelType.XSSF); + exportParams.setStyle(ExcelStyleUtil.class); + workbook.write(response.getOutputStream()); + } + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/CustomsPassServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/CustomsPassServiceImpl.java new file mode 100644 index 0000000..b281aea --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/CustomsPassServiceImpl.java @@ -0,0 +1,32 @@ +package com.huoran.nakadai.service.impl; + +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.CustomsPass; +import com.huoran.nakadai.mapper.CustomsPassMapper; +import com.huoran.nakadai.service.CustomsPassService; +import org.springframework.stereotype.Service; + +/** + *

+ * 沙盘-关卡表 服务实现类 + *

+ * + * @author chen + * @since 2023-10-26 + */ +@Service +public class CustomsPassServiceImpl extends ServiceImpl implements CustomsPassService { + + + @Override + public Integer maximumSequenceNumber() { + return baseMapper.maximumSequenceNumber(); + } + + @Override + public R checkPointList(Integer schoolId, Integer accountId, Integer projectId, Integer displayCollection) { + return R.ok().put("data", baseMapper.checkPointList(schoolId, accountId, projectId,displayCollection)); + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/DataProductServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/DataProductServiceImpl.java new file mode 100644 index 0000000..b3fbb9a --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/DataProductServiceImpl.java @@ -0,0 +1,37 @@ +package com.huoran.nakadai.service.impl; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.DataProduct; +import com.huoran.nakadai.entity.req.MiniProgramProductsReq; +import com.huoran.nakadai.entity.res.AppletsDataProductResp; +import com.huoran.nakadai.entity.res.BusinessManagerOrderResp; +import com.huoran.nakadai.mapper.DataProductMapper; +import com.huoran.nakadai.service.IDataProductService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 数据平台产品表 服务实现类 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@Service +public class DataProductServiceImpl extends ServiceImpl implements IDataProductService { + + /** + * 当前需求为:强行将产品功能与课程功能合并为一个 + * @param req + * @return + */ + @Override + public R AppletsDataProductList( MiniProgramProductsReq req) { + Page page = new Page(req.getPageNum(), req.getPageSize()); + IPage pageList = baseMapper.AppletsDataProductList(page, req); + return R.ok().put("data", pageList); + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/DisciplineLevelServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/DisciplineLevelServiceImpl.java new file mode 100644 index 0000000..22c027e --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/DisciplineLevelServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.nakadai.service.impl; + +import com.huoran.nakadai.entity.DisciplineLevel; +import com.huoran.nakadai.mapper.DisciplineLevelMapper; +import com.huoran.nakadai.service.IDisciplineLevelService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 学科层次 服务实现类 + *

+ * + * @author huoran + * @since 2021-07-09 + */ +@Service +public class DisciplineLevelServiceImpl extends ServiceImpl implements IDisciplineLevelService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/DisciplineServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/DisciplineServiceImpl.java new file mode 100644 index 0000000..24beaa3 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/DisciplineServiceImpl.java @@ -0,0 +1,51 @@ +package com.huoran.nakadai.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.nakadai.entity.Discipline; +import com.huoran.nakadai.entity.Professional; +import com.huoran.nakadai.entity.ProfessionalClass; +import com.huoran.nakadai.mapper.DisciplineMapper; +import com.huoran.nakadai.mapper.ProfessionalClassMapper; +import com.huoran.nakadai.mapper.ProfessionalMapper; +import com.huoran.nakadai.service.IDisciplineService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 学科 服务实现类 + *

+ * + * @author lr + * @since 2021-09-17 + */ +@Service +public class DisciplineServiceImpl extends ServiceImpl implements IDisciplineService { + + @Autowired + private ProfessionalClassMapper professionalClassMapper; + + @Autowired + private ProfessionalMapper professionalMapper; + + @Override + public List disciplineLevel() { + return baseMapper.disciplineLevel(); + } + + @Override + public List subjectCategoryCited() { + List disciplines = baseMapper.subjectCategoryCited(); + for (Discipline discipline : disciplines) { + List professionalClasses = professionalClassMapper.professionalClassLevelNoLeft(discipline.getDisciplineId()); + for (ProfessionalClass professionalClass : professionalClasses) { + List professionals = professionalMapper.professionalLevelNoLeft(professionalClass.getProfessionalClassId()); + professionalClass.setProfessionals(professionals); + } + discipline.setProfessionalClasses(professionalClasses); + } + return disciplines; + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/EduCurriculumChapterServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/EduCurriculumChapterServiceImpl.java new file mode 100644 index 0000000..7c8ae9a --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/EduCurriculumChapterServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.nakadai.service.impl; + +import com.huoran.nakadai.entity.EduCurriculumChapter; +import com.huoran.nakadai.mapper.EduCurriculumChapterMapper; +import com.huoran.nakadai.service.EduCurriculumChapterService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 课程章节 服务实现类 + *

+ * + * @author lr + * @since 2021-09-26 + */ +@Service +public class EduCurriculumChapterServiceImpl extends ServiceImpl implements EduCurriculumChapterService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/HrContractInformationServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/HrContractInformationServiceImpl.java new file mode 100644 index 0000000..b5c952e --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/HrContractInformationServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.nakadai.service.impl; + +import com.huoran.nakadai.entity.HrContractInformation; +import com.huoran.nakadai.mapper.HrContractInformationMapper; +import com.huoran.nakadai.service.IHrContractInformationService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 合同信息表 服务实现类 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@Service +public class HrContractInformationServiceImpl extends ServiceImpl implements IHrContractInformationService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/HrCoursePermissionsServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/HrCoursePermissionsServiceImpl.java new file mode 100644 index 0000000..2bce8ca --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/HrCoursePermissionsServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.nakadai.service.impl; + +import com.huoran.nakadai.entity.HrCoursePermissions; +import com.huoran.nakadai.mapper.HrCoursePermissionsMapper; +import com.huoran.nakadai.service.IHrCoursePermissionsService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 课程权限表 服务实现类 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@Service +public class HrCoursePermissionsServiceImpl extends ServiceImpl implements IHrCoursePermissionsService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/HrDataPermissionsServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/HrDataPermissionsServiceImpl.java new file mode 100644 index 0000000..dfe84c2 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/HrDataPermissionsServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.nakadai.service.impl; + +import com.huoran.nakadai.entity.HrDataPermissions; +import com.huoran.nakadai.mapper.HrDataPermissionsMapper; +import com.huoran.nakadai.service.IHrDataPermissionsService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 数据平台权限表 服务实现类 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@Service +public class HrDataPermissionsServiceImpl extends ServiceImpl implements IHrDataPermissionsService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/HrIndustryClassServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/HrIndustryClassServiceImpl.java new file mode 100644 index 0000000..dbe0149 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/HrIndustryClassServiceImpl.java @@ -0,0 +1,29 @@ +package com.huoran.nakadai.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.nakadai.entity.HrIndustryClass; +import com.huoran.nakadai.mapper.HrIndustryClassMapper; +import com.huoran.nakadai.service.IHrIndustryClassService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 行业类 服务实现类 + *

+ * + * @author huoran + * @since 2021-06-29 + */ +@Service +public class HrIndustryClassServiceImpl extends ServiceImpl implements IHrIndustryClassService { + + @Override + public List queryIndustryClass() { + List hrIndustryClassesList = this.baseMapper.selectList(new QueryWrapper()); + return hrIndustryClassesList; + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/HrIndustryServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/HrIndustryServiceImpl.java new file mode 100644 index 0000000..d0ff771 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/HrIndustryServiceImpl.java @@ -0,0 +1,29 @@ +package com.huoran.nakadai.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.nakadai.entity.HrIndustry; +import com.huoran.nakadai.mapper.HrIndustryMapper; +import com.huoran.nakadai.service.IHrIndustryService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 行业 服务实现类 + *

+ * + * @author huoran + * @since 2021-06-29 + */ +@Service +public class HrIndustryServiceImpl extends ServiceImpl implements IHrIndustryService { + + @Override + public List queryIndustry(Integer industryClassId) { + return this.baseMapper.selectList(new QueryWrapper() + .eq("industry_class_id",industryClassId)); + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/HrLogServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/HrLogServiceImpl.java new file mode 100644 index 0000000..9404ede --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/HrLogServiceImpl.java @@ -0,0 +1,33 @@ +package com.huoran.nakadai.service.impl; + +import com.huoran.nakadai.entity.HrLog; +import com.huoran.nakadai.entity.vo.LogManagementListVo; +import com.huoran.nakadai.mapper.HrLogMapper; +import com.huoran.nakadai.service.HrLogService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 服务实现类 + *

+ * + * @author chen + * @since 2022-03-04 + */ +@Service +public class HrLogServiceImpl extends ServiceImpl implements HrLogService { + + @Override + public List managementList(String search) { + List logManagementListVos = baseMapper.selectManagementList(); + return logManagementListVos; + } + + @Override + public List queryAllAccount(Integer platformId) { + return baseMapper.selectAllAccount(platformId); + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/HrMallMarketingPromotionServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/HrMallMarketingPromotionServiceImpl.java new file mode 100644 index 0000000..fb20cf1 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/HrMallMarketingPromotionServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.nakadai.service.impl; + +import com.huoran.nakadai.entity.HrMallMarketingPromotion; +import com.huoran.nakadai.mapper.HrMallMarketingPromotionMapper; +import com.huoran.nakadai.service.HrMallMarketingPromotionService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@Service +public class HrMallMarketingPromotionServiceImpl extends ServiceImpl implements HrMallMarketingPromotionService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/HrStaffAccountArchitectureServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/HrStaffAccountArchitectureServiceImpl.java new file mode 100644 index 0000000..b864f59 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/HrStaffAccountArchitectureServiceImpl.java @@ -0,0 +1,94 @@ +package com.huoran.nakadai.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.common.constant.DelConstant; +import com.huoran.common.entity.Architecture; +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.HrStaffAccountArchitecture; +import com.huoran.nakadai.entity.req.ArchitectureAddReq; +import com.huoran.nakadai.mapper.HrStaffAccountArchitectureMapper; +import com.huoran.nakadai.service.HrStaffAccountArchitectureService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +/** + *

+ * 中台账号组织架构 服务实现类 + *

+ * + * @author chen + * @since 2022-03-22 + */ +@Service +public class HrStaffAccountArchitectureServiceImpl extends ServiceImpl implements HrStaffAccountArchitectureService { + + @Override + public boolean checkRepeat(HrStaffAccountArchitecture architecture) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + queryWrapper.eq("level", architecture.getLevel()); + queryWrapper.eq("organization_name", architecture.getOrganizationName()); + queryWrapper.eq("parent_id", architecture.getParentId()); + if (architecture.getId() != null) { + queryWrapper.last(" and id != " + architecture.getId()); + } + List architectureList = baseMapper.selectList(queryWrapper); + return architectureList.size() > 0; + } + + @Override + public List treeList() { + //查询父级的 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("is_del", DelConstant.NOT_DEL); + List architectureList = baseMapper.selectList(wrapper); + return build(architectureList); + } + + /** + * 使用递归方法构建权限菜单 + */ + public List build(List treeNodes) { + List trees = new ArrayList<>(); + for (HrStaffAccountArchitecture treeNode : treeNodes) { + if (treeNode.getParentId() == 1) { + trees.add(findChildren(treeNode, treeNodes)); + } + } + return trees; + } + + /** + * 递归查找子节点 + */ + public HrStaffAccountArchitecture findChildren(HrStaffAccountArchitecture treeNode, List treeNodes) { + treeNode.setChildren(new ArrayList<>()); + + for (HrStaffAccountArchitecture it : treeNodes) { + + if (treeNode.getId().equals(it.getParentId())) { + if (treeNode.getChildren() == null) { + treeNode.setChildren(new ArrayList<>()); + } + treeNode.getChildren().add(findChildren(it, treeNodes)); + } + } + return treeNode; + } + + @Override + public boolean removeOrganization(Integer id) { + //根据父id查询以下所有子级 + List ids = baseMapper.selectIdByPid(id); + ids.add(id); + //批量进行删除 + int i = baseMapper.deleteBatchIds(ids); + return i>0; + } + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/HrStaffDepartmentServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/HrStaffDepartmentServiceImpl.java new file mode 100644 index 0000000..01e9fb8 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/HrStaffDepartmentServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.nakadai.service.impl; + +import com.huoran.nakadai.entity.HrStaffDepartment; +import com.huoran.nakadai.mapper.HrStaffDepartmentMapper; +import com.huoran.nakadai.service.HrStaffDepartmentService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author chen + * @since 2022-03-23 + */ +@Service +public class HrStaffDepartmentServiceImpl extends ServiceImpl implements HrStaffDepartmentService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/HrStaffServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/HrStaffServiceImpl.java new file mode 100644 index 0000000..bb20bd6 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/HrStaffServiceImpl.java @@ -0,0 +1,810 @@ +package com.huoran.nakadai.service.impl; + +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.entity.ExportParams; +import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.TypeReference; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.google.common.collect.Maps; +import com.huoran.api.UserClient; +import com.huoran.common.constant.DelConstant; +import com.huoran.common.entity.Role; +import com.huoran.common.exception.CustomException; +import com.huoran.common.exception.ExceptionEnum; +import com.huoran.common.response.R; +import com.huoran.common.utils.MD5; +import com.huoran.nakadai.entity.*; +import com.huoran.nakadai.entity.req.ExcelImpStaffReq; +import com.huoran.nakadai.entity.req.StaffAddReq; +import com.huoran.nakadai.entity.req.StaffListReq; +import com.huoran.nakadai.entity.req.StaffUpdateReq; +import com.huoran.nakadai.entity.res.StaffResp; +import com.huoran.nakadai.entity.vo.ImportStaffFailureVo; +import com.huoran.nakadai.mapper.HrStaffAccountArchitectureMapper; +import com.huoran.nakadai.mapper.HrStaffDepartmentMapper; +import com.huoran.nakadai.mapper.HrStaffMapper; +import com.huoran.nakadai.service.HrStaffService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.nakadai.utils.*; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.data.redis.core.ValueOperations; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.net.URLEncoder; +import java.util.*; +import java.util.concurrent.TimeUnit; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + +/** + *

+ * 中台后台员工账号表 服务实现类 + *

+ * + * @author chen + * @since 2022-03-22 + */ +@Service +public class HrStaffServiceImpl extends ServiceImpl implements HrStaffService { + + @Autowired + private UserClient userClient; + + @Autowired + private HrStaffDepartmentMapper staffDepartmentMapper; + + @Autowired + private HrStaffAccountArchitectureMapper staffAccountArchitectureMapper; + + @Resource + StringRedisTemplate stringRedisTemplate; + + @Override + public R saveStaff(StaffAddReq staffReq) { + try { + //用户相关信息表 + UserInfo userInfo = new UserInfo(); + BeanUtils.copyProperties(staffReq, userInfo); + int addUserInfo = baseMapper.addUserInfo(userInfo); + + //账户相关信息表,账号判重 + //中台判重 + Integer count = baseMapper.checkAccount(staffReq.getAccount()); + if (count>0){ + throw new CustomException(ExceptionEnum.EXIST_ACCOUNT); + } + UserAccount userAccount = new UserAccount(); + BeanUtils.copyProperties(staffReq, userAccount); + userAccount.setPassword(MD5.encrypt("1122aa")); + userAccount.setUserId(userInfo.getUserId()); + userAccount.setType(2);//平台端区分:0->教师端 1->学生端 2->无端 + userAccount.setPlatformId("3");//1表示职站 + // userAccount.setRoleId("0");//设置为0 表示该表角色id暂时无用 acl_user_role:用户角色表有账号所属角色 + int addAccount = baseMapper.addUserAccount(userAccount); + + //添加员工信息 + HrStaff staff = new HrStaff(); + staff.setAccountId(userAccount.getId()); + // staff.setStaffArchitectureId(staffReq.getStaffArchitectureId()); + int insert = baseMapper.insert(staff); + + //添加员工部门 + List staffArchitectureId = staffReq.getStaffArchitectureId(); + if (staffArchitectureId!=null && staffArchitectureId.size()>0){ + staffArchitectureId.forEach(id -> { + HrStaffDepartment staffDepartment = new HrStaffDepartment(); + staffDepartment.setStaffId(staff.getStaffId()); + staffDepartment.setDepartmentId(id); + staffDepartmentMapper.insert(staffDepartment); + }); + } + + //账号赋予角色 + userClient.rolePermissionService(userAccount.getId(), staffReq.getRoleList(),null); + return addUserInfo > 0 && addAccount > 0 && insert > 0 ? R.ok() : R.error(); + } catch (Exception e) { + return R.error(e.getMessage()); + } + } + + @Override + public R pageStaffList(StaffListReq req) { + //查询未加入部门的员工,部门id一定清空 + if (req.getType()==2){ + req.setStaffArchitectureId(null); + } + + Page page = new Page(req.getPageNum(), req.getPageSize()); + IPage staffList = baseMapper.staffList(page, req); + return R.ok().put("page", staffList); + } + + @Override + public R staffDetail(Integer accountId) { + StaffResp resp = baseMapper.staffDetail(accountId); + return R.ok().put("data", resp); + } + + @Override + public R modifyStaff(StaffUpdateReq updateReq) { + //根据账号id获取userId + Integer userId = baseMapper.getUserId(updateReq.getAccountId()); + + //更新员工相关信息表 + if (updateReq.getRoleList() != null) { + + //删除该账号原有角色 + baseMapper.delRoleByAccountId(updateReq.getAccountId()); + + //更新员工信息,删除之前部门 + QueryWrapper staffDepartmentQueryWrapper = new QueryWrapper<>(); + staffDepartmentQueryWrapper.eq("staff_id", updateReq.getStaffId()); + int delete = staffDepartmentMapper.delete(staffDepartmentQueryWrapper); + + //添加员工部门 + List idList = updateReq.getStaffArchitectureId(); + if (idList!=null && idList.size()>0){ + idList.forEach(id -> { + HrStaffDepartment staffDepartment = new HrStaffDepartment(); + staffDepartment.setStaffId(updateReq.getStaffId()); + staffDepartment.setDepartmentId(id); + staffDepartmentMapper.insert(staffDepartment); + }); + } + + //账号赋予角色 + userClient.rolePermissionService(updateReq.getAccountId(), updateReq.getRoleList(),null); + } + + //编辑账户相关信息表 + UserAccount userAccount = new UserAccount(); + BeanUtils.copyProperties(updateReq, userAccount); + userAccount.setId(updateReq.getAccountId()); + boolean updateAccount = baseMapper.modifyUserAccount(userAccount); + + //编辑用户相关信息表 + UserInfo userInfo = new UserInfo(); + BeanUtils.copyProperties(updateReq, userInfo); + userInfo.setUserId(userId); + boolean updateUserInfo = baseMapper.modifyUserInfo(userInfo); + return updateUserInfo && updateAccount ? R.ok() : R.error(); + } + + @Override + public R delStaff(List accountIds) { + Integer ret = 0; + if (accountIds.size() > 0) { + for (Integer accountId : accountIds) { + QueryWrapper staffQueryWrapper = new QueryWrapper<>(); + staffQueryWrapper.eq("account_id", accountId); + HrStaff hrStaff = baseMapper.selectOne(staffQueryWrapper); + + //删除账号、用户表数据 修改用户表逻辑删除状态 修改账号表逻辑删除状态 + userClient.delAccountAndUser(accountId); + + //删除现有员工信息 + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.set("is_del", DelConstant.IS_DEL); + updateWrapper.eq("account_id", accountId); + ret = baseMapper.update(new HrStaff(), updateWrapper); + + //删除员工部门 + QueryWrapper staffDepartmentQueryWrapper = new QueryWrapper<>(); + staffDepartmentQueryWrapper.eq("staff_id", hrStaff.getStaffId()); + staffDepartmentMapper.delete(staffDepartmentQueryWrapper); + } + + } + return ret > 0 ? R.ok() : R.error(); + } + + @Override + @Transactional + public Map importStaff(MultipartFile file) { + List impStaffReqList = ExcelImportHelper.readStaff(file); + if (impStaffReqList.size() <= 0) { + //小于等于0为上传空模板的情况下 抛出异常 + throw new CustomException(ExceptionEnum.EXCEL_FILE_FORMAT_ERROR); + } + int count = 0; + List failVo1 = new ArrayList(); + // 参数合法性校验,只能上传.xlsx后缀的文件 + if (org.apache.commons.lang3.StringUtils.isBlank(file.getOriginalFilename()) + || !file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")).equals(".xlsx")) { + ExceptionCast.cast(CommonCode.EXCEL_FILE_INVALID); + } + int size = impStaffReqList.size(); + Map map = new HashMap<>(); + Long ii = 1L;//用于记录序列号 + Integer countNum = 0;//用于失败原因排序 eg:1、XXXXX 2、XXXXXXX + try { + Integer countSuccess = 0;//统计成功次数 + Integer countError = 0;//统计失败次数 + + List workNumberList = new ArrayList<>();//用来储存新增前用户在excel中输入的所有学号用于excel中的数据判重 + List accountList = new ArrayList<>();//用来储存新增前用户在excel中输入的所有账号用于excel中的数据判重 + for (int i = 0; i < impStaffReqList.size(); i++) { + boolean ret = true; + ++ii; + ExcelImpStaffReq req = impStaffReqList.get(i); + + ImportStaffFailureVo vo1 = new ImportStaffFailureVo(); + + String errMsg = ""; + //去除Excel中的全角半角空格 + String getUserName = req.getUserName().replaceAll("\\u00A0", "").trim(); + String getAccount = req.getAccount().replaceAll("\\u00A0", "").trim(); + String getRoleName = req.getRoleName().replaceAll("\\u00A0", "").trim(); + String getWorkNumber = req.getWorkNumber().replaceAll("\\u00A0", "").trim(); + String dept = req.getDept().replaceAll("\\u00A0", "").trim(); + String getPhone = req.getPhone().replaceAll("\\u00A0", "").trim(); + String getEmail = req.getEmail().replaceAll("\\u00A0", "").trim(); + + if (!workNumberList.contains(req.getWorkNumber())) { + workNumberList.add(req.getWorkNumber()); + } else { + //包含excel数据中存在相同学号 + ++countNum; + vo1.setWorkNumber(getWorkNumber + " *必填项:(当前Excel数据中该工号已存在重复的!)"); + errMsg += countNum + " *必填项:(当前Excel数据中该工号号已存在重复的)"; + ret = false; + } + + if (!accountList.contains(req.getAccount())) { + accountList.add(req.getAccount()); + } else { + //包含excel数据中存在相同账号 + ++countNum; + vo1.setAccount(getAccount + " *必填项:(当前Excel数据中该账号已存在重复的)"); + errMsg += countNum + " *必填项:(当前Excel数据中该账号已存在重复的)"; + ret = false; + } + + vo1.setIndex(ii); + //检验姓名 + if ("".equals(getUserName)) { + ++countNum; + vo1.setUserName(getUserName + " *必填项:(姓名不能为空) "); + errMsg += countNum + "必填项:(姓名不能为空)"; + ret = false; + } else { + vo1.setUserName(getUserName); + } + Integer accountId1 = 0; + Integer userId1 = 0; + //检验账号 + if ("".equals(getAccount)) { + ++countNum; + vo1.setAccount(getAccount + " *必填项:(账号不能为空)"); + errMsg += countNum + " *必填项:(账号不能为空)"; + ret = false; + } else { + UserAccount checkAccount = new UserAccount(); + checkAccount.setAccount(getAccount); + List checkUserAccount = baseMapper.checkUserAccount(checkAccount); + //账号存在,验证该账号相关信息 + if (checkUserAccount.size() > 0) { + for (UserAccount userAccount: checkUserAccount){ + String account = userAccount.getAccount(); + Integer userId = userAccount.getUserId(); + String workNumber = userAccount.getWorkNumber(); + String userName = baseMapper.selectUserNameById(userId); + if (getAccount.equals(account)&&getWorkNumber.equals(workNumber)&&getUserName.equals(userName)){ + accountId1=userAccount.getId(); + userId1=userId; + break; + }else { + ++countNum; + vo1.setAccount(getAccount + " *必填项:(账号已有重复的)"); + errMsg += countNum + " *必填项:(账号已有重复的)"; + ret = false; + } + } + + } else { + vo1.setAccount(getAccount + ""); + } + } + + List roleIds = new ArrayList<>(); + + //检验角色 + if ("".equals(getRoleName)) { + ++countNum; + vo1.setAccount(getRoleName + " *必填项:(角色不能为空)"); + errMsg += countNum + " *必填项:(角色不能为空)"; + ret = false; + } else { + //分隔多个角色 + String[] roleNames = getRoleName.split("/"); + for (int r = 0; r < roleNames.length; r++) { + // 查询多个角色是否存在 + Role checkRole = userClient.checkRoleIsExist(roleNames[r], 0,3); + if (checkRole != null && !"超级管理员".equals(checkRole.getRoleName())) { + roleIds.add(checkRole.getId()); + //存在 + vo1.setRoleName(getRoleName); + } else { + //不存在 + vo1.setRoleName(getRoleName + " *必填项:(请输入系统中存在的角色)"); + errMsg += countNum + " *必填项:(请输入系统中存在的角色)"; + ret = false; + } + } + + } + + //检验工号 + if ("".equals(getWorkNumber)) { + ++countNum; + vo1.setWorkNumber(getWorkNumber + " *必填项:(工号不能为空)"); + errMsg += countNum + " *必填项:(工号不能为空)"; + ret = false; + } else { + UserAccount workNum = new UserAccount(); + workNum.setWorkNumber(getWorkNumber); + workNum.setType(2); + workNum.setPlatformId("3"); + List checkUserWorkNum = baseMapper.checkUserAccount(workNum); + if (checkUserWorkNum.size() > 0) { + ++countNum; + vo1.setWorkNumber(getWorkNumber + " *必填项:(工号已经存在重复的)"); + errMsg += countNum + " *必填项:(工号已经存在重复的)"; + ret = false; + } else { + vo1.setWorkNumber(getWorkNumber + ""); + } + } + + if (!"".equals(getPhone)) { + //校验手机号格式 + if (!validPhoneNum("0", getPhone)) { + ++countNum; + vo1.setPhone(getPhone + " *请输入正确的手机号!"); + errMsg += countNum + " *请输入正确的手机号!"; + ret = false; + } else { + //用户账号存在,手机号邮箱则跳过效验 + if (accountId1==0&&userId1==0){ + //检验手机号 type 1为手机号 2为校验邮箱 + boolean checkPhone = userClient.checkPhoneOrEmailExist(getPhone, getEmail, 1); + if (checkPhone) { + ++countNum; + vo1.setPhone(getPhone + " *该手机号已被绑定!"); + errMsg += countNum + " *该手机号已被绑定!"; + ret = false; + } + vo1.setPhone(getPhone); + } + } + + } else { + vo1.setPhone(getPhone); + } + + if (!"".equals(getEmail)) { + //校验邮箱格式 + if (!isValidEmail(getEmail)) { + ++countNum; + vo1.setEmail(getEmail + "*请输入正确的邮箱格式!"); + errMsg += countNum + " *请输入正确的邮箱格式!"; + ret = false; + } else { + if (accountId1==0&&userId1==0){ + //检验手机号 type 2为校验邮箱 + boolean checkEmail = userClient.checkPhoneOrEmailExist(getPhone, getEmail, 2); + if (checkEmail) { + ++countNum; + vo1.setEmail(getEmail + " *该邮箱已被绑定!"); + errMsg += countNum + " *该邮箱已被绑定!"; + ret = false; + } + vo1.setEmail(getEmail); + } + } + + } else { + vo1.setEmail(getEmail); + } + + ArrayList architectureIds = new ArrayList<>(); + //检验所在部门 + if ("".equals(dept)) { + ++countNum; + vo1.setDept(dept + " *必填项:(请输入正确的员工架构!)"); + errMsg += countNum + " *必填项:(请输入正确的员工架构!)"; + ret = false; + } else { + if (ret){ + //检验是否有多部门 + String[] multi = dept.split(","); + //多部门进行循环添加每个部门 + if (multi.length>1){ + for (int d = 0; d < multi.length; d++) { + HashMap hashMap = automaticAddArchitecture(multi[d], countNum, dept, vo1); + + Object countNum1 = hashMap.get("countNum"); + //存在错误数据 + if (countNum1!=null){ + countNum = (Integer) countNum1; + Object vo11 = hashMap.get("vo1"); + vo1 = (ImportStaffFailureVo) vo11; + Object errMsg1 = hashMap.get("errMsg"); + errMsg = (String) errMsg1; + Object ret1 = hashMap.get("ret"); + ret = (boolean) ret1; + }else { + //保存架构id + Object architectureId = hashMap.get("architectureId"); + Integer id = 0; + if (architectureId!=null){ + id = (Integer) architectureId; + architectureIds.add(id); + } + } + } + + }else{ + HashMap hashMap = automaticAddArchitecture(dept, countNum, dept, vo1); + + Object countNum1 = hashMap.get("countNum"); + //存在错误数据 + if (countNum1!=null){ + countNum = (Integer) countNum1; + Object vo11 = hashMap.get("vo1"); + vo1 = (ImportStaffFailureVo) vo11; + Object errMsg1 = hashMap.get("errMsg"); + errMsg = (String) errMsg1; + Object ret1 = hashMap.get("ret"); + ret = (boolean) ret1; + }else { + //保存架构id + Object architectureId = hashMap.get("architectureId"); + Integer id = 0; + if (architectureId!=null){ + id = (Integer) architectureId; + architectureIds.add(id); + } + } + } + } + } + + vo1.setFailureMsg(errMsg); + countNum = 0; + + failVo1.add(vo1); + + //ret判断 新增成功的插入到数据库 否则则不新增至数据库 + if (ret) { + //用户账号不存在 + if (accountId1==0&&userId1==0){ + + //执行新增操作 + // 工号(本校内)——————账号(全平台)判重 ——————手机号、邮箱根据平台id判重 + UserInfo userInfo = new UserInfo(); + userInfo.setRoleId("0"); + userInfo.setUniqueIdentification(String.valueOf(System.currentTimeMillis())); + BeanUtils.copyProperties(req, userInfo); + baseMapper.addUserInfo(userInfo); + + UserAccount account = new UserAccount(); + account.setPassword(MD5.encrypt("1122aa")); + account.setPlatformId("3");//所属平台id 1.职站 + account.setType(2);//平台端区分:0->教师端 1->学生端 2->无端 + account.setUserId(userInfo.getUserId()); + account.setRoleId("0"); + BeanUtils.copyProperties(req, account); + baseMapper.addUserAccount(account); + + accountId1 = account.getId(); + + // 新增至员工信息表 + HrStaff staff = new HrStaff().setAccountId(accountId1); + baseMapper.insert(staff); + //添加员工部门 + if (architectureIds.size()>0){ + architectureIds.forEach(id -> { + HrStaffDepartment staffDepartment = new HrStaffDepartment(); + staffDepartment.setStaffId(staff.getStaffId()); + staffDepartment.setDepartmentId(id); + staffDepartmentMapper.insert(staffDepartment); + }); + } + + // 同时新增至用户角色表 + //账号赋予角色 + userClient.rolePermissionService(accountId1, roleIds,null); + + }else { + HrStaff staff = baseMapper.selectOne(new QueryWrapper().eq("account_id", accountId1)); + //导入新部门、赋予新角色 + List staffDepartments = staffDepartmentMapper. + selectList(new QueryWrapper().eq("staff_id", staff.getStaffId())); + + ArrayList staffDepartmentIds = new ArrayList<>(); + for (HrStaffDepartment staffDepartment : staffDepartments) { + staffDepartmentIds.add(staffDepartment.getDepartmentId()); + } + for (Integer architectureId : architectureIds) { + if (!staffDepartmentIds.contains(architectureId)){ + HrStaffDepartment hrStaffDepartment = new HrStaffDepartment(); + hrStaffDepartment.setStaffId(staff.getStaffId()); + hrStaffDepartment.setDepartmentId(architectureId); + staffDepartmentMapper.insert(hrStaffDepartment); + } + } + //补充部门 + /*if (staffDepartmentIds.size()!=architectureIds.size()){ + Collection differentNoDuplicate = CollectionUtil.getDifferentNoDuplicate(architectureIds, staffDepartmentIds); + ArrayList arrayList = new ArrayList(differentNoDuplicate); + if (arrayList.size()>0){ + for (Integer id : arrayList) { + HrStaffDepartment hrStaffDepartment = new HrStaffDepartment(); + hrStaffDepartment.setStaffId(staff.getStaffId()); + hrStaffDepartment.setDepartmentId(id); + staffDepartmentMapper.insert(hrStaffDepartment); + } + } + }*/ + + //补充角色 + List roles = baseMapper.selectRolesByAccountId(accountId1); + + for (Integer roleId : roleIds) { + if (!roles.contains(roleId)){ + List addRoleId = new ArrayList<>(); + addRoleId.add(roleId); + //账号赋予角色 + userClient.rolePermissionService(accountId1, addRoleId,null); + } + } + /*if (roleIds.size()!=roles.size()){ + Collection differentNoDuplicate = CollectionUtil.getDifferentNoDuplicate(roleIds, roles); + ArrayList arrayList = new ArrayList(differentNoDuplicate); + if (arrayList.size()>0){ + for (Integer id : arrayList) { + List addRoleId = new ArrayList<>(); + addRoleId.add(id); + //账号赋予角色 + userClient.rolePermissionService(accountId1, addRoleId); + } + } + }*/ + } + //countSuccess:统计累计成功次数 + countSuccess++; + } else { + //countError:累计失败次数 + countError++; + } + } + String exportCode = ""; + + // 有导入失败的数据,才会存入redis + if (countError > 0) { + //生成token + exportCode = "FAILURE_IMPORT" + UUID.randomUUID().toString().replace("-", ""); + ValueOperations ops = stringRedisTemplate.opsForValue(); + + List collect = failVo1.stream().filter(importStaffFailureVo -> { + return !importStaffFailureVo.getFailureMsg().equals(""); + }).collect(Collectors.toList()); + + String failureVOJson = JSON.toJSONString(collect); + ops.set(exportCode, failureVOJson, 30 * 60, TimeUnit.SECONDS); + } + map.put("exportCode", exportCode);//返回导出code + map.put("successNum", countSuccess + "");//本次新增成功数量 + map.put("failureNum", countError + "");//本次新增失败数量 + return map; + } catch (RuntimeException e) { + System.err.println(e.getMessage()); + throw new RuntimeException(); + } + } + + @Override + public void exportFailureRecord(HttpServletResponse response, String token) throws IOException { + if (org.apache.commons.lang3.StringUtils.isEmpty(token)) { + return; + } + ValueOperations ops = stringRedisTemplate.opsForValue(); + //获取数据 + String record = ops.get(token); + if (org.apache.commons.lang3.StringUtils.isEmpty(record)) { + return; + } + List parse = JSON.parseObject(record, new TypeReference>() { + }); + + parse.sort(Comparator.comparing(ImportStaffFailureVo::getIndex)); + + // 告诉浏览器用什么软件可以打开此文件 + response.setHeader("content-Type", "application/vnd.ms-excel"); + // 下载文件的默认名称 + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("员工导入失败数据表", "UTF-8") + ".xls"); + //编码 + response.setCharacterEncoding("UTF-8"); + Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), ImportStaffFailureVo.class, parse); + ExportParams exportParams = new ExportParams(null, "delivery", ExcelType.XSSF); + exportParams.setStyle(ExcelStyleUtil.class); + workbook.write(response.getOutputStream()); + } + + + /** + * @Description : 校验手机号 + * @Param checkType 校验类型:0校验手机号码,1校验座机号码,2两者都校验满足其一就可 + * @Param phoneNum + * @Author Rong---2021/10/18 + */ + public static boolean validPhoneNum(String checkType, String phoneNum) { + boolean flag = false; + Pattern p1 = null; + Pattern p2 = null; + Matcher m = null; + p1 = Pattern.compile("^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(17[0-9]{1}))+\\d{8})?$"); + p2 = Pattern.compile("^(0[0-9]{2,3}\\-)?([1-9][0-9]{6,7})$"); + if ("0".equals(checkType)) { + System.out.println(phoneNum.length()); + if (phoneNum.length() != 11) { + return false; + } else { + m = p1.matcher(phoneNum); + flag = m.matches(); + } + } else if ("1".equals(checkType)) { + if (phoneNum.length() < 11 || phoneNum.length() >= 16) { + return false; + } else { + m = p2.matcher(phoneNum); + flag = m.matches(); + } + } else if ("2".equals(checkType)) { + if (!((phoneNum.length() == 11 && p1.matcher(phoneNum).matches()) || (phoneNum.length() < 16 && p2.matcher(phoneNum).matches()))) { + return false; + } else { + flag = true; + } + } + return flag; + } + + /** + * @Description : 校验邮箱 + * @Param email + * @Author Rong---2021/10/18 + */ + public static boolean isValidEmail(String email) { + if ((email != null) && (!email.isEmpty())) { + return Pattern.matches("^(\\w+([-.][A-Za-z0-9]+)*){3,18}@\\w+([-.][A-Za-z0-9]+)*\\.\\w+([-.][A-Za-z0-9]+)*$", email); + } + return false; + } + + /** + * 组织架构判重,返回下一层级的父id + * + */ + public Integer checkArchitectureRepeat(String name ,Integer pid){ + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("organization_name",name).eq("parent_id",pid); + HrStaffAccountArchitecture hrStaffAccountArchitecture = staffAccountArchitectureMapper.selectOne(queryWrapper); + if (hrStaffAccountArchitecture!=null){ + return hrStaffAccountArchitecture.getId(); + } + return null; + } + /** + * 根据导入部门自动添加组织架构 + */ + public HashMap automaticAddArchitecture(String architectureName,Integer countNum, + String dept,ImportStaffFailureVo vo1){ + HashMap map = Maps.newHashMap(); + //获取部门层级 + String[] split = architectureName.split("/"); + if (split.length>6){ + map.put("countNum",++countNum); + map.put("vo1",vo1.setDept(dept + " 员工架构暂不支持第7层级")); + map.put("errMsg",countNum + " 员工架构暂不支持第7层级"); + map.put("ret",false); + return map; + } + // 检验输入的一级部门是否存在 + //查询一级部门信息 + QueryWrapper queryWrapper1 = new QueryWrapper<>(); + queryWrapper1.eq("organization_name", split[0]); + HrStaffAccountArchitecture hrStaffAccountArchitecture = staffAccountArchitectureMapper.selectOne(queryWrapper1); + if (hrStaffAccountArchitecture == null) { + //为空表示不存在该部门,一级部门不存在,表示子级部门都能直接新增,达底端返回部门id + int pid = 1; + for (int j = 0; j < split.length; j++) { + HrStaffAccountArchitecture hrStaffAccountArchitecture1 = new HrStaffAccountArchitecture(); + hrStaffAccountArchitecture1.setOrganizationName(split[j]); + hrStaffAccountArchitecture1.setParentId(pid); + hrStaffAccountArchitecture1.setLevel(j+1); + int insert = staffAccountArchitectureMapper.insert(hrStaffAccountArchitecture1); + //添加成功后id赋值给下一层级父id + if (insert>0){ + pid = hrStaffAccountArchitecture1.getId(); + } + //最后返回部门id + if (split.length-1==j){ + map.put("architectureId",pid); + } + } + } else { + Integer nextLevelPid = hrStaffAccountArchitecture.getId(); + //存在一级部门,循环查询下一层级,存在则继续向下判断,否则进行新增,到达底端返回部门id + int pid = 1; + for (int j = 1; j < split.length; j++) { + Integer nextPid = checkArchitectureRepeat(split[j],nextLevelPid); + //都存在,最后一次循环返回部门id + if (split.length-1==j){ + map.put("architectureId",nextPid); + } + //层级已存在,进入下次循环 + if (nextPid!=null){ + nextLevelPid = nextPid; + continue; + } + //该层级不存在,进行新增 + HrStaffAccountArchitecture architecture = new HrStaffAccountArchitecture(); + architecture.setOrganizationName(split[j]); + architecture.setParentId(nextLevelPid); + architecture.setLevel(j+1); + int insert = staffAccountArchitectureMapper.insert(architecture); + //添加成功后id赋值给下一层级父id + if (insert>0){ + nextLevelPid = architecture.getId(); + } + //最后返回部门id + if (split.length-1==j){ + map.put("architectureId",nextLevelPid); + } + } + } + return map; + } + + public static void main(String[] args) { +//集合一 + + List _first=new ArrayList(); + + _first.add("1"); + + _first.add("2"); + + _first.add("3"); + +//集合二 + + List _second=new ArrayList(); + + _second.add("1"); + + _second.add("2"); + _second.add("2"); + _second.add("4"); + + Collection differentNoDuplicate = CollectionUtil.getDifferentNoDuplicate(_first, _second); + ArrayList arrayList = new ArrayList<>(differentNoDuplicate); + arrayList.forEach(System.out::println); + } + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/LogContentServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/LogContentServiceImpl.java new file mode 100644 index 0000000..598a7db --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/LogContentServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.nakadai.service.impl; + +import com.huoran.nakadai.entity.LogContent; +import com.huoran.nakadai.mapper.LogContentMapper; +import com.huoran.nakadai.service.LogContentService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author chen + * @since 2022-03-08 + */ +@Service +public class LogContentServiceImpl extends ServiceImpl implements LogContentService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/MallAnnexServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/MallAnnexServiceImpl.java new file mode 100644 index 0000000..697804b --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/MallAnnexServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.nakadai.service.impl; + +import com.huoran.nakadai.entity.MallAnnex; +import com.huoran.nakadai.mapper.MallAnnexMapper; +import com.huoran.nakadai.service.MallAnnexService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 商品附件表 服务实现类 + *

+ * + * @author chen + * @since 2023-05-06 + */ +@Service +public class MallAnnexServiceImpl extends ServiceImpl implements MallAnnexService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/MallClassificationServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/MallClassificationServiceImpl.java new file mode 100644 index 0000000..863977f --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/MallClassificationServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.nakadai.service.impl; + +import com.huoran.nakadai.entity.MallClassification; +import com.huoran.nakadai.mapper.MallClassificationMapper; +import com.huoran.nakadai.service.MallClassificationService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 商品分类关联表 服务实现类 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@Service +public class MallClassificationServiceImpl extends ServiceImpl implements MallClassificationService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/MallCourseLearningRecordServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/MallCourseLearningRecordServiceImpl.java new file mode 100644 index 0000000..a2510d2 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/MallCourseLearningRecordServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.nakadai.service.impl; + +import com.huoran.nakadai.entity.MallCourseLearningRecord; +import com.huoran.nakadai.mapper.MallCourseLearningRecordMapper; +import com.huoran.nakadai.service.MallCourseLearningRecordService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 商品课程学习记录 服务实现类 + *

+ * + * @author chen + * @since 2023-04-26 + */ +@Service +public class MallCourseLearningRecordServiceImpl extends ServiceImpl implements MallCourseLearningRecordService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/MallDisciplineServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/MallDisciplineServiceImpl.java new file mode 100644 index 0000000..c2bd72a --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/MallDisciplineServiceImpl.java @@ -0,0 +1,100 @@ +package com.huoran.nakadai.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.common.exception.CustomException; +import com.huoran.common.exception.ExceptionEnum; +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.Discipline; +import com.huoran.nakadai.entity.MallDiscipline; +import com.huoran.nakadai.entity.Professional; +import com.huoran.nakadai.entity.ProfessionalClass; +import com.huoran.nakadai.entity.vo.DisciplineExcelVo; +import com.huoran.nakadai.mapper.DisciplineMapper; +import com.huoran.nakadai.mapper.MallDisciplineMapper; +import com.huoran.nakadai.mapper.ProfessionalClassMapper; +import com.huoran.nakadai.mapper.ProfessionalMapper; +import com.huoran.nakadai.service.MallDisciplineService; +import com.huoran.nakadai.utils.CommonCode; +import com.huoran.nakadai.utils.ExcelImportHelper; +import com.huoran.nakadai.utils.ExceptionCast; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; + +/** + *

+ * 商品学科类别关联表 服务实现类 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@Service +public class MallDisciplineServiceImpl extends ServiceImpl implements MallDisciplineService { + + @Autowired + private DisciplineMapper disciplineMapper; + + @Autowired + private ProfessionalClassMapper professionalClassMapper; + + @Autowired + private ProfessionalMapper professionalMapper; + + @Override + public R importSubjectCategoriesInBatches(MultipartFile file) { + List disciplineExcelVos = ExcelImportHelper.readDiscipline(file); + if (disciplineExcelVos.size() <= 0) { + //小于等于0为上传空模板的情况下 抛出异常 + throw new CustomException(ExceptionEnum.EXCEL_FILE_FORMAT_ERROR); + } + // 参数合法性校验,只能上传.xlsx后缀的文件 + if (org.apache.commons.lang3.StringUtils.isBlank(file.getOriginalFilename()) + || !file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")).equals(".xlsx")) { + ExceptionCast.cast(CommonCode.EXCEL_FILE_INVALID); + } + + for (int i = 0; i < disciplineExcelVos.size(); i++) { + DisciplineExcelVo disciplineExcelVo = disciplineExcelVos.get(i); + + //去除Excel中的全角半角空格 + String num = disciplineExcelVo.getSerialNumber().replaceAll("\\u00A0", "").trim(); + String category = disciplineExcelVo.getCategory().replaceAll(" ", "").trim(); + String majorCategory = disciplineExcelVo.getMajorCategory().replaceAll(" ", "").trim(); + String major = disciplineExcelVo.getMajor().replaceAll(" ", "").trim(); + Discipline discipline = disciplineMapper.selectOne(new QueryWrapper().eq("discipline_name", category)); + if (discipline!=null){ + ProfessionalClass professionalClass = professionalClassMapper.selectOne(new QueryWrapper(). + eq("professional_class_name", majorCategory).eq("discipline_id", discipline.getDisciplineId())); + if (professionalClass!=null){ + Professional professional = professionalMapper.selectOne(new QueryWrapper(). + eq("professional_name", major).eq("professional_class_id", professionalClass.getProfessionalClassId())); + if (professional==null){ + Professional professional1 = new Professional(); + professional1.setProfessionalClassId(professionalClass.getProfessionalClassId()); + professional1.setProfessionalName(major); + professionalMapper.insert(professional1); + } + + }else { + ProfessionalClass professionalClass1 = new ProfessionalClass(); + professionalClass1.setDisciplineId(discipline.getDisciplineId()); + professionalClass1.setProfessionalClassName(majorCategory); + professionalClassMapper.insert(professionalClass1); + } + + }else { + Discipline discipline1 = new Discipline(); + discipline1.setDisciplineName(category); + disciplineMapper.insert(discipline1); + } + + } + + return R.ok(); + + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/MallNonAssociatedLinksServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/MallNonAssociatedLinksServiceImpl.java new file mode 100644 index 0000000..8bc4881 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/MallNonAssociatedLinksServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.nakadai.service.impl; + +import com.huoran.nakadai.entity.MallNonAssociatedLinks; +import com.huoran.nakadai.mapper.MallNonAssociatedLinksMapper; +import com.huoran.nakadai.service.MallNonAssociatedLinksService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 非关联产品链接 服务实现类 + *

+ * + * @author chen + * @since 2023-05-15 + */ +@Service +public class MallNonAssociatedLinksServiceImpl extends ServiceImpl implements MallNonAssociatedLinksService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/MallPriceServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/MallPriceServiceImpl.java new file mode 100644 index 0000000..57aa41c --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/MallPriceServiceImpl.java @@ -0,0 +1,21 @@ +package com.huoran.nakadai.service.impl; + +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.MallPrice; +import com.huoran.nakadai.mapper.MallPriceMapper; +import com.huoran.nakadai.service.MallPriceService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 商品价格表 服务实现类 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@Service +public class MallPriceServiceImpl extends ServiceImpl implements MallPriceService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/MallServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/MallServiceImpl.java new file mode 100644 index 0000000..6120116 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/MallServiceImpl.java @@ -0,0 +1,621 @@ +package com.huoran.nakadai.service.impl; + +import cn.hutool.core.util.ObjectUtil; +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.huoran.api.OccupationlabClient; +import com.huoran.api.UserClient; +import com.huoran.common.exception.CustomException; +import com.huoran.common.exception.ExceptionEnum; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.nakadai.entity.*; +import com.huoran.nakadai.entity.req.GoodsListReq; +import com.huoran.nakadai.entity.res.GoodsRes; +import com.huoran.nakadai.entity.vo.GoodsVo; +import com.huoran.nakadai.mapper.*; +import com.huoran.nakadai.service.MallService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.stream.Collectors; + +/** + *

+ * 商城管理表 服务实现类 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@Service +public class MallServiceImpl extends ServiceImpl implements MallService { + + @Autowired + ThreadPoolExecutor executor; + + @Autowired + private UserClient userClient; + + @Autowired + private MallClassificationMapper mallClassificationMapper; + + @Autowired + private MallDisciplineMapper mallDisciplineMapper; + + @Autowired + private MallPriceMapper mallPriceMapper; + + @Autowired + private MallTagsMapper mallTagsMapper; + + @Autowired + private MallTypeMapper mallTypeMapper; + + @Autowired + private MallSupplierMapper mallSupplierMapper; + + @Autowired + private MallAnnexMapper mallAnnexMapper; + + @Autowired + private OccupationlabClient occupationlabClient; + + @Autowired + private CurriculumMapper curriculumMapper; + + @Autowired + private DataProductMapper dataProductMapper; + + @Autowired + private MallNonAssociatedLinksMapper mallNonAssociatedLinksMapper; + + @Override + @Transactional +// @CacheEvict(value = "n_listOfGoods", allEntries = true) + public R addGoods(GoodsVo goodsVo) throws ExecutionException, InterruptedException { + Mall goods = goodsVo.getMall(); + List classificationIds = goodsVo.getClassificationIds(); + List mallDisciplines = goodsVo.getMallDisciplines(); + List mallPrices = goodsVo.getMallPrices(); + List tagsIds = goodsVo.getTagsIds(); + List supplierIds = goodsVo.getSupplierIds(); + List typeIds = goodsVo.getTypeIds(); + List mallAnnex = goodsVo.getMallAnnex(); + List mallNonAssociatedLinks = goodsVo.getMallNonAssociatedLinks(); + + CompletableFuture goodsFuture = CompletableFuture.supplyAsync(() -> { + //添加商品基本信息 + baseMapper.insert(goods); + return goods.getMallId(); + }, executor); + + + CompletableFuture classificationFuture = goodsFuture.thenAcceptAsync(mallId -> { + //如果产品分类存在,则保存 + if (ObjectUtil.isNotNull(classificationIds)) { + for (Integer classificationId : classificationIds) { + MallClassification mallClassification = new MallClassification(); + mallClassification.setMallId(mallId); + mallClassification.setClassificationId(classificationId); + mallClassificationMapper.insert(mallClassification); + } + } + }, executor); + + + CompletableFuture disciplinesFuture = goodsFuture.thenAcceptAsync(mallId -> { + //如果适用学科专业集存在,则保存 + if (ObjectUtil.isNotNull(mallDisciplines)) { + for (MallDiscipline mallDiscipline : mallDisciplines) { + mallDiscipline.setMallId(mallId); + mallDisciplineMapper.insert(mallDiscipline); + } + } + }, executor); + + + CompletableFuture mallPriceFuture = goodsFuture.thenAcceptAsync(mallId -> { + //如果产品分类存在,则保存 + if (ObjectUtil.isNotNull(mallPrices)) { + for (MallPrice mallPrice : mallPrices) { + mallPrice.setMallId(mallId); + mallPriceMapper.insert(mallPrice); + } + } + }, executor); + + CompletableFuture tagsIdsFuture = goodsFuture.thenAcceptAsync(mallId -> { + //如果产品分类存在,则保存 + if (ObjectUtil.isNotNull(tagsIds)) { + for (Integer tagsId : tagsIds) { + MallTags mallTags = new MallTags(); + mallTags.setTagsId(tagsId); + mallTags.setMallId(mallId); + mallTagsMapper.insert(mallTags); + } + } + }, executor); + + + CompletableFuture mallSupplierFuture = goodsFuture.thenAcceptAsync(mallId -> { + //如果产品分类存在,则保存 + if (ObjectUtil.isNotNull(supplierIds)) { + for (Integer supplierId : supplierIds) { + MallSupplier mallSupplier = new MallSupplier(); + mallSupplier.setSupplierId(supplierId); + mallSupplier.setMallId(mallId); + mallSupplierMapper.insert(mallSupplier); + } + } + }, executor); + + + CompletableFuture mallTypeFuture = goodsFuture.thenAcceptAsync(mallId -> { + //如果产品分类存在,则保存 + if (ObjectUtil.isNotNull(typeIds)) { + for (Integer typeId : typeIds) { + MallType mallType = new MallType(); + mallType.setTypeId(typeId); + mallType.setMallId(mallId); + mallTypeMapper.insert(mallType); + } + } + }, executor); + + + CompletableFuture mallAnnexFuture = goodsFuture.thenAcceptAsync(mallId -> { + //如果产品分类存在,则保存 + if (ObjectUtil.isNotNull(mallAnnex)) { + for (MallAnnex annex : mallAnnex) { + annex.setMallId(mallId); + mallAnnexMapper.insert(annex); + } + } + }, executor); + + CompletableFuture mallNonAssociatedLinksFuture = goodsFuture.thenAcceptAsync(mallId -> { + //如果产品链接存在,则保存 + if (ObjectUtil.isNotNull(mallNonAssociatedLinks)) { + for (MallNonAssociatedLinks mallNonAssociatedLink : mallNonAssociatedLinks) { + mallNonAssociatedLink.setMallId(mallId); + mallNonAssociatedLinksMapper.insert(mallNonAssociatedLink); + } + } + }, executor); + + //等待所有任务都完成 + CompletableFuture.allOf(classificationFuture, + disciplinesFuture, mallPriceFuture, + tagsIdsFuture, mallSupplierFuture, + mallTypeFuture,mallAnnexFuture,mallNonAssociatedLinksFuture).get(); + + if (goodsFuture.get() > 0) { + return R.ok().put("mallId", goods.getMallId()); + } + return R.error(); + } + + @Override +// @Cacheable(value = {"n_listOfGoods"}) + public R listOfGoods(GoodsListReq goodsListReq) { + //默认为0 + goodsListReq.setSchoolPurchaseSign(0); + Page page = new Page<>(goodsListReq.getPageNum(), goodsListReq.getPageSize()); + + List mallIds = new ArrayList<>(); + //查询学校购买的商品id + if (goodsListReq.getSchoolId()!=null&& goodsListReq.getSchoolId()!=0){ + mallIds = this.schoolGoods(goodsListReq.getSchoolId()); + //查询已购买信息,未购买直接返回空 + if (mallIds==null || mallIds.size()<1){ + if (goodsListReq.getPurchaseStatus()!=null&&goodsListReq.getPurchaseStatus()==1){ + return createEmptyPage(); + } + } + goodsListReq.setMallIds(mallIds); + + } + if (goodsListReq.getPurchaseStatus()!=null&&goodsListReq.getPurchaseStatus()==1){ + //学校购买标识,购买过可以查询下架商品 + goodsListReq.setSchoolPurchaseSign(1); + } + +// if (goodsListReq.getPurchaseStatus()!=null&&goodsListReq.getPurchaseStatus()==2){ +// //查询,所有上架商品 +// List allMallIds = baseMapper.selectGoodsList(); +// +// //如果所有上架商品都在学校购买的商品之中,未购买直接返回空 +// if (allMallIds!=null){ +// int i = 0; +// for (Integer allMallId : allMallIds) { +// if (mallIds.contains(allMallId)){ +// i++; +// } +// } +// if (allMallIds.size()==i){ +// return createEmptyPage(); +// } +// +// allMallIds.removeAll(mallIds); +// } +// goodsListReq.setMallIds(allMallIds); +// } + if (goodsListReq.getPurchaseStatus()!=null&&goodsListReq.getPurchaseStatus()==2){ + //查询,所有上架商品 + List allMallIds = baseMapper.selectGoodsList(); + + //如果所有上架商品都在学校购买的商品之中,未购买直接返回空 + if (allMallIds!=null && allMallIds.stream().allMatch(mallIds::contains)){ + return createEmptyPage(); + } + assert allMallIds != null; + allMallIds.removeAll(mallIds); + goodsListReq.setMallIds(allMallIds); + } + + IPage iPage = baseMapper.goodsList(page, goodsListReq); + for (GoodsRes goodsRes : iPage.getRecords()) { + //我校标识 + if (mallIds!=null && mallIds.size()>0){ + if (mallIds.contains(goodsRes.getMallId())){ + goodsRes.setLogoOfOurSchool(true); + } + } + List mallNonAssociatedLinks = mallNonAssociatedLinksMapper. + selectList(new QueryWrapper().eq("mall_id", goodsRes.getMallId())); + goodsRes.setMallNonAssociatedLinks(mallNonAssociatedLinks); + } + + if (goodsListReq.getIsAssociatedProduct()!=null && goodsListReq.getIsAssociatedProduct()==1){ + //查询课程下面的系统,赛事内容调用 + ArrayList curriculumList = new ArrayList<>(); + curriculumList.add(1); + curriculumList.add(2); + List list = iPage.getRecords().stream(). + filter(goodsRes -> goodsRes.getIsAssociatedProduct() == 0 && + curriculumList.contains(goodsRes.getClassificationId())).collect(Collectors.toList()); + for (GoodsRes goodsRes : list) { + //查询关联产品对应的系统 + String systemId = baseMapper.selectMallSystem(goodsRes.getAssociatedProduct()); + goodsRes.setSystemId(systemId); + } + iPage.setRecords(list); + iPage.setSize(list.size()); + } + + return R.ok().put("page",iPage); + } + + public R createEmptyPage() { + IPage iPage = new IPage() { + @Override + public List getRecords() { + return null; + } + + @Override + public IPage setRecords(List list) { + return null; + } + + @Override + public long getTotal() { + return 0; + } + + @Override + public IPage setTotal(long l) { + return null; + } + + @Override + public long getSize() { + return 0; + } + + @Override + public IPage setSize(long l) { + return null; + } + + @Override + public long getCurrent() { + return 0; + } + + @Override + public IPage setCurrent(long l) { + return null; + } + }; + return R.ok().put("page",iPage); + } + + @Override + public R stationShoppingMall(GoodsListReq goodsListReq) { + //默认为0 + goodsListReq.setSchoolPurchaseSign(0); + Page page = new Page<>(goodsListReq.getPageNum(), goodsListReq.getPageSize()); + + IPage iPage = baseMapper.goodsList(page, goodsListReq); + for (GoodsRes goodsRes : iPage.getRecords()) { + List mallNonAssociatedLinks = mallNonAssociatedLinksMapper. + selectList(new QueryWrapper().eq("mall_id", goodsRes.getMallId())); + goodsRes.setMallNonAssociatedLinks(mallNonAssociatedLinks); + } + + if (goodsListReq.getIsAssociatedProduct()!=null && goodsListReq.getIsAssociatedProduct()==1){ + //查询课程下面的系统,赛事内容调用 + ArrayList curriculumList = new ArrayList<>(); + curriculumList.add(1); + curriculumList.add(2); + List list = iPage.getRecords().stream(). + filter(goodsRes -> goodsRes.getIsAssociatedProduct() == 0 && + curriculumList.contains(goodsRes.getClassificationId())).collect(Collectors.toList()); + for (GoodsRes goodsRes : list) { + //查询关联产品对应的系统 + String systemId = baseMapper.selectMallSystem(goodsRes.getAssociatedProduct()); + goodsRes.setSystemId(systemId); + } + iPage.setRecords(list); + iPage.setSize(list.size()); + } + + return R.ok().put("page",iPage); + } + + @Override + public List schoolGoods(Integer schoolId) { + return baseMapper.schoolGoods(schoolId); + } + + @Override + public GoodsVo detailsOfGoods(Integer mallId,String token) { + GoodsVo goodsVo = new GoodsVo(); + Mall mall = baseMapper.selectById(mallId); + + List classifications = mallClassificationMapper.selectList(new QueryWrapper().eq("mall_id", mallId)); + List classificationIds = classifications.stream().map(MallClassification::getClassificationId).collect(Collectors.toList()); + + //关联了课程产品 + if (mall.getIsAssociatedProduct()==0){ + if (classificationIds.contains(1)||classificationIds.contains(2)){ + //查询课程系统 + String systemId = baseMapper.selectSystem(mall.getAssociatedProduct(),0); + if (systemId!=null&&token!=null){ + goodsVo.setSystemId(systemId); + R r = occupationlabClient.getProjectBySystemId(systemId, token,0, mall.getAssociatedProduct(),mallId); + Integer projectSize = (Integer)r.get("projectSize"); + if (projectSize!=null){ + goodsVo.setNumberOfExperimentalItems(projectSize); + } + } + if (token==null){ + goodsVo.setNumberOfExperimentalItems(50); + } + } + } + + List mallDisciplines = mallDisciplineMapper.selectList(new QueryWrapper().eq("mall_id", mallId)); + List mallPrices = mallPriceMapper.selectList(new QueryWrapper().eq("mall_id", mallId)); + + List mallTags = mallTagsMapper.selectList(new QueryWrapper().eq("mall_id", mallId)); + List mallTagIds = mallTags.stream().map(MallTags::getTagsId).collect(Collectors.toList()); + + List mallTypes = mallTypeMapper.selectList(new QueryWrapper().eq("mall_id", mallId)); + List mallTypeIds = mallTypes.stream().map(MallType::getTypeId).collect(Collectors.toList()); + + List mallSuppliers = mallSupplierMapper.selectList(new QueryWrapper().eq("mall_id", mallId)); + List mallSupplierIds = mallSuppliers.stream().map(MallSupplier::getSupplierId).collect(Collectors.toList()); + + List mallAnnexes = mallAnnexMapper.selectList(new QueryWrapper().eq("mall_id", mallId)); + List mallNonAssociatedLinks = mallNonAssociatedLinksMapper.selectList(new QueryWrapper().eq("mall_id", mallId)); + + GoodsRes goodsRes = baseMapper.selectGoods(mallId); + if (token!=null){ + String accountId = TokenUtils.getIdByJwtToken(token); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + //查询学校购买的课程id + if (schoolId!=null&& schoolId!=0){ + List list = baseMapper.schoolCourseIds(schoolId); + if (list.contains(mall.getAssociatedProduct())){ + goodsRes.setLogoOfOurSchool(true); + } + } + + if (schoolId!=null&& schoolId!=0){ + List list = this.schoolGoods(schoolId); + if (list.contains(mallId)){ + goodsRes.setLogoOfOurSchool(true); + } + } + } + + goodsVo.setGoodsRes(goodsRes); + goodsVo.setMall(mall); + goodsVo.setMallPrices(mallPrices); + goodsVo.setMallDisciplines(mallDisciplines); + goodsVo.setTagsIds(mallTagIds); + goodsVo.setClassificationIds(classificationIds); + goodsVo.setTypeIds(mallTypeIds); + goodsVo.setSupplierIds(mallSupplierIds); + goodsVo.setMallAnnex(mallAnnexes); + goodsVo.setMallNonAssociatedLinks(mallNonAssociatedLinks); + return goodsVo; + } + + @Override + @Transactional +// @CacheEvict(value = "n_listOfGoods", allEntries = true) + public boolean deletionOfGoods(Integer mallId) { + //商品相关联数据删除,再删除商品 + mallClassificationMapper.delete(new QueryWrapper().eq("mall_id", mallId)); + mallDisciplineMapper.delete(new QueryWrapper().eq("mall_id", mallId)); + mallPriceMapper.delete(new QueryWrapper().eq("mall_id", mallId)); + mallTagsMapper.delete(new QueryWrapper().eq("mall_id", mallId)); + mallTypeMapper.delete(new QueryWrapper().eq("mall_id", mallId)); + mallSupplierMapper.delete(new QueryWrapper().eq("mall_id", mallId)); + mallAnnexMapper.delete(new QueryWrapper().eq("mall_id", mallId)); + mallNonAssociatedLinksMapper.delete(new QueryWrapper().eq("mall_id", mallId)); + int delete = baseMapper.deleteById(mallId); + return delete > 0; + } + + @Override + @Transactional +// @CacheEvict(value = "n_listOfGoods", allEntries = true) + public boolean renewalOfGoods(GoodsVo goodsVo) { + Mall mall = goodsVo.getMall(); + int update = baseMapper.updateById(mall); + Integer mallId = mall.getMallId(); + + //关联了课程产品并上架 + if (mall.getIsAssociatedProduct()==0 && mall.getIsShelves()==0){ + if (goodsVo.getClassificationIds().contains(1)||goodsVo.getClassificationIds().contains(2)){ + //查询课程 + Curriculum curriculum = curriculumMapper.selectById(mall.getAssociatedProduct()); + if (ObjectUtil.isNull(curriculum)){ + throw new CustomException(ExceptionEnum.COURSE_PRODUCTS_HAVE_BEEN_REMOVED); + }else { + if (curriculum.getIsShelves()==0){ + throw new CustomException(ExceptionEnum.COURSE_PRODUCTS_HAVE_BEEN_REMOVED_FROM_SALE); + } + } + //关联了数据平台 + }else if (goodsVo.getClassificationIds().contains(5)){ + DataProduct dataProduct = dataProductMapper.selectById(mall.getAssociatedProduct()); + if (ObjectUtil.isNull(dataProduct)){ + throw new CustomException(ExceptionEnum.DATA_PRODUCTS_HAVE_BEEN_REMOVED); + }else { + if (dataProduct.getStatus()==0){ + throw new CustomException(ExceptionEnum.DATA_PRODUCTS_HAVE_BEEN_REMOVED_FROM_SALE); + } + } + } + } + + //商品相关联数据删除,再删除商品 + mallClassificationMapper.delete(new QueryWrapper().eq("mall_id", mallId)); + mallDisciplineMapper.delete(new QueryWrapper().eq("mall_id", mallId)); + mallPriceMapper.delete(new QueryWrapper().eq("mall_id", mallId)); + mallTagsMapper.delete(new QueryWrapper().eq("mall_id", mallId)); + mallTypeMapper.delete(new QueryWrapper().eq("mall_id", mallId)); + mallSupplierMapper.delete(new QueryWrapper().eq("mall_id", mallId)); + mallAnnexMapper.delete(new QueryWrapper().eq("mall_id", mallId)); + mallNonAssociatedLinksMapper.delete(new QueryWrapper().eq("mall_id", mallId)); + + //如果产品分类存在,则保存 + if (ObjectUtil.isNotNull(goodsVo.getClassificationIds())) { + for (Integer classificationId : goodsVo.getClassificationIds()) { + MallClassification mallClassification = new MallClassification(); + mallClassification.setMallId(mallId); + mallClassification.setClassificationId(classificationId); + mallClassificationMapper.insert(mallClassification); + } + } + + //如果适用学科专业集存在,则保存 + if (ObjectUtil.isNotNull(goodsVo.getMallDisciplines())) { + for (MallDiscipline mallDiscipline : goodsVo.getMallDisciplines()) { + mallDiscipline.setMallId(mallId); + mallDisciplineMapper.insert(mallDiscipline); + } + } + + //如果产品分类存在,则保存 + if (ObjectUtil.isNotNull(goodsVo.getMallPrices())) { + for (MallPrice mallPrice : goodsVo.getMallPrices()) { + mallPrice.setMallId(mallId); + mallPriceMapper.insert(mallPrice); + } + } + + //如果产品分类存在,则保存 + if (ObjectUtil.isNotNull(goodsVo.getTagsIds())) { + for (Integer tagsId : goodsVo.getTagsIds()) { + MallTags mallTags = new MallTags(); + mallTags.setTagsId(tagsId); + mallTags.setMallId(mallId); + mallTagsMapper.insert(mallTags); + } + } + + + //如果产品分类存在,则保存 + if (ObjectUtil.isNotNull(goodsVo.getSupplierIds())) { + for (Integer supplierId : goodsVo.getSupplierIds()) { + MallSupplier mallSupplier = new MallSupplier(); + mallSupplier.setSupplierId(supplierId); + mallSupplier.setMallId(mallId); + mallSupplierMapper.insert(mallSupplier); + } + } + + //如果产品分类存在,则保存 + if (ObjectUtil.isNotNull(goodsVo.getTypeIds())) { + for (Integer typeId : goodsVo.getTypeIds()) { + MallType mallType = new MallType(); + mallType.setTypeId(typeId); + mallType.setMallId(mallId); + mallTypeMapper.insert(mallType); + } + } + + //如果产品附件存在,则保存 + if (ObjectUtil.isNotNull(goodsVo.getMallAnnex())) { + for (MallAnnex annex : goodsVo.getMallAnnex()) { + annex.setMallId(mallId); + mallAnnexMapper.insert(annex); + } + } + + //如果产品链接存在,则保存 + if (ObjectUtil.isNotNull(goodsVo.getMallNonAssociatedLinks())) { + for (MallNonAssociatedLinks mallNonAssociatedLink : goodsVo.getMallNonAssociatedLinks()) { + mallNonAssociatedLink.setMallId(mallId); + mallNonAssociatedLinksMapper.insert(mallNonAssociatedLink); + } + } + + return update>0; + } + + + @Override + public List goodsSchemeClassification() { + //查询关联方案 + List list = baseMapper.selectAssociationScheme(); + for (PartnerArticleClassification partnerArticleClassification : list) { + //查询关联商品 + if (StringUtils.isNotEmpty(partnerArticleClassification.getSchemeId())){ + String mallId = baseMapper.selectAssociationMall(partnerArticleClassification.getSchemeId()); + partnerArticleClassification.setMallId(mallId); + } + } + return list; + } + + @Override + public R websiteProductList(GoodsListReq goodsListReq) { + + Page page = new Page<>(goodsListReq.getPageNum(), goodsListReq.getPageSize()); + IPage iPage = baseMapper.websiteProductList(page, goodsListReq); + for (GoodsRes goodsRes : iPage.getRecords()) { + List mallNonAssociatedLinks = mallNonAssociatedLinksMapper. + selectList(new QueryWrapper().eq("mall_id", goodsRes.getMallId())); + goodsRes.setMallNonAssociatedLinks(mallNonAssociatedLinks); + } + + return R.ok().put("page",iPage); + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/MallSupplierServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/MallSupplierServiceImpl.java new file mode 100644 index 0000000..fc1d435 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/MallSupplierServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.nakadai.service.impl; + +import com.huoran.nakadai.entity.MallSupplier; +import com.huoran.nakadai.mapper.MallSupplierMapper; +import com.huoran.nakadai.service.MallSupplierService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 商品供应商关联表 服务实现类 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@Service +public class MallSupplierServiceImpl extends ServiceImpl implements MallSupplierService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/MallTagsServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/MallTagsServiceImpl.java new file mode 100644 index 0000000..8f47451 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/MallTagsServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.nakadai.service.impl; + +import com.huoran.nakadai.entity.MallTags; +import com.huoran.nakadai.mapper.MallTagsMapper; +import com.huoran.nakadai.service.MallTagsService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 商品分类标签关联表 服务实现类 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@Service +public class MallTagsServiceImpl extends ServiceImpl implements MallTagsService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/MallTypeServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/MallTypeServiceImpl.java new file mode 100644 index 0000000..cc30e8c --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/MallTypeServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.nakadai.service.impl; + +import com.huoran.nakadai.entity.MallType; +import com.huoran.nakadai.mapper.MallTypeMapper; +import com.huoran.nakadai.service.MallTypeService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 商品类型关联表 服务实现类 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@Service +public class MallTypeServiceImpl extends ServiceImpl implements MallTypeService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/MessageServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/MessageServiceImpl.java new file mode 100644 index 0000000..650aaca --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/MessageServiceImpl.java @@ -0,0 +1,89 @@ +package com.huoran.nakadai.service.impl; + +import com.huoran.common.constant.RabbitmqConstant; +import com.huoran.common.response.R; +import com.huoran.nakadai.service.MessageService; +import com.huoran.nakadai.utils.ContextUtils; +import com.rabbitmq.client.Channel; +import org.springframework.amqp.core.AmqpAdmin; +import org.springframework.amqp.core.Binding; +import org.springframework.amqp.core.Message; +import org.springframework.amqp.core.Queue; +import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer; +import org.springframework.amqp.rabbit.listener.api.ChannelAwareMessageListener; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +@Service +public class MessageServiceImpl implements MessageService { + + @Autowired + private AmqpAdmin amqpAdmin; + + @Autowired + private RabbitTemplate rabbitTemplate; + + @Override + public void createQueue(String accountId) { + //根据当前用户创建队列并绑定交换机 + String queueName = accountId + RabbitmqConstant.COMMENT_QUEUE; + Queue queue = new Queue(queueName,true,false,false,null); + amqpAdmin.declareQueue(queue); + String routingKey = accountId + RabbitmqConstant.COMMENT_ROUTING_KEY; + /* + * String destination, 目的地 + * DestinationType destinationType, 目的地类型 + * String exchange,交换机 + * String routingKey,路由键 + * @Nullable Map arguments 自定义参数 + */ + Binding binding = new Binding(queueName, + Binding.DestinationType.QUEUE, + RabbitmqConstant.COMMENT_EXCHANGE,routingKey,null); + amqpAdmin.declareBinding(binding); + } + + @Override + public void sendMessageToUser(String message, String accountId) { + String routingKey = accountId + RabbitmqConstant.COMMENT_ROUTING_KEY; + rabbitTemplate.convertAndSend(RabbitmqConstant.COMMENT_EXCHANGE, routingKey,message); + } + + @Override + public R messagesListener(String accountId,Long deliveryTag){ + SimpleMessageListenerContainer container = ContextUtils.getBean(SimpleMessageListenerContainer.class); + String oneQueueNames = accountId + RabbitmqConstant.COMMENT_QUEUE; + + List list = new ArrayList<>(); + container.addQueueNames(oneQueueNames); + container.setMessageListener(new ChannelAwareMessageListener() { + + @Override + public void onMessage(Message message, Channel channel) { + System.out.println(message); + /*list.add(message.getBody().toString()); + try { + if (deliveryTag!=null){ + //消息确认 + channel.basicAck(deliveryTag,false); + } + +*//* long deliveryTagM = message.getMessageProperties().getDeliveryTag(); + if (deliveryTag==null || deliveryTagM!=deliveryTag){ + //消息返回 + channel.basicNack(deliveryTagM,false,true); + }*//* + } catch (IOException e) { + throw new RuntimeException(e); + } +*/ + } + }); + return R.ok().put("list",list); + } + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/ModelDemoHiddenServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/ModelDemoHiddenServiceImpl.java new file mode 100644 index 0000000..cac475c --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/ModelDemoHiddenServiceImpl.java @@ -0,0 +1,29 @@ +package com.huoran.nakadai.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.nakadai.entity.ModelDemoHidden; +import com.huoran.nakadai.mapper.ModelDemoHiddenMapper; +import com.huoran.nakadai.service.ModelDemoHiddenService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 此表是在教师端系统管理,可对于系统内置模型统一管理 服务实现类 + *

+ * + * @author chen + * @since 2023-06-03 + */ +@Service +public class ModelDemoHiddenServiceImpl extends ServiceImpl implements ModelDemoHiddenService { + + @Override + public ModelDemoHidden viewDetails(Integer modelId,Integer schoolId) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("model_id",modelId); + queryWrapper.eq("school_id",schoolId); + ModelDemoHidden hidden = baseMapper.selectOne(queryWrapper); + return hidden; + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/ModelReferenceCategoryServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/ModelReferenceCategoryServiceImpl.java new file mode 100644 index 0000000..938247a --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/ModelReferenceCategoryServiceImpl.java @@ -0,0 +1,202 @@ +package com.huoran.nakadai.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.huoran.common.constant.DelConstant; +import com.huoran.common.constant.ModellConstant; +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.ModelReferenceCategory; +import com.huoran.nakadai.entity.ModelReferenceDemo; +import com.huoran.nakadai.entity.ModelSysCategory; +import com.huoran.nakadai.entity.ModelSysDemo; +import com.huoran.nakadai.mapper.ModelReferenceCategoryMapper; +import com.huoran.nakadai.mapper.ModelReferenceDemoMapper; +import com.huoran.nakadai.service.ModelReferenceCategoryService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.stream.Collectors; + +/** + *

+ * 引用模型-分类表 服务实现类 + *

+ * + * @author chen + * @since 2022-03-04 + */ +@Service +public class ModelReferenceCategoryServiceImpl extends ServiceImpl implements ModelReferenceCategoryService { + + @Autowired + private ModelReferenceDemoMapper referenceDemoMapper; + + /** + * 递归查询子级 + * + * @param menus 查询的所有菜单 + * @param firstMenuVos 第一级的菜单 + */ + private void findSubMenu(List menus, List firstMenuVos) { + //遍历第一级 + firstMenuVos.forEach(firstMenuVo -> { + //子级菜单集合 + List secondMenuVos = new LinkedList<>(); + //查找子级 递归的出口就是循环完毕 + for (ModelReferenceCategory menu : menus) { + //判断当前是否为子父级关系 + if (firstMenuVo.getId().equals(menu.getParentId())) { + //如果是添加到子级中 + secondMenuVos.add(menuToMenuVO(menu)); + } + //递归调用,几级菜单都可以 + // findSubMenu(menus, secondMenuVos); + } + + if (menus.size() != 0) { + //递归调用,几级菜单都可以 + findSubMenu(menus, secondMenuVos); + } + //将子级放入一级目录 + firstMenuVo.setChildren(secondMenuVos); + }); + } + + /** + * 视图与实体类数据转换 + * + * @param menu + * @return + */ + private ModelReferenceCategory menuToMenuVO(ModelReferenceCategory menu) { + ModelReferenceCategory menuVo = new ModelReferenceCategory(); + BeanUtils.copyProperties(menu, menuVo); + return menuVo; + } + + public void selectCategoryChildById(String id, List idList) { + //查询菜单里面子菜单id + QueryWrapper wrapper = new QueryWrapper(); + wrapper.eq("parent_id", id); + wrapper.eq("is_del", 0); + wrapper.select("id");//我们只想查询id 所以只需要查询指定列的值 + List childIdList = baseMapper.selectList(wrapper);//当前菜单的所有子菜单 + //把childIdList里面菜单id值获取出来,封装idList里面,做递归查询 + childIdList.stream().forEach(item -> {//遍历集合得到每一个对象item + //封装idList里面 + idList.add(item.getId()); + //递归查询 + this.selectCategoryChildById(item.getId() + "", idList); + }); + } + + @Override + public List modelClassList(Integer systemId, Integer founder, Integer schoolId) { + //1.查询出所有分类 + + QueryWrapper queryWrapper = new QueryWrapper(); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + queryWrapper.eq("system_id", systemId); + queryWrapper.eq("founder", founder); + if (founder == ModellConstant.SOURCE_INSTITUTION) { + //创建来源为院校时候赋值学校id + queryWrapper.eq("school_id", schoolId); + } + List menus = baseMapper.selectList(queryWrapper); + + //2.组装成父子分类 + //2.1找到所有的一级分类(父分类ID为0) + //获取一级菜单 + List firstMenuVos = menus.stream().filter(menu -> menu.getParentId() == 0).collect(Collectors.toList()); + //查询子级 + findSubMenu(menus, firstMenuVos); + return firstMenuVos; + } + + @Override + public R deleteModelClass(Integer categoryId) { + //1 创建list集合,用于封装所有删除菜单id值 + List idList = new ArrayList<>(); + //2 向idList集合设置删除菜单id + this.selectCategoryChildById(categoryId + "", idList);//找到当前菜单的子菜单 把结果id封装到idlist里面去 + //把当前id封装到list里面 + idList.add(categoryId);//现在把当前id封装进去 之前都是子菜单的id + + for (Integer id : idList) { + //删除当前分类以及分类下模型 + referenceDemoMapper.update(new ModelReferenceDemo(), new UpdateWrapper() + .set("is_del", DelConstant.IS_DEL).eq("category_id", id)); + } + Integer retCode = baseMapper.deleteBatchIds(idList); + return retCode > 0 ? R.ok() : R.error(); + } + + @Override + public boolean checkRepeat(ModelReferenceCategory modelSysCategory, Integer type) { + //增加校验 判重 同级下不能重复 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("parent_id", modelSysCategory.getParentId()); + queryWrapper.eq("category_name", modelSysCategory.getCategoryName()); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + queryWrapper.eq("system_id", modelSysCategory.getSystemId()); + if (modelSysCategory.getFounder() == ModellConstant.SOURCE_INSTITUTION) { + //来源为院校时候增加学校查询条件 + queryWrapper.eq("school_id", modelSysCategory.getSchoolId()); + } + + switch (type) { + //区分编辑还是新增判重 如若为编辑判重时候除去本id + case 1: + //编辑 + queryWrapper.last(" and id != " + modelSysCategory.getId()); + } + + ModelReferenceCategory category = baseMapper.selectOne(queryWrapper); + return category != null; + } + + @Override + public R checkIsShowBySystemId(Integer systemId) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("system_id", systemId); + queryWrapper.eq("level", 0); + queryWrapper.last(" LIMIT 0,1"); + ModelReferenceCategory category = baseMapper.selectOne(queryWrapper); + if (category != null) { + return R.ok().put("isShow", category.getIsShow()); + } + return R.ok().put("isShow", 1); + + } + + @Override + public R modifyIsShowState(Integer systemId, Integer isShow) { + UpdateWrapper wrapper = new UpdateWrapper<>(); + wrapper.set("is_show", isShow); + wrapper.eq("system_id", systemId); + wrapper.eq("is_del", DelConstant.NOT_DEL); + Integer retCode = baseMapper.update(new ModelReferenceCategory(), wrapper); + return R.ok(); + } + + @Override + public List builtInClassificationByNakadai(Integer systemId) { + //1.查询出中台创建的引用模型的所有未删除的分类 + List menus = baseMapper.selectList(new QueryWrapper() + .eq("is_del", DelConstant.NOT_DEL) + .eq("founder", ModellConstant.SOURCE_SYSTEM) + .eq("system_id", systemId)); + //2.组装成父子分类 + //2.1找到所有的一级分类(父分类ID为0) + //获取一级菜单 + List firstMenuVos = menus.stream().filter(menu -> menu.getParentId() == 0).collect(Collectors.toList()); + //查询子级 + findSubMenu(menus, firstMenuVos); + return firstMenuVos; + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/ModelReferenceDemoServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/ModelReferenceDemoServiceImpl.java new file mode 100644 index 0000000..12c20fd --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/ModelReferenceDemoServiceImpl.java @@ -0,0 +1,354 @@ +package com.huoran.nakadai.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.common.constant.DelConstant; +import com.huoran.common.constant.ModellConstant; +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.ModelReferenceCategory; +import com.huoran.nakadai.entity.ModelReferenceDemo; +import com.huoran.nakadai.entity.ModelSysCategory; +import com.huoran.nakadai.entity.ModelSysDemo; +import com.huoran.nakadai.entity.req.PageImportModelReq; +import com.huoran.nakadai.entity.req.PageModelReq; +import com.huoran.nakadai.mapper.ModelReferenceCategoryMapper; +import com.huoran.nakadai.mapper.ModelReferenceDemoMapper; +import com.huoran.nakadai.mapper.ModelSysCategoryMapper; +import com.huoran.nakadai.mapper.ModelSysDemoMapper; +import com.huoran.nakadai.service.ModelReferenceDemoService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Queue; + +/** + *

+ * 引用模型代码记录表 服务实现类 + *

+ * + * @author chen + * @since 2022-03-04 + */ +@Service +public class ModelReferenceDemoServiceImpl extends ServiceImpl implements ModelReferenceDemoService { + + @Autowired + private ModelSysCategoryMapper sysCategoryMapper; + + @Autowired + private ModelSysDemoMapper sysDemoMapper; + + @Autowired + private ModelReferenceCategoryMapper referenceCategoryMapper; + + @Override + public R referenceDemoList(PageModelReq req) { + Page page = new Page(req.getPageNum(), req.getPageSize()); + IPage pageList = baseMapper.referenceDemoList(page, req); + return R.ok().put("data", pageList); + } + + @Override + public R sortReadingModelByTeacherSideSystem(PageModelReq req) { + Page page = new Page(req.getPageNum(), req.getPageSize()); + IPage pageList = baseMapper.sortReadingModelByTeacherSideSystem(page, req); + return R.ok().put("data", pageList); + } + + /** + * @Description :同步原始模型前删除原有数据 + * @Param systemId + * @Author Rong---2022/3/7 + */ + @Override + public R delModelInfoBySystemId(Integer systemId, Integer founder, Integer schoolId) { + //同步前删除原有系统的数据 + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.set("is_del", DelConstant.IS_DEL); + updateWrapper.eq("system_id", systemId); + updateWrapper.eq("founder", founder); + if (founder == ModellConstant.SOURCE_INSTITUTION && schoolId != null) { + //创建来源为院校时候赋值学校id + updateWrapper.eq("school_id", schoolId); + } + Integer del = referenceCategoryMapper.update(new ModelReferenceCategory(), updateWrapper); + + //同时将当前删除分类下的模型一并删除 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("is_del", DelConstant.IS_DEL); + queryWrapper.eq("system_id", systemId); + queryWrapper.eq("founder", founder); + if (founder == ModellConstant.SOURCE_INSTITUTION && schoolId != null) { + //创建来源为院校时候赋值学校id + queryWrapper.eq("school_id", schoolId); + } + + List list = referenceCategoryMapper.selectList(queryWrapper); + for (ModelReferenceCategory modelSysCategory : list) { + UpdateWrapper updateWrapper1 = new UpdateWrapper<>(); + updateWrapper1.set("is_del", DelConstant.IS_DEL); + updateWrapper1.eq("category_id", modelSysCategory.getId()); + updateWrapper1.eq("system_id", systemId); + updateWrapper1.eq("founder", founder); + if (founder == ModellConstant.SOURCE_INSTITUTION && schoolId != null) { + //创建来源为院校时候赋值学校id + updateWrapper1.eq("school_id", schoolId); + } + baseMapper.update(new ModelReferenceDemo(), updateWrapper1); + } + return del != -1 ? R.ok() : R.error(); + } + + @Override + public R getAllModelList(PageImportModelReq req) { + Page page = new Page(req.getPageNum(), req.getPageSize()); + IPage pageList = baseMapper.getAllModelList(page, req); + return R.ok().put("data", pageList); + } + + @Override + public R teacherModelList(PageImportModelReq req) { + Page page = new Page(req.getPageNum(), req.getPageSize()); + IPage pageList = baseMapper.teacherModelList(page, req); + return R.ok().put("data", pageList); + } + + /** + * @Description : 根据系统id同步数据 + * @Param systemId + * @Param accountId + * @Author Rong---2022/3/11 + */ + @Override + public R synchronizationMdel(Integer systemId, Integer accountId) { + boolean ret = addCategory(0, 0, systemId, accountId); + return ret ? R.ok() : R.error(); + + } + + @Override + public R synchronizationMdelByOccupationlab(Integer systemId, Integer schoolId, Integer accountId) { + boolean ret = addCategoryByOccupationlab(0, 0, systemId, schoolId, accountId); + + QueryWrapper queryWrapper1 = new QueryWrapper(); + queryWrapper1.eq("parent_id", 0); + queryWrapper1.eq("founder", 1); + queryWrapper1.eq("school_id", schoolId); + queryWrapper1.eq("system_id", systemId); + queryWrapper1.eq("is_del", DelConstant.NOT_DEL); + + //获取学校分类父类id + ModelReferenceCategory getsTheSchoolParentClassId = referenceCategoryMapper.selectOne(queryWrapper1); + return ret ? R.ok().put("id", getsTheSchoolParentClassId.getId()) : R.error(); + } + + @Override + public R referenceDemoListByNakadai(PageModelReq req) { + Page page = new Page(req.getPageNum(), req.getPageSize()); + IPage pageList = baseMapper.referenceDemoListByNakadai(page, req); + return R.ok().put("data", pageList); + } + + @Override + public R studentModelList(PageImportModelReq req) { + Page page = new Page(req.getPageNum(), req.getPageSize()); + IPage pageList = baseMapper.studentModelList(page, req); + return R.ok().put("data", pageList); + } + + @Override + public R systemModelByTeacher(PageImportModelReq req) { + Page page = new Page(req.getPageNum(), req.getPageSize()); + IPage pageList = baseMapper.systemModelByTeacher(page, req); + return R.ok().put("data", pageList); + } + + /* public boolean addCategoryByOccupationlab(Integer fid, Integer incrementId, Integer systemId, Integer schoolId, Integer accountId) { + + //查询中台的内置数据同步到职站引用模型表 + QueryWrapper queryWrapper1 = new QueryWrapper<>(); + queryWrapper1.eq("parent_id", fid); + queryWrapper1.eq("is_open", DelConstant.IS_OPEN); + queryWrapper1.eq("is_del", DelConstant.NOT_DEL); + queryWrapper1.eq("founder", 0); + + List list = sysCategoryMapper.selectList(queryWrapper1);//查询源表 父类id为fid的数据 + + if (list.size() > 0) { + for (ModelSysCategory modelSysCategory : list) { + //将modelSysCategory添加进引用分类表中 + ModelReferenceCategory referenceCategory = new ModelReferenceCategory(); + referenceCategory.setCategoryName(modelSysCategory.getCategoryName()); + referenceCategory.setAccountId(accountId); + referenceCategory.setSystemId(systemId); + referenceCategory.setParentId(incrementId); + referenceCategory.setFounder(1); + referenceCategory.setSchoolId(schoolId); + referenceCategory.setLevel(modelSysCategory.getLevel()); + referenceCategoryMapper.insert(referenceCategory); + Integer getId = referenceCategory.getId();//拿到当前自增id + + //根据getId查询源模型代码表 + QueryWrapper queryWrapper2 = new QueryWrapper<>(); + queryWrapper2.eq("category_id", modelSysCategory.getId()); + queryWrapper2.eq("is_open", DelConstant.IS_OPEN); + queryWrapper2.eq("is_del", DelConstant.NOT_DEL); + queryWrapper2.eq("post_status", DelConstant.POST_STATUS); + //查询已发布的 + queryWrapper2.eq("post_status", ModellConstant.PUBLICATION_STATUS_PUBLISHED); + List demoList = sysDemoMapper.selectList(queryWrapper2);//查询源模型代码 + + if (demoList.size() > 0) { + for (ModelSysDemo demo : demoList) { + ModelReferenceDemo referenceDemo = new ModelReferenceDemo(); + referenceDemo.setCategoryId(getId); + referenceDemo.setAccountId(accountId); + referenceDemo.setCopyId(demo.getId()); + referenceDemo.setSystemId(systemId); + referenceDemo.setFounder(1); + referenceDemo.setModifyAccountId(accountId); + referenceDemo.setSchoolId(schoolId); + baseMapper.insert(referenceDemo); + } + } + addCategoryByOccupationlab(modelSysCategory.getId(), getId, systemId, schoolId, accountId); + } + return true; + } + return false; + }*/ + + + /** + * @Description :同步职站源模型至模型列表 + * @Param fid 父id + * @Param incrementId 自增id + * @Param systemId 系统id + * @Param accountId 账号id + * @Author Rong---2022/3/11 + */ + public boolean addCategoryByOccupationlab(Integer fid, Integer incrementId, Integer systemId, Integer schoolId, Integer accountId) { + + QueryWrapper queryWrapper1 = new QueryWrapper<>(); + queryWrapper1.eq("parent_id", fid); + queryWrapper1.eq("is_open", DelConstant.IS_OPEN); + queryWrapper1.eq("is_del", DelConstant.NOT_DEL); + queryWrapper1.eq("founder", 1); + queryWrapper1.eq("school_id", schoolId); + List list = sysCategoryMapper.selectList(queryWrapper1);//查询源表 父类id为fid的数据 + + if (list.size() > 0) { + for (ModelSysCategory modelSysCategory : list) { + //将modelSysCategory添加进引用分类表中 + ModelReferenceCategory referenceCategory = new ModelReferenceCategory(); + referenceCategory.setCategoryName(modelSysCategory.getCategoryName()); + referenceCategory.setAccountId(accountId); + referenceCategory.setSystemId(systemId); + referenceCategory.setParentId(incrementId); + referenceCategory.setFounder(ModellConstant.SOURCE_INSTITUTION); + referenceCategory.setSchoolId(schoolId); + referenceCategory.setLevel(modelSysCategory.getLevel()); + referenceCategoryMapper.insert(referenceCategory); + Integer getId = referenceCategory.getId();//拿到当前自增id + //根据getId查询查询已发布的源模型代码表 + QueryWrapper queryWrapper2 = new QueryWrapper<>(); + queryWrapper2.eq("category_id", modelSysCategory.getId()); + queryWrapper2.eq("is_open", DelConstant.IS_OPEN); + queryWrapper2.eq("zt_open", DelConstant.IS_OPEN); + queryWrapper2.eq("is_del", DelConstant.NOT_DEL); + queryWrapper2.eq("zt_del", DelConstant.NOT_DEL); + queryWrapper2.eq("founder", ModellConstant.SOURCE_INSTITUTION); + queryWrapper2.eq("school_id", schoolId); + queryWrapper2.eq("post_status", ModellConstant.PUBLICATION_STATUS_PUBLISHED); + //查询源模型代码 + List demoList = sysDemoMapper.selectList(queryWrapper2); + + if (demoList.size() > 0) { + for (ModelSysDemo demo : demoList) { + ModelReferenceDemo referenceDemo = new ModelReferenceDemo(); + referenceDemo.setCategoryId(getId); + referenceDemo.setAccountId(accountId); + referenceDemo.setCopyId(demo.getId()); + referenceDemo.setSystemId(systemId); + referenceDemo.setFounder(ModellConstant.SOURCE_INSTITUTION); + referenceDemo.setModifyAccountId(accountId); + referenceDemo.setSchoolId(schoolId); + baseMapper.insert(referenceDemo); + } + } + addCategoryByOccupationlab(modelSysCategory.getId(), getId, systemId,schoolId, accountId); + } + return true; + } + return false; + } + + + /** + * @Description :同步原始模型列表 + * @Param fid 父id + * @Param incrementId 自增id + * @Param systemId 系统id + * @Param accountId 账号id + * @Author Rong---2022/3/11 + */ + public boolean addCategory(Integer fid, Integer incrementId, Integer systemId, Integer accountId) { + + QueryWrapper queryWrapper1 = new QueryWrapper<>(); + queryWrapper1.eq("parent_id", fid); + queryWrapper1.eq("is_open", DelConstant.IS_OPEN); + queryWrapper1.eq("is_del", DelConstant.NOT_DEL); + queryWrapper1.eq("founder", 0); + + List list = sysCategoryMapper.selectList(queryWrapper1);//查询源表 父类id为fid的数据 + + if (list.size() > 0) { + for (ModelSysCategory modelSysCategory : list) { + //将modelSysCategory添加进引用分类表中 + ModelReferenceCategory referenceCategory = new ModelReferenceCategory(); + referenceCategory.setCategoryName(modelSysCategory.getCategoryName()); + referenceCategory.setAccountId(accountId); + referenceCategory.setSystemId(systemId); + referenceCategory.setParentId(incrementId); + referenceCategory.setFounder(0); + referenceCategory.setSchoolId(0); + referenceCategory.setLevel(modelSysCategory.getLevel()); + referenceCategoryMapper.insert(referenceCategory); + Integer getId = referenceCategory.getId();//拿到当前自增id + + //根据getId查询源模型代码表 + QueryWrapper queryWrapper2 = new QueryWrapper<>(); + queryWrapper2.eq("category_id", modelSysCategory.getId()); + queryWrapper2.eq("is_open", DelConstant.IS_OPEN); + queryWrapper2.eq("is_del", DelConstant.NOT_DEL); + queryWrapper2.eq("post_status", DelConstant.POST_STATUS); + //查询已发布的 + queryWrapper2.eq("post_status", ModellConstant.PUBLICATION_STATUS_PUBLISHED); + List demoList = sysDemoMapper.selectList(queryWrapper2);//查询源模型代码 + + if (demoList.size() > 0) { + for (ModelSysDemo demo : demoList) { + ModelReferenceDemo referenceDemo = new ModelReferenceDemo(); + referenceDemo.setCategoryId(getId); + referenceDemo.setAccountId(accountId); + referenceDemo.setCopyId(demo.getId()); + referenceDemo.setSystemId(systemId); + referenceDemo.setFounder(0); + referenceDemo.setModifyAccountId(accountId); + referenceDemo.setSchoolId(0); + baseMapper.insert(referenceDemo); + } + } + addCategory(modelSysCategory.getId(), getId, systemId, accountId); + } + return true; + } + return false; + } + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/ModelSysCategoryServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/ModelSysCategoryServiceImpl.java new file mode 100644 index 0000000..2e98ce7 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/ModelSysCategoryServiceImpl.java @@ -0,0 +1,177 @@ +package com.huoran.nakadai.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.huoran.common.constant.DelConstant; +import com.huoran.common.constant.ModellConstant; +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.ModelReferenceCategory; +import com.huoran.nakadai.entity.ModelSysCategory; +import com.huoran.nakadai.entity.ModelSysDemo; +import com.huoran.nakadai.entity.req.ModelSysDemoReq; +import com.huoran.nakadai.mapper.ModelSysCategoryMapper; +import com.huoran.nakadai.mapper.ModelSysDemoMapper; +import com.huoran.nakadai.service.ModelSysCategoryService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.stream.Collectors; + +/** + *

+ * 源模型-分类表 服务实现类 + *

+ * + * @author chen + * @since 2022-03-03 + */ +@Service +public class ModelSysCategoryServiceImpl extends ServiceImpl implements ModelSysCategoryService { + + @Autowired + private ModelSysCategoryMapper mapper; + + @Autowired + private ModelSysDemoMapper sysDemoMapper; + + /** + * 视图与实体类数据转换 + * + * @param menu + * @return + */ + private ModelSysCategory menuToMenuVO(ModelSysCategory menu) { + ModelSysCategory menuVo = new ModelSysCategory(); + BeanUtils.copyProperties(menu, menuVo); + return menuVo; + } + + /** + * 递归查询子级 + * + * @param menus 查询的所有菜单 + * @param firstMenuVos 第一级的菜单 + */ + private void findSubMenu(List menus, List firstMenuVos) { + //遍历第一级 + firstMenuVos.forEach(firstMenuVo -> { + //子级菜单集合 + List secondMenuVos = new LinkedList<>(); + //查找子级 递归的出口就是循环完毕 + for (ModelSysCategory menu : menus) { + //判断当前是否为子父级关系 + if (firstMenuVo.getId().equals(menu.getParentId())) { + //如果是添加到子级中 + secondMenuVos.add(menuToMenuVO(menu)); + } + + } + + if (menus.size() != 0) { + //递归调用,几级菜单都可以 + findSubMenu(menus, secondMenuVos); + } + //将子级放入一级目录 + firstMenuVo.setChildren(secondMenuVos); + }); + } + + @Override + public List sourceModelClassification(ModelSysDemoReq req) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("is_del", 0); + queryWrapper.eq("founder", req.getFounder()); + if (req.getFounder() == ModellConstant.SOURCE_INSTITUTION) { + //查询院校 + queryWrapper.eq("school_id", req.getSchoolId()); + } + + + //1.查询出所有分类 + List menus = mapper.selectList(queryWrapper); + //2.组装成父子分类 + //2.1找到所有的一级分类(父分类ID为0) + //获取一级菜单 + List firstMenuVos = menus.stream().filter(menu -> menu.getParentId() == 0).collect(Collectors.toList()); + //查询子级 + findSubMenu(menus, firstMenuVos); + return firstMenuVos; + } + + public void selectCategoryChildById(String id, List idList) { + //查询菜单里面子菜单id + QueryWrapper wrapper = new QueryWrapper(); + wrapper.eq("parent_id", id); + wrapper.eq("is_del", 0); + wrapper.select("id");//我们只想查询id 所以只需要查询指定列的值 + List childIdList = baseMapper.selectList(wrapper);//当前菜单的所有子菜单 + //把childIdList里面菜单id值获取出来,封装idList里面,做递归查询 + childIdList.stream().forEach(item -> {//遍历集合得到每一个对象item + //封装idList里面 + idList.add(item.getId()); + //递归查询 + this.selectCategoryChildById(item.getId() + "", idList); + }); + } + + @Override + public R deleteSourceModelCategory(Integer categoryId) { + //1 创建list集合,用于封装所有删除菜单id值 + List idList = new ArrayList<>(); + //2 向idList集合设置删除菜单id + this.selectCategoryChildById(categoryId + "", idList);//找到当前菜单的子菜单 把结果id封装到idlist里面去 + //把当前id封装到list里面 + idList.add(categoryId);//现在把当前id封装进去 之前都是子菜单的id + + for (Integer id : idList) { + //删除当前分类以及分类下模型 + sysDemoMapper.update(new ModelSysDemo(), new UpdateWrapper() + .set("is_del", DelConstant.IS_DEL).eq("category_id", id)); + } + Integer retCode = baseMapper.deleteBatchIds(idList); + return retCode > 0 ? R.ok() : R.error(); + } + + @Override + public boolean checkRepeat(ModelSysCategory modelSysCategory, Integer type) { + //增加校验 判重 同级下不能重复 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("category_name", modelSysCategory.getCategoryName()); + queryWrapper.eq("parent_id", modelSysCategory.getParentId()); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + queryWrapper.eq("founder", modelSysCategory.getFounder()); + if (modelSysCategory.getFounder() == ModellConstant.SOURCE_INSTITUTION) { + //来源为院校时候增加学校查询条件 + queryWrapper.eq("school_id", modelSysCategory.getSchoolId()); + } + + switch (type) { + //区分编辑还是新增判重 如若为编辑判重时候除去本id + case 1: + //编辑 + queryWrapper.last(" and id != " + modelSysCategory.getId()); + } + + ModelSysCategory category = baseMapper.selectOne(queryWrapper); + return category != null; + } + + @Override + public List primaryClassification() { + return baseMapper.primaryClassification(); + } + + @Override + public List classificationByPid(Integer parentId) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("parent_id", parentId); + queryWrapper.eq("is_del", 0); + return baseMapper.selectList(queryWrapper); + } + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/ModelSysDemoServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/ModelSysDemoServiceImpl.java new file mode 100644 index 0000000..1e3514c --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/ModelSysDemoServiceImpl.java @@ -0,0 +1,90 @@ +package com.huoran.nakadai.service.impl; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.common.constant.ModellConstant; +import com.huoran.common.entity.PythonCodeResp; +import com.huoran.common.entity.RunCode; +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.DataProduct; +import com.huoran.nakadai.entity.ModelReferenceDemo; +import com.huoran.nakadai.entity.ModelSysDemo; +import com.huoran.nakadai.entity.req.CopyTheModelToTheNakadaiReq; +import com.huoran.nakadai.entity.req.PageModelReq; +import com.huoran.nakadai.mapper.ModelSysDemoMapper; +import com.huoran.nakadai.service.ModelSysDemoService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.nakadai.utils.RunCodeHelperUtil; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; + +import java.io.IOException; +import java.util.Date; + +/** + *

+ * 服务实现类 + *

+ * + * @author chen + * @since 2022-03-04 + */ +@Service +public class ModelSysDemoServiceImpl extends ServiceImpl implements ModelSysDemoService { + + @Override + public R sysModelDemoList(PageModelReq req) { + Page page = new Page(req.getPageNum(), req.getPageSize()); + IPage pageList = baseMapper.sysModelDemoList(page, req); + return R.ok().put("data", pageList); + } + + @Override + public R runCode(String code) throws IOException { + //执行运行操作 + PythonCodeResp runResult = RunCodeHelperUtil.runPython(code); + return R.ok().put("code", runResult); + } + + @Override + public R getAllModelListBySys(PageModelReq req) { + Page page = new Page(req.getPageNum(), req.getPageSize()); + IPage pageList = baseMapper.getAllModelListBySys(page, req); + return R.ok().put("data", pageList); + } + + @Override + public R InstitutionSourceModel(PageModelReq req) { + + Page page = new Page(req.getPageNum(), req.getPageSize()); + IPage pageList = baseMapper.InstitutionSourceModel(page, req); + return R.ok().put("data", pageList); + } + + @Override + public R copyTheModelToTheNakadai(CopyTheModelToTheNakadaiReq req) { + + //获取当前要复制到中台的院校的模型信息 + ModelSysDemo institutionalModelInfo = baseMapper.selectById(req.getBeCopiedModelId()); + + ModelSysDemo copyInfo = new ModelSysDemo(); +// BeanUtils.copyProperties( copyInfo,institutionalModelInfo); + copyInfo.setCategoryId(req.getCategoryId()); + copyInfo.setSchoolId(0); + copyInfo.setIsOpen(0); + copyInfo.setZtOpen(0); + copyInfo.setZtDel(0); + copyInfo.setIsDel(0); + copyInfo.setFounder(ModellConstant.SOURCE_SYSTEM); + copyInfo.setAccountId(req.getAccountId()); + copyInfo.setModifyAccountId(req.getAccountId()); + copyInfo.setCreateTime(new Date()); + copyInfo.setUpdateTime(new Date()); + copyInfo.setPostStatus(institutionalModelInfo.getPostStatus()); + copyInfo.setModelDemo(institutionalModelInfo.getModelDemo()); + copyInfo.setModelName(req.getModelName()); + + int ret = baseMapper.insert(copyInfo); + return ret > 0 ? R.ok() : R.error(); + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/NotifyServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/NotifyServiceImpl.java new file mode 100644 index 0000000..c961a25 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/NotifyServiceImpl.java @@ -0,0 +1,29 @@ +package com.huoran.nakadai.service.impl; + +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.Notify; +import com.huoran.nakadai.entity.vo.MessageNotificationVo; +import com.huoran.nakadai.mapper.NotifyMapper; +import com.huoran.nakadai.service.NotifyService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 消息通知表 服务实现类 + *

+ * + * @author chen + * @since 2023-05-29 + */ +@Service +public class NotifyServiceImpl extends ServiceImpl implements NotifyService { + + @Override + public R messageNotificationList(String accountId,Integer type) { + List messageNotificationVos = baseMapper.messageNotificationList(accountId, type); + return R.ok().put("notificationList",messageNotificationVos); + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/OSSFileServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/OSSFileServiceImpl.java new file mode 100644 index 0000000..2a4118e --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/OSSFileServiceImpl.java @@ -0,0 +1,169 @@ +package com.huoran.nakadai.service.impl; + +import com.aliyun.oss.ClientException; +import com.aliyun.vod.upload.impl.UploadVideoImpl; +import com.aliyun.vod.upload.req.UploadStreamRequest; +import com.aliyun.vod.upload.resp.UploadStreamResponse; +import com.aliyuncs.DefaultAcsClient; +import com.aliyuncs.vod.model.v20170321.DeleteVideoRequest; +import com.aliyuncs.vod.model.v20170321.DeleteVideoResponse; +import com.aliyuncs.vod.model.v20170321.GetVideoPlayAuthRequest; +import com.aliyuncs.vod.model.v20170321.GetVideoPlayAuthResponse; +import com.huoran.common.entity.FilesResult; +import com.huoran.common.exception.CustomException; +import com.huoran.common.exception.ExceptionEnum; +import com.huoran.common.utils.AliyunOssUtil; +import com.huoran.common.utils.AliyunVodSDKUtil; +import com.huoran.common.utils.ConstantPropertiesUtil; +import com.huoran.nakadai.service.OSSFileService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; + +import java.io.IOException; +import java.io.InputStream; +import java.util.List; + +/** + * @Author chen + * @DATE 2020/10/1 22:01 + * @Version 1.0 + */ +@Slf4j +@Service +public class OSSFileServiceImpl implements OSSFileService { + + @Override + public FilesResult upload(MultipartFile file) throws IOException { + //判断文件是否为视频 +/* String fileName = file.getOriginalFilename(); + assert fileName != null; + String suffix = fileName.substring(fileName.lastIndexOf(".") + 1); + boolean isVideo = VideoUtil.isVideo(suffix); + if (isVideo) { + return vodUpload(file); + }*/ + return fileUpload(file); + } + + /** + * 视频上传 + * + * @param file 视频文件 + * @return 返回文件信息 + * @throws IOException IO异常 + */ + public FilesResult vodUpload(MultipartFile file) throws IOException { + FilesResult filesResult = new FilesResult(); + //获取文件流 + InputStream inputStream = file.getInputStream(); + String originalFilename = file.getOriginalFilename(); + String fileSize = String.valueOf(file.getSize()); + assert originalFilename != null; + String title = originalFilename.substring(0, originalFilename.lastIndexOf(".")); + // 获取文件尾缀 + String fileType = originalFilename.substring(originalFilename.lastIndexOf(".") + 1); + // 文件类型 + filesResult.setFileType(fileType); + //文件大小 + filesResult.setFileSize(fileSize); + + //上传流请求 + UploadStreamRequest request = new UploadStreamRequest(ConstantPropertiesUtil.ACCESS_KEY_ID, + ConstantPropertiesUtil.ACCESS_KEY_SECRET, title, originalFilename, inputStream); + + /* 是否使用默认水印(可选),指定模板组ID时,根据模板组配置确定是否使用默认水印*/ + //request.setShowWaterMark(true); + /* 设置上传完成后的回调URL(可选),建议通过点播控制台配置消息监听事件,参见文档 https://help.aliyun.com/document_detail/57029.html */ + //request.setCallback("http://callback.sample.com"); + /* 自定义消息回调设置,参数说明参考文档 https://help.aliyun.com/document_detail/86952.html#UserData */ + //request.setUserData(""{\"Extend\":{\"test\":\"www\",\"localId\":\"xxxx\"},\"MessageCallback\":{\"CallbackURL\":\"http://test.test.com\"}}""); + /* 视频分类ID(可选) */ + //request.setCateId(0); + /* 视频标签,多个用逗号分隔(可选) */ + //request.setTags("标签1,标签2"); + /* 视频描述(可选) */ + //request.setDescription("视频描述"); + /* 封面图片(可选) */ + //request.setCoverURL("http://cover.sample.com/sample.jpg"); + /* 模板组ID(可选) */ + //request.setTemplateGroupId("8c4792cbc8694e7084fd5330e56a33d"); + /* 工作流ID(可选) */ + //request.setWorkflowId("d4430d07361f0*be1339577859b0177b"); + /* 存储区域(可选) */ + //request.setStorageLocation("in-201703232118266-5sejdln9o.oss-cn-shanghai.aliyuncs.com"); + /* 开启默认上传进度回调 */ + // request.setPrintProgress(true); + /* 设置自定义上传进度回调 (必须继承 VoDProgressListener) */ + // request.setProgressListener(new PutObjectProgressListener()); + /* 设置应用ID*/ + //request.setAppId("app-1000000"); + /* 点播服务接入点 */ + //request.setApiRegionId("cn-shanghai"); + /* ECS部署区域*/ + // request.setEcsRegionId("cn-shanghai"); + + UploadVideoImpl uploader = new UploadVideoImpl(); + UploadStreamResponse response = uploader.uploadStream(request); + + //如果设置回调URL无效,不影响视频上传,可以返回VideoId同时会返回错误码。 + // 其他情况上传失败时,VideoId为空,此时需要根据返回错误码分析具体错误原因 + String videoId = response.getVideoId(); + if (!response.isSuccess()) { + String errorMessage = "阿里云视频上传错误:" + "code:" + response.getCode() + ", message:" + response.getMessage(); + log.error(errorMessage); + if (StringUtils.isEmpty(videoId)) { + throw new CustomException(ExceptionEnum.UNKNOWN_EXCEPTION); + } + } + filesResult.setFileId(videoId); + return filesResult; + } + + /** + * 文件删除 + * + * @param keys 完整文件名 + * @return 返回成功删除文件名 + */ + @Override + public List fileDeletion(List keys) { + return AliyunOssUtil.deleteFiles(keys); + } + + @Override + public String getPlayAuth(String videoId) throws ClientException, com.aliyuncs.exceptions.ClientException { + DefaultAcsClient client = AliyunVodSDKUtil.initVodClient(ConstantPropertiesUtil.ACCESS_KEY_ID, ConstantPropertiesUtil.ACCESS_KEY_SECRET); + GetVideoPlayAuthRequest request = new GetVideoPlayAuthRequest(); + request.setVideoId(videoId); + GetVideoPlayAuthResponse response = client.getAcsResponse(request); + //得到播放凭证并返回 + return response.getPlayAuth(); + } + + @Override + public void removeVideo(String videoId) throws ClientException, com.aliyuncs.exceptions.ClientException { + DefaultAcsClient client = AliyunVodSDKUtil.initVodClient( + ConstantPropertiesUtil.ACCESS_KEY_ID, + ConstantPropertiesUtil.ACCESS_KEY_SECRET); + + DeleteVideoRequest request = new DeleteVideoRequest(); + request.setVideoIds(videoId); + DeleteVideoResponse response = client.getAcsResponse(request); + System.out.print("RequestId = " + response.getRequestId() + "\n"); + } + + /** + * 文件上传 + * + * @param file 上传文件 + * @return 返回文件信息 + * @throws IOException IO异常 + */ + @Override + public FilesResult fileUpload(MultipartFile file) throws IOException { + return AliyunOssUtil.uploadFile(file); + } + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/OrderOtherServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/OrderOtherServiceImpl.java new file mode 100644 index 0000000..d824d8c --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/OrderOtherServiceImpl.java @@ -0,0 +1,348 @@ +package com.huoran.nakadai.service.impl; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.huoran.api.OccupationlabClient; +import com.huoran.common.constant.OrderConstant; +import com.huoran.common.entity.to.JudgmentPointDataTo; +import com.huoran.common.entity.to.ProjectDataTo; +import com.huoran.common.exception.CustomException; +import com.huoran.common.exception.ExceptionEnum; +import com.huoran.nakadai.entity.CurriculumConfigure; +import com.huoran.nakadai.entity.Customer; +import com.huoran.nakadai.entity.Order; +import com.huoran.nakadai.entity.OrderOther; +import com.huoran.nakadai.entity.req.BulkShipOrdersReq; +import com.huoran.nakadai.entity.req.QueryTimeReq; +import com.huoran.nakadai.entity.vo.OrderRenewVo; +import com.huoran.nakadai.mapper.*; +import com.huoran.nakadai.service.OrderOtherService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.*; + +/** + *

+ * 订单其他信息(包含课程权限、数据平台权限、合同信息等) 服务实现类 + *

+ * + * @author cheney + * @since 2021-07-01 + */ +@Service +public class OrderOtherServiceImpl extends ServiceImpl implements OrderOtherService { + + @Autowired + private OrderMapper orderMapper; + + @Autowired + private CustomerMapper customerMapper; + + @Autowired + private OccupationlabClient occupationlabClient; + + @Autowired + private CurriculumConfigureMapper configureMapper; + + @Autowired + private DataProductMapper dataProductMapper; + + @Autowired + private CurriculumMapper curriculumMapper; + + /** + * 根据订单内容id修改货物发货状态及订单状态,同步修改起始时间 + * @return boolean + */ + @Override + public boolean ship(OrderOther orderOther) { + int update = baseMapper.updateById(orderOther); + //查询订单其他产品状态,都为发货则订单已完成 + QueryWrapper otherQueryWrapper = new QueryWrapper<>(); + otherQueryWrapper.eq("order_id", orderOther.getOrderId()); + List orderOtherList = baseMapper.selectList(otherQueryWrapper); + List ship = new ArrayList<>(); + orderOtherList.forEach(other -> { + ship.add(other.getShip()); + }); + boolean contains = ship.contains(0); + if (!contains) { + Order order = new Order(); + order.setOrderId(orderOther.getOrderId()); + order.setOrderStatus(OrderConstant.SHIPPED); + orderMapper.updateById(order); + } + return update > 0; + } + + @Override + public boolean bulkShipping(BulkShipOrdersReq bulkShipOrdersReq) { + List orderOthers = bulkShipOrdersReq.getOrderOthers(); + for (OrderOther orderOther : orderOthers) { + baseMapper.updateById(orderOther); + //查询订单其他产品状态,都为发货则订单已完成 + QueryWrapper otherQueryWrapper = new QueryWrapper<>(); + otherQueryWrapper.eq("order_id", orderOther.getOrderId()); + List orderOtherList = baseMapper.selectList(otherQueryWrapper); + List ship = new ArrayList<>(); + orderOtherList.forEach(other -> { + ship.add(other.getShip()); + }); + boolean contains = ship.contains(0); + if (!contains) { + Order order = new Order(); + order.setOrderId(orderOther.getOrderId()); + order.setOrderStatus(OrderConstant.SHIPPED); + orderMapper.updateById(order); + } + } + return true; + } + + /** + * 根据订单内容id修改货物启用状态 + * + * @param id 内容id + * @param flag 标识 + * @return boolean + */ + @Override + public boolean enable(Integer id, Integer flag) { + OrderOther orderOther = new OrderOther(); + orderOther.setId(id); + orderOther.setIsEnable(flag); + int update = baseMapper.updateById(orderOther); + return update > 0; + } + + /** + * 根据起止日期以及当前日期设置剩余期限 + */ + @Override + public void remainingPeriod() { + // List orderOtherList = baseMapper.remainingDay(); + //查询所有订单产品 + List orderOtherList = baseMapper.selectList(null); + orderOtherList.forEach(orderOther -> { + if (orderOther.getShip().equals(OrderConstant.SHIPPED)) { + if (orderOther.getRemainingPeriod() > 0) { + //用于将负数全部修正,判断隔天可以删除 + if (orderOther.getRemainingPeriod() < 0) { + orderOther.setRemainingPeriod(0); + } + //修改订单剩余期限,当前时间在产品时间内进行扣除 + long start = orderOther.getStartTime().getTime(); + long now = DateUtil.date().getTime(); + long end = orderOther.getEndTime().getTime(); + if (now >= start && now <= end){ + orderOther.setRemainingPeriod(orderOther.getRemainingPeriod()-1); + baseMapper.updateById(orderOther); + } + }else { + //关闭产品 + orderOther.setIsEnable(0); + baseMapper.updateById(orderOther); + } + } + }); + } + + @Override + public void customerExpiration() { + //查询到期订单 + List orderOtherList = baseMapper.selectList(new QueryWrapper() + .eq("remaining_period", 0)); + if (ObjectUtil.isNotNull(orderOtherList) && orderOtherList.size()>0){ + orderOtherList.forEach(orderOther -> { + //产品到期、查询客户所有订单产品是否都到期 + if (orderOther.getRemainingPeriod()==0){ + Integer orderId = orderOther.getOrderId(); + Order order = orderMapper.selectById(orderId); + List customerList = orderMapper.selectList(new QueryWrapper(). + eq("customer_id", order.getCustomerId())); + List type = new ArrayList<>(); + // 订单类型(1、正式 2、试用) + for (Order orderInfo : customerList){ + type.add(orderInfo.getOrderType()); + } + List allOrderOther = new ArrayList<>(); + customerList.forEach(customerOrder -> { + List other = baseMapper.selectList(new QueryWrapper() + .eq("order_id", customerOrder.getOrderId())); + if (ObjectUtil.isNotNull(other) && other.size()>0){ + allOrderOther.addAll(other); + } + }); + List remainingPeriod = new ArrayList<>(); + allOrderOther.forEach(customerOrderOther -> { + remainingPeriod.add(customerOrderOther.getRemainingPeriod()); + }); + Customer customer = customerMapper.selectById(order.getCustomerId()); + HashSet set = new HashSet<>(remainingPeriod); + //订单产品都过期,更新客户类型为到期 + if (set.size()==1&&set.contains(0)){ + customer.setCustomerType(3); + }else { + //有正式订单 + boolean contains = type.contains(1); + if (contains) { + customer.setCustomerType(1); + }else { + customer.setCustomerType(2); + } + } + //更新客户类型 + customerMapper.updateById(customer); + } + }); + } + } + + @Override + public ArrayList renew(OrderRenewVo orderRenewVo) { + + Integer customerId = orderRenewVo.getCustomerId(); + Integer authority = orderRenewVo.getAuthority(); + List productList = orderRenewVo.getProductId(); + HashMap map = Maps.newHashMap(); + ArrayList orderOthers = Lists.newArrayList(); + productList.forEach(id -> { + //查询还未过期有此产品的订单 + QueryWrapper otherQueryWrapper = new QueryWrapper<>(); + otherQueryWrapper.eq("mall_id", id). + eq("authority",authority). + ge("end_time", new Date()); + List orderOtherList = baseMapper.selectList(otherQueryWrapper); + if (!orderOtherList.isEmpty()) { + orderOtherList.forEach(orderOther -> { + //查询客户产品的最新订单 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("customer_id", customerId). + eq("order_id", orderOther.getOrderId()). + orderByDesc("create_time").last("limit 1"); + Order order = orderMapper.selectOne(wrapper); + if (ObjectUtil.isNotNull(order)) { + /*//课程产品 + if (orderOther.getAuthority() == 1) { + Curriculum curriculum = curriculumMapper.courseListDeletedNotDeleted(orderOther.getDataOrCourseId()); + orderOther.setProductType(curriculum.getCurriculumType()); + orderOther.setMiniProgramPictureAddress(curriculum.getMiniProgramPictureAddress()); + orderOther.setOriginalSettlementPrice(curriculum.getSettlementPrice()); + orderOther.setSettlementMethod(curriculum.getSettlementMethod()); + orderOther.setSupplier(curriculum.getSupplier()); + orderOther.setBusinessProportion(curriculum.getBusinessProportion()); + orderOther.setManufacturerProportion(curriculum.getManufacturerProportion()); + orderOther.setMarketPrice(curriculum.getMarketPrice()); + orderOther.setMarketValue(curriculum.getMarketPrice()); + }else if (orderOther.getAuthority() == 0){ + //数据产品 + DataProduct dataProduct = dataProductMapper.selectById(orderOther.getDataOrCourseId()); + orderOther.setOriginalSettlementPrice(dataProduct.getSettlementPrice()); + orderOther.setProductType(3); + orderOther.setSettlementMethod(dataProduct.getSettlementMethod()); + orderOther.setSupplier(dataProduct.getSupplier()); + orderOther.setBusinessProportion(dataProduct.getBusinessProportion()); + orderOther.setManufacturerProportion(dataProduct.getManufacturerProportion()); + orderOther.setMarketPrice(new BigDecimal(dataProduct.getMarket())); + orderOther.setMarketValue(new BigDecimal(dataProduct.getMarket())); + }else if (orderOther.getAuthority() == 2){ + + }*/ + map.put("" + id + "", orderOther); + } + }); + } + }); + orderOthers.addAll(map.values()); + return orderOthers; + } + + @Override + public JudgmentPointDataTo getCustomerOrderOther(Integer schoolId,Integer systemId,String name) { + //查询客户id + Customer customer = customerMapper.selectOne(new QueryWrapper().eq("school_id", schoolId)); + //查询客户订单 + List orderList = orderMapper.selectList(new QueryWrapper().eq("customer_id", customer.getCustomerId())); + //查询所有订单内容 + ArrayList orderOthers = Lists.newArrayList(); + orderList.forEach(order -> { + //已发货、课程权限、启用、未过期 + List orderOtherList = baseMapper.selectList(new QueryWrapper() + .eq("order_id", order.getOrderId()) + .eq("ship",1) + .eq("authority",1) + .eq("is_enable",1) + .ge("remaining_period",0)); + orderOthers.addAll(orderOtherList); + }); + + + ArrayList curriculumConfigures = Lists.newArrayList(); + //查询购买的所有课程中系统的项目 + orderOthers.forEach(orderOther -> { + //展示、未删除、系统查询 + List curriculumConfigureList = configureMapper.selectList(new QueryWrapper() + .eq("cid", orderOther.getDataOrCourseId()) + .eq("is_show", 0) + .eq("is_del", 0) + .eq("system_id", systemId)); + curriculumConfigures.addAll(curriculumConfigureList); + }); + + //获取项目集合 + HashSet set = new HashSet<>(); + if (curriculumConfigures.size()>0){ + for (CurriculumConfigure curriculumConfigure : curriculumConfigures){ + set.add(curriculumConfigure.getProjectId()); + } + }else { + return null; + } + + ProjectDataTo projectDataTo = new ProjectDataTo(); + projectDataTo.setSet(set); + projectDataTo.setName(name); + projectDataTo.setSystemId(systemId); + JudgmentPointDataTo projectPoints = occupationlabClient.getProjectPoints(projectDataTo); + if (projectPoints==null){ + throw new CustomException(ExceptionEnum.SERVICE_FAIL); + } + return projectPoints; + } + + @Override + public String getOrderOtherTime(QueryTimeReq queryTimeReq) { + if (queryTimeReq.getStartTime()!=null){ + //查询客户下有此产品的所有订单产品是否存在时间期内 + Integer count = baseMapper.isTimePeriod(queryTimeReq); + if (count>0){ + throw new CustomException(ExceptionEnum.REPEAT_ORDERS); + } + // 返回上一个订单产品的到期时间 + // return baseMapper.OrderOtherEndTime(queryTimeReq); + } + + if (StringUtils.isNotBlank(queryTimeReq.getEndTime()) && StringUtils.isNotBlank(queryTimeReq.getStartTime())){ + //查询客户下有此产品的所有订单产品时间是否重叠 + List orderOtherList = baseMapper.selectOtherList(queryTimeReq); + orderOtherList.forEach(orderOther -> { + long startTime1 = DateUtil.parseDate(queryTimeReq.getStartTime()).getTime(); + long endTime1 = DateUtil.parseDate(queryTimeReq.getEndTime()).getTime(); + long startTime2 = orderOther.getStartTime().getTime(); + long endTime2 = orderOther.getEndTime().getTime(); + //允许时间重叠,续费时订单时间无缝衔接 + if (startTime1 < endTime2 && endTime1 > startTime2){ + throw new CustomException(ExceptionEnum.REPEAT_ORDERS); + } + }); + } + + return null; + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/OrderServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/OrderServiceImpl.java new file mode 100644 index 0000000..efb4333 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/OrderServiceImpl.java @@ -0,0 +1,760 @@ +package com.huoran.nakadai.service.impl; + +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.entity.ExportParams; +import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONObject; +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.huoran.common.constant.OrderConstant; +import com.huoran.common.response.R; +import com.huoran.common.utils.DateUtils; +import com.huoran.nakadai.entity.*; +import com.huoran.nakadai.entity.req.GetTheSystemUnderTheProductReq; +import com.huoran.nakadai.entity.req.ListOfClientCommercialManagersReq; +import com.huoran.nakadai.entity.req.OrderListReq; +import com.huoran.nakadai.entity.req.OrderRecordParametersReq; +import com.huoran.nakadai.entity.res.*; +import com.huoran.nakadai.entity.vo.OrderVo; +import com.huoran.nakadai.entity.vo.WxMssVo; +import com.huoran.nakadai.mapper.*; +import com.huoran.nakadai.service.IOrderService; +import com.huoran.nakadai.service.MallClassificationService; +import com.huoran.nakadai.service.MallTypeService; +import com.huoran.nakadai.service.ProductTypeService; +import com.huoran.nakadai.utils.ExcelStyleUtil; +import com.huoran.nakadai.utils.WeChatUtil; +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.net.URLEncoder; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.stream.Collectors; + +/** + *

+ * 订单表 服务实现类 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@Service +public class OrderServiceImpl extends ServiceImpl implements IOrderService { + + @Autowired + private OrderOtherMapper orderOtherMapper; + + @Autowired + private DataProductMapper dataProductMapper; + + @Autowired + private CurriculumMapper curriculumMapper; + + @Autowired + private HrContractInformationMapper contractInformationMapper; + + @Autowired + private CustomerMapper customerMapper; + + @Autowired + private HrStaffMapper staffMapper; + + @Autowired + private PartnerAccountMapper partnerAccountMapper; + + @Autowired + private PartnerClassificationMapper classificationMapper; + + @Autowired + ThreadPoolExecutor executor; + @Autowired + private PartnerTeamMapper teamMapper; + + @Autowired + private MallClassificationService mallClassificationService; + + @Autowired + private MallTypeService mallTypeService; + + @Autowired + private ProductTypeService productTypeService; + + @Autowired + private MallNonAssociatedLinksMapper mallNonAssociatedLinksMapper; + + /** + * 为客户添加订单,保存订单客户信息、订单内容、合同信息 + * 订单生成后根据订单内容相关数据权限将该客户添加所属平台 + * 新客户并成为该平台下的超级管理员,拥有该平台的所有权限 + * + * @param orderVo 订单信息 + * @return true/false + */ + @Override + @Transactional + public R addOrder(OrderVo orderVo) throws ExecutionException, InterruptedException { + Order order = orderVo.getOrder(); + List orderOtherList = orderVo.getOrderOther(); + HrContractInformation contractInformation = orderVo.getContractInformation(); + + CompletableFuture orderFuture = CompletableFuture.supplyAsync(() -> { + //根据时间戳生成订单号 + String orderNumber = String.valueOf(new Date().getTime()); + order.setOrderNumber(orderNumber); + //添加订单基本信息 + baseMapper.insert(order); + return order.getOrderId(); + }, executor); + + CompletableFuture contractInformationFuture = orderFuture.thenAcceptAsync(orderId -> { + //如果合同存在,则保存合同信息 + if (ObjectUtil.isNotNull(contractInformation)) { + contractInformation.setOrderId(orderId); + contractInformationMapper.insert(contractInformation); + } + }, executor); + + //根据订单类型修改客户类型 + CompletableFuture customerFuture = orderFuture.thenAcceptAsync(orderId -> { + List type = new ArrayList<>(); + Customer customer = customerMapper.selectById(order.getCustomerId()); + //查询客户所有订单 + List customerOrderList = baseMapper.selectList(new QueryWrapper().eq("customer_id", order.getCustomerId())); + // 订单类型(1、正式 2、试用) + for (Order orderInfo : customerOrderList) { + type.add(orderInfo.getOrderType()); + } + //有正式订单 + boolean contains = type.contains(1); + if (contains) { + customer.setCustomerType(1); + } else { + customer.setCustomerType(2); + } + //更新客户类型 + customerMapper.updateById(customer); + }, executor); + + List ship = new ArrayList<>(); + + CompletableFuture orderOtherFuture = orderFuture.thenAcceptAsync(orderId -> { + //添加订单其他信息 + for (OrderOther orderOther : orderOtherList) { + //开始时间取前一天的后一分钟,达成续费无缝连接 + orderOther.setStartTime(getDateAfterTime(orderOther.getStartTime())); + Integer dataId = orderOther.getDataOrCourseId(); + //添加数据平台信息,对应订单数量增加 + if (OrderConstant.DATA_AUTHORITY.equals(orderOther.getAuthority())) { + DataProduct dataProduct = dataProductMapper.selectById(dataId); + dataProduct.setOrderNum(dataProduct.getOrderNum() + 1); + dataProductMapper.updateById(dataProduct); + } + + orderOther.setOrderId(orderId); + //是否发货(0未发货,1已发货,默认不发货) + if (orderOther.getShip().equals(OrderConstant.SHIPPED)) { + //添加发货时间 + orderOther.setShipTime(new Date()); + } + + orderOtherMapper.insert(orderOther); + ship.add(orderOther.getShip()); + } + }, executor); + + CompletableFuture updateFuture = orderOtherFuture.thenRunAsync(() -> { + //更新订单发货状态 + boolean contains = ship.contains(0); + if (!contains) { + order.setOrderStatus(OrderConstant.SHIPPED); + } + baseMapper.updateById(order); + }, executor); + + CompletableFuture updateCustomerExpireDateFuture = orderOtherFuture.thenRunAsync(() -> { + //更新客户过期时间 + //查询客户产品最后的过期时间 + String ExpireDate = baseMapper.selectCustomerExpireDate(order.getCustomerId()); + Customer customer = new Customer(); + customer.setCustomerId(order.getCustomerId()); + customer.setExpireDate(DateUtil.parseDate(ExpireDate)); + //更新时间 + customerMapper.updateById(customer); + }, executor); + + //等待所有任务都完成 + CompletableFuture.allOf(contractInformationFuture, orderOtherFuture, updateFuture, customerFuture, updateCustomerExpireDateFuture).get(); + + if (orderFuture.get() > 0) { + return R.ok().put("orderId", order.getOrderId()); + } + return R.error(); + } + + /** + * 获取某个时间,前一天的后一分钟 + * @param startTime s + */ + public static Date getDateAfterTime(Date startTime) { + try { +// SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Calendar cal = Calendar.getInstance(); + cal.setTime(startTime); + cal.add(Calendar.DATE, -1); + cal.add(Calendar.MINUTE, 1); +// System.out.println(df.format(cal.getTime())); + return cal.getTime(); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + @Override + public HashMap orderList(OrderListReq orderListReq) { + if (orderListReq.getSort() == null) { + orderListReq.setSort(0); + } + //查询包含供应商配置的课程 + List cIds = curriculumMapper.selectCurriculumBySupplier(orderListReq.getSupplierId()); + //查询课程的数据权限订单id + HashSet orderIds = new HashSet<>(); + if (!cIds.isEmpty()) { + orderIds = baseMapper.dataPermissionOrderId(cIds); + } + //查询数据产品的数据权限订单id + HashSet dataProductOrderIds = baseMapper.dataPermissionOrderIdByDataProduct(orderListReq.getSupplierId()); + orderIds.addAll(dataProductOrderIds); + //查询增值权限订单id + HashSet valueOrderIds = baseMapper.valuePermissionOrderIds(); + orderIds.addAll(valueOrderIds); + //查询商品管理的相关数据订单id + HashSet goodsOrderIds = baseMapper.selectGoodsOrderId(orderListReq.getSupplierId()); + orderIds.addAll(goodsOrderIds); + + orderListReq.setOrderIds(orderIds); + orderListReq.setPageNo((orderListReq.getPageNo() - 1) * orderListReq.getPageSize()); + List orders = baseMapper.selectOrderPage(orderListReq); + orders.forEach(order -> { + Integer orderId = order.getOrderId(); + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("order_id", orderId); + List orderOtherList = orderOtherMapper.selectList(wrapper); + String orderContent = ""; + if (orderOtherList != null && orderOtherList.size() != 0) { + for (OrderOther orderOther : orderOtherList) { + orderContent += orderOther.getProductName() + ","; + } + order.setOrderContent(orderContent.substring(0, orderContent.length() - 1)); + } + }); + int total = baseMapper.selectTotalNum(orderListReq); + HashMap hashMap = new HashMap<>(); + hashMap.put("orders", orders); + hashMap.put("total", total); + return hashMap; + } + + @Override + public OrderVo queryOrderDetails(Integer orderId) { + OrderVo orderVo = new OrderVo(); + Order order = baseMapper.selectById(orderId); + String city = baseMapper.selectCity(order.getCityId(), order.getProvinceId()); + String province = baseMapper.selectProvince(order.getProvinceId()); + order.setCityName(city); + order.setProvinceName(province); + + //查询商务经理信息,删除数据也查询 + if (order.getTeamId() != null) { + PartnerClassification partnerClassification = classificationMapper.selectTeamNameById(order.getTeamId()); + order.setTeamName(partnerClassification.getPartnerClassificationName()); + String businessManagerId = order.getBusinessManagerId(); + if (StrUtil.isNotEmpty(businessManagerId)) { + PartnerAccount partnerAccount = partnerAccountMapper.selectAccountByPartnerId(businessManagerId); + Integer accountId = partnerAccount.getAccountId(); + Integer userId = staffMapper.getUserId(accountId); + String userNameById = staffMapper.selectUserNameById(userId); + order.setBusinessManagerName(userNameById); + String openid = baseMapper.selectOpenid(accountId); + //查询用户openid + order.setOpenid(openid); + } + } + + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("order_id", orderId); + List orderOtherList = orderOtherMapper.selectList(wrapper); + + orderOtherList.forEach(orderOther -> { + //课程产品 区分权限(0为数据平台权限,1为课程权限,2为职站增值模块,3为实训课程(非集成),4为实验工具,对应id为商城管理中的产品) + if (orderOther.getAuthority() == 1) { + /*QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.or().eq( "is_del", DelConstant.IS_DEL); + queryWrapper.eq("cid",orderOther.getDataOrCourseId());*/ + Curriculum curriculum = curriculumMapper.courseListDeletedNotDeleted(orderOther.getDataOrCourseId()); + if (curriculum!=null){ + orderOther.setProductType(curriculum.getCurriculumType()); + orderOther.setMiniProgramPictureAddress(curriculum.getMiniProgramPictureAddress()); + orderOther.setOriginalSettlementPrice(curriculum.getSettlementPrice()); + orderOther.setSettlementMethod(curriculum.getSettlementMethod()); + orderOther.setSupplier(curriculum.getSupplier()); + orderOther.setBusinessProportion(curriculum.getBusinessProportion()); + orderOther.setManufacturerProportion(curriculum.getManufacturerProportion()); + orderOther.setMarketPrice(curriculum.getMarketPrice()); + orderOther.setIsShelves(curriculum.getIsShelves()); + } + } else if (orderOther.getAuthority() == 0) { + //数据产品 + DataProduct dataProduct = dataProductMapper.selectById(orderOther.getDataOrCourseId()); + if (dataProduct!=null){ + orderOther.setOriginalSettlementPrice(dataProduct.getSettlementPrice()); + orderOther.setProductType(3); + orderOther.setSettlementMethod(dataProduct.getSettlementMethod()); + orderOther.setSupplier(dataProduct.getSupplier()); + orderOther.setBusinessProportion(dataProduct.getBusinessProportion()); + orderOther.setManufacturerProportion(dataProduct.getManufacturerProportion()); +// orderOther.setMarketPrice(new BigDecimal(dataProduct.getMarket())); + } + }else { + //查询产品链接 + if (orderOther.getMallId()!=null){ + List mallNonAssociatedLinks = mallNonAssociatedLinksMapper.selectList(new QueryWrapper().eq("mall_id", orderOther.getMallId())); + orderOther.setMallNonAssociatedLinks(mallNonAssociatedLinks); + } + } + + if (orderOther.getMallId()!=null){ + //查询分类 + List classifications = mallClassificationService.list(new QueryWrapper().eq("mall_id", orderOther.getMallId())); + List classificationIds = classifications.stream().map(MallClassification::getClassificationId).collect(Collectors.toList()); + for (Integer classificationId : classificationIds) { + orderOther.setMallClassificationId(classificationId); + } + //查询类型 + List mallTypes = mallTypeService.list(new QueryWrapper().eq("mall_id", orderOther.getMallId())); + List mallTypeIds = mallTypes.stream().map(MallType::getTypeId).collect(Collectors.toList()); + for (Integer typeId : mallTypeIds) { + orderOther.setTypeId(typeId); + ProductType productType = productTypeService.getById(typeId); + orderOther.setTypeName(productType.getTypeName()); + } + } + }); + orderVo.setOrder(order); + orderVo.setOrderOther(orderOtherList); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("order_id", orderId); + HrContractInformation hrContractInformation = contractInformationMapper.selectOne(queryWrapper); + orderVo.setContractInformation(hrContractInformation); + return orderVo; + } + + @Override + public boolean deleteOrders(List orderIds) { + //先删除订单其他信息,再删除基本信息 + if (orderIds.size() > 1) { + orderIds.forEach(orderId -> { + orderOtherMapper.delete(new QueryWrapper().eq("order_id", orderId)); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("order_id", orderId); + contractInformationMapper.delete(queryWrapper); + }); + } else { + orderOtherMapper.delete(new QueryWrapper().eq("order_id", orderIds.get(0))); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("order_id", orderIds.get(0)); + contractInformationMapper.delete(queryWrapper); + } + + int deleteBatchIds = baseMapper.deleteBatchIds(orderIds); + + return deleteBatchIds > 0; + } + + /** + * 更新订单信息,订单其他信息中的状态都为已发货,修改该订单状态为已完成 + * + * @param orderVo 订单信息 + * @return boolean + */ + @Override + public boolean updateOrder(OrderVo orderVo) { + Order order = orderVo.getOrder(); + List ship = new ArrayList<>(); + orderOtherMapper.delete(new QueryWrapper().eq("order_id",order.getOrderId())); + + List orderOtherList = orderVo.getOrderOther(); + StringBuilder productName = new StringBuilder(); + orderOtherList.forEach(orderOther -> { + orderOther.setOrderId(order.getOrderId()); + orderOtherMapper.insert(orderOther); + ship.add(orderOther.getShip()); + productName.append(orderOther.getProductName() + ","); + }); + String productNames; + if (productName.length() >= 20) { + productNames = "包含" + orderOtherList.size() + "个产品,点击查看详情!"; + } else { + productNames = productName.substring(0, productName.toString().length() - 1); + } + boolean contains = ship.contains(0); + if (!contains) { + order.setOrderStatus(OrderConstant.SHIPPED); + orderOtherList.forEach(orderOther -> { + + if (orderOther.getShipTime() == null) { + //添加发货时间 + orderOther.setShipTime(new Date()); + } + orderOtherMapper.updateById(orderOther); + + }); + //通知一次之后修改订单不在通知 + if (order.getNotification()==0 && StringUtils.isNotEmpty(order.getBusinessManagerId())) { + order.setNotification(1); + //发货成功后小程序服务通知商务经理 + PartnerAccount partnerAccount = partnerAccountMapper.selectAccountByPartnerId(order.getBusinessManagerId()); + Integer accountId = partnerAccount.getAccountId(); + String openid = baseMapper.selectOpenid(accountId); + WxMssVo wxMssVo = new WxMssVo(); + //设置模板id + wxMssVo.setTemplate_id("8pDVfWYqh9c-nn3CeA1NXJtBxdd1FYiCtrl5BeLvbgU"); + //跳转小程序类型:developer为开发版;trial为体验版;formal为正式版;默认为正式版 + wxMssVo.setMiniprogram_state("trial"); + wxMssVo.setLang("zh_CN"); + String accessToken = null; + try { + //设置openId + wxMssVo.setTouser(openid); + //设置accessToken + accessToken = WeChatUtil.getAccessToken(); + } catch (IOException e) { + e.printStackTrace(); + } + //设置小程序 跳转页面 + wxMssVo.setPage("/order/orderDetail/orderDetail?orderId=" + order.getOrderId() + "&show=1"); + + wxMssVo.setRequest_url("https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=" + accessToken); + //将模板中的值一一赋值 发送到小程序的数据要转化为json格式 可以使用下面的方法直接拼接成JSONObject + JSONObject jsonObject = new JSONObject(); + JSONObject dataInfo = new JSONObject(); + dataInfo.putOpt("value", new Date()); + jsonObject.putOpt("time5", dataInfo); + + //使用map结合模板 后续再加遍历拼接成JSONObject + HashMap map = new HashMap<>(3); + //根据模板写值 + //订阅消息参数值内容限制说明 + //---摘自微信小程序官方:https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/subscribe-message/subscribeMessage.send.html + //参数类别 参数说明 参数值限制 说明 + //thing.DATA 事物 20个以内字符 可汉字、数字、字母或符号组合 + //number.DATA 数字 32位以内数字 只能数字,可带小数 + //letter.DATA 字母 32位以内字母 只能字母 + //symbol.DATA 符号 5位以内符号 只能符号 + //character_string.DATA 字符串 32位以内数字、字母或符号 可数字、字母或符号组合 + //time.DATA 时间 24小时制时间格式(支持+年月日) 例如:15:01,或:2019年10月1日 15:01 + //date.DATA 日期 年月日格式(支持+24小时制时间) 例如:2019年10月1日,或:2019年10月1日 15:01 + //amount.DATA 金额 1个币种符号+10位以内纯数字,可带小数,结尾可带“元” 可带小数 + //phone_number.DATA 电话 17位以内,数字、符号 电话号码,例:+86-0766-66888866 + //car_number.DATA 车牌 8位以内,第一位与最后一位可为汉字,其余为字母或数字 车牌号码:粤A8Z888挂 + //name.DATA 姓名 10个以内纯汉字或20个以内纯字母或符号 中文名10个汉字内;纯英文名20个字母内;中文和字母混合按中文名算,10个字内 + //phrase.DATA 汉字 5个以内汉字 5个以内纯汉字,例如:配送中 + map.put("thing12", order.getCustomerName());//客户名称 + map.put("thing8", productNames);//订单内容 + map.put("amount13", order.getOrderAmount()+"元");//订单金额 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + String format = sdf.format(order.getCreateTime()); +// System.out.println(format); + map.put("time14", format);//下单日期 + map.put("phrase15", "已完成");//订单状态 + wxMssVo.setMap(map); + WeChatUtil.sendTemplateMessage(wxMssVo); + } + + } + HrContractInformation contractInformation = orderVo.getContractInformation(); + //更新合同信息 + if (contractInformation.getContractId() != null) { + contractInformationMapper.updateById(contractInformation); + } + int update = baseMapper.updateById(order); + + //根据订单类型修改客户类型 + List type = new ArrayList<>(); + Customer customer = customerMapper.selectById(order.getCustomerId()); + //查询客户所有订单 + List customerOrderList = baseMapper.selectList(new QueryWrapper().eq("customer_id", order.getCustomerId())); + // 订单类型(1、正式 2、试用) + for (Order orderInfo : customerOrderList) { + type.add(orderInfo.getOrderType()); + } + //有正式订单 + boolean typeContains = type.contains(1); + if (typeContains) { + customer.setCustomerType(1); + } else { + customer.setCustomerType(2); + } + //更新客户类型 + customerMapper.updateById(customer); + + return update > 0; + } + + /** + * @Description : 客户当前已订阅产品 + * @Param customeId + * @Author Rong---2022/5/16 + */ + @Override + public R getProductsSubscribedByCustomers(Integer customeId) { + //获取当前客户下的订单信息 (data_or_course_id、authority) + List orderOtherList = orderOtherMapper.getProductsSubscribedByCustomers(customeId); + /** + * 1 实训课程 + * 2 理论课程 + * 3 职站增值应用 + * 4 实训课程(非集成) + * 5 数据前瞻 + * 6 实验工具 + */ + for (OrderOther orderOther : orderOtherList) { + orderOther.setProductDel(1); + //authority:区分权限(0为数据平台权限,1为课程权限,对应data_or_course_id) + switch (orderOther.getAuthority()) { + case 0: + DataProduct dataProduct = dataProductMapper.selectById(orderOther.getDataOrCourseId()); + if (dataProduct != null) { + orderOther.setProductDel(0); + orderOther.setProductName(dataProduct.getProductName()); + orderOther.setProductType(5);//产品类型(3-数据产品) + List dataStartAndEndTimeList = orderOtherMapper.permissionToGetOrders(customeId, orderOther.getAuthority(), orderOther.getMallId()); + orderOther.setStartAndEndTimeList(dataStartAndEndTimeList); + break; + } + case 1: + Curriculum curriculum = curriculumMapper.selectById(orderOther.getDataOrCourseId()); + if (curriculum != null) { + orderOther.setProductDel(0); +// orderOther.setProductName(curriculum.getCurriculumName()); + orderOther.setProductName(orderOther.getGoodsName()); + + //产品类型(0->理论 1-实训) 1更改为1为实训课程 0更改2理论课程 + if (curriculum.getCurriculumType() == 0) { + orderOther.setProductType(2); + } else if (curriculum.getCurriculumType() == 1) { + orderOther.setProductType(1); + } + + orderOther.setMiniProgramPictureAddress(curriculum.getMiniProgramPictureAddress()); + List curriculumStartAndEndTimeList = orderOtherMapper.permissionToGetOrders(customeId, orderOther.getAuthority(), orderOther.getMallId()); + orderOther.setStartAndEndTimeList(curriculumStartAndEndTimeList); + break; + } + + case 2: + orderOther.setProductDel(0); + orderOther.setProductType(3); + orderOther.setProductName("大赛系统"); + List curriculumStartAndEndTimeList = orderOtherMapper.permissionToGetOrders(customeId, orderOther.getAuthority(), orderOther.getMallId()); + orderOther.setStartAndEndTimeList(curriculumStartAndEndTimeList); + break; + + //区分权限(0为数据平台权限,1为课程权限,2为职站增值模块,3为实训课程(非集成),4为实验工具,对应id为商城管理中的产品) + case 3: + orderOther.setProductDel(0); + orderOther.setProductType(4); + orderOther.setProductName("实训课程(非集成)"); + List trainingCourses = orderOtherMapper.permissionToGetOrders(customeId, orderOther.getAuthority(), orderOther.getMallId()); + orderOther.setStartAndEndTimeList(trainingCourses); + break; + + case 4: + orderOther.setProductDel(0); + orderOther.setProductType(6); + orderOther.setProductName("实验工具)"); + List experimentalTool = orderOtherMapper.permissionToGetOrders(customeId, orderOther.getAuthority(), orderOther.getMallId()); + orderOther.setStartAndEndTimeList(experimentalTool); + break; + + + } + + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); + long currentTimestamp = System.currentTimeMillis(); // 当前时间戳 + + String inActiveStartTime = null; // 生效中的开始时间 + String inActiveEndTime = null; // 生效中的截止时间 + + String continuousStartTime = null; // 连续订单的开始时间 + String continuousEndTime = null; // 连续订单的截止时间 + + String lastDateTime = null; // 上一笔订单截止时间 + String lastStartDateTime = null; // 上一笔订单开始时间 + + List notActiveList = new ArrayList(); // 非连续订单并未失效的时间 + + if (orderOther.getStartAndEndTimeList() != null) { + for (PermissiontogetordersResp getTime : orderOther.getStartAndEndTimeList()) { + + if (orderOther.getStartAndEndTimeList().size() > 1) {//表示当前集合中大于一条数据以上 少于2条不作判断 + if (lastDateTime == null) { + lastStartDateTime = getTime.getStartTime(); + lastDateTime = getTime.getEndTime(); + continue; + } + boolean check = true; // 用于排除生效中的时间 + String startDateTime = getTime.getStartTime(); + String endDateTime = getTime.getEndTime(); + try { + //intervalDays:获取间隔天数 + Integer intervalDays = DateUtils.getTheNumberOfDaysBetweenTwoDates(startDateTime, lastDateTime); + if (intervalDays == 1) {//为1表示 刚好间隔一天,为连续订单 + if (continuousStartTime == null || continuousEndTime != null) { // continuousEndTime不等于null的话,代表有多次的连续订单 + continuousStartTime = lastStartDateTime; + continuousEndTime = null; + } + } else { + if (continuousStartTime != null) { // 赋值连续订单的结束时间 + continuousEndTime = lastDateTime; + } + + // 正在生效的时间 当前时间大于等于开始时间 并 小于等于截止时间 + long startTimestamp = df.parse(startDateTime).getTime(); + long endTimestamp = df.parse(endDateTime).getTime(); + if (currentTimestamp >= startTimestamp && currentTimestamp <= endTimestamp) { // 非连续订单 + inActiveStartTime = startDateTime; + inActiveEndTime = endDateTime; + check = false; + } else if (continuousEndTime != null) { // 连续订单 + startTimestamp = df.parse(continuousStartTime).getTime(); + endTimestamp = df.parse(continuousEndTime).getTime(); + if (currentTimestamp >= startTimestamp && currentTimestamp <= endTimestamp) { + inActiveStartTime = continuousStartTime; + inActiveEndTime = continuousEndTime; + check = false; + } + + } + } + + if (inActiveEndTime != null && check) { // 有生效中的结束时间,则都丢进未生效的订单时间集合 + notActiveList.add(getTime); + } + } catch (ParseException e) { + e.printStackTrace(); + } + lastStartDateTime = getTime.getStartTime(); + lastDateTime = getTime.getEndTime(); + } else { + try { + orderOther.setStartTime(df.parse(getTime.getStartTime())); + orderOther.setEndTime(df.parse(getTime.getEndTime())); + } catch (ParseException e) { + e.printStackTrace(); + } + } + } + + orderOther.setNotActiveList(notActiveList);//还未生效订单的订单时间 + + try { + if (inActiveStartTime != null) { // 生效中的订单 + orderOther.setStartTime(df.parse(inActiveStartTime)); + orderOther.setEndTime(df.parse(inActiveEndTime)); + } else if (inActiveStartTime == null && notActiveList.size() > 0) { // 没有生效中的订单 且 有未生效的订单 + PermissiontogetordersResp notContinuousTime = notActiveList.get(0); + notActiveList.remove(0); + orderOther.setStartTime(df.parse(notContinuousTime.getStartTime())); + orderOther.setEndTime(df.parse(notContinuousTime.getEndTime())); + } + } catch (ParseException e) { + e.printStackTrace(); + } + } + } + return R.ok().put("data", orderOtherList); + } + + @Override + public void exportSubscribedRecords(List listOfExportSub, HttpServletResponse response) throws Exception { + // 告诉浏览器用什么软件可以打开此文件 + response.setHeader("content-Type", "application/vnd.ms-excel"); + // 下载文件的默认名称 + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("产品已订阅记录", "UTF-8") + ".xls"); + //编码 + response.setCharacterEncoding("UTF-8"); + Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), ExportSubscribedRecordsResp.class, listOfExportSub); + ExportParams exportParams = new ExportParams(null, "delivery", ExcelType.XSSF); + exportParams.setStyle(ExcelStyleUtil.class); + workbook.write(response.getOutputStream()); + } + + @Override + public R getAListOfClientBusinessManagers(ListOfClientCommercialManagersReq req) { + Page page = new Page(req.getPageNum(), req.getPageSize()); + IPage pageList = orderOtherMapper.getAListOfClientBusinessManagersByCustomerId(page, req); + for (ListOfClientCommercialManagersResp resp : pageList.getRecords()) { + //查询当前商务经理所在的团队(可存在多个团队中) + //2022.07-05 所属团队展示更改需求为:只展示当前客户下单后订单里面选择的团队信息(可以是同一人不同团队下的下订单为同一个客户,此时就是多条) + List teamInformationRespList = classificationMapper.getTeamInformationByCustomerId(req.getCustomerId(), resp.getBusinessManagerId()); + String productName = orderOtherMapper.getTheProductPurchasedByTheBusinessManager(resp.getBusinessManagerId(), req.getCustomerId(), teamInformationRespList); + resp.setTeamInformationRespList(teamInformationRespList); + resp.setProductName(productName); + } + return R.ok().put("data", pageList); + } + + @Override + public R getBusinessManagerOrder(ListOfClientCommercialManagersReq req) { + Page page = new Page(req.getPageNum(), req.getPageSize()); + IPage pageList = orderOtherMapper.getBusinessManagerOrder(page, req); + return R.ok().put("data", pageList); + } + + @Override + public R getOrderBasedOnBusinessManagerId(ListOfClientCommercialManagersReq req) { + Page page = new Page(req.getPageNum(), req.getPageSize()); + IPage pageList = baseMapper.getOrderBasedOnBusinessManagerId(page, req); + //查询费率 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("classification_id", req.getTeamId()); +// queryWrapper.eq("partner_id", req.getBusinessManagerId()); + PartnerTeam rateInformation = teamMapper.selectOne(queryWrapper); + return R.ok().put("data", pageList).put("annualMarketingFee", rateInformation.getAnnualMarketingFee()); + } + + @Override + public R miniProgramOrderRecord(OrderRecordParametersReq req) { + Page page = new Page(req.getPageNum(), req.getPageSize()); + IPage pageList = baseMapper.miniProgramOrderRecord(page, req); + return R.ok().put("data", pageList); + } + + @Override + public R getSystemByCustomers(GetTheSystemUnderTheProductReq req) { + Page page = new Page(req.getPageNum(), req.getPageSize()); + IPage pageList = orderOtherMapper.getSystemByCustomers(page, req); + return R.ok().put("data", pageList); + } + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/PartnerAccountServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/PartnerAccountServiceImpl.java new file mode 100644 index 0000000..170fc46 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/PartnerAccountServiceImpl.java @@ -0,0 +1,1167 @@ +package com.huoran.nakadai.service.impl; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.RandomUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +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.huoran.api.UserClient; +import com.huoran.common.constant.DelConstant; +import com.huoran.common.constant.SMSTemplate; +import com.huoran.common.exception.CustomException; +import com.huoran.common.exception.ExceptionEnum; +import com.huoran.common.response.R; +import com.huoran.common.utils.JwtUtils; +import com.huoran.common.utils.MD5; +import com.huoran.nakadai.entity.*; +import com.huoran.nakadai.entity.req.*; +import com.huoran.nakadai.entity.res.PartnerAccountResp; +import com.huoran.nakadai.entity.vo.TeamMemberVo; +import com.huoran.nakadai.mapper.*; +import com.huoran.nakadai.service.PartnerAccountService; +import com.huoran.nakadai.service.PartnerClassificationService; +import com.huoran.nakadai.service.PartnerTeamService; +import com.huoran.nakadai.utils.EmailUtil; +import com.huoran.nakadai.utils.QrCodeUtil; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; + +/** + *

+ * 合伙人账号表 服务实现类 + *

+ * + * @author chen + * @since 2022-05-18 + */ +@Service +public class PartnerAccountServiceImpl extends ServiceImpl implements PartnerAccountService { + + @Autowired + private RedisTemplate redisTemplate; + + @Autowired + private HrStaffMapper staffMapper; + + @Autowired + private UserClient userClient; + + @Autowired + private PartnerClassificationMapper partnerClassificationMapper; + + @Autowired + private PartnerClassificationService partnerClassificationService; + + @Autowired + private PartnerTeamMapper partnerTeamMapper; + + @Autowired + private EmailUtil emailUtil; + + @Autowired + private OrderMapper orderMapper; + + @Autowired + public PartnerTeamService partnerTeamService; + + @Override + @Transactional + public R savePartnerAccount(PartnerAccountAddReq partnerAccountAddReq) { + //验证邀请码是否过期 + String code = redisTemplate.opsForValue().get(partnerAccountAddReq.getId() + "invitationCode"); + if (StringUtils.isEmpty(code)) { + throw new CustomException(ExceptionEnum.INVITATION_CODE_EXPIRED); + } + + String key = StringUtils.join(partnerAccountAddReq.getPhone(), SMSTemplate.AUTHENTICATION_CODE); + String value = redisTemplate.opsForValue().get(key); + if (StringUtils.isEmpty(value)) { + throw new CustomException(ExceptionEnum.CODE_EXPIRED); + } + //验证手机验证码 + if (partnerAccountAddReq.getCode().equals(value)) { + int role = 0; + if (partnerAccountAddReq.getPartnerClassificationId()!=null){ + //查询转让管理人员角色是否为未认证角色,为未认证角色,邀请进入的人默认为未认证角色 + List roleName = baseMapper.selectUserRole(Integer.valueOf(partnerAccountAddReq.getId()), partnerAccountAddReq.getPartnerClassificationId().toString()); + //role为0,赋予超管角色,其他值为未认证角色 + if (roleName.contains("未认证")){ + role = 1; + } + } + + //创建账号,用户信息,团队分类,分配角色权限 + //账户相关信息表,账号合伙人平台判重(手机号为唯一标识) + Integer accountId = baseMapper.selectAccount(partnerAccountAddReq.getPhone()); + + //邀请人为成员且账号存在,则直接拉入该团队,不可重复拉入 + if (accountId != null & partnerAccountAddReq.getIsTeam() == 0) { + //无法加入自己的团队 + if (partnerAccountAddReq.getId().equals(accountId.toString())) { + throw new CustomException(ExceptionEnum.CANT_JOIN_TEAM); + } + + //查询合伙人账号 + PartnerAccount partnerAccount = baseMapper.selectOne(new QueryWrapper(). + eq("account_id", accountId)); + + //被邀请人有合伙人账号,判断是否已经存在当前团队中 + if (ObjectUtil.isNotNull(partnerAccount)){ + List partnerTeams = partnerTeamMapper.selectList(new QueryWrapper(). + eq("partner_id", partnerAccount.getPartnerId())); + + //查询团队下的成员是否存在团队中 + List teamMeb = partnerClassificationMapper.selectList(new QueryWrapper(). + eq("parent_id", partnerAccountAddReq.getPartnerClassificationId())); + + for (PartnerTeam partnerTeam : partnerTeams) { + for (PartnerClassification partnerClassification : teamMeb) { + if (partnerTeam!=null&&partnerClassification!=null){ + if (partnerTeam.getClassificationId().equals(partnerClassification.getId())){ + throw new CustomException(ExceptionEnum.USER_ALREADY_EXISTS_GROUP); + } + } + } + } + } + + PartnerClassification classification = partnerClassificationMapper.selectById(partnerAccountAddReq.getPartnerClassificationId()); + //新增团队成员 + PartnerClassification partnerClassification = new PartnerClassification(); + partnerClassification.setIsTeam(0); + partnerClassification.setParentId(partnerAccountAddReq.getPartnerClassificationId()); + partnerClassification.setLevel(classification.getLevel() + 1); + partnerClassification.setPartnerClassificationName(classification.getPartnerClassificationName()); + int insert = partnerClassificationMapper.insert(partnerClassification); + + //团队分类 + if (insert > 0) { + PartnerTeam partnerTeam = new PartnerTeam(); + partnerTeam.setPartnerId(partnerAccount.getPartnerId()); + partnerTeam.setClassificationId(partnerClassification.getId()); + partnerTeam.setProvinceId(partnerAccountAddReq.getProvinceId()); + partnerTeam.setCityId(partnerAccountAddReq.getCityId()); + partnerTeamMapper.insert(partnerTeam); + } + this.assignTeamMemberRoles(accountId, role, partnerClassification.getId()); + return insert > 0 ? R.ok() : R.error(); + } + + //合伙人新增团队,已是团员,新增当前用户为新团队管理员 + if (accountId != null & partnerAccountAddReq.getIsTeam() == 1) { + //查询当前用户只能有一个团队管理员身份 + PartnerAccount partnerAccount = baseMapper.selectOne(new QueryWrapper(). + eq("account_id", accountId)); + + //查询团队管理员数量,count为1表示已经是一个团队的超管,无法再创建 + Integer count = baseMapper.selectTeamManager(accountId); + if (count > 1) { + throw new CustomException(ExceptionEnum.CANNOT_ADDED_REPEATEDLY); + } + + Integer level = 1; + Integer parentId = 1; + if (partnerAccountAddReq.getPartnerClassificationId()!=null) { + //分类不为空,为团队直接新增该分类下的团体,为团队成员新增为该团队下的成员 + PartnerClassification classification = partnerClassificationMapper.selectById(partnerAccountAddReq.getPartnerClassificationId()); + level = classification.getLevel(); + parentId = partnerAccountAddReq.getPartnerClassificationId(); + } + + //新增分类团队 + PartnerClassification partnerClassification = new PartnerClassification(); + partnerClassification.setIsTeam(1); + partnerClassification.setParentId(parentId); + partnerClassification.setLevel(level); + String teamName = partnerAccountAddReq.getUserName() + "的团队"; + //名称进行判重 + String newName = checkRepeatClassName(teamName); + partnerClassification.setPartnerClassificationName(newName); + int insert = partnerClassificationMapper.insert(partnerClassification); + if (insert > 0) { + PartnerTeam partnerTeam = new PartnerTeam(); + partnerTeam.setPartnerId(partnerAccount.getPartnerId()); + partnerTeam.setClassificationId(partnerClassification.getId()); + partnerTeam.setProvinceId(partnerAccountAddReq.getProvinceId()); + partnerTeam.setCityId(partnerAccountAddReq.getCityId()); + partnerTeamMapper.insert(partnerTeam); + } + this.assignAdministratorRoles(accountId, role, partnerClassification.getId()); + return insert > 0 ? R.ok() : R.error(); + } + + //账号平台判重 + Integer count = baseMapper.checkAccount(partnerAccountAddReq.getAccount()); + if (count > 0) { + throw new CustomException(ExceptionEnum.EXIST_ACCOUNT); + } + + //用户相关信息表 + UserInfo userInfo = new UserInfo(); + BeanUtils.copyProperties(partnerAccountAddReq, userInfo); + int addUserInfo = staffMapper.addUserInfo(userInfo); + + UserAccount userAccount = new UserAccount(); + BeanUtils.copyProperties(partnerAccountAddReq, userAccount); + userAccount.setPassword(MD5.encrypt("1122aa")); + userAccount.setUserId(userInfo.getUserId()); + userAccount.setType(2);//平台端区分:0->教师端 1->学生端 2->无端 + userAccount.setPlatformId("4");//4表示合伙人 + userAccount.setAccount(RandomUtil.randomNumbers(6)); + int addAccount = staffMapper.addUserAccount(userAccount); + + //添加合伙人信息 + PartnerAccount partnerAccount = new PartnerAccount(); + //合伙人绑定账号id + partnerAccount.setAccountId(userAccount.getId()); + String username = baseMapper.selectUsername(partnerAccountAddReq.getId()); + //邀请人名称 + partnerAccount.setInvitationAccount(username); + int insert = baseMapper.insert(partnerAccount); + + //添加所属合伙人分类,分类为空直接新增团队,(0是团队成员,1为团队) + if (partnerAccountAddReq.getPartnerClassificationId()==null) { + //新增团队 + PartnerClassification partnerClassification = new PartnerClassification(); + partnerClassification.setIsTeam(1); + partnerClassification.setParentId(1); + partnerClassification.setLevel(1); + String teamName = partnerAccountAddReq.getUserName() + "的团队"; + //名称进行判重 + String newName = checkRepeatClassName(teamName); + partnerClassification.setPartnerClassificationName(newName); + int insert1 = partnerClassificationMapper.insert(partnerClassification); + if (insert1 > 0) { + PartnerTeam partnerTeam = new PartnerTeam(); + partnerTeam.setPartnerId(partnerAccount.getPartnerId()); + partnerTeam.setClassificationId(partnerClassification.getId()); + partnerTeam.setProvinceId(partnerAccountAddReq.getProvinceId()); + partnerTeam.setCityId(partnerAccountAddReq.getCityId()); + partnerTeamMapper.insert(partnerTeam); + } + this.assignAdministratorRoles(userAccount.getId(), 0, partnerClassification.getId()); + return addUserInfo > 0 && addAccount > 0 && insert > 0 ? R.ok() : R.error(); + } else { + //分类不为空,为团队直接新增该分类下的团体,为团队成员新增为该团队下的成员 + PartnerClassification classification = partnerClassificationMapper.selectById(partnerAccountAddReq.getPartnerClassificationId()); + if (partnerAccountAddReq.getIsTeam() == 1) { + //新增分类团队 + PartnerClassification partnerClassification = new PartnerClassification(); + partnerClassification.setIsTeam(1); + partnerClassification.setParentId(partnerAccountAddReq.getPartnerClassificationId()); + partnerClassification.setLevel(classification.getLevel() + 1); + String teamName = partnerAccountAddReq.getUserName() + "的团队"; + //名称进行判重 + String newName = checkRepeatClassName(teamName); + partnerClassification.setPartnerClassificationName(newName); + int insert1 = partnerClassificationMapper.insert(partnerClassification); + if (insert1 > 0) { + PartnerTeam partnerTeam = new PartnerTeam(); + partnerTeam.setPartnerId(partnerAccount.getPartnerId()); + partnerTeam.setClassificationId(partnerClassification.getId()); + partnerTeam.setProvinceId(partnerAccountAddReq.getProvinceId()); + partnerTeam.setCityId(partnerAccountAddReq.getCityId()); + partnerTeamMapper.insert(partnerTeam); + } + this.assignAdministratorRoles(userAccount.getId(),0, partnerClassification.getId()); + return addUserInfo > 0 && addAccount > 0 && insert > 0 ? R.ok() : R.error(); + } + if (partnerAccountAddReq.getIsTeam() == 0) { + //新增分类团队成员 + PartnerClassification partnerClassification = new PartnerClassification(); + partnerClassification.setIsTeam(0); + partnerClassification.setParentId(partnerAccountAddReq.getPartnerClassificationId()); + partnerClassification.setLevel(classification.getLevel() + 1); + partnerClassification.setPartnerClassificationName(classification.getPartnerClassificationName()); + int insert1 = partnerClassificationMapper.insert(partnerClassification); + if (insert1 > 0) { + PartnerTeam partnerTeam = new PartnerTeam(); + partnerTeam.setPartnerId(partnerAccount.getPartnerId()); + partnerTeam.setClassificationId(partnerClassification.getId()); + partnerTeam.setProvinceId(partnerAccountAddReq.getProvinceId()); + partnerTeam.setCityId(partnerAccountAddReq.getCityId()); + partnerTeamMapper.insert(partnerTeam); + } + this.assignTeamMemberRoles(userAccount.getId(), role, partnerClassification.getId()); + return addUserInfo > 0 && addAccount > 0 && insert > 0 ? R.ok() : R.error(); + } + } + } + throw new CustomException(ExceptionEnum.CODE_ERROR); + } + + /** + * 小程序分配合伙人角色 + */ + public void assignAdministratorRoles(Integer accountId, Integer role, Integer teamId) { + List list = new ArrayList<>(); + Integer platform = 4;//合伙人平台 + Integer port = 1;//pc端角色为0、小程序端为1 + String roleName; + if (role==0){ + //查询超管角色 + roleName = "超级管理员"; + }else { + //查询未认证角色 + roleName = "未认证"; + } + Integer roleId = baseMapper.selectAdmin(platform, port,roleName); + + Integer id = baseMapper.selectRoleExist(accountId, roleId, teamId); + if (id != null) { + System.out.println("角色已存在"); + } else { + list.add(roleId); + // roleList.addAll(list); + //账号赋予角色 + userClient.rolePermissionService(accountId, list, teamId); + } + } + + /** + * 小程序分配合伙人队员角色 + */ + public void assignTeamMemberRoles(Integer accountId, Integer role, Integer teamId) { + List list = new ArrayList<>(); + //查询团队成员 + Integer platform = 4;//合伙人平台 + Integer port = 1;//pc端角色为0、小程序端为1 + String roleName; + if (role==0){ + //查询团队成员角色 + roleName = "团队成员"; + }else { + //查询未认证角色 + roleName = "未认证"; + } + Integer roleId = baseMapper.selectAdmin(platform, port,roleName); + if (roleId == null) { + throw new CustomException(ExceptionEnum.DEFAULT_ROLE_NOTEXIST); + } + Integer id = baseMapper.selectRoleExist(accountId, roleId, teamId); + if (id != null) { + System.out.println("角色已存在"); + } else { + list.add(roleId); + // roleList.addAll(list); + //账号赋予角色 + userClient.rolePermissionService(accountId, list, teamId); + } + } + + @Override + public R pagePartnerAccountList(PartnerAccountListReq req) { + //无分类id,查询所有团队 + if (StringUtils.isEmpty(req.getPartnerClassificationId())) { + return R.error("先选择分类/团队进行查询!"); + } + Page page = new Page<>(req.getPageNum(), req.getPageSize()); + //查询分类下所有团队id + ArrayList ids = baseMapper.selectTeamIdByClassificationId(req.getPartnerClassificationId()); + req.setIds(ids); + + IPage partnerAccountList = baseMapper.pagePartnerAccountList(page, req); + + List respList = partnerAccountList.getRecords(); + //获取负责人数据 + List collect = respList.stream().filter(partnerAccountResp -> "1".equals(partnerAccountResp.getIsTeam())).collect(Collectors.toList()); + + for (PartnerAccountResp partnerAccountResp : collect) { + //成员设置省份城市及费率 + for (PartnerAccountResp accountResp : respList) { + if (accountResp.getParentId().toString().equals(partnerAccountResp.getPartnerClassificationId())){ + accountResp.setProvinceId(partnerAccountResp.getProvinceId()); + accountResp.setProvinceName(partnerAccountResp.getProvinceName()); + accountResp.setCityId(partnerAccountResp.getCityId()); + accountResp.setCityName(partnerAccountResp.getCityName()); + accountResp.setAnnualTeamFee(partnerAccountResp.getAnnualTeamFee()); + accountResp.setAnnualMarketingFee(partnerAccountResp.getAnnualMarketingFee()); + } + } + } + partnerAccountList.setRecords(respList); + return R.ok().put("pageList", partnerAccountList); + + } + + @Override + public R partnerAccountMergeList(PartnerAccountListReq req) { + + Page page = new Page<>(req.getPageNum(), req.getPageSize()); + //查询团队合伙人 + IPage partnerAccountList = baseMapper.partnerAccountMergeList(page, req); + + return R.ok().put("pageList", partnerAccountList); + } + + @Override + public R partnerAccountDetail(Integer accountId) { + PartnerAccountResp resp = baseMapper.partnerAccountDetail(accountId); + return R.ok().put("data", resp); + } + + @Override + public R modifyPartnerAccount(PartnerAccountUpdateReq updateReq) { + //根据账号id获取userId + Integer userId = staffMapper.getUserId(updateReq.getAccountId()); + + //更新员工相关信息表 + if (updateReq.getRoleList() != null) { + + //删除该账号原有角色 + staffMapper.delRoleByAccountId(updateReq.getAccountId()); + + //更新员工信息,删除之前部门 + QueryWrapper partnerTeamQueryWrapper = new QueryWrapper<>(); + partnerTeamQueryWrapper.eq("partner_id", updateReq.getPartnerId()); + int delete = partnerTeamMapper.delete(partnerTeamQueryWrapper); + + //添加员工部门 + List idList = updateReq.getPartnerClassificationId(); + if (idList != null && idList.size() > 0) { + idList.forEach(id -> { + PartnerTeam partnerTeam = new PartnerTeam(); + partnerTeam.setClassificationId(id); + partnerTeam.setPartnerId(updateReq.getPartnerId()); + partnerTeamMapper.insert(partnerTeam); + }); + } + + //账号赋予角色 + userClient.rolePermissionService(updateReq.getAccountId(), updateReq.getRoleList(), null); + } + + //编辑账户相关信息表 + UserAccount userAccount = new UserAccount(); + BeanUtils.copyProperties(updateReq, userAccount); + userAccount.setId(updateReq.getAccountId()); + boolean updateAccount = staffMapper.modifyUserAccount(userAccount); + + //编辑用户相关信息表 + UserInfo userInfo = new UserInfo(); + BeanUtils.copyProperties(updateReq, userInfo); + userInfo.setUserId(userId); + boolean updateUserInfo = staffMapper.modifyUserInfo(userInfo); + return updateUserInfo && updateAccount ? R.ok() : R.error(); + } + + @Override + public R delPartnerAccount(Integer accountId) { + + QueryWrapper accountQueryWrapper = new QueryWrapper<>(); + accountQueryWrapper.eq("account_id", accountId); + PartnerAccount partnerAccount = baseMapper.selectOne(accountQueryWrapper); + + int count = 0; + List partnerTeams = partnerTeamMapper.selectList(new QueryWrapper(). + eq("partner_id", partnerAccount.getPartnerId())); + if (ObjectUtil.isNotNull(partnerTeams) && partnerTeams.size() > 0) { + for (PartnerTeam partnerTeam : partnerTeams) { + PartnerClassification partnerClassification = partnerClassificationMapper.selectById(partnerTeam.getClassificationId()); + if (ObjectUtil.isNotNull(partnerClassification)) { + //已经存在团队管理员,抛出异常 + if (partnerClassification.getIsTeam() == 1) { + count++; + } + } + } + } + if (count>0){ + throw new CustomException(ExceptionEnum.SUPERVISING_ROLE); + } + + //删除账号、用户表数据 修改用户表逻辑删除状态 修改账号表逻辑删除状态 + userClient.delAccountAndUser(accountId); + + //删除合伙人信息 + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.set("is_del", DelConstant.IS_DEL); + updateWrapper.eq("account_id", accountId); + int update = baseMapper.update(new PartnerAccount(), updateWrapper); + + QueryWrapper partnerTeamQueryWrapper = new QueryWrapper<>(); + partnerTeamQueryWrapper.eq("partner_id", partnerAccount.getPartnerId()); + + //查询所有分类进行删除 + List partnerTeams1 = partnerTeamMapper.selectList(partnerTeamQueryWrapper); + + partnerTeams1.forEach(partnerTeam -> { + partnerClassificationMapper.deleteById(partnerTeam.getClassificationId()); + }); + + //删除团队关系 + partnerTeamMapper.delete(partnerTeamQueryWrapper); + + return update > 0 ? R.ok() : R.error(); + } + + /*@Override + public R delPartnerAccount(String teamId) { + //团队id + PartnerClassification partnerClassification = partnerClassificationMapper.selectById(teamId); + QueryWrapper partnerTeamQueryWrapper = new QueryWrapper<>(); + partnerTeamQueryWrapper.eq("parent_id", teamId); + + //删除该团队所以关系 + List partnerClassifications = partnerClassificationMapper.selectList(partnerTeamQueryWrapper); + partnerClassifications.add(partnerClassification); + partnerClassifications.forEach(partnerClass -> { + partnerTeamMapper.delete(new QueryWrapper().eq("classification_id",partnerClass.getId())); + }); + + //删除团队成员 + partnerClassificationMapper.delete(partnerTeamQueryWrapper); + //删除团队管理员 + partnerClassificationMapper.deleteById(Integer.parseInt(teamId)); + + return R.ok(); + }*/ + + @Override + public void generationQrCode(String url, HttpServletResponse response) { + QrCodeUtil.encode(url, response); + } + + @Override + public R getTeamsByAccountId(Integer accountId) { + //1.首先拿到当前用户所在团队的信息 + + List partnerAccountList = baseMapper.getTeamsByAccountId(accountId); + /*for (PartnerAccountResp resp:partnerAccountList) { + for (PartnerAccountResp resp : partnerAccountList) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.select("*").eq("id",resp.getTeamId()).eq("is_del",0); + PartnerClassification partnerClassification= partnerClassificationMapper.selectOne(queryWrapper); + queryWrapper.select("parent_id").eq("id", resp.getTeamId()).eq("is_team", 1).eq("is_del", 0); + PartnerClassification partnerClassification = partnerClassificationMapper.selectOne(queryWrapper); + + List partnerClassificationList = partnerClassificationMapper.getBusinessManagersUnderTheSameTeam(partnerClassification.getParentId()); + resp.setBusinessManagerIds(partnerClassificationList); + }*/ + partnerAccountList.forEach(partnerAccountResp -> { + PartnerClassification partnerClassification = partnerClassificationMapper.getParentInformationBasedOnChild(Integer.parseInt(partnerAccountResp.getPartnerClassificationId())); + partnerAccountResp.setPartnerClassificationList(partnerClassification); + }); + return R.ok().put("data", partnerAccountList); + + + + /*List partnerAccountList = baseMapper.getTeamsByAccountId(accountId); + for (PartnerAccountResp resp:partnerAccountList) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.select("*").eq("id",resp.getTeamId()).eq("is_del",0); + PartnerClassification partnerClassification= partnerClassificationMapper.selectOne(queryWrapper); + + + if (partnerClassification.getIsTeam()==0){ + + } + + List partnerClassificationList = partnerClassificationMapper.getBusinessManagersUnderTheSameTeam(partnerClassification.getParentId()); + resp.setBusinessManagerIds(partnerClassificationList); + } + return R.ok().put("data", partnerAccountList);*/ + } + + @Override + public R transferAdmin(TransferAdminReq transferAdminReq) { + //验证邀请码是否过期 + String code = redisTemplate.opsForValue().get(transferAdminReq.getId() + "transferCode"); + if (StringUtils.isEmpty(code)) { + throw new CustomException(ExceptionEnum.INVITATION_CODE_EXPIRED); + } + + String key = StringUtils.join(transferAdminReq.getPhone(), SMSTemplate.AUTHENTICATION_CODE); + String value = redisTemplate.opsForValue().get(key); + if (StringUtils.isEmpty(value)) { + throw new CustomException(ExceptionEnum.CODE_EXPIRED); + } + //验证手机验证码 + if (transferAdminReq.getCode().equals(value)) { + //创建账号,用户信息,团队分类,分配角色权限 + //账户相关信息表,账号合伙人平台判重(手机号为唯一标识) + Integer accountId = baseMapper.selectAccount(transferAdminReq.getPhone()); + + //邀请人账号存在 + if (accountId != null) { + //已经是该团队超管 + if (transferAdminReq.getId().equals(accountId.toString())) { + throw new CustomException(ExceptionEnum.CANNOT_ADDED_REPEATEDLY); + } + + List partnerClassifications = partnerClassificationMapper.selectList(new QueryWrapper(). + eq("parent_id", transferAdminReq.getPartnerClassificationId())); + + ArrayList partnerClassIds = new ArrayList<>(); + if (ObjectUtil.isNotNull(partnerClassifications) && partnerClassifications.size() > 0) { + //是否已存在团队 + partnerClassifications.forEach(partnerClassification -> { + partnerClassIds.add(partnerClassification.getId()); + }); + } + PartnerAccount memberAccount = baseMapper.selectOne(new QueryWrapper(). + eq("account_id",accountId)); + + List partnerTeams = partnerTeamMapper.selectList(new QueryWrapper(). + eq("partner_id", memberAccount.getPartnerId())); + + boolean exist = false; + Integer memberTeamId = 0; + for (PartnerTeam partnerTeam : partnerTeams) { + if (partnerClassIds.contains(partnerTeam.getClassificationId())){ + exist = true; + memberTeamId = partnerTeam.getClassificationId(); + } + } + //查询管理员的团队id + PartnerAccount adminAccount = baseMapper.selectOne(new QueryWrapper(). + eq("account_id",transferAdminReq.getId())); + + //存在该团队,直接进行转换,不存在该团队,进入团队后再转换 + if (exist){ + //转移团队 + partnerTeamMapper.update(new PartnerTeam(),new UpdateWrapper(). + eq("partner_id",adminAccount.getPartnerId()).eq("classification_id",transferAdminReq.getPartnerClassificationId()). + set("classification_id",memberTeamId)); + + partnerTeamMapper.update(new PartnerTeam(),new UpdateWrapper(). + eq("partner_id",memberAccount.getPartnerId()).eq("classification_id",memberTeamId). + set("classification_id",transferAdminReq.getPartnerClassificationId())); + + //转移订单 + List orders = orderMapper.selectList(new QueryWrapper(). + eq("business_manager_id", adminAccount.getPartnerId()). + eq("team_id", transferAdminReq.getPartnerClassificationId())); + + for (Order order : orders) { + order.setBusinessManagerId(memberAccount.getPartnerId().toString()); + orderMapper.updateById(order); + } + + //更新团队名称 + PartnerClassification partnerClassification = partnerClassificationMapper.selectById(transferAdminReq.getPartnerClassificationId()); + String teamName = transferAdminReq.getUserName() + "的团队"; + //名称进行判重 + String newName = checkRepeatClassName(teamName); + partnerClassification.setPartnerClassificationName(newName); + partnerClassificationMapper.updateById(partnerClassification); + //更新团员所属团队名称 + List partnerClassifications1 = partnerClassificationMapper.selectList(new QueryWrapper(). + eq("parent_id", partnerClassification.getId())); + partnerClassifications1.forEach(partnerClassification1 -> { + partnerClassification1.setPartnerClassificationName(newName); + partnerClassificationMapper.updateById(partnerClassification1); + }); + //查询转让管理人员角色是否为未认证角色,为未认证角色,邀请进入的人默认为未认证角色 + List roleName = baseMapper.selectUserRole(adminAccount.getAccountId(), transferAdminReq.getPartnerClassificationId()); + //role为0,赋予超管角色,其他值为未认证角色 + int role = 0; + if (roleName.contains("未认证")){ + role = 1; + } + + //删除之前账号在所在团队的角色 + partnerTeamService.delRoleByAccountIdAndTeamId(memberAccount.getAccountId(),Integer.parseInt(transferAdminReq.getPartnerClassificationId())); + //删除该账号在所在团队的角色 + partnerTeamService.delRoleByAccountIdAndTeamId(adminAccount.getAccountId(),memberTeamId); + + //赋予新增用户为所在团队超管角色,删除之前管理员在团队中的所有角色,赋予团队成员角色 + this.assignAdministratorRoles(memberAccount.getAccountId(), role,Integer.parseInt(transferAdminReq.getPartnerClassificationId())); + + this.assignTeamMemberRoles(adminAccount.getAccountId(), role, memberTeamId); + return R.ok(); + }else { + + PartnerClassification classification = partnerClassificationMapper.selectById(transferAdminReq.getPartnerClassificationId()); + //新增团队成员 + PartnerClassification partnerClassification = new PartnerClassification(); + partnerClassification.setIsTeam(0); + partnerClassification.setParentId(Integer.parseInt(transferAdminReq.getPartnerClassificationId())); + partnerClassification.setLevel(classification.getLevel() + 1); + partnerClassification.setPartnerClassificationName(classification.getPartnerClassificationName()); + int insert = partnerClassificationMapper.insert(partnerClassification); + + //团队分类 + if (insert > 0) { + PartnerTeam partnerTeam = new PartnerTeam(); + partnerTeam.setPartnerId(memberAccount.getPartnerId()); + partnerTeam.setClassificationId(partnerClassification.getId()); + partnerTeam.setProvinceId(transferAdminReq.getProvinceId()); + partnerTeam.setCityId(transferAdminReq.getCityId()); + partnerTeamMapper.insert(partnerTeam); + } + this.assignTeamMemberRoles(accountId, 0, partnerClassification.getId()); + + //转移团队 + partnerTeamMapper.update(new PartnerTeam(),new UpdateWrapper(). + eq("partner_id",adminAccount.getPartnerId()).eq("classification_id",transferAdminReq.getPartnerClassificationId()). + set("classification_id",partnerClassification.getId())); + + partnerTeamMapper.update(new PartnerTeam(),new UpdateWrapper(). + eq("partner_id",memberAccount.getPartnerId()).eq("classification_id",partnerClassification.getId()). + set("classification_id",transferAdminReq.getPartnerClassificationId())); + + //转移订单 + List orders = orderMapper.selectList(new QueryWrapper(). + eq("business_manager_id", adminAccount.getPartnerId()). + eq("team_id", transferAdminReq.getPartnerClassificationId())); + + for (Order order : orders) { + order.setBusinessManagerId(memberAccount.getPartnerId().toString()); + orderMapper.updateById(order); + } + + //更新团队名称 + PartnerClassification partnerClassification1 = partnerClassificationMapper.selectById(transferAdminReq.getPartnerClassificationId()); + String teamName = transferAdminReq.getUserName() + "的团队"; + //名称进行判重 + String newName = checkRepeatClassName(teamName); + partnerClassification1.setPartnerClassificationName(newName); + partnerClassificationMapper.updateById(partnerClassification1); + //更新团员所属团队名称 + List partnerClassifications2 = partnerClassificationMapper.selectList(new QueryWrapper(). + eq("parent_id", partnerClassification1.getId())); + partnerClassifications2.forEach(partnerClassification2 -> { + partnerClassification2.setPartnerClassificationName(newName); + partnerClassificationMapper.updateById(partnerClassification2); + }); + //查询转让管理人员角色是否为未认证角色,为未认证角色,邀请进入的人默认为未认证角色 + List roleName = baseMapper.selectUserRole(adminAccount.getAccountId(), transferAdminReq.getPartnerClassificationId()); + //role为0,赋予超管角色,其他值为未认证角色 + int role = 0; + if (roleName.contains("未认证")){ + role = 1; + } + + //删除之前账号在所在团队的角色 + partnerTeamService.delRoleByAccountIdAndTeamId(memberAccount.getAccountId(),Integer.parseInt(transferAdminReq.getPartnerClassificationId())); + + //删除该账号在所在团队的角色 + partnerTeamService.delRoleByAccountIdAndTeamId(adminAccount.getAccountId(),partnerClassification.getId()); + //赋予新增用户为所在团队超管角色,删除之前管理员在团队中的所有角色,赋予团队成员角色 + this.assignAdministratorRoles(memberAccount.getAccountId(), role,Integer.parseInt(transferAdminReq.getPartnerClassificationId())); + + this.assignTeamMemberRoles(adminAccount.getAccountId(), role, partnerClassification.getId()); + + return R.ok(); + } + } + + //账号平台判重 + Integer count = baseMapper.checkAccount(transferAdminReq.getAccount()); + if (count > 0) { + throw new CustomException(ExceptionEnum.EXIST_ACCOUNT); + } + + //用户相关信息表 + UserInfo userInfo = new UserInfo(); + BeanUtils.copyProperties(transferAdminReq, userInfo); + int addUserInfo = staffMapper.addUserInfo(userInfo); + + UserAccount userAccount = new UserAccount(); + BeanUtils.copyProperties(transferAdminReq, userAccount); + userAccount.setPassword(MD5.encrypt("1122aa")); + userAccount.setUserId(userInfo.getUserId()); + userAccount.setType(2);//平台端区分:0->教师端 1->学生端 2->无端 + userAccount.setPlatformId("4");//4表示合伙人 + userAccount.setAccount(RandomUtil.randomNumbers(6)); + int addAccount = staffMapper.addUserAccount(userAccount); + + //查询管理员的团队id + PartnerAccount adminAccount = baseMapper.selectOne(new QueryWrapper(). + eq("account_id",transferAdminReq.getId())); + + //添加合伙人信息 + PartnerAccount partnerAccount = new PartnerAccount(); + partnerAccount.setAccountId(userAccount.getId()); + String username = baseMapper.selectUsername(transferAdminReq.getId()); + //邀请人名称 + partnerAccount.setInvitationAccount(username); + int insert = baseMapper.insert(partnerAccount); + + //团队新增该分类下的成员 + PartnerClassification classification = partnerClassificationMapper.selectById(transferAdminReq.getPartnerClassificationId()); + //新增分类团队成员 + PartnerClassification partnerClassification = new PartnerClassification(); + partnerClassification.setIsTeam(0); + partnerClassification.setParentId(Integer.parseInt(transferAdminReq.getPartnerClassificationId())); + partnerClassification.setLevel(classification.getLevel() + 1); + partnerClassification.setPartnerClassificationName(classification.getPartnerClassificationName()); + int insert1 = partnerClassificationMapper.insert(partnerClassification); + if (insert1 > 0) { + PartnerTeam partnerTeam = new PartnerTeam(); + partnerTeam.setPartnerId(partnerAccount.getPartnerId()); + partnerTeam.setClassificationId(partnerClassification.getId()); + partnerTeam.setProvinceId(transferAdminReq.getProvinceId()); + partnerTeam.setCityId(transferAdminReq.getCityId()); + partnerTeamMapper.insert(partnerTeam); + } + + + + //转移团队 + partnerTeamMapper.update(new PartnerTeam(),new UpdateWrapper(). + eq("partner_id",adminAccount.getPartnerId()).eq("classification_id",transferAdminReq.getPartnerClassificationId()). + set("classification_id",partnerClassification.getId())); + + partnerTeamMapper.update(new PartnerTeam(),new UpdateWrapper(). + eq("partner_id",partnerAccount.getPartnerId()).eq("classification_id",partnerClassification.getId()). + set("classification_id",transferAdminReq.getPartnerClassificationId())); + + //转移订单 + List orders = orderMapper.selectList(new QueryWrapper(). + eq("business_manager_id", adminAccount.getPartnerId()). + eq("team_id", transferAdminReq.getPartnerClassificationId())); + + for (Order order : orders) { + order.setBusinessManagerId(partnerAccount.getPartnerId().toString()); + orderMapper.updateById(order); + } + + //更新团队名称 + PartnerClassification partnerClassification1 = partnerClassificationMapper.selectById(transferAdminReq.getPartnerClassificationId()); + String teamName = transferAdminReq.getUserName() + "的团队"; + //名称进行判重 + String newName = checkRepeatClassName(teamName); + partnerClassification1.setPartnerClassificationName(newName); + partnerClassificationMapper.updateById(partnerClassification1); + //更新团员所属团队名称 + List partnerClassifications1 = partnerClassificationMapper.selectList(new QueryWrapper(). + eq("parent_id", partnerClassification1.getId())); + partnerClassifications1.forEach(partnerClassification2 -> { + partnerClassification2.setPartnerClassificationName(newName); + partnerClassificationMapper.updateById(partnerClassification2); + }); + //查询转让管理人员角色是否为未认证角色,为未认证角色,邀请进入的人默认为未认证角色 + List roleName = baseMapper.selectUserRole(adminAccount.getAccountId(),transferAdminReq.getPartnerClassificationId()); + //role为0,赋予超管角色,其他值为未认证角色 + int role = 0; + if (roleName.contains("未认证")){ + role = 1; + } + + //删除被转让账号在所在团队的角色 + partnerTeamService.delRoleByAccountIdAndTeamId(adminAccount.getAccountId(),Integer.parseInt(transferAdminReq.getPartnerClassificationId())); + //赋予新增用户为所在团队超管角色,删除之前管理员在团队中的所有角色,赋予团队成员角色 + this.assignAdministratorRoles(userAccount.getId(), role,Integer.parseInt(transferAdminReq.getPartnerClassificationId())); + + this.assignTeamMemberRoles(adminAccount.getAccountId(), role, partnerClassification.getId()); + + return addAccount > 0 ? R.ok() : R.error(); + } + throw new CustomException(ExceptionEnum.CODE_ERROR); + } + + @Override + public R transferTeam(TransferTeamReq transferTeamReq) { + Integer adminPartnerId = transferTeamReq.getAdminPartnerId(); + Integer memberPartnerId = transferTeamReq.getMemberPartnerId(); + Integer adminTeamId = transferTeamReq.getAdminTeamId(); + Integer memberTeamId = transferTeamReq.getMemberTeamId(); + + //查询管理员的团队id + PartnerAccount adminAccount = baseMapper.selectById(adminPartnerId); + //转移团队 + partnerTeamMapper.update(new PartnerTeam(),new UpdateWrapper(). + eq("partner_id",adminPartnerId).eq("classification_id",adminTeamId). + set("classification_id",memberTeamId)); + + partnerTeamMapper.update(new PartnerTeam(),new UpdateWrapper(). + eq("partner_id",memberPartnerId).eq("classification_id",memberTeamId). + set("classification_id",adminTeamId)); + + //转移订单 + List orders = orderMapper.selectList(new QueryWrapper(). + eq("business_manager_id", adminPartnerId). + eq("team_id", adminTeamId)); + + for (Order order : orders) { + order.setBusinessManagerId(memberPartnerId.toString()); + orderMapper.updateById(order); + } + + //更新团队名称 + PartnerClassification partnerClassification = partnerClassificationMapper.selectById(adminTeamId); + //查询当前用户的团队后台 + String teamName = transferTeamReq.getMemberName() + "的团队"; + //名称进行判重 + String newName = checkRepeatClassName(teamName); + partnerClassification.setPartnerClassificationName(newName); + partnerClassificationMapper.updateById(partnerClassification); + //更新团员所属团队名称 + List partnerClassifications = partnerClassificationMapper.selectList(new QueryWrapper(). + eq("parent_id", partnerClassification.getId())); + partnerClassifications.forEach(partnerClassification1 -> { + partnerClassification1.setPartnerClassificationName(newName); + partnerClassificationMapper.updateById(partnerClassification1); + }); + //查询转让管理人员角色是否为未认证角色,为未认证角色,邀请进入的人默认为未认证角色 + List roleName = baseMapper.selectUserRole(adminAccount.getAccountId(), adminTeamId.toString()); + //role为0,赋予超管角色,其他值为未认证角色 + int role = 0; + if (roleName.contains("未认证")){ + role = 1; + } + + PartnerAccount memberAccount = baseMapper.selectById(memberPartnerId); + + //删除之前账号在所在团队的角色 + partnerTeamService.delRoleByAccountIdAndTeamId(memberAccount.getAccountId(),adminTeamId); + //删除该账号在所在团队的角色 + partnerTeamService.delRoleByAccountIdAndTeamId(adminAccount.getAccountId(),memberTeamId); + + + //赋予转让用户为所在团队超管角色,删除之前管理员在团队中的所有角色,赋予团队成员角色 + this.assignAdministratorRoles( memberAccount.getAccountId(), role,adminTeamId); + + this.assignTeamMemberRoles(adminAccount.getAccountId(), role,memberTeamId); + + return R.ok(); + } + + @Override + public R mailFileSend(FileSendReq fileSendReq) { +// emailUtil.sendMessageCarryFile(fileSendReq.getMail(), fileSendReq.getCopyWriting(), fileSendReq.getUrl(),fileSendReq.getCopyWriting()); + emailUtil.sendMessageCarryFiles(fileSendReq.getMail(), fileSendReq.getCopyWriting(), fileSendReq.getCopyWriting(),fileSendReq.getUrls(),fileSendReq.getFileName()); + return R.ok(); + } + + @Override + public String checkRepeatClassName(String teamName) { + Integer count = 1; + PartnerClassification partnerClassification = new PartnerClassification(); + partnerClassification.setPartnerClassificationName(teamName); + boolean ok = partnerClassificationService.checkRepeatAll(partnerClassification); + //如果名称重复,加完之后再调取一遍 + if (ok){ + teamName=teamName+count++; + return checkRepeatClassName(teamName); + }else { + return teamName; + } + } + + @Override + public R teamPartnerList(PartnerAccountListReq req) { + Page page = new Page<>(req.getPageNum(), req.getPageSize()); + //无分类id,查询所有团队 + if (StringUtils.isNotEmpty(req.getPartnerClassificationId())) { + //查询分类下所有团队id + ArrayList ids = baseMapper.selectTeamIdByClassificationId(req.getPartnerClassificationId()); + req.setIds(ids); + } + //查询团队合伙人 + IPage partnerAccountList = baseMapper.teamPartnerList(page, req); + for (PartnerAccountResp record : partnerAccountList.getRecords()) { + //查询区域,往上查询所有父级 + String area = baseMapper.area(record.getTeamId()); + record.setArea(area); + //查询团队数,往下查询所有子级 + Integer teamSize = baseMapper.teamSize(record.getTeamId()); + record.setTeamSize(teamSize); + } + + return R.ok().put("pageList", partnerAccountList); + } + + @Override + public R queryTeamMembers(TeamMemberVo teamMemberVo) { + //查询团队数,往下查询所有子级 + List ids = baseMapper.teamMembers(teamMemberVo.getTeamId()); + List list = baseMapper.selectTeamMembersDetails(ids,teamMemberVo.getName()); + return R.ok().put("teamMembers", list); + } + + @Override + public R queryPartnerAccount(String phone) { + //查询是否有合伙人平台账号 + Integer accountId = baseMapper.selectAccount(phone); + //无账号数据,返回成功状态 + if (accountId==null){ + return R.ok(); + } + //查询合伙人账号 + PartnerAccount partnerAccount = baseMapper.selectOne(new QueryWrapper(). + eq("account_id", accountId)); + + if (ObjectUtil.isNotNull(partnerAccount)){ + + List partnerTeams = partnerTeamMapper.selectList(new QueryWrapper(). + eq("partner_id", partnerAccount.getPartnerId())); + //查询所在团队 + List classIds = new ArrayList<>(); + for (PartnerTeam partnerTeam : partnerTeams) { + classIds.add(partnerTeam.getClassificationId()); + } + //查询团队角色 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.in("id",classIds); + wrapper.eq("is_team",1); + wrapper.orderByDesc("create_time"); + wrapper.last("limit 1"); + PartnerClassification partnerClassification1 = partnerClassificationMapper.selectOne(wrapper); + Integer classId = 0; + int teamId = 0; + int parentId = 0; + String username = baseMapper.selectUsername(accountId.toString()); + //拥有管理者信息 + if (partnerClassification1!=null){ + classId = partnerClassification1.getId(); + teamId = 1; + }else { + //查询最近创建成员信息 + QueryWrapper classificationQueryWrapper = new QueryWrapper<>(); + classificationQueryWrapper.in("id",classIds); + classificationQueryWrapper.eq("is_team",0); + classificationQueryWrapper.orderByDesc("create_time"); + classificationQueryWrapper.last("limit 1"); + PartnerClassification partnerClassification = partnerClassificationMapper.selectOne(classificationQueryWrapper); + if (partnerClassification==null){ + return R.ok().put("username",username); + } + classId = partnerClassification.getId(); + parentId = partnerClassification.getParentId(); + } + + + String accountName = baseMapper.selectAccountName(accountId.toString()); + PartnerTeam team = baseMapper.selectProvinceCity( partnerAccount.getPartnerId(),classId); + if (team==null){ + return R.ok().put("username",username); + } + if (teamId==0){ + QueryWrapper classificationQueryWrapper1 = new QueryWrapper<>(); + classificationQueryWrapper1.eq("id",parentId); + PartnerClassification partnerClassification = partnerClassificationMapper.selectOne(classificationQueryWrapper1); + team.setTeamName(partnerClassification.getPartnerClassificationName()); + classId = partnerClassification.getId(); + } + team.setTeamId(classId); + team.setUserName(username); + team.setIsTeam(teamId); + team.setAccountName(accountName); + return R.ok().put("team",team); + + } + + return R.error("信息有误,请联系管理员进行处理!"); + } + + @Override + public R partnerAccountApplication(PartnerRegisterReq registerReq) { + + //创建账号,用户信息,团队分类,分配角色权限 + //账户相关信息表,账号合伙人平台判重(手机号为唯一标识) + Integer accountId = baseMapper.selectAccount(registerReq.getPhone()); + + + //合伙人新增团队,已是团员,新增当前用户为新团队管理员 + if (accountId != null ) { + //查询当前用户只能有一个团队管理员身份 + PartnerAccount partnerAccount = baseMapper.selectOne(new QueryWrapper(). + eq("account_id", accountId)); + + //查询团队管理员数量,count为1表示已经是一个团队的超管,无法再创建 + Integer count = baseMapper.selectTeamManager(accountId); + if (count > 1) { + throw new CustomException(ExceptionEnum.CANNOT_ADDED_REPEATEDLY); + } + + Integer level = 1; + Integer parentId = 1; + + //新增分类团队 + PartnerClassification partnerClassification = new PartnerClassification(); + partnerClassification.setIsTeam(1); + partnerClassification.setParentId(parentId); + partnerClassification.setLevel(level); + String teamName = registerReq.getUserName() + "的团队"; + //名称进行判重 + String newName = checkRepeatClassName(teamName); + partnerClassification.setPartnerClassificationName(newName); + int insert = partnerClassificationMapper.insert(partnerClassification); + if (insert > 0) { + PartnerTeam partnerTeam = new PartnerTeam(); + partnerTeam.setPartnerId(partnerAccount.getPartnerId()); + partnerTeam.setClassificationId(partnerClassification.getId()); + partnerTeam.setProvinceId(registerReq.getProvinceId()); + partnerTeam.setCityId(registerReq.getCityId()); + partnerTeamMapper.insert(partnerTeam); + } + //role为0赋为超管角色,不为0为未认证角色 + this.assignAdministratorRoles(accountId,1 , partnerClassification.getId()); + + return R.ok().put("token", JwtUtils.getJwtToken(accountId.toString())).put("teamId",partnerClassification.getId()); + } + + //账号平台判重 + Integer count = baseMapper.checkAccount(registerReq.getAccount()); + if (count > 0) { + throw new CustomException(ExceptionEnum.EXIST_ACCOUNT); + } + + //用户相关信息表 + UserInfo userInfo = new UserInfo(); + BeanUtils.copyProperties(registerReq, userInfo); + userInfo.setLoginNumber(1); + userInfo.setLastLoginTime(new Date()); + int addUserInfo = staffMapper.addUserInfo(userInfo); + + UserAccount userAccount = new UserAccount(); + BeanUtils.copyProperties(registerReq, userAccount); + userAccount.setPassword(MD5.encrypt("1122aa")); + userAccount.setUserId(userInfo.getUserId()); + userAccount.setType(2);//平台端区分:0->教师端 1->学生端 2->无端 + userAccount.setPlatformId("4");//4表示合伙人 + userAccount.setAppOpenId(registerReq.getAppOpenId()); + userAccount.setAccount(RandomUtil.randomNumbers(6)); + userAccount.setAppOpenId(registerReq.getOpenId()); + int addAccount = staffMapper.addUserAccount(userAccount); + + //添加合伙人信息 + PartnerAccount partnerAccount = new PartnerAccount(); + //合伙人绑定账号id + partnerAccount.setAccountId(userAccount.getId()); + + int insert = baseMapper.insert(partnerAccount); + + //添加所属合伙人分类,分类为空直接新增团队 + PartnerClassification partnerClassification = new PartnerClassification(); + partnerClassification.setIsTeam(1); + partnerClassification.setParentId(1); + partnerClassification.setLevel(1); + String teamName = registerReq.getUserName() + "的团队"; + //名称进行判重 + String newName = checkRepeatClassName(teamName); + partnerClassification.setPartnerClassificationName(newName); + int insert1 = partnerClassificationMapper.insert(partnerClassification); + if (insert1 > 0) { + PartnerTeam partnerTeam = new PartnerTeam(); + partnerTeam.setPartnerId(partnerAccount.getPartnerId()); + partnerTeam.setClassificationId(partnerClassification.getId()); + partnerTeam.setProvinceId(registerReq.getProvinceId()); + partnerTeam.setCityId(registerReq.getCityId()); + partnerTeamMapper.insert(partnerTeam); + } + //role为0赋为超管角色,不为0为未认证角色 + this.assignAdministratorRoles(userAccount.getId(), 1, partnerClassification.getId()); + + //注册成功返回token和团队id + if (addUserInfo > 0 && addAccount > 0){ + return R.ok().put("token", JwtUtils.getJwtToken(userAccount.getId().toString())).put("teamId",partnerClassification.getId()); + } + return R.error(); + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/PartnerArticleClassificationServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/PartnerArticleClassificationServiceImpl.java new file mode 100644 index 0000000..a1fba82 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/PartnerArticleClassificationServiceImpl.java @@ -0,0 +1,30 @@ +package com.huoran.nakadai.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.nakadai.entity.PartnerArticleClassification; +import com.huoran.nakadai.mapper.PartnerArticleClassificationMapper; +import com.huoran.nakadai.service.PartnerArticleClassificationService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @描述:合伙人——文章管理——文章所属分类 服务类 + * @作者: Rong + * @日期: 2023-03-16 + */ +@Service +public class PartnerArticleClassificationServiceImpl extends ServiceImpl implements PartnerArticleClassificationService { + + @Autowired + private PartnerArticleClassificationMapper mapper; + + @Override + public List categoryIdsQueriesCategoryInformation(String ids) { + return baseMapper.categoryIdsQueriesCategoryInformation(ids); + } +} + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/PartnerArticleFileServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/PartnerArticleFileServiceImpl.java new file mode 100644 index 0000000..4b18aa0 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/PartnerArticleFileServiceImpl.java @@ -0,0 +1,36 @@ +package com.huoran.nakadai.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.common.constant.DelConstant; +import com.huoran.nakadai.entity.PartnerArticleFile; +import com.huoran.nakadai.mapper.PartnerArticleFileMapper; +import com.huoran.nakadai.service.PartnerArticleFileService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @描述:合伙人——文章管理——文章附件管理表 服务类 + * @作者: Rong + * @日期: 2023-03-16 + */ +@Service +public class PartnerArticleFileServiceImpl extends ServiceImpl implements PartnerArticleFileService { + + @Autowired + private PartnerArticleFileMapper mapper; + + @Override + public List getFileByContentId(Integer contentId) { + QueryWrapper queryWrap = new QueryWrapper<>(); + queryWrap.eq("content_id",contentId); + queryWrap.eq("is_del", DelConstant.NOT_DEL); + List list = mapper.selectList(queryWrap); + return list; + } +} + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/PartnerArticleLabelServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/PartnerArticleLabelServiceImpl.java new file mode 100644 index 0000000..53de532 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/PartnerArticleLabelServiceImpl.java @@ -0,0 +1,30 @@ +package com.huoran.nakadai.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.nakadai.entity.PartnerArticleLabel; +import com.huoran.nakadai.mapper.PartnerArticleLabelMapper; +import com.huoran.nakadai.service.PartnerArticleLabelService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @描述:合伙人——文章管理——文章主题标签 服务类 + * @作者: Rong + * @日期: 2023-03-16 + */ +@Service +public class PartnerArticleLabelServiceImpl extends ServiceImpl implements PartnerArticleLabelService { + + @Autowired + private PartnerArticleLabelMapper mapper; + + @Override + public List idsQueriesLabelInformation(String ids) { + return mapper.idsQueriesLabelInformation(ids); + } +} + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/PartnerArticleManagementCollectServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/PartnerArticleManagementCollectServiceImpl.java new file mode 100644 index 0000000..fcbfa1b --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/PartnerArticleManagementCollectServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.nakadai.service.impl; + +import com.huoran.nakadai.entity.PartnerArticleManagementCollect; +import com.huoran.nakadai.mapper.PartnerArticleManagementCollectMapper; +import com.huoran.nakadai.service.PartnerArticleManagementCollectService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 合伙人——学习收藏表 服务实现类 + *

+ * + * @author chen + * @since 2023-04-18 + */ +@Service +public class PartnerArticleManagementCollectServiceImpl extends ServiceImpl implements PartnerArticleManagementCollectService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/PartnerArticleManagementServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/PartnerArticleManagementServiceImpl.java new file mode 100644 index 0000000..82ea079 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/PartnerArticleManagementServiceImpl.java @@ -0,0 +1,187 @@ +package com.huoran.nakadai.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.common.constant.DelConstant; +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.PartnerArticleManagement; +import com.huoran.nakadai.entity.PartnerArticleManagementCollect; +import com.huoran.nakadai.entity.req.PagePartnerArticleManagementReq; +import com.huoran.nakadai.entity.res.PartnerArticleManagementResp; +import com.huoran.nakadai.entity.vo.ContentHeavyTitleReqVO; +import com.huoran.nakadai.mapper.PartnerArticleManagementCollectMapper; +import com.huoran.nakadai.mapper.PartnerArticleManagementMapper; +import com.huoran.nakadai.service.PartnerArticleManagementService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.data.redis.core.ValueOperations; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @描述:合伙人——文章管理 服务类 + * @作者: Rong + * @日期: 2023-03-16 + */ +@Service +public class PartnerArticleManagementServiceImpl extends ServiceImpl implements PartnerArticleManagementService { + + + private final static Logger logger = LoggerFactory.getLogger(PartnerArticleManagementServiceImpl.class); + @Autowired + private PartnerArticleManagementMapper mapper; + + @Autowired + private PartnerArticleManagementCollectMapper collectMapper; + @Autowired + private StringRedisTemplate redisTemplate; + + @Override + public R partnerOperatingList(PagePartnerArticleManagementReq req) { + req.setPageNum((req.getPageNum() - 1) * req.getPageSize()); + req.setPageSize(req.getPageSize()); + ValueOperations opsForString = redisTemplate.opsForValue(); + String key = "browse:accountId=" + req.getAccountId(); +// Page page = new Page(req.getPageNum(), req.getPageSize()); +// IPage pageList = baseMapper.partnerOperatingList(page, req); + + List pageList = baseMapper.partnerOperatingList(req); + //查看缓存是否有数据 + String returnValue = opsForString.get(key); + //使用缓存返回数据 类型(1.学习2.资讯) 只有学习返回上次阅读 + if (req.getTypeId() == 1) { + if (returnValue != null) { + for (PartnerArticleManagementResp r : pageList) { + if (r.getId() == Integer.valueOf(returnValue)) { + r.setLastReading(true); + } + } + } + + for (PartnerArticleManagementResp resp : pageList) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("account_id", req.getAccountId()); + queryWrapper.eq("content_id", resp.getId()); + PartnerArticleManagementCollect courseCollect = collectMapper.selectOne(queryWrapper); + + + QueryWrapper queryWrapper1 = new QueryWrapper<>(); + queryWrapper1.eq("content_id", resp.getId()); + Integer collectCount = collectMapper.selectCount(queryWrapper1); + + resp.setCollectionNumber(collectCount); + //是否收藏:(state = 1收藏,0取消收藏) + if (courseCollect != null) { + //收藏过 + resp.setCollectionStatus(1); + } else { + resp.setCollectionStatus(0); + } + } + } +// return R.ok().put("data", pageList); + return R.ok().put("page", pageList).put("total", baseMapper.partnerOperatingListCount(req)); + + } + + @Override + public boolean checkIfTheTitleIsRepeat(ContentHeavyTitleReqVO content) { + //只对已发布的标题判重 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("title", content.getTitle()); + queryWrapper.eq("is_release", DelConstant.POST_STATUS); + queryWrapper.eq("type_id", content.getTypeId()); + List article = mapper.selectList(queryWrapper); + if (article.size() > 0) { + if (content.getId() != null) { + //判断为编辑情况下,如果编辑的id与查询出来的一致不提示 + if (content.getId().equals(article.get(0).getId())) { + return true; + } + } + + return false; + } + return true; + } + + /* @Override + public R modifiedSort(Integer sequenceNumber, Integer articleId) { + // 占分布式锁,去redis占坑 + // 1. 分布式锁占坑 + Boolean lock = redisTemplate.opsForValue().setIfAbsent("articleSortLock", "value", 30, TimeUnit.SECONDS); + if (lock) { + //加锁成功... + if (sequenceNumber <= 0) { + redisTemplate.delete("articleSortLock"); //删除key,释放锁 + return R.error("请输入正确的序号!"); + } + + PartnerArticleManagement content = baseMapper.selectById(articleId); + + + //查看当前升序情况下全部文章信息 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("type_id", content.getTypeId()); + List articles = baseMapper.selectList(queryWrapper); + + if (sequenceNumber > articles.size()) { + sequenceNumber = articles.size(); + } + + //获取当前排序的序号 + Integer currentSerialNumber = content.getSequence(); + + if (currentSerialNumber.equals(sequenceNumber)) { + redisTemplate.delete("articleSortLock"); //删除key,释放锁 + return R.ok(); + } + //修改当前序号 + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.set("sequence", sequenceNumber); + updateWrapper.eq("id", articleId); + //做乐观锁处理 + *//*updateWrapper.eq("sequence", currentSerialNumber);*//* + int updateCount = baseMapper.update(new PartnerArticleManagement(), updateWrapper); + + UpdateWrapper updateWrapper1 = new UpdateWrapper<>(); + updateWrapper1.ne("id", articleId); + //currentSerialNumber 当前文章的序号 + //sequenceNumber 要更改的序号 + + *//** + * 就要判断排序是值改小还是改大 + * 大改小比如53改5那就加一个语句“大于等于5并且小于53” + * 如果是小改大比如3改50那就是“大于3并且小于等于50" + *//* + if (currentSerialNumber > sequenceNumber) { + //改大 gt > + updateWrapper1.setSql(" sequence = sequence + 1"); + updateWrapper1.last(" and sequence >= " + sequenceNumber + " and sequence < " + currentSerialNumber); + } else if (currentSerialNumber < sequenceNumber) { + //改小 + //le为<= +// updateWrapper1.le("sequence", sequenceNumber); + updateWrapper1.setSql(" sequence = sequence - 1"); + updateWrapper1.last(" and sequence > " + currentSerialNumber + " and sequence <= " + sequenceNumber); + //用于判断序号为本身就为1时候就不减了 +// updateWrapper1.ne("sequence", 1); + } + + updateWrapper1.eq("type_id", content.getTypeId()); + baseMapper.update(new PartnerArticleManagement(), updateWrapper1); + redisTemplate.delete("articleSortLock"); //删除key,释放锁 + return R.ok(); + } else { + return R.error("当前有用户操作排序,请稍后刷新重试!"); + } + } +*/ + +} + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/PartnerArticleStatisticServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/PartnerArticleStatisticServiceImpl.java new file mode 100644 index 0000000..30d6934 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/PartnerArticleStatisticServiceImpl.java @@ -0,0 +1,43 @@ +package com.huoran.nakadai.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.nakadai.entity.PartnerArticleStatistic; +import com.huoran.nakadai.mapper.PartnerArticleStatisticMapper; +import com.huoran.nakadai.service.PartnerArticleStatisticService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * @描述:合伙人——文章管理——文章浏览记录 服务类 + * @作者: Rong + * @日期: 2023-03-17 + */ +@Service +public class PartnerArticleStatisticServiceImpl extends ServiceImpl implements PartnerArticleStatisticService { + + @Autowired + private PartnerArticleStatisticMapper mapper; + + @Override + public boolean checkForExistence(PartnerArticleStatistic partnerArticleStatistics) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("content_id", partnerArticleStatistics.getContentId()); + queryWrapper.eq("account_id", partnerArticleStatistics.getAccountId()); + PartnerArticleStatistic statistics = mapper.selectOne(queryWrapper); + if (statistics == null) { + //还未浏览 返回true表示可新增 + return true; + } + //已存在 不做新增 + return false; + } + + @Override + public Integer statisticsOfVisitors(Integer contentId) { + return baseMapper.statisticsOfVisitors(contentId); + } +} + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/PartnerClassificationServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/PartnerClassificationServiceImpl.java new file mode 100644 index 0000000..6675c6e --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/PartnerClassificationServiceImpl.java @@ -0,0 +1,126 @@ +package com.huoran.nakadai.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.common.constant.DelConstant; +import com.huoran.nakadai.entity.PartnerClassification; +import com.huoran.nakadai.mapper.PartnerClassificationMapper; +import com.huoran.nakadai.service.PartnerClassificationService; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +/** + *

+ * 合伙人分类表 服务实现类 + *

+ * + * @author chen + * @since 2022-05-18 + */ +@Service +public class PartnerClassificationServiceImpl extends ServiceImpl implements PartnerClassificationService { + + @Override + public boolean checkRepeat(PartnerClassification partnerClassification) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + queryWrapper.eq("level", partnerClassification.getLevel()); + queryWrapper.eq("partner_classification_name", partnerClassification.getPartnerClassificationName()); + queryWrapper.eq("parent_id", partnerClassification.getParentId()); + if (partnerClassification.getId() != null) { + queryWrapper.last(" and id != " + partnerClassification.getId()); + } + List partnerClassifications = baseMapper.selectList(queryWrapper); + return partnerClassifications.size() > 0; + } + + @Override + public boolean checkRepeatAll(PartnerClassification partnerClassification) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + queryWrapper.eq("partner_classification_name", partnerClassification.getPartnerClassificationName()); + List partnerClassifications = baseMapper.selectList(queryWrapper); + return partnerClassifications.size() > 0; + } + + @Override + public boolean removeClassification(Integer id) { + //查询当前id的父id,删除后所有的团体父id更新此父id + PartnerClassification partnerClassification = baseMapper.selectById(id); + Integer parentId = partnerClassification.getParentId(); + + //查询当前分类下的所有子分类,0为分类,1为团队 + List ids = baseMapper.selectIdByPid(id,0); + ids.add(id); + + //查询当前分类下的所有团队,团队名称叠加更新 + List team = baseMapper.selectIdByPid(id, 1); + team.forEach(t ->{ + + PartnerClassification classification = new PartnerClassification(); + classification.setParentId(parentId); + classification.setId(t); + baseMapper.updateById(classification); + }); + + //批量进行删除 + int i = baseMapper.deleteBatchIds(ids); + return i>0; + } + + @Override + public List treeList(Integer applet) { + //查询父级的 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("is_del", DelConstant.NOT_DEL); +// 小程序端只查询层级,不查询团队 + if (applet!=null&&applet==1){ + wrapper.eq("is_team", 0); + } + List partnerClassifications = baseMapper.selectList(wrapper); + return build(partnerClassifications); + } + + @Override + public List queryBusinessManagerIdBasedOnTeamId(String teamId) { + return baseMapper.queryBusinessManagerIdBasedOnTeamId(teamId); + } + + @Override + public void removeRole(String teamId, Integer accountId) { + baseMapper.updateRole(teamId,accountId); + } + + /** + * 使用递归方法构建权限菜单 + */ + public List build(List treeNodes) { + List trees = new ArrayList<>(); + for (PartnerClassification treeNode : treeNodes) { + if (treeNode.getParentId() == 1) { + trees.add(findChildren(treeNode, treeNodes)); + } + } + return trees; + } + + /** + * 递归查找子节点 + */ + public PartnerClassification findChildren(PartnerClassification treeNode, List treeNodes) { + treeNode.setChildren(new ArrayList<>()); + + for (PartnerClassification it : treeNodes) { + + if (treeNode.getId().equals(it.getParentId())) { + if (treeNode.getChildren() == null) { + treeNode.setChildren(new ArrayList<>()); + } + treeNode.getChildren().add(findChildren(it, treeNodes)); + } + } + return treeNode; + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/PartnerSchemeManagementProductConfigServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/PartnerSchemeManagementProductConfigServiceImpl.java new file mode 100644 index 0000000..2c548b4 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/PartnerSchemeManagementProductConfigServiceImpl.java @@ -0,0 +1,26 @@ +package com.huoran.nakadai.service.impl; + +import com.huoran.nakadai.entity.PartnerSchemeManagementProductConfig; +import com.huoran.nakadai.mapper.PartnerSchemeManagementProductConfigMapper; +import com.huoran.nakadai.service.PartnerSchemeManagementProductConfigService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 合伙人——方案管理——产品配置表 服务实现类 + *

+ * + * @author chen + * @since 2023-06-28 + */ +@Service +public class PartnerSchemeManagementProductConfigServiceImpl extends ServiceImpl implements PartnerSchemeManagementProductConfigService { + + @Override + public List obtainProductsAccordingToTheScheme(Integer schemeId,Integer isRelease) { + return baseMapper.obtainProductsAccordingToTheScheme(schemeId,isRelease); + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/PartnerSchemeManagementServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/PartnerSchemeManagementServiceImpl.java new file mode 100644 index 0000000..7c70795 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/PartnerSchemeManagementServiceImpl.java @@ -0,0 +1,31 @@ +package com.huoran.nakadai.service.impl; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.PartnerSchemeManagement; +import com.huoran.nakadai.entity.req.PagePartnerArticleManagementReq; +import com.huoran.nakadai.entity.res.PartnerArticleManagementResp; +import com.huoran.nakadai.mapper.PartnerSchemeManagementMapper; +import com.huoran.nakadai.service.PartnerSchemeManagementService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 合伙人——方案管理 服务实现类 + *

+ * + * @author chen + * @since 2023-03-20 + */ +@Service +public class PartnerSchemeManagementServiceImpl extends ServiceImpl implements PartnerSchemeManagementService { + + @Override + public R schemeList(PagePartnerArticleManagementReq req) { + Page page = new Page(req.getPageNum(), req.getPageSize()); + IPage pageList = baseMapper.schemeList(page, req); + return R.ok().put("data", pageList); + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/PartnerTeamServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/PartnerTeamServiceImpl.java new file mode 100644 index 0000000..e0937ec --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/PartnerTeamServiceImpl.java @@ -0,0 +1,298 @@ +package com.huoran.nakadai.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.google.common.collect.Maps; +import com.huoran.common.exception.CustomException; +import com.huoran.common.exception.ExceptionEnum; +import com.huoran.common.response.R; +import com.huoran.common.utils.RandomUtil; +import com.huoran.nakadai.entity.PartnerClassification; +import com.huoran.nakadai.entity.PartnerTeam; +import com.huoran.nakadai.entity.req.EditProvinceCityReq; +import com.huoran.nakadai.entity.req.SalesProgressReq; +import com.huoran.nakadai.entity.res.AnnualOperatingAnalysisResp; +import com.huoran.nakadai.entity.res.PartnerAccountResp; +import com.huoran.nakadai.entity.res.UserInfoByPhoneRes; +import com.huoran.nakadai.entity.vo.CheckVo; +import com.huoran.nakadai.mapper.OrderMapper; +import com.huoran.nakadai.mapper.PartnerClassificationMapper; +import com.huoran.nakadai.mapper.PartnerTeamMapper; +import com.huoran.nakadai.service.PartnerAccountService; +import com.huoran.nakadai.service.PartnerTeamService; +import com.huoran.nakadai.utils.EmailUtil; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.stereotype.Service; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.concurrent.TimeUnit; + +/** + *

+ * 合伙人团队表(合伙人账号与分类中间表) 服务实现类 + *

+ * + * @author chen + * @since 2022-05-18 + */ +@Service +public class PartnerTeamServiceImpl extends ServiceImpl implements PartnerTeamService { + + @Autowired + private PartnerClassificationMapper partnerClassificationMapper; + + @Autowired + private OrderMapper orderMapper; + + @Autowired + private PartnerAccountService partnerAccountService; + + @Autowired + private PartnerTeamMapper partnerTeamMapper; + + @Autowired + private PartnerTeamMapper teamMapper; + + @Autowired + StringRedisTemplate stringRedisTemplate; + + @Autowired + private EmailUtil emailUtil; + + @Override + public List getMembersUnderTheSameTeam(Integer classificationId) { + return baseMapper.getMembersUnderTheSameTeam(classificationId); + } + + @Override + public List selectTeamList(String id, int current, int pageSize, String name) { + current = (current - 1) * pageSize; + + List partnerClassifications = partnerClassificationMapper. + selectList(new QueryWrapper(). + eq("parent_id", id)); + //合伙人id + ArrayList ids = new ArrayList<>(); + //查询所有团队成员id + partnerClassifications.forEach(partnerClassification -> { + PartnerTeam partnerTeam = baseMapper.selectOne(new QueryWrapper(). + eq("classification_id", partnerClassification.getId())); + ids.add(partnerTeam.getPartnerId()); + }); + + if (ids != null && ids.size() > 0) { + List teamList = baseMapper.selectTeamInfo(ids, current, pageSize, name); + return teamList; + } + return null; + } + + /** + * 1.分成方式的 + * 产品1成交价格是10w。结算方式是5:5分成的,则此时该产品的结算价=成交价*商务分成比例(比如50%,此处读取课程管理设置的商务经理分成比例) + * 采购成本为 = 结算价+平台服务费 + * 平台服务费=结算价*10%即:10*50%+10**50%10%=5.5w + * 2.结算单价方式 + * 采购成本为 =结算价+平台服务费 + * 结算价=结算单价(**元/年)*购买时长*数量 + * 此处购买时长要进行转换,比如购买的为月,则要先算出每月的价格即年结算价格/12;如果为日则按照年结算价/365 + * 比如产品结算价2w/年,购买三年此处采购成本为: + * 2*3+2*3*10%=6.6 + */ + @Override + public BigDecimal teamIncome(String id) { + + return null; + } + + @Override + public BigDecimal myIncome() { + return null; + } + + @Override + public R queryUserInfoByPhone(String phone, String partnerId, String teamId) { + HashMap map = Maps.newHashMap(); + + //查询费率 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("classification_id", teamId); + PartnerTeam partnerTeam = teamMapper.selectOne(queryWrapper); + int platformId = 3; + if (StringUtils.isNotEmpty(partnerId) || StringUtils.isNotEmpty(teamId)) { + //根据商务经理查询已完成的订单 + SalesProgressReq req = new SalesProgressReq(); + req.setTeamId(Integer.parseInt(teamId)); + AnnualOperatingAnalysisResp teamIncome = orderMapper.income(req); + if (teamIncome != null) { + if (partnerTeam != null) { + if (partnerTeam.getAnnualMarketingFee() != null) { + BigDecimal bigDecimal = teamIncome.getFinalPrice().multiply((partnerTeam.getAnnualMarketingFee().divide(new BigDecimal(100)))); + //市场服务费 = 即成交金额之和 * 所填入的费率/100; + teamIncome.setMarketingServiceCharge(bigDecimal); + } + + if (teamIncome.getMarketingServiceCharge() != null) { + //项目收益:总成交金额-总结算金额-总市场服务费 + teamIncome.setProjectBenefit(teamIncome.getFinalPrice() + .subtract(teamIncome.getSettlementPrice()). + subtract(teamIncome.getMarketingServiceCharge())); + } + } + } + + + AnnualOperatingAnalysisResp myIncome = null; + + if (partnerId != null) { + req.setBusinessManagerId(Integer.parseInt(partnerId)); + myIncome = orderMapper.income(req); + if (myIncome != null) { + if (partnerTeam != null) { + if (partnerTeam.getAnnualMarketingFee() != null) { + BigDecimal bigDecimal = myIncome.getFinalPrice().multiply((partnerTeam.getAnnualMarketingFee().divide(new BigDecimal(100)))); + //市场服务费 = 即成交金额之和 * 所填入的费率/100; + myIncome.setMarketingServiceCharge(bigDecimal); + } + + if (myIncome.getMarketingServiceCharge() != null) { + //项目收益:总成交金额-总结算金额-总市场服务费 + myIncome.setProjectBenefit(myIncome.getFinalPrice() + .subtract(myIncome.getSettlementPrice()) + .subtract(myIncome.getMarketingServiceCharge())); + } + } + } + } + + + BigDecimal teamIncomeMoney = BigDecimal.ZERO; + if (teamIncome!=null && teamIncome.getProjectBenefit() != null) { + teamIncomeMoney = teamIncome.getProjectBenefit(); + } + + + BigDecimal myIncomeMoney = BigDecimal.ZERO; + if (myIncome!=null && myIncome.getProjectBenefit() != null) { + myIncomeMoney = myIncome.getProjectBenefit(); + } + + /* + + + + List orders = orderMapper.selectList(new QueryWrapper(). + eq("business_manager_id", partnerId). + eq("team_id", teamId).eq("order_status",1)); + //统计个人收益 + BigDecimal myIncome = new BigDecimal(0); + for (Order order : orders) { + if (order.getProfit()!=null){ + myIncome = myIncome.add(new BigDecimal(order.getProfit().toString())); + } + } + + //统计团队收益 + BigDecimal teamIncome = BigDecimal.ZERO; + //根据团队查询团队商务经理 + //查询所有团队成员id + List partnerClassifications = partnerClassificationMapper. + selectList(new QueryWrapper(). + eq("parent_id", teamId)); + + for (PartnerClassification partnerClassification : partnerClassifications) { + PartnerTeam partnerTeam = partnerTeamMapper.selectOne(new QueryWrapper(). + eq("classification_id", partnerClassification.getId())); + //查询团队内商务经理的订单 + List orderList = orderMapper.selectList(new QueryWrapper(). + eq("team_id", teamId).eq("order_status",1)); + + for (Order order : orderList) { + if (order.getProfit()!=null){ + teamIncome = teamIncome.add(new BigDecimal(order.getProfit().toString())); + } + } + }*/ + + QueryWrapper queryWrapper1 = new QueryWrapper<>(); + queryWrapper1.eq("classification_id", teamId); + PartnerTeam one = baseMapper.selectOne(queryWrapper1); + map.put("teamInfo", one); + map.put("myIncome", myIncomeMoney); + map.put("teamIncome", teamIncomeMoney); + platformId = 4; + } + + UserInfoByPhoneRes info = baseMapper.selectInfoByPlatformId(phone, platformId); + info.setPhone(phone); + map.put("info", info); + return R.ok().put("my", map); + } + + @Override + public String getPhone(String id, int platformId) { + return baseMapper.queryPhone(id, platformId); + } + + @Override + public R queryPhone(String phone) { + UserInfoByPhoneRes info = baseMapper.selectInfo(phone); + return R.ok().put("info", info); + } + + @Override + public R updateMyEmail(CheckVo checkVo) { + //邀请码 + String opener = stringRedisTemplate.opsForValue().get(checkVo.getAccountId() + checkVo.getPlatformId() + "mailCode"); + if (opener == null) { + throw new CustomException(ExceptionEnum.CODE_EXPIRED); + } + + if (opener.equals(checkVo.getCode())) { + Integer userId = baseMapper.queryUserId(checkVo.getAccountId()); + baseMapper.updateUserMail(userId, checkVo.getEmail()); + return R.ok(); + } + + return R.error("验证码错误!"); + } + + @Override + public boolean mailCodeSend(CheckVo checkVo) { + //存在直接返回邀请码 + String code = stringRedisTemplate.opsForValue().get(checkVo.getAccountId() + checkVo.getPlatformId() + "mailCode"); + if (StringUtils.isNotEmpty(code)) { + throw new CustomException(ExceptionEnum.VERIFICATION_CODE_HAS_BEEN_SENT); + } + code = RandomUtil.getSixBitRandom(); + stringRedisTemplate.opsForValue().set(checkVo.getAccountId() + checkVo.getPlatformId() + "mailCode", code, 5, TimeUnit.MINUTES); + + emailUtil.sendMessage(checkVo.getEmail(), + "职站", + "尊敬的用户,欢迎使用职站,您本次的验证码是: " + code + ",有效时间为5分钟"); + return true; + } + + @Override + public boolean checkName(EditProvinceCityReq provinceCityReq) { + //查询合伙人姓名是否重复 + Integer count = baseMapper.queryUsername(provinceCityReq.getAccountId(), provinceCityReq.getUserName()); + return count > 0; + } + + @Override + public void editUsername(EditProvinceCityReq provinceCityReq) { + Integer userId = baseMapper.queryUserId(provinceCityReq.getAccountId().toString()); + baseMapper.editUsername(userId, provinceCityReq.getUserName()); + } + + @Override + public void delRoleByAccountIdAndTeamId(Integer accountId, Integer classificationId) { + baseMapper.delRoleByAccountIdAndTeamId(accountId, classificationId); + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/ProductClassificationServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/ProductClassificationServiceImpl.java new file mode 100644 index 0000000..67a7487 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/ProductClassificationServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.nakadai.service.impl; + +import com.huoran.nakadai.entity.ProductClassification; +import com.huoran.nakadai.mapper.ProductClassificationMapper; +import com.huoran.nakadai.service.ProductClassificationService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 产品分类表 服务实现类 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@Service +public class ProductClassificationServiceImpl extends ServiceImpl implements ProductClassificationService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/ProductThemeServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/ProductThemeServiceImpl.java new file mode 100644 index 0000000..cbc0d6c --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/ProductThemeServiceImpl.java @@ -0,0 +1,26 @@ +package com.huoran.nakadai.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.nakadai.entity.ProductTheme; +import com.huoran.nakadai.mapper.ProductThemeMapper; +import com.huoran.nakadai.service.ProductThemeService; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + +import javax.annotation.Resource; + +/** + * @描述: 服务类 + * @作者: Rong + * @日期: 2023-08-22 + */ +@Service +public class ProductThemeServiceImpl extends ServiceImpl implements ProductThemeService { + + @Autowired + private ProductThemeMapper mapper; + +} + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/ProductTypeServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/ProductTypeServiceImpl.java new file mode 100644 index 0000000..8b6894f --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/ProductTypeServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.nakadai.service.impl; + +import com.huoran.nakadai.entity.ProductType; +import com.huoran.nakadai.mapper.ProductTypeMapper; +import com.huoran.nakadai.service.ProductTypeService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 产品类型表 服务实现类 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@Service +public class ProductTypeServiceImpl extends ServiceImpl implements ProductTypeService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/ProfessionalClassServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/ProfessionalClassServiceImpl.java new file mode 100644 index 0000000..d2daff8 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/ProfessionalClassServiceImpl.java @@ -0,0 +1,33 @@ +package com.huoran.nakadai.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.nakadai.entity.ProfessionalClass; +import com.huoran.nakadai.mapper.ProfessionalClassMapper; +import com.huoran.nakadai.service.IProfessionalClassService; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 服务实现类 + *

+ * + * @author huoran + * @since 2021-07-09 + */ +@Service +public class ProfessionalClassServiceImpl extends ServiceImpl implements IProfessionalClassService { + + @Override + @Cacheable(value = {"n_professional_class_"},key = "#root.methodName") + public List queryProfessionalClass(List disciplineIds) { + return this.baseMapper.queryProfessionalClass(disciplineIds); + } + + @Override + public List professionalClassLevel(Integer disciplineId) { + return baseMapper.professionalClassLevel(disciplineId); + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/ProfessionalServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/ProfessionalServiceImpl.java new file mode 100644 index 0000000..9b97f02 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/ProfessionalServiceImpl.java @@ -0,0 +1,35 @@ +package com.huoran.nakadai.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.nakadai.entity.Professional; +import com.huoran.nakadai.mapper.ProfessionalMapper; +import com.huoran.nakadai.service.IProfessionalService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 专业 服务实现类 + *

+ * + * @author huoran + * @since 2021-07-09 + */ +@Service +public class ProfessionalServiceImpl extends ServiceImpl implements IProfessionalService { + + @Override + @Cacheable(value = {"n_professional_"},key = "#root.methodName") + public List queryProfessional(Integer professionalClassId) { + return this.baseMapper.selectList(new QueryWrapper() + .eq("professional_class_id",professionalClassId)); + } + + @Override + public List professionalLevel(Integer professionalClassId) { + return baseMapper.professionalLevel(professionalClassId); + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/ProgramShoppingCartServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/ProgramShoppingCartServiceImpl.java new file mode 100644 index 0000000..4beb273 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/ProgramShoppingCartServiceImpl.java @@ -0,0 +1,33 @@ +package com.huoran.nakadai.service.impl; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.common.response.R; +import com.huoran.nakadai.entity.ProgramShoppingCart; +import com.huoran.nakadai.entity.req.ProgramShoppingCartReq; +import com.huoran.nakadai.entity.res.PartnerArticleManagementResp; +import com.huoran.nakadai.entity.res.ProgramShoppingCartResp; +import com.huoran.nakadai.mapper.ProgramShoppingCartMapper; +import com.huoran.nakadai.service.ProgramShoppingCartService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 小程序—购物车 服务实现类 + *

+ * + * @author chen + * @since 2023-06-09 + */ +@Service +public class ProgramShoppingCartServiceImpl extends ServiceImpl implements ProgramShoppingCartService { + + + @Override + public R shoppingCartList(ProgramShoppingCartReq req) { + Page page = new Page(req.getPageNum(), req.getPageSize()); + IPage pageList = baseMapper.shoppingCartList(page, req); + return R.ok().put("data", pageList); + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/ProvinceServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/ProvinceServiceImpl.java new file mode 100644 index 0000000..2e995b3 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/ProvinceServiceImpl.java @@ -0,0 +1,30 @@ +package com.huoran.nakadai.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.nakadai.entity.Province; +import com.huoran.nakadai.mapper.ProvinceMapper; +import com.huoran.nakadai.service.IProvinceService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 省份表 服务实现类 + *

+ * + * @author huoran + * @since 2021-07-08 + */ +@Service +public class ProvinceServiceImpl extends ServiceImpl implements IProvinceService { + + @Override + @Cacheable(value = {"n_province_"},key = "#root.methodName") + public List queryProvince() { + List provinces = this.baseMapper.selectList(new QueryWrapper()); + return provinces; + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/SchoolCurriculumServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/SchoolCurriculumServiceImpl.java new file mode 100644 index 0000000..5239077 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/SchoolCurriculumServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.nakadai.service.impl; + +import com.huoran.nakadai.entity.SchoolCurriculum; +import com.huoran.nakadai.mapper.SchoolCurriculumMapper; +import com.huoran.nakadai.service.SchoolCurriculumService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 学校内置课程表 服务实现类 + *

+ * + * @author lr + * @since 2021-09-26 + */ +@Service +public class SchoolCurriculumServiceImpl extends ServiceImpl implements SchoolCurriculumService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/SchoolServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/SchoolServiceImpl.java new file mode 100644 index 0000000..49a7ead --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/SchoolServiceImpl.java @@ -0,0 +1,35 @@ +package com.huoran.nakadai.service.impl; + +import com.huoran.nakadai.entity.School; +import com.huoran.nakadai.mapper.SchoolMapper; +import com.huoran.nakadai.service.ISchoolService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 学校表 服务实现类 + *

+ * + * @author huoran + * @since 2021-06-29 + */ +@Service +public class SchoolServiceImpl extends ServiceImpl implements ISchoolService { + + @Override + @Cacheable(value = {"n_school_"},key = "#root.methodName") + public List querySchool(String schoolName, Integer provinceId, Integer cityId) { + List list = this.baseMapper.querySchool(schoolName,provinceId,cityId); + return list; + } + + @Override + public List getSchoolsByProvince(String schoolName, Integer provinceId, Integer cityId) { + List list = this.baseMapper.querySchool(schoolName,provinceId,cityId); + return list; + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/ServiceConfigurationServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/ServiceConfigurationServiceImpl.java new file mode 100644 index 0000000..528674f --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/ServiceConfigurationServiceImpl.java @@ -0,0 +1,78 @@ +package com.huoran.nakadai.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.huoran.common.response.R; +import com.huoran.nakadai.entity.ServiceConfiguration; +import com.huoran.nakadai.entity.req.ServiceConfigurationReq; +import com.huoran.nakadai.entity.res.CurriculumRes; +import com.huoran.nakadai.mapper.ServiceConfigurationMapper; +import com.huoran.nakadai.service.IServiceConfigurationService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.ObjectUtils; +import org.springframework.util.StringUtils; + +import java.util.List; + +/** + *

+ * 服务配置表 服务实现类 + *

+ * + * @author Mr.JK + * @since 2021-09-08 + */ +@Service +public class ServiceConfigurationServiceImpl extends ServiceImpl implements IServiceConfigurationService { + + @Autowired + private ServiceConfigurationMapper serviceConfigurationMapper; + + @Override + public IPage getAllService(ServiceConfigurationReq serviceReq) { + +// IPage page = new Page(serviceReq.getPageNum(),serviceReq.getPageSize()); + + /*QueryWrapper queryWrapper = new QueryWrapper(); + if (!ObjectUtils.isEmpty(serviceReq.getBelong())){ + queryWrapper.eq("belong", serviceReq.getBelong()); + } + if (!ObjectUtils.isEmpty(serviceReq.getType())){ + queryWrapper.eq("type", serviceReq.getType()); + } + + if (!StringUtils.isEmpty(serviceReq.getSystemName())){ + queryWrapper.like("system_name",serviceReq.getSystemName()); + } + + if (!StringUtils.isEmpty(serviceReq.getSupplierId())){ + queryWrapper.in("supplier_id",serviceReq.getSupplierId()); + } + IPage iPage = serviceConfigurationMapper.selectPage(page, queryWrapper); + List records = iPage.getRecords(); + for (ServiceConfiguration configuration : records) { + Integer supplierId = configuration.getSupplierId(); + if (supplierId==1){ + configuration.setSupplierName("或然科技"); + }else if (supplierId==2){ + configuration.setSupplierName("智信云"); + }else if (supplierId==3){ + configuration.setSupplierName("漩雨"); + } + }*/ + + Page page = new Page<>(serviceReq.getPageNum(),serviceReq.getPageSize()); + return baseMapper.serviceConfigurationList(page, serviceReq); + } + + @Override + public String getSystemNameBySystemId(Integer systemId) { + ServiceConfiguration configuration = serviceConfigurationMapper + .selectOne(new QueryWrapper().eq("system_id", systemId)); + return configuration.getSystemName(); + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/SupplierServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/SupplierServiceImpl.java new file mode 100644 index 0000000..abf4780 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/SupplierServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.nakadai.service.impl; + +import com.huoran.nakadai.entity.Supplier; +import com.huoran.nakadai.mapper.SupplierMapper; +import com.huoran.nakadai.service.SupplierService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 供应商表 服务实现类 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@Service +public class SupplierServiceImpl extends ServiceImpl implements SupplierService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/TagsServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/TagsServiceImpl.java new file mode 100644 index 0000000..d4d4f5d --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/TagsServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.nakadai.service.impl; + +import com.huoran.nakadai.entity.Tags; +import com.huoran.nakadai.mapper.TagsMapper; +import com.huoran.nakadai.service.TagsService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 分类标签表 服务实现类 + *

+ * + * @author chen + * @since 2023-04-25 + */ +@Service +public class TagsServiceImpl extends ServiceImpl implements TagsService { + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/ValueModuleManagementServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/ValueModuleManagementServiceImpl.java new file mode 100644 index 0000000..839ddeb --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/ValueModuleManagementServiceImpl.java @@ -0,0 +1,25 @@ +package com.huoran.nakadai.service.impl; + +import com.huoran.nakadai.entity.ValueModuleManagement; +import com.huoran.nakadai.mapper.ValueModuleManagementMapper; +import com.huoran.nakadai.service.ValueModuleManagementService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 增值模块管理表 服务实现类 + *

+ * + * @author chen + * @since 2023-01-30 + */ +@Service +public class ValueModuleManagementServiceImpl extends ServiceImpl implements ValueModuleManagementService { + @Override + public List selectProductModule() { + return baseMapper.selectProductModule(); + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/utils/BigDecimalSerializer.java b/nakadai/src/main/java/com/huoran/nakadai/utils/BigDecimalSerializer.java new file mode 100644 index 0000000..5fe90f0 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/utils/BigDecimalSerializer.java @@ -0,0 +1,23 @@ +package com.huoran.nakadai.utils; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; + +import java.io.IOException; +import java.math.BigDecimal; + +public class BigDecimalSerializer extends JsonSerializer { + public BigDecimalSerializer() { + } + + public void serialize(BigDecimal value, JsonGenerator gen, SerializerProvider serializers) throws IOException { + if (value != null) { + BigDecimal number = value.setScale(2, BigDecimal.ROUND_HALF_UP); + gen.writeNumber(number); + } else { + gen.writeNumber(value); + } + + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/utils/CollectionUtil.java b/nakadai/src/main/java/com/huoran/nakadai/utils/CollectionUtil.java new file mode 100644 index 0000000..7ecd953 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/utils/CollectionUtil.java @@ -0,0 +1,69 @@ +package com.huoran.nakadai.utils; + +import java.util.*; + +/** + * @Author chen + * @DATE 2022/4/1 11:36 + * @Version 1.0 + * 该类提供对集合类的高效操作 + */ +public class CollectionUtil { + /** + * 不允许实例化 + */ + private CollectionUtil() { + } + + /** + * 获取两个集合的不同元素 + * @param collmax + * @param collmin + * @return + */ + @SuppressWarnings({ "rawtypes", "unchecked" }) + public static Collection getDifferent(Collection collmax, Collection collmin) + { + //使用LinkedList防止差异过大时,元素拷贝 + Collection csReturn = new LinkedList(); + Collection max = collmax; + Collection min = collmin; + //先比较大小,这样会减少后续map的if判断次数 + if(collmax.size() map = new HashMap(max.size()); + for (Object object : max) { + map.put(object, 1); + } + for (Object object : min) { + if(map.get(object)==null) + { + csReturn.add(object); + }else{ + map.put(object, 2); + } + } + for (Map.Entry entry : map.entrySet()) { + if(entry.getValue()==1) + { + csReturn.add(entry.getKey()); + } + } + return csReturn; + } + /** + * 获取两个集合的不同元素,去除重复 + * @param collMax + * @param collMin + * @return + */ + @SuppressWarnings({ "rawtypes", "unchecked" }) + public static Collection getDifferentNoDuplicate (Collection collMax,Collection collMin) + { + return new HashSet(getDifferent(collMax, collMin)); + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/utils/CommonCode.java b/nakadai/src/main/java/com/huoran/nakadai/utils/CommonCode.java new file mode 100644 index 0000000..8974272 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/utils/CommonCode.java @@ -0,0 +1,53 @@ +package com.huoran.nakadai.utils; + +import lombok.ToString; + +@ToString +public enum CommonCode implements ResultCode { + + + SUCCESS(true, 10000, "操作成功!"), + UNAUTHENTICATED(false, 10001, "此操作需要登陆系统!"), + UNAUTHORISE(false, 10002, "权限不足,无权操作!"), + QUESTIONTYPE_INVALID(false, 10006, "题型错误!"), + INVALID_PARAM(false, 10003, "非法参数!"), + QUESTION_NUM_INVALID(false, 10004, "测评题目数量设置超出范围!"), + QUESTION_EXISTS(false, 10005, "此题已存在!"), + QUESTION_TYPE_INVALID(false, 10006, "题型错误!"), + EXCEL_INVALID(false, 10007, "excel表内容错误!"), + EVALUATION_TIME_INVALID(false, 10008, "测评时间错误!"), + EXCEL_FILE_INVALID(false, 10009, "上传excel文件错误!"), + REPEAT_INEXCEL(false, 10010, "试题在excel表中重复!"), + EVALUATION_QUESTION_NUM_INVALID(false, 10011, "当前测评题数设置为0,请先设置测评题数!"), + FAIL(false, 11111, "操作失败!"), + SERVER_ERROR(false, 99999, "抱歉,系统繁忙,请稍后重试!"); + //操作是否成功 + boolean success; + //操作代码 + int code; + //提示信息 + String message; + + CommonCode(boolean success, int code, String message) { + this.success = success; + this.code = code; + this.message = message; + } + + @Override + public boolean success() { + return success; + } + + @Override + public int code() { + return code; + } + + @Override + public String message() { + return message; + } + + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/utils/ContextUtils.java b/nakadai/src/main/java/com/huoran/nakadai/utils/ContextUtils.java new file mode 100644 index 0000000..1a3cea5 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/utils/ContextUtils.java @@ -0,0 +1,78 @@ +package com.huoran.nakadai.utils; + +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.stereotype.Component; + +@Component +public class ContextUtils implements ApplicationContextAware { + + private static ApplicationContext context; + + @Override + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + context = applicationContext; + } + + /** + * 根据Bean名称获取Bean对象 + * + * @param name Bean名称 + * @return 对应名称的Bean对象 + */ + public static Object getBean(String name) { + return context.getBean(name); + } + + /** + * 根据Bean的类型获取对应的Bean + * + * @param requiredType Bean类型 + * @return 对应类型的Bean对象 + */ + public static T getBean(Class requiredType) { + return context.getBean(requiredType); + } + + /** + * 根据Bean名称获取指定类型的Bean对象 + * + * @param name Bean名称 + * @param requiredType Bean类型(可为空) + * @return 获取对应Bean名称的指定类型Bean对象 + */ + public static T getBean(String name, Class requiredType) { + return context.getBean(name, requiredType); + } + + /** + * 判断是否包含对应名称的Bean对象 + * + * @param name Bean名称 + * @return 包含:返回true,否则返回false。 + */ + public static boolean containsBean(String name) { + return context.containsBean(name); + } + + /** + * 获取对应Bean名称的类型 + * + * @param name Bean名称 + * @return 返回对应的Bean类型 + */ + public static Class getType(String name) { + return context.getType(name); + } + + /** + * 获取上下文对象,可进行各种Spring的上下文操作 + * + * @return Spring上下文对象 + */ + public static ApplicationContext getContext() { + return context; + } + +} \ No newline at end of file diff --git a/nakadai/src/main/java/com/huoran/nakadai/utils/CustomException.java b/nakadai/src/main/java/com/huoran/nakadai/utils/CustomException.java new file mode 100644 index 0000000..9dfd687 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/utils/CustomException.java @@ -0,0 +1,19 @@ +package com.huoran.nakadai.utils; + +/** + * @author 世杰 + * @date 2020/3/24 22:47 + */ +public class CustomException extends RuntimeException { + private ResultCode resultCode; + + public CustomException(ResultCode resultCode) { + //异常信息为错误代码+异常信息 + super("错误代码:" + resultCode.code() + "错误信息:" + resultCode.message()); + this.resultCode = resultCode; + } + + public ResultCode getResultCode() { + return this.resultCode; + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/utils/EmailUtil.java b/nakadai/src/main/java/com/huoran/nakadai/utils/EmailUtil.java new file mode 100644 index 0000000..aa6603f --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/utils/EmailUtil.java @@ -0,0 +1,196 @@ +package com.huoran.nakadai.utils; + +import cn.hutool.core.date.BetweenFormater; +import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUnit; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.io.FileUtil; +import cn.hutool.core.io.StreamProgress; +import cn.hutool.http.HttpUtil; +import com.huoran.common.exception.CustomException; +import com.huoran.common.exception.ExceptionEnum; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.mail.javamail.JavaMailSender; +import org.springframework.mail.javamail.MimeMessageHelper; +import org.springframework.stereotype.Component; + +import javax.mail.internet.InternetAddress; +import javax.mail.internet.MimeMessage; +import java.io.File; +import java.util.List; +import java.util.UUID; + +/** + * @Author chen + * @DATE 2022/6/10 14:23 + * @Version 1.0 + * @Description 邮件发送工具 + */ +@Component +public class EmailUtil { + + @Value("${spring.mail.from}") // 从application.yml配置文件中获取 + private String from; // 发送发邮箱地址 + + @Value("${email.url}") // 从application.yml配置文件中获取 + private String url; // 发送附件地址 + + @Autowired + private JavaMailSender mailSender; + + /** + * 发送纯文本邮件信息 + * + * @param to 接收方 + * @param subject 邮件主题 + * @param content 邮件内容(发送内容) + */ + public void sendMessage(String to, String subject, String content) { + + MimeMessage mimeMessage = mailSender.createMimeMessage(); + // 创建一个邮件对象 + // SimpleMailMessage msg = new SimpleMailMessage(); + try { + MimeMessageHelper msg = new MimeMessageHelper(mimeMessage, true); + msg.setFrom(new InternetAddress(from, "或然科技", "UTF-8")); // 设置发送发 + msg.setTo(to); // 设置接收方 + msg.setSubject(subject); // 设置邮件主题 + msg.setText(content); // 设置邮件内容 + // 发送邮件 + mailSender.send(mimeMessage); + } catch (Exception e) { + e.printStackTrace(); + throw new CustomException(ExceptionEnum.ENTER_CORRECT_EMAIL); + } + } + + /** + * 发送带附件的邮件信息 + * + * @param to 接收方 + * @param subject 邮件主题 + * @param content 邮件内容(发送内容) +// * @param files 文件数组 // 可发送多个附件 + */ + public void sendMessageCarryFiles(String to, String subject, String content, List urls,List fileName) { + MimeMessage mimeMessage = mailSender.createMimeMessage(); + try { + MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true); + helper.setFrom(new InternetAddress(from, "或然科技", "UTF-8")); // 设置发送方 + helper.setTo(to); // 设置接收方 + helper.setSubject(subject); // 设置邮件主题 + helper.addTo(to); + if (fileName.size()<2){ + helper.setText(fileName.get(0)+"已发送至邮箱附件,请注意查收!"); // 设置邮件内容 + }else { + helper.setText("多个文件已发送至邮箱附件,请注意查收!"); // 设置邮件内容 + } + + if (urls != null && urls.size() > 0) { // 下载文件并发送(多个) + for (int i = 0; i < urls.size(); i++) { + //下载文件到本地 + downLoadFromUrl(urls.get(i),fileName.get(i)); + //创建新文件 + System.out.println(url + fileName.get(i)); + File file = new File(url + fileName.get(i)); + helper.addAttachment(file.getName(), file); // 单个附件 + } + } + // 发送邮件 + mailSender.send(mimeMessage); + } catch (Exception e) { + e.printStackTrace(); + throw new CustomException(ExceptionEnum.ENTER_CORRECT_EMAIL); + } + } + + + /** + * @description 从网络URL中下载文件 + * @date 15:33 2021/11/2 + * @params [fileUrl, diskPath] + */ + public void downLoadFromUrl(String fileUrl, String diskPath) { + String path; + if (fileUrl != null) { + //文件后缀 +// String fileName = fileUrl.substring(fileUrl.lastIndexOf(".")); + try { + String uuidName = UUID.randomUUID().toString(); + File file = new File(url); + if (!file.exists()) { + //创建文件夹 + boolean mkdir = file.mkdir(); + if (!mkdir) { + throw new RuntimeException("创建文件夹失败,路径为:" + url); + } + } + path = url + diskPath; + String begin = DateUtil.now(); + DateTime beginTime = DateUtil.parse(begin); + //带进度显示的文件下载 + HttpUtil.downloadFile(fileUrl, FileUtil.file(path), new StreamProgress() { + @Override + public void start() { + System.out.println("开始下载,时间为:" + begin); + } + + @Override + public void progress(long progressSize) { + System.out.println("已下载:{}"+FileUtil.readableFileSize(progressSize)); + } + + @Override + public void finish() { + String end = DateUtil.now(); + DateTime endTime = DateUtil.parse(end); + long between = DateUtil.between(beginTime, endTime, DateUnit.MS); + System.out.println("下载完成,用时:" + DateUtil.formatBetween(between, BetweenFormater.Level.SECOND)); + } + }); + } catch (Exception e) { + System.out.println("下载异常,异常信息为:" + e.getMessage()); + } + } + } + + /** + * 发送带附件的邮件信息 + * + * @param to 接收方 + * @param subject 邮件主题 + * @param fileUrl 文件链接 + * // * @param file 单个文件 + */ + public void sendMessageCarryFile(String to, String subject, String fileUrl, String fileName) { + + MimeMessage mimeMessage = mailSender.createMimeMessage(); + try { + //下载文件到本地 + downLoadFromUrl(fileUrl,fileName); + //创建新文件 + File file = new File(url + fileName); + MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true); + helper.setFrom(new InternetAddress(from, "或然科技", "UTF-8")); // 设置发送方 + helper.setTo(to); // 设置接收方 + helper.setSubject(subject); // 设置邮件主题 + helper.setText(fileName+"已发送至邮箱附件,请注意查收!"); // 设置邮件内容 + helper.addAttachment(file.getName(), file); // 单个附件 + // 发送邮件 + mailSender.send(mimeMessage); + } catch (Exception e) { + e.printStackTrace(); + throw new CustomException(ExceptionEnum.ENTER_CORRECT_EMAIL); + } + } + + public String getFrom() { + return from; + } + + public void setFrom(String from) { + this.from = from; + } +} + diff --git a/nakadai/src/main/java/com/huoran/nakadai/utils/ExcelAttribute.java b/nakadai/src/main/java/com/huoran/nakadai/utils/ExcelAttribute.java new file mode 100644 index 0000000..f38444f --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/utils/ExcelAttribute.java @@ -0,0 +1,25 @@ +package com.huoran.nakadai.utils; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) +public @interface ExcelAttribute { + /** + * 对应的列名称 + */ + String name() default ""; + + /** + * excel列的索引 + */ + int sort(); + + /** + * 字段类型对应的格式 + */ + String format() default ""; +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/utils/ExcelImportHelper.java b/nakadai/src/main/java/com/huoran/nakadai/utils/ExcelImportHelper.java new file mode 100644 index 0000000..1647806 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/utils/ExcelImportHelper.java @@ -0,0 +1,254 @@ +package com.huoran.nakadai.utils; + +import com.huoran.common.exception.CustomException; +import com.huoran.common.exception.ExceptionEnum; +import com.huoran.nakadai.entity.req.ExcelImpStaffReq; +import com.huoran.nakadai.entity.vo.DisciplineExcelVo; +import org.apache.commons.lang.StringUtils; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.*; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.springframework.web.multipart.MultipartFile; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +public class ExcelImportHelper { + + //判断row是否为空 + public static boolean isRowEmpty(Row row) { + if (null == row) { + return true; + } + int firstCellNum = row.getFirstCellNum(); //第一个列位置 + int lastCellNum = row.getLastCellNum(); //最后一列位置 + int nullCellNum = 0; //空列数量 + for (int c = firstCellNum; c < lastCellNum; c++) { + Cell cell = row.getCell(c); + if (null == cell || CellType.BLANK == cell.getCellType()) { + nullCellNum++; + continue; + } + cell.setCellType(CellType.STRING); + String cellValue = cell.getStringCellValue().trim(); + if (StringUtils.isEmpty(cellValue)) { + nullCellNum++; + } + } + //所有列都为空 + if (nullCellNum == (lastCellNum - firstCellNum)) { + return true; + } + return false; + } + + + private static Workbook getWorkbook(MultipartFile file) { + String fileName = file.getOriginalFilename(); + Workbook workbook = null; + + if (fileName.endsWith("xlsx")) { + try { + workbook = new XSSFWorkbook(file.getInputStream()); + } catch (IOException e) { + e.printStackTrace(); + } + } else if (fileName.endsWith("xls")) { + try { + workbook = new HSSFWorkbook(file.getInputStream()); + } catch (IOException e) { + e.printStackTrace(); + } + } + return workbook; + } + + + /** + * @Description : 读取文件数据 + * @Param file + * @Author Rong---2021/10/15 + */ + public static List readStaff(MultipartFile file) { + List list = new ArrayList<>(); + + Workbook workbook = getWorkbook(file); + ExcelImpStaffReq excelImpStaffReq = null; + // 循环工作表Sheet + for (int numSheet = 0; numSheet < workbook.getNumberOfSheets(); numSheet++) { + Sheet hssfSheet = workbook.getSheetAt(numSheet); + if (hssfSheet == null) { + continue; + } + + int count = 1; + // 循环行Row//开始行2 + for (int rowNum = 2; rowNum <= hssfSheet.getLastRowNum(); rowNum++) { + Row row = hssfSheet.getRow(rowNum); + + if (isRowEmpty(row)) { + count++; + if (count == hssfSheet.getLastRowNum()) { + throw new CustomException(ExceptionEnum.EXCEL_FILE_NULL); + } + continue; + } + + Cell userName;//姓名 + Cell account;//账号 + Cell workNumber;//工号 + Cell dept;//所在部门 + Cell roleName;//角色 + Cell phone;//手机号 + Cell email;//邮箱 + if (row != null) { + + excelImpStaffReq = new ExcelImpStaffReq(); + + if (row.getCell(6) != null) { + row.getCell(6).setCellType(CellType.STRING); + email = row.getCell(6); + } else { + email = row.createCell(6); + } + + if (row.getCell(5) != null) { + row.getCell(5).setCellType(CellType.STRING); + phone = row.getCell(5); + } else { + phone = row.createCell(5); + } + + if (row.getCell(4) != null) { + row.getCell(4).setCellType(CellType.STRING); + dept = row.getCell(4); + } else { + dept = row.createCell(4); + } + + if (row.getCell(3) != null) { + row.getCell(3).setCellType(CellType.STRING); + workNumber = row.getCell(3); + } else { + workNumber = row.createCell(3); + } + + if (row.getCell(2) != null) { + row.getCell(2).setCellType(CellType.STRING); + roleName = row.getCell(2); + } else { + roleName = row.createCell(3); + } + + if (row.getCell(1) != null) { + row.getCell(1).setCellType(CellType.STRING); + account = row.getCell(1); + } else { + account = row.createCell(1); + } + + if (row.getCell(0) != null) { + row.getCell(0).setCellType(CellType.STRING); + userName = row.getCell(0); + } else { + userName = row.createCell(0); + } + + excelImpStaffReq.setUserName(userName.getStringCellValue()); + excelImpStaffReq.setAccount(account.getStringCellValue()); + excelImpStaffReq.setWorkNumber(workNumber.getStringCellValue()); + excelImpStaffReq.setDept(dept.getStringCellValue()); + excelImpStaffReq.setRoleName(roleName.getStringCellValue()); + excelImpStaffReq.setPhone(phone.getStringCellValue()); + excelImpStaffReq.setEmail(email.getStringCellValue()); + + list.add(excelImpStaffReq); + } + } + + } + + return list; + } + + + public static List readDiscipline(MultipartFile file) { + List list = new ArrayList<>(); + + Workbook workbook = getWorkbook(file); + DisciplineExcelVo disciplineExcelVo = null; + // 循环工作表Sheet + for (int numSheet = 0; numSheet < workbook.getNumberOfSheets(); numSheet++) { + Sheet hssfSheet = workbook.getSheetAt(numSheet); + if (hssfSheet == null) { + continue; + } + + int count = 1; + // 循环行Row//开始行2 + for (int rowNum = 2; rowNum <= hssfSheet.getLastRowNum(); rowNum++) { + Row row = hssfSheet.getRow(rowNum); + + if (isRowEmpty(row)) { + count++; + if (count == hssfSheet.getLastRowNum()) { + throw new CustomException(ExceptionEnum.EXCEL_FILE_NULL); + } + continue; + } + + Cell serialNumber;//姓名 + Cell category;//账号 + Cell majorCategory;//工号 + Cell major;//所在部门 + + if (row != null) { + + disciplineExcelVo = new DisciplineExcelVo(); + + + if (row.getCell(3) != null) { + row.getCell(3).setCellType(CellType.STRING); + major = row.getCell(3); + } else { + major = row.createCell(3); + } + + if (row.getCell(2) != null) { + row.getCell(2).setCellType(CellType.STRING); + majorCategory = row.getCell(2); + } else { + majorCategory = row.createCell(3); + } + + if (row.getCell(1) != null) { + row.getCell(1).setCellType(CellType.STRING); + category = row.getCell(1); + } else { + category = row.createCell(1); + } + + if (row.getCell(0) != null) { + row.getCell(0).setCellType(CellType.STRING); + serialNumber = row.getCell(0); + } else { + serialNumber = row.createCell(0); + } + + disciplineExcelVo.setSerialNumber(serialNumber.getStringCellValue()); + disciplineExcelVo.setCategory(category.getStringCellValue()); + disciplineExcelVo.setMajorCategory(majorCategory.getStringCellValue()); + disciplineExcelVo.setMajor(major.getStringCellValue()); + + + list.add(disciplineExcelVo); + } + } + + } + + return list; + } + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/utils/ExcelStyleUtil.java b/nakadai/src/main/java/com/huoran/nakadai/utils/ExcelStyleUtil.java new file mode 100644 index 0000000..21e8267 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/utils/ExcelStyleUtil.java @@ -0,0 +1,187 @@ +package com.huoran.nakadai.utils; + +import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity; +import cn.afterturn.easypoi.excel.entity.params.ExcelForEachParams; +import cn.afterturn.easypoi.excel.export.styler.IExcelExportStyler; +import org.apache.poi.ss.usermodel.*; + +/** + * @ProjectName: huorantech + * @Package: com.huoran.common.utils + * @ClassName: ExcelStyleUtil + * @Description: easy poi导出设置样式 + * @Author: Maureen.Rong + * @CreateDate: 2021/9/1 14:29 + * @UpdateDate: 2021/9/1 14:29 + * @Version: 1.0 + */ +public class ExcelStyleUtil implements IExcelExportStyler { + private static final short STRING_FORMAT = (short) BuiltinFormats.getBuiltinFormat("TEXT"); + private static final short FONT_SIZE_TEN = 9; + private static final short FONT_SIZE_ELEVEN = 10; + private static final short FONT_SIZE_TWELVE = 50; + + /** + * 大标题样式 + */ + private CellStyle headerStyle; + /** + * 每列标题样式 + */ + private CellStyle titleStyle; + /** + * 数据行样式 + */ + private CellStyle styles; + + public ExcelStyleUtil(Workbook workbook) { + this.init(workbook); + } + + /** + * 初始化样式 + * + * @param workbook + */ + private void init(Workbook workbook) { + this.headerStyle = initHeaderStyle(workbook); + this.titleStyle = initTitleStyle(workbook); + this.styles = initStyles(workbook); + } + + /** + * 大标题样式 + * + * @param color + * @return + */ + @Override + public CellStyle getHeaderStyle(short color) { + return headerStyle; + } + + /** + * 每列标题样式 + * + * @param color + * @return + */ + @Override + public CellStyle getTitleStyle(short color) { + return titleStyle; + } + + /** + * 数据行样式 + * + * @param parity 可以用来表示奇偶行 + * @param entity 数据内容 + * @return 样式 + */ + @Override + public CellStyle getStyles(boolean parity, ExcelExportEntity entity) { + return styles; + } + + /** + * 获取样式方法 + * + * @param dataRow 数据行 + * @param obj 对象 + * @param data 数据 + */ + @Override + public CellStyle getStyles(Cell cell, int dataRow, ExcelExportEntity entity, Object obj, Object data) { + return getStyles(true, entity); + } + + /** + * 模板使用的样式设置 + */ + @Override + public CellStyle getTemplateStyles(boolean isSingle, ExcelForEachParams excelForEachParams) { + return null; + } + + /** + * 初始化--大标题样式 + * + * @param workbook + * @return + */ + private CellStyle initHeaderStyle(Workbook workbook) { + CellStyle style = getBaseCellStyle(workbook); + style.setFont(getFont(workbook, FONT_SIZE_TWELVE, true)); + return style; + } + + /** + * 初始化--每列标题样式 + * + * @param workbook + * @return + */ + private CellStyle initTitleStyle(Workbook workbook) { + CellStyle style = getBaseCellStyle(workbook); + style.setFont(getFont(workbook, FONT_SIZE_ELEVEN, false)); + //背景色 + style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); + style.setFillPattern(FillPatternType.SOLID_FOREGROUND); + return style; + } + + /** + * 初始化--数据行样式 + * + * @param workbook + * @return + */ + private CellStyle initStyles(Workbook workbook) { + CellStyle style = getBaseCellStyle(workbook); + style.setFont(getFont(workbook, FONT_SIZE_TEN, false)); + style.setDataFormat(STRING_FORMAT); + return style; + } + + /** + * 基础样式 + * + * @return + */ + private CellStyle getBaseCellStyle(Workbook workbook) { + CellStyle style = workbook.createCellStyle(); + //下边框 + style.setBorderBottom(BorderStyle.THIN); + //左边框 + style.setBorderLeft(BorderStyle.THIN); + //上边框 + style.setBorderTop(BorderStyle.THIN); + //右边框 + style.setBorderRight(BorderStyle.THIN); + //水平居中 + style.setAlignment(HorizontalAlignment.CENTER); + //上下居中 + style.setVerticalAlignment(VerticalAlignment.CENTER); + //设置自动换行 + style.setWrapText(true); + return style; + } + + /** + * 字体样式 + * + * @param size 字体大小 + * @param isBold 是否加粗 + * @return + */ + private Font getFont(Workbook workbook, short size, boolean isBold) { + Font font = workbook.createFont(); + //字体样式 + font.setFontName("宋体"); + //是否加粗 + font.setBold(isBold); + //字体大小 + font.setFontHeightInPoints(size); + return font; + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/utils/ExceptionCast.java b/nakadai/src/main/java/com/huoran/nakadai/utils/ExceptionCast.java new file mode 100644 index 0000000..ff23f10 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/utils/ExceptionCast.java @@ -0,0 +1,14 @@ +package com.huoran.nakadai.utils; + + + +/** + * @author 世杰 + * @date 2020/3/24 23:04 + */ +public class ExceptionCast { + //使用此静态方法抛出自定义异常 + public static void cast(ResultCode resultCode) { + throw new CustomException(resultCode); + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/utils/GenerateCodeUtil.java b/nakadai/src/main/java/com/huoran/nakadai/utils/GenerateCodeUtil.java new file mode 100644 index 0000000..ebde4ca --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/utils/GenerateCodeUtil.java @@ -0,0 +1,28 @@ +package com.huoran.nakadai.utils; + +import java.util.Random; + +/** + * @Author chen + * @DATE 2022/5/19 17:43 + * @Version 1.0 + */ +public class GenerateCodeUtil { + public static String generateCode() { + String charList = "ABCDEFGHIJKLMNPQRSTUVWXY"; + String numList = "0123456789"; + String rev = ""; + int maxNumCount = 4; + int length = 6; + Random f = new Random(); + for (int i = 0; i < length; i++) { + if (f.nextBoolean() && maxNumCount > 0) { + maxNumCount--; + rev += numList.charAt(f.nextInt(numList.length())); + } else { + rev += charList.charAt(f.nextInt(charList.length())); + } + } + return rev; + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/utils/MyBatisPlusCodeGenerator.java b/nakadai/src/main/java/com/huoran/nakadai/utils/MyBatisPlusCodeGenerator.java new file mode 100644 index 0000000..0ae385c --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/utils/MyBatisPlusCodeGenerator.java @@ -0,0 +1,115 @@ +package com.huoran.nakadai.utils; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.core.toolkit.StringPool; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.baomidou.mybatisplus.generator.AutoGenerator; +import com.baomidou.mybatisplus.generator.InjectionConfig; +import com.baomidou.mybatisplus.generator.config.*; +import com.baomidou.mybatisplus.generator.config.po.TableInfo; +import com.baomidou.mybatisplus.generator.config.rules.DateType; +import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; +import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine; + +import java.util.ArrayList; +import java.util.List; + +/** + * @Author: LvFang + * @Date: Created in 2019/6/11. + * @Description: + */ +public class MyBatisPlusCodeGenerator { + + //包名 + public static final String PACKAGE_NAME = "com.huoran.nakadai"; + + public static void main(String[] args) { + String[] tables = new String[] {"professional"};//表名数组 + String[] tablePrefixs = new String[] {""};//去掉前缀 + executeCode(PACKAGE_NAME,tables,tablePrefixs); + } + + private static void executeCode(String pack,String[] tables,String[] tablePrefixs) { + // 代码生成器 + AutoGenerator mpg = new AutoGenerator(); + + // 全局配置 + GlobalConfig gc = new GlobalConfig(); + // 是否覆盖已有文件 + gc.setFileOverride(false); + // 生成文件的输出目录 + String projectPath = System.getProperty("user.dir");//user.dir 表示当前工程路径无需替换 + gc.setOutputDir(projectPath + "/nakadai/src/main/java"); + //设置bean命名规范 + gc.setEntityName("%s"); + // 开发人员 + gc.setAuthor("huoran"); + // 是否打开输出目录 + gc.setOpen(false); + // 开启 BaseResultMap + gc.setBaseResultMap(true); + // 指定生成的主键的ID类型 + gc.setIdType(IdType.ID_WORKER); + // 时间类型对应策略: 只使用 java.utils.date 代替 + gc.setDateType(DateType.ONLY_DATE); + mpg.setGlobalConfig(gc); + + // 数据源配置 + DataSourceConfig config= new DataSourceConfig(); + // 从试图获取 + config.setUrl("jdbc:mysql://rm-wz9y13wf7u8q8610fwo.mysql.rds.aliyuncs.com:3306/nakadai?serverTimezone=UTC"); + config.setDriverName("com.mysql.cj.jdbc.Driver"); + config.setUsername("super"); + config.setPassword("huoran888"); + mpg.setDataSource(config); + + // 包配置 + PackageConfig pc = new PackageConfig(); + // 父包名。如果为空,将下面子包名必须写全部, 否则就只需写子包名 + pc.setParent(pack); + // Entity包名 + pc.setEntity("entity"); + mpg.setPackageInfo(pc); + + // 自定义配置 + InjectionConfig cfg = new InjectionConfig() { + @Override + public void initMap() { + // to do nothing + } + }; + List focList = new ArrayList<>(); + focList.add(new FileOutConfig("/templates/mapper.xml.ftl") { + public String outputFile(TableInfo tableInfo) { + // 自定义输入文件名称 + if (StringUtils.isEmpty(pc.getModuleName())) { + return projectPath + "/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/" + tableInfo.getXmlName() + StringPool.DOT_XML; + }else { + return projectPath + "/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/" + pc.getModuleName() + "/" + tableInfo.getXmlName() + StringPool.DOT_XML; + } + } + }); + cfg.setFileOutConfigList(focList); + mpg.setCfg(cfg); + mpg.setTemplate(new TemplateConfig().setXml(null)); + + // 策略配置 + StrategyConfig strategy = new StrategyConfig(); + // 数据库表映射到实体的命名策略: 下划线转驼峰命名 + strategy.setNaming(NamingStrategy.underline_to_camel); + // 数据库表字段映射到实体的命名策略: 下划线转驼峰命名 + strategy.setColumnNaming(NamingStrategy.underline_to_camel); + // 【实体】是否为lombok模型(默认 false) + strategy.setEntityLombokModel(true); + // 需要包含的表名,允许正则表达式(与exclude二选一配置) + strategy.setInclude(tables); + // 驼峰转连字符 + strategy.setControllerMappingHyphenStyle(false); + // 表前缀 + strategy.setTablePrefix(tablePrefixs); + mpg.setStrategy(strategy); + mpg.setTemplateEngine(new FreemarkerTemplateEngine()); + mpg.execute(); + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/utils/QrCodeUtil.java b/nakadai/src/main/java/com/huoran/nakadai/utils/QrCodeUtil.java new file mode 100644 index 0000000..05ecd5d --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/utils/QrCodeUtil.java @@ -0,0 +1,121 @@ +package com.huoran.nakadai.utils; + +import com.google.zxing.*; +import com.google.zxing.client.j2se.BufferedImageLuminanceSource; +import com.google.zxing.client.j2se.MatrixToImageWriter; +import com.google.zxing.common.BitMatrix; +import com.google.zxing.common.HybridBinarizer; +import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; + +import javax.imageio.ImageIO; +import javax.servlet.http.HttpServletResponse; +import java.awt.image.BufferedImage; +import java.io.File; +import java.util.Hashtable; +import java.util.Map; + +/** * + * @Author chen + * @DATE 2022/5/23 10:13 + * @Version 1.0 + * 二维码生成工具类 + */ +public class QrCodeUtil { + + /** + * 生成二维码 + * David + * @param url url 网址 + * @param response 生成的二维码url: 路径+文件名 + */ + public static void encode(String url, HttpServletResponse response) { + int width = 500; int height = 500; + + Map hints = new Hashtable(); + + // 指定纠错等级 + + hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.L); + + // 指定编码格式 + + hints.put(EncodeHintType.CHARACTER_SET, "UTF8"); + + response.setContentType(MediaType.IMAGE_PNG_VALUE); + response.setHeader(HttpHeaders.PRAGMA, "No-cache"); + response.setHeader(HttpHeaders.CACHE_CONTROL, "No-cache"); + response.setDateHeader(HttpHeaders.EXPIRES, 0L); + + try { + + BitMatrix bitMatrix = new MultiFormatWriter().encode(url, BarcodeFormat.QR_CODE, width, height, hints); + + // MatrixToImageWriter.writeToStream(bitMatrix, "png", new FileOutputStream(imgPath)); + + MatrixToImageWriter.writeToStream(bitMatrix, "png", response.getOutputStream());// 输出图像 + + + } catch (Exception e) { + + e.printStackTrace(); + + } + + } + + + /** + * 二维码解析 + * @param imgPath 二维码图片 路径+文件名 + * @return 解析后的二维码内容 + */ + + public static String decode(String imgPath) { + + BufferedImage image = null; + + Result result = null; + + try { + + image = ImageIO.read(new File(imgPath)); + + if (image == null) { + + return "the decode image may be not exit"; + + } + + LuminanceSource source = new BufferedImageLuminanceSource(image); + + BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source)); + + Map hints = new Hashtable(); + + hints.put(DecodeHintType.CHARACTER_SET, "UTF8"); + + result = new MultiFormatReader().decode(bitmap, hints); + + return result.getText(); + + } catch (Exception e) { + + e.printStackTrace(); + + } + + return null; + + } + + // 测试代码 + public static void main( String[] args ){ + + // QrCodeUtil.encode("http://www.dataforward.cn/", ); +// System.out.println(QrCodeUtil.decode("D:\\David\\QrCode\\QrCode1.png")); + + } + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/utils/RelativeNumberFormatTool.java b/nakadai/src/main/java/com/huoran/nakadai/utils/RelativeNumberFormatTool.java new file mode 100644 index 0000000..016d7bb --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/utils/RelativeNumberFormatTool.java @@ -0,0 +1,121 @@ +package com.huoran.nakadai.utils; + +import lombok.Data; +import lombok.extern.slf4j.Slf4j; + +import java.math.BigDecimal; + +/** + * 数字转换 千、万、k、w、9999W+ + * + * @author xysddjyt + * @date 2019/11/08 16:34:27 + */ +@Data +@Slf4j +public class RelativeNumberFormatTool { + + /** + * 中文显示 + */ + public static final String CH = "CH"; + /** + * 拼音显示 + */ + public static final String PY = "PY"; + + private static final Long ONE_HUNDRED = 100L; + + private static final Long THOUSAND = 1000L; + private static final Long TEN_THOUSAND = 10000L; + private static final Long ONE_HUNDRED_MILLION = 100000000L; + + /** + * 数据转换 + * + * @param num 需要转换的数据 支持Long、BigDecimal、Integer、String、int、long类型 + * @param type 需要转换的方式 RelativeNumberFormatTool.CH:中文显示 RelativeNumberFormatTool.PY:拼音显示 + * @return + */ + public static String relativeNumberFormat(Object temp, String type) { + Long num = numberFormat(temp); + if (null == num) { + return temp + ""; + } + if (type.equals(PY)) { + if (num.compareTo(ONE_HUNDRED_MILLION) == 1 || num.compareTo(ONE_HUNDRED_MILLION) == 0) { + return "9999W+"; + } + if (num.compareTo(TEN_THOUSAND) == 1 || num.compareTo(TEN_THOUSAND) == 0) { + return num / TEN_THOUSAND + "w+"; + } + if (num.compareTo(THOUSAND) == 1 || num.compareTo(THOUSAND) == 0) { + return num / THOUSAND + "k+"; + } + + if (num.compareTo(ONE_HUNDRED) == 1 || num.compareTo(ONE_HUNDRED) == 0) { + return num + "+"; + } + + + } else if (type.equals(CH)) { + if (num.compareTo(ONE_HUNDRED_MILLION) == 1 || num.compareTo(ONE_HUNDRED_MILLION) == 0) { + return "9999万+"; + } + if (num.compareTo(TEN_THOUSAND) == 1 || num.compareTo(TEN_THOUSAND) == 0) { + return num / TEN_THOUSAND + "万+"; + } + if (num.compareTo(THOUSAND) == 1 || num.compareTo(THOUSAND) == 0) { + return num / THOUSAND + "千+"; + } + } + return num + ""; + } + + /** + * 格式化数据为Long类型 + */ + public static Long numberFormat(Object number) { + if (number != null && !"".equals(number)) { + if (number instanceof BigDecimal) { + return ((BigDecimal) number).longValue(); + } + if (number instanceof Integer) { + return ((Integer) number).longValue(); + } + if (number instanceof Long) { + return (Long) number; + } + if (number instanceof String) { + try { + return Long.valueOf(number + ""); + } catch (Exception e) { + log.info("字符串数字转换失败,请检查!" + e.getMessage(), e); + } + } + } + return null; + } + + public static void main(String[] args) { + BigDecimal a = new BigDecimal(199.54); + /* int c = 8350; + Integer c1 = 1000000; + String str = "1000"; + long bb = 13544l; + Long bb1 = 3624l;*/ + + System.out.println(relativeNumberFormat(a, CH)); + /*System.out.println(relativeNumberFormat(c, CH)); + System.out.println(relativeNumberFormat(c1, CH)); + System.out.println(relativeNumberFormat(str, CH)); + System.out.println(relativeNumberFormat(bb, CH)); + System.out.println(relativeNumberFormat(bb1, CH));*/ + System.out.println(relativeNumberFormat(a, PY)); + /* System.out.println(relativeNumberFormat(c, PY)); + System.out.println(relativeNumberFormat(c1, PY)); + System.out.println(relativeNumberFormat(str, PY)); + System.out.println(relativeNumberFormat(bb, PY)); + System.out.println(relativeNumberFormat(bb1, PY));*/ + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/utils/ResultCode.java b/nakadai/src/main/java/com/huoran/nakadai/utils/ResultCode.java new file mode 100644 index 0000000..ddcb238 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/utils/ResultCode.java @@ -0,0 +1,21 @@ +package com.huoran.nakadai.utils; + +/** + * Created by mrt on 2018/3/5. + * 10000-- 通用错误代码 + * 22000-- 媒资错误代码 + * 23000-- 用户中心错误代码 + * 24000-- cms错误代码 + * 25000-- 文件系统 + */ +public interface ResultCode { + //操作是否成功,true为成功,false操作失败 + boolean success(); + + //操作代码 + int code(); + + //提示信息 + String message(); + +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/utils/RunCodeHelperUtil.java b/nakadai/src/main/java/com/huoran/nakadai/utils/RunCodeHelperUtil.java new file mode 100644 index 0000000..45afaf6 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/utils/RunCodeHelperUtil.java @@ -0,0 +1,181 @@ +package com.huoran.nakadai.utils; + +import com.huoran.common.entity.PythonCodeResp; +import com.huoran.common.utils.DeleteFilesUtil; +import com.huoran.nakadai.config.EnvironmentConfig; +import lombok.extern.slf4j.Slf4j; + +import java.io.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * 运行python文件工具类 + * + * @author 或然 + */ +@Slf4j +public class RunCodeHelperUtil { + + /** + * 生成文件到本地 + * + * @param path:路径 + * @param data:数据 + */ + private static void writeFile(String path, byte[] data) { + FileOutputStream fos = null; + try { + //注意这里一定要写到文件名为止 + File file = new File(path); + if (!file.exists()) { + file.getParentFile().mkdir(); + file.createNewFile(); + } + fos = new FileOutputStream(new File(path)); + fos.write(data); + } catch (IOException e) { + e.printStackTrace(); + } finally { + try { + if (fos != null) { + fos.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + /** + * 运行python脚本,接收它的运行信息 + * + * @param + * @return + */ + public static PythonCodeResp runPython(String code) { + PythonCodeResp resp = new PythonCodeResp(); + //判断代码中是否包含某个函数 包含则抛出异常 + if (code.contains("os.system") || + code.contains("os.popen") || + code.contains("commands.getstatusoutput") || + code.contains("subprocess.Popen") || + code.contains("subprocess.run")) { + return null; + } + InputStream input = null; + BufferedReader in = null; + //将代码转成字节数组 + byte[] data = code.getBytes(); + //生成本地路径 + String objectName = EnvironmentConfig.pythonURL + "python" + System.currentTimeMillis() + ".py";//测试服 + //生成文件到本地 + writeFile(objectName, data); + //接受python脚本运行结果 + StringBuffer buff = new StringBuffer(); + + Process process; + try { + process = Runtime.getRuntime().exec("python " + objectName); + int ztm = process.waitFor(); + String result = null; + + if (ztm == 0) { + input = process.getInputStream(); //正确返回值 + resp.setRetResult(1);//retResult:返回结果(1为正确 0为错误) + if (code.contains(".savefig(")) { + String url = checkCode(code); + if (url != null && !url.equals("输入的路径有误")) { + resp.setPhotoUrl(url); + } + + } + } else { + input = process.getErrorStream(); //错误返回值 + resp.setRetResult(0); + } + + in = new BufferedReader(new InputStreamReader(input, EnvironmentConfig.coding)); + //一行一行读取 + while ((result = in.readLine()) != null) { + buff.append(result); + buff.append("\n"); + } + resp.setRunResult(buff.toString()); + } catch (IOException | InterruptedException e) { + e.printStackTrace(); + } finally { + try { + if (in != null) { + in.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + try { + if (input != null) { + input.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + + //运行后删除python脚本文件 + DeleteFilesUtil.deleteFile(objectName); + return resp; + + } + + private static void writeFile1(String code, String fileName) { + FileWriter writer; + try { + writer = new FileWriter(fileName); + writer.write(code); + writer.flush(); + writer.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + /** + * @Description : 校验输入的代码是否存在 + * @Param str + * @Author Rong---2021/12/14 + */ + public static String checkCode(String str) { + if (str.contains(".savefig(")) { + String url = checkRegular(str); + String servicePath = EnvironmentConfig.projectImgUrl; + //String servicePath = "http://www.occupationlab.com/python/"; + + //本地地址 + // String servicePath = "http://localhost:9100/nakadai/static/"; + String returnUrl = ""; + for (String path : url.split("\t")) { + returnUrl += servicePath + path + ","; + } + return returnUrl.substring(0, returnUrl.length() - 1); + } + return null; + + } + + public static String checkRegular(String str) { + Pattern p = Pattern.compile("plt\\.savefig\\((\\\".*?\\\")\\)"); + Matcher m = p.matcher(str); + String url = ""; + while (m.find()) { + String quStr = m.group(); + String quStr1 = quStr.substring(quStr.indexOf("\"") + 1, quStr.lastIndexOf("\"")); + System.out.println(quStr1); + url += quStr1 + "\t"; + } + System.out.println("返回总:" + url.substring(0, url.length() - 1)); + return url.substring(0, url.length() - 1); + } +} + + + diff --git a/nakadai/src/main/java/com/huoran/nakadai/utils/SentinelConfig.java b/nakadai/src/main/java/com/huoran/nakadai/utils/SentinelConfig.java new file mode 100644 index 0000000..f81e76b --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/utils/SentinelConfig.java @@ -0,0 +1,32 @@ +package com.huoran.nakadai.utils; + + +import com.alibaba.fastjson.JSON; +import com.huoran.common.exception.ExceptionEnum; +import com.huoran.common.response.R; +import org.springframework.context.annotation.Configuration; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * @Author chen + * @DATE 2022/2/10 18:04 + * @Version 1.0 + */ +/*@Configuration +public class SentinelConfig { + + public SentinelConfig() { + WebCallbackManager.setUrlBlockHandler(new UrlBlockHandler() { + @Override + public void blocked(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, BlockException e) throws IOException { + R error = R.error(ExceptionEnum.TOO_MANY_REQUEST); + httpServletResponse.setCharacterEncoding("UTF-8"); + httpServletResponse.setContentType("application/json"); + httpServletResponse.getWriter().write(JSON.toJSONString(error)); + } + }); + } +}*/ diff --git a/nakadai/src/main/java/com/huoran/nakadai/utils/WeChatPropertiesUtil.java b/nakadai/src/main/java/com/huoran/nakadai/utils/WeChatPropertiesUtil.java new file mode 100644 index 0000000..041fc99 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/utils/WeChatPropertiesUtil.java @@ -0,0 +1,52 @@ +package com.huoran.nakadai.utils; + +import org.springframework.beans.factory.InitializingBean; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +/** + * @Author chen + * @DATE 2020/9/8 13:57 + * @Version 1.0 + */ +@Component +public class WeChatPropertiesUtil implements InitializingBean { + + @Value("${partner.wxopen.appid}") + private String partnerAppId; + + @Value("${partner.wxopen.appsecret}") + private String partnerAppSecret; + + @Value("${partner.wxopen.redirect_url}") + private String partnerRedirectUrl; + + + @Value("${operation.wxopen.appid}") + private String operationAppId; + + @Value("${operation.wxopen.appsecret}") + private String operationAppSecret; + + @Value("${operation.wxopen.redirect_url}") + private String operationRedirectUrl; + + public static String PARTNER_WX_OPEN_APP_ID; + public static String PARTNER_WX_OPEN_APP_SECRET; + public static String PARTNER_WX_OPEN_REDIRECT_URL; + + + public static String OPERATION_WX_OPEN_APP_ID; + public static String OPERATION_WX_OPEN_APP_SECRET; + public static String OPERATION_WX_OPEN_REDIRECT_URL; + + @Override + public void afterPropertiesSet() throws Exception { + PARTNER_WX_OPEN_APP_ID = partnerAppId; + PARTNER_WX_OPEN_APP_SECRET = partnerAppSecret; + PARTNER_WX_OPEN_REDIRECT_URL = partnerRedirectUrl; + OPERATION_WX_OPEN_APP_ID = operationAppId; + OPERATION_WX_OPEN_APP_SECRET = operationAppSecret; + OPERATION_WX_OPEN_REDIRECT_URL = operationRedirectUrl; + } +} diff --git a/nakadai/src/main/java/com/huoran/nakadai/utils/WeChatUtil.java b/nakadai/src/main/java/com/huoran/nakadai/utils/WeChatUtil.java new file mode 100644 index 0000000..cdba470 --- /dev/null +++ b/nakadai/src/main/java/com/huoran/nakadai/utils/WeChatUtil.java @@ -0,0 +1,148 @@ +package com.huoran.nakadai.utils; + +import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; +import com.huoran.nakadai.entity.vo.WxMssVo; +import org.apache.http.HttpEntity; +import org.apache.http.HttpResponse; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.util.EntityUtils; + +import javax.net.ssl.HttpsURLConnection; +import java.io.*; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.Map; +import java.util.Set; + +public class WeChatUtil { + public static String httpRequest(String requestUrl,String requestMethod,String output){ + try{ + URL url = new URL(requestUrl); + HttpsURLConnection connection = (HttpsURLConnection) url.openConnection(); + connection.setDoOutput(true); + connection.setDoInput(true); + connection.setUseCaches(false); + if(null != output){ + OutputStream outputStream = connection.getOutputStream(); + outputStream.write(output.getBytes("utf-8")); + outputStream.close(); + } + // 从输入流读取返回内容 + InputStream inputStream = connection.getInputStream(); + InputStreamReader inputStreamReader = new InputStreamReader(inputStream, "utf-8"); + BufferedReader bufferedReader = new BufferedReader(inputStreamReader); + String str = null; + StringBuffer buffer = new StringBuffer(); + while ((str = bufferedReader.readLine()) != null){ + buffer.append(str); + } + bufferedReader.close(); + inputStreamReader.close(); + inputStream.close(); + inputStream = null; + connection.disconnect(); + return buffer.toString(); + }catch(Exception e){ + e.printStackTrace(); + } + return ""; + } + + /** + * 根据AppID和AppSecret获取最新可用的AccessToken + * @return + */ + public static String getAccessToken() throws IOException { +// https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET +// String appid = PropUtils.getProp("APPID"); +// String appsecret = PropUtils.getProp("APPSECRET"); + // 微信小程序ID + String appid = WeChatPropertiesUtil.PARTNER_WX_OPEN_APP_ID; + // 微信小程序秘钥 + String appsecret =WeChatPropertiesUtil.PARTNER_WX_OPEN_APP_SECRET; + + //构建url,用于向微信服务器请求用户的openId + StringBuffer url = new StringBuffer("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&"); + url.append("appid=").append(appid) + .append("&secret=").append(appsecret); + + //向微信的服务器发送Get请求 + HttpClient client = HttpClientBuilder.create().build(); + HttpGet httpGet = new HttpGet(url.toString()); + HttpResponse httpResponse = client.execute(httpGet); + HttpEntity result = httpResponse.getEntity(); + String resultStr = EntityUtils.toString(result); + System.out.println(resultStr); + JSONObject resultJsonObject = JSONUtil.parseObj(resultStr); + String accessToken = (String) resultJsonObject.get("access_token"); + return accessToken; + } + + //发送模板消息 + public static String sendTemplateMessage(WxMssVo wxMssVo) { + String info = ""; + try { + //创建连接 + URL url = new URL(wxMssVo.getRequest_url()); + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + connection.setDoOutput(true); + connection.setDoInput(true); + connection.setRequestMethod("POST"); + connection.setUseCaches(false); + connection.setInstanceFollowRedirects(true); + connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); + connection.setRequestProperty("Content-Type", "utf-8"); + connection.connect(); + + //POST请求 + DataOutputStream out = new DataOutputStream(connection.getOutputStream()); + JSONObject obj = new JSONObject(); + + //设置参数 + //不可缺失 缺失会出现invalid openid rid + //putOpt 等效于当两个参数都为非空时;除此之外什么都不做。put(name, value) + obj.putOpt("touser", wxMssVo.getTouser()); + //不可缺失 缺失出现invalid template_id + obj.putOpt("template_id", wxMssVo.getTemplate_id()); + obj.putOpt("page", wxMssVo.getPage()); + + JSONObject jsonObject = new JSONObject(); + + //发送自定义数据 + Set> entries = wxMssVo.getMap().entrySet(); + + for (Map.Entryentry:entries){ + + JSONObject dataInfo = new JSONObject(); + dataInfo.putOpt("value", entry.getValue()); + jsonObject.putOpt(entry.getKey(), dataInfo); + } + obj.putOpt("data", jsonObject); + + System.out.println(obj.toString()); + out.write(obj.toString().getBytes()); + out.flush(); + out.close(); + + //读取响应 + BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); + String lines; + StringBuffer sb = new StringBuffer(""); + while ((lines = reader.readLine()) != null) { + lines = new String(lines.getBytes(), "utf-8"); + sb.append(lines); + } + info = sb.toString(); + System.out.println(sb); + reader.close(); + // 断开连接 + connection.disconnect(); + } catch (Exception e) { + e.printStackTrace(); + } + return info; + } +} diff --git a/nakadai/src/main/resources/bootstrap.properties b/nakadai/src/main/resources/bootstrap.properties new file mode 100644 index 0000000..86b8cc3 --- /dev/null +++ b/nakadai/src/main/resources/bootstrap.properties @@ -0,0 +1,41 @@ +spring.application.name=nakadai + +#addr +spring.cloud.nacos.config.server-addr=127.0.0.1:8848 + +#namespace +spring.cloud.nacos.config.namespace=kindergarten-microservice-configuration-namespace + + +#合伙人微信小程序配置 +partner.wxopen.appid=wx2b506fdb0eeee65d +partner.wxopen.appsecret=d14ccc2f188e6e64a263086f91dfa71c +#wxopen.redirect_url=http://www.occupationlab.com/apiHrmsAuth/hrms/auth/userlogin/user/callback +partner.wxopen.redirect_url=http://192.168.31.116:9000/apiHrmsAuth/hrms/auth/userlogin/user/callback + +#运营微信小程序配置 +operation.wxopen.appid=wx88cd6037d54f230a +operation.wxopen.appsecret=82c18212b17bf8b2fa17c680feb5b012 +operation.wxopen.redirect_url=http://192.168.31.116:9000/apiHrmsAuth/hrms/auth/userlogin/user/callback + +spring.mail.host=smtp.qq.com +spring.mail.port=587 +spring.mail.username=1251790704@qq.com +spring.mail.password=tgbteukyosdnhadh +spring.mail.default-encoding=UTF-8 +spring.mail.properties.mail.smtp.socketFactoryClass=javax.net.ssl.SSLSocketFactory +spring.mail.properties.mail.debug=true +spring.mail.from=1251790704@qq.com + +#email.url=D:/copyWriting/ + +#以下是补充配置 +spring.datasource.type=com.zaxxer.hikari.HikariDataSource +spring.datasource.hikari.minimum-idle=5 +spring.datasource.hikari.maximum-pool-size=15 +spring.datasource.hikari.auto-commit=true +spring.datasource.hikari.idle-timeout=30000 +spring.datasource.hikari.pool-name=DatebookHikariCP +spring.datasource.hikari.max-lifetime=500000 +spring.datasource.hikari.connection-timeout=30000 +spring.datasource.hikari.connection-test-query=SELECT 1 diff --git a/nakadai/src/main/resources/logback-spring.xml b/nakadai/src/main/resources/logback-spring.xml new file mode 100644 index 0000000..0d29c0f --- /dev/null +++ b/nakadai/src/main/resources/logback-spring.xml @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + %red(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green(%-5level) [%thread] %highlight(%logger{50}) - %cyan(%msg%n) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/nakadai/src/main/resources/sensitive/censorword.txt b/nakadai/src/main/resources/sensitive/censorword.txt new file mode 100644 index 0000000..c95cebc --- /dev/null +++ b/nakadai/src/main/resources/sensitive/censorword.txt @@ -0,0 +1,1173 @@ +爱女人 +爱液 +按摩棒 +拔出来 +爆草 +包二奶 +暴干 +暴奸 +暴乳 +爆乳 +暴淫 +屄 +被操 +被插 +被干 +逼奸 +仓井空 +插暴 +操逼 +操黑 +操烂 +肏你 +肏死 +操死 +操我 +厕奴 +插比 +插b +插逼 +插进 +插你 +插我 +插阴 +潮吹 +潮喷 +成人dv +成人电影 +成人论坛 +成人小说 +成人电 +成人电影 +成人卡通 +成人聊 +成人片 +成人视 +成人图 +成人文 +成人小 +成人电影 +成人论坛 +成人色情 +成人网站 +成人文学 +成人小说 +艳情小说 +成人游戏 +吃精 +赤裸 +抽插 +扌由插 +抽一插 +春药 +大波 +大力抽送 +大乳 +荡妇 +荡女 +盗撮 +多人轮 +发浪 +放尿 +肥逼 +粉穴 +封面女郎 +风月大陆 +干死你 +干穴 +肛交 +肛门 +龟头 +裹本 +国产av +好嫩 +豪乳 +黑逼 +后庭 +后穴 +虎骑 +花花公子 +换妻俱乐部 +黄片 +几吧 +鸡吧 +鸡巴 +鸡奸 +寂寞男 +寂寞女 +妓女 +激情 +集体淫 +奸情 +叫床 +脚交 +金鳞岂是池中物 +金麟岂是池中物 +精液 +就去日 +巨屌 +菊花洞 +菊门 +巨奶 +巨乳 +菊穴 +开苞 +口爆 +口活 +口交 +口射 +口淫 +裤袜 +狂操 +狂插 +浪逼 +浪妇 +浪叫 +浪女 +狼友 +聊性 +流淫 +铃木麻 +凌辱 +漏乳 +露b +乱交 +乱伦 +轮暴 +轮操 +轮奸 +裸陪 +买春 +美逼 +美少妇 +美乳 +美腿 +美穴 +美幼 +秘唇 +迷奸 +密穴 +蜜穴 +蜜液 +摸奶 +摸胸 +母奸 +奈美 +奶子 +男奴 +内射 +嫩逼 +嫩女 +嫩穴 +捏弄 +女优 +炮友 +砲友 +喷精 +屁眼 +品香堂 +前凸后翘 +强jian +强暴 +强奸处女 +情趣用品 +情色 +拳交 +全裸 +群交 +惹火身材 +人妻 +人兽 +日逼 +日烂 +肉棒 +肉逼 +肉唇 +肉洞 +肉缝 +肉棍 +肉茎 +肉具 +揉乳 +肉穴 +肉欲 +乳爆 +乳房 +乳沟 +乳交 +乳头 +三级片 +骚逼 +骚比 +骚女 +骚水 +骚穴 +色逼 +色界 +色猫 +色盟 +色情网站 +色区 +色色 +色诱 +色欲 +色b +少年阿宾 +少修正 +射爽 +射颜 +食精 +释欲 +兽奸 +兽交 +手淫 +兽欲 +熟妇 +熟母 +熟女 +爽片 +爽死我了 +双臀 +死逼 +丝袜 +丝诱 +松岛枫 +酥痒 +汤加丽 +套弄 +体奸 +体位 +舔脚 +舔阴 +调教 +偷欢 +偷拍 +推油 +脱内裤 +文做 +我就色 +无码 +舞女 +无修正 +吸精 +夏川纯 +相奸 +小逼 +校鸡 +小穴 +小xue +写真 +性感妖娆 +性感诱惑 +性虎 +性饥渴 +性技巧 +性交 +性奴 +性虐 +性息 +性欲 +胸推 +穴口 +学生妹 +穴图 +亚情 +颜射 +阳具 +杨思敏 +要射了 +夜勤病栋 +一本道 +一夜欢 +一夜情 +一ye情 +阴部 +淫虫 +阴唇 +淫荡 +阴道 +淫电影 +阴阜 +淫妇 +淫河 +阴核 +阴户 +淫贱 +淫叫 +淫教师 +阴茎 +阴精 +淫浪 +淫媚 +淫糜 +淫魔 +淫母 +淫女 +淫虐 +淫妻 +淫情 +淫色 +淫声浪语 +淫兽学园 +淫书 +淫术炼金士 +淫水 +淫娃 +淫威 +淫亵 +淫样 +淫液 +淫照 +阴b +应召 +幼交 +幼男 +幼女 +欲火 +欲女 +玉女心经 +玉蒲团 +玉乳 +欲仙欲死 +玉穴 +援交 +原味内衣 +援助交际 +张筱雨 +招鸡 +招妓 +中年美妇 +抓胸 +自拍 +自慰 +作爱 +18禁 +99bb +a4u +a4y +adult +amateur +anal +a片 +fuck +gay片 +g点 +g片 +hardcore +h动画 +h动漫 +incest +porn +secom +sexinsex +sm女王 +xiao77 +xing伴侣 +tokyohot +yin荡 +贱人 +装b +大sb +傻逼 +傻b +煞逼 +煞笔 +刹笔 +傻比 +沙比 +欠干 +婊子养的 +我日你 +我操 +我草 +卧艹 +卧槽 +爆你菊 +艹你 +cao你 +你他妈 +真他妈 +别他吗 +草你吗 +草你丫 +操你妈 +擦你妈 +操你娘 +操他妈 +日你妈 +干你妈 +干你娘 +娘西皮 +狗操 +狗草 +狗杂种 +狗日的 +操你祖宗 +操你全家 +操你大爷 +妈逼 +你麻痹 +麻痹的 +妈了个逼 +马勒 +狗娘养 +贱比 +贱b +下贱 +死全家 +全家死光 +全家不得好死 +全家死绝 +白痴 +无耻 +sb +杀b +你吗b +你妈的 +婊子 +贱货 +人渣 +混蛋 +媚外 +和弦 +兼职 +限量 +铃声 +性伴侣 +男公关 +火辣 +精子 +射精 +诱奸 +强奸 +做爱 +性爱 +发生关系 +按摩 +快感 +处男 +猛男 +少妇 +屌 +屁股 +下体 +a片 +内裤 +浑圆 +咪咪 +发情 +刺激 +白嫩 +粉嫩 +兽性 +风骚 +呻吟 +sm +阉割 +高潮 +裸露 +不穿 +一丝不挂 +脱光 +干你 +干死 +我干 +裙中性运动 +乱奸 +乱伦 +乱伦类 +乱伦小 +伦理大 +伦理电影 +伦理毛 +伦理片 +裸聊 +裸聊网 +裸体写真 +裸舞视 +裸照 +美女裸体 +美女写真 +美女上门 +美艳少妇 +妹按摩 +妹上门 +迷幻药 +迷幻藥 +迷昏口 +迷昏药 +迷昏藥 +迷魂香 +迷魂药 +迷魂藥 +迷奸粉 +迷奸药 +迷情粉 +迷情水 +迷情药 +迷药 +迷藥 +谜奸药 +骚妇 +骚货 +骚浪 +骚女 +骚嘴 +色电影 +色妹妹 +色情表演 +色情电影 +色情服务 +色情图片 +色情小说 +色情影片 +色情表演 +色情电影 +色情服务 +色情片 +色视频 +色小说 +性伴侣 +性服务 +性福情 +性感少 +性伙伴 +性交 +性交视频 +性交图片 +性奴 +性奴集中营 +性虐 +阴唇 +阴道 +阴蒂 +阴户 +阴间来电 +阴茎 +阴茎增大 +阴茎助勃 +阴毛 +陰唇 +陰道 +陰戶 +淫荡 +淫荡美女 +淫荡视频 +淫荡照片 +淫乱 +淫靡 +淫魔 +淫魔舞 +淫女 +淫情女 +淫肉 +淫騷妹 +淫兽 +淫兽学 +淫水 +淫穴 +morphine +摇头丸 +迷药 +乖乖粉 +narcotic +麻醉药 +精神药品 +爱女人 +爱液 +按摩棒 +拔出来 +爆草 +包二奶 +暴干 +暴奸 +暴乳 +爆乳 +暴淫 +屄 +被操 +被插 +被干 +逼奸 +仓井空 +插暴 +操逼 +操黑 +操烂 +肏你 +肏死 +操死 +操我 +厕奴 +插比 +插b +插逼 +插进 +插你 +插我 +插阴 +潮吹 +潮喷 +成人电影 +成人论坛 +成人色情 +成人网站 +成人文学 +成人小说 +艳情小说 +成人游戏 +吃精 +赤裸 +抽插 +扌由插 +抽一插 +春药 +大波 +大力抽送 +大乳 +荡妇 +荡女 +盗撮 +多人轮 +发浪 +放尿 +肥逼 +粉穴 +封面女郎 +风月大陆 +干死你 +干穴 +肛交 +肛门 +龟头 +裹本 +国产av +好嫩 +豪乳 +黑逼 +后庭 +后穴 +虎骑 +花花公子 +换妻俱乐部 +黄片 +几吧 +鸡吧 +鸡巴 +鸡奸 +寂寞男 +寂寞女 +妓女 +激情 +集体淫 +奸情 +叫床 +脚交 +金鳞岂是池中物 +金麟岂是池中物 +精液 +就去日 +巨屌 +菊花洞 +菊门 +巨奶 +巨乳 +菊穴 +开苞 +口爆 +口活 +口交 +口射 +口淫 +裤袜 +狂操 +狂插 +浪逼 +浪妇 +浪叫 +浪女 +狼友 +聊性 +流淫 +铃木麻 +凌辱 +漏乳 +露b +乱交 +乱伦 +轮暴 +轮操 +轮奸 +裸陪 +买春 +美逼 +美少妇 +美乳 +美腿 +美穴 +美幼 +秘唇 +迷奸 +密穴 +蜜穴 +蜜液 +摸奶 +摸胸 +母奸 +奈美 +奶子 +男奴 +内射 +嫩逼 +嫩女 +嫩穴 +捏弄 +女优 +炮友 +砲友 +喷精 +屁眼 +品香堂 +前凸后翘 +强jian +强暴 +强奸处女 +情趣用品 +情色 +拳交 +全裸 +群交 +惹火身材 +人妻 +人兽 +日逼 +日烂 +肉棒 +肉逼 +肉唇 +肉洞 +肉缝 +肉棍 +肉茎 +肉具 +揉乳 +肉穴 +肉欲 +乳爆 +乳房 +乳沟 +乳交 +乳头 +三级片 +骚逼 +骚比 +骚女 +骚水 +骚穴 +色逼 +色界 +色猫 +色盟 +色情网站 +色区 +色色 +色诱 +色欲 +色b +少年阿宾 +少修正 +射爽 +射颜 +食精 +释欲 +兽奸 +兽交 +手淫 +兽欲 +熟妇 +熟母 +熟女 +爽片 +爽死我了 +双臀 +死逼 +丝袜 +丝诱 +松岛枫 +酥痒 +汤加丽 +套弄 +体奸 +体位 +舔脚 +舔阴 +调教 +偷欢 +偷拍 +推油 +脱内裤 +文做 +我就色 +无码 +舞女 +无修正 +吸精 +夏川纯 +相奸 +小逼 +校鸡 +小穴 +小xue +写真 +性感妖娆 +性感诱惑 +性虎 +性饥渴 +性技巧 +性交 +性奴 +性虐 +性息 +性欲 +胸推 +穴口 +学生妹 +穴图 +亚情 +颜射 +阳具 +杨思敏 +要射了 +夜勤病栋 +一本道 +一夜欢 +一夜情 +一ye情 +阴部 +淫虫 +阴唇 +淫荡 +阴道 +淫电影 +阴阜 +淫妇 +淫河 +阴核 +阴户 +淫贱 +淫叫 +淫教师 +阴茎 +阴精 +淫浪 +淫媚 +淫糜 +淫魔 +淫母 +淫女 +淫虐 +淫妻 +淫情 +淫色 +淫声浪语 +淫兽学园 +淫书 +淫术炼金士 +淫水 +淫娃 +淫威 +淫亵 +淫样 +淫液 +淫照 +阴b +应召 +幼交 +幼男 +幼女 +欲火 +欲女 +玉女心经 +玉蒲团 +玉乳 +欲仙欲死 +玉穴 +援交 +原味内衣 +援助交际 +张筱雨 +招鸡 +招妓 +中年美妇 +抓胸 +自拍 +自慰 +作爱 +18禁 +99bb +a4u +a4y +adult +amateur +anal +a片 +fuck +gay片 +g点 +g片 +hardcore +h动画 +h动漫 +incest +porn +secom +sexinsex +sm女王 +xiao77 +xing伴侣 +tokyohot +yin荡 +腐败 +贪污 +gcd +共贪党 +gongchandang +阿共 +共一产一党 +产党共 +公产党 +工产党 +共c党 +共x党 +共铲 +供产 +共惨 +供铲党 +供铲谠 +供铲裆 +共残党 +共残主义 +共产主义的幽灵 +拱铲 +老共 +中珙 +中gong +gc党 +贡挡 +gong党 +g产 +狗产蛋 +共残裆 +恶党 +邪党 +共产专制 +共产王朝 +裆中央 +土共 +土g +共狗 +g匪 +共匪 +仇共 +共产党腐败 +共产党专制 +共产党的报应 +共产党的末日 +共产党专制 +communistparty +症腐 +政腐 +政付 +正府 +政俯 +政f +zhengfu +政zhi +挡中央 +档中央 +中国zf +中央zf +国wu院 +中华帝国 +gong和 +大陆官方 +北京政权 +刘志军 +张曙 +刘志军 +买别墅 +玩女人 +贪20亿 +许宗衡 +贪财物 +李启红 +贪腐财富 +落马 +高官名单 +陈希同 +贪污 +玩忽职守 +有期徒刑 +陈良宇 +受贿罪 +滥用职权 +有期徒刑 +没收个人财产 +成克杰 +死刑 +程维高 +严重违纪 +开除党籍 +撤销职务 +刘方仁 +无期徒刑 +倪献策 +徇私舞弊 +梁湘 +以权谋私 +撤职。 +李嘉廷 +死刑缓期 +张国光 +韩桂芝 +宋平顺 +自杀 +黄瑶 +双规 +陈绍基 +判处死刑 +剥夺政治权利终身 +没收个人全部财产 +石兆彬 +侯伍杰 +王昭耀 +剥夺政治权利 +杜世成 +沈图 +叛逃美国 +罗云光 +起诉 +张辛泰 +李效时 +边少斌 +徐鹏航 +违纪 +收受股票 +王乐毅 +李纪周 +郑光迪 +田凤山。 +邱晓华 +郑筱萸 +孙鹤龄 +蓝田造假案 +于幼军 +留党察看 +何洪达 +朱志刚 +杨汇泉 +官僚主义 +徐炳松 +托乎提沙比尔 +王宝森 +经济犯罪 +畏罪自杀。 +陈水文 +孟庆平 +胡长清 +朱川 +许运鸿 +丘广钟 +刘知炳 +丛福奎 +王怀忠 +巨额财产 +来源不明罪 +李达昌 +刘长贵 +王钟麓 +阿曼哈吉 +付晓光 +自动辞 +刘克田 +吕德彬 +刘维明 +双开 +刘志华 +孙瑜 +李堂堂 +韩福才 青海 +欧阳德 广东 +韦泽芳 海南 +铁英 北京 +辛业江 海南 +于飞 广东 +姜殿武 河北 +秦昌典 重庆 +范广举 黑龙江 +张凯广东 +王厚宏海南 +陈维席安徽 +王有杰河南 +王武龙江苏 +米凤君吉林 +宋勇辽宁 +张家盟浙江 +马烈孙宁夏 +黄纪诚北京 +常征贵州 +王式惠重庆 +周文吉 +王庆录广西 +潘广田山东 +朱作勇甘肃 +孙善武河南 +宋晨光江西 +梁春禄广西政协 +鲁家善 中国交通 +金德琴 中信 +李大强 神华 +吴文英 纺织 +查克明 华能 +朱小华光大 +高严 国家电力 +王雪冰 +林孔兴 +刘金宝 +张恩照 +陈同海 +康日新 +王益 +张春江 +洪清源 +平义杰 +李恩潮 +孙小虹 +陈忠 +慕绥新 +田凤岐 +麦崇楷 +柴王群 +吴振汉 +张秋阳 +徐衍东 +徐发 黑龙江 +张宗海 +丁鑫发 +徐国健 +李宝金 +单平 +段义和 +荆福生 +陈少勇 +黄松有 +皮黔生 +王华元 +王守业 +刘连昆 +孙晋美 +邵松高 +肖怀枢 +刘广智 空军 +姬胜德 总参 +廖伯年 北京 \ No newline at end of file diff --git a/nakadai/src/test/java/com/huoran/nakadai/code/CodeGenerator.java b/nakadai/src/test/java/com/huoran/nakadai/code/CodeGenerator.java new file mode 100644 index 0000000..0bf59d5 --- /dev/null +++ b/nakadai/src/test/java/com/huoran/nakadai/code/CodeGenerator.java @@ -0,0 +1,82 @@ +package com.huoran.nakadai.code; + +import com.baomidou.mybatisplus.annotation.DbType; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.generator.AutoGenerator; +import com.baomidou.mybatisplus.generator.config.DataSourceConfig; +import com.baomidou.mybatisplus.generator.config.GlobalConfig; +import com.baomidou.mybatisplus.generator.config.PackageConfig; +import com.baomidou.mybatisplus.generator.config.StrategyConfig; +import com.baomidou.mybatisplus.generator.config.rules.DateType; +import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; +import org.junit.Test; + +/** + * @Author chen + * @DATE 2021/8/10 15:42 + * @Version 1.0 + */ +public class CodeGenerator { + + @Test + public void run() { + + // 1、创建代码生成器 + AutoGenerator mpg = new AutoGenerator(); + + // 2、全局配置 + GlobalConfig gc = new GlobalConfig(); + String projectPath = System.getProperty("user.dir"); + gc.setOutputDir(projectPath + "/src/main/java"); + + + gc.setAuthor("chen");//设置作者 + gc.setOpen(false); //生成后是否打开资源管理器 + gc.setFileOverride(false); //重新生成时文件是否覆盖 + gc.setServiceName("%sService"); //去掉Service接口的首字母I + gc.setIdType(IdType.AUTO); //主键策略 + gc.setDateType(DateType.ONLY_DATE);//定义生成的实体类中日期类型 + gc.setSwagger2(true);//开启Swagger2模式 + + mpg.setGlobalConfig(gc); + + // 3、数据源配置 + // 3、数据源配置 + DataSourceConfig dsc = new DataSourceConfig(); + dsc.setUrl("jdbc:mysql://139.9.47.170:3306/nakadai?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8"); + dsc.setDriverName("com.mysql.cj.jdbc.Driver"); + dsc.setUsername("root"); + dsc.setPassword("HuoRan@2021"); + dsc.setDbType(DbType.MYSQL); + mpg.setDataSource(dsc); + + // 4、包配置 + PackageConfig pc = new PackageConfig(); + pc.setParent("com.huoran.nakadai"); + //pc.setModuleName("occupationlab"); //模块名 + pc.setController("controller"); + pc.setEntity("entity"); + pc.setService("service"); + pc.setServiceImpl("service.impl"); + pc.setMapper("mapper"); + mpg.setPackageInfo(pc); + + // 5、策略配置 + StrategyConfig strategy = new StrategyConfig(); + strategy.setInclude("st_customs_pass"); + strategy.setNaming(NamingStrategy.underline_to_camel);//数据库表映射到实体的命名策略 + strategy.setTablePrefix("st_"); //生成实体时去掉表前缀 + + strategy.setColumnNaming(NamingStrategy.underline_to_camel);//数据库表字段映射到实体的命名策略 + strategy.setEntityLombokModel(true); // lombok 模型 @Accessors(chain = true) setter链式操作 + + strategy.setRestControllerStyle(true); //restful api风格控制器 + strategy.setControllerMappingHyphenStyle(true); //url中驼峰转连字符 + + mpg.setStrategy(strategy); + + + // 6、执行 + mpg.execute(); + } +} diff --git a/occupationlab/pom.xml b/occupationlab/pom.xml new file mode 100644 index 0000000..cf083ce --- /dev/null +++ b/occupationlab/pom.xml @@ -0,0 +1,165 @@ + + + 4.0.0 + + + huoran + com.huoran.parent + 1.0-SNAPSHOT + + + com.huoran + occupationlab + 1.0.0 + occupationlab + + 职站微服务 + + 1.8 + + + + + + + + + + + + commons-codec + commons-codec + 1.15 + + + + + org.springframework.boot + spring-boot-starter-actuator + + + + com.huoran.common + common + 0.0.1-SNAPSHOT + + + + + com.huoran.api + api + 1.0-SNAPSHOT + compile + + + + com.alibaba + easyexcel + + + + org.apache.poi + poi-ooxml + + + org.apache.poi + poi + + + + + cn.afterturn + easypoi-base + + + guava + com.google.guava + + + guava + com.google.guava + + + poi-ooxml-schemas + org.apache.poi + + + + + cn.afterturn + easypoi-web + + + cn.afterturn + easypoi-annotation + + + org.freemarker + freemarker + + + org.apache.shiro + shiro-spring + + + + org.quartz-scheduler + quartz + + + com.mchange + c3p0 + + + com.zaxxer + HikariCP-java6 + + + + + + + + + + + src/main/java + + **/*.xml + + + + src/main/resources + + **/*.properties + **/*.xlsx + **/*.ftl + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + true + + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/OccupationlabApplication.java b/occupationlab/src/main/java/com/huoran/occupationlab/OccupationlabApplication.java new file mode 100644 index 0000000..843d767 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/OccupationlabApplication.java @@ -0,0 +1,24 @@ +package com.huoran.occupationlab; + +import org.mybatis.spring.annotation.MapperScan; +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; +import org.springframework.scheduling.annotation.EnableScheduling; + +//@EnableScheduling//定时任务 +//@EnableRabbit//开启rabbitmq +@SpringBootApplication +@EnableDiscoveryClient +@EnableFeignClients(basePackages = "com.huoran.api") +@MapperScan(basePackages = "com.huoran.occupationlab.mapper") +@ComponentScan(basePackages = {"com.huoran"}) +public class OccupationlabApplication { + + public static void main(String[] args) { + SpringApplication.run(OccupationlabApplication.class, args); + } + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/config/MyThreadConfig.java b/occupationlab/src/main/java/com/huoran/occupationlab/config/MyThreadConfig.java new file mode 100644 index 0000000..65e63cb --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/config/MyThreadConfig.java @@ -0,0 +1,25 @@ +package com.huoran.occupationlab.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import java.util.concurrent.Executors; +import java.util.concurrent.LinkedBlockingDeque; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +//@EnableConfigurationProperties(ThreadPoolConfigProperties.class) +@Configuration +public class MyThreadConfig { + + @Bean + public ThreadPoolExecutor threadPoolExecutor(ThreadPoolConfigProperties pool) { + return new ThreadPoolExecutor(pool.getCoreSize(), + pool.getMaxSize(), + pool.getKeepAliveTime(), + TimeUnit.SECONDS, + new LinkedBlockingDeque<>(100000), + Executors.defaultThreadFactory(), + new ThreadPoolExecutor.AbortPolicy()); + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/config/RabbitConfig.java b/occupationlab/src/main/java/com/huoran/occupationlab/config/RabbitConfig.java new file mode 100644 index 0000000..033a166 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/config/RabbitConfig.java @@ -0,0 +1,52 @@ +/* +package com.huoran.occupationlab.config; + +import com.huoran.common.constant.RabbitmqConstant; +import org.springframework.amqp.core.Binding; +import org.springframework.amqp.core.DirectExchange; +import org.springframework.amqp.core.Exchange; +import org.springframework.amqp.core.Queue; +import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter; +import org.springframework.amqp.support.converter.MessageConverter; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + + +@Configuration +public class RabbitConfig { + + @Autowired + RabbitTemplate rabbitTemplate; + + */ +/** + * mq消息转换json格式 + * @return json + *//* + + @Bean + public MessageConverter messageConverter(){ + return new Jackson2JsonMessageConverter(); + } + + @Bean + public Exchange courseExchange(){ + return new DirectExchange(RabbitmqConstant.COURSE_EXCHANGE,true,false); + } + + @Bean + public Queue courseQueue(){ + return new Queue(RabbitmqConstant.COURSE_QUEUE,true,false,false); + } + + @Bean + public Binding courseBind(){ + return new Binding(RabbitmqConstant.COURSE_QUEUE, + Binding.DestinationType.QUEUE, + RabbitmqConstant.COURSE_EXCHANGE, + RabbitmqConstant.COURSE_ROUTING_KEY,null); + } +} +*/ diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/config/SwaggerConfig.java b/occupationlab/src/main/java/com/huoran/occupationlab/config/SwaggerConfig.java new file mode 100644 index 0000000..d7fc6d1 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/config/SwaggerConfig.java @@ -0,0 +1,78 @@ +package com.huoran.occupationlab.config; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.ParameterBuilder; +import springfox.documentation.builders.PathSelectors; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.schema.ModelRef; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.service.Parameter; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger.web.*; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +import java.util.ArrayList; +import java.util.List; + +@Configuration +@EnableSwagger2 +@Profile({"dev","test"}) +public class SwaggerConfig { + + @Bean + public Docket createRestApi() { + // 构造token给测试的时候填写 + ParameterBuilder tokenPar = new ParameterBuilder(); + List pars = new ArrayList(); + tokenPar.name("token").description("用户令牌(不需用户鉴权的不需要传)").modelRef(new ModelRef("string")).parameterType("header") + .required(false).build(); + pars.add(tokenPar.build()); + + return new Docket(DocumentationType.SWAGGER_2) + .apiInfo(apiInfo()) + .select() + .apis(RequestHandlerSelectors.basePackage("com.huoran.occupationlab.controller")) + .apis(RequestHandlerSelectors.withClassAnnotation(Api.class)) + .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) + .paths(PathSelectors.any()) + .build().globalOperationParameters(pars); + } + + + @Bean + UiConfiguration uiConfig() { + return UiConfigurationBuilder.builder() + .docExpansion(DocExpansion.LIST) + .deepLinking(true) + .displayOperationId(false) + // 隐藏UI上的Models模块 + .defaultModelsExpandDepth(-1) + .defaultModelExpandDepth(0) + .defaultModelRendering(ModelRendering.EXAMPLE) + .displayRequestDuration(false) + .docExpansion(DocExpansion.NONE) + .filter(false) + .maxDisplayedTags(null) + .operationsSorter(OperationsSorter.ALPHA) + .showExtensions(false) + .tagsSorter(TagsSorter.ALPHA) + .validatorUrl(null) + .build(); + } + + private ApiInfo apiInfo() { + return new ApiInfoBuilder() + .title("职站微服务接口文档") + .description("Rong") + .contact("developer@mail.com") + .version("1.0") + .build(); + } + +} \ No newline at end of file diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/config/SysLogAspect.java b/occupationlab/src/main/java/com/huoran/occupationlab/config/SysLogAspect.java new file mode 100644 index 0000000..6d06f4e --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/config/SysLogAspect.java @@ -0,0 +1,120 @@ +package com.huoran.occupationlab.config; + +import com.alibaba.fastjson.JSON; +import com.huoran.api.UserClient; +import com.huoran.common.aop.annotation.LogAnnotation; +import com.huoran.common.utils.HttpContextUtils; +import com.huoran.common.utils.IPUtils; +import com.huoran.common.utils.TokenUtils; +import com.huoran.occupationlab.entity.SysLog; +import com.huoran.occupationlab.mapper.SysLogMapper; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; +import org.aspectj.lang.reflect.MethodSignature; +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.lang.reflect.Method; + +/** + * 日志切面 + * + * @author cheney + * @version V1.0 + * @date 2022年7月28日 + */ +@Aspect +@Component +@Slf4j +public class SysLogAspect { + @Lazy + @Resource + private SysLogMapper sysLogMapper; + + @Lazy + @Resource + private UserClient userClient; + + /** + * 此处的切点是注解的方式 + * 只要出现 @LogAnnotation注解都会进入 + */ + @Pointcut("@annotation(com.huoran.common.aop.annotation.LogAnnotation)") + public void logPointCut() { + + } + + /** + * 环绕增强,相当于MethodInterceptor + */ + @Around("logPointCut()") + public Object around(ProceedingJoinPoint point) throws Throwable { + long beginTime = System.currentTimeMillis(); + //执行方法 + Object result = point.proceed(); + //执行时长(毫秒) + long time = System.currentTimeMillis() - beginTime; + + //保存日志 + try { + saveSysLog(point, time); + } catch (Exception e) { + log.error("sysLog,exception:{}", e, e); + } + + return result; + } + + /** + * 把日志保存 + */ + private void saveSysLog(ProceedingJoinPoint joinPoint, long time) { + MethodSignature signature = (MethodSignature) joinPoint.getSignature(); + Method method = signature.getMethod(); + + SysLog sysLog = new SysLog(); + LogAnnotation logAnnotation = method.getAnnotation(LogAnnotation.class); + if (logAnnotation != null) { + //注解上的描述 + sysLog.setOperation(logAnnotation.title() + "-" + logAnnotation.action()); + } + + //请求的方法名 + String className = joinPoint.getTarget().getClass().getName(); + String methodName = signature.getName(); + sysLog.setMethod(className + "." + methodName + "()"); + log.info("请求{}.{}耗时{}毫秒", className, methodName, time); + try { + //请求的参数 + Object[] args = joinPoint.getArgs(); + String params = null; + if (args.length != 0) { + params = JSON.toJSONString(args); + } + + sysLog.setParams(params); + } catch (Exception e) { + log.error("sysLog,exception:{}", e, e); + } + //获取request + HttpServletRequest request = HttpContextUtils.getHttpServletRequest(); + //设置IP地址 + sysLog.setIp(IPUtils.getIpAddr(request)); + log.info("Ip{},接口地址{},请求方式{},入参:{}", sysLog.getIp(), request.getRequestURL(), request.getMethod(), sysLog.getParams()); + //用户名 + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + sysLog.setUserName(userClient.getUserName(Integer.valueOf(accountId))); + sysLog.setUserId(accountId); + sysLog.setSchoolId(schoolId); + sysLog.setTime((int) time); + log.info(sysLog.toString()); + sysLogMapper.insert(sysLog); + + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/config/ThreadPoolConfigProperties.java b/occupationlab/src/main/java/com/huoran/occupationlab/config/ThreadPoolConfigProperties.java new file mode 100644 index 0000000..2a68831 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/config/ThreadPoolConfigProperties.java @@ -0,0 +1,14 @@ +package com.huoran.occupationlab.config; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +@ConfigurationProperties(prefix = "occupationlab.thread") +@Component +@Data +public class ThreadPoolConfigProperties { + private Integer coreSize; + private Integer maxSize; + private Integer keepAliveTime; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/AchievementController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/AchievementController.java new file mode 100644 index 0000000..e9da03d --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/AchievementController.java @@ -0,0 +1,754 @@ +package com.huoran.occupationlab.controller; + +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.api.UserClient; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.occupationlab.entity.*; +import com.huoran.occupationlab.entity.Class; +import com.huoran.occupationlab.entity.req.*; +import com.huoran.occupationlab.entity.resp.*; +import com.huoran.occupationlab.entity.vo.ActivityDerivationVO; +import com.huoran.occupationlab.entity.vo.PerformanceManagementPracticeActivityVO; +import com.huoran.occupationlab.entity.vo.PracticeTheHighestScoreListVO; +import com.huoran.occupationlab.entity.vo.ProductClassInformationVO; +import com.huoran.occupationlab.mapper.ArchitectureMapper; +import com.huoran.occupationlab.service.*; +import com.huoran.occupationlab.utils.DelTagsUtil; +import com.huoran.occupationlab.utils.ImgUtil; +import freemarker.cache.ClassTemplateLoader; +import freemarker.template.Configuration; +import freemarker.template.Template; +import freemarker.template.TemplateException; +import freemarker.template.Version; +import io.swagger.annotations.ApiParam; +import lombok.SneakyThrows; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import java.io.*; +import java.net.URLEncoder; +import java.util.*; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/** + * @描述:成绩管理 + * @作者: Rong + * @日期: 2021-09-06 + */ +@RestController +@RequestMapping("/occupationlab/achievement") +@Api(value = "职站:成绩管理", tags = "职站:成绩管理") +public class AchievementController { + + @Autowired + public ExperimentalReportService experimentalReportService; + @Autowired + public AssessmentService assessmentService; + + @Autowired + public StudentService studentService; + @Autowired + public ClassService classService; + + @Autowired + private ProjectManageService projectManageService; + + @Autowired + private ArchitectureMapper architectureMapper; + @Autowired + private UserClient userClient; + + /** + * @Description: 管理端成绩管理 + * @auther: Rong + * @date: 2021/9/8 10:27 + */ + @PostMapping("/getAchievementInfo") + @ApiOperation(value = " 管理端成绩管理", response = AchievementResp.class) + public R getAchievementInfo(@RequestBody @Valid PageAchievementByTeacherReq req, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + req.setAccountId(Integer.valueOf(accountId)); + req.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); + return experimentalReportService.getAchievementInfo(req); + } + + /** + * @Description: 教师端:我的班级 + * @auther: Rong + * @date: 2021/9/8 10:27 + */ + @PostMapping("/myClass") + @ApiOperation(value = "教师端:我的班级", response = Class.class) + public R myClass(HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + return assessmentService.getMineClass(Integer.valueOf(accountId)); + } + + /** + * @Description: 学生端:我的班级 + * @auther: Rong + * @date: 2021/9/8 10:27 + */ + @PostMapping("/myClassByStudent") + @ApiOperation(value = "学生端:我的班级", response = Class.class) + public R myClassByStudent(HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + /*QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("account_id", accountId); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + List studentList = studentService.list(queryWrapper); + List classList = new ArrayList<>(); + studentList.stream().forEach(student -> { + for (String cid : student.getClassId().split(",")) { + Class cla = classService.getById(Integer.valueOf(cid)); + classList.add(cla); + } + });*/ + List classList = new ArrayList<>(); + Set set = assessmentService.myClassByStudent(Integer.valueOf(accountId), userClient.getSchoolIdByAccountId(accountId)); + Iterator it = set.iterator(); + while (it.hasNext()) { + String classId = (String) it.next(); + Class cla = classService.getById(Integer.valueOf(classId)); + classList.add(cla); + } + return R.ok().put("data", classList); + } + + /** + * @Description: 管理端练习成绩详情 + * @auther: Rong + * @date: 2021/9/8 10:28 + */ + @PostMapping("/getPracticeDetail") + @ApiOperation(value = "管理端练习成绩详情", response = AchievementResp.class) + public R getPracticeDetail(@ApiParam(value = "项目id", required = true) @RequestParam("projectId") Integer projectId, + @ApiParam(value = "当前页数", required = true) @RequestParam("pageNum") Integer pageNum, + @ApiParam(value = "当前页需要显示的数量", required = true) @RequestParam("pageSize") Integer pageSize, + @ApiParam(value = "班级id", required = false) @RequestParam("classId") Integer classId, + @ApiParam(value = "关键词", required = false) @RequestParam("keyWord") String keyWord, + @ApiParam(value = "商品id", required = false) @RequestParam("mallId") Integer mallId, + HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + return experimentalReportService.getPracticeDetail(projectId, pageNum, pageSize, schoolId, classId, keyWord,mallId); + + } + + /** + * @Description: 管理端考核成绩详情 + * @auther: Rong + * @date: 2021/9/8 15:11 + */ + @PostMapping("/getAssessmentDetail") + @ApiOperation(value = "管理端考核成绩详情", response = AchievementResp.class) + public R getAssessmentDetail(@ApiParam(value = "考核id", required = true) @RequestParam("assessmentId") Integer assessmentId, + @ApiParam(value = "班级id", required = false) @RequestParam("classId") Integer classId, + @ApiParam(value = "当前页数", required = true) @RequestParam("pageNum") Integer pageNum, + @ApiParam(value = "当前页需要显示的数量", required = true) @RequestParam("pageSize") Integer pageSize, + @ApiParam(value = "关键词", required = true) @RequestParam("keyword") String keyword, + HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + return experimentalReportService.getAssessmentDetail(assessmentId, classId, pageNum, pageSize,keyword); + } + + /** + * @Description:单个、批量删除实验报告 + * @auther: Rong + * @date: 2021/9/8 15:05 + */ + @ApiOperation(value = "单个、批量删除实验报告") + @PostMapping("/deleteExperimentalReport") + public R deleteExperimentalReport(@RequestBody List ids) { + boolean ret = experimentalReportService.removeByIds(ids); + return ret ? R.ok() : R.error(); + } + + /** + * @Description: 批量导出练习成绩 + * @auther: Rong + * @date: 2021/9/8 15:40 + */ + @ApiOperation(value = "教师端:批量导出练习成绩") + @GetMapping("/exportPracticeInfo") + public void exportPracticeInfo( + @ApiParam(value = "要导出的id", required = false) @RequestParam(value = "ids", required = false) String ids, + @RequestParam("projectId") @ApiParam(value = "项目id", required = true) @NotNull(message = "项目id不能为空") Integer projectId, + @RequestParam("mallId") @ApiParam(value = "商品id", required = true) @NotNull(message = "商品id不能为空") Integer mallId, + HttpServletResponse response, HttpServletRequest request) throws Exception { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + experimentalReportService.exportPracticeInfo(ids, response, schoolId, projectId,mallId); + } + + /** + * @Description: 批量导出考核成绩 + * @auther: Rong + * @date: 2021/9/8 16:39 + */ + @ApiOperation(value = "教师端:批量导出考核成绩") + @GetMapping("/exportAssessmentInfo") + public void exportAssessmentInfo( + @ApiParam(value = "要导出的id", required = false) @RequestParam(value = "ids", required = false) String ids, + @RequestParam("assessmentId") @ApiParam(value = "考核id", required = true) @NotNull(message = "考核id不能为空") Integer assessmentId, + @RequestParam(value = "classId", required = false) @ApiParam(value = "班级id", required = false) Integer classId, + HttpServletResponse response, HttpServletRequest request) throws Exception { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + experimentalReportService.exportAssessmentInfo(ids, response, schoolId, assessmentId, classId); + } + + /** + * @Description: 实验概览 + * @auther: Rong + * @date: 2021/9/8 17:14 + */ + @ApiOperation(value = "实验概览") + @GetMapping("/experimentOverview") + public R experimentOverview(HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + return experimentalReportService.getExperimentOverview(Integer.valueOf(accountId)); + } + + /** + * @Description: 学生端-学生端练习成绩列表 + * @auther: Rong + * @date: 2021/9/9 10:02 + */ + @PostMapping("/queryPracticeByStudent") + @ApiOperation(value = " 学生端练习成绩列表", response = AchievementResp.class) + public R queryPracticeByStudent(@RequestBody @Valid PageAchievementByStuReq req, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + req.setAccountId(Integer.valueOf(accountId)); + return experimentalReportService.queryPracticeByStudent(req); + } + + /** + * @Description: 学生端-学生端练习实验情况 + * @auther: Rong + * @date: 2021/9/30 15:39 + */ + @PostMapping("/practiceByStudentDetail") + @ApiOperation(value = " 学生端练习实验情况", response = AchievementResp.class) + public R practiceByStudentDetail(@RequestParam("curriculumId") @ApiParam(value = "课程id", required = true) @NotNull(message = "课程id不能为空") Integer curriculumId, + @RequestParam("projectId") @ApiParam(value = "项目id", required = true) @NotNull(message = "项目id不能为空") Integer projectId, + @ApiParam(value = "当前页数", required = true) @RequestParam("pageNum") Integer pageNum, + @ApiParam(value = "当前页需要显示的数量", required = true) @RequestParam("pageSize") Integer pageSize, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + //Integer curriculumId, Integer projectId, Integer accountId, Integer pageNum, Integer pageSize + return experimentalReportService.practiceByStudentDetail(curriculumId, projectId, Integer.valueOf(accountId), pageNum, pageSize); + } + + /** + * @Description: 学生端-导出学生端练习实验情况 + * @auther: Rong + * @date: 2021/9/30 15:39 + */ + @ApiOperation(value = "导出学生端练习实验情况") + @GetMapping("/exportPracticeByStudentDetail") + public void exportPracticeByStudentDetail( + @ApiParam(value = "要导出的id(非必填)", required = false) @RequestParam(value = "ids", required = false) String ids, + @ApiParam(value = "项目id(必填)") @RequestParam(value = "projectId", required = true) Integer projectId, + HttpServletResponse response, HttpServletRequest request) throws Exception { + String accountId = TokenUtils.getIdByJwtToken(request); + experimentalReportService.exportPracticeByStudentDetail(ids, projectId, Integer.valueOf(accountId), response); + } + + /** + * @Description: 学生端-考核成绩列表 + * @auther: Rong + * @date: 2021/9/9 10:02 + */ + @PostMapping("/queryAssessmentByStudent") + @ApiOperation(value = " 学生端考核成绩列表", response = AchievementResp.class) + public R queryAssessmentByStudent(@RequestBody @Valid PageAchievementByStuReq req, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + req.setAccountId(Integer.valueOf(accountId)); + return experimentalReportService.queryAssessmentByStudent(req); + } + + /** + * @Description: 批量删除成绩管理中的项目/批量删除成绩管理中的考核 + * 实际做的是隐藏操作 + * @auther: Rong + * @date: 2021/9/23 10:28 + */ + @ApiOperation(value = "批量删除成绩管理中的项目/批量删除成绩管理中的考核") + @GetMapping("/deleteReportById") + public R deleteReportByIds(@ApiParam(name = "projectIds", value = "要删除的项目ids") @RequestParam(required = false) List projectIds, + @ApiParam(name = "projectPermissions", value = "0、练习 1、考核 ") @RequestParam(required = false) Integer projectPermissions, + @ApiParam(name = "ids", value = "要删除的考核ids") @RequestParam(required = false) List ids) { + return experimentalReportService.deleteReportById(projectIds, projectPermissions, ids); + } + + /** + * @Description: 学生批量导出练习成绩 + * @auther: Rong + * @date: 2021/9/8 15:40 + */ + @ApiOperation(value = "学生-批量导出练习成绩") + @GetMapping("/exportPracticeByStudent") + public void exportPracticeByStudent( + /* @ApiParam(value = "要导出的id", required = false) @RequestParam("ids") String ids,*/ + @RequestParam("curriculumId") @ApiParam(value = "课程id", required = true) @NotNull(message = "课程id不能为空") Integer curriculumId, + HttpServletResponse response, HttpServletRequest request) throws Exception { + String accountId = TokenUtils.getIdByJwtToken(request); + + experimentalReportService.exportPracticeByStudent(curriculumId, Integer.valueOf(accountId), response); + } + + /** + * @Description: 学生批量导出考核成绩 + * @auther: Rong + * @date: 2021/9/8 16:39 + */ + @ApiOperation(value = "学生-批量导出考核成绩") + @GetMapping("/exportAssessmentByStudent") + public void exportAssessmentByStudent( + @ApiParam(value = "要导出的id(非必填)") @RequestParam(value = "ids", required = false) String ids, + @RequestParam("curriculumId") @ApiParam(value = "课程id", required = true) @NotNull(message = "课程id不能为空") Integer curriculumId, + HttpServletResponse response, HttpServletRequest request) throws Exception { + String accountId = TokenUtils.getIdByJwtToken(request); + //Integer accountId,Integer curriculumId,String ids + experimentalReportService.exportAssessmentByStudent(Integer.valueOf(accountId), curriculumId, ids, response); + } + + @ApiOperation(value = "学生-成绩报告详情", response = ExperimentalReport.class) + @GetMapping("/reportDetail") + public R reportDetail(@RequestParam("reportId") Integer reportId) { + return experimentalReportService.reportDetail(reportId); + } + + @ApiOperation(value = "学生-修改成绩报告") + @PostMapping("/updateReport") + public R updateReport(@RequestBody com.huoran.common.entity.ExperimentalReport experimentalReport) { + return R.toR(experimentalReportService.updateById(experimentalReport)); + } + + /** + * @Description: 拼接班级 + * @auther: Rong + * @date: 2021/9/8 10:27 + */ + @PostMapping("/spliceClass") + @ApiOperation(value = "拼接班级", response = Class.class) + public R spliceClass(@RequestParam("assessmentId") @ApiParam(value = "考核id", required = true) @NotNull(message = "考核id不能为空") Integer assessmentId, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + return assessmentService.spliceClass(assessmentId); + } + + @PostMapping("/exportLabReport") + @ApiOperation(value = "导出实验报告", httpMethod = "POST", produces = "application/json", notes = "导出用户doc", response = ExperimentalReportResp.class) + public R exportLabReport(@RequestBody ExperimentalReportResp report, HttpServletResponse response) throws IOException, TemplateException { + Configuration configuration = new Configuration(new Version("2.3.28")); + //既能保证本地运行找得到模板文件,又能保证jar包运行能找到得到模板文件 + configuration.setClassForTemplateLoading(this.getClass(), "/excel-template"); + configuration.setTemplateLoader(new ClassTemplateLoader(this.getClass(), "/excel-template")); + Template template = configuration.getTemplate("python.ftl", "utf-8"); + + //定义下载的类型,标明是word文件(这种是浏览器下载的方式) + + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("导出模板", "UTF-8") + ".doc"); + //response.setContentType("application/octet-stream;charset=UTF-8"); + Map dataMap = new HashMap<>(); + if (report.getUserName() != null) { + dataMap.put("userName", DelTagsUtil.getTextFromHtml(report.getUserName())); + } + + if (report.getPeriod() != null) { + dataMap.put("period", DelTagsUtil.getTextFromHtml(report.getPeriod())); + } + + if (report.getWorkNumber() != null) { + dataMap.put("workNumber", DelTagsUtil.getTextFromHtml(report.getWorkNumber())); + } + + + if (report.getClassName() != null) { + dataMap.put("className", DelTagsUtil.getTextFromHtml(report.getClassName())); + } + + if (report.getProjectName() != null) { + dataMap.put("projectName", DelTagsUtil.getTextFromHtml(report.getProjectName())); + } + + if (report.getSummarize() != null) { + dataMap.put("summarize", DelTagsUtil.getTextFromHtml(report.getSummarize())); + } + if (report.getInstructor() != null) { + dataMap.put("instructor", DelTagsUtil.getTextFromHtml(report.getInstructor())); + } + + dataMap.put("submitTime", String.valueOf(report.getSubmitTime())); + dataMap.put("score", report.getScore()); + dataMap.put("timeSum", report.getTimeSum()); + + if (report.getPurpose() != null) { + dataMap.put("purpose", report.getPurpose()); + } + + List experimentalDataList = new ArrayList<>(); + + for (UserScore userScore : report.getExperimentalData()) { + if (userScore.getJudgmentName() != null) { + userScore.setJudgmentName(DelTagsUtil.getTextFromHtml(userScore.getJudgmentName())); + } + + if (userScore.getAnswer() != null) { + userScore.setAnswer(DelTagsUtil.getTextFromHtml(userScore.getAnswer())); + + } + + if (userScore.getRunResult() != null) { + userScore.setRunResult(DelTagsUtil.getTextFromHtml(userScore.getRunResult())); + + } + + if (userScore.getReferenceAnswer() != null) { + userScore.setReferenceAnswer(DelTagsUtil.getTextFromHtml(userScore.getReferenceAnswer())); + + } + + /*if (userScore.getRunThePicture() != null) { + userScore.setRunThePicture(ImgUtil.imgToBase64(userScore.getRunThePicture())); + + }*/ + + + List imgUrl = new ArrayList<>(); + if (userScore.getRunThePicture() != null) { + if (userScore.getRunThePictureList().size() > 0) { + for (String url : userScore.getRunThePictureList()) { + imgUrl.add(ImgUtil.imgToBase64(url)); + } + userScore.setRunThePictureList(imgUrl); + } + } + + experimentalDataList.add(userScore); + } + dataMap.put("experimentalDataList", experimentalDataList); + + Writer out = null; + out = new BufferedWriter(new OutputStreamWriter(response.getOutputStream(), "UTF-8")); + try { + template.process(dataMap, out); + out.flush(); + out.close(); + } catch (TemplateException e) { + e.printStackTrace(); + return null; + } + + return R.ok(); + } + + @SneakyThrows + @PostMapping("/exportBankExperimentReport") + @ApiOperation(value = "导出银行实验报告", httpMethod = "POST", produces = "application/json", notes = "导出银行实验报告doc", response = ExperimentaForBanklReportReq.class) + public R exportBankExperimentReport(@RequestBody ExperimentaForBanklReportReq req, HttpServletResponse response) throws IOException { + Configuration configuration = new Configuration(new Version("2.3.28")); + //既能保证本地运行找得到模板文件,又能保证jar包运行能找到得到模板文件 + configuration.setClassForTemplateLoading(this.getClass(), "/excel-template"); + configuration.setTemplateLoader(new ClassTemplateLoader(this.getClass(), "/excel-template")); + Template template = configuration.getTemplate("bank1.ftl", "utf-8"); + + //定义下载的类型,标明是word文件(这种是浏览器下载的方式) + + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("导出模板", "UTF-8") + ".doc"); + Map dataMap = new HashMap<>(); + List experimentalDataList = new ArrayList<>(); + for (BankExperimentDataReq dataReq : req.getExperimentalData()) { + experimentalDataList.add(dataReq); + } + dataMap.put("experimentalDataList", experimentalDataList); + dataMap.put("userName", req.getUserName()); + dataMap.put("workNumber", req.getWorkNumber()); + dataMap.put("className", req.getClassName()); + dataMap.put("projectName", req.getProjectName()); + dataMap.put("summarize", req.getSummarize()); + dataMap.put("instructor", req.getInstructor()); + dataMap.put("submitTime", String.valueOf(req.getSubmitTime())); + dataMap.put("score", req.getScore()); + dataMap.put("timeSum", req.getTimeSum()); + dataMap.put("purpose", req.getPurpose()); + + Writer out = null; + out = new BufferedWriter(new OutputStreamWriter(response.getOutputStream(), "UTF-8")); + try { + template.process(dataMap, out); + out.flush(); + out.close(); + } catch (TemplateException e) { + e.printStackTrace(); + return null; + } + + return R.ok(); + } + + + @PostMapping("/practiceActivity") + @ApiOperation(value = "管理端练习活跃度列表", response = PerformanceManagementPracticeActivityVO.class) + public R practiceActivity(@ApiParam(value = "项目id", required = true) @RequestParam("projectId") Integer projectId, + @ApiParam(value = "当前页数", required = true) @RequestParam("pageNum") Integer pageNum, + @ApiParam(value = "当前页需要显示的数量", required = true) @RequestParam("pageSize") Integer pageSize, + @ApiParam(value = "班级id", required = false) @RequestParam("classId") Integer classId, + @ApiParam(value = "关键词", required = false) @RequestParam("keyWord") String keyWord, + @ApiParam(value = "商品id", required = true) @NotNull(message = "商品id不能为空") Integer mallId, + HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + return experimentalReportService.practiceActivity(projectId, pageNum, pageSize, schoolId, classId, keyWord,mallId); + + } + + + @ApiOperation(value = "导出练习活跃度全部数据", response = PerformanceManagementPracticeActivityVO.class) + @GetMapping("/exportAllData") + public void exportAllData( + @ApiParam(name = "projectId", value = "项目id", required = true) + @RequestParam("projectId") Integer projectId,@ApiParam(name = "mallId", value = "产品id", required = true) + @RequestParam("projectId") Integer mallId, HttpServletRequest request, HttpServletResponse response) { + try { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + experimentalReportService.exportAllData(projectId, schoolId, response,mallId); + } catch (IOException e) { + e.printStackTrace(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + @ApiOperation(value = "批量练习活跃度导出数据") + @PostMapping(value = "/exportDataInBatches", produces = "application/json;multipart/form-data;charset=utf-8") + public void exportSubscribedRecords( + @RequestBody List listOfExportSub, + HttpServletResponse response, HttpServletRequest request) throws Exception { + experimentalReportService.exportDataInBatches(listOfExportSub, response); + } + + + @PostMapping("/maximumPracticeScoreList") + @ApiOperation(value = "练习列表最高分列表", response = PracticeTheHighestScoreListVO.class) + public R maximumPracticeScoreList(@ApiParam(value = "项目id", required = true) @RequestParam("projectId") Integer projectId, + @ApiParam(value = "当前页数", required = true) @RequestParam("pageNum") Integer pageNum, + @ApiParam(value = "当前页需要显示的数量", required = true) @RequestParam("pageSize") Integer pageSize, + @ApiParam(value = "商品id", required = true) @RequestParam("mallId") Integer mallId, + HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + return experimentalReportService.maximumPracticeScoreList(projectId, pageNum, pageSize, schoolId,mallId); + + } + + + @PostMapping("/practiceByProduct") + @ApiOperation(value = "管理端练习依据产品维度读取", response = ProductClassInformationVO.class) + public R practiceByProduct(@RequestBody AchievementProductDimensionReq req, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + + List newList = new ArrayList<>(); + + //获取本校全部班级列表 + List classList = classService.getClassesUnderTheSchool(schoolId); + for (Class cla : classList) { + //拿到班级的上级年级以及上上级专业 + if (cla.getId() != 1) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("id", cla.getArchitectureId()); + Architecture getGrade = architectureMapper.selectOne(wrapper); + //根据年级拿到专业信息 + QueryWrapper wrapper1 = new QueryWrapper<>(); + wrapper1.eq("id", getGrade.getParentId()); + Architecture getProfessional = architectureMapper.selectOne(wrapper1); + cla.setClassName(getProfessional.getOrganizationName() + "/" + getGrade.getOrganizationName() + "/" + cla.getClassName()); + } + } + + //获取本校购买的产品列表 + List getProduct = experimentalReportService.getProduct(schoolId); + for (ProductClassInformationVO addClass : getProduct) { + for (Class clasInfo : classList) { + addClass.setClassName(clasInfo.getClassName()); + addClass.setClassId(clasInfo.getId()); + + ProductClassInformationVO vo = new ProductClassInformationVO(); + vo.setClassId(clasInfo.getId()); + vo.setClassName(clasInfo.getClassName()); + vo.setMallId(addClass.getMallId()); + vo.setCurriculumName(addClass.getCurriculumName()); + vo.setCid(addClass.getCid()); + newList.add(vo); + } + + } + + Integer builtInTotalNumberOfExercises = 0;//内置的练习项目总数 + Integer builtTntotalNumberOfAssessmentItems = 0;//内置的考核项目总数 + + Integer totalNumberOfSchoolPracticeProjects = 0;//学校练习项目总数 + Integer totalNumberOfSchoolAssessmentItems = 0;//学校考核项目总数 + + Integer classSize = 0;//班级人总数 + + + //循环统计 练习项目数、考核项目数 + for (ProductClassInformationVO proList : newList) { + //统计内置项目+学校自己创建在产品下的项目 + builtInTotalNumberOfExercises = projectManageService.getCurriculumCountByType(proList.getCid(), 0); + + totalNumberOfSchoolPracticeProjects = projectManageService.projectCreatedUnderProduct(proList.getMallId(), 0, schoolId); + builtTntotalNumberOfAssessmentItems = projectManageService.getCurriculumCountByType(proList.getCid(), 1); + totalNumberOfSchoolAssessmentItems = projectManageService.projectCreatedUnderProduct(proList.getMallId(), 1, schoolId); + proList.setNumberOfPracticeItems(builtInTotalNumberOfExercises + totalNumberOfSchoolPracticeProjects); + proList.setNumberOfAssessmentItems(builtTntotalNumberOfAssessmentItems + totalNumberOfSchoolAssessmentItems); + proList.setClassSize(studentService.countClassSizes(schoolId, proList.getClassId())); + } + + Stream stream = newList.stream(); + if (req.getClassId() != null) { + // 筛选班级id + stream = stream.filter(e -> req.getClassId().equals(e.getClassId())); + } + + if (req.getMallId() != null) { + // 筛选产品id + stream = stream.filter(e -> req.getMallId().equals(e.getMallId())); + } + newList = stream.collect(Collectors.toList()); + // 处理分页 + int total = newList.size(); + newList = newList.stream().skip((long) req.getPageSize() * (req.getPageNum() - 1)).limit(req.getPageSize()).collect(Collectors.toList()); + return R.ok().put("data", newList).put("total", total); + } + + @PostMapping("/allClassesInOurSchool") + @ApiOperation(value = "获取本校创建的班级", response = ProductClassInformationVO.class) + public R allClassesInOurSchool(HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + //获取本校全部班级列表 + List classList = classService.getClassesUnderTheSchool(schoolId); + for (Class cla : classList) { + //拿到班级的上级年级以及上上级专业 + + if (cla.getId() != 1) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("id", cla.getArchitectureId()); + Architecture getGrade = architectureMapper.selectOne(wrapper); + //根据年级拿到专业信息 + QueryWrapper wrapper1 = new QueryWrapper<>(); + wrapper1.eq("id", getGrade.getParentId()); + Architecture getProfessional = architectureMapper.selectOne(wrapper1); + cla.setClassName(getProfessional.getOrganizationName() + "/" + getGrade.getOrganizationName() + "/" + cla.getClassName()); + } + } + return R.ok().put("data", classList); + } + + + /** + * 产品维度下读取考核/练习成绩列表 + * + * @param req + * @param request + * @return + */ + @PostMapping("/productReadScore") + @ApiOperation(value = "产品维度下:读取考核/练习成绩(依据permissions参数区分)", response = AchievementResp.class) + public R productReadScore(@RequestBody PerformanceUnderProductReq req, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + req.setSchoolId(schoolId); + return experimentalReportService.productReadScore(req); + + } + + + @PostMapping("/productReadGradeDetails") + @ApiOperation(value = "产品维度下:读取考核/练习成绩详情(依据permissions参数区分)", response = PracticeScoreDetailsUnderProductResp.class) + public R productReadGradeDetails(@RequestBody PerformanceUnderProductReq req, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + req.setSchoolId(schoolId); + return experimentalReportService.productReadGradeDetails(req); + + } + + + @ApiOperation(value = "产品维度下:批量导出产品下的练习成绩") + @PostMapping(value = "/exportProductPracticeResults", produces = "application/json;multipart/form-data;charset=utf-8") + public void exportProductPracticeResults( + @RequestBody List list, + HttpServletResponse response) throws Exception { + /*for (PracticeProjectsUnderTheProductResp resp : list) { + resp.setTotalNumberOfPractices(resp.getTotalNumberOfPractices() + "/" + resp.getTotalNumberOfExercises()); + }*/ + experimentalReportService.exportProductPracticeResults(list, response); + } + + @ApiOperation(value = "产品维度下:批量导出产品下的考核成绩") + @PostMapping(value = "/exportProductAssessResults", produces = "application/json;multipart/form-data;charset=utf-8") + public void exportProductAssessResults( + @RequestBody List list, + HttpServletResponse response) throws Exception { + /*for (AssessProjectsUnderTheProductResp resp : list) { + resp.setTotalNumberOfParticipants(resp.getTotalNumberOfParticipants() + "/" + resp.getTotalAssessment()); + }*/ + experimentalReportService.exportProductAssessResults(list, response); + } + + + @ApiOperation(value = "产品维度下:批量导出学生练习成绩详情") + @PostMapping(value = "/exportDetailsOfStudentPracticeScores", produces = "application/json;multipart/form-data;charset=utf-8") + public void exportDetailsOfStudentPracticeScores( + @RequestBody PerformanceUnderProductReq req, + HttpServletResponse response, HttpServletRequest request) throws Exception { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + req.setSchoolId(schoolId); + experimentalReportService.exportDetailsOfStudentPracticeScores(req, response, request); + } + + @ApiOperation(value = "产品维度下:批量导出学生考核成绩详情") + @PostMapping(value = "/exportDetailsOfStudentAssessmentResults", produces = "application/json;multipart/form-data;charset=utf-8") + public void exportDetailsOfStudentAssessmentResults( + @RequestBody PerformanceUnderProductReq req, + HttpServletResponse response, HttpServletRequest request) throws Exception { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + req.setSchoolId(schoolId); + experimentalReportService.exportDetailsOfStudentAssessmentResults(req, response, request); + } + + + @PostMapping("/dataBinding") + @ApiOperation(value = "实验报告旧数据绑定绑定产品", response = ProductClassInformationVO.class) + public R dataBinding(HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + //获取本校全部班级列表 + List list = experimentalReportService.experimentalReportDataProcessing(); + + for (ExperimentalReportDataBindingResp resp: list) { + Assessment assessment = new Assessment(); + assessment.setId(resp.getId()); + assessment.setMallId(resp.getMallId()); + assessmentService.updateById(assessment); + } + return R.ok(); + } +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/ApplicantController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/ApplicantController.java new file mode 100644 index 0000000..1c220da --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/ApplicantController.java @@ -0,0 +1,160 @@ +package com.huoran.occupationlab.controller; + +import com.huoran.api.UserClient; +import com.huoran.common.constant.EnableStatus; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.occupationlab.entity.Applicant; +import com.huoran.occupationlab.entity.Contest; +import com.huoran.common.entity.School; +import com.huoran.occupationlab.entity.req.PageRegistrationStaffReq; +import com.huoran.occupationlab.entity.vo.ApplicantVO; +import com.huoran.occupationlab.service.ApplicantService; +import com.huoran.occupationlab.service.ContestRangeService; +import com.huoran.occupationlab.service.ContestService; +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 javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.Date; +import java.util.List; + +/** + * 赛事报名人员 前端控制器 + * + * @author chen + * @since 2020-10-15 + */ +@Api(description = "竞赛报名人员管理", tags = "竞赛报名人员管理") +@RestController +@RequestMapping("/occupationlab/enterprise/match/applicant") +public class ApplicantController { + + @Autowired + private ApplicantService applicantService; + @Autowired + private UserClient userClient; + + @Autowired + private ContestService contestService; + + @Autowired + private ContestRangeService contestRangeService; + + @ApiOperation(value = "是否禁用报名人员") + @PutMapping("/disableApplicant/{applicantId}/{isDisable}") + public R disableApplicant(@ApiParam(name = "applicantId", value = "ID", required = true) @PathVariable String applicantId, + + @ApiParam(name = "isDisable", value = "是否禁用", required = true) @PathVariable String isDisable) { + if (EnableStatus.ENABLE.equals(isDisable) || EnableStatus.NOT_ACTIVATED.equals(isDisable)) { + Applicant applicant = new Applicant(); + applicant.setId(applicantId); + applicant.setIsDisable(Integer.parseInt(isDisable)); + boolean update = applicantService.updateById(applicant); + return update ? R.ok() : R.error(); + } else { + return R.error("启用状态错误"); + } + } + + @ApiOperation(value = "添加报名人员") + @PostMapping("/addApplicant") + public R addApplicant(@ApiParam(name = "applicant", value = "报名人员对象", required = true) @RequestBody Applicant applicant, HttpServletRequest request) { + + String accountId = TokenUtils.getIdByJwtToken(request); + applicant.setAccountId(accountId); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + String contestId = applicant.getContestId(); + boolean isSignUp = applicantService.selectOne(accountId, contestId); + //添加前判断是否已报名 + if (!isSignUp) { + applicant.setGmtCreate(new Date()); + applicant.setGmtModified(new Date()); + Contest contest = contestService.getById(applicant.getContestId()); + //大赛范围(0:本校内 1:全平台 2:指定区域、院校) + if (contest.getCompetitionScope() == 2) { + //拿到当前用户所在学校省市信息 + School school = applicantService.getSchool(schoolId); + + boolean check = contestRangeService.checkWhetherToParticipate(school, contestId); + if (check) { + return R.error("你所在院校不符合参赛要求,无法报名!"); + } + } + + boolean save = applicantService.save(applicant); + return save ? R.ok() : R.error(); + } else { + return R.error("你已经报过名啦!"); + } + } + + + @ApiOperation(value = "报名人员分页条件查询", response = ApplicantVO.class) + @PostMapping("/queryApplicantByCondition") + public R conditionPageList(@RequestBody PageRegistrationStaffReq req, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + R applicantPageConditionQuery = applicantService.applicantPageConditionQuery(req); + return applicantPageConditionQuery; + } + + + @ApiOperation(value = "批量禁用人员参赛") + @PutMapping("/disableContests") + public R disableContests(@ApiParam(name = "ids", value = "多个id", required = true) @RequestParam("ids") List ids) { + if (ids != null && ids.size() != 0) { + boolean delete = applicantService.disableContests(ids); + return delete ? R.ok() : R.error(); + } else { + return R.error(); + } + } + + @ApiOperation(value = "导出全部数据", response = ApplicantVO.class) + @GetMapping("/excelExport") + public void excelExport(@RequestParam("contestId") @ApiParam(name = "contestId", value = "赛事ID", required = true) String contestId, HttpServletResponse response) { + try { + + PageRegistrationStaffReq req = new PageRegistrationStaffReq(); + req.setContestId(contestId); + req.setPageNum(1); + req.setPageSize(1000); + applicantService.export(response, req); + } catch (IOException e) { + e.printStackTrace(); + } + } + + + @ApiOperation(value = "批量导出数据") + @PostMapping(value = "/exportDataInBatches", produces = "application/json;multipart/form-data;charset=utf-8") + public void exportSubscribedRecords(@RequestBody List listOfExportSub, HttpServletResponse response, HttpServletRequest request) throws Exception { + applicantService.exportDataInBatches(listOfExportSub, response); + } + + /*@ApiOperation(value = "批量导出数据", response = ApplicantVO.class) + @GetMapping("/batchExport") + public void batchExport(@ApiParam(name = "ids", value = "多个id", required = true) @RequestParam("ids") List ids, HttpServletResponse response) { + try { + applicantService.batchExport(response, ids); + } catch (IOException e) { + e.printStackTrace(); + } + }*/ + + + @ApiOperation(value = "取消报名") + @PostMapping(value = "/cancelRegistration") + public R cancelRegistration(@RequestParam("contestId") @ApiParam(name = "contestId", value = "赛事ID", required = true) String contestId, HttpServletRequest request) throws Exception { + String accountId = TokenUtils.getIdByJwtToken(request); + return applicantService.cancelRegistration(contestId, Integer.valueOf(accountId)); + } + +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/ArticleController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/ArticleController.java new file mode 100644 index 0000000..f1a0828 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/ArticleController.java @@ -0,0 +1,188 @@ +package com.huoran.occupationlab.controller; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.api.UserClient; +import com.huoran.common.constant.EnableStatus; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.occupationlab.entity.Article; +import com.huoran.occupationlab.entity.Column; +import com.huoran.occupationlab.entity.vo.ArticleSort; +import com.huoran.occupationlab.service.ArticleService; +import com.huoran.occupationlab.service.ColumnService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.util.Date; +import java.util.List; + +/** + * 资讯文章 + * + * @author chen + * @since 2020-10-15 + */ +@Api(tags = "文章管理") +@RestController +@RequestMapping("/occupationlab/information/article") +public class ArticleController { + + @Autowired + private ArticleService articleService; + @Autowired + private UserClient userClient; + @Autowired + private ColumnService columnService; + + @ApiOperation(value = "栏目文章排序") + @PostMapping("/articleSort") + public R articleSort( + @ApiParam(name = "articleSort", value = "排序对象", required = true) + @RequestBody ArticleSort articleSort) { + boolean update = articleService.sort(articleSort); + return update ? R.ok() : R.error(); + } + + @ApiOperation(value = "是否启用文章") + @PutMapping("/enableArticle/{articleId}/{isEnable}") + public R enableArticle( + @ApiParam(name = "articleId", value = "文章ID", required = true) + @PathVariable Integer articleId, + @ApiParam(name = "isEnable", value = "isEnable", required = true) + @PathVariable String isEnable) { + if (EnableStatus.ENABLE.equals(isEnable) || EnableStatus.NOT_ACTIVATED.equals(isEnable)) { + Article article = new Article(); + article.setId(articleId); + article.setStatus(Integer.parseInt(isEnable)); + boolean update = articleService.updateById(article); + return update ? R.ok() : R.error(); + } else { + return R.error("启用状态错误"); + } + } + + @ApiOperation(value = "文章列表分页条件查询") + @GetMapping("/queryArticleByCondition/{current}/{pageSize}") + public R queryArticlePageList( + @ApiParam(name = "current", value = "当前页码", required = true) + @PathVariable int current, + @ApiParam(name = "pageSize", value = "每页记录数", required = true) + @PathVariable int pageSize, + @ApiParam(name = "columnId", value = "栏目Id", required = true) + @RequestParam(value = "columnId") String columnId, + @ApiParam(name = "port", value = "用户端0", required = false) + @RequestParam(value = "port", required = false) String port, + @RequestParam(value = "school",required = false) + @ApiParam(value = "学校id",required = false) String school, + HttpServletRequest request) { + + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + if (StringUtils.isNotEmpty(school)){ + schoolId = 0; + } + Page
page = new Page<>(current, pageSize); + //条件查询 + articleService.articlePageQuery(page, columnId, port, schoolId); + //总数 + long total = page.getTotal(); + //每页文章 + List
articleList = page.getRecords(); + return R.ok().put("total", total).put("articleList", articleList); + } + + @ApiOperation(value = "添加文章") + @PostMapping("/addArticle") + public R addArticle( + @ApiParam(name = "article", value = "文章对象", required = true) + @RequestBody Article article, HttpServletRequest request) { + //判重 + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + article.setSchoolId(schoolId); + boolean isRepeat = articleService.repeat(article); + if (isRepeat) { + return R.error("文章已存在"); + } + boolean save = articleService.save(article); + return save ? R.ok() : R.error(); + } + + @ApiOperation(value = "修改文章") + @PutMapping("/editArticle") + public R editArticle( + @ApiParam(name = "article", value = "文章对象", required = true) + @RequestBody Article article) { + boolean isRepeat = articleService.repeat(article); + if (isRepeat) { + return R.error("文章已存在"); + } + boolean update = articleService.updateById(article); + return update ? R.ok() : R.error(); + } + + @ApiOperation(value = "根据id查询文章") + @GetMapping("/getArticle") + public R getArticle( + @ApiParam(name = "articleId", value = "文章ID", required = true) + @RequestParam String articleId) { + Article article = articleService.getArticle(articleId); + return R.ok().put("article", article); + } + + @ApiOperation(value = "根据id删除文章") + @DeleteMapping("/deleteArticle/{articleId}") + public R deleteArticle( + @ApiParam(name = "articleId", value = "文章ID", required = true) + @PathVariable String articleId) { + boolean remove = articleService.removeById(articleId); + return remove ? R.ok() : R.error(); + } + + @ApiOperation(value = "批量删除文章") + @DeleteMapping("/deleteArticles") + public R deleteArticles( + @ApiParam(name = "articleIds", value = "多个文章id", required = true) + @RequestParam("articleIds") List articleIds) { + if (articleIds != null && articleIds.size() != 0) { + boolean delete = articleService.removeByIds(articleIds); + return delete ? R.ok() : R.error(); + } else { + return R.error(); + } + } + + @ApiOperation(value = "添加资讯内置数据(远程调用)") + @PostMapping("/addArticleData") + public boolean addArticleData(@RequestParam("accountId") @ApiParam(value = "账号id") Integer accountId, + @RequestParam("schoolId") @ApiParam(value = "学校id") Integer schoolId) { + //添加栏目 + Column column = new Column(); + column.setLevel(1); + column.setName("校园资讯"); + column.setParentId(0); + column.setSchoolId(schoolId); + column.setPlatformId(1); + column.setSort(1); + boolean saveColumn = columnService.saveColumn(column); + + Article article = new Article(); + article.setSchoolId(schoolId); + article.setColumnId(column.getId()); + article.setAuthor("超管"); + article.setContent("内置数据"); + article.setSort(1); + article.setDate(new Date()); + article.setCoverUrl("https://huoran.oss-cn-shenzhen.aliyuncs.com/20211104/jpg/1456157181287620608.jpg"); + article.setTitle("样例,可自行删除......"); + boolean save = articleService.save(article); + return save && saveColumn; + } + +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/AssessmentController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/AssessmentController.java new file mode 100644 index 0000000..e001452 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/AssessmentController.java @@ -0,0 +1,269 @@ +package com.huoran.occupationlab.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.api.NakadaiClient; +import com.huoran.api.UserClient; +import com.huoran.common.aop.annotation.LogAnnotation; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.occupationlab.entity.Assessment; +import com.huoran.occupationlab.entity.req.AssessmentReq; +import com.huoran.occupationlab.entity.req.PageAssessmentReq; +import com.huoran.occupationlab.entity.req.PageStuAssessmentReq; +import com.huoran.occupationlab.entity.resp.StuAssessmentListResp; +import com.huoran.occupationlab.entity.vo.AssessmentVO; +import com.huoran.occupationlab.service.*; +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 javax.servlet.http.HttpServletRequest; +import javax.validation.Valid; +import java.text.ParseException; +import java.util.List; + +/** + * 考核管理 + * + * @author lr + * @since 2021-08-18 + */ +@RestController +@RequestMapping("/occupationlab/assessment") +@Api(value = "职站:考核管理", tags = "职站:考核管理") +public class AssessmentController { + @Autowired + public AssessmentService assessmentService; + @Autowired + public AssessmentExamService examService; + + @Autowired + public ExperimentalReportService reportService; + @Autowired + public PythonSystemService pythonSystemService; + + @Autowired + public ClassService classService; + + @Autowired + private UserClient userClient; + + @Autowired + private NakadaiClient nakadaiClient; + + /** + * @描述: 创建考核 + * @入参: + * @出参: + * @作者: Rong + * @日期: 2021-08-18 + **/ + @PostMapping("/saveAssessment") + @ApiOperation(value = "创建考核") + @LogAnnotation(title = "职站:考核管理", action = "创建考核") + public R saveAssessment(@RequestBody @Valid AssessmentReq req, HttpServletRequest request) throws ParseException { + String accountId = TokenUtils.getIdByJwtToken(request); + req.setAccountId(Integer.valueOf(accountId)); + req.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); + return assessmentService.saveAssessment(req); + } + + /** + * 教师端——考核管理列表 + * 测评设置默认关闭,关闭时,前台学生端点击课程时,没有测评按钮 + * 启动了就不能修改和删除但是结束后可以删除,但不可修改 + * 每个老师只能看到自己创建的考核,管理员可以看到所有老师创建的考核并且进行所有的操作。 + * + * @param req + * @return + */ + @PostMapping("/pageByCondition") + @ApiOperation(value = "教师端——考核管理列表", response = Assessment.class) + public R pageByCondition(@RequestBody PageAssessmentReq req, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + req.setAccountId(Integer.valueOf(accountId)); + req.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); + List pageByCondition = assessmentService.pageByCondition(req); + + return R.ok().put("list", pageByCondition).put("total", assessmentService.pageByConditionNum(req)); + } + + /** + * 删除 + */ + @ApiOperation(value = "单个、批量删除") + @PostMapping("/deleteAssessment") + public R deleteAssessment(@RequestBody List ids) { + return assessmentService.deleteAssessment(ids); + } + + /** + * 编辑考核 + * + * @param ass + * @return + */ + @ApiOperation(value = "编辑考核") + @PostMapping("/modifyAssessment") + @LogAnnotation(title = "职站:考核管理", action = "编辑考核") + public R modifyAssessment(@RequestBody @Valid Assessment ass, HttpServletRequest request) throws ParseException { + String accountId = TokenUtils.getIdByJwtToken(request); + ass.setAccountId(Integer.valueOf(accountId)); + if (assessmentService.checkReapt(ass) == false) { + return R.error("该考核名称已存在重复的!"); + } + return assessmentService.modifyAssessment(ass); + } + + /** + * @Description : 启用考核 + * @Param id + * @Param request + * @Author Rong---2021/11/15 + */ + @ApiOperation(value = "启用考核") + @PostMapping("/enableAssessment") + @LogAnnotation(title = "职站:考核管理", action = "启用考核") + public R enableAssessment(@RequestParam("id") @ApiParam(value = "考核id") Integer id, HttpServletRequest request) throws ParseException { + String accountId = TokenUtils.getIdByJwtToken(request); + return assessmentService.enableAssessment(id); + } + + /** + * 根据考核Id查询考核详情 + * + * @param id + * @return + */ + @ApiOperation(value = "根据考核Id查询考核详情", response = Assessment.class) + @GetMapping("/getDetailById") + public R getDetailById(@RequestParam("id") @ApiParam(value = "考核id") Integer id) { + return assessmentService.getDetailById(id); + } + + /** + * 收卷 + * + * @param id + * @return + */ + @PostMapping("/collectPaper") + @ApiOperation(value = "收卷(结束考试)") + @LogAnnotation(title = "职站:考核管理", action = "收卷(结束考试)") + public R collectPaper(@RequestParam("id") @ApiParam(value = "考核id") Integer id) { + return assessmentService.collectPaper(id); + } + + /** + * 根据学生账号id查询被发布的课程名称 + *2023.07.10更改为获取绑定的产品 + * @param request + * @return + */ + @ApiOperation(value = "学生端——课程名称", response = AssessmentVO.class) + @GetMapping("/getPythonSysByStuAccountId") + public R getPythonSysByStuAccountId(HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + List assessment = pythonSystemService.getCourseTitle(Integer.valueOf(accountId), userClient.getSchoolIdByAccountId(accountId)); + return R.ok(assessment); + } + + /** + * 学生考核列表 + * 展示老师发布班级的考核 以及无指定范围班级的考核 + * + * @param req + * @return + */ + @ApiOperation(value = "学生端——学生考核列表", response = StuAssessmentListResp.class) + @PostMapping("/pageStuAssessment") + public R pageStuAssessment(@RequestBody PageStuAssessmentReq req, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + req.setAccountId(Integer.valueOf(accountId)); + req.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); + List assessment = assessmentService.pageStuAssessment(req); + for (StuAssessmentListResp resp : assessment) { + + //返回返回当前学生的实验报告id + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("account_id", Integer.valueOf(accountId)); + queryWrapper.eq("assessment_id", resp.getAssessmentId()); + queryWrapper.eq("class_id", resp.getClassId()); + com.huoran.common.entity.ExperimentalReport report = reportService.getOne(queryWrapper); + + if (report != null) { + resp.setReportId(report.getReportId()); + } + } + return R.ok().put("list", assessment).put("total", assessmentService.pageStuAssessmentNum(req)); + } + + /** + * 学生端进入考试 + * 进入考试情况分为3种: + * 1.指定班级或学生才能进入 + * 2.没有邀请码的可直接进入 + * 3.需要邀请码的才能进入 + * + * @param assessmentId + * @param classId + * @param request + * @return + */ + @ApiOperation(value = "学生端——进入考试(进入考核)", response = StuAssessmentListResp.class) + @PostMapping("/enterExam") + public R enterExam(@RequestParam("assessmentId") @ApiParam(value = "考核id(必填)", required = true) Integer assessmentId, + @RequestParam("classId") @ApiParam(value = "班级id(必填)", required = true) Integer classId, + @RequestParam(value = "invitationCode", required = false) @ApiParam(value = "邀请码(非必填)", required = false) Integer invitationCode, + HttpServletRequest request) { + return assessmentService.enterExam(assessmentId, classId, invitationCode, request); + } + + @ApiOperation(value = "提交考试(远程调用)", response = StuAssessmentListResp.class) + @PostMapping("/submitExam") + @LogAnnotation(title = "职站:考核管理", action = "学生提交考试(远程调用)") + public boolean submitExam(@RequestParam("assessmentId") @ApiParam(value = "考核id(必填)") Integer assessmentId, + @RequestParam("classId") @ApiParam(value = "班级id(必填)") Integer classId, + @RequestParam("accountId") @ApiParam(value = "账号id(必填)") Integer accountId, + @RequestParam("score") @ApiParam(value = "分数(必填)") Integer score + + ) { + return assessmentService.submitExam(assessmentId, classId, accountId, score); + } + + @ApiOperation(value = "根据考核id获取考核创建人Id") + @GetMapping("/getTeacherIdByAssessmentId") + public Integer getTeacherIdByAssessmentId(@RequestParam("assessmentId") @ApiParam(value = "考核id(必填)") Integer assessmentId) { + Assessment assessment = this.assessmentService.getById(assessmentId); + return assessment.getAccountId(); + } + + //启动考核任务处理器 +// @XxlJob("assessmentJobStart") +// public void assessmentJobStart() { +// // 获取任务参数 +// String assessmentId = XxlJobHelper.getJobParam(); +// //启动考核 +// Assessment assessment = new Assessment(); +// assessment.setStatus(1); +// assessment.setId(Integer.valueOf(assessmentId)); +// assessmentService.updateById(assessment); +// } + + //停止考核任务处理器 +// @XxlJob("assessmentJobStop") +// public void assessmentJobStop() { +// // 获取任务参数 +// String assessmentId = XxlJobHelper.getJobParam(); +// //停止考核 +// Assessment assessment = new Assessment(); +// assessment.setStatus(2); +// assessment.setId(Integer.valueOf(assessmentId)); +// assessmentService.updateById(assessment); +// //通知收卷 +// nakadaiClient.refreshPageNotification("系统通知","all","3-"+assessmentId); +// } +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/CityController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/CityController.java new file mode 100644 index 0000000..183d3ff --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/CityController.java @@ -0,0 +1,49 @@ +package com.huoran.occupationlab.controller; + + +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.City; +import com.huoran.occupationlab.service.CityService; +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.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.List; + +/** + *

+ * 城市 前端控制器 + *

+ * + * @author Ning + * @since 2020-10-27 + */ +@RestController +@RequestMapping("/occupationlab/enterprise/city") +@Api(description = "城市", tags = "城市") +public class CityController { + @Autowired + private CityService cityService; + + /** + * 查询员工专业架构 + */ + @ApiOperation(value = "查询城市") + @GetMapping("/queryCity") + public R queryCity( + @ApiParam(name = "provinceId", value = "省份id", required = true) + @RequestParam Integer provinceId) { + if (provinceId == null) { + return R.error("省份id为空,查询失败!"); + } else { + List list = cityService.queryCity(provinceId); + return R.ok().put("list", list); + } + } +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/ClassController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/ClassController.java new file mode 100644 index 0000000..d403f88 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/ClassController.java @@ -0,0 +1,42 @@ +package com.huoran.occupationlab.controller; + + +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.Class; +import com.huoran.occupationlab.service.ClassService; +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.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 班级表 前端控制器 + *

+ * + * @author lr + * @since 2021-08-18 + */ +@RestController +@RequestMapping("/occupationlab/class") +@Api(value = "职站:学生组织架构相关", tags = "职站:学生班级相关") +public class ClassController { + @Autowired + public ClassService classService; + + @ApiOperation(value = "查询班级详情") + @GetMapping("/queryClassDetails") + public boolean queryClassDetails(@RequestParam("id") @ApiParam(value = "班级id") Integer id) { + Class details = classService.getById(id); + if (details == null) { + return false; + } + return true; + } +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/ClientManagementController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/ClientManagementController.java new file mode 100644 index 0000000..3fdda15 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/ClientManagementController.java @@ -0,0 +1,165 @@ +package com.huoran.occupationlab.controller; + + +import com.google.common.collect.Maps; +import com.huoran.common.entity.NewClientManagement; +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.ClientManagement; +import com.huoran.occupationlab.service.ClientManagementService; +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; + +/** + *

+ * 企业端客户管理 前端控制器 + *

+ * + * @author Ning + * @since 2020-10-27 + */ +@RestController +@RequestMapping("/occupationlab/enterprise/client") +@Api(description = "客户管理", tags = "客户管理") +public class ClientManagementController { + + @Autowired + private ClientManagementService service; + + /** + * 添加客户信息 + */ + @ApiOperation(value = "添加客户信息") + @PostMapping("/addClient") + public R addClient(@ApiParam(name = "clientManagement", value = "客户管理实体", required = true) + @RequestBody ClientManagement clientManagement) { + if (clientManagement == null) { + return R.error("数据有误,新增客户失败!"); + } else { + boolean ret = service.addClient(clientManagement); + return ret ? R.ok() : R.error(); + } + } + + /** + * 查询客户列表 + */ + @ApiOperation(value = "查询客户列表") + @GetMapping("/list/{current}/{pageSize}") + public R list( + @ApiParam(name = "current", value = "当前页码", required = true) + @PathVariable int current, + @ApiParam(name = "pageSize", value = "每页记录数", required = true) + @PathVariable int pageSize, + @ApiParam(name = "searchContent", value = "搜索内容", required = false) + @RequestParam(value = "searchContent", required = false) String searchContent, + @ApiParam(name = "provinceId", value = "省份id", required = false) + @RequestParam(value = "provinceId", required = false) Integer provinceId, + @ApiParam(name = "cityId", value = "城市id", required = false) + @RequestParam(value = "cityId", required = false) Integer cityId) { + HashMap map = Maps.newHashMap(); + map.put("current", (current - 1) * pageSize); + map.put("pageSize", pageSize); + if (provinceId != null) { + map.put("provinceId", provinceId); + } + if (cityId != null) { + map.put("cityId", cityId); + } + if (searchContent != null) { + map.put("searchContent", searchContent); + } + List list = service.queryList(map); + int total = service.queryListCount(map); + return R.ok().put("list", list).put("total", total); + } + + /** + * 删除员工年级 + */ + @ApiOperation(value = "批量删除客户") + @PostMapping("/deleteClient") + public R deleteClient(@ApiParam(name = "clientIds", value = "多个客户id", required = true) + @RequestParam List clientIds) { + if (clientIds.isEmpty()) { + return R.error("客户id为空,删除失败!"); + } else { + boolean ret = service.deleteClient(clientIds); + return ret ? R.ok() : R.error(); + } + } + + /** + * 更新员工年级 + */ + @ApiOperation(value = "更新客户") + @PostMapping("/updateClient") + public R updateClient(@ApiParam(name = "NewClientManagement", value = "客户实体", required = true) + @RequestBody ClientManagement clientManagement) { + if (clientManagement == null) { + return R.error("客户实体为空,修改失败!"); + } else { + boolean ret = service.updateClient(clientManagement); + return ret ? R.ok() : R.error(); + } + } + + /** + * 根据id查询客户详情 + */ + @ApiOperation(value = "根据id查询客户详情") + @GetMapping("/getClient/{clientId}") + public R getClient( + @ApiParam(name = "clientId", value = "客户id", required = true) + @PathVariable int clientId) { + ClientManagement client = service.getById(clientId); + return R.ok().put("client", client); + } + + /** + * 查询客户名称 + */ + @ApiOperation(value = "查询客户名称") + @GetMapping("/getClientName") + public R getClientName( + @ApiParam(name = "clientName", value = "客户名称", required = true) + @RequestParam String clientName) { + List client = service.getClientName(clientName); + return R.ok().put("client", client); + } + + /** + * 查询客户名称 + */ + @ApiOperation(value = "查询客户名称大小") + @GetMapping("/queryClientNameSize") + public R queryClientNameSize( + @ApiParam(name = "clientName", value = "客户名称", required = true) + @RequestParam String clientName) { + int client = service.queryClientNameSize(clientName); + return R.ok().put("client", client); + } + + + /** + * 根据客户名称查询一个客户返回客户id + */ + @ApiOperation(value = "根据客户名称查询一个客户返回客户id") + @GetMapping("/queryOneClient") + public NewClientManagement queryOneClient( + @ApiParam(name = "clientName", value = "客户名称", required = true) + @RequestParam String clientName) { + NewClientManagement client = service.queryOneClient(clientName); + if (client != null) { + return client; + } else { + return client; + } + } +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/ClockScheduledController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/ClockScheduledController.java new file mode 100644 index 0000000..63a3081 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/ClockScheduledController.java @@ -0,0 +1,72 @@ +package com.huoran.occupationlab.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.occupationlab.entity.Assessment; +import com.huoran.occupationlab.service.AssessmentService; +import com.huoran.occupationlab.service.StudentService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * @ProjectName: gzedu + * @Package: com.huoran.user.controller + * @ClassName: test + * @Description: java类作用描述 + * @Author: Maureen.Rong + * @CreateDate: 2020/12/7 11:35 + * @UpdateDate: 2020/12/7 11:35 + * @Version: 1.0 + */ +@Component +@RestController +public class ClockScheduledController { + + @Autowired + public StudentService studentService; + + @Autowired + public AssessmentService service; + + //考核自启动 + @Scheduled(fixedRate = 1000) + public void timer2() { + /*//查询考核类型为定时发布且考核状态为待开始状态以及开始时间为当前时间时候 则启动考核 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("type", 2);//发布类型(1、手动发布 2、定时发布) + queryWrapper.eq("is_del", 0); + queryWrapper.eq("status", 0);//状态(0、待开始 1、进行中 2、已结束) + queryWrapper.last(" AND start_time = now() "); + List list = service.list(queryWrapper); + if (list.size() > 0) { + for (Assessment experimentalTeaching : list) { + //启动考核 + Assessment update = new Assessment(); + update.setStatus(1); + update.setId(experimentalTeaching.getId()); + service.updateById(update); + } + } + + //当结束时间为当前时间 且发布类型为定时发布的以及考核状态为进行中的 则停止考核 + QueryWrapper queryWrapper1 = new QueryWrapper<>(); + //queryWrapper1.eq("type", 2); + queryWrapper1.eq("is_del", 0); + queryWrapper1.eq("status", 1); + queryWrapper1.last(" AND stop_time = now() "); + List list1 = service.list(queryWrapper1); + if (list1.size() > 0) { + for (Assessment experimentalTeaching : list1) { + //停止考核 + Assessment update = new Assessment(); + update.setStatus(2); + update.setId(experimentalTeaching.getId()); + service.updateById(update); + } + }*/ + + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/ColumnController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/ColumnController.java new file mode 100644 index 0000000..6b7f255 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/ColumnController.java @@ -0,0 +1,128 @@ +package com.huoran.occupationlab.controller; + +import com.huoran.api.UserClient; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.occupationlab.entity.Column; +import com.huoran.occupationlab.entity.vo.ColumnSort; +import com.huoran.occupationlab.service.ColumnService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + * 资讯栏目 + * + * @author chen + * @since 2020-10-15 + */ +@Api(tags = "资讯栏目管理") +@RestController +@RequestMapping("/occupationlab/information/column") +public class ColumnController { + + @Autowired + private ColumnService columnService; + @Autowired + private UserClient userClient; + + @ApiOperation(value = "栏目树") + @GetMapping("/queryAllColumns") + public R queryAllColumns( + @RequestParam(value = "platformId",required = false) @ApiParam(value = "平台id") String platformId, + @RequestParam(value = "school",required = false) + @ApiParam(value = "学校id",required = false) String school, + HttpServletRequest request) { + + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + if (StringUtils.isNotEmpty(school)){ + schoolId = 0; + } + List columnTree = columnService.columnTree(schoolId,platformId); + return R.ok().put("columnTree", columnTree); + } + + @ApiOperation(value = "编辑排序") + @PostMapping("/reorder") + public R columnReorder( + @ApiParam(name = "columnSort", value = "栏目重排序对象", required = true) + @RequestBody ColumnSort columnSort) { + boolean update = columnService.updateSort(columnSort); + return update ? R.ok() : R.error(); + } + + @ApiOperation(value = "添加栏目") + @PostMapping("/addColumn") + public R addColumn( + @ApiParam(name = "column", value = "栏目对象", required = true) + @RequestBody Column column, HttpServletRequest request) { + + //限制层级4级 + if (column.getLevel() > 3) { + return R.error("暂不支持" + column.getLevel() + "层级"); + } + String accountId = TokenUtils.getIdByJwtToken(request); + column.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); + + if (column.getParentId()==null){ + column.setParentId(0); + } + //判重 + boolean isRepeat = columnService.repeat(column); + if (isRepeat) { + return R.error("栏目已存在"); + } + boolean save = columnService.saveColumn(column); + return save ? R.ok() : R.error(); + } + + @ApiOperation(value = "修改栏目") + @PutMapping("/editColumn") + public R editColumn( + @ApiParam(name = "column", value = "栏目对象", required = true) + @RequestBody Column column) { + //判重 + boolean isRepeat = columnService.repeat(column); + if (isRepeat) { + return R.error("栏目已存在"); + } + + boolean update = columnService.updateById(column); + return update ? R.ok() : R.error(); + } + + @ApiOperation(value = "删除栏目") + @DeleteMapping("/deleteColumn/{columnId}") + public R deleteColumn( + @ApiParam(name = "columnId", value = "栏目ID", required = true) + @PathVariable Integer columnId) { + boolean remove = columnService.removeColumn(columnId); + return remove ? R.ok() : R.error(); + } + + @ApiOperation(value = "一级栏目") + @GetMapping("/firstLevelColumn") + public R firstLevelColumn(HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + List list = columnService.firstLevelColumn(schoolId); + return R.ok().put("data", list); + } + + @ApiOperation(value = "根据一级栏目获取二级栏目") + @GetMapping("/secondaryColumnsByFirst") + public R secondaryColumnsByFirst(@RequestParam("parentId") @ApiParam(value = "一级分类id") String parentId, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + List list = columnService.secondaryColumnsByFirst(parentId, schoolId); + return R.ok().put("data", list); + } +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/ContestAnnexController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/ContestAnnexController.java new file mode 100644 index 0000000..305039e --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/ContestAnnexController.java @@ -0,0 +1,42 @@ +package com.huoran.occupationlab.controller; + + +import com.huoran.occupationlab.entity.ContestAnnex; +import com.huoran.occupationlab.entity.ContestAnnouncementAnnex; +import com.huoran.occupationlab.service.ContestAnnexService; +import io.swagger.annotations.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import com.huoran.common.response.R; + +@RestController +@RequestMapping("/occupationlab/contest/annex") +@Api(value = "API - 中台:ContestAnnexController", tags = "中台:赛事附件") +public class ContestAnnexController { + + @Autowired + private ContestAnnexService contestAnnexService; + + @PostMapping("/update") + @ApiOperation(value = "编辑赛事附件",response = ContestAnnex.class) + public R update(@RequestBody ContestAnnex contestAnnex) { + boolean update = contestAnnexService.updateById(contestAnnex); + return update ? R.ok() : R.error(); + } + + + @PostMapping("/save") + @ApiOperation(value = "新增赛事附件",response = ContestAnnex.class) + public R save(@RequestBody ContestAnnex contestAnnex) { + boolean save = contestAnnexService.save(contestAnnex); + return save ? R.ok() : R.error(); + } + + @PostMapping("/delete") + @ApiOperation(value = "删除赛事附件",response = ContestAnnex.class) + public R delete(@RequestParam("id") @ApiParam(name = "id", value = "附件id", required = true) Integer id) { + boolean del = contestAnnexService.removeById(id); + return del ? R.ok() : R.error(); + } +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/ContestAnnouncementAnnexController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/ContestAnnouncementAnnexController.java new file mode 100644 index 0000000..93ec457 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/ContestAnnouncementAnnexController.java @@ -0,0 +1,67 @@ +package com.huoran.occupationlab.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.common.constant.DelConstant; +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.ContestAnnouncementAnnex; +import com.huoran.occupationlab.service.ContestAnnouncementAnnexService; +import io.swagger.annotations.*; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.springframework.beans.factory.annotation.Autowired; +import org.apache.commons.lang.StringUtils; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; + +import java.util.List; + + +/** + * @描述:大赛公告附件存储控制类 + * @作者: Rong + * @日期: 2022-06-17 + */ +@RestController +@RequestMapping("/occupationlab/contestAnnouncementAnnex") +@Api(value = "API - 中台:ContestAnnouncementAnnexController", tags = "中台:大赛公告附件存储") +public class ContestAnnouncementAnnexController { + + @Autowired + public ContestAnnouncementAnnexService service; + + @PostMapping("/viewAttachments") + @ApiOperation(value = "查看公告下的附件",response = ContestAnnouncementAnnex.class) + public R findById(@RequestParam("announcementId") @ApiParam(value = "announcementId") Integer announcementId) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("announcement_id",announcementId); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + List annexList = service.list(queryWrapper); + return R.ok().put("list",annexList); + } + + @PostMapping("/save") + @ApiOperation(value = "新增",response = ContestAnnouncementAnnex.class) + public R save(@RequestBody ContestAnnouncementAnnex contestAnnouncementAnnex) { + boolean save = service.save(contestAnnouncementAnnex); + return save ? R.ok() : R.error(); + } + + + @PostMapping("/update") + @ApiOperation(value = "修改",response = ContestAnnouncementAnnex.class) + public R update(@RequestBody ContestAnnouncementAnnex contestAnnouncementAnnex) { + boolean update = service.updateById(contestAnnouncementAnnex); + return update ? R.ok() : R.error(); + } + + + @PostMapping("/delete") + @ApiOperation(value = "根据主键删除",response = ContestAnnouncementAnnex.class) + public R delete(@RequestParam("id") @ApiParam(value = "id")Integer id) { + boolean delete = service.removeById(id); + return delete ? R.ok() : R.error(); + } +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/ContestAnnouncementController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/ContestAnnouncementController.java new file mode 100644 index 0000000..cd334f1 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/ContestAnnouncementController.java @@ -0,0 +1,111 @@ +package com.huoran.occupationlab.controller; + + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.common.constant.DelConstant; +import com.huoran.common.constant.EnableStatus; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.occupationlab.entity.Applicant; +import com.huoran.occupationlab.entity.ContestAnnex; +import com.huoran.occupationlab.entity.ContestAnnouncement; +import com.huoran.occupationlab.entity.ContestAnnouncementAnnex; +import com.huoran.occupationlab.service.ContestAnnouncementAnnexService; +import com.huoran.occupationlab.service.ContestAnnouncementService; +import io.swagger.annotations.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + * @描述:赛事公告控制类 + * @作者: Rong + * @日期: 2022-06-17 + */ +@RestController +@RequestMapping("/occupationlab/contest/announcement") +@Api(value = "API - 中台:ContestAnnouncementController", tags = "中台:赛事公告") +public class ContestAnnouncementController { + + + @Autowired + public ContestAnnouncementService service;//公告 + + @Autowired + public ContestAnnouncementAnnexService annexService;//大赛公告附件 + + + @PostMapping("/queryAnnouncementDetails") + @ApiOperation(value = "查询公告详情",response = ContestAnnouncement.class) + public R findById(@RequestParam("id") @ApiParam(value = "公告主键") Integer id) { + ContestAnnouncement contestAnnouncement = service.getById(id); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("announcement_id",id); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + List annexList = annexService.list(queryWrapper); + if (annexList.size()>0){ + contestAnnouncement.setAnnouncementAnnexList(annexList); + } + return R.ok().put("data", contestAnnouncement); + } + + + @PostMapping("/addAnnouncement") + @ApiOperation(value = "新增公告",response = ContestAnnouncement.class) + public R save(@RequestBody ContestAnnouncement contestAnnouncement, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + contestAnnouncement.setAccountId(Integer.valueOf(accountId)); + boolean save = service.save(contestAnnouncement); + if (contestAnnouncement.getAnnouncementAnnexList().size() > 0) { + contestAnnouncement.getAnnouncementAnnexList().forEach(contestAnnex -> { + contestAnnex.setAnnouncementId(contestAnnouncement.getId()+""); + boolean saveContestAnnex = annexService.save(contestAnnex);//保存比赛附件 + }); + } + return save ? R.ok() : R.error(); + } + + + @PostMapping("/amendmentAnnouncement") + @ApiOperation(value = "修改公告",response = ContestAnnouncement.class) + public R update(@RequestBody ContestAnnouncement contestAnnouncement) { + boolean update = service.updateById(contestAnnouncement); + return update ? R.ok() : R.error(); + } + + + @ApiOperation(value = "是否禁用公告") + @PutMapping("/disableAnnouncement") + public R disableAnnouncement(@ApiParam(name = "id", value = "公告主键", required = true) @RequestParam Integer id, + @ApiParam(name = "isDisable", value = "是否开启(0开启 1未开启 默认0)", required = true)@RequestParam Integer isDisable) { + if (isDisable==1 || isDisable==0) { + ContestAnnouncement contestAnnouncement = new ContestAnnouncement(); + contestAnnouncement.setId(id); + contestAnnouncement.setIsOpen(isDisable); + boolean update = service.updateById(contestAnnouncement); + return update ? R.ok() : R.error(); + } else { + return R.error("启用状态错误"); + } + } + + @PostMapping("/deleteAnnouncement") + @ApiOperation(value = "删除公告",response = ContestAnnouncement.class) + public R delete(@RequestParam("id") @ApiParam(value = "公告主键") Integer id) { + boolean del = service.removeById(id); + return del ? R.ok() : R.error(); + } + + + @PostMapping("/queryAnnouncementByContestId") + @ApiOperation(value = "根据赛事id查询公告列表(分页)",response = ContestAnnouncement.class) + public R queryAnnouncementByContestId(@RequestParam("contestId") @ApiParam(value = "赛事id") String contestId, + @ApiParam(value = "当前页数", required = true) @RequestParam("pageNum") Integer pageNum, + @ApiParam(value = "当前页需要显示的数量", required = true) @RequestParam("pageSize") Integer pageSize) { + return service.queryAnnouncementByContestId(contestId, pageNum, pageSize); + } +} + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/ContestController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/ContestController.java new file mode 100644 index 0000000..cc815e7 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/ContestController.java @@ -0,0 +1,300 @@ +package com.huoran.occupationlab.controller; + +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.huoran.api.UserClient; +import com.huoran.common.constant.DelConstant; +import com.huoran.common.response.R; +import com.huoran.common.utils.DateUtils; +import com.huoran.common.utils.TokenUtils; +import com.huoran.occupationlab.entity.Contest; +import com.huoran.occupationlab.entity.ContestAnnex; +import com.huoran.occupationlab.entity.ContestRange; +import com.huoran.occupationlab.entity.req.AfterLoginPageContestListReq; +import com.huoran.occupationlab.entity.req.DisableEnableContestReq; +import com.huoran.occupationlab.entity.req.PageContestListReq; +import com.huoran.occupationlab.entity.vo.ContestVO; +import com.huoran.occupationlab.service.ContestAnnexService; +import com.huoran.occupationlab.service.ContestRangeService; +import com.huoran.occupationlab.service.ContestService; +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 javax.servlet.http.HttpServletRequest; +import java.util.Date; +import java.util.List; + +/** + * 竞赛管理 前端控制器 + * + * @author chen + * @since 2020-10-15 + */ +@Api(description = "赛事管理", tags = "赛事管理") +@RestController +@RequestMapping("/occupationlab/enterprise/match/contest") +public class ContestController { + @Autowired + private UserClient userClient; + @Autowired + private ContestService contestService; + + @Autowired + private ContestRangeService contestRangeService; + + @Autowired + private ContestAnnexService contestAnnexService; + + @ApiOperation(value = "创建竞赛") + @PostMapping("/addContest") + public R addContest(@ApiParam(name = "contest", value = "赛事对象", required = true) @RequestBody Contest contest, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + contest.setSchoolId(schoolId); + contest.setFounderId(accountId); +// String getSchoolName = contestService.getSchoolNameById(schoolId); +// contest.setFounderName(getSchoolName); + + + //平台来源(0:中台,1:职站) + if (contest.getPlatformSource() == 0) { + contest.setFounderName("平台创建"); + } + + //判重: + // 2022-06.16 当前判重逻辑——>比赛范围为非本校内的比赛,名字要全平台判重。本校内的竞赛名字,只需要本校内判重 + boolean isRepeat = contestService.repeat(contest); + if (isRepeat) { + return R.error("赛事已存在"); + } + boolean save = contestService.save(contest); + + if (contest.getContestAnnexList().size() > 0) { + contest.getContestAnnexList().forEach(contestAnnex -> { + contestAnnex.setContestId(contest.getId()); + boolean saveContestAnnex = contestAnnexService.save(contestAnnex);//保存比赛附件 + }); + + } + if (contest.getContestRangeList().size() > 0) { + contest.getContestRangeList().forEach(contestRange -> { + String getContestId = contest.getId(); + contestRange.setContestId(getContestId); + boolean saveContestRange = contestRangeService.save(contestRange);//保存比赛范围 + }); + } + + + return save ? R.ok() : R.error(); + } + + + @ApiOperation(value = "修改赛事") + @PostMapping("/editContest") + public R editContest(@ApiParam(name = "contest", value = "赛事对象", required = true) @RequestBody Contest contest) { + boolean update = contestService.updateById(contest); + + + if (contest.getCompetitionScope() == 2) { + if (contest.getContestRangeList().size() > 0) { + + //1.首先删除原有的大赛范围选择 + UpdateWrapper annexUpdateWrapper = new UpdateWrapper<>(); + annexUpdateWrapper.set("is_del", DelConstant.IS_DEL); + annexUpdateWrapper.eq("contest_id", contest.getId()); + boolean delContestAnnex = contestRangeService.update(new ContestRange(), annexUpdateWrapper); + + //2.重新保存比赛范围 + contest.getContestRangeList().forEach(contestRange -> { + contestRange.setContestId(contest.getId()); + boolean saveContestRange = contestRangeService.save(contestRange);//保存比赛范围 + }); + } + } + return update ? R.ok() : R.error(); + } + + + + @ApiOperation(value = "根据id删除赛事") + @PostMapping("/deleteContest") + public R deleteContest(@ApiParam(name = "contestId", value = "赛事ID", required = true) @RequestParam String contestId) { + boolean remove = contestService.removeContest(contestId); + return remove ? R.ok() : R.error(); + } + + + @ApiOperation(value = "批量删除赛事") + @PostMapping("/batchDeleteContest") + public R deleteContest(@ApiParam(name = "contestIds", value = "赛事ID", required = true) @RequestParam List contestIds) { + contestIds.forEach(contestId->{ + contestService.removeContest(contestId); + }); + return R.ok(); + } + + @ApiOperation(value = "根据id查询赛事", response = ContestRange.class) + @PostMapping("/getContest") + public R getContest(@ApiParam(name = "contestId", value = "赛事ID", required = true) @RequestParam("contestId") String contestId) { + Contest contest = contestService.getById(contestId); + List contestAnnexList = contestAnnexService.getContestAnnexByContestId(contestId); + List contestRangeList = contestRangeService.getContestRangeByContestId(contestId); + if (contestRangeList.size() > 0) { + contest.setContestRangeList(contestRangeList); + } + if (contestAnnexList.size() > 0) { + contest.setContestAnnexList(contestAnnexList); + } + + if (contest.getCompetitionScope() == 1) { + contest.setRange("全平台"); + } else if (contest.getCompetitionScope() == 2) { + contest.setRange("指定范围"); + //依据赛事id查询指定范围的省、市、学校 + contest.setContestRangeRespList(contestRangeService.getRangeByContestId(contest.getId())); + } + + return R.ok().put("contest", contest); + } + + + @ApiOperation(value = "赛事禁启用", response = ContestRange.class) + @PostMapping("/disabledEvents") + public R disabledEvents(@RequestBody DisableEnableContestReq req) { + + Contest getDetail = contestService.getById(req.getContestId()); + Contest contest = new Contest(); + contest.setId(req.getContestId()); + //禁用平台来源(0中台,1职站) + switch (req.getType()) { + case 0: + contest.setZtOpen(req.getIsOpen()); + break; + case 1: + //原型需求: + // 客户创建的大赛,禁用时职站首页以及学生登录后的大赛模块看不到对应的比赛,创建的老师在大赛管理还是可以看到该大赛,可以编辑,但是无法启用。 + // 即中台禁用的大赛,即使是该院校老师创建的,老师端也不能自己启用,需要中台启用。 + //1.判断当前院校禁启用状态为要启用时候再判断当前赛事中台禁启用的状态 + if (req.getIsOpen() == 0) { + if (getDetail.getZtOpen() == 1) { + return R.error("当前赛事已被平台禁用,请联系平台管理员!"); + } + } + contest.setIsOpen(req.getIsOpen()); + break; + + } + boolean ret = contestService.updateById(contest); + return ret ? R.ok() : R.error(); + } + + + @ApiOperation(value = "赛事样例数据") + @PostMapping("/eventSampleData") + public boolean eventSampleData(@RequestParam("accountId") @ApiParam(value = "账号id") Integer accountId, @RequestParam("schoolId") @ApiParam(value = "学校id") Integer schoolId) { + Contest contest = new Contest(); + contest.setFounderId(accountId.toString()); + contest.setName("样例赛事"); + contest.setCoverUrl("https://huoran.oss-cn-shenzhen.aliyuncs.com/20220509/png/1523606505516457984.png"); + contest.setCarouselUrl("https://huoran.oss-cn-shenzhen.aliyuncs.com/20220310/png/1501818796133343232.png"); + contest.setSponsor("主办方"); + contest.setUndertaker("承办方"); + contest.setDescription("样例赛事,仅供参考!"); + contest.setPublishStatus(1); + contest.setPlayStartTime(DateUtils.getDateByDay(15)); + contest.setPlayEndTime(DateUtils.getDateByDay(18)); + contest.setSignUpStartTime(new Date()); + contest.setSignUpEndTime(DateUtils.getDateByDay(10)); + contest.setSchoolId(schoolId); + contest.setPlatformSource(1);//平台来源(0:中台,1:职站) + contest.setCompetitionScope(0);//大赛范围(0:本校内 1:全平台 2:指定区域、院校) + return contestService.save(contest); + } + + + @ApiOperation(value = "职站——赛事列表(教师端赛事管理)") + @PostMapping("/contestPageConditionQueryByOccupationlab") + public R contestPageConditionQueryByOccupationlab(@RequestBody PageContestListReq pageContestListReq, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + pageContestListReq.setSchoolId(schoolId); + if (!accountId.equals("")) { + pageContestListReq.setAccountId(Integer.valueOf(accountId)); + } + return contestService.contestPageConditionQueryByOccupationlab(pageContestListReq); + + } + + @ApiOperation(value = "中台——赛事列表分页条件查询(赛事广场)") + @PostMapping("/contestPageConditionQueryByNakadai") + public R contestPageConditionQueryByNakadai(@RequestBody PageContestListReq pageContestListReq, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + return contestService.contestPageConditionQueryByNakadai(pageContestListReq); + } + + /* + + @ApiOperation(value = "职站(学生端)——已报名赛事列表", response = ContestVO.class) + @PostMapping("/listOfRegisteredEvents") + public R listOfRegisteredEvents(@RequestBody PageContestListReq pageContestListReq, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + if (!accountId.equals("")) { + pageContestListReq.setAccountId(Integer.valueOf(accountId)); + } + return contestService.listOfRegisteredEvents(pageContestListReq); + } + + @ApiOperation(value = "职站——(学生端登录后线上赛事-本校赛事)") + @PostMapping("/onlineCompetitionByStudent") + public R onlineCompetitionByStudent(@RequestBody PageContestListReq pageContestListReq, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + pageContestListReq.setSchoolId(schoolId); + if (!accountId.equals("")) { + pageContestListReq.setAccountId(Integer.valueOf(accountId)); + } + return contestService.onlineCompetitionByStudent(pageContestListReq); + + }*/ + + @ApiOperation(value = "查询赛事状态(返回为false时表示当前赛事在教师端已禁用)") + @PostMapping("/checkTheStatusOfTheCompetition") + public boolean checkTheStatusOfTheCompetition(@ApiParam(name = "contestId", value = "赛事ID", required = true) @RequestParam String contestId) { + Contest contest = contestService.getById(contestId); + //是否开启(0开启 1未开启 默认0) + if (contest.getIsOpen()==1){ + return false; + } + return true; + } + + @ApiOperation(value = "职站(学生端)——登录前竞赛", response = ContestVO.class) + @PostMapping("/notLoggedInBeforeStudentEvents") + public R notLoggedInBeforeStudentEvents(@RequestBody PageContestListReq pageContestListReq, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + if (!accountId.equals("")) { + pageContestListReq.setSchoolId(schoolId); + pageContestListReq.setAccountId(Integer.valueOf(accountId)); + } + return contestService.notLoggedInBeforeStudentEvents(pageContestListReq); + + } + + @ApiOperation(value = "职站(学生端)——登录后竞赛", response = ContestVO.class) + @PostMapping("/contestAfterLogin") + public R contestAfterLogin(@RequestBody AfterLoginPageContestListReq pageContestListReq, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + if (!accountId.equals("")) { + pageContestListReq.setSchoolId(schoolId); + pageContestListReq.setAccountId(Integer.valueOf(accountId)); + } + return contestService.contestAfterLogin(pageContestListReq); + + } + +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/ContestProgressController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/ContestProgressController.java new file mode 100644 index 0000000..5a4ca37 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/ContestProgressController.java @@ -0,0 +1,74 @@ +package com.huoran.occupationlab.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.ContestProgress; +import com.huoran.occupationlab.service.ContestProgressService; +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.Date; +import java.util.List; + +/** + * 竞赛进展 前端控制器 + * + * @author chen + * @since 2020-10-15 + */ +@Api(description = "企业端竞赛进展管理", tags = "企业端竞赛进展管理") +@RestController +@RequestMapping("/occupationlab/enterprise/match/contest-progress") +public class ContestProgressController { + + @Autowired + private ContestProgressService contestProgressService; + + @ApiOperation(value = "添加竞赛进展") + @PostMapping("/addContestProgress") + public R addContestProgress( + @ApiParam(name = "contestProgress", value = "竞赛进展对象", required = true) + @RequestBody ContestProgress contestProgress) { + //判重 + contestProgress.setGmtCreate(new Date()); + contestProgress.setGmtModified(new Date()); + boolean isRepeat = contestProgressService.repeat(contestProgress); + if (isRepeat) { + return R.error("竞赛进展已存在"); + } + boolean save = contestProgressService.save(contestProgress); + return save ? R.ok() : R.error(); + } + + @ApiOperation(value = "根据赛事id查询竞赛进展") + @GetMapping("/getContestProgress") + public R getContestProgress(@RequestParam("contestId") @ApiParam(value = "contestId")String contestId) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("contest_id", contestId); + List contestProgressList = contestProgressService.list(wrapper); + return R.ok().put("contestProgressList", contestProgressList); + } + + @ApiOperation(value = "根据id删除竞赛进展") + @DeleteMapping("/deleteContestProgress/{contestProgressId}") + public R deleteContestProgress( + @ApiParam(name = "contestProgressId", value = "竞赛进展ID", required = true) + @PathVariable String contestProgressId) { + boolean remove = contestProgressService.removeById(contestProgressId); + return remove ? R.ok() : R.error(); + } + + @ApiOperation(value = "修改竞赛进展") + @PutMapping("/editContestProgress") + public R editContestProgress( + @ApiParam(name = "ContestProgress", value = "赛事进展对象", required = true) + @RequestBody ContestProgress contestProgress) { + boolean update = contestProgressService.updateById(contestProgress); + return update ? R.ok() : R.error(); + } + +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/CourseChapterController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/CourseChapterController.java new file mode 100644 index 0000000..c683204 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/CourseChapterController.java @@ -0,0 +1,87 @@ +package com.huoran.occupationlab.controller; + +import cn.hutool.core.util.ObjectUtil; +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.CourseChapter; +import com.huoran.occupationlab.entity.vo.ChapterVO; +import com.huoran.occupationlab.entity.vo.SortVO; +import com.huoran.occupationlab.service.CourseChapterService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.apache.commons.lang.ObjectUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Date; +import java.util.List; + +/** + * 课程章节 前端控制器 + * + * @author chen + * @since 2020-09-30 + */ +@Api(description = "课程章节管理", tags = "课程章节管理") +@RestController +@RequestMapping("/occupationlab/management/edu/courseChapter") +public class CourseChapterController { + + @Autowired + private CourseChapterService courseChapterService; + + @ApiOperation(value = "根据课程id查询章节小节,树状结构") + @GetMapping("/queryChaptersAndSubsections/{courseId}") + public R queryChaptersAndSubsections( + @ApiParam(name = "courseId", value = "课程ID", required = true) + @PathVariable String courseId) { + List chapterList = courseChapterService.getChapterTree(courseId); + return R.ok().put("chapterList", chapterList); + } + + @ApiOperation(value = "编辑排序") + @PostMapping("/reorder") + public R chapterReorder( + @ApiParam(name = "sortVO", value = "章节小节重排序对象", required = true) + @RequestBody SortVO sortVO) { + boolean update = courseChapterService.updateSort(sortVO); + return update ? R.ok() : R.error(); + + } + + @ApiOperation(value = "添加章节") + @PostMapping("/addChapter") + public R addChapter( + @ApiParam(name = "courseChapter", value = "章节对象", required = true) + @RequestBody CourseChapter courseChapter) { + //判重 + boolean isRepeat = courseChapterService.repeat(courseChapter); + if (isRepeat) { + return R.error("章节已存在"); + } + courseChapter.setGmtModified(new Date()); + courseChapter.setGmtCreate(new Date()); + boolean save = courseChapterService.saveChapter(courseChapter); + return save ? R.ok() : R.error(); + } + + @ApiOperation(value = "修改章节") + @PutMapping("/editChapter") + public R editChapter( + @ApiParam(name = "courseChapter", value = "章节对象", required = true) + @RequestBody CourseChapter courseChapter) { + boolean update = courseChapterService.updateById(courseChapter); + return update ? R.ok() : R.error(); + } + + @ApiOperation(value = "根据id删除章节") + @DeleteMapping("/deleteChapter/{chapterId}") + public R deleteChapter( + @ApiParam(name = "chapterId", value = "章节ID", required = true) + @PathVariable String chapterId) { + boolean remove = courseChapterService.removeChapter(chapterId); + return remove ? R.ok() : R.error(); + } + +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/CourseClassificationController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/CourseClassificationController.java new file mode 100644 index 0000000..6dffacd --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/CourseClassificationController.java @@ -0,0 +1,129 @@ +package com.huoran.occupationlab.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.api.UserClient; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.occupationlab.entity.EduCourseClassification; +import com.huoran.occupationlab.entity.SchoolClassification; +import com.huoran.occupationlab.service.CourseClassificationService; +import com.huoran.occupationlab.service.SchoolClassificationService; +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 javax.servlet.http.HttpServletRequest; +import java.util.Date; +import java.util.List; + +/** + * 课程类别 前端控制器 + * + * @author chen + * @since 2020-09-30 + */ +@Api(tags = {"管理端——课程分类管理"}) +@RestController +@RequestMapping("/occupationlab/management/edu/courseClassification") +public class CourseClassificationController { + + @Autowired + private CourseClassificationService courseClassificationService; + @Autowired + private SchoolClassificationService schoolClassificationService; + @Autowired + private UserClient userClient; + + @ApiOperation(value = "查询学校端分类") + @GetMapping("/queryGlClassification") + public R queryGlClassification(HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + List classificationList = courseClassificationService.queryGlClassification(String.valueOf(schoolId)); + return R.ok().put("classificationList", classificationList); + } + + @ApiOperation(value = "添加分类") + @PostMapping("/addClassification/{name}") + public R addClassification( + @ApiParam(name = "name", value = "类别名称", required = true) + @PathVariable String name, + @ApiParam(name = "distinguish", value = "企业添加分类为1", required = false) + @RequestParam String distinguish, HttpServletRequest request) { + EduCourseClassification classification = new EduCourseClassification(); + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + //如果为1,添加企业端分类 + if ("1".equals(distinguish)) { + classification.setDistinguish(1); + } + classification.setName(name); + classification.setGmtCreate(new Date()); + classification.setGmtModified(new Date()); + + //新增前判重 + EduCourseClassification classification1 = new EduCourseClassification(); + classification1.setSchoolId(schoolId); + classification1.setName(name); + List list = courseClassificationService.checkReapt(classification1); + if (list.size() > 0) { + return R.error(name + "已存在!"); + } + + boolean save = courseClassificationService.save(classification); + String classificationId = classification.getId(); + //学校id不为空,学校端添加分类对应学校关系 + if (schoolId != null) { + SchoolClassification schoolClassification = new SchoolClassification(); + schoolClassification.setClassificationId(classificationId); + schoolClassification.setSchoolId(schoolId + ""); + schoolClassificationService.save(schoolClassification); + } + return save ? R.ok() : R.error(); + } + + @ApiOperation(value = "修改分类") + @PutMapping("/editClassification") + public R editClassification( + @ApiParam(name = "classification", value = "分类对象", required = true) + @RequestBody EduCourseClassification classification, HttpServletRequest request) { + //新增前判重 + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + classification.setSchoolId(schoolId); + List list = courseClassificationService.checkReapt(classification); + if (list.size() > 0) { + return R.error(classification.getName() + "已存在!"); + } + + boolean update = courseClassificationService.updateById(classification); + return update ? R.ok() : R.error(); + } + + @ApiOperation(value = "根据id删除分类") + @DeleteMapping("/deleteClassification/{classificationId}") + public R deleteClassification( + @ApiParam(name = "classificationId", value = "分类ID", required = true) + @PathVariable String classificationId, HttpServletRequest request) { + //删除课程分类,学校id不为空,删除管理端分类id,学校id为空,其他学校全部删除该分类 + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + if (schoolId != null) { + courseClassificationService.removeById(classificationId); + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("classification_id", classificationId).eq("school_id", schoolId); + boolean remove = schoolClassificationService.remove(wrapper); + return remove ? R.ok() : R.error(); + } else { + courseClassificationService.removeById(classificationId); + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("classification_id", classificationId); + boolean remove = schoolClassificationService.remove(wrapper); + return remove ? R.ok() : R.error(); + } + } + +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/CourseController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/CourseController.java new file mode 100644 index 0000000..bbcb624 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/CourseController.java @@ -0,0 +1,280 @@ +package com.huoran.occupationlab.controller; + +import com.google.common.collect.Maps; +import com.huoran.api.UserClient; +import com.huoran.common.constant.EnableStatus; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.occupationlab.entity.EduCourse; +import com.huoran.occupationlab.entity.EduCourseClassification; +import com.huoran.occupationlab.entity.SchoolClassification; +import com.huoran.occupationlab.entity.SchoolCourse; +import com.huoran.occupationlab.entity.vo.CourseVO; +import com.huoran.occupationlab.service.CourseClassificationService; +import com.huoran.occupationlab.service.CourseService; +import com.huoran.occupationlab.service.SchoolClassificationService; +import com.huoran.occupationlab.service.SchoolCourseService; +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 javax.servlet.http.HttpServletRequest; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +/** + * 课程基本信息 前端控制器 + * + * @author chen + * @since 2020-09-30 + */ +@Api(tags = {"管理端——课程管理"}) +@RestController +@RequestMapping("/occupationlab/management/edu/course") +public class CourseController { + + @Autowired + private CourseService courseService; + + @Autowired + private SchoolCourseService schoolCourseService; + + @Autowired + private UserClient userClient; + @Autowired + private CourseClassificationService courseClassificationService; + + @Autowired + private SchoolClassificationService schoolClassificationService; + + /** + * @Description: 是否启用企业端课程 + * @auther: Rong + * @date: 2021/9/10 16:57 + */ + @ApiOperation(value = "是否启用企业端课程") + @PutMapping("/enableQyCourse") + public R enableQyCourse( + @ApiParam(name = "courseId", value = "课程ID", required = true) + @RequestParam String courseId, + @ApiParam(name = "isEnable", value = "isEnable", required = true) + @RequestParam String isEnable, HttpServletRequest request) { + if (EnableStatus.ENABLE.equals(isEnable) || EnableStatus.NOT_ACTIVATED.equals(isEnable)) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + EduCourse course = new EduCourse(); + course.setSchoolId(String.valueOf(schoolId)); + course.setFounderId(accountId); + course.setId(courseId); + course.setIsEnable(Integer.parseInt(isEnable)); + boolean update = courseService.updateById(course); + return update ? R.ok() : R.error(); + } else { + return R.error("启用状态错误"); + } + } + + /** + * @Description: 课程列表分页条件查询 + * @auther: Rong + * @date: 2021/9/10 16:57 + */ + @ApiOperation(value = "课程列表分页条件查询") + @GetMapping("/queryCourseByCondition/{current}/{pageSize}") + public R conditionPageList( + @ApiParam(name = "current", value = "当前页码", required = true) + @PathVariable int current, + @ApiParam(name = "pageSize", value = "每页记录数", required = true) + @PathVariable int pageSize, + @ApiParam(name = "name", value = "课程名称或创建人,模糊查询", required = false) + @RequestParam(value = "name", required = false) String name, + @ApiParam(name = "classificationId", value = "课程分类ID", required = false) + @RequestParam(value = "classificationId", required = false) String classificationId, + @ApiParam(name = "port", value = "用户端0", required = false) + @RequestParam(value = "port", required = false) String port, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + + HashMap map = Maps.newHashMap(); + map.put("current", (current - 1) * pageSize); + map.put("pageSize", pageSize); + map.put("classificationId", classificationId); + map.put("schoolId", schoolId); + map.put("name", name); + map.put("port", port); + //每页记录数 + List courseList = courseService.coursePageConditionQuery(map); + //总数 + int total = courseService.coursePageConditionCount(map); + return R.ok().put("total", total).put("courseList", courseList); + } + + /** + * @Description: 添加课程 + * @auther: Rong + * @date: 2021/9/10 16:57 + */ + @ApiOperation(value = "添加课程") + @PostMapping("/addCourse") + public R addCourse( + @ApiParam(name = "course", value = "课程对象", required = true) + @RequestBody EduCourse course, + @ApiParam(name = "mark", value = "企业添加课程为1", required = false) + @RequestParam(required = false) String mark, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId1 = userClient.getSchoolIdByAccountId(accountId); + course.setFounderId(accountId); + course.setSchoolId(schoolId1 + ""); + //判重 + boolean isRepeat = courseService.repeat(course); + if (isRepeat) { + return R.error("课程已存在"); + } + //如果为1,添加企业端课程 + if ("1".equals(mark)) { + course.setDistinguish(1); + } + course.setGmtCreate(new Date()); + course.setGmtModified(new Date()); + boolean save = courseService.save(course); + //默认添加第一章 + courseService.addChapter(course); + String courseId = course.getId(); + String schoolId = course.getSchoolId(); + //学校id不为空,学校端添加课程对应学校关系 + if (schoolId != null) { + SchoolCourse schoolCourse = new SchoolCourse(); + schoolCourse.setCourseId(courseId); + schoolCourse.setSchoolId(schoolId); + schoolCourse.setGmtModified(new Date()); + schoolCourse.setGmtCreate(new Date()); + schoolCourseService.save(schoolCourse); + } + return save ? R.ok().put("courseId", courseId) : R.error(); + } + + /** + * @Description: 修改课程 + * @auther: Rong + * @date: 2021/9/10 16:57 + */ + @ApiOperation(value = "修改课程") + @PutMapping("/editCourse") + public R editCourse( + @ApiParam(name = "course", value = "课程对象", required = true) + @RequestBody EduCourse course, HttpServletRequest request) { + + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + course.setFounderId(accountId); + course.setSchoolId(schoolId + ""); + boolean update = courseService.updateById(course); + return update ? R.ok() : R.error(); + } + + /** + * @Description: 根据id查询课程 + * @auther: Rong + * @date: 2021/9/10 16:57 + */ + @ApiOperation(value = "根据id查询课程") + @GetMapping("/getCourse/{courseId}") + public R getCourse( + @ApiParam(name = "courseId", value = "课程ID", required = true) + @PathVariable String courseId) { + EduCourse course = courseService.getById(courseId); + return R.ok().put("course", course); + } + + /** + * @Description: 根据id删除课程 + * @auther: Rong + * @date: 2021/9/10 16:57 + */ + @ApiOperation(value = "根据id删除课程") + @DeleteMapping("/deleteCourse/{courseId}") + public R deleteCourse( + @ApiParam(name = "courseId", value = "课程ID", required = true) + @PathVariable String courseId) { + boolean remove = courseService.removeCourse(courseId); + return remove ? R.ok() : R.error(); + } + + /** + * @Description: 批量删除课程 + * @auther: Rong + * @date: 2021/9/10 16:57 + */ + @ApiOperation(value = "批量删除课程") + @DeleteMapping("/deleteCourses") + public R deleteCourses( + @ApiParam(name = "courseIds", value = "多个课程id", required = true) + @RequestParam("courseIds") List courseIds) { + if (courseIds != null && courseIds.size() != 0) { + boolean delete = courseService.deleteCourses(courseIds); + return delete ? R.ok() : R.error(); + } else { + return R.error(); + } + } + + /** + * @Description: 添加课程 + * @auther: Rong + * @date: 2021/9/10 16:57 + */ + @ApiOperation(value = "添加课程初始数据") + @PostMapping("/addCourseData") + public boolean addCourseData(Integer schoolId, Integer accountId) { + + //添加分类数据 + EduCourseClassification classification = new EduCourseClassification(); + //如果为1,添加企业端分类 + classification.setDistinguish(1); + classification.setName("案例分类"); + classification.setGmtCreate(new Date()); + classification.setGmtModified(new Date()); + boolean save1 = courseClassificationService.save(classification); + String classificationId = classification.getId(); + //学校id不为空,学校端添加分类对应学校关系 + if (schoolId != null) { + SchoolClassification schoolClassification = new SchoolClassification(); + schoolClassification.setClassificationId(classificationId); + schoolClassification.setSchoolId(schoolId + ""); + schoolClassificationService.save(schoolClassification); + } + + //添加课程数据 + EduCourse course = new EduCourse(); + course.setFounderId(accountId + ""); + course.setSchoolId(schoolId + ""); + course.setDistinguish(1); + course.setGmtCreate(new Date()); + course.setGmtModified(new Date()); + course.setName("样例课程"); + course.setCoverUrl("https://huoran.oss-cn-shenzhen.aliyuncs.com/20220224/png/1496736142388125696.png"); + course.setClassificationId(classificationId); + course.setFounderName("超管"); + course.setDescription("课程案例,仅供参考,可自行删除"); + + boolean save = courseService.save(course); + //默认添加第一章 + courseService.addChapter(course); + String courseId = course.getId(); + //学校id不为空,学校端添加课程对应学校关系 + if (schoolId != null) { + SchoolCourse schoolCourse = new SchoolCourse(); + schoolCourse.setCourseId(courseId); + schoolCourse.setSchoolId(schoolId + ""); + schoolCourse.setGmtModified(new Date()); + schoolCourse.setGmtCreate(new Date()); + schoolCourseService.save(schoolCourse); + } + return save; + } + +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/CourseSubsectionController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/CourseSubsectionController.java new file mode 100644 index 0000000..5164a81 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/CourseSubsectionController.java @@ -0,0 +1,82 @@ +package com.huoran.occupationlab.controller; + +import com.aliyuncs.exceptions.ClientException; +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.CourseSubsection; +import com.huoran.occupationlab.service.CourseSubsectionService; +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.Date; + +/** + * 课程小节 前端控制器 + * + * @author chen + * @since 2020-09-30 + */ +@Api(description = "课程小节管理", tags = "课程小节管理") +@RestController +@RequestMapping("/occupationlab/management/edu/courseSubsection") +public class CourseSubsectionController { + + @Autowired + private CourseSubsectionService courseSubsectionService; + + @ApiOperation(value = "添加小节") + @PostMapping("/addSubsection") + public R addSubsection( + @ApiParam(name = "courseSubsection", value = "小节对象", required = true) + @RequestBody CourseSubsection courseSubsection) { + //防止主键重复 + courseSubsection.setId(null); + //判重 + boolean isRepeat = courseSubsectionService.repeat(courseSubsection); + if (isRepeat) { + return R.error("小节已存在"); + } + courseSubsection.setGmtCreate(new Date()); + courseSubsection.setGmtModified(new Date()); + boolean save = courseSubsectionService.saveSubsection(courseSubsection); + return save ? R.ok() : R.error(); + } + + @ApiOperation(value = "修改小节") + @PutMapping("/editSubsection") + public R editSubsection( + @ApiParam(name = "courseSubsection", value = "小节对象", required = true) + @RequestBody CourseSubsection courseSubsection) { + boolean update = courseSubsectionService.updateById(courseSubsection); + return update ? R.ok() : R.error(); + } + + @ApiOperation(value = "根据id删除小节") + @DeleteMapping("/deleteSubsection/{subsectionId}") + public R deleteSubsection( + @ApiParam(name = "subsectionId", value = "小节ID", required = true) + @PathVariable String subsectionId) throws ClientException { + boolean remove = courseSubsectionService.removeSubsection(subsectionId); + return remove ? R.ok() : R.error(); + } + + @ApiOperation(value = "根据小节id获取预览文件地址") + @GetMapping("/getSubsection/{subsectionId}") + public R getSubsection( + @ApiParam(name = "subsectionId", value = "小节ID", required = true) + @PathVariable String subsectionId) { + String officeUrl = "https://view.officeapps.live.com/op/view.aspx?src="; + // String xDocUrl = "http://view.xdocin.com/xdoc?_xdoc="; + CourseSubsection courseSubsection = courseSubsectionService.getById(subsectionId); + if (courseSubsection != null) { + String fileUrl = courseSubsection.getFileUrl(); + String previewUrl = officeUrl + fileUrl; + return R.ok().put("previewUrl", previewUrl); + } else { + return R.error(); + } + } +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/DataKanbanController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/DataKanbanController.java new file mode 100644 index 0000000..df335b8 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/DataKanbanController.java @@ -0,0 +1,107 @@ +package com.huoran.occupationlab.controller; + + +import com.huoran.api.UserClient; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.occupationlab.entity.req.PageReq; +import com.huoran.occupationlab.entity.req.StudentPerformanceAnalysisReq; +import com.huoran.occupationlab.entity.resp.*; +import com.huoran.occupationlab.service.ExperimentalReportService; +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 javax.servlet.http.HttpServletRequest; +import java.util.List; + +@RestController +@RequestMapping("/occupationlab/data/kanban") +@Api(value = "API - 职站:DataKanbanController", tags = "职站:数据看板") +public class DataKanbanController { + @Autowired + private UserClient userClient; + @Autowired + private ExperimentalReportService reportService; + + @PostMapping("/getTheMostUsedCoursesInOurSchool") + @ApiOperation(value = "获取本月当前学校排名前三课程/本月综合学习积极性最高的实验课程", response = MostLabCoursestResp.class) + public R findById(HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + return reportService.getTheMostUsedCoursesInOurSchool(schoolId); + } + + + @PostMapping("/academicLeadersRanking") + @ApiOperation(value = "学霸排行榜", response = AcademicLeadersRankingResp.class) + public R academicLeadersRanking(PageReq req,HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + return reportService.academicLeadersRanking(schoolId,req); + } + + + @PostMapping("/examStatistics") + @ApiOperation(value = "平台考试数据考试统计", response = ExamStatisticsResp.class) + public R examStatistics(HttpServletRequest request, @RequestParam(value = "choose", required = true) @ApiParam(value = "周=0 、日 =1 ", required = true) Integer choose) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + return reportService.examStatistics(schoolId, choose); + } + + + @PostMapping("/studentGradeDistribution") + @ApiOperation(value = "学生成绩分布分析", response = StudentPerformanceAnalysisResp.class) + public R studentGradeDistribution(HttpServletRequest request, @RequestBody List req) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + return reportService.studentGradeDistribution(schoolId, req); + } + + @PostMapping("/studentAssessSchievement") + @ApiOperation(value = "学生实验考核成绩趋势图", response = StudentAssesScoreResp.class) + public R studentAssessSchievement(HttpServletRequest request, @RequestBody List req) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + return reportService.studentAssessSchievement(schoolId, req); + } + + + @PostMapping("/overviewOfOurSchoolData") + @ApiOperation(value = "本院数据概览", response = OverviewOfStudentExperimentDataResp.class) + public R overviewOfOurSchoolData(HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + return reportService.overviewOfOurSchoolData(schoolId); + } + + + @PostMapping("/monthlyAverageOnlineTime") + @ApiOperation(value = "月人均在线时长情况") + public R monthlyAverageOnlineTime(HttpServletRequest request, @RequestBody List req) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + return reportService.monthlyAverageOnlineTime(schoolId, req); + } + + @PostMapping("/courseRankings") + @ApiOperation(value = "课程排行榜") + public R courseRankings(HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + return reportService.courseRankings(schoolId); + } + + + @PostMapping("/activityRanking") + @ApiOperation(value = "活跃度排行榜",response = ReturnActiveRankingResp.class) + public R activityRanking(HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + return reportService.activityRanking(schoolId); + } +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/EntrepreneurialActivityAnnouncementAnnexController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/EntrepreneurialActivityAnnouncementAnnexController.java new file mode 100644 index 0000000..5726e2b --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/EntrepreneurialActivityAnnouncementAnnexController.java @@ -0,0 +1,77 @@ +package com.huoran.occupationlab.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.api.UserClient; +import com.huoran.common.constant.DelConstant; +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.EntrepreneurialActivityAnnouncementAnnex; +import com.huoran.occupationlab.service.EntrepreneurialActivityAnnouncementAnnexService; +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 javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + * @描述:活动公告附件表控制类 + * @作者: Rong + * @日期: 2023-05-12 + */ +@RestController +@RequestMapping("/occupationlab/activity/announcement/annex") +@Api(value = "活动公告附件表:EntrepreneurialActivityAnnouncementAnnexController", tags = "R-活动公告附件表") +public class EntrepreneurialActivityAnnouncementAnnexController { + + @Autowired + public EntrepreneurialActivityAnnouncementAnnexService service; + + @Autowired + private UserClient userClient; + + + + + @PostMapping("/viewAttachments") + @ApiOperation(value = "查看公告下的附件",response = EntrepreneurialActivityAnnouncementAnnex.class) + public R findById(@RequestParam("announcementId") @ApiParam(name = "活动公告主键", value = "传入json格式", required = true) Integer announcementId) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("announcement_id",announcementId); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + List annexList = service.list(queryWrapper); + return R.ok().put("list",annexList); + } + + @PostMapping("/save") + @ApiOperation(value = "新增", response = EntrepreneurialActivityAnnouncementAnnex.class) + public R save(@RequestBody @ApiParam(name = "活动公告附件表对象", value = "传入json格式", required = true) EntrepreneurialActivityAnnouncementAnnex entrepreneurialActivityAnnouncementAnnex, HttpServletRequest request) { + boolean addState = service.save(entrepreneurialActivityAnnouncementAnnex); + return addState ? R.ok() : R.error("新增失败"); + } + + + @PostMapping("/update") + @ApiOperation(value = "修改", response = EntrepreneurialActivityAnnouncementAnnex.class) + public R update(@RequestBody @ApiParam(name = "活动公告附件表对象", value = "传入json格式", required = true) EntrepreneurialActivityAnnouncementAnnex entrepreneurialActivityAnnouncementAnnex, HttpServletRequest request) { + boolean updateState = service.updateById(entrepreneurialActivityAnnouncementAnnex); + return updateState ? R.ok() : R.error("编辑失败"); + } + + + @PostMapping("/delete") + @ApiOperation(value = "删除", response = EntrepreneurialActivityAnnouncementAnnex.class) + public R delete(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { + boolean delState = service.removeById(id); + return delState ? R.ok() : R.error("删除失败"); + } + + @PostMapping("/batchDeletion") + @ApiOperation(value = "批量删除", response = EntrepreneurialActivityAnnouncementAnnex.class) + public R batchDeletion(@ApiParam(name = "id", value = "主键", required = true) @RequestParam List ids) { + boolean delState = service.removeByIds(ids); + return delState ? R.ok() : R.error("删除失败"); + } +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/EntrepreneurialActivityAnnouncementController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/EntrepreneurialActivityAnnouncementController.java new file mode 100644 index 0000000..50225d0 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/EntrepreneurialActivityAnnouncementController.java @@ -0,0 +1,112 @@ +package com.huoran.occupationlab.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.api.UserClient; +import com.huoran.common.aop.annotation.NoRepeatSubmit; +import com.huoran.common.constant.DelConstant; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.occupationlab.entity.EntrepreneurialActivityAnnouncement; +import com.huoran.occupationlab.entity.EntrepreneurialActivityAnnouncementAnnex; +import com.huoran.occupationlab.service.EntrepreneurialActivityAnnouncementAnnexService; +import com.huoran.occupationlab.service.EntrepreneurialActivityAnnouncementService; +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 javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + * @描述:活动公告表控制类 + * @作者: Rong + * @日期: 2023-05-12 + */ +@RestController +@RequestMapping("/occupationlab/activity/announcement") +@Api(value = "活动公告表:EntrepreneurialActivityAnnouncementController", tags = "R-活动公告") +public class EntrepreneurialActivityAnnouncementController { + + @Autowired + public EntrepreneurialActivityAnnouncementService service; + + @Autowired + private UserClient userClient; + @Autowired + public EntrepreneurialActivityAnnouncementAnnexService annexService;//大赛公告附件 + + @PostMapping("/queryAnnouncementDetails") + @ApiOperation(value = "查询公告详情", response = EntrepreneurialActivityAnnouncement.class) + public R findById(@RequestParam("id") @ApiParam(value = "公告主键") Integer id) { + EntrepreneurialActivityAnnouncement competitionAnnouncement = service.getById(id); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("announcement_id", id); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + List annexList = annexService.list(queryWrapper); + if (annexList.size() > 0) { + competitionAnnouncement.setAnnouncementAnnexList(annexList); + } + return R.ok().put("data", competitionAnnouncement); + } + + @NoRepeatSubmit + @PostMapping("/addAnnouncement") + @ApiOperation(value = "新增公告", response = EntrepreneurialActivityAnnouncement.class) + public R save(@RequestBody EntrepreneurialActivityAnnouncement competitionAnnouncement, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + competitionAnnouncement.setAccountId(Integer.valueOf(accountId)); + boolean save = service.save(competitionAnnouncement); + if (competitionAnnouncement.getAnnouncementAnnexList().size() > 0) { + competitionAnnouncement.getAnnouncementAnnexList().forEach(competitionAnnex -> { + competitionAnnex.setAnnouncementId(competitionAnnouncement.getId()); + boolean saveCompetitionAnnex = annexService.save(competitionAnnex);//保存比赛附件 + }); + } + return save ? R.ok() : R.error(); + } + + @NoRepeatSubmit + @PostMapping("/amendmentAnnouncement") + @ApiOperation(value = "修改公告", response = EntrepreneurialActivityAnnouncement.class) + public R update(@RequestBody EntrepreneurialActivityAnnouncement competitionAnnouncement) { + boolean update = service.updateById(competitionAnnouncement); + return update ? R.ok() : R.error(); + } + + @NoRepeatSubmit + @ApiOperation(value = "是否禁用公告") + @PutMapping("/disableAnnouncement") + public R disableAnnouncement(@ApiParam(name = "id", value = "公告主键", required = true) @RequestParam Integer id, + @ApiParam(name = "isDisable", value = "是否开启(0开启 1未开启 默认0)", required = true) @RequestParam Integer isDisable) { + if (isDisable == 1 || isDisable == 0) { + EntrepreneurialActivityAnnouncement EntrepreneurialActivityAnnouncement = new EntrepreneurialActivityAnnouncement(); + EntrepreneurialActivityAnnouncement.setId(id); + EntrepreneurialActivityAnnouncement.setIsOpen(isDisable); + boolean update = service.updateById(EntrepreneurialActivityAnnouncement); + return update ? R.ok() : R.error(); + } else { + return R.error("启用状态错误"); + } + } + + @NoRepeatSubmit + @PostMapping("/deleteAnnouncement") + @ApiOperation(value = "删除公告", response = EntrepreneurialActivityAnnouncement.class) + public R delete(@RequestParam("id") @ApiParam(value = "公告主键") Integer id) { + boolean del = service.removeById(id); + return del ? R.ok() : R.error(); + } + + + @PostMapping("/queryAnnouncementByCompetitionId") + @ApiOperation(value = "根据赛事id查询公告列表(分页)", response = EntrepreneurialActivityAnnouncement.class) + public R queryAnnouncementByCompetitionId( + @RequestParam("competitionId") @ApiParam(value = "赛事id") String competitionId, + @ApiParam(value = "当前页数", required = true) @RequestParam("pageNum") Integer pageNum, + @ApiParam(value = "当前页需要显示的数量", required = true) @RequestParam("pageSize") Integer pageSize) { + return service.queryAnnouncementByActivityId(competitionId, pageNum, pageSize); + } +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/EntrepreneurialActivityApplicantController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/EntrepreneurialActivityApplicantController.java new file mode 100644 index 0000000..f8db6db --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/EntrepreneurialActivityApplicantController.java @@ -0,0 +1,166 @@ +package com.huoran.occupationlab.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.api.UserClient; +import com.huoran.common.aop.annotation.NoRepeatSubmit; +import com.huoran.common.exception.CustomException; +import com.huoran.common.exception.ExceptionEnum; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.occupationlab.entity.EntrepreneurialActivity; +import com.huoran.occupationlab.entity.EntrepreneurialActivityApplicant; +import com.huoran.occupationlab.entity.req.ActivityApplicantReq; +import com.huoran.occupationlab.entity.vo.RegistrationVO; +import com.huoran.occupationlab.service.EntrepreneurialActivityApplicantService; +import com.huoran.occupationlab.service.EntrepreneurialActivityService; +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 javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; + +/** + * @描述:创业活动报名人员表控制类 + * @作者: Rong + * @日期: 2023-04-27 + */ +@RestController +@RequestMapping("/occupationlab/activity/applicant") +@Api(value = "创业活动报名人员表:EntrepreneurialActivityApplicantController", tags = "R-创业活动报名人员") +public class EntrepreneurialActivityApplicantController { + + @Autowired + public EntrepreneurialActivityApplicantService service; + + + @Autowired + public EntrepreneurialActivityService activityService; + @Autowired + private UserClient userClient; + + + @PostMapping("/ApplicantsList") + @ApiOperation(value = "报名人员列表", response = RegistrationVO.class) + public R applicantsList(@RequestBody ActivityApplicantReq request) { + return R.ok().put("data", service.ApplicantsList(request)); + } + + + @PostMapping("/findById") + @ApiOperation(value = "查询详情", response = EntrepreneurialActivityApplicant.class) + public R findById(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { + EntrepreneurialActivityApplicant entrepreneurialActivityApplicant = service.getById(id); + return R.ok().put("data", entrepreneurialActivityApplicant); + } + + + @PostMapping("/save") + @ApiOperation(value = "报名", response = EntrepreneurialActivityApplicant.class) + public R save(@RequestBody @ApiParam(name = "创业活动报名人员表对象", value = "传入json格式", required = true) EntrepreneurialActivityApplicant entrepreneurialActivityApplicant, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + entrepreneurialActivityApplicant.setAccountId(Integer.valueOf(accountId)); + entrepreneurialActivityApplicant.setSchoolId(schoolId); + + EntrepreneurialActivity activity = null; + if (entrepreneurialActivityApplicant.getActivityId() != null) { + activity = activityService.getById(entrepreneurialActivityApplicant.getActivityId()); + } + + if (activity == null) { + throw new CustomException(ExceptionEnum.DELETE_REFRESH_LIST); + } + + QueryWrapper queryWrap = new QueryWrapper<>(); + queryWrap.eq("activity_id", entrepreneurialActivityApplicant.getActivityId()); + List activityList = service.list(queryWrap); + + //报名人数限制(0表示不限制)默认为0 + if (activity.getMaximumNumber() != 0) { + //判断有人数限制的情况下不给报名 + if (activity.getMaximumNumber() <= activityList.size()) { + throw new CustomException(ExceptionEnum.ACTIVITY_REGISTRATION_FAILURE); + } + } + + //是否需要报名邀请码 + Integer code = activity.getIsNeedCode(); + if (code == 1) { + //验证报名邀请码 + if (!activity.getInvitationCode().equals(entrepreneurialActivityApplicant.getRegistrationInvitationCode())) { + throw new CustomException(ExceptionEnum.CODE); + } + } + + + boolean addState = service.save(entrepreneurialActivityApplicant); + return addState ? R.ok() : R.error("新增失败"); + } + + + @PostMapping("/update") + @ApiOperation(value = "修改", response = EntrepreneurialActivityApplicant.class) + public R update(@RequestBody @ApiParam(name = "创业活动报名人员表对象", value = "传入json格式", required = true) EntrepreneurialActivityApplicant entrepreneurialActivityApplicant, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + entrepreneurialActivityApplicant.setAccountId(Integer.valueOf(accountId)); + entrepreneurialActivityApplicant.setSchoolId(schoolId); + boolean updateState = service.updateById(entrepreneurialActivityApplicant); + return updateState ? R.ok() : R.error("编辑失败"); + } + + + @PostMapping("/delete") + @ApiOperation(value = "删除", response = EntrepreneurialActivityApplicant.class) + public R delete(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { + boolean delState = service.removeById(id); + return delState ? R.ok() : R.error("删除失败"); + } + + @PostMapping("/batchDeletion") + @ApiOperation(value = "批量删除", response = EntrepreneurialActivityApplicant.class) + public R batchDeletion(@ApiParam(name = "id", value = "主键", required = true) @RequestParam List ids) { + boolean delState = service.removeByIds(ids); + return delState ? R.ok() : R.error("删除失败"); + + } + + + @ApiOperation(value = "导出全部数据", response = RegistrationVO.class) + @GetMapping("/excelExport") + public void excelExport(@ApiParam(name = "activityId", value = "活动id", required = true) @RequestParam("activityId") Integer activityId, HttpServletResponse response) { + try { + ActivityApplicantReq req = new ActivityApplicantReq(); + req.setActivityId(activityId); + req.setPageNum(1); + req.setPageSize(1000); + service.export(response, req); + } catch (IOException e) { + e.printStackTrace(); + } + } + + @ApiOperation(value = "批量导出数据") + @PostMapping(value = "/exportDataInBatches", produces = "application/json;multipart/form-data;charset=utf-8") + public void exportSubscribedRecords(@RequestBody List listOfExportSub, HttpServletResponse response, HttpServletRequest request) throws Exception { + service.exportDataInBatches(listOfExportSub, response); + } + + + @NoRepeatSubmit + @ApiOperation(value = "是否禁用报名人员") + @PutMapping("/disableRegistration") + public R disableRegistration(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer competitionRegistrationId, @ApiParam(name = "isDisable", value = "是否禁用", required = true) @RequestParam Integer isDisable) { + EntrepreneurialActivityApplicant competitionRegistration = new EntrepreneurialActivityApplicant(); + competitionRegistration.setId(competitionRegistrationId); + competitionRegistration.setIsDisable(isDisable); + boolean update = service.updateById(competitionRegistration); + return update ? R.ok() : R.error(); + } +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/EntrepreneurialActivityController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/EntrepreneurialActivityController.java new file mode 100644 index 0000000..8b4894e --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/EntrepreneurialActivityController.java @@ -0,0 +1,398 @@ +package com.huoran.occupationlab.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.huoran.api.UserClient; +import com.huoran.common.aop.annotation.NoRepeatSubmit; +import com.huoran.common.constant.DelConstant; +import com.huoran.common.constant.PlatformConstant; +import com.huoran.common.exception.CustomException; +import com.huoran.common.exception.ExceptionEnum; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.occupationlab.entity.EntrepreneurialActivity; +import com.huoran.occupationlab.entity.EntrepreneurialActivityApplicant; +import com.huoran.occupationlab.entity.EntrepreneurialActivityCollect; +import com.huoran.occupationlab.entity.EntrepreneurialActivityFile; +import com.huoran.occupationlab.entity.req.DisableEnableActivityReq; +import com.huoran.occupationlab.entity.req.EntrepreneurshipActivityListrReq; +import com.huoran.occupationlab.entity.vo.EntrepreneurialActivityVO; +import com.huoran.occupationlab.service.EntrepreneurialActivityApplicantService; +import com.huoran.occupationlab.service.EntrepreneurialActivityCollectService; +import com.huoran.occupationlab.service.EntrepreneurialActivityFileService; +import com.huoran.occupationlab.service.EntrepreneurialActivityService; +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.data.redis.core.StringRedisTemplate; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.util.Date; +import java.util.List; +import java.util.concurrent.TimeUnit; + + +/** + * @描述:创业活动管理表控制类 + * @作者: Rong + * @日期: 2023-04-26 + */ +@RestController +@RequestMapping("/occupationlab/activity") +@Api(value = "创业活动管理表:EntrepreneurialActivityController", tags = "R-创业活动管理") +public class EntrepreneurialActivityController { + @Autowired + private StringRedisTemplate redisTemplate; + @Autowired + public EntrepreneurialActivityService service; + @Autowired + public EntrepreneurialActivityApplicantService applicantService; + + @Autowired + public EntrepreneurialActivityFileService activityFileService; + + @Autowired + public EntrepreneurialActivityCollectService collectService; + + @Autowired + private UserClient userClient; + + @PostMapping("/activityList") + @ApiOperation(value = "创业活动列表(用于教师端)", response = EntrepreneurialActivityVO.class) + public R activityList(@RequestBody EntrepreneurshipActivityListrReq req, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + req.setAccountId(Integer.parseInt(accountId)); + req.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); + + //当前所属平台(0:中台,1:职站教师 2职站学生) + if (req.getPlatformSource() == PlatformConstant.POST_STATION) { + String roleName = userClient.getUserAllRole(accountId, PlatformConstant.POST_STATION);//获取当前用户的角色 + req.setIsAdmin(0); + //需求: 学校超管能看到教师以及学生发布的,教师能看到老师自己的和学生的(学生的:已发布的且未被学生禁用的(教师禁用学生的要展示) + if (roleName.contains("超级管理员") || roleName.contains("管理员")) { + req.setIsAdmin(1); + } + } + + return service.activityList(req); + + } + + + @PostMapping("/schoolActivities") + @ApiOperation(value = "本校创业活动(用于学生端)", response = EntrepreneurialActivityVO.class) + public R schoolActivities(@RequestBody EntrepreneurshipActivityListrReq req, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + req.setAccountId(Integer.parseInt(accountId)); + req.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); + return service.schoolActivities(req); + } + + + @PostMapping("/concernedActivity") + @ApiOperation(value = "已关注的活动(用于学生端)", response = EntrepreneurialActivityVO.class) + public R concernedActivity(@RequestBody EntrepreneurshipActivityListrReq req, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + req.setAccountId(Integer.parseInt(accountId)); + req.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); + return service.concernedActivity(req); + } + + + + @PostMapping("/myActivities") + @ApiOperation(value = "我的活动(用于学生端)", response = EntrepreneurialActivityVO.class) + public R myActivities(@RequestBody EntrepreneurshipActivityListrReq req, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + req.setAccountId(Integer.parseInt(accountId)); + req.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); + return service.myActivities(req); + } + + @PostMapping("/findById") + @ApiOperation(value = "查询详情", response = EntrepreneurialActivity.class) + public R findById(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id, HttpServletRequest request) { + EntrepreneurialActivity entrepreneurialActivity = service.getById(id); + String accountId = TokenUtils.getIdByJwtToken(request); + + + QueryWrapper queryWrap = new QueryWrapper<>(); + queryWrap.eq("activity_id", id); + queryWrap.eq("account_id", accountId); + EntrepreneurialActivityApplicant applicant = applicantService.getOne(queryWrap); + if (applicant != null) { + entrepreneurialActivity.setCancelId(applicant.getId()); + //是否报名(0为已报名 1为未报名) + entrepreneurialActivity.setWhetherToSignUp(0); + } + + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + queryWrapper.eq("activity_id", entrepreneurialActivity.getId()); + List activityFileList = activityFileService.list(queryWrapper); + if (activityFileList.size() > 0) { + entrepreneurialActivity.setActivityFileList(activityFileList); + } + + + QueryWrapper queryWrapper1 = new QueryWrapper<>(); + queryWrapper1.eq("account_id", accountId); + queryWrapper1.eq("activity_id", id); + EntrepreneurialActivityCollect activityCollect = collectService.getOne(queryWrapper1); + entrepreneurialActivity.setCollectorsNum(collectService.countTheNumberOfCollectors(id)); + //是否收藏:(state = 1收藏,0取消收藏) + if (activityCollect != null) { + //收藏过 + entrepreneurialActivity.setCollectionStatus(1); + } else { + entrepreneurialActivity.setCollectionStatus(0); + } + + + return R.ok().put("data", entrepreneurialActivity); + } + + + @PostMapping("/save") + @ApiOperation(value = "新增", response = EntrepreneurialActivity.class) + public R save(@RequestBody @ApiParam(name = "创业活动管理表对象", value = "传入json格式", required = true) EntrepreneurialActivity entrepreneurialActivity, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + entrepreneurialActivity.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); + entrepreneurialActivity.setAccountId(Integer.valueOf(accountId)); + boolean addState = service.save(entrepreneurialActivity); + if (entrepreneurialActivity.getActivityFileList().size() > 0) { + entrepreneurialActivity.getActivityFileList().forEach(CompetitionAnnex -> { + CompetitionAnnex.setActivityId(entrepreneurialActivity.getId()); + activityFileService.save(CompetitionAnnex);//保存活动附件 + }); + + } + + return addState ? R.ok() : R.error("新增失败"); + } + + + @PostMapping("/update") + @ApiOperation(value = "编辑创业活动(不更改附件时候不传附件的集合)", response = EntrepreneurialActivity.class) + public R update(@RequestBody @ApiParam(name = "创业活动管理表对象", value = "传入json格式", required = true) EntrepreneurialActivity entrepreneurialActivity, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + entrepreneurialActivity.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); + entrepreneurialActivity.setAccountId(Integer.valueOf(accountId)); + + //编辑 + if (entrepreneurialActivity.getActivityFileList().size() > 0) { + entrepreneurialActivity.getActivityFileList().forEach(CompetitionAnnex -> { + //删除原有附件 + UpdateWrapper queryWrapper = new UpdateWrapper<>(); + queryWrapper.set("is_del", DelConstant.IS_DEL); + queryWrapper.eq("activity_id", entrepreneurialActivity.getId()); + activityFileService.update(new EntrepreneurialActivityFile(), queryWrapper); + CompetitionAnnex.setActivityId(entrepreneurialActivity.getId()); + activityFileService.save(CompetitionAnnex);//保存新的活动附件 + + }); + + } + boolean updateState = service.updateById(entrepreneurialActivity); + return updateState ? R.ok() : R.error("编辑失败"); + } + + + /*@PostMapping("/delete") + @ApiOperation(value = "删除", response = EntrepreneurialActivity.class) + public R delete(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id, HttpServletRequest request) { + boolean delState = service.removeById(id); + return delState ? R.ok() : R.error("删除失败"); + }*/ + + @PostMapping("/batchDeletion") + @ApiOperation(value = "批量删除", response = EntrepreneurialActivity.class) + public R batchDeletion(@ApiParam(name = "id", value = "主键", required = true) @RequestBody List ids, HttpServletRequest request) { + //删除活动下的附件 + for (Integer id : ids) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + queryWrapper.eq("activity_id", id); + List delList = activityFileService.list(queryWrapper); + if (delList.size() > 0) { + for (EntrepreneurialActivityFile file : delList) { + activityFileService.removeById(file.getId()); + } + + } + } + boolean delState = service.removeByIds(ids); + return delState ? R.ok() : R.error("删除失败"); + } + + + /*@NoRepeatSubmit + @ApiOperation(value = "赛事禁启用", response = EntrepreneurialActivity.class) + @PostMapping("/disabledEvents") + public R disabledEvents(@RequestBody DisableEnableActivityReq req, HttpServletRequest request) { + + String accountId = TokenUtils.getIdByJwtToken(request); + + EntrepreneurialActivity getDetail = service.getById(req.getActivityId()); + EntrepreneurialActivity competition = new EntrepreneurialActivity(); + competition.setId(req.getActivityId()); + + + //禁用平台来源(0中台,1职站教师端 2.职站学生端) + switch (req.getType()) { + case 1: + String roleName = userClient.getUserAllRole(accountId, PlatformConstant.POST_STATION);//获取当前用户的角色 + req.setIsAdmin(0); + //需求: 学校超管能看到教师以及学生发布的,教师能看到老师自己的和学生的(学生的:已发布的且未被学生禁用的(教师禁用学生的要展示) + if (roleName.contains("超级管理员") || roleName.contains("管理员")||roleName.contains("教师")) { + req.setIsAdmin(1); + } + + if (req.getIsAdmin() == 1) { + competition.setSchoolOpen(req.getIsOpen()); + } else { + //判断如果教师端禁用学生端的,也是禁用字段SchoolOpen + if (req.getIsOpen() == 0) { + if (getDetail.getSchoolOpen() == 1) { + return R.error("当前项目已被学校禁用,请联系学校管理员!"); + } + } + if (getDetail.getFounder() == 2) { + competition.setSchoolOpen(req.getIsOpen()); + } else { + competition.setIsOpen(req.getIsOpen()); + } + } + + break; + case 2: + + + if (req.getIsOpen() == 0) { + if (getDetail.getSchoolOpen() == 1) { + return R.error("当前项目已被学校禁用,请联系学校管理员!"); + } + } + *//* if (getDetail.getFounder() == 2) { + competition.setSchoolOpen(req.getIsOpen()); + } else {*//* + competition.setIsOpen(req.getIsOpen()); +// } + + break; + } + boolean ret = service.updateById(competition); + //保存的key名 + String key = "activityDisabled"; + //保存到缓存中 + redisTemplate.opsForValue().set(key, "true"); + return ret ? R.ok() : R.error(); + }*/ + + + @NoRepeatSubmit + @ApiOperation(value = "创业活动禁启用", response = EntrepreneurialActivity.class) + @PostMapping("/disabledEvents") + public R disabledEvents(@RequestBody DisableEnableActivityReq req, HttpServletRequest request) { + + String accountId = TokenUtils.getIdByJwtToken(request); + + EntrepreneurialActivity getDetail = service.getById(req.getActivityId()); + EntrepreneurialActivity competition = new EntrepreneurialActivity(); + competition.setId(req.getActivityId()); + //禁用平台来源(0中台,1职站教师端 2.职站学生端) + switch (req.getType()) { + case 1: + if (req.getIsOpen() == 0) { + if (getDetail.getIsOpen() == 1) { + throw new CustomException(ExceptionEnum.REFRESH_THE_LIST); + } + } + competition.setSchoolOpen(req.getIsOpen()); + break; + case 2: + //原型需求: + // 客户创建的大赛,禁用时职站首页以及学生登录后的大赛模块看不到对应的比赛,创建的老师在大赛管理还是可以看到该大赛,可以编辑,但是无法启用。 + // 即中台禁用的大赛,即使是该院校老师创建的,老师端也不能自己启用,需要中台启用。 + //1.判断当前院校禁启用状态为要启用时候再判断当前赛事中台禁启用的状态 + if (req.getIsOpen() == 0) { + if (getDetail.getSchoolOpen() == 1) { + return R.error("当前项目已被学校禁用,请联系学校管理员!"); + } + } + competition.setIsOpen(req.getIsOpen()); + break; + + } + boolean ret = service.updateById(competition); + //保存的key名 + String key = "activityDisabled"; + //以时间戳方式保存到缓存中 + redisTemplate.opsForValue().set(key, System.currentTimeMillis() + ""); + return ret ? R.ok() : R.error(); + } + + + /** + * 禁用/启用的时候,把时间戳写入那个key,前端第一次调用的时候,把时间戳写入本地缓存 + * 然后前端通过定时器获取这个redis缓存的接口 + * 只要获取到的值跟本地缓存的不一致就刷新列表 + * + * @return + */ + @PostMapping("/getRedisCache") + @ApiOperation(value = "获取Redis缓存(返回的时间戳只要获取到的值跟本地缓存的不一致就刷新列表)") + public R getRedisCache() { + //保存的key名 + String key = "activityDisabled"; + //查看缓存是否有数据 + String returnValue = redisTemplate.opsForValue().get(key); + + //使用缓存返回数据 + if (returnValue != null) { + //设置过期时间 + /*redisTemplate.expire(key, 5000, TimeUnit.MILLISECONDS);*/ + return R.ok().put("data", returnValue); + } + + + return R.ok(); + } + + + @PostMapping("/collectionActivity") + @ApiOperation(value = "收藏活动", response = EntrepreneurialActivityCollect.class) + public R collectCourse(@ApiParam(name = "activityId", value = "活动id", required = true) @RequestParam Integer activityId, + @ApiParam(name = "state", value = "操作状态(state = 1收藏,0取消收藏)", required = true) @RequestParam Integer state + , HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + QueryWrapper queryWrapper = new QueryWrapper(); + queryWrapper.eq("activity_id", activityId); + queryWrapper.eq("account_id", accountId); + EntrepreneurialActivityCollect detail = collectService.getOne(queryWrapper); + switch (state) { + case 0://取消收藏 + if (detail != null) { + collectService.removeById(detail.getId()); + } + break; + + case 1://收藏 + if (detail != null) { + return R.ok("已经收藏过了!"); + } + EntrepreneurialActivityCollect courseCollect = new EntrepreneurialActivityCollect(); + courseCollect.setActivityId(activityId); + courseCollect.setCollectionTime(new Date()); + courseCollect.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); + courseCollect.setAccountId(Integer.valueOf(accountId)); + collectService.save(courseCollect); + break; + } + return R.ok(); + } +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/EntrepreneurialActivityFileController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/EntrepreneurialActivityFileController.java new file mode 100644 index 0000000..7185c0f --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/EntrepreneurialActivityFileController.java @@ -0,0 +1,80 @@ +package com.huoran.occupationlab.controller; + +import com.huoran.api.UserClient; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.occupationlab.entity.EntrepreneurialActivityFile; +import com.huoran.occupationlab.service.EntrepreneurialActivityFileService; +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 javax.servlet.http.HttpServletRequest; +import java.util.List; + + +/** + * @描述:创业活动附件存储控制类 + * @作者: Rong + * @日期: 2023-04-26 + */ +@RestController +@RequestMapping("/occupationlab/activity/file") +@Api(value = "创业活动附件存储:EntrepreneurialActivityFileController", tags = "R-创业活动附件存储") +public class EntrepreneurialActivityFileController { + + @Autowired + public EntrepreneurialActivityFileService service; + + @Autowired + private UserClient userClient; + @PostMapping("/listByEntity") + @ApiOperation(value = "分页查询", response = EntrepreneurialActivityFile.class) + public R listByEntity(@RequestBody EntrepreneurialActivityFile entrepreneurialActivityFile) { + + return null; + } + + + @PostMapping("/findById") + @ApiOperation(value = "查询详情", response = EntrepreneurialActivityFile.class) + public R findById(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { + EntrepreneurialActivityFile entrepreneurialActivityFile = service.getById(id); + return R.ok().put("data", entrepreneurialActivityFile); + } + + + @PostMapping("/save") + @ApiOperation(value = "新增", response = EntrepreneurialActivityFile.class) + public R save(@RequestBody @ApiParam(name = "创业活动附件存储对象", value = "传入json格式", required = true) EntrepreneurialActivityFile entrepreneurialActivityFile, HttpServletRequest request) { + boolean addState = service.save(entrepreneurialActivityFile); + return addState ? R.ok() : R.error("新增失败"); + } + + + @PostMapping("/update") + @ApiOperation(value = "修改", response = EntrepreneurialActivityFile.class) + public R update(@RequestBody @ApiParam(name = "创业活动附件存储对象", value = "传入json格式", required = true) EntrepreneurialActivityFile entrepreneurialActivityFile, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + boolean updateState = service.updateById(entrepreneurialActivityFile); + return updateState ? R.ok() : R.error("编辑失败"); + } + + + @PostMapping("/delete") + @ApiOperation(value = "删除", response = EntrepreneurialActivityFile.class) + public R delete(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { + boolean delState = service.removeById(id); + return delState ? R.ok() : R.error("删除失败"); + } + + @PostMapping("/batchDeletion") + @ApiOperation(value = "批量删除", response = EntrepreneurialActivityFile.class) + public R batchDeletion(@ApiParam(name = "id", value = "主键", required = true) @RequestParam List ids) { + boolean delState = service.removeByIds(ids); + return delState ? R.ok() : R.error("删除失败"); + } +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/EntrepreneurialActivityProgressController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/EntrepreneurialActivityProgressController.java new file mode 100644 index 0000000..278720d --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/EntrepreneurialActivityProgressController.java @@ -0,0 +1,99 @@ +package com.huoran.occupationlab.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.api.UserClient; +import com.huoran.common.aop.annotation.NoRepeatSubmit; +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.EntrepreneurialActivityProgress; +import com.huoran.occupationlab.service.EntrepreneurialActivityProgressService; +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 javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + * @描述:活动进展表控制类 + * @作者: Rong + * @日期: 2023-05-12 + */ +@RestController +@RequestMapping("/occupationlab/activity/progress") +@Api(value = "活动进展表:EntrepreneurialActivityProgressController", tags = "R-活动进展") +public class EntrepreneurialActivityProgressController { + + @Autowired + public EntrepreneurialActivityProgressService service; + + @Autowired + private UserClient userClient; + + @ApiOperation(value = "根据赛事id查询竞赛进展") + @GetMapping("/getCompetitionProgress") + public R getCompetitionProgress( + @ApiParam(name = "activityId", value = "活动id") + @RequestParam("activityId") String activityId) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("activity_id", activityId); + List activityProgressList = service.list(wrapper); + return R.ok().put("activityProgressList", activityProgressList); + } + + + @PostMapping("/findById") + @ApiOperation(value = "查询详情", response = EntrepreneurialActivityProgress.class) + public R findById(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { + EntrepreneurialActivityProgress entrepreneurialActivityProgress = service.getById(id); + return R.ok().put("data", entrepreneurialActivityProgress); + } + + + /* @PostMapping("/save") + @ApiOperation(value = "新增", response = EntrepreneurialActivityProgress.class) + public R save(@RequestBody @ApiParam(name = "活动进展表对象", value = "传入json格式", required = true) EntrepreneurialActivityProgress entrepreneurialActivityProgress, HttpServletRequest request) { + boolean addState = service.save(entrepreneurialActivityProgress); + return addState ? R.ok() : R.error("新增失败"); + } + +*/ + + @NoRepeatSubmit + @ApiOperation(value = "添加竞赛进展") + @PostMapping("/addCompetitionProgress") + public R addCompetitionProgress(@ApiParam(name = "competitionProgress", value = "竞赛进展对象", required = true) + @RequestBody EntrepreneurialActivityProgress competitionProgress) { + //判重 + boolean isRepeat = service.repeat(competitionProgress); + if (isRepeat) { + return R.error("竞赛进展已存在"); + } + boolean save = service.save(competitionProgress); + return save ? R.ok() : R.error(); + } + + @PostMapping("/update") + @ApiOperation(value = "修改", response = EntrepreneurialActivityProgress.class) + public R update(@RequestBody @ApiParam(name = "活动进展表对象", value = "传入json格式", required = true) EntrepreneurialActivityProgress entrepreneurialActivityProgress, HttpServletRequest request) { + boolean updateState = service.updateById(entrepreneurialActivityProgress); + return updateState ? R.ok() : R.error("编辑失败"); + } + + + @PostMapping("/delete") + @ApiOperation(value = "删除", response = EntrepreneurialActivityProgress.class) + public R delete(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { + boolean delState = service.removeById(id); + return delState ? R.ok() : R.error("删除失败"); + } + + @PostMapping("/batchDeletion") + @ApiOperation(value = "批量删除", response = EntrepreneurialActivityProgress.class) + public R batchDeletion(@ApiParam(name = "id", value = "主键", required = true) @RequestBody List ids) { + boolean delState = service.removeByIds(ids); + return delState ? R.ok() : R.error("删除失败"); + } +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/EvaluationRecordController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/EvaluationRecordController.java new file mode 100644 index 0000000..e509163 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/EvaluationRecordController.java @@ -0,0 +1,172 @@ +package com.huoran.occupationlab.controller; + + +import com.huoran.api.UserClient; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.occupationlab.entity.EvaluationFraction; +import com.huoran.occupationlab.entity.vo.EvaluationRecordDetailVO; +import com.huoran.occupationlab.entity.vo.EvaluationRecordSubmitVO; +import com.huoran.occupationlab.entity.vo.TMSEvaluationRecordVO; +import com.huoran.occupationlab.service.EvaluationFractionService; +import com.huoran.occupationlab.service.EvaluationRecordService; +import com.huoran.occupationlab.service.QuestionsService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.util.concurrent.ExecutionException; + +/** + *

+ * 记录用户测评信息 前端控制器 + *

+ * + * @author lr + * @since 2021-09-26 + */ +@RequestMapping("/occupationlab/evaluationrecord") +@RestController +@Api(value = "职站:用户测评信息记录与操作", tags = "职站:提供用户测评信息增删改查等相关方法") +public class EvaluationRecordController { + + @Autowired + private EvaluationRecordService evaluationRecordService; + @Autowired + private QuestionsService questionsService; + @Autowired + private EvaluationFractionService fractionService; + @Autowired + private UserClient userClient; + + /* + 测评管理大致需求: + 1.用户一进去没做过的情况下,直接依据测评规则设置的题目数量直接默认生成,比如设置10题,则用户端直接随机生成10道题目且数据库同步生成10条数据. + 点击下一题时做编辑操作更改答案为用户选择的答案,点击下一题时候更改测评信息的字段更新当前做到第几题。 + + 2.如若在教师端对题目进行禁启用处理,在学生端如若已生成题目需将本次题目做完才会刷新(不能影响学生,以防学生正在测评中题目直接刷新没有),教师端更改测评规则同理, + 也是学生做完本次已经生成的题目后才会依据规则刷新设置后的题目。 + */ + + + @GetMapping("/remaining") + @ApiOperation(value = "获取测评剩余时间", notes = "获取测评剩余时间") + public R getEvaluationRemainingTime(HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + String remainingTime = questionsService.getEvaluationRemainingTime(Integer.valueOf(accountId), schoolId); + return R.ok().put("data", remainingTime); + } + + @GetMapping("/start") + @ApiOperation(value = "开始测评", notes = "开始测评") + public R startEvaluation(HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + TMSEvaluationRecordVO evaluationRecordVO = evaluationRecordService.startEvaluation(Integer.valueOf(accountId), schoolId); + return R.ok().put("data", evaluationRecordVO); + } + + @PostMapping("/previous") + @ApiOperation(value = "上一题", notes = "上一题") + public R previousQuestion(@RequestBody TMSEvaluationRecordVO evaluationRecordVO) throws ExecutionException, InterruptedException { + Integer evaluationRecordId = evaluationRecordVO.getId(); + String userAnswer = evaluationRecordVO.getUserAnswer(); + Integer currentQuestionSortNo = evaluationRecordVO.getCurrentQuestionSortNo(); + TMSEvaluationRecordVO recordVO = evaluationRecordService.convertQuestion(evaluationRecordId, currentQuestionSortNo, userAnswer, currentQuestionSortNo - 1); + return R.ok().put("data", recordVO); + } + + @PostMapping("/next") + @ApiOperation(value = "下一题", notes = "下一题") + public R nextQuestion(@RequestBody TMSEvaluationRecordVO evaluationRecordVO) throws ExecutionException, InterruptedException { + Integer evaluationRecordId = evaluationRecordVO.getId(); + String userAnswer = evaluationRecordVO.getUserAnswer(); + Integer currentQuestionSortNo = evaluationRecordVO.getCurrentQuestionSortNo(); + TMSEvaluationRecordVO recordVO = evaluationRecordService.convertQuestion(evaluationRecordId, currentQuestionSortNo, userAnswer, currentQuestionSortNo + 1); + return R.ok().put("data", recordVO); + } + + @GetMapping("/not_made") + @ApiOperation(value = "提交之前查询是否还有未做完的试题", notes = "提交之前查询是否还有未做完的试题") + public R selectNotMade(@RequestParam("evaluationRecordId") Integer evaluationRecordId) { + String result = evaluationRecordService.selectNotMade(evaluationRecordId); + return R.ok().put("data", result); + } + + @ApiOperation(value = "提交测评", notes = "提交测评") + @PostMapping("/submit") + public R submitEvaluation(@RequestBody TMSEvaluationRecordVO evaluationRecordVO, HttpServletRequest request) throws ExecutionException, InterruptedException { + Integer evaluationRecordId = evaluationRecordVO.getId(); + String userAnswer = evaluationRecordVO.getUserAnswer(); + Integer currentQuestionSortNo = evaluationRecordVO.getCurrentQuestionSortNo(); + String accountId = TokenUtils.getIdByJwtToken(request); + evaluationRecordVO.setAccountId(Integer.valueOf(accountId)); + + Integer types = evaluationRecordVO.getTypes(); + EvaluationRecordSubmitVO recordSubmitVO = evaluationRecordService.submitEvaluation(evaluationRecordId, currentQuestionSortNo, userAnswer, Integer.valueOf(accountId)); + Integer totalScore = recordSubmitVO.getTotalScore(); + EvaluationFraction fractionEntity = new EvaluationFraction(); + EvaluationFraction fraction = fractionEntity.setAccountId(Integer.valueOf(accountId)).setFraction(totalScore).setTypes(types); + fractionService.insertRecord(fraction); + + return R.ok().put("data", recordSubmitVO); + } + + @ApiOperation(value = "成绩详情", notes = "成绩详情") + @GetMapping("/detail") + public R evaluationScoreDetail(Integer evaluationRecordId) throws ExecutionException, InterruptedException { + EvaluationRecordDetailVO detailVO = evaluationRecordService.evaluationDetail(evaluationRecordId); + return R.ok().put("data", detailVO); + } + + + @ApiOperation(value = "查询是否能够开启实验", notes = "查询是否能够开启实验") + @GetMapping("/can_experiment") + public R isOpenExperiment(HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + boolean openExperiment = evaluationRecordService.isOpenExperiment(Integer.valueOf(accountId)); + return R.ok().put("data", openExperiment); + } + + + @ApiOperation(value = "查询是否能开启虚拟仿真实验", notes = "查询是否能开启虚拟仿真实验") + @GetMapping("/openExercise") + public R isOpenExercise(HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer type = 2; + Integer id = fractionService.queryScore(Integer.valueOf(accountId), type); + if (id > 0) { + Integer score = fractionService.queryExerciseRecord(Integer.valueOf(accountId)); + if (score >= 80) { + return R.ok("true"); + } else { + return R.error(200, "false"); + } + } else { + return R.error(200, "false"); + } + + } + + @ApiOperation(value = "查询是否能开启教学实验", notes = "查询是否能开启教学实验") + @GetMapping("/openTeaching") + public R isOpenTeaching(HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer type = 3; + Integer id = fractionService.queryScore(Integer.valueOf(accountId), type); + if (id > 0) { + Integer score = fractionService.queryTeachingRecord(Integer.valueOf(accountId)); + if (score >= 80) { + return R.ok("true"); + } else { + return R.error("false"); + } + } else { + return R.error("false"); + } + } +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/ExperimentalReportController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/ExperimentalReportController.java new file mode 100644 index 0000000..85d861f --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/ExperimentalReportController.java @@ -0,0 +1,73 @@ +package com.huoran.occupationlab.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.huoran.common.constant.DelConstant; +import com.huoran.common.entity.ExperimentalReport; +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.req.EditExperimentalDataReq; +import com.huoran.occupationlab.service.ExperimentalReportService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +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.RestController; + +/** + *

+ * 存储各子系统的实验报告 前端控制器 + *

+ * + * @author Mr.JK + * @since 2021-09-13 + */ +@RestController +@RequestMapping("/occupationlab/experimentalReport") +@Api(tags = "实验报告") +public class ExperimentalReportController { + + @Autowired + private ExperimentalReportService experimentalReportService; + + @PostMapping("/addExperimentalReport") + @ApiOperation("添加实验报告 -远程feign") + public Integer addExperimentalReport(@RequestBody ExperimentalReport experimentalReport) { + + QueryWrapper experimentalQueryWrapper = new QueryWrapper(); + experimentalQueryWrapper.eq("school_id",experimentalReport.getSchoolId()); + experimentalQueryWrapper.eq("project_id",experimentalReport.getProjectId()); + experimentalQueryWrapper.eq("curriculum_id",experimentalReport.getCurriculumId()); + experimentalQueryWrapper.eq("mall_id",experimentalReport.getMallId()); + experimentalQueryWrapper.eq("assessment_id",experimentalReport.getAssessmentId()); + experimentalQueryWrapper.eq("account_id",experimentalReport.getAccountId()); + ExperimentalReport one = experimentalReportService.getOne(experimentalQueryWrapper); + //考核id不为空,有考核数据,不保存实验报告返回0 + if (experimentalReport.getAssessmentId()!=null && one!=null){ + return 0; + } + if (experimentalReportService.save(experimentalReport)) { + return experimentalReport.getReportId(); + } + return null; + } + + /** + * @Description : 用于提交实验报告后将实验数据填入数据字段 + * @Param req + * @Author Rong---2022/5/20 + */ + @PostMapping("/editExperimentalData") + @ApiOperation("编辑实验数据") + public R editExperimentalData(@RequestBody EditExperimentalDataReq req) { + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.set("data", req.getData()); + updateWrapper.eq("is_del", DelConstant.NOT_DEL); + updateWrapper.eq("report_id", req.getReportId()); + boolean ret = experimentalReportService.update(new ExperimentalReport(), updateWrapper); + return ret ? R.ok() : R.error(); + } + +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/OSSFileController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/OSSFileController.java new file mode 100644 index 0000000..d7bb0c8 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/OSSFileController.java @@ -0,0 +1,68 @@ +package com.huoran.occupationlab.controller; + +import com.huoran.common.entity.FilesResult; +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.PythonTableData; +import com.huoran.occupationlab.service.OSSFileService; +import com.huoran.occupationlab.service.PythonTableDataService; +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 org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; +import javax.validation.Valid; +import java.io.IOException; +import java.util.Date; +import java.util.List; + +/** + * @Author chen + * @DATE 2020/10/1 21:59 + * @Version 1.0 + */ +@Api(description = "阿里云文件/视频管理") +@RestController +@RequestMapping("/oss/manage") +public class OSSFileController { + + @Autowired + private OSSFileService ossFileService; + + @Autowired + public PythonTableDataService pythonTableDataService; + + + @ApiOperation(value = "文件上传(本接口只限python导入Excel至oss用(指定文件上传))") + @PostMapping("/fileupload") + public R fileupload(@ApiParam(name = "file", value = "文件", required = true) @RequestParam("file") MultipartFile file, + @ApiParam(name = "tableName", value = "表名", required = true) @RequestParam("tableName") String tableName) { + if (file == null) return R.error("请选择文件"); + + try { + //获取上传路径 + FilesResult filesResult = ossFileService.upload(file,tableName); + if (filesResult != null) { + PythonTableData pythonTableData = new PythonTableData(); + pythonTableData.setOssFileName(filesResult.getOssFileName()); + pythonTableData.setFileName(filesResult.getOriginalFileName()); + pythonTableData.setFileFormat(filesResult.getFileType()); + pythonTableData.setFileSize(filesResult.getFileSize()); + pythonTableData.setFilePath(filesResult.getFileUrl()); + pythonTableData.setCreateTime(new Date()); + pythonTableData.setTableName(tableName); + pythonTableDataService.save(pythonTableData); + + } + return R.ok().put("filesResult", filesResult); + } catch (IOException e) { + e.printStackTrace(); + return R.error(); + } + } + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/OnlineContestController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/OnlineContestController.java new file mode 100644 index 0000000..57282a3 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/OnlineContestController.java @@ -0,0 +1,64 @@ +package com.huoran.occupationlab.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.api.UserClient; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.occupationlab.entity.Applicant; +import com.huoran.occupationlab.entity.Contest; +import com.huoran.occupationlab.service.ApplicantService; +import com.huoran.occupationlab.service.ContestService; +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 javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + * @Author chen + * @DATE 2020/10/20 15:55 + * @Version 1.0 + */ +@Api(description = "用户端线上赛事管理", tags = "用户端线上赛事管理") +@RestController +@RequestMapping("/occupationlab/enterprise/match/onlineContest") +public class OnlineContestController { + + @Autowired + private ContestService contestService; + + @Autowired + private ApplicantService applicantService; + + @Autowired + private UserClient userClient; + + @ApiOperation(value = "线上赛事列表分页条件查询") + @GetMapping("/onlineContestQuery/{current}/{pageSize}") + public R onlineContestQuery( + @ApiParam(name = "current", value = "当前页码", required = true) + @PathVariable int current, + @ApiParam(name = "pageSize", value = "每页记录数", required = true) + @PathVariable int pageSize, + @ApiParam(name = "name", value = "竞赛名称,模糊查询", required = false) + @RequestParam(value = "name", required = false) String name, + @ApiParam(name = "way", value = "最近更新排序方式0", required = false) + @RequestParam(value = "way", required = false) String way, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + Page page = new Page<>(current, pageSize); + //分页查询 + contestService.pageQuery(page, name, way, schoolId); + //查询用户报名赛事 + List contestIds = applicantService.queryContestId(accountId); + //每页记录数 + List contestList = page.getRecords(); + //总数 + long total = page.getTotal(); + return R.ok().put("contestList", contestList).put("contestIds", contestIds).put("total", total); + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/PermissionController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/PermissionController.java new file mode 100644 index 0000000..b0ada7b --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/PermissionController.java @@ -0,0 +1,89 @@ +package com.huoran.occupationlab.controller; + + +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.AclPermission; +import com.huoran.occupationlab.entity.vo.PermissionVO; +import com.huoran.occupationlab.service.PermissionService; +import com.huoran.occupationlab.service.RolePermissionService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 权限 菜单管理 + */ +@Api(tags = "权限菜单管理") +@RestController +@RequestMapping("/occupationlab/management/permission") +public class PermissionController { + + @Autowired + private PermissionService permissionService; + + @Autowired + private RolePermissionService rolePermissionService; + + @ApiOperation(value = "获取企业端权限菜单") + @GetMapping("/queryPermissionMenu") + public R queryPermissionMenu() { + List list = permissionService.queryAllMenu(); + return R.ok().put("children", list); + } + + @ApiOperation(value = "获取管理端权限菜单") + @GetMapping("/queryManagementPermissionMenu") + public R queryEnterprisePermissionMenu() { + List list = permissionService.queryManagementAllMenu(); + return R.ok().put("children", list); + } + + // @ApiOperation(value = "递归删除菜单") + // @DeleteMapping("/remove/{id}") + // public R remove(@PathVariable String id) { + // permissionService.removeChildById(id); + // return R.ok(); + // } + + @ApiOperation(value = "给角色分配权限") + @PostMapping("/doAssign") + public R doAssign(@RequestBody PermissionVO permissionVO) { + String roleId = permissionVO.getRoleId(); + Integer isPort = permissionVO.getIsPort(); + if (roleId != null) { + //给角色分配权限之前,删除所有角色权限 + rolePermissionService.removeMenu(roleId, isPort); + //分配权限 + permissionService.saveRolePermissionRelationShip(permissionVO); + return R.ok(); + } else { + return R.error(); + } + } + + @ApiOperation(value = "根据角色获取菜单") + @GetMapping("/toAssign/{roleId}") + public R toAssign(@PathVariable String roleId) { + List rolePermissions = permissionService.selectRoleMenu(roleId); + return R.ok().put("rolePermissions", rolePermissions); + } + + @ApiOperation(value = "新增菜单") + @PostMapping("/save") + public R save(@RequestBody AclPermission permission) { + permissionService.save(permission); + return R.ok(); + } + + // @ApiOperation(value = "修改菜单") + // @PutMapping("/update") + // public R updateById(@RequestBody Permission permission) { + // permissionService.updateById(permission); + // return R.ok(); + // } + +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/PlayRecordController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/PlayRecordController.java new file mode 100644 index 0000000..10bf580 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/PlayRecordController.java @@ -0,0 +1,86 @@ +package com.huoran.occupationlab.controller; + +import com.huoran.api.UserClient; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.occupationlab.entity.PlayRecord; +import com.huoran.occupationlab.service.PlayRecordService; +import io.swagger.annotations.*; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.springframework.beans.factory.annotation.Autowired; +import org.apache.commons.lang.StringUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.Api; +import org.springframework.web.bind.annotation.RequestParam; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletRequest; +import javax.validation.Valid; + +/** + *

+ * 资源播放记录表 前端控制器 + *

+ * + * @author lr + * @since 2022-09-09 + */ +@RestController +@RequestMapping("/occupationlab/playRecord") +@Api(value = "资源播放记录表:PlayRecordController", tags = "R-资源播放记录") +public class PlayRecordController { + + @Autowired + public PlayRecordService service; + @Autowired + private UserClient userClient; + + + @PostMapping("/findById") + @ApiOperation(value = "查询详情", response = PlayRecord.class) + public R findById(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { + PlayRecord playRecord = service.getById(id); + return R.ok().put("data", playRecord); + } + + + @PostMapping("/save") + @ApiOperation(value = "新增", response = PlayRecord.class) + public R save(@RequestBody @Valid @ApiParam(name = "资源播放记录表对象", value = "传入json格式", required = true) PlayRecord playRecord, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + playRecord.setAccountId(Integer.valueOf(accountId)); + playRecord.setSchoolId(schoolId); + + boolean addState = service.save(playRecord); + return addState ? R.ok() : R.error("新增失败"); + } + + + @PostMapping("/update") + @ApiOperation(value = "修改", response = PlayRecord.class) + public R update(@RequestBody @ApiParam(name = "资源播放记录表对象", value = "传入json格式", required = true) PlayRecord playRecord, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + playRecord.setAccountId(Integer.valueOf(accountId)); + playRecord.setSchoolId(schoolId); + boolean updateState = service.updateById(playRecord); + return updateState ? R.ok() : R.error("编辑失败"); + } + + + @PostMapping("/delete") + @ApiOperation(value = "删除", response = PlayRecord.class) + public R delete(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { + boolean delState = service.removeById(id); + return delState ? R.ok() : R.error("删除失败"); + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/ProjectJudgmentController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/ProjectJudgmentController.java new file mode 100644 index 0000000..f4f7a04 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/ProjectJudgmentController.java @@ -0,0 +1,57 @@ +package com.huoran.occupationlab.controller; + + +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.ProjectJudgment; +import com.huoran.occupationlab.service.ProjectJudgmentService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.List; + +/** + *

+ * 项目管理判分点绑定表 前端控制器 + *

+ * + * @author Mr.JK + * @since 2021-08-26 + */ +@Api(tags = "项目管理:项目管理判分点绑定") +@RestController +@RequestMapping("/occupationlab/projectJudgment") +public class ProjectJudgmentController { + + @Autowired + private ProjectJudgmentService projectJudgmentService; + + @ApiOperation(value = "添加项目管理、判分点中间表") + @PostMapping("/addProjectJudgment") + public R addProjectJudgment(@RequestBody @Valid List projectJudgments){ + return R.toR(projectJudgmentService.saveBatch(projectJudgments)); + } + + @ApiOperation(value = "批量更新") + @PostMapping("/updateProjectJudgment") + public R updateProjectJudgment(@RequestParam Integer projectId,@RequestBody @Valid List projectJudgments){ + return R.toR(projectJudgmentService.updateProjectJudgment(projectId,projectJudgments)); + } + + @ApiOperation(value = "批量删除") + @PostMapping("deleteProjectJudgment") + public R deleteProjectJudgment(@RequestParam List projectJudgmentIds){ + return R.toR(projectJudgmentService.removeByIds(projectJudgmentIds)); + } + + @ApiOperation(value = "获取判分点分数信息 远程feign") + @GetMapping("getJudgmentScore") + public Integer getJudgmentScore(@RequestParam Integer projectId,@RequestParam Integer JudgmentId){ + return projectJudgmentService.getJudgmentScore(projectId,JudgmentId); + } + +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/ProjectManageController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/ProjectManageController.java new file mode 100644 index 0000000..452be2b --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/ProjectManageController.java @@ -0,0 +1,267 @@ +package com.huoran.occupationlab.controller; + +import com.huoran.api.UserClient; +import com.huoran.common.constant.PlatformConstant; +import com.huoran.common.entity.ProjectManage; +import com.huoran.common.entity.to.JudgmentPointDataTo; +import com.huoran.common.entity.to.ProjectDataTo; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.occupationlab.entity.req.PageAssessmentForProjectReq; +import com.huoran.occupationlab.entity.req.ProjectManageReq; +import com.huoran.occupationlab.entity.resp.StuAssessmentListResp; +import com.huoran.occupationlab.entity.vo.ProjectVo; +import com.huoran.occupationlab.service.ProjectManageService; +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.util.ObjectUtils; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import javax.validation.Valid; +import java.util.List; + +/** + *

+ * 项目管理表 前端控制器 + * 职站与中台接口 + *

+ * + * @author Mr.JK + * @since 2021-08-26 + */ +@Api(tags = "项目管理:项目管理") +@RestController +@RequestMapping("/occupationlab/projectManage") +public class ProjectManageController { + + @Autowired + private ProjectManageService projectManageService; + + @Autowired + private UserClient userClient; + + @ApiOperation("项目管理——列表(分页、筛选)") + @PostMapping("/queryProjectManage") + public R queryProjectManageByNakadai(@RequestBody ProjectManageReq projectManageReq, @RequestHeader String token) { + //token查询学校id + Integer schoolId = userClient.getSchoolIdByAccountId(TokenUtils.getIdByJwtToken(token)); + if (schoolId == -1) { + return R.error("学校查询失败"); + } + + String accountId = TokenUtils.getIdByJwtToken(token); + projectManageReq.setSchoolId(schoolId); + projectManageReq.setAccountId(Integer.valueOf(accountId)); + + if (projectManageReq.getPlatformId() == PlatformConstant.POST_STATION) { + String roleName = userClient.getUserAllRole(accountId, PlatformConstant.POST_STATION);//获取当前用户的角色 + //需求:需要依据角色查询本校内的项目(超管管理员角色能看到本校内发布的全部项目、其它角色只能看到自己发布的以及超管管理员发布的项目) + if (roleName.contains("超级管理员") || roleName.contains("管理员")) { + projectManageReq.setIsAdmin(1); + } + return projectManageService.queryProjectManageByOccupationlab(projectManageReq); + } + return projectManageService.queryProjectManageByNakadai(projectManageReq); + + } + + /** + * @Description :2021/11/26修改 由原来新增项目不区分创建人角色修改为根据账号id区分创建人角色(目前中台管理员只有一人以账号id区分) + * @Param projectVo + * @Param token + * @Param request + */ + @ApiOperation("新增项目管理") + @PostMapping("/addProjectManage") + public R addProjectManage(@RequestBody ProjectVo projectVo, + @RequestHeader String token, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + //token查询学校id + Integer schoolId = userClient.getSchoolIdByAccountId(TokenUtils.getIdByJwtToken(token)); + if (schoolId == -1) { + return R.error("学校查询失败"); + } + projectVo.getProjectManage().setSchoolId(schoolId); + projectVo.getProjectManage().setAccountId(Integer.valueOf(accountId)); + + if (ObjectUtils.isEmpty(projectVo.getProjectJudgmentList())) { + return R.error("判分点为空!"); + } + + return projectManageService.addProjectManage(projectVo); + } + + @ApiOperation("修改项目管理") + @PostMapping("/updateProjectManage") + public R updateProjectManage(@RequestBody @Valid ProjectVo projectVo) { + if (ObjectUtils.isEmpty(projectVo.getProjectJudgmentList())) { + return R.error("判分点为空!"); + } + return projectManageService.updateProjectManage(projectVo); + } + + @ApiOperation("批量删除项目管理") + @PostMapping("/deleteProjectManage") + public R deleteProjectManage(@RequestParam List projectIds, @RequestParam Integer platformId) { + return projectManageService.deleteProjectManage(projectIds, platformId); + } + + @ApiOperation("根据项目id查询详情") + @GetMapping("/getProjectDetail") + public R getProjectDetail(@RequestParam Integer projectId, + @RequestParam(value = "stuAssessent", required = false) + @ApiParam(value = "学生考核进入考核调用时给后端的标识,用于给后端区分禁用启用根据禁用启用展示(默认给1)", required = false) + Integer stuAssessent, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + //token查询学校id + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + return projectManageService.getProjectDetail(projectId, stuAssessent, schoolId); + } + + @ApiOperation("根据项目id查询判分点") + @PostMapping("/getProjectPoints") + public JudgmentPointDataTo getProjectPoints(@RequestBody ProjectDataTo projectDataTo) { + return projectManageService.getProjectPoints(projectDataTo); + } + + @ApiOperation(value = "更新开启状态") + @GetMapping("/updateIsOpen") + public R updateIsOpen(@RequestParam Integer projectId, @RequestParam Integer isOpen, + @RequestParam Integer platformId, @RequestHeader String token) { + String accountId = TokenUtils.getIdByJwtToken(token); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + projectManageService.updateIsOpen(projectId, isOpen, platformId, schoolId); + return R.ok(); + } + + @ApiOperation(value = "新增/编辑项目管理名称判重", notes = "字段无开启校验") + @PostMapping("/queryNameIsExist") + public R queryNameIsExist(@RequestBody ProjectManage projectManage, @RequestHeader String token) { + String accountId = TokenUtils.getIdByJwtToken(token); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + projectManage.setFounder(0); + if (schoolId != null) { + projectManage.setSchoolId(schoolId); + projectManage.setFounder(1); + } + Integer ret = projectManageService.queryNameIsExist(projectManage); + if (ret == 1) { + return R.ok(); + } else { + return R.error("项目名称重复!"); + } + } + + @ApiOperation(value = "平均分分配值") + @GetMapping("/avgValues") + public R avgValues(@RequestParam Integer number) { + return projectManageService.avgValues(number); + } + + @ApiOperation(value = "根据系统id获取项目(获取课程下与该学校下的所有项目)") + @GetMapping("/getProjectBySystemId") + public R getProjectBySystemId( + @RequestParam String systemId, + @RequestHeader String token, + @ApiParam(value = "项目权限(0、练习 1、考核 2、竞赛)", name = "permissions") + @RequestParam Integer permissions, + @RequestParam Integer cId, @RequestParam Integer mallId) { + String accountId = TokenUtils.getIdByJwtToken(token); + return projectManageService.getProjectBySystemId(systemId, accountId, permissions, cId, mallId); + } + + + + + @ApiOperation(value = "根据系统id获取项目(获取课程下与该学校下的所有项目) 仅供远程调用", response = StuAssessmentListResp.class) + @PostMapping("/getProjectBySystemIdRemoteCall") + public List getProjectBySystemIdRemoteCall( + @RequestParam("systemId") @ApiParam(value = "系统id(可多个逗号拼接)") String systemId, + @RequestParam("permissions") @ApiParam(value = "项目权限(0、练习 1、考核 2、竞赛)") Integer permissions, + @RequestParam("courseId") @ApiParam(value = "课程id") Integer courseId, + @RequestParam("accountId") @ApiParam(value = "账号id(必填)") Integer accountId, + @RequestParam("mallId") @ApiParam(value = "商品id(必填)") Integer mallId) { + return projectManageService.getProjectBySystemIdRemoteCall(systemId, accountId + "", permissions, courseId, mallId); + } + + @ApiOperation("复制项目管理") + @PostMapping("/copyProjectManage") + public R copyProjectManage(@RequestBody ProjectVo projectVo, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + projectVo.getProjectManage().setAccountId(Integer.valueOf(accountId)); + projectVo.getProjectManage().setSchoolId(userClient.getSchoolIdByAccountId(accountId)); + return projectManageService.copyProjectManage(projectVo); + } + + @ApiOperation(value = "根据系统id、项目权限获取系统内置项目") + @GetMapping("/getInternalProjectBySystemId") + public List getInternalProjectBySystemId(@RequestParam List systemId, + @RequestParam @ApiParam(value = "项目权限(0、练习 1、考核 2、竞赛)", name = "permissions") Integer permissions) { + return projectManageService.getInternalProjectBySystemId(systemId, permissions); + } + + @ApiOperation("获取学校下拥有的系统") + @GetMapping("/getSystemIdBySchool") + public R getSystemIdBySchool(@RequestHeader String token) { + String accountId = TokenUtils.getIdByJwtToken(token); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + if (schoolId == -1) { + return R.error("查询学校失败!"); + } + return projectManageService.getSystemIdBySchool(schoolId); + } + + @ApiOperation(value = "根据课程id获取考核项目列表(分页、筛选)", response = ProjectManage.class) + @PostMapping("/getSchoolProjectByAssessent") + public R getSchoolProjectByAssessent(@RequestBody PageAssessmentForProjectReq projectManageReq, @RequestHeader String token) { + //token查询学校id + Integer schoolId = userClient.getSchoolIdByAccountId(TokenUtils.getIdByJwtToken(token)); + if (schoolId == -1) { + return R.error("学校查询失败"); + } + String accountId = TokenUtils.getIdByJwtToken(token); + projectManageReq.setSchoolId(schoolId); + projectManageReq.setAccountId(Integer.valueOf(accountId)); + + return projectManageService.getSchoolProjectByAssessent(projectManageReq); + + } + + + @ApiOperation(value = "赛事根据课程id获取考核项目列表(分页、筛选)", response = ProjectManage.class) + @PostMapping("/getProjectAssessmentByCompetition") + public R getProjectAssessmentByCompetition(@RequestBody PageAssessmentForProjectReq projectManageReq, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + //token查询学校id + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + if (schoolId > 0) { + projectManageReq.setSchoolId(schoolId); + } + return projectManageService.getProjectAssessmentByCompetition(projectManageReq); + } + + @ApiOperation("保存项目草稿") + @PostMapping("/saveProjectDraft") + public R saveProjectDraft(@RequestBody ProjectVo projectVo, + @RequestHeader String token, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + //token查询学校id + Integer schoolId = userClient.getSchoolIdByAccountId(TokenUtils.getIdByJwtToken(token)); + if (schoolId == -1) { + return R.error("学校查询失败"); + } + projectVo.getProjectManage().setSchoolId(schoolId); + projectVo.getProjectManage().setAccountId(Integer.valueOf(accountId)); + return projectManageService.addProjectManage(projectVo); + } + + @ApiOperation("修改项目草稿") + @PostMapping("/editProjectDraft") + public R editProjectDraft(@RequestBody @Valid ProjectVo projectVo) { + return projectManageService.updateProjectManage(projectVo); + } +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/ProvinceController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/ProvinceController.java new file mode 100644 index 0000000..af41b92 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/ProvinceController.java @@ -0,0 +1,42 @@ +package com.huoran.occupationlab.controller; + + +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.Province; +import com.huoran.occupationlab.service.ProvinceService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +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.RestController; + +import java.util.List; + +/** + *

+ * 省份表 前端控制器 + *

+ * + * @author Ning + * @since 2020-10-27 + */ +@RestController +@RequestMapping("/occupationlab/enterprise/province") +@Api(description = "省份", tags = "省份") +public class ProvinceController { + + @Autowired + private ProvinceService provinceService; + + /** + * 查询省份 + */ + @ApiOperation(value = "查询省份") + @GetMapping("/queryProvince") + public R queryProvince() { + List list = provinceService.queryProvince(); + return R.ok().put("list", list); + } +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/PythonFileDataController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/PythonFileDataController.java new file mode 100644 index 0000000..e0daade --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/PythonFileDataController.java @@ -0,0 +1,121 @@ +package com.huoran.occupationlab.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.api.NakadaiClient; +import com.huoran.api.UserClient; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.occupationlab.entity.PythonFileData; +import com.huoran.occupationlab.service.PythonFileDataService; +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 javax.servlet.http.HttpServletRequest; +import java.util.ArrayList; +import java.util.List; + +/** + *

+ * 前端控制器 + *

+ * + * @author lr + * @since 2022-04-06 + */ +@RestController +@RequestMapping("/occupationlab/python/file/data") +@Api(value = "职站-python:我的数据", tags = "职站-python:我的数据") +public class PythonFileDataController { + + @Autowired + public PythonFileDataService service; + @Autowired + private UserClient userClient; + @Autowired + private NakadaiClient nakadaiClient; + + /** + * @Description : 导入数据 + * @Param fileData + * @Param request + * @Author Rong---2022/4/6 + */ + @PostMapping("/importData") + @ApiOperation(value = "新增数据") + public R importData(@RequestBody PythonFileData fileData, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + fileData.setAccountId(Integer.valueOf(accountId)); + fileData.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); + //统计总共上传的文件大小 + Double fileSize = service.statistics(Integer.valueOf(accountId), userClient.getSchoolIdByAccountId(accountId)); + + if (fileSize > 10 || (10 - fileSize) < Double.valueOf(fileData.getFileSize()) / (1024 * 1024)) { + return R.error("当前储存空间已满,请删除不需要的文件后再上传!"); + } + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("file_name", fileData.getFileName()); + queryWrapper.eq("account_id", accountId); + queryWrapper.eq("school_id", userClient.getSchoolIdByAccountId(accountId)); + PythonFileData pythonFileData = service.getOne(queryWrapper); + if (pythonFileData != null) { + return R.error("您已导入过相同的文件!"); + } + + boolean result = service.save(fileData); + return result ? R.ok() : R.error(); + } + + /** + * @Description : 我的数据 + * @Param req + * @Param request + * @Author Rong---2022/4/6 + */ + @PostMapping("/myData") + @ApiOperation(value = " 我的数据", response = PythonFileData.class) + public R myData(@RequestParam(value = "fileName", required = false) @ApiParam(value = "文件名称", required = false) String fileName, + @ApiParam(value = "当前页数", required = true) @RequestParam("pageNum") Integer pageNum, + @ApiParam(value = "当前页需要显示的数量", required = true) @RequestParam("pageSize") Integer pageSize, + HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + PythonFileData fileData = new PythonFileData(); + fileData.setAccountId(Integer.valueOf(accountId)); + fileData.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); + fileData.setFileName(fileName); + fileData.setPageNum(pageNum); + fileData.setPageSize(pageSize); + return service.myData(fileData); + } + + @PostMapping("/lookOver") + @ApiOperation(value = "查看") + public R lookOver(@RequestParam("id") @ApiParam(value = "id") Integer id) { + PythonFileData pythonFileData = service.getById(id); + return R.ok().put("data", pythonFileData); + } + + @ApiOperation("批量删除") + @PostMapping("/batchDeletion") + public R deleteProjectManage(@RequestParam List ids, HttpServletRequest request) { + List ossFileNames = new ArrayList<>(); + for (Integer id : ids) { + PythonFileData pythonFileData = service.getById(id); + ossFileNames.add(pythonFileData.getOssFileName()); + + } + nakadaiClient.fileDeletion(ossFileNames, request);//删除阿里云文件 + return service.removeByIds(ids) ? R.ok() : R.error(); + } + + /*@PostMapping("/lookExcel") + @ApiOperation(value = "查看Excel") + public R lookExcel(@RequestParam("excelUrl") @ApiParam(value = "Excel地址") String excelUrl) { + return R.ok().put("data", EXCELUtil.readFile(excelUrl)); + }*/ + +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/PythonTableDataController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/PythonTableDataController.java new file mode 100644 index 0000000..ae5a047 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/PythonTableDataController.java @@ -0,0 +1,53 @@ +package com.huoran.occupationlab.controller; + + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.common.constant.DelConstant; +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.ContestAnnouncement; +import com.huoran.occupationlab.entity.ContestAnnouncementAnnex; +import com.huoran.occupationlab.entity.PythonTableData; +import com.huoran.occupationlab.service.PythonTableDataService; +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 javax.validation.Valid; +import java.util.List; + +/** + *

+ * 储存全部python表数据表导出Excel路径 前端控制器 + *

+ * + * @author lr + * @since 2022-08-12 + */ +@RestController +@RequestMapping("/python/table/data") +@Api(value = "储存全部python表数据表导出Excel路径:PythonTableDataController", tags = "R-储存全部python表数据表导出Excel路径") +public class PythonTableDataController { + @Autowired + public PythonTableDataService service; + + + @PostMapping("/save") + @ApiOperation(value = "新增", response = PythonTableData.class) + public R save(@RequestBody @Valid PythonTableData pythonTableData) { + boolean addState = service.save(pythonTableData); + return addState ? R.ok() : R.error(); + } + + + @PostMapping("/lookupTableFile") + @ApiOperation(value = "查询某表的Excel文件是否存在", response = PythonTableData.class) + public R lookupTableFile(@RequestParam("tableName") @ApiParam(value = "表名") String tableName) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("table_name", tableName); + PythonTableData pythonTableData = service.getOne(queryWrapper); + return R.ok().put("data", pythonTableData); + } +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/QuestionsController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/QuestionsController.java new file mode 100644 index 0000000..bcbca16 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/QuestionsController.java @@ -0,0 +1,206 @@ +package com.huoran.occupationlab.controller; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.huoran.api.UserClient; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.occupationlab.entity.EvaluationRules; +import com.huoran.occupationlab.entity.Questions; +import com.huoran.occupationlab.entity.req.QuestionsAddReq; +import com.huoran.occupationlab.entity.req.QuestionsQueryReq; +import com.huoran.occupationlab.entity.req.QuestionsUpdateReq; +import com.huoran.occupationlab.entity.vo.EvaluationRulesVO; +import com.huoran.occupationlab.entity.vo.QuestionsDetailVO; +import com.huoran.occupationlab.service.EvaluationRulesService; +import com.huoran.occupationlab.service.QuestionsService; +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 org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + *

+ * 测评管理-题库记录表 前端控制器 + *

+ * + * @author lr + * @since 2021-08-12 + */ +@RestController +@RequestMapping("/occupationlab/questions") +@Api(value = "职站:测评管理", tags = "职站:测评管理") +public class QuestionsController { + @Autowired + public QuestionsService service; + @Autowired + public EvaluationRulesService evaluationRulesService; + @Autowired + private UserClient userClient; + + /** + * 题库列表查询 + * + * @param queryReq + * @return + */ + @PostMapping("/list") + @ApiOperation(value = "题库列表查询") + public R list(@RequestBody QuestionsQueryReq queryReq, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + queryReq.setAccountId(Integer.valueOf(accountId)); + queryReq.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); + IPage getQuestionsList = service.getQuestionsList(queryReq); + return R.ok().put("page", getQuestionsList); + } + + /** + * 新增题目 + * + * @param questions + * @return + */ + @PostMapping("/save") + @ApiOperation(value = "新增题目") + public R save(@RequestBody QuestionsAddReq questions, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + questions.setAccountId(Integer.valueOf(accountId)); + questions.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); + boolean save = service.saveQuestion(questions); + return save ? R.ok() : R.error(); + } + + /** + * @描述: 根据试题id修改试题信息 + * @入参: + * @出参: + * @作者: Rong + * @日期: 2021-08-12 + **/ + @PostMapping("/update") + @ApiOperation(value = "根据试题id修改试题信息") + public R update(@RequestBody QuestionsUpdateReq questions) { + boolean update = service.updateQuestionById(questions); + return update ? R.ok() : R.error(); + } + + /** + * @描述: 根据主键删除 + * @入参: id + * @出参: + * @作者: Rong + * @日期: 2021-08-12 + **/ + @PostMapping("/delete") + @ApiOperation(value = "根据主键删除") + public R delete(@ApiParam(name = "ids", value = "多个id", required = true) @RequestParam("ids") List ids) { + boolean delete = service.deleteByIds(ids); + return delete ? R.ok() : R.error(); + } + + /** + * 是否禁用试题 + */ + @PostMapping("/isDisable") + @ApiOperation(value = "是否禁用试题") + public R isDisable(@RequestParam(name = "id", required = true) Integer id, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + R result = service.isDisable(id, schoolId); + return result; + } + + /** + * 查看当前题库信息 + */ + @ApiOperation(value = "查看当前题库信息") + @GetMapping("/detail") + public R info(@RequestParam(name = "id", required = true) Integer id) { + QuestionsDetailVO questions = service.getQuestionDetailById(id); + return R.ok().put("questions", questions); + } + + @PostMapping("/importQuestion") + @ApiOperation("批量导入题库") + public R importQuestion(@RequestParam(name = "file") MultipartFile file, HttpServletRequest request) throws IOException { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + Map map = service.upload(file, schoolId, Integer.valueOf(accountId)); + return R.ok().put("data", map); + } + + /** + * 批量导入题库失败数据导出 + * + * @param response + * @param exportCode + * @throws Exception + */ + @ApiOperation(value = "批量导入题库失败数据导出") + @GetMapping("/exportFailure") + public void exportFailureRecord(HttpServletResponse response, @ApiParam(name = "exportCode", value = "importQuestion接口返回的exportCode", required = true) @RequestParam String exportCode) throws Exception { + service.exportFailureRecord(response, exportCode); + } + + /** + * 测评规则信息的展示 + */ + @ApiOperation(value = "测评规则信息的展示", notes = "测评规则信息的展示", response = EvaluationRulesVO.class) + @GetMapping("/info") + public R info(HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + EvaluationRulesVO evaluationRulesVO = evaluationRulesService.getEvaluationRules(schoolId); + return R.ok().put("data", evaluationRulesVO); + } + + /** + * 修改 + */ + @ApiOperation(value = "修改测评规则信息", notes = "修改测评规则信息") + @PostMapping("/updateEvaluationRules") + public R updateEvaluationRules(@RequestBody EvaluationRules evaluationRules, HttpServletRequest request) { + + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + evaluationRules.setSchoolId(schoolId); + boolean b = evaluationRulesService.updateEvaluationRulesById(evaluationRules); + + return b ? R.ok() : R.error(); + } + + /** + * @Description : 下单复制题库 + * @Param schoolId + * @Author Rong---2021/10/28 + */ + @ApiOperation(value = "下单复制题库(远程调用)", notes = "下单复制题库") + @PostMapping("/copyQuestion") + public boolean copyQuestion(@RequestParam(name = "schoolId", required = true) Integer schoolId, + @RequestParam(name = "accountId", required = true) Integer accountId) { + boolean ret = service.copyQuestion(schoolId, accountId); + return ret; + } + + /** + * @Description : 创建客户后内置测评数据 + * @Param schoolId + * @Author Rong---2021/10/28 + */ + @ApiOperation(value = "创建客户后内置测评数据(远程调用)", notes = "创建客户后内置测评数据") + @PostMapping("/copyEvaluationRules") + public boolean copyEvaluationRules(@RequestParam(name = "schoolId", required = true) Integer schoolId) { + boolean ret = evaluationRulesService.copyEvaluationRules(schoolId); + return ret; + } +} + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/RabbitController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/RabbitController.java new file mode 100644 index 0000000..18226ff --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/RabbitController.java @@ -0,0 +1,41 @@ +/* +package com.huoran.occupationlab.controller; + +import com.huoran.common.constant.RabbitmqConstant; +import com.huoran.common.response.R; +import com.huoran.occupationlab.service.RabbitService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.amqp.rabbit.core.RabbitTemplate; +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; + +@Api(tags = "消息管理") +@RestController +@RequestMapping("/occupationlab/rabbitmq") +public class RabbitController { + + @Autowired + RabbitTemplate rabbitTemplate; + + @Autowired + RabbitService rabbitService; + + @ApiOperation(value = "消息发送") + @GetMapping("/messageSend") + public R messageSend(@RequestParam String message) { + rabbitTemplate.convertAndSend(RabbitmqConstant.COURSE_EXCHANGE, RabbitmqConstant.COURSE_ROUTING_KEY, message); + return R.ok("消息发送成功"); + } + + @ApiOperation(value = "消息返回") + @GetMapping("/receiveMessage") + public R receiveMessage() { + return rabbitService.receiveMessage(); + } + +} +*/ diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/RoleController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/RoleController.java new file mode 100644 index 0000000..7b97533 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/RoleController.java @@ -0,0 +1,106 @@ +package com.huoran.occupationlab.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.AclRole; +import com.huoran.occupationlab.service.RoleService; +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.List; + +/** + * 角色管理 + */ +@Api(tags = "角色管理") +@RestController +@RequestMapping("/occupationlab/management/role") +public class RoleController { + + @Autowired + private RoleService roleService; + + @ApiOperation(value = "角色分页列表查询") + @GetMapping("/list/{page}/{limit}") + public R index( + @ApiParam(name = "page", value = "当前页码", required = true) + @PathVariable Long page, + @ApiParam(name = "limit", value = "每页记录数", required = true) + @PathVariable Long limit, + @ApiParam(name = "clientId", value = "绑定客户id", required = true) + @RequestParam(required = true) Integer clientId, + @ApiParam(name = "name", value = "角色名称", required = false) + @RequestParam(required = false) String name) { + Page pageParam = new Page<>(page, limit); + QueryWrapper wrapper = new QueryWrapper<>(); + if (name != null) { + wrapper.like("role_name", name); + } + wrapper.eq("client_id", clientId); + roleService.page(pageParam, wrapper); + return R.ok().put("items", pageParam.getRecords()).put("total", pageParam.getTotal()); + } + + @ApiOperation(value = "获取角色") + @GetMapping("/get/{id}") + public R get(@PathVariable String id) { + AclRole role = roleService.getById(id); + return R.ok().put("item", role); + } + + @ApiOperation(value = "根据学校id获取角色") + @GetMapping("/getRole") + public R getRole(@RequestParam Integer clientId) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("client_id", clientId); + List roleList = roleService.list(wrapper); + return R.ok().put("data", roleList); + } + + @ApiOperation(value = "根据学校id和角色名称获取角色id") + @GetMapping("/getRoleId") + public AclRole getRoleId(@RequestParam AclRole role) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("client_id", role.getClientId()).eq("role_name", role.getRoleName()); + AclRole roleId = roleService.getOne(wrapper); + return roleId; + } + + @ApiOperation(value = "新增或更新角色") + @PostMapping("/saveOrUpdate") + public R save(@RequestBody AclRole role) { + //判重 + boolean isRepeat = roleService.repeat(role); + if (isRepeat && role.getId() == null) { + return R.error("角色已存在"); + } + roleService.saveOrUpdate(role); + return R.ok().put("roleId", role.getId()); + } + + @ApiOperation(value = "删除角色") + @DeleteMapping("/remove/{id}") + public R remove(@PathVariable String id) { + boolean re = roleService.removeRolePermission(id); + boolean remove = roleService.removeById(id); + return remove ? R.ok() : R.error(); + } + + @ApiOperation(value = "批量删除角色") + @DeleteMapping("/batchRemove") + public R batchRemove(@ApiParam(name = "roleIds", value = "多个角色id", required = true) + @RequestParam("roleIds") List roleIds) { + if (roleIds != null && roleIds.size() != 0) { + boolean re = roleService.removeRolePermissions(roleIds); + boolean remove = roleService.removeByIds(roleIds); + return remove ? R.ok() : R.error(); + } else { + return R.error(); + } + } +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/SchoolClassificationController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/SchoolClassificationController.java new file mode 100644 index 0000000..889408b --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/SchoolClassificationController.java @@ -0,0 +1,43 @@ +package com.huoran.occupationlab.controller; + + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.EduCourseClassification; +import com.huoran.occupationlab.service.CourseClassificationService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +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.RestController; + +import java.util.List; + +/** + *

+ * 前端控制器 + *

+ * + * @author Cheney + * @since 2020-12-11 + */ +@Api(tags = {"企业端课程分类管理"}) +@RestController +@RequestMapping("/occupationlab/management/schoolClassification") +public class SchoolClassificationController { + + @Autowired + private CourseClassificationService courseClassificationService; + + @ApiOperation(value = "查询企业端所有分类") + @GetMapping("/queryQyClassification") + public R queryQyClassification() { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("distinguish", 1); + List classificationList = courseClassificationService.list(wrapper); + return R.ok().put("classificationList", classificationList); + } + +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/SchoolCourseController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/SchoolCourseController.java new file mode 100644 index 0000000..a99b4b6 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/SchoolCourseController.java @@ -0,0 +1,137 @@ +package com.huoran.occupationlab.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.google.common.collect.Maps; +import com.huoran.api.UserClient; +import com.huoran.common.constant.EnableStatus; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.occupationlab.entity.SchoolCourse; +import com.huoran.occupationlab.entity.vo.CourseVO; +import com.huoran.occupationlab.service.SchoolCourseService; +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 javax.servlet.http.HttpServletRequest; +import java.util.HashMap; +import java.util.List; + +/** + *

+ * 学校内置课程表 前端控制器 + *

+ * + * @author Cheney + * @since 2020-11-30 + */ +@Api(tags = {"企业课程管理"}) +@RestController +@RequestMapping("/occupationlab/management/schoolCourse") +public class SchoolCourseController { + + @Autowired + private SchoolCourseService schoolCourseService; + @Autowired + private UserClient userClient; + + @ApiOperation(value = "企业课程列表分页条件查询") + @GetMapping("/queryCourseByCondition/{current}") + public R conditionPageList( + @ApiParam(name = "current", value = "当前页码", required = true) + @PathVariable int current, + @ApiParam(name = "name", value = "课程名称或创建人,模糊查询", required = false) + @RequestParam(value = "name", required = false) String name, + @ApiParam(name = "classificationId", value = "课程分类ID", required = false) + @RequestParam(value = "classificationId", required = false) String classificationId) { + // 每页记录数,默认为10 + int pageSize = 10; + HashMap map = Maps.newHashMap(); + map.put("current", (current - 1) * pageSize); + map.put("pageSize", pageSize); + map.put("classificationId", classificationId); + map.put("name", name); + //每页记录数 + List courseList = schoolCourseService.coursePageConditionQuery(map); + //总数 + int total = schoolCourseService.coursePageConditionCount(map); + return R.ok().put("courseList", courseList).put("total", total); + } + + @ApiOperation(value = "内置课程列表分页条件查询") + @GetMapping("/queryBuiltInCourseByCondition/{current}") + public R queryBuiltInCourseByCondition( + @ApiParam(name = "current", value = "当前页码", required = true) + @PathVariable int current, + @ApiParam(name = "schoolId", value = "学校ID") + @RequestParam(value = "schoolId") String schoolId) { + // 每页记录数,默认为10 + int pageSize = 10; + HashMap map = Maps.newHashMap(); + map.put("current", (current - 1) * pageSize); + map.put("pageSize", pageSize); + map.put("schoolId", schoolId); + //每页记录数 + List courseList = schoolCourseService.builtInCoursePageQuery(map); + //总数 + int total = schoolCourseService.builtInCoursePageCount(map); + return R.ok().put("total", total).put("courseList", courseList); + } + + @ApiOperation(value = "添加内置课程") + @PostMapping("/addBuiltInCourse") + public R addBuiltInCourse( + @ApiParam(name = "schoolId", value = "学校ID", example = "1") + @RequestParam(value = "schoolId") String schoolId, + @ApiParam(name = "courseIds", value = "课程ids") + @RequestParam(value = "courseIds") String courseIds, + @ApiParam(name = "classificationIds", value = "课程分类ids") + @RequestParam(value = "classificationIds") String classificationIds) { + boolean ok = schoolCourseService.addBuiltInCourse(schoolId, courseIds, classificationIds); + return ok ? R.ok() : R.error(); + } + + + @ApiOperation(value = "删除内置课程") + @DeleteMapping("/deleteBuiltInCourse") + public R deleteBuiltInCourse( + @ApiParam(name = "courseId", value = "课程ID", required = true) + @RequestParam String courseId, + @ApiParam(name = "schoolId", value = "学校ID", required = true) + @RequestParam String schoolId, + @ApiParam(name = "classificationId", value = "分类ID", required = true) + @RequestParam String classificationId) { + //是否删除管理端的分类,删除该课程之前如果分类数只有1时,删除该管理端的分类对应关系 + schoolCourseService.removeClassificationId(schoolId, classificationId); + //删除课程与学校的对应关系 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("course_id", courseId).eq("school_id", schoolId); + boolean remove = schoolCourseService.remove(wrapper); + return remove ? R.ok() : R.error(); + } + + @ApiOperation(value = "是否启用管理端课程") + @PutMapping("/enableGlCourse") + public R enableGlCourse( + @ApiParam(name = "courseId", value = "课程ID", required = true) + @RequestParam String courseId, + @ApiParam(name = "isEnable", value = "isEnable", required = true) + @RequestParam String isEnable, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + if (EnableStatus.ENABLE.equals(isEnable) || EnableStatus.NOT_ACTIVATED.equals(isEnable)) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("course_id", courseId).eq("school_id", schoolId); + SchoolCourse schoolCourse = schoolCourseService.getOne(wrapper); + schoolCourse.setIsEnable(Integer.parseInt(isEnable)); + boolean update = schoolCourseService.updateById(schoolCourse); + return update ? R.ok() : R.error(); + } else { + return R.error("启用状态错误"); + } + } + +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/SchoolProjectHintOpenController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/SchoolProjectHintOpenController.java new file mode 100644 index 0000000..971b630 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/SchoolProjectHintOpenController.java @@ -0,0 +1,88 @@ +package com.huoran.occupationlab.controller; + + +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.api.UserClient; +import com.huoran.common.entity.ProjectManage; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.occupationlab.entity.SchoolProjectHintOpen; +import com.huoran.occupationlab.service.ProjectManageService; +import com.huoran.occupationlab.service.SchoolProjectHintOpenService; +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.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletRequest; + +/** + *

+ * 学校项目实验提示管理表 前端控制器 + *

+ * + * @author lr + * @since 2023-06-02 + */ +@Api(tags = {"学校项目实验提示管理"}) +@RestController +@RequestMapping("/schoolProjectHintOpen") +public class SchoolProjectHintOpenController { + + @Autowired + private UserClient userClient; + + @Autowired + private SchoolProjectHintOpenService schoolProjectHintOpenService; + + @Autowired + private ProjectManageService projectManageService; + + + @ApiOperation("学校内《系统》项目实验提示禁用启用") + @PostMapping("/schoolProjectPromptsEnabled") + public R schoolProjectPromptsEnabled( + @ApiParam(value = "项目id") Integer projectId, + @ApiParam(value = "实验提示是否开启(0开启 1不开启)") Integer hintOpen, + HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + //token查询学校id + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + if (schoolId == -1) { + return R.error("学校查询失败"); + } + boolean update = false; + QueryWrapper openQueryWrapper = new QueryWrapper<>(); + openQueryWrapper.eq("school_id", schoolId); + openQueryWrapper.eq("project_id",projectId); + SchoolProjectHintOpen one = schoolProjectHintOpenService.getOne(openQueryWrapper); + if (ObjectUtil.isNotNull(one)){ + one.setHintOpen(hintOpen); + update = schoolProjectHintOpenService.updateById(one); + }else { + SchoolProjectHintOpen schoolProjectHintOpen = new SchoolProjectHintOpen(); + schoolProjectHintOpen.setSchoolId(schoolId); + schoolProjectHintOpen.setProjectId(projectId); + schoolProjectHintOpen.setHintOpen(hintOpen); + update = schoolProjectHintOpenService.save(schoolProjectHintOpen); + } + + return update ? R.ok() : R.error(); + } + + @ApiOperation("学校内《自建》项目实验提示禁用启用") + @PostMapping("/schoolCreateProjectPromptsEnabled") + public R schoolCreateProjectPromptsEnabled( + @ApiParam(value = "项目id") Integer projectId, + @ApiParam(value = "实验提示是否开启(0开启 1不开启)") Integer hintOpen) { + ProjectManage projectManage = projectManageService.getById(projectId); + projectManage.setHintOpen(hintOpen); + boolean update = projectManageService.updateById(projectManage); + return update ? R.ok() : R.error(); + } +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/StaffController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/StaffController.java new file mode 100644 index 0000000..c391097 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/StaffController.java @@ -0,0 +1,325 @@ +package com.huoran.occupationlab.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.api.UserClient; +import com.huoran.common.constant.DelConstant; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.occupationlab.entity.Architecture; +import com.huoran.occupationlab.entity.Staff; +import com.huoran.occupationlab.entity.StaffGrade; +import com.huoran.occupationlab.entity.StaffProfessionalArchitecture; +import com.huoran.occupationlab.entity.req.AddStaffReq; +import com.huoran.occupationlab.entity.req.ModifyStaffReq; +import com.huoran.occupationlab.entity.req.PageStaffListReq; +import com.huoran.occupationlab.entity.resp.StaffResp; +import com.huoran.occupationlab.service.StaffGradeService; +import com.huoran.occupationlab.service.StaffProfessionalArchitectureService; +import com.huoran.occupationlab.service.StaffService; +import com.huoran.occupationlab.service.StudentService; +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 org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * @描述:员工组织架构 + * @作者: Rong + * @日期: 2021-10-13 + */ +@RestController +@RequestMapping("/occupationlab/staff") +@Api(value = "API - 职站:员工组织架构", tags = "职站:员工组织架构") +public class StaffController { + @Autowired + public StaffProfessionalArchitectureService architectureService; + + @Autowired + public StaffGradeService gradeService; + + @Autowired + public StaffService staffService; + + @Autowired + private UserClient userClient; + + /** + * @Description : 新增初始员工组织架构数据 + * @Param architecture + * @Param request + * @Author Rong---2021/11/11 + */ + @PostMapping("/saveStaffData") + @ApiOperation(value = "新增初始员工组织架构数据(远程调用)") + public boolean saveStaffData(Integer schoolId) { + //新增一级部门 + StaffProfessionalArchitecture dept = new StaffProfessionalArchitecture(); + dept.setSchoolId(schoolId) + .setIsDel(DelConstant.NOT_DEL) + .setStaffArchitectureName("一级部门"); + boolean ret = architectureService.save(dept); + //新增二级部门 + StaffGrade grade = new StaffGrade(); + grade.setGradeName("二级部门") + .setStaffArchitectureId(dept.getStaffArchitectureId()); + boolean ret1 = gradeService.save(grade); + return ret && ret1; + + } + + /** + * @Description : 新增专业 + * @Param architecture + * @Param request + * @Author Rong---2021/10/13 + */ + @PostMapping("/saveProfessional") + @ApiOperation(value = "新增专业") + public R saveProfessional(@RequestBody @Valid StaffProfessionalArchitecture architecture, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + architecture.setSchoolId(userClient.getSchoolIdByAccountId(accountId)) + .setIsDel(DelConstant.NOT_DEL); + if (architectureService.repeat(architecture) == false) { + boolean ret = architectureService.save(architecture); + return ret ? R.ok().put("staffArchitectureId", architecture.getStaffArchitectureId()) : R.error(); + } else { + return R.error(architecture.getStaffArchitectureName() + "一级部门已存在"); + } + + } + + /** + * @Description : 新增年级 + * @Param staffGrade + * @Param request + * @Author Rong---2021/10/13 + */ + @PostMapping("/saveGrade") + @ApiOperation(value = "新增年级") + public R saveGrade(@RequestBody @Valid StaffGrade staffGrade, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + if (gradeService.repeat(staffGrade) == false) { + boolean ret = gradeService.save(staffGrade); + return ret ? R.ok().put("gradeId", staffGrade.getGradeId()) : R.error(); + } else { + return R.error(staffGrade.getGradeName() + "二级部门已存在"); + } + + } + + /** + * @Description : 编辑专业 + * @Param architecture + * @Param request + * @Author Rong---2021/10/19 + */ + @PostMapping("/updateProfessional") + @ApiOperation(value = "编辑专业") + public R updateProfessional(@RequestBody @Valid StaffProfessionalArchitecture architecture, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + architecture.setSchoolId(userClient.getSchoolIdByAccountId(accountId)) + .setIsDel(DelConstant.NOT_DEL); + if (architectureService.repeat(architecture) == false) { + boolean ret = architectureService.updateById(architecture); + return ret ? R.ok().put("staffArchitectureId", architecture.getStaffArchitectureId()) : R.error(); + } else { + return R.error(architecture.getStaffArchitectureName() + "一级部门已存在"); + } + + } + + /** + * @Description : 编辑年级 + * @Param staffGrade + * @Param request + * @Author Rong---2021/10/19 + */ + @PostMapping("/updateGrade") + @ApiOperation(value = "编辑年级") + public R updateProfessional(@RequestBody @Valid StaffGrade staffGrade, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + if (gradeService.repeat(staffGrade) == false) { + boolean ret = gradeService.updateById(staffGrade); + return ret ? R.ok().put("gradeId", staffGrade.getGradeId()) : R.error(); + } else { + return R.error(staffGrade.getGradeName() + "二级部门已存在"); + } + + } + + /** + * @Description : 删除专业 + * @Param architecture + * @Param request + * @Author Rong---2021/10/19 + */ + @PostMapping("/deleteProfessional") + @ApiOperation(value = "删除专业") + public R deleteProfessional(@ApiParam(name = "staffArchitectureId", value = "员工专业组织架构ID", required = true) @RequestParam Integer staffArchitectureId, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + boolean delRet = architectureService.removeById(staffArchitectureId); + return delRet ? R.ok() : R.error(); + } + + /** + * @Description : 删除年级 + * @Param staffGrade + * @Param request + * @Author Rong---2021/10/19 + */ + @PostMapping("/deleteGrade") + @ApiOperation(value = "删除年级") + public R deleteGrade(@ApiParam(name = "gradeId", value = "年级id", required = true) @RequestParam Integer gradeId, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + boolean delRet = gradeService.removeById(gradeId); + return delRet ? R.ok() : R.error(); + + } + + /** + * @Description : 新增员工 + * @Param staffReq + * @Param request + * @Author Rong---2021/10/13 + */ + @PostMapping("/saveStaff") + @ApiOperation(value = "新增员工") + public R saveStaff(@RequestBody @Valid AddStaffReq staffReq, HttpServletRequest request) throws Exception { + String accountId = TokenUtils.getIdByJwtToken(request); + staffReq.setSchoolId(userClient.getSchoolIdByAccountId(accountId)) + .setAccountId(Integer.valueOf(accountId)); + return staffService.saveStaff(staffReq); + } + + /** + * @Description : 查询专业 + * @Param request + * @Author Rong---2021/10/13 + */ + @GetMapping("/professionalList") + @ApiOperation(value = "查询专业", response = StaffProfessionalArchitecture.class) + public R professionalList(HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("school_id", schoolId); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + List list = architectureService.list(queryWrapper); + return R.ok().put("data", list); + + } + + /** + * @Description : 根据专业id查询年级 + * @Param request + * @Author Rong---2021/10/13 + */ + @GetMapping("/staffGradeList") + @ApiOperation(value = "根据专业id查询年级", response = StaffGrade.class) + public R staffGradeList( + @ApiParam(name = "staffArchitectureId", value = "员工专业组织架构ID", required = true) @RequestParam Integer staffArchitectureId + , HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("staff_architecture_id", staffArchitectureId); + List list = gradeService.list(queryWrapper); + return R.ok().put("data", list); + + } + + /** + * @Description : 员工列表 + * @Param req + * @Param request + * @Author Rong---2021/10/14 + */ + @PostMapping("/staffList") + @ApiOperation(value = "员工列表", response = StaffResp.class) + public R staffList(@RequestBody @Valid PageStaffListReq req, + HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + req.setSchoolId(schoolId); + return staffService.pageStaffList(req); + } + + /** + * @Description : 员工详情 + * @Param accountId + * @Param request + * @Author Rong---2021/10/15 + */ + @GetMapping("/staffDetail") + @ApiOperation(value = "员工详情", response = StaffResp.class) + public R staffDetail(@ApiParam(name = "accountId", value = "员工账号id") @RequestParam Integer accountId, + HttpServletRequest request) { + return staffService.staffDetail(accountId); + } + + /** + * @Description : 编辑员工 + * @Param staffReq + * @Param request + * @Author Rong---2021/10/13 + */ + @PostMapping("/modifyStaff") + @ApiOperation(value = "编辑员工") + public R modifyStaff(@RequestBody @Valid ModifyStaffReq staffReq, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + return staffService.modifyStaff(staffReq, schoolId); + } + + /** + * @Description : 删除员工 + * @Param ids + * @Param request + * @Author Rong---2021/10/15 + */ + @PostMapping("/delStaff") + @ApiOperation(value = "删除员工") + public R delStaff(@ApiParam(name = "accountIds", value = "要删除的账号id") @RequestParam List accountIds, + HttpServletRequest request) { + return staffService.delStaff(accountIds); + } + + /** + * @Description : 批量导入员工 + * @Param file + * @Param request + * @Author Rong---2021/10/15 + */ + @PostMapping("/importStaff") + @ApiOperation("批量导入员工") + public R importStaff(@RequestParam(name = "file") MultipartFile file, HttpServletRequest request) throws IOException { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + Map map = staffService.importStaff(file, schoolId); + return R.ok().put("data", map); + } + + /** + * 批量导入员工失败数据导出 + * + * @param response + * @param exportCode + * @throws Exception + */ + @ApiOperation(value = "批量导入员工失败数据导出") + @GetMapping("/exportFailure") + public void exportFailureRecord(HttpServletResponse response, @ApiParam(name = "exportCode", value = "importQuestion接口返回的exportCode", required = true) @RequestParam String exportCode) throws Exception { + staffService.exportFailureRecord(response, exportCode); + } + +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/StudentArchitectureController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/StudentArchitectureController.java new file mode 100644 index 0000000..f4084a1 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/StudentArchitectureController.java @@ -0,0 +1,863 @@ +package com.huoran.occupationlab.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.google.common.collect.Maps; +import com.huoran.common.constant.DelConstant; +import com.huoran.common.entity.Student; +import com.huoran.common.entity.UserAccount; +import com.huoran.common.entity.UserInfo; +import com.huoran.common.response.R; +import com.huoran.common.utils.MD5; +import com.huoran.common.utils.TokenUtils; +import com.huoran.occupationlab.entity.*; +import com.huoran.occupationlab.entity.Class; +import com.huoran.occupationlab.entity.req.*; +import com.huoran.occupationlab.entity.resp.StudentInfoResp; +import com.huoran.api.UserClient; +import com.huoran.occupationlab.service.ArchitectureService; +import com.huoran.occupationlab.service.ClassService; +import com.huoran.occupationlab.service.StudentService; +import com.huoran.common.utils.DateUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.io.IOException; +import java.util.*; + +/** + *

+ * 学生组织架构 + *

+ * + * @author lr + * @since 2021-08-24 + */ +@RestController +@RequestMapping("/occupationlab/architecture") +@Api(value = "职站:学生组织架构相关", tags = "职站:学生组织架构相关") +public class StudentArchitectureController { + @Autowired + public ArchitectureService service; + @Autowired + public StudentService studentService; + @Autowired + private UserClient userClient; + + @Autowired + public ClassService classService; + @Autowired + private StringRedisTemplate redisTemplate; + + /** + * 新增组织架构 + * + * @param req + * @return + */ + @PostMapping("/save") + @ApiOperation(value = "新增") + public R save(@RequestBody @Valid AddArchitectureReq req, HttpServletRequest request) { + Architecture architecture = new Architecture(); + BeanUtils.copyProperties(req, architecture); + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + architecture.setSchoolId(schoolId); + + boolean ret = false; + //层级为3时候表示新增到班级表 + if (req.getLevel() == 3) { + //新增前校验同级下是否存在重复的 + List classList = classService.chenckReapt(new Class().setArchitectureId(req.getParentId()) + .setClassName(req.getOrganizationName())); + if (classList.size() > 0) { + return R.error("同级下已存在相同的名称:" + req.getOrganizationName()); + } + + ret = classService.save(new Class().setArchitectureId(req.getParentId()) + .setClassName(req.getOrganizationName())); + + return ret ? R.ok().put("id", architecture.getId()) : R.error(); + } else if (req.getLevel() == 1) { + //为1时候 表示新增专业 + architecture.setParentId(schoolId); + } + + List architectureList = service.chenckReapt(architecture); + if (architectureList.size() > 0) { + return R.error("同级下已存在相同的名称:" + req.getOrganizationName()); + } + ret = service.save(architecture); + return ret ? R.ok().put("id", architecture.getId()) : R.error(); + + } + + /** + * 编辑组织架构 + * + * @param architecture + * @return + */ + @PostMapping("/update") + @ApiOperation(value = "编辑组织架构") + public R update(@RequestBody @Valid Architecture architecture, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + architecture.setSchoolId(schoolId); + boolean ret = false; + if (architecture.getLevel() == 3) { + //新增前校验同级下是否存在重复的 + Class cla = new Class().setArchitectureId(architecture.getParentId()) + .setClassName(architecture.getOrganizationName()); + if (architecture.getId() != null) { + cla.setId(architecture.getId()); + } + List classList = classService.chenckReapt(cla); + if (classList.size() > 0) { + return R.error("同级下已存在相同的名称:" + architecture.getOrganizationName()); + } + + ret = classService.updateById(new Class().setClassName(architecture.getOrganizationName()) + .setId(architecture.getId()) + .setArchitectureId(architecture.getParentId())); + return ret ? R.ok().put("id", architecture.getId()) : R.error(); + } else { + + List architectureList = service.chenckReapt(architecture); + if (architectureList.size() > 0) { + return R.error("同级下已存在相同的名称:" + architecture.getOrganizationName()); + } + + ret = service.updateById(architecture); + } + return ret ? R.ok() : R.error(); + } + + /** + * 删除组织架构 + * + * @param id + * @return + */ + @PostMapping("/delete") + @ApiOperation(value = "删除组织架构") + public R delete(@ApiParam(name = "id", value = "架构id", required = true) @RequestParam Integer id, + @ApiParam(name = "level", value = "等级", required = true) @RequestParam Integer level) { + + //level : 1表示专业 2表示年级 + switch (level) { + //将parent_id为要删除的id的表示存在该专业下的年级 需要下面的年级、班级做删除操作 + case 1: + QueryWrapper queryWrapper1 = new QueryWrapper<>(); + queryWrapper1.eq("parent_id", id); + List list = service.list(queryWrapper1); + + //list获取到所有该专业下的年级 同时需要将年级全部删除以及年级下的班级 以及学生表的班级id包含了该班级需遍历后删除 + for (Architecture delGrade : list) { + service.removeById(delGrade);//这里执行的是删除专业下的年级 + + //查询年级下的班级 + QueryWrapper queryWrapper2 = new QueryWrapper<>(); + queryWrapper2.eq("architecture_id", delGrade.getId()); + List list1 = classService.list(queryWrapper2); + for (Class delClass : list1) { + classService.removeById(delClass);//这里执行的是删除班级操作 + //删除班级的同时将学生表包含该班级id的也删除 + + QueryWrapper queryWrapper3 = new QueryWrapper<>(); + queryWrapper3.eq("is_del", DelConstant.NOT_DEL); + queryWrapper3.last(" and find_in_set(" + delClass.getId() + ",class_id)"); + List studentList = studentService.list(queryWrapper3); + + for (Student student : studentList) { + String classIdStr = "";//用来拼接未删除的班级id的 + //循环将包含该班级id的学生表中的classId遍历出来且删除 + for (String classId : student.getClassId().split(",")) { + + if (classId.equals("")) { + continue; + } + if (Integer.valueOf(classId) != delClass.getId()) { + classIdStr += delClass.getId() + ","; + } + } + + //将遍历删除后的classId再塞回去 + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + if (!classIdStr.equals("")) { + updateWrapper.set("class_id", classIdStr); + } else { + updateWrapper.set("class_id", 1); + } + + updateWrapper.eq("id", student.getId()); + studentService.update(new Student(), updateWrapper); + } + + } + + } + //执行删除操作 + service.removeById(id); + + break; + case 2: + //查询年级下的班级 + QueryWrapper queryWrapper3 = new QueryWrapper<>(); + queryWrapper3.eq("architecture_id", id); + List list3 = classService.list(queryWrapper3); + for (Class delClass : list3) { + classService.removeById(delClass);//这里执行的是删除班级操作 + //删除班级的同时将学生表包含该班级id的也删除 + + QueryWrapper queryWrapper4 = new QueryWrapper<>(); + queryWrapper4.eq("is_del", DelConstant.NOT_DEL); + queryWrapper4.last(" and find_in_set(" + delClass.getId() + ",class_id)"); + List studentList = studentService.list(queryWrapper4); + String classIdStr = "";//用来拼接未删除的班级id的 + for (Student student : studentList) { + //循环将包含该班级id的学生表中的classId遍历出来且删除 + for (String classId : student.getClassId().split(",")) { + + if (classId.equals("")) { + continue; + } + if (Integer.valueOf(classId) != delClass.getId()) { + classIdStr += delClass.getId() + ","; + } + } + + //将遍历删除后的classId再塞回去 + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + if (!classIdStr.equals("")) { + updateWrapper.set("class_id", classIdStr); + } else { + updateWrapper.set("class_id", 1); + } + updateWrapper.eq("id", student.getId()); + studentService.update(new Student(), updateWrapper); + } + + } + //执行删除操作 + service.removeById(id); + + break; + case 3: + classService.removeById(id);//这里执行的是删除班级操作 + QueryWrapper queryWrapper4 = new QueryWrapper<>(); + queryWrapper4.eq("is_del", DelConstant.NOT_DEL); + queryWrapper4.last(" and find_in_set(" + id + ",class_id)"); + List studentList = studentService.list(queryWrapper4); + + if (studentList != null) { + String classIdStr = "";//用来拼接未删除的班级id的 + for (Student student : studentList) { + //循环将包含该班级id的学生表中的classId遍历出来且删除 + for (String classId : student.getClassId().split(",")) { + if (classId.equals("")) { + continue; + } + if (Integer.valueOf(classId) != id) { + classIdStr += id + ","; + } + } + + //将遍历删除后的classId再塞回去 + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + if (!classIdStr.equals("")) { + updateWrapper.set("class_id", classIdStr); + } else { + updateWrapper.set("class_id", 1); + } + updateWrapper.eq("id", student.getId()); + studentService.update(new Student(), updateWrapper); + } + break; + } + } + + return R.ok(); + } + + // set 集合特点,存储元素唯一,不重复 + public static String stringSet(String s) { + + // 创建set集合 + Set set = new HashSet(); + // for循环,遍历字符串 + for (int i = 0; i < s.length(); i++) { + // 将字符串添加到Set集合中 + // s.substring(0,1)截取字符串s,位置从0到1,左闭右开 + set.add(s.substring(i, i + 1)); + } + // 定义一个空的字符串ss + String ss = ""; + // foreach遍历set集合 + for (Object o : set) { + // 字符串拼接 + ss += o; + } + // 输出去重后的字符串 + //System.out.println(ss); + return ss; + + } + + public static void main(String[] args) { + stringSet("106,106,106,106,106,106,"); + } + + /** + * 学生组织架构树形列表 + * + * @param request + * @return + */ + @PostMapping("/treeList") + @ApiOperation(value = "学生组织架构树形列表", response = Architecture.class) + public R treeList(HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + List list = service.treeList(schoolId); + return R.ok().put("treeList", list); + + } + + /** + * 学生组织架构树 + * + * @param request + * @return + */ + @PostMapping("/stuOrganizationTree") + @ApiOperation(value = "学生组织架构树", response = Architecture.class) + public R stuOrganizationTree(HttpServletRequest request, + @ApiParam(name = "level", value = "层级(专业1、年级2、班级3)", required = true) @RequestParam String level + , @ApiParam(name = "parentId", value = "父id(层级为1时候不用传)") @RequestParam Integer parentId) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + + return service.stuOrganizationTree(schoolId, Integer.valueOf(accountId), Integer.valueOf(level), parentId); + } + + /** + * 新增学生 + * + * @param addStudentReq + * @return + */ + @PostMapping("/addStudent") + @ApiOperation(value = "新增学生") + public R addStudent(@RequestBody @Valid AddStudentReq addStudentReq, HttpServletRequest request) { + //根据token获取账号id + String accountId = TokenUtils.getIdByJwtToken(request); + //根据账号id获取当前院校 + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + addStudentReq.setSchoolId(schoolId); + + //22.4.13补充: 学号判重依据学校id、平台端(教师、学生端、无端(数据平台的用户)) 以及 平台来源(职站、数据平台) + //22.4.13补充: 账号组成条件:平台(职站/数据平台/中台)-端(教师、学生端、无端(数据平台的用户))-学校(学校id)-学号/工号(用户输入的工号学号) + UserInfo userInfo = new UserInfo(); + userInfo.setSchoolId(schoolId); + userInfo.setRoleId("0"); + BeanUtils.copyProperties(addStudentReq, userInfo); + boolean addUserRet = studentService.addUserInfo(userInfo); + + UserAccount account = new UserAccount(); + account.setSchoolId(schoolId); + account.setPassword(MD5.encrypt("1122aa")); + account.setPlatformId("1");//所属平台id 1.职站 + account.setType(1);//平台端区分:0->教师端 1->学生端 2->无端 + account.setUserId(userInfo.getUserId()); + account.setRoleId("0"); + BeanUtils.copyProperties(addStudentReq, account); + + account.setPhone(null); + if (!addStudentReq.getPhone().equals("")) { + account.setPhone(addStudentReq.getPhone()); + account.setPhoneBindingTime(DateUtil.currentDate()); + } + boolean addAccountRet = studentService.addUserAccount(account); + + Student student = new Student(); + student.setAccountId(account.getId()); + BeanUtils.copyProperties(addStudentReq, student); + if (student.getClassId().equals("")) { + student.setClassId("1"); + } + + boolean addStuRet = studentService.save(student); + return addStuRet && addUserRet && addAccountRet ? R.ok().put("id", student.getId()) : R.error(); + } + + /** + * 按学号获取详细信息 + * + * @param workNumber + * @param platformId + * @param type + * @return + */ + @PostMapping("/getDetailByAccount") + @ApiOperation(value = "新增用户前调用:按学号获取详细信息", response = StudentInfoResp.class) + public R getDetailByAccount(HttpServletRequest request, @ApiParam(name = "workNumber", value = "输入的学生学号", required = true) @RequestParam String workNumber, + @ApiParam(name = "platformId", value = "所属平台id(1.职站 2.数据平台 3.中台)", required = true) @RequestParam Integer platformId, + @ApiParam(name = "type", value = "平台端区分:0教师 1学生 2无端", required = true) @RequestParam Integer type) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + HashMap objectObjectHashMap = Maps.newHashMap(); + objectObjectHashMap.put("workNumber", workNumber); + objectObjectHashMap.put("schoolId", schoolId); + objectObjectHashMap.put("platformId", platformId); + objectObjectHashMap.put("type", type); + //根据账号获取到账号信息 + StudentInfoResp studentInfoResp = studentService.getStudentInfoDetailByWorkNum(objectObjectHashMap); + + if (studentInfoResp != null) { + //获取学生中的classId + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + queryWrapper.eq("account_id", studentInfoResp.getAccountId()); + Student student = studentService.getOne(queryWrapper); + + if (student != null) { + + List classList = new ArrayList<>(); + + for (String classId : student.getClassId().split(",")) { + //获取student中的classId后查询class表 + QueryWrapper classQueryWrapper = new QueryWrapper<>(); + classQueryWrapper.eq("is_del", DelConstant.NOT_DEL); + classQueryWrapper.eq("id", Integer.valueOf(classId)); + //获取到班级信息 + Class classes = classService.getOne(classQueryWrapper); + + classList.add(classes); + } + studentInfoResp.setClassList(classList); + + } + } + + return R.ok().put("data", studentInfoResp); + + } + + /** + * 新增学生前:校验手机号或者邮箱 + * + * @param phone + * @param email + * @return + */ + /* @PostMapping("/checkEmailOrPhone") + @ApiOperation(value = "新增学生前:校验手机号或者邮箱", response = Architecture.class) + public R checkEmailAndPhone(@ApiParam(name = "phone", value = "手机号(一次校验只传一个参数)", required = false) @RequestParam(required = false) String phone, + @ApiParam(name = "email", value = "邮 箱(一次校验只传一个参数)", required = false) @RequestParam(required = false) String email + , @ApiParam(name = "accountId", value = "编辑传:被编辑用户的账号id") @RequestParam(value = "accountId", required = false) Integer accountId) { + + UserInfo userInfo = new UserInfo(); + userInfo.setEmail(email); + userInfo.setPhone(phone); + if (accountId != null) { + Integer userId = studentService.getUserId(accountId); + userInfo.setUserId(userId); + } + List user = studentService.checkUserInfo(userInfo); + + String msg = ""; + if (user.size() > 0) { + if (phone != null && !phone.equals("")) { + msg = "该手机号已存在!"; + } else if (email != null && !email.equals("")) { + msg = "该Email已存在!"; + } + + return R.error(msg); + } + return R.ok(); + }*/ + + /** + * 学生列表 + * + * @param request + * @return + */ + @PostMapping("/studentList") + @ApiOperation(value = "学生列表", response = StudentInfoResp.class) + public R StudentList(@RequestBody PageStudentListReq req, + HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + req.setSchoolId(schoolId); + req.setAccountId(Integer.valueOf(accountId)); + List list = studentService.studentList(req); + return R.ok().put("page", list).put("total", studentService.studentListNum(req)); + } + + /** + * 将学生移除班级 + * + * @param request + * @param classId + * @param stuAccountId + * @return + */ + @PostMapping("/removeStudent") + @ApiOperation(value = "移除学生", response = StudentInfoResp.class) + public R removeStudent(HttpServletRequest request, @ApiParam(name = "classId", value = "要移除的班级id", required = true) @RequestParam String classId, + @ApiParam(name = "stuAccountId", value = "要移除的学生账号id", required = true) @RequestParam String stuAccountId) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + queryWrapper.eq("account_id", stuAccountId); + + String removeId = ""; + + Student student = studentService.getOne(queryWrapper); + if (student.getClassId().contains(",")) { + for (String id : student.getClassId().split(",")) { + if (!id.equals(classId)) { + //循环的id不等于要移除的id时保存该id + removeId += id + ","; + } + } + removeId = removeId.substring(0, removeId.length() - 1); + } else { + removeId = "1"; + } + + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.set("class_id", removeId); + updateWrapper.set("school_id", schoolId); + updateWrapper.eq("account_id", stuAccountId); + updateWrapper.eq("is_del", DelConstant.NOT_DEL); + boolean ret = studentService.update(new Student(), updateWrapper); + return ret ? R.ok() : R.error(); + } + + /** + * 单个、批量删除学生 + * + * @param accountIds + * @param request + * @return + */ + @PostMapping("/delStudent") + @ApiOperation(value = "单个、批量删除学生", response = StudentInfoResp.class) + public R delStudent(@ApiParam(name = "accountIds", value = "多个账号id", required = true) @RequestParam("accountIds") List accountIds, HttpServletRequest request + ) { + + boolean ret = false; + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + if (accountIds != null && accountIds.size() != 0) { + for (Integer stuAccountId : accountIds) { + //修改学生表删除状态为已删除 同时班级id设置为1表示无指定班级 + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + //updateWrapper.set("class_id", 1); + updateWrapper.set("school_id", schoolId); + updateWrapper.set("is_del", DelConstant.IS_DEL); + updateWrapper.eq("account_id", stuAccountId); + ret = studentService.update(new Student(), updateWrapper); + } + + //修改账号表逻辑删除状态 修改用户表逻辑删除状态 + //22.04.15补充: + // 教师管理端的学生管理或员工管理进行删除的操作时, + // 如果手机号绑定了多个用户的信息则只是删除了该账号在这个平台(职站,或数据平台)对应端的用户信息(同时该账号也与该学校组织对应端解绑了) + // 不是真的把账号删除,但是如果手机号有且只有一个用户信息则一并把该账号进行删除。 + + //执行删除账号、用户信息表 + userClient.delStudent(accountIds); + } + return ret ? R.ok() : R.error(); + } + + /** + * 编辑学生 + * + * @param modifyStudentReq + * @return + */ + @PostMapping("/modifyStudent") + @ApiOperation(value = "编辑学生") + public R modifyStudent(@RequestBody @Valid ModifyStudentReq modifyStudentReq, HttpServletRequest request) { + + + //账户信息 + UserAccount userAccount = new UserAccount(); + userAccount.setId(modifyStudentReq.getAccountId()); + BeanUtils.copyProperties(modifyStudentReq, userAccount); + boolean updateUserAccount = studentService.modifyUserAccount(userAccount); + + //用户信息 + UserInfo userInfo = new UserInfo(); + userInfo.setUserId(userInfo.getUserId()); + BeanUtils.copyProperties(modifyStudentReq, userInfo); + boolean updateUserInfo = studentService.modifyUserInfo(userInfo); + + //学生信息 + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.set("class_id", modifyStudentReq.getClassId()); + updateWrapper.eq("is_del", DelConstant.NOT_DEL); + updateWrapper.eq("account_id", modifyStudentReq.getAccountId()); + boolean updateStu = studentService.update(new Student(), updateWrapper); + + return updateUserAccount && updateUserInfo && updateStu ? R.ok() : R.error(); + } + + /** + * 新增/编辑账号前:校验(学号/工号)或者账号 + * 学号、工号通过分平台id、学校id以及平台端区分 + * (账号)全平台校验 + * + * @param workNumber + * @param account + * @return + */ + @PostMapping("/checkWorkNumOrAccount") + @ApiOperation(value = "新增/编辑账号前:校验(学号/工号) 或者(账号)全平台校验", response = Architecture.class) + public R checkWorkNumOrAccount(@ApiParam(name = "workNumber", value = "学号/工号(一次校验只传一个参数)") @RequestParam(value = "workNumber", required = false) String workNumber, + @ApiParam(name = "account", value = "账号(一次校验只传一个参数)") @RequestParam(value = "account", required = false) String account, + @ApiParam(name = "accountId", value = "编辑传:被编辑用户的账号id") @RequestParam(value = "accountId", required = false) Integer accountId, + @ApiParam(name = "platformId", value = "必填:所属平台id 1.职站 2数据平台 3中台", required = true) @RequestParam(value = "platformId", required = true) Integer platformId, + @ApiParam(name = "type", value = "必填:平台端区分:0->教师端 1->学生端 2->无端", required = true) @RequestParam(value = "type", required = true) Integer type, + HttpServletRequest request) { + + String accId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accId); + UserAccount userAccount = new UserAccount(); + userAccount.setAccount(account); + userAccount.setWorkNumber(workNumber); + userAccount.setSchoolId(schoolId); + userAccount.setType(type); + userAccount.setPlatformId(platformId + ""); + if (accountId != null) { + userAccount.setId(accountId); + } + + List user = studentService.checkUserAccount(userAccount); + + String msg = ""; + if (user.size() > 0) { + if (workNumber != null && !workNumber.equals("")) { + msg = "工号/学号已存在!"; + } else if (account != null && !account.equals("")) { + msg = "账号已存在!"; + } + + return R.error(msg); + } + return R.ok(); + } + + /** + * 查看学生信息 + * + * @param stuAccountId + * @return + */ + @PostMapping("/getStudentInfoByAccountId") + @ApiOperation(value = "查看学生信息", response = StudentInfoResp.class) + public R getStudentInfoByAccountId(@ApiParam(name = "stuAccountId", value = "要查看的学生账号id", required = true) @RequestParam Integer stuAccountId, HttpServletRequest request) { + StudentInfoResp data = studentService.getStudentInfoByAccountId(stuAccountId); + return R.ok().put("data", data); + } + + /** + * 批量导入学生 + * + * @param file + * @param request + * @return + * @throws IOException + */ + @PostMapping("/importStudent") + @ApiOperation("批量导入学生") + public R importStudent(@RequestParam(name = "file") MultipartFile file, HttpServletRequest request) throws IOException { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + Map map = studentService.uploadStudent(file, schoolId); + return R.ok().put("data", map); + } + + /** + * 批量导入学生失败数据导出 + * + * @param response + * @param exportCode + * @throws Exception + */ + @ApiOperation(value = "批量导入学生失败数据导出") + @GetMapping("/exportFailure") + public void exportFailureRecord(HttpServletResponse response, @ApiParam(name = "exportCode", value = "importQuestion接口返回的exportCode", required = true) @RequestParam String exportCode) throws Exception { + studentService.exportFailureRecord(response, exportCode); + } + + /** + * 根据组织架构筛选学生列表 + * + * @param request + * @return + */ + @PostMapping("/organizationalStudentList") + @ApiOperation(value = "根据组织架构筛选学生列表", response = StudentInfoResp.class) + public R organizationalStudentList(@RequestBody OrganizationStudentReq req, + HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + req.setSchoolId(schoolId); + req.setPageNum((req.getPageNum() - 1) * req.getPageSize()); + req.setPageSize(req.getPageSize()); + List list = new ArrayList<>(); + Set allList = new HashSet<>(); + //1.专业 2.年级 3.班级 + switch (req.getLevel()) { + case 1: + //选择专业时 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("school_id", schoolId); + queryWrapper.eq("parent_id", req.getArchitectureId()); + queryWrapper.eq("level", req.getLevel() + 1); + List getGrade = service.list(queryWrapper); + //获取到所有该专业下的年级 + for (Architecture architecture : getGrade) { + QueryWrapper classQueryWrapper = new QueryWrapper<>(); + classQueryWrapper.eq("architecture_id", architecture.getId()); + //获取到所有班级id + List getClass = classService.list(classQueryWrapper); + if (getClass.size() == 0) { + continue; + } + req.setClassList(getClass); + + list = studentService.organizationalStudentList(req); + allList.addAll(list); + } + + return R.ok().put("page", allList).put("total", allList.size()); + + case 2: + //选择年级时 + QueryWrapper classQueryWrapper = new QueryWrapper<>(); + classQueryWrapper.eq("architecture_id", req.getArchitectureId()); + List getClass = classService.list(classQueryWrapper); + req.setClassList(getClass); + list = studentService.organizationalStudentList(req); + if (getClass.size() == 0) { + return R.ok().put("total", 0); + } + return R.ok().put("page", list).put("total", studentService.organizationalStudentListNum(req)); + + case 3: + List classList = new ArrayList<>(); + Class classes = new Class(); + classes.setId(req.getArchitectureId()); + classList.add(classes); + req.setClassList(classList); + + list = studentService.organizationalStudentList(req); + return R.ok().put("page", list).put("total", studentService.organizationalStudentListNum(req)); + + } + return R.ok(); + + } + + /** + * 修改账号禁用启用功能 + * + * @param id + * @param isEnable + * @return + */ + @ApiOperation(value = "修改账号禁用启用功能") + @GetMapping("/updateAccountEnable") + public R updateAccountEnable(@RequestParam("id") @ApiParam(value = "账号id") Integer id, + @RequestParam("isEnable") @ApiParam(value = "是否禁用(0->禁用,1->启用") Integer isEnable) { + int result = studentService.updateAccountEnable(id, isEnable); + return result > 0 ? R.ok() : R.error(); + } + + /** + * @Description :新增初始学生组织架构数据 + * @Param architecture + * @Author Rong---2021/11/2 + */ + @PostMapping("/saveData") + @ApiOperation(value = "新增初始学生组织架构数据(远程调用)") + public boolean saveData(@RequestParam("schoolId") @ApiParam(value = "学校id") Integer schoolId) { + + //新增专业 + Architecture addProfessional1 = new Architecture() + .setOrganizationName("金融专业") + .setLevel(1) + .setParentId(schoolId) + .setSchoolId(schoolId); + boolean ret1 = service.save(addProfessional1); + + Architecture addProfessional2 = new Architecture() + .setOrganizationName("金融工程专业") + .setLevel(1) + .setParentId(schoolId) + .setSchoolId(schoolId); + boolean ret2 = service.save(addProfessional2); + + Architecture addProfessional3 = new Architecture() + .setOrganizationName("金融科技专业") + .setLevel(1) + .setParentId(schoolId) + .setSchoolId(schoolId); + boolean ret3 = service.save(addProfessional3); + + //新增年级 + Architecture addGrade1 = new Architecture() + .setOrganizationName("2021级") + .setLevel(2) + .setParentId(addProfessional1.getId()) + .setSchoolId(schoolId); + boolean ret4 = service.save(addGrade1); + + Architecture addGrade2 = new Architecture() + .setOrganizationName("2021级") + .setLevel(2) + .setParentId(addProfessional2.getId()) + .setSchoolId(schoolId); + boolean ret5 = service.save(addGrade2); + + Architecture addGrade3 = new Architecture() + .setOrganizationName("2021级") + .setLevel(2) + .setParentId(addProfessional3.getId()) + .setSchoolId(schoolId); + boolean ret6 = service.save(addGrade3); + + //新增班级 + boolean ret7 = classService.save(new Class().setArchitectureId(addGrade1.getId()) + .setClassName("一班")); + + boolean ret8 = classService.save(new Class().setArchitectureId(addGrade2.getId()) + .setClassName("一班")); + + boolean ret9 = classService.save(new Class().setArchitectureId(addGrade3.getId()) + .setClassName("一班")); + + return ret1 && ret2 && ret3 && ret4 && ret5 && ret6 && ret7 && ret8 && ret9; + + } +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/StudentController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/StudentController.java new file mode 100644 index 0000000..53fdfd4 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/StudentController.java @@ -0,0 +1,26 @@ +package com.huoran.occupationlab.controller; + + +import com.huoran.occupationlab.service.StudentService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 学生表 前端控制器 + *

+ * + * @author Mr.JK + * @since 2021-11-03 + */ +@RestController +@RequestMapping("/occupationlab/student") +public class StudentController { + + @Autowired + private StudentService studentService; + +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/SysJobController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/SysJobController.java new file mode 100644 index 0000000..4d1c92b --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/SysJobController.java @@ -0,0 +1,159 @@ +//package com.huoran.occupationlab.controller; +// +//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.huoran.common.aop.annotation.LogAnnotation; +//import com.huoran.common.response.R; +//import com.huoran.occupationlab.entity.SysJob; +//import com.huoran.occupationlab.entity.req.PageSysJobReq; +//import com.huoran.occupationlab.job.utils.ScheduleJob; +//import com.huoran.occupationlab.service.SysJobService; +//import io.swagger.annotations.Api; +//import io.swagger.annotations.ApiOperation; +//import io.swagger.annotations.ApiParam; +//import org.apache.shiro.authz.annotation.RequiresPermissions; +//import org.quartz.TriggerUtils; +//import org.quartz.impl.triggers.CronTriggerImpl; +//import org.springframework.util.StringUtils; +//import org.springframework.web.bind.annotation.*; +// +//import javax.annotation.Resource; +//import java.text.ParseException; +//import java.text.SimpleDateFormat; +//import java.util.ArrayList; +//import java.util.Date; +//import java.util.List; +// +// +///** +// * 定时任务 +// * @author cheney +// * @version V1.0 +// * @date 2022年7月28日 +// */ +// +//@Api(tags = "定时任务") +//@RestController +//@RequestMapping("/sysJob") +//public class SysJobController { +// @Resource +// private SysJobService sysJobService; +// +// @ApiOperation(value = "新增") +// @PostMapping("/add") +// public R add(@RequestBody SysJob sysJob) { +// if (isValidExpression(sysJob.getCronExpression())) { +// return R.error("cron表达式有误"); +// } +// ScheduleJob.judgeBean(sysJob.getBeanName()); +// +// sysJobService.saveJob(sysJob); +// return R.ok(); +// } +// +// @ApiOperation(value = "删除") +// @DeleteMapping("/delete") +// public R delete(@RequestBody @ApiParam(value = "id集合") List ids) { +// sysJobService.delete(ids); +// return R.ok(); +// } +// +// @ApiOperation(value = "更新") +// @PutMapping("/update") +// public R update(@RequestBody SysJob sysJob) { +// if (isValidExpression(sysJob.getCronExpression())) { +// return R.error("cron表达式有误"); +// } +// R R = ScheduleJob.judgeBean(sysJob.getBeanName()); +// +// sysJobService.updateJobById(sysJob); +// return R.ok(); +// } +// +// @ApiOperation(value = "查询分页数据") +// @PostMapping("/listByPage") +// public R findListByPage(@RequestBody PageSysJobReq req) { +// QueryWrapper queryWrapper = new QueryWrapper<>(); +// +// //查询条件示例 +// if (!StringUtils.isEmpty(req.getBeanName())) { +// queryWrapper.like("bean_name", req.getBeanName()); +// } +// Page page = new Page(req.getPageNum(), req.getPageSize()); +// IPage iPage = sysJobService.page(page, queryWrapper); +// return R.ok(iPage); +// } +// +// +// /** +// * 立即执行任务 +// */ +// +// @ApiOperation(value = "立即执行任务") +// @PostMapping("/run") +// public R run(@RequestBody List ids) { +// sysJobService.run(ids); +// return R.ok(); +// } +// +// /** +// * 暂停定时任务 +// */ +// @ApiOperation(value = "暂停定时任务") +// @LogAnnotation(title = "暂停定时任务") +// @PostMapping("/pause") +// @RequiresPermissions("sysJob:pause") +// public R pause(@RequestBody List ids) { +// sysJobService.pause(ids); +// return R.ok(); +// } +// +// /** +// * 恢复定时任务 +// */ +// @ApiOperation(value = "恢复定时任务") +// @PostMapping("/resume") +// public R resume(@RequestBody List ids) { +// sysJobService.resume(ids); +// return R.ok(); +// } +// +// /** +// * 判断cron表达式 +// * +// * @param cronExpression cron表达式 +// * @return 是否有误 +// */ +// public static boolean isValidExpression(String cronExpression) { +// CronTriggerImpl trigger = new CronTriggerImpl(); +// try { +// trigger.setCronExpression(cronExpression); +// Date date = trigger.computeFirstFireTime(null); +// return date == null || !date.after(new Date()); +// } catch (Exception e) { +// return true; +// } +// } +// +// +// @ApiOperation(value = "获取运行时间") +// @PostMapping("/getRecentTriggerTime") +// public R getRecentTriggerTime(String cron) { +// List list = new ArrayList<>(); +// try { +// CronTriggerImpl cronTriggerImpl = new CronTriggerImpl(); +// cronTriggerImpl.setCronExpression(cron); +// // 这个是重点,一行代码搞定 +// List dates = TriggerUtils.computeFireTimes(cronTriggerImpl, null, 5); +// SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); +// for (Date date : dates) { +// list.add(dateFormat.format(date)); +// } +// } catch (ParseException e) { +// e.printStackTrace(); +// } +// return R.ok(list); +// } +// +//} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/SysJobLogController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/SysJobLogController.java new file mode 100644 index 0000000..6bd5870 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/SysJobLogController.java @@ -0,0 +1,61 @@ +//package com.huoran.occupationlab.controller; +// +//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.huoran.common.aop.annotation.LogAnnotation; +//import com.huoran.common.response.R; +//import com.huoran.occupationlab.entity.SysJobLog; +//import com.huoran.occupationlab.entity.req.PageSysJobLogReq; +//import com.huoran.occupationlab.service.SysJobLogService; +//import io.swagger.annotations.Api; +//import io.swagger.annotations.ApiOperation; +//import org.apache.shiro.authz.annotation.RequiresPermissions; +//import org.springframework.util.StringUtils; +//import org.springframework.web.bind.annotation.*; +// +//import javax.annotation.Resource; +// +// +///** +// * 定时任务日志 +// * +// * @author cheney +// * @version V1.0 +// * @date 2022年7月28日 +// */ +// +//@Api(tags = "定时任务日志") +//@RestController +//@RequestMapping("/sysJobLog") +//public class SysJobLogController { +// @Resource +// private SysJobLogService sysJobLogService; +// +// @ApiOperation(value = "查询分页数据") +// @PostMapping("/listByPage") +// @RequiresPermissions("sysJob:list") +// public R findListByPage(@RequestBody PageSysJobLogReq req) { +// QueryWrapper queryWrapper = new QueryWrapper<>(); +// //查询条件示例 +// if (!StringUtils.isEmpty(req.getJobId())) { +// queryWrapper.like("job_id", req.getJobId()); +// } +// queryWrapper.orderByDesc("create_time"); +// +// +// Page page = new Page(req.getPageNum(), req.getPageSize()); +// IPage iPage = sysJobLogService.page(page, queryWrapper); +// return R.ok(iPage); +// } +// +// @ApiOperation(value = "清空定时任务日志") +// @DeleteMapping("/delete") +// @RequiresPermissions("sysJob:delete") +// @LogAnnotation(title = "清空") +// public R delete() { +// sysJobLogService.remove(null); +// return R.ok(); +// } +// +//} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/SysLogController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/SysLogController.java new file mode 100644 index 0000000..4a47b90 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/SysLogController.java @@ -0,0 +1,72 @@ +package com.huoran.occupationlab.controller; + +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.huoran.api.NakadaiClient; +import com.huoran.common.aop.annotation.LogAnnotation; +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.SysLog; +import com.huoran.occupationlab.entity.req.PageSysLogReq; +import com.huoran.occupationlab.service.LogService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.ObjectUtils; +import org.springframework.util.StringUtils; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 系统操作日志 + * + * @author cheney + * @version V1.0 + * @date 2022年7月28日 + */ + +@RequestMapping("/sys") +@Api(tags = "系统模块-系统操作日志管理") +@RestController +public class SysLogController { + @Resource + private LogService logService; + @Autowired + private NakadaiClient nakadaiClient; + + @PostMapping("/logs") + @ApiOperation(value = "分页查询系统操作日志接口") + public R pageInfo(@RequestBody PageSysLogReq vo) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + if (!StringUtils.isEmpty(vo.getUserName())) { + queryWrapper.like("user_name", vo.getUserName()); + } + if (!StringUtils.isEmpty(vo.getOperation())) { + queryWrapper.like("operation", vo.getOperation()); + } + + queryWrapper.orderByDesc("create_time"); + + Page page = new Page(vo.getPageNum(), vo.getPageSize()); + + IPage sysLogPage = logService.page(page, queryWrapper); + if (sysLogPage.getRecords()!=null){ + for (SysLog log : sysLogPage.getRecords()) { + if (!ObjectUtils.isEmpty(log.getSchoolId())&&log.getSchoolId()!=-1&&log.getSchoolId()!=0) { + log.setSchoolName(nakadaiClient.getTheSchoolNameBySchoolId(log.getSchoolId()).getSchoolName()); + } + } + } + return R.ok(sysLogPage); + } + + @DeleteMapping("/logs") + @ApiOperation(value = "删除日志接口") + @LogAnnotation(title = "系统操作日志管理", action = "删除系统操作日志") + public R deleted(@RequestBody List logIds) { + logService.removeByIds(logIds); + return R.ok(); + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/SystemLogoController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/SystemLogoController.java new file mode 100644 index 0000000..e53f23b --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/SystemLogoController.java @@ -0,0 +1,80 @@ +package com.huoran.occupationlab.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.huoran.api.UserClient; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.occupationlab.entity.SystemLogo; +import com.huoran.occupationlab.entity.req.AddStaffReq; +import com.huoran.occupationlab.service.SystemLogoService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import javax.validation.Valid; + +/** + *

+ * 职站教师端-系统logo设置 前端控制器 + *

+ * + * @author lr + * @since 2021-10-18 + */ +@RestController +@RequestMapping("/occupationlab/sys/logo") +@Api(value = "API - 职站:系统logo设置", tags = "职站:系统logo设置") +public class SystemLogoController { + @Autowired + private UserClient userClient; + + @Autowired + public SystemLogoService service; + + /** + * @Description : 系统logo设置 + * @Param staffReq + * @Param request + * @Author Rong---2021/10/13 + */ + @PostMapping("/save") + @ApiOperation(value = "新增系统设置信息") + public R save(@RequestBody @Valid SystemLogo systemLogo, HttpServletRequest request) throws Exception { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + systemLogo.setSchoolId(schoolId); + boolean ret = service.save(systemLogo); + return ret ? R.ok() : R.error(); + } + + @GetMapping("/detail") + @ApiOperation(value = "查看系统设置信息") + public R save(HttpServletRequest request) throws Exception { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + SystemLogo logo = service.getOne(new QueryWrapper().eq("school_id", schoolId)); + return R.ok().put("data", logo); + } + + @PostMapping("/update") + @ApiOperation(value = "编辑系统设置信息") + public R update(@RequestBody @Valid SystemLogo systemLogo, HttpServletRequest request) throws Exception { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + + if (systemLogo.getTitle() != null) { + updateWrapper.set("title", systemLogo.getTitle()); + } + if (systemLogo.getLogoUrl() != null) { + updateWrapper.set("logo_url", systemLogo.getLogoUrl()); + } + updateWrapper.eq("school_id", schoolId); + boolean ret = service.update(new SystemLogo(), updateWrapper); + return ret ? R.ok() : R.error(); + } +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/TheoreticalCourseChapterController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/TheoreticalCourseChapterController.java new file mode 100644 index 0000000..7728249 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/TheoreticalCourseChapterController.java @@ -0,0 +1,83 @@ +package com.huoran.occupationlab.controller; + +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.TheoreticalCourseChapter; +import com.huoran.occupationlab.entity.vo.ReorderVO; +import com.huoran.occupationlab.entity.vo.TheoreticalChapterVO; +import com.huoran.occupationlab.service.TheoreticalCourseChapterService; +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.List; + +/** + *

+ * 理论课程章节表 前端控制器 + *

+ * + * @author lr + * @since 2022-09-22 + */ +@Api(tags = "理论课程章节管理") +@RestController +@RequestMapping("/occupationlab/theoreticalCourseChapter") +public class TheoreticalCourseChapterController { + + @Autowired + private TheoreticalCourseChapterService theoreticalCourseChapterService; + + @ApiOperation(value = "根据课程id查询章节小节,树状结构") + @GetMapping("/queryChaptersAndSubsections") + public R queryChaptersAndSubsections( + @ApiParam(name = "courseId", value = "课程ID", required = true) + @RequestParam String courseId) { + List chapterList = theoreticalCourseChapterService.getChapterTree(courseId); + return R.ok().put("chapterList", chapterList); + } + + @ApiOperation(value = "编辑排序") + @PostMapping("/reorder") + public R chapterReorder( + @ApiParam(name = "sortVO", value = "章节小节重排序对象", required = true) + @RequestBody ReorderVO reorderVO) { + boolean update = theoreticalCourseChapterService.updateSort(reorderVO); + return update ? R.ok() : R.error(); + + } + + @ApiOperation(value = "添加章节") + @PostMapping("/addChapter") + public R addChapter( + @ApiParam(name = "courseChapter", value = "章节对象", required = true) + @RequestBody TheoreticalCourseChapter theoreticalCourseChapter) { + //判重 + boolean isRepeat = theoreticalCourseChapterService.repeat(theoreticalCourseChapter); + if (isRepeat) { + return R.error("章节已存在"); + } + boolean save = theoreticalCourseChapterService.saveChapter(theoreticalCourseChapter); + return save ? R.ok() : R.error(); + } + + @ApiOperation(value = "修改章节") + @PutMapping("/editChapter") + public R editChapter( + @ApiParam(name = "courseChapter", value = "章节对象", required = true) + @RequestBody TheoreticalCourseChapter theoreticalCourseChapter) { + boolean update = theoreticalCourseChapterService.updateById(theoreticalCourseChapter); + return update ? R.ok() : R.error(); + } + + @ApiOperation(value = "根据id删除章节") + @DeleteMapping("/deleteChapter") + public R deleteChapter( + @ApiParam(name = "chapterId", value = "章节ID", required = true) + @RequestParam Integer chapterId) { + boolean remove = theoreticalCourseChapterService.removeChapter(chapterId); + return remove ? R.ok() : R.error(); + } +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/TheoreticalCourseClassificationController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/TheoreticalCourseClassificationController.java new file mode 100644 index 0000000..0bd0db5 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/TheoreticalCourseClassificationController.java @@ -0,0 +1,126 @@ +package com.huoran.occupationlab.controller; + +import com.huoran.api.UserClient; +import com.huoran.common.constant.DelConstant; +import com.huoran.common.constant.PlatformConstant; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.occupationlab.entity.TheoreticalCourseClassification; +import com.huoran.occupationlab.entity.req.ClassificationPageReq; +import com.huoran.occupationlab.service.TheoreticalCourseClassificationService; +import com.huoran.occupationlab.utils.Constant; +import io.swagger.annotations.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.Api; +import org.springframework.web.bind.annotation.RequestParam; +import io.swagger.annotations.ApiOperation; + +import javax.servlet.http.HttpServletRequest; +import java.util.Date; +import java.util.List; + + +/** + * @描述:理论课程分类信息控制类 + * @作者: Rong + * @日期: 2022-09-14 + */ +@RestController +@RequestMapping("/occupationlab/theoreticalCourseClassification") +@Api(value = "理论课程分类信息:TheoreticalCourseClassificationController", tags = "R-理论课程分类信息") +public class TheoreticalCourseClassificationController { + + @Autowired + public TheoreticalCourseClassificationService service; + @Autowired + private UserClient userClient; + + @PostMapping("/pagingQuery") + @ApiOperation(value = "分页查询", response = TheoreticalCourseClassification.class) + public R pagingQuery(@RequestBody ClassificationPageReq pageReq, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + + if (pageReq.getPlatformSource() == PlatformConstant.POST_STATION) { + pageReq.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); + } + return service.pagingQuery(pageReq); + } + + + @PostMapping("/checkRepeat") + @ApiOperation(value = "判重(传来源、名称、如若编辑则多传一个id)", response = TheoreticalCourseClassification.class) + public R checkRepeat(@RequestBody TheoreticalCourseClassification classification, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + classification.setFounderId(Integer.valueOf(accountId)); + if (classification.getPlatformSource() == PlatformConstant.POST_STATION) { + classification.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); + } + return service.checkRepeat(classification); + } + + + @PostMapping("/findById") + @ApiOperation(value = "查询详情", response = TheoreticalCourseClassification.class) + public R findById(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { + TheoreticalCourseClassification theoreticalCourseClassification = service.getById(id); + return R.ok().put("data", theoreticalCourseClassification); + } + + + @PostMapping("/save") + @ApiOperation(value = "新增", response = TheoreticalCourseClassification.class) + public R save(@RequestBody @ApiParam(name = "理论课程分类信息对象", value = "传入json格式", required = true) TheoreticalCourseClassification theoreticalCourseClassification, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + theoreticalCourseClassification.setFounderId(Integer.valueOf(accountId)); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + theoreticalCourseClassification.setSchoolId(schoolId); + boolean addState = service.save(theoreticalCourseClassification); + return addState ? R.ok() : R.error("新增失败"); + } + + + @PostMapping("/update") + @ApiOperation(value = "修改", response = TheoreticalCourseClassification.class) + public R update(@RequestBody @ApiParam(name = "理论课程分类信息对象", value = "传入json格式", required = true) TheoreticalCourseClassification theoreticalCourseClassification, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + theoreticalCourseClassification.setFounderId(Integer.valueOf(accountId)); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + theoreticalCourseClassification.setSchoolId(schoolId); + boolean updateState = service.updateById(theoreticalCourseClassification); + return updateState ? R.ok() : R.error("编辑失败"); + } + + + @PostMapping("/batchDeletion") + @ApiOperation(value = "批量删除", response = TheoreticalCourseClassification.class) + public R delete(@RequestBody List ids) { + boolean delState = service.removeByIds(ids); + return delState ? R.ok() : R.error("删除失败"); + } + + + @PostMapping("/queryAllCategoriesOfSchools") + @ApiOperation(value = "查询院校所有发布的分类", response = TheoreticalCourseClassification.class) + public R queryAllCategoriesOfSchools() { + return service.queryAllCategoriesOfSchools(); + } + + + @PostMapping("/builtInCourseClassification") + @ApiOperation(value = "内置课程分类数据", response = TheoreticalCourseClassification.class) + public boolean builtInCourseClassification(Integer schoolId, Integer accountId) { + TheoreticalCourseClassification addCourseClassification1 = new TheoreticalCourseClassification().setClassificationName("金融").setSchoolId(schoolId).setFounderId(accountId).setPlatformSource(PlatformConstant.POST_STATION).setIsDel(DelConstant.NOT_DEL).setCreateTime(new Date()).setUpdateTime(new Date()); + boolean ret1 = service.save(addCourseClassification1); + TheoreticalCourseClassification addCourseClassification2 = new TheoreticalCourseClassification().setClassificationName("金融科技").setSchoolId(schoolId).setFounderId(accountId).setPlatformSource(PlatformConstant.POST_STATION).setIsDel(DelConstant.NOT_DEL).setCreateTime(new Date()).setUpdateTime(new Date()); + boolean ret2 = service.save(addCourseClassification2); + TheoreticalCourseClassification addCourseClassification3 = new TheoreticalCourseClassification().setClassificationName("大数据").setSchoolId(schoolId).setFounderId(accountId).setPlatformSource(PlatformConstant.POST_STATION).setIsDel(DelConstant.NOT_DEL).setCreateTime(new Date()).setUpdateTime(new Date()); + boolean ret3 = service.save(addCourseClassification3); + return ret1 && ret2 && ret3; + } + +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/TheoreticalCourseConfigureController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/TheoreticalCourseConfigureController.java new file mode 100644 index 0000000..98101c6 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/TheoreticalCourseConfigureController.java @@ -0,0 +1,83 @@ +package com.huoran.occupationlab.controller; + +import com.huoran.common.response.R; +import io.swagger.annotations.*; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.springframework.beans.factory.annotation.Autowired; +import org.apache.commons.lang.StringUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.Api; +import org.springframework.web.bind.annotation.RequestParam; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import com.huoran.occupationlab.service.TheoreticalCourseConfigureService; +import com.huoran.occupationlab.entity.TheoreticalCourseConfigure; + +import java.util.List; + + +/** + * @描述:理论课程与理论课程分类配置表控制类 + * @作者: Rong + * @日期: 2022-09-14 + */ +@RestController +@RequestMapping("/occupationlab/theoreticalCourseConfigure") +@Api(value = "理论课程与理论课程分类配置表:TheoreticalCourseConfigureController", tags = "R-理论课程与理论课程分类配置表") +public class TheoreticalCourseConfigureController { + + @Autowired + public TheoreticalCourseConfigureService service; + + + /*@PostMapping("/listByEntity") + @ApiOperation(value = "分页查询", response = TheoreticalCourseConfigure.class) + public R listByEntity(@RequestBody TheoreticalCourseConfigure theoreticalCourseConfigure) { + + return null; + }*/ + + + @PostMapping("/findById") + @ApiOperation(value = "查询详情", response = TheoreticalCourseConfigure.class) + public R findById(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { + TheoreticalCourseConfigure theoreticalCourseConfigure = service.getById(id); + return R.ok().put("data", theoreticalCourseConfigure); + } + + + @PostMapping("/save") + @ApiOperation(value = "新增", response = TheoreticalCourseConfigure.class) + public R save(@RequestBody @ApiParam(name = "理论课程与理论课程分类配置表对象", value = "传入json格式", required = true) TheoreticalCourseConfigure theoreticalCourseConfigure) { + boolean addState = service.save(theoreticalCourseConfigure); + return addState ? R.ok() : R.error("新增失败"); + } + + + @PostMapping("/update") + @ApiOperation(value = "修改", response = TheoreticalCourseConfigure.class) + public R update(@RequestBody @ApiParam(name = "理论课程与理论课程分类配置表对象", value = "传入json格式", required = true) TheoreticalCourseConfigure theoreticalCourseConfigure) { + boolean updateState = service.updateById(theoreticalCourseConfigure); + return updateState ? R.ok() : R.error("编辑失败"); + } + + + @PostMapping("/delete") + @ApiOperation(value = "删除", response = TheoreticalCourseConfigure.class) + public R delete(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { + boolean delState = service.removeById(id); + return delState ? R.ok() : R.error("删除失败"); + } + + @PostMapping("/batchDeletion") + @ApiOperation(value = "批量删除", response = TheoreticalCourseConfigure.class) + public R batchDeletion(@ApiParam(name = "id", value = "主键", required = true) @RequestParam List ids) { + boolean delState = service.removeByIds(ids); + return delState ? R.ok() : R.error("删除失败"); + } +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/TheoreticalCourseController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/TheoreticalCourseController.java new file mode 100644 index 0000000..61c3e58 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/TheoreticalCourseController.java @@ -0,0 +1,239 @@ +package com.huoran.occupationlab.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.api.UserClient; +import com.huoran.common.constant.PlatformConstant; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.occupationlab.entity.PlayRecord; +import com.huoran.occupationlab.entity.TheoreticalCourse; +import com.huoran.occupationlab.entity.TheoreticalCourseCollect; +import com.huoran.occupationlab.entity.req.AddTheoreticalCourseReq; +import com.huoran.occupationlab.entity.req.DisableEnableCourseReq; +import com.huoran.occupationlab.entity.req.PageStudentTheoreticalCourseReq; +import com.huoran.occupationlab.entity.req.PageTheoreticalCourseReq; +import com.huoran.occupationlab.entity.resp.PageTheoreticalCourseByNakadaiResp; +import com.huoran.occupationlab.entity.resp.TheoreticalCourseDetailResp; +import com.huoran.occupationlab.service.PlayRecordService; +import com.huoran.occupationlab.service.TheoreticalCourseCollectService; +import com.huoran.occupationlab.service.TheoreticalCourseService; +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.data.redis.core.StringRedisTemplate; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.util.Date; +import java.util.List; +import java.util.concurrent.TimeUnit; + + +/** + * @描述:理论课程基本信息控制类 + * @作者: Rong + * @日期: 2022-09-14 + */ +@RestController +@RequestMapping("/occupationlab/theoreticalCourse") +@Api(value = "理论课程基本信息:TheoreticalCourseController", tags = "R-理论课程基本信息") +public class TheoreticalCourseController { + + @Autowired + public TheoreticalCourseService service; + + @Autowired + public PlayRecordService playRecordService; + + @Autowired + public TheoreticalCourseCollectService courseCollectService; + @Autowired + private UserClient userClient; + + @Autowired + private StringRedisTemplate redisTemplate; + + @PostMapping("/pageConditionalQueryCourse") + @ApiOperation(value = "分页条件查询课程(本接口可用于中台、职站教师端理论课程)", response = PageTheoreticalCourseByNakadaiResp.class) + public R pageConditionalQueryCourse(@RequestBody PageTheoreticalCourseReq pageReq, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + pageReq.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); + return service.pageConditionalQueryCourse(pageReq); + } + + @PostMapping("/pageConditionalQueryCourseByStudent") + @ApiOperation(value = "分页条件查询课程(学生端理论课程)", response = PageTheoreticalCourseByNakadaiResp.class) + public R pageConditionalQueryCourseByStudent(@RequestBody PageStudentTheoreticalCourseReq pageReq, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + pageReq.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); + pageReq.setAccountId(Integer.valueOf(accountId)); + return service.pageConditionalQueryCourseByStudent(pageReq); + } + + + @PostMapping("/studentLoginPreCourse") + @ApiOperation(value = "分页条件查询课程(学生登录前)", response = PageTheoreticalCourseByNakadaiResp.class) + public R studentLoginPreCourse(@RequestBody PageTheoreticalCourseReq pageReq) { + return service.studentLoginPreCourse(pageReq); + } + + + @PostMapping("/findById") + @ApiOperation(value = "查询详情", response = TheoreticalCourseDetailResp.class) + public R findById(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { + return service.theoryCoursesDetail(id); + } + + + @PostMapping("/save") + @ApiOperation(value = "新增理论课程", response = TheoreticalCourse.class) + public R save(@RequestBody @ApiParam(name = "理论课程基本信息对象", value = "传入json格式", required = true) AddTheoreticalCourseReq req, HttpServletRequest request) { + return service.addTheoryCourses(req, request); + } + + + /** + * 同校内判重 + * 平台和学校内可重复 + * + * @param theoreticalCourse + * @param request + * @return + */ + @PostMapping("/checkRepeat") + @ApiOperation(value = "课程判重(传来源、名称、如若编辑则多传一个id)", response = TheoreticalCourse.class) + public R checkRepeat(@RequestBody TheoreticalCourse theoreticalCourse, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + theoreticalCourse.setFounderId(Integer.valueOf(accountId)); + if (theoreticalCourse.getPlatformSource() == PlatformConstant.POST_STATION) { + theoreticalCourse.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); + } + return service.checkRepeat(theoreticalCourse); + } + + @PostMapping("/update") + @ApiOperation(value = "修改", response = TheoreticalCourse.class) + public R update(@RequestBody @ApiParam(name = "理论课程基本信息对象", value = "传入json格式", required = true) AddTheoreticalCourseReq req, HttpServletRequest request) { + return service.modifyTheoryCourses(req, request); + } + + + @PostMapping("/delete") + @ApiOperation(value = "删除", response = TheoreticalCourse.class) + public R delete(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { + boolean delState = service.removeById(id); + return delState ? R.ok() : R.error("删除失败"); + } + + @PostMapping("/batchDeletion") + @ApiOperation(value = "批量删除", response = TheoreticalCourse.class) + public R batchDeletion(@ApiParam(name = "id", value = "主键", required = true) @RequestParam List ids) { + boolean delState = service.removeByIds(ids); + return delState ? R.ok() : R.error("删除失败"); + } + + + @ApiOperation(value = "课程禁启用", response = TheoreticalCourse.class) + @PostMapping("/disabledEvents") + public R disabledEvents(@RequestBody DisableEnableCourseReq req) { + + TheoreticalCourse getDetail = service.getById(req.getCourseId()); + TheoreticalCourse contest = new TheoreticalCourse(); + contest.setId(req.getCourseId()); + //禁用平台来源(0中台,1职站) + switch (req.getType()) { + case 0: + contest.setZtOpen(req.getIsOpen()); + break; + case 1: + //原理论课程需求: + // 用户创建的理论课程,禁用时职站首页以及学生登录后的理论课程模块看不到对应的课程,创建的老师在理论课程管理还是可以看到该理论课程,可以编辑,但是无法启用。 + // 即中台禁用的理论课程,即使是该院校老师创建的,老师端也不能自己启用,需要中台启用。 + //1.判断当前院校禁启用状态为要启用时候再判断当前课程中台禁启用的状态 + if (req.getIsOpen() == 0) { + if (getDetail.getZtOpen() == 1) { + return R.error("当前课程已被平台禁用,请联系平台管理员!"); + } + } + contest.setIsOpen(req.getIsOpen()); + break; + + } + boolean ret = service.updateById(contest); + + /*if (req.getIsOpen() == 1) {*/ + //保存的key名 + String key = "theoryCoursesAreDisabled"; + //保存到缓存中 + redisTemplate.opsForValue().set(key, "true"); + /*}*/ + return ret ? R.ok() : R.error(); + } + + + @PostMapping("/getRedisCache") + @ApiOperation(value = "获取Redis缓存(返回true 刷新)") + public R getRedisCache() { + //保存的key名 + String key = "theoryCoursesAreDisabled"; + //查看缓存是否有数据 + String returnValue = redisTemplate.opsForValue().get(key); + + //使用缓存返回数据 + if (returnValue != null) { + + //设置key过期时间 + redisTemplate.expire(key, 5000, TimeUnit.MILLISECONDS);//设置过期时间 + return R.ok().put("data", returnValue); + } + + + return R.ok(); + } + + + @PostMapping("/addBrowsingData") + @ApiOperation(value = "增加浏览数据", response = TheoreticalCourse.class) + public void addBrowsingData(@RequestBody @ApiParam(name = "资源播放记录对象", value = "传入json格式", required = true) PlayRecord playRecord) { + for (int i = 0; i <= playRecord.getNum(); i++) { + playRecordService.save(playRecord); + } + } + + + @PostMapping("/collectCourse") + @ApiOperation(value = "收藏课程", response = TheoreticalCourseCollect.class) + public R collectCourse(@ApiParam(name = "courseId", value = "课程id", required = true) @RequestParam Integer courseId, + @ApiParam(name = "state", value = "操作状态(state = 1收藏,0取消收藏)", required = true) @RequestParam Integer state, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("course_id", courseId); + queryWrapper.eq("account_id", accountId); + + TheoreticalCourseCollect detail = courseCollectService.getOne(queryWrapper); + switch (state) { + case 0://取消收藏 + if (detail != null) { + courseCollectService.removeById(detail.getId()); + } + break; + + case 1://收藏 + if (detail != null) { + return R.ok("已经收藏过了!"); + } + TheoreticalCourseCollect courseCollect = new TheoreticalCourseCollect(); + courseCollect.setCourseId(courseId); + courseCollect.setCollectionTime(new Date()); + courseCollect.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); + courseCollect.setAccountId(Integer.valueOf(accountId)); + courseCollectService.save(courseCollect); + break; + } + return R.ok(); + } + + +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/TheoreticalCourseSubsectionController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/TheoreticalCourseSubsectionController.java new file mode 100644 index 0000000..021328d --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/TheoreticalCourseSubsectionController.java @@ -0,0 +1,78 @@ +package com.huoran.occupationlab.controller; + +import com.aliyuncs.exceptions.ClientException; +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.TheoreticalCourseSubsection; +import com.huoran.occupationlab.service.TheoreticalCourseSubsectionService; +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.*; + +/** + *

+ * 课程小节 前端控制器 + *

+ * + * @author lr + * @since 2022-09-22 + */ +@Api(tags = "理论课程小节管理") +@RestController +@RequestMapping("/occupationlab/theoreticalCourseSubsection") +public class TheoreticalCourseSubsectionController { + + @Autowired + private TheoreticalCourseSubsectionService theoreticalCourseSubsectionService; + + @ApiOperation(value = "添加小节") + @PostMapping("/addSubsection") + public R addSubsection( + @ApiParam(name = "theoreticalCourseSubsection", value = "小节对象", required = true) + @RequestBody TheoreticalCourseSubsection theoreticalCourseSubsection) { + //判重 + boolean isRepeat = theoreticalCourseSubsectionService.repeat(theoreticalCourseSubsection); + if (isRepeat) { + return R.error("小节已存在"); + } + boolean save = theoreticalCourseSubsectionService.saveSubsection(theoreticalCourseSubsection); + return save ? R.ok() : R.error(); + } + + @ApiOperation(value = "修改小节") + @PutMapping("/editSubsection") + public R editSubsection( + @ApiParam(name = "theoreticalCourseSubsection", value = "小节对象", required = true) + @RequestBody TheoreticalCourseSubsection theoreticalCourseSubsection) { + boolean update = theoreticalCourseSubsectionService.updateById(theoreticalCourseSubsection); + return update ? R.ok() : R.error(); + } + + @ApiOperation(value = "根据id删除小节") + @DeleteMapping("/deleteSubsection") + public R deleteSubsection( + @ApiParam(name = "subsectionId", value = "小节ID", required = true) + @RequestParam Integer subsectionId) throws ClientException { + boolean remove = theoreticalCourseSubsectionService.removeSubsection(subsectionId); + return remove ? R.ok() : R.error(); + } + + @ApiOperation(value = "根据小节id获取预览文件地址") + @GetMapping("/getSubsection") + public R getSubsection( + @ApiParam(name = "subsectionId", value = "小节ID", required = true) + @RequestParam String subsectionId) { + String officeUrl = "https://view.officeapps.live.com/op/view.aspx?src="; + // String xDocUrl = "http://view.xdocin.com/xdoc?_xdoc="; + TheoreticalCourseSubsection courseSubsection = theoreticalCourseSubsectionService.getById(subsectionId); + if (courseSubsection != null) { + String fileUrl = courseSubsection.getFileUrl(); + String previewUrl = officeUrl + fileUrl; + return R.ok().put("previewUrl", previewUrl); + } else { + return R.error(); + } + } +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/UserInfoController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/UserInfoController.java new file mode 100644 index 0000000..fd56b78 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/UserInfoController.java @@ -0,0 +1,150 @@ +package com.huoran.occupationlab.controller; + + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.AclPermission; +import com.huoran.occupationlab.entity.AclRole; +import com.huoran.occupationlab.entity.HrUserInfo; +import com.huoran.occupationlab.service.PermissionService; +import com.huoran.occupationlab.service.RoleService; +import com.huoran.occupationlab.service.UserInfoService; +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.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; + +import java.util.HashMap; +import java.util.List; + +/** + *

+ * 用户信息表 前端控制器 + *

+ * + * @author Ning + * @since 2020-10-21 + */ +@RestController +@RequestMapping("/occupationlab/management/userInfo") +@Api(tags = "用户管理") +public class UserInfoController { + + @Autowired + private UserInfoService userInfoService; + + @Autowired + private RoleService roleService; + + @Autowired + private PermissionService permissionService; + + + /** + * 个人中心 + */ + @ApiOperation(value = "个人中心") + @GetMapping("/getUserInfo") + public R getUserInfo( + @ApiParam(name = "userId", value = "用户id", required = true) + @RequestParam(value = "userId", required = true) Integer userId) { + HrUserInfo userInfo = userInfoService.getUserInfo(userId); + return R.ok().put("userInfo", userInfo); + } + + /** + * 登陆 + */ + @Transactional + @ApiOperation(value = "登陆") + @GetMapping("/login") + public R login( + @ApiParam(name = "account", value = "账号", required = true) + @RequestParam(value = "account", required = true) String account, + @ApiParam(name = "password", value = "密码", required = true) + @RequestParam(value = "password", required = true) String password) { + HashMap map = new HashMap<>(); + map.put("account", account); + map.put("password", password); + HrUserInfo userInfo = userInfoService.login(map); + if (userInfo == null) { + throw new RuntimeException("账号密码错误!"); + } else { + Integer userId = userInfo.getUserId(); + //获取当前用户角色id + String roleId = userInfo.getRoleId(); + //获取用户端口 + Integer isPort = userInfo.getIsPort(); + //根据角色查询菜单 + List permissions = permissionService.selectAllMenu(roleId, isPort); + //查询角色 + AclRole role = roleService.getById(roleId); + //更新登录时间 + userInfoService.updateTime(userId); + return R.ok().put("userInfo", userInfo).put("permissions", permissions).put("role", role); + } + } + + /** + * 注册 + */ + @ApiOperation(value = "注册") + @PostMapping("/add") + public R add( + @ApiParam(name = "userInfo", value = "用户对象", required = true) + @RequestBody HrUserInfo userInfo) { + boolean status = userInfoService.save(userInfo); + return R.ok().put("status", status); + } + + /** + * 查询用户账号 + */ + @ApiOperation(value = "查询用户账号") + @GetMapping("/getAccount") + public R getAccount( + @ApiParam(name = "account", value = "账号", required = true) + @RequestParam(value = "account", required = true) String account) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("account", account).eq("isdel", 0); + HrUserInfo userInfo = userInfoService.getOne(wrapper); + return R.ok().put("userInfo", userInfo); + } + + /** + * 修改 + */ + @ApiOperation(value = "修改") + @PostMapping("/update") + public R update( + @ApiParam(name = "userInfo", value = "用户对象", required = true) + @RequestBody HrUserInfo userInfo) { + boolean status = userInfoService.updateById(userInfo); + return status ? R.ok() : R.error(); + } + + // @ApiOperation(value = "根据用户获取角色数据") + // @GetMapping("/toAssign/{userId}") + // public R toAssign(@PathVariable String userId) { + // Map roleMap = roleService.findRoleByUserId(userId); + // return R.ok().put(roleMap); + // } + + @ApiOperation(value = "根据用户分配角色") + @PostMapping("/doAssign") + public R doAssign(@RequestParam String userId, @RequestParam String[] roleId) { + roleService.saveUserRoleRelationShip(userId, roleId); + return R.ok(); + } + + // @ApiOperation(value = "根据用户id拥有的角色id") + // @PostMapping("/getRoles") + // public R getRoles(@RequestParam String userId) { + // List roles = roleService.selectRoleByUserId(userId); + // return R.ok().put("roles",roles); + // } + +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/UserManagementController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/UserManagementController.java new file mode 100644 index 0000000..f341165 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/UserManagementController.java @@ -0,0 +1,131 @@ +package com.huoran.occupationlab.controller; + + +import com.google.common.collect.Maps; +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.UserManagement; +import com.huoran.occupationlab.entity.vo.UserVO; +import com.huoran.occupationlab.service.UserManagementService; +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 org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + *

+ * 企业端用户管理 前端控制器 + *

+ * + * @author Ning + * @since 2020-10-27 + */ +@RestController +@RequestMapping("/occupationlab/enterprise/user") +@Api(description = "用户管理", tags = "用户管理") +public class UserManagementController { + + @Autowired + private UserManagementService service; + + /** + * 添加用户信息 + */ + @ApiOperation(value = "添加用户信息") + @PostMapping("/addUser") + public R addUser(@ApiParam(name = "userManagement", value = "用户管理实体", required = true) + @RequestBody UserVO vo) { + if (vo == null) { + return R.error("数据有误,新增用户失败!"); + } else { + boolean ret = service.addUser(vo); + return ret ? R.ok() : R.error(); + } + } + + /** + * 查询用户列表 + */ + @ApiOperation(value = "查询用户列表") + @GetMapping("/list/{current}/{pageSize}") + public R list( + @ApiParam(name = "current", value = "当前页码", required = true) + @PathVariable int current, + @ApiParam(name = "pageSize", value = "每页记录数", required = true) + @PathVariable int pageSize, + @ApiParam(name = "searchContent", value = "搜索内容", required = false) + @RequestParam(value = "searchContent", required = false) String searchContent) { + HashMap map = Maps.newHashMap(); + map.put("current", (current - 1) * pageSize); + map.put("pageSize", pageSize); + if (searchContent != null) { + map.put("searchContent", searchContent); + } + List list = service.queryList(map); + int total = service.queryListCount(map); + return R.ok().put("list", list).put("total", total); + } + + /** + * 批量删除用户 + */ + @ApiOperation(value = "批量删除用户") + @PostMapping("/deleteUser") + public R deleteClient(@ApiParam(name = "userIds", value = "多个用户id", required = true) + @RequestParam List userIds) { + if (userIds.isEmpty()) { + return R.error("用户id为空,删除失败!"); + } else { + boolean ret = service.deleteUser(userIds); + return ret ? R.ok() : R.error(); + } + } + + /** + * 更新用户 + */ + @ApiOperation(value = "更新用户") + @PostMapping("/updateUser") + public R updateClient(@ApiParam(name = "UserManagement", value = "用户实体", required = true) + @RequestBody UserVO vo) { + if (vo == null) { + return R.error("用户实体为空,修改失败!"); + } else { + boolean ret = service.updateUser(vo); + return ret ? R.ok() : R.error(); + } + } + + /** + * 批量导入用户信息 + * + * @param file + * @return + */ + @ApiOperation(value = "批量导入用户信息") + @PostMapping("/uploadFile") + public R uploadFile(@ApiParam(name = "file", value = "用户信息文件", required = true) MultipartFile file) throws IOException { + Map upload = service.upload(file); + return R.ok().put("data", upload); + } + + /** + * 导出失败原因 + * + * @param token + * @return + */ + @ApiOperation(value = "导出失败原因") + @GetMapping("/exportFailure") + public void exportFailureRecord(HttpServletResponse response, String token) throws Exception { + service.exportFailureRecord(response, token); + } +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/UserScoreController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/UserScoreController.java new file mode 100644 index 0000000..d8f3c4a --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/UserScoreController.java @@ -0,0 +1,42 @@ +package com.huoran.occupationlab.controller; + + +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.UserScore; +import com.huoran.occupationlab.service.UserScoreService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +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.RestController; + +/** + *

+ * 用户分数表 前端控制器 + *

+ * + * @author Mr.JK + * @since 2021-09-14 + */ +@RestController +@RequestMapping("/occupationlab/userScore") +@Api(tags = "用户分数") +public class UserScoreController { + + @Autowired + private UserScoreService userScoreService; + + @PostMapping("/addUserScore") + @ApiOperation(value = "新增用户分数表 远程feign") + public Integer addUserScore(@RequestBody UserScore userScore){ + if (userScoreService.save(userScore)){ + return userScore.getId(); + } + return null; + } + +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/controller/XxlJobController.java b/occupationlab/src/main/java/com/huoran/occupationlab/controller/XxlJobController.java new file mode 100644 index 0000000..b1b937e --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/controller/XxlJobController.java @@ -0,0 +1,70 @@ +//package com.huoran.occupationlab.controller; +// +//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.PostMapping; +//import org.springframework.web.bind.annotation.RequestMapping; +//import org.springframework.web.bind.annotation.RequestParam; +//import org.springframework.web.bind.annotation.RestController; +// +//import java.text.DateFormat; +//import java.text.SimpleDateFormat; +// +// +//@Api(tags = "xxlJob定时任务管理") +//@RestController +//@RequestMapping("/xxlJob") +//public class XxlJobController { +// +//// @Autowired +//// private XxlJobService xxlJobService; +// +// //添加任务并运行 +// @PostMapping("/addTask") +// @ApiOperation(value = "新增") +// public void addTask( +// @ApiParam(name = "customId", value = "用户id", required = true) +// @RequestParam(value = "customId", required = true) String customId, +// @RequestParam(value = "triggerTime", required = true) String triggerTime, +// @RequestParam(value = "executorParam", required = true) String executorParam) { +// try { +// /** +// customId – 自定义的唯一的业务id,此id在所有任务中保持唯一,注意:这个唯一标识被放到了负责人字段 +// triggerTime – 任务执行时间,必须大于当前时间 +// executorParam – 任务执行参数 +// executorHandler – 任务处理器,关联@XxlJob的value "2023-11-03 12:05:00" +// */ +// +// DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); +// Integer taskId = xxlJobService.addJustExecuteOnceJob(customId,dateFormat.parse(triggerTime),executorParam,"testHandler"); +// //开始运行任务 +// xxlJobService.start(taskId); +// }catch (Exception e) { +// e.printStackTrace(); +// } +// } +// +// @PostMapping("/deleteTask") +// @ApiOperation(value = "删除任务") +// public void deleteTask(@RequestParam String data) { +// try { +// //通过自定义的唯一的业务id获取任务的id +// Integer taskId = xxlJobService.getJobIdByCustomId(data); +// //删除任务 +// xxlJobService.remove(taskId); +// }catch (Exception e) { +// e.printStackTrace(); +// } +// } +// +// //任务处理器 +//// @XxlJob("testHandler") +//// public void test() { +//// System.out.println("计划任务开始执行"); +//// // 获取任务参数 +//// String param = XxlJobHelper.getJobParam(); +//// System.out.println("计划任务传输过来的参数 ------" + param); +//// } +//} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/AclPermission.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/AclPermission.java new file mode 100644 index 0000000..028f257 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/AclPermission.java @@ -0,0 +1,82 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + *

+ * 权限表 + *

+ * + * @author lr + * @since 2021-08-10 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_acl_permission") +@ApiModel(value = "AclPermission对象", description = "权限表") +public class AclPermission implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "id") + @TableId(value = "id", type = IdType.ID_WORKER_STR) + private String id; + + @ApiModelProperty(value = "所属上级") + private String pid; + + @ApiModelProperty(value = "权限名称") + private String name; + + @ApiModelProperty(value = "权限类型(1:菜单,2:按钮)") + private Integer type; + + @ApiModelProperty(value = "权限值") + private String permissionValue; + + @ApiModelProperty(value = "访问路径") + private String path; + + @ApiModelProperty(value = "组件路径") + private String component; + + @ApiModelProperty(value = "图标") + private String icon; + + @ApiModelProperty(value = "状态(0:正常,1:禁止)") + private Integer status; + + + @ApiModelProperty(value = "层级") + @TableField(exist = false) + private Integer level; + + @ApiModelProperty(value = "下级") + @TableField(exist = false) + private List children; + + @ApiModelProperty(value = "是否选中") + @TableField(exist = false) + private boolean isSelect; + + @ApiModelProperty(value = "创建时间") + private Date gmtCreate; + + @ApiModelProperty(value = "更新时间") + private Date gmtModified; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/AclRole.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/AclRole.java new file mode 100644 index 0000000..4cdac93 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/AclRole.java @@ -0,0 +1,54 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import java.util.Date; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 角色表 + *

+ * + * @author lr + * @since 2021-08-10 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_acl_role") +@ApiModel(value="AclRole对象", description="角色表") +public class AclRole implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "角色id") + @TableId(value = "id", type = IdType.ID_WORKER_STR) + private String id; + + @ApiModelProperty(value = "角色名称") + private String roleName; + + @ApiModelProperty(value = "角色编码") + private String roleCode; + + @ApiModelProperty(value = "备注") + private String remark; + + @ApiModelProperty(value = "创建时间") + private Date gmtCreate; + + @ApiModelProperty(value = "更新时间") + private Date gmtModified; + + @ApiModelProperty(value = "绑定客户id") + private Integer clientId; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/AclRolePermission.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/AclRolePermission.java new file mode 100644 index 0000000..cd7182e --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/AclRolePermission.java @@ -0,0 +1,50 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import java.util.Date; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 角色权限表 + *

+ * + * @author lr + * @since 2021-08-10 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_acl_role_permission") +@ApiModel(value="AclRolePermission对象", description="角色权限表") +public class AclRolePermission implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.ID_WORKER_STR) + private String id; + + @ApiModelProperty(value = "角色id") + private String roleId; + + @ApiModelProperty(value = "权限id") + private String permissionId; + + @ApiModelProperty(value = "创建时间") + private Date gmtCreate; + + @ApiModelProperty(value = "更新时间") + private Date gmtModified; + + @ApiModelProperty(value = "端口(1、企业端 2、管理端)") + private Integer isPort; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/AclUserRole.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/AclUserRole.java new file mode 100644 index 0000000..92eb043 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/AclUserRole.java @@ -0,0 +1,48 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import java.util.Date; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 用户角色表 + *

+ * + * @author lr + * @since 2021-08-10 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_acl_user_role") +@ApiModel(value="AclUserRole对象", description="用户角色表") +public class AclUserRole implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键id") + @TableId(value = "id", type = IdType.ID_WORKER_STR) + private String id; + + @ApiModelProperty(value = "角色id") + private String roleId; + + @ApiModelProperty(value = "用户id") + private String userId; + + @ApiModelProperty(value = "创建时间") + private Date gmtCreate; + + @ApiModelProperty(value = "更新时间") + private Date gmtModified; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/Applicant.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/Applicant.java new file mode 100644 index 0000000..141158f --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/Applicant.java @@ -0,0 +1,66 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 报名人员表 + *

+ * + * @author lr + * @since 2021-08-10 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_applicant") +@ApiModel(value = "Applicant对象", description = "报名人员表") +public class Applicant implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.ID_WORKER_STR) + private String id; + + @ApiModelProperty(value = "用户主键Id", example = "1") + private String userId; + + @ApiModelProperty(value = "竞赛主键Id", example = "1435884916087099393") + private String contestId; + + @ApiModelProperty(value = "是否禁用(1未禁用,0禁用)", example = "1") + private Integer isDisable; + + @ApiModelProperty(value = "创建时间") + private Date gmtCreate; + + @ApiModelProperty(value = "修改时间") + private Date gmtModified; + + @ApiModelProperty(value = "用户名称", example = "张昭") + private String username; + + @ApiModelProperty(value = "学校名称", example = "湖南科技大学") + private String school; + + @ApiModelProperty(value = "账号", example = "hunan") + private String account; + + @ApiModelProperty(value = "手机号", example = "17777777777") + private String phone; + + @ApiModelProperty(value = "账号id", example = "1") + private String accountId; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/Architecture.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/Architecture.java new file mode 100644 index 0000000..444dc4e --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/Architecture.java @@ -0,0 +1,78 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; + +import java.io.Serializable; +import java.util.List; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** + *

+ * 学生组织架构 + *

+ * + * @author lr + * @since 2021-08-24 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_architecture") +@ApiModel(value = "Architecture对象", description = "学生组织架构") +public class Architecture implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "自增id 新增无需传值") + private Integer id; + + @ApiModelProperty(value = "组织名称") + private String organizationName; + + @ApiModelProperty(value = "父id 一级为0", example = "0", name = "parentId") + private Integer parentId; + + @ApiModelProperty(value = "学校id", example = "1", name = "schoolId") + private Integer schoolId; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "逻辑删除") + @TableLogic + private Integer isDel; + + + @ApiModelProperty(value = "层级") + private Integer level; + + @ApiModelProperty(value = "子级") + @TableField(exist = false) + private List children; + + @ApiModelProperty(value = "层级拼接") + @TableField(exist = false) + private String splicingLevel; + + /*@ApiModelProperty(value = "班級") + @TableField(exist = false) + private List classList;*/ + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/Article.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/Article.java new file mode 100644 index 0000000..fdf7d62 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/Article.java @@ -0,0 +1,83 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 文章表 + *

+ * + * @author lr + * @since 2021-08-10 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_article") +@ApiModel(value = "Article对象", description = "文章表") +public class Article implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "文章标题", example = "今天天气不错") + private String title; + + @ApiModelProperty(value = "文章作者", example = "Rong") + private String author; + + @ApiModelProperty(value = "创建人") + private String createUser; + + @ApiModelProperty(value = "栏目ID") + private Integer columnId; + + @ApiModelProperty(value = "文章封面图", example = "https://www.baidu.com/") + private String coverUrl; + + @ApiModelProperty(value = "文章内容", example = "DDD 是 Eric Evans 在2003年出版的书名,同时也是这个架构设计方法名的起源。Eric Evans “领域驱动设计之父”,世界杰出软件建模专家。他创建的 “Domain Language” 公司,就是致力帮助公司机构创建与业务紧密相关的软件。") + private String content; + + @ApiModelProperty(value = "排序号", example = "0") + private Integer sort; + + @ApiModelProperty(value = "浏览量", example = "0") + private Long viewCount; + + @ApiModelProperty(value = "状态(0不展示,1展示)", example = "0") + private Integer status; + + @ApiModelProperty(value = "文章日期", example = "2021-09-09 10:00:00") + private Date date; + + @ApiModelProperty(value = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "是否删除") + @TableLogic(value = "0",delval = "1") + private Integer isDel; + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/Assessment.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/Assessment.java new file mode 100644 index 0000000..d4fe146 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/Assessment.java @@ -0,0 +1,125 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; + +import java.io.Serializable; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.huoran.occupationlab.entity.req.ClassReq; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import org.springframework.format.annotation.DateTimeFormat; + +import javax.validation.constraints.NotNull; + +/** + *

+ * 考核管理 + *

+ * + * @author lr + * @since 2021-08-18 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_assessment") +@ApiModel(value = "Assessment对象", description = "考核管理") +public class Assessment implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "考核名称") + private String experimentalName; + + @ApiModelProperty(value = "班级id(可多个班级参加,逗号隔开)") + private String classId; + + @ApiModelProperty(value = "绑定项目id") + private Integer projectId; + + @ApiModelProperty(value = "实验时长") + private String experimentDuration; + + @ApiModelProperty(value = "发布类型(1、手动发布 2、定时发布)") + private Integer type; + + @ApiModelProperty(value = "起始时间") + private Date startTime; + + @ApiModelProperty(value = "结束时间") + private Date stopTime; + + @ApiModelProperty(value = "状态(0、待开始 1、进行中 2、已结束)") + private Integer status; + + @ApiModelProperty(value = "邀请码") + private Integer invitationCode; + + @ApiModelProperty(value = "指定范围(0无指定范围 1指定范围)") + @NotNull(message = "指定范围不能为空") + private Integer isSpecify; + + @ApiModelProperty(value = "创建人用户账号id") + private Integer accountId; + + @ApiModelProperty(value = "课程id 默认不传(nakadai curriculum表)") + private Integer curriculumId; + + @ApiModelProperty(value = "是否启用邀请码(0、未启用 1、启用)") + private Integer isEnableCode; + + @ApiModelProperty(value = "是否删除(0、未删除 1、已删除)") + @TableLogic + private Integer isDel; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date createTime; + + @ApiModelProperty(value = "商品id", name = "mallId") + private Integer mallId; + + @ApiModelProperty(value = "班级名称") + @TableField(exist = false) + private String className; + + @ApiModelProperty(value = "项目名称") + @TableField(exist = false) + private String projectName; + + @ApiModelProperty(value = "实验人数") + @TableField(exist = false) + private Integer experimenterNum; + + @ApiModelProperty(value = "绑定学生信息") + @TableField(exist = false) + private List stuInfo; + + @ApiModelProperty(value = "班级信息") + @TableField(exist = false) + private List classInfo; + + @ApiModelProperty(value = "学校id", name = "schoolId", example = "1") + private Integer schoolId; + + @ApiModelProperty(value = "倒计时") + @TableField(exist = false) + private String countdownTime; + + @ApiModelProperty(value = "考核发布人角色") + @TableField(exist = false) + private String roleName; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/AssessmentExam.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/AssessmentExam.java new file mode 100644 index 0000000..fe43505 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/AssessmentExam.java @@ -0,0 +1,64 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; + +import java.util.Date; + +import com.baomidou.mybatisplus.annotation.TableId; + +import java.io.Serializable; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 学生考试表(考核) + *

+ * + * @author lr + * @since 2021-08-19 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_assessment_exam") +@ApiModel(value = "AssessmentExam对象", description = "学生考试表(考核)") +public class AssessmentExam implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = " 考试主键id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "绑定考核id") + private Integer assessmentId; + + @ApiModelProperty(value = "绑定用户id") + private Integer accountId; + + @ApiModelProperty(value = "用时") + private Integer timeCost; + + @ApiModelProperty(value = "得分") + private Integer score; + + @ApiModelProperty(value = "班级id(用于区分学生端同一考核下,该生在两个不同的班级需要进入两次)") + private Integer classId; + + @ApiModelProperty(value = "考试状态(0、未考 1、在考 2、已考)") + private Integer state; + + @ApiModelProperty(value = "学生开考时间") + private Date examTime; + + @ApiModelProperty(value = "学生结束时间") + private Date stopTime; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/City.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/City.java new file mode 100644 index 0000000..f02d1f4 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/City.java @@ -0,0 +1,49 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableField; + +import java.io.Serializable; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 城市 + *

+ * + * @author lr + * @since 2021-08-10 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_city") +@ApiModel(value = "City对象", description = "城市") +public class City implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "城市主键ID") + @TableField("cityId") + private Integer cityId; + + @ApiModelProperty(value = "城市名称") + @TableField("cityName") + private String cityName; + + @ApiModelProperty(value = "绑定省份ID") + @TableField("provinceId") + private Integer provinceId; + + @ApiModelProperty(value = "是否删除(0、为删除 1、已删除)") + private Integer isdel; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/Class.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/Class.java new file mode 100644 index 0000000..d7d576f --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/Class.java @@ -0,0 +1,54 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 班级表 + *

+ * + * @author lr + * @since 2021-08-18 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_class") +@ApiModel(value = "Class对象", description = "班级表") +public class Class implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "班级名称") + private String className; + + @ApiModelProperty(value = "学生架构id(ol_architecture表)") + private Integer architectureId; + + @TableLogic + @ApiModelProperty(value = "是否删除(0、未删除 1、已删除)") + private Integer isDel; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "备注") + private String remark; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/ClientManagement.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/ClientManagement.java new file mode 100644 index 0000000..0bb1410 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/ClientManagement.java @@ -0,0 +1,62 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 企业端客户管理 + *

+ * + * @author lr + * @since 2021-08-10 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_client_management") +@ApiModel(value="ClientManagement对象", description="企业端客户管理") +public class ClientManagement implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "客户名称") + private String clientName; + + @ApiModelProperty(value = "省份id") + private Integer provinceId; + + @ApiModelProperty(value = "城市id") + private Integer cityId; + + @ApiModelProperty(value = "联系人姓名") + private String contactPersonName; + + @ApiModelProperty(value = "手机号") + private String phone; + + @ApiModelProperty(value = "省份名称") + private String provinceName; + + @ApiModelProperty(value = "城市名称") + private String cityName; + + @ApiModelProperty(value = "客户类型") + private Integer type; + + @ApiModelProperty(value = "是否禁用(0、未禁用 1、已禁用)") + private Integer isDisable; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/Column.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/Column.java new file mode 100644 index 0000000..328739a --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/Column.java @@ -0,0 +1,72 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + *

+ * 栏目表 + *

+ * + * @author lr + * @since 2021-08-10 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_column") +@ApiModel(value = "Column对象", description = "栏目表") +public class Column implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "栏目id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "父栏目id,一级栏目的父id是0", example = "0") + private Integer parentId; + + @ApiModelProperty(value = "栏目名称", example = "测试栏目") + private String name; + + @ApiModelProperty(value = "排序号", example = "0") + private Integer sort; + + @ApiModelProperty(value = "层级", example = "0") + private Integer level; + + @ApiModelProperty(value = "平台id", example = "3") + private Integer platformId; + + @ApiModelProperty(value = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "是否删除") + @TableLogic(value = "0",delval = "1") + private Integer isDel; + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + @ApiModelProperty(value = "子级") + @TableField(exist = false) + private List children; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/Contest.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/Contest.java new file mode 100644 index 0000000..4c3cdfd --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/Contest.java @@ -0,0 +1,125 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; + +import java.io.Serializable; +import java.util.List; + +import com.huoran.occupationlab.entity.resp.ContestRangeResp; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 竞赛管理表 + *

+ * + * @author lr + * @since 2021-08-10 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_contest") +@ApiModel(value = "Contest对象", description = "竞赛管理表") +public class Contest implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.ID_WORKER_STR) + private String id; + + @ApiModelProperty(value = "创建人Id", example = "1") + private String founderId; + + @ApiModelProperty(value = "创建人名称", example = "张三李四王五") + private String founderName; + + @ApiModelProperty(value = "竞赛名称", example = "数据库数据库色即是空") + private String name; + + @ApiModelProperty(value = "竞赛封面图", example = "http://localhost:9400/occupationlab/doc.html") + private String coverUrl; + + @ApiModelProperty(value = "竞赛轮播图", example = "http://localhost:9400/occupationlab/doc.html") + private String carouselUrl; + + @ApiModelProperty(value = "主办方", example = "或然科技") + private String sponsor; + + @ApiModelProperty(value = "承办方", example = "或然科技") + private String undertaker; + + @ApiModelProperty(value = "竞赛描述", example = "或然科技赛事") + private String description; + + @ApiModelProperty(value = "发布状态(0未发布,1已发布)", example = "0") + private Integer publishStatus; + + + @ApiModelProperty(value = "竞赛开始时间", example = "2021-09-09 16:24:24") + private Date playStartTime; + + @ApiModelProperty(value = "竞赛结束时间", example = "2021-09-20 16:24:24") + private Date playEndTime; + + @ApiModelProperty(value = "报名开始时间", example = "2021-09-10 16:24:24") + private Date signUpStartTime; + + @ApiModelProperty(value = "报名结束时间", example = "2021-09-20 16:24:24") + private Date signUpEndTime; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "学校id", example = "0") + private Integer schoolId; + + + @ApiModelProperty(value = "平台来源(0:中台,1:职站)", example = "0") + private Integer platformSource; + + @ApiModelProperty(value = "大赛范围(0:本校内 1:全平台 2:指定区域、院校)", example = "0") + private Integer competitionScope; + + + @ApiModelProperty(value = "中台是否开启(0开启 1未开启 默认0)", example = "0") + private Integer ztOpen; + + @ApiModelProperty(value = "是否开启(0开启 1未开启 默认0)", example = "0") + private Integer isOpen; + + + @ApiModelProperty(value = "赛事附件") + @TableField(exist = false) + private List contestAnnexList; + + + @ApiModelProperty(value = "大赛范围选择") + @TableField(exist = false) + private List contestRangeList; + + + + @ApiModelProperty(value = "比赛范围") + @TableField(exist = false) + private String range; + + @ApiModelProperty(value = "比赛范围(省市学校集合)") + @TableField(exist = false) + private List contestRangeRespList; + /* @ApiModelProperty(value = "学生参加状态(0未发布,1已发布)", example = "0") + @TableField(exist = false) + private Integer stuStatus;*/ +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/ContestAnnex.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/ContestAnnex.java new file mode 100644 index 0000000..dfd59fd --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/ContestAnnex.java @@ -0,0 +1,56 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 赛事附件 + *

+ * + * @author lr + * @since 2022-06-16 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_contest_annex") +@ApiModel(value="ContestAnnex对象", description="赛事/公告附件") +public class ContestAnnex implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "竞赛附件主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "大赛主键(ol_contest表主键)") + private String contestId; + + @ApiModelProperty(value = "文件名称") + private String fileName; + + @ApiModelProperty(value = "文件路径") + private String filePath; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "是否删除(默认0 1为已删除)") + @TableLogic + private Integer isDel; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/ContestAnnouncement.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/ContestAnnouncement.java new file mode 100644 index 0000000..6b1c62d --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/ContestAnnouncement.java @@ -0,0 +1,76 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; +import java.io.Serializable; +import java.util.List; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 赛事公告 + *

+ * + * @author lr + * @since 2022-06-17 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_contest_announcement") +@ApiModel(value="ContestAnnouncement对象", description="赛事公告") +public class ContestAnnouncement implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "竞赛公告主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "大赛主键(ol_contest表主键)") + private String contestId; + + @ApiModelProperty(value = "公告标题") + private String announcementTitle; + + @ApiModelProperty(value = "公告正文") + private String announcementText; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "是否删除(默认0 1为已删除)") + @TableLogic + private Integer isDel; + + @ApiModelProperty(value = "创建人id") + private Integer accountId; + + @ApiModelProperty(value = "0草稿 1为已发布") + private Integer status; + + @ApiModelProperty(value = "是否开启(0开启 1未开启 默认0)") + private Integer isOpen; + + + @ApiModelProperty(value = "创建人(列表展示)") + @TableField(exist = false) + private String founderName; + + @ApiModelProperty(value = "大赛公告附件存储集合") + @TableField(exist = false) + private List announcementAnnexList; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/ContestAnnouncementAnnex.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/ContestAnnouncementAnnex.java new file mode 100644 index 0000000..16d9b1d --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/ContestAnnouncementAnnex.java @@ -0,0 +1,63 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; +import java.io.Serializable; +import java.util.List; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 大赛公告附件存储 + *

+ * + * @author lr + * @since 2022-06-17 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_contest_announcement_annex") +@ApiModel(value = "大赛公告附件存储", description = "大赛公告附件存储") +public class ContestAnnouncementAnnex implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "竞赛附件主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "大赛公告主键(ol_contest_announcement表主键)") + private String announcementId; + + @ApiModelProperty(value = "文件名称") + private String fileName; + + @ApiModelProperty(value = "文件路径") + private String filePath; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "是否删除(默认0 1为已删除)") + @TableLogic + private Integer isDel; + + + @ApiModelProperty(value = "是否删除(默认0 1为已删除)") + @TableField(exist = false) + List contestAnnouncementAnnexList; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/ContestProgress.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/ContestProgress.java new file mode 100644 index 0000000..035b0ff --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/ContestProgress.java @@ -0,0 +1,58 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; + +import java.util.Date; + +import com.baomidou.mybatisplus.annotation.TableId; + +import java.io.Serializable; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 竞赛进展表 + *

+ * + * @author lr + * @since 2021-08-10 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_contest_progress") +@ApiModel(value = "ContestProgress对象", description = "竞赛进展表") +public class ContestProgress implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.ID_WORKER_STR) + private String id; + + @ApiModelProperty(value = "竞赛进展标题", example = "竞赛进展标题") + private String title; + + @ApiModelProperty(value = "竞赛主键Id", example = "1") + private String contestId; + + @ApiModelProperty(value = "竞赛进展状态(0未完成,1进行中,2已完成)", example = "0") + private Integer status; + + @ApiModelProperty(value = "竞赛进展描述", example = "竞赛进展描述") + private String description; + + @ApiModelProperty(value = "创建时间") + private Date gmtCreate; + + @ApiModelProperty(value = "修改时间") + private Date gmtModified; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/ContestRange.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/ContestRange.java new file mode 100644 index 0000000..6bb87bf --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/ContestRange.java @@ -0,0 +1,53 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; + +import java.io.Serializable; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * + *

+ * + * @author lr + * @since 2022-06-16 + */ +@Data +@ApiModel(value = "大赛范围选择") +@TableName("ol_contest_range") +public class ContestRange implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "主键") + private Integer id; + + @ApiModelProperty(value = "竞赛主键") + private String contestId; + + @ApiModelProperty(value = "省") + private String provinceId; + + @ApiModelProperty(value = "市") + private String cityId; + + @ApiModelProperty(value = "学校id") + private String schoolId; + + @ApiModelProperty(value = "范围类型(0为学校 1为地区)") + private Integer type; + + @ApiModelProperty(value = "是否删除(默认0 ,1为已删除)") + @TableLogic + private Integer isDel; +} \ No newline at end of file diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/Course.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/Course.java new file mode 100644 index 0000000..8834c27 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/Course.java @@ -0,0 +1,64 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 企业课程表 + *

+ * + * @author lr + * @since 2021-08-10 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_course") +@ApiModel(value = "Course对象", description = "企业课程表") +public class Course implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "课程ID") + @TableId(value = "id", type = IdType.ID_WORKER_STR) + private String id; + + @ApiModelProperty(value = "课程名称") + private String name; + + @ApiModelProperty(value = "课程封面图片路径") + private String coverUrl; + + @ApiModelProperty(value = "创建人ID") + private String founderId; + + @ApiModelProperty(value = "创建人名称") + private String founderName; + + @ApiModelProperty(value = "课程类别ID") + private String classificationId; + + @ApiModelProperty(value = "是否启用(0启用,1未启用)") + private Integer isEnable; + + @ApiModelProperty(value = "课程描述") + private String description; + + @ApiModelProperty(value = "创建时间") + private Date gmtCreate; + + @ApiModelProperty(value = "更新时间") + private Date gmtModified; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/CourseChapter.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/CourseChapter.java new file mode 100644 index 0000000..391657c --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/CourseChapter.java @@ -0,0 +1,55 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; + +import java.util.Date; + +import com.baomidou.mybatisplus.annotation.TableId; + +import java.io.Serializable; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 企业课程章节表 + *

+ * + * @author lr + * @since 2021-08-10 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_course_chapter") +@ApiModel(value = "CourseChapter对象", description = "企业课程章节表") +public class CourseChapter implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "章节ID") + @TableId(value = "id", type = IdType.ID_WORKER_STR) + private String id; + + @ApiModelProperty(value = "章节名称", example = "章节名称") + private String name; + + @ApiModelProperty(value = "课程ID", example = "1436155708163129346") + private String courseId; + + @ApiModelProperty(value = "显示排序", example = "0") + private Integer sort; + + @ApiModelProperty(value = "创建时间") + private Date gmtCreate; + + @ApiModelProperty(value = "更新时间") + private Date gmtModified; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/CourseClassification.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/CourseClassification.java new file mode 100644 index 0000000..28d85a6 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/CourseClassification.java @@ -0,0 +1,45 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import java.util.Date; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 企业课程分类表 + *

+ * + * @author lr + * @since 2021-08-10 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_course_classification") +@ApiModel(value="CourseClassification对象", description="企业课程分类表") +public class CourseClassification implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "课程类别ID") + @TableId(value = "id", type = IdType.ID_WORKER_STR) + private String id; + + @ApiModelProperty(value = "类别名称") + private String name; + + @ApiModelProperty(value = "创建时间") + private Date gmtCreate; + + @ApiModelProperty(value = "更新时间") + private Date gmtModified; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/CourseSubsection.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/CourseSubsection.java new file mode 100644 index 0000000..2312ef9 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/CourseSubsection.java @@ -0,0 +1,70 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 企业课程小节表 + *

+ * + * @author lr + * @since 2021-08-10 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_course_subsection") +@ApiModel(value = "CourseSubsection对象", description = "企业课程小节表") +public class CourseSubsection implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "小节ID") + @TableId(value = "id", type = IdType.ID_WORKER_STR) + private String id; + + @ApiModelProperty(value = "小节名称", example = "2021年9月10日11:13:22") + private String name; + + @ApiModelProperty(value = "课程ID", example = "1436155708163129346") + private String courseId; + + @ApiModelProperty(value = "章节ID",example = "1436155708163124569") + private String chapterId; + + @ApiModelProperty(value = "资源文件ID") + private String fileId; + + @ApiModelProperty(value = "文件存储路径") + private String fileUrl; + + @ApiModelProperty(value = "资源文件类型") + private String fileType; + + @ApiModelProperty(value = "阿里云文件名称") + private String fileName; + + @ApiModelProperty(value = "原始文件名称") + private String originalFileName; + + @ApiModelProperty(value = "排序字段") + private Integer sort; + + @ApiModelProperty(value = "创建时间") + private Date gmtCreate; + + @ApiModelProperty(value = "更新时间") + private Date gmtModified; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/EduCourse.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/EduCourse.java new file mode 100644 index 0000000..354cb51 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/EduCourse.java @@ -0,0 +1,74 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 课程基本信息 + *

+ * + * @author lr + * @since 2021-08-10 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_edu_course") +@ApiModel(value = "EduCourse对象", description = "课程基本信息") +public class EduCourse implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "课程ID") + @TableId(value = "id", type = IdType.ID_WORKER_STR) + private String id; + + @ApiModelProperty(value = "课程名称", example = "电子竞技教学课程") + private String name; + + @ApiModelProperty(value = "课程封面图片路径", example = "www.baidu.com") + private String coverUrl; + + @ApiModelProperty(value = "学校id", example = "1", hidden = true) + private String schoolId; + + @ApiModelProperty(value = "创建人ID", example = "1", hidden = true) + private String founderId; + + @ApiModelProperty(value = "创建人名称", example = "刘怼怼") + private String founderName; + + @ApiModelProperty(value = "课程类别ID", example = "1436149119016452097") + private String classificationId; + + @ApiModelProperty(value = "是否启用(0启用,1未启用)", example = "0") + private Integer isEnable; + + @ApiModelProperty(value = "内置标识:1为内置课程,0为自己添加", example = "0") + @TableField(exist = false) + private Integer builtIn; + + @ApiModelProperty(value = "课程描述", example = "如果请求瞬间增多,超过最大处理请求,会导致系统奔溃。加以限制,让系统慢慢处理,就可以缓解请求突增的情况。") + private String description; + + @ApiModelProperty(value = "创建时间") + private Date gmtCreate; + + @ApiModelProperty(value = "更新时间") + private Date gmtModified; + + @ApiModelProperty(value = "区分标识:1为企业端课程,0为管理端课程", example = "0") + private Integer distinguish; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/EduCourseChapter.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/EduCourseChapter.java new file mode 100644 index 0000000..a80759b --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/EduCourseChapter.java @@ -0,0 +1,51 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import java.util.Date; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 课程章节 + *

+ * + * @author lr + * @since 2021-08-10 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_edu_course_chapter") +@ApiModel(value="EduCourseChapter对象", description="课程章节") +public class EduCourseChapter implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "章节ID") + @TableId(value = "id", type = IdType.ID_WORKER_STR) + private String id; + + @ApiModelProperty(value = "章节名称") + private String name; + + @ApiModelProperty(value = "课程ID") + private String courseId; + + @ApiModelProperty(value = "显示排序") + private Integer sort; + + @ApiModelProperty(value = "创建时间") + private Date gmtCreate; + + @ApiModelProperty(value = "更新时间") + private Date gmtModified; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/EduCourseClassification.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/EduCourseClassification.java new file mode 100644 index 0000000..694a4c2 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/EduCourseClassification.java @@ -0,0 +1,53 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 课程类别 + *

+ * + * @author lr + * @since 2021-08-10 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_edu_course_classification") +@ApiModel(value = "EduCourseClassification对象", description = "课程类别") +public class EduCourseClassification implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "课程类别ID") + @TableId(value = "id", type = IdType.ID_WORKER_STR) + private String id; + + @ApiModelProperty(value = "类别名称") + private String name; + + @ApiModelProperty(value = "区分标识:1为企业端分类,0为管理端分类") + private Integer distinguish; + + @ApiModelProperty(value = "创建时间") + private Date gmtCreate; + + @ApiModelProperty(value = "更新时间") + private Date gmtModified; + + @TableField(exist = false) + private Integer schoolId; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/EduCourseSubsection.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/EduCourseSubsection.java new file mode 100644 index 0000000..d98d247 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/EduCourseSubsection.java @@ -0,0 +1,69 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import java.util.Date; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 课程小节 + *

+ * + * @author lr + * @since 2021-08-10 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_edu_course_subsection") +@ApiModel(value="EduCourseSubsection对象", description="课程小节") +public class EduCourseSubsection implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "小节ID") + @TableId(value = "id", type = IdType.ID_WORKER_STR) + private String id; + + @ApiModelProperty(value = "小节名称") + private String name; + + @ApiModelProperty(value = "课程ID") + private String courseId; + + @ApiModelProperty(value = "章节ID") + private String chapterId; + + @ApiModelProperty(value = "资源文件ID") + private String fileId; + + @ApiModelProperty(value = "文件存储路径") + private String fileUrl; + + @ApiModelProperty(value = "资源文件类型") + private String fileType; + + @ApiModelProperty(value = "阿里云文件名称") + private String fileName; + + @ApiModelProperty(value = "原始文件名称") + private String originalFileName; + + @ApiModelProperty(value = "排序字段") + private Integer sort; + + @ApiModelProperty(value = "创建时间") + private Date gmtCreate; + + @ApiModelProperty(value = "更新时间") + private Date gmtModified; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/EntrepreneurialActivity.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/EntrepreneurialActivity.java new file mode 100644 index 0000000..7007074 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/EntrepreneurialActivity.java @@ -0,0 +1,117 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * @描述:创业活动管理表 + * @作者: Rong + * @日期: 2023-04-27 + */ +@Data +@ApiModel(value = "创业活动管理表") +@TableName("ol_entrepreneurial_activity") +public class EntrepreneurialActivity implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "主键") + private Integer id; + + @ApiModelProperty(value = "创建人id") + private Integer accountId; + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + @ApiModelProperty(value = "创建人角色(0、系统 1、老师 2、学生)") + private Integer founder; + + @ApiModelProperty(value = "发布状态(默认0、草稿箱 1、已发布)") + private Integer publishStatus; + + @ApiModelProperty(value = "项目名称") + private String projectName; + + @ApiModelProperty(value = "发起人(可多选,用逗号隔开)") + private String initiator; + + @ApiModelProperty(value = "项目封面图") + private String coverUrl; + + @ApiModelProperty(value = "项目轮播图") + private String carouselUrl; + + @ApiModelProperty(value = "项目开始时间") + private Date playStartTime; + + @ApiModelProperty(value = "项目结束时间") + private Date playEndTime; + + @ApiModelProperty(value = "报名开始时间") + private Date signUpStartTime; + + @ApiModelProperty(value = "报名结束时间") + private Date signUpEndTime; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "是否开启(0开启 1未开启 默认0)") + private Integer isOpen; + + @ApiModelProperty(value = "用于教师端控制学生端是否开启(0开启 1未开启 默认0)") + private Integer schoolOpen; + + @ApiModelProperty(value = "项目描述") + private String projectDescribe; + + @ApiModelProperty(value = "邀请码") + private String invitationCode; + + @ApiModelProperty(value = "是否需要邀请码(0不需要,1需要)默认为0") + private Integer isNeedCode; + + @ApiModelProperty(value = "报名人数限制(0表示不限制)默认为0") + private Integer maximumNumber; + + @ApiModelProperty(value = "是否删除(0、未删除 1、已删除 默认0)") + @TableLogic(value = "0", delval = "1") + private Integer isDel; + + + @ApiModelProperty(value = "活动附件") + @TableField(exist = false) + private List activityFileList; + + + @ApiModelProperty(value = "是否报名(0为已报名 1为未报名)", example = "0") + @TableField(exist = false) + private Integer whetherToSignUp; + + @ApiModelProperty(value = "取消报名传的id", example = "0") + @TableField(exist = false) + private Integer cancelId; + + + @ApiModelProperty(value = "是否收藏:(state = 1收藏,0:未收藏)") + @TableField(exist = false) + private Integer collectionStatus; + + + @ApiModelProperty(value = "收藏人数") + @TableField(exist = false) + private Integer collectorsNum; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/EntrepreneurialActivityAnnouncement.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/EntrepreneurialActivityAnnouncement.java new file mode 100644 index 0000000..5753866 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/EntrepreneurialActivityAnnouncement.java @@ -0,0 +1,69 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + *

+ * 活动公告表 + *

+ * + * @author lr + * @since 2023-05-12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_entrepreneurial_activity_announcement") +@ApiModel(value="EntrepreneurialActivityAnnouncement对象", description="活动公告表") +public class EntrepreneurialActivityAnnouncement implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "活动公告主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "活动主键(ol_entrepreneurial_activity表主键)") + private Integer activityId; + + @ApiModelProperty(value = "公告标题") + private String announcementTitle; + + @ApiModelProperty(value = "公告正文") + private String announcementText; + + @ApiModelProperty(value = "0草稿 1为已发布") + private Integer status; + + @ApiModelProperty(value = "是否开启(0开启 1未开启 默认0)") + private Integer isOpen; + + @ApiModelProperty(value = "创建人") + private Integer accountId; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "是否删除(默认0 1为已删除)") + @TableLogic + private Integer isDel; + + @ApiModelProperty(value = "大赛公告附件存储集合") + @TableField(exist = false) + private List announcementAnnexList; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/EntrepreneurialActivityAnnouncementAnnex.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/EntrepreneurialActivityAnnouncementAnnex.java new file mode 100644 index 0000000..1477153 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/EntrepreneurialActivityAnnouncementAnnex.java @@ -0,0 +1,56 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 活动公告附件表 + *

+ * + * @author lr + * @since 2023-05-12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_entrepreneurial_activity_announcement_annex") +@ApiModel(value="EntrepreneurialActivityAnnouncementAnnex对象", description="活动公告附件表") +public class EntrepreneurialActivityAnnouncementAnnex implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "活动附件主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "活动公告主键(ol_entrepreneurial_activity_announcement表主键)") + private Integer announcementId; + + @ApiModelProperty(value = "文件名称") + private String fileName; + + @ApiModelProperty(value = "文件路径") + private String filePath; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "是否删除(默认0 1为已删除)") + @TableLogic + private Integer isDel; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/EntrepreneurialActivityApplicant.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/EntrepreneurialActivityApplicant.java new file mode 100644 index 0000000..be60561 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/EntrepreneurialActivityApplicant.java @@ -0,0 +1,67 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 创业活动报名人员表 + *

+ * + * @author lr + * @since 2023-04-27 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_entrepreneurial_activity_applicant") +@ApiModel(value="EntrepreneurialActivityApplicant对象", description="创业活动报名人员表") +public class EntrepreneurialActivityApplicant implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "主键") + private Integer id; + + @ApiModelProperty(value = "报名账号id") + private Integer accountId; + + @ApiModelProperty(value = "活动主键Id") + private Integer activityId; + + @ApiModelProperty(value = "是否禁用(0未禁用,1禁用)") + private Integer isDisable; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + + + @ApiModelProperty(value = "报名邀请码") + @TableField(exist = false) + private String registrationInvitationCode; + + @ApiModelProperty(value = "是否需要邀请码(0不需要,1需要)默认为0") + @TableField(exist = false) + private Integer isNeedCode; + + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/EntrepreneurialActivityCollect.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/EntrepreneurialActivityCollect.java new file mode 100644 index 0000000..ea3aa24 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/EntrepreneurialActivityCollect.java @@ -0,0 +1,48 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import java.util.Date; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 活动收藏表 + *

+ * + * @author lr + * @since 2023-06-01 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_entrepreneurial_activity_collect") +@ApiModel(value="EntrepreneurialActivityCollect对象", description="活动收藏表") +public class EntrepreneurialActivityCollect implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "活动收藏id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "活动id") + private Integer activityId; + + @ApiModelProperty(value = "收藏时间") + private Date collectionTime; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/EntrepreneurialActivityFile.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/EntrepreneurialActivityFile.java new file mode 100644 index 0000000..ad188ef --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/EntrepreneurialActivityFile.java @@ -0,0 +1,56 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 创业活动附件存储 + *

+ * + * @author lr + * @since 2023-04-26 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_entrepreneurial_activity_file") +@ApiModel(value = "EntrepreneurialActivityFile对象", description = "创业活动附件存储") +public class EntrepreneurialActivityFile implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "创业活动附件主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "创业活动主键(ol_entrepreneurial_activity表主键)") + private Integer activityId; + + @ApiModelProperty(value = "文件名称") + private String fileName; + + @ApiModelProperty(value = "文件路径") + private String filePath; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "是否删除(默认0 1为已删除)") + @TableLogic + private Integer isDel; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/EntrepreneurialActivityProgress.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/EntrepreneurialActivityProgress.java new file mode 100644 index 0000000..1db73b4 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/EntrepreneurialActivityProgress.java @@ -0,0 +1,56 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 活动进展表 + *

+ * + * @author lr + * @since 2023-05-12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_entrepreneurial_activity_progress") +@ApiModel(value="EntrepreneurialActivityProgress对象", description="活动进展表") +public class EntrepreneurialActivityProgress implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "活动进展标题") + private String title; + + @ApiModelProperty(value = "活动主键Id(c_competition表主键)") + private Integer activityId; + + @ApiModelProperty(value = "活动进展状态(0未完成,1进行中,2已完成)") + private Integer status; + + @ApiModelProperty(value = "活动进展描述") + private String description; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/EvaluationFraction.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/EvaluationFraction.java new file mode 100644 index 0000000..94526cd --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/EvaluationFraction.java @@ -0,0 +1,44 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 记录用户能力测评的总分数 + *

+ * + * @author lr + * @since 2021-09-26 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_evaluation_fraction") +@ApiModel(value="EvaluationFraction对象", description="记录用户能力测评的总分数") +public class EvaluationFraction implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "绑定用户id") + private Integer accountId; + + @ApiModelProperty(value = "测评类型(1练习 2虚拟仿真实验 3教学实验 默认1)") + private Integer types; + + @ApiModelProperty(value = "总分数") + private Integer fraction; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/EvaluationQuestion.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/EvaluationQuestion.java new file mode 100644 index 0000000..2dd8145 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/EvaluationQuestion.java @@ -0,0 +1,62 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 测评试题表,记录每次测评的试题,与测评记录表相关联 + *

+ * + * @author lr + * @since 2021-09-26 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_evaluation_question") +@ApiModel(value="EvaluationQuestion对象", description="测评试题表,记录每次测评的试题,与测评记录表相关联") +public class EvaluationQuestion implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "自增主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "测评记录表id") + private Integer evaluationRecordId; + + @ApiModelProperty(value = "试题id") + private Integer questionId; + + @ApiModelProperty(value = "试题顺序号") + private Integer questionSortNo; + + @ApiModelProperty(value = "试题状态:是否已被作过:1、已作/0、未作") + private Integer questionStatus; + + @ApiModelProperty(value = "用户填写的答案") + private String userAnswer; + + @ApiModelProperty(value = "是否正确:1、正确/0、错误") + private Integer isTure; + + @ApiModelProperty(value = "试题分值") + private Integer questionPoints; + + @ApiModelProperty(value = "试题得分") + private Integer questionScore; + + @ApiModelProperty(value = "测评类型(0虚拟仿真实验,1教学实验)") + private Integer type; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/EvaluationRecord.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/EvaluationRecord.java new file mode 100644 index 0000000..7977693 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/EvaluationRecord.java @@ -0,0 +1,54 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import java.util.Date; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 记录用户测评信息 + *

+ * + * @author lr + * @since 2021-09-26 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_evaluation_record") +@ApiModel(value="EvaluationRecord对象", description="记录用户测评信息") +public class EvaluationRecord implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "自增主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "当前测评的用户的id") + private Integer accountId; + + @ApiModelProperty(value = "记录当前做到第几题,用于刷新页面以后保持在当前题目,默认开始时是第一题") + private Integer currentQuestionSortNo; + + @ApiModelProperty(value = "总题目数量") + private Integer totalQuestionNum; + + @ApiModelProperty(value = "当前测评状态:1:已提交/0:未提交") + private Integer evaluationStatus; + + @ApiModelProperty(value = "开始时间") + private Date startTime; + + @ApiModelProperty(value = "提交时间") + private Date submitTime; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/EvaluationRules.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/EvaluationRules.java new file mode 100644 index 0000000..cbe9853 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/EvaluationRules.java @@ -0,0 +1,63 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 测评规则信息记录,只记录一条信息 + *

+ * + * @author lr + * @since 2021-08-12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_evaluation_rules") +@ApiModel(value="EvaluationRules对象", description="测评规则信息记录,只记录一条信息") +public class EvaluationRules implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "测评类型:1:随机类型,0:自定义类型") + private Integer evaluationType; + + @ApiModelProperty(value = "测评时长,单位:分钟") + private Integer duration; + + @ApiModelProperty(value = "测评总题数") + private Integer questionNum; + + @ApiModelProperty(value = "单选题数") + private Integer singleNum; + + @ApiModelProperty(value = "只在类型为自定义类型时才启用:1:启用,0:不启用,默认1启用") + private Integer isSingleEnable; + + @ApiModelProperty(value = "多选题数") + private Integer multipleNum; + + @ApiModelProperty(value = "只在类型为自定义类型时才启用:1:启用,0:不启用,默认1启用") + private Integer isMultipleEnable; + + @ApiModelProperty(value = "判断题数") + private Integer judgmentNum; + + @ApiModelProperty(value = "只在类型为自定义类型时才启用:1:启用,0:不启用,默认1启用") + private Integer isJudgmentEnable; + + @ApiModelProperty(value = "学校id") + private Integer schoolId; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/ExperimentalReport.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/ExperimentalReport.java new file mode 100644 index 0000000..c7c5ec7 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/ExperimentalReport.java @@ -0,0 +1,145 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; + +import java.io.Serializable; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 存储各子系统的实验报告 + *

+ * + * @author lr + * @since 2021-09-08 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_experimental_report") +@ApiModel(value = "ExperimentalReport对象", description = "存储各子系统的实验报告") +public class ExperimentalReport implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "实验报告主键") + @TableId(value = "report_id", type = IdType.AUTO) + private Integer reportId; + + @ApiModelProperty(value = "项目管理id") + private Integer projectId; + + @ApiModelProperty(value = "班级id") + private Integer classId; + + @ApiModelProperty(value = "课程id(curriculum表主键)") + private Integer curriculumId; + + @ApiModelProperty(value = "考核id(当进入的实验为练习时本列为空)") + private Integer assessmentId; + + @ApiModelProperty(value = "学生账号id") + private Integer accountId; + + @ApiModelProperty(value = "用户名称 (学生姓名)") + @TableField(exist = false) + private String userName; + + @ApiModelProperty(value = "学号") + @TableField(exist = false) + private String workNumber; + + @ApiModelProperty(value = "实验原理") + private String principle; + + @ApiModelProperty(value = "实验内容") + private String content; + + @ApiModelProperty(value = "实验步骤") + private String step; + + @ApiModelProperty(value = "实验数据") + private String data; + + @ApiModelProperty(value = "实验分析") + private String analysis; + + @ApiModelProperty(value = "实验结论") + private String conclusion; + + @ApiModelProperty(value = "实验总结") + private String summarize; + + @ApiModelProperty(value = "实验器材") + private String equipment; + + @ApiModelProperty(value = "实验目的") + private String purpose; + + @ApiModelProperty(value = "对本实验过程方法及手段的改进建议") + private String improvement; + + @ApiModelProperty(value = "绑定教师评语id") + private Integer commentId; + + @ApiModelProperty(value = "教师评语") + private String comment; + + @ApiModelProperty(value = "绑定老师id") + private Integer teacherId; + + @ApiModelProperty(value = "老师名称") + @TableField(exist = false) + private String teacherName; + + @ApiModelProperty(value = "学时") + private String period; + + @ApiModelProperty(value = "实验室名称") + private String laboratory; + + @ApiModelProperty(value = "是否启用教师签名(0不启用,1启用,默认0)") + private Integer isSignature; + + @ApiModelProperty(value = "绑定教师签名id") + private Integer signatureId; + + @ApiModelProperty(value = "指导老师:(考核的自动读取发布考核的老师名称,可修改)") + private String instructor; + + @ApiModelProperty(value = "实验项目名称:(自动读取,可修改)") + private String projectName; + + @ApiModelProperty(value = "学生班级:(自动读取学生班级,可修改)") + private String className; + + @ApiModelProperty(value = "得分") + private Integer score; + + @ApiModelProperty(value = "进入时间") + private Date startTime; + + @ApiModelProperty(value = "结束时间") + private Date endTime; + + @ApiModelProperty(value = "提交时间") + private Date submitTime; + + @ApiModelProperty(value = "耗时") + private Integer timeSum; + + @ApiModelProperty(value = "是否删除(0未删除1已删除 默认0)") + @TableLogic + private Integer isDel; + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/HrProject.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/HrProject.java new file mode 100644 index 0000000..b5f0da4 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/HrProject.java @@ -0,0 +1,27 @@ +package com.huoran.occupationlab.entity; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +/** + * @description 爬虫迁移程序使用 其他地方勿用 + * @author: Mr.JK + * @create: 2021-10-20 10:36 + **/ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +public class HrProject { + + private String projectName; + private Integer projectPermissions; + private Integer state; + private String experimentalGoal; + private String caseDescription; + private String experimentSuggests; + private Integer experimentIntroductionIsEnable; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/HrScore.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/HrScore.java new file mode 100644 index 0000000..c9a109b --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/HrScore.java @@ -0,0 +1,22 @@ +package com.huoran.occupationlab.entity; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +/** + * @description 爬虫迁移程序使用 其他地方勿用 + * @author: Mr.JK + * @create: 2021-10-20 10:41 + **/ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +public class HrScore { + + private String judgmentPointsName; + private Integer score; + private String experimentalRequirements; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/HrUserInfo.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/HrUserInfo.java new file mode 100644 index 0000000..7dd5edd --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/HrUserInfo.java @@ -0,0 +1,129 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableField; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 用户信息表 + *

+ * + * @author lr + * @since 2021-08-10 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_hr_user_info") +@ApiModel(value="HrUserInfo对象", description="用户信息表") +public class HrUserInfo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "用户id") + @TableId(value = "userId", type = IdType.AUTO) + private Integer userId; + + @ApiModelProperty(value = "用户姓名") + @TableField("userName") + private String userName; + + @ApiModelProperty(value = "唯一标识账号") + @TableField("uniqueIdentificationAccount") + private String uniqueIdentificationAccount; + + @ApiModelProperty(value = "证件类型(1、身份证)") + @TableField("documentType") + private Integer documentType; + + @ApiModelProperty(value = "证件号码") + @TableField("IDNumber") + private String IDNumber; + + @ApiModelProperty(value = "绑定省份id") + @TableField("provinceId") + private Integer provinceId; + + @ApiModelProperty(value = "绑定城市id") + @TableField("cityId") + private Integer cityId; + + @ApiModelProperty(value = "国家归属地") + private String countries; + + @ApiModelProperty(value = "出生日期") + @TableField("dateBirth") + private String dateBirth; + + @ApiModelProperty(value = "教育程度") + @TableField("educationDegree") + private Integer educationDegree; + + @ApiModelProperty(value = "绑定客户id") + @TableField("clientId") + private Integer clientId; + + @ApiModelProperty(value = "客户名称") + @TableField("clientName") + private String clientName; + + @ApiModelProperty(value = "电话") + private String phone; + + @ApiModelProperty(value = "微信号") + @TableField("weChatID") + private String weChatID; + + @ApiModelProperty(value = "邮箱") + private String email; + + @ApiModelProperty(value = "账号") + private String account; + + @ApiModelProperty(value = "密码") + private String password; + + @ApiModelProperty(value = "创建时间") + @TableField("creationTime") + private String creationTime; + + @ApiModelProperty(value = "登陆次数") + @TableField("logInNumber") + private Integer logInNumber; + + @ApiModelProperty(value = "性别(1、男 2、女)") + private Integer sex; + + @ApiModelProperty(value = "用户头像路径") + @TableField("userAvatars") + private String userAvatars; + + @ApiModelProperty(value = "是否删除(0、未删除 1、已删除)") + private Integer isdel; + + @ApiModelProperty(value = "最后登陆时间") + @TableField("lastLoginTime") + private String lastLoginTime; + + @ApiModelProperty(value = "绑定角色id") + @TableField("roleId") + private String roleId; + + @ApiModelProperty(value = "禁用状态(0未禁用1已禁用默认0)") + @TableField("disableAccount") + private Integer disableAccount; + + @ApiModelProperty(value = "端口(1、企业端 2、管理端)") + @TableField("isPort") + private Integer isPort; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/ImportStaff.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/ImportStaff.java new file mode 100644 index 0000000..846de54 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/ImportStaff.java @@ -0,0 +1,76 @@ +package com.huoran.occupationlab.entity; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + *

+ * 员工表 + *

+ * + * @author Ning + * @since 2020-10-21 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "导入Staff对象", description = "导入员工") +public class ImportStaff implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "员工主键ID") + private Integer staffId; + + @ApiModelProperty(value = "用户账号") + private String account; + + @ApiModelProperty(value = "用户姓名") + private String userName; + + @ApiModelProperty(value = "员工工号") + private String workNumber; + + @ApiModelProperty(value = "绑定角色ID") + private String roleId; + + @ApiModelProperty(value = "绑定角色名称") + private String roleName; + + @ApiModelProperty(value = "绑定客户id") + private Integer clientId; + + @ApiModelProperty(value = "绑定客户名称") + private String clientName; + + @ApiModelProperty(value = "绑定用户Id") + private Integer userId; + + @ApiModelProperty(value = "绑定手机号") + private String phone; + + @ApiModelProperty(value = "绑定邮箱") + private String email; + + @ApiModelProperty(value = "唯一标识账号") + private String uniqueIdentificationAccount; + + @ApiModelProperty(value = "员工年级Id") + private Integer staffGradeId; + + @ApiModelProperty(value = "员工组织架构Id") + private Integer staffProfessionalArchitectureId; + + @ApiModelProperty(value = "员工年级名称") + private String staffGradeName; + + @ApiModelProperty(value = "员工组织架构名称") + private String staffProfessionalArchitectureName; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/ImportStudent.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/ImportStudent.java new file mode 100644 index 0000000..8378817 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/ImportStudent.java @@ -0,0 +1,60 @@ +package com.huoran.occupationlab.entity; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + *

+ * 学生表 + *

+ * + * @author Ning + * @since 2020-10-21 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "导入Student对象", description = "导入学生表") +public class ImportStudent implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "学生主键ID") + private Integer studentId; + + @ApiModelProperty(value = "用户账号") + private String account; + + @ApiModelProperty(value = "用户姓名") + private String userName; + + @ApiModelProperty(value = "学生学号") + private String workNumber; + + @ApiModelProperty(value = "绑定角色ID") + private Integer roleId; + + @ApiModelProperty(value = "绑定客户id") + private Integer clientId; + + @ApiModelProperty(value = "绑定客户名称") + private String clientName; + + @ApiModelProperty(value = "绑定用户Id") + private Integer userId; + + @ApiModelProperty(value = "绑定手机号") + private String phone; + + @ApiModelProperty(value = "绑定邮箱") + private String email; + + @ApiModelProperty(value = "唯一标识账号") + private String uniqueIdentificationAccount; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/LcJudgmentRule.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/LcJudgmentRule.java new file mode 100644 index 0000000..b3d2bc7 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/LcJudgmentRule.java @@ -0,0 +1,67 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 流程类判分点规则表 + *

+ * + * @author Mr.JK + * @since 2021-08-13 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="LcJudgmentRule对象", description="流程类判分点规则表") +public class LcJudgmentRule implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键id") + private Integer id; + + @ApiModelProperty(value = "操作id串") + private String operationIds; + + @ApiModelProperty(value = "题目类型(1选择 2判断 3填空 4问答 5指标结果)") + private String type; + + @ApiModelProperty(value = "流程类判分点id") + private Integer lcId; + + @ApiModelProperty(value = "选项id") + private Integer itemId; + + @ApiModelProperty(value = "空格一",notes = "选择题、判断题、填空题、指标结果填subject_id,、问答题填需要字段") + private String emptyOne; + + @ApiModelProperty(value = "空格二",notes = "选择题、判断题填item_id,填空题、问答题、指标结果填需要字段") + private String emptyTwo; + + @ApiModelProperty(value = "结果运算符(0为与 1为或 默认0)") + private Integer resultOperation; + + @ApiModelProperty(value = "规则运算符(0为与 1为或 默认0)") + private Integer ruleOperation; + + @ApiModelProperty(value = "是否删除(0 未删除 1已删除 默认0)") + @TableLogic(value = "0",delval = "1") + private Integer isDel; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/PlayRecord.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/PlayRecord.java new file mode 100644 index 0000000..fbb6a9e --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/PlayRecord.java @@ -0,0 +1,62 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 资源播放记录表 + *

+ * + * @author lr + * @since 2022-09-09 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_play_record") +@ApiModel(value = "PlayRecord对象", description = "资源播放记录表") +public class PlayRecord implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "课程类型(0:课程管理 1:理论课程)") + @NotNull(message = "课程类型不能为空!") + private Integer courseType; + + @ApiModelProperty(value = "课程id") + @NotNull(message = "课程id不能为空!") + private Integer courseId; + + @ApiModelProperty(value = "播放时长(分钟,不满1分钟视为1分钟)") + @NotNull(message = "播放时长不能为空!") + private Integer playTime; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + + @ApiModelProperty(value = "生成次数") + @TableField(exist = false) + private Integer num; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/ProjectHidden.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/ProjectHidden.java new file mode 100644 index 0000000..a3653d8 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/ProjectHidden.java @@ -0,0 +1,47 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import java.util.Date; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 此表是在教师端成绩管理,虚仿以及教学列表展示中使用到 + *

+ * + * @author lr + * @since 2021-09-23 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_project_hidden") +@ApiModel(value="ProjectHidden对象", description="此表是在教师端成绩管理,虚仿以及教学列表展示中使用到") +public class ProjectHidden implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "项目id(对应hr_project_management主键)") + private Integer projectId; + + @ApiModelProperty(value = "考核id(ol_assessment主键)") + private Integer teachId; + + @ApiModelProperty(value = "是否隐藏(0不隐藏,1隐藏)") + private Integer isHidden; + + private Date updateTime; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/ProjectJudgment.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/ProjectJudgment.java new file mode 100644 index 0000000..3da1bba --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/ProjectJudgment.java @@ -0,0 +1,63 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; + +/** + *

+ * 项目管理判分点绑定表 + *

+ * + * @author Mr.JK + * @since 2021-08-26 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_project_judgment") +@ApiModel(value="ProjectJudgment对象", description="项目管理判分点绑定表") +public class ProjectJudgment implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "分数") + private Integer score; + + @ApiModelProperty(value = "项目id") + private Integer projectId; + + @ApiModelProperty(value = "判分点id(编程与流程)系统id为11时,是流程类") + @NotNull(message = "判分点id不能为空!") + private Integer judgmentId; + + @ApiModelProperty(value = "排序顺序") + @NotNull(message = "排序不能为空") + private Integer sort; + + @ApiModelProperty(value = "是否删除(0未删除 1已删除 默认0)") + @TableLogic(value = "0",delval = "1") + private Integer isDel; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/ProjectManage.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/ProjectManage.java new file mode 100644 index 0000000..0dada4c --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/ProjectManage.java @@ -0,0 +1,142 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 项目管理表 + *

+ * + * @author Mr.JK + * @since 2021-08-26 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_project_manage") +@ApiModel(value = "ProjectManage对象", description = "项目管理表") +public class ProjectManage implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键id") + @TableId(value = "project_id", type = IdType.AUTO) + private Integer projectId; + + @ApiModelProperty(value = "项目名称") + @NotBlank(message = "项目名称不能为空!") + private String projectName; + + @ApiModelProperty(value = "项目权限(0、练习 1、考核 2、竞赛)") + @NotNull(message = "项目权限不能为空!") + private Integer permissions; + + @ApiModelProperty(value = "系统id") + @NotNull(message = "系统id不能为空!") + private Integer systemId; + + @ApiModelProperty(value = "系统名称") + @TableField(exist = false) + private String systemName; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + @ApiModelProperty(value = "创建人角色(0、系统 1、院校)") + @NotNull(message = "创建人角色不能为空!") + private Integer founder; + + + @ApiModelProperty(value = "创建人") + @TableField(exist = false) + private String creator; + + + @ApiModelProperty(value = "状态(0、草稿箱 1、已发布)") + @NotNull(message = "状态不能为空!") + private Integer state; + + @ApiModelProperty(value = "系统类型(0编程类 1流程类)") + @TableField(exist = false) + private Integer type; + + @ApiModelProperty(value = "实验目标") + private String experimentTarget; + + @ApiModelProperty(value = "实验描述") + private String experimentDescription; + + @ApiModelProperty(value = "实验提示") + private String experimentHint; + + @ApiModelProperty(value = "实验提示是否开启(0开启 1不开启 默认0)") + private Integer hintOpen; + + @ApiModelProperty(value = "学校实验提示是否开启(0开启 1不开启)") + @TableField(exist = false) + private Integer hintOpenBySchool; + + @ApiModelProperty(value = "是否开启(0开启 1未开启 默认0)") + private Integer isOpen; + + @ApiModelProperty(value = "中台是否开启(0开启 1未开启 默认0)") + private Integer ztOpen; + + @ApiModelProperty(value = "是否删除(0、未删除 1、已删除 默认0)") + @TableLogic(value = "0", delval = "1") + private Integer isDel; + + @ApiModelProperty(value = "中台是否删除(0未删除 1已删除 默认0)") + private Integer ztDel; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "是否为管理员发布 0否 1是") + @TableField(exist = false) + private Integer isAdminRelease; + + @ApiModelProperty(value = "学校名称") + @TableField(exist = false) + private String schoolName; + + @ApiModelProperty(value = "职站是否禁用启用(0启用 1已禁用)") + @TableField(exist = false) + private Integer ccupationlabOpen; + + @ApiModelProperty(value = "创建人") + @TableField(exist = false) + private String createUser; + + @ApiModelProperty(value = "项目发布人角色") + @TableField(exist = false) + private String roleName; + + @ApiModelProperty(value = "备注") + private String remark; + + + @ApiModelProperty(value = "商品id") + private Integer mallId; + + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/ProjectManageDisable.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/ProjectManageDisable.java new file mode 100644 index 0000000..6f26b52 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/ProjectManageDisable.java @@ -0,0 +1,52 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 记录项目学校端的禁用记录 + *

+ * + * @author lr + * @since 2022-01-12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_project_manage_disable") +@ApiModel(value = "ProjectManageDisable对象", description = "记录项目学校端的禁用记录") +public class ProjectManageDisable implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + @ApiModelProperty(value = "项目id") + private Integer projectId; + + @ApiModelProperty(value = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/Province.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/Province.java new file mode 100644 index 0000000..6f2e33b --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/Province.java @@ -0,0 +1,43 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableField; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 省份表 + *

+ * + * @author lr + * @since 2021-08-10 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_province") +@ApiModel(value="Province对象", description="省份表") +public class Province implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "省份主键ID") + @TableId(value = "provinceId", type = IdType.AUTO) + private Integer provinceId; + + @ApiModelProperty(value = "省份名称") + @TableField("provinceName") + private String provinceName; + + @ApiModelProperty(value = "是否删除(0、为删除 1、已删除)") + private Integer isdel; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/PythonFileData.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/PythonFileData.java new file mode 100644 index 0000000..321fd13 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/PythonFileData.java @@ -0,0 +1,70 @@ +package com.huoran.occupationlab.entity; + +import cn.afterturn.easypoi.excel.annotation.ExcelTarget; +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; + +import java.io.Serializable; + +import com.huoran.common.utils.PageUtils; +import com.huoran.occupationlab.entity.req.PageReq; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * + *

+ * + * @author lr + * @since 2022-04-06 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "PythonFileData对象", description = "") +public class PythonFileData implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "主键") + private Integer id; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + @ApiModelProperty(value = "文件名") + private String fileName; + + @ApiModelProperty(value = "文件大小") + private String fileSize; + + @ApiModelProperty(value = "文件格式") + private String fileFormat; + + @ApiModelProperty(value = "文件路径") + private String filePath; + + @ApiModelProperty(value = "oss文件名") + private String ossFileName; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "当前页数", name = "pageNum", example = "1", required = true, hidden = true) + @TableField(exist = false) + private Integer pageNum; + @ApiModelProperty(value = "当前页需要显示的数量", name = "pageSize", example = "10", required = true, hidden = true) + @TableField(exist = false) + private Integer pageSize; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/PythonRunCode.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/PythonRunCode.java new file mode 100644 index 0000000..795484d --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/PythonRunCode.java @@ -0,0 +1,70 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import java.util.Date; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * python储存实验运行记录 + *

+ * + * @author lr + * @since 2021-12-22 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="PythonRunCode对象", description="python储存实验运行记录") +public class PythonRunCode implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "实验代码主键Id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "实验代码") + private String code; + + @ApiModelProperty(value = "绑定的项目id") + private Integer projectId; + + @ApiModelProperty(value = "判分点主键Id") + private Integer judgmentPointsId; + + @ApiModelProperty(value = "0未提交,1为已提交") + private Integer isSubmit; + + @ApiModelProperty(value = "运行结果") + private String runResult; + + @ApiModelProperty(value = "运行的图片") + private String runPhotoUrl; + + @ApiModelProperty(value = "运行有没有出现错误(0、运行正确 1、运行错误)") + private Integer isError; + + @ApiModelProperty(value = "绑定账号id") + private Integer accountId; + + @ApiModelProperty(value = "实验报告id(ol_experimental_report)") + private Integer reportId; + + @ApiModelProperty(value = "逻辑删除默认0未删除,1为已删除") + private Integer isDel; + + @ApiModelProperty(value = "运行时间") + private Date createTime; + + @ApiModelProperty(value = "修改时间") + private Date updateTime; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/PythonSystem.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/PythonSystem.java new file mode 100644 index 0000000..03429fc --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/PythonSystem.java @@ -0,0 +1,47 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * python系统记录表 + *

+ * + * @author lr + * @since 2021-08-19 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_python_system") +@ApiModel(value="PythonSystem对象", description="python系统记录表") +public class PythonSystem implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "系统名称") + private String sysName; + + @ApiModelProperty(value = "后缀") + private String suffix; + + @ApiModelProperty(value = "逻辑删除(默认0 1为已删除)") + private Boolean isDel; + + @ApiModelProperty(value = "是否启用(默认0已启用 1为禁用)") + private Boolean isEnable; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/PythonTableData.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/PythonTableData.java new file mode 100644 index 0000000..8a9da8b --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/PythonTableData.java @@ -0,0 +1,62 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; + +import java.util.Date; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; + +import java.io.Serializable; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 储存全部python表数据表导出Excel路径 + *

+ * + * @author lr + * @since 2022-08-12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "PythonTableData对象", description = "储存全部python表数据表导出Excel路径") +public class PythonTableData implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "表名") + private String tableName; + + @ApiModelProperty(value = "文件名") + private String fileName; + + @ApiModelProperty(value = "文件大小") + private String fileSize; + + @ApiModelProperty(value = "文件格式") + private String fileFormat; + + @ApiModelProperty(value = "oss文件名") + private String ossFileName; + + @ApiModelProperty(value = "文件路径") + private String filePath; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/Questions.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/Questions.java new file mode 100644 index 0000000..074566d --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/Questions.java @@ -0,0 +1,101 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import org.junit.jupiter.params.shadow.com.univocity.parsers.annotations.Validate; + +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 测评管理-题库记录表 + *

+ * + * @author lr + * @since 2021-08-12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_questions") +@ApiModel(value = "Questions对象", description = "测评管理-题库记录表") +public class Questions implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "自增主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "题型:1、单选题,2、多选题,3、判断题") + @NotBlank(message = "题型不能为空!") + private String questionType; + + @ApiModelProperty(value = "题干信息") + @NotBlank(message = "题干信息不能为空!") + private String questionStem; + + @ApiModelProperty(value = "A选项内容") + @NotBlank(message = "A选项内容不能为空!") + private String optionA; + + @ApiModelProperty(value = "B选项内容") + @NotBlank(message = "B选项内容不能为空!") + private String optionB; + + @ApiModelProperty(value = "C选项内容") + private String optionC; + + @ApiModelProperty(value = "D选项内容") + private String optionD; + + @ApiModelProperty(value = "E选项内容") + private String optionE; + + @ApiModelProperty(value = "F选项内容") + private String optionF; + + @ApiModelProperty(value = "正确答案") + @NotBlank(message = "正确答案不能为空!") + private String answer; + + @ApiModelProperty(value = "答案解析") + private String answerAnalysis; + + @ApiModelProperty(value = "是否禁用:1:启用,0:禁用,默认是1启用") + private Integer isEnable; + + @ApiModelProperty(value = "是否删除:0未删除,1删除,默认0未删除") + private Integer isDel; + + @ApiModelProperty(value = "创建人") + private String createUser; + + + @ApiModelProperty(value = "修改人") + private String modifyUser; + + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "创建人用户账号id", name = "accountId", example = "1", required = true) + private Integer accountId; + + @ApiModelProperty(value = "学校id", name = "schoolId", example = "1") + private Integer schoolId; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/SchoolClassification.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/SchoolClassification.java new file mode 100644 index 0000000..c811d67 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/SchoolClassification.java @@ -0,0 +1,48 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import java.util.Date; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 学校对应分类表 + *

+ * + * @author lr + * @since 2021-09-09 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_school_classification") +@ApiModel(value="SchoolClassification对象", description="学校对应分类表") +public class SchoolClassification implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "唯一标识") + @TableId(value = "id", type = IdType.ID_WORKER_STR) + private String id; + + @ApiModelProperty(value = "学校id") + private String schoolId; + + @ApiModelProperty(value = "课程分类id") + private String classificationId; + + @ApiModelProperty(value = "创建时间") + private Date gmtCreate; + + @ApiModelProperty(value = "更新时间") + private Date gmtModified; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/SchoolCourse.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/SchoolCourse.java new file mode 100644 index 0000000..db82cf5 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/SchoolCourse.java @@ -0,0 +1,51 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import java.util.Date; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 学校内置课程表 + *

+ * + * @author lr + * @since 2021-08-10 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_school_course") +@ApiModel(value="SchoolCourse对象", description="学校内置课程表") +public class SchoolCourse implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "唯一标识") + @TableId(value = "id", type = IdType.ID_WORKER_STR) + private String id; + + @ApiModelProperty(value = "学校id") + private String schoolId; + + @ApiModelProperty(value = "课程id") + private String courseId; + + @ApiModelProperty(value = "是否启用(0启用,1未启用)") + private Integer isEnable; + + @ApiModelProperty(value = "创建时间") + private Date gmtCreate; + + @ApiModelProperty(value = "更新时间") + private Date gmtModified; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/SchoolProjectHintOpen.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/SchoolProjectHintOpen.java new file mode 100644 index 0000000..398ed4e --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/SchoolProjectHintOpen.java @@ -0,0 +1,44 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 学校项目实验提示管理表 + *

+ * + * @author lr + * @since 2023-06-02 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_school_project_hint_open") +@ApiModel(value="SchoolProjectHintOpen对象", description="学校项目实验提示管理表") +public class SchoolProjectHintOpen implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + @ApiModelProperty(value = "项目id") + private Integer projectId; + + @ApiModelProperty(value = "实验提示是否开启(0开启 1不开启)") + private Integer hintOpen; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/Staff.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/Staff.java new file mode 100644 index 0000000..0d1ff79 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/Staff.java @@ -0,0 +1,60 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; + +import java.io.Serializable; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 员工表 + *

+ * + * @author lr + * @since 2021-10-13 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_staff") +@ApiModel(value = "Staff对象", description = "员工表") +public class Staff implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "员工主键ID") + @TableId(value = "staff_id", type = IdType.AUTO) + private Integer staffId; + + @ApiModelProperty(value = "绑定年级ID") + private Integer gradeId; + + @ApiModelProperty(value = "组织架构id") + private Integer staffArchitectureId; + + @ApiModelProperty(value = "绑定学校id") + private Integer schoolId; + + @ApiModelProperty(value = "绑定账号id") + private Integer accountId; + + /** + * @Description : roleId 员工表 一个员工 = 一个角色绑定一个一级部门及一个二级部门 + * @Author Rong---2021/10/15 + */ + @ApiModelProperty(value = "该员工绑定的角色id") + private Integer roleId; + + @ApiModelProperty(value = "是否删除(0、未删除 1、已删除)") + @TableLogic + private Integer isDel; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/StaffGrade.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/StaffGrade.java new file mode 100644 index 0000000..c3a0d25 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/StaffGrade.java @@ -0,0 +1,45 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; + +import java.io.Serializable; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; + +/** + *

+ * 员工年级表 + *

+ * + * @author lr + * @since 2021-10-13 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_staff_grade") +@ApiModel(value = "StaffGrade对象", description = "员工年级表") +public class StaffGrade implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "员工年级表主键ID") + @TableId(value = "grade_id", type = IdType.AUTO) + private Integer gradeId; + + @ApiModelProperty(value = "二级部门", example = "三生三世") + @NotNull(message = "二级部门不能为空") + private String gradeName; + + @ApiModelProperty(value = "绑定员工专业组织架构ID", example = "1") + private Integer staffArchitectureId; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/StaffProfessionalArchitecture.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/StaffProfessionalArchitecture.java new file mode 100644 index 0000000..c723b8e --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/StaffProfessionalArchitecture.java @@ -0,0 +1,50 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; + +import java.io.Serializable; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; + +/** + *

+ * 员工专业组织架构 + *

+ * + * @author lr + * @since 2021-10-13 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_staff_professional_architecture") +@ApiModel(value = "StaffProfessionalArchitecture对象", description = "员工专业组织架构") +public class StaffProfessionalArchitecture implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "员工专业架构主键ID") + @TableId(value = "staff_architecture_id", type = IdType.AUTO) + private Integer staffArchitectureId; + + @ApiModelProperty(value = "员工组织架构名称", example = "经济管理学院") + @NotNull(message = "组织名称不能为空") + private String staffArchitectureName; + + @ApiModelProperty(value = "绑定学校ID", example = "1") + private Integer schoolId; + + @ApiModelProperty(value = "是否删除(0、未删除 1、已删除)", example = "0") + @TableLogic + private Integer isDel; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/SysJob.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/SysJob.java new file mode 100644 index 0000000..e11e7eb --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/SysJob.java @@ -0,0 +1,71 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.util.Date; + +/** + * 定时任务 + * + * @author cheney + * @version V1.0 + * @date 2022年7月28日 + */ +@EqualsAndHashCode(callSuper = false) +@Data +@TableName("sys_job") +public class SysJob implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 任务调度参数key + */ + public static final String JOB_PARAM_KEY = "JOB_PARAM_KEY"; + /** + * 任务id + */ + @ApiModelProperty(value = "主键ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + /** + * spring bean名称 + */ + @TableField("bean_name") + private String beanName; + + /** + * 参数 + */ + @TableField("params") + private String params; + + /** + * cron表达式 + */ + @TableField("cron_expression") + private String cronExpression; + + /** + * 任务状态 0:正常 1:暂停 + */ + @TableField("status") + private Integer status; + + /** + * 备注 + */ + @TableField("remark") + private String remark; + + /** + * 创建时间 + */ + @TableField(value = "create_time", fill = FieldFill.INSERT) + private Date createTime; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/SysJobLog.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/SysJobLog.java new file mode 100644 index 0000000..84af087 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/SysJobLog.java @@ -0,0 +1,74 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.util.Date; + +/** + * 定时任务日志 + * + * @author cheney + * @version V1.0 + * @date 2022年7月28日 + */ +@EqualsAndHashCode(callSuper = false) +@Data +@TableName("sys_job_log") +public class SysJobLog implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 任务日志id + */ + @ApiModelProperty(value = "主键ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + /** + * 任务id + */ + @TableField("job_id") + private Integer jobId; + + /** + * spring bean名称 + */ + @TableField("bean_name") + private String beanName; + + /** + * 参数 + */ + @TableField("params") + private String params; + + /** + * 任务状态 0:成功 1:失败 + */ + @TableField("status") + private Integer status; + + /** + * 失败信息 + */ + @TableField("error") + private String error; + + /** + * 耗时(单位:毫秒) + */ + @TableField("times") + private Integer times; + + /** + * 创建时间 + */ + @TableField(value = "create_time", fill = FieldFill.INSERT) + private Date createTime; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/SysLog.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/SysLog.java new file mode 100644 index 0000000..f7946e8 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/SysLog.java @@ -0,0 +1,61 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + * 操作日志 + * + * @author cheney + * @version V1.0 + * @date 2022年7月28日 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("sys_log") +@ApiModel(value = "sys_log", description = "sys_log") +public class SysLog implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + private String userId; + + private String userName; + + private String operation; + + private Integer time; + + private Integer schoolId; + + private String method; + + private String params; + + private String ip; + + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @TableField(exist = false) + private String startTime; + + @TableField(exist = false) + private String endTime; + + @TableField(exist = false) + private String schoolName; + +} \ No newline at end of file diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/SystemLogo.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/SystemLogo.java new file mode 100644 index 0000000..f108f1d --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/SystemLogo.java @@ -0,0 +1,44 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 职站教师端-系统logo设置 + *

+ * + * @author lr + * @since 2021-10-18 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_system_logo") +@ApiModel(value="SystemLogo对象", description="职站教师端-系统logo设置") +public class SystemLogo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "标题") + private String title; + + @ApiModelProperty(value = "图标") + private String logoUrl; + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/TheoreticalCourse.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/TheoreticalCourse.java new file mode 100644 index 0000000..8518291 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/TheoreticalCourse.java @@ -0,0 +1,78 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; + +import java.io.Serializable; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 理论课程基本信息 + *

+ * + * @author lr + * @since 2022-09-14 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_theoretical_course") +@ApiModel(value = "TheoreticalCourse对象", description = "理论课程基本信息") +public class TheoreticalCourse implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "理论课程主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "课程名称") + private String courseName; + + @ApiModelProperty(value = "课程类型(0.免费 1.付费)") + private Integer courseType; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + @ApiModelProperty(value = "创建人Id") + private Integer founderId; + + @ApiModelProperty(value = "理论课程封面") + private String coverUrl; + + @ApiModelProperty(value = "理论课程介绍") + private String courseIntroduction; + + @ApiModelProperty(value = "平台来源(0中台,1职站)") + private Integer platformSource; + + @ApiModelProperty(value = "课程范围(0:本校内 1:全平台 2.指定区域、院校)") + private Integer visibleRange; + + @ApiModelProperty(value = "中台是否开启(0开启 1未开启 默认0)") + private Integer ztOpen; + + @ApiModelProperty(value = "是否开启(0开启 1未开启 默认0)") + private Integer isOpen; + + @ApiModelProperty(value = "是否删除(0未删除 1已删除 默认0)") + private Integer isDel; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/TheoreticalCourseChapter.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/TheoreticalCourseChapter.java new file mode 100644 index 0000000..0669585 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/TheoreticalCourseChapter.java @@ -0,0 +1,52 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 理论课程章节表 + *

+ * + * @author lr + * @since 2022-09-22 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_theoretical_course_chapter") +@ApiModel(value="TheoreticalCourseChapter对象", description="理论课程章节表") +public class TheoreticalCourseChapter implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "章节ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "章节名称") + private String name; + + @ApiModelProperty(value = "课程ID") + private Integer courseId; + + @ApiModelProperty(value = "显示排序") + private Integer sort; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/TheoreticalCourseClassification.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/TheoreticalCourseClassification.java new file mode 100644 index 0000000..4c7cf59 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/TheoreticalCourseClassification.java @@ -0,0 +1,66 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 理论课程分类信息 + *

+ * + * @author lr + * @since 2022-09-14 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_theoretical_course_classification") +@ApiModel(value = "TheoreticalCourseClassification对象", description = "理论课程分类信息") +public class TheoreticalCourseClassification implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "理论课程分类主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "分类名称") + private String classificationName; + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + @ApiModelProperty(value = "创建人Id") + private Integer founderId; + + @ApiModelProperty(value = "平台来源(0中台,1职站)") + private Integer platformSource; + + @ApiModelProperty(value = "是否删除(0未删除 1已删除 默认0)") + @TableLogic + private Integer isDel; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + + @ApiModelProperty(value = "学校名称") + @TableField(exist = false) + private String schoolName; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/TheoreticalCourseCollect.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/TheoreticalCourseCollect.java new file mode 100644 index 0000000..817d524 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/TheoreticalCourseCollect.java @@ -0,0 +1,49 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 理论课程收藏表 + *

+ * + * @author lr + * @since 2023-04-18 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_theoretical_course_collect") +@ApiModel(value = "TheoreticalCourseCollect对象", description = "理论课程收藏表") +public class TheoreticalCourseCollect implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "理论课程收藏id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "理论课程id") + private Integer courseId; + + @ApiModelProperty(value = "收藏时间") + private Date collectionTime; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/TheoreticalCourseConfigure.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/TheoreticalCourseConfigure.java new file mode 100644 index 0000000..50f1b75 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/TheoreticalCourseConfigure.java @@ -0,0 +1,58 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; + +import java.io.Serializable; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 理论课程与理论课程分类配置表 + *

+ * + * @author lr + * @since 2022-09-14 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_theoretical_course_configure") +@ApiModel(value = "TheoreticalCourseConfigure对象", description = "理论课程与理论课程分类配置表") +public class TheoreticalCourseConfigure implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "配置主键") + @TableId(value = "config_id", type = IdType.AUTO) + private Integer configId; + + @ApiModelProperty(value = "理论课程课程id") + private Integer courseId; + + @ApiModelProperty(value = "课程分类id") + private Integer classificationId; + + @ApiModelProperty(value = "分类类型") + private Integer classificationType; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + + @ApiModelProperty(value = "分类名称") + @TableField(exist = false) + private String classificationName; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/TheoreticalCourseRange.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/TheoreticalCourseRange.java new file mode 100644 index 0000000..9c7dcd5 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/TheoreticalCourseRange.java @@ -0,0 +1,53 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 理论课程指定范围选择 + *

+ * + * @author lr + * @since 2022-09-19 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_theoretical_course_range") +@ApiModel(value="TheoreticalCourseRange对象", description="理论课程指定范围选择") +public class TheoreticalCourseRange implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "理论课程主键") + private Integer courseId; + + @ApiModelProperty(value = "省") + private String provinceId; + + @ApiModelProperty(value = "市") + private String cityId; + + @ApiModelProperty(value = "学校id") + private String schoolId; + + @ApiModelProperty(value = "范围类型(0为学校 1为地区)") + private Integer type; + + @ApiModelProperty(value = "是否删除(默认0 ,1为已删除)") + private Integer isDel; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/TheoreticalCourseSubsection.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/TheoreticalCourseSubsection.java new file mode 100644 index 0000000..c0f0a1e --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/TheoreticalCourseSubsection.java @@ -0,0 +1,70 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 课程小节 + *

+ * + * @author lr + * @since 2022-09-22 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_theoretical_course_subsection") +@ApiModel(value="TheoreticalCourseSubsection对象", description="课程小节") +public class TheoreticalCourseSubsection implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "小节ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "小节名称") + private String name; + + @ApiModelProperty(value = "课程ID") + private Integer courseId; + + @ApiModelProperty(value = "章节ID") + private Integer chapterId; + + @ApiModelProperty(value = "资源文件ID") + private String fileId; + + @ApiModelProperty(value = "文件存储路径") + private String fileUrl; + + @ApiModelProperty(value = "资源文件类型") + private String fileType; + + @ApiModelProperty(value = "阿里云文件名称") + private String fileName; + + @ApiModelProperty(value = "原始文件名称") + private String originalFileName; + + @ApiModelProperty(value = "排序字段") + private Integer sort; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/UserManagement.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/UserManagement.java new file mode 100644 index 0000000..ebf8291 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/UserManagement.java @@ -0,0 +1,60 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + *

+ * 企业端用户管理 + *

+ * + * @author lr + * @since 2021-08-10 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_user_management") +@ApiModel(value="UserManagement对象", description="企业端用户管理") +public class UserManagement implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "绑定客户id") + private Integer clientId; + + @ApiModelProperty(value = "用户姓名") + private String name; + + @ApiModelProperty(value = "账号") + private String account; + + @ApiModelProperty(value = "账号角色") + private Integer roleId; + + @ApiModelProperty(value = "登录次数") + private Integer loginNumber; + + @ApiModelProperty(value = "上次登录时间") + private String lastLoginTime; + + @ApiModelProperty(value = "客户名称") + private String clientName; + + @ApiModelProperty(value = "绑定用户id") + private Integer userId; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/UserScore.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/UserScore.java new file mode 100644 index 0000000..956267d --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/UserScore.java @@ -0,0 +1,122 @@ +package com.huoran.occupationlab.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; +import java.io.Serializable; +import java.util.List; + +import com.huoran.common.entity.LcRuleRecord; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 用户分数表 + *

+ * + * @author Mr.JK + * @since 2021-09-14 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_user_score") +@ApiModel(value = "UserScore对象", description = "用户分数表") +public class UserScore implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "分数") + private Integer score; + + + @ApiModelProperty(value = "实验报告主键") + private Integer reportId; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "系统id") + private Integer systemId; + + @ApiModelProperty(value = "判分点id(系统11为流程类)") + private Integer judgmentId; + + @ApiModelProperty(value = "用户答案") + private String answer; + + @ApiModelProperty(value = "参考答案") + @TableField(exist = false) + private String referenceAnswer; + + + @ApiModelProperty(value = "运行结果") + @TableField(exist = false) + private String runResult; + + + @ApiModelProperty(value = "题目分值") + @TableField(exist = false) + private Integer quesScore; + + @ApiModelProperty(value = "是否正确") + private Integer isCorrect; + + @ApiModelProperty(value = "是否删除") + @TableLogic(value = "0", delval = "1") + private Integer isDel; + + @ApiModelProperty(value = "判分点名称") + @TableField(exist = false) + private String judgmentName; + + @ApiModelProperty(value = "规则记录") + @TableField(exist = false) + private List lcRuleRecords; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + + @ApiModelProperty(value = "参考答案图片集合") + @TableField(exist = false) + private List runThePictureList; + + @ApiModelProperty(value = "实验学时") + @TableField(exist = false) + private String period; + + @ApiModelProperty(value = "运行图片(未截取分割前的)") + @TableField(exist = false) + private String runThePicture; + + @ApiModelProperty(value = "赛事id") + private Integer competitionId; + + @ApiModelProperty(value = "赛事阶段id") + private Integer stageId; + + @ApiModelProperty(value = "耗时(用于区分线下赛事的耗时)") + private Integer timeSum; + + @ApiModelProperty(value = "提交时间(用于区分线下赛事的提交时间)") + private Date submitTime; + + @ApiModelProperty(value = "团队id") + private Integer teamId; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/excel/ExcelData.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/excel/ExcelData.java new file mode 100644 index 0000000..e226a3f --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/excel/ExcelData.java @@ -0,0 +1,43 @@ +package com.huoran.occupationlab.entity.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import com.alibaba.excel.annotation.ExcelProperty; +import com.huoran.occupationlab.utils.StatusConverter; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Author chen + * @DATE 2020/10/19 15:34 + * @Version 1.0 + */ +@Data +public class ExcelData { + + @ApiModelProperty(value = "序号") + @Excel(name = "序号", orderNum = "1", isImportField = "rownum", width = 30) + private Integer rownum; + + @ApiModelProperty(value = "学校") + @Excel(name = "学校", orderNum = "2", mergeVertical = true, isImportField = "school", width = 30) + private String school; + + @ApiModelProperty(value = "学生姓名") + @Excel(name = "学生姓名", orderNum = "3", mergeVertical = true, isImportField = "username", width = 30) + private String username; + + + @ApiModelProperty(value = "手机号") + @Excel(name = "手机号", orderNum = "4", mergeVertical = true, isImportField = "phone", width = 30) + private String phone; + + + @ApiModelProperty(value = "学号") + @Excel(name = "学号", orderNum = "5", mergeVertical = true, isImportField = "workNumber", width = 30) + private String workNumber; + + + @ApiModelProperty(value = "报名时间") + @Excel(name = "报名时间", orderNum = "6", mergeVertical = true, isImportField = "gmtCreate", width = 30) + private String gmtCreate; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/AchievementProductDimensionReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/AchievementProductDimensionReq.java new file mode 100644 index 0000000..8938eac --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/AchievementProductDimensionReq.java @@ -0,0 +1,30 @@ +package com.huoran.occupationlab.entity.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class AchievementProductDimensionReq extends PageReq { + + + @ApiModelProperty(value = "项目id") + Integer projectId; + + + @ApiModelProperty(value = "班级id") + Integer classId; + + @ApiModelProperty(value = "关键词") + String keyWord; + + @ApiModelProperty(value = "班级名称") + String className; + + @ApiModelProperty(value = "产品id") + Integer mallId; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/ActivityApplicantReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/ActivityApplicantReq.java new file mode 100644 index 0000000..412b532 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/ActivityApplicantReq.java @@ -0,0 +1,32 @@ +package com.huoran.occupationlab.entity.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 创业活动报名人员表 + *

+ * + * @author lr + * @since 2023-04-27 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class ActivityApplicantReq extends PageReq { + + + @ApiModelProperty(value = "活动主键Id") + private Integer activityId; + + + @ApiModelProperty(value = "关键词") + private String keyWords; + + @ApiModelProperty(value = "报名人员状态(0未禁用,1禁用)") + private Integer isDisable; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/AddArchitectureReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/AddArchitectureReq.java new file mode 100644 index 0000000..7a9e463 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/AddArchitectureReq.java @@ -0,0 +1,49 @@ +package com.huoran.occupationlab.entity.req; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + *

+ * 学生组织架构 + *

+ * + * @author lr + * @since 2021-08-24 + */ +@Data +@ApiModel(value = "新增组织架构请参数", description = "新增组织架构请参数") +public class AddArchitectureReq { + + + @ApiModelProperty(value = "组织名称") + @NotNull(message = "组织名称不能为空") + private String organizationName; + + @ApiModelProperty(value = "父id 一级为0") + @NotNull(message = "父id不能为空") + private Integer parentId; + + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + + @ApiModelProperty(value = "层级") + @NotNull(message = "层级不能为空") + private Integer level; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/AddStaffReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/AddStaffReq.java new file mode 100644 index 0000000..c7b5f88 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/AddStaffReq.java @@ -0,0 +1,64 @@ +package com.huoran.occupationlab.entity.req; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + * @Author chen + * @DATE 2021/10/13 15:51 + * @Version 1.0 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_staff") +@ApiModel(value = "AddStaffReq对象", description = "新增员工") +public class AddStaffReq { + + @ApiModelProperty(value = "绑定账号id", hidden = true) + private Integer accountId; + + @ApiModelProperty(value = "绑定学校id", hidden = true) + private Integer schoolId; + + //----------------------------用户表相关字段Start---------------------------- + @ApiModelProperty(value = "用户姓名", example = "穆虎虎") + @NotNull(message = "用户姓名不能为空") + private String userName; + + @ApiModelProperty(value = "唯一标识账号", example = "sjjskisjisjsisj") + @NotNull(message = "唯一标识账号不能为空") + private String uniqueIdentification; + + @ApiModelProperty(value = "电话") + private String phone; + + @ApiModelProperty(value = "邮箱") + private String email; + + @ApiModelProperty(value = "账号角色及绑定的一级二级部门信息") + @NotNull(message = "账号角色及绑定的一级二级部门信息不能为空") + private List roleAndDeptList; + + @ApiModelProperty(value = "组织关系:1->有组织关系;2->无组织关系;", example = "1") + private Integer organizationalRelation; + + //----------------------------用户表相关字段End---------------------------- + + //----------------------------账户表相关字段Start---------------------------- + @ApiModelProperty(value = "账号") + private String account; + + @ApiModelProperty(value = "工号") + private String workNumber; + //----------------------------账户表相关字段End---------------------------- +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/AddStaffRoleReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/AddStaffRoleReq.java new file mode 100644 index 0000000..c87ae0d --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/AddStaffRoleReq.java @@ -0,0 +1,37 @@ +package com.huoran.occupationlab.entity.req; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + * @Author chen + * @DATE 2021/10/13 15:51 + * @Version 1.0 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_staff") +@ApiModel(value = "绑定员工角色及部门参数", description = "绑定员工角色及部门参数") +public class AddStaffRoleReq { + + @ApiModelProperty(value = "一级部门绑定id", example = "1") + @NotNull(message = "绑定年级ID不能为空") + private Integer gradeId; + + @ApiModelProperty(value = "二级部门绑定id", example = "1") + @NotNull(message = "绑定专业ID不能为空") + private Integer staffArchitectureId; + + @ApiModelProperty(value = "角色id(一个角色绑定一个一级部门、二级部门)", example = "1") + @NotNull(message = "角色ID不能为空") + private Integer roleId; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/AddStudentCheckReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/AddStudentCheckReq.java new file mode 100644 index 0000000..49f8fcc --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/AddStudentCheckReq.java @@ -0,0 +1,45 @@ +package com.huoran.occupationlab.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.util.Date; + +/** + *

+ * 学生表 + *

+ * + * @author lr + * @since 2021-08-24 + */ +@Data +@ApiModel(value = "Student对象", description = "学生表") +public class AddStudentCheckReq { + + //Integer schoolId,String userName,String account,String workNumber,Integer platformId,Integer type + + @ApiModelProperty(value = "学号/工号") + private String workNumber; + + @ApiModelProperty(value = "学生姓名") + private String userName; + + @ApiModelProperty(value = "账号") + private String account; + + @ApiModelProperty(value = "班级id") + private String classId; + + @ApiModelProperty(value = "学校id", hidden = true) + private Integer schoolId; + + @ApiModelProperty(value = "所属平台id") + private Integer platformId; + + @ApiModelProperty(value = "平台端区分:0->教师端 1->学生端 2->无端") + private Integer type; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/AddStudentReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/AddStudentReq.java new file mode 100644 index 0000000..840f7a6 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/AddStudentReq.java @@ -0,0 +1,55 @@ +package com.huoran.occupationlab.entity.req; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 学生表 + *

+ * + * @author lr + * @since 2021-08-24 + */ +@Data +@ApiModel(value = "Student对象", description = "学生表") +public class AddStudentReq { + @ApiModelProperty(value = "学号/工号") + @NotNull(message = "学生学号不能为空!") + private String workNumber; + + @ApiModelProperty(value = "学生姓名") + @NotNull(message = "学生姓名不能为空!") + private String userName; + + @NotNull(message = "账号不能为空!") + @ApiModelProperty(value = "账号") + private String account; + + @ApiModelProperty(value = "班级id") + private String classId; + + @ApiModelProperty(value = "唯一标识账号") + @NotNull(message = "唯一标识不能为空!") + private String uniqueIdentification; + + @ApiModelProperty(value = "电话") + private String phone; + + @ApiModelProperty(value = "邮箱") + private String email; + + @ApiModelProperty(value = "学校id", hidden = true) + private Integer schoolId; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/AddTheoreticalCourseReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/AddTheoreticalCourseReq.java new file mode 100644 index 0000000..8c42342 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/AddTheoreticalCourseReq.java @@ -0,0 +1,61 @@ +package com.huoran.occupationlab.entity.req; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.huoran.occupationlab.entity.TheoreticalCourseRange; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + *

+ * 理论课程基本信息 + *

+ * + * @author lr + * @since 2022-09-14 + */ +@Data +@ApiModel(value = "新增/编辑理论课程所需参数", description = "新增/编辑理论课程所需参数") +public class AddTheoreticalCourseReq { + + @ApiModelProperty(value = "理论课程id(编辑才传)") + private Integer courseId; + + @ApiModelProperty(value = "课程名称") + private String courseName; + + @ApiModelProperty(value = "课程类型(0.免费 1.付费)") + private Integer courseType; + + @ApiModelProperty(value = "理论课程封面") + private String coverUrl; + + @ApiModelProperty(value = "理论课程介绍") + private String courseIntroduction; + + @ApiModelProperty(value = "平台来源(0中台,1职站)") + private Integer platformSource; + + @ApiModelProperty(value = "课程范围(0:本校内 1:全平台 2.指定区域、院校)") + private Integer visibleRange; + + @ApiModelProperty(value = "学校分类") + private List schoolClassificationsIds; + + @ApiModelProperty(value = "平台分类") + private List platformClassificationIds; + + + @ApiModelProperty(value = "指定区域、院校") + private List courseRangeList; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/AfterLoginPageContestListReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/AfterLoginPageContestListReq.java new file mode 100644 index 0000000..088741d --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/AfterLoginPageContestListReq.java @@ -0,0 +1,37 @@ +package com.huoran.occupationlab.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @描述:竞赛管理表 + * @作者: Rong + * @日期: 2022-06-16 + */ +@Data +@ApiModel(value = "登录后赛事列表分页") +public class AfterLoginPageContestListReq extends PageReq{ + + @ApiModelProperty(value = "关键词(竞赛名称/创建人)",example = "事") + private String keyWord; + + @ApiModelProperty(value = "大赛范围(0:本校内 1:全平台 2.指定区域、院校 3.不限)",example = "3") + private String competitionScope; + + @ApiModelProperty(value = "省") + private Integer provinceId; + + @ApiModelProperty(value = "市") + private Integer cityId; + + @ApiModelProperty(value = "排序(1:近期排名 2.最近更新)") + private Integer sequence; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "赛事类型(1.本校赛事/2.赛事广场/3.已报名赛事)") + private Integer eventType; + +} \ No newline at end of file diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/AssessmentReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/AssessmentReq.java new file mode 100644 index 0000000..77194c4 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/AssessmentReq.java @@ -0,0 +1,80 @@ +package com.huoran.occupationlab.entity.req; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + *

+ * 考核管理 + *

+ * + * @author lr + * @since 2021-08-18 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "创建考核对象", description = "创建考核对象") +public class AssessmentReq { + + + @ApiModelProperty(value = "考核名称", name = "experimentalName", example = "K1", required = true) + @NotEmpty(message = "考核名称不能为空") + private String experimentalName; + + @ApiModelProperty(value = "班级id(可多个班级参加,逗号隔开) 指定范围才需要传值", name = "classId", example = "1,2,3", required = true) + //@NotEmpty(message = "班级id不能为空") + private String classId; + + @ApiModelProperty(value = "绑定项目id", name = "projectId", example = "1", required = true) + @NotNull(message = "项目id不能为空") + private Integer projectId; + + @ApiModelProperty(value = "实验时长", name = "experimentDuration", example = "1", required = true) + @NotEmpty(message = "实验时长不能为空") + private String experimentDuration; + + @ApiModelProperty(value = "发布类型(1、手动发布 2、定时发布)", name = "type", example = "1", required = true) + @NotNull(message = "发布类型不能为空") + private Integer type; + + @ApiModelProperty(value = "起始时间", name = "startTime", example = "2021-08-19 16:00:00", required = true) + private String startTime; + + @ApiModelProperty(value = "结束时间", name = "stopTime", example = "2021-08-20 16:00:00", required = true) + private String stopTime; + + @ApiModelProperty(value = "邀请码") + private Integer invitationCode; + + @ApiModelProperty(value = "是否启用邀请码(0、启用 1、未启用)", name = "isEnableCode", example = "1", required = true) + private Integer isEnableCode; + + @ApiModelProperty(value = "指定范围(0无指定范围 1指定范围)", name = "isSpecify", example = "1", required = true) + private Integer isSpecify; + + @ApiModelProperty(value = "创建人用户账号id", name = "accountId", example = "1", required = true) + private Integer accountId; + + @ApiModelProperty(value = "课程id", name = "curriculumId", example = "1", required = true) + private Integer curriculumId; + + @ApiModelProperty(value = "学校id", name = "schoolId", example = "1") + private Integer schoolId; + + @ApiModelProperty(value = "绑定学生信息") + private List stuInfo; + + @ApiModelProperty(value = "商品id", name = "mallId") + private Integer mallId; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/BankExperimentDataReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/BankExperimentDataReq.java new file mode 100644 index 0000000..f563e43 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/BankExperimentDataReq.java @@ -0,0 +1,35 @@ +package com.huoran.occupationlab.entity.req; + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class BankExperimentDataReq { + + @ApiModelProperty(value = "序号") + private Integer id; + + @ApiModelProperty(value = "判分点") + private String judgmentName; + + @ApiModelProperty(value = "考核点") + private String assessmentPoint; + + @ApiModelProperty(value = "参考答案") + private String referenceAnswer; + + @ApiModelProperty(value = "学生答案") + private String answer; + + @ApiModelProperty(value = "得分") + private Integer score; + + @ApiModelProperty(value = "题目分值") + private Integer quesScore; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/ClassReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/ClassReq.java new file mode 100644 index 0000000..a3098c2 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/ClassReq.java @@ -0,0 +1,30 @@ +package com.huoran.occupationlab.entity.req; + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @ProjectName: huorantech + * @Package: com.huoran.occupationlab.entity.req + * @ClassName: ClassReq + * @Description: java类作用描述 + * @Author: Maureen.Rong + * @CreateDate: 2021/8/19 18:13 + * @UpdateDate: 2021/8/19 18:13 + * @Version: 1.0 + */ +@Data +public class ClassReq { + @ApiModelProperty(value = "绑定学生账号id", name = "stuAccountId", example = "1", required = true) + private Integer stuAccountId; + + @ApiModelProperty(value = "绑定班级id", name = "classId", example = "1", required = true) + private Integer classId; + + + @ApiModelProperty(value = "班级名称", name = "className") + private String className; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/ClassificationPageReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/ClassificationPageReq.java new file mode 100644 index 0000000..5f1eee2 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/ClassificationPageReq.java @@ -0,0 +1,27 @@ +package com.huoran.occupationlab.entity.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @ProjectName: huorantech + * @Package: com.huoran.occupationlab.entity.req + * @ClassName: PageReq + * @Description: 分页 + * @Author: Maureen.Rong + * @CreateDate: 2021/8/12 15:10 + * @UpdateDate: 2021/8/12 15:10 + * @Version: 1.0 + */ +@Data +public class ClassificationPageReq { + + @ApiModelProperty(value = "当前页数", name = "pageNum", example = "1", required = true) + private Integer pageNum; + @ApiModelProperty(value = "当前页需要显示的数量", name = "pageSize", example = "10", required = true) + private Integer pageSize; + @ApiModelProperty(value = "平台来源(0中台,1职站)") + private Integer platformSource; + @ApiModelProperty(value = "学校id") + private Integer schoolId; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/ConfigurationReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/ConfigurationReq.java new file mode 100644 index 0000000..30664df --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/ConfigurationReq.java @@ -0,0 +1,24 @@ +package com.huoran.occupationlab.entity.req; + +import io.swagger.annotations.ApiModelProperty; + +import java.util.List; + +/** + * @ProjectName: huorantech + * @Package: com.huoran.occupationlab.entity.req + * @ClassName: ConfigurationReq + * @Description: java类作用描述 + * @Author: Maureen.Rong + * @CreateDate: 2021/9/28 14:12 + * @UpdateDate: 2021/9/28 14:12 + * @Version: 1.0 + * @create: 2021-09-28 14:12 + */ +public class ConfigurationReq { + @ApiModelProperty(value = "系统id") + private List systemId; + + @ApiModelProperty(value = "排序") + private Integer sort; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/DisableEnableActivityReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/DisableEnableActivityReq.java new file mode 100644 index 0000000..d35ed98 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/DisableEnableActivityReq.java @@ -0,0 +1,23 @@ +package com.huoran.occupationlab.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +@Data +@ApiModel(value = "禁用启用活动所需参数") +public class DisableEnableActivityReq { + + @ApiModelProperty(value = "禁用平台来源(0中台,1职站教师端 2.职站学生端)",example = "1") + private Integer type; + + @ApiModelProperty(value = "禁用的活动id",example = "1") + private Integer activityId; + + @ApiModelProperty(value = "是否开启(默认0启用 1禁用)", example = "0") + private Integer isOpen; + + @ApiModelProperty(value = "是否是本校超管以及管理员(0为否 1为是)", hidden = true) + private Integer isAdmin; +} \ No newline at end of file diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/DisableEnableContestReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/DisableEnableContestReq.java new file mode 100644 index 0000000..c4515ed --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/DisableEnableContestReq.java @@ -0,0 +1,26 @@ +package com.huoran.occupationlab.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @描述:竞赛管理表 + * @作者: Rong + * @日期: 2022-06-16 + */ +@Data +@ApiModel(value = "禁用启用赛事所需参数") +public class DisableEnableContestReq { + + @ApiModelProperty(value = "禁用平台来源(0中台,1职站)",example = "1") + private Integer type; + + @ApiModelProperty(value = "禁用的赛事id",example = "1") + private String contestId; + + + @ApiModelProperty(value = "是否开启(默认0启用 1禁用)", example = "0") + private Integer isOpen; + +} \ No newline at end of file diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/DisableEnableCourseReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/DisableEnableCourseReq.java new file mode 100644 index 0000000..8172902 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/DisableEnableCourseReq.java @@ -0,0 +1,23 @@ +package com.huoran.occupationlab.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +@Data +@ApiModel(value = "禁用启用课程所需参数") +public class DisableEnableCourseReq { + + @ApiModelProperty(value = "禁用平台来源(0中台,1职站)", example = "1") + private Integer type; + + @ApiModelProperty(value = "课程id", example = "1") + private Integer courseId; + + + @ApiModelProperty(value = "是否开启(默认0启用 1禁用)", example = "0") + private Integer isOpen; + + +} \ No newline at end of file diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/EditExperimentalDataReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/EditExperimentalDataReq.java new file mode 100644 index 0000000..1a64aab --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/EditExperimentalDataReq.java @@ -0,0 +1,20 @@ +package com.huoran.occupationlab.entity.req; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @描述: + * @作者: Rong + * @日期: 2022/5/19 17:29 + */ +@Data +public class EditExperimentalDataReq { + @ApiModelProperty(value = "实验报告主键") + private Integer reportId; + + @ApiModelProperty(value = "实验数据") + private String data; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/EditStudentsReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/EditStudentsReq.java new file mode 100644 index 0000000..98f3518 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/EditStudentsReq.java @@ -0,0 +1,101 @@ +package com.huoran.occupationlab.entity.req; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @描述:用户信息表 + * @作者: Rong + * @日期: 2021-08-25 + */ +@Data +@ApiModel(value = "用户信息表") +@TableName("hr_user_info") +public class EditStudentsReq implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "用户id") + private Integer userId; + + @ApiModelProperty(value = "用户姓名") + private String userName; + + @ApiModelProperty(value = "唯一标识账号") + private String uniqueIdentification; + + @ApiModelProperty(value = "证件类型(1、身份证)") + private Integer documentType; + + @ApiModelProperty(value = "证件号码") + private String idNumber; + + @ApiModelProperty(value = "绑定省份id") + private Integer provinceId; + + @ApiModelProperty(value = "绑定城市id") + private Integer cityId; + + @ApiModelProperty(value = "国家归属地") + private String countries; + + @ApiModelProperty(value = "出生日期") + private Date dateBirth; + + @ApiModelProperty(value = "教育程度") + private Integer educationDegree; + + @ApiModelProperty(value = "绑定学校id") + private Integer schoolId; + + @ApiModelProperty(value = "电话") + private String phone; + + @ApiModelProperty(value = "邮箱") + private String email; + + @ApiModelProperty(value = "微信号") + private String wechatId; + + @ApiModelProperty(value = "登陆次数") + private Integer loginNumber; + + @ApiModelProperty(value = "性别(1、男 2、女)") + private Integer sex; + + @ApiModelProperty(value = "用户头像路径") + private String userAvatars; + + @ApiModelProperty(value = "是否删除(0->未删除;1->已删除)") + private Integer isDel; + + @ApiModelProperty(value = "最后登陆时间") + private String lastLoginTime; + + @ApiModelProperty(value = "绑定多个角色id") + private String roleId; + + @ApiModelProperty(value = "组织关系:1->有组织关系;2->无组织关系;") + private Integer organizationalRelation; + + @ApiModelProperty(value = "是否禁用(0->禁用,1->启用)") + private Boolean isEnable; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "绑定时间") + private String phoneBindingTime; + +} \ No newline at end of file diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/EntrepreneurshipActivityListrReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/EntrepreneurshipActivityListrReq.java new file mode 100644 index 0000000..6113115 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/EntrepreneurshipActivityListrReq.java @@ -0,0 +1,46 @@ +package com.huoran.occupationlab.entity.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 创业活动列表所需参数 + */ +@Data +@Accessors(chain = true) +public class EntrepreneurshipActivityListrReq extends PageReq { + + @ApiModelProperty(value = "创建人角色(0、系统 1、老师 2、学生)", example = "1") + private Integer founder; + + @ApiModelProperty(value = "发布状态(默认0、草稿箱 1、已发布)", example = "1") + private Integer publishStatus; + + @ApiModelProperty(value = "关键词", example = "三") + private String keyWords; + + @ApiModelProperty(value = "当前所属平台(0:中台,1:职站教师 2职站学生)", example = "1") + private Integer platformSource; + + + @ApiModelProperty(value = "是否是本校超管以及管理员(0为否 1为是)", hidden = true) + private Integer isAdmin; + + + @ApiModelProperty(hidden = true) + private Integer accountId; + + + @ApiModelProperty(value = "是否报名(0为已报名 1为未报名)", example = "0") + private Integer whetherToSignUp; + + @ApiModelProperty(value = "开始时间") + private String startTime; + + @ApiModelProperty(value = "结束时间") + private String endTime; + + @ApiModelProperty(value = "筛选排序(0 最近更新 1:近期报名)") + private Integer filterSort; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/ExcelImpQuestionReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/ExcelImpQuestionReq.java new file mode 100644 index 0000000..3ba40a2 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/ExcelImpQuestionReq.java @@ -0,0 +1,56 @@ +package com.huoran.occupationlab.entity.req; + +import com.huoran.occupationlab.entity.Questions; +import com.huoran.occupationlab.utils.poi.ExcelAttribute; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @ProjectName: huorantech + * @Package: com.huoran.occupationlab.entity.req + * @ClassName: ExcelImpQuestionReq + * @Description: 题库批量导入所需 + * @Author: Maureen.Rong + * @CreateDate: 2021/8/16 16:49 + * @UpdateDate: 2021/8/16 16:49 + * @Version: 1.0 + */ +@Data +@ApiModel(value = "题库批量导入所需") +public class ExcelImpQuestionReq { + + @ApiModelProperty(value = "题干") + private String questionStem; + + @ApiModelProperty(value = "绑定院校id") + private Integer schoolId; + + @ApiModelProperty("题型") + private String questionType; + + @ApiModelProperty("选项A") + private String optionA; + + @ApiModelProperty("选项B") + private String optionB; + + @ApiModelProperty("选项C") + private String optionC; + + @ApiModelProperty("选项D") + private String optionD; + + @ApiModelProperty("选项E") + private String optionE; + + @ApiModelProperty("选项F") + private String optionF; + + @ApiModelProperty("正确答案") + private String answer; + + @ApiModelProperty("答案解析") + private String answerAnalysis; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/ExcelImpStaffReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/ExcelImpStaffReq.java new file mode 100644 index 0000000..1c0261a --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/ExcelImpStaffReq.java @@ -0,0 +1,53 @@ +package com.huoran.occupationlab.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * @ProjectName: huorantech + * @Package: com.huoran.occupationlab.entity.req + * @ClassName: ExcelImpStaffReq + * @Description: 批量导入员工所需 + * @Author: Maureen.Rong + * @CreateDate: 2021/10/15 09:49 + * @UpdateDate: 2021/10/15 09:49 + * @Version: 1.0 + */ +@Data +@ApiModel(value = "批量导入员工所需") +public class ExcelImpStaffReq { + + @ApiModelProperty(value = "姓名") + @NotNull(message = "姓名不能为空!") + private String userName; + + /*@NotNull(message = "账号不能为空!") + @ApiModelProperty(value = "账号") + private String account;*/ + + @ApiModelProperty(value = "角色") + @NotNull(message = "角色不能为空!") + private String roleName; + + @ApiModelProperty(value = "工号") + @NotNull(message = "工号不能为空!") + private String workNumber; + + @ApiModelProperty(value = "一级部门") + @NotNull(message = "一级部门为空!") + private String firstDept; + + @ApiModelProperty(value = "二级部门") + @NotNull(message = "二级部门不能为空!") + private String secondDept; + + @ApiModelProperty(value = "手机号码") + private String phone; + + @ApiModelProperty(value = "邮箱") + private String email; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/ExcelImpStudentReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/ExcelImpStudentReq.java new file mode 100644 index 0000000..b3dad5b --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/ExcelImpStudentReq.java @@ -0,0 +1,49 @@ +package com.huoran.occupationlab.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * @ProjectName: huorantech + * @Package: com.huoran.occupationlab.entity.req + * @ClassName: ExcelImpQuestionReq + * @Description: 批量导入学生所需 + * @Author: Maureen.Rong + * @CreateDate: 2021/8/16 16:49 + * @UpdateDate: 2021/8/16 16:49 + * @Version: 1.0 + */ +@Data +@ApiModel(value = "批量导入学生所需") +public class ExcelImpStudentReq { + + @ApiModelProperty(value = "学生姓名") + @NotNull(message = "学生姓名不能为空!") + private String userName; + + /*@NotNull(message = "账号不能为空!") + @ApiModelProperty(value = "账号") + private String account;*/ + + @ApiModelProperty(value = "学号") + @NotNull(message = "学生学号不能为空!") + private String workNumber; + + @ApiModelProperty(value = "专业") + private String professional; + + @ApiModelProperty(value = "年级") + private String grade; + + @ApiModelProperty(value = "班级") + private String classes; + + @ApiModelProperty(value = "手机号码") + private String phone; + + @ApiModelProperty(value = "邮箱") + private String email; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/ExperimentaForBanklReportReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/ExperimentaForBanklReportReq.java new file mode 100644 index 0000000..17f2756 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/ExperimentaForBanklReportReq.java @@ -0,0 +1,67 @@ +package com.huoran.occupationlab.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.util.List; + +/** + *

+ * 存储各子系统的实验报告 + *

+ * + * @author lr + * @since 2021-09-08 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "银行实验导出word所需参数", description = "银行实验导出word所需参数") +public class ExperimentaForBanklReportReq { + + @ApiModelProperty(value = "用户名称 (学生姓名)") + private String userName; + + @ApiModelProperty(value = "学号") + private String workNumber; + + @ApiModelProperty(value = "实验总结") + private String summarize; + + @ApiModelProperty(value = "实验目的") + private String purpose; + + @ApiModelProperty(value = "老师名称") + private String teacherName; + + @ApiModelProperty(value = "学时") + private String period; + + @ApiModelProperty(value = "实验室名称") + private String laboratory; + + @ApiModelProperty(value = "指导老师:(考核的自动读取发布考核的老师名称,可修改)") + private String instructor; + + @ApiModelProperty(value = "实验项目名称:(自动读取,可修改)") + private String projectName; + + @ApiModelProperty(value = "学生班级:(自动读取学生班级,可修改)") + private String className; + + @ApiModelProperty(value = "得分") + private Integer score; + + @ApiModelProperty(value = "提交时间") + private String submitTime; + + @ApiModelProperty(value = "耗时") + private Integer timeSum; + + @ApiModelProperty(value = "实验数据") + List experimentalData; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/GetDetailByAccountReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/GetDetailByAccountReq.java new file mode 100644 index 0000000..233ba6d --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/GetDetailByAccountReq.java @@ -0,0 +1,25 @@ +package com.huoran.occupationlab.entity.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * @ProjectName: huorantech + * @Package: com.huoran.occupationlab.entity.req + * @ClassName: GetDetailByAccountReq + * @Description: java类作用描述 + * @Author: Maureen.Rong + * @CreateDate: 2021/8/26 16:09 + * @UpdateDate: 2021/8/26 16:09 + * @Version: 1.0 + */ +@Data +public class GetDetailByAccountReq { + @ApiModelProperty("账号") + @NotNull(message = "账号不能为空") + private String account; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/ModifyStaffReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/ModifyStaffReq.java new file mode 100644 index 0000000..efe0131 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/ModifyStaffReq.java @@ -0,0 +1,44 @@ +package com.huoran.occupationlab.entity.req; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + * @Author chen + * @DATE 2021/10/13 15:51 + * @Version 1.0 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "ModifyStaffReq", description = "编辑员工") +public class ModifyStaffReq { + + @ApiModelProperty(value = "员工账号id", example = "503") + private Integer accountId; + + @ApiModelProperty(value = "账号", example = "90000") + private String account; + + @ApiModelProperty(value = "用户姓名", example = "遛遛") + private String userName; + + @ApiModelProperty(value = "工号", example = "90000") + private String workNumber; + + @ApiModelProperty(value = "电话", example = "17788771965") + private String phone; + + @ApiModelProperty(value = "邮箱", example = "17788771965@qq.com") + private String email; + + @ApiModelProperty(value = "账号角色及绑定的一级二级部门信息") + private List roleAndDeptList; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/ModifyStudentReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/ModifyStudentReq.java new file mode 100644 index 0000000..fe6401c --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/ModifyStudentReq.java @@ -0,0 +1,52 @@ +package com.huoran.occupationlab.entity.req; + +import com.baomidou.mybatisplus.annotation.FieldStrategy; +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + *

+ * 学生表 + *

+ * + * @author lr + * @since 2021-08-24 + */ +@Data +@ApiModel(value = "Student对象", description = "学生表") +public class ModifyStudentReq { + @ApiModelProperty(value = "学号/工号") + private String workNumber; + + @ApiModelProperty(value = "学生姓名") + private String userName; + + @ApiModelProperty(value = "账号") + private String account; + + @ApiModelProperty(value = "班级id") + private String classId; + + @ApiModelProperty(value = "电话") + // @TableField(strategy = FieldStrategy.IGNORED) + private String phone; + + @ApiModelProperty(value = "邮箱") + @TableField(strategy = FieldStrategy.IGNORED) + private String email; + + @ApiModelProperty(value = "学校id", hidden = true) + private Integer schoolId; + + @ApiModelProperty(value = "用户id") + private Integer userId; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/OrganizationStudentReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/OrganizationStudentReq.java new file mode 100644 index 0000000..8d38084 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/OrganizationStudentReq.java @@ -0,0 +1,33 @@ +package com.huoran.occupationlab.entity.req; + +import com.huoran.occupationlab.entity.Class; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.util.List; + +/** + * @ProjectName: huorantech + * @Package: com.huoran.occupationlab.entity.req + * @ClassName: PageStudentListReq + * @Description: java类作用描述 + * @Author: Maureen.Rong + * @CreateDate: 2021/8/30 14:29 + * @UpdateDate: 2021/8/30 14:29 + * @Version: 1.0 + */ +@Data +public class OrganizationStudentReq extends PageReq { + @ApiModelProperty(value = "筛选条件", example = "榕", name = "keyWord") + private String keyWord; + + @ApiModelProperty(value = "组织机构id", example = "2", name = "architectureId") + private Integer architectureId; + + @ApiModelProperty(value = "层级(1.专业 2.年级 3.班级)", example = "1", name = "level") + private Integer level; + + @ApiModelProperty(hidden = true) + private List classList; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageAchievementByStuReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageAchievementByStuReq.java new file mode 100644 index 0000000..9c796f4 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageAchievementByStuReq.java @@ -0,0 +1,28 @@ +package com.huoran.occupationlab.entity.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * @description 项目管理请求实体 + * @author: Mr.JK + * @create: 2021-08-27 14:48 + **/ +@Data +@Accessors(chain = true) +public class PageAchievementByStuReq extends PageReq { + + + @ApiModelProperty(value = "课程id", example = "1", required = true) + /*@NotNull(message = "课程id不能为空")*/ + private Integer curriculumId; + + @ApiModelProperty(value = "商品id", example = "1", required = true) + /*@NotNull(message = "课程id不能为空")*/ + private Integer mallId; + + + @ApiModelProperty(value = "账号id", example = "1", required = true, hidden = true) + private Integer accountId; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageAchievementByTeacherReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageAchievementByTeacherReq.java new file mode 100644 index 0000000..5195255 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageAchievementByTeacherReq.java @@ -0,0 +1,59 @@ +package com.huoran.occupationlab.entity.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + * @description 项目管理请求实体 + * @author: Mr.JK + * @create: 2021-08-27 14:48 + **/ +@Data +@Accessors(chain = true) +public class PageAchievementByTeacherReq extends PageReq { + + @ApiModelProperty(value = "项目权限(0、练习 1、考核 2、竞赛)", example = "0", required = true) + @NotNull(message = "项目权限不能为空!") + private Integer permissions; + + @ApiModelProperty(value = "课程id", example = "1", required = true) + private String curriculumId; + + @ApiModelProperty(value = "课程ids", example = "1,3,4", hidden = true) + private String curriculumIds; + + @ApiModelProperty(value = "月份", example = "1") + private Integer month; + + @ApiModelProperty(value = "开始日期", example = "2021-08-18") + private String startTime; + + @ApiModelProperty(value = "结束日期", example = "2021-08-20") + private String endTime; + + @ApiModelProperty(value = "搜索条件", example = "6") + private String keyWord; + + @ApiModelProperty(value = "账号id", example = "1", required = true, hidden = true) + private Integer accountId; + + @ApiModelProperty(value = "班级id") + private String classId; + + @ApiModelProperty(value = "系统id") + private String systemId; + + @ApiModelProperty(value = "是否为管理员") + private Integer isAdmin; + + @ApiModelProperty(value = "商品id") + private Integer mallId; + + @ApiModelProperty(value = "账号列表(用于区分角色展示数据)") + private List accountIdList; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageAssessmentForProjectReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageAssessmentForProjectReq.java new file mode 100644 index 0000000..ac3e9f2 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageAssessmentForProjectReq.java @@ -0,0 +1,47 @@ +package com.huoran.occupationlab.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; + +/** + *

+ * 考核管理 + *

+ * + * @author lr + * @since 2021-08-18 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "分页请求参数", description = "分页请求参数") +public class PageAssessmentForProjectReq extends PageReq { + + @ApiModelProperty(value = "项目名称") + private String projectName; + + @ApiModelProperty(value = "课程id") + @NotNull(message = "课程id不能为空") + private String cid; + + + @ApiModelProperty(value = "商品id") + @NotNull(message = "商品id不能为空") + private Integer mallId; + + @ApiModelProperty(value = "系统id") + @NotNull(message = "系统id不能为空") + private String systemId; + + @ApiModelProperty(value = "账号id", hidden = true) + private Integer accountId; + + @ApiModelProperty(value = "项目权限(0、练习 1、考核 2、竞赛)") + private Integer permissions; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageAssessmentReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageAssessmentReq.java new file mode 100644 index 0000000..2e4744b --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageAssessmentReq.java @@ -0,0 +1,56 @@ +package com.huoran.occupationlab.entity.req; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 考核管理 + *

+ * + * @author lr + * @since 2021-08-18 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "分页请求参数", description = "分页请求参数") +public class PageAssessmentReq extends PageReq { + + @ApiModelProperty(value = "搜索框筛选条件 默认不传") + private String keyWord; + + @ApiModelProperty(value = "发布类型(1、手动发布 2、定时发布) 默认不传") + private Integer type; + + @ApiModelProperty(value = "状态(0、待开始 1、进行中 2、已结束) 默认不传") + private Integer status; + + @ApiModelProperty(value = "课程id 默认不传") + private Integer curriculumId; + + @ApiModelProperty(value = "月份(传值 1 3 6) 默认不传") + private Integer month; + + @ApiModelProperty(value = "账号id", name = "accountId", example = "1", required = true) + @NotNull(message = "账号id不能为空") + private Integer accountId; + + @ApiModelProperty(value = "开始时间", name = "startTime", example = "2021-08-26") + private String startTime; + @ApiModelProperty(value = "结束时间", name = "startTime", example = "2021-08-30") + private String endTime; + + @ApiModelProperty(value = "商品id") + private Integer mallId; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageContestListReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageContestListReq.java new file mode 100644 index 0000000..7df6dd5 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageContestListReq.java @@ -0,0 +1,51 @@ +package com.huoran.occupationlab.entity.req; + +import lombok.Data; + +import java.util.Date; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * @描述:竞赛管理表 + * @作者: Rong + * @日期: 2022-06-16 + */ +@Data +@ApiModel(value = "赛事列表分页") +public class PageContestListReq extends PageReq{ + + @ApiModelProperty(value = "关键词(竞赛名称/创建人)",example = "事") + private String keyWord; + + @ApiModelProperty(value = "发布状态(0未发布,1已发布)") + private Integer publishStatus; + + @ApiModelProperty(value = "大赛来源(0中台,1职站)",example = "1") + private String platformSource; + + @ApiModelProperty(value = "大赛范围(0:本校内 1:全平台 2.指定区域、院校)",example = "0") + private String competitionScope; + + @ApiModelProperty(value = "开始时间") + private String startTime; + + @ApiModelProperty(value = "结束时间") + private String endTime; + + @ApiModelProperty(value = "省") + private Integer provinceId; + + @ApiModelProperty(value = "市") + private Integer cityId; + + @ApiModelProperty(value = "排序(1:近期排名 2.最近更新)") + private Integer sequence; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "是否登录:-1未登录/1已登录") + private Integer isLogin; +} \ No newline at end of file diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageRegistrationStaffReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageRegistrationStaffReq.java new file mode 100644 index 0000000..d1dcc99 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageRegistrationStaffReq.java @@ -0,0 +1,27 @@ +package com.huoran.occupationlab.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @描述:竞赛管理表 + * @作者: Rong + * @日期: 2022-06-16 + */ +@Data +@ApiModel(value = "报名人员分页参数列表") +public class PageRegistrationStaffReq extends PageReq{ + + + + + @ApiModelProperty(value = "关键词(学生姓名/手机号)",example = "18818574533") + private String keyWord; + + @ApiModelProperty(value = "赛事ID",example = "1485860415656255489") + private String contestId; + + + +} \ No newline at end of file diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageReq.java new file mode 100644 index 0000000..6d14f2e --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageReq.java @@ -0,0 +1,28 @@ +package com.huoran.occupationlab.entity.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @ProjectName: huorantech + * @Package: com.huoran.occupationlab.entity.req + * @ClassName: PageReq + * @Description: 分页 + * @Author: Maureen.Rong + * @CreateDate: 2021/8/12 15:10 + * @UpdateDate: 2021/8/12 15:10 + * @Version: 1.0 + */ +@Data +public class PageReq { + + @ApiModelProperty(value = "当前页数", name = "pageNum", example = "1", required = true) + private Integer pageNum; + + @ApiModelProperty(value = "当前页需要显示的数量", name = "pageSize", example = "10", required = true) + private Integer pageSize; + + @ApiModelProperty(hidden = true) + private Integer schoolId; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageStaffListReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageStaffListReq.java new file mode 100644 index 0000000..4241c5b --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageStaffListReq.java @@ -0,0 +1,23 @@ +package com.huoran.occupationlab.entity.req; + +import cn.hutool.db.Page; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @描述:员工管理列表请求参数 + * @作者: Rong + * @日期: 2021/10/14 14:25 + */ +@Data +public class PageStaffListReq extends PageReq { + + @ApiModelProperty(value = "搜索关键词", example = "1") + private String keyWord; + + @ApiModelProperty(value = "员工年级表主键ID", example = "1") + private String gradeId; + + @ApiModelProperty(value = "员工部门主键ID", example = "1") + private String staffArchitectureId; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageStuAssessmentReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageStuAssessmentReq.java new file mode 100644 index 0000000..1da52f5 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageStuAssessmentReq.java @@ -0,0 +1,52 @@ +package com.huoran.occupationlab.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 考核管理 + *

+ * + * @author lr + * @since 2021-08-18 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "学生考核列表", description = "分页请求参数") +public class PageStuAssessmentReq extends PageReq { + + @ApiModelProperty(value = "搜索框筛选条件 默认不传", name = "keyWord", example = "K") + private String keyWord; + + @ApiModelProperty(value = "实验状态(0、待开始 1、进行中 2、已结束) 默认不传", name = "status", example = "0") + private Integer status; + + @ApiModelProperty(value = "系统名称(非id) 默认不传") + private String sysName; + + @ApiModelProperty(value = "月份(传值 1 3 6) 默认不传") + private Integer month; + + @ApiModelProperty(value = "学生账号id", name = "accountId", example = "2", required = true) + private Integer accountId; + + @ApiModelProperty(value = "班级id", name = "accountId", example = "103", required = true) + private Integer classId; + + @ApiModelProperty(value = "课程id", name = "curriculumId") + private Integer curriculumId; + + @ApiModelProperty(value = "商品id", name = "mallId") + private Integer mallId; + + @ApiModelProperty(value = "开始时间", name = "startTime", example = "2021-08-26") + private String startTime; + @ApiModelProperty(value = "结束时间", name = "startTime", example = "2021-08-30") + private String endTime; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageStudentListReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageStudentListReq.java new file mode 100644 index 0000000..e2aa28b --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageStudentListReq.java @@ -0,0 +1,28 @@ +package com.huoran.occupationlab.entity.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @ProjectName: huorantech + * @Package: com.huoran.occupationlab.entity.req + * @ClassName: PageStudentListReq + * @Description: java类作用描述 + * @Author: Maureen.Rong + * @CreateDate: 2021/8/30 14:29 + * @UpdateDate: 2021/8/30 14:29 + * @Version: 1.0 + */ +@Data +public class PageStudentListReq extends PageReq { + @ApiModelProperty(value = "筛选条件", example = "榕", name = "keyWord") + private String keyWord; + + @ApiModelProperty(value = "类型:必填一个(1.所有学生 2.未加入班级学生)", required = true, example = "1") + @NotBlank(message = "类型不能为空") + private Integer type; + + private Integer accountId; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageStudentTheoreticalCourseReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageStudentTheoreticalCourseReq.java new file mode 100644 index 0000000..6cffcaf --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageStudentTheoreticalCourseReq.java @@ -0,0 +1,28 @@ +package com.huoran.occupationlab.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +@Data +@ApiModel(value = "学生端分页查询课程所需参数", description = "学生端分页查询课程所需参数") +public class PageStudentTheoreticalCourseReq extends PageReq { + + + @ApiModelProperty(value = "关键字") + private String keyWord; + + @ApiModelProperty(value = "课程类型(0.免费 1.付费)") + private Integer courseType; + + @ApiModelProperty(value = "课程分类id") + private Integer categoryId; + + @ApiModelProperty(value = "来源(0.共享课堂 1.本校课程)") + private Integer courseSource; + + @ApiModelProperty(hidden = true) + private Integer accountId; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageSysJobLogReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageSysJobLogReq.java new file mode 100644 index 0000000..615f315 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageSysJobLogReq.java @@ -0,0 +1,71 @@ +package com.huoran.occupationlab.entity.req; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 定时任务日志 + * + * @author cheney + * @version V1.0 + * @date 2022年7月28日 + */ +@EqualsAndHashCode(callSuper = false) +@Data +public class PageSysJobLogReq extends PageReq { + + /** + * 任务日志id + */ + @TableId("id") + private String id; + + /** + * 任务id + */ + @TableField("job_id") + private String jobId; + + /** + * spring bean名称 + */ + @TableField("bean_name") + private String beanName; + + /** + * 参数 + */ + @TableField("params") + private String params; + + /** + * 任务状态 0:成功 1:失败 + */ + @TableField("status") + private Integer status; + + /** + * 失败信息 + */ + @TableField("error") + private String error; + + /** + * 耗时(单位:毫秒) + */ + @TableField("times") + private Integer times; + + /** + * 创建时间 + */ + @TableField(value = "create_time", fill = FieldFill.INSERT) + private Date createTime; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageSysJobReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageSysJobReq.java new file mode 100644 index 0000000..eccac3e --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageSysJobReq.java @@ -0,0 +1,70 @@ +package com.huoran.occupationlab.entity.req; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 定时任务 + * + * @author cheney + * @version V1.0 + * @date 2022年7月28日 + */ +@EqualsAndHashCode(callSuper = false) +@Data +@TableName("sys_job") +public class PageSysJobReq extends PageReq { + /** + * 任务调度参数key + */ + + /** + * 任务id + */ + @TableId("id") + private String id; + + /** + * spring bean名称 + */ + @TableField("bean_name") + private String beanName; + + /** + * 参数 + */ + @TableField("params") + private String params; + + /** + * cron表达式 + */ + @TableField("cron_expression") + private String cronExpression; + + /** + * 任务状态 0:正常 1:暂停 + */ + @TableField("status") + private Integer status; + + /** + * 备注 + */ + @TableField("remark") + private String remark; + + /** + * 创建时间 + */ + @TableField(value = "create_time", fill = FieldFill.INSERT) + private Date createTime; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageSysLogReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageSysLogReq.java new file mode 100644 index 0000000..21ae283 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageSysLogReq.java @@ -0,0 +1,48 @@ +package com.huoran.occupationlab.entity.req; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.util.Date; + +/** + * 操作日志 + * + * @author cheney + * @version V1.0 + * @date 2022年7月28日 + */ +@EqualsAndHashCode(callSuper = true) +@Data +public class PageSysLogReq extends PageReq { + @TableId + private String id; + + private String userId; + + private String userName; + + private String operation; + + private Integer time; + + private String method; + + private String params; + + private String ip; + + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @TableField(exist = false) + private String startTime; + + @TableField(exist = false) + private String endTime; + +} \ No newline at end of file diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageTheoreticalCourseReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageTheoreticalCourseReq.java new file mode 100644 index 0000000..d13ee9a --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageTheoreticalCourseReq.java @@ -0,0 +1,38 @@ +package com.huoran.occupationlab.entity.req; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + + +@Data +@ApiModel(value = "分类查询课程所需参数", description = "分类查询课程所需参数") +public class PageTheoreticalCourseReq extends PageReq { + + + @ApiModelProperty(value = "关键字") + private String keyWord; + + @ApiModelProperty(value = "课程类型(0.免费 1.付费)") + private Integer courseType; + + @ApiModelProperty(value = "平台来源(0中台,1职站)") + private Integer platformSource; + + @ApiModelProperty(value = "可见范围(0:本校内 1:全平台 2.指定区域、院校)") + private Integer visibleRange; + + @ApiModelProperty(value = "课程分类id") + private Integer categoryId; + + @ApiModelProperty(value = "创建平台(0为平台自建,1为院校创建)") + private Integer createPlatform; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PerformanceUnderProductReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PerformanceUnderProductReq.java new file mode 100644 index 0000000..54f76c3 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PerformanceUnderProductReq.java @@ -0,0 +1,44 @@ +package com.huoran.occupationlab.entity.req; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + * 产品下练习、考核成绩请求参数 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class PerformanceUnderProductReq extends PageReq { + + @ApiModelProperty(value = "产品id") + private Integer mallId; + + @ApiModelProperty(value = "筛选类型(0、练习 1、考核 2、竞赛)") + private Integer permissions; + + @ApiModelProperty(value = "关键字") + private String keyWord; + + + @ApiModelProperty(value = "学生账号id(查看学生全部成绩详情必传)") + private Integer studentAccountId; + + @ApiModelProperty(value = "班级id") + private Integer classId; + + @ApiModelProperty(value = "课程id") + private Integer cid; + + //课程 + /*@ApiModelProperty(value = "课程名称") + private String goodsName;*/ + + /* //班级 + @ApiModelProperty(value = "班级名称") + private String className;*/ + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/ProjectManageReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/ProjectManageReq.java new file mode 100644 index 0000000..859d855 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/ProjectManageReq.java @@ -0,0 +1,74 @@ +package com.huoran.occupationlab.entity.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.List; + +/** + * @description 项目管理请求实体 + * @author: Mr.JK + * @create: 2021-08-27 14:48 + **/ +@Data +@Accessors(chain = true) +public class ProjectManageReq implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "项目名称") + private String projectName; + + @ApiModelProperty(value = "项目权限(0、练习 1、考核 2、竞赛)") + private Integer permissions; + + @ApiModelProperty(value = "系统id") + @NotNull(message = "系统id不能为空!") + private String systemId; + + @ApiModelProperty(value = "创建人角色(0、系统 1、老师 2、全部)") + @NotNull(message = "创建人不能为空!") + private Integer founder; + + @ApiModelProperty(value = "状态(0、草稿箱 1、已发布)") + private Integer state; + + @ApiModelProperty(value = "平台:职站->1 中台->3") + private Integer platformId; + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + @ApiModelProperty(value = "起始页") + private Integer pageNum; + + @ApiModelProperty(value = "页数") + private Integer pageSize; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "是否是本校超管以及管理员(0为否 1为是)") + private Integer isAdmin; + + @ApiModelProperty(value = "课程id") + private String cid; + + @ApiModelProperty(value = "用于判断职站项目管理学校之间的启用禁用") + private Integer occupationlabDel; + + @ApiModelProperty(value = "职站当前登录用户角色") + private String occupationlabRole; + + + @ApiModelProperty(value = "账号ids") + private List accountIdList; + + @ApiModelProperty(value = "商品id") + private Integer mallId; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/QuestionsAddReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/QuestionsAddReq.java new file mode 100644 index 0000000..413888d --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/QuestionsAddReq.java @@ -0,0 +1,71 @@ +package com.huoran.occupationlab.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 试题的基本信息表 + * + * @author gongsj + */ +@Data +@ApiModel(value = "QuestionsAddRequest", description = "添加试题请求体对象") +public class QuestionsAddReq { + /** + * 题型:1、单选题,2、多选题,3、判断题 + */ + @ApiModelProperty(value = "题型:1、单选题,2、多选题,3、判断题", name = "questionType", example = "1", required = true) + private Integer questionType; + /** + * 题干信息 + */ + @ApiModelProperty(value = "题干信息", name = "questionStem", example = "世界上最大的哺乳动物是什么?", required = true) + private String questionStem; + /** + * A选项内容 + */ + @ApiModelProperty(value = "A选项内容", name = "optionA", example = "鲸鱼") + private String optionA; + /** + * B选项内容 + */ + @ApiModelProperty(value = "B选项内容", name = "optionB", example = "鲨鱼") + private String optionB; + /** + * C选项内容 + */ + @ApiModelProperty(value = "C选项内容", name = "optionC", example = "河马") + private String optionC; + /** + * D选项内容 + */ + @ApiModelProperty(value = "D选项内容", name = "optionD", example = "豹子") + private String optionD; + /** + * E选项内容 + */ + @ApiModelProperty(value = "E选项内容", name = "optionE", example = "大象") + private String optionE; + /** + * F选项内容 + */ + @ApiModelProperty(value = "F选项内容", name = "optionF", example = "老虎") + private String optionF; + /** + * 正确答案 + */ + @ApiModelProperty(value = "正确答案", name = "answer", example = "A", required = true) + private String answer; + /** + * 答案解析 + */ + @ApiModelProperty(value = "答案解析", name = "answerAnalysis", example = "鲸鱼是最大的哺乳动物") + private String answerAnalysis; + + @ApiModelProperty(value = "创建人用户账号id", name = "accountId", example = "1", required = true) + private Integer accountId; + + @ApiModelProperty(value = "学校id", name = "schoolId", example = "1") + private Integer schoolId; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/QuestionsImportReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/QuestionsImportReq.java new file mode 100644 index 0000000..dd774cf --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/QuestionsImportReq.java @@ -0,0 +1,81 @@ +package com.huoran.occupationlab.entity.req; + +import com.huoran.occupationlab.utils.poi.ExcelAttribute; +import lombok.Data; +import lombok.ToString; + +/** + * 试题的基本信息表 + * + * @author gongsj + */ +@Data +@ToString +public class QuestionsImportReq { + /** + * 第几行 + */ + private Integer index; + + /** + * 题干,问题描述 + */ + @ExcelAttribute(sort = 0) + private String questionStem; + /** + * 题型 + */ + @ExcelAttribute(sort = 1) + private String questionTypeName; + /** + * 选项A + */ + @ExcelAttribute(sort = 2) + private String optionA; + /** + * 选项B + */ + @ExcelAttribute(sort = 3) + private String optionB; + /** + * 选项C + */ + @ExcelAttribute(sort = 4) + private String optionC; + /** + * 选项D + */ + @ExcelAttribute(sort = 5) + private String optionD; + /** + * 选项E + */ + @ExcelAttribute(sort = 6) + private String optionE; + /** + * 选项F + */ + @ExcelAttribute(sort = 7) + private String optionF; + /** + * 正确答案 + */ + @ExcelAttribute(sort = 8) + private String answer; + /** + * 答案解析 + */ + @ExcelAttribute(sort = 9) + private String answerAnalysis; + + public String toStringForCompare() { + return questionStem + + questionTypeName + + optionA + + optionB + + optionC + + optionD + + optionE + + optionF; + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/QuestionsQueryReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/QuestionsQueryReq.java new file mode 100644 index 0000000..853f777 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/QuestionsQueryReq.java @@ -0,0 +1,33 @@ +package com.huoran.occupationlab.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 试题的基本信息表 + * + * @author gongsj + */ +@Data +@ApiModel(value = "QuestionsQueryRequest", description = "条件查询请求对象") +public class QuestionsQueryReq extends PageReq { + + /** + * 题干,问题描述 + */ + @ApiModelProperty(value = "题干,问题描述", name = "questionStem", example = "世界上最大的哺乳动物是什么?") + private String questionStem; + + /** + * 题型 + */ + @ApiModelProperty(value = "题型:1、单选题,2、多选题,3、判断题", name = "questionType", example = "1") + private Integer questionType; + + @ApiModelProperty(value = "创建人用户账号id", name = "accountId", example = "1", required = true) + private Integer accountId; + + @ApiModelProperty(value = "学校id", name = "schoolId", example = "1") + private Integer schoolId; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/QuestionsUpdateReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/QuestionsUpdateReq.java new file mode 100644 index 0000000..61ec60d --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/QuestionsUpdateReq.java @@ -0,0 +1,70 @@ +package com.huoran.occupationlab.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 试题的基本信息表 + * + * @author gongsj + */ +@Data +@ApiModel(value = "QuestionsUpdateRequest", description = "修改试题请求体对象") +public class QuestionsUpdateReq { + /** + * 主键 + */ + @ApiModelProperty(value = "主键", name = "id", example = "1", required = true) + private Integer id; + /** + * 题型:1、单选题,2、多选题,3、判断题 + */ + @ApiModelProperty(value = "题型:1、单选题,2、多选题,3、判断题", name = "questionType", example = "1", required = true) + private Integer questionType; + /** + * 题干信息 + */ + @ApiModelProperty(value = "题干信息", name = "questionStem", example = "世界上最大的哺乳动物是什么?", required = true) + private String questionStem; + /** + * A选项内容 + */ + @ApiModelProperty(value = "A选项内容", name = "optionA", example = "鲸鱼") + private String optionA; + /** + * B选项内容 + */ + @ApiModelProperty(value = "B选项内容", name = "optionB", example = "鲨鱼") + private String optionB; + /** + * C选项内容 + */ + @ApiModelProperty(value = "C选项内容", name = "optionC", example = "河马") + private String optionC; + /** + * D选项内容 + */ + @ApiModelProperty(value = "D选项内容", name = "optionD", example = "豹子") + private String optionD; + /** + * E选项内容 + */ + @ApiModelProperty(value = "E选项内容", name = "optionE", example = "大象") + private String optionE; + /** + * F选项内容 + */ + @ApiModelProperty(value = "F选项内容", name = "optionF", example = "老虎") + private String optionF; + /** + * 正确答案 + */ + @ApiModelProperty(value = "正确答案", name = "answer", example = "A", required = true) + private String answer; + /** + * 答案解析 + */ + @ApiModelProperty(value = "答案解析", name = "answerAnalysis", example = "鲸鱼是最大的哺乳动物") + private String answerAnalysis; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/StudentPerformanceAnalysisReq.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/StudentPerformanceAnalysisReq.java new file mode 100644 index 0000000..370fbad --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/req/StudentPerformanceAnalysisReq.java @@ -0,0 +1,30 @@ +package com.huoran.occupationlab.entity.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.util.List; + +/** + * 学生成绩分布分析 + */ +@Data +@Accessors(chain = true) +public class StudentPerformanceAnalysisReq { + + + @ApiModelProperty(value = "开始时间") + private String startTime; + + @ApiModelProperty(value = "结束时间") + private String endTime; + + @ApiModelProperty(value = "课程id") + private List cids; + + + @ApiModelProperty(value = "商品id") + private List mallIds; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/AcademicLeadersRankingResp.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/AcademicLeadersRankingResp.java new file mode 100644 index 0000000..1c04b6a --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/AcademicLeadersRankingResp.java @@ -0,0 +1,34 @@ +package com.huoran.occupationlab.entity.resp; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 学霸排行榜 + */ +@Data +@Accessors(chain = true) +public class AcademicLeadersRankingResp { + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + + @ApiModelProperty(value = "平均分") + private double avgScore; + + @ApiModelProperty(value = "练习次数") + private Integer practiceNumber; + + @ApiModelProperty(value = "用户名称") + private String userName; + + @ApiModelProperty(value = "班级名称") + private String className; + + @ApiModelProperty(value = "学校名称") + private String schoolName; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/AchievementByPracticeResp.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/AchievementByPracticeResp.java new file mode 100644 index 0000000..410e877 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/AchievementByPracticeResp.java @@ -0,0 +1,47 @@ +package com.huoran.occupationlab.entity.resp; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import cn.afterturn.easypoi.excel.annotation.ExcelTarget; +import com.baomidou.mybatisplus.annotation.TableField; +import com.huoran.occupationlab.entity.Class; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.util.Date; +import java.util.List; + +/** + *

+ * 项目管理表 + *

+ * + * @author Mr.JK + * @since 2021-08-26 + */ +@Data +@Accessors(chain = true) +@ExcelTarget("AchievementByPracticeResp") +public class AchievementByPracticeResp { + + @ApiModelProperty(value = "项目id") + private Integer projectId; + + @ApiModelProperty(value = "项目名称") + private String projectName; + + @ApiModelProperty(value = "创建时间") + private Date createTime; + + @ApiModelProperty(value = "成绩报告数量") + private Integer experimentalNumber; + + @ApiModelProperty(value = "是否为内置项目(1为内置项目 默认为0)") + private Integer isAdmin; + + @ApiModelProperty(value = "是否删除(1为已删除 默认为0)") + private Integer isDel; + + @ApiModelProperty(value = "课程引用项目是否移除(1为已删除 默认为0)") + private Integer courseDel; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/AchievementResp.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/AchievementResp.java new file mode 100644 index 0000000..733a53f --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/AchievementResp.java @@ -0,0 +1,120 @@ +package com.huoran.occupationlab.entity.resp; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import cn.afterturn.easypoi.excel.annotation.ExcelTarget; +import com.baomidou.mybatisplus.annotation.*; +import com.huoran.occupationlab.entity.Class; +import com.huoran.occupationlab.entity.req.ClassReq; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + *

+ * 项目管理表 + *

+ * + * @author Mr.JK + * @since 2021-08-26 + */ +@Data +@Accessors(chain = true) +@ExcelTarget("AchievementResp") +public class AchievementResp { + + @ApiModelProperty(value = "项目id") + private Integer projectId; + + @ApiModelProperty(value = "项目名称") + private String projectName; + + @ApiModelProperty(value = "课程名称") + private String curriculumName; + + @ApiModelProperty(value = "项目权限(0、练习 1、考核 2、竞赛)") + private Integer permissions; + + @ApiModelProperty(value = "系统id") + private Integer systemId; + + @ApiModelProperty(value = "创建时间") + private Date createTime; + + @ApiModelProperty(value = "成绩报告数量") + private Integer experimentalNumber; + + @ApiModelProperty(value = "考核id") + private Integer assessmentId; + + @ApiModelProperty(value = "班级") + private String className; + + @ApiModelProperty(value = "实验名称") + private String experimentalName; + + @ApiModelProperty(value = "班级id") + private String classId; + + @ApiModelProperty(value = "耗时") + private String timeSum; + + @ApiModelProperty(value = "成绩报告id") + private Integer reportId; + + @Excel(name = "学校名称", orderNum = "1", isImportField = "schoolName", width = 30) + @ApiModelProperty(value = "学校名称") + private String schoolName; + + @Excel(name = "学生姓名", orderNum = "2", isImportField = "userName", width = 30) + @ApiModelProperty(value = "学生姓名") + private String userName; + + @Excel(name = "学号", orderNum = "3", isImportField = "workNumber", width = 30) + @ApiModelProperty(value = "学号") + private String workNumber; + + @Excel(name = "分数", orderNum = "4", isImportField = "score", width = 30) + @ApiModelProperty(value = "分数") + private Integer score; + + @Excel(name = "提交时间", orderNum = "5", isImportField = "submitTime", width = 30) + @ApiModelProperty(value = "提交时间") + private String submitTime; + + @ApiModelProperty(value = "最高分") + private Integer hightScore; + + @ApiModelProperty(value = "最近实验时间") + private String lastTime; + + @ApiModelProperty(value = "练习次数") + private Integer practiceNum; + + @ApiModelProperty(value = "累计时长") + private String duration; + + @ApiModelProperty(value = "进入时间") + private String startTime; + + @ApiModelProperty(value = "结束时间") + private String endTime; + + @ApiModelProperty(value = "是否删除") + private Integer isDel; + + @ApiModelProperty(value = "班级信息列表") + @TableField(exist = false) + private List classList; + + @ApiModelProperty(value = "课程id") + private Integer curriculumId; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/ActiveLeaderboardtResp.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/ActiveLeaderboardtResp.java new file mode 100644 index 0000000..1482238 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/ActiveLeaderboardtResp.java @@ -0,0 +1,28 @@ +package com.huoran.occupationlab.entity.resp; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +@Data +@ApiModel(value = "活跃排行榜", description = "活跃排行榜") +public class ActiveLeaderboardtResp { + + + @ApiModelProperty(value = "班级id(String类型)") + private String classIds; + + @ApiModelProperty(value = "实验报告id") + private Integer reportId; + + @ApiModelProperty(value = "学生ID") + private Integer studentId; + + @ApiModelProperty(value = "学校名字") + private String schoolName; + + @ApiModelProperty(value = "活跃指数") + private String activityIndex ; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/AssessProjectsUnderTheProductResp.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/AssessProjectsUnderTheProductResp.java new file mode 100644 index 0000000..4d50930 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/AssessProjectsUnderTheProductResp.java @@ -0,0 +1,68 @@ +package com.huoran.occupationlab.entity.resp; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 产品下考核项目情况 + */ +@Data +public class AssessProjectsUnderTheProductResp { + + + @ApiModelProperty(value = "序号") + @Excel(name = "序号", orderNum = "1", isImportField = "rownum", width = 30) + private Integer rownum; + + //课程 + @ApiModelProperty(value = "课程名称") + @Excel(name = "课程名称", orderNum = "2", mergeVertical = true, isImportField = "goodsName", width = 30) + private String goodsName; + + //班级 + @ApiModelProperty(value = "班级名称") + @Excel(name = "班级名称", orderNum = "3", mergeVertical = true, isImportField = "className", width = 30) + private String className; + + + @ApiModelProperty(value = "姓名") + @Excel(name = "姓名", orderNum = "3", mergeVertical = true, isImportField = "username", width = 30) + private String userName; + + + @ApiModelProperty(value = "学号") + @Excel(name = "学号", orderNum = "4", mergeVertical = true, isImportField = "workNumber", width = 30) + private String workNumber; + + @ApiModelProperty(value = "当前学生已经考核次数") + @Excel(name = "参加考核次数", orderNum = "5", mergeVertical = false, isImportField = "totalNumberOfParticipants", width = 30) + private String totalNumberOfParticipants; + + + @ApiModelProperty(value = "平均用时") + @Excel(name = "平均用时", orderNum = "6", mergeVertical = false, isImportField = "averageTimeSpent", width = 30) + private Integer averageTimeSpent; + + @ApiModelProperty(value = "平均分") + @Excel(name = "平均分", orderNum = "7", mergeVertical = false, isImportField = "avgScore", width = 30) + private String averageScore; + + @ApiModelProperty(value = "最高分") + @Excel(name = "最高分", orderNum = "8", mergeVertical = false, isImportField = "maxScore", width = 30) + private Integer maxScore; + + @ApiModelProperty(value = "最低分") + @Excel(name = "最低分", orderNum = "9", mergeVertical = false, isImportField = "minScore", width = 30) + private Integer minScore; + + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "发布的考核总次数") + private Integer totalAssessment; + + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/AssessScoreDetailsUnderProductResp.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/AssessScoreDetailsUnderProductResp.java new file mode 100644 index 0000000..5f87220 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/AssessScoreDetailsUnderProductResp.java @@ -0,0 +1,64 @@ +package com.huoran.occupationlab.entity.resp; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 产品下考核成绩详情 + */ +@Data +@Accessors(chain = true) +public class AssessScoreDetailsUnderProductResp { + + @ApiModelProperty(value = "序号") + @Excel(name = "序号", orderNum = "1", isImportField = "rownum", width = 30) + private Integer rownum; + + //课程 + @ApiModelProperty(value = "课程名称") + @Excel(name = "课程名称", orderNum = "2", mergeVertical = true, isImportField = "goodsName", width = 30) + private String goodsName; + + //班级 + @ApiModelProperty(value = "班级名称") + @Excel(name = "班级名称", orderNum = "3", mergeVertical = true, isImportField = "className", width = 30) + private String className; + + @ApiModelProperty(value = "姓名") + @Excel(name = "姓名", orderNum = "4", mergeVertical = true, isImportField = "username", width = 30) + private String userName; + + + @ApiModelProperty(value = "学号") + @Excel(name = "学号", orderNum = "5", mergeVertical = true, isImportField = "workNumber", width = 30) + private String workNumber; + + @ApiModelProperty(value = "考核名称") + @Excel(name = "考核名称", orderNum = "6", mergeVertical = false, isImportField = "experimentalName", width = 30) + private String experimentalName; + + + @ApiModelProperty(value = "用时") + @Excel(name = "用时", orderNum = "7", mergeVertical = false, isImportField = "timeSum", width = 30) + private Integer timeSum; + + + @ApiModelProperty(value = "分数") + @Excel(name = "分数", orderNum = "8", mergeVertical = false, isImportField = "score", width = 30) + private String score; + + @ApiModelProperty(value = "项目id") + private Integer projectId; + + @ApiModelProperty(value = "班级id") + private String classId; + + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "实验报告id") + private Integer reportId; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/ClassStatisticsResp.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/ClassStatisticsResp.java new file mode 100644 index 0000000..5fa23ee --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/ClassStatisticsResp.java @@ -0,0 +1,24 @@ +package com.huoran.occupationlab.entity.resp; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + + +@Data +@ApiModel(value = "班级统计", description = "班级统计") +public class ClassStatisticsResp { + + + + @ApiModelProperty(value = "班级id(Integer类型)") + private Integer classId; + + @ApiModelProperty(value = "统计次数") + private Integer countNumber; + + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/ContestRangeResp.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/ContestRangeResp.java new file mode 100644 index 0000000..675d06c --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/ContestRangeResp.java @@ -0,0 +1,42 @@ +package com.huoran.occupationlab.entity.resp; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + *

+ * + *

+ * + * @author lr + * @since 2022-06-16 + */ +@Data +@ApiModel(value = "大赛范围选择") +public class ContestRangeResp { + + + + @ApiModelProperty(value = "竞赛主键") + private String contestId; + + @ApiModelProperty(value = "省") + private String provinceName; + + @ApiModelProperty(value = "市") + private String cityName; + + @ApiModelProperty(value = "学校id") + private String schoolName; + + @ApiModelProperty(value = "范围类型(0为学校 1为地区)") + private Integer type; + +} \ No newline at end of file diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/EnterExamResp.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/EnterExamResp.java new file mode 100644 index 0000000..23037bf --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/EnterExamResp.java @@ -0,0 +1,29 @@ +package com.huoran.occupationlab.entity.resp; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * @描述: + * @作者: Rong + * @日期: 2021/11/17 11:18 + */ +@Data +@Accessors(chain = true) +public class EnterExamResp { + @ApiModelProperty(value = "项目id") + private Integer projectId; + + @ApiModelProperty(value = "跳转路径") + private String url; + + @ApiModelProperty(value = "系统id") + private Integer systemId; + + @ApiModelProperty(value = "系统id") + private Integer assessmentId; + + @ApiModelProperty(value = "课程id") + private Integer cid; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/ErrorRateAnalysisResp.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/ErrorRateAnalysisResp.java new file mode 100644 index 0000000..1b78076 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/ErrorRateAnalysisResp.java @@ -0,0 +1,26 @@ +package com.huoran.occupationlab.entity.resp; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * 错误率分析 + */ +@Data +public class ErrorRateAnalysisResp { + + + /*@ApiModelProperty(value = "最高错误率名称") + private ScorePointsUnderTheItemResp highestErrorRate; + + @ApiModelProperty(value = "最低错误率名称") + private ScorePointsUnderTheItemResp minimumErrorRate;*/ + + + @ApiModelProperty(value = "获取项目下的全部判分点以及错误率") + private List scoringPointList; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/ExamStatisticsResp.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/ExamStatisticsResp.java new file mode 100644 index 0000000..a358a1b --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/ExamStatisticsResp.java @@ -0,0 +1,28 @@ +package com.huoran.occupationlab.entity.resp; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 平台考试数据统计 + */ +@Data +@Accessors(chain = true) +public class ExamStatisticsResp { + + @ApiModelProperty(value = "考试总场次") + private Integer totalNumberOfExams; + + + @ApiModelProperty(value = "参考人数") + private Integer referenceNumber; + + @ApiModelProperty(value = "考试通过率") + private String examPassRate; + + @ApiModelProperty(value = "通过人数") + private Integer numberOfPeoplePassed; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/ExperimentOverviewResp.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/ExperimentOverviewResp.java new file mode 100644 index 0000000..3d20ce2 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/ExperimentOverviewResp.java @@ -0,0 +1,40 @@ +package com.huoran.occupationlab.entity.resp; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + *

+ * 学生组织架构 + *

+ * + * @author lr + * @since 2021-08-24 + */ +@Data +@ApiModel(value = "实验概览", description = "实验概览") +public class ExperimentOverviewResp { + + + @ApiModelProperty(value = "姓名") + private String userName; + + @ApiModelProperty(value = "实验次数") + private Integer experimentalNum; + + + @ApiModelProperty(value = "时长") + private String duration; + + + @ApiModelProperty(value = "实验平均分") + private double avgScore; + + @ApiModelProperty(value = "实验总分") + private double sumScore; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/ExperimentalReportDataBindingResp.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/ExperimentalReportDataBindingResp.java new file mode 100644 index 0000000..12b3879 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/ExperimentalReportDataBindingResp.java @@ -0,0 +1,31 @@ +package com.huoran.occupationlab.entity.resp; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +/** + * 实验报告数据绑定 + */ +@Data +public class ExperimentalReportDataBindingResp { + + + @ApiModelProperty(value = "实验报告主键") + private Integer reportId; + + + @ApiModelProperty(value = "商品id") + private Integer mallId; + + @ApiModelProperty(value = "原来实验报告绑定的产品id 有可能为0 有可能为空") + private Integer oldMallId; + + @ApiModelProperty(value = "考核id") + private Integer id; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/ExperimentalReportResp.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/ExperimentalReportResp.java new file mode 100644 index 0000000..11af127 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/ExperimentalReportResp.java @@ -0,0 +1,121 @@ +package com.huoran.occupationlab.entity.resp; + +import com.baomidou.mybatisplus.annotation.*; +import com.huoran.occupationlab.entity.UserScore; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + *

+ * 存储各子系统的实验报告 + *

+ * + * @author lr + * @since 2021-09-08 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "实验导出word所需参数", description = "实验导出word所需参数") +public class ExperimentalReportResp implements Serializable { + + @ApiModelProperty(value = "用户名称 (学生姓名)") + @TableField(exist = false) + private String userName; + + @ApiModelProperty(value = "学号") + private String workNumber; + + @ApiModelProperty(value = "实验原理") + private String principle; + + @ApiModelProperty(value = "实验内容") + private String content; + + @ApiModelProperty(value = "实验步骤") + private String step; + + @ApiModelProperty(value = "实验数据") + private String data; + + @ApiModelProperty(value = "实验分析") + private String analysis; + + @ApiModelProperty(value = "实验结论") + private String conclusion; + + @ApiModelProperty(value = "实验总结") + private String summarize; + + @ApiModelProperty(value = "实验器材") + private String equipment; + + @ApiModelProperty(value = "实验目的") + private String purpose; + + @ApiModelProperty(value = "对本实验过程方法及手段的改进建议") + private String improvement; + + @ApiModelProperty(value = "教师评语") + private String comment; + + @ApiModelProperty(value = "老师名称") + @TableField(exist = false) + private String teacherName; + + @ApiModelProperty(value = "学时") + private String period; + + @ApiModelProperty(value = "实验室名称") + private String laboratory; + + @ApiModelProperty(value = "是否启用教师签名(0不启用,1启用,默认0)") + private Integer isSignature; + + @ApiModelProperty(value = "指导老师:(考核的自动读取发布考核的老师名称,可修改)") + private String instructor; + + @ApiModelProperty(value = "实验项目名称:(自动读取,可修改)") + private String projectName; + + @ApiModelProperty(value = "学生班级:(自动读取学生班级,可修改)") + private String className; + + @ApiModelProperty(value = "得分") + private Integer score; + + @ApiModelProperty(value = "进入时间") + private String startTime; + + @ApiModelProperty(value = "结束时间") + private String endTime; + + @ApiModelProperty(value = "提交时间") + private String submitTime; + + @ApiModelProperty(value = "耗时") + private Integer timeSum; + + @ApiModelProperty(value = "实验数据") + List experimentalData; + + @ApiModelProperty(value = "运行图片集合") + @TableField(exist = false) + private List runThePictureList; + + + @ApiModelProperty(value = "运行图片(未截取分割前的)") + @TableField(exist = false) + private String runThePicture; + + @ApiModelProperty(value = "运行结果") + private String runResult; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/ExportAssessmentByStuResp.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/ExportAssessmentByStuResp.java new file mode 100644 index 0000000..e636775 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/ExportAssessmentByStuResp.java @@ -0,0 +1,59 @@ +package com.huoran.occupationlab.entity.resp; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import cn.afterturn.easypoi.excel.annotation.ExcelTarget; +import com.baomidou.mybatisplus.annotation.TableField; +import com.huoran.occupationlab.entity.Class; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.util.Date; +import java.util.List; + +/** + *

+ * 项目管理表 + *

+ * + * @author Mr.JK + * @since 2021-08-26 + */ +@Data +@Accessors(chain = true) +@ExcelTarget("ExportAssessmentByStuResp") +public class ExportAssessmentByStuResp { + + @Excel(name = "课程名称", orderNum = "1", mergeVertical = true, isImportField = "curriculumName", width = 30) + @ApiModelProperty(value = "课程名称") + private String curriculumName; + + @Excel(name = "实验项目名称", orderNum = "2", mergeVertical = true, isImportField = "experimentalName", width = 30) + @ApiModelProperty(value = "实验项目名称") + private String experimentalName; + + @Excel(name = "项目名称", orderNum = "3", mergeVertical = true, isImportField = "projectName", width = 30) + @ApiModelProperty(value = "项目名称") + private String projectName; + + @Excel(name = "得分", orderNum = "4", mergeVertical = true, isImportField = "score", width = 30) + @ApiModelProperty(value = "得分") + private Integer score; + + @Excel(name = "实验班级", orderNum = "5", mergeVertical = true, isImportField = "className", width = 30) + @ApiModelProperty(value = "实验班级") + private String className; + + @Excel(name = "耗时", orderNum = "6", mergeVertical = true, isImportField = "timeSum", width = 30) + @ApiModelProperty(value = "耗时") + private String timeSum; + + @Excel(name = "起始时间", orderNum = "7", mergeVertical = true, isImportField = "startTime", width = 30) + @ApiModelProperty(value = "起始时间") + private String startTime; + + @Excel(name = "结束时间", orderNum = "8", mergeVertical = true, isImportField = "submitTime", width = 30) + @ApiModelProperty(value = "结束时间") + private String submitTime; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/ExportAssessmentByTeacherResp.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/ExportAssessmentByTeacherResp.java new file mode 100644 index 0000000..5468522 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/ExportAssessmentByTeacherResp.java @@ -0,0 +1,54 @@ +package com.huoran.occupationlab.entity.resp; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import cn.afterturn.easypoi.excel.annotation.ExcelTarget; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + *

+ * 项目管理表 + *

+ * + * @author Mr.JK + * @since 2021-08-26 + */ +@Data +@Accessors(chain = true) +@ExcelTarget("ExportAssessmentByTeacherResp") +public class ExportAssessmentByTeacherResp { + + @Excel(name = "序号", orderNum = "1", isImportField = "rownum", width = 30) + @ApiModelProperty(value = "序号") + private Integer rownum; + + @Excel(name = "班级", orderNum = "2", isImportField = "className", width = 30) + @ApiModelProperty(value = "班级") + private String className; + + @Excel(name = "考核名称", orderNum = "3", isImportField = "assessmentName", width = 30) + @ApiModelProperty(value = "考核名称") + private String assessmentName; + + @Excel(name = "学生姓名", orderNum = "4", isImportField = "userName", width = 30) + @ApiModelProperty(value = "学生姓名") + private String userName; + + @Excel(name = "学号", orderNum = "5", isImportField = "workNumber", width = 30) + @ApiModelProperty(value = "学号") + private String workNumber; + + @Excel(name = "分数", orderNum = "6", isImportField = "score", width = 30) + @ApiModelProperty(value = "分数") + private Integer score; + + @Excel(name = "耗时(min)", orderNum = "7", isImportField = "timeSum", width = 30) + @ApiModelProperty(value = "耗时(min)") + private Integer timeSum; + + @Excel(name = "提交时间", orderNum = "8", isImportField = "submitTime", width = 30) + @ApiModelProperty(value = "提交时间") + private String submitTime; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/ExportByStudentResp.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/ExportByStudentResp.java new file mode 100644 index 0000000..7adbfc3 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/ExportByStudentResp.java @@ -0,0 +1,51 @@ +package com.huoran.occupationlab.entity.resp; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import cn.afterturn.easypoi.excel.annotation.ExcelTarget; +import com.baomidou.mybatisplus.annotation.TableField; +import com.huoran.occupationlab.entity.Class; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.util.Date; +import java.util.List; + +/** + *

+ * 项目管理表 + *

+ * + * @author Mr.JK + * @since 2021-08-26 + */ +@Data +@Accessors(chain = true) +@ExcelTarget("ExportByStudentResp") +public class ExportByStudentResp { + + @Excel(name = "项目名称", orderNum = "1", isImportField = "projectName", width = 30) + @ApiModelProperty(value = "项目名称") + private String projectName; + + @Excel(name = "课程名称", orderNum = "2", isImportField = "curriculumName", width = 30) + @ApiModelProperty(value = "课程名称") + private String curriculumName; + + @Excel(name = "最高分", orderNum = "3", isImportField = "hightScore", width = 30) + @ApiModelProperty(value = "最高分") + private Integer hightScore; + + @Excel(name = "练习次数", orderNum = "4", isImportField = "practiceNum", width = 30) + @ApiModelProperty(value = "练习次数") + private Integer practiceNum; + + @Excel(name = "累计实验时长(小时)", orderNum = "5", isImportField = "duration", width = 30) + @ApiModelProperty(value = "累计实验时长(小时)") + private String duration; + + @Excel(name = "最近实验时间", orderNum = "6", isImportField = "lastTime", width = 30) + @ApiModelProperty(value = "最近实验时间") + private String lastTime; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/ExportPracticeByTeacherResp.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/ExportPracticeByTeacherResp.java new file mode 100644 index 0000000..eef71ae --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/ExportPracticeByTeacherResp.java @@ -0,0 +1,50 @@ +package com.huoran.occupationlab.entity.resp; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import cn.afterturn.easypoi.excel.annotation.ExcelTarget; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + *

+ * 项目管理表 + *

+ * + * @author Mr.JK + * @since 2021-08-26 + */ +@Data +@Accessors(chain = true) +@ExcelTarget("ExportPracticeByTeacherResp") +public class ExportPracticeByTeacherResp { + + @Excel(name = "序号", orderNum = "1", isImportField = "rownum", width = 30) + @ApiModelProperty(value = "序号") + private Integer rownum; + + @Excel(name = "班级", orderNum = "2", isImportField = "className", width = 30) + @ApiModelProperty(value = "班级") + private String className; + + @Excel(name = "学生姓名", orderNum = "3", isImportField = "userName", width = 30) + @ApiModelProperty(value = "学生姓名") + private String userName; + + @Excel(name = "学号", orderNum = "4", isImportField = "workNumber", width = 30) + @ApiModelProperty(value = "学号") + private String workNumber; + + @Excel(name = "分数", orderNum = "5", isImportField = "score", width = 30) + @ApiModelProperty(value = "分数") + private Integer score; + + @Excel(name = "耗时(min)", orderNum = "6", isImportField = "timeSum", width = 30) + @ApiModelProperty(value = "耗时(min)") + private Integer timeSum; + + @Excel(name = "提交时间", orderNum = "7", isImportField = "submitTime", width = 30) + @ApiModelProperty(value = "提交时间") + private String submitTime; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/FractionalSegmentResp.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/FractionalSegmentResp.java new file mode 100644 index 0000000..0cdddb6 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/FractionalSegmentResp.java @@ -0,0 +1,59 @@ +package com.huoran.occupationlab.entity.resp; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +/** + * @Description: 职站教师端实验分数返回 + * @auther: Rong + * @date: 2021/9/24 17:02 + */ +@Data +public class FractionalSegmentResp { + + + @ApiModelProperty(value = "0-10") + private Integer num1; + + @ApiModelProperty(value = "11-20") + private Integer num2; + + @ApiModelProperty(value = "21-30") + private Integer num3; + + @ApiModelProperty(value = "31-40") + private Integer num4; + + @ApiModelProperty(value = "41-50") + private Integer num5; + + @ApiModelProperty(value = "51-60") + private Integer num6; + + @ApiModelProperty(value = "61-70") + private Integer num7; + + @ApiModelProperty(value = "71-80") + private Integer num8; + + @ApiModelProperty(value = "81-90") + private Integer num9; + + @ApiModelProperty(value = "91-100") + private Integer num10; + + @ApiModelProperty(value = "人数") + private Integer peopleNum; + + @ApiModelProperty(value = "平均分") + private String avgScore; + + + @ApiModelProperty(value = "最低分") + private String minScore; + + @ApiModelProperty(value = "最高分") + private String maxScore; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/ItemErrorRateUnderProductResp.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/ItemErrorRateUnderProductResp.java new file mode 100644 index 0000000..e68a31a --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/ItemErrorRateUnderProductResp.java @@ -0,0 +1,31 @@ +package com.huoran.occupationlab.entity.resp; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 产品下错误率分析 + */ +@Data +public class ItemErrorRateUnderProductResp { + + + @ApiModelProperty(value = "项目id") + private Integer projectId; + + @ApiModelProperty(value = "项目名称") + private String projectName; + + @ApiModelProperty(value = "当前判分点的错误率") + private String errorRate; + + + @ApiModelProperty(value = "此项目的练习/考核总次数") + private Integer totalNumberOfExercises; + + @ApiModelProperty(value = "当前做错总人数") + private Integer itemErrorCount; + + @ApiModelProperty(value = "参与当前的总人数") + private Integer numberOfParticipants; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/MonthlyOnlineStudyHoursResp.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/MonthlyOnlineStudyHoursResp.java new file mode 100644 index 0000000..6d09c3f --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/MonthlyOnlineStudyHoursResp.java @@ -0,0 +1,23 @@ +package com.huoran.occupationlab.entity.resp; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 本校学生实验数据概率 + */ +@Data +@Accessors(chain = true) +public class MonthlyOnlineStudyHoursResp { + + @ApiModelProperty(value = "平均时长") + private String averageDuration; + + @ApiModelProperty(value = "时间") + private String time; + + + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/MostLabCoursestResp.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/MostLabCoursestResp.java new file mode 100644 index 0000000..7e1a2e3 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/MostLabCoursestResp.java @@ -0,0 +1,33 @@ +package com.huoran.occupationlab.entity.resp; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import cn.afterturn.easypoi.excel.annotation.ExcelTarget; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + *

+ * 本月实验练习数(已提交的)最多的课程名称排名,前三 + *

+ * + * @author Mr.JK + * @since 2021-08-26 + */ +@Data +@Accessors(chain = true) +@ExcelTarget("MostLabCoursestResp") +public class MostLabCoursestResp { + + @ApiModelProperty(value = "课程名称") + private String goodsName; + + + @ApiModelProperty(value = "总数") + private Integer total; + + @ApiModelProperty(value = "课程id") + private Integer curriculumId; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/OverviewOfStudentExperimentDataResp.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/OverviewOfStudentExperimentDataResp.java new file mode 100644 index 0000000..9aeda9f --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/OverviewOfStudentExperimentDataResp.java @@ -0,0 +1,36 @@ +package com.huoran.occupationlab.entity.resp; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 本校学生实验数据概率 + */ +@Data +@Accessors(chain = true) +public class OverviewOfStudentExperimentDataResp { + + @ApiModelProperty(value = "本校学习总人数/院校学生账号数量") + private String numberOfPeopleStudy; + + @ApiModelProperty(value = "累计实验次数(即所有人练习和考核(已提交的)的次数之和(即实验报告数量))") + private String numberOfExperiments; + + @ApiModelProperty(value = "当前活跃人数(90分钟内登陆的账号总数量)") + private String currentActivePeople; + + + @ApiModelProperty(value = "累计实验时长(即院校所有学生每次实验报告上练习时长之和)") + private String cumulativeExperimentTime; + + + @ApiModelProperty(value = "累计课程学习次数(即学生课前预习和课程学习模块的资源点击数的累计)") + private String courseStudyFrequency; + + + @ApiModelProperty(value = "累计课程学习时长(即学校每个学生每次停留在课程预习页面和课程学习页面的时间之和)") + private String courseStudyTime; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/PageTheoreticalCourseByNakadaiResp.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/PageTheoreticalCourseByNakadaiResp.java new file mode 100644 index 0000000..784ddf3 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/PageTheoreticalCourseByNakadaiResp.java @@ -0,0 +1,79 @@ +package com.huoran.occupationlab.entity.resp; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + + +@Data +public class PageTheoreticalCourseByNakadaiResp { + + + @ApiModelProperty(value = "理论课程主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "课程名称") + private String courseName; + + @ApiModelProperty(value = "课程类型(0.免费 1.付费)") + private String courseType; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + + @ApiModelProperty(value = "学校名称") + private String schoolName; + + @ApiModelProperty(value = "创建人") + private String founder; + + @ApiModelProperty(value = "创建人Id") + private Integer founderId; + + @ApiModelProperty(value = "理论课程封面") + private String coverUrl; + + @ApiModelProperty(value = "理论课程介绍") + private String courseIntroduction; + + @ApiModelProperty(value = "课程分类") + private String courseClassification; + + @ApiModelProperty(value = "平台来源(0中台,1职站)") + private Integer platformSource; + + @ApiModelProperty(value = "课程范围(0:本校内 1:全平台 2.指定区域、院校)") + private Integer visibleRange; + + @ApiModelProperty(value = "中台是否开启(0开启 1未开启 默认0)") + private Integer ztOpen; + + @ApiModelProperty(value = "是否开启(0开启 1未开启 默认0)") + private Integer isOpen; + + @ApiModelProperty(value = "是否删除(0未删除 1已删除 默认0)") + private Integer isDel; + + @ApiModelProperty(value = "浏览量") + private Integer pageviews; + + @ApiModelProperty(value = "是否收藏:(state = 1收藏,0:未收藏)") + private Integer collectionStatus; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/PerformanceUnderProductResp.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/PerformanceUnderProductResp.java new file mode 100644 index 0000000..4956b48 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/PerformanceUnderProductResp.java @@ -0,0 +1,40 @@ +package com.huoran.occupationlab.entity.resp; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import cn.afterturn.easypoi.excel.annotation.ExcelTarget; +import com.baomidou.mybatisplus.annotation.TableField; +import com.huoran.occupationlab.entity.Class; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.util.Date; +import java.util.List; + + +@Data +@Accessors(chain = true) +public class PerformanceUnderProductResp { + + + @ApiModelProperty(value = "实验总人数") + private Integer experimentalPopulation; + + @ApiModelProperty(value = "总实验次数") + private Integer experimentNum; + + + @ApiModelProperty(value = "实验总分") + private Integer totalExperimentalScore; + + @ApiModelProperty(value = "最高分") + private Integer maxScore; + + @ApiModelProperty(value = "最低分") + private Integer minScore; + + @ApiModelProperty(value = "平均分") + private String averageScore; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/PracticeProjectsUnderTheProductResp.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/PracticeProjectsUnderTheProductResp.java new file mode 100644 index 0000000..9bd90c0 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/PracticeProjectsUnderTheProductResp.java @@ -0,0 +1,82 @@ +package com.huoran.occupationlab.entity.resp; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 产品下练习项目情况 + */ +@Data +public class PracticeProjectsUnderTheProductResp { + + + + + @ApiModelProperty(value = "序号") + @Excel(name = "序号", orderNum = "1", isImportField = "rownum", width = 30) + private Integer rownum; + + //课程 + @ApiModelProperty(value = "课程名称") + @Excel(name = "课程名称", orderNum = "2", mergeVertical = true, isImportField = "goodsName", width = 30) + private String goodsName; + + //班级 + @ApiModelProperty(value = "班级名称") + @Excel(name = "班级名称", orderNum = "3", mergeVertical = true, isImportField = "className", width = 30) + private String className; + + + + @ApiModelProperty(value = "姓名") + @Excel(name = "姓名", orderNum = "4", mergeVertical = true, isImportField = "username", width = 30) + private String userName; + + + @ApiModelProperty(value = "学号") + @Excel(name = "学号", orderNum = "5", mergeVertical = true, isImportField = "workNumber", width = 30) + private String workNumber; + + @ApiModelProperty(value = "当前学生已经练习的项目数(已练习总数)") + @Excel(name = "练习项目数", orderNum = "6", mergeVertical = false, isImportField = "totalNumberOfPractices", width = 30) + private String totalNumberOfPractices; + + @ApiModelProperty(value = "练习次数") + @Excel(name = "练习次数", orderNum = "7", mergeVertical = false, isImportField = "numberOfExercises", width = 30) + private Integer numberOfExercises; + + @ApiModelProperty(value = "所有项目练习成绩之和") + private Integer totalScore; + + + + @ApiModelProperty(value = "累计练习时长") + @Excel(name = "累计练习时长", orderNum = "8", mergeVertical = false, isImportField = "cumulativePracticeTime", width = 30) + private Integer cumulativePracticeTime; + + @ApiModelProperty(value = "平均分") + @Excel(name = "平均分", orderNum = "9", mergeVertical = false, isImportField = "avgScore", width = 30) + private String avgScore; + + @ApiModelProperty(value = "最高分") + @Excel(name = "最低分", orderNum = "10", mergeVertical = false, isImportField = "maxScore", width = 30) + private Integer maxScore; + + @ApiModelProperty(value = "最低分") + @Excel(name = "最低分", orderNum = "11", mergeVertical = false, isImportField = "minScore", width = 30) + private Integer minScore; + + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + + @ApiModelProperty(value = "班级id") + private String classId; + + + + @ApiModelProperty(value = "练习项目总数") + private Integer totalNumberOfExercises; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/PracticeResultDerivationResp.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/PracticeResultDerivationResp.java new file mode 100644 index 0000000..baf457e --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/PracticeResultDerivationResp.java @@ -0,0 +1,41 @@ +package com.huoran.occupationlab.entity.resp; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.huoran.occupationlab.entity.UserScore; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.List; + +/** + *

+ * 存储各子系统的实验报告 + *

+ * + * @author lr + * @since 2021-09-08 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "练习成绩导出word所需参数", description = "练习成绩导出word所需参数") +public class PracticeResultDerivationResp { + + @ApiModelProperty(value = "课程名称") + private String goodsName; + + @ApiModelProperty(value = "班级名称") + private String className; + + @ApiModelProperty(value = "导出时间") + private String derivationTime; + + @ApiModelProperty(value = "练习成绩数据") + List practicePerformanceData; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/PracticeScoreDetailsUnderProductResp.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/PracticeScoreDetailsUnderProductResp.java new file mode 100644 index 0000000..a72a0f9 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/PracticeScoreDetailsUnderProductResp.java @@ -0,0 +1,60 @@ +package com.huoran.occupationlab.entity.resp; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 产品下练习成绩详情 + */ +@Data +@Accessors(chain = true) +public class PracticeScoreDetailsUnderProductResp { + + @ApiModelProperty(value = "序号") + @Excel(name = "序号", orderNum = "1", isImportField = "rownum", width = 30) + private Integer rownum; + + //课程 + @ApiModelProperty(value = "课程名称") + @Excel(name = "课程名称", orderNum = "2", mergeVertical = true, isImportField = "goodsName", width = 30) + private String goodsName; + + //班级 + @ApiModelProperty(value = "班级名称") + @Excel(name = "班级名称", orderNum = "3", mergeVertical = true, isImportField = "className", width = 30) + private String className; + + @ApiModelProperty(value = "姓名") + @Excel(name = "姓名", orderNum = "4", mergeVertical = true, isImportField = "username", width = 30) + private String userName; + + + @ApiModelProperty(value = "学号") + @Excel(name = "学号", orderNum = "5", mergeVertical = true, isImportField = "workNumber", width = 30) + private String workNumber; + + @ApiModelProperty(value = "项目名称") + @Excel(name = "项目名称", orderNum = "6", mergeVertical = false, isImportField = "projectName", width = 30) + private String projectName; + + + @ApiModelProperty(value = "平均练习时长") + @Excel(name = "平均练习时长", orderNum = "7", mergeVertical = false, isImportField = "averageDuration", width = 30) + private String averageDuration; + + + @ApiModelProperty(value = "平均分") + @Excel(name = "平均分", orderNum = "8", mergeVertical = false, isImportField = "averageScore", width = 30) + private String averageScore; + + @ApiModelProperty(value = "项目id") + private Integer projectId; + + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/ReturnActiveRankingResp.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/ReturnActiveRankingResp.java new file mode 100644 index 0000000..3848191 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/ReturnActiveRankingResp.java @@ -0,0 +1,41 @@ +package com.huoran.occupationlab.entity.resp; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + + +@Data +@ApiModel(value = "活跃排行榜", description = "活跃排行榜") +public class ReturnActiveRankingResp { + + + @ApiModelProperty(value = "班级id(Integer类型)") + private Integer classId; + + + @ApiModelProperty(value = "班级统计") + private String classPracticeTimes; + + + @ApiModelProperty(value = "班级总人数") + private String totalClassSize ; + + + @ApiModelProperty(value = "学校id",hidden = true) + private Integer schoolId; + + + @ApiModelProperty(value = "活跃指数") + private BigDecimal activityIndex ; + + + @ApiModelProperty(value = "班级名称") + private String className; + + @ApiModelProperty(value = "学校名字") + private String schoolName; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/ScorePointsUnderTheItemResp.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/ScorePointsUnderTheItemResp.java new file mode 100644 index 0000000..4155376 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/ScorePointsUnderTheItemResp.java @@ -0,0 +1,27 @@ +package com.huoran.occupationlab.entity.resp; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 获取项目下的判分点 + */ +@Data +public class ScorePointsUnderTheItemResp { + + + @ApiModelProperty(value = "判分点Id") + private Integer judgmentId; + + @ApiModelProperty(value = "判分点名称") + private String judgmentName; + + @ApiModelProperty(value = "当前判分点的错误率") + private String errorRate; + + @ApiModelProperty(value = "当前判分点做错的人数总数") + private Integer errorTotal; + + @ApiModelProperty(value = "当前参与人数") + private Integer peopleNum; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/StaffResp.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/StaffResp.java new file mode 100644 index 0000000..6c1b26f --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/StaffResp.java @@ -0,0 +1,79 @@ +package com.huoran.occupationlab.entity.resp; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.util.List; + +/** + * @Author chen + * @DATE 2021/10/13 15:51 + * @Version 1.0 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "StaffResp", description = "员工列表") +public class StaffResp { + + @ApiModelProperty(value = "绑定年级ID") + private Integer gradeId; + + @ApiModelProperty(value = "专业ID") + private Integer staffArchitectureId; + + @ApiModelProperty(value = "绑定账号id", hidden = true) + private Integer accountId; + + @ApiModelProperty(value = "绑定学校id", hidden = true) + private Integer schoolId; + + @ApiModelProperty(value = "职工姓名") + private String userName; + + @ApiModelProperty(value = "职工工号") + private String workNumber; + + @ApiModelProperty(value = "唯一标识账号") + private String uniqueIdentification; + + @ApiModelProperty(value = "电话") + private String phone; + + @ApiModelProperty(value = "邮箱") + private String email; + + //用于列表逗号隔开展示 + @ApiModelProperty(value = "角色") + private String roleName; + + //用于查看详情是否角色选中 + /*@ApiModelProperty(value = "角色列表") + private List roleList;*/ + + @ApiModelProperty(value = "账号") + private String account; + + @ApiModelProperty(value = "登陆次数") + private Integer logInNumber; + + @ApiModelProperty(value = "最后登陆时间") + private String lastLoginTime; + + @ApiModelProperty(value = "学校名称") + private String schoolName; + + @ApiModelProperty(value = "部门") + private String dept; + + @ApiModelProperty(value = "账号角色及绑定的一级二级部门信息") + private List roleAndDeptList; + + @ApiModelProperty(value = "用户id") + private Integer userId; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/StaffRoleResp.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/StaffRoleResp.java new file mode 100644 index 0000000..5ce0830 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/StaffRoleResp.java @@ -0,0 +1,41 @@ +package com.huoran.occupationlab.entity.resp; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; + +/** + * @Author chen + * @DATE 2021/10/13 15:51 + * @Version 1.0 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "绑定员工角色及部门参数", description = "绑定员工角色及部门参数") +public class StaffRoleResp { + + @ApiModelProperty(value = "一级部门绑定id") + private Integer gradeId; + + @ApiModelProperty(value = "二级部门绑定id") + private Integer staffArchitectureId; + + @ApiModelProperty(value = "角色id(一个角色绑定一个一级部门、二级部门)") + private Integer roleId; + + @ApiModelProperty(value = "一级部门名称") + private String staffArchitectureName; + + @ApiModelProperty(value = "二级部门名称") + private String gradeName; + + @ApiModelProperty(value = "角色名称") + private String roleName; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/StuAchievementResp.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/StuAchievementResp.java new file mode 100644 index 0000000..8a0c217 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/StuAchievementResp.java @@ -0,0 +1,54 @@ +package com.huoran.occupationlab.entity.resp; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import cn.afterturn.easypoi.excel.annotation.ExcelTarget; +import com.baomidou.mybatisplus.annotation.TableField; +import com.huoran.occupationlab.entity.Class; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.util.Date; +import java.util.List; + +/** + *

+ * 项目管理表 + *

+ * + * @author Mr.JK + * @since 2021-08-26 + */ +@Data +@Accessors(chain = true) +@ExcelTarget("StuAchievementResp") +public class StuAchievementResp { + + + @Excel(name = "课程名称", orderNum = "1", mergeVertical = true, isImportField = "curriculumName", width = 30) + @ApiModelProperty(value = "课程名称") + private String curriculumName; + + @Excel(name = "实验项目名称", orderNum = "2", mergeVertical = true, isImportField = "projectName", width = 30) + @ApiModelProperty(value = "实验项目名称") + private String projectName; + + @Excel(name = "实验最高分", orderNum = "3", mergeVertical = true, isImportField = "hightScore", width = 30) + @ApiModelProperty(value = "实验最高分") + private Integer hightScore; + + @Excel(name = "练习次数", orderNum = "4", mergeVertical = true, isImportField = "practiceNum", width = 30) + @ApiModelProperty(value = "练习次数") + private Integer practiceNum; + + + @ApiModelProperty(value = "最近实验时间") + private String lastTime; + + + @Excel(name = "练习次数", orderNum = "4", mergeVertical = true, isImportField = "practiceNum", width = 30) + @ApiModelProperty(value = "结束时间") + private String endTime; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/StuAssessmentListResp.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/StuAssessmentListResp.java new file mode 100644 index 0000000..532e9f0 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/StuAssessmentListResp.java @@ -0,0 +1,82 @@ +package com.huoran.occupationlab.entity.resp; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +/** + *

+ * 考核管理 + *

+ * + * @author lr + * @since 2021-08-18 + */ +@Data +@ApiModel(value = "学生考核列表", description = "学生考核列表") +public class StuAssessmentListResp { + + + @ApiModelProperty(value = "考核id") + private Integer assessmentId; + + @ApiModelProperty(value = "考核名称") + private String experimentalName; + + @ApiModelProperty(value = "课程名称") + private String sysName; + + @ApiModelProperty(value = "班级名称(0表示展示无指定范围)") + private String className; + + @ApiModelProperty(value = "用户账号id") + private Integer accountId; + + @ApiModelProperty(value = "考试时长") + private String experimentDuration; + + @ApiModelProperty(value = "创建时间") + private Date createTime; + + @ApiModelProperty(value = "起始时间") + private String startTime; + + @ApiModelProperty(value = "结束时间") + private String stopTime; + + @ApiModelProperty(value = "考核状态(0、待开始 1、进行中 2、已结束)") + private Integer status; + + @ApiModelProperty(value = "学生考试状态(0、未考 1、在考 2、已考)") + private Integer stuState; + + @ApiModelProperty(value = "实验人数") + private Integer experimentalNum; + + @ApiModelProperty(value = "是否启用邀请码(0、未启用 1、启用)") + private Integer isEnableCode; + + @ApiModelProperty(value = "发布类型(1、手动发布 2、定时发布)") + private Integer type; + + @ApiModelProperty(value = "班级id") + private String classId; + + @ApiModelProperty(value = "邀请码") + private Integer invitationCode; + + @ApiModelProperty(value = "实验报告id") + private Integer reportId; + + @ApiModelProperty(value = "课程id") + private Integer curriculumId; + + + @ApiModelProperty(value = "商品名称") + private String goodsName; + + @ApiModelProperty(value = "商品id") + private Integer mallId; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/StuAssessmentScoreResp.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/StuAssessmentScoreResp.java new file mode 100644 index 0000000..5fab90b --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/StuAssessmentScoreResp.java @@ -0,0 +1,24 @@ +package com.huoran.occupationlab.entity.resp; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.util.List; + +/** + * 学生实验课程考核成绩趋势 + */ +@Data +@Accessors(chain = true) +public class StuAssessmentScoreResp { + + @ApiModelProperty(value = "平均分/课程") + private List assesScoreRespList; + + + @ApiModelProperty(value = "时间") + private String time; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/StuExportAchievementResp.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/StuExportAchievementResp.java new file mode 100644 index 0000000..79f0aac --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/StuExportAchievementResp.java @@ -0,0 +1,51 @@ +package com.huoran.occupationlab.entity.resp; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import cn.afterturn.easypoi.excel.annotation.ExcelTarget; +import com.baomidou.mybatisplus.annotation.TableField; +import com.huoran.occupationlab.entity.Class; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.util.Date; +import java.util.List; + +/** + *

+ * 项目管理表 + *

+ * + * @author Mr.JK + * @since 2021-08-26 + */ +@Data +@Accessors(chain = true) +@ExcelTarget("StuExportAchievementResp") +public class StuExportAchievementResp { + + @Excel(name = "项目名称", orderNum = "1", isImportField = "projectName", width = 30) + @ApiModelProperty(value = "项目名称") + private String projectName; + + + @Excel(name = "得分", orderNum = "2", isImportField = "score", width = 30) + @ApiModelProperty(value = "得分") + private Integer score; + + + @Excel(name = "耗时", orderNum = "3", isImportField = "timeSum", width = 30) + @ApiModelProperty(value = "耗时") + private String timeSum; + + @Excel(name = "起始时间", orderNum = "4", isImportField = "startTime", width = 30) + @ApiModelProperty(value = "起始时间") + private String startTime; + + + @Excel(name = "结束时间", orderNum = "5", isImportField = "submitTime", width = 30) + @ApiModelProperty(value = "结束时间") + private String submitTime; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/StudentAssesScoreResp.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/StudentAssesScoreResp.java new file mode 100644 index 0000000..d405794 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/StudentAssesScoreResp.java @@ -0,0 +1,32 @@ +package com.huoran.occupationlab.entity.resp; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 学生实验课程考核成绩趋势 + */ +@Data +@Accessors(chain = true) +public class StudentAssesScoreResp { + + @ApiModelProperty(value = "课程名称") + private String curriculumName; + + + @ApiModelProperty(value = "平均分") + private String avgScore; + + + @ApiModelProperty(value = "时间") + private String time; + + + @ApiModelProperty(value = "课程id") + private Integer curriculumId; + + + @ApiModelProperty(value = "商品id") + private Integer mallId; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/StudentInfoResp.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/StudentInfoResp.java new file mode 100644 index 0000000..85da85d --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/StudentInfoResp.java @@ -0,0 +1,68 @@ +package com.huoran.occupationlab.entity.resp; + +import com.huoran.occupationlab.entity.Class; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @ProjectName: huorantech + * @Package: com.huoran.occupationlab.entity.resp + * @ClassName: StudentInfoResp + * @Description: java类作用描述 + * @Author: Maureen.Rong + * @CreateDate: 2021/8/25 17:29 + * @UpdateDate: 2021/8/25 17:29 + * @Version: 1.0 + */ +@Data +public class StudentInfoResp { + @ApiModelProperty(value = "学号/工号") + private String workNumber; + + @ApiModelProperty(value = "用户名称") + private String userName; + + @ApiModelProperty(value = "班级id") + private String classId; + + + @ApiModelProperty(value = "唯一标识") + private String uniqueIdentification; + + @ApiModelProperty(value = "手机号") + private String phone; + + @ApiModelProperty(value = "邮箱") + private String email; + + @ApiModelProperty(value = "用户id") + private Integer userId; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "登录次数") + private Integer loginNumber; + + @ApiModelProperty(value = "最近登录时间") + private String lastLoginTime; + + @ApiModelProperty(value = "班级名称") + private String className; + + @ApiModelProperty(value = "账号") + private String account; + + @ApiModelProperty(value = "学生账号id") + private Integer stuAccountId; + + + @ApiModelProperty(value = "是否禁用:0->禁用,1->启用") + private Integer isEnable; + + private Integer schoolId; + + private List classList; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/StudentPerformanceAnalysisResp.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/StudentPerformanceAnalysisResp.java new file mode 100644 index 0000000..306f68c --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/StudentPerformanceAnalysisResp.java @@ -0,0 +1,32 @@ +package com.huoran.occupationlab.entity.resp; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 学生成绩分布分析 + */ +@Data +@Accessors(chain = true) +public class StudentPerformanceAnalysisResp { + + @ApiModelProperty(value = "黄色") + private String yellow; + + + @ApiModelProperty(value = "绿色") + private String green; + + @ApiModelProperty(value = "蓝色") + private String blue; + + @ApiModelProperty(value = "粉色") + private String pink; + + + @ApiModelProperty(value = "时间") + private String time; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/TheoreticalCourseDetailResp.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/TheoreticalCourseDetailResp.java new file mode 100644 index 0000000..c167e3c --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/TheoreticalCourseDetailResp.java @@ -0,0 +1,64 @@ +package com.huoran.occupationlab.entity.resp; + +import com.baomidou.mybatisplus.annotation.*; +import com.huoran.occupationlab.entity.TheoreticalCourseClassification; +import com.huoran.occupationlab.entity.TheoreticalCourseConfigure; +import com.huoran.occupationlab.entity.TheoreticalCourseRange; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + *

+ * 理论课程基本信息 + *

+ * + * @author lr + * @since 2022-09-14 + */ +@Data + +public class TheoreticalCourseDetailResp { + + + @ApiModelProperty(value = "理论课程主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "课程名称") + private String courseName; + + @ApiModelProperty(value = "课程类型(0.免费 1.付费)") + private Integer courseType; + + + @ApiModelProperty(value = "学校分类") + private List schoolClassificationsList; + + @ApiModelProperty(value = "平台分类") + private List platformClassificationList; + + + @ApiModelProperty(value = "指定区域、院校") + private List courseRangeList; + + @ApiModelProperty(value = "理论课程封面") + private String coverUrl; + + @ApiModelProperty(value = "理论课程介绍") + private String courseIntroduction; + + @ApiModelProperty(value = "课程范围(0:本校内 1:全平台 2.指定区域、院校)") + private Integer visibleRange; + + @ApiModelProperty(value = "平台来源(0中台,1职站)") + private Integer platformSource; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/TheoreticalCoursetRangeResp.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/TheoreticalCoursetRangeResp.java new file mode 100644 index 0000000..f9f6baf --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/TheoreticalCoursetRangeResp.java @@ -0,0 +1,47 @@ +package com.huoran.occupationlab.entity.resp; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author lr + * @since 2022-06-16 + */ +@Data +@ApiModel(value = "课程范围选择") +public class TheoreticalCoursetRangeResp { + + + @ApiModelProperty(value = "课程主键") + private Integer courseId; + + @ApiModelProperty(value = "省") + private String provinceName; + + @ApiModelProperty(value = "市") + private String cityName; + + @ApiModelProperty(value = "学校id") + private String schoolName; + + @ApiModelProperty(value = "范围类型(0为学校 1为地区)") + private Integer type; + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + + @ApiModelProperty(value = "省id") + private Integer provinceId; + + + @ApiModelProperty(value = "城市id") + private Integer cityId; + + +} \ No newline at end of file diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/ActivityDerivationVO.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/ActivityDerivationVO.java new file mode 100644 index 0000000..8faa29f --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/ActivityDerivationVO.java @@ -0,0 +1,67 @@ +package com.huoran.occupationlab.entity.vo; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @描述:成绩管理——练习活跃度 + * @作者: Rong + * @日期: 2023-04-27 + */ +@Data +@ApiModel(value = "练习活跃度导出") +public class ActivityDerivationVO { + + + + + @ApiModelProperty(value = "序号") + @Excel(name = "序号", orderNum = "1", isImportField = "rownum", width = 30) + private Integer rownum; + + + @ApiModelProperty(value = "班级") + @Excel(name = "班级", orderNum = "2", isImportField = "className", width = 30) + private String className; + + @ApiModelProperty(value = "学生姓名") + @Excel(name = "学生姓名", orderNum = "3", isImportField = "userName", width = 30) + private String userName; + + @ApiModelProperty(value = "学号/工号") + @Excel(name = "学号", orderNum = "4", isImportField = "workNumber", width = 30) + private String workNumber; + + @ApiModelProperty(value = "练习次数") + @Excel(name = "练习次数", orderNum = "5", isImportField = "practiceNum", width = 30) + private Integer practiceNum; + + @ApiModelProperty(value = "实验平均分") + @Excel(name = "实验平均分", orderNum = "6", isImportField = "avgScore", width = 30) + private String avgScore; + + @ApiModelProperty(value = "实验最高分") + @Excel(name = "实验最高分", orderNum = "7", isImportField = "highestScore", width = 30) + private String highestScore; + + @ApiModelProperty(value = "实验最低分") + @Excel(name = "实验最低分", orderNum = "8", isImportField = "lowestMark", width = 30) + private String lowestMark; + + @ApiModelProperty(value = "耗时最长") + @Excel(name = "耗时最多", orderNum = "9", isImportField = "theLongestTime", width = 30) + private String theLongestTime; + + @ApiModelProperty(value = "耗时最少") + @Excel(name = "耗时最少", orderNum = "10", isImportField = "shortestTime", width = 30) + private String shortestTime; + + @ApiModelProperty(value = "最近提交时间") + @Excel(name = "最近提交时间", orderNum = "11", isImportField = "lastSubmissionTime", width = 30) + private String lastSubmissionTime; + + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/ApplicantVO.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/ApplicantVO.java new file mode 100644 index 0000000..c909532 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/ApplicantVO.java @@ -0,0 +1,67 @@ +package com.huoran.occupationlab.entity.vo; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Author chen + * @DATE 2020/10/19 14:08 + * @Version 1.0 + */ +@Data +public class ApplicantVO { + + /* @ApiModelProperty(value = "主键") + private String id; + + @ApiModelProperty(value = "用户名称") + private String username; + + @ApiModelProperty(value = "手机号") + private String phone; + + @ApiModelProperty(value = "账户号") + private String workNumber; + + @ApiModelProperty(value = "学校名称") + private String school; + + @ApiModelProperty(value = "是否禁用(0启用,1禁用)") + private String isDisable;*/ + + + /* @ApiModelProperty(value = "序号") + @Excel(name = "序号", orderNum = "1", isImportField = "id", width = 30) + private String id;*/ + + + @ApiModelProperty(value = "序号") + @Excel(name = "序号", orderNum = "1", isImportField = "id", width = 30) + private Integer rownum; + + + @ApiModelProperty(value = "学校") + @Excel(name = "学校", orderNum = "2", mergeVertical = true, isImportField = "school", width = 30) + private String school; + + @ApiModelProperty(value = "学生姓名") + @Excel(name = "学生姓名", orderNum = "3", mergeVertical = true, isImportField = "username", width = 30) + private String username; + + + @ApiModelProperty(value = "手机号") + @Excel(name = "手机号", orderNum = "4", mergeVertical = true, isImportField = "phone", width = 30) + private String phone; + + + @ApiModelProperty(value = "学号") + @Excel(name = "学号", orderNum = "5", mergeVertical = true, isImportField = "workNumber", width = 30) + private String workNumber; + + + + @ApiModelProperty(value = "报名时间") + @Excel(name = "报名时间", orderNum = "6", mergeVertical = true, isImportField = "gmtCreate", width = 30) + private String gmtCreate; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/ArchitectureVO.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/ArchitectureVO.java new file mode 100644 index 0000000..4b8094a --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/ArchitectureVO.java @@ -0,0 +1,62 @@ +package com.huoran.occupationlab.entity.vo; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + *

+ * 学生组织架构 + *

+ * + * @author lr + * @since 2021-08-24 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_architecture") +@ApiModel(value = "Architecture对象", description = "学生组织架构") +public class ArchitectureVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "组织名称") + @NotNull(message = "组织名称不能为空") + private String organizationName; + + @ApiModelProperty(value = "既为父id又是学校id 第一级为学校id") + private Integer parentId; + + @ApiModelProperty(value = "层级 0为学校,1为专业,2为年级") + private Integer level; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "逻辑删除 默认为0 1为已删除") + private Integer isDel; + + @ApiModelProperty(value = "子级") + @TableField(exist = false) + private List children; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/ArticleSort.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/ArticleSort.java new file mode 100644 index 0000000..d4e5e77 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/ArticleSort.java @@ -0,0 +1,18 @@ +package com.huoran.occupationlab.entity.vo; + +import com.huoran.occupationlab.entity.Article; +import lombok.Data; + +import java.util.ArrayList; +import java.util.List; + +/** + * @Author chen + * @DATE 2020/10/21 9:21 + * @Version 1.0 + * 文章排序 + */ +@Data +public class ArticleSort { + List
articleList = new ArrayList<>(); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/AssessmentVO.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/AssessmentVO.java new file mode 100644 index 0000000..0e5006a --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/AssessmentVO.java @@ -0,0 +1,101 @@ +package com.huoran.occupationlab.entity.vo; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + *

+ * 考核管理 + *

+ * + * @author lr + * @since 2021-08-18 + */ +@Data +@ApiModel(value = "AssessmentVO", description = "考核管理") +public class AssessmentVO { + + + @ApiModelProperty(value = "主键id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "考核名称") + private String experimentalName; + + @ApiModelProperty(value = "班级id(可多个班级参加,逗号隔开)") + private String classId; + + @ApiModelProperty(value = "绑定项目id") + private Integer projectId; + + @ApiModelProperty(value = "实验时长") + private String experimentDuration; + + @ApiModelProperty(value = "发布类型(1、手动发布 2、定时发布)") + private Integer type; + + @ApiModelProperty(value = "起始时间") + private String startTime; + + @ApiModelProperty(value = "结束时间") + private String stopTime; + + @ApiModelProperty(value = "状态(0、待开始 1、进行中 2、已结束)") + private Integer status; + + @ApiModelProperty(value = "邀请码") + private Integer invitationCode; + + @ApiModelProperty(value = "指定范围(0无指定范围 1指定范围)") + private Integer isSpecify; + + @ApiModelProperty(value = "创建人用户账号id") + private Integer accountId; + + @ApiModelProperty(value = "系统id(ol_system表)") + private Integer systemId; + + @ApiModelProperty(value = "是否启用邀请码(0、启用 1、未启用)") + private Integer isEnableCode; + + @ApiModelProperty(value = "是否删除(0、未删除 1、已删除)") + @TableLogic + private Integer isDel; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + + @ApiModelProperty(value = "班级名称") + private String className; + + @ApiModelProperty(value = "项目名称") + private String projectName; + + @ApiModelProperty(value = "绑定学生账号id") + private List stuAccountId; + + @ApiModelProperty(value = "课程名称") + private String sysName; + + @ApiModelProperty(value = "课程id") + private String sysId; + + @ApiModelProperty(value = "商品名称") + private String goodsName; + + @ApiModelProperty(value = "商品id") + private Integer mallId; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/ChapterVO.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/ChapterVO.java new file mode 100644 index 0000000..7a7a776 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/ChapterVO.java @@ -0,0 +1,32 @@ +package com.huoran.occupationlab.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * @Author chen + * @DATE 2020/10/10 9:37 + * @Version 1.0 + * 章节封装对象 + */ +@Data +public class ChapterVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "章节ID") + private String id; + + @ApiModelProperty(value = "章节名称") + private String name; + + @ApiModelProperty(value = "排序号") + private Integer sort; + + @ApiModelProperty(value = "小节集合") + private List subsectionList = new ArrayList<>(); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/ColumnSort.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/ColumnSort.java new file mode 100644 index 0000000..438896f --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/ColumnSort.java @@ -0,0 +1,16 @@ +package com.huoran.occupationlab.entity.vo; + +import lombok.Data; + +import java.util.List; + +/** + * @Author chen + * @DATE 2020/10/16 14:56 + * @Version 1.0 + * 栏目排序 + */ +@Data +public class ColumnSort { + private List columnTree; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/ColumnTree.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/ColumnTree.java new file mode 100644 index 0000000..0b2e12c --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/ColumnTree.java @@ -0,0 +1,23 @@ +package com.huoran.occupationlab.entity.vo; + +import lombok.Data; + +import java.util.List; + +/** + * @Author chen + * @DATE 2020/10/16 9:11 + * @Version 1.0 + * 栏目树 + */ +@Data +public class ColumnTree { + + private Integer id; + private String name; + private Integer parentId; + private Integer sort; + private Integer level; + List children; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/ContestVO.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/ContestVO.java new file mode 100644 index 0000000..454f48f --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/ContestVO.java @@ -0,0 +1,113 @@ +package com.huoran.occupationlab.entity.vo; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.huoran.occupationlab.entity.resp.ContestRangeResp; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * @Author chen + * @DATE 2020/10/16 17:13 + * @Version 1.0 + */ +@Data +public class ContestVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + private String id; + + @ApiModelProperty(value = "竞赛名称") + private String competitionName; + + @ApiModelProperty(value = "创建人") + private String founderName; + + + @ApiModelProperty(value = "大赛范围(0:本校内 1:全平台 2:指定区域、院校)", example = "0") + private Integer competitionScope; + + @ApiModelProperty(value = "平台来源(0:中台,1:职站)", example = "0") + private Integer platformSource; + + + @ApiModelProperty(value = "发布状态(0未发布,1已发布)") + private Integer publishStatus; + + @ApiModelProperty(value = "中台是否开启(0开启 1未开启 默认0)", example = "0") + private Integer ztOpen; + + @ApiModelProperty(value = "是否开启(0开启 1未开启 默认0)", example = "0") + private Integer isOpen; + + @ApiModelProperty(value = "报名人数") + private String applicantNum; + + @ApiModelProperty(value = "竞赛开始时间") + private Date playStartTime; + + @ApiModelProperty(value = "竞赛结束时间") + private Date playEndTime; + + @ApiModelProperty(value = "创建时间") + private Date createTime; + + @ApiModelProperty(value = "比赛范围") + private String range; + + @ApiModelProperty(value = "比赛范围(省市学校集合)") + private List contestRangeRespList; + + + @ApiModelProperty(value = "主办方", example = "或然科技") + private String sponsor; + + @ApiModelProperty(value = "承办方", example = "或然科技") + private String undertaker; + + @ApiModelProperty(value = "竞赛描述", example = "或然科技赛事") + private String description; + + @ApiModelProperty(value = "报名开始时间", example = "2021-09-10 16:24:24") + private Date signUpStartTime; + + @ApiModelProperty(value = "报名结束时间", example = "2021-09-20 16:24:24") + private Date signUpEndTime; + + + @ApiModelProperty(value = "创建人Id", example = "1") + private String founderId; + + + @ApiModelProperty(value = "竞赛名称", example = "数据库数据库色即是空") + private String name; + + @ApiModelProperty(value = "竞赛封面图", example = "http://localhost:9400/occupationlab/doc.html") + private String coverUrl; + + @ApiModelProperty(value = "竞赛轮播图", example = "http://localhost:9400/occupationlab/doc.html") + private String carouselUrl; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "学校id", example = "0") + private Integer schoolId; + + + @ApiModelProperty(value = "是否报名(0为已报名 1为未报名)", example = "0") + private Integer whetherToSignUp; + + + @ApiModelProperty(value = "报名时间") + private Date registrationTime; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/CourseVO.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/CourseVO.java new file mode 100644 index 0000000..97eee0c --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/CourseVO.java @@ -0,0 +1,57 @@ +package com.huoran.occupationlab.entity.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Author chen + * @DATE 2020/10/4 12:20 + * @Version 1.0 + */ +@ApiModel(value = "课程vo", description = "课程vo封装") +@Data +public class CourseVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "课程ID") + private String id; + + @ApiModelProperty(value = "课程名称") + private String name; + + @ApiModelProperty(value = "创建时间") + private Date gmtCreate; + + @ApiModelProperty(value = "创建人") + private String founder; + + @ApiModelProperty(value = "章节数") + private Integer chapterNum; + + @ApiModelProperty(value = "课程封面图片路径") + private String coverUrl; + + @ApiModelProperty(value = "课程描述") + private String description; + + @ApiModelProperty(value = "区分标识:1为企业端课程,0为管理端课程") + private Integer distinguish; + + @ApiModelProperty(value = "课程分类id") + private String classificationId; + + @ApiModelProperty(value = "小节数") + private Integer subsectionNum; + + @ApiModelProperty(value = "分类名称") + private String classification; + + @ApiModelProperty(value = "是否开启") + private Integer isEnable; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/EntrepreneurialActivityVO.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/EntrepreneurialActivityVO.java new file mode 100644 index 0000000..1b66399 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/EntrepreneurialActivityVO.java @@ -0,0 +1,105 @@ +package com.huoran.occupationlab.entity.vo; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +/** + * @描述:创业活动管理表 + * @作者: Rong + * @日期: 2023-04-27 + */ +@Data +@ApiModel(value = "创业活动管理表") +public class EntrepreneurialActivityVO { + + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "主键") + private Integer id; + + @ApiModelProperty(value = "创建人") + private String founderName; + + @ApiModelProperty(value = "报名人数") + private String applicantNum; + + @ApiModelProperty(value = "创建人id") + private Integer accountId; + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + @ApiModelProperty(value = "创建人角色(0、系统 1、老师 2、学生)") + private Integer founder; + + @ApiModelProperty(value = "发布状态(默认0、草稿箱 1、已发布)") + private Integer publishStatus; + + @ApiModelProperty(value = "项目名称") + private String projectName; + + @ApiModelProperty(value = "发起人(可多选,用逗号隔开)") + private String initiator; + + @ApiModelProperty(value = "项目封面图") + private String coverUrl; + + @ApiModelProperty(value = "项目轮播图") + private String carouselUrl; + + @ApiModelProperty(value = "项目开始时间") + private Date playStartTime; + + @ApiModelProperty(value = "项目结束时间") + private Date playEndTime; + + @ApiModelProperty(value = "报名开始时间") + private Date signUpStartTime; + + @ApiModelProperty(value = "报名结束时间") + private Date signUpEndTime; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "是否开启(0开启 1未开启 默认0)") + private Integer isOpen; + + @ApiModelProperty(value = "用于教师端控制学生端是否开启(0开启 1未开启 默认0)") + private Integer schoolOpen; + + @ApiModelProperty(value = "项目描述") + private String projectDescribe; + + @ApiModelProperty(value = "邀请码") + private String invitationCode; + + @ApiModelProperty(value = "是否需要邀请码(0不需要,1需要)默认为0") + private Integer isNeedCode; + + @ApiModelProperty(value = "报名人数限制(0表示不限制)默认为0") + private Integer maximumNumber; + + @ApiModelProperty(value = "是否报名(0为已报名 1为未报名)", example = "0") + private Integer whetherToSignUp; + + @ApiModelProperty(value = "取消报名传的id", example = "0") + private Integer cancelId; + + @ApiModelProperty(value = "是否收藏:(state = 1收藏,0:未收藏)") + private Integer collectionStatus; + + + @ApiModelProperty(value = "收藏人数") + private Integer collectorsNum; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/EvaluationDetailVO.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/EvaluationDetailVO.java new file mode 100644 index 0000000..f7ca150 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/EvaluationDetailVO.java @@ -0,0 +1,40 @@ +package com.huoran.occupationlab.entity.vo; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 测评试题表,记录每次测评的试题,与测评记录表相关联 + * + * @author gongsj + * @email gongsj@gmail.com + * @date 2020-08-28 10:15:49 + */ +@Data +public class EvaluationDetailVO implements Serializable { + /** + * 序号 + */ + private Integer questionSortNo; + /** + * 是否正确 + */ + private Integer isTrue; + /** + * 试题得分 + */ + private Integer questionScore; + /** + * 用户填写的答案 + */ + private String userAnswer; + /** + * 正确答案 + */ + private String answer; + /** + * 解析 + */ + private String answerAnalysis; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/EvaluationQuestionVO.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/EvaluationQuestionVO.java new file mode 100644 index 0000000..50b1b18 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/EvaluationQuestionVO.java @@ -0,0 +1,38 @@ +package com.huoran.occupationlab.entity.vo; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 测评试题表,记录每次测评的试题,与测评记录表相关联 + * + * @author gongsj + * @email gongsj@gmail.com + * @date 2020-08-28 10:15:49 + */ +@Data +public class EvaluationQuestionVO implements Serializable { + + /** + * 主键 + */ + private Integer id; + /** + * 试题id + */ + private Integer questionId; + /** + * 试题分值 + */ + private Integer questionPoints; + /** + * 用户填写的答案 + */ + private String userAnswer; + /** + * 正确答案 + */ + private String answer; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/EvaluationRecordDetailVO.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/EvaluationRecordDetailVO.java new file mode 100644 index 0000000..db05882 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/EvaluationRecordDetailVO.java @@ -0,0 +1,25 @@ +package com.huoran.occupationlab.entity.vo; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 记录用户测评信息 + * + * @author gongsj + * @email gongsj@gmail.com + * @date 2020-08-28 10:15:48 + */ +@Data +public class EvaluationRecordDetailVO implements Serializable { + /** + * 总得分 + */ + private Integer totalScore; + /** + * 详情列表 + */ + private List evaluationDetailVOS; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/EvaluationRecordSubmitVO.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/EvaluationRecordSubmitVO.java new file mode 100644 index 0000000..1f9a6ab --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/EvaluationRecordSubmitVO.java @@ -0,0 +1,44 @@ +package com.huoran.occupationlab.entity.vo; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 记录用户测评信息 + * + * @author gongsj + * @email gongsj@gmail.com + * @date 2020-08-28 10:15:48 + */ +@Data +public class EvaluationRecordSubmitVO implements Serializable { + /** + * 主键 + */ + private Integer id; + /** + * 当前测评的用户的id + */ + private Integer userId; + /** + * 总题目数量 + */ + private Integer totalQuestionNum; + /** + * 是否通过 + */ + private String isPassed; + /** + * 总得分 + */ + private Integer totalScore; + /** + * 答对几题 + */ + private Integer correctQuestionNum; + /** + * 正确率 + */ + private String correctRate; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/EvaluationRulesVO.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/EvaluationRulesVO.java new file mode 100644 index 0000000..6a3e19c --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/EvaluationRulesVO.java @@ -0,0 +1,72 @@ +package com.huoran.occupationlab.entity.vo; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 测评规则信息记录,只记录一条信息 + * + * @author gongsj + */ +@Data +public class EvaluationRulesVO implements Serializable { + + /** + * 主键 + */ + private Integer id; + /** + * 测评类型:1:随机类型,0:自定义类型 + */ + private Integer evaluationType; + /** + * 测评时长,单位:分钟 + */ + private Integer duration; + /** + * 测评总题数 + */ + private Integer questionNum; + /** + * 题库总题数 + */ + private Integer totalQuestionNum; + /** + * 单选题数 + */ + private Integer singleNum; + /** + * 题库单选题总数 + */ + private Integer totalSingleNum; + /** + * 只在类型为自定义类型时才启用:1:启用,0:不启用,默认1启用 + */ + private Integer isSingleEnable; + /** + * 多选题数 + */ + private Integer multipleNum; + /** + * 题库多选题总数 + */ + private Integer totalMultipleNum; + /** + * 只在类型为自定义类型时才启用:1:启用,0:不启用,默认1启用 + */ + private Integer isMultipleEnable; + /** + * 判断题数 + */ + private Integer judgmentNum; + /** + * 题库判断题总数 + */ + private Integer totalJudgmentNum; + /** + * 只在类型为自定义类型时才启用:1:启用,0:不启用,默认1启用 + */ + private Integer isJudgmentEnable; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/EvaluationVO.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/EvaluationVO.java new file mode 100644 index 0000000..876ed14 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/EvaluationVO.java @@ -0,0 +1,62 @@ +package com.huoran.occupationlab.entity.vo; + +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.util.Set; + +/** + * 测评规则信息记录,只记录一条信息 + * + * @author gongsj + */ +@Data +@TableName("tms_evaluation_rules") +public class EvaluationVO implements Serializable { + + /** + * 主键 + */ + private Integer id; + /** + * 测评类型:1:随机类型,0:自定义类型 + */ + private Integer evaluationType; + /** + * 测评时长,单位:分钟 + */ + private Integer duration; + /** + * 测评总题数 + */ + private Integer questionNum; + /** + * 单选题数 + */ + private Integer singleNum; + /** + * 只在类型为自定义类型时才启用:1:启用,0:不启用,默认1启用 + */ + private Integer isSingleEnable; + /** + * 多选题数 + */ + private Integer multipleNum; + /** + * 只在类型为自定义类型时才启用:1:启用,0:不启用,默认1启用 + */ + private Integer isMultipleEnable; + /** + * 判断题数 + */ + private Integer judgmentNum; + /** + * 只在类型为自定义类型时才启用:1:启用,0:不启用,默认1启用 + */ + private Integer isJudgmentEnable; + /** + *试题列表 + */ + private Set Questions; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/ImportStaffFailureVo.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/ImportStaffFailureVo.java new file mode 100644 index 0000000..4687f0c --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/ImportStaffFailureVo.java @@ -0,0 +1,55 @@ +package com.huoran.occupationlab.entity.vo; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import cn.afterturn.easypoi.excel.annotation.ExcelTarget; +import com.huoran.occupationlab.utils.poi.ExcelAttribute; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.ToString; +import lombok.experimental.Accessors; + +@Data +@ToString +@Accessors(chain = true) +@ExcelTarget("ImportStaffFailureVo") +public class ImportStaffFailureVo { + + //第几行 + private Long index; + + @Excel(name = "姓名", orderNum = "1", isImportField = "id", width = 30) + @ApiModelProperty(value = "姓名") + private String userName; + + /*@ApiModelProperty(value = "账号") + @Excel(name = "账号", orderNum = "2", mergeVertical = false, isImportField = "account", width = 30) + private String account;*/ + + @ApiModelProperty(value = "角色") + @Excel(name = "角色", orderNum = "2", isImportField = "roleName", width = 30) + private String roleName; + + @ApiModelProperty(value = "工号") + @Excel(name = "工号", orderNum = "3", isImportField = "workNumber", width = 30) + private String workNumber; + + @ApiModelProperty(value = "一级部门") + @Excel(name = "一级部门", orderNum = "4", isImportField = "firstDept", width = 30) + private String firstDept; + + @ApiModelProperty(value = "二级部门") + @Excel(name = "二级部门", orderNum = "5", isImportField = "secondDept", width = 20) + private String secondDept; + + @ApiModelProperty(value = "手机号码") + @Excel(name = "手机号码", orderNum = "6", isImportField = "phone", width = 20) + private String phone; + + @ApiModelProperty(value = "邮箱") + @Excel(name = "邮箱", orderNum = "7", isImportField = "email", width = 20) + private String email; + + @ExcelAttribute(sort = 8) + @Excel(name = "失败原因", orderNum = "8", isImportField = "failureMsg", width = 50) + private String failureMsg; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/ImportStudentFailureVo.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/ImportStudentFailureVo.java new file mode 100644 index 0000000..b66745c --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/ImportStudentFailureVo.java @@ -0,0 +1,53 @@ +package com.huoran.occupationlab.entity.vo; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import cn.afterturn.easypoi.excel.annotation.ExcelTarget; +import com.huoran.occupationlab.utils.poi.ExcelAttribute; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.ToString; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; + +@Data +@ToString +@Accessors(chain = true) +@ExcelTarget("ImportStudentFailureVo") +public class ImportStudentFailureVo { + + //第几行 + private Long index; + + @Excel(name = "学生姓名", orderNum = "1", isImportField = "id", width = 30) + @ApiModelProperty(value = "学生姓名") + private String userName; + + @ApiModelProperty(value = "学号") + @Excel(name = "学号", orderNum = "2", isImportField = "workNumber", width = 30) + private String workNumber; + + @ApiModelProperty(value = "专业") + @Excel(name = "专业", orderNum = "3", isImportField = "professional", width = 20) + private String professional; + + @ApiModelProperty(value = "年级") + @Excel(name = "年级", orderNum = "4", isImportField = "grade", width = 20) + private String grade; + + @ApiModelProperty(value = "班级") + @Excel(name = "班级", orderNum = "5", isImportField = "classes", width = 20) + private String classes; + + @ApiModelProperty(value = "手机号码") + @Excel(name = "手机号码", orderNum = "6", isImportField = "phone", width = 20) + private String phone; + + @ApiModelProperty(value = "邮箱") + @Excel(name = "邮箱", orderNum = "7", isImportField = "email", width = 20) + private String email; + + @ExcelAttribute(sort = 8) + @Excel(name = "失败原因", orderNum = "8", isImportField = "failureMsg", width = 50) + private String failureMsg; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/PerformanceManagementPracticeActivityVO.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/PerformanceManagementPracticeActivityVO.java new file mode 100644 index 0000000..45e35d8 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/PerformanceManagementPracticeActivityVO.java @@ -0,0 +1,70 @@ +package com.huoran.occupationlab.entity.vo; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +/** + * @描述:成绩管理——练习活跃度 + * @作者: Rong + * @日期: 2023-04-27 + */ +@Data +@ApiModel(value = "练习活跃度") +public class PerformanceManagementPracticeActivityVO { + + @ApiModelProperty(value = "项目id") + private Integer projectId; + + @ApiModelProperty(value = "创建人id") + private Integer accountId; + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + @ApiModelProperty(value = "班级") + private String className; + + @ApiModelProperty(value = "学校名称") + private String schoolName; + + @ApiModelProperty(value = "学生姓名") + private String userName; + + @ApiModelProperty(value = "学号/工号") + private String workNumber; + + @ApiModelProperty(value = "总耗时") + private String totalTimeConsuming; + + @ApiModelProperty(value = "总分") + private String totalScore; + + @ApiModelProperty(value = "练习次数") + private Integer practiceNum; + + @ApiModelProperty(value = "最高分") + private String highestScore; + + @ApiModelProperty(value = "最低分") + private String lowestMark; + + @ApiModelProperty(value = "耗时最长") + private String theLongestTime; + + @ApiModelProperty(value = "耗时最短") + private String shortestTime; + + @ApiModelProperty(value = "最近提交时间") + private String lastSubmissionTime; + + @ApiModelProperty(value = "平均分") + private String avgScore; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/PermissionVO.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/PermissionVO.java new file mode 100644 index 0000000..f0799c0 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/PermissionVO.java @@ -0,0 +1,24 @@ +package com.huoran.occupationlab.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @Author chen + * @DATE 2020/11/9 16:44 + * @Version 1.0 + */ +@Data +public class PermissionVO { + + @ApiModelProperty(value = "角色ID") + String roleId; + + @ApiModelProperty(value = "菜单ID") + List permissionId; + + @ApiModelProperty(value = "端口") + Integer isPort; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/PersonalExcelDataVO.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/PersonalExcelDataVO.java new file mode 100644 index 0000000..c7947a6 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/PersonalExcelDataVO.java @@ -0,0 +1,32 @@ +package com.huoran.occupationlab.entity.vo; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class PersonalExcelDataVO { + + @ApiModelProperty(value = "序号") + @Excel(name = "序号", orderNum = "1", isImportField = "rownum", width = 30) + private Integer rownum; + + @ApiModelProperty(value = "学校") + @Excel(name = "学校", orderNum = "2", mergeVertical = true, isImportField = "school", width = 30) + private String school; + + @ApiModelProperty(value = "学生姓名") + @Excel(name = "学生姓名", orderNum = "3", mergeVertical = true, isImportField = "username", width = 30) + private String username; + + + @ApiModelProperty(value = "学号") + @Excel(name = "学号", orderNum = "4", mergeVertical = true, isImportField = "workNumber", width = 30) + private String workNumber; + + @ApiModelProperty(value = "手机号") + @Excel(name = "手机号", orderNum = "5", mergeVertical = true, isImportField = "phone", width = 30) + private String phone; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/PracticeTheHighestScoreListVO.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/PracticeTheHighestScoreListVO.java new file mode 100644 index 0000000..971ed23 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/PracticeTheHighestScoreListVO.java @@ -0,0 +1,32 @@ +package com.huoran.occupationlab.entity.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @描述:成绩管理——练习最高分列表 + * @作者: Rong + * @日期: 2023-04-27 + */ +@Data +@ApiModel(value = "练习最高分列表") +public class PracticeTheHighestScoreListVO { + + @ApiModelProperty(value = "项目id") + private Integer projectId; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "学生姓名") + private String userName; + + @ApiModelProperty(value = "最高分") + private String highestScore; + + @ApiModelProperty(value = "学生头像") + private String userAvatars; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/ProductClassInformationVO.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/ProductClassInformationVO.java new file mode 100644 index 0000000..7710d6e --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/ProductClassInformationVO.java @@ -0,0 +1,45 @@ +package com.huoran.occupationlab.entity.vo; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + + +@Data +@ApiModel(value = "产品维度下获取班级列表") +public class ProductClassInformationVO { + + + @ApiModelProperty(value = "产品名称") + private String curriculumName; + + @ApiModelProperty(value = "商品id") + private Integer mallId; + + @ApiModelProperty(value = "班级id") + private Integer classId; + + @ApiModelProperty(value = "课程id") + private Integer cid; + + @ApiModelProperty(value = "班级名称") + private String className; + + + @ApiModelProperty(value = "班级人总数") + private Integer classSize; + + @ApiModelProperty(value = "练习项目数") + private Integer numberOfPracticeItems; + + @ApiModelProperty(value = "考核项目数") + private Integer numberOfAssessmentItems; + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/ProjectVo.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/ProjectVo.java new file mode 100644 index 0000000..ea051ac --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/ProjectVo.java @@ -0,0 +1,29 @@ +package com.huoran.occupationlab.entity.vo; + +import com.huoran.common.entity.ProjectManage; +import com.huoran.occupationlab.entity.ProjectJudgment; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.Valid; +import java.util.List; + +/** + * @description + * @author: Mr.JK + * @create: 2021-08-30 14:37 + **/ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="ProjectVo对象") +public class ProjectVo { + + @Valid + private ProjectManage projectManage; + + @Valid + private List projectJudgmentList; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/QuestionImportFailureVo.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/QuestionImportFailureVo.java new file mode 100644 index 0000000..fd2ac64 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/QuestionImportFailureVo.java @@ -0,0 +1,60 @@ +package com.huoran.occupationlab.entity.vo; + +import com.huoran.occupationlab.utils.poi.ExcelAttribute; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.ToString; +import lombok.experimental.Accessors; + +@Data +@ToString +@Accessors(chain = true) +public class QuestionImportFailureVo { + + //第几行 + private Long index; + + @ExcelAttribute(sort = 0) + @ApiModelProperty("题干") + private String questionStem; + + @ApiModelProperty("题型") + @ExcelAttribute(sort = 1) + private String questionTypeName; + + @ApiModelProperty("选项A") + @ExcelAttribute(sort = 2) + private String optionA; + + @ApiModelProperty("选项B") + @ExcelAttribute(sort = 3) + private String optionB; + + @ApiModelProperty("选项C") + @ExcelAttribute(sort = 4) + private String optionC; + + @ApiModelProperty("选项D") + @ExcelAttribute(sort = 5) + private String optionD; + + @ApiModelProperty("选项E") + @ExcelAttribute(sort = 6) + private String optionE; + + @ApiModelProperty("选项F") + @ExcelAttribute(sort = 7) + private String optionF; + + @ApiModelProperty("正确答案") + @ExcelAttribute(sort = 8) + private String answer; + + @ApiModelProperty("答案解析") + @ExcelAttribute(sort = 9) + private String answerAnalysis; + + @ApiModelProperty("失败原因") + @ExcelAttribute(sort = 10) + private String failureMsg; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/QuestionsDetailVO.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/QuestionsDetailVO.java new file mode 100644 index 0000000..fa3d3ca --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/QuestionsDetailVO.java @@ -0,0 +1,87 @@ +package com.huoran.occupationlab.entity.vo; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 记录试题信息 + * + * @author gongsj + */ +@Data +public class QuestionsDetailVO implements Serializable { + + /** + * 主键 + */ + private Integer id; + /** + * 题型:用于区分是什么题型,1:单选,2:多选,3:判断 + */ + private Integer questionType; + /** + * 题型名称 + */ + private String questionTypeName; + /** + * 题干信息 + */ + private String questionStem; + /** + * A选项内容 + */ + private String optionA; + /** + * A选项是否为正确答案 + */ + private boolean AIsTrue = false; + /** + * B选项内容 + */ + private String optionB; + /** + * B选项是否为正确答案 + */ + private boolean BIsTrue = false; + /** + * C选项内容 + */ + private String optionC; + /** + * C选项是否为正确答案 + */ + private boolean CIsTrue = false; + /** + * D选项内容 + */ + private String optionD; + /** + * D选项是否为正确答案 + */ + private boolean DIsTrue = false; + /** + * E选项内容 + */ + private String optionE; + /** + * E选项是否为正确答案 + */ + private boolean EIsTrue = false; + /** + * F选项内容 + */ + private String optionF; + /** + * F选项是否为正确答案 + */ + private boolean FIsTrue = false; + /** + * 正确答案 + */ + private String answer; + /** + * 答案解析 + */ + private String answerAnalysis; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/QuestionsImportFailureVO.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/QuestionsImportFailureVO.java new file mode 100644 index 0000000..4effedd --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/QuestionsImportFailureVO.java @@ -0,0 +1,76 @@ +package com.huoran.occupationlab.entity.vo; + +import com.huoran.occupationlab.utils.poi.ExcelAttribute; +import lombok.Data; +import lombok.ToString; + +/** + * 试题的基本信息表 + * + * @author gongsj + */ +@Data +@ToString +public class QuestionsImportFailureVO { + /** + * 第几行 + */ + private Integer index; + + /** + * 题干,问题描述 + */ + @ExcelAttribute(sort = 0) + private String questionStem; + /** + * 题型 + */ + @ExcelAttribute(sort = 1) + private String questionTypeName; + /** + * 选项A + */ + @ExcelAttribute(sort = 2) + private String optionA; + /** + * 选项B + */ + @ExcelAttribute(sort = 3) + private String optionB; + /** + * 选项C + */ + @ExcelAttribute(sort = 4) + private String optionC; + /** + * 选项D + */ + @ExcelAttribute(sort = 5) + private String optionD; + /** + * 选项E + */ + @ExcelAttribute(sort = 6) + private String optionE; + /** + * 选项F + */ + @ExcelAttribute(sort = 7) + private String optionF; + /** + * 正确答案 + */ + @ExcelAttribute(sort = 8) + private String answer; + /** + * 答案解析 + */ + @ExcelAttribute(sort = 9) + private String answerAnalysis; + + /** + * 失败原因 + */ + @ExcelAttribute(sort = 10) + private String failureMsg; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/RegistrationVO.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/RegistrationVO.java new file mode 100644 index 0000000..421d549 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/RegistrationVO.java @@ -0,0 +1,39 @@ +package com.huoran.occupationlab.entity.vo; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class RegistrationVO { + + @ApiModelProperty(value = "序号") + @Excel(name = "序号", orderNum = "1", isImportField = "id", width = 30) + private Integer rownum; + + + @ApiModelProperty(value = "学校") + @Excel(name = "学校", orderNum = "2", mergeVertical = true, isImportField = "schoolName", width = 30) + private String schoolName; + + @ApiModelProperty(value = "姓名") + @Excel(name = "姓名", orderNum = "3", mergeVertical = true, isImportField = "username", width = 30) + private String username; + + + @ApiModelProperty(value = "学号/工号") + @Excel(name = "学号/工号", orderNum = "4", mergeVertical = true, isImportField = "workNumber", width = 30) + private String workNumber; + + + @ApiModelProperty(value = "手机号") + @Excel(name = "手机号", orderNum = "5", mergeVertical = true, isImportField = "phone", width = 30) + private String phone; + + + @ApiModelProperty(value = "是否禁用(0未禁用,1禁用)") + private Integer isDisable; + + @ApiModelProperty(value = "报名表主键id") + private Integer id; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/ReorderVO.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/ReorderVO.java new file mode 100644 index 0000000..247cdf3 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/ReorderVO.java @@ -0,0 +1,19 @@ +package com.huoran.occupationlab.entity.vo; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Author chen + * @DATE 2022/9/23 14:53 + * @Version 1.0 + */ +@Data +public class ReorderVO implements Serializable { + + private static final long serialVersionUID = 1L; + + private List chapterVOList; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/SortVO.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/SortVO.java new file mode 100644 index 0000000..577ef66 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/SortVO.java @@ -0,0 +1,19 @@ +package com.huoran.occupationlab.entity.vo; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Author chen + * @DATE 2020/10/15 9:01 + * @Version 1.0 + */ +@Data +public class SortVO implements Serializable { + + private static final long serialVersionUID = 1L; + + private List chapterVOList; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/StudentImportFailureVo.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/StudentImportFailureVo.java new file mode 100644 index 0000000..30386a4 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/StudentImportFailureVo.java @@ -0,0 +1,36 @@ +package com.huoran.occupationlab.entity.vo; + +import com.huoran.occupationlab.utils.poi.ExcelAttribute; +import lombok.Data; +import lombok.ToString; +import lombok.experimental.Accessors; + +@Data +@ToString +@Accessors(chain = true) +public class StudentImportFailureVo { + + //第几行 + private Long index; + //用户账号 + @ExcelAttribute(sort = 0) + private String account; + //用户姓名 + @ExcelAttribute(sort = 1) + private String userName; + //学生学号 + @ExcelAttribute(sort = 2) + private String workNumber; + //手机号 + @ExcelAttribute(sort = 3) + private String phone; + //绑定邮箱 + @ExcelAttribute(sort = 4) + private String email; + //客户名称 + @ExcelAttribute(sort = 5) + private String clientName; + //失败原因 + @ExcelAttribute(sort = 6) + private String failureMsg; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/SubsectionVO.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/SubsectionVO.java new file mode 100644 index 0000000..76b5081 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/SubsectionVO.java @@ -0,0 +1,43 @@ +package com.huoran.occupationlab.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author chen + * @DATE 2020/10/10 9:37 + * @Version 1.0 + * 小节封装对象 + */ +@Data +public class SubsectionVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "小节ID") + private String id; + + @ApiModelProperty(value = "小节名称") + private String name; + + @ApiModelProperty(value = "原始文件名称") + private String originalFileName; + + @ApiModelProperty(value = "阿里云文件名称") + private String fileName; + + @ApiModelProperty(value = "资源文件ID") + private String fileId; + + @ApiModelProperty(value = "文件存储路径") + private String fileUrl; + + @ApiModelProperty(value = "资源文件类型") + private String fileType; + + @ApiModelProperty(value = "排序字段") + private Integer sort; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/TMSEvaluationRecordVO.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/TMSEvaluationRecordVO.java new file mode 100644 index 0000000..28cc5d1 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/TMSEvaluationRecordVO.java @@ -0,0 +1,70 @@ +package com.huoran.occupationlab.entity.vo; + +import lombok.Data; + +/** + * 用户测评信息 + */ +@Data +public class TMSEvaluationRecordVO { + /** + * 主键 + */ + private Integer id; + /** + * 当前测评的用户的id + */ + private Integer accountId; + /** + * 记录当前做到第几题,用于刷新页面以后保持在当前题目,默认开始时是第一题 + */ + private Integer currentQuestionSortNo; + /** + * 总题目数量 + */ + private Integer totalQuestionNum; + /** + * 题型 + */ + private String questionType; + /** + * 题型名称 + */ + private String questionTypeName; + /** + * 题干信息 + */ + private String questionStem; + /** + * A选项内容 + */ + private String optionA; + /** + * B选项内容 + */ + private String optionB; + /** + * C选项内容 + */ + private String optionC; + /** + * D选项内容 + */ + private String optionD; + /** + * E选项内容 + */ + private String optionE; + /** + * F选项内容 + */ + private String optionF; + /** + * 用户答案 + */ + private String userAnswer; + /** + * 测试类型 + */ + private Integer types; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/TheoreticalChapterVO.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/TheoreticalChapterVO.java new file mode 100644 index 0000000..eb7cbcd --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/TheoreticalChapterVO.java @@ -0,0 +1,30 @@ +package com.huoran.occupationlab.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.ArrayList; +import java.util.List; + +/** + * @Author chen + * @DATE 2022/9/23 14:42 + * @Version 1.0 + */ +@Data +public class TheoreticalChapterVO { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "章节ID") + private Integer id; + + @ApiModelProperty(value = "章节名称") + private String name; + + @ApiModelProperty(value = "排序号") + private Integer sort; + + @ApiModelProperty(value = "小节集合") + private List subsectionList = new ArrayList<>(); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/TheoreticalSubsectionVO.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/TheoreticalSubsectionVO.java new file mode 100644 index 0000000..96387f1 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/TheoreticalSubsectionVO.java @@ -0,0 +1,39 @@ +package com.huoran.occupationlab.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Author chen + * @DATE 2022/9/23 14:43 + * @Version 1.0 + */ +@Data +public class TheoreticalSubsectionVO { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "小节ID") + private Integer id; + + @ApiModelProperty(value = "小节名称") + private String name; + + @ApiModelProperty(value = "原始文件名称") + private String originalFileName; + + @ApiModelProperty(value = "阿里云文件名称") + private String fileName; + + @ApiModelProperty(value = "资源文件ID") + private String fileId; + + @ApiModelProperty(value = "文件存储路径") + private String fileUrl; + + @ApiModelProperty(value = "资源文件类型") + private String fileType; + + @ApiModelProperty(value = "排序字段") + private Integer sort; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/UserInfo.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/UserInfo.java new file mode 100644 index 0000000..374cf4b --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/UserInfo.java @@ -0,0 +1,121 @@ +package com.huoran.occupationlab.entity.vo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + *

+ * 用户信息表 + *

+ * + * @author Ning + * @since 2020-10-21 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "UserInfo对象", description = "用户信息表") +@TableName("hr_user_info") +public class UserInfo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "用户id") + @TableId(value = "userId", type = IdType.AUTO) + private Integer userId; + + @ApiModelProperty(value = "用户姓名") + @TableField("userName") + private String userName; + + @ApiModelProperty(value = "唯一标识账号") + @TableField("uniqueIdentificationAccount") + private String uniqueIdentificationAccount; + + @ApiModelProperty(value = "证件类型(1、身份证)") + @TableField("documentType") + private Integer documentType; + + @ApiModelProperty(value = "证件号码") + @TableField("IDNumber") + private String IDNumber; + + @ApiModelProperty(value = "绑定省份id") + @TableField("provinceId") + private Integer provinceId; + + @ApiModelProperty(value = "绑定城市id") + @TableField("cityId") + private Integer cityId; + + @ApiModelProperty(value = "国家归属地") + private String countries; + + @ApiModelProperty(value = "出生日期") + @TableField("dateBirth") + private String dateBirth; + + @ApiModelProperty(value = "教育程度") + @TableField("educationDegree") + private Integer educationDegree; + + @ApiModelProperty(value = "绑定客户id") + @TableField("clientId") + private Integer clientId; + + @ApiModelProperty(value = "绑定客户名称") + @TableField("clientName") + private String clientName; + + @ApiModelProperty(value = "电话") + private String phone; + + @ApiModelProperty(value = "微信号") + @TableField("weChatID") + private String weChatID; + + @ApiModelProperty(value = "邮箱") + private String email; + + @ApiModelProperty(value = "账号") + private String account; + + @ApiModelProperty(value = "密码") + private String password; + + @ApiModelProperty(value = "创建时间") + @TableField("creationTime") + private String creationTime; + + @ApiModelProperty(value = "登陆次数") + @TableField("logInNumber") + private Integer logInNumber; + + @ApiModelProperty(value = "性别(1、男 2、女)") + private Integer sex; + + @ApiModelProperty(value = "用户头像路径") + @TableField("userAvatars") + private String userAvatars; + + @ApiModelProperty(value = "最后登陆时间") + @TableField("lastLoginTime") + private String lastLoginTime; + + @ApiModelProperty(value = "绑定多个角色id") + @TableField("roleId") + private String roleId; + + @ApiModelProperty(value = "是什么端口(1、企业端 2、管理端)") + @TableField("isPort") + private Integer isPort; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/UserManagementImportFailureVo.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/UserManagementImportFailureVo.java new file mode 100644 index 0000000..76c5769 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/UserManagementImportFailureVo.java @@ -0,0 +1,27 @@ +package com.huoran.occupationlab.entity.vo; + +import com.huoran.occupationlab.utils.poi.ExcelAttribute; +import lombok.Data; +import lombok.ToString; +import lombok.experimental.Accessors; + +@Data +@ToString +@Accessors(chain = true) +public class UserManagementImportFailureVo { + + //第几行 + private Long index; + //账号 + @ExcelAttribute(sort = 0) + private String account; + //用户姓名 + @ExcelAttribute(sort = 1) + private String name; + //客户名称 + @ExcelAttribute(sort = 2) + private String clientName; + //失败原因 + @ExcelAttribute(sort = 3) + private String failureMsg; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/UserVO.java b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/UserVO.java new file mode 100644 index 0000000..28238e7 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/entity/vo/UserVO.java @@ -0,0 +1,34 @@ +package com.huoran.occupationlab.entity.vo; + +import com.huoran.occupationlab.entity.UserManagement; +import com.huoran.occupationlab.entity.vo.UserInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + *

+ * 企业端用户管理 + *

+ * + * @author Ning + * @since 2020-10-27 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="UserVO", description="用户管理") +public class UserVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "用户信息") + private UserInfo userInfo; + + @ApiModelProperty(value = "用户管理信息") + private UserManagement userManagement; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/helper/MemuHelper.java b/occupationlab/src/main/java/com/huoran/occupationlab/helper/MemuHelper.java new file mode 100644 index 0000000..07e5987 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/helper/MemuHelper.java @@ -0,0 +1,75 @@ +package com.huoran.occupationlab.helper; + +import com.alibaba.fastjson.JSONObject; +import com.huoran.occupationlab.entity.AclPermission; +import org.springframework.util.StringUtils; + +import java.util.ArrayList; +import java.util.List; + +/** + * 根据权限数据构建登录用户左侧菜单数据 + */ +public class MemuHelper { + + /** + * 构建菜单 + */ + public static List bulid(List treeNodes) { + List meuns = new ArrayList<>(); + if (treeNodes.size() == 1) { + AclPermission topNode = treeNodes.get(0); + //左侧一级菜单 + List oneMeunList = topNode.getChildren(); + for (AclPermission one : oneMeunList) { + JSONObject oneMeun = new JSONObject(); + oneMeun.put("path", one.getPath()); + oneMeun.put("component", one.getComponent()); + oneMeun.put("redirect", "noredirect"); + oneMeun.put("name", "name_" + one.getId()); + oneMeun.put("hidden", false); + + JSONObject oneMeta = new JSONObject(); + oneMeta.put("title", one.getName()); + oneMeta.put("icon", one.getIcon()); + oneMeun.put("meta", oneMeta); + + List children = new ArrayList<>(); + List twoMeunList = one.getChildren(); + for (AclPermission two : twoMeunList) { + JSONObject twoMeun = new JSONObject(); + twoMeun.put("path", two.getPath()); + twoMeun.put("component", two.getComponent()); + twoMeun.put("name", "name_" + two.getId()); + twoMeun.put("hidden", false); + + JSONObject twoMeta = new JSONObject(); + twoMeta.put("title", two.getName()); + twoMeun.put("meta", twoMeta); + + children.add(twoMeun); + + List threeMeunList = two.getChildren(); + for (AclPermission three : threeMeunList) { + if (StringUtils.isEmpty(three.getPath())) continue; + + JSONObject threeMeun = new JSONObject(); + threeMeun.put("path", three.getPath()); + threeMeun.put("component", three.getComponent()); + threeMeun.put("name", "name_" + three.getId()); + threeMeun.put("hidden", true); + + JSONObject threeMeta = new JSONObject(); + threeMeta.put("title", three.getName()); + threeMeun.put("meta", threeMeta); + + children.add(threeMeun); + } + } + oneMeun.put("children", children); + meuns.add(oneMeun); + } + } + return meuns; + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/helper/PermissionHelper.java b/occupationlab/src/main/java/com/huoran/occupationlab/helper/PermissionHelper.java new file mode 100644 index 0000000..85f7f24 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/helper/PermissionHelper.java @@ -0,0 +1,46 @@ +package com.huoran.occupationlab.helper; + + +import com.huoran.occupationlab.entity.AclPermission; + +import java.util.ArrayList; +import java.util.List; + +/** + * 根据权限数据构建菜单数据 + */ +public class PermissionHelper { + + /** + * 使用递归方法建菜单 + */ + public static List bulid(List treeNodes) { + List trees = new ArrayList<>(); + for (AclPermission treeNode : treeNodes) { + if ("0".equals(treeNode.getPid())) { + treeNode.setLevel(1); + trees.add(findChildren(treeNode, treeNodes)); + } + } + return trees; + } + + /** + * 递归查找子节点 + */ + public static AclPermission findChildren(AclPermission treeNode, List treeNodes) { + treeNode.setChildren(new ArrayList()); + + for (AclPermission it : treeNodes) { + if (treeNode.getId().equals(it.getPid())) { + int level = treeNode.getLevel() + 1; + it.setLevel(level); + if (treeNode.getChildren() == null) { + treeNode.setChildren(new ArrayList<>()); + } + treeNode.getChildren().add(findChildren(it, treeNodes)); + } + } + return treeNode; + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/job/task/AssessmentTimedStart.java b/occupationlab/src/main/java/com/huoran/occupationlab/job/task/AssessmentTimedStart.java new file mode 100644 index 0000000..f988296 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/job/task/AssessmentTimedStart.java @@ -0,0 +1,34 @@ +//package com.huoran.occupationlab.job.task; +// +//import com.huoran.occupationlab.entity.Assessment; +//import com.huoran.occupationlab.service.AssessmentService; +//import com.huoran.occupationlab.utils.CronUtils; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.stereotype.Component; +// +//import java.util.Date; +// +//@Component("assessmentJobStart") +//public class AssessmentTimedStart { +// +// @Autowired +// public AssessmentService service; +// +// //params传考核id +// public void run(String params){ +// //启动考核 +// Assessment assessment = new Assessment(); +// assessment.setStatus(1); +// assessment.setId(Integer.valueOf(params)); +// service.updateById(assessment); +// } +// +// public static void main(String[] args) { +// System.out.println(CronUtils.getCron(new Date())); +// } +//} +// +// +// +// +// diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/job/task/AssessmentTimedStop.java b/occupationlab/src/main/java/com/huoran/occupationlab/job/task/AssessmentTimedStop.java new file mode 100644 index 0000000..e869474 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/job/task/AssessmentTimedStop.java @@ -0,0 +1,21 @@ +//package com.huoran.occupationlab.job.task; +// +//import com.huoran.occupationlab.entity.Assessment; +//import com.huoran.occupationlab.service.AssessmentService; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.stereotype.Component; +// +//@Component("assessmentJobStop") +//public class AssessmentTimedStop { +// +// @Autowired +// public AssessmentService service; +// +// public void run(String params){ +// //停止考核 +// Assessment assessment = new Assessment(); +// assessment.setStatus(2); +// assessment.setId(Integer.valueOf(params)); +// service.updateById(assessment); +// } +//} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/job/task/TestTask.java b/occupationlab/src/main/java/com/huoran/occupationlab/job/task/TestTask.java new file mode 100644 index 0000000..31c4bda --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/job/task/TestTask.java @@ -0,0 +1,67 @@ +//package com.huoran.occupationlab.job.task; +// +//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +//import com.huoran.occupationlab.entity.Assessment; +//import com.huoran.occupationlab.service.AssessmentService; +//import com.huoran.occupationlab.service.StudentService; +//import org.slf4j.Logger; +//import org.slf4j.LoggerFactory; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.stereotype.Component; +// +//import java.util.List; +// +///** +// * 测试定时任务(演示Demo,可删除) +// * testTask为spring bean的名称, 方法名称必须是run +// * +// * @author cheney +// * @version V1.0 +// * @date 2022年7月28日 +// */ +//@Component("testTask") +//public class TestTask { +// private Logger logger = LoggerFactory.getLogger(getClass()); +// @Autowired +// public StudentService studentService; +// +// @Autowired +// public AssessmentService service; +// +// public void run(String params) { +// System.out.println("TestTask:监控考核定时任务正在执行,参数为:{}"+ params); +// //查询考核类型为定时发布且考核状态为待开始状态以及开始时间为当前时间时候 则启动考核 +// QueryWrapper queryWrapper = new QueryWrapper<>(); +// queryWrapper.eq("type", 2);//发布类型(1、手动发布 2、定时发布) +// queryWrapper.eq("is_del", 0); +// queryWrapper.eq("status", 0);//状态(0、待开始 1、进行中 2、已结束) +// queryWrapper.last(" AND start_time = now() "); +// List list = service.list(queryWrapper); +// if (list.size() > 0) { +// for (Assessment experimentalTeaching : list) { +// //启动考核 +// Assessment update = new Assessment(); +// update.setStatus(1); +// update.setId(experimentalTeaching.getId()); +// service.updateById(update); +// } +// } +// +// //当结束时间为当前时间 且发布类型为定时发布的以及考核状态为进行中的 则停止考核 +// QueryWrapper queryWrapper1 = new QueryWrapper<>(); +// //queryWrapper1.eq("type", 2); +// queryWrapper1.eq("is_del", 0); +// queryWrapper1.eq("status", 1); +// queryWrapper1.last(" AND stop_time = now() "); +// List list1 = service.list(queryWrapper1); +// if (list1.size() > 0) { +// for (Assessment experimentalTeaching : list1) { +// //停止考核 +// Assessment update = new Assessment(); +// update.setStatus(2); +// update.setId(experimentalTeaching.getId()); +// service.updateById(update); +// } +// } +// } +//} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/job/utils/ScheduleJob.java b/occupationlab/src/main/java/com/huoran/occupationlab/job/utils/ScheduleJob.java new file mode 100644 index 0000000..ab82a62 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/job/utils/ScheduleJob.java @@ -0,0 +1,113 @@ +//package com.huoran.occupationlab.job.utils; +// +//import com.huoran.common.response.R; +//import com.huoran.occupationlab.entity.SysJob; +//import com.huoran.occupationlab.entity.SysJobLog; +//import com.huoran.occupationlab.service.SysJobLogService; +//import com.huoran.occupationlab.utils.SpringContextUtils; +//import org.apache.commons.lang.StringUtils; +//import org.quartz.JobExecutionContext; +//import org.slf4j.Logger; +//import org.slf4j.LoggerFactory; +//import org.springframework.scheduling.quartz.QuartzJobBean; +// +//import java.lang.reflect.Method; +// +// +///** +// * 定时任务 +// * +// * @author cheney +// * @version V1.0 +// * @date 2022年7月28日 +// */ +// +//public class ScheduleJob extends QuartzJobBean { +// private Logger logger = LoggerFactory.getLogger(getClass()); +// +// final SysJobLogService sysJobLogService; +// +// public ScheduleJob(SysJobLogService sysJobLogService) { +// this.sysJobLogService = sysJobLogService; +// } +// +// +// @Override +// protected void executeInternal(JobExecutionContext context) { +// SysJob scheduleJob = (SysJob) context.getMergedJobDataMap() +// .get(SysJob.JOB_PARAM_KEY); +// +// //获取spring bean +// SysJobLogService scheduleJobLogService = (SysJobLogService) SpringContextUtils.getBean("sysJobLogService"); +// +// //数据库保存执行记录 +// SysJobLog log = new SysJobLog(); +// log.setJobId(scheduleJob.getId()); +// log.setBeanName(scheduleJob.getBeanName()); +// log.setParams(scheduleJob.getParams()); +// +// //任务开始时间 +// long startTime = System.currentTimeMillis(); +// +// try { +// //执行任务 +// logger.debug("任务准备执行,任务ID:" + scheduleJob.getId()); +// +// Object target = SpringContextUtils.getBean(scheduleJob.getBeanName()); +// assert target != null; +// Method method = target.getClass().getDeclaredMethod("run", String.class); +// method.invoke(target, scheduleJob.getParams()); +// +// //任务执行总时长 +// long times = System.currentTimeMillis() - startTime; +// log.setTimes((int) times); +// //任务状态 0:成功 1:失败 +// log.setStatus(0); +// +// logger.debug("任务执行完毕,任务ID:" + scheduleJob.getId() + " 总共耗时:" + times + "毫秒"); +// } catch (Exception e) { +// logger.error("任务执行失败,任务ID:" + scheduleJob.getId(), e); +// +// //任务执行总时长 +// long times = System.currentTimeMillis() - startTime; +// log.setTimes((int) times); +// +// //任务状态 0:成功 1:失败 +// log.setStatus(1); +// log.setError(StringUtils.substring(e.toString(), 0, 2000)); +// } finally { +// assert scheduleJobLogService != null; +// scheduleJobLogService.save(log); +// } +// } +// +///** +// * 判断bean是否有效 +// * +// * @param beanName beanName +// * @return 返回信息 +// */ +// +// public static R judgeBean(String beanName) { +// +// if (org.springframework.util.StringUtils.isEmpty(beanName)) { +// return R.error("spring bean名称不能为空"); +// } +// +// Object target = SpringContextUtils.getBean(beanName); +// if (target == null) { +// return R.error("spring bean不存在,请检查"); +// } +// Method method; +// try { +// method = target.getClass().getDeclaredMethod("run", String.class); +// } catch (Exception e) { +// return R.error("spring bean中的run方法不存在,请检查"); +// } +// if (method == null) { +// return R.error("spring bean中的run方法不存在,请检查"); +// } +// +// return R.ok(); +// } +//} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/job/utils/ScheduleUtils.java b/occupationlab/src/main/java/com/huoran/occupationlab/job/utils/ScheduleUtils.java new file mode 100644 index 0000000..c41df42 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/job/utils/ScheduleUtils.java @@ -0,0 +1,159 @@ +//package com.huoran.occupationlab.job.utils; +// +// +//import com.huoran.common.exception.BusinessException; +//import com.huoran.occupationlab.entity.SysJob; +//import com.huoran.occupationlab.utils.job.Constant; +//import org.quartz.*; +// +///** +// * 定时任务工具类 +// * +// * @author cheney +// * @version V1.0 +// * @date 2022年7月28日 +// */ +// +//public class ScheduleUtils { +// private final static String JOB_NAME = "TASK_"; +// +// /** +// * 获取触发器key +// */ +// +// public static TriggerKey getTriggerKey(Integer jobId) { +// return TriggerKey.triggerKey(JOB_NAME + jobId); +// } +// +// /** +// * 获取jobKey +// */ +// +// public static JobKey getJobKey(Integer jobId) { +// return JobKey.jobKey(JOB_NAME + jobId); +// } +// +// /** +// * 获取表达式触发器 +// */ +// +// public static CronTrigger getCronTrigger(Scheduler scheduler, Integer jobId) { +// try { +// return (CronTrigger) scheduler.getTrigger(getTriggerKey(jobId)); +// } catch (SchedulerException e) { +// throw new BusinessException("获取定时任务CronTrigger出现异常"); +// } +// } +// +// /** +// * 创建定时任务 +// */ +// +// public static void createScheduleJob(Scheduler scheduler, SysJob scheduleJob) { +// try { +// //构建job信息 +// JobDetail jobDetail = JobBuilder.newJob(ScheduleJob.class).withIdentity(getJobKey(scheduleJob.getId())).build(); +// +// //表达式调度构建器 +// CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(scheduleJob.getCronExpression()).withMisfireHandlingInstructionDoNothing(); +// +// //按新的cronExpression表达式构建一个新的trigger +// CronTrigger trigger = TriggerBuilder.newTrigger().withIdentity(getTriggerKey(scheduleJob.getId())).withSchedule(scheduleBuilder).build(); +// +// //放入参数,运行时的方法可以获取 +// jobDetail.getJobDataMap().put(SysJob.JOB_PARAM_KEY, scheduleJob); +// +// scheduler.scheduleJob(jobDetail, trigger); +// +// //暂停任务 +// if (Constant.SCHEDULER_STATUS_PAUSE.equals(scheduleJob.getStatus())) { +// pauseJob(scheduler, scheduleJob.getId()); +// } +// } catch (SchedulerException e) { +// throw new BusinessException("创建定时任务失败"); +// } +// } +// +// /** +// * 更新定时任务 +// */ +// +// public static void updateScheduleJob(Scheduler scheduler, SysJob scheduleJob) { +// try { +// TriggerKey triggerKey = getTriggerKey(scheduleJob.getId()); +// +// //表达式调度构建器 +// CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(scheduleJob.getCronExpression()).withMisfireHandlingInstructionDoNothing(); +// +// CronTrigger trigger = getCronTrigger(scheduler, scheduleJob.getId()); +// +// //按新的cronExpression表达式重新构建trigger +// trigger = trigger.getTriggerBuilder().withIdentity(triggerKey).withSchedule(scheduleBuilder).build(); +// +// //参数 +// trigger.getJobDataMap().put(SysJob.JOB_PARAM_KEY, scheduleJob); +// +// scheduler.rescheduleJob(triggerKey, trigger); +// +// //暂停任务 +// if (Constant.SCHEDULER_STATUS_PAUSE.equals(scheduleJob.getStatus())) { +// pauseJob(scheduler, scheduleJob.getId()); +// } +// +// } catch (SchedulerException e) { +// throw new BusinessException("更新定时任务失败"); +// } +// } +// +// /** +// * 立即执行任务 +// */ +// +// public static void run(Scheduler scheduler, SysJob scheduleJob) { +// try { +// //参数 +// JobDataMap dataMap = new JobDataMap(); +// dataMap.put(SysJob.JOB_PARAM_KEY, scheduleJob); +// +// scheduler.triggerJob(getJobKey(scheduleJob.getId()), dataMap); +// } catch (SchedulerException e) { +// throw new BusinessException("立即执行定时任务失败"); +// } +// } +// +// /** +// * 暂停任务 +// */ +// +// public static void pauseJob(Scheduler scheduler, Integer jobId) { +// try { +// scheduler.pauseJob(getJobKey(jobId)); +// } catch (SchedulerException e) { +// throw new BusinessException("暂停定时任务失败"); +// } +// } +// +// /** +// * 恢复任务 +// */ +// +// public static void resumeJob(Scheduler scheduler, Integer jobId) { +// try { +// scheduler.resumeJob(getJobKey(jobId)); +// } catch (SchedulerException e) { +// throw new BusinessException("暂停定时任务失败"); +// } +// } +// +// /** +// * 删除定时任务 +// */ +// +// public static void deleteScheduleJob(Scheduler scheduler, Integer jobId) { +// try { +// scheduler.deleteJob(getJobKey(jobId)); +// } catch (SchedulerException e) { +// throw new BusinessException("删除定时任务失败"); +// } +// } +//} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ApplicantMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ApplicantMapper.java new file mode 100644 index 0000000..45c6769 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ApplicantMapper.java @@ -0,0 +1,54 @@ +package com.huoran.occupationlab.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.occupationlab.entity.Applicant; +import com.huoran.common.entity.School; +import com.huoran.occupationlab.entity.excel.ExcelData; +import com.huoran.occupationlab.entity.req.PageRegistrationStaffReq; +import com.huoran.occupationlab.entity.vo.ApplicantVO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.HashMap; +import java.util.List; + +/** + *

+ * 报名人员表 Mapper 接口 + *

+ * + * @author chen + * @since 2020-10-15 + */ +@Mapper +public interface ApplicantMapper extends BaseMapper { + + IPage selectApplicantByCondition(Page page, @Param("req") PageRegistrationStaffReq req); + + int selectApplicantCountByCondition(HashMap map); + + /** + * 批量禁用数据 + * + * @param ids ids + * @return 返回禁用条数 + */ + int disableByIds(List ids); + + /** + * 批量查询数据 + * + * @param ids ids + * @return 返回生成的数据 + */ + List selectBatchData(List ids); + + School getSchool( @Param("schoolId") Integer schoolId); + + + boolean cancelRegistration( @Param("contestId")String contestId, @Param("accountId")Integer accountId); + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ArchitectureMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ArchitectureMapper.java new file mode 100644 index 0000000..229d37d --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ArchitectureMapper.java @@ -0,0 +1,20 @@ +package com.huoran.occupationlab.mapper; + +import com.huoran.occupationlab.entity.Architecture; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + *

+ * 学生组织架构 Mapper 接口 + *

+ * + * @author lr + * @since 2021-08-24 + */ +@Mapper +public interface ArchitectureMapper extends BaseMapper { //新增专业年级班级 + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ArticleMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ArticleMapper.java new file mode 100644 index 0000000..f711033 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ArticleMapper.java @@ -0,0 +1,19 @@ +package com.huoran.occupationlab.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.occupationlab.entity.Article; +import org.apache.ibatis.annotations.Mapper; + +/** + * 文章表 Mapper 接口 + * + * @author chen + * @since 2020-10-15 + */ +@Mapper +public interface ArticleMapper extends BaseMapper
{ + + Integer selectMaxSort(); + + void updateViewNum(String articleId); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/AssessmentExamMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/AssessmentExamMapper.java new file mode 100644 index 0000000..adbe5e5 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/AssessmentExamMapper.java @@ -0,0 +1,18 @@ +package com.huoran.occupationlab.mapper; + +import com.huoran.occupationlab.entity.AssessmentExam; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + *

+ * 学生考试表(考核) Mapper 接口 + *

+ * + * @author lr + * @since 2021-08-19 + */ +@Mapper +public interface AssessmentExamMapper extends BaseMapper { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/AssessmentMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/AssessmentMapper.java new file mode 100644 index 0000000..a67f0a3 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/AssessmentMapper.java @@ -0,0 +1,42 @@ +package com.huoran.occupationlab.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.occupationlab.entity.Assessment; +import com.huoran.occupationlab.entity.resp.EnterExamResp; +import com.huoran.occupationlab.entity.resp.StuAssessmentListResp; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + *

+ * 考核管理 Mapper 接口 + *

+ * + * @author lr + * @since 2021-08-18 + */ +@Mapper +public interface AssessmentMapper extends BaseMapper { + + List pageByCondition(@Param("params") Map params); + + List pageByConditionNum(@Param("params") Map params); + + List pageStuAssessment(@Param("params") Map params); + + List pageStuAssessmentNum(@Param("params") Map params); + + String getMineClass(Integer accountId); + + List myClassByStudent(@Param("accountId") Integer accountId,@Param("schoolId") Integer schoolId); + + //进入考核获取跳转路径 + EnterExamResp getUrl(Integer id); + + + String spliceClass(Integer assessmentId); + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/CityMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/CityMapper.java new file mode 100644 index 0000000..9025460 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/CityMapper.java @@ -0,0 +1,18 @@ +package com.huoran.occupationlab.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.occupationlab.entity.City; +import org.apache.ibatis.annotations.Mapper; + +/** + *

+ * 城市 Mapper 接口 + *

+ * + * @author Ning + * @since 2020-10-27 + */ +@Mapper +public interface CityMapper extends BaseMapper { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ClassMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ClassMapper.java new file mode 100644 index 0000000..a0e40a5 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ClassMapper.java @@ -0,0 +1,21 @@ +package com.huoran.occupationlab.mapper; + +import com.huoran.occupationlab.entity.Class; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 班级表 Mapper 接口 + *

+ * + * @author lr + * @since 2021-08-18 + */ +@Mapper +public interface ClassMapper extends BaseMapper { + List getClassesUnderTheSchool(@Param("schoolId") Integer schoolId); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ClientManagementMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ClientManagementMapper.java new file mode 100644 index 0000000..0a7e76b --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ClientManagementMapper.java @@ -0,0 +1,29 @@ +package com.huoran.occupationlab.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.occupationlab.entity.ClientManagement; +import org.apache.ibatis.annotations.Mapper; + +import java.util.HashMap; +import java.util.List; + +/** + *

+ * 企业端客户管理 Mapper 接口 + *

+ * + * @author Ning + * @since 2020-10-27 + */ +@Mapper +public interface ClientManagementMapper extends BaseMapper { + + List queryList(HashMap map); + + int deleteUser(Integer clientId); + + int deleteStaff(Integer clientId); + + int deleteStudent(Integer clientId); + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ColumnMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ColumnMapper.java new file mode 100644 index 0000000..2c9d2ca --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ColumnMapper.java @@ -0,0 +1,24 @@ +package com.huoran.occupationlab.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.occupationlab.entity.Column; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 栏目表 Mapper 接口 + * + * @author chen + * @since 2020-10-15 + */ +@Mapper +public interface ColumnMapper extends BaseMapper { + //查询一级最大排序号 + Integer selectFirstMaxSort(); + + //查询二级最大排序号 + Integer selectSecondMaxSort(Integer firstColumn,Integer schoolId); + + List selectIdByPid(String columnId); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ContestAnnexMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ContestAnnexMapper.java new file mode 100644 index 0000000..ed66eaf --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ContestAnnexMapper.java @@ -0,0 +1,16 @@ +package com.huoran.occupationlab.mapper; + +import com.huoran.occupationlab.entity.ContestAnnex; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 赛事附件 Mapper 接口 + *

+ * + * @author lr + * @since 2022-06-16 + */ +public interface ContestAnnexMapper extends BaseMapper { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ContestAnnouncementAnnexMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ContestAnnouncementAnnexMapper.java new file mode 100644 index 0000000..53180fc --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ContestAnnouncementAnnexMapper.java @@ -0,0 +1,16 @@ +package com.huoran.occupationlab.mapper; + +import com.huoran.occupationlab.entity.ContestAnnouncementAnnex; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 大赛公告附件存储 Mapper 接口 + *

+ * + * @author lr + * @since 2022-06-17 + */ +public interface ContestAnnouncementAnnexMapper extends BaseMapper { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ContestAnnouncementMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ContestAnnouncementMapper.java new file mode 100644 index 0000000..0d670c9 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ContestAnnouncementMapper.java @@ -0,0 +1,22 @@ +package com.huoran.occupationlab.mapper; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.occupationlab.entity.ContestAnnouncement; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.occupationlab.entity.req.PageContestListReq; +import com.huoran.occupationlab.entity.vo.ContestVO; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 赛事公告 Mapper 接口 + *

+ * + * @author lr + * @since 2022-06-17 + */ +public interface ContestAnnouncementMapper extends BaseMapper { + //根据大赛查询大赛公告 + IPage queryAnnouncementByContestId(Page page,@Param("contestId") String contestId); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ContestMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ContestMapper.java new file mode 100644 index 0000000..73a75e4 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ContestMapper.java @@ -0,0 +1,57 @@ +package com.huoran.occupationlab.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.occupationlab.entity.Contest; +import com.huoran.occupationlab.entity.req.AfterLoginPageContestListReq; +import com.huoran.occupationlab.entity.req.PageContestListReq; +import com.huoran.occupationlab.entity.vo.ContestVO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.HashMap; +import java.util.List; + +/** + *

+ * 竞赛管理表 Mapper 接口 + *

+ * + * @author chen + * @since 2020-10-15 + */ +@Mapper +public interface ContestMapper extends BaseMapper { + + List selectContestByCondition(HashMap map); + + int selectContestCountByCondition(HashMap map); + + IPage contestPageConditionQueryByNakadai(Page page, @Param("req") PageContestListReq req); + + + IPage contestPageConditionQueryByOccupationlab(Page page, @Param("req") PageContestListReq req); + +// IPage onlineCompetitionByStudent(Page page, @Param("req") PageContestListReq req); + + + + + IPage registeredBySchoolAndAllPlatforms(Page page, @Param("req") AfterLoginPageContestListReq req); + + + IPage registeredBySpecifiedRange(Page page, @Param("req") AfterLoginPageContestListReq req); + + IPage allContestsByStu(Page page, @Param("req") PageContestListReq req); + + IPage designatedRangeCompetitionByStu(Page page, @Param("req") PageContestListReq req); + + //本校赛事 + IPage schoolCompetition(Page page, @Param("req") AfterLoginPageContestListReq req); + + //赛事广场 + IPage tournamentSquare(Page page, @Param("req") AfterLoginPageContestListReq req); + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ContestProgressMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ContestProgressMapper.java new file mode 100644 index 0000000..874a1fe --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ContestProgressMapper.java @@ -0,0 +1,18 @@ +package com.huoran.occupationlab.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.occupationlab.entity.ContestProgress; +import org.apache.ibatis.annotations.Mapper; + +/** + *

+ * 竞赛进展表 Mapper 接口 + *

+ * + * @author chen + * @since 2020-10-15 + */ +@Mapper +public interface ContestProgressMapper extends BaseMapper { + String getSchoolNameById(Integer schoolId); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ContestRangeMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ContestRangeMapper.java new file mode 100644 index 0000000..23f5d07 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ContestRangeMapper.java @@ -0,0 +1,27 @@ +package com.huoran.occupationlab.mapper; + +import com.huoran.occupationlab.entity.ContestRange; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.occupationlab.entity.resp.ContestRangeResp; +import io.swagger.models.auth.In; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author lr + * @since 2022-06-16 + */ +public interface ContestRangeMapper extends BaseMapper { + List getRangeByContestId(@Param("contestId")String contestId); + + /* List getRangeDetailByContestId(@Param("contestId")String contestId, + @Param("type") Integer type, + @Param("provinceId")Integer provinceId, + @Param("cityId") Integer cityId, + @Param("schoolId") Integer schoolId);*/ +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/CourseChapterMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/CourseChapterMapper.java new file mode 100644 index 0000000..9b3f59f --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/CourseChapterMapper.java @@ -0,0 +1,30 @@ +package com.huoran.occupationlab.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.occupationlab.entity.CourseChapter; + +/** + * 课程章节 Mapper 接口 + * @author chen + * @since 2020-09-30 + */ +public interface CourseChapterMapper extends BaseMapper { + + Integer selectMaxSort(); + + Integer selectMinSort(); + + /** + * 查询上一章节 + * @param currentChapterId 当前章节id + * @return 上一章节id + */ + String selectPreviousChapter(String currentChapterId); + + /** + * 查询下一章节 + * @param currentChapterId 当前章节id + * @return 下一章节id + */ + String selectNextChapter(String currentChapterId); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/CourseClassificationMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/CourseClassificationMapper.java new file mode 100644 index 0000000..d7bbf87 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/CourseClassificationMapper.java @@ -0,0 +1,20 @@ +package com.huoran.occupationlab.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.occupationlab.entity.EduCourseClassification; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 课程类别 Mapper 接口 + * + * @author chen + * @since 2020-09-30 + */ +public interface CourseClassificationMapper extends BaseMapper { + + List selectGlClassification(String schoolId); + + List checkReapt(EduCourseClassification classification); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/CourseMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/CourseMapper.java new file mode 100644 index 0000000..afc87e6 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/CourseMapper.java @@ -0,0 +1,24 @@ +package com.huoran.occupationlab.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.occupationlab.entity.Course; +import com.huoran.occupationlab.entity.EduCourse; +import com.huoran.occupationlab.entity.vo.CourseVO; + +import java.util.HashMap; +import java.util.List; + +/** + * 课程基本信息 Mapper 接口 + * + * @author chen + * @since 2020-09-30 + */ +public interface CourseMapper extends BaseMapper { + + List selectCourseByCondition(HashMap map); + + int selectCourseCountByCondition(HashMap map); + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/CourseSubsectionMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/CourseSubsectionMapper.java new file mode 100644 index 0000000..c49ab88 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/CourseSubsectionMapper.java @@ -0,0 +1,33 @@ +package com.huoran.occupationlab.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.occupationlab.entity.CourseSubsection; + +/** + * 课程小节 Mapper 接口 + * + * @author chen + * @since 2020-09-30 + */ +public interface CourseSubsectionMapper extends BaseMapper { + + Integer selectMaxSort(); + + Integer selectMinSort(); + + /** + * 查询上一小节 + * + * @param currentSubsectionId 当前小节id + * @return 上一小节id + */ + String selectPreviousSubsection(String currentSubsectionId); + + /** + * 查询下一小节 + * + * @param currentSubsectionId 当前小节id + * @return 下一小节id + */ + String selectNextSubsection(String currentSubsectionId); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/EntrepreneurialActivityAnnouncementAnnexMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/EntrepreneurialActivityAnnouncementAnnexMapper.java new file mode 100644 index 0000000..606d2d5 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/EntrepreneurialActivityAnnouncementAnnexMapper.java @@ -0,0 +1,16 @@ +package com.huoran.occupationlab.mapper; + +import com.huoran.occupationlab.entity.EntrepreneurialActivityAnnouncementAnnex; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 活动公告附件表 Mapper 接口 + *

+ * + * @author lr + * @since 2023-05-12 + */ +public interface EntrepreneurialActivityAnnouncementAnnexMapper extends BaseMapper { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/EntrepreneurialActivityAnnouncementMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/EntrepreneurialActivityAnnouncementMapper.java new file mode 100644 index 0000000..8387204 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/EntrepreneurialActivityAnnouncementMapper.java @@ -0,0 +1,20 @@ +package com.huoran.occupationlab.mapper; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.occupationlab.entity.EntrepreneurialActivityAnnouncement; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 活动公告表 Mapper 接口 + *

+ * + * @author lr + * @since 2023-05-12 + */ +public interface EntrepreneurialActivityAnnouncementMapper extends BaseMapper { + IPage queryAnnouncementByActivityId(Page page, @Param("activityId") String activityId); + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/EntrepreneurialActivityApplicantMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/EntrepreneurialActivityApplicantMapper.java new file mode 100644 index 0000000..bcec554 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/EntrepreneurialActivityApplicantMapper.java @@ -0,0 +1,21 @@ +package com.huoran.occupationlab.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.occupationlab.entity.EntrepreneurialActivityApplicant; +import com.huoran.occupationlab.entity.req.ActivityApplicantReq; +import com.huoran.occupationlab.entity.vo.RegistrationVO; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 创业活动报名人员表 Mapper 接口 + *

+ * + * @author lr + * @since 2023-04-27 + */ +public interface EntrepreneurialActivityApplicantMapper extends BaseMapper { + IPage selectRegistration(Page page, @Param("req") ActivityApplicantReq req); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/EntrepreneurialActivityCollectMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/EntrepreneurialActivityCollectMapper.java new file mode 100644 index 0000000..9141b8e --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/EntrepreneurialActivityCollectMapper.java @@ -0,0 +1,17 @@ +package com.huoran.occupationlab.mapper; + +import com.huoran.occupationlab.entity.EntrepreneurialActivityCollect; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 理论课程收藏表 Mapper 接口 + *

+ * + * @author lr + * @since 2023-06-01 + */ +public interface EntrepreneurialActivityCollectMapper extends BaseMapper { + Integer countTheNumberOfCollectors(@Param("activityId") Integer activityId); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/EntrepreneurialActivityFileMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/EntrepreneurialActivityFileMapper.java new file mode 100644 index 0000000..df70b4f --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/EntrepreneurialActivityFileMapper.java @@ -0,0 +1,16 @@ +package com.huoran.occupationlab.mapper; + +import com.huoran.occupationlab.entity.EntrepreneurialActivityFile; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 创业活动附件存储 Mapper 接口 + *

+ * + * @author lr + * @since 2023-04-26 + */ +public interface EntrepreneurialActivityFileMapper extends BaseMapper { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/EntrepreneurialActivityMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/EntrepreneurialActivityMapper.java new file mode 100644 index 0000000..067ff5b --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/EntrepreneurialActivityMapper.java @@ -0,0 +1,37 @@ +package com.huoran.occupationlab.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.occupationlab.entity.EntrepreneurialActivity; +import com.huoran.occupationlab.entity.req.EntrepreneurshipActivityListrReq; +import com.huoran.occupationlab.entity.vo.EntrepreneurialActivityVO; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 创业活动管理表 Mapper 接口 + *

+ * + * @author lr + * @since 2023-04-26 + */ +public interface EntrepreneurialActivityMapper extends BaseMapper { + + + //给超管看的活动列表 能看到全校发布的 + IPage theOverpipeOfTheActivityList(Page page, @Param("req") EntrepreneurshipActivityListrReq req); + + //教师端发布的 + IPage activityListForTeachers(Page page, @Param("req") EntrepreneurshipActivityListrReq req); + + IPage activityListForStudents(Page page, @Param("req") EntrepreneurshipActivityListrReq req); + + + IPage schoolActivities(Page page, @Param("req") EntrepreneurshipActivityListrReq req); + + IPage myActivities(Page page, @Param("req") EntrepreneurshipActivityListrReq req); + + IPage concernedActivity(Page page, @Param("req") EntrepreneurshipActivityListrReq req); + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/EntrepreneurialActivityProgressMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/EntrepreneurialActivityProgressMapper.java new file mode 100644 index 0000000..67e3cb1 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/EntrepreneurialActivityProgressMapper.java @@ -0,0 +1,16 @@ +package com.huoran.occupationlab.mapper; + +import com.huoran.occupationlab.entity.EntrepreneurialActivityProgress; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 活动进展表 Mapper 接口 + *

+ * + * @author lr + * @since 2023-05-12 + */ +public interface EntrepreneurialActivityProgressMapper extends BaseMapper { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/EvaluationFractionMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/EvaluationFractionMapper.java new file mode 100644 index 0000000..ecaf278 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/EvaluationFractionMapper.java @@ -0,0 +1,22 @@ +package com.huoran.occupationlab.mapper; + +import com.huoran.occupationlab.entity.EvaluationFraction; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 记录用户能力测评的总分数 Mapper 接口 + *

+ * + * @author lr + * @since 2021-09-26 + */ +public interface EvaluationFractionMapper extends BaseMapper { + Integer queryExerciseRecord(@Param("accountId") Integer accountId); + + Integer queryTeachingRecord(@Param("accountId") Integer accountId); + + Integer queryScore(@Param("accountId") Integer accountId, @Param("type") Integer type); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/EvaluationQuestionMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/EvaluationQuestionMapper.java new file mode 100644 index 0000000..feaa0d7 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/EvaluationQuestionMapper.java @@ -0,0 +1,29 @@ +package com.huoran.occupationlab.mapper; + +import com.huoran.occupationlab.entity.EvaluationQuestion; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.occupationlab.entity.vo.EvaluationDetailVO; +import com.huoran.occupationlab.entity.vo.EvaluationQuestionVO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 测评试题表,记录每次测评的试题,与测评记录表相关联 Mapper 接口 + *

+ * + * @author lr + * @since 2021-09-26 + */ +public interface EvaluationQuestionMapper extends BaseMapper { + EvaluationQuestionVO selectByInfo(@Param("evaluationRecordId") Integer evaluationRecordId, + @Param("questionSortNo") Integer questionSortNo); + + int sumScore(@Param("evaluationRecordId") Integer evaluationRecordId); + + List sumScoreListByUserId(@Param("userId") Integer accountId); + + List selectDetailByInfo(@Param("evaluationRecordId") Integer evaluationRecordId); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/EvaluationRecordMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/EvaluationRecordMapper.java new file mode 100644 index 0000000..788bf96 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/EvaluationRecordMapper.java @@ -0,0 +1,22 @@ +package com.huoran.occupationlab.mapper; + +import com.huoran.occupationlab.entity.EvaluationRecord; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.occupationlab.entity.vo.TMSEvaluationRecordVO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 记录用户测评信息 Mapper 接口 + *

+ * + * @author lr + * @since 2021-09-26 + */ +public interface EvaluationRecordMapper extends BaseMapper { + + TMSEvaluationRecordVO selectVOByInfo(@Param("evaluationRecordId") Integer evaluationRecordId, + @Param("questionSortNo") Integer questionSortNo); + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/EvaluationRulesMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/EvaluationRulesMapper.java new file mode 100644 index 0000000..b8b9e2e --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/EvaluationRulesMapper.java @@ -0,0 +1,16 @@ +package com.huoran.occupationlab.mapper; + +import com.huoran.occupationlab.entity.EvaluationRules; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 测评规则信息记录,只记录一条信息 Mapper 接口 + *

+ * + * @author lr + * @since 2021-08-12 + */ +public interface EvaluationRulesMapper extends BaseMapper { +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ExperimentalReportMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ExperimentalReportMapper.java new file mode 100644 index 0000000..41fbc30 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ExperimentalReportMapper.java @@ -0,0 +1,182 @@ +package com.huoran.occupationlab.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.common.entity.ExperimentalReport; +import com.huoran.common.entity.LcRuleRecord; +import com.huoran.occupationlab.entity.req.PageAchievementByStuReq; +import com.huoran.occupationlab.entity.req.PageAchievementByTeacherReq; +import com.huoran.occupationlab.entity.req.PerformanceUnderProductReq; +import com.huoran.occupationlab.entity.resp.*; +import com.huoran.occupationlab.entity.vo.ActivityDerivationVO; +import com.huoran.occupationlab.entity.vo.PerformanceManagementPracticeActivityVO; +import com.huoran.occupationlab.entity.vo.PracticeTheHighestScoreListVO; +import com.huoran.occupationlab.entity.vo.ProductClassInformationVO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.HashMap; +import java.util.List; + +/** + *

+ * 存储各子系统的实验报告 Mapper 接口 + *

+ * + * @author lr + * @since 2021-09-08 + */ +@Mapper +public interface ExperimentalReportMapper extends BaseMapper { + + ExperimentOverviewResp getExperimentOverview(Integer accountId); + + IPage queryAssessmentByStudent(Page page, @Param("pageReq") PageAchievementByStuReq pageReq); + + IPage queryPracticeByStudent(Page page, @Param("pageReq") PageAchievementByStuReq pageReq); + + List getPracticeForTeacher(@Param("req") PageAchievementByTeacherReq req); + + List getPracticeForTeacherNum(@Param("req") PageAchievementByTeacherReq req); + + IPage getAssessmentForTeacher(Page page, @Param("req") PageAchievementByTeacherReq req); + + IPage getPracticeDetail(Page page, @Param("projectId") Integer projectId, + @Param("schoolId") Integer schoolId, @Param("classId") Integer classId, @Param("keyWord") String keyWord,@Param("mallId")Integer mallId); + + List exportPracticeInfo(@Param("ids") String ids, @Param("schoolId") Integer schoolId, @Param("projectId") Integer projectId,@Param("mallId")Integer mallId); + + List exportAssessmentInfo(@Param("ids") String ids, @Param("schoolId") Integer schoolId, @Param("assessmentId") Integer assessmentId, @Param("classId") Integer classId); + + IPage getAssessmentDetail(Page page, @Param("assessmentId") Integer assessmentId, @Param("classId") Integer classId,@Param("keyword")String keyword); + + FractionalSegmentResp getFractionalSegmentByPractice(@Param("projectId") Integer projectId, @Param("schoolId") Integer schoolId, @Param("classId") Integer classId,@Param("mallId")Integer mallId); + + FractionalSegmentResp getFractionalSegmentByAssessment(@Param("assessmentId") Integer assessmentId, @Param("classId") Integer classId); + + FractionalSegmentResp getAvgScoreAndPeopleByPractice(@Param("projectId") Integer projectId, @Param("schoolId") Integer schoolId, @Param("classId") Integer classId,@Param("mallId")Integer mallId); + + Integer countTheTotalNumberOfExercisers(@Param("projectId") Integer projectId, @Param("schoolId") Integer schoolId, @Param("classId") Integer classId,@Param("mallId")Integer mallId); + + FractionalSegmentResp getAvgScoreAndPeopleByAssessment(@Param("assessmentId") Integer assessmentId, @Param("classId") Integer classId); + + List exportAssessmentByStudent(@Param("ids") String ids, @Param("accountId") Integer accountId, @Param("curriculumId") Integer curriculumId); + + List exportPracticeByStudent(@Param("curriculumId") Integer curriculumId, @Param("accountId") Integer accountId); + + IPage practiceByStudentDetail(Page page, @Param("curriculumId") Integer curriculumId, @Param("projectId") Integer projectId, @Param("accountId") Integer accountId); + + List exportPracticeByStudentDetail(@Param("reportIds") String reportIds, @Param("projectId") Integer projectId, @Param("accountId") Integer accountId); + + HashMap queryUserInfo(Integer accountId); + + String selectTeacherName(Integer assessmentId); + + List getTheMostUsedCoursesInOurSchool(@Param("schoolId") Integer schoolId); + + IPage academicLeadersRanking(Page page, Integer schoolId); + + + ExamStatisticsResp examStatistics(@Param("schoolId") Integer schoolId, @Param("choose") Integer choose);//平台考试数据统计 + + + StudentPerformanceAnalysisResp studentGradeDistribution(@Param("schoolId") Integer schoolId, @Param("startTime") String startTime, @Param("endTime") String endTime); + + List studentAssessSchievement(@Param("schoolId") Integer schoolId, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("idlist") List idlist); + + OverviewOfStudentExperimentDataResp overviewOfOurSchoolData(@Param("schoolId") Integer schoolId); + + List getLcRuleRecord(@Param("answer") String answer); + + List getStRuleRecord(@Param("answer") String answer); + + List activityRanking(@Param("schoolId") Integer schoolId); + + List schoolActivityRanking(); + + ReturnActiveRankingResp classPracticeTimes(@Param("schoolId") Integer schoolId, @Param("classId") Integer classId); + + + //成绩管理——获取项目下的判分点信息 + List getPointInformationForProject(@Param("projectId") Integer projectId, @Param("schoolId") Integer schoolId); + + + Integer countError(@Param("projectId") Integer projectId, @Param("schoolId") Integer schoolId, @Param("pointId") Integer pointId); + + List errorRateAnalysis(@Param("projectId") Integer projectId, @Param("schoolId") Integer schoolId, @Param("classId") Integer classId, @Param("mallId") Integer mallId); + + List errorRateAnalysisForAssessment(@Param("projectId") Integer projectId, @Param("schoolId") Integer schoolId + , @Param("assessmentId") Integer assessmentId, @Param("classId") Integer classId); + + List errorRateAnalysisForAssessmentByLc(@Param("projectId") Integer projectId, @Param("schoolId") Integer schoolId + , @Param("assessmentId") Integer assessmentId); + + + IPage practiceActivity(Page page, + @Param("projectId") Integer projectId, @Param("schoolId") Integer schoolId, + @Param("classId") Integer classId, @Param("keyWord") String keyWord, @Param("mallId")Integer mallId); + + + IPage exportAllData(Page page, @Param("projectId") Integer projectId, @Param("schoolId") Integer schoolId, @Param("mallId")Integer mallId); + + + IPage maximumPracticeScoreList(Page page, @Param("projectId") Integer projectId, + @Param("schoolId") Integer schoolId, + @Param("mallId")Integer mallId); + + + Integer selectSystemType(@Param("systemId") Integer systemId); + + List errorRateAnalysisByLc(@Param("projectId") Integer projectId, + @Param("schoolId") Integer schoolId, + @Param("classId") Integer classId, + @Param("mallId") Integer mallId); + + + List getProduct(@Param("schoolId") Integer schoolId); + + + //产品下练习板块数据 + PerformanceUnderProductResp practicePlateDataUnderProduct(@Param("req") PerformanceUnderProductReq req); + + //产品下考核板块数据 + PerformanceUnderProductResp assessPlateDataUnderProduct(@Param("req") PerformanceUnderProductReq req); + + + + //产品下练习阶段分数数据 + FractionalSegmentResp productPracticeStageScoreData(@Param("req") PerformanceUnderProductReq req); + + + //产品下项目错误率分析 + List projectErrorRateAnalysisUnderProduct(@Param("req") PerformanceUnderProductReq req); + + + //产品下项目成绩列表 + IPage listOfProjectResultsUnderTheProduct(Page page,@Param("req") PerformanceUnderProductReq req); + + + //用户练习成绩详情 + IPage userPracticeScoreDetails(Page page,@Param("req") PerformanceUnderProductReq req); + + //用户考核成绩详情 + IPage userAssessScoreDetails(Page page,@Param("req") PerformanceUnderProductReq req); + + + //产品下考核成绩列表 + IPage listOfAssessmentResultsUnderTheProduct(Page page,@Param("req") PerformanceUnderProductReq req); + + + + List testErrorRateUnderProduct(@Param("req") PerformanceUnderProductReq req); + + //实验报告数据处理:将原来未绑定产品的实验报告补上 + List experimentalReportDataProcessing(); + + + String getItemOptions(@Param("itemId")String ruleAnswer); + + String getStItemOptions(@Param("itemId")String ruleAnswer); + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/PermissionMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/PermissionMapper.java new file mode 100644 index 0000000..410139c --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/PermissionMapper.java @@ -0,0 +1,19 @@ +package com.huoran.occupationlab.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.occupationlab.entity.AclPermission; + +import java.util.List; + +/** + * 权限 Mapper 接口 + */ +public interface PermissionMapper extends BaseMapper { + + List selectPermissionValueByUserId(String id); + + List selectAllPermissionValue(); + + List selectPermissionByUserId(String userId); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/PlayRecordMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/PlayRecordMapper.java new file mode 100644 index 0000000..8af3196 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/PlayRecordMapper.java @@ -0,0 +1,25 @@ +package com.huoran.occupationlab.mapper; + +import com.huoran.occupationlab.entity.PlayRecord; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.occupationlab.entity.req.StudentPerformanceAnalysisReq; +import com.huoran.occupationlab.entity.resp.MonthlyOnlineStudyHoursResp; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 资源播放记录表 Mapper 接口 + *

+ * + * @author lr + * @since 2022-09-09 + */ +@Mapper +public interface PlayRecordMapper extends BaseMapper { + MonthlyOnlineStudyHoursResp monthlyAverageOnlineTime(@Param("schoolId") Integer schoolId, @Param("startTime") String startTime, @Param("endTime") String endTime); + + List courseRankings(@Param("schoolId")Integer schoolId); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ProjectHiddenMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ProjectHiddenMapper.java new file mode 100644 index 0000000..196d904 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ProjectHiddenMapper.java @@ -0,0 +1,18 @@ +package com.huoran.occupationlab.mapper; + +import com.huoran.occupationlab.entity.ProjectHidden; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + *

+ * 此表是在教师端成绩管理,虚仿以及教学列表展示中使用到 Mapper 接口 + *

+ * + * @author lr + * @since 2021-09-23 + */ +@Mapper +public interface ProjectHiddenMapper extends BaseMapper { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ProjectJudgmentMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ProjectJudgmentMapper.java new file mode 100644 index 0000000..294da6e --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ProjectJudgmentMapper.java @@ -0,0 +1,43 @@ +package com.huoran.occupationlab.mapper; + +import com.huoran.occupationlab.entity.ProjectJudgment; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; + +/** + *

+ * 项目管理判分点绑定表 Mapper 接口 + *

+ * + * @author Mr.JK + * @since 2021-08-26 + */ +@Mapper +public interface ProjectJudgmentMapper extends BaseMapper { + + /** + * 迁移数据使用接口 勿用 + * @param pointName + * @param experimentalRequirements + * @return + */ + Integer tempSelectBcId(@Param("pointName") String pointName,@Param("experimentalRequirements") String experimentalRequirements); + + /** + * 更新项目管理中间表 + * @param judgmentId id + * @param judgmentScore 分数 + * @param judgmentSort 排序 + * @return + */ + Integer updateJudgment(Integer judgmentId,Integer judgmentScore,Integer judgmentSort); + + ArrayList selectBcJudgmentIdList(@Param("ids") HashSet ids,@Param("name") String name); + + ArrayList selectLcJudgmentIdList(@Param("ids") HashSet set,@Param("name") String name); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ProjectManageDisableMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ProjectManageDisableMapper.java new file mode 100644 index 0000000..83fb9bc --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ProjectManageDisableMapper.java @@ -0,0 +1,18 @@ +package com.huoran.occupationlab.mapper; + +import com.huoran.occupationlab.entity.ProjectManageDisable; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + *

+ * 记录项目学校端的禁用记录 Mapper 接口 + *

+ * + * @author lr + * @since 2022-01-12 + */ +@Mapper +public interface ProjectManageDisableMapper extends BaseMapper { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ProjectManageMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ProjectManageMapper.java new file mode 100644 index 0000000..61ed49c --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ProjectManageMapper.java @@ -0,0 +1,130 @@ +package com.huoran.occupationlab.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.common.entity.ProjectManage; +import com.huoran.occupationlab.entity.req.ProjectManageReq; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 项目管理表 Mapper 接口 + *

+ * + * @author Mr.JK + * @since 2021-08-26 + */ +@Mapper +public interface ProjectManageMapper extends BaseMapper { + + /** + * 更新职站是否开启 + * + * @param projectId + * @param isOpen + */ + void updateIsOpenZz(Integer projectId, Integer isOpen); + + /** + * 更新中台是否开启 + * + * @param projectId + * @param isOpen + */ + void updateIsOpenZt(Integer projectId, Integer isOpen); + + /** + * 查询所有订单下的所有课程下的所有项目 + * + * @param schoolId + * @param systemId + * @param permissions + * @return + */ + List selectCurriculumProject(@Param("schoolId") Integer schoolId, @Param("systemId") String systemId, @Param("permissions") Integer permissions, @Param("cId") Integer cId); + + /** + * 发布项目 + * + * @param projectId + */ + void updateState(Integer projectId); + + /** + * @Description : 项目管理列表 + * @Param page + * @Param req + * @Author Rong---2021/11/30 + */ + IPage queryProjectManage(Page page, @Param("req") ProjectManageReq req); + + /** + * @Description : 教师:项目管理列表 + * @Param page + * @Param req + * @Author Rong---2021/12/1 + */ + IPage queryProjectManageByTeacher(Page page, @Param("req") ProjectManageReq req); + + /** + * @Description : 中台:全部项目管理列表 + * @Param page + * @Param req + * @Author Rong---2021/12/6 + */ + IPage queryNakadaiProjectList(Page page, @Param("req") ProjectManageReq req); + + /** + * @Description :职站实验项目管理-全部: + * 1、查询中台全部数据以及学校发布的全部数据 + * 2、查询购买的课程下的项目以及根据角色查询本校内的项目 + *

+ * 22.3.9更新后逻辑 + * 1).系统的项目依据课程排序的项目顺序展示 + * 2).老师的依据发布时间展示 在系统项目上面 + * 3).处于草稿的项目置信在最上面。 + * @Param page + * @Param req + * @Author Rong---2021/12/6 + */ + IPage queryOccupationlabProjectList(Page page, @Param("req") ProjectManageReq req); + + /** + * @Description :中台项目管理列表——教师条件 + * @Param page + * @Param req + * @Author Rong---2022/1/12 + */ + IPage nakadaiProjectListByTeacher(Page page, @Param("req") ProjectManageReq req); + + + /** + * 中台项目管理列表——系统条件 + * @param page + * @param req + * @return + */ + IPage nakadaiProjectListBySystem(Page page, @Param("req") ProjectManageReq req); + + Integer selectSystemType(@Param("systemId") Integer systemId); + + List selectProjectList(@Param("systemIds") String systemIds,@Param("permissions") Integer permissions); + + IPage selectProjectAssessmentByCompetition(Page page, @Param("req") ProjectManageReq projectManageReq); + + String selectSystemName(@Param("systemId")Integer systemId); + + + ProjectManage getProjectDetails(@Param("projectId")Integer projectId); + + ProjectManage undeletedAndDeletedItemDetails(@Param("projectId")Integer projectId); + + Integer getCurriculumCountByType(@Param("cid")Integer cid,@Param("permissions")Integer permissions); + + Integer projectCreatedUnderProduct(@Param("mallId")Integer mallId,@Param("permissions")Integer permissions,@Param("schoolId")Integer schoolId); + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ProvinceMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ProvinceMapper.java new file mode 100644 index 0000000..bda39b8 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/ProvinceMapper.java @@ -0,0 +1,18 @@ +package com.huoran.occupationlab.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.occupationlab.entity.Province; +import org.apache.ibatis.annotations.Mapper; + +/** + *

+ * 省份表 Mapper 接口 + *

+ * + * @author Ning + * @since 2020-10-27 + */ +@Mapper +public interface ProvinceMapper extends BaseMapper { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/PythonFileDataMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/PythonFileDataMapper.java new file mode 100644 index 0000000..a1e8f6e --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/PythonFileDataMapper.java @@ -0,0 +1,18 @@ +package com.huoran.occupationlab.mapper; + +import com.huoran.occupationlab.entity.PythonFileData; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author lr + * @since 2022-04-06 + */ +public interface PythonFileDataMapper extends BaseMapper { + //新增前统计 + Double statistics(@Param("accountId") Integer accountId, @Param("schoolId") Integer schoolId); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/PythonRunCodeMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/PythonRunCodeMapper.java new file mode 100644 index 0000000..d7b59ca --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/PythonRunCodeMapper.java @@ -0,0 +1,21 @@ +package com.huoran.occupationlab.mapper; + +import com.huoran.occupationlab.entity.PythonRunCode; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import io.lettuce.core.dynamic.annotation.Param; +import org.apache.ibatis.annotations.Mapper; + +/** + *

+ * python储存实验运行记录 Mapper 接口 + *

+ * + * @author lr + * @since 2021-12-22 + */ +@Mapper +public interface PythonRunCodeMapper extends BaseMapper { + String getRunCode(PythonRunCode code); + + String getRunPhotoUrlString(@Param("reportId") Integer reportId,@Param("judgmentPointsId") Integer judgmentPointsId); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/PythonSystemMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/PythonSystemMapper.java new file mode 100644 index 0000000..a6705c5 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/PythonSystemMapper.java @@ -0,0 +1,21 @@ +package com.huoran.occupationlab.mapper; + +import com.huoran.occupationlab.entity.PythonSystem; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.occupationlab.entity.vo.AssessmentVO; +import org.apache.ibatis.annotations.Param; +import org.springframework.web.bind.annotation.RequestParam; + +import java.util.List; + +/** + *

+ * python系统记录表 Mapper 接口 + *

+ * + * @author lr + * @since 2021-08-19 + */ +public interface PythonSystemMapper extends BaseMapper { + List getCourseTitle(@Param("accountId") Integer accountId,@Param("schoolId") Integer schoolId); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/PythonTableDataMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/PythonTableDataMapper.java new file mode 100644 index 0000000..ea23078 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/PythonTableDataMapper.java @@ -0,0 +1,16 @@ +package com.huoran.occupationlab.mapper; + +import com.huoran.occupationlab.entity.PythonTableData; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 储存全部python表数据表导出Excel路径 Mapper 接口 + *

+ * + * @author lr + * @since 2022-08-12 + */ +public interface PythonTableDataMapper extends BaseMapper { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/QuestionsMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/QuestionsMapper.java new file mode 100644 index 0000000..01adf9d --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/QuestionsMapper.java @@ -0,0 +1,37 @@ +package com.huoran.occupationlab.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.occupationlab.entity.EvaluationRules; +import com.huoran.occupationlab.entity.Questions; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 测评管理-题库记录表 Mapper 接口 + *

+ * + * @author lr + * @since 2021-08-12 + */ +public interface QuestionsMapper extends BaseMapper { + + EvaluationRules queryNumberOfQuestions(@Param("schoolId")Integer schoolId); + + EvaluationRules queryNumberOfTatolQuestions(@Param("schoolId")Integer schoolId); + + Integer queryQuestionNumber(String number,@Param("schoolId")Integer schoolId); + + + Integer countTotalMultipleNum(@Param("schoolId")Integer schoolId); + + Integer countTotalJudgmentNum(@Param("schoolId")Integer schoolId); + + Integer countTotalMultiplenum(@Param("schoolId")Integer schoolId); + + Integer countTotalJudgmentnum(@Param("schoolId")Integer schoolId); + + + List selectIds(@Param("questionType") String questionType,@Param("schoolId")Integer schoolId); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/RoleMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/RoleMapper.java new file mode 100644 index 0000000..b9a5a06 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/RoleMapper.java @@ -0,0 +1,12 @@ +package com.huoran.occupationlab.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.occupationlab.entity.AclRole; + +/** + * 角色 Mapper 接口 + */ +public interface RoleMapper extends BaseMapper { + + int removeRolePermission(String roleId); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/RolePermissionMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/RolePermissionMapper.java new file mode 100644 index 0000000..f5c051f --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/RolePermissionMapper.java @@ -0,0 +1,11 @@ +package com.huoran.occupationlab.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.occupationlab.entity.AclRolePermission; + +/** + * 角色权限 Mapper 接口 + */ +public interface RolePermissionMapper extends BaseMapper { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/SchoolClassificationMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/SchoolClassificationMapper.java new file mode 100644 index 0000000..8532105 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/SchoolClassificationMapper.java @@ -0,0 +1,16 @@ +package com.huoran.occupationlab.mapper; + +import com.huoran.occupationlab.entity.SchoolClassification; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 学校对应分类表 Mapper 接口 + *

+ * + * @author lr + * @since 2021-09-09 + */ +public interface SchoolClassificationMapper extends BaseMapper { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/SchoolCourseMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/SchoolCourseMapper.java new file mode 100644 index 0000000..02b49fe --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/SchoolCourseMapper.java @@ -0,0 +1,30 @@ +package com.huoran.occupationlab.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.occupationlab.entity.SchoolCourse; +import com.huoran.occupationlab.entity.vo.CourseVO; +import org.apache.ibatis.annotations.Param; + +import java.util.HashMap; +import java.util.List; + +/** + *

+ * 学校内置课程表 Mapper 接口 + *

+ * + * @author Cheney + * @since 2020-11-30 + */ +public interface SchoolCourseMapper extends BaseMapper { + + List selectCoursePageByCondition(HashMap map); + + int coursePageConditionCount(HashMap map); + + List builtInCoursePageQuery(HashMap map); + + int builtInCoursePageCount(HashMap map); + + int builtInCourseClassificationCount(@Param("schoolId")String schoolId, @Param("classificationId")String classificationId); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/SchoolMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/SchoolMapper.java new file mode 100644 index 0000000..3731e6d --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/SchoolMapper.java @@ -0,0 +1,18 @@ +package com.huoran.occupationlab.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.common.entity.School; +import org.apache.ibatis.annotations.Mapper; + +/** + *

+ * 学校表 Mapper 接口 + *

+ * + * @author Ning + * @since 2020-10-27 + */ +@Mapper +public interface SchoolMapper extends BaseMapper { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/SchoolProjectHintOpenMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/SchoolProjectHintOpenMapper.java new file mode 100644 index 0000000..0b377ca --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/SchoolProjectHintOpenMapper.java @@ -0,0 +1,18 @@ +package com.huoran.occupationlab.mapper; + +import com.huoran.occupationlab.entity.SchoolProjectHintOpen; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + *

+ * 学校项目实验提示管理表 Mapper 接口 + *

+ * + * @author lr + * @since 2023-06-02 + */ +@Mapper +public interface SchoolProjectHintOpenMapper extends BaseMapper { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/StaffGradeMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/StaffGradeMapper.java new file mode 100644 index 0000000..f0b5ba0 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/StaffGradeMapper.java @@ -0,0 +1,16 @@ +package com.huoran.occupationlab.mapper; + +import com.huoran.occupationlab.entity.StaffGrade; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 员工年级表 Mapper 接口 + *

+ * + * @author lr + * @since 2021-10-13 + */ +public interface StaffGradeMapper extends BaseMapper { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/StaffMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/StaffMapper.java new file mode 100644 index 0000000..42eb81a --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/StaffMapper.java @@ -0,0 +1,33 @@ +package com.huoran.occupationlab.mapper; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.occupationlab.entity.Questions; +import com.huoran.occupationlab.entity.Staff; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.occupationlab.entity.req.PageStaffListReq; +import com.huoran.occupationlab.entity.req.QuestionsQueryReq; +import com.huoran.occupationlab.entity.resp.AchievementResp; +import com.huoran.occupationlab.entity.resp.StaffResp; +import com.huoran.occupationlab.entity.resp.StaffRoleResp; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 员工表 Mapper 接口 + *

+ * + * @author lr + * @since 2021-10-13 + */ +public interface StaffMapper extends BaseMapper { + + IPage staffList(Page page, @Param("req") PageStaffListReq req); + + StaffResp staffDetail(@Param("accountId")Integer accountId); + + List getStaffInfoByAccountId(@Param("accountId")Integer accountId); + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/StaffProfessionalArchitectureMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/StaffProfessionalArchitectureMapper.java new file mode 100644 index 0000000..4e49733 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/StaffProfessionalArchitectureMapper.java @@ -0,0 +1,16 @@ +package com.huoran.occupationlab.mapper; + +import com.huoran.occupationlab.entity.StaffProfessionalArchitecture; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 员工专业组织架构 Mapper 接口 + *

+ * + * @author lr + * @since 2021-10-13 + */ +public interface StaffProfessionalArchitectureMapper extends BaseMapper { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/StudentMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/StudentMapper.java new file mode 100644 index 0000000..270ec8d --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/StudentMapper.java @@ -0,0 +1,92 @@ +package com.huoran.occupationlab.mapper; + +import com.huoran.common.entity.Student; +import com.huoran.common.entity.UserAccount; +import com.huoran.common.entity.UserInfo; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.occupationlab.entity.req.AddStudentCheckReq; +import com.huoran.occupationlab.entity.req.EditStudentsReq; +import com.huoran.occupationlab.entity.req.OrganizationStudentReq; +import com.huoran.occupationlab.entity.resp.StudentInfoResp; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + *

+ * 学生表 Mapper 接口 + *

+ * + * @author lr + * @since 2021-08-24 + */ +@Mapper +public interface StudentMapper extends BaseMapper { + StudentInfoResp getStudentInfoDetail(@Param("params") Map params); + //根据学号获取学生详情信息 + StudentInfoResp getStudentInfoDetailByWorkNum(@Param("params") Map params); + + //根据账号id获取用户名 + StudentInfoResp getUerName(Integer accountId); + + //新增用户信息 + Integer addUserInfo(UserInfo userInfo); + + //新增账号信息 + Integer addUserAccount(UserAccount account); + + /** + * 学号(本校内)——————账号(全平台)判重 ——————手机号、邮箱根据平台id判重 + */ + //手机号、邮箱根据平台id判重 + List checkUserInfo(UserInfo userInfo); + + //学号(本校内)——————账号(全平台) + List checkUserAccount(UserAccount userAccount); + + //查询学生列表oc + List studentList(@Param("params") Map params); + + //统计学生列表总数 + Integer studentListNum(@Param("params") Map params); + + //查询职站学生端的用户 + List getOccupationlabStudent(); + + //查询学生信息 + StudentInfoResp getStudentInfoByAccountId(Integer stuAccountId); + + //修改用户信息 + boolean modifyUserInfo(UserInfo userInfo); + + //根据用户id修改账户信息 + boolean modifyUserAccountByUserId(@Param("u") EditStudentsReq userInfo); + + //修改账户信息 + boolean modifyUserAccount(UserAccount userAccount); + + //组织架构筛选学生 + List organizationalStudentList(@Param("req") OrganizationStudentReq req); + + //统计组织架构筛选学生 + Integer organizationalStudentListNum(@Param("req") OrganizationStudentReq req); + + Integer updateAccountEnable(@Param("id") Integer id, @Param("isEnable") Integer isEnable); + + //根据账号id拿到用户id + Integer getUserId(Integer accountId); + + //根据学校id、用户姓名、学生账号、学号平台、端口查询 + StudentInfoResp isExistUserInfo(@Param("req") AddStudentCheckReq req); + + //学号(本校内)——————账号(全平台) + UserAccount checkAccountOrWorkNum(UserAccount userAccount); + + //连表根据账号学号姓名学校查询用户信息 + StudentInfoResp getUserInfo(StudentInfoResp resp); + + Integer countClassSizes(@Param("schoolId")Integer schoolId,@Param("classId")Integer classId); + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/SysJobLogMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/SysJobLogMapper.java new file mode 100644 index 0000000..77a6f09 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/SysJobLogMapper.java @@ -0,0 +1,15 @@ +package com.huoran.occupationlab.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.occupationlab.entity.SysJobLog; + +/** + * 定时任务日志、 Mapper + * + * @author cheney + * @version V1.0 + * @date 2022年7月28日 + */ +public interface SysJobLogMapper extends BaseMapper { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/SysJobMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/SysJobMapper.java new file mode 100644 index 0000000..470270b --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/SysJobMapper.java @@ -0,0 +1,15 @@ +package com.huoran.occupationlab.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.occupationlab.entity.SysJob; + +/** + * 定时任务 Mapper + * + * @author cheney + * @version V1.0 + * @date 2022年7月28日 + */ +public interface SysJobMapper extends BaseMapper { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/SysLogMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/SysLogMapper.java new file mode 100644 index 0000000..3bd906d --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/SysLogMapper.java @@ -0,0 +1,17 @@ +package com.huoran.occupationlab.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.occupationlab.entity.SysLog; +import org.apache.ibatis.annotations.Mapper; + +/** + * 操作日志 Mapper + * + * @author cheney + * @version V1.0 + * @date 2022年7月28日 + */ +@Mapper +public interface SysLogMapper extends BaseMapper { +} \ No newline at end of file diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/SystemLogoMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/SystemLogoMapper.java new file mode 100644 index 0000000..b970f8b --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/SystemLogoMapper.java @@ -0,0 +1,16 @@ +package com.huoran.occupationlab.mapper; + +import com.huoran.occupationlab.entity.SystemLogo; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 职站教师端-系统logo设置 Mapper 接口 + *

+ * + * @author lr + * @since 2021-10-18 + */ +public interface SystemLogoMapper extends BaseMapper { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/TheoreticalCourseChapterMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/TheoreticalCourseChapterMapper.java new file mode 100644 index 0000000..108107a --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/TheoreticalCourseChapterMapper.java @@ -0,0 +1,33 @@ +package com.huoran.occupationlab.mapper; + +import com.huoran.occupationlab.entity.TheoreticalCourseChapter; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 理论课程章节表 Mapper 接口 + *

+ * + * @author lr + * @since 2022-09-22 + */ +public interface TheoreticalCourseChapterMapper extends BaseMapper { + + Integer selectMaxSort(); + + Integer selectMinSort(); + + /** + * 查询上一章节 + * @param currentChapterId 当前章节id + * @return 上一章节id + */ + String selectPreviousChapter(String currentChapterId); + + /** + * 查询下一章节 + * @param currentChapterId 当前章节id + * @return 下一章节id + */ + String selectNextChapter(String currentChapterId); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/TheoreticalCourseClassificationMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/TheoreticalCourseClassificationMapper.java new file mode 100644 index 0000000..474bad3 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/TheoreticalCourseClassificationMapper.java @@ -0,0 +1,19 @@ +package com.huoran.occupationlab.mapper; + +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.TheoreticalCourseClassification; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +import java.util.List; + +/** + *

+ * 理论课程分类信息 Mapper 接口 + *

+ * + * @author lr + * @since 2022-09-14 + */ +public interface TheoreticalCourseClassificationMapper extends BaseMapper { + List queryAllCategoriesOfSchools(); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/TheoreticalCourseCollectMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/TheoreticalCourseCollectMapper.java new file mode 100644 index 0000000..545873c --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/TheoreticalCourseCollectMapper.java @@ -0,0 +1,16 @@ +package com.huoran.occupationlab.mapper; + +import com.huoran.occupationlab.entity.TheoreticalCourseCollect; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 理论课程收藏表 Mapper 接口 + *

+ * + * @author lr + * @since 2023-04-18 + */ +public interface TheoreticalCourseCollectMapper extends BaseMapper { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/TheoreticalCourseConfigureMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/TheoreticalCourseConfigureMapper.java new file mode 100644 index 0000000..b0d3962 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/TheoreticalCourseConfigureMapper.java @@ -0,0 +1,23 @@ +package com.huoran.occupationlab.mapper; + +import com.huoran.occupationlab.entity.TheoreticalCourseConfigure; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.occupationlab.entity.req.PageTheoreticalCourseReq; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 理论课程与理论课程分类配置表 Mapper 接口 + *

+ * + * @author lr + * @since 2022-09-14 + */ +public interface TheoreticalCourseConfigureMapper extends BaseMapper { + + List getConfigInfoByCourseId(@Param("courseId") Integer courseId, @Param("classificationType") Integer classificationType); + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/TheoreticalCourseMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/TheoreticalCourseMapper.java new file mode 100644 index 0000000..f0254b2 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/TheoreticalCourseMapper.java @@ -0,0 +1,40 @@ +package com.huoran.occupationlab.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.occupationlab.entity.TheoreticalCourse; +import com.huoran.occupationlab.entity.req.PageStudentTheoreticalCourseReq; +import com.huoran.occupationlab.entity.req.PageTheoreticalCourseReq; +import com.huoran.occupationlab.entity.resp.PageTheoreticalCourseByNakadaiResp; +import com.huoran.occupationlab.entity.resp.TheoreticalCourseDetailResp; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 理论课程基本信息 Mapper 接口 + *

+ * + * @author lr + * @since 2022-09-14 + */ +public interface TheoreticalCourseMapper extends BaseMapper { + IPage pageConditionalQueryCourseByNakadai(Page page, @Param("req") PageTheoreticalCourseReq req); + + + TheoreticalCourseDetailResp theoryCoursesDetail(@Param("id") Integer id); + + + IPage pageConditionalQueryCourseByStudent(Page page, @Param("req") PageStudentTheoreticalCourseReq req); + + + IPage studentLoginPreCourse(Page page, @Param("req") PageTheoreticalCourseReq req); + + //本校创建的课程 + IPage theoreticalCoursesOfTheSchool(Page page, @Param("req") PageStudentTheoreticalCourseReq req); + + + //本人收藏的课程 + IPage theCurrentUserFavoriteCourse(Page page, @Param("req") PageStudentTheoreticalCourseReq req); + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/TheoreticalCourseRangeMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/TheoreticalCourseRangeMapper.java new file mode 100644 index 0000000..d52fb7e --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/TheoreticalCourseRangeMapper.java @@ -0,0 +1,24 @@ +package com.huoran.occupationlab.mapper; + +import com.huoran.occupationlab.entity.TheoreticalCourseRange; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.occupationlab.entity.resp.ContestRangeResp; +import com.huoran.occupationlab.entity.resp.TheoreticalCoursetRangeResp; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 理论课程指定范围选择 Mapper 接口 + *

+ * + * @author lr + * @since 2022-09-19 + */ +public interface TheoreticalCourseRangeMapper extends BaseMapper { + List getCourseRangeByCourseId(@Param("courseId")Integer courseId); + + List getRangeByCourseId(@Param("courseId")Integer courseId); + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/TheoreticalCourseSubsectionMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/TheoreticalCourseSubsectionMapper.java new file mode 100644 index 0000000..8c3ef98 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/TheoreticalCourseSubsectionMapper.java @@ -0,0 +1,17 @@ +package com.huoran.occupationlab.mapper; + +import com.huoran.occupationlab.entity.TheoreticalCourseSubsection; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 课程小节 Mapper 接口 + *

+ * + * @author lr + * @since 2022-09-22 + */ +public interface TheoreticalCourseSubsectionMapper extends BaseMapper { + + Integer selectMaxSort(); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/UserInfoMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/UserInfoMapper.java new file mode 100644 index 0000000..3c7e508 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/UserInfoMapper.java @@ -0,0 +1,24 @@ +package com.huoran.occupationlab.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.occupationlab.entity.HrUserInfo; + +import java.util.HashMap; +import java.util.List; + +/** + *

+ * 用户信息表 Mapper 接口 + *

+ * + * @author Ning + * @since 2020-10-21 + */ +public interface UserInfoMapper extends BaseMapper { + + List queryList(HashMap map); + + HrUserInfo login(HashMap map); + + int updateTime(Integer userId); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/UserManagementMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/UserManagementMapper.java new file mode 100644 index 0000000..d37e5ad --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/UserManagementMapper.java @@ -0,0 +1,31 @@ +package com.huoran.occupationlab.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.occupationlab.entity.UserManagement; +import com.huoran.occupationlab.entity.vo.UserInfo; +import org.apache.ibatis.annotations.Mapper; + +import java.util.HashMap; +import java.util.List; + +/** + *

+ * 企业端用户管理 Mapper 接口 + *

+ * + * @author Ning + * @since 2020-10-27 + */ +@Mapper +public interface UserManagementMapper extends BaseMapper { + + boolean addUserInfo(UserInfo userInfo); + + List queryList(HashMap map); + + int queryListCount(HashMap map); + + Integer selectUserId(Integer id); + + int deleteUser(Integer userId); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/UserRoleMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/UserRoleMapper.java new file mode 100644 index 0000000..3c7819b --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/UserRoleMapper.java @@ -0,0 +1,11 @@ +package com.huoran.occupationlab.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.occupationlab.entity.AclUserRole; + +/** + * 用户角色 Mapper 接口 + */ +public interface UserRoleMapper extends BaseMapper { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/UserScoreMapper.java b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/UserScoreMapper.java new file mode 100644 index 0000000..0157d3f --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/UserScoreMapper.java @@ -0,0 +1,40 @@ +package com.huoran.occupationlab.mapper; + +import com.huoran.common.entity.BcJudgmentPoint; +import com.huoran.occupationlab.entity.UserScore; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.springframework.web.bind.annotation.PostMapping; + +import java.util.List; + +/** + *

+ * 用户分数表 Mapper 接口 + *

+ * + * @author Mr.JK + * @since 2021-09-14 + */ +@Mapper +public interface UserScoreMapper extends BaseMapper { + + /** + * 查询判分点名称 + * + * @param judgmentId + * @return + */ + String selectJudgmentNameById(Integer judgmentId); + + /** + * 获取编程类判分名称 + * + * @param bcId + * @return + */ + BcJudgmentPoint selectJudgmentNameByBcId(Integer bcId); + + List selectScoreList(@Param("reportId") Integer reportId); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ApplicantMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ApplicantMapper.xml new file mode 100644 index 0000000..90b1134 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ApplicantMapper.xml @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + update ol_applicant set is_disable = 1 where id in + + #{id} + + + + DELETE + FROM ol_applicant + WHERE contest_id = #{contestId} + and account_id = #{accountId} + + + + + + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ArchitectureMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ArchitectureMapper.xml new file mode 100644 index 0000000..40d3ee3 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ArchitectureMapper.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ArticleMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ArticleMapper.xml new file mode 100644 index 0000000..dee1f54 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ArticleMapper.xml @@ -0,0 +1,15 @@ + + + + + + update ol_article + set view_count=view_count + 1 + where id = #{articleId} + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/AssessmentExamMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/AssessmentExamMapper.xml new file mode 100644 index 0000000..72abd66 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/AssessmentExamMapper.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/AssessmentMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/AssessmentMapper.xml new file mode 100644 index 0000000..ba42b5e --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/AssessmentMapper.xml @@ -0,0 +1,614 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/CityMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/CityMapper.xml new file mode 100644 index 0000000..8d4a8cc --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/CityMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ClassMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ClassMapper.xml new file mode 100644 index 0000000..f47ef7b --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ClassMapper.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ClientManagementMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ClientManagementMapper.xml new file mode 100644 index 0000000..a0c2f08 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ClientManagementMapper.xml @@ -0,0 +1,38 @@ + + + + + + + delete + from ol_hr_user_info + where clientId = #{clientId} + + + + delete + from ol_staff + where schoolId = #{clientId} + + + delete + from ol_student + where clientId = #{clientId} + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ColumnMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ColumnMapper.xml new file mode 100644 index 0000000..50ea363 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ColumnMapper.xml @@ -0,0 +1,18 @@ + + + + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ContestAnnexMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ContestAnnexMapper.xml new file mode 100644 index 0000000..f77828f --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ContestAnnexMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ContestAnnouncementAnnexMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ContestAnnouncementAnnexMapper.xml new file mode 100644 index 0000000..de4e679 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ContestAnnouncementAnnexMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ContestAnnouncementMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ContestAnnouncementMapper.xml new file mode 100644 index 0000000..c3936cd --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ContestAnnouncementMapper.xml @@ -0,0 +1,17 @@ + + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ContestMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ContestMapper.xml new file mode 100644 index 0000000..da819b3 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ContestMapper.xml @@ -0,0 +1,489 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ContestProgressMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ContestProgressMapper.xml new file mode 100644 index 0000000..340bff5 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ContestProgressMapper.xml @@ -0,0 +1,12 @@ + + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ContestRangeMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ContestRangeMapper.xml new file mode 100644 index 0000000..47674d0 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ContestRangeMapper.xml @@ -0,0 +1,46 @@ + + + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/CourseChapterMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/CourseChapterMapper.xml new file mode 100644 index 0000000..c913f7d --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/CourseChapterMapper.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/CourseClassificationMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/CourseClassificationMapper.xml new file mode 100644 index 0000000..af055d2 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/CourseClassificationMapper.xml @@ -0,0 +1,22 @@ + + + + + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/CourseMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/CourseMapper.xml new file mode 100644 index 0000000..ba3be5c --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/CourseMapper.xml @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/CourseSubsectionMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/CourseSubsectionMapper.xml new file mode 100644 index 0000000..1b2c3ba --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/CourseSubsectionMapper.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/EntrepreneurialActivityAnnouncementAnnexMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/EntrepreneurialActivityAnnouncementAnnexMapper.xml new file mode 100644 index 0000000..8714939 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/EntrepreneurialActivityAnnouncementAnnexMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/EntrepreneurialActivityAnnouncementMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/EntrepreneurialActivityAnnouncementMapper.xml new file mode 100644 index 0000000..8e5a734 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/EntrepreneurialActivityAnnouncementMapper.xml @@ -0,0 +1,22 @@ + + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/EntrepreneurialActivityApplicantMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/EntrepreneurialActivityApplicantMapper.xml new file mode 100644 index 0000000..8239add --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/EntrepreneurialActivityApplicantMapper.xml @@ -0,0 +1,40 @@ + + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/EntrepreneurialActivityCollectMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/EntrepreneurialActivityCollectMapper.xml new file mode 100644 index 0000000..919fe4f --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/EntrepreneurialActivityCollectMapper.xml @@ -0,0 +1,10 @@ + + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/EntrepreneurialActivityFileMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/EntrepreneurialActivityFileMapper.xml new file mode 100644 index 0000000..01bff8c --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/EntrepreneurialActivityFileMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/EntrepreneurialActivityMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/EntrepreneurialActivityMapper.xml new file mode 100644 index 0000000..339bec9 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/EntrepreneurialActivityMapper.xml @@ -0,0 +1,310 @@ + + + + + + + + + + + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/EntrepreneurialActivityProgressMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/EntrepreneurialActivityProgressMapper.xml new file mode 100644 index 0000000..6884d81 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/EntrepreneurialActivityProgressMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/EvaluationFractionMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/EvaluationFractionMapper.xml new file mode 100644 index 0000000..02d7549 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/EvaluationFractionMapper.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/EvaluationQuestionMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/EvaluationQuestionMapper.xml new file mode 100644 index 0000000..dbabd7d --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/EvaluationQuestionMapper.xml @@ -0,0 +1,42 @@ + + + + + + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/EvaluationRecordMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/EvaluationRecordMapper.xml new file mode 100644 index 0000000..ec71490 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/EvaluationRecordMapper.xml @@ -0,0 +1,26 @@ + + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/EvaluationRulesMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/EvaluationRulesMapper.xml new file mode 100644 index 0000000..4ed9217 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/EvaluationRulesMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ExperimentalReportMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ExperimentalReportMapper.xml new file mode 100644 index 0000000..d42aa29 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ExperimentalReportMapper.xml @@ -0,0 +1,2520 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/PermissionMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/PermissionMapper.xml new file mode 100644 index 0000000..c3bc5ed --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/PermissionMapper.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + p + . + id + ,p.pid,p.name,p.type,p.permission_value,path,p.component,p.icon,p.status,p.gmt_create,p.gmt_modified + + + + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/PlayRecordMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/PlayRecordMapper.xml new file mode 100644 index 0000000..6e783d1 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/PlayRecordMapper.xml @@ -0,0 +1,65 @@ + + + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ProjectHiddenMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ProjectHiddenMapper.xml new file mode 100644 index 0000000..4748ebf --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ProjectHiddenMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ProjectJudgmentMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ProjectJudgmentMapper.xml new file mode 100644 index 0000000..f28591d --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ProjectJudgmentMapper.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + update ol_project_judgment set is_del = 0,score = #{judgmentScore},sort = #{judgmentSort} where id = #{judgmentId} + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ProjectManageDisableMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ProjectManageDisableMapper.xml new file mode 100644 index 0000000..81ae963 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ProjectManageDisableMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ProjectManageMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ProjectManageMapper.xml new file mode 100644 index 0000000..04a3c82 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ProjectManageMapper.xml @@ -0,0 +1,569 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + update ol_project_manage + set is_open = #{isOpen} + where project_id = #{projectId} + + + + update ol_project_manage + set zt_open = #{isOpen} + where project_id = #{projectId} + + + + update ol_project_manage + set state = 1 + where project_id = #{projectId} + + + + + + + + + + + + + + + + + + + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ProvinceMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ProvinceMapper.xml new file mode 100644 index 0000000..6de839d --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ProvinceMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/PythonFileDataMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/PythonFileDataMapper.xml new file mode 100644 index 0000000..d303a28 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/PythonFileDataMapper.xml @@ -0,0 +1,11 @@ + + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/PythonRunCodeMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/PythonRunCodeMapper.xml new file mode 100644 index 0000000..3a7010a --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/PythonRunCodeMapper.xml @@ -0,0 +1,20 @@ + + + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/PythonSystemMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/PythonSystemMapper.xml new file mode 100644 index 0000000..676fa35 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/PythonSystemMapper.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/PythonTableDataMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/PythonTableDataMapper.xml new file mode 100644 index 0000000..c1b0e87 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/PythonTableDataMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/QuestionsMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/QuestionsMapper.xml new file mode 100644 index 0000000..279db38 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/QuestionsMapper.xml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/RoleMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/RoleMapper.xml new file mode 100644 index 0000000..dd8e6e3 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/RoleMapper.xml @@ -0,0 +1,10 @@ + + + + + + delete + from ol_acl_role_permission + where role_id = #{roleId} + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/RolePermissionMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/RolePermissionMapper.xml new file mode 100644 index 0000000..6c00dc6 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/RolePermissionMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/SchoolClassificationMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/SchoolClassificationMapper.xml new file mode 100644 index 0000000..c3238a1 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/SchoolClassificationMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/SchoolCourseMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/SchoolCourseMapper.xml new file mode 100644 index 0000000..180525f --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/SchoolCourseMapper.xml @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/SchoolMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/SchoolMapper.xml new file mode 100644 index 0000000..dfa17ee --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/SchoolMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/SchoolProjectHintOpenMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/SchoolProjectHintOpenMapper.xml new file mode 100644 index 0000000..0d44ce3 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/SchoolProjectHintOpenMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/StaffGradeMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/StaffGradeMapper.xml new file mode 100644 index 0000000..a1f6beb --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/StaffGradeMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/StaffMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/StaffMapper.xml new file mode 100644 index 0000000..72fff0d --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/StaffMapper.xml @@ -0,0 +1,104 @@ + + + + + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/StaffProfessionalArchitectureMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/StaffProfessionalArchitectureMapper.xml new file mode 100644 index 0000000..23e0878 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/StaffProfessionalArchitectureMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/StudentMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/StudentMapper.xml new file mode 100644 index 0000000..b575b29 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/StudentMapper.xml @@ -0,0 +1,420 @@ + + + + + + + INSERT INTO nakadai.hr_user_info (user_name, unique_identification, school_id, email, role_id, + create_time, update_time) + VALUES (#{userName}, #{uniqueIdentification}, #{schoolId}, #{email}, #{roleId}, now(), now()) + + + + + + INSERT INTO nakadai.hr_user_account(user_id, account, password, work_number, role_id, school_id, platform_id, + type, create_time, update_time, phone_binding_time, phone) + VALUES (#{userId}, #{account}, #{password}, #{workNumber}, #{roleId}, #{schoolId}, #{platformId}, #{type}, + now(), now(), #{phoneBindingTime}, #{phone}) + + + + + + + + + + + + + + + + + + + + + + + + + + + update nakadai.hr_user_info + set user_name = #{userName}, + email = #{email} + where user_id = #{userId} + + + + + UPDATE nakadai.hr_user_account + + + + work_number = #{workNumber}, + + + account = #{account}, + + + + phone = #{phone}, + + phone_binding_time = #{phoneBindingTime}, + + + + + + + id=#{id} + + + + + + update nakadai.hr_user_account + set is_enable = #{isEnable} + WHERE id = #{id} + + + update nakadai.hr_user_account + set phone = #{u.phone} + WHERE user_id = #{u.userId} + + + + + + + + + + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/SystemLogoMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/SystemLogoMapper.xml new file mode 100644 index 0000000..4825ff8 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/SystemLogoMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/TheoreticalCourseChapterMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/TheoreticalCourseChapterMapper.xml new file mode 100644 index 0000000..62f2b09 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/TheoreticalCourseChapterMapper.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/TheoreticalCourseClassificationMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/TheoreticalCourseClassificationMapper.xml new file mode 100644 index 0000000..ba46661 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/TheoreticalCourseClassificationMapper.xml @@ -0,0 +1,17 @@ + + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/TheoreticalCourseCollectMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/TheoreticalCourseCollectMapper.xml new file mode 100644 index 0000000..09e65f1 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/TheoreticalCourseCollectMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/TheoreticalCourseConfigureMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/TheoreticalCourseConfigureMapper.xml new file mode 100644 index 0000000..e61c561 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/TheoreticalCourseConfigureMapper.xml @@ -0,0 +1,17 @@ + + + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/TheoreticalCourseMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/TheoreticalCourseMapper.xml new file mode 100644 index 0000000..85d7f06 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/TheoreticalCourseMapper.xml @@ -0,0 +1,323 @@ + + + + + + + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/TheoreticalCourseRangeMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/TheoreticalCourseRangeMapper.xml new file mode 100644 index 0000000..ae12d1d --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/TheoreticalCourseRangeMapper.xml @@ -0,0 +1,63 @@ + + + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/TheoreticalCourseSubsectionMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/TheoreticalCourseSubsectionMapper.xml new file mode 100644 index 0000000..e9194ef --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/TheoreticalCourseSubsectionMapper.xml @@ -0,0 +1,10 @@ + + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/UserInfoMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/UserInfoMapper.xml new file mode 100644 index 0000000..5e23b86 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/UserInfoMapper.xml @@ -0,0 +1,27 @@ + + + + + + + + + + update ol_hr_user_info + SET logInNumber=logInNumber + 1, + lastLoginTime=NOW() + where userId = #{userId} + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/UserManagementMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/UserManagementMapper.xml new file mode 100644 index 0000000..68266eb --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/UserManagementMapper.xml @@ -0,0 +1,47 @@ + + + + + + INSERT INTO ol_hr_user_info (userName, roleId, email, clientId, clientName, uniqueIdentificationAccount, + account, password, creationTime, isPort) + VALUES (#{userName}, #{roleId}, #{email}, #{clientId}, #{clientName}, #{uniqueIdentificationAccount}, + #{account}, #{password}, NOW(), #{isPort}) + + + + + + + + update ol_hr_user_info + SET isdel = 1 + where userId = #{userId} + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/UserRoleMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/UserRoleMapper.xml new file mode 100644 index 0000000..c1767d7 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/UserRoleMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/UserScoreMapper.xml b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/UserScoreMapper.xml new file mode 100644 index 0000000..2301234 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/UserScoreMapper.xml @@ -0,0 +1,21 @@ + + + + + + + + + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/ApplicantService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/ApplicantService.java new file mode 100644 index 0000000..a03d362 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/ApplicantService.java @@ -0,0 +1,44 @@ +package com.huoran.occupationlab.service; + + + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.Applicant; +import com.huoran.common.entity.School; +import com.huoran.occupationlab.entity.req.PageRegistrationStaffReq; +import com.huoran.occupationlab.entity.vo.ApplicantVO; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; + +/** + *

+ * 报名人员表 服务类 + *

+ * + * @author chen + * @since 2020-10-15 + */ +public interface ApplicantService extends IService { + + R applicantPageConditionQuery(PageRegistrationStaffReq req); + + boolean disableContests(List ids); + + void export(HttpServletResponse response, PageRegistrationStaffReq contestId) throws IOException; + + void batchExport(HttpServletResponse response, List ids) throws IOException; + + List queryContestId(String account_id); + + boolean selectOne(String accountId, String contestId); + + School getSchool(Integer schoolId); + + + void exportDataInBatches(List list, HttpServletResponse response) throws Exception; + + R cancelRegistration(String contestId, Integer accountId); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/ArchitectureService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/ArchitectureService.java new file mode 100644 index 0000000..43a4183 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/ArchitectureService.java @@ -0,0 +1,31 @@ +package com.huoran.occupationlab.service; + +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.Architecture; +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.occupationlab.entity.Class; +import com.huoran.occupationlab.entity.resp.StudentInfoResp; +import com.huoran.occupationlab.entity.vo.ArchitectureVO; +import io.swagger.annotations.ApiParam; +import org.springframework.web.bind.annotation.RequestParam; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + *

+ * 学生组织架构 服务类 + *

+ * + * @author lr + * @since 2021-08-24 + */ +public interface ArchitectureService extends IService { + //级联分类列表列表展示 + List treeList(Integer schoolId); + + R stuOrganizationTree(Integer schoolId, Integer accountId, Integer level, Integer parentId); + + List chenckReapt(Architecture classes); + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/ArticleService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/ArticleService.java new file mode 100644 index 0000000..f19e794 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/ArticleService.java @@ -0,0 +1,25 @@ +package com.huoran.occupationlab.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.occupationlab.entity.Article; +import com.huoran.occupationlab.entity.vo.ArticleSort; + +/** + *

+ * 文章表 服务类 + *

+ * + * @author chen + * @since 2020-10-15 + */ +public interface ArticleService extends IService
{ + + void articlePageQuery(Page
page, String columnId, String port,Integer schoolId); + + Article getArticle(String articleId); + + boolean sort(ArticleSort articleSort); + + boolean repeat(Article article); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/AssessmentExamService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/AssessmentExamService.java new file mode 100644 index 0000000..ebf15e9 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/AssessmentExamService.java @@ -0,0 +1,16 @@ +package com.huoran.occupationlab.service; + +import com.huoran.occupationlab.entity.AssessmentExam; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 学生考试表(考核) 服务类 + *

+ * + * @author lr + * @since 2021-08-19 + */ +public interface AssessmentExamService extends IService { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/AssessmentService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/AssessmentService.java new file mode 100644 index 0000000..6a36a0b --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/AssessmentService.java @@ -0,0 +1,59 @@ +package com.huoran.occupationlab.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.Assessment; +import com.huoran.occupationlab.entity.req.AssessmentReq; +import com.huoran.occupationlab.entity.req.PageAssessmentReq; +import com.huoran.occupationlab.entity.req.PageStuAssessmentReq; +import com.huoran.occupationlab.entity.resp.StuAssessmentListResp; +import org.apache.ibatis.annotations.Param; +import org.springframework.web.bind.annotation.RequestBody; + +import javax.servlet.http.HttpServletRequest; +import java.text.ParseException; +import java.util.List; +import java.util.Set; + +/** + *

+ * 考核管理 服务类 + *

+ * + * @author lr + * @since 2021-08-18 + */ +public interface AssessmentService extends IService { + + List pageByCondition(PageAssessmentReq req); + + Integer pageByConditionNum(PageAssessmentReq req); + + List pageStuAssessment(PageStuAssessmentReq req); + + Integer pageStuAssessmentNum(PageStuAssessmentReq req); + + R saveAssessment(AssessmentReq req) throws ParseException; + + R deleteAssessment(@RequestBody List ids); + + R modifyAssessment(@RequestBody Assessment ass) throws ParseException; + + R getDetailById(Integer id); + + R collectPaper(Integer id); + + R enterExam(Integer assessmentId, Integer classId, Integer invitationCode, HttpServletRequest request); + + R getMineClass(Integer accountId); + + Set myClassByStudent(@Param("accountId") Integer accountId, @Param("schoolId") Integer schoolId); + + R enableAssessment(Integer id) throws ParseException; + + boolean checkReapt(Assessment assessment); + + boolean submitExam(Integer assessmentId, Integer classId, Integer accountId, Integer score); + + R spliceClass(Integer assessmentId); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/CityService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/CityService.java new file mode 100644 index 0000000..723e720 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/CityService.java @@ -0,0 +1,19 @@ +package com.huoran.occupationlab.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.occupationlab.entity.City; + +import java.util.List; + +/** + *

+ * 城市 服务类 + *

+ * + * @author Ning + * @since 2020-10-27 + */ +public interface CityService extends IService { + + List queryCity(Integer provinceId); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/ClassService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/ClassService.java new file mode 100644 index 0000000..b252bb1 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/ClassService.java @@ -0,0 +1,21 @@ +package com.huoran.occupationlab.service; + +import com.huoran.occupationlab.entity.Class; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + *

+ * 班级表 服务类 + *

+ * + * @author lr + * @since 2021-08-18 + */ +public interface ClassService extends IService { + + List chenckReapt(Class classes); + + List getClassesUnderTheSchool(Integer schoolId); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/ClientManagementService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/ClientManagementService.java new file mode 100644 index 0000000..2de59c0 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/ClientManagementService.java @@ -0,0 +1,41 @@ +package com.huoran.occupationlab.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.common.entity.NewClientManagement; +import com.huoran.occupationlab.entity.ClientManagement; + +import java.util.HashMap; +import java.util.List; + +/** + *

+ * 企业端客户管理 服务类 + *

+ * + * @author Ning + * @since 2020-10-27 + */ +public interface ClientManagementService extends IService { + //添加客户 + boolean addClient(ClientManagement clientManagement); + + //查询客户列表 + List queryList(HashMap map); + + //查询客户列表数量 + int queryListCount(HashMap map); + + //批量删除客户 + boolean deleteClient(List clientIds); + + //修改客户 + boolean updateClient(ClientManagement clientManagement); + + //查询客户列表数量 + int queryClientNameSize(String clientName); + + //查询客户列表数量 + NewClientManagement queryOneClient(String clientName); + + List getClientName(String clientName); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/ColumnService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/ColumnService.java new file mode 100644 index 0000000..24bb62a --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/ColumnService.java @@ -0,0 +1,33 @@ +package com.huoran.occupationlab.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.occupationlab.entity.Column; +import com.huoran.occupationlab.entity.vo.ColumnSort; + +import java.util.List; + +/** + *

+ * 栏目表 服务类 + *

+ * + * @author chen + * @since 2020-10-15 + */ +public interface ColumnService extends IService { + + boolean saveColumn(Column column); + + boolean removeColumn(Integer columnId); + + List columnTree(Integer schoolId,String platformId); + + boolean updateSort(ColumnSort columnSort); + + boolean repeat(Column column); + + List firstLevelColumn(Integer schoolId); + + List secondaryColumnsByFirst(String id,Integer schoolId); + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/ContestAnnexService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/ContestAnnexService.java new file mode 100644 index 0000000..3ae0b5e --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/ContestAnnexService.java @@ -0,0 +1,19 @@ +package com.huoran.occupationlab.service; + +import com.huoran.occupationlab.entity.ContestAnnex; +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.occupationlab.entity.ContestRange; + +import java.util.List; + +/** + *

+ * 赛事附件 服务类 + *

+ * + * @author lr + * @since 2022-06-16 + */ +public interface ContestAnnexService extends IService { + List getContestAnnexByContestId(String ContestId); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/ContestAnnouncementAnnexService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/ContestAnnouncementAnnexService.java new file mode 100644 index 0000000..6e887c2 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/ContestAnnouncementAnnexService.java @@ -0,0 +1,16 @@ +package com.huoran.occupationlab.service; + +import com.huoran.occupationlab.entity.ContestAnnouncementAnnex; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 大赛公告附件存储 服务类 + *

+ * + * @author lr + * @since 2022-06-17 + */ +public interface ContestAnnouncementAnnexService extends IService { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/ContestAnnouncementService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/ContestAnnouncementService.java new file mode 100644 index 0000000..c1c3a87 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/ContestAnnouncementService.java @@ -0,0 +1,19 @@ +package com.huoran.occupationlab.service; + +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.ContestAnnouncement; +import com.baomidou.mybatisplus.extension.service.IService; +import io.swagger.annotations.ApiParam; +import org.springframework.web.bind.annotation.RequestParam; + +/** + *

+ * 赛事公告 服务类 + *

+ * + * @author lr + * @since 2022-06-17 + */ +public interface ContestAnnouncementService extends IService { + R queryAnnouncementByContestId(String contestId,Integer pageNum,Integer pageSize); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/ContestProgressService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/ContestProgressService.java new file mode 100644 index 0000000..f97827f --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/ContestProgressService.java @@ -0,0 +1,17 @@ +package com.huoran.occupationlab.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.occupationlab.entity.ContestProgress; + +/** + *

+ * 竞赛进展表 服务类 + *

+ * + * @author chen + * @since 2020-10-15 + */ +public interface ContestProgressService extends IService { + + boolean repeat(ContestProgress contestProgress); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/ContestRangeService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/ContestRangeService.java new file mode 100644 index 0000000..1fadcf4 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/ContestRangeService.java @@ -0,0 +1,27 @@ +package com.huoran.occupationlab.service; + +import com.huoran.occupationlab.entity.ContestRange; +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.common.entity.School; +import com.huoran.occupationlab.entity.resp.ContestRangeResp; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author lr + * @since 2022-06-16 + */ +public interface ContestRangeService extends IService { + List getContestRangeByContestId(String ContestId); + + List getRangeByContestId(@Param("contestId")String contestId); + +// List getRangeDetailByContestId(String contestId,Integer type); + + boolean checkWhetherToParticipate(School school, String contestId) ; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/ContestService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/ContestService.java new file mode 100644 index 0000000..7c9fe2d --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/ContestService.java @@ -0,0 +1,52 @@ +package com.huoran.occupationlab.service; + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.Contest; +import com.huoran.occupationlab.entity.req.AfterLoginPageContestListReq; +import com.huoran.occupationlab.entity.req.PageContestListReq; +import com.huoran.occupationlab.entity.vo.ContestVO; + +import java.util.HashMap; +import java.util.List; + +/** + *

+ * 竞赛管理表 服务类 + *

+ * + * @author chen + * @since 2020-10-15 + */ +public interface ContestService extends IService { + + boolean removeContest(String contestId); + + /*List contestPageConditionQuery(HashMap map); + + int contestPageConditionCount(HashMap map);*/ + + void pageQuery(Page page, String name, String way, Integer schoolId); + + boolean repeat(Contest contest); + + R contestPageConditionQueryByNakadai(PageContestListReq pageContestListReq); + + R contestPageConditionQueryByOccupationlab(PageContestListReq pageContestListReq); + +// R onlineCompetitionByStudent(PageContestListReq pageContestListReq); + +// String getSchoolNameById(Integer schoolId); + +// R contestPageConditionQueryByOccupationlabStu(PageContestListReq pageContestListReq); + +// R listOfRegisteredEvents(PageContestListReq pageContestListReq); + + //学生——未登录前 + R notLoggedInBeforeStudentEvents(PageContestListReq pageContestListReq); + + //学生——登录后 + R contestAfterLogin(AfterLoginPageContestListReq pageContestListReq); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/CourseChapterService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/CourseChapterService.java new file mode 100644 index 0000000..912e5d7 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/CourseChapterService.java @@ -0,0 +1,26 @@ +package com.huoran.occupationlab.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.occupationlab.entity.CourseChapter; +import com.huoran.occupationlab.entity.vo.ChapterVO; +import com.huoran.occupationlab.entity.vo.SortVO; + +import java.util.List; + +/** + * 课程章节 服务类 + * @author chen + * @since 2020-09-30 + */ +public interface CourseChapterService extends IService { + + List getChapterTree(String courseId); + + boolean removeChapter(String chapterId); + + boolean saveChapter(CourseChapter courseChapter); + + boolean updateSort(SortVO sortVO); + + boolean repeat(CourseChapter courseChapter); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/CourseClassificationService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/CourseClassificationService.java new file mode 100644 index 0000000..a654746 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/CourseClassificationService.java @@ -0,0 +1,19 @@ +package com.huoran.occupationlab.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.occupationlab.entity.EduCourseClassification; + +import java.util.List; + +/** + * 课程类别 服务类 + * + * @author chen + * @since 2020-09-30 + */ +public interface CourseClassificationService extends IService { + + List queryGlClassification(String schoolId); + + List checkReapt(EduCourseClassification classification); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/CourseService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/CourseService.java new file mode 100644 index 0000000..8a4e82e --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/CourseService.java @@ -0,0 +1,31 @@ +package com.huoran.occupationlab.service; + + +import com.aliyuncs.exceptions.ClientException; +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.occupationlab.entity.EduCourse; +import com.huoran.occupationlab.entity.vo.CourseVO; + +import java.util.HashMap; +import java.util.List; + +/** + * 课程基本信息 服务类 + * + * @author chen + * @since 2020-09-30 + */ +public interface CourseService extends IService { + + List coursePageConditionQuery(HashMap map); + + int coursePageConditionCount(HashMap map); + + boolean deleteCourses(List courseIds); + + boolean removeCourse(String courseId); + + boolean repeat(EduCourse course); + + void addChapter(EduCourse course); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/CourseSubsectionService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/CourseSubsectionService.java new file mode 100644 index 0000000..d21f306 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/CourseSubsectionService.java @@ -0,0 +1,19 @@ +package com.huoran.occupationlab.service; + +import com.aliyuncs.exceptions.ClientException; +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.occupationlab.entity.CourseSubsection; + +/** + * 课程小节 服务类 + * @author chen + * @since 2020-09-30 + */ +public interface CourseSubsectionService extends IService { + + boolean removeSubsection(String subsectionId) throws ClientException; + + boolean saveSubsection(CourseSubsection courseSubsection); + + boolean repeat(CourseSubsection courseSubsection); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/EntrepreneurialActivityAnnouncementAnnexService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/EntrepreneurialActivityAnnouncementAnnexService.java new file mode 100644 index 0000000..e797945 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/EntrepreneurialActivityAnnouncementAnnexService.java @@ -0,0 +1,16 @@ +package com.huoran.occupationlab.service; + +import com.huoran.occupationlab.entity.EntrepreneurialActivityAnnouncementAnnex; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 活动公告附件表 服务类 + *

+ * + * @author lr + * @since 2023-05-12 + */ +public interface EntrepreneurialActivityAnnouncementAnnexService extends IService { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/EntrepreneurialActivityAnnouncementService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/EntrepreneurialActivityAnnouncementService.java new file mode 100644 index 0000000..71e1f2e --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/EntrepreneurialActivityAnnouncementService.java @@ -0,0 +1,17 @@ +package com.huoran.occupationlab.service; + +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.EntrepreneurialActivityAnnouncement; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 活动公告表 服务类 + *

+ * + * @author lr + * @since 2023-05-12 + */ +public interface EntrepreneurialActivityAnnouncementService extends IService { + R queryAnnouncementByActivityId(String competitionId, Integer pageNum, Integer pageSize); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/EntrepreneurialActivityApplicantService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/EntrepreneurialActivityApplicantService.java new file mode 100644 index 0000000..84062de --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/EntrepreneurialActivityApplicantService.java @@ -0,0 +1,28 @@ +package com.huoran.occupationlab.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.EntrepreneurialActivityApplicant; +import com.huoran.occupationlab.entity.req.ActivityApplicantReq; +import com.huoran.occupationlab.entity.vo.RegistrationVO; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; + +/** + *

+ * 创业活动报名人员表 服务类 + *

+ * + * @author lr + * @since 2023-04-27 + */ +public interface EntrepreneurialActivityApplicantService extends IService { + R ApplicantsList(ActivityApplicantReq req); + + + void export(HttpServletResponse response, ActivityApplicantReq req) throws IOException; + + void exportDataInBatches(List listOfExportSub, HttpServletResponse response) throws IOException; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/EntrepreneurialActivityCollectService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/EntrepreneurialActivityCollectService.java new file mode 100644 index 0000000..cd94c04 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/EntrepreneurialActivityCollectService.java @@ -0,0 +1,16 @@ +package com.huoran.occupationlab.service; + +import com.huoran.occupationlab.entity.EntrepreneurialActivityCollect; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 理论课程收藏表 服务类 + *

+ * + * @author lr + * @since 2023-06-01 + */ +public interface EntrepreneurialActivityCollectService extends IService { + Integer countTheNumberOfCollectors(Integer activityId); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/EntrepreneurialActivityFileService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/EntrepreneurialActivityFileService.java new file mode 100644 index 0000000..78e1c78 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/EntrepreneurialActivityFileService.java @@ -0,0 +1,16 @@ +package com.huoran.occupationlab.service; + +import com.huoran.occupationlab.entity.EntrepreneurialActivityFile; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 创业活动附件存储 服务类 + *

+ * + * @author lr + * @since 2023-04-26 + */ +public interface EntrepreneurialActivityFileService extends IService { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/EntrepreneurialActivityProgressService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/EntrepreneurialActivityProgressService.java new file mode 100644 index 0000000..dd5e1ee --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/EntrepreneurialActivityProgressService.java @@ -0,0 +1,17 @@ +package com.huoran.occupationlab.service; + +import com.huoran.occupationlab.entity.EntrepreneurialActivityProgress; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 活动进展表 服务类 + *

+ * + * @author lr + * @since 2023-05-12 + */ +public interface EntrepreneurialActivityProgressService extends IService { + boolean repeat(EntrepreneurialActivityProgress activityProgress); + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/EntrepreneurialActivityService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/EntrepreneurialActivityService.java new file mode 100644 index 0000000..412fe66 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/EntrepreneurialActivityService.java @@ -0,0 +1,25 @@ +package com.huoran.occupationlab.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.EntrepreneurialActivity; +import com.huoran.occupationlab.entity.req.EntrepreneurshipActivityListrReq; + +/** + *

+ * 创业活动管理表 服务类 + *

+ * + * @author lr + * @since 2023-04-26 + */ +public interface EntrepreneurialActivityService extends IService { + R activityList(EntrepreneurshipActivityListrReq req); + + + R schoolActivities(EntrepreneurshipActivityListrReq req); + + R myActivities(EntrepreneurshipActivityListrReq req); + + R concernedActivity(EntrepreneurshipActivityListrReq req); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/EvaluationFractionService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/EvaluationFractionService.java new file mode 100644 index 0000000..5fce012 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/EvaluationFractionService.java @@ -0,0 +1,23 @@ +package com.huoran.occupationlab.service; + +import com.huoran.occupationlab.entity.EvaluationFraction; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 记录用户能力测评的总分数 服务类 + *

+ * + * @author lr + * @since 2021-09-26 + */ +public interface EvaluationFractionService extends IService { + + void insertRecord(EvaluationFraction fraction); + + Integer queryExerciseRecord(Integer accountId); + + Integer queryTeachingRecord(Integer accountId); + + Integer queryScore(Integer accountId, Integer type); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/EvaluationQuestionService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/EvaluationQuestionService.java new file mode 100644 index 0000000..e930f66 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/EvaluationQuestionService.java @@ -0,0 +1,16 @@ +package com.huoran.occupationlab.service; + +import com.huoran.occupationlab.entity.EvaluationQuestion; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 测评试题表,记录每次测评的试题,与测评记录表相关联 服务类 + *

+ * + * @author lr + * @since 2021-09-26 + */ +public interface EvaluationQuestionService extends IService { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/EvaluationRecordService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/EvaluationRecordService.java new file mode 100644 index 0000000..b380d4d --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/EvaluationRecordService.java @@ -0,0 +1,39 @@ +package com.huoran.occupationlab.service; + +import com.huoran.occupationlab.entity.EvaluationRecord; +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.occupationlab.entity.vo.EvaluationRecordDetailVO; +import com.huoran.occupationlab.entity.vo.EvaluationRecordSubmitVO; +import com.huoran.occupationlab.entity.vo.TMSEvaluationRecordVO; + +import java.util.concurrent.ExecutionException; + +/** + *

+ * 记录用户测评信息 服务类 + *

+ * + * @author lr + * @since 2021-09-26 + */ +public interface EvaluationRecordService extends IService { + TMSEvaluationRecordVO startEvaluation(Integer accountId,Integer schoolId); + + TMSEvaluationRecordVO convertQuestion(Integer evaluationRecordId, + Integer currentQuestionSortNo, + String userAnswer, + Integer changeSortNo) throws ExecutionException, InterruptedException; + + EvaluationRecordSubmitVO submitEvaluation(Integer evaluationRecordId, + Integer currentQuestionSortNo, + String userAnswer, + Integer accountId) throws ExecutionException, InterruptedException; + + EvaluationRecordDetailVO evaluationDetail(Integer evaluationRecordId) throws ExecutionException, InterruptedException; + + String selectNotMade(Integer evaluationRecordId); + + void cleanRemainingTime(Integer accountId); + + boolean isOpenExperiment(Integer accountId); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/EvaluationRulesService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/EvaluationRulesService.java new file mode 100644 index 0000000..39f1f04 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/EvaluationRulesService.java @@ -0,0 +1,22 @@ +package com.huoran.occupationlab.service; + +import com.huoran.occupationlab.entity.EvaluationRules; +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.occupationlab.entity.vo.EvaluationRulesVO; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 测评规则信息记录,只记录一条信息 服务类 + *

+ * + * @author lr + * @since 2021-08-12 + */ +public interface EvaluationRulesService extends IService { + EvaluationRulesVO getEvaluationRules(Integer schoolId); + + boolean updateEvaluationRulesById(EvaluationRules evaluationRules); + + boolean copyEvaluationRules(@Param("schoolId") Integer schoolId); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/ExperimentalReportService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/ExperimentalReportService.java new file mode 100644 index 0000000..fc70ab5 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/ExperimentalReportService.java @@ -0,0 +1,179 @@ +package com.huoran.occupationlab.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.common.entity.ExperimentalReport; +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.req.*; +import com.huoran.occupationlab.entity.resp.*; +import com.huoran.occupationlab.entity.vo.ActivityDerivationVO; +import com.huoran.occupationlab.entity.vo.ProductClassInformationVO; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; + +/** + *

+ * 存储各子系统的实验报告 服务类 + *

+ * + * @author lr + * @since 2021-09-08 + */ +public interface ExperimentalReportService extends IService { + + /** + * @Description: 学生端-实验记录-实验概览 + * @auther: Rong + * @date: 2021/9/8 17:43 + */ + R getExperimentOverview(Integer accountId); + + /** + * @Description: 学生端-实验记录-考核列表 + * @auther: Rong + * @date: 2021/9/8 17:45 + */ + R queryAssessmentByStudent(PageAchievementByStuReq accountId); + + /** + * @Description: 学生端-实验记录-练习列表 + * @auther: Rong + * @date: 2021/9/8 17:45 + */ + R queryPracticeByStudent(PageAchievementByStuReq accountId); + + /** + * 管理端——练习成绩管理列表 + * + * @param req + * @return + */ + R getAchievementInfo(PageAchievementByTeacherReq req); + + /** + * 成绩详情 + * + * @param projectId + * @param pageNum + * @param pageSize + * @return + */ + R getPracticeDetail(Integer projectId, Integer pageNum, Integer pageSize, Integer schoolId,Integer classId,String keyWord,Integer mallId); + + /** + * @Description: 管理端考核成绩详情 + * @auther: Rong + * @date: 2021/9/8 15:22 + */ + R getAssessmentDetail(Integer assessmentId, Integer classId, Integer pageNum, Integer pageSize,String keyword); + + /** + * @Description: 批量导出练习成绩 + * @auther: Rong + * @date: 2021/9/8 16:39 + */ + void exportPracticeInfo(String ids, HttpServletResponse response, Integer schoolId, Integer projectId,Integer mallId) throws Exception; + + /** + * @Description: 批量导出考核成绩 + * @auther: Rong + * @date: 2021/9/8 16:39 + */ + void exportAssessmentInfo(String ids, HttpServletResponse response, Integer schoolId, Integer assessmentId, Integer classId) throws Exception; + + R deleteReportById(List projectId, Integer projectPermissions, List id); + + /** + * @Description: 学生端-实验记录-导出考核记录 + * @auther: Rong + * @date: 2021/9/8 17:45 + */ + void exportAssessmentByStudent(Integer accountId, Integer curriculumId, String ids, HttpServletResponse response) throws Exception; + + /** + * @Description: 学生端-实验记录-导出练习记录 + * @auther: Rong + * @date: 2021/9/8 17:45 + */ + void exportPracticeByStudent(Integer curriculumId, Integer accountId, HttpServletResponse response) throws Exception; + + /** + * @Description: 学生端-练习-实验情况 + * @auther: Rong + * @date: 2021/9/30 15:35 + */ + R practiceByStudentDetail(Integer curriculumId, Integer projectId, Integer accountId, Integer pageNum, Integer pageSize); + + /** + * @Description: 学生端-练习-导出实验情况 + * @auther: Rong + * @date: 2021/9/30 15:53 + */ + void exportPracticeByStudentDetail(String ids, Integer projectId, Integer accountId, HttpServletResponse response) throws Exception; + + + + /** + * 学生端-练习、考核-实验报告详情 + * + * @param reportId + * @return + */ + R reportDetail(Integer reportId); + + + + R practiceActivity(Integer projectId, Integer pageNum, Integer pageSize, Integer schoolId,Integer classId,String keyWord,Integer mallId); + + + + void exportDataInBatches(List list, HttpServletResponse response) throws Exception; + + + void exportAllData(Integer projectId,Integer schoolId, HttpServletResponse response,Integer mallId) throws Exception; + + R maximumPracticeScoreList(Integer projectId, Integer pageNum, Integer pageSize, Integer schoolId,Integer mallId); + + + //-------------------------------以下为数据看板功能 START------------------------------- + R getTheMostUsedCoursesInOurSchool(Integer schoolId); + + R academicLeadersRanking(Integer schoolId,PageReq req);//学霸排行榜 + + R examStatistics(Integer schoolId, Integer choose);//平台考试数据统计 + + R studentGradeDistribution(Integer schoolId, List req);//学生成绩分布分析 + + R studentAssessSchievement(Integer schoolId, List req);//学生实验课程考核成绩趋势 + + R overviewOfOurSchoolData(Integer schoolId);//本校数据概览 + + R monthlyAverageOnlineTime(Integer schoolId, List req);//月人均在线时长情况 + + R courseRankings(Integer schoolId); + + R activityRanking(Integer schoolId); + + //-------------------------------以上为数据看板功能 END--------------------------------- + + List getProduct(Integer schoolId); + + + R productReadScore(PerformanceUnderProductReq req); + + R productReadGradeDetails(PerformanceUnderProductReq req); + + void exportDetailsOfStudentPracticeScores(PerformanceUnderProductReq req, HttpServletResponse response, HttpServletRequest request) throws IOException; + + void exportDetailsOfStudentAssessmentResults(PerformanceUnderProductReq req, HttpServletResponse response, HttpServletRequest request) throws IOException; + + + void exportProductPracticeResults(List list, HttpServletResponse response) throws IOException; + void exportProductAssessResults(List list, HttpServletResponse response) throws IOException; + + //实验报告数据处理:将原来未绑定产品的实验报告补上 + List experimentalReportDataProcessing(); + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/LogService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/LogService.java new file mode 100644 index 0000000..5a525c2 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/LogService.java @@ -0,0 +1,14 @@ +package com.huoran.occupationlab.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.occupationlab.entity.SysLog; + +/** + * 系统日志 + * + * @author cheney + * @version V1.0 + * @date 2022年7月28日 + */ +public interface LogService extends IService { +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/OSSFileService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/OSSFileService.java new file mode 100644 index 0000000..ba5a99b --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/OSSFileService.java @@ -0,0 +1,32 @@ +package com.huoran.occupationlab.service; + +import com.aliyuncs.exceptions.ClientException; +import com.huoran.common.entity.FilesResult; +import org.springframework.web.multipart.MultipartFile; + +import java.io.IOException; +import java.util.List; + +/** + * @Author chen + * @DATE 2020/9/1 22:01 + * @Version 1.0 + */ +public interface OSSFileService { + + + FilesResult upload(MultipartFile file,String tableName) throws IOException; + + FilesResult fileupload(MultipartFile file, String tableName) throws IOException; + + FilesResult vodUpload(MultipartFile file) throws IOException; + + List fileDeletion(List keys); + + String getPlayAuth(String videoId) throws ClientException; + + void removeVideo(String videoId) throws ClientException; + + void removeMoreVideo(List videoIdList) throws ClientException; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/PermissionService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/PermissionService.java new file mode 100644 index 0000000..677ddf5 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/PermissionService.java @@ -0,0 +1,37 @@ +package com.huoran.occupationlab.service; + +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.occupationlab.entity.AclPermission; +import com.huoran.occupationlab.entity.vo.PermissionVO; + +import java.util.List; + +/** + * 权限 服务类 + */ +public interface PermissionService extends IService { + + //获取全部菜单 + List queryAllMenu(); + + //获取企业端菜单 + List queryManagementAllMenu(); + + //根据角色获取菜单 + List selectAllMenu(String roleId, Integer isPort); + + //给角色分配权限 + void saveRolePermissionRelationShip(PermissionVO permissionVO); + + //递归删除菜单 + void removeChildById(String id); + + //根据用户id获取用户菜单 + List selectPermissionValueByUserId(String id); + + + List selectPermissionByUserId(String id); + + List selectRoleMenu(String roleId); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/PlayRecordService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/PlayRecordService.java new file mode 100644 index 0000000..a3e8935 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/PlayRecordService.java @@ -0,0 +1,16 @@ +package com.huoran.occupationlab.service; + +import com.huoran.occupationlab.entity.PlayRecord; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 资源播放记录表 服务类 + *

+ * + * @author lr + * @since 2022-09-09 + */ +public interface PlayRecordService extends IService { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/ProjectHiddenService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/ProjectHiddenService.java new file mode 100644 index 0000000..4ce29ed --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/ProjectHiddenService.java @@ -0,0 +1,16 @@ +package com.huoran.occupationlab.service; + +import com.huoran.occupationlab.entity.ProjectHidden; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 此表是在教师端成绩管理,虚仿以及教学列表展示中使用到 服务类 + *

+ * + * @author lr + * @since 2021-09-23 + */ +public interface ProjectHiddenService extends IService { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/ProjectJudgmentService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/ProjectJudgmentService.java new file mode 100644 index 0000000..cff301d --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/ProjectJudgmentService.java @@ -0,0 +1,33 @@ +package com.huoran.occupationlab.service; + +import com.huoran.occupationlab.entity.ProjectJudgment; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + *

+ * 项目管理判分点绑定表 服务类 + *

+ * + * @author Mr.JK + * @since 2021-08-26 + */ +public interface ProjectJudgmentService extends IService { + + /** + * 获取判分点分数 + * @param projectId + * @param judgmentId + * @return + */ + Integer getJudgmentScore(Integer projectId, Integer judgmentId); + + /** + * 更新中间表 + * @param projectId + * @param projectJudgments + * @return + */ + Integer updateProjectJudgment(Integer projectId,List projectJudgments); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/ProjectManageDisableService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/ProjectManageDisableService.java new file mode 100644 index 0000000..93d9825 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/ProjectManageDisableService.java @@ -0,0 +1,16 @@ +package com.huoran.occupationlab.service; + +import com.huoran.occupationlab.entity.ProjectManageDisable; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 记录项目学校端的禁用记录 服务类 + *

+ * + * @author lr + * @since 2022-01-12 + */ +public interface ProjectManageDisableService extends IService { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/ProjectManageService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/ProjectManageService.java new file mode 100644 index 0000000..9fb172e --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/ProjectManageService.java @@ -0,0 +1,153 @@ +package com.huoran.occupationlab.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.common.entity.ProjectManage; +import com.huoran.common.entity.to.JudgmentPointDataTo; +import com.huoran.common.entity.to.ProjectDataTo; +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.req.PageAssessmentForProjectReq; +import com.huoran.occupationlab.entity.req.ProjectManageReq; +import com.huoran.occupationlab.entity.vo.ProjectVo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ *

+ * 项目管理表 服务类 + *

+ * + * @author Mr.JK + * @since 2021-08-26 + */ +public interface ProjectManageService extends IService { + + /** + * 新增项目管理 + * + * @param projectVo + * @return + */ + R addProjectManage(ProjectVo projectVo); + + /** + * 更新项目管理 + * + * @param projectVo + * @return + */ + R updateProjectManage(ProjectVo projectVo); + + /** + * 批量删除项目管理 + * + * @param projectIds + * @param platformId + * @return + */ + R deleteProjectManage(List projectIds, Integer platformId); + + /** + * 获取项目管理详情 + * + * @param projectId + * @return + */ + R getProjectDetail(Integer projectId, Integer stuAssessent,Integer schoolId); + + /** + * 查询名称是否重复 + * + * @param projectManage + * @return + */ + Integer queryNameIsExist(ProjectManage projectManage); + + /** + * 平均分分配值 + * + * @param number + * @return + */ + R avgValues(Integer number); + + /** + * 根据系统id获取项目 + * + * @param systemId + * @param accountId + * @return + */ + R getProjectBySystemId(String systemId, String accountId, Integer permissions, Integer cId,Integer mallId); + + + List getProjectBySystemIdRemoteCall(String systemId, String accountId, Integer permissions, Integer cId,Integer mallId); + + /** + * 复制项目管理 + * + * @param projectVo + * @return + */ + R copyProjectManage(ProjectVo projectVo); + + /** + * 根据系统id获取系统内置项目 + * + * @param systemId + * @return + */ + List getInternalProjectBySystemId(List systemId, Integer permissions); + + /** + * 获取学校下所有系统id + * + * @param schoolId + * @return + */ + R getSystemIdBySchool(Integer schoolId); + + /** + * 更新是否开启 + * + * @param projectId + * @param isOpen + * @param platformId + */ + void updateIsOpen(Integer projectId, Integer isOpen, Integer platformId, Integer schoolId); + + /** + * 中台项目管理列表 分页,筛选 + * + * @param projectManageReq + * @return + */ + R queryProjectManageByNakadai(ProjectManageReq projectManageReq); + + /** + * 职站项目管理列表 分页,筛选 + * + * @param projectManageReq + * @return + */ + R queryProjectManageByOccupationlab(ProjectManageReq projectManageReq); + + /** + * @Description : 创建考核——>根据课程筛选项目列表 + * @Param req + * @Author Rong---2022/1/13 + */ + R getSchoolProjectByAssessent(PageAssessmentForProjectReq req); + + JudgmentPointDataTo getProjectPoints(ProjectDataTo projectDataTo); + + R getProjectAssessmentByCompetition(PageAssessmentForProjectReq projectManageReq); + + //根据类型获取课程下项目总数 + Integer getCurriculumCountByType(Integer cid, Integer permissions); + + //获取当前学校在当前产品下创建的某类型的项目 + Integer projectCreatedUnderProduct( Integer mallId, Integer permissions, Integer schoolId); + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/ProvinceService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/ProvinceService.java new file mode 100644 index 0000000..e44f5fe --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/ProvinceService.java @@ -0,0 +1,19 @@ +package com.huoran.occupationlab.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.occupationlab.entity.Province; + +import java.util.List; + +/** + *

+ * 省份表 服务类 + *

+ * + * @author Ning + * @since 2020-10-27 + */ +public interface ProvinceService extends IService { + + List queryProvince(); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/PythonFileDataService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/PythonFileDataService.java new file mode 100644 index 0000000..733f2f7 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/PythonFileDataService.java @@ -0,0 +1,22 @@ +package com.huoran.occupationlab.service; + +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.PythonFileData; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author lr + * @since 2022-04-06 + */ +public interface PythonFileDataService extends IService { + R myData(PythonFileData fileData); + + //新增前统计 + Double statistics(Integer accountId,Integer schoolId); + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/PythonRunCodeService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/PythonRunCodeService.java new file mode 100644 index 0000000..3d7764b --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/PythonRunCodeService.java @@ -0,0 +1,16 @@ +package com.huoran.occupationlab.service; + +import com.huoran.occupationlab.entity.PythonRunCode; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * python储存实验运行记录 服务类 + *

+ * + * @author lr + * @since 2021-12-22 + */ +public interface PythonRunCodeService extends IService { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/PythonSystemService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/PythonSystemService.java new file mode 100644 index 0000000..434d295 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/PythonSystemService.java @@ -0,0 +1,22 @@ +package com.huoran.occupationlab.service; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.huoran.occupationlab.entity.PythonSystem; +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.occupationlab.entity.vo.AssessmentVO; + +import java.util.List; + +/** + *

+ * python系统记录表 服务类 + *

+ * + * @author lr + * @since 2021-08-19 + */ +public interface PythonSystemService extends IService { + + //根据学生账号id获取课程名称 + List getCourseTitle(Integer accountId,Integer schoolId); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/PythonTableDataService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/PythonTableDataService.java new file mode 100644 index 0000000..c173487 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/PythonTableDataService.java @@ -0,0 +1,16 @@ +package com.huoran.occupationlab.service; + +import com.huoran.occupationlab.entity.PythonTableData; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 储存全部python表数据表导出Excel路径 服务类 + *

+ * + * @author lr + * @since 2022-08-12 + */ +public interface PythonTableDataService extends IService { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/QuestionsService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/QuestionsService.java new file mode 100644 index 0000000..b0f2c88 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/QuestionsService.java @@ -0,0 +1,55 @@ +package com.huoran.occupationlab.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.Questions; +import com.huoran.occupationlab.entity.req.QuestionsAddReq; +import com.huoran.occupationlab.entity.req.QuestionsQueryReq; +import com.huoran.occupationlab.entity.req.QuestionsUpdateReq; +import com.huoran.occupationlab.entity.vo.EvaluationVO; +import com.huoran.occupationlab.entity.vo.QuestionsDetailVO; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + *

+ * 测评管理-题库记录表 服务类 + *

+ * + * @author lr + * @since 2021-08-12 + */ +public interface QuestionsService extends IService { + + //题库列表 + IPage getQuestionsList(QuestionsQueryReq req); + + boolean saveQuestion(QuestionsAddReq questions); + + boolean updateQuestionById(QuestionsUpdateReq questions); + + boolean deleteByIds(List ids); + + R isDisable(Integer id,Integer schoolId); + + QuestionsDetailVO getQuestionDetailById(Integer id); + + //批量导入 + Map upload(MultipartFile file,Integer schoolId,Integer accountId ) throws IOException; + + //批量导入失败 + void exportFailureRecord(HttpServletResponse response, String token) throws Exception; + + String getEvaluationRemainingTime(Integer accountId,Integer schoolId); + + EvaluationVO randomQuestions(Integer schoolId); + + //复制内置题库 + boolean copyQuestion(Integer schoolId,Integer accountId); + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/RabbitService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/RabbitService.java new file mode 100644 index 0000000..da31e89 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/RabbitService.java @@ -0,0 +1,7 @@ +package com.huoran.occupationlab.service; + +import com.huoran.common.response.R; + +public interface RabbitService { + R receiveMessage(); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/RolePermissionService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/RolePermissionService.java new file mode 100644 index 0000000..86ef55f --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/RolePermissionService.java @@ -0,0 +1,17 @@ +package com.huoran.occupationlab.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.occupationlab.entity.AclRolePermission; + +/** + *

+ * 角色权限 服务类 + *

+ * + * @author testjava + * @since 2020-01-12 + */ +public interface RolePermissionService extends IService { + + void removeMenu(String roleId, Integer isPort); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/RoleService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/RoleService.java new file mode 100644 index 0000000..1c65056 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/RoleService.java @@ -0,0 +1,34 @@ +package com.huoran.occupationlab.service; + + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.occupationlab.entity.AclRole; + +import java.util.List; +import java.util.Map; + +/** + *

+ * 服务类 + *

+ * + * @author testjava + * @since 2020-01-12 + */ +public interface RoleService extends IService { + + //根据用户获取角色数据 + Map findRoleByUserId(String userId); + + //根据用户分配角色 + void saveUserRoleRelationShip(String userId, String[] roleId); + + // 根据用户id拥有的角色id + List selectRoleByUserId(String id); + + boolean repeat(AclRole role); + + boolean removeRolePermission(String roleId); + + boolean removeRolePermissions(List roleIds); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/SchoolClassificationService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/SchoolClassificationService.java new file mode 100644 index 0000000..818265b --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/SchoolClassificationService.java @@ -0,0 +1,16 @@ +package com.huoran.occupationlab.service; + +import com.huoran.occupationlab.entity.SchoolClassification; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 学校对应分类表 服务类 + *

+ * + * @author lr + * @since 2021-09-09 + */ +public interface SchoolClassificationService extends IService { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/SchoolCourseService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/SchoolCourseService.java new file mode 100644 index 0000000..2ec8c12 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/SchoolCourseService.java @@ -0,0 +1,31 @@ +package com.huoran.occupationlab.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.occupationlab.entity.SchoolCourse; +import com.huoran.occupationlab.entity.vo.CourseVO; + +import java.util.HashMap; +import java.util.List; + +/** + *

+ * 学校内置课程表 服务类 + *

+ * + * @author Cheney + * @since 2020-11-30 + */ +public interface SchoolCourseService extends IService { + + List coursePageConditionQuery(HashMap map); + + int coursePageConditionCount(HashMap map); + + List builtInCoursePageQuery(HashMap map); + + int builtInCoursePageCount(HashMap map); + + boolean addBuiltInCourse(String schoolId, String courseIds , String classificationIds); + + void removeClassificationId(String schoolId, String classificationId); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/SchoolProjectHintOpenService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/SchoolProjectHintOpenService.java new file mode 100644 index 0000000..6ae2f7a --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/SchoolProjectHintOpenService.java @@ -0,0 +1,16 @@ +package com.huoran.occupationlab.service; + +import com.huoran.occupationlab.entity.SchoolProjectHintOpen; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 学校项目实验提示管理表 服务类 + *

+ * + * @author lr + * @since 2023-06-02 + */ +public interface SchoolProjectHintOpenService extends IService { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/SchoolService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/SchoolService.java new file mode 100644 index 0000000..e68881a --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/SchoolService.java @@ -0,0 +1,16 @@ +package com.huoran.occupationlab.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.common.entity.School; + +/** + *

+ * 学校表 服务类 + *

+ * + * @author Ning + * @since 2020-10-27 + */ +public interface SchoolService extends IService { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/StaffGradeService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/StaffGradeService.java new file mode 100644 index 0000000..e934573 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/StaffGradeService.java @@ -0,0 +1,18 @@ +package com.huoran.occupationlab.service; + +import com.huoran.occupationlab.entity.StaffGrade; +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.occupationlab.entity.StaffProfessionalArchitecture; + +/** + *

+ * 员工年级表 服务类 + *

+ * + * @author lr + * @since 2021-10-13 + */ +public interface StaffGradeService extends IService { + boolean repeat(StaffGrade staffGrade); + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/StaffProfessionalArchitectureService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/StaffProfessionalArchitectureService.java new file mode 100644 index 0000000..2279ecd --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/StaffProfessionalArchitectureService.java @@ -0,0 +1,16 @@ +package com.huoran.occupationlab.service; + +import com.huoran.occupationlab.entity.StaffProfessionalArchitecture; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 员工专业组织架构 服务类 + *

+ * + * @author lr + * @since 2021-10-13 + */ +public interface StaffProfessionalArchitectureService extends IService { + boolean repeat(StaffProfessionalArchitecture staffProfessionalArchitecture); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/StaffService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/StaffService.java new file mode 100644 index 0000000..eb04369 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/StaffService.java @@ -0,0 +1,41 @@ +package com.huoran.occupationlab.service; + +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.Staff; +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.occupationlab.entity.req.AddStaffReq; +import com.huoran.occupationlab.entity.req.ModifyStaffReq; +import com.huoran.occupationlab.entity.req.PageStaffListReq; +import io.swagger.models.auth.In; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + *

+ * 员工表 服务类 + *

+ * + * @author lr + * @since 2021-10-13 + */ +public interface StaffService extends IService { + R saveStaff(AddStaffReq staffReq) throws Exception; + + R pageStaffList(PageStaffListReq req); + + R staffDetail(Integer accountId); + + R modifyStaff(ModifyStaffReq staffReq,Integer schoolId); + + R delStaff(List ids); + + Map importStaff(MultipartFile file, Integer schoolId) throws IOException; + + //批量导入失败 + void exportFailureRecord(HttpServletResponse response, String token) throws Exception; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/StudentService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/StudentService.java new file mode 100644 index 0000000..ab89aca --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/StudentService.java @@ -0,0 +1,90 @@ +package com.huoran.occupationlab.service; + +import com.huoran.common.entity.Student; +import com.huoran.common.entity.UserAccount; +import com.huoran.common.entity.UserInfo; +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.occupationlab.entity.req.OrganizationStudentReq; +import com.huoran.occupationlab.entity.req.PageStudentListReq; +import com.huoran.occupationlab.entity.resp.StudentInfoResp; +import org.apache.ibatis.annotations.Param; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + *

+ * 学生表 服务类 + *

+ * + * @author lr + * @since 2021-08-24 + */ +public interface StudentService extends IService { + + //获取学生详情信息 + StudentInfoResp getStudentInfoDetail(@Param("params") Map params); + + //根据学号获取学生详情信息 + StudentInfoResp getStudentInfoDetailByWorkNum(@Param("params") Map params); + + //新增用户信息 + boolean addUserInfo(UserInfo userInfo); + + //新增账号信息 + boolean addUserAccount(UserAccount account); + + /** + * 学号(本校内)——————账号(全平台)判重 ——————手机号、邮箱根据平台id判重 + */ + //手机号、邮箱根据平台id判重 + List checkUserInfo(UserInfo userInfo); + + //学号(本校内)——————账号(全平台 + List checkUserAccount(UserAccount userAccount); + + //查询学生列表 + List studentList(PageStudentListReq req); + + //统计查询学生列表总数 + Integer studentListNum(PageStudentListReq req); + + + //查询职站学生端的用户 + List getOccupationlabStudent(); + + //查询学生信息 + StudentInfoResp getStudentInfoByAccountId(Integer stuAccountId); + + //修改用户信息 + boolean modifyUserInfo(UserInfo userInfo); + + //修改账户信息 + boolean modifyUserAccount(UserAccount userAccount); + + //批量导入学生 + Map uploadStudent(MultipartFile file, Integer schoolId) throws IOException; + + //批量导入失败 + void exportFailureRecord(HttpServletResponse response, String token) throws Exception; + + //组织架构筛选学生 + List organizationalStudentList(OrganizationStudentReq req); + + //统计组织架构筛选学生 + Integer organizationalStudentListNum(OrganizationStudentReq req); + + //禁用启用学生账号 + Integer updateAccountEnable(Integer id, Integer isEnable); + + //根据账号id拿到用户id + Integer getUserId(Integer accountId); + + //统计班级下人数 + Integer countClassSizes(Integer schoolId,Integer classId); + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/SysJobLogService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/SysJobLogService.java new file mode 100644 index 0000000..c857e1e --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/SysJobLogService.java @@ -0,0 +1,16 @@ +package com.huoran.occupationlab.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.occupationlab.entity.SysJobLog; + +/** + * 定时任务 服务类 + * + * @author cheney + * @version V1.0 + * @date 2022年7月28日 + */ +public interface SysJobLogService extends IService { + +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/SysJobService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/SysJobService.java new file mode 100644 index 0000000..e2ce1c7 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/SysJobService.java @@ -0,0 +1,67 @@ +package com.huoran.occupationlab.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.occupationlab.entity.SysJob; + +import java.util.List; + +/** + * 定时任务 服务类 + * + * @author cheney + * @version V1.0 + * @date 2022年7月28日 + */ +public interface SysJobService extends IService { + + /** + * 保存job + * + * @param sysJob sysJob + */ + void saveJob(SysJob sysJob); + + /** + * 更新job + * + * @param sysJob sysJob + */ + void updateJobById(SysJob sysJob); + + /** + * 删除job + * + * @param ids ids + */ + void delete(List ids); + + /** + * 运行一次job + * + * @param ids ids + */ + void run(List ids); + + /** + * 暂停job + * + * @param ids ids + */ + void pause(List ids); + + /** + * 恢复job + * + * @param ids ids + */ + void resume(List ids); + + /** + * 批量更新状态 + * + * @param ids ids + * @param status status + */ + void updateBatch(List ids, int status); +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/SystemLogoService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/SystemLogoService.java new file mode 100644 index 0000000..708b9b0 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/SystemLogoService.java @@ -0,0 +1,16 @@ +package com.huoran.occupationlab.service; + +import com.huoran.occupationlab.entity.SystemLogo; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 职站教师端-系统logo设置 服务类 + *

+ * + * @author lr + * @since 2021-10-18 + */ +public interface SystemLogoService extends IService { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/TheoreticalCourseChapterService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/TheoreticalCourseChapterService.java new file mode 100644 index 0000000..34f0a88 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/TheoreticalCourseChapterService.java @@ -0,0 +1,29 @@ +package com.huoran.occupationlab.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.occupationlab.entity.TheoreticalCourseChapter; +import com.huoran.occupationlab.entity.vo.ReorderVO; +import com.huoran.occupationlab.entity.vo.TheoreticalChapterVO; + +import java.util.List; + +/** + *

+ * 理论课程章节表 服务类 + *

+ * + * @author lr + * @since 2022-09-22 + */ +public interface TheoreticalCourseChapterService extends IService { + + List getChapterTree(String courseId); + + boolean updateSort(ReorderVO reorderVO); + + boolean repeat(TheoreticalCourseChapter theoreticalCourseChapter); + + boolean saveChapter(TheoreticalCourseChapter theoreticalCourseChapter); + + boolean removeChapter(Integer chapterId); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/TheoreticalCourseClassificationService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/TheoreticalCourseClassificationService.java new file mode 100644 index 0000000..44ac7fc --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/TheoreticalCourseClassificationService.java @@ -0,0 +1,31 @@ +package com.huoran.occupationlab.service; + +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.TheoreticalCourseClassification; +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.occupationlab.entity.req.ClassificationPageReq; +import org.springframework.web.bind.annotation.RequestBody; + +import javax.servlet.http.HttpServletRequest; + +/** + *

+ * 理论课程分类信息 服务类 + *

+ * + * @author lr + * @since 2022-09-14 + */ +public interface TheoreticalCourseClassificationService extends IService { + + + R checkRepeat(TheoreticalCourseClassification classification); + + + R pagingQuery(ClassificationPageReq pageReq); + + R queryAllCategoriesOfSchools(); + + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/TheoreticalCourseCollectService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/TheoreticalCourseCollectService.java new file mode 100644 index 0000000..63478be --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/TheoreticalCourseCollectService.java @@ -0,0 +1,16 @@ +package com.huoran.occupationlab.service; + +import com.huoran.occupationlab.entity.TheoreticalCourseCollect; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 理论课程收藏表 服务类 + *

+ * + * @author lr + * @since 2023-04-18 + */ +public interface TheoreticalCourseCollectService extends IService { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/TheoreticalCourseConfigureService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/TheoreticalCourseConfigureService.java new file mode 100644 index 0000000..a46ed70 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/TheoreticalCourseConfigureService.java @@ -0,0 +1,16 @@ +package com.huoran.occupationlab.service; + +import com.huoran.occupationlab.entity.TheoreticalCourseConfigure; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 理论课程与理论课程分类配置表 服务类 + *

+ * + * @author lr + * @since 2022-09-14 + */ +public interface TheoreticalCourseConfigureService extends IService { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/TheoreticalCourseRangeService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/TheoreticalCourseRangeService.java new file mode 100644 index 0000000..b775b1b --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/TheoreticalCourseRangeService.java @@ -0,0 +1,16 @@ +package com.huoran.occupationlab.service; + +import com.huoran.occupationlab.entity.TheoreticalCourseRange; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 理论课程指定范围选择 服务类 + *

+ * + * @author lr + * @since 2022-09-19 + */ +public interface TheoreticalCourseRangeService extends IService { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/TheoreticalCourseService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/TheoreticalCourseService.java new file mode 100644 index 0000000..6a43377 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/TheoreticalCourseService.java @@ -0,0 +1,41 @@ +package com.huoran.occupationlab.service; + +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.TheoreticalCourse; +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.occupationlab.entity.TheoreticalCourseClassification; +import com.huoran.occupationlab.entity.req.AddTheoreticalCourseReq; +import com.huoran.occupationlab.entity.req.PageStudentTheoreticalCourseReq; +import com.huoran.occupationlab.entity.req.PageTheoreticalCourseReq; +import io.swagger.annotations.ApiParam; +import org.springframework.web.bind.annotation.RequestBody; + +import javax.servlet.http.HttpServletRequest; + +/** + *

+ * 理论课程基本信息 服务类 + *

+ * + * @author lr + * @since 2022-09-14 + */ +public interface TheoreticalCourseService extends IService { + + R addTheoryCourses(AddTheoreticalCourseReq req, HttpServletRequest request); + + R pageConditionalQueryCourse(PageTheoreticalCourseReq pageReq); + + R modifyTheoryCourses(AddTheoreticalCourseReq req, HttpServletRequest request); + + R theoryCoursesDetail(Integer id); + + //学生端 课程列表 + R pageConditionalQueryCourseByStudent(PageStudentTheoreticalCourseReq pageReq); + + //登录前 学生端课程列表 + R studentLoginPreCourse(PageTheoreticalCourseReq pageReq); + + R checkRepeat(TheoreticalCourse classification); + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/TheoreticalCourseSubsectionService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/TheoreticalCourseSubsectionService.java new file mode 100644 index 0000000..f2e0610 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/TheoreticalCourseSubsectionService.java @@ -0,0 +1,22 @@ +package com.huoran.occupationlab.service; + +import com.aliyuncs.exceptions.ClientException; +import com.huoran.occupationlab.entity.TheoreticalCourseSubsection; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 课程小节 服务类 + *

+ * + * @author lr + * @since 2022-09-22 + */ +public interface TheoreticalCourseSubsectionService extends IService { + + boolean repeat(TheoreticalCourseSubsection theoreticalCourseSubsection); + + boolean saveSubsection(TheoreticalCourseSubsection theoreticalCourseSubsection); + + boolean removeSubsection(Integer subsectionId) throws ClientException; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/UserInfoService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/UserInfoService.java new file mode 100644 index 0000000..e3e4623 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/UserInfoService.java @@ -0,0 +1,22 @@ +package com.huoran.occupationlab.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.occupationlab.entity.HrUserInfo; + +import java.util.HashMap; + +/** + *

+ * 用户信息表 服务类 + *

+ * + * @author Ning + * @since 2020-10-21 + */ +public interface UserInfoService extends IService { + HrUserInfo getUserInfo(Integer userId); + + HrUserInfo login(HashMap map); + + boolean updateTime(Integer userId); +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/UserManagementService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/UserManagementService.java new file mode 100644 index 0000000..dbff1e1 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/UserManagementService.java @@ -0,0 +1,43 @@ +package com.huoran.occupationlab.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.occupationlab.entity.UserManagement; +import com.huoran.occupationlab.entity.vo.UserVO; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + *

+ * 企业端用户管理 服务类 + *

+ * + * @author Ning + * @since 2020-10-27 + */ +public interface UserManagementService extends IService { + + //添加用户 + boolean addUser(UserVO vo); + + //查询用户列表 + List queryList(HashMap map); + + //查询用户列表数量 + int queryListCount(HashMap map); + + //批量删除用户 + boolean deleteUser(List userIds); + + //修改用户 + boolean updateUser(UserVO vo); + + Map upload(MultipartFile file) throws IOException; + + void exportFailureRecord(HttpServletResponse response, String token) throws Exception; + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/UserRoleService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/UserRoleService.java new file mode 100644 index 0000000..9b75c97 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/UserRoleService.java @@ -0,0 +1,16 @@ +package com.huoran.occupationlab.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.occupationlab.entity.AclUserRole; + +/** + *

+ * 服务类 + *

+ * + * @author testjava + * @since 2020-01-12 + */ +public interface UserRoleService extends IService { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/UserScoreService.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/UserScoreService.java new file mode 100644 index 0000000..0163aeb --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/UserScoreService.java @@ -0,0 +1,16 @@ +package com.huoran.occupationlab.service; + +import com.huoran.occupationlab.entity.UserScore; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 用户分数表 服务类 + *

+ * + * @author Mr.JK + * @since 2021-09-14 + */ +public interface UserScoreService extends IService { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ApplicantServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ApplicantServiceImpl.java new file mode 100644 index 0000000..3968b22 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ApplicantServiceImpl.java @@ -0,0 +1,150 @@ +package com.huoran.occupationlab.service.impl; + +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.entity.ExportParams; +import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; +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.huoran.common.response.R; +import com.huoran.occupationlab.entity.Applicant; +import com.huoran.common.entity.School; +import com.huoran.occupationlab.entity.excel.ExcelData; +import com.huoran.occupationlab.entity.req.PageRegistrationStaffReq; +import com.huoran.occupationlab.entity.vo.ApplicantVO; +import com.huoran.occupationlab.mapper.ApplicantMapper; +import com.huoran.occupationlab.service.ApplicantService; +import com.huoran.occupationlab.utils.EasyExcelUtil; +import com.huoran.occupationlab.utils.poi.ExcelStyleUtil; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +/** + *

+ * 报名人员表 服务实现类 + *

+ * + * @author chen + * @since 2020-10-15 + */ +@Service +public class ApplicantServiceImpl extends ServiceImpl implements ApplicantService { + + @Override + public R applicantPageConditionQuery(PageRegistrationStaffReq req) { + + Page page = new Page(req.getPageNum(), req.getPageSize()); + IPage pageList = baseMapper.selectApplicantByCondition(page, req); + return R.ok().put("data", pageList); + + + } + + + @Override + public boolean disableContests(List ids) { + int updates = baseMapper.disableByIds(ids); + return updates > 0; + } + + @Override + public void export(HttpServletResponse response, PageRegistrationStaffReq req) throws IOException { + + Page page = new Page(req.getPageNum(), req.getPageSize()); + IPage applicantVOList = baseMapper.selectApplicantByCondition(page, req); + List excelDataList = new ArrayList<>(); + applicantVOList.getRecords().forEach(applicantVO -> { + ExcelData excelData = new ExcelData(); + /*//是否禁用(0未禁用,1禁用) + if (applicantVO.getIsDisable().equals("0")){ + applicantVO.setIsDisable("启用"); + }else{ + applicantVO.setIsDisable("禁用"); + }*/ + BeanUtils.copyProperties(applicantVO, excelData); + excelDataList.add(excelData); + }); + /* EasyExcelUtil.download(response, ExcelData.class, excelDataList);*/ + + + // 告诉浏览器用什么软件可以打开此文件 + response.setHeader("content-Type", "application/vnd.ms-excel"); + // 下载文件的默认名称 + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("报名人员导出", "UTF-8") + ".xls"); + //编码 + response.setCharacterEncoding("UTF-8"); + Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), ExcelData.class, excelDataList); + ExportParams exportParams = new ExportParams(null, "delivery", ExcelType.XSSF); + exportParams.setStyle(ExcelStyleUtil.class); + workbook.write(response.getOutputStream()); + } + + @Override + public void batchExport(HttpServletResponse response, List ids) throws IOException { + List excelDataList = baseMapper.selectBatchData(ids); + EasyExcelUtil.download(response, ExcelData.class, excelDataList); + } + + @Override + public List queryContestId(String account_id) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("account_id", account_id); + wrapper.select("contest_id"); + List applicants = baseMapper.selectList(wrapper); + List contestIds = applicants.stream().map(Applicant::getContestId).collect(Collectors.toList()); + return contestIds; + } + + @Override + public boolean selectOne(String accountId, String contestId) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("account_id", accountId); + wrapper.eq("contest_id", contestId); + Integer count = baseMapper.selectCount(wrapper); + return count > 0; + } + + @Override + public School getSchool(Integer schoolId) { + return baseMapper.getSchool(schoolId); + } + + @Override + public void exportDataInBatches(List list, HttpServletResponse response) throws Exception { + + /* list.forEach(applicantVO -> { + //是否禁用(0启用,1禁用) + if (applicantVO.getIsDisable().equals("1")){ + applicantVO.setIsDisable("已禁用"); + }else{ + applicantVO.setIsDisable("启用"); + } + });*/ + + // 告诉浏览器用什么软件可以打开此文件 + response.setHeader("content-Type", "application/vnd.ms-excel"); + // 下载文件的默认名称 + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("报名人员导出", "UTF-8") + ".xls"); + //编码 + response.setCharacterEncoding("UTF-8"); + Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), ApplicantVO.class, list); + ExportParams exportParams = new ExportParams(null, "delivery", ExcelType.XSSF); + exportParams.setStyle(ExcelStyleUtil.class); + workbook.write(response.getOutputStream()); + } + + @Override + public R cancelRegistration(String contestId, Integer accountId) { + boolean ret = baseMapper.cancelRegistration(contestId, accountId); + return ret ? R.ok() : R.error(); + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ArchitectureServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ArchitectureServiceImpl.java new file mode 100644 index 0000000..b4247a0 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ArchitectureServiceImpl.java @@ -0,0 +1,183 @@ +package com.huoran.occupationlab.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.common.constant.DelConstant; +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.Architecture; +import com.huoran.occupationlab.entity.Class; +import com.huoran.common.entity.Student; +import com.huoran.occupationlab.entity.resp.StudentInfoResp; +import com.huoran.occupationlab.mapper.ArchitectureMapper; +import com.huoran.occupationlab.mapper.ClassMapper; +import com.huoran.occupationlab.mapper.StudentMapper; +import com.huoran.occupationlab.service.ArchitectureService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +/** + *

+ * 学生组织架构 服务实现类 + *

+ * + * @author lr + * @since 2021-08-24 + */ +@Service +public class ArchitectureServiceImpl extends ServiceImpl implements ArchitectureService { + + @Autowired + private ClassMapper classMapper; + + @Autowired + private StudentMapper studentMapper; + + /** + * 使用递归方法构建权限菜单 + */ + public List bulid(List treeNodes) { + List trees = new ArrayList<>(); + for (Architecture treeNode : treeNodes) { + if (treeNode.getLevel() == 1) { + trees.add(findChildren(treeNode, treeNodes)); + } + } + return trees; + } + + /** + * 递归查找子节点 + */ + public Architecture findChildren(Architecture treeNode, List treeNodes) { + treeNode.setChildren(new ArrayList()); + + for (Architecture it : treeNodes) { + if (treeNode.getLevel() == 2) {//表示查询年级下的班级 拼接 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + queryWrapper.eq("architecture_id", treeNode.getId()); + List classList = classMapper.selectList(queryWrapper); + + List addClassList = new ArrayList<>(); + for (Class cla : classList) { + Architecture classArchitecture = new Architecture(); + classArchitecture.setOrganizationName(cla.getClassName()); + classArchitecture.setParentId(cla.getArchitectureId()); + classArchitecture.setLevel(3); + classArchitecture.setId(cla.getId()); + + QueryWrapper studentQueryWrapper = new QueryWrapper<>(); + studentQueryWrapper.eq("is_del", DelConstant.NOT_DEL); + studentQueryWrapper.last(" and FIND_IN_SET(" + cla.getId() + ",class_id)"); + List students = studentMapper.selectList(studentQueryWrapper); + List addStudentList = new ArrayList<>(); + for (Student student : students) { + StudentInfoResp stu = studentMapper.getUerName(student.getAccountId()); + Architecture studentArchitecture = new Architecture(); + studentArchitecture.setOrganizationName(stu.getUserName()); + studentArchitecture.setLevel(4); + studentArchitecture.setId(student.getId()); + studentArchitecture.setParentId(cla.getId()); + addStudentList.add(studentArchitecture); + } + + classArchitecture.setChildren(addStudentList); + + addClassList.add(classArchitecture); + } + treeNode.setChildren(addClassList); + + } + if (treeNode.getId().equals(it.getParentId())) { + if (treeNode.getChildren() == null) { + treeNode.setChildren(new ArrayList<>()); + } + treeNode.getChildren().add(findChildren(it, treeNodes)); + } + } + return treeNode; + } + + @Override + public List treeList(Integer schoolId) { + //查询父级的 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("is_del", DelConstant.NOT_DEL); + wrapper.eq("school_id", schoolId); + List permissionList = baseMapper.selectList(wrapper); + List result = bulid(permissionList); + + return result; + } + + @Override + public R stuOrganizationTree(Integer schoolId, Integer accountId, Integer level, Integer parentId) { + QueryWrapper queryWrapper = new QueryWrapper(); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + queryWrapper.eq("school_id", schoolId); + queryWrapper.eq("level", level); + + List list = new ArrayList<>(); + switch (level) { + case 1: + return R.ok().put("treeList", baseMapper.selectList(queryWrapper)); + case 2: + queryWrapper.eq("parent_id", parentId); + return R.ok().put("treeList", baseMapper.selectList(queryWrapper)); + case 3: + //查询年级下的班级 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("is_del", DelConstant.NOT_DEL); + wrapper.eq("architecture_id", parentId); + List classList = classMapper.selectList(wrapper); + for (Class classes : classList) { + Architecture architecture = new Architecture(); + architecture.setOrganizationName(classes.getClassName()); + architecture.setLevel(3); + architecture.setParentId(parentId); + architecture.setId(classes.getId()); + list.add(architecture); + } + return R.ok().put("treeList", list); + case 4: + //查询年级下的班级 + QueryWrapper studentQueryWrapper = new QueryWrapper<>(); + studentQueryWrapper.eq("is_del", DelConstant.NOT_DEL); + studentQueryWrapper.last(" and FIND_IN_SET(" + parentId + ",class_id)"); + List students = studentMapper.selectList(studentQueryWrapper); + List addStudentList = new ArrayList<>(); + for (Student student : students) { + StudentInfoResp stu = studentMapper.getUerName(student.getAccountId()); + Architecture studentArchitecture = new Architecture(); + studentArchitecture.setOrganizationName(stu.getUserName()); + studentArchitecture.setLevel(4); + studentArchitecture.setId(student.getAccountId()); + studentArchitecture.setParentId(parentId); + addStudentList.add(studentArchitecture); + } + + return R.ok().put("treeList", addStudentList); + default: + return R.error("请输入正确的层级!"); + } + + } + + @Override + public List chenckReapt(Architecture architecture) { + QueryWrapper queryWrapper = new QueryWrapper(); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + queryWrapper.eq("level", architecture.getLevel()); + queryWrapper.eq("school_id", architecture.getSchoolId()); + queryWrapper.eq("organization_name", architecture.getOrganizationName()); + queryWrapper.eq("parent_id", architecture.getParentId()); + if (architecture.getId() != null) { + queryWrapper.last(" and id != " + architecture.getId()); + } + List architectureList = baseMapper.selectList(queryWrapper); + return architectureList; + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ArticleServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ArticleServiceImpl.java new file mode 100644 index 0000000..83a78c0 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ArticleServiceImpl.java @@ -0,0 +1,73 @@ +package com.huoran.occupationlab.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.occupationlab.entity.Article; +import com.huoran.occupationlab.entity.vo.ArticleSort; +import com.huoran.occupationlab.mapper.ArticleMapper; +import com.huoran.occupationlab.service.ArticleService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +/** + *

+ * 文章表 服务实现类 + *

+ * + * @author chen + * @since 2020-10-15 + */ +@Service +public class ArticleServiceImpl extends ServiceImpl implements ArticleService { + + @Override + public void articlePageQuery(Page
page, String columnId, String port, Integer schoolId) { + QueryWrapper
wrapper = new QueryWrapper<>(); + wrapper.orderByAsc("sort"); + wrapper.orderByDesc("date"); + wrapper.eq("column_id", columnId); + wrapper.eq("school_id", schoolId); + if (StringUtils.isNotEmpty(port)) { + wrapper.eq("status", 0); + } + baseMapper.selectPage(page, wrapper); + } + + @Transactional + @Override + public Article getArticle(String articleId) { + Article article = baseMapper.selectById(articleId); + baseMapper.updateViewNum(articleId); + return article; + } + + @Override + public boolean sort(ArticleSort articleSort) { + List
articleList = articleSort.getArticleList(); + if (articleList != null && articleList.size() != 0) { + articleList.forEach(article -> { + baseMapper.updateById(article); + }); + return true; + } else { + return false; + } + } + + @Override + public boolean repeat(Article article) { + QueryWrapper
wrapper = new QueryWrapper<>(); + wrapper.eq("column_id", article.getColumnId()); + wrapper.eq("title", article.getTitle()); + wrapper.eq("school_id", article.getSchoolId()); + if (article.getId() != null) { + wrapper.last(" and id != " + article.getId()); + } + Integer count = baseMapper.selectCount(wrapper); + return count > 0; + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/AssessmentExamServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/AssessmentExamServiceImpl.java new file mode 100644 index 0000000..1968060 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/AssessmentExamServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.occupationlab.service.impl; + +import com.huoran.occupationlab.entity.AssessmentExam; +import com.huoran.occupationlab.mapper.AssessmentExamMapper; +import com.huoran.occupationlab.service.AssessmentExamService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 学生考试表(考核) 服务实现类 + *

+ * + * @author lr + * @since 2021-08-19 + */ +@Service +public class AssessmentExamServiceImpl extends ServiceImpl implements AssessmentExamService { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/AssessmentServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/AssessmentServiceImpl.java new file mode 100644 index 0000000..b9c2a23 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/AssessmentServiceImpl.java @@ -0,0 +1,737 @@ +package com.huoran.occupationlab.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.api.UserClient; +import com.huoran.common.constant.AssessmentConstant; +import com.huoran.common.constant.DelConstant; +import com.huoran.common.constant.PlatformConstant; +import com.huoran.common.exception.CustomException; +import com.huoran.common.exception.ExceptionEnum; +import com.huoran.common.response.R; +import com.huoran.common.utils.CheckDateUtil; +import com.huoran.common.utils.TokenUtils; +import com.huoran.occupationlab.entity.Architecture; +import com.huoran.occupationlab.entity.Assessment; +import com.huoran.occupationlab.entity.AssessmentExam; +import com.huoran.occupationlab.entity.Class; +import com.huoran.occupationlab.entity.req.AssessmentReq; +import com.huoran.occupationlab.entity.req.ClassReq; +import com.huoran.occupationlab.entity.req.PageAssessmentReq; +import com.huoran.occupationlab.entity.req.PageStuAssessmentReq; +import com.huoran.occupationlab.entity.resp.EnterExamResp; +import com.huoran.occupationlab.entity.resp.StuAssessmentListResp; +import com.huoran.occupationlab.mapper.ArchitectureMapper; +import com.huoran.occupationlab.mapper.AssessmentExamMapper; +import com.huoran.occupationlab.mapper.AssessmentMapper; +import com.huoran.occupationlab.mapper.ClassMapper; +import com.huoran.occupationlab.service.AssessmentService; +import org.apache.commons.lang3.StringUtils; +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.util.ObjectUtils; + +import javax.servlet.http.HttpServletRequest; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.ParsePosition; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.stream.Collectors; + +/** + *

+ * 考核管理 服务实现类 + *

+ * + * @author lr + * @since 2021-08-18 + */ +@Service +public class AssessmentServiceImpl extends ServiceImpl implements AssessmentService { + + @Autowired + private AssessmentMapper mapper; + @Autowired + private ClassMapper classMapper; + + @Autowired + private ArchitectureMapper architectureMapper; + + @Autowired + private AssessmentExamMapper examMapper; + +// @Autowired +// private XxlJobService xxlJobService; + + @Autowired + private UserClient userClient; + + @Override + public List pageByCondition(PageAssessmentReq req) { + Map map = new HashMap(); + + map.put("month", req.getMonth()); + map.put("type", req.getType()); + map.put("status", req.getStatus()); + map.put("curriculumId", req.getCurriculumId()); + map.put("keyWord", req.getKeyWord()); + map.put("pageNum", (req.getPageNum() - 1) * req.getPageSize()); + map.put("pageSize", req.getPageSize()); + map.put("schoolId", req.getSchoolId()); + map.put("startTime", req.getStartTime()); + map.put("endTime", req.getEndTime()); + + map.put("accountId", req.getAccountId()); + + map.put("isAdmin", 0); + map.put("mallId", req.getMallId()); + + String roleName = userClient.getUserAllRole(req.getAccountId() + "", 1); + if (roleName.contains("超级管理员") || roleName.contains("管理员")) { + //依据角色查询本校内的项目(超管管理员角色、管理员角色能看到全部考核列表 其它角色只能看到自己发布的) + map.put("isAdmin", 1); + } else { + List accountIdList = userClient.getAccountIdsBySchoolId(req.getSchoolId(), PlatformConstant.POST_STATION); + //为满足非超管、管理员的角色情况下能看到本人及超管、管理员角色发布的项目 由此将当前用户的账号id赋值进去List + accountIdList.add(req.getAccountId()); + map.put("accountIdList", accountIdList); + } + + List assessments = mapper.pageByCondition(map); + + for (Assessment ass : assessments) { + List classList = new ArrayList<>(); + for (String classId : ass.getClassId().split(",")) { + Class classInfo = classMapper.selectById(classId); + classList.add(classInfo); + } + ass.setClassInfo(classList); + } + + return assessments; + } + + @Override + public Integer pageByConditionNum(PageAssessmentReq req) { + Map map = new HashMap(); + + map.put("month", req.getMonth()); + map.put("type", req.getType()); + map.put("status", req.getStatus()); + map.put("curriculumId", req.getCurriculumId()); + map.put("keyWord", req.getKeyWord()); + map.put("pageNum", (req.getPageNum() - 1) * req.getPageSize()); + map.put("pageSize", req.getPageSize()); + map.put("schoolId", req.getSchoolId()); + map.put("startTime", req.getStartTime()); + map.put("endTime", req.getEndTime()); + + map.put("accountId", req.getAccountId()); + map.put("mallId", req.getMallId()); + map.put("isAdmin", 0); + + String roleName = userClient.getUserAllRole(req.getAccountId() + "", 1); + if (roleName.contains("超级管理员") || roleName.contains("管理员")) { + //依据角色查询本校内的项目(超管管理员角色、管理员角色能看到全部考核列表 其它角色只能看到自己发布的) + map.put("isAdmin", 1); + } else { + List accountIdList = userClient.getAccountIdsBySchoolId(req.getSchoolId(), PlatformConstant.POST_STATION); + //为满足非超管、管理员的角色情况下能看到本人及超管、管理员角色发布的项目 由此将当前用户的账号id赋值进去List + accountIdList.add(req.getAccountId()); + map.put("accountIdList", accountIdList); + } + + Integer total = mapper.pageByConditionNum(map).size(); + return total; + } + + @Override + public List pageStuAssessment(PageStuAssessmentReq req) { + Map map = new HashMap(); + map.put("accountId", req.getAccountId()); + map.put("month", req.getMonth()); + map.put("status", req.getStatus()); + map.put("curriculumId", req.getCurriculumId()); + map.put("keyWord", req.getKeyWord()); + map.put("classId", req.getClassId()); + map.put("pageNum", (req.getPageNum() - 1) * req.getPageSize()); + map.put("pageSize", req.getPageSize()); + map.put("schoolId", req.getSchoolId()); + map.put("startTime", req.getStartTime()); + map.put("endTime", req.getEndTime()); + map.put("mallId", req.getMallId()); + List assessments = mapper.pageStuAssessment(map); + + return assessments; + } + + @Override + public Integer pageStuAssessmentNum(PageStuAssessmentReq req) { + /*Map map = new HashMap(); + map.put("month", req.getMonth()); + map.put("accountId", req.getAccountId()); + map.put("keyWord", req.getKeyWord()); + map.put("status", req.getStatus()); + map.put("sysName", req.getSysName()); + map.put("classId", req.getClassId()); + map.put("pageNum", (req.getPageNum() - 1) * req.getPageSize()); + map.put("pageSize", req.getPageSize()); + map.put("schoolId", req.getSchoolId()); + map.put("startTime", req.getStartTime()); + map.put("endTime", req.getEndTime());*/ + + Map map = new HashMap(); + map.put("accountId", req.getAccountId()); + map.put("month", req.getMonth()); + map.put("status", req.getStatus()); + map.put("curriculumId", req.getCurriculumId()); + map.put("keyWord", req.getKeyWord()); + map.put("classId", req.getClassId()); + map.put("pageNum", (req.getPageNum() - 1) * req.getPageSize()); + map.put("pageSize", req.getPageSize()); + map.put("schoolId", req.getSchoolId()); + map.put("startTime", req.getStartTime()); + map.put("endTime", req.getEndTime()); + map.put("mallId", req.getMallId()); + List num = mapper.pageStuAssessmentNum(map); + /*Integer countNum = 0; + for (Integer count : num) { + countNum += count; + }*/ + return num.size(); + } + + @Override + public R saveAssessment(AssessmentReq req) throws ParseException { + + Assessment assessment = new Assessment(); + if (StringUtils.isNotEmpty(req.getStartTime())) { + //校验考核开始结束时间与当前时间对比 + if (CheckDateUtil.checStartkTime(req.getStartTime()) == false) { + return R.error("考试开始时间不能小于当前时间"); + } + } + if (StringUtils.isNotEmpty(req.getStopTime())) { + if (CheckDateUtil.checStartkTime(req.getStopTime()) == false) { + return R.error("考试结束时间不能小于当前时间"); + } + } + //检验名称是否有相同的 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("experimental_name", req.getExperimentalName()); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + queryWrapper.eq("school_id", req.getSchoolId()); + if (baseMapper.selectOne(queryWrapper) != null) { + return R.error("考核名称不能重复!"); + } + + //指定范围(0无指定范围 1指定范围) + if (req.getIsSpecify() == 0) { + //remark:创建无指定范围时候不同时对学生考试表进行新增操作 + req.setClassId("1");//无指定范围测classId为1 + } else { + if (StringUtils.isEmpty(req.getClassId())) { + return R.error("指定范围班级id不能为空"); + } + } + + //复制属性 + BeanUtils.copyProperties(req, assessment); + //添加学生考核考试记录 + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + if (req.getStartTime() != null) { + ParsePosition pos = new ParsePosition(0); + Date strtodate = formatter.parse(req.getStartTime(), pos); + assessment.setStartTime(strtodate); + } + + if (req.getStartTime() != null) { + ParsePosition pos1 = new ParsePosition(0); + Date stopdate = formatter.parse(req.getStopTime(), pos1); + assessment.setStopTime(stopdate); + } + + int addRet = mapper.insert(assessment); + Integer type = assessment.getType(); + //定时发布添加定时开启和关闭 +// if (type == 2) { +// DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); +// Integer startTaskId = xxlJobService.addJustExecuteOnceJob(assessment.getId() + "start", dateFormat.parse(dateFormat.format(assessment.getStartTime())), assessment.getId().toString(), "assessmentJobStart"); +// //开始运行开启考核任务 +// xxlJobService.start(startTaskId); +// +// Integer stopTaskId = xxlJobService.addJustExecuteOnceJob(assessment.getId() + "stop", dateFormat.parse(dateFormat.format(assessment.getStopTime())), assessment.getId().toString(), "assessmentJobStop"); +// //开始运行停止考核任务 +// xxlJobService.start(stopTaskId); +// } + + if (req.getIsSpecify() == 1) { + //remark:为指定范围时 需要对选择班级下的学生对学生考试表做新增操作 + for (ClassReq stuAccount : assessment.getStuInfo()) { + AssessmentExam exam = new AssessmentExam(); + exam.setAssessmentId(assessment.getId()); + exam.setAccountId(stuAccount.getStuAccountId()); + exam.setClassId(stuAccount.getClassId()); + exam.setState(AssessmentConstant.EXAMINATION_STATE_NOT_START); + examMapper.insert(exam); + } + } + + return addRet > 0 ? R.ok() : R.error(); + } + + @Override + public R deleteAssessment(List ids) { + for (Integer id : ids) { + QueryWrapper queryWrapper = new QueryWrapper(); + queryWrapper.eq("assessment_id", id); + examMapper.delete(queryWrapper); + + /* //定时时间修改,删除之前定时任务 + Integer removeStartTaskId = xxlJobService.getJobIdByCustomId(id+"start"); + Integer removeStopTaskId = xxlJobService.getJobIdByCustomId(id+"stop"); + //删除任务 + xxlJobService.remove(removeStartTaskId); + xxlJobService.remove(removeStopTaskId);*/ + + } + int ret = baseMapper.deleteBatchIds(ids); + return ret > 0 ? R.ok() : R.error(); + } + + @Override + public R modifyAssessment(Assessment ass) throws ParseException { + + //指定范围(0无指定范围 1指定范围) + if (ass.getIsSpecify() == 0) { + //remark:创建无指定范围时候不同时对学生考试表进行新增操作 + ass.setClassId("1");//无指定范围测classId为1 + //删除原有考试表中的信息 + examMapper.delete(new QueryWrapper().eq("assessment_id", ass.getId())); + } else { + if (StringUtils.isEmpty(ass.getClassId())) { + return R.error("指定范围班级id不能为空"); + } + } + int ret = 0; + //assessment:查看更改前的考核详情 + Assessment assessment = baseMapper.selectById(ass.getId()); + + //删除已存在的考核定时任务 +// Integer removeStartTaskId = xxlJobService.getJobIdByCustomId(ass.getId() + "start"); +// Integer removeStopTaskId = xxlJobService.getJobIdByCustomId(ass.getId() + "stop"); +// //删除任务 +// if (!ObjectUtils.isEmpty(removeStartTaskId)) { +// xxlJobService.remove(removeStartTaskId); +// } +// if (!ObjectUtils.isEmpty(removeStopTaskId)) { +// xxlJobService.remove(removeStopTaskId); +// } +// // 判断当前考核类型已做变更 +// if (assessment.getType() != ass.getType()) { +// /*根据当前选择的考核类型处理相应操作*/ +// switch (ass.getType()) {//发布类型(1、手动发布 2、定时发布) +// case 1: +// //将原有的定时发布时间 起始结束时间置空 +// ass.setStartTime(null); +// ass.setStopTime(null); +// break; +// case 2: +// DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); +// //新增新任务 +// Integer startTaskId = xxlJobService.addJustExecuteOnceJob(assessment.getId() + "start", dateFormat.parse(dateFormat.format(ass.getStartTime())), assessment.getId().toString(), "assessmentJobStart"); +// //开始运行开启考核任务 +// xxlJobService.start(startTaskId); +// +// Integer stopTaskId = xxlJobService.addJustExecuteOnceJob(assessment.getId() + "stop", dateFormat.parse(dateFormat.format(ass.getStopTime())), assessment.getId().toString(), "assessmentJobStop"); +// //开始运行停止考核任务 +// xxlJobService.start(stopTaskId); +// break; +// +// } +// } + + + + + + + /*String time = ""; + if (assessment.getType() == 1) {//发布类型(1、手动发布 2、定时发布) + if (!ObjectUtils.isEmpty(ass.getExperimentDuration())) { + time = ass.getExperimentDuration(); + } else { + time = assessment.getExperimentDuration(); + + } + int d = time.indexOf("d"); + int h = time.indexOf("h"); + int m = time.indexOf("m"); + int dd = Integer.parseInt(time.substring(0, d)); + int hh = Integer.parseInt(time.substring(d + 1, h)); + int mm = Integer.parseInt(time.substring(h + 1, m)); + int newTime = dd * 24 * 60 + hh * 60 + mm; + + Calendar nowTime = Calendar.getInstance(); + Date date = new Date(); + nowTime.setTime(date); + nowTime.add(Calendar.MINUTE, newTime); + ass.setStopTime(nowTime.getTime()); + }else { + DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + //定时时间修改,删除之前定时任务 + Integer removeStartTaskId = xxlJobService.getJobIdByCustomId(ass.getId()+"start"); + Integer removeStopTaskId = xxlJobService.getJobIdByCustomId(ass.getId()+"stop"); + //删除任务 + if (!ObjectUtils.isEmpty(removeStartTaskId)){ + xxlJobService.remove(removeStartTaskId); + } + if (!ObjectUtils.isEmpty(removeStopTaskId)){ + xxlJobService.remove(removeStopTaskId); + } + //新增新任务 + Integer startTaskId = xxlJobService.addJustExecuteOnceJob( + assessment.getId()+"start", + dateFormat.parse(dateFormat.format(assessment.getStartTime())), + assessment.getId().toString(),"assessmentJobStart"); + //开始运行开启考核任务 + xxlJobService.start(startTaskId); + + Integer stopTaskId = xxlJobService.addJustExecuteOnceJob( + assessment.getId()+"stop", + dateFormat.parse(dateFormat.format(assessment.getStopTime())), + assessment.getId().toString(),"assessmentJobStop"); + //开始运行停止考核任务 + xxlJobService.start(stopTaskId); + }*/ + //学生列表不为空表示修改了学生列表 需对考试表进行删除 + if (!ass.getClassId().equals("1")) { + if (!ObjectUtils.isEmpty(ass.getStuInfo())) { + //先删除原有的再新增 + examMapper.delete(new QueryWrapper().eq("assessment_id", ass.getId())); + + for (ClassReq classreq : ass.getStuInfo()) { + examMapper.insert(new AssessmentExam().setAssessmentId(ass.getId()).setAccountId(classreq.getStuAccountId()).setClassId(classreq.getClassId())); + } + } + } + ret = baseMapper.updateById(ass); + return ret > 0 ? R.ok() : R.error(); + } + + @Override + public R getDetailById(Integer id) { + Assessment assessment = baseMapper.selectById(id); + List list = new ArrayList(); + //将classId循环出来获取到班级名称 + for (String classId : assessment.getClassId().split(",")) { + //根据班级id查询班级名称 + QueryWrapper queryWrapper1 = new QueryWrapper<>(); + queryWrapper1.eq("is_del", DelConstant.NOT_DEL); + queryWrapper1.eq("id", classId); + Class classes = classMapper.selectOne(queryWrapper1); + Class cla = new Class(); + cla.setId(Integer.valueOf(classes.getId())); + cla.setClassName(classes.getClassName()); + list.add(cla); + } + + List classReqList = new ArrayList(); + //当本次考核为指定范围时候 查询本次考核的所有学生 + if (assessment.getIsSpecify() == 1) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("assessment_id", assessment.getId()); + List assessmentExam = examMapper.selectList(queryWrapper); + + for (AssessmentExam exam : assessmentExam) { + ClassReq req = new ClassReq(); + req.setClassId(exam.getClassId()); + req.setStuAccountId(exam.getAccountId()); + classReqList.add(req); + + } + } + + assessment.setClassInfo(list); + assessment.setStuInfo(classReqList); + return R.ok().put("data", assessment); + } + + @Override + public R collectPaper(Integer id) { + //执行收卷操作需要对考核表考核状态进行修改以及学生考试表进行对学生考试状态修改 + Assessment assessment = new Assessment(); + assessment.setStatus(AssessmentConstant.EXAMINATION_STATE_STOP);//设置考核状态为已结束 + assessment.setId(id); + assessment.setStopTime(new Date()); + int ret = baseMapper.updateById(assessment); +// if (ret > 0) { +// //提前结束删除定时停止任务 +// Integer taskId = xxlJobService.getJobIdByCustomId(id + "stop"); +// //删除任务 +// xxlJobService.remove(taskId); +// +// QueryWrapper queryWrapper = new QueryWrapper<>(); +// queryWrapper.eq("assessment_id", id); +// List examList = examMapper.selectList(queryWrapper); +// +// if (examList.size() > 0) { +// //对学生考核表考核状态进行修改 +// UpdateWrapper updateWrapper = new UpdateWrapper<>(); +// updateWrapper.set("state", AssessmentConstant.EXAMINATION_STATE_STOP); +// updateWrapper.ne("state", AssessmentConstant.EXAMINATION_STATE_STOP); +// updateWrapper.set("stop_time", new Date()); +// updateWrapper.eq("assessment_id", id); +// //对考核状态不为已结束的修改状态 +// examMapper.update(new AssessmentExam(), updateWrapper); +// } +// +// } + return ret > 0 ? R.ok() : R.error(); + } + + @Transactional + @Override + public R enterExam(Integer assessmentId, Integer classId, Integer invitationCode, HttpServletRequest request) { + + String accountId = TokenUtils.getIdByJwtToken(request); + //根据考核id获取到考核信息 用于判断为第几种情况 + Assessment assessment = baseMapper.selectById(assessmentId); + //校验当启用验证码时候 输入的验证码为空弹出相应提示 + if (assessment.getIsEnableCode() == AssessmentConstant.IS_ENABLE_CODE) {//如果查询的考核启用验证码时候 + if (invitationCode == null) { + return R.error(ExceptionEnum.ASSESSMENT_ENABLE_CODE_NULL.getCode(), ExceptionEnum.ASSESSMENT_ENABLE_CODE_NULL.getMsg()); + } else if (!invitationCode.equals(assessment.getInvitationCode())) { + //校验输入的验证码是否与考核设置的验证码相匹配 + return R.error(ExceptionEnum.ASSESSMENT_ENABLE_CODE_NULL.getCode(), ExceptionEnum.ASSESSMENT_ENABLE_CODE_NULL.getMsg()); + } + + } + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("assessment_id", assessmentId); + queryWrapper.eq("account_id", accountId); + queryWrapper.eq("class_id", classId); + + AssessmentExam exam = examMapper.selectOne(queryWrapper); + if (exam == null) { + AssessmentExam addExam = new AssessmentExam(); + addExam.setAssessmentId(assessmentId); + addExam.setState(AssessmentConstant.EXAMINATION_STATE_START); + addExam.setClassId(classId); + addExam.setAccountId(Integer.valueOf(accountId)); + addExam.setExamTime(new Date()); + int inserRet = examMapper.insert(addExam); + if (inserRet < 1) { + throw new CustomException(ExceptionEnum.ENTER_EXAM_FAIL); + } + + } else { + + //进入考试将状态更改完进行中且添加学生开考时间 + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.set("state", AssessmentConstant.EXAMINATION_STATE_START); + updateWrapper.set("exam_time", new Date()); + updateWrapper.eq("assessment_id", assessmentId); + updateWrapper.eq("account_id", accountId); + updateWrapper.eq("class_id", classId); + + int updateRet = examMapper.update(new AssessmentExam(), updateWrapper); + if (updateRet < 1) { + throw new CustomException(ExceptionEnum.ENTER_EXAM_FAIL); + } + } + + EnterExamResp examResp = mapper.getUrl(assessmentId); + + //返回当前项目id及邀请码以及跳转路径 + return R.ok().put("projectId", assessment.getProjectId()).put("invitationCode", assessment.getInvitationCode()).put("assessmentInfo", assessment).put("url", examResp.getUrl()).put("info", examResp); + } + + @Override + public R getMineClass(Integer accountId) { + String throughLine = mapper.getMineClass(accountId); + + if (StringUtils.isNotEmpty(throughLine)) { + //将字符串变成数组,然后利用stream流变成集合 + List throughLines = Arrays.stream(throughLine.split(",")).collect(Collectors.toList()); + //利用stream流将集合去重 + List throughLineList = throughLines.stream().distinct().collect(Collectors.toList()); + //然后再用Stringuitls.join将集合变成逗号分开的字符串 + String thoughLineTarget = StringUtils.join(throughLineList, ","); + List classIdList = new ArrayList<>(); + for (String classId : thoughLineTarget.split(",")) { + if (!classId.equals("")) { + classIdList.add(Integer.valueOf(classId)); + } + + } + + List classList = classMapper.selectBatchIds(classIdList); + for (Class cla : classList) { + //拿到班级的上级年级以及上上级专业 + + if (cla.getId() != 1) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("id", cla.getArchitectureId()); + Architecture getGrade = architectureMapper.selectOne(wrapper); + //根据年级拿到专业信息 + QueryWrapper wrapper1 = new QueryWrapper<>(); + wrapper1.eq("id", getGrade.getParentId()); + Architecture getProfessional = architectureMapper.selectOne(wrapper1); + cla.setClassName(getProfessional.getOrganizationName() + "/" + getGrade.getOrganizationName() + "/" + cla.getClassName()); + } + } + return R.ok().put("list", classList); + + } + return R.ok(); + } + + @Override + public Set myClassByStudent(Integer accountId, Integer schoolId) { + List list = baseMapper.myClassByStudent(accountId, schoolId); + Set set = new HashSet<>(); + List classList = new ArrayList<>(); + list.stream().forEach(str -> { + if (str != null) { + if (str.contains(",")) { + for (String classId : str.split(",")) { + classList.add(classId); + set.addAll(new HashSet(classList)); + + } + } else { + classList.add(str); + set.addAll(new HashSet(classList)); + } + } + }); + return set; + } + + @Override + public R enableAssessment(Integer id) throws ParseException { + int ret = 0; + Assessment assessment = baseMapper.selectById(id); + assessment.setStatus(1);//状态(0、待开始 1、进行中 2、已结束) + if (assessment.getType() == 1) {//发布类型(1、手动发布 2、定时发布) + String time = assessment.getExperimentDuration(); + int d = time.indexOf("d"); + int h = time.indexOf("h"); + int m = time.indexOf("m"); + int dd = Integer.parseInt(time.substring(0, d)); + int hh = Integer.parseInt(time.substring(d + 1, h)); + int mm = Integer.parseInt(time.substring(h + 1, m)); + int newTime = dd * 24 * 60 + hh * 60 + mm; + Calendar nowTime = Calendar.getInstance(); + Date date = new Date(); + nowTime.setTime(date); + nowTime.add(Calendar.MINUTE, newTime); + assessment.setStopTime(nowTime.getTime()); + assessment.setStartTime(new Date()); + + } + //assessment.setIsEnableCode(1); + ret = baseMapper.updateById(assessment); + +// SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); +// Integer stopTaskId = xxlJobService.addJustExecuteOnceJob(assessment.getId() + "stop", dateFormat.parse(dateFormat.format(assessment.getStopTime())), assessment.getId().toString(), "assessmentJobStop"); +// //开始运行停止考核任务 +// xxlJobService.start(stopTaskId); + + return ret > 0 ? R.ok() : R.error(); + } + + @Override + public boolean checkReapt(Assessment assessment) { + //检验名称是否有相同的 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("experimental_name", assessment.getExperimentalName()); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + queryWrapper.eq("school_id", assessment.getSchoolId()); + if (assessment.getId() != null) { + queryWrapper.last(" and id != " + assessment.getId()); + } + + return baseMapper.selectOne(queryWrapper) == null; + } + + @Override + public boolean submitExam(Integer assessmentId, Integer classId, Integer accountId, Integer score) { + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("assessment_id", assessmentId); + queryWrapper.eq("account_id", accountId); + queryWrapper.eq("class_id", classId); + AssessmentExam exam = examMapper.selectOne(queryWrapper); + + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.set("state", 2);//考试状态(0、未考 1、在考 2、已考) + updateWrapper.set("stop_time", new Date()); + updateWrapper.set("time_cost", Long.valueOf(((new Date().getTime() - exam.getExamTime().getTime()) / 1000 / 60)).intValue()); + updateWrapper.set("score", score); + updateWrapper.eq("assessment_id", assessmentId); + updateWrapper.eq("account_id", accountId); + updateWrapper.eq("class_id", classId); + Integer ret = examMapper.update(new AssessmentExam(), updateWrapper); + return ret > 0; + } + + @Override + public R spliceClass(Integer assessmentId) { + String throughLine = mapper.spliceClass(assessmentId); + + if (StringUtils.isNotEmpty(throughLine)) { + //将字符串变成数组,然后利用stream流变成集合 + List throughLines = Arrays.stream(throughLine.split(",")).collect(Collectors.toList()); + //利用stream流将集合去重 + List throughLineList = throughLines.stream().distinct().collect(Collectors.toList()); + //然后再用Stringuitls.join将集合变成逗号分开的字符串 + String thoughLineTarget = StringUtils.join(throughLineList, ","); + List classIdList = new ArrayList<>(); + for (String classId : thoughLineTarget.split(",")) { + if (!classId.equals("")) { + classIdList.add(Integer.valueOf(classId)); + } + + } + + List classList = classMapper.selectBatchIds(classIdList); + for (Class cla : classList) { + //拿到班级的上级年级以及上上级专业 + + if (cla.getId() != 1) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("id", cla.getArchitectureId()); + Architecture getGrade = architectureMapper.selectOne(wrapper); + //根据年级拿到专业信息 + QueryWrapper wrapper1 = new QueryWrapper<>(); + wrapper1.eq("id", getGrade.getParentId()); + Architecture getProfessional = architectureMapper.selectOne(wrapper1); + cla.setClassName(getProfessional.getOrganizationName() + "/" + getGrade.getOrganizationName() + "/" + cla.getClassName()); + } + } + return R.ok().put("list", classList); + + } + return R.ok(); + } + + public static void main(String[] args) { + String throughLine = "6"; + //将字符串变成数组,然后利用stream流变成集合 + List throughLines = Arrays.stream(throughLine.split(",")).collect(Collectors.toList()); + //利用stream流将集合去重 + List throughLineList = throughLines.stream().distinct().collect(Collectors.toList()); + //然后再用Stringuitls.join将集合变成逗号分开的字符串 + String thoughLineTarget = StringUtils.join(throughLineList, ","); + System.out.println(thoughLineTarget); + } + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/CityServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/CityServiceImpl.java new file mode 100644 index 0000000..0f3bfcd --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/CityServiceImpl.java @@ -0,0 +1,29 @@ +package com.huoran.occupationlab.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.occupationlab.entity.City; +import com.huoran.occupationlab.mapper.CityMapper; +import com.huoran.occupationlab.service.CityService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 城市 服务实现类 + *

+ * + * @author Ning + * @since 2020-10-27 + */ +@Service +public class CityServiceImpl extends ServiceImpl implements CityService { + @Override + public List queryCity(Integer provinceId) { + QueryWrapper chapterWrapper = new QueryWrapper<>(); + chapterWrapper.eq("provinceId",provinceId); + chapterWrapper.select("*"); + return baseMapper.selectList(chapterWrapper); + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ClassServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ClassServiceImpl.java new file mode 100644 index 0000000..4cca60e --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ClassServiceImpl.java @@ -0,0 +1,42 @@ +package com.huoran.occupationlab.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.common.constant.DelConstant; +import com.huoran.occupationlab.entity.Class; +import com.huoran.occupationlab.mapper.ClassMapper; +import com.huoran.occupationlab.service.ClassService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 班级表 服务实现类 + *

+ * + * @author lr + * @since 2021-08-18 + */ +@Service +public class ClassServiceImpl extends ServiceImpl implements ClassService { + + @Override + public List chenckReapt(Class classes) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + queryWrapper.eq("architecture_id", classes.getArchitectureId()); + queryWrapper.eq("class_name", classes.getClassName()); + if (classes.getId() != null) { + queryWrapper.last(" and id != " + classes.getId()); + } + + List classList = baseMapper.selectList(queryWrapper); + return classList; + } + + @Override + public List getClassesUnderTheSchool(Integer schoolId) { + return baseMapper.getClassesUnderTheSchool(schoolId); + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ClientManagementServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ClientManagementServiceImpl.java new file mode 100644 index 0000000..9f78b07 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ClientManagementServiceImpl.java @@ -0,0 +1,131 @@ +package com.huoran.occupationlab.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.common.entity.NewClientManagement; +import com.huoran.occupationlab.entity.ClientManagement; +import com.huoran.occupationlab.mapper.ClientManagementMapper; +import com.huoran.occupationlab.service.ClientManagementService; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.List; + +/** + *

+ * 企业端客户管理 服务实现类 + *

+ * + * @author Ning + * @since 2020-10-27 + */ +@Service +public class ClientManagementServiceImpl extends ServiceImpl implements ClientManagementService { + + @Autowired + private ClientManagementMapper mapper; + + //查询客户列表 + @Override + public List queryList(HashMap map) { + Object cityId = map.get("cityId"); + Object provinceId = map.get("provinceId"); + Object searchContent = map.get("searchContent"); + QueryWrapper wrapper = new QueryWrapper<>(); + if (cityId != null) { + wrapper.eq("city_id", cityId); + } + if (provinceId != null) { + wrapper.eq("province_id", provinceId); + } + if (searchContent != null && searchContent != "") { + wrapper.like("client_name", searchContent).or().like("contact_person_name", searchContent).or().like("phone", searchContent); + } + wrapper.ne("id", 1); + return mapper.queryList(map); + } + + //查询客户列表数量 + @Override + public int queryListCount(HashMap map) { + Object cityId = map.get("cityId"); + Object provinceId = map.get("provinceId"); + Object searchContent = map.get("searchContent"); + QueryWrapper wrapper = new QueryWrapper<>(); + if (cityId != null) { + wrapper.eq("city_id", cityId); + } + if (provinceId != null) { + wrapper.eq("province_id", provinceId); + } + if (searchContent != null) { + wrapper.like("client_name", searchContent); + } + wrapper.ne("id", 1); + return baseMapper.selectCount(wrapper); + } + + //添加客户 + @Override + public boolean addClient(ClientManagement clientManagement) { + int size = baseMapper.insert(clientManagement); + return size > 0; + } + + //批量删除客户 + @Override + public boolean deleteClient(List clientIds) { + int size = baseMapper.deleteBatchIds(clientIds); + int sum = clientIds.size(); + for (int i = 0; i < sum; i++) { + Integer clientId = clientIds.get(i); + //删除该客户下的所有用户 + int deteleUser = baseMapper.deleteUser(clientId); + //删除该客户下的所有员工 + int deteleStaff = baseMapper.deleteStaff(clientId); + //删除该客户下的所有员工 + int deteleStudent = baseMapper.deleteStudent(clientId); + } + return size > 0; + } + + //修改客户 + @Override + public boolean updateClient(ClientManagement clientManagement) { + int size = baseMapper.updateById(clientManagement); + return size > 0; + } + + //查询客户列表数量 + @Override + public int queryClientNameSize(String clientName) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("client_name", clientName); + return baseMapper.selectCount(wrapper); + } + + //查询客户名称 + @Override + public List getClientName(String clientName) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("client_name", clientName); + return baseMapper.selectList(wrapper); + } + + //查询客户名称 + @Override + public NewClientManagement queryOneClient(String clientName) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("client_name", clientName); + NewClientManagement newClientManagement = new NewClientManagement(); + ClientManagement clientManagement = baseMapper.selectOne(wrapper); + if (clientManagement != null) { + BeanUtils.copyProperties(clientManagement, newClientManagement); + return newClientManagement; + } else { + return null; + } + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ColumnServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ColumnServiceImpl.java new file mode 100644 index 0000000..1d7aaa5 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ColumnServiceImpl.java @@ -0,0 +1,209 @@ +package com.huoran.occupationlab.service.impl; + +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.occupationlab.entity.Column; +import com.huoran.occupationlab.entity.vo.ColumnSort; +import com.huoran.occupationlab.entity.vo.ColumnTree; +import com.huoran.occupationlab.mapper.ColumnMapper; +import com.huoran.occupationlab.service.ColumnService; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +/** + *

+ * 栏目表 服务实现类 + *

+ * + * @author chen + * @since 2020-10-15 + */ +@Service +public class ColumnServiceImpl extends ServiceImpl implements ColumnService { + + @Override + public boolean updateSort(ColumnSort columnSort) { + /*List firstColumnList = columnSort.getColumnTree(); + if (firstColumnList != null && firstColumnList.size() != 0) { + firstColumnList.forEach(firstColumn -> { + Column column1 = new Column(); + BeanUtils.copyProperties(firstColumn, column1); + baseMapper.updateById(column1); + List secondColumnList = firstColumn.getSecondColumn(); + if (secondColumnList != null && secondColumnList.size() != 0) { + secondColumnList.forEach(secondColumn -> { + Column column2 = new Column(); + BeanUtils.copyProperties(secondColumn, column2); + baseMapper.updateById(column2); + }); + } + }); + return true; + }*/ + //获取所有栏目 + List columnTree = columnSort.getColumnTree(); + update(columnTree); + return true; + } + + /** + * 使用递归方法 + */ + public void update(List columns) { + int count = 1; + for (ColumnTree column : columns) { + Column column1 = new Column(); + column1.setSort(count++); + BeanUtils.copyProperties(column, column1); + baseMapper.updateById(column1); + if (ObjectUtil.isNotNull(column.getChildren()) && column.getChildren().size()>0){ + update(column.getChildren()); + /*for (ColumnTree child : column.getChildren()) { + Column column2 = new Column(); + BeanUtils.copyProperties(child, column2); + baseMapper.updateById(column2); + if (ObjectUtil.isNotNull(child.getChildren()) && child.getChildren().size()>0){ + + } + }*/ + } + } + } + + @Override + public List columnTree(Integer schoolId,String platformId) { + QueryWrapper columnWrapper = new QueryWrapper<>(); + columnWrapper.eq("school_id", schoolId); + // columnWrapper.eq("platform_id", platformId); + columnWrapper.orderByAsc("sort"); + List columns = baseMapper.selectList(columnWrapper); + return build(columns); + } + + /** + * 使用递归方法构建权限菜单 + */ + public List build(List columns) { + List trees = new ArrayList<>(); + for (Column column : columns) { + if (column.getParentId()==0) { + trees.add(findChildren(column, columns)); + } + } + return trees; + } + + /** + * 递归查找子节点 + */ + public Column findChildren(Column treeNode, List treeNodes) { + treeNode.setChildren(new ArrayList<>()); + + for (Column it : treeNodes) { + + if (treeNode.getId().equals(it.getParentId())) { + if (treeNode.getChildren() == null) { + treeNode.setChildren(new ArrayList<>()); + } + treeNode.getChildren().add(findChildren(it, treeNodes)); + } + } + return treeNode; + } + + @Override + public boolean saveColumn(Column column) { + //添加栏目时查询一级栏目数量 + /*if (column.getParentId()==0) { + //查询一级栏目的总数 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("parent_id", 0); + wrapper.eq("platform_id", column.getPlatformId()); + wrapper.eq("school_id", column.getSchoolId()); + int count = baseMapper.selectCount(wrapper); + if (count == 10) { + throw new CustomException(ExceptionEnum.ADD_COLUMNS_FAILED); + } + //没有一级栏目时,序号为1 + if (count == 0) { + column.setSort(1); + } else { + //查询一级栏目最大排序数 + count = baseMapper.selectFirstMaxSort(); + column.setSort(count + 1); + } + int insert = baseMapper.insert(column); + return insert > 0; + } + //查询二级栏目的总数 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("parent_id", column.getParentId()); + wrapper.eq("school_id", column.getSchoolId()); + wrapper.eq("platform_id", column.getPlatformId()); + int count = baseMapper.selectCount(wrapper); + //没有二级栏目时,序号为1 + if (count == 0) { + column.setSort(1); + } else { + //查询二级栏目最大排序数 + count = baseMapper.selectSecondMaxSort(column.getParentId(), column.getSchoolId()); + column.setSort(count + 1); + }*/ + int insert = baseMapper.insert(column); + return insert > 0; + } + + @Override + public boolean removeColumn(Integer columnId) { + /*//查询当前分类下的所有子分类,0为分类,1为团队 + List ids = baseMapper.selectIdByPid(columnId); + ids.add(columnId);*/ + + + //批量进行删除 + int i = baseMapper.deleteById(columnId); + return i>0; + } + + @Override + public boolean repeat(Column column) { + Integer parentId = column.getParentId(); + String name = column.getName(); + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("parent_id", parentId); + wrapper.eq("name", name); + // wrapper.eq("platform_id", column.getPlatformId()); + wrapper.eq("school_id", column.getSchoolId()); + if (column.getId() != null) { + wrapper.last(" and id != " + column.getId()); + } + Integer count = baseMapper.selectCount(wrapper); + return count > 0; + } + + @Override + public List firstLevelColumn(Integer schoolId) { + //一级栏目查询 + QueryWrapper firstColumnWrapper = new QueryWrapper<>(); + firstColumnWrapper.eq("parent_id", 1); + firstColumnWrapper.eq("school_id", schoolId); + firstColumnWrapper.orderByAsc("sort"); + List firstColumns = baseMapper.selectList(firstColumnWrapper); + return firstColumns; + } + + @Override + public List secondaryColumnsByFirst(String id, Integer schoolId) { + //二级栏目查询 + QueryWrapper secondColumnWrapper = new QueryWrapper<>(); + secondColumnWrapper.eq("parent_id", id); + secondColumnWrapper.eq("school_id", schoolId); + secondColumnWrapper.orderByAsc("sort"); + List secondColumns = baseMapper.selectList(secondColumnWrapper); + return secondColumns; + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ContestAnnexServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ContestAnnexServiceImpl.java new file mode 100644 index 0000000..d609f78 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ContestAnnexServiceImpl.java @@ -0,0 +1,34 @@ +package com.huoran.occupationlab.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.common.constant.DelConstant; +import com.huoran.occupationlab.entity.ContestAnnex; +import com.huoran.occupationlab.entity.ContestRange; +import com.huoran.occupationlab.mapper.ContestAnnexMapper; +import com.huoran.occupationlab.service.ContestAnnexService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 赛事附件 服务实现类 + *

+ * + * @author lr + * @since 2022-06-16 + */ +@Service +public class ContestAnnexServiceImpl extends ServiceImpl implements ContestAnnexService { + + @Override + public List getContestAnnexByContestId(String contestId) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("contest_id",contestId); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + List contestAnnexList = baseMapper.selectList(queryWrapper); + + return contestAnnexList; + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ContestAnnouncementAnnexServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ContestAnnouncementAnnexServiceImpl.java new file mode 100644 index 0000000..dc0b6d1 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ContestAnnouncementAnnexServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.occupationlab.service.impl; + +import com.huoran.occupationlab.entity.ContestAnnouncementAnnex; +import com.huoran.occupationlab.mapper.ContestAnnouncementAnnexMapper; +import com.huoran.occupationlab.service.ContestAnnouncementAnnexService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 大赛公告附件存储 服务实现类 + *

+ * + * @author lr + * @since 2022-06-17 + */ +@Service +public class ContestAnnouncementAnnexServiceImpl extends ServiceImpl implements ContestAnnouncementAnnexService { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ContestAnnouncementServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ContestAnnouncementServiceImpl.java new file mode 100644 index 0000000..7e917fa --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ContestAnnouncementServiceImpl.java @@ -0,0 +1,30 @@ +package com.huoran.occupationlab.service.impl; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.ContestAnnouncement; +import com.huoran.occupationlab.entity.vo.ContestVO; +import com.huoran.occupationlab.mapper.ContestAnnouncementMapper; +import com.huoran.occupationlab.service.ContestAnnouncementService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 赛事公告 服务实现类 + *

+ * + * @author lr + * @since 2022-06-17 + */ +@Service +public class ContestAnnouncementServiceImpl extends ServiceImpl implements ContestAnnouncementService { + + @Override + public R queryAnnouncementByContestId(String contestId,Integer pageNum,Integer pageSize) { + Page page = new Page(pageNum, pageSize); + IPage pageList = baseMapper.queryAnnouncementByContestId(page, contestId); + return R.ok().put("data", pageList); + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ContestProgressServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ContestProgressServiceImpl.java new file mode 100644 index 0000000..f7c5ff6 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ContestProgressServiceImpl.java @@ -0,0 +1,29 @@ +package com.huoran.occupationlab.service.impl; + + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.occupationlab.entity.ContestProgress; +import com.huoran.occupationlab.mapper.ContestProgressMapper; +import com.huoran.occupationlab.service.ContestProgressService; +import org.springframework.stereotype.Service; + +/** + *

+ * 竞赛进展表 服务实现类 + *

+ * + * @author chen + * @since 2020-10-15 + */ +@Service +public class ContestProgressServiceImpl extends ServiceImpl implements ContestProgressService { + @Override + public boolean repeat(ContestProgress contestProgress) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("title", contestProgress.getTitle()); + wrapper.eq("contest_id", contestProgress.getContestId()); + Integer count = baseMapper.selectCount(wrapper); + return count > 0; + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ContestRangeServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ContestRangeServiceImpl.java new file mode 100644 index 0000000..5c104e3 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ContestRangeServiceImpl.java @@ -0,0 +1,80 @@ +package com.huoran.occupationlab.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.common.constant.DelConstant; +import com.huoran.occupationlab.entity.ContestRange; +import com.huoran.common.entity.School; +import com.huoran.occupationlab.entity.resp.ContestRangeResp; +import com.huoran.occupationlab.mapper.ContestRangeMapper; +import com.huoran.occupationlab.service.ContestRangeService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 服务实现类 + *

+ * + * @author lr + * @since 2022-06-16 + */ +@Service +public class ContestRangeServiceImpl extends ServiceImpl implements ContestRangeService { + + @Override + public List getContestRangeByContestId(String contestId) { + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("contest_id", contestId); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + List contestRangeList = baseMapper.selectList(queryWrapper); + + return contestRangeList; + } + + @Override + public List getRangeByContestId(String contestId) { + return baseMapper.getRangeByContestId(contestId); + } + + @Override + public boolean checkWhetherToParticipate(School school, String contestId) { + //校验地区范围为学校的标准 + QueryWrapper queryWrapper1 = new QueryWrapper<>(); + queryWrapper1.eq("type", 0); + queryWrapper1.eq("is_del", 0); + queryWrapper1.eq("school_id", school.getSchoolId()); + queryWrapper1.eq("contest_id", contestId); + List schoolList1 = baseMapper.selectList(queryWrapper1); + + //校验地区范围为省的标准 + QueryWrapper queryWrapper2 = new QueryWrapper<>(); + queryWrapper2.eq("contest_id", contestId); + queryWrapper2.eq("type", 1); + queryWrapper2.eq("is_del", 0); + queryWrapper2.eq("province_id", school.getProvinceId()); + List schoolList2 = baseMapper.selectList(queryWrapper2); + + //校验地区范围为市的标准 + QueryWrapper queryWrapper3 = new QueryWrapper<>(); + queryWrapper3.eq("type", 1); + queryWrapper3.eq("is_del", 0); + queryWrapper3.eq("province_id", school.getProvinceId()); + queryWrapper3.eq("city_id", school.getCityId()); + queryWrapper3.eq("contest_id", contestId); + List schoolList3 = baseMapper.selectList(queryWrapper3); + + if (schoolList1.size() <= 0 && schoolList2.size() <= 0 && schoolList3.size() <= 0) { + return true; //你所在院校不符合参赛要求,无法报名! + } + + return false; + } + + /*@Override + public List getRangeDetailByContestId(String contestId,Integer type) { + return baseMapper.getRangeDetailByContestId(contestId, type); + }*/ +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ContestServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ContestServiceImpl.java new file mode 100644 index 0000000..1bee803 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ContestServiceImpl.java @@ -0,0 +1,234 @@ +package com.huoran.occupationlab.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.huoran.common.response.R; +import com.huoran.occupationlab.entity.Applicant; +import com.huoran.occupationlab.entity.Contest; +import com.huoran.occupationlab.entity.ContestProgress; +import com.huoran.occupationlab.entity.req.AfterLoginPageContestListReq; +import com.huoran.occupationlab.entity.req.PageContestListReq; +import com.huoran.occupationlab.entity.vo.ContestVO; +import com.huoran.occupationlab.mapper.ApplicantMapper; +import com.huoran.occupationlab.mapper.ContestProgressMapper; +import com.huoran.occupationlab.mapper.ContestMapper; +import com.huoran.occupationlab.mapper.ContestRangeMapper; +import com.huoran.occupationlab.service.ContestService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.List; +import java.util.stream.Collectors; + +/** + *

+ * 竞赛管理表 服务实现类 + *

+ * + * @author chen + * @since 2020-10-15 + */ +@Service +public class ContestServiceImpl extends ServiceImpl implements ContestService { + + @Autowired + private ApplicantMapper applicantMapper; + + @Autowired + private ContestProgressMapper contestProgressMapper; + + + @Autowired + private ContestRangeMapper contestRangeMapper; + + @Override + public boolean removeContest(String contestId) { + // 删除该赛事报名人员数 + QueryWrapper applicantWrapper = new QueryWrapper<>(); + applicantWrapper.eq("contest_id", contestId); + applicantWrapper.select("id"); + List applicants = applicantMapper.selectList(applicantWrapper); + if (applicants != null && applicants.size() != 0) { + List applicantIds = applicants.stream().map(Applicant::getId).collect(Collectors.toList()); + applicantMapper.deleteBatchIds(applicantIds); + } + // 删除赛事进展 + QueryWrapper contestProgressWrapper = new QueryWrapper<>(); + contestProgressWrapper.eq("contest_id", contestId); + contestProgressWrapper.select("id"); + List contestProgressList = contestProgressMapper.selectList(contestProgressWrapper); + if (contestProgressList != null && contestProgressList.size() != 0) { + List contestProgressIds = contestProgressList.stream().map(ContestProgress::getId).collect(Collectors.toList()); + contestProgressMapper.deleteBatchIds(contestProgressIds); + } + // 删除赛事 + int delete = baseMapper.deleteById(contestId); + return delete > 0; + } + + /* @Override + public List contestPageConditionQuery(HashMap map) { + return baseMapper.selectContestByCondition(map); + } + + @Override + public int contestPageConditionCount(HashMap map) { + return baseMapper.selectContestCountByCondition(map); + }*/ + + @Override + public void pageQuery(Page page, String name, String way, Integer schoolId) { + QueryWrapper wrapper = new QueryWrapper<>(); + //查询发布的赛事 + wrapper.eq("publish_status", 0); + wrapper.eq("school_id", schoolId); + if (StringUtils.isNotEmpty(way) && "0".equals(way)) { + //最近更新时间 + wrapper.orderByDesc("gmt_modified"); + } else { + //默然最近报名时间排序 + wrapper.orderByAsc("sign_up_start_time"); + } + if (StringUtils.isNotEmpty(name)) { + wrapper.like("name", name); + } + baseMapper.selectPage(page, wrapper); + } + + /** + * 创建大赛:名字判重逻辑 + * 2022-06.16当前判重逻辑——>比赛范围为非本校内的比赛,名字要全平台判重。本校内的竞赛名字,只需要本校内判重。 + * + * @param contest + * @return + */ + @Override + public boolean repeat(Contest contest) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("name", contest.getName()); + //大赛范围(0:本校内 1:全平台 2:指定区域、院校) + switch (contest.getCompetitionScope()) { + case 0: + wrapper.eq("school_id", contest.getSchoolId()); + break; + } + if (contest.getId()!=null) { + wrapper.last(" and id != " + contest.getId()); + } + Integer count = baseMapper.selectCount(wrapper); + return count > 0; + } + + @Override + public R contestPageConditionQueryByNakadai(PageContestListReq req) { + Page page = new Page(req.getPageNum(), req.getPageSize()); + IPage pageList = baseMapper.contestPageConditionQueryByNakadai(page, req); + return R.ok().put("data", pageList); + } + + @Override + public R contestPageConditionQueryByOccupationlab(PageContestListReq req) { + Page page = new Page(req.getPageNum(), req.getPageSize()); + IPage pageList = baseMapper.contestPageConditionQueryByOccupationlab(page, req); + + //大赛范围(0:本校内 1:全平台 2:指定区域、院校) + pageList.getRecords().forEach(contestVO -> { + if (contestVO.getCompetitionScope() == 1) { + contestVO.setRange("全平台"); + } else if (contestVO.getCompetitionScope() == 2) { + contestVO.setRange("指定范围"); + //依据赛事id查询指定范围的省、市、学校 + contestVO.setContestRangeRespList(contestRangeMapper.getRangeByContestId(contestVO.getId())); + } else if (contestVO.getCompetitionScope() == 0) { + contestVO.setRange("本校内"); + } + }); + return R.ok().put("data", pageList); + } + + + /** + * 学生端——登录前赛事 + * @param pageContestListReq + * @return + */ + @Override + public R notLoggedInBeforeStudentEvents(PageContestListReq pageContestListReq) { + Page page = new Page(pageContestListReq.getPageNum(), pageContestListReq.getPageSize()); + IPage pageList = null; + //大赛范围(0:本校内 1:全平台 2.指定区域、院校) 3表示不限 + switch (pageContestListReq.getCompetitionScope()) { + case "3": + case "1": + pageList = baseMapper.allContestsByStu(page, pageContestListReq); + break; + case "2": + pageList = baseMapper.designatedRangeCompetitionByStu(page, pageContestListReq); + break; + } + + return getR(pageList); + } + + /** + * 学生端——登录后赛事 + * @param req + * @return + */ + @Override + public R contestAfterLogin(AfterLoginPageContestListReq req) { + Page page = new Page(req.getPageNum(), req.getPageSize()); + IPage pageList = null; + //赛事类型(1.本校赛事/2.赛事广场/3.已报名赛事) + switch (req.getEventType()){ + case 1: + pageList = baseMapper.schoolCompetition(page, req); + break; + case 2: + if (req.getCompetitionScope().equals("3")){ + req.setCompetitionScope(null); + } + pageList = baseMapper.tournamentSquare(page,req); + break; + case 3: + + switch (req.getCompetitionScope()){//大赛范围(0:本校内 1:全平台 2.指定区域、院校 3.不限) + //已报名赛事——修改为依据学生报名时间排序 + case "0": + case "1": + case "3": + if (req.getCompetitionScope().equals("3")){ + req.setCompetitionScope(null); + } + pageList =baseMapper.registeredBySchoolAndAllPlatforms(page,req); + break; + case "2": + pageList = baseMapper.registeredBySpecifiedRange(page,req); + break; + + + } + break; + } + return getR(pageList); + } + + private R getR(IPage pageList) { + pageList.getRecords().forEach(contest -> { + if (contest.getCompetitionScope() == 1) { + contest.setRange("全平台"); + } else if (contest.getCompetitionScope() == 2) { + contest.setRange("指定范围"); + //依据赛事id查询指定范围的省、市、学校 + contest.setContestRangeRespList(contestRangeMapper.getRangeByContestId(contest.getId())); + } else if (contest.getCompetitionScope() == 0) { + contest.setRange("本校内"); + } + }); + return R.ok().put("data", pageList); + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/CourseChapterServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/CourseChapterServiceImpl.java new file mode 100644 index 0000000..a2383b3 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/CourseChapterServiceImpl.java @@ -0,0 +1,165 @@ +package com.huoran.occupationlab.service.impl; + +import com.aliyun.oss.OSSClient; +import com.aliyuncs.exceptions.ClientException; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.common.utils.AliyunOssUtil; +import com.huoran.common.utils.VideoUtil; +import com.huoran.occupationlab.entity.CourseChapter; +import com.huoran.occupationlab.entity.CourseSubsection; +import com.huoran.occupationlab.entity.vo.ChapterVO; +import com.huoran.occupationlab.entity.vo.SortVO; +import com.huoran.occupationlab.entity.vo.SubsectionVO; +import com.huoran.occupationlab.mapper.CourseChapterMapper; +import com.huoran.occupationlab.mapper.CourseSubsectionMapper; +import com.huoran.occupationlab.service.CourseChapterService; +import org.apache.commons.lang3.StringUtils; +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.util.ArrayList; +import java.util.List; + +/** + * 课程章节 服务实现类 + * + * @author chen + * @since 2020-09-30 + */ +@Service +public class CourseChapterServiceImpl extends ServiceImpl implements CourseChapterService { + + @Autowired + private CourseSubsectionMapper courseSubsectionMapper; + + @Override + public List getChapterTree(String courseId) { + // 根据课程ID查询所有章节 + QueryWrapper chapterWrapper = new QueryWrapper<>(); + chapterWrapper.eq("course_id", courseId); + //降序查询 + chapterWrapper.orderByAsc("sort"); + List chapters = baseMapper.selectList(chapterWrapper); + + // 根据课程ID查询所有小节 + QueryWrapper subsectionWrapper = new QueryWrapper<>(); + subsectionWrapper.eq("course_id", courseId); + //降序查询 + subsectionWrapper.orderByAsc("sort"); + List subsections = courseSubsectionMapper.selectList(subsectionWrapper); + + List chapterVOList = new ArrayList<>(); + // 遍历封装 + for (CourseChapter c : chapters) { + ChapterVO chapterVO = new ChapterVO(); + //属性复制 + BeanUtils.copyProperties(c, chapterVO); + chapterVOList.add(chapterVO); + + List subsectionVOList = new ArrayList<>(); + for (CourseSubsection s : subsections) { + //判断小节是否属于某一章节 + if (StringUtils.equals(c.getId(), s.getChapterId())) { + SubsectionVO subsectionVO = new SubsectionVO(); + BeanUtils.copyProperties(s, subsectionVO); + subsectionVOList.add(subsectionVO); + } + } + //设置小节 + chapterVO.setSubsectionList(subsectionVOList); + } + return chapterVOList; + } + + /** + * 删除章节,删除小节及资源 + * + * @param chapterId 章节id + */ + @Transactional + @Override + public boolean removeChapter(String chapterId) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("chapter_id", chapterId); + List courseSubsections = courseSubsectionMapper.selectList(wrapper); + + if (courseSubsections != null && courseSubsections.size() != 0) { + //循环删除小节 + courseSubsections.forEach(subsection -> { + //删除资源 + boolean isVideo = VideoUtil.isVideo(subsection.getFileType()); + if (isVideo) { + try { + AliyunOssUtil.removeVideo(subsection.getFileId()); + } catch (ClientException e) { + e.printStackTrace(); + } + } else { + List keys = new ArrayList<>(); + keys.add(subsection.getFileName()); + try { + AliyunOssUtil.removeMoreVideo(keys); + } catch (ClientException e) { + e.printStackTrace(); + } + } + courseSubsectionMapper.deleteById(subsection.getId()); + }); + } + int count = baseMapper.deleteById(chapterId); + return count > 0; + } + + @Override + public boolean saveChapter(CourseChapter courseChapter) { + //查询课程章节的总数 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("course_id", courseChapter.getCourseId()); + int count = baseMapper.selectCount(wrapper); + if (count == 0) { + courseChapter.setSort(1); + } else { + //查询课程章节最大排序数 + count = baseMapper.selectMaxSort(); + courseChapter.setSort(count + 1); + } + int insert = baseMapper.insert(courseChapter); + return insert > 0; + } + + @Override + public boolean updateSort(SortVO sortVO) { + List chapterVOList = sortVO.getChapterVOList(); + if (chapterVOList != null && chapterVOList.size() != 0) { + chapterVOList.forEach(chapterVO -> { + CourseChapter courseChapter = new CourseChapter(); + courseChapter.setId(chapterVO.getId()); + courseChapter.setSort(chapterVO.getSort()); + baseMapper.updateById(courseChapter); + List subsectionList = chapterVO.getSubsectionList(); + if (subsectionList != null && subsectionList.size() != 0) { + subsectionList.forEach(subsectionVO -> { + CourseSubsection courseSubsection = new CourseSubsection(); + courseSubsection.setId(subsectionVO.getId()); + courseSubsection.setSort(subsectionVO.getSort()); + courseSubsectionMapper.updateById(courseSubsection); + }); + } + }); + return true; + } + return false; + } + + @Override + public boolean repeat(CourseChapter courseChapter) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("course_id", courseChapter.getCourseId()); + wrapper.eq("name", courseChapter.getName()); + Integer count = baseMapper.selectCount(wrapper); + return count > 0; + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/CourseClassificationServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/CourseClassificationServiceImpl.java new file mode 100644 index 0000000..04e7103 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/CourseClassificationServiceImpl.java @@ -0,0 +1,29 @@ +package com.huoran.occupationlab.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.occupationlab.entity.EduCourseClassification; +import com.huoran.occupationlab.mapper.CourseClassificationMapper; +import com.huoran.occupationlab.service.CourseClassificationService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 课程类别 服务实现类 + * + * @author chen + * @since 2020-09-30 + */ +@Service +public class CourseClassificationServiceImpl extends ServiceImpl implements CourseClassificationService { + + @Override + public List queryGlClassification(String schoolId) { + return baseMapper.selectGlClassification(schoolId); + } + + @Override + public List checkReapt(EduCourseClassification classification) { + return baseMapper.checkReapt(classification); + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/CourseServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/CourseServiceImpl.java new file mode 100644 index 0000000..d06e6c0 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/CourseServiceImpl.java @@ -0,0 +1,156 @@ +package com.huoran.occupationlab.service.impl; + +import com.aliyuncs.exceptions.ClientException; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.common.utils.AliyunOssUtil; +import com.huoran.common.utils.VideoUtil; +import com.huoran.occupationlab.entity.CourseChapter; +import com.huoran.occupationlab.entity.CourseSubsection; +import com.huoran.occupationlab.entity.EduCourse; +import com.huoran.occupationlab.entity.SchoolCourse; +import com.huoran.occupationlab.entity.vo.CourseVO; +import com.huoran.occupationlab.mapper.CourseChapterMapper; +import com.huoran.occupationlab.mapper.CourseMapper; +import com.huoran.occupationlab.mapper.CourseSubsectionMapper; +import com.huoran.occupationlab.mapper.SchoolCourseMapper; +import com.huoran.occupationlab.service.CourseService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 课程基本信息 服务实现类 + * + * @author chen + * @since 2020-09-30 + */ +@Service +public class CourseServiceImpl extends ServiceImpl implements CourseService { + + @Autowired + private CourseMapper courseMapper; + + @Autowired + private CourseChapterMapper courseChapterMapper; + + @Autowired + private CourseSubsectionMapper courseSubsectionMapper; + + @Autowired + private SchoolCourseMapper schoolCourseMapper; + + @Override + public List coursePageConditionQuery(HashMap map) { + return courseMapper.selectCourseByCondition(map); + } + + @Override + public int coursePageConditionCount(HashMap map) { + return courseMapper.selectCourseCountByCondition(map); + } + + /** + * 删除课程、删除课程下的章节、小节及资源 + * + * @param courseId 课程id + */ + @Transactional + @Override + public boolean removeCourse(String courseId) { + //删除小节 + QueryWrapper subsectionWrapper = new QueryWrapper<>(); + subsectionWrapper.eq("course_id", courseId); + List courseSubsections = courseSubsectionMapper.selectList(subsectionWrapper); + if (courseSubsections != null && courseSubsections.size() != 0) { + courseSubsections.forEach(subsection -> { + //删除资源 + boolean isVideo = VideoUtil.isVideo(subsection.getFileType()); + if (isVideo) { + try { + AliyunOssUtil.removeVideo(subsection.getFileId()); + } catch (ClientException e) { + e.printStackTrace(); + } + } else { + List keys = new ArrayList<>(); + keys.add(subsection.getFileName()); + try { + AliyunOssUtil.removeMoreVideo(keys); + } catch (ClientException e) { + e.printStackTrace(); + } + } + courseSubsectionMapper.deleteById(subsection.getId()); + }); + } + //删除章节 + QueryWrapper chapterWrapper = new QueryWrapper<>(); + chapterWrapper.eq("course_id", courseId); + chapterWrapper.select("id"); + List courseChapters = courseChapterMapper.selectList(chapterWrapper); + if (courseChapters != null && courseChapters.size() != 0) { + //获取章节id集 + List chapterIds = courseChapters.stream().map(CourseChapter::getId).collect(Collectors.toList()); + courseChapterMapper.deleteBatchIds(chapterIds); + } + + EduCourse course = baseMapper.selectById(courseId); + //删除课程封面 + if (course != null) { + String fileUrl = course.getCoverUrl(); + String fileName = fileUrl.substring(fileUrl.indexOf("/", 9) + 1); + List key = new ArrayList<>(); + key.add(fileName); + try { + AliyunOssUtil.removeMoreVideo(key); + } catch (ClientException e) { + e.printStackTrace(); + } + } + //删除学校与课程对应关系 + schoolCourseMapper.delete(new QueryWrapper().eq("course_id", courseId)); + //删除课程 + int count = baseMapper.deleteById(courseId); + return count > 0; + } + + /** + * 批量删除课程、删除课程下的章节、小节及资源 + * + * @param courseIds 多个课程id + */ + @Override + public boolean deleteCourses(List courseIds) { + if (courseIds != null && courseIds.size() != 0) { + courseIds.forEach(this::removeCourse); + } + return true; + } + + @Override + public boolean repeat(EduCourse course) { + QueryWrapper courseQueryWrapper = new QueryWrapper<>(); + courseQueryWrapper.eq("school_id", course.getSchoolId()); + courseQueryWrapper.eq("name", course.getName()); + Integer count = baseMapper.selectCount(courseQueryWrapper); + return count > 0; + } + + @Override + public void addChapter(EduCourse course) { + CourseChapter courseChapter = new CourseChapter(); + courseChapter.setCourseId(course.getId()); + courseChapter.setSort(1); + courseChapter.setName("第一章"); + courseChapter.setGmtCreate(new Date()); + courseChapter.setGmtModified(new Date()); + courseChapterMapper.insert(courseChapter); + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/CourseSubsectionServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/CourseSubsectionServiceImpl.java new file mode 100644 index 0000000..3934d9d --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/CourseSubsectionServiceImpl.java @@ -0,0 +1,76 @@ +package com.huoran.occupationlab.service.impl; + +import com.aliyuncs.exceptions.ClientException; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.common.utils.AliyunOssUtil; +import com.huoran.common.utils.VideoUtil; +import com.huoran.occupationlab.entity.CourseSubsection; +import com.huoran.occupationlab.mapper.CourseSubsectionMapper; +import com.huoran.occupationlab.service.CourseSubsectionService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.List; + +/** + * 课程小节 服务实现类 + * + * @author chen + * @since 2020-09-30 + */ +@Service +public class CourseSubsectionServiceImpl extends ServiceImpl implements CourseSubsectionService { + + /** + * 删除小节及资源 + * + * @param subsectionId 小节id + */ + @Transactional + @Override + public boolean removeSubsection(String subsectionId) throws ClientException { + CourseSubsection courseSubsection = baseMapper.selectById(subsectionId); + String fileType = courseSubsection.getFileType(); + //删除资源 + boolean isVideo = VideoUtil.isVideo(fileType); + if (isVideo) { + AliyunOssUtil.removeVideo(courseSubsection.getFileId()); + } else { + List keys = new ArrayList<>(); + keys.add(courseSubsection.getFileName()); + AliyunOssUtil.deleteFiles(keys); + } + //删除小节 + int count = baseMapper.deleteById(subsectionId); + return count > 0; + } + + @Override + public boolean saveSubsection(CourseSubsection courseSubsection) { + //查询章节小节的总数 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("chapter_id", courseSubsection.getChapterId()); + int count = baseMapper.selectCount(wrapper); + if (count == 0) { + courseSubsection.setSort(1); + } else { + //查询章节小节最大排序数 + count = baseMapper.selectMaxSort(); + courseSubsection.setSort(count + 1); + } + int insert = baseMapper.insert(courseSubsection); + return insert > 0; + } + + @Override + public boolean repeat(CourseSubsection courseSubsection) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("chapter_id", courseSubsection.getChapterId()); + wrapper.eq("course_id", courseSubsection.getCourseId()); + wrapper.eq("name", courseSubsection.getName()); + Integer count = baseMapper.selectCount(wrapper); + return count > 0; + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/EntrepreneurialActivityAnnouncementAnnexServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/EntrepreneurialActivityAnnouncementAnnexServiceImpl.java new file mode 100644 index 0000000..54d8964 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/EntrepreneurialActivityAnnouncementAnnexServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.occupationlab.service.impl; + +import com.huoran.occupationlab.entity.EntrepreneurialActivityAnnouncementAnnex; +import com.huoran.occupationlab.mapper.EntrepreneurialActivityAnnouncementAnnexMapper; +import com.huoran.occupationlab.service.EntrepreneurialActivityAnnouncementAnnexService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 活动公告附件表 服务实现类 + *

+ * + * @author lr + * @since 2023-05-12 + */ +@Service +public class EntrepreneurialActivityAnnouncementAnnexServiceImpl extends ServiceImpl implements EntrepreneurialActivityAnnouncementAnnexService { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/EntrepreneurialActivityAnnouncementServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/EntrepreneurialActivityAnnouncementServiceImpl.java new file mode 100644 index 0000000..db783c0 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/EntrepreneurialActivityAnnouncementServiceImpl.java @@ -0,0 +1,29 @@ +package com.huoran.occupationlab.service.impl; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.EntrepreneurialActivityAnnouncement; +import com.huoran.occupationlab.mapper.EntrepreneurialActivityAnnouncementMapper; +import com.huoran.occupationlab.service.EntrepreneurialActivityAnnouncementService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 活动公告表 服务实现类 + *

+ * + * @author lr + * @since 2023-05-12 + */ +@Service +public class EntrepreneurialActivityAnnouncementServiceImpl extends ServiceImpl implements EntrepreneurialActivityAnnouncementService { + + @Override + public R queryAnnouncementByActivityId(String competitionId, Integer pageNum, Integer pageSize) { + Page page = new Page(pageNum, pageSize); + IPage pageList = baseMapper.queryAnnouncementByActivityId(page, competitionId); + return R.ok().put("data", pageList); + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/EntrepreneurialActivityApplicantServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/EntrepreneurialActivityApplicantServiceImpl.java new file mode 100644 index 0000000..1018cb2 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/EntrepreneurialActivityApplicantServiceImpl.java @@ -0,0 +1,79 @@ +package com.huoran.occupationlab.service.impl; + +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.entity.ExportParams; +import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; +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.huoran.common.response.R; +import com.huoran.occupationlab.entity.EntrepreneurialActivityApplicant; +import com.huoran.occupationlab.entity.req.ActivityApplicantReq; +import com.huoran.occupationlab.entity.vo.RegistrationVO; +import com.huoran.occupationlab.mapper.EntrepreneurialActivityApplicantMapper; +import com.huoran.occupationlab.service.EntrepreneurialActivityApplicantService; +import com.huoran.occupationlab.utils.poi.ExcelStyleUtil; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.stereotype.Service; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.net.URLEncoder; +import java.util.List; +import java.util.stream.Collectors; + +/** + *

+ * 创业活动报名人员表 服务实现类 + *

+ * + * @author lr + * @since 2023-04-27 + */ +@Service +public class EntrepreneurialActivityApplicantServiceImpl extends ServiceImpl implements EntrepreneurialActivityApplicantService { + + @Override + public R ApplicantsList(ActivityApplicantReq req) { + Page page = new Page(req.getPageNum(), req.getPageSize()); + IPage pageList = baseMapper.selectRegistration(page, req); + return R.ok().put("data", pageList); + } + + @Override + public void export(HttpServletResponse response, ActivityApplicantReq req) throws IOException { + Page page = new Page(req.getPageNum(), req.getPageSize()); + IPage pageList = baseMapper.selectRegistration(page, req); + //添加序列号 + Integer[] arr = {1}; + List retList = pageList.getRecords().stream().peek(e -> e.setRownum(arr[0]++)).collect(Collectors.toList()); + // 告诉浏览器用什么软件可以打开此文件 + response.setHeader("content-Type", "application/vnd.ms-excel"); + // 下载文件的默认名称 + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("报名人员导出", "UTF-8") + ".xls"); + //编码 + response.setCharacterEncoding("UTF-8"); + Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), RegistrationVO.class, retList); + ExportParams exportParams = new ExportParams(null, "delivery", ExcelType.XSSF); + exportParams.setStyle(ExcelStyleUtil.class); + workbook.write(response.getOutputStream()); + + } + + @Override + public void exportDataInBatches(List listOfExportSub, HttpServletResponse response) throws IOException { + // 告诉浏览器用什么软件可以打开此文件 + response.setHeader("content-Type", "application/vnd.ms-excel"); + // 下载文件的默认名称 + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("报名人员导出", "UTF-8") + ".xls"); + //编码 + response.setCharacterEncoding("UTF-8"); + //添加序列号 + Integer[] arr = {1}; + listOfExportSub = listOfExportSub.stream().peek(e -> e.setRownum(arr[0]++)).collect(Collectors.toList()); + Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), RegistrationVO.class, listOfExportSub); + ExportParams exportParams = new ExportParams(null, "delivery", ExcelType.XSSF); + exportParams.setStyle(ExcelStyleUtil.class); + workbook.write(response.getOutputStream()); + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/EntrepreneurialActivityCollectServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/EntrepreneurialActivityCollectServiceImpl.java new file mode 100644 index 0000000..75e8b22 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/EntrepreneurialActivityCollectServiceImpl.java @@ -0,0 +1,24 @@ +package com.huoran.occupationlab.service.impl; + +import com.huoran.occupationlab.entity.EntrepreneurialActivityCollect; +import com.huoran.occupationlab.mapper.EntrepreneurialActivityCollectMapper; +import com.huoran.occupationlab.service.EntrepreneurialActivityCollectService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 理论课程收藏表 服务实现类 + *

+ * + * @author lr + * @since 2023-06-01 + */ +@Service +public class EntrepreneurialActivityCollectServiceImpl extends ServiceImpl implements EntrepreneurialActivityCollectService { + + @Override + public Integer countTheNumberOfCollectors(Integer activityId) { + return baseMapper.countTheNumberOfCollectors(activityId); + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/EntrepreneurialActivityFileServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/EntrepreneurialActivityFileServiceImpl.java new file mode 100644 index 0000000..d278465 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/EntrepreneurialActivityFileServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.occupationlab.service.impl; + +import com.huoran.occupationlab.entity.EntrepreneurialActivityFile; +import com.huoran.occupationlab.mapper.EntrepreneurialActivityFileMapper; +import com.huoran.occupationlab.service.EntrepreneurialActivityFileService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 创业活动附件存储 服务实现类 + *

+ * + * @author lr + * @since 2023-04-26 + */ +@Service +public class EntrepreneurialActivityFileServiceImpl extends ServiceImpl implements EntrepreneurialActivityFileService { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/EntrepreneurialActivityProgressServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/EntrepreneurialActivityProgressServiceImpl.java new file mode 100644 index 0000000..860ee9f --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/EntrepreneurialActivityProgressServiceImpl.java @@ -0,0 +1,29 @@ +package com.huoran.occupationlab.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.occupationlab.entity.EntrepreneurialActivityProgress; +import com.huoran.occupationlab.mapper.EntrepreneurialActivityProgressMapper; +import com.huoran.occupationlab.service.EntrepreneurialActivityProgressService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 活动进展表 服务实现类 + *

+ * + * @author lr + * @since 2023-05-12 + */ +@Service +public class EntrepreneurialActivityProgressServiceImpl extends ServiceImpl implements EntrepreneurialActivityProgressService { + + @Override + public boolean repeat(EntrepreneurialActivityProgress activityProgress) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("title", activityProgress.getTitle()); + wrapper.eq("activity_id", activityProgress.getActivityId()); + Integer count = baseMapper.selectCount(wrapper); + return count > 0; + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/EntrepreneurialActivityServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/EntrepreneurialActivityServiceImpl.java new file mode 100644 index 0000000..6b2aa67 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/EntrepreneurialActivityServiceImpl.java @@ -0,0 +1,124 @@ +package com.huoran.occupationlab.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.huoran.common.response.R; +import com.huoran.occupationlab.entity.EntrepreneurialActivity; +import com.huoran.occupationlab.entity.EntrepreneurialActivityCollect; +import com.huoran.occupationlab.entity.TheoreticalCourseCollect; +import com.huoran.occupationlab.entity.req.EntrepreneurshipActivityListrReq; +import com.huoran.occupationlab.entity.resp.PageTheoreticalCourseByNakadaiResp; +import com.huoran.occupationlab.entity.vo.EntrepreneurialActivityVO; +import com.huoran.occupationlab.mapper.AssessmentMapper; +import com.huoran.occupationlab.mapper.EntrepreneurialActivityCollectMapper; +import com.huoran.occupationlab.mapper.EntrepreneurialActivityMapper; +import com.huoran.occupationlab.service.EntrepreneurialActivityService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + *

+ * 创业活动管理表 服务实现类 + *

+ * + * @author lr + * @since 2023-04-26 + */ +@Service +public class EntrepreneurialActivityServiceImpl extends ServiceImpl implements EntrepreneurialActivityService { + + + @Autowired + private EntrepreneurialActivityCollectMapper collectMapper; + + @Override + public R activityList(EntrepreneurshipActivityListrReq req) { + //学校超管能看到教师以及学生发布的,教师能看到老师自己的和学生的(学生的:已发布的且未被学生禁用的(教师禁用学生的要展示) + Page page = new Page(req.getPageNum(), req.getPageSize()); + IPage iPage = null; + //当前所属平台(0:中台,1:职站教师 2职站学生) + switch (req.getPlatformSource()) { + case 1: + if (req.getIsAdmin() == 1) { + //为1表示该觉得为超管 能看到全校发布的 + iPage = baseMapper.theOverpipeOfTheActivityList(page, req); + break; + } + //展示教师当前发布的 + iPage = baseMapper.activityListForTeachers(page, req); + break; + } + return R.ok().put("data", iPage); + } + + @Override + public R schoolActivities(EntrepreneurshipActivityListrReq req) { + Page page = new Page(req.getPageNum(), req.getPageSize()); + IPage iPage = baseMapper.schoolActivities(page, req); + + + for (EntrepreneurialActivityVO resp : iPage.getRecords()) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("account_id", req.getAccountId()); + queryWrapper.eq("activity_id", resp.getId()); + EntrepreneurialActivityCollect activityCollect = collectMapper.selectOne(queryWrapper); + resp.setCollectorsNum(collectMapper.countTheNumberOfCollectors(resp.getId())); + //是否收藏:(state = 1收藏,0取消收藏) + if (activityCollect != null) { + //收藏过 + resp.setCollectionStatus(1); + } else { + resp.setCollectionStatus(0); + } + } + + + return R.ok().put("data", iPage); + } + + @Override + public R myActivities(EntrepreneurshipActivityListrReq req) { + Page page = new Page(req.getPageNum(), req.getPageSize()); + IPage iPage = baseMapper.myActivities(page, req); + + for (EntrepreneurialActivityVO resp : iPage.getRecords()) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("account_id", req.getAccountId()); + queryWrapper.eq("activity_id", resp.getId()); + EntrepreneurialActivityCollect activityCollect = collectMapper.selectOne(queryWrapper); + resp.setCollectorsNum(collectMapper.countTheNumberOfCollectors(resp.getId())); + //是否收藏:(state = 1收藏,0取消收藏) + if (activityCollect != null) { + //收藏过 + resp.setCollectionStatus(1); + } else { + resp.setCollectionStatus(0); + } + } + return R.ok().put("data", iPage); + } + + @Override + public R concernedActivity(EntrepreneurshipActivityListrReq req) { + Page page = new Page(req.getPageNum(), req.getPageSize()); + IPage iPage = baseMapper.concernedActivity(page, req); + + for (EntrepreneurialActivityVO resp : iPage.getRecords()) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("activity_id", resp.getId()); + queryWrapper.eq("account_id", req.getAccountId()); + EntrepreneurialActivityCollect activityCollect = collectMapper.selectOne(queryWrapper); + resp.setCollectorsNum(collectMapper.countTheNumberOfCollectors(resp.getId())); + //是否收藏:(state = 1收藏,0取消收藏) + if (activityCollect != null) { + //收藏过 + resp.setCollectionStatus(1); + } else { + resp.setCollectionStatus(0); + } + } + return R.ok().put("data", iPage); + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/EvaluationFractionServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/EvaluationFractionServiceImpl.java new file mode 100644 index 0000000..2d73934 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/EvaluationFractionServiceImpl.java @@ -0,0 +1,42 @@ +package com.huoran.occupationlab.service.impl; + +import com.huoran.occupationlab.entity.EvaluationFraction; +import com.huoran.occupationlab.mapper.EvaluationFractionMapper; +import com.huoran.occupationlab.service.EvaluationFractionService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 记录用户能力测评的总分数 服务实现类 + *

+ * + * @author lr + * @since 2021-09-26 + */ +@Service +public class EvaluationFractionServiceImpl extends ServiceImpl implements EvaluationFractionService { + + @Override + public void insertRecord(EvaluationFraction fraction) { + baseMapper.insert(fraction); + } + + @Override + public Integer queryExerciseRecord(Integer accountId) { + Integer score = baseMapper.queryExerciseRecord(accountId); + return score; + } + + @Override + public Integer queryTeachingRecord(Integer accountId) { + Integer score = baseMapper.queryTeachingRecord(accountId); + return score; + } + + @Override + public Integer queryScore(Integer accountId, Integer type) { + Integer id = baseMapper.queryScore(accountId, type); + return id; + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/EvaluationQuestionServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/EvaluationQuestionServiceImpl.java new file mode 100644 index 0000000..158e4aa --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/EvaluationQuestionServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.occupationlab.service.impl; + +import com.huoran.occupationlab.entity.EvaluationQuestion; +import com.huoran.occupationlab.mapper.EvaluationQuestionMapper; +import com.huoran.occupationlab.service.EvaluationQuestionService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 测评试题表,记录每次测评的试题,与测评记录表相关联 服务实现类 + *

+ * + * @author lr + * @since 2021-09-26 + */ +@Service +public class EvaluationQuestionServiceImpl extends ServiceImpl implements EvaluationQuestionService { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/EvaluationRecordServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/EvaluationRecordServiceImpl.java new file mode 100644 index 0000000..bc769c9 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/EvaluationRecordServiceImpl.java @@ -0,0 +1,347 @@ +package com.huoran.occupationlab.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.occupationlab.entity.EvaluationQuestion; +import com.huoran.occupationlab.entity.EvaluationRecord; +import com.huoran.occupationlab.entity.vo.*; +import com.huoran.occupationlab.mapper.EvaluationQuestionMapper; +import com.huoran.occupationlab.mapper.EvaluationRecordMapper; +import com.huoran.occupationlab.service.EvaluationQuestionService; +import com.huoran.occupationlab.service.EvaluationRecordService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.occupationlab.service.QuestionsService; +import com.huoran.occupationlab.utils.Constant; +import com.huoran.occupationlab.utils.poi.CommonCode; +import com.huoran.occupationlab.utils.poi.ExceptionCast; +import org.apache.commons.lang.StringUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.text.NumberFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.List; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.stream.Collectors; + +/** + * @Description: 测评管理 + * 从 + * @auther: Rong + * @date: 2021/9/26 16:24 + */ +@Service("evaluationRecordService") +public class EvaluationRecordServiceImpl extends ServiceImpl implements EvaluationRecordService { + + @Autowired + QuestionsService questionsService; + + @Autowired + EvaluationQuestionService evaluationQuestionService; + + @Autowired + EvaluationQuestionMapper evaluationQuestionDao; + + @Resource + StringRedisTemplate stringRedisTemplate; + + @Autowired + ThreadPoolExecutor executor; + + private String REMAINING_TINE_KEY = "REMAINING_TINE"; + + /** + * 平均分配分值 + * + * @param number 判分点数量 + * @return + */ + private List averageValue(Integer number) { + if (number == null || number == 0) { + ExceptionCast.cast(CommonCode.EVALUATION_QUESTION_NUM_INVALID); + } + Integer score = 100 / number; + List list = new ArrayList<>(); + if (100 % number == 0) { + for (int i = 0; i < number; i++) { + list.add(score); + } + } else { + int n; + for (int i = 0; i < number; i++) { + list.add(score); + } + for (int i = 100 % number; i > 0; i--) { + n = score + 1; + list.set(i, n); + } + } + return list; + } + + @Override + public TMSEvaluationRecordVO startEvaluation(Integer accountId,Integer schoolId) { + //TODO 接口幂等性处理 + //根据用户id和是否提交,查询测评记录信息 + EvaluationRecord one = this.getOne(new QueryWrapper().eq("account_id", accountId) + .eq("evaluation_status", Constant.Submit.NOT_SUBMIT.getType())); + + //查询是否有过测评记录 为空则随机抽取题目 + if (one == null) { + //随机抽取试题数据 + EvaluationVO evaluation = questionsService.randomQuestions(schoolId); + + //保存测评记录 + EvaluationRecord evaluationRecord = new EvaluationRecord(); + evaluationRecord.setAccountId(accountId); + evaluationRecord.setEvaluationStatus(Constant.Submit.NOT_SUBMIT.getType()); + evaluationRecord.setTotalQuestionNum(evaluation.getQuestionNum()); + evaluationRecord.setCurrentQuestionSortNo(1); + evaluationRecord.setStartTime(new Date()); + this.save(evaluationRecord); + + List evaluationQuestionList = evaluation.getQuestions().stream().map(question -> { + EvaluationQuestion evaluationQuestionEntity = new EvaluationQuestion(); + evaluationQuestionEntity.setEvaluationRecordId(evaluationRecord.getId()); + evaluationQuestionEntity.setQuestionId(Integer.valueOf(question)); + return evaluationQuestionEntity; + }).collect(Collectors.toList()); + + List list = averageValue(evaluation.getQuestionNum()); + for (int i = 0; i < list.size(); i++) { + evaluationQuestionList.get(i).setQuestionSortNo(i + 1); + evaluationQuestionList.get(i).setQuestionPoints(list.get(i)); + } + evaluationQuestionService.saveBatch(evaluationQuestionList); + + one = evaluationRecord; + } + + TMSEvaluationRecordVO evaluationRecordVO = baseMapper.selectVOByInfo(one.getId(), one.getCurrentQuestionSortNo()); + evaluationRecordVO.setQuestionTypeName(getQuestionTypeName(evaluationRecordVO.getQuestionType())); + return evaluationRecordVO; + } + + private String getQuestionTypeName(String questionType) { + String questionTypeName = ""; + //处理试题类型 + if (questionType.equals(Constant.QuestionType.SINGLE_CHOICE.getType())) { + //单选题 + questionTypeName = Constant.QuestionType.SINGLE_CHOICE.getDesc(); + } else if (questionType.equals(Constant.QuestionType.MULTIPLE_CHOICE.getType())) { + //多选题 + questionTypeName = Constant.QuestionType.MULTIPLE_CHOICE.getDesc(); + } else if (questionType.equals(Constant.QuestionType.TRUE_OR_FALSE.getType())) { + //判断题 + questionTypeName = Constant.QuestionType.TRUE_OR_FALSE.getDesc(); + } else { + ExceptionCast.cast(CommonCode.QUESTIONTYPE_INVALID); + } + return questionTypeName; + } + + @Override + public TMSEvaluationRecordVO convertQuestion(Integer evaluationRecordId, Integer currentQuestionSortNo, String userAnswer, Integer changeSortNo) throws ExecutionException, InterruptedException { + if (currentQuestionSortNo < 1 + || currentQuestionSortNo > this.getById(evaluationRecordId).getTotalQuestionNum() + || changeSortNo < 1 + || changeSortNo > this.getById(evaluationRecordId).getTotalQuestionNum()) { + ExceptionCast.cast(CommonCode.INVALID_PARAM); + } + //提交当前试题信息 + submitCurrentQuestion(evaluationRecordId, currentQuestionSortNo, userAnswer); + //修改测评记录表当前题目顺序号 + updateCurrentSortNo(changeSortNo, evaluationRecordId); + TMSEvaluationRecordVO evaluationRecordVO = baseMapper.selectVOByInfo(evaluationRecordId, changeSortNo); + + //查询下一题信息 + evaluationRecordVO.setQuestionTypeName(getQuestionTypeName(evaluationRecordVO.getQuestionType())); + return evaluationRecordVO; + } + + + //提交当前试题,并修改当前测评记录表 + private void submitCurrentQuestion(Integer evaluationRecordId, + Integer currentQuestionSortNo, + String userAnswer) { + //1、根据当前传递的evaluationRecordId和currentQuestionSortNo查询当前试题 + EvaluationQuestionVO evaluationQuestionVO = evaluationQuestionDao.selectByInfo(evaluationRecordId, currentQuestionSortNo); + + if (evaluationQuestionVO == null) { + ExceptionCast.cast(CommonCode.INVALID_PARAM); + } + // 题目分值 + Integer questionPoints = evaluationQuestionVO.getQuestionPoints(); + //正确答案 + String answer = evaluationQuestionVO.getAnswer(); + + String userString = ""; + String answerString = ""; + char[] arr = userAnswer.toCharArray(); + Arrays.sort(arr); + for (char a : arr) { + userString = userString + String.valueOf(a); + } + char[] array = answer.toCharArray(); + Arrays.sort(array); + for (char b : array) { + answerString = answerString + String.valueOf(b); + } + //修改当前试题状态 + //记录用户的答案 + //判断当前试题正误 + //记录试题得分 + EvaluationQuestion evaluationQuestion = new EvaluationQuestion(); + evaluationQuestion.setId(evaluationQuestionVO.getId()); + evaluationQuestion.setUserAnswer(userAnswer); + //如果用户答案为空,则设置状态为未作,设为错,得分设为0 +// if (StringUtils.isEmpty(userAnswer)) { + if (StringUtils.isEmpty(userString)) { + evaluationQuestion.setQuestionStatus(Constant.QuestionStatus.NOT_MADE.getType()); + evaluationQuestion.setIsTure(Constant.QuestionIsTure.FALSE.getType()); + evaluationQuestion.setQuestionScore(0); + } else { + evaluationQuestion.setQuestionStatus(Constant.QuestionStatus.MADE.getType()); + if (!answerString.equals(userString)) { + evaluationQuestion.setIsTure(Constant.QuestionIsTure.FALSE.getType()); + evaluationQuestion.setQuestionScore(0); + } else { + evaluationQuestion.setIsTure(Constant.QuestionIsTure.TRUE.getType()); + evaluationQuestion.setQuestionScore(questionPoints); + } + } + evaluationQuestionDao.updateById(evaluationQuestion); + + } + + private void updateCurrentSortNo(Integer changeSortNo, Integer evaluationRecordId) { + //修改测评记录表 + EvaluationRecord evaluationRecordEntity = new EvaluationRecord(); + evaluationRecordEntity.setCurrentQuestionSortNo(changeSortNo); + evaluationRecordEntity.setId(evaluationRecordId); + this.updateById(evaluationRecordEntity); + } + + @Override + public EvaluationRecordSubmitVO submitEvaluation(Integer evaluationRecordId, Integer currentQuestionSortNo, String userAnswer, Integer accountId) throws ExecutionException, InterruptedException { + //清除redis中的倒计时 + CompletableFuture deleteKeyFuture = CompletableFuture.runAsync(() -> { + String key = REMAINING_TINE_KEY + accountId; + stringRedisTemplate.delete(key); + }, executor); + +// CompletableFuture submitCurrentQuestionFuture = CompletableFuture.runAsync(() +// -> submitCurrentQuestion(evaluationRecordId, currentQuestionSortNo, userAnswer), executor); +// 2020.09.30 清除上面异步操作,需先提交并统计最后一题的结果 + submitCurrentQuestion(evaluationRecordId, currentQuestionSortNo, userAnswer); + + //修改提交时间和测评记录状态 + CompletableFuture updateEvaluationFuture = CompletableFuture.runAsync(() -> { + EvaluationRecord entity = new EvaluationRecord(); + entity.setId(evaluationRecordId); + entity.setEvaluationStatus(Constant.Submit.SUBMIT.getType()); + entity.setSubmitTime(new Date()); + this.updateById(entity); + }, executor); + + EvaluationRecordSubmitVO submitVO = new EvaluationRecordSubmitVO(); + + //查询总成绩 + CompletableFuture sumScoreFuture = CompletableFuture.runAsync(() -> { + int sumScore = evaluationQuestionDao.sumScore(evaluationRecordId); + //得分 + submitVO.setTotalScore(sumScore); + //是否通过 +// submitVO.setIsPassed(sumScore > Constant.PASSING_SCORE ? Constant.EVALUATIONN_PASSED : Constant.EVALUATIONN_NOT_PASSED); + //成绩大于等于60分通过 + submitVO.setIsPassed(sumScore >= Constant.PASSING_SCORE ? Constant.EVALUATIONN_PASSED : Constant.EVALUATIONN_NOT_PASSED); + }, executor); + + CompletableFuture getByIdFuture = CompletableFuture.supplyAsync(() -> { + EvaluationRecord evaluationRecord = this.getById(evaluationRecordId); + BeanUtils.copyProperties(evaluationRecord, submitVO); + return evaluationRecord; + }, executor); + + CompletableFuture countFuture = getByIdFuture.thenAcceptAsync((res) -> { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("evaluation_record_id", evaluationRecordId) + .eq("is_ture", Constant.QuestionIsTure.TRUE.getType()); + //查询答对几题 + int count = evaluationQuestionService.count(queryWrapper); + //答对几道 + submitVO.setCorrectQuestionNum(count); + //正确率 + // 创建一个数值格式化对象 + NumberFormat numberFormat = NumberFormat.getInstance(); + // 设置精确到小数点后2位 + numberFormat.setMaximumFractionDigits(2); + submitVO.setCorrectRate(numberFormat.format((float) count / (float) res.getTotalQuestionNum() * 100) + "%"); + + }, executor); + CompletableFuture.allOf(deleteKeyFuture, updateEvaluationFuture, + sumScoreFuture, getByIdFuture, countFuture).get(); + + return submitVO; + } + + @Override + public EvaluationRecordDetailVO evaluationDetail(Integer evaluationRecordId) throws ExecutionException, InterruptedException { + EvaluationRecordDetailVO evaluationRecordDetailVO = new EvaluationRecordDetailVO(); + + CompletableFuture sumScoreFuture = CompletableFuture.runAsync(() -> { + //查询总成绩 + int sumScore = evaluationQuestionDao.sumScore(evaluationRecordId); + evaluationRecordDetailVO.setTotalScore(sumScore); + }, executor); + + CompletableFuture evaluationDetailVOSFuture = CompletableFuture.runAsync(() -> { + List evaluationDetailVOS = evaluationQuestionDao.selectDetailByInfo(evaluationRecordId); + evaluationRecordDetailVO.setEvaluationDetailVOS(evaluationDetailVOS); + }, executor); + + CompletableFuture.allOf(sumScoreFuture, evaluationDetailVOSFuture).get(); + return evaluationRecordDetailVO; + } + + @Override + public String selectNotMade(Integer evaluationRecordId) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("evaluation_record_id", evaluationRecordId) + .eq("question_status", Constant.QuestionStatus.NOT_MADE.getType()); + + List list = evaluationQuestionService.list(queryWrapper); + List collect = list.stream().map(EvaluationQuestion::getQuestionSortNo).collect(Collectors.toList()); + if (collect.size() == 0) { + return "已完成全部题目"; + } + return "还有以下题目未完成" + collect.toString(); + } + + @Override + public void cleanRemainingTime(Integer accountId) { + //清除redis中的倒计时 + String key = REMAINING_TINE_KEY + accountId; + stringRedisTemplate.delete(key); + + } + + @Override + public boolean isOpenExperiment(Integer accountId) { + List list = evaluationQuestionDao.sumScoreListByUserId(accountId); + if (list != null && list.size() > 0) { + for (Integer integer : list) { + if (integer > Constant.PASSING_SCORE) { + return true; + } + } + } + return false; + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/EvaluationRulesServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/EvaluationRulesServiceImpl.java new file mode 100644 index 0000000..2594b52 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/EvaluationRulesServiceImpl.java @@ -0,0 +1,152 @@ +package com.huoran.occupationlab.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.common.exception.CustomException; +import com.huoran.common.exception.ExceptionEnum; +import com.huoran.occupationlab.entity.EvaluationRules; +import com.huoran.occupationlab.entity.Questions; +import com.huoran.occupationlab.entity.vo.EvaluationRulesVO; +import com.huoran.occupationlab.mapper.EvaluationRulesMapper; +import com.huoran.occupationlab.mapper.QuestionsMapper; +import com.huoran.occupationlab.service.EvaluationRulesService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.occupationlab.service.QuestionsService; +import com.huoran.occupationlab.utils.Constant; +import com.huoran.occupationlab.utils.poi.CommonCode; +import com.huoran.occupationlab.utils.poi.ExceptionCast; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; + +/** + *

+ * 测评规则信息记录,只记录一条信息 服务实现类 + *

+ * + * @author lr + * @since 2021-08-12 + */ +@Service +public class EvaluationRulesServiceImpl extends ServiceImpl implements EvaluationRulesService { + @Resource + QuestionsService questionsService; + @Autowired + private QuestionsMapper questionsMapper; + + @Override + public EvaluationRulesVO getEvaluationRules(Integer schoolId) { + EvaluationRulesVO evaluationRulesVO = new EvaluationRulesVO(); + + //根据学校id查询测评规则 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("school_id", schoolId); + EvaluationRules evaluationRules = baseMapper.selectOne(wrapper); + + if (evaluationRules.getEvaluationType().equals(Constant.RulesType.CUSTOMIZE.getType())) {//自定义 + + int totalNum = 0; + if (evaluationRules.getIsSingleEnable().equals(Constant.IsEnable.ENABLE.getType())) {//启用 + totalNum += evaluationRules.getSingleNum(); + } + if (evaluationRules.getIsMultipleEnable().equals(Constant.IsEnable.ENABLE.getType())) {//启用 + totalNum += evaluationRules.getMultipleNum(); + } + if (evaluationRules.getIsJudgmentEnable().equals(Constant.IsEnable.ENABLE.getType())) {//启用 + totalNum += evaluationRules.getJudgmentNum(); + } + + //类型为自定义,测评试题数量是各个参与测评的试题类型数量之和 + evaluationRules.setQuestionNum(totalNum); + } + + BeanUtils.copyProperties(evaluationRules, evaluationRulesVO); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("is_del", Constant.IsDel.NOT_DEL.getType()) //未删除 + .eq("is_enable", Constant.IsEnable.ENABLE.getType())//启用 + .eq("school_id", schoolId) + ; + + evaluationRulesVO.setTotalQuestionNum(questionsService.count(queryWrapper));//总题数 + int totalSingleNum = questionsService.count(queryWrapper.eq("question_type", + Constant.QuestionType.SINGLE_CHOICE.getType()));//单选题总数 + int totalMultipleNum = questionsMapper.countTotalMultipleNum(evaluationRules.getSchoolId()); + int totalJudgmentNum = questionsMapper.countTotalJudgmentNum(evaluationRules.getSchoolId()); + + evaluationRulesVO.setTotalSingleNum(totalSingleNum); + evaluationRulesVO.setTotalMultipleNum(totalMultipleNum); + evaluationRulesVO.setTotalJudgmentNum(totalJudgmentNum); + + return evaluationRulesVO; + } + + @Override + public boolean updateEvaluationRulesById(EvaluationRules evaluationRules) { + //控制测评题数不能超过100道 + if (evaluationRules == null + || evaluationRules.getQuestionNum() == null + || evaluationRules.getQuestionNum() > 100 + || evaluationRules.getQuestionNum() < 0) { + //ExceptionCast.cast(CommonCode.QUESTION_NUM_INVALID); + throw new CustomException(ExceptionEnum.QUESTION_NUM_INVALID); + } + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("is_del", Constant.IsDel.NOT_DEL.getType()) //未删除 + .eq("is_enable", Constant.IsEnable.ENABLE.getType())//启用 + .eq("school_id", evaluationRules.getSchoolId()) + ; + //查询总题数 + int count = questionsService.count(queryWrapper);//总题数 + + //判断题目是否超出范围 + //判断类型 + Integer evaluationType = evaluationRules.getEvaluationType(); + if (evaluationType.equals(Constant.RulesType.RANDOM.getType())) {//随机 + Integer questionNum = evaluationRules.getQuestionNum(); + + numIncalid(questionNum, count); + + } else if (evaluationType.equals(Constant.RulesType.CUSTOMIZE.getType())) {//自定义 + if (evaluationRules.getIsSingleEnable().equals(Constant.IsEnable.ENABLE.getType())) {//启用 + int singleNum = evaluationRules.getSingleNum(); + int totalSingleNum = questionsService.count(queryWrapper.eq("question_type", + Constant.QuestionType.SINGLE_CHOICE.getType()).eq("school_id", evaluationRules.getSchoolId()));//单选题总数 + numIncalid(singleNum, totalSingleNum); + } + if (evaluationRules.getIsMultipleEnable().equals(Constant.IsEnable.ENABLE.getType())) {//启用 + int multipleNum = evaluationRules.getMultipleNum(); + int totalMultipleNum = questionsMapper.countTotalMultiplenum(evaluationRules.getSchoolId()); + numIncalid(multipleNum, totalMultipleNum); + } + if (evaluationRules.getIsJudgmentEnable().equals(Constant.IsEnable.ENABLE.getType())) {//启用 + int judgmentNum = evaluationRules.getJudgmentNum(); + int totalJudgmentNum = questionsMapper.countTotalJudgmentnum(evaluationRules.getSchoolId()); + numIncalid(judgmentNum, totalJudgmentNum); + } + + } + + return this.updateById(evaluationRules); + } + + @Override + public boolean copyEvaluationRules(Integer schoolId) { + //查询内置学校id为0的测评规则 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("school_id", 0); + EvaluationRules evaluationRules = baseMapper.selectOne(wrapper); + evaluationRules.setSchoolId(schoolId); + Integer ret = baseMapper.insert(evaluationRules); + return ret > 0; + } + + private void numIncalid(int num, int totalNum) { + if (num < 0 || num > totalNum) { + //ExceptionCast.cast(CommonCode.QUESTION_NUM_INVALID); + throw new CustomException(ExceptionEnum.QUESTION_NUM_INVALID); + } + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ExperimentalReportServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ExperimentalReportServiceImpl.java new file mode 100644 index 0000000..866f894 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ExperimentalReportServiceImpl.java @@ -0,0 +1,1046 @@ +package com.huoran.occupationlab.service.impl; + +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.entity.ExportParams; +import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +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.huoran.api.NakadaiClient; +import com.huoran.api.UserClient; +import com.huoran.common.constant.DelConstant; +import com.huoran.common.constant.PlatformConstant; +import com.huoran.common.constant.PointConstant; +import com.huoran.common.entity.BcJudgmentPoint; +import com.huoran.common.entity.LcRuleRecord; +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.Class; +import com.huoran.occupationlab.entity.*; +import com.huoran.occupationlab.entity.req.*; +import com.huoran.occupationlab.entity.resp.*; +import com.huoran.occupationlab.entity.vo.ActivityDerivationVO; +import com.huoran.occupationlab.entity.vo.PerformanceManagementPracticeActivityVO; +import com.huoran.occupationlab.entity.vo.PracticeTheHighestScoreListVO; +import com.huoran.occupationlab.entity.vo.ProductClassInformationVO; +import com.huoran.occupationlab.mapper.*; +import com.huoran.occupationlab.service.ExperimentalReportService; +import com.huoran.occupationlab.utils.SemesterDateUtils; +import com.huoran.occupationlab.utils.poi.ExcelStyleUtil; +import org.apache.commons.lang3.ObjectUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.math.BigDecimal; +import java.net.URLEncoder; +import java.util.*; + +import static java.math.BigDecimal.ROUND_HALF_DOWN; + +/** + *

+ * 存储各子系统的实验报告 服务实现类 + *

+ * + * @author lr + * @since 2021-09-08 + */ +@Service +public class ExperimentalReportServiceImpl extends ServiceImpl implements ExperimentalReportService { + + @Autowired + private ProjectHiddenMapper projectHiddenMapper; + + @Autowired + private ProjectManageMapper projectManageMapper; + + @Autowired + private ClassMapper classMapper; + + @Autowired + private ExperimentalReportMapper experimentalReportMapper; + + @Autowired + private PlayRecordMapper playRecordMapper; + + @Autowired + private UserScoreMapper userScoreMapper; + + @Autowired + private PythonRunCodeMapper runCodeMapper; + +// @Autowired +// private JudgmentPointClient judgmentPointClient; + @Autowired + private NakadaiClient nakadaiClient; + + @Autowired + private ArchitectureMapper architectureMapper; + + @Autowired + private AssessmentMapper assessmentMapper; + + @Autowired + private StudentMapper studentMapper; + + /** + * @Description: 学生端-实验记录-实验概览 + * @auther: Rong + * @date: 2021/9/8 17:43 + */ + @Override + public R getExperimentOverview(Integer accountId) { + ExperimentOverviewResp resp = baseMapper.getExperimentOverview(accountId); + double avgScore = ((double) resp.getSumScore() / resp.getExperimentalNum()); + if (Double.isNaN(avgScore)) { + avgScore = 0.0; + } + resp.setAvgScore(avgScore); + return R.ok().put("data", resp); + } + + @Override + public R queryAssessmentByStudent(PageAchievementByStuReq req) { + Page page = new Page(req.getPageNum(), req.getPageSize()); + IPage iPage = baseMapper.queryAssessmentByStudent(page, req); + return R.ok().put("page", iPage); + } + + @Override + public R queryPracticeByStudent(PageAchievementByStuReq req) { + Page page = new Page(req.getPageNum(), req.getPageSize()); + IPage iPage = baseMapper.queryPracticeByStudent(page, req); + return R.ok().put("page", iPage); + } + + @Autowired + private UserClient userClient; + + public static String getPercentage(Integer a, Integer b) { + int v = (int) ((new BigDecimal((float) a / b).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()) * 100); + String str = v + "%"; //用字符串做拼接,得到想要的%形式 + System.out.println(str); + return str; + } + + @Override + public R getAchievementInfo(PageAchievementByTeacherReq req) { + if (req.getCurriculumId().equals("")) { + String ids = nakadaiClient.getSchoolCourse(req.getSchoolId()); + req.setCurriculumIds(ids); + } + + req.setIsAdmin(0); + + String roleName = userClient.getUserAllRole(req.getAccountId() + "", PlatformConstant.POST_STATION); + if (roleName.contains("超级管理员") || roleName.contains("管理员")) { + //依据角色查询本校内的项目(超管管理员角色、管理员角色能看到全部考核列表 其它角色只能看到自己发布的) + req.setIsAdmin(1); + } else { + List accountIdList = userClient.getAccountIdsBySchoolId(req.getSchoolId(), PlatformConstant.POST_STATION); + //为满足非超管、管理员的角色情况下能看到本人及超管、管理员角色发布的项目 由此将当前用户的账号id赋值进去List + accountIdList.add(req.getAccountId()); + req.setAccountIdList(accountIdList); + } + + //成绩管理,老师应该看到内置+管理员(含超管)+自己创建的项目/发布考核的成绩,看不到别的老师的项目的练习或考核成绩 + switch (req.getPermissions()) { + case 0://练习 + req.setPageNum((req.getPageNum() - 1) * req.getPageSize()); + req.setPageSize(req.getPageSize()); + if (req.getCurriculumId().equals("")) { + String getCourse = nakadaiClient.getSchoolCourse(req.getSchoolId()); + req.setCurriculumId(getCourse); + } + return R.ok().put("page", baseMapper.getPracticeForTeacher(req)).put("total", baseMapper.getPracticeForTeacherNum(req).size()); + case 1://考核 + + Page page = new Page(req.getPageNum(), req.getPageSize()); + IPage iPage = baseMapper.getAssessmentForTeacher(page, req); + + for (AchievementResp resp : iPage.getRecords()) { + List classList = new ArrayList<>(); + for (String classId : resp.getClassId().split(",")) { + Class classInfo = classMapper.selectById(classId); + classList.add(classInfo); + } + resp.setClassList(classList); + } + return R.ok().put("page", iPage); + } + + return null; + } + + @Override + public R getPracticeDetail(Integer projectId, Integer pageNum, Integer pageSize, Integer schoolId, Integer classId, String keyWord, Integer mallId) { + Page page = new Page(pageNum, pageSize); + IPage iPage = baseMapper.getPracticeDetail(page, projectId, schoolId, classId, keyWord, mallId); + + //获取各个分数段人数 + FractionalSegmentResp getFractionalSegmentNum = baseMapper.getFractionalSegmentByPractice(projectId, schoolId, classId, mallId); + //获取平均分和总人数 + FractionalSegmentResp getAvgScoreAndPeople = baseMapper.getAvgScoreAndPeopleByPractice(projectId, schoolId, classId, mallId); + + //统计当前参加练习的人数 非有实验报告的总数(人数去重) + Integer peopleNum = baseMapper.countTheTotalNumberOfExercisers(projectId, schoolId, classId, mallId); + + com.huoran.common.entity.ProjectManage projectManage = projectManageMapper.undeletedAndDeletedItemDetails(projectId); + Integer sysType = baseMapper.selectSystemType(projectManage.getSystemId()); + //获取项目下的全部判分点(不同系统查询不同) + List scoringPointList = null; + if (sysType == PointConstant.PROGRAMMING) { + scoringPointList = baseMapper.errorRateAnalysis(projectId, schoolId, classId, mallId); + } else { + scoringPointList = baseMapper.errorRateAnalysisByLc(projectId, schoolId, classId, mallId); + } + + for (ScorePointsUnderTheItemResp scorePoint : scoringPointList) { +// Integer countError = baseMapper.countError(projectId, schoolId, scorePoint.getJudgmentId()); + //当前判分点做错的人数总数 +// scorePoint.setErrorTotal(countError); + scorePoint.setPeopleNum(getAvgScoreAndPeople.getPeopleNum()); + //设置错误率 + BigDecimal errorBigDecimal = new BigDecimal(0); + //除数非0校验 + if (getAvgScoreAndPeople.getPeopleNum() != 0) { + errorBigDecimal = new BigDecimal(scorePoint.getErrorTotal()).divide(new BigDecimal(getAvgScoreAndPeople.getPeopleNum()), 2, ROUND_HALF_DOWN); + } + scorePoint.setErrorRate(errorBigDecimal.multiply(new BigDecimal(100)) + ""); + } + + + ErrorRateAnalysisResp errorRateAnalysisResp = new ErrorRateAnalysisResp(); + errorRateAnalysisResp.setScoringPointList(scoringPointList); + + ScorePointsUnderTheItemResp max = null; + ScorePointsUnderTheItemResp min = null; + if (scoringPointList.size() > 0) { + max = Collections.max(scoringPointList, new Comparator() { + @Override + public int compare(ScorePointsUnderTheItemResp u1, ScorePointsUnderTheItemResp u2) { + double diff = Double.valueOf(u1.getErrorRate()) - Double.valueOf(u2.getErrorRate()); + if (diff > 0) { + return 1; + } else if (diff < 0) { + return -1; + } + return 0; //相等为0 + } + }); +// System.out.println("最大值" + max.toString()); + + + min = Collections.min(scoringPointList, new Comparator() { + @Override + public int compare(ScorePointsUnderTheItemResp u1, ScorePointsUnderTheItemResp u2) { + double diff = Double.valueOf(u1.getErrorRate()) - Double.valueOf(u2.getErrorRate()); + if (diff > 0) { + return 1; + } else if (diff < 0) { + return -1; + } + return 0; //相等为0 + } + }); +// System.out.println("最小值" + min.toString()); + } + + + return R.ok().put("page", iPage).put("peopleNum", peopleNum).put("avgScore", getAvgScoreAndPeople.getAvgScore()).put("maxScore", getAvgScoreAndPeople.getMaxScore()).put("minScore", getAvgScoreAndPeople.getMinScore()).put("getFractionalSegmentNum", getFractionalSegmentNum).put("errorAnalysis", errorRateAnalysisResp).put("highestErrorRate", max).put("minimumErrorRate", min); + } + + @Override + public R getAssessmentDetail(Integer assessmentId, Integer classId, Integer pageNum, Integer pageSize, String keyword) { + Page page = new Page(pageNum, pageSize); + IPage iPage = baseMapper.getAssessmentDetail(page, assessmentId, classId, keyword); + //获取各个分数段人数 + FractionalSegmentResp getFractionalSegmentNum = baseMapper.getFractionalSegmentByAssessment(assessmentId, classId); + //获取平均分和总人数 + FractionalSegmentResp getAvgScoreAndPeople = baseMapper.getAvgScoreAndPeopleByAssessment(assessmentId, classId); + Assessment assessment = assessmentMapper.selectById(assessmentId); + //获取考核下的全部判分点 +// List scoringPointList = baseMapper.errorRateAnalysisForAssessment(assessment.getProjectId(), assessment.getSchoolId(), assessmentId); + com.huoran.common.entity.ProjectManage projectManage = projectManageMapper.undeletedAndDeletedItemDetails(assessment.getProjectId()); + Integer sysType = baseMapper.selectSystemType(projectManage.getSystemId()); + //获取项目下的全部判分点(不同系统查询不同) + List scoringPointList = null; + if (sysType == PointConstant.PROGRAMMING) { + //编程类 + scoringPointList = baseMapper.errorRateAnalysisForAssessment(assessment.getProjectId(), assessment.getSchoolId(), assessmentId, classId); + } else { + //流程类 + scoringPointList = baseMapper.errorRateAnalysisForAssessmentByLc(assessment.getProjectId(), assessment.getSchoolId(), assessmentId); + } + + + for (ScorePointsUnderTheItemResp scorePoint : scoringPointList) { + //当前判分点做错的人数总数 + scorePoint.setPeopleNum(getAvgScoreAndPeople.getPeopleNum()); + //设置错误率 + BigDecimal errorBigDecimal = new BigDecimal(0); + //除数非0校验 + if (getAvgScoreAndPeople.getPeopleNum() != 0) { + errorBigDecimal = new BigDecimal(scorePoint.getErrorTotal()).divide(new BigDecimal(getAvgScoreAndPeople.getPeopleNum()), 2, ROUND_HALF_DOWN); + } + scorePoint.setErrorRate(errorBigDecimal.multiply(new BigDecimal(100)) + ""); + } + + + ErrorRateAnalysisResp errorRateAnalysisResp = new ErrorRateAnalysisResp(); + errorRateAnalysisResp.setScoringPointList(scoringPointList); + + + ScorePointsUnderTheItemResp max = null; + ScorePointsUnderTheItemResp min = null; + if (scoringPointList.size() > 0) { + + + max = Collections.max(scoringPointList, new Comparator() { + @Override + public int compare(ScorePointsUnderTheItemResp u1, ScorePointsUnderTheItemResp u2) { + double diff = Double.valueOf(u1.getErrorRate()) - Double.valueOf(u2.getErrorRate()); + if (diff > 0) { + return 1; + } else if (diff < 0) { + return -1; + } + return 0; //相等为0 + } + }); + System.out.println("最大值" + max.toString()); + + min = Collections.min(scoringPointList, new Comparator() { + @Override + public int compare(ScorePointsUnderTheItemResp u1, ScorePointsUnderTheItemResp u2) { + double diff = Double.valueOf(u1.getErrorRate()) - Double.valueOf(u2.getErrorRate()); + if (diff > 0) { + return 1; + } else if (diff < 0) { + return -1; + } + return 0; //相等为0 + } + }); + System.out.println("最小值" + min.toString()); + } + + return R.ok().put("page", iPage).put("peopleNum", getAvgScoreAndPeople.getPeopleNum()).put("avgScore", getAvgScoreAndPeople.getAvgScore()).put("maxScore", getAvgScoreAndPeople.getMaxScore()).put("minScore", getAvgScoreAndPeople.getMinScore()).put("getFractionalSegmentNum", getFractionalSegmentNum).put("errorAnalysis", errorRateAnalysisResp).put("highestErrorRate", max).put("minimumErrorRate", min); + } + + @Override + public void exportPracticeInfo(String ids, HttpServletResponse response, Integer schoolId, Integer projectId, Integer mallId) throws Exception { + List retList = baseMapper.exportPracticeInfo(ids, schoolId, projectId, mallId); + + // 告诉浏览器用什么软件可以打开此文件 + response.setHeader("content-Type", "application/vnd.ms-excel"); + // 下载文件的默认名称 + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("练习实验成绩", "UTF-8") + ".xls"); + //编码 + response.setCharacterEncoding("UTF-8"); + Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), ExportPracticeByTeacherResp.class, retList); + ExportParams exportParams = new ExportParams(null, "delivery", ExcelType.XSSF); + exportParams.setStyle(ExcelStyleUtil.class); + workbook.write(response.getOutputStream()); + } + + @Override + public void exportAssessmentInfo(String ids, HttpServletResponse response, Integer schoolId, Integer assessmentId, Integer classId) throws Exception { + List retList = baseMapper.exportAssessmentInfo(ids, schoolId, assessmentId, classId); + + response.setHeader("content-Type", "application/vnd.ms-excel"); + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("考核实验成绩", "UTF-8") + ".xls"); + response.setCharacterEncoding("UTF-8"); + Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), ExportAssessmentByTeacherResp.class, retList); + ExportParams exportParams = new ExportParams(null, "delivery", ExcelType.XSSF); + exportParams.setStyle(ExcelStyleUtil.class); + workbook.write(response.getOutputStream()); + } + + /** + * @param projectIds 要删除的 + * @param projectPermissions 项目权限(0、练习 1、考核 2、竞赛) + * @param ids + * @return + */ + @Override + public R deleteReportById(List projectIds, Integer projectPermissions, List ids) { + ProjectHidden projectHidden = new ProjectHidden(); + + switch (projectPermissions) { + + //将实验报告中使用该项目的实验报告删除 + case 0: + projectIds.stream().forEach(projectId -> { + projectHidden.setProjectId(projectId).setIsHidden(1); + projectHiddenMapper.insert(projectHidden); + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.set("is_del", DelConstant.IS_DEL); + updateWrapper.eq("project_id", projectId); + baseMapper.update(new com.huoran.common.entity.ExperimentalReport(), updateWrapper); + }); + + case 1: + ids.stream().forEach(id -> { + projectHidden.setTeachId(id).setIsHidden(1); + projectHiddenMapper.insert(projectHidden); + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.set("is_del", DelConstant.IS_DEL); + updateWrapper.eq("assessment_id", id); + baseMapper.update(new com.huoran.common.entity.ExperimentalReport(), updateWrapper); + }); + + default: + R.error("请传入正确的项目权限"); + } + + return R.ok(); + } + + @Override + public void exportAssessmentByStudent(Integer accountId, Integer curriculumId, String ids, HttpServletResponse response) throws Exception { + List retList = baseMapper.exportAssessmentByStudent(ids, accountId, curriculumId); + // 告诉浏览器用什么软件可以打开此文件 + response.setHeader("content-Type", "application/vnd.ms-excel"); + // 下载文件的默认名称 + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("学生考核实验成绩", "UTF-8") + ".xls"); + //编码 + response.setCharacterEncoding("UTF-8"); + Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), ExportAssessmentByStuResp.class, retList); + ExportParams exportParams = new ExportParams(null, "delivery", ExcelType.XSSF); + exportParams.setStyle(ExcelStyleUtil.class); + workbook.write(response.getOutputStream()); + } + + @Override + public void exportPracticeByStudent(Integer curriculumId, Integer accountId, HttpServletResponse response) throws Exception { + List retList = baseMapper.exportPracticeByStudent(curriculumId, accountId); + // 告诉浏览器用什么软件可以打开此文件 + response.setHeader("content-Type", "application/vnd.ms-excel"); + // 下载文件的默认名称 + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("学生练习实验成绩", "UTF-8") + ".xls"); + //编码 + response.setCharacterEncoding("UTF-8"); + Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), ExportByStudentResp.class, retList); + ExportParams exportParams = new ExportParams(null, "delivery", ExcelType.XSSF); + exportParams.setStyle(ExcelStyleUtil.class); + workbook.write(response.getOutputStream()); + } + + @Override + public R practiceByStudentDetail(Integer curriculumId, Integer projectId, Integer accountId, Integer pageNum, Integer pageSize) { + Page page = new Page(pageNum, pageSize); + return R.ok().put("data", baseMapper.practiceByStudentDetail(page, curriculumId, projectId, accountId)); + } + + @Override + public void exportPracticeByStudentDetail(String ids, Integer projectId, Integer accountId, HttpServletResponse response) throws Exception { + List retList = baseMapper.exportPracticeByStudentDetail(ids, projectId, accountId); + // 告诉浏览器用什么软件可以打开此文件 + response.setHeader("content-Type", "application/vnd.ms-excel"); + // 下载文件的默认名称 + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("实验记录明细", "UTF-8") + ".xls"); + //编码 + response.setCharacterEncoding("UTF-8"); + Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), StuExportAchievementResp.class, retList); + ExportParams exportParams = new ExportParams(null, "delivery", ExcelType.XSSF); + exportParams.setStyle(ExcelStyleUtil.class); + workbook.write(response.getOutputStream()); + } + + @Override + public R reportDetail(Integer reportId) { + + com.huoran.common.entity.ExperimentalReport report = experimentalReportMapper.selectById(reportId); + if (ObjectUtils.isEmpty(report.getAccountId())) { + return R.error("账号不存在!"); + } + //班级id不为空 + /*if (report.getClassId() != null) { + if (StrUtil.isNotEmpty(report.getClassId().toString())) { + Class aClass = classMapper.selectById(report.getClassId()); + report.setClassName(aClass.getClassName()); + } + }*/ + + //实验报告班级读取学生管理学生所在班级 + StudentInfoResp getStudentClass = studentMapper.getStudentInfoByAccountId(report.getAccountId()); + + //班级增加判断 判断老师或者超管情况是没有班级的 + if (getStudentClass != null) { + if (getStudentClass.getClassId().equals("1")) { + report.setClassName(null); + } else { + if (StringUtils.isEmpty(report.getClassName())) { + //当实验报告自改班级名称为空时候默认读取学生管理所在的班级 + report.setClassName(getStudentClass.getClassName()); + } + } + } + + + //查询指导老师,客户实验报告为空,查询用户为空 + if (report.getAssessmentId() != null) { + + if (StrUtil.isNotEmpty(report.getAssessmentId().toString())) { + String name = experimentalReportMapper.selectTeacherName(report.getAssessmentId()); + report.setTeacherName(name); + } + } + HashMap map = experimentalReportMapper.queryUserInfo(report.getAccountId()); + if (!ObjectUtils.isEmpty(map)) { + report.setUserName(map.get("userName")); + report.setWorkNumber(map.get("workNumber")); + } + + if (ObjectUtils.isEmpty(report)) { + return R.error("实验报告查询失败!"); + } + if (ObjectUtils.isEmpty(report.getProjectId())) { + return R.error("项目id不存在!"); + } + +// 根据系统查询判分点类型 +// List userScores = userScoreMapper.selectList(new QueryWrapper().eq("report_id", reportId)); + + List userScores = userScoreMapper.selectScoreList(reportId); + if (projectManageMapper.selectSystemType(userScores.get(0).getSystemId()) == 0) { + for (UserScore userScore : userScores) { + BcJudgmentPoint point = userScoreMapper.selectJudgmentNameByBcId(userScore.getJudgmentId()); + userScore.setJudgmentName(point.getName()); + userScore.setReferenceAnswer(point.getExperimentCode()); + + PythonRunCode pythonRunCode = new PythonRunCode(); + pythonRunCode.setReportId(reportId); + pythonRunCode.setJudgmentPointsId(userScore.getJudgmentId()); + + String userCode = runCodeMapper.getRunCode(pythonRunCode); + + + String runPhotoUrl = runCodeMapper.getRunPhotoUrlString(reportId, userScore.getJudgmentId()); + if (runPhotoUrl != null) { + //runThePictureList:储存处理好转换集合的 + List runThePictureList = new ArrayList<>(); + for (String url : runPhotoUrl.split(",")) { + if (url.equals("")) { + continue; + } + runThePictureList.add(url); + } + userScore.setRunThePictureList(runThePictureList);//用户运行的图片集合 + userScore.setRunThePicture(runPhotoUrl);//分割前的 + } + + //UserScore userAnswer = userScoreMapper.selectById(userScore.getId()); + + userScore.setAnswer(userCode);//用户答案(这里的答案只是的用户输入的代码,并非运行出来的结果) + + } + } else { + //流程类 + for (UserScore userScore : userScores) { + if (userScore.getSystemId() == 19) { + List lcRuleRecord = baseMapper.getStRuleRecord(userScore.getAnswer()); + + for (LcRuleRecord ruleRecord : lcRuleRecord) { + //选择题型,根据id查询选择名称 + if (StringUtils.isNotEmpty(ruleRecord.getType()) && "1".equals(ruleRecord.getType())) { + /* //为id查询数据库 + String options = baseMapper.getStItemOptions(ruleRecord.getRuleAnswer()); + ruleRecord.setRuleAnswer(options);*/ + + //为id查询数据库 +// if (isNumeric(ruleRecord.getRuleAnswer())) { + String options = baseMapper.getStItemOptions(ruleRecord.getRuleAnswer()); + ruleRecord.setRuleAnswer(options); +// } +// if (isNumeric(ruleRecord.getUserAnswer())) { + String userAnswer = baseMapper.getStItemOptions(ruleRecord.getUserAnswer()); + ruleRecord.setUserAnswer(userAnswer); +// } + } + + } + + + userScore.setLcRuleRecords(lcRuleRecord); + String judgmentName = userScoreMapper.selectJudgmentNameById(userScore.getJudgmentId()); + userScore.setJudgmentName(judgmentName); + } else { + List lcRuleRecord = baseMapper.getLcRuleRecord(userScore.getAnswer()); + for (LcRuleRecord ruleRecord : lcRuleRecord) { + //选择题型,根据id查询选择名称 + if (StringUtils.isNotEmpty(ruleRecord.getType()) && "1".equals(ruleRecord.getType())) { + //为id查询数据库 + if (isNumeric(ruleRecord.getRuleAnswer())) { + String options = baseMapper.getItemOptions(ruleRecord.getRuleAnswer()); + ruleRecord.setRuleAnswer(options); + } + if (isNumeric(ruleRecord.getUserAnswer())) { + String options = baseMapper.getItemOptions(ruleRecord.getUserAnswer()); + ruleRecord.setUserAnswer(options); + } + } + } + userScore.setLcRuleRecords(lcRuleRecord); + String judgmentName = userScoreMapper.selectJudgmentNameById(userScore.getJudgmentId()); + userScore.setJudgmentName(judgmentName); + } + } + } + + return R.ok().put("report", report).put("userScores", userScores); + } + + public static boolean isNumeric(String str) { + return str.matches("-?\\d+(\\.\\d+)?"); + } + + @Override + public R practiceActivity(Integer projectId, Integer pageNum, Integer pageSize, Integer schoolId, Integer classId, String keyWord, Integer mallId) { + + + Page page = new Page(pageNum, pageSize); + IPage iPage = baseMapper.practiceActivity(page, projectId, schoolId, classId, keyWord, mallId); + return R.ok(iPage); + } + + @Override + public void exportDataInBatches(List list, HttpServletResponse response) throws Exception { + // 告诉浏览器用什么软件可以打开此文件 + response.setHeader("content-Type", "application/vnd.ms-excel"); + // 下载文件的默认名称 + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("活跃度列表", "UTF-8") + ".xls"); + //编码 + response.setCharacterEncoding("UTF-8"); + Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), ActivityDerivationVO.class, list); + ExportParams exportParams = new ExportParams(null, "delivery", ExcelType.XSSF); + exportParams.setStyle(ExcelStyleUtil.class); + workbook.write(response.getOutputStream()); + } + + @Override + public void exportAllData(Integer projectId, Integer schoolId, HttpServletResponse response, Integer mallId) throws Exception { + Page page = new Page(1, 10000); + IPage list = baseMapper.exportAllData(page, projectId, schoolId, mallId); + // 告诉浏览器用什么软件可以打开此文件 + response.setHeader("content-Type", "application/vnd.ms-excel"); + // 下载文件的默认名称 + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("活跃度列表", "UTF-8") + ".xls"); + //编码 + response.setCharacterEncoding("UTF-8"); + Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), ActivityDerivationVO.class, list.getRecords()); + ExportParams exportParams = new ExportParams(null, "delivery", ExcelType.XSSF); + exportParams.setStyle(ExcelStyleUtil.class); + workbook.write(response.getOutputStream()); + + } + + @Override + public R maximumPracticeScoreList(Integer projectId, Integer pageNum, Integer pageSize, Integer schoolId, Integer mallId) { + Page page = new Page(pageNum, pageSize); + IPage iPage = baseMapper.maximumPracticeScoreList(page, projectId, schoolId, mallId); + return R.ok(iPage); + } + + @Override + public R getTheMostUsedCoursesInOurSchool(Integer schoolId) { + return R.ok().put("data", experimentalReportMapper.getTheMostUsedCoursesInOurSchool(schoolId)); + } + + @Override + public R academicLeadersRanking(Integer schoolId, PageReq req) { + Page page = new Page(req.getPageNum(), req.getPageSize()); + return R.ok().put("data", experimentalReportMapper.academicLeadersRanking(page, schoolId)); + } + + /** + * @param schoolId + * @param choose 筛选为本月/本日 + * @return + */ + @Override + public R examStatistics(Integer schoolId, Integer choose) { + ExamStatisticsResp resp = experimentalReportMapper.examStatistics(schoolId, choose); + String examPassRate = "0%"; + //合格人数÷考试总人数×100%=合格率 + if (resp.getNumberOfPeoplePassed() != 0) { + examPassRate = getPercentage(resp.getNumberOfPeoplePassed(), resp.getReferenceNumber()); + } + resp.setExamPassRate(examPassRate);//通过率 + return R.ok().put("data", resp); + } + + + @Override + public R studentGradeDistribution(Integer schoolId, List req) { + //上学期统计的时间为2月1日-8月30日,下学期为9月1日到1月30。 + + + List retList = new ArrayList<>(); + + for (StudentPerformanceAnalysisReq forReq : req) { + StudentPerformanceAnalysisResp analysisResp = experimentalReportMapper.studentGradeDistribution(schoolId, forReq.getStartTime(), forReq.getEndTime()); + if (analysisResp != null) { + Integer getYear = Integer.valueOf(SemesterDateUtils.getYear(forReq.getStartTime())); + Integer getMonth = Integer.valueOf(SemesterDateUtils.getMonth(forReq.getStartTime())); + + String appendTime = ""; + if (getMonth >= 1 && getMonth <= 6) { + appendTime = getYear + "上半年"; + } else { + appendTime = getYear + "下半年"; + } + analysisResp.setTime(appendTime); + retList.add(analysisResp); + } + + } + + + return R.ok().put("data", retList); + } + + @Override + public R studentAssessSchievement(Integer schoolId, List req) { + List retList = new ArrayList<>(); + + for (StudentPerformanceAnalysisReq forReq : req) { + List analysisResp = experimentalReportMapper.studentAssessSchievement(schoolId, forReq.getStartTime(), forReq.getEndTime(), forReq.getCids()); + if (analysisResp != null) { + Integer getYear = Integer.valueOf(SemesterDateUtils.getYear(forReq.getStartTime())); + Integer getMonth = Integer.valueOf(SemesterDateUtils.getMonth(forReq.getStartTime())); + + String appendTime = ""; + if (getMonth >= 1 && getMonth <= 6) { + appendTime = getYear + "上半年"; + } else { + appendTime = getYear + "下半年"; + } + StuAssessmentScoreResp scoreResp = new StuAssessmentScoreResp(); + scoreResp.setTime(appendTime); + scoreResp.setAssesScoreRespList(analysisResp); + retList.add(scoreResp); + } + + } + + + return R.ok().put("data", retList); + } + + @Override + public R overviewOfOurSchoolData(Integer schoolId) { + OverviewOfStudentExperimentDataResp dataResp = experimentalReportMapper.overviewOfOurSchoolData(schoolId); + dataResp.setCumulativeExperimentTime(turnDayHourMinuteString(Integer.valueOf(dataResp.getCumulativeExperimentTime()))); + dataResp.setCourseStudyTime(turnDayHourMinuteString(Integer.valueOf(dataResp.getCourseStudyTime()))); + return R.ok().put("data", dataResp); + } + + @Override + public R monthlyAverageOnlineTime(Integer schoolId, List req) { + + List retList = new ArrayList<>(); + + for (StudentPerformanceAnalysisReq forReq : req) { + MonthlyOnlineStudyHoursResp resp = playRecordMapper.monthlyAverageOnlineTime(schoolId, forReq.getStartTime(), forReq.getEndTime()); + if (resp != null) { + Integer getYear = Integer.valueOf(SemesterDateUtils.getYear(forReq.getStartTime())); + Integer getMonth = Integer.valueOf(SemesterDateUtils.getMonth(forReq.getStartTime())); + + + if (resp.getAverageDuration().trim().equals("0E-8")) { + BigDecimal bigDecimal1 = new BigDecimal(resp.getAverageDuration()); + resp.setAverageDuration(bigDecimal1 + ""); + } + resp.setTime(getYear + "年" + getMonth + ""); + retList.add(resp); + + } + + } + + + return R.ok().put("data", retList); + } + + @Override + public R courseRankings(Integer schoolId) { + + List list = playRecordMapper.courseRankings(schoolId); + + return R.ok().put("data", list); + } + + /** + * 活跃度排行榜 + * + * @param schoolId + * @return + */ + @Override + public R activityRanking(Integer schoolId) { + if (schoolId == -1) { + List list = baseMapper.schoolActivityRanking(); + return R.ok(list); + } + + + //循环查询出来本校实验报告,并且附带了练习的班级(一个人可同时存在多个班级,这时则练习算在每个班级练习了一次) + List list = baseMapper.activityRanking(schoolId); + + Set classSet = new HashSet<>(); + for (ActiveLeaderboardtResp studentinfo : list) { + if (studentinfo.getClassIds().contains(",")) { + for (String id : studentinfo.getClassIds().split(",")) { + classSet.add(Integer.valueOf(id)); + } + } else { + classSet.add(Integer.valueOf(studentinfo.getClassIds())); + } + } + + + List retList = new ArrayList<>(); + //classSet 获取到本校参与练习的全部班级id + if (classSet.size() > 0) { + for (Integer classId : classSet) { + + Class checkClassExist = classMapper.selectById(classId); + if (checkClassExist != null) { + ReturnActiveRankingResp returnActiveRankingResp = new ReturnActiveRankingResp(); + returnActiveRankingResp.setClassId(classId); + + //班级统计 + BigDecimal classPracticeTimes = new BigDecimal(baseMapper.classPracticeTimes(schoolId, classId).getClassPracticeTimes()); + returnActiveRankingResp.setClassPracticeTimes(classPracticeTimes + ""); + + + //班级总人数 + BigDecimal totalClassSize = new BigDecimal(baseMapper.classPracticeTimes(schoolId, classId).getTotalClassSize()); + returnActiveRankingResp.setTotalClassSize(totalClassSize + ""); + + //活跃指数 + returnActiveRankingResp.setActivityIndex(classPracticeTimes.divide(totalClassSize, 2, ROUND_HALF_DOWN)); + retList.add(returnActiveRankingResp); + } + } + } + + for (ReturnActiveRankingResp cla : retList) { + //拿到班级的上级年级以及上上级专业 + + if (cla.getClassId() != 1) { + + Class c = classMapper.selectById(cla.getClassId()); + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("id", c.getArchitectureId()); + Architecture getGrade = architectureMapper.selectOne(wrapper); + //根据年级拿到专业信息 + QueryWrapper wrapper1 = new QueryWrapper<>(); + wrapper1.eq("id", getGrade.getParentId()); + Architecture getProfessional = architectureMapper.selectOne(wrapper1); + cla.setClassName(getProfessional.getOrganizationName() + "/" + getGrade.getOrganizationName() + "/" + c.getClassName()); + cla.setSchoolId(getProfessional.getSchoolId()); + cla.setSchoolName(nakadaiClient.getTheSchoolNameBySchoolId(getProfessional.getSchoolId()).getSchoolName()); + } + } + + //降序排序 + retList.sort(Comparator.comparing(ReturnActiveRankingResp::getActivityIndex).reversed()); + //取值取前十 + if (retList.size() > 10) { + retList = retList.subList(0, 10); + } + + + return R.ok(retList); + } + + @Override + public List getProduct(Integer schoolId) { + return baseMapper.getProduct(schoolId); + } + + @Override + public R productReadScore(PerformanceUnderProductReq req) { + + //获取练习的各个分数段人数 + FractionalSegmentResp stageNumber = baseMapper.productPracticeStageScoreData(req); + Page page = new Page(req.getPageNum(), req.getPageSize()); + //筛选类型(0、练习 1、考核 2、竞赛) + switch (req.getPermissions()) { + case 0: + //练习板块数据 + PerformanceUnderProductResp exerciseBlockData = baseMapper.practicePlateDataUnderProduct(req); + //错误率分析 + List projectErrorRateAnalysisUnderProduct = baseMapper.projectErrorRateAnalysisUnderProduct(req); + //用户成绩列表 + IPage userScoreList = baseMapper.listOfProjectResultsUnderTheProduct(page, req); + + + Integer totalNumberOfSchoolPracticeProjects = 0;//学校练习项目总数 + Integer builtInTotalNumberOfExercises = 0;//内置的练习项目总数 + builtInTotalNumberOfExercises = projectManageMapper.getCurriculumCountByType(req.getCid(), 0); + totalNumberOfSchoolPracticeProjects = projectManageMapper.projectCreatedUnderProduct(req.getMallId(), 0, req.getSchoolId()); + + //拼接练习项目数量+全部练习项目总数 + Integer numberOfExercises = builtInTotalNumberOfExercises + totalNumberOfSchoolPracticeProjects; + for (PracticeProjectsUnderTheProductResp resp : userScoreList.getRecords()) { + resp.setTotalNumberOfPractices(resp.getTotalNumberOfPractices() + "/" + numberOfExercises); + } + + + return R.ok().put("experimentalStatistics", exerciseBlockData).put("stageNumber", stageNumber).put("projectErrorRateAnalysisUnderProduct", projectErrorRateAnalysisUnderProduct).put("userScoreList", userScoreList); + case 1: + //用户考核成绩列表 + IPage listOfAssessmentResults = baseMapper.listOfAssessmentResultsUnderTheProduct(page, req); + //考核板块数据 + PerformanceUnderProductResp assessmentData = baseMapper.assessPlateDataUnderProduct(req); + + for (AssessProjectsUnderTheProductResp resp : listOfAssessmentResults.getRecords()) { + resp.setTotalNumberOfParticipants(resp.getTotalNumberOfParticipants() + "/" + resp.getTotalAssessment()); + } + //考核项目错误率 + List testErrorRateUnderProduct = baseMapper.testErrorRateUnderProduct(req); + return R.ok().put("experimentalStatistics", assessmentData).put("testErrorRateUnderProduct", testErrorRateUnderProduct).put("stageNumber", stageNumber).put("listOfAssessmentResults", listOfAssessmentResults); + + } + + + return null; + } + + @Override + public R productReadGradeDetails(PerformanceUnderProductReq req) { + //筛选类型(0、练习 1、考核 2、竞赛) + switch (req.getPermissions()) { + case 0: + Page exercisePage = new Page(req.getPageNum(), req.getPageSize()); + IPage userPracticeScoreDetails = baseMapper.userPracticeScoreDetails(exercisePage, req); + return R.ok().put("data", userPracticeScoreDetails); + case 1: + Page assessPage = new Page(req.getPageNum(), req.getPageSize()); + IPage userAssessScoreDetails = baseMapper.userAssessScoreDetails(assessPage, req); + return R.ok().put("data", userAssessScoreDetails); + } + + + return null; + } + + /** + * 导出某生的全部该产品下的练习成绩 + * + * @param req + * @param response + * @param request + * @throws IOException + */ + @Override + public void exportDetailsOfStudentPracticeScores(PerformanceUnderProductReq req, HttpServletResponse response, HttpServletRequest request) throws IOException { + + Page page = new Page(1, 10000); + IPage userPracticeScoreDetails = baseMapper.userPracticeScoreDetails(page, req); + String userName = ""; + for (PracticeScoreDetailsUnderProductResp resp : userPracticeScoreDetails.getRecords()) { + if (resp.getUserName() != null) { + userName = resp.getUserName(); + } + +// resp.setGoodsName(req.getGoodsName()); + } + + // 告诉浏览器用什么软件可以打开此文件 + response.setHeader("content-Type", "application/vnd.ms-excel"); + // 下载文件的默认名称 + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(userName + "_练习成绩详情", "UTF-8") + ".xls"); + //编码 + response.setCharacterEncoding("UTF-8"); + Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), PracticeScoreDetailsUnderProductResp.class, userPracticeScoreDetails.getRecords()); + ExportParams exportParams = new ExportParams(null, "delivery", ExcelType.XSSF); + exportParams.setStyle(ExcelStyleUtil.class); + workbook.write(response.getOutputStream()); + + } + + @Override + public void exportDetailsOfStudentAssessmentResults(PerformanceUnderProductReq req, HttpServletResponse response, HttpServletRequest request) throws IOException { + Page page = new Page(1, 10000); + IPage userAssessScoreDetails = baseMapper.userAssessScoreDetails(page, req); + String userName = ""; + for (AssessScoreDetailsUnderProductResp resp : userAssessScoreDetails.getRecords()) { + if (resp.getUserName() != null) { + userName = resp.getUserName(); + } + } + + // 告诉浏览器用什么软件可以打开此文件 + response.setHeader("content-Type", "application/vnd.ms-excel"); + // 下载文件的默认名称 + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(userName + "_考核成绩详情", "UTF-8") + ".xls"); + //编码 + response.setCharacterEncoding("UTF-8"); + Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), AssessScoreDetailsUnderProductResp.class, userAssessScoreDetails.getRecords()); + ExportParams exportParams = new ExportParams(null, userName + "考核成绩详情", ExcelType.XSSF); + exportParams.setStyle(ExcelStyleUtil.class); + workbook.write(response.getOutputStream()); + } + + @Override + public void exportProductPracticeResults(List list, HttpServletResponse response) throws IOException { + // 告诉浏览器用什么软件可以打开此文件 + response.setHeader("content-Type", "application/vnd.ms-excel"); + + // 下载文件的默认名称 + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("练习成绩列表", "UTF-8") + ".xls"); + //编码 + response.setCharacterEncoding("UTF-8"); + + Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), PracticeProjectsUnderTheProductResp.class, list); + ExportParams exportParams = new ExportParams(null, "练习成绩列表", ExcelType.XSSF); + exportParams.setStyle(ExcelStyleUtil.class); + workbook.write(response.getOutputStream()); + + } + + @Override + public void exportProductAssessResults(List list, HttpServletResponse response) throws IOException { + // 告诉浏览器用什么软件可以打开此文件 + response.setHeader("content-Type", "application/vnd.ms-excel"); + // 下载文件的默认名称 + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("考核成绩列表", "UTF-8") + ".xls"); + //编码 + //编码 + response.setCharacterEncoding("UTF-8"); + Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), AssessProjectsUnderTheProductResp.class, list); + ExportParams exportParams = new ExportParams(null, "考核成绩列表", ExcelType.XSSF); + exportParams.setStyle(ExcelStyleUtil.class); + workbook.write(response.getOutputStream()); + + } + + @Override + public List experimentalReportDataProcessing() { + return baseMapper.experimentalReportDataProcessing(); + } + + + public static String turnDayHourMinuteString(int m) { + if (m > 0) { + BigDecimal roundThreeCalc = new BigDecimal(m); + BigDecimal hours = (roundThreeCalc.divide(new BigDecimal("60"), 2, ROUND_HALF_DOWN)); + return hours + "h"; + } + return "0h"; + } + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/LogServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/LogServiceImpl.java new file mode 100644 index 0000000..6e64ba5 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/LogServiceImpl.java @@ -0,0 +1,18 @@ +package com.huoran.occupationlab.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.occupationlab.entity.SysLog; +import com.huoran.occupationlab.mapper.SysLogMapper; +import com.huoran.occupationlab.service.LogService; +import org.springframework.stereotype.Service; + +/** + * 系统日志 + * + * @author cheney + * @version V1.0 + * @date 2022年7月28日 + */ +@Service +public class LogServiceImpl extends ServiceImpl implements LogService { +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/OSSFileServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/OSSFileServiceImpl.java new file mode 100644 index 0000000..3b70974 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/OSSFileServiceImpl.java @@ -0,0 +1,165 @@ +package com.huoran.occupationlab.service.impl; + +import com.aliyun.vod.upload.impl.UploadVideoImpl; +import com.aliyun.vod.upload.req.UploadStreamRequest; +import com.aliyun.vod.upload.resp.UploadStreamResponse; +import com.aliyuncs.DefaultAcsClient; +import com.aliyuncs.exceptions.ClientException; +import com.aliyuncs.vod.model.v20170321.DeleteVideoRequest; +import com.aliyuncs.vod.model.v20170321.DeleteVideoResponse; +import com.aliyuncs.vod.model.v20170321.GetVideoPlayAuthRequest; +import com.aliyuncs.vod.model.v20170321.GetVideoPlayAuthResponse; +import com.huoran.common.entity.FilesResult; +import com.huoran.common.utils.ConstantPropertiesUtil; +import com.huoran.common.utils.VideoUtil; +import com.huoran.occupationlab.service.OSSFileService; +import com.huoran.occupationlab.utils.oss.AliyunOssUtil; +import com.huoran.occupationlab.utils.oss.AliyunVodSDKUtil; +import com.huoran.occupationlab.utils.poi.CustomException; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; + +import java.io.IOException; +import java.io.InputStream; +import java.util.List; + +/** + * @Author chen + * @DATE 2020/10/1 22:01 + * @Version 1.0 + */ +@Slf4j +@Service +public class OSSFileServiceImpl implements OSSFileService { + + + @Override + public FilesResult upload(MultipartFile file, String tableName) throws IOException { + //判断文件是否为视频 + String fileName = tableName+".xls"; + //String fileName = file.getOriginalFilename(); + assert fileName != null; + String suffix = fileName.substring(fileName.lastIndexOf(".") + 1); + boolean isVideo = VideoUtil.isVideo(suffix); + if (isVideo) return vodUpload(file); + return fileupload(file,fileName); + } + + /** + * 文件删除 + * + * @param keys 完整文件名 + * @return 返回成功删除文件名 + */ + @Override + public List fileDeletion(List keys) { + return AliyunOssUtil.deleteFiles(keys); + } + + /** + * 文件上传 + * + * @param file 上传文件 + * @return 返回文件信息 + * @throws IOException IO异常 + */ + @Override + public FilesResult fileupload(MultipartFile file, String tableName) throws IOException { + return AliyunOssUtil.uploadFile(file,tableName); + } + + /** + * 视频上传 + * + * @param file 视频文件 + * @return 返回文件信息 + * @throws IOException IO异常 + */ + @Override + public FilesResult vodUpload(MultipartFile file) throws IOException { + FilesResult filesResult = new FilesResult(); + //获取文件流 + InputStream inputStream = file.getInputStream(); + String originalFilename = file.getOriginalFilename(); + assert originalFilename != null; + String title = originalFilename.substring(0, originalFilename.lastIndexOf(".")); + // 获取文件尾缀 + String fileType = originalFilename.substring(originalFilename.lastIndexOf(".") + 1); + // 文件类型 + filesResult.setFileType(fileType); + + //上传流请求 + UploadStreamRequest request = new UploadStreamRequest(ConstantPropertiesUtil.ACCESS_KEY_ID, ConstantPropertiesUtil.ACCESS_KEY_SECRET, title, originalFilename, inputStream); + + + UploadVideoImpl uploader = new UploadVideoImpl(); + UploadStreamResponse response = uploader.uploadStream(request); + + //如果设置回调URL无效,不影响视频上传,可以返回VideoId同时会返回错误码。 + // 其他情况上传失败时,VideoId为空,此时需要根据返回错误码分析具体错误原因 + String videoId = response.getVideoId(); + if (!response.isSuccess()) { + String errorMessage = "阿里云视频上传错误:" + "code:" + response.getCode() + ", message:" + response.getMessage(); + log.error(errorMessage); + if (StringUtils.isEmpty(videoId)) { + throw new CustomException(201, errorMessage); + } + } + filesResult.setFileId(videoId); + return filesResult; + } + + /** + * 根据视频id删除视频 + * + * @param videoId 视频id + */ + @Override + public void removeVideo(String videoId) throws ClientException { + + DefaultAcsClient client = AliyunVodSDKUtil.initVodClient(ConstantPropertiesUtil.ACCESS_KEY_ID, ConstantPropertiesUtil.ACCESS_KEY_SECRET); + + DeleteVideoRequest request = new DeleteVideoRequest(); + request.setVideoIds(videoId); + DeleteVideoResponse response = client.getAcsResponse(request); + System.out.print("RequestId = " + response.getRequestId() + "\n"); + } + + /** + * 根据视频id批量删除视频 + * + * @param videoIdList 视频id + */ + @Override + public void removeMoreVideo(List videoIdList) throws ClientException { + DefaultAcsClient client = AliyunVodSDKUtil.initVodClient(ConstantPropertiesUtil.ACCESS_KEY_ID, ConstantPropertiesUtil.ACCESS_KEY_SECRET); + DeleteVideoRequest request = new DeleteVideoRequest(); + //使用工具类将集合转化成指定的字符串 + String videos = StringUtils.join(videoIdList, ","); + request.setVideoIds(videos); + DeleteVideoResponse response = client.getAcsResponse(request); + System.out.print("RequestId = " + response.getRequestId() + "\n"); + } + + /** + * 根据视频id获取播放凭证 + * + * @param videoId 视频id + * @return 返回凭证 + */ + @Override + public String getPlayAuth(String videoId) throws ClientException { + + DefaultAcsClient client = AliyunVodSDKUtil.initVodClient(ConstantPropertiesUtil.ACCESS_KEY_ID, ConstantPropertiesUtil.ACCESS_KEY_SECRET); + + GetVideoPlayAuthRequest request = new GetVideoPlayAuthRequest(); + + request.setVideoId(videoId); + + GetVideoPlayAuthResponse response = client.getAcsResponse(request); + //得到播放凭证并返回 + return response.getPlayAuth(); + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/PermissionServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/PermissionServiceImpl.java new file mode 100644 index 0000000..5543e8d --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/PermissionServiceImpl.java @@ -0,0 +1,222 @@ +package com.huoran.occupationlab.service.impl; + +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.occupationlab.entity.*; +import com.huoran.occupationlab.entity.vo.PermissionVO; +import com.huoran.occupationlab.helper.MemuHelper; +import com.huoran.occupationlab.helper.PermissionHelper; +import com.huoran.occupationlab.mapper.PermissionMapper; +import com.huoran.occupationlab.service.PermissionService; +import com.huoran.occupationlab.service.RolePermissionService; +import com.huoran.occupationlab.service.UserInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; + +import java.util.ArrayList; +import java.util.List; + +/** + * 权限 服务实现类 + */ +@Service +public class PermissionServiceImpl extends ServiceImpl implements PermissionService { + + @Autowired + private RolePermissionService rolePermissionService; + + @Autowired + private UserInfoService userInfoService; + + + //获取全部权限菜单 + @Override + public List queryAllMenu() { + + QueryWrapper wrapper = new QueryWrapper<>(); + List permissionList = baseMapper.selectList(wrapper); + List result = bulid(permissionList); + + return result; + } + + //获取管理端权限菜单 + @Override + public List queryManagementAllMenu() { + + QueryWrapper wrapper = new QueryWrapper<>(); + List permissionList = baseMapper.selectList(wrapper); + List result = managementBulid(permissionList); + + return result; + } + + //根据角色获取菜单 + @Override + public List selectAllMenu(String roleId, Integer isPort) { + List allPermissionList = baseMapper.selectList(new QueryWrapper().orderByAsc("CAST(id AS SIGNED)")); + + //根据角色id获取角色权限 + List rolePermissionList = rolePermissionService.list(new QueryWrapper().eq("role_id", roleId).eq("is_port", isPort)); + //转换给角色id与角色权限对应Map对象 + for (int i = 0; i < allPermissionList.size(); i++) { + AclPermission permission = allPermissionList.get(i); + for (int m = 0; m < rolePermissionList.size(); m++) { + AclRolePermission rolePermission = rolePermissionList.get(m); + if (rolePermission.getPermissionId().equals(permission.getId())) { + permission.setSelect(true); + } + } + } + if (isPort == 1) { + List permissionList = bulid(allPermissionList); + return permissionList; + } else { + List permissionList = managementBulid(allPermissionList); + return permissionList; + } + } + + //给角色分配权限 + @Override + public void saveRolePermissionRelationShip(PermissionVO permissionVO) { + String roleId = permissionVO.getRoleId(); + Integer isPort = permissionVO.getIsPort(); + + rolePermissionService.remove(new QueryWrapper().eq("role_id", roleId).eq("is_port", isPort)); + + List rolePermissionList = new ArrayList<>(); + for (String permissionId : permissionVO.getPermissionId()) { + if (StringUtils.isEmpty(permissionId)) continue; + AclRolePermission rolePermission = new AclRolePermission(); + rolePermission.setRoleId(roleId); + rolePermission.setPermissionId(permissionId); + rolePermission.setIsPort(isPort); + rolePermissionList.add(rolePermission); + } + rolePermissionService.saveBatch(rolePermissionList); + } + + //递归删除菜单 + @Override + public void removeChildById(String id) { + List idList = new ArrayList<>(); + this.selectChildListById(id, idList); + + idList.add(id); + baseMapper.deleteBatchIds(idList); + } + + // 根据用户id获取用户菜单 + @Override + public List selectPermissionValueByUserId(String id) { + + List selectPermissionValueList = null; + if (this.isSysAdmin(id)) { + //如果是系统管理员,获取所有权限 + selectPermissionValueList = baseMapper.selectAllPermissionValue(); + } else { + selectPermissionValueList = baseMapper.selectPermissionValueByUserId(id); + } + return selectPermissionValueList; + } + + @Override + public List selectRoleMenu(String roleId) { + + // //查询所有的菜单 + // List permissions = baseMapper.selectList(new QueryWrapper().select("id,name")); + + //根据角色id,查询角色的菜单 + List rolePermissions = rolePermissionService.list(new QueryWrapper().eq("role_id", roleId).select("permission_id")); + List list = new ArrayList<>(); + rolePermissions.forEach(rolePermission -> { + String permissionId = rolePermission.getPermissionId(); + list.add(permissionId); + }); + return list; + } + + @Override + public List selectPermissionByUserId(String userId) { + List selectPermissionList = null; + if (this.isSysAdmin(userId)) { + //如果是超级管理员,获取所有菜单 + selectPermissionList = baseMapper.selectList(null); + } else { + selectPermissionList = baseMapper.selectPermissionByUserId(userId); + } + + List permissionList = PermissionHelper.bulid(selectPermissionList); + List result = MemuHelper.bulid(permissionList); + return result; + } + + /** + * 判断账户是否超级管理员 + */ + private boolean isSysAdmin(String userId) { + HrUserInfo user = userInfoService.getById(userId); + return null != user && "admin".equals(user.getAccount()); + } + + /** + * 递归获取子节点 + */ + private void selectChildListById(String id, List idList) { + List childList = baseMapper.selectList(new QueryWrapper().eq("pid", id).select("id")); + childList.stream().forEach(item -> { + idList.add(item.getId()); + this.selectChildListById(item.getId(), idList); + }); + } + + /** + * 使用递归方法构建权限菜单 + */ + private static List bulid(List treeNodes) { + List trees = new ArrayList<>(); + for (AclPermission treeNode : treeNodes) { + if ("0".equals(treeNode.getPid())) { + treeNode.setLevel(1); + trees.add(findChildren(treeNode, treeNodes)); + } + } + return trees; + } + + /** + * 使用递归方法构建权限菜单 + */ + private static List managementBulid(List treeNodes) { + List trees = new ArrayList<>(); + for (AclPermission treeNode : treeNodes) { + if ("00".equals(treeNode.getPid())) { + treeNode.setLevel(1); + trees.add(findChildren(treeNode, treeNodes)); + } + } + return trees; + } + + /** + * 递归查找子节点 + */ + private static AclPermission findChildren(AclPermission treeNode, List treeNodes) { + treeNode.setChildren(new ArrayList()); + + for (AclPermission it : treeNodes) { + if (treeNode.getId().equals(it.getPid())) { + int level = treeNode.getLevel() + 1; + it.setLevel(level); + if (treeNode.getChildren() == null) { + treeNode.setChildren(new ArrayList<>()); + } + treeNode.getChildren().add(findChildren(it, treeNodes)); + } + } + return treeNode; + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/PlayRecordServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/PlayRecordServiceImpl.java new file mode 100644 index 0000000..4159e7b --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/PlayRecordServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.occupationlab.service.impl; + +import com.huoran.occupationlab.entity.PlayRecord; +import com.huoran.occupationlab.mapper.PlayRecordMapper; +import com.huoran.occupationlab.service.PlayRecordService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 资源播放记录表 服务实现类 + *

+ * + * @author lr + * @since 2022-09-09 + */ +@Service +public class PlayRecordServiceImpl extends ServiceImpl implements PlayRecordService { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ProjectHiddenServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ProjectHiddenServiceImpl.java new file mode 100644 index 0000000..6653410 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ProjectHiddenServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.occupationlab.service.impl; + +import com.huoran.occupationlab.entity.ProjectHidden; +import com.huoran.occupationlab.mapper.ProjectHiddenMapper; +import com.huoran.occupationlab.service.ProjectHiddenService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 此表是在教师端成绩管理,虚仿以及教学列表展示中使用到 服务实现类 + *

+ * + * @author lr + * @since 2021-09-23 + */ +@Service +public class ProjectHiddenServiceImpl extends ServiceImpl implements ProjectHiddenService { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ProjectJudgmentServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ProjectJudgmentServiceImpl.java new file mode 100644 index 0000000..68bdd79 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ProjectJudgmentServiceImpl.java @@ -0,0 +1,96 @@ +package com.huoran.occupationlab.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.common.entity.ProjectManage; +import com.huoran.occupationlab.entity.ProjectJudgment; +import com.huoran.occupationlab.mapper.ProjectJudgmentMapper; +import com.huoran.occupationlab.mapper.ProjectManageMapper; +import com.huoran.occupationlab.service.ProjectJudgmentService; +import com.huoran.occupationlab.utils.CollectionUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.ObjectUtils; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + *

+ * 项目管理判分点绑定表 服务实现类 + *

+ * + * @author Mr.JK + * @since 2021-08-26 + */ +@Service +public class ProjectJudgmentServiceImpl extends ServiceImpl implements ProjectJudgmentService { + + @Autowired + private ProjectJudgmentMapper projectJudgmentMapper; + + @Autowired + private ProjectManageMapper projectManageMapper; + +// @Autowired +// private JudgmentPointClient judgmentPointClient; + + @Override + public Integer getJudgmentScore(Integer projectId, Integer judgmentId) { + ProjectJudgment projectJudgment = projectJudgmentMapper.selectOne(new QueryWrapper() + .eq("project_id", projectId).eq("judgment_id", judgmentId)); + if (ObjectUtils.isEmpty(projectJudgment)) { + return null; + } + return projectJudgment.getScore(); + } + + @Override + @Transactional(rollbackFor = RuntimeException.class) + public Integer updateProjectJudgment(Integer projectId, List projectJudgments) { + //编辑排序,不影响原本判分点顺序,存在添加绑定关系,不存在解除绑定 + ArrayList before = new ArrayList<>(); + ArrayList after = new ArrayList<>(); + + //查询项目修改前判分点 + QueryWrapper queryWrapper = new QueryWrapper().eq("project_id", projectId); + + List oldJudgmentList = projectJudgmentMapper.selectList(queryWrapper); + for (ProjectJudgment projectJudgment : oldJudgmentList) { + before.add(projectJudgment.getId()); + } + + //更新判分点内容 + ProjectManage projectManage = projectManageMapper.selectById(projectId); + for (ProjectJudgment judgment : projectJudgments) { + //id为空新增 + if (ObjectUtils.isEmpty(judgment.getId())) { + projectJudgmentMapper.insert(judgment); + } else { + projectJudgmentMapper.updateJudgment(judgment.getId(), judgment.getScore(), judgment.getSort()); + after.add(judgment.getId()); + } + } + + //长度变化,表示有删减 + if (before.size() != after.size()) { + Collection differentNoDuplicate = CollectionUtil.getDifferentNoDuplicate(before, after); + differentNoDuplicate.forEach(i -> { + //删除项目中的判分点 + projectJudgmentMapper.deleteById((Integer) i); + + //解绑 +// if (projectManage.getSystemId() <= 10) { +// judgmentPointClient.bcBandingProject((Integer) i, projectId, 0); +// } else { +// judgmentPointClient.lcBandingProject((Integer) i, projectId, 0); +// } + }); + } + + + return 1; + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ProjectManageDisableServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ProjectManageDisableServiceImpl.java new file mode 100644 index 0000000..c0bfafc --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ProjectManageDisableServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.occupationlab.service.impl; + +import com.huoran.occupationlab.entity.ProjectManageDisable; +import com.huoran.occupationlab.mapper.ProjectManageDisableMapper; +import com.huoran.occupationlab.service.ProjectManageDisableService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 记录项目学校端的禁用记录 服务实现类 + *

+ * + * @author lr + * @since 2022-01-12 + */ +@Service +public class ProjectManageDisableServiceImpl extends ServiceImpl implements ProjectManageDisableService { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ProjectManageServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ProjectManageServiceImpl.java new file mode 100644 index 0000000..f7394ed --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ProjectManageServiceImpl.java @@ -0,0 +1,754 @@ +package com.huoran.occupationlab.service.impl; + +import cn.hutool.core.util.ObjectUtil; +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.huoran.api.NakadaiClient; +import com.huoran.api.UserClient; +import com.huoran.common.constant.DelConstant; +import com.huoran.common.constant.PlatformConstant; +import com.huoran.common.entity.BcJudgmentPoint; +import com.huoran.common.entity.LcJudgmentPoint; +import com.huoran.common.entity.ProjectJudgmentVo; +import com.huoran.common.entity.ProjectManage; +import com.huoran.common.entity.to.JudgmentPointDataTo; +import com.huoran.common.entity.to.ProjectDataTo; +import com.huoran.common.exception.CustomException; +import com.huoran.common.exception.ExceptionEnum; +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.ProjectJudgment; +import com.huoran.occupationlab.entity.ProjectManageDisable; +import com.huoran.occupationlab.entity.SchoolProjectHintOpen; +import com.huoran.occupationlab.entity.req.PageAssessmentForProjectReq; +import com.huoran.occupationlab.entity.req.ProjectManageReq; +import com.huoran.occupationlab.entity.vo.ProjectVo; +import com.huoran.occupationlab.mapper.ProjectJudgmentMapper; +import com.huoran.occupationlab.mapper.ProjectManageDisableMapper; +import com.huoran.occupationlab.mapper.ProjectManageMapper; +import com.huoran.occupationlab.mapper.SchoolProjectHintOpenMapper; +import com.huoran.occupationlab.service.ProjectManageService; +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.util.ObjectUtils; +import org.springframework.util.StringUtils; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +/** + *

+ * 项目管理表 服务实现类 + *

+ * + * @author Mr.JK + * @since 2021-08-26 + */ +@Service +public class ProjectManageServiceImpl extends ServiceImpl implements ProjectManageService { + + @Autowired + private ProjectManageMapper projectManageMapper; + + @Autowired + private ProjectJudgmentMapper projectJudgmentMapper; + + @Autowired + private SchoolProjectHintOpenMapper schoolProjectHintOpenMapper; + +// @Autowired +// private JudgmentPointClient judgmentPointClient; + + @Autowired + private NakadaiClient nakadaiClient; + + @Autowired + private UserClient userClient; + + @Autowired + private ProjectManageDisableMapper disableMapper; + + @Override + @Transactional + public R addProjectManage(ProjectVo projectVo) { + + ProjectManage projectManage = projectVo.getProjectManage(); + if (projectManage.getState() == 0) { + projectManage.setIsOpen(1); + } + if (projectManage.getSchoolId().equals("0")) { + projectManage.setFounder(1);//创建人角色(0、系统 1、老师) + } + + //新增项目管理 + int ret = projectManageMapper.insert(projectManage); + if (ret < 1) { + throw new CustomException(ExceptionEnum.INSERT_PROJECT_MANAGE_FAIL); + } + + //新增项目管理判分点中间表 + for (ProjectJudgment projectJudgment : projectVo.getProjectJudgmentList()) { + projectJudgment.setProjectId(projectManage.getProjectId()); + projectJudgmentMapper.insert(projectJudgment); + } + + //绑定判分点 + Integer result = this.bindProjectJudgment(projectManage.getSystemId(), + projectManage.getProjectId(), projectVo.getProjectJudgmentList()); + if (result == 0) { + return R.error("判分点绑定失败!"); + } + return R.ok(); + } + + @Override + @Transactional + public R updateProjectManage(ProjectVo projectVo) { + + ProjectManage projectManage = projectVo.getProjectManage(); + int ret = projectManageMapper.updateById(projectManage); + if (ret < 1) { + throw new CustomException(ExceptionEnum.UPDATE_PROJECT_MANAGE_FAIL); + } + return R.ok(); + } + + private Integer bindProjectJudgment(Integer systemId, Integer projectId, List projectJudgmentList) { + int result = 1; +// 根据系统查询判分点类型 + Integer type = baseMapper.selectSystemType(systemId); + for (ProjectJudgment projectJudgment : projectJudgmentList) { + + //判分点绑定--根据系统 11为流程类 +// if (type == 0) { +// result = judgmentPointClient +// .bcBandingProject(projectJudgment.getJudgmentId(), projectId, 1); +// } else { +// result = judgmentPointClient +// .lcBandingProject(projectJudgment.getJudgmentId(), projectId, 1); +// } + if (result == 0) { + return 0; + } + } + return 1; + } + + @Override + @Transactional + public R deleteProjectManage(List projectIds, Integer platformId) { + + //职站 + if (platformId.equals(PlatformConstant.POST_STATION)) { + + for (Integer projectId : projectIds) { + ProjectManage projectManage = projectManageMapper.selectById(projectId); + + QueryWrapper wrapper = new QueryWrapper() + .eq("project_id", projectId); + + //解绑判分点绑定的项目管理 + List projectJudgments = projectJudgmentMapper.selectList(wrapper); + +// for (ProjectJudgment judgment : projectJudgments) { +// if (projectManage.getSystemId() <= 10) { +// judgmentPointClient.bcBandingProject(judgment.getJudgmentId(), projectId, 0); +// } else { +// judgmentPointClient.lcBandingProject(judgment.getJudgmentId(), projectId, 0); +// } +// } + + //删除 中间表 + projectJudgmentMapper.delete(wrapper); + } + projectManageMapper.deleteBatchIds(projectIds); + + } + //中台 + if (platformId.equals(PlatformConstant.NAKADAI)) { + ProjectManage projectManage = new ProjectManage(); + projectManage.setZtDel(DelConstant.IS_DEL); + for (Integer projectId : projectIds) { + projectManage.setProjectId(projectId); + projectManageMapper.updateById(projectManage); + } + } + return R.ok(); + } + + @Override + public R getProjectDetail(Integer projectId, Integer stuAssessent, Integer schoolId) { + + ProjectManage projectManage = projectManageMapper.selectById(projectId); + if (projectManage.getFounder() == 0) { + QueryWrapper openQueryWrapper = new QueryWrapper<>(); + openQueryWrapper.eq("school_id", schoolId); + openQueryWrapper.eq("project_id", projectId); + SchoolProjectHintOpen schoolProjectHintOpen = schoolProjectHintOpenMapper.selectOne(openQueryWrapper); + if (ObjectUtil.isNotNull(schoolProjectHintOpen)) { + projectManage.setHintOpenBySchool(schoolProjectHintOpen.getHintOpen()); + } else { + projectManage.setHintOpenBySchool(0); + } + } + + //查询中间关系表 --排序字段 + List projectJudgmentList = projectJudgmentMapper + .selectList(new QueryWrapper().eq("project_id", projectId) + .orderByAsc("sort")); + +// 根据系统查询判分点类型 + Integer type = baseMapper.selectSystemType(projectManage.getSystemId()); + List projectJudgmentVos = new ArrayList<>(); + for (ProjectJudgment projectJudgment : projectJudgmentList) { + BcJudgmentPoint judgmentPoint = null; + //根据系统id获取判分点名称、要求 +// if (type == 0) { +// +// judgmentPoint = judgmentPointClient +// .queryBcJudgmentByBcId(projectJudgment.getJudgmentId(), DelConstant.IS_OPEN); +// if (stuAssessent != null) { +// judgmentPoint = judgmentPointClient +// .queryBcJudgmentByBcId(projectJudgment.getJudgmentId(), null); +// +// } +// +// if (judgmentPoint != null) { +// if (projectManage.getPermissions() == 1) { +// ProjectJudgmentVo projectJudgmentVo = new ProjectJudgmentVo(); +// projectJudgmentVo.setId(projectJudgment.getId()); +// projectJudgmentVo.setScore(projectJudgment.getScore()); +// projectJudgmentVo.setProjectId(projectJudgment.getProjectId().toString()); +// projectJudgmentVo.setJudgmentId(projectJudgment.getJudgmentId()); +// projectJudgmentVo.setName(judgmentPoint.getName()); +// projectJudgmentVo.setExperimentalRequirements(judgmentPoint.getExperimentalRequirements()); +// projectJudgmentVo.setExperimentCodeType(judgmentPoint.getExperimentCodeType()); +// projectJudgmentVo.setExperimentalRequirementsType(judgmentPoint.getExperimentalRequirementsType()); +// projectJudgmentVos.add(projectJudgmentVo); +// } else { +// if (judgmentPoint.getIsOpen() == 0) { +// ProjectJudgmentVo projectJudgmentVo = new ProjectJudgmentVo(); +// projectJudgmentVo.setId(projectJudgment.getId()); +// projectJudgmentVo.setScore(projectJudgment.getScore()); +// projectJudgmentVo.setProjectId(projectJudgment.getProjectId().toString()); +// projectJudgmentVo.setJudgmentId(projectJudgment.getJudgmentId()); +// projectJudgmentVo.setName(judgmentPoint.getName()); +// projectJudgmentVo.setExperimentalRequirements(judgmentPoint.getExperimentalRequirements()); +// projectJudgmentVo.setExperimentCodeType(judgmentPoint.getExperimentCodeType()); +// projectJudgmentVo.setExperimentalRequirementsType(judgmentPoint.getExperimentalRequirementsType()); +// projectJudgmentVos.add(projectJudgmentVo); +// +// } +// } +// } +// +// } else { +// LcJudgmentPoint lcJudgmentPoint = null; +// lcJudgmentPoint = judgmentPointClient +// .queryLcJudgmentByLcId(projectJudgment.getJudgmentId(), DelConstant.IS_OPEN); +// if (stuAssessent != null) { +// lcJudgmentPoint = judgmentPointClient +// .queryLcJudgmentByLcId(projectJudgment.getJudgmentId(), null); +// } +// +// if (ObjectUtil.isNotNull(lcJudgmentPoint)) { +// if (projectManage.getPermissions() == 1) { +// +// ProjectJudgmentVo projectJudgmentVo = new ProjectJudgmentVo(); +// projectJudgmentVo.setId(projectJudgment.getId()); +// projectJudgmentVo.setScore(projectJudgment.getScore()); +// projectJudgmentVo.setProjectId(projectJudgment.getProjectId().toString()); +// projectJudgmentVo.setJudgmentId(projectJudgment.getJudgmentId()); +// projectJudgmentVo.setName(lcJudgmentPoint.getName()); +// projectJudgmentVo.setExperimentalRequirements(lcJudgmentPoint.getExperimentalRequirements()); +// projectJudgmentVos.add(projectJudgmentVo); +// } else { +// if (lcJudgmentPoint.getIsOpen() == 0) { +// ProjectJudgmentVo projectJudgmentVo = new ProjectJudgmentVo(); +// projectJudgmentVo.setId(projectJudgment.getId()); +// projectJudgmentVo.setScore(projectJudgment.getScore()); +// projectJudgmentVo.setProjectId(projectJudgment.getProjectId().toString()); +// projectJudgmentVo.setJudgmentId(projectJudgment.getJudgmentId()); +// projectJudgmentVo.setName(lcJudgmentPoint.getName()); +// projectJudgmentVo.setExperimentalRequirements(lcJudgmentPoint.getExperimentalRequirements()); +// projectJudgmentVos.add(projectJudgmentVo); +// } +// } +// } +// +// } + + } + return R.ok().put("projectManage", projectManage).put("projectJudgmentVos", projectJudgmentVos); + + } + + @Override + public Integer queryNameIsExist(ProjectManage projectManage) { + + Integer projectId = ObjectUtils.isEmpty(projectManage.getProjectId()) ? 0 : projectManage.getProjectId(); + + if (StringUtils.isEmpty(projectManage.getProjectName())) { + return 0; + } + + QueryWrapper wrapper = new QueryWrapper().eq("project_name", projectManage.getProjectName()); + wrapper.eq("is_del", DelConstant.NOT_DEL); + wrapper.eq("zt_del", DelConstant.NOT_DEL); + /*switch (projectManage.getFounder()) { + case 1: + wrapper.eq("school_id", projectManage.getSchoolId()); + break; + }*/ + + ProjectManage newProjectManage = projectManageMapper.selectOne(wrapper); + if (!ObjectUtils.isEmpty(newProjectManage) && !newProjectManage.getProjectId().equals(projectId)) { + return 0; + } + + return 1; + } + + @Override + public R avgValues(Integer number) { + final Integer HUNDRED = 100; + Integer score = HUNDRED / number; + List list = new ArrayList(); + if (HUNDRED % number == 0) { + for (int i = 0; i < number; i++) { + list.add(score); + } + } else { + for (int i = 0; i < number; i++) { + list.add(score); + } + for (int i = HUNDRED % number; i > 0; i--) { + list.set(i, score + 1); + } + } + return R.ok().put("data", list); + } + + @Override + public R getProjectBySystemId(String systemId, String accountId, Integer permissions, Integer cId, Integer mallId) { + + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + + //查询学校在产品下创建的练习项目 + List projectManages = projectManageMapper + .selectList(new QueryWrapper() + .eq("school_id", schoolId) + .eq("permissions", permissions) + .eq("zt_del", DelConstant.NOT_DEL) + .eq("is_del", DelConstant.NOT_DEL) + .eq("zt_open", 0) + .eq("is_open", 0) + .eq("mall_id", mallId).last(" AND FIND_IN_SET( system_id, '" + systemId + "' )") + ); + + //课程排序优于老师创建的项目 + List projectManageList = new ArrayList<>(); + List projectIds = projectManageMapper.selectCurriculumProject(schoolId, systemId, permissions, cId); + + for (Integer projectId : projectIds) { + ProjectManage manage = projectManageMapper.selectById(projectId); + projectManageList.add(manage); + } + projectManageList.addAll(projectManages); + + return R.ok().put("projects", projectManageList).put("projectSize", projectIds.size()); + } + + + @Override + public List getProjectBySystemIdRemoteCall(String systemId, String accountId, Integer permissions, Integer cId, Integer mallId) { + + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + + List projectManages = projectManageMapper + .selectList(new QueryWrapper() + .eq("school_id", schoolId) + .eq("permissions", permissions) + .eq("zt_del", DelConstant.NOT_DEL) + .eq("is_del", DelConstant.NOT_DEL) + .eq("zt_open", 0) + .eq("is_open", 0).eq("mall_id", mallId) + .last(" AND FIND_IN_SET( system_id, '" + systemId + "' )") + ); + + //课程排序优于老师创建的项目 + List projectManageList = new ArrayList<>(); + List projectIds = projectManageMapper.selectCurriculumProject(schoolId, systemId, permissions, cId); + + for (Integer projectId : projectIds) { + ProjectManage manage = projectManageMapper.selectById(projectId); + projectManageList.add(manage); + } + projectManageList.addAll(projectManages); + + return projectManageList; + } + + + @Override + public R copyProjectManage(ProjectVo projectVo) { + + //循环匹配名称 + ProjectManage projectManage = projectVo.getProjectManage(); + String projectName = projectManage.getProjectName(); + for (int i = 1; i < Integer.MAX_VALUE; i++) { + //传进名称无重复 + if (this.queryNameIsExist(projectManage) == 1) { + break; + } + projectManage.setProjectName(projectName + "(" + i + ")"); + Integer ret = this.queryNameIsExist(projectManage); + if (ret == 1) { + //不重复则塞回原对象 + projectVo.getProjectManage().setProjectName(projectName + "(" + i + ")"); + break; + } + } + + //排序赋值 + List newProjectJudgment = new ArrayList<>(); + for (int i = 0; i < projectVo.getProjectJudgmentList().size(); i++) { + ProjectJudgment projectJudgment = projectVo.getProjectJudgmentList().get(i); + projectJudgment.setSort(i + 1); + newProjectJudgment.add(projectJudgment); + } + projectVo.setProjectJudgmentList(newProjectJudgment); + + if (projectVo.getProjectManage().getAccountId() == 1) { + projectVo.getProjectManage().setFounder(0); + } + return this.addProjectManage(projectVo); + } + + @Override + public List getInternalProjectBySystemId(List systemId, Integer permissions) { + String id = ""; + for (Integer sysId : systemId) { + id += sysId + ","; + } + String systemIds = id.substring(0, id.length() - 1); + return baseMapper.selectProjectList(systemIds, permissions); + } + + @Override + public R getSystemIdBySchool(Integer schoolId) { + Integer customerId = nakadaiClient.getCustomerBySchoolId(schoolId); + if (customerId == -1) { + return R.error("查询客户失败!"); + } + List systemIds = nakadaiClient.getSystemIdByCustomerId(customerId); + if (ObjectUtils.isEmpty(systemIds)) { + return R.error("暂无订单,请下单后再查看!"); + } + ArrayList> systemObject = new ArrayList<>(); + for (Integer systemId : systemIds) { + String systemName = nakadaiClient.getSystemNameBySystemId(systemId); + HashMap map = new HashMap<>(); + map.put("id", systemId); + map.put("label", systemName); + systemObject.add(map); + } + return R.ok().put("data", systemObject); + } + + @Override + public void updateIsOpen(Integer projectId, Integer isOpen, Integer platformId, Integer schoolId) { + + if (platformId.equals(PlatformConstant.POST_STATION)) { + //职站(经过职站禁用的项目 添加一条禁用记录至ol_project_manage_disable表) + + //查询项目是否是中台内置还是本校发布的 + ProjectManage manage = baseMapper.selectById(projectId); + switch (manage.getFounder()) { //创建人角色(0、系统 1、老师) + case 0: + switch (isOpen) {//是否开启(0开启 1禁用 默认0) + case 1: + //禁用 增加禁用表记录 + ProjectManageDisable disable = new ProjectManageDisable(); + disable.setSchoolId(schoolId); + disable.setProjectId(projectId); + disableMapper.insert(disable); + break; + case 0: + //启用 删除禁用表记录 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("school_id", schoolId); + queryWrapper.eq("project_id", projectId); + disableMapper.delete(queryWrapper); + } + break; + case 1: + //对本校的项目进行禁用启用 不对项目禁用表操作!! + projectManageMapper.updateIsOpenZz(projectId, isOpen); + break; + } + + } else { + //中台 + projectManageMapper.updateIsOpenZt(projectId, isOpen); + } + + //新需求 开启时默认发布 + if (isOpen == 0) { + projectManageMapper.updateState(projectId); + } + + } + + @Override + public R queryProjectManageByNakadai(ProjectManageReq projectManageReq) { + /** + * 中台列表需求: + * 从中台进入实验项目管理: + * 系统筛选条件:默认展示内置的项目信息 + * 教师筛选条件:默认展示全部学校发布的项目信息 + * 全部筛选条件:默认展示内置项目信息 以及展示全部学校发布的项目 + */ + Page page = new Page(projectManageReq.getPageNum(), projectManageReq.getPageSize()); + IPage iPage = null; + /* + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("system_id", projectManageReq.getSystemId()); + + if (projectManageReq.getProjectName() != null) { + queryWrapper.like("project_name", projectManageReq.getProjectName()); + } + + if (projectManageReq.getPermissions() != null) { + queryWrapper.eq("permissions", projectManageReq.getPermissions()); + } + + if (projectManageReq.getState() != null) { + queryWrapper.eq("state", projectManageReq.getState()); + }*/ + + switch (projectManageReq.getFounder()) { + + case 0://0:系统 +// queryWrapper.eq("zt_del", DelConstant.NOT_DEL).eq("founder", projectManageReq.getFounder()).orderByDesc("update_time"); + + //中台——>系统筛选 +// iPage = baseMapper.selectPage(page, queryWrapper); + iPage = baseMapper.nakadaiProjectListBySystem(page, projectManageReq); + return R.ok().put("data", iPage); + case 1://1:老师 + iPage = baseMapper.nakadaiProjectListByTeacher(page, projectManageReq); + return R.ok().put("data", iPage); + case 2: //2:全部 + //中台:查询中台全部数据以及学校发布的全部数据 + iPage = baseMapper.queryNakadaiProjectList(page, projectManageReq); + return R.ok().put("data", iPage); + + } + /*iPage = baseMapper.selectPage(page, queryWrapper); + return R.ok().put("data", iPage);*/ + return R.ok(); + } + + @Override + public R queryProjectManageByOccupationlab(ProjectManageReq projectManageReq) { + /** + *需求: + * 从职站进入实验项目管理: + * 系统筛选条件:默认展示由该校购买的订单下包含的课程下的项目 + * 教师筛选条件:默认展示本校发布的项目信息(同时依据本校角色展示超管、管理员可查看该校全部,其它角色只可看本人发布的) + * 全部筛选条件:默认展示由该校购买的订单下包含的课程下的项目以及默认展示本校发布的项目信息(同时依据本校角色展示超管、管理员可查看该校全部,其它角色只可看本人发布的) + */ + Page page = new Page(projectManageReq.getPageNum(), projectManageReq.getPageSize()); + IPage iPage = null; + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("school_id", projectManageReq.getSchoolId()); + List disables = disableMapper.selectList(queryWrapper); + if (disables.size() > 0) { + projectManageReq.setOccupationlabDel(1); + } + switch (projectManageReq.getFounder()) { + //0:系统 + case 0: + if (projectManageReq.getPlatformId() == PlatformConstant.POST_STATION) { + //当平台为职站时候查询根据课程绑定的项目(只查询购买订单下课程所绑定启用且未删除的项目) + String cid = nakadaiClient.getSchoolCourse(projectManageReq.getSchoolId()); +// projectManageReq.setCid(cid); + projectManageReq.setCid(projectManageReq.getCid()); + iPage = baseMapper.queryProjectManage(page, projectManageReq); + for (ProjectManage record : iPage.getRecords()) { + QueryWrapper openQueryWrapper = new QueryWrapper<>(); + openQueryWrapper.eq("school_id", projectManageReq.getSchoolId()); + openQueryWrapper.eq("project_id", record.getProjectId()); + SchoolProjectHintOpen schoolProjectHintOpen = schoolProjectHintOpenMapper.selectOne(openQueryWrapper); + if (ObjectUtil.isNotNull(schoolProjectHintOpen)) { + record.setHintOpenBySchool(schoolProjectHintOpen.getHintOpen()); + } else { + record.setHintOpenBySchool(0); + } + } + return R.ok().put("data", iPage); + } + case 1: + //1:老师 + if (projectManageReq.getPlatformId() == PlatformConstant.POST_STATION) { + //依据角色查询本校内的项目 + String roleName = userClient.getUserAllRole(projectManageReq.getAccountId() + "", 1); + projectManageReq.setIsAdmin(0); + //依据角色查询本校内的项目(超管、管理员角色能看到本校内发布的全部项目、其它角色只能看到自己发布的以及超管、管理员、系统内置发布的项目) + if (roleName.contains("超级管理员") || roleName.contains("管理员")) { + projectManageReq.setIsAdmin(1); + } else { + List accountIdList = userClient.getAccountIdsBySchoolId(projectManageReq.getSchoolId(), PlatformConstant.POST_STATION); + //为满足非超管、管理员的角色情况下能看到本人及超管、管理员角色发布的项目 由此将当前用户的账号id赋值进去List + accountIdList.add(projectManageReq.getAccountId()); + projectManageReq.setAccountIdList(accountIdList); + } + iPage = baseMapper.queryProjectManageByTeacher(page, projectManageReq); + for (ProjectManage record : iPage.getRecords()) { + if (record.getFounder() == 0) { + QueryWrapper openQueryWrapper = new QueryWrapper<>(); + openQueryWrapper.eq("school_id", projectManageReq.getSchoolId()); + openQueryWrapper.eq("project_id", record.getProjectId()); + SchoolProjectHintOpen schoolProjectHintOpen = schoolProjectHintOpenMapper.selectOne(openQueryWrapper); + if (ObjectUtil.isNotNull(schoolProjectHintOpen)) { + record.setHintOpenBySchool(schoolProjectHintOpen.getHintOpen()); + } else { + record.setHintOpenBySchool(0); + } + } + } + return R.ok().put("data", iPage); + } + case 2: {//全部 + //查询购买的课程下的项目以及根据角色查询本校内的项目 + String cid = nakadaiClient.getSchoolCourse(projectManageReq.getSchoolId()); +// projectManageReq.setCid(cid); + projectManageReq.setCid(projectManageReq.getCid()); + //依据角色查询本校内的项目(超管管理员角色能看到本校内发布的全部项目、其它角色只能看到自己发布的以及超管管理员发布的项目) + String roleName = userClient.getUserAllRole(projectManageReq.getAccountId() + "", 1); + projectManageReq.setIsAdmin(0); + + if (roleName.contains("超级管理员") || roleName.contains("管理员")) { + projectManageReq.setIsAdmin(1); + } else { + List accountIdList = userClient.getAccountIdsBySchoolId(projectManageReq.getSchoolId(), PlatformConstant.POST_STATION); + //为满足非超管、管理员的角色情况下能看到本人及超管、管理员角色发布的项目 由此将当前用户的账号id赋值进去List + accountIdList.add(projectManageReq.getAccountId()); + projectManageReq.setAccountIdList(accountIdList); + } + iPage = baseMapper.queryOccupationlabProjectList(page, projectManageReq); + for (ProjectManage record : iPage.getRecords()) { + if (record.getFounder() == 0) { + QueryWrapper openQueryWrapper = new QueryWrapper<>(); + openQueryWrapper.eq("school_id", projectManageReq.getSchoolId()); + openQueryWrapper.eq("project_id", record.getProjectId()); + SchoolProjectHintOpen schoolProjectHintOpen = schoolProjectHintOpenMapper.selectOne(openQueryWrapper); + if (ObjectUtil.isNotNull(schoolProjectHintOpen)) { + record.setHintOpenBySchool(schoolProjectHintOpen.getHintOpen()); + } else { + record.setHintOpenBySchool(0); + } + } + } + return R.ok().put("data", iPage); + } + + } + + return R.ok(); + } + + @Override + public R getSchoolProjectByAssessent(PageAssessmentForProjectReq req) { + Page page = new Page(req.getPageNum(), req.getPageSize()); + IPage iPage = null; + + ProjectManageReq projectManageReq = new ProjectManageReq(); + projectManageReq.setSystemId(req.getSystemId()); + BeanUtils.copyProperties(req, projectManageReq); + projectManageReq.setPermissions(req.getPermissions()); + //依据角色查询本校内的项目(超管管理员角色能看到本校内发布的全部项目、其它角色只能看到自己发布的以及超管管理员发布的项目) + String roleName = userClient.getUserAllRole(projectManageReq.getAccountId() + "", 1); + projectManageReq.setIsAdmin(0); + if (roleName.contains("超级管理员") || roleName.contains("管理员")) { + projectManageReq.setIsAdmin(1); + } else { + List accountIdList = userClient.getAccountIdsBySchoolId(projectManageReq.getSchoolId(), PlatformConstant.POST_STATION); + //为满足非超管、管理员的角色情况下能看到本人及超管、管理员角色发布的项目 由此将当前用户的账号id赋值进去List + accountIdList.add(projectManageReq.getAccountId()); + projectManageReq.setAccountIdList(accountIdList); + } + iPage = baseMapper.queryOccupationlabProjectList(page, projectManageReq); + + return R.ok().put("data", iPage); + } + + @Override + public R getProjectAssessmentByCompetition(PageAssessmentForProjectReq req) { + Page page = new Page(req.getPageNum(), req.getPageSize()); + IPage iPage = null; + + ProjectManageReq projectManageReq = new ProjectManageReq(); + projectManageReq.setSystemId(req.getSystemId()); + BeanUtils.copyProperties(req, projectManageReq); + projectManageReq.setPermissions(2); + iPage = baseMapper.selectProjectAssessmentByCompetition(page, projectManageReq); + + if (req.getSchoolId() != null) { + //教师端创建的竞赛类项目 + List projectManages = projectManageMapper + .selectList(new QueryWrapper() +// .eq("system_id", systemId) + .eq("school_id", req.getSchoolId()) + .eq("permissions", 2) + .eq("zt_del", DelConstant.NOT_DEL) + .eq("is_del", DelConstant.NOT_DEL) + .eq("zt_open", 0) + .eq("is_open", 0).in("system_id", req.getSystemId()) + ); + for (ProjectManage projectManage : projectManages) { + String name = baseMapper.selectSystemName(projectManage.getSystemId()); + projectManage.setSystemName(name); + } + iPage.getRecords().addAll(projectManages); + } + + return R.ok().put("data", iPage); + } + + @Override + public Integer getCurriculumCountByType(Integer cid,Integer permissions) { + return baseMapper.getCurriculumCountByType(cid, permissions); + } + + @Override + public Integer projectCreatedUnderProduct(Integer mallId, Integer permissions, Integer schoolId) { + return baseMapper.projectCreatedUnderProduct(mallId, permissions, schoolId); + } + + @Override + public JudgmentPointDataTo getProjectPoints(ProjectDataTo projectDataTo) { + + if (projectManageMapper.selectSystemType(projectDataTo.getSystemId()) == 0) { + //查询编程判分点 + ArrayList judgmentIds = projectJudgmentMapper.selectBcJudgmentIdList(projectDataTo.getSet(), projectDataTo.getName()); + JudgmentPointDataTo judgmentPointDataTo = new JudgmentPointDataTo(); + judgmentPointDataTo.setJudgmentIds(judgmentIds); + return judgmentPointDataTo; + } else { + //查询流程判分点 + ArrayList judgmentIds = projectJudgmentMapper.selectLcJudgmentIdList(projectDataTo.getSet(), projectDataTo.getName()); + JudgmentPointDataTo judgmentPointDataTo = new JudgmentPointDataTo(); + judgmentPointDataTo.setJudgmentIds(judgmentIds); + return judgmentPointDataTo; + } + } + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ProvinceServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ProvinceServiceImpl.java new file mode 100644 index 0000000..d7511e0 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ProvinceServiceImpl.java @@ -0,0 +1,29 @@ +package com.huoran.occupationlab.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.occupationlab.entity.Province; +import com.huoran.occupationlab.mapper.ProvinceMapper; +import com.huoran.occupationlab.service.ProvinceService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 省份表 服务实现类 + *

+ * + * @author Ning + * @since 2020-10-27 + */ +@Service +public class ProvinceServiceImpl extends ServiceImpl implements ProvinceService { + + @Override + public List queryProvince() { + QueryWrapper chapterWrapper = new QueryWrapper<>(); + chapterWrapper.select("*"); + return baseMapper.selectList(chapterWrapper); + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/PythonFileDataServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/PythonFileDataServiceImpl.java new file mode 100644 index 0000000..697c342 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/PythonFileDataServiceImpl.java @@ -0,0 +1,45 @@ +package com.huoran.occupationlab.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.huoran.common.response.R; +import com.huoran.occupationlab.entity.ProjectManage; +import com.huoran.occupationlab.entity.PythonFileData; +import com.huoran.occupationlab.mapper.PythonFileDataMapper; +import com.huoran.occupationlab.service.PythonFileDataService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 服务实现类 + *

+ * + * @author lr + * @since 2022-04-06 + */ +@Service +public class PythonFileDataServiceImpl extends ServiceImpl implements PythonFileDataService { + + @Override + public R myData(PythonFileData fileData) { + Page page = new Page(fileData.getPageNum(), fileData.getPageSize()); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("account_id", fileData.getAccountId()); + queryWrapper.eq("school_id", fileData.getSchoolId()); + if (!fileData.getFileName().equals("")) { + queryWrapper.like("file_name", fileData.getFileName()); + } + queryWrapper.orderByDesc("id"); + IPage list = baseMapper.selectPage(page, queryWrapper); + return R.ok().put("data", list); + } + + @Override + public Double statistics(Integer accountId, Integer schoolId) { + return baseMapper.statistics(accountId, schoolId); + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/PythonRunCodeServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/PythonRunCodeServiceImpl.java new file mode 100644 index 0000000..26b4f91 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/PythonRunCodeServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.occupationlab.service.impl; + +import com.huoran.occupationlab.entity.PythonRunCode; +import com.huoran.occupationlab.mapper.PythonRunCodeMapper; +import com.huoran.occupationlab.service.PythonRunCodeService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * python储存实验运行记录 服务实现类 + *

+ * + * @author lr + * @since 2021-12-22 + */ +@Service +public class PythonRunCodeServiceImpl extends ServiceImpl implements PythonRunCodeService { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/PythonSystemServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/PythonSystemServiceImpl.java new file mode 100644 index 0000000..937adc3 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/PythonSystemServiceImpl.java @@ -0,0 +1,31 @@ +package com.huoran.occupationlab.service.impl; + +import com.huoran.occupationlab.entity.PythonSystem; +import com.huoran.occupationlab.entity.vo.AssessmentVO; +import com.huoran.occupationlab.mapper.PythonSystemMapper; +import com.huoran.occupationlab.service.PythonSystemService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * python系统记录表 服务实现类 + *

+ * + * @author lr + * @since 2021-08-19 + */ +@Service +public class PythonSystemServiceImpl extends ServiceImpl implements PythonSystemService { + + @Autowired + private PythonSystemMapper pythonSystemMapper; + + @Override + public List getCourseTitle(Integer accountId,Integer schoolId) { + return pythonSystemMapper.getCourseTitle(accountId,schoolId); + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/PythonTableDataServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/PythonTableDataServiceImpl.java new file mode 100644 index 0000000..627c9b7 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/PythonTableDataServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.occupationlab.service.impl; + +import com.huoran.occupationlab.entity.PythonTableData; +import com.huoran.occupationlab.mapper.PythonTableDataMapper; +import com.huoran.occupationlab.service.PythonTableDataService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 储存全部python表数据表导出Excel路径 服务实现类 + *

+ * + * @author lr + * @since 2022-08-12 + */ +@Service +public class PythonTableDataServiceImpl extends ServiceImpl implements PythonTableDataService { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/QuestionsServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/QuestionsServiceImpl.java new file mode 100644 index 0000000..ed3cbf0 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/QuestionsServiceImpl.java @@ -0,0 +1,672 @@ +package com.huoran.occupationlab.service.impl; + +import cn.hutool.core.date.DateUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.TypeReference; +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.huoran.common.constant.DelConstant; +import com.huoran.common.exception.CustomException; +import com.huoran.common.exception.ExceptionEnum; +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.EvaluationRules; +import com.huoran.occupationlab.entity.Questions; +import com.huoran.occupationlab.entity.req.ExcelImpQuestionReq; +import com.huoran.occupationlab.entity.req.QuestionsAddReq; +import com.huoran.occupationlab.entity.req.QuestionsQueryReq; +import com.huoran.occupationlab.entity.req.QuestionsUpdateReq; +import com.huoran.occupationlab.entity.vo.*; +import com.huoran.occupationlab.mapper.QuestionsMapper; +import com.huoran.occupationlab.service.EvaluationRulesService; +import com.huoran.occupationlab.service.QuestionsService; +import com.huoran.occupationlab.utils.Constant; +import com.huoran.occupationlab.utils.ExcelImportHelper; +import com.huoran.occupationlab.utils.poi.CommonCode; +import com.huoran.occupationlab.utils.poi.ExcelExportUtil; +import com.huoran.occupationlab.utils.poi.ExceptionCast; +import org.apache.commons.lang.StringUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.io.ClassPathResource; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.data.redis.core.ValueOperations; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.InputStream; +import java.util.*; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +/** + *

+ * 测评管理-题库记录表 服务实现类 + *

+ * + * @author lr + * @since 2021-08-12 + */ +@Service +public class QuestionsServiceImpl extends ServiceImpl implements QuestionsService { + + @Autowired + private QuestionsMapper mapper; + + @Resource + StringRedisTemplate stringRedisTemplate; + + @Autowired + private EvaluationRulesService evaluationRulesService; + + private String REMAINING_TINE_KEY = "REMAINING_TINE"; + private String FAILURE_IMPORT_KEY = "FAILURE_IMPORT"; + + private String getQuestionTypeName(String questionType) { + String questionTypeName = ""; + //处理试题类型 + if (questionType.equals(Constant.QuestionType.SINGLE_CHOICE.getType())) { + //单选题 + questionTypeName = Constant.QuestionType.SINGLE_CHOICE.getDesc(); + } else if (questionType.equals(Constant.QuestionType.MULTIPLE_CHOICE.getType())) { + //多选题 + questionTypeName = Constant.QuestionType.MULTIPLE_CHOICE.getDesc(); + } else if (questionType.equals(Constant.QuestionType.TRUE_OR_FALSE.getType())) { + //判断题 + questionTypeName = Constant.QuestionType.TRUE_OR_FALSE.getDesc(); + } else { + ExceptionCast.cast(CommonCode.QUESTION_TYPE_INVALID); + } + return questionTypeName; + } + + /** + * 判断题型是够存在 + * + * @param type + */ + private void checkType(String type) { + boolean include = false; + for (Constant.QuestionType value : Constant.QuestionType.values()) { + if (value.getType().equals(type)) { + include = true; + } + } + if (!include) {//题型不在枚举类中,不正确 + ExceptionCast.cast(CommonCode.QUESTION_TYPE_INVALID); + } + } + + /** + * 构造根据内容查询试题数量的Wrapper + * + * @param questions + * @return + */ + private QueryWrapper constructDistinctWrapper(Questions questions) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("is_del", Constant.IsDel.NOT_DEL.getType()) + .eq("question_stem", questions.getQuestionStem()) + .eq("school_id", questions.getSchoolId()) + ; + if (StringUtils.isNotEmpty(questions.getOptionA())) { + queryWrapper.eq("option_a", questions.getOptionA()); + } + if (StringUtils.isNotEmpty(questions.getOptionB())) { + queryWrapper.eq("option_b", questions.getOptionB()); + } + if (StringUtils.isNotEmpty(questions.getOptionC())) { + queryWrapper.eq("option_c", questions.getOptionC()); + } + if (StringUtils.isNotEmpty(questions.getOptionD())) { + queryWrapper.eq("option_d", questions.getOptionD()); + } + if (StringUtils.isNotEmpty(questions.getOptionE())) { + queryWrapper.eq("option_e", questions.getOptionE()); + } + if (StringUtils.isNotEmpty(questions.getOptionF())) { + queryWrapper.eq("option_f", questions.getOptionF()); + } + return queryWrapper; + } + + @Override + public IPage getQuestionsList(QuestionsQueryReq request) { + Page page = new Page(request.getPageNum(), request.getPageSize()); + + // 请求包装类 + QueryWrapper queryWrapper = new QueryWrapper(); + + // 只查询未被删除的试题 + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + queryWrapper.eq("school_id", request.getSchoolId()); + + // 判断请求体是否为空 + if (request != null) { + // 题干:判断题干是否为空,不为空则加入搜索条件 + if (request.getQuestionStem() != null) { + queryWrapper.like("question_stem", request.getQuestionStem()); + } + // 题型:判断题型是否为空,不为空则加入搜索条件 + if (request.getQuestionType() != null) { + queryWrapper.eq("question_type", request.getQuestionType()); + } + //扩展其他搜索条件... + queryWrapper.orderByDesc("id"); + } + IPage records = mapper.selectPage(page, queryWrapper); + + return records; + + } + + /** + * 保存题库 + * + * @param questions + * @return + */ + @Override + @Transactional + public boolean saveQuestion(QuestionsAddReq questions) { + //试题对象为空或题干内容为空,抛出参数不合法异常 + if (questions == null + || StringUtils.isEmpty(questions.getQuestionStem()) + || questions.getQuestionType() == null) { + ExceptionCast.cast(CommonCode.INVALID_PARAM); + } + + //校验题型是否正确 + checkType(questions.getQuestionType() + ""); + + // 校验重复,不仅要校验题干,还要校验选项 + Questions questionsEntity = new Questions(); + questionsEntity.setQuestionType(questions.getQuestionType() + ""); + BeanUtils.copyProperties(questions, questionsEntity); + + //构造根据内容查询试题数量的Wrapper + QueryWrapper queryWrapper = constructDistinctWrapper(questionsEntity); + + int count = this.count(queryWrapper); + if (count > 0) {//说明已存在 + //抛出题目已存在异常 + ExceptionCast.cast(CommonCode.QUESTION_EXISTS); + } + // 将传入的对象内容拷贝到QuestionsEntity并返回 + questionsEntity.setCreateTime(new Date()); + questionsEntity.setUpdateTime(new Date()); + + return this.save(questionsEntity); + } + + /** + * 根据试题id修改试题信息 + * + * @param questions + * @return + */ + @Override + @Transactional + public boolean updateQuestionById(QuestionsUpdateReq questions) { + if (questions == null + || questions.getId() == null + || StringUtils.isEmpty(questions.getQuestionStem())) { + ExceptionCast.cast(CommonCode.INVALID_PARAM); + } + + // 判断id是否存在 + if (this.getById(questions.getId()) == null) { + ExceptionCast.cast(CommonCode.INVALID_PARAM); + } + + //校验题型是否正确 + checkType(questions.getQuestionType() + ""); + + //校验题干和内容重复 + Questions questionsEntity = new Questions(); + BeanUtils.copyProperties(questions, questionsEntity); + //构造根据内容查询试题数量的Wrapper + QueryWrapper queryWrapper = constructDistinctWrapper(questionsEntity); + + queryWrapper.notIn("id", questions.getId()); + + int count = this.count(queryWrapper); + if (count > 0) {//说明除了本题之外题干已存在 + //抛出题目已存在异常 + ExceptionCast.cast(CommonCode.QUESTION_EXISTS); + } + + questionsEntity.setUpdateTime(new Date()); + //TODO 设置修改者。。。 + + return this.updateById(questionsEntity); + } + + /** + * 根据主键删除 + * + * @param ids + * @return + */ + @Override + @Transactional + public boolean deleteByIds(List ids) { + List collect = ids.stream().map(item -> { + Questions questionsEntity = new Questions(); + questionsEntity.setId(item); + questionsEntity.setIsDel(Constant.IsDel.DEL.getType()); + return questionsEntity; + }).collect(Collectors.toList()); + + return updateBatchById(collect); + } + + /** + * 是否禁用 + * + * @param id + * @return + */ + @Override + public R isDisable(Integer id, Integer schoolId) { + Questions questionsEntity = new Questions(); + questionsEntity.setId(id); + Questions byId = mapper.selectById(id); + EvaluationRules questions = mapper.queryNumberOfQuestions(schoolId); + if (byId.getIsEnable().equals(Constant.IsEnable.ENABLE.getType())) { +// Integer types = rules.getTypes(); + String types = byId.getQuestionType(); + EvaluationRules rule = mapper.queryNumberOfTatolQuestions(schoolId); + Integer num = mapper.queryQuestionNumber(types, schoolId); + String questionTypes = null; + int rulesNumber = 0; + switch (types) { + case "1": + questionTypes = "单选题的"; + rulesNumber = questions.getSingleNum(); + break; + case "2": + questionTypes = "多选题的"; + rulesNumber = questions.getMultipleNum(); + break; + case "3": + questionTypes = "判断题的"; + rulesNumber = questions.getJudgmentNum(); + break; + } + if (num <= rulesNumber) { + return R.error(400, questionTypes+"试题数量不能少于测评设置对应题的数量!"); + } else { + questionsEntity.setIsEnable(Constant.IsEnable.NOT_ENABLE.getType()); + } + + } else if (byId.getIsEnable().equals(Constant.IsEnable.NOT_ENABLE.getType())) { + questionsEntity.setIsEnable(Constant.IsEnable.ENABLE.getType()); + } else { + ExceptionCast.cast(CommonCode.INVALID_PARAM); + } + + int i = mapper.updateById(questionsEntity); + + if (i == 1) { + return R.ok(); + } else { + return R.error(); + } + } + + @Override + public QuestionsDetailVO getQuestionDetailById(Integer id) { + QuestionsDetailVO questionsDetailVO = new QuestionsDetailVO(); + //查询试题信息 + Questions questionsEntity = this.getById(id); + BeanUtils.copyProperties(questionsEntity, questionsDetailVO); + //处理试题类型 + String questionTypeName = getQuestionTypeName(questionsEntity.getQuestionType()); + questionsDetailVO.setQuestionTypeName(questionTypeName); + + //处理每个选项是否为被设置为答案 + String answer = questionsEntity.getAnswer(); + + if (answer.contains(Constant.A)) { + questionsDetailVO.setAIsTrue(true); + } + if (answer.contains(Constant.B)) { + questionsDetailVO.setBIsTrue(true); + } + if (answer.contains(Constant.C)) { + questionsDetailVO.setCIsTrue(true); + } + if (answer.contains(Constant.D)) { + questionsDetailVO.setDIsTrue(true); + } + if (answer.contains(Constant.E)) { + questionsDetailVO.setEIsTrue(true); + } + if (answer.contains(Constant.F)) { + questionsDetailVO.setFIsTrue(true); + } + return questionsDetailVO; + } + + @Override + public Map upload(MultipartFile file, Integer schoolId, Integer accountId) throws IOException { + List impQuestionReqList = ExcelImportHelper.readQuestionManagement(file); + if (impQuestionReqList.size() <= 0) { + //小于等于0为上传空模板的情况下 抛出异常 + throw new CustomException(ExceptionEnum.EXCEL_FILE_FORMAT_ERROR); + } + int count = 0; + List failVo1 = new ArrayList<>(); + // 参数合法性校验,只能上传.xlsx后缀的文件 + if (org.apache.commons.lang3.StringUtils.isBlank(file.getOriginalFilename()) + || !file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")).equals(".xlsx")) { + ExceptionCast.cast(CommonCode.EXCEL_FILE_INVALID); + } + int size = impQuestionReqList.size(); + Map map = new HashMap<>(); + Long ii = 1L;//用于记录序列号 + Integer countNum = 0;//用于失败原因排序 eg:1、XXXXX 2、XXXXXXX + try { + Integer countSuccess = 0;//统计成功次数 + Integer countError = 0;//统计失败次数 + + for (int i = 0; i < impQuestionReqList.size(); i++) { + boolean ret = true; + ++ii; + ExcelImpQuestionReq req = impQuestionReqList.get(i); + + String errMsg = ""; + //去除Excel中的全角半角空格 + String questionStem = req.getQuestionStem().replaceAll("\\u00A0", "").trim();//题干 + String questionTypeName = req.getQuestionType().replaceAll("\\u00A0", "").trim();//题型 + String optionA = req.getOptionA().replaceAll("\\u00A0", "").trim();//选项A + String optionB = req.getOptionB().replaceAll("\\u00A0", "").trim();//选项B + String optionC = req.getOptionC().replaceAll("\\u00A0", "").trim();//选项C + String optionD = req.getOptionD().replaceAll("\\u00A0", "").trim();//选项D + String optionE = req.getOptionE().replaceAll("\\u00A0", "").trim();//选项E + String optionF = req.getOptionF().replaceAll("\\u00A0", "").trim();//选项F + String answer = req.getAnswer().replaceAll("\\u00A0", "").trim();//正确答案 + String answerAnalysis = req.getAnswerAnalysis().replaceAll("\\u00A0", "").trim();//答案解析 + + QuestionImportFailureVo vo1 = new QuestionImportFailureVo(); + vo1.setIndex(ii); + //检验题干 + if (req.getQuestionStem().equals("")) { + ++countNum; + vo1.setQuestionStem(questionStem + " *必填项:(题干不能为空) "); + errMsg += countNum + "必填项:(题干不能为空)"; + ret = false; + } else { + vo1.setQuestionStem(questionStem); + //ret = true; + } + + if (questionTypeName.equals("")) { + ++countNum; + vo1.setQuestionTypeName(questionTypeName + " *必填项:(题型不能为空)"); + errMsg += countNum + " *必填项:(题型不能为空)"; + ret = false; + } else { + Integer typeName = 0;//题型:1、单选题,2、多选题,3、判断题 + switch (questionTypeName.trim()) { + case "单选题": + typeName = 1; + break; + case "多选题": + typeName = 2; + break; + case "判断题": + typeName = 3; + break; + default: + ++countNum; + vo1.setQuestionTypeName(questionTypeName + " *必填项:(请输入正确的题型)"); + errMsg += countNum + " *必填项:(请输入正确的题型)"; + ret = false; + + } + req.setQuestionType(typeName + ""); + vo1.setQuestionTypeName(typeName + ""); + //ret = true; + } + + if (optionA.equals("")) { + ++countNum; + vo1.setOptionA(optionA + " *必填项:(选项A不能为空)"); + errMsg += countNum + " *必填项:(选项A不能为空)"; + ret = false; + } else { + vo1.setOptionA(optionA); + } + + if (optionB.equals("")) { + ++countNum; + vo1.setOptionB(optionB + " *必填项:(选项B不能为空)"); + errMsg += countNum + " *必填项:(选项B不能为空)"; + ret = false; + } else { + vo1.setOptionB(optionB); + } + + if (answer.equals("")) { + ++countNum; + vo1.setAnswer(answer + " *必填项:(正确答案不能为空)"); + errMsg += countNum + " *必填项:(正确答案不能为空)"; + ret = false; + } else { + vo1.setAnswer(answer); + } + + vo1.setOptionC(optionC); + vo1.setOptionD(optionD); + vo1.setOptionE(optionE); + vo1.setOptionF(optionF); + vo1.setAnswerAnalysis(answerAnalysis); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + queryWrapper.eq("question_stem", questionStem); + List checkQuestionStem = mapper.selectList(queryWrapper); + if (checkQuestionStem.size() > 0) { + ++countNum; + vo1.setQuestionStem(questionStem + " (*错误原因:题库中已存在重复的题干!)"); + errMsg += countNum + " *题库中已存在重复的题干"; + ret = false; + } else { + vo1.setAnswerAnalysis(answerAnalysis); + } + + vo1.setFailureMsg(errMsg); + countNum = 0; + + failVo1.add(vo1); + + Questions questions = new Questions(); + //questions.setQuestionType(Integer.valueOf(req.getQuestionTypeName())); + BeanUtils.copyProperties(req, questions); + + //ret判断 新增成功的插入到数据库 否则则不新增至数据库 + if (ret) { + //执行新增操作 + questions.setAccountId(accountId); + questions.setSchoolId(schoolId); + baseMapper.insert(questions); + //countSuccess:统计累计成功次数 + countSuccess++; + } else { + //countError:累计失败次数 + countError++; + } + } + String exportCode = ""; + + // 有导入失败的数据,才会存入redis + if (countError > 0) { + //生成token + exportCode = "FAILURE_IMPORT" + UUID.randomUUID().toString().replace("-", ""); + ValueOperations ops = stringRedisTemplate.opsForValue(); + String failureVOJson = JSON.toJSONString(failVo1); + ops.set(exportCode, failureVOJson, 30 * 60, TimeUnit.SECONDS); + } + map.put("exportCode", exportCode);//返回导出code + map.put("successNum", countSuccess + "");//本次新增成功数量 + map.put("failureNum", countError + "");//本次新增失败数量 + return map; + } catch (RuntimeException e) { + throw new RuntimeException(); + } + + } + + @Override + public void exportFailureRecord(HttpServletResponse response, String token) throws Exception { + if (org.apache.commons.lang3.StringUtils.isEmpty(token)) { + return; + } + ValueOperations ops = stringRedisTemplate.opsForValue(); + //获取数据 + String record = ops.get(token); + if (org.apache.commons.lang3.StringUtils.isEmpty(record)) { + return; + } + List parse = JSON.parseObject(record, new TypeReference>() { + }); + + parse.sort(Comparator.comparing(QuestionsImportFailureVO::getIndex)); + + ClassPathResource classPathResource = new ClassPathResource("excel-template/试题导入失败数据导出模板.xlsx"); + InputStream inputStream = classPathResource.getInputStream(); + + //3、通过工具类下载文件 + new ExcelExportUtil(QuestionsImportFailureVO.class, Constant.ROW_INDEX, Constant.STYLE_INDEX). + export(response, inputStream, parse, "导入失败数据表.xlsx"); + + if (inputStream != null) { + inputStream.close(); + } + } + + @Override + public String getEvaluationRemainingTime(Integer accountId, Integer schoolId) { + //时长转成秒来计算 + //先查询该用户有没有开始考试,既redis中有没有跟该用户id相关联的key + //如果没有,表示是开始测评,向redis中插入一条数据,key是前缀加用户id,value是当前时间,过期时间是测评时长加三十秒 + //如果有,则得到value,既开始测评的时间,用当前时间和开始测评时间做差,测评时长减去该差值 + //TODO 提交测评时删除redis中的该条数据 + //得到总时长,单位:分 + EvaluationRulesVO evaluationRules = evaluationRulesService.getEvaluationRules(schoolId); + Integer duration = evaluationRules.getDuration(); + ValueOperations ops = stringRedisTemplate.opsForValue(); + String key = REMAINING_TINE_KEY + accountId; + String startTime = ops.get(key); + // 剩余时间,单位:秒 + int remainingTime = duration * 60; + if (StringUtils.isEmpty(startTime)) { + //如果没有,表示是开始测评,向redis中插入一条数据,key是前缀加用户id,value是当前时间,过期时间是测评时长加十秒 + ops.set(key, String.valueOf(System.currentTimeMillis()), duration * 60 + 10, TimeUnit.SECONDS); + } else { + // 当前时间与开始时间得时间差,单位:毫秒 + long difference = System.currentTimeMillis() - Long.parseLong(startTime); + remainingTime = (duration * 60) - (new Long(difference).intValue() / 1000); + if (remainingTime < 0) { + ExceptionCast.cast(CommonCode.EVALUATION_TIME_INVALID); + } + } + return DateUtil.secondToTime(remainingTime); + } + + private Set getRandomList(int len, List list) { + Set set = new HashSet<>(); + Random random = new Random(); + int i; + while (true) { + i = random.nextInt(list.size()); + set.add(list.get(i)); + if (set.size() >= len) { + break; + } + } + return set; + } + + @Override + public EvaluationVO randomQuestions(Integer schoolId) { + // 查询测评规则类型 + EvaluationRulesVO evaluationRules = evaluationRulesService.getEvaluationRules(schoolId); + EvaluationVO evaluation = new EvaluationVO(); + BeanUtils.copyProperties(evaluationRules, evaluation); + Set set = new HashSet<>(); + //根据测评规则的类型不同(测评类型:1:随机类型,0:自定义类型) + Integer evaluationType = evaluationRules.getEvaluationType(); + if (evaluationType.equals(Constant.RulesType.RANDOM.getType())) {//随机 + // 类型为随机,直接用题目数量 + Integer questionNum = evaluationRules.getQuestionNum(); + if (questionNum == null || questionNum == 0) { + ExceptionCast.cast(CommonCode.EVALUATION_QUESTION_NUM_INVALID); + } + // 查询题库所有未删除,未禁用的题目id + List ids = baseMapper.selectIds(null,schoolId); + set = getRandomList(questionNum, ids); + } else if (evaluationType.equals(Constant.RulesType.CUSTOMIZE.getType())) {//自定义 + // 单选题数量 + int singleNum = 0; + // 多选题数量 + int multipleNum = 0; + // 判断题数量 + int judgmentNum = 0; + //判断各条目的题型是否启用 + if (evaluationRules.getIsSingleEnable().equals(Constant.IsEnable.ENABLE.getType())) { + singleNum = evaluationRules.getSingleNum(); + if (singleNum == 0) { + ExceptionCast.cast(CommonCode.EVALUATION_QUESTION_NUM_INVALID); + } + List ids = baseMapper.selectIds(Constant.QuestionType.SINGLE_CHOICE.getType(),schoolId); + set.addAll(getRandomList(singleNum, ids)); + } + if (evaluationRules.getIsMultipleEnable().equals(Constant.IsEnable.ENABLE.getType())) { + multipleNum = evaluationRules.getMultipleNum(); + if (multipleNum == 0) { + ExceptionCast.cast(CommonCode.EVALUATION_QUESTION_NUM_INVALID); + } + List ids = baseMapper.selectIds(Constant.QuestionType.MULTIPLE_CHOICE.getType(),schoolId); + set.addAll(getRandomList(multipleNum, ids)); + } + if (evaluationRules.getIsJudgmentEnable().equals(Constant.IsEnable.ENABLE.getType())) { + judgmentNum = evaluationRules.getJudgmentNum(); + if (judgmentNum == 0) { + ExceptionCast.cast(CommonCode.EVALUATION_QUESTION_NUM_INVALID); + } + List ids = baseMapper.selectIds(Constant.QuestionType.TRUE_OR_FALSE.getType(),schoolId); + set.addAll(getRandomList(judgmentNum, ids)); + } + // 总题数等于各类题目数量之和 + evaluation.setQuestionNum(singleNum + multipleNum + judgmentNum); + } + evaluation.setQuestions(set); + + return evaluation; + } + + @Override + public boolean copyQuestion(Integer schoolId, Integer accountId) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("school_id", 0);//0查询内置题库 + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + List list = baseMapper.selectList(queryWrapper); + //复制题库 + list.stream().forEach(questions -> { + questions.setSchoolId(schoolId); + questions.setAccountId(accountId); + baseMapper.insert(questions); + }); + + return true; + } + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/RabbitServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/RabbitServiceImpl.java new file mode 100644 index 0000000..4a088dc --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/RabbitServiceImpl.java @@ -0,0 +1,26 @@ +/* +package com.huoran.occupationlab.service.impl; + +import com.huoran.common.constant.RabbitmqConstant; +import com.huoran.common.response.R; +import com.huoran.occupationlab.service.RabbitService; +import com.rabbitmq.client.Channel; +import org.springframework.amqp.core.Message; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.stereotype.Service; + +@Service +public class RabbitServiceImpl implements RabbitService { + + @RabbitListener(queues = RabbitmqConstant.COURSE_QUEUE) + public void receiveMessages(Message message, String messages, Channel channel) { + System.out.println(messages); + } + + @Override + public R receiveMessage() { +// String s = this.receiveMessages(null, null, null); + return R.ok(); + } +} +*/ diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/RolePermissionServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/RolePermissionServiceImpl.java new file mode 100644 index 0000000..049b559 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/RolePermissionServiceImpl.java @@ -0,0 +1,27 @@ +package com.huoran.occupationlab.service.impl; + + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.occupationlab.entity.AclRolePermission; +import com.huoran.occupationlab.mapper.RolePermissionMapper; +import com.huoran.occupationlab.service.RolePermissionService; +import org.springframework.stereotype.Service; + +/** + *

+ * 角色权限 服务实现类 + *

+ * + * @author testjava + * @since 2020-01-12 + */ +@Service +public class RolePermissionServiceImpl extends ServiceImpl implements RolePermissionService { + @Override + public void removeMenu(String roleId, Integer isPort) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("role_id", roleId).eq("is_port", isPort); + baseMapper.delete(wrapper); + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/RoleServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/RoleServiceImpl.java new file mode 100644 index 0000000..87de6ad --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/RoleServiceImpl.java @@ -0,0 +1,109 @@ +package com.huoran.occupationlab.service.impl; + + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.occupationlab.entity.AclRole; +import com.huoran.occupationlab.entity.AclUserRole; +import com.huoran.occupationlab.mapper.RoleMapper; +import com.huoran.occupationlab.service.RoleService; +import com.huoran.occupationlab.service.UserRoleService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + *

+ * 服务实现类 + *

+ */ +@Service +public class RoleServiceImpl extends ServiceImpl implements RoleService { + + @Autowired + private UserRoleService userRoleService; + + + //根据用户获取角色数据 + @Override + public Map findRoleByUserId(String userId) { + //查询所有的角色 + List allRolesList = baseMapper.selectList(null); + + //根据用户id,查询用户拥有的角色id + List existUserRoleList = userRoleService.list(new QueryWrapper().eq("user_id", userId).select("role_id")); + + List existRoleList = existUserRoleList.stream().map(c -> c.getRoleId()).collect(Collectors.toList()); + + //对角色进行分类 + List assignRoles = new ArrayList(); + for (AclRole role : allRolesList) { + //已分配 + if (existRoleList.contains(role.getId())) { + assignRoles.add(role); + } + } + + Map roleMap = new HashMap<>(); + roleMap.put("assignRoles", assignRoles); + roleMap.put("allRolesList", allRolesList); + return roleMap; + } + + //根据用户分配角色 + @Override + public void saveUserRoleRelationShip(String userId, String[] roleIds) { + userRoleService.remove(new QueryWrapper().eq("user_id", userId)); + + List userRoleList = new ArrayList<>(); + for (String roleId : roleIds) { + if (StringUtils.isEmpty(roleId)) continue; + AclUserRole userRole = new AclUserRole(); + userRole.setUserId(userId); + userRole.setRoleId(roleId); + + userRoleList.add(userRole); + } + userRoleService.saveBatch(userRoleList); + } + + @Override + public List selectRoleByUserId(String id) { + //根据用户id拥有的角色id + List userRoleList = userRoleService.list(new QueryWrapper().eq("user_id", id).select("role_id")); + List roleIdList = userRoleList.stream().map(item -> item.getRoleId()).collect(Collectors.toList()); + List roleList = new ArrayList<>(); + if (roleIdList.size() > 0) { + roleList = baseMapper.selectBatchIds(roleIdList); + } + return roleList; + } + + @Override + public boolean repeat(AclRole role) { + QueryWrapper roleQueryWrapper = new QueryWrapper<>(); + roleQueryWrapper.eq("role_name", role.getRoleName()); + Integer count = baseMapper.selectCount(roleQueryWrapper); + return count > 0; + } + + @Override + public boolean removeRolePermission(String roleId) { + int size = baseMapper.removeRolePermission(roleId); + return size > 0; + } + + @Override + public boolean removeRolePermissions(List roleIds) { + for (String roleId : roleIds) { + baseMapper.removeRolePermission(roleId); + } + return true; + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/SchoolClassificationServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/SchoolClassificationServiceImpl.java new file mode 100644 index 0000000..c5c1ede --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/SchoolClassificationServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.occupationlab.service.impl; + +import com.huoran.occupationlab.entity.SchoolClassification; +import com.huoran.occupationlab.mapper.SchoolClassificationMapper; +import com.huoran.occupationlab.service.SchoolClassificationService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 学校对应分类表 服务实现类 + *

+ * + * @author lr + * @since 2021-09-09 + */ +@Service +public class SchoolClassificationServiceImpl extends ServiceImpl implements SchoolClassificationService { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/SchoolCourseServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/SchoolCourseServiceImpl.java new file mode 100644 index 0000000..bf04cd5 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/SchoolCourseServiceImpl.java @@ -0,0 +1,105 @@ +package com.huoran.occupationlab.service.impl; + + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.occupationlab.entity.SchoolClassification; +import com.huoran.occupationlab.entity.SchoolCourse; +import com.huoran.occupationlab.entity.vo.CourseVO; +import com.huoran.occupationlab.mapper.SchoolClassificationMapper; +import com.huoran.occupationlab.mapper.SchoolCourseMapper; +import com.huoran.occupationlab.service.SchoolClassificationService; +import com.huoran.occupationlab.service.SchoolCourseService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Arrays; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +/** + *

+ * 学校内置课程表 服务实现类 + *

+ * + * @author Cheney + * @since 2020-11-30 + */ +@Service +public class SchoolCourseServiceImpl extends ServiceImpl implements SchoolCourseService { + + @Autowired + private SchoolClassificationMapper schoolClassificationMapper; + + @Override + public List coursePageConditionQuery(HashMap map) { + return baseMapper.selectCoursePageByCondition(map); + } + + @Override + public int coursePageConditionCount(HashMap map) { + return baseMapper.coursePageConditionCount(map); + } + + @Override + public List builtInCoursePageQuery(HashMap map) { + return baseMapper.builtInCoursePageQuery(map); + } + + @Override + public int builtInCoursePageCount(HashMap map) { + return baseMapper.builtInCoursePageCount(map); + } + + @Override + public boolean addBuiltInCourse(String schoolId, String courseIds, String classificationIds) { + String[] courseId = courseIds.split(","); + List courseIdList = Arrays.asList(courseId); + + String[] classificationId = classificationIds.split(","); + List classificationIdList = Arrays.asList(classificationId); + + + //先添加分类给对应学校 + if (classificationIdList.size() != 0) { + classificationIdList.forEach(id -> { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("school_id", schoolId).eq("classification_id", id); + Integer count = schoolClassificationMapper.selectCount(wrapper); + //学校没有该分类,则进行添加对应关系 + if (count == 0) { + SchoolClassification schoolClassification = new SchoolClassification(); + schoolClassification.setClassificationId(id); + schoolClassification.setSchoolId(schoolId); + schoolClassificationMapper.insert(schoolClassification); + } + }); + } + + //循环添加课程 + if (courseIdList.size() != 0) { + courseIdList.forEach(id -> { + SchoolCourse schoolCourse = new SchoolCourse(); + + schoolCourse.setGmtCreate(new Date()); + schoolCourse.setGmtModified(new Date()); + schoolCourse.setCourseId(id); + schoolCourse.setSchoolId(schoolId); + baseMapper.insert(schoolCourse); + }); + return true; + } + return false; + } + + @Override + public void removeClassificationId(String schoolId, String classificationId) { + int count = baseMapper.builtInCourseClassificationCount(schoolId, classificationId); + if (count == 1) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("school_id", schoolId).eq("classification_id", classificationId); + schoolClassificationMapper.delete(wrapper); + } + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/SchoolProjectHintOpenServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/SchoolProjectHintOpenServiceImpl.java new file mode 100644 index 0000000..14bde7c --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/SchoolProjectHintOpenServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.occupationlab.service.impl; + +import com.huoran.occupationlab.entity.SchoolProjectHintOpen; +import com.huoran.occupationlab.mapper.SchoolProjectHintOpenMapper; +import com.huoran.occupationlab.service.SchoolProjectHintOpenService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 学校项目实验提示管理表 服务实现类 + *

+ * + * @author lr + * @since 2023-06-02 + */ +@Service +public class SchoolProjectHintOpenServiceImpl extends ServiceImpl implements SchoolProjectHintOpenService { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/SchoolServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/SchoolServiceImpl.java new file mode 100644 index 0000000..9c20d3c --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/SchoolServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.occupationlab.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.common.entity.School; +import com.huoran.occupationlab.mapper.SchoolMapper; +import com.huoran.occupationlab.service.SchoolService; +import org.springframework.stereotype.Service; + +/** + *

+ * 学校表 服务实现类 + *

+ * + * @author Ning + * @since 2020-10-27 + */ +@Service +public class SchoolServiceImpl extends ServiceImpl implements SchoolService { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/StaffGradeServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/StaffGradeServiceImpl.java new file mode 100644 index 0000000..164cba6 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/StaffGradeServiceImpl.java @@ -0,0 +1,33 @@ +package com.huoran.occupationlab.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.common.constant.DelConstant; +import com.huoran.occupationlab.entity.StaffGrade; +import com.huoran.occupationlab.entity.StaffProfessionalArchitecture; +import com.huoran.occupationlab.mapper.StaffGradeMapper; +import com.huoran.occupationlab.service.StaffGradeService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 员工年级表 服务实现类 + *

+ * + * @author lr + * @since 2021-10-13 + */ +@Service +public class StaffGradeServiceImpl extends ServiceImpl implements StaffGradeService { + + @Override + public boolean repeat(StaffGrade staffGrade) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("grade_name", staffGrade.getGradeName()); + queryWrapper.eq("staff_architecture_id", staffGrade.getStaffArchitectureId()); + Integer count = baseMapper.selectCount(queryWrapper); + return count > 0; + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/StaffProfessionalArchitectureServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/StaffProfessionalArchitectureServiceImpl.java new file mode 100644 index 0000000..b117232 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/StaffProfessionalArchitectureServiceImpl.java @@ -0,0 +1,34 @@ +package com.huoran.occupationlab.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.common.constant.DelConstant; +import com.huoran.occupationlab.entity.StaffProfessionalArchitecture; +import com.huoran.occupationlab.mapper.StaffProfessionalArchitectureMapper; +import com.huoran.occupationlab.service.StaffProfessionalArchitectureService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 员工专业组织架构 服务实现类 + *

+ * + * @author lr + * @since 2021-10-13 + */ +@Service +public class StaffProfessionalArchitectureServiceImpl extends ServiceImpl implements StaffProfessionalArchitectureService { + + @Override + public boolean repeat(StaffProfessionalArchitecture staffProfessionalArchitecture) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("staff_architecture_name", staffProfessionalArchitecture.getStaffArchitectureName()); + queryWrapper.eq("school_id", staffProfessionalArchitecture.getSchoolId()); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + + Integer count = baseMapper.selectCount(queryWrapper); + return count > 0; + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/StaffServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/StaffServiceImpl.java new file mode 100644 index 0000000..34b8c19 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/StaffServiceImpl.java @@ -0,0 +1,639 @@ +package com.huoran.occupationlab.service.impl; + +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.entity.ExportParams; +import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.TypeReference; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.api.UserClient; +import com.huoran.common.constant.DelConstant; +import com.huoran.common.constant.PlatformConstant; +import com.huoran.common.entity.Role; +import com.huoran.common.entity.UserAccount; +import com.huoran.common.entity.UserInfo; +import com.huoran.common.exception.CustomException; +import com.huoran.common.exception.ExceptionEnum; +import com.huoran.common.response.R; +import com.huoran.common.utils.MD5; +import com.huoran.occupationlab.entity.*; +import com.huoran.occupationlab.entity.req.*; +import com.huoran.occupationlab.entity.resp.StaffResp; +import com.huoran.occupationlab.entity.vo.ImportStaffFailureVo; +import com.huoran.occupationlab.mapper.StaffGradeMapper; +import com.huoran.occupationlab.mapper.StaffMapper; +import com.huoran.occupationlab.mapper.StaffProfessionalArchitectureMapper; +import com.huoran.occupationlab.mapper.StudentMapper; +import com.huoran.occupationlab.service.StaffService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.common.utils.DateUtil; +import com.huoran.occupationlab.utils.ExcelImportHelper; +import com.huoran.occupationlab.utils.poi.CommonCode; +import com.huoran.occupationlab.utils.poi.ExcelStyleUtil; +import com.huoran.occupationlab.utils.poi.ExceptionCast; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.data.redis.core.ValueOperations; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.net.URLEncoder; +import java.util.*; +import java.util.concurrent.TimeUnit; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + +/** + *

+ * 员工表 服务实现类 + *

+ * + * @author lr + * @since 2021-10-13 + */ +@Service +public class StaffServiceImpl extends ServiceImpl implements StaffService { + + @Autowired + private UserClient userClient; + + @Autowired + public StudentMapper studentMapper;//引用新增账号 用户表新增操作 + + @Autowired + public StaffProfessionalArchitectureMapper professionalArchitectureMapper; + + @Autowired + public StaffGradeMapper gradeMapper; + + @Resource + StringRedisTemplate stringRedisTemplate; + + @Transactional + @Override + public R saveStaff(AddStaffReq req) throws Exception { + + try { + //用户相关信息表 + UserInfo userInfo = new UserInfo(); + BeanUtils.copyProperties(req, userInfo); + userInfo.setRoleId("0");//设置为0 表示该表角色id暂时无用 acl_user_role:用户角色表有账号所属角色 + int addUserInfo = studentMapper.addUserInfo(userInfo); + + //账户相关信息表 + UserAccount userAccount = new UserAccount(); + BeanUtils.copyProperties(req, userAccount); + userAccount.setPassword(MD5.encrypt("1122aa")); + userAccount.setUserId(userInfo.getUserId()); + userAccount.setType(PlatformConstant.TEACHER_SIDE);//平台端区分:0->教师端 1->学生端 2->无端 + userAccount.setPlatformId(PlatformConstant.POST_STATION + "");//1表示职站 + userAccount.setRoleId("0");//设置为0 表示该表角色id暂时无用 acl_user_role:用户角色表有账号所属角色 + userAccount.setPhone(null); + if (!req.getPhone().equals("")) { + userAccount.setPhoneBindingTime(DateUtil.currentDate()); + userAccount.setPhone(req.getPhone()); + } + + int addAccount = studentMapper.addUserAccount(userAccount); + + List roleIds = new ArrayList<>(); + //员工相关信息表 + int addStaff = 0; + // 此处由创建人选择几个角色则生成几条员工表记录 + for (AddStaffRoleReq staffRoleReq : req.getRoleAndDeptList()) { + Staff staff = new Staff(); + staff.setAccountId(userAccount.getId()); + staff.setRoleId(staffRoleReq.getRoleId());//新增角色 + staff.setStaffArchitectureId(staffRoleReq.getStaffArchitectureId()); + staff.setGradeId(staffRoleReq.getGradeId()); + staff.setSchoolId(req.getSchoolId()); + addStaff = baseMapper.insert(staff); + roleIds.add(staffRoleReq.getRoleId()); + + } + //账号赋予角色 + userClient.rolePermissionService(userAccount.getId(), roleIds,null); + return addUserInfo > 0 && addAccount > 0 && addStaff > 0 ? R.ok() : R.error(); + } catch (Exception e) { + return R.error(e.getMessage()); + } + + } + + @Override + public R pageStaffList(PageStaffListReq req) { + Page page = new Page(req.getPageNum(), req.getPageSize()); + IPage staffList = baseMapper.staffList(page, req); + return R.ok().put("page", staffList); + } + + @Override + public R staffDetail(Integer accountId) { + StaffResp resp = baseMapper.staffDetail(accountId); + resp.setRoleAndDeptList(baseMapper.getStaffInfoByAccountId(accountId)); + return R.ok().put("data", resp); + } + + @Override + public R modifyStaff(ModifyStaffReq req, Integer schoolId) { + + //根据账号id获取userId + Integer userId = studentMapper.getUserId(req.getAccountId()); + + //存角色列表 用于新增至用户角色表 + List roleIds = new ArrayList<>(); + + //编辑员工相关信息表 + if (req.getRoleAndDeptList() != null) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("account_id", req.getAccountId()); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + List getRoleInfo = baseMapper.selectList(queryWrapper); + + getRoleInfo.stream().forEach(roleInfo -> { + //删除该用户原有角色 + userClient.delRoleByAccountId(roleInfo.getRoleId(), req.getAccountId()); + }); + + //删除现有员工信息 + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.set("is_del", DelConstant.IS_DEL); + updateWrapper.eq("account_id", req.getAccountId()); + baseMapper.update(new Staff(), updateWrapper); + + //重新新增一级二级部门及角色数据 + for (AddStaffRoleReq modifyStaffReq : req.getRoleAndDeptList()) { + Staff addStaff = new Staff(); + addStaff.setAccountId(req.getAccountId()); + addStaff.setRoleId(modifyStaffReq.getRoleId());//新增角色 + addStaff.setStaffArchitectureId(modifyStaffReq.getStaffArchitectureId()); + addStaff.setGradeId(modifyStaffReq.getGradeId()); + addStaff.setSchoolId(schoolId); + baseMapper.insert(addStaff); + roleIds.add(modifyStaffReq.getRoleId()); + } + //账号赋予角色 + userClient.rolePermissionService(req.getAccountId(), roleIds,null); + } + + //编辑账户相关信息表 + UserAccount userAccount = new UserAccount(); + BeanUtils.copyProperties(req, userAccount); + userAccount.setId(req.getAccountId()); + boolean updateAccount = studentMapper.modifyUserAccount(userAccount); + + //编辑用户相关信息表 + UserInfo userInfo = new UserInfo(); + BeanUtils.copyProperties(req, userInfo); + userInfo.setUserId(userId); + boolean updateUserInfo = studentMapper.modifyUserInfo(userInfo); + return updateUserInfo && updateAccount ? R.ok() : R.error(); + + } + + @Override + public R delStaff(List ids) { + Integer ret = 0; + if (ids.size() > 0) { + for (Integer accountId : ids) { + + //删除账号、用户表数据 修改用户表逻辑删除状态 修改账号表逻辑删除状态 + userClient.delAccountAndUser(accountId); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + queryWrapper.eq("account_id", accountId); + List roleList = baseMapper.selectList(queryWrapper); + roleList.stream().forEach(roleInfo -> { + //删除该用户原有角色 + userClient.delRoleByAccountId(roleInfo.getRoleId(), accountId); + }); + + //删除现有员工信息 + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.set("is_del", DelConstant.IS_DEL); + updateWrapper.eq("account_id", accountId); + ret = baseMapper.update(new Staff(), updateWrapper); + } + + } + return ret > 0 ? R.ok() : R.error(); + } + + @Transactional + @Override + public Map importStaff(MultipartFile file, Integer schoolId) throws IOException { + List impStaffReqList = ExcelImportHelper.readStaff(file); + if (impStaffReqList.size() <= 0) { + //小于等于0为上传空模板的情况下 抛出异常 + throw new CustomException(ExceptionEnum.EXCEL_FILE_FORMAT_ERROR); + } + int count = 0; + List failVo1 = new ArrayList(); + // 参数合法性校验,只能上传.xlsx后缀的文件 + if (org.apache.commons.lang3.StringUtils.isBlank(file.getOriginalFilename()) + || !file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")).equals(".xlsx")) { + ExceptionCast.cast(CommonCode.EXCEL_FILE_INVALID); + } + int size = impStaffReqList.size(); + Map map = new HashMap<>(); + Long ii = 1L;//用于记录序列号 + Integer countNum = 0;//用于失败原因排序 eg:1、XXXXX 2、XXXXXXX + try { + Integer countSuccess = 0;//统计成功次数 + Integer countError = 0;//统计失败次数 + + List workNumberList = new ArrayList<>();//用来储存新增前用户在excel中输入的所有工号用于excel中的数据判重 + List accountList = new ArrayList<>();//用来储存新增前用户在excel中输入的所有账号用于excel中的数据判重 + for (int i = 0; i < impStaffReqList.size(); i++) { + boolean ret = true; + ++ii; + ExcelImpStaffReq req = impStaffReqList.get(i); + + ImportStaffFailureVo vo1 = new ImportStaffFailureVo(); + + String errMsg = ""; + //去除Excel中的全角半角空格 + String getUserName = req.getUserName().replaceAll("\\u00A0", "").trim(); + // String getAccount = req.getAccount().replaceAll("\\u00A0", "").trim(); + String getRoleName = req.getRoleName().replaceAll("\\u00A0", "").trim(); + String getWorkNumber = req.getWorkNumber().replaceAll("\\u00A0", "").trim(); + String getFirstDept = req.getFirstDept().replaceAll("\\u00A0", "").trim(); + String getSecondDept = req.getSecondDept().replaceAll("\\u00A0", "").trim(); + String getPhone = req.getPhone().replaceAll("\\u00A0", "").trim(); + String getEmail = req.getEmail().replaceAll("\\u00A0", "").trim(); + + if (!workNumberList.contains(req.getWorkNumber())) { + workNumberList.add(req.getWorkNumber()); + } else { + + if (!getWorkNumber.equals("")) { + //包含excel数据中存在相同工号 + ++countNum; + vo1.setWorkNumber(getWorkNumber + " *必填项:(当前Excel数据中该工号已存在重复的!)"); + errMsg += countNum + " *必填项:(当前Excel数据中该工号已存在重复的)"; + ret = false; + } + + } + + /*if (!accountList.contains(req.getAccount())) { + accountList.add(req.getAccount()); + } else { + //包含excel数据中存在相同账号 + ++countNum; + vo1.setAccount(getAccount + " *必填项:(当前Excel数据中该账号已存在重复的)"); + errMsg += countNum + " *必填项:(当前Excel数据中该账号已存在重复的)"; + ret = false; + }*/ + + vo1.setIndex(ii); + //检验姓名 + if (getUserName.equals("")) { + ++countNum; + vo1.setUserName(getUserName + " *必填项:(姓名不能为空) "); + errMsg += countNum + "必填项:(姓名不能为空)"; + ret = false; + } else { + vo1.setUserName(getUserName); + } + + //检验账号 + /* if (getAccount.equals("")) { + ++countNum; + vo1.setAccount(getAccount + " *必填项:(账号不能为空)"); + errMsg += countNum + " *必填项:(账号不能为空)"; + ret = false; + } else { + UserAccount checkAccount = new UserAccount(); + checkAccount.setAccount(getAccount); + List checkUserAccount = studentMapper.checkUserAccount(checkAccount); + + if (checkUserAccount.size() > 0) { + ++countNum; + vo1.setAccount(getAccount + " *必填项:(账号已有重复的)"); + errMsg += countNum + " *必填项:(账号已有重复的)"; + ret = false; + } else { + vo1.setAccount(getAccount + ""); + } + }*/ + + //一级部门id + Integer saffArchitectureId = null; + //二级部门id + Integer gradeId = null; + //角色id + Integer roleId = null; + + //检验角色 + if (getRoleName.equals("")) { + ++countNum; + vo1.setRoleName(getRoleName + " *必填项:(角色不能为空)"); + errMsg += countNum + " *必填项:(角色不能为空)"; + ret = false; + } else if (!getRoleName.equals("")) { + // 不为空 则查询该角色是否存在 + Role checkRole = userClient.checkRoleIsExist(getRoleName, schoolId, 1); + if (checkRole != null && !checkRole.getRoleName().equals("超级管理员")) { + roleId = checkRole.getId(); + //存在 + vo1.setRoleName(getRoleName); + } else { + //不存在 + vo1.setRoleName(getRoleName + " *必填项:(请输入系统中存在的角色)"); + errMsg += countNum + " *必填项:(请输入系统中存在的角色)"; + ret = false; + } + + } + + //检验工号 + if (getWorkNumber.equals("")) { + ++countNum; + vo1.setWorkNumber(getWorkNumber + " *必填项:(工号不能为空)"); + errMsg += countNum + " *必填项:(工号不能为空)"; + ret = false; + } else if (!getWorkNumber.equals("")) { + UserAccount workNum = new UserAccount(); + workNum.setWorkNumber(getWorkNumber); + workNum.setSchoolId(schoolId); + workNum.setType(0); + workNum.setPlatformId("1"); + List checkUserWorkNum = studentMapper.checkUserAccount(workNum); + if (checkUserWorkNum.size() > 0) { + ++countNum; + vo1.setWorkNumber(getWorkNumber + " *必填项:(工号已经存在重复的)"); + errMsg += countNum + " *必填项:(工号已经存在重复的)"; + ret = false; + } else { + vo1.setWorkNumber(getWorkNumber + ""); + } + } + + //检验一二级部门 + if (getFirstDept.equals("") || getSecondDept.equals("")) { + ++countNum; + vo1.setFirstDept(getFirstDept + " *必填项:(请输入正确的员工架构!)"); + vo1.setSecondDept(getSecondDept + " *必填项:(请输入正确的员工架构!)"); + errMsg += countNum + " *必填项:(请输入正确的员工架构!)"; + ret = false; + } else { + // 检验输入的一二级部门是否存在 + //查询一级部门信息 + QueryWrapper queryWrapper1 = new QueryWrapper<>(); + queryWrapper1.eq("school_id", schoolId); + queryWrapper1.eq("is_del", DelConstant.NOT_DEL); + queryWrapper1.eq("staff_architecture_name", getFirstDept); + StaffProfessionalArchitecture architecture = professionalArchitectureMapper.selectOne(queryWrapper1); + if (architecture == null) { + //为空表示不存在该部门 + ++countNum; + vo1.setFirstDept(getFirstDept + " *必填项:(请输入正确的员工架构!)"); + vo1.setSecondDept(getSecondDept + " *必填项:(请输入正确的员工架构!)"); + errMsg += countNum + " *必填项:(请输入正确的员工架构!)"; + ret = false; + } else { + saffArchitectureId = architecture.getStaffArchitectureId(); + //查询二级部门信息 + QueryWrapper queryWrapper2 = new QueryWrapper<>(); + queryWrapper2.eq("staff_architecture_id", architecture.getStaffArchitectureId()); + queryWrapper2.eq("grade_name", getSecondDept); + StaffGrade grade = gradeMapper.selectOne(queryWrapper2); + vo1.setFirstDept(getFirstDept); + if (grade != null) { + gradeId = grade.getGradeId(); + vo1.setSecondDept(getSecondDept); + } else { + ++countNum; + vo1.setSecondDept(getSecondDept + " *必填项:(请输入正确的员工架构!)"); + errMsg += countNum + " *必填项:(请输入正确的员工架构!)"; + ret = false; + } + } + + } + + if (!getPhone.equals("")) { + //校验手机号格式 + if (validPhoneNum("0", getPhone) == false) { + ++countNum; + vo1.setPhone(getPhone + " *请输入正确的手机号!"); + errMsg += countNum + " *请输入正确的手机号!"; + ret = false; + } /*else { + //检验手机号 type 1为手机号 2为校验邮箱 + boolean checkPhone = userClient.checkPhoneOrEmailExist(getPhone, getEmail, 1); + if (checkPhone) { + ++countNum; + vo1.setPhone(getPhone + " *该手机号已被绑定!"); + errMsg += countNum + " *该手机号已被绑定!"; + ret = false; + } + vo1.setPhone(getPhone); + }*/ + + } else { + vo1.setPhone(getPhone); + } + + if (!getEmail.equals("")) { + //校验邮箱格式 + if (isValidEmail(getEmail) == false) { + ++countNum; + vo1.setEmail(getEmail + "*请输入正确的邮箱格式!"); + errMsg += countNum + " *请输入正确的邮箱格式!"; + ret = false; + } /*else { + //检验手机号 type 2为校验邮箱 + boolean checkEmail = userClient.checkPhoneOrEmailExist(getPhone, getEmail, 2); + if (checkEmail) { + ++countNum; + vo1.setEmail(getEmail + " *该邮箱已被绑定!"); + errMsg += countNum + " *该邮箱已被绑定!"; + ret = false; + } + vo1.setEmail(getEmail); + }*/ + + } else { + vo1.setEmail(getEmail); + } + + vo1.setFailureMsg(errMsg); + countNum = 0; + + failVo1.add(vo1); + + //ret判断 新增成功的插入到数据库 否则则不新增至数据库 + if (ret) { + //执行新增操作 + // 工号(本校内)——————账号(全平台)判重 ——————手机号、邮箱根据平台id判重 + UserInfo userInfo = new UserInfo(); + userInfo.setSchoolId(schoolId); + userInfo.setRoleId("0"); + userInfo.setUniqueIdentification(String.valueOf(System.currentTimeMillis())); + BeanUtils.copyProperties(req, userInfo); + studentMapper.addUserInfo(userInfo); + + UserAccount account = new UserAccount(); + account.setSchoolId(schoolId); + account.setPassword(MD5.encrypt("1122aa")); + account.setPlatformId(PlatformConstant.POST_STATION + "");//所属平台id 1.职站 + account.setType(PlatformConstant.TEACHER_SIDE);//平台端区分:0->教师端 1->学生端 2->无端 + account.setUserId(userInfo.getUserId()); + account.setRoleId("0"); + + //22.4.13补充: 账号组成条件:平台(职站/数据平台/中台)-端(教师、学生端、无端(数据平台的用户))-学校(学校id)-学号/工号(用户输入的工号学号) + + account.setAccount(PlatformConstant.POST_STATION + "-" + PlatformConstant + .TEACHER_SIDE + "-" + schoolId + "-" + req.getWorkNumber()); + BeanUtils.copyProperties(req, account); + + + account.setPhone(null); + if (getPhone != null && !getPhone.equals("")) { + account.setPhone(getPhone); + account.setPhoneBindingTime(DateUtil.currentDate()); + } + studentMapper.addUserAccount(account); + + // 新增至员工信息表 + Staff staff = new Staff().setSchoolId(schoolId) + .setStaffArchitectureId(saffArchitectureId) + .setAccountId(account.getId()) + .setRoleId(roleId) + .setGradeId(gradeId); + baseMapper.insert(staff); + + List roleIds = new ArrayList<>(); + roleIds.add(roleId); + // 同时新增至用户角色表 + //账号赋予角色 + userClient.rolePermissionService(account.getId(), roleIds,null); + + //countSuccess:统计累计成功次数 + countSuccess++; + } else { + //countError:累计失败次数 + countError++; + } + } + String exportCode = ""; + + // 有导入失败的数据,才会存入redis + if (countError > 0) { + //生成token + exportCode = "FAILURE_IMPORT" + UUID.randomUUID().toString().replace("-", ""); + ValueOperations ops = stringRedisTemplate.opsForValue(); + + List collect = failVo1.stream().filter(importStaffFailureVo -> { + return !importStaffFailureVo.getFailureMsg().equals(""); + }).collect(Collectors.toList()); + + String failureVOJson = JSON.toJSONString(collect); + ops.set(exportCode, failureVOJson, 30 * 60, TimeUnit.SECONDS); + } + map.put("exportCode", exportCode);//返回导出code + map.put("successNum", countSuccess + "");//本次新增成功数量 + map.put("failureNum", countError + "");//本次新增失败数量 + return map; + } catch (RuntimeException e) { + System.err.println(e.getMessage()); + throw new RuntimeException(); + } + } + + /** + * @Description : 校验邮箱 + * @Param email + * @Author Rong---2021/10/18 + */ + public static boolean isValidEmail(String email) { + if ((email != null) && (!email.isEmpty())) { + return Pattern.matches("^(\\w+([-.][A-Za-z0-9]+)*){3,18}@\\w+([-.][A-Za-z0-9]+)*\\.\\w+([-.][A-Za-z0-9]+)*$", email); + } + return false; + } + + public static void main(String[] args) { + //System.out.println(validPhoneNum("0", "13828811320")); + System.out.println(isValidEmail("13828811320@qq.com")); + } + + /** + * @Description : 校验手机号 + * @Param checkType 校验类型:0校验手机号码,1校验座机号码,2两者都校验满足其一就可 + * @Param phoneNum + * @Author Rong---2021/10/18 + */ + public static boolean validPhoneNum(String checkType, String phoneNum) { + boolean flag = false; + Pattern p1 = null; + Pattern p2 = null; + Matcher m = null; + p1 = Pattern.compile("^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(17[0-9]{1}))+\\d{8})?$"); + p2 = Pattern.compile("^(0[0-9]{2,3}\\-)?([1-9][0-9]{6,7})$"); + if ("0".equals(checkType)) { + System.out.println(phoneNum.length()); + if (phoneNum.length() != 11) { + return false; + } else { + m = p1.matcher(phoneNum); + flag = m.matches(); + } + } else if ("1".equals(checkType)) { + if (phoneNum.length() < 11 || phoneNum.length() >= 16) { + return false; + } else { + m = p2.matcher(phoneNum); + flag = m.matches(); + } + } else if ("2".equals(checkType)) { + if (!((phoneNum.length() == 11 && p1.matcher(phoneNum).matches()) || (phoneNum.length() < 16 && p2.matcher(phoneNum).matches()))) { + return false; + } else { + flag = true; + } + } + return flag; + } + + @Override + public void exportFailureRecord(HttpServletResponse response, String token) throws Exception { + if (org.apache.commons.lang3.StringUtils.isEmpty(token)) { + return; + } + ValueOperations ops = stringRedisTemplate.opsForValue(); + //获取数据 + String record = ops.get(token); + if (org.apache.commons.lang3.StringUtils.isEmpty(record)) { + return; + } + List parse = JSON.parseObject(record, new TypeReference>() { + }); + + parse.sort(Comparator.comparing(ImportStaffFailureVo::getIndex)); + + // 告诉浏览器用什么软件可以打开此文件 + response.setHeader("content-Type", "application/vnd.ms-excel"); + // 下载文件的默认名称 + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("员工导入失败数据表", "UTF-8") + ".xls"); + //编码 + response.setCharacterEncoding("UTF-8"); + Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), ImportStaffFailureVo.class, parse); + ExportParams exportParams = new ExportParams(null, "delivery", ExcelType.XSSF); + exportParams.setStyle(ExcelStyleUtil.class); + workbook.write(response.getOutputStream()); + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/StudentServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/StudentServiceImpl.java new file mode 100644 index 0000000..6adc9ea --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/StudentServiceImpl.java @@ -0,0 +1,1004 @@ +package com.huoran.occupationlab.service.impl; + +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.entity.ExportParams; +import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.TypeReference; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.huoran.api.UserClient; +import com.huoran.common.constant.DelConstant; +import com.huoran.common.constant.PlatformConstant; +import com.huoran.common.entity.Student; +import com.huoran.common.entity.UserAccount; +import com.huoran.common.entity.UserInfo; +import com.huoran.common.exception.CustomException; +import com.huoran.common.exception.ExceptionEnum; +import com.huoran.common.utils.DateUtils; +import com.huoran.common.utils.MD5; +import com.huoran.occupationlab.entity.*; +import com.huoran.occupationlab.entity.Class; +import com.huoran.occupationlab.entity.req.*; +import com.huoran.occupationlab.entity.resp.StudentInfoResp; +import com.huoran.occupationlab.entity.vo.ImportStudentFailureVo; +import com.huoran.occupationlab.mapper.ArchitectureMapper; +import com.huoran.occupationlab.mapper.ClassMapper; +import com.huoran.occupationlab.mapper.StudentMapper; +import com.huoran.occupationlab.service.StudentService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.common.utils.DateUtil; +import com.huoran.occupationlab.utils.ExcelImportHelper; +import com.huoran.occupationlab.utils.poi.CommonCode; +import com.huoran.occupationlab.utils.poi.ExcelStyleUtil; +import com.huoran.occupationlab.utils.poi.ExceptionCast; +import org.apache.ibatis.annotations.Param; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.data.redis.core.ValueOperations; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.net.URLEncoder; +import java.util.*; +import java.util.concurrent.TimeUnit; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + +/** + *

+ * 学生表 服务实现类 + *

+ * + * @author lr + * @since 2021-08-24 + */ +@Service +public class StudentServiceImpl extends ServiceImpl implements StudentService { + + @Autowired + private ArchitectureMapper architectureMapper; + + @Autowired + private ClassMapper classMapper; + + @Autowired + private StudentMapper studentMapper; + + @Resource + StringRedisTemplate stringRedisTemplate; + + @Autowired + private UserClient userClient; + + @Override + public StudentInfoResp getStudentInfoDetail(@Param("params") Map params) { + return studentMapper.getStudentInfoDetail(params); + } + + @Override + public StudentInfoResp getStudentInfoDetailByWorkNum(Map params) { + return studentMapper.getStudentInfoDetailByWorkNum(params); + } + + @Override + public boolean addUserInfo(UserInfo userInfo) { + if (studentMapper.addUserInfo(userInfo) > 0) { + return true; + } + return false; + + } + + @Override + public boolean addUserAccount(UserAccount account) { + if (studentMapper.addUserAccount(account) > 0) { + return true; + } + return false; + } + + @Override + public List checkUserInfo(UserInfo userInfo) { + return baseMapper.checkUserInfo(userInfo); + } + + @Override + public List checkUserAccount(UserAccount userAccount) { + return baseMapper.checkUserAccount(userAccount); + } + + @Override + public List studentList(PageStudentListReq req) { + Map map = new HashMap<>(); + map.put("schoolId", req.getSchoolId()); + map.put("keyWord", req.getKeyWord()); + map.put("pageNum", (req.getPageNum() - 1) * req.getPageSize()); + map.put("pageSize", req.getPageSize()); + map.put("type", req.getType()); + map.put("accountId", req.getAccountId()); + return baseMapper.studentList(map); + } + + @Override + public Integer studentListNum(PageStudentListReq req) { + Map map = new HashMap<>(); + map.put("keyWord", req.getKeyWord()); + map.put("schoolId", req.getSchoolId()); + map.put("pageNum", (req.getPageNum() - 1) * req.getPageSize()); + map.put("pageSize", req.getPageSize()); + map.put("type", req.getType()); + return baseMapper.studentListNum(map); + } + + @Override + public List getOccupationlabStudent() { + return baseMapper.getOccupationlabStudent(); + } + + @Override + public StudentInfoResp getStudentInfoByAccountId(Integer stuAccountId) { + return baseMapper.getStudentInfoByAccountId(stuAccountId); + } + + @Override + public boolean modifyUserInfo(UserInfo userInfo) { + /* EditStudentsReq req = new EditStudentsReq(); + req.setPhoneBindingTime(null); + if (userInfo.getPhone() != null) { + + BeanUtils.copyProperties(userInfo, req); + req.setPhoneBindingTime(DateUtils.getNowTime()); + boolean result = baseMapper.modifyUserAccountByUserId(req); + }*/ + + return baseMapper.modifyUserInfo(userInfo); + } + + @Override + public boolean modifyUserAccount(UserAccount userAccount) { + userAccount.setPhoneBindingTime(null); + if (userAccount.getPhone() != null && !userAccount.getPhone().equals("")) { + userAccount.setPhoneBindingTime(DateUtils.getNowTime()); + } + return baseMapper.modifyUserAccount(userAccount); + } + + /** + * @Description :校验是否存在文字 为true表示存在 false表示不存在 + * @Param str + * @Author Rong---2021/11/4 + */ + public static boolean isContainChinese(String str) { + Pattern p = Pattern.compile("[\u4e00-\u9fa5]"); + Matcher m = p.matcher(str); + if (m.find()) { + return true; + } + return false; + } + + @Transactional + @Override + public Map uploadStudent(MultipartFile file, Integer schoolId) throws IOException { + List impStudentReqs = ExcelImportHelper.readStudent(file); + if (impStudentReqs.size() <= 0) { + //小于等于0为上传空模板的情况下 抛出异常 + throw new CustomException(ExceptionEnum.EXCEL_FILE_FORMAT_ERROR); + } + int count = 0; + List failVo1 = new ArrayList<>(); + // 参数合法性校验,只能上传.xlsx后缀的文件 + if (org.apache.commons.lang3.StringUtils.isBlank(file.getOriginalFilename()) || !file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")).equals(".xlsx")) { + ExceptionCast.cast(CommonCode.EXCEL_FILE_INVALID); + } + int size = impStudentReqs.size(); + Map map = new HashMap<>(); + Long ii = 1L;//用于记录序列号 + Integer countNum = 0;//用于失败原因排序 eg:1、XXXXX 2、XXXXXXX + try { + Integer countSuccess = 0;//统计成功次数 + Integer countError = 0;//统计失败次数 + + List workNumberList = new ArrayList<>();//用来储存新增前用户在excel中输入的所有学号用于excel中的数据判重 + List accountList = new ArrayList<>();//用来储存新增前用户在excel中输入的所有账号用于excel中的数据判重 + + for (int i = 0; i < impStudentReqs.size(); i++) { + boolean ret = true;//用于判断是否可以新增到数据库中 + ++ii; + ExcelImpStudentReq req = impStudentReqs.get(i); + + String errMsg = ""; + //去除Excel中的全角半角空格 + String getUserName = req.getUserName().replaceAll("\\u00A0", "").trim(); + //String getAccount = req.getAccount().replaceAll("\\u00A0", "").trim(); + //22.4.13补充: 账号组成条件:平台(职站/数据平台/中台)-端(教师、学生端、无端(数据平台的用户))-学校(学校id)-学号/工号(用户输入的工号学号) + + String getWorkNumber = req.getWorkNumber().replaceAll("\\u00A0", "").trim(); + String getProfessional = req.getProfessional().replaceAll("\\u00A0", "").trim();//专业 + String getGrade = req.getGrade().replaceAll("\\u00A0", "").trim();//年级 + String getClasses = req.getClasses().replaceAll("\\u00A0", "").trim();//班级 + String getPhone = req.getPhone().replaceAll("\\u00A0", "").trim(); + String getEmail = req.getEmail().replaceAll("\\u00A0", "").trim(); + + ImportStudentFailureVo vo1 = new ImportStudentFailureVo(); + + //判断当前的Excel列表中是否存在重复的 + if (!workNumberList.contains(req.getWorkNumber())) { + workNumberList.add(req.getWorkNumber()); + } else { + //包含excel数据中存在相同学号 + ++countNum; + vo1.setProfessional(getProfessional); + vo1.setGrade(getGrade); + vo1.setClasses(getClasses); + vo1.setUserName(getUserName); + vo1.setPhone(getPhone); + vo1.setEmail(getEmail); + // vo1.setAccount(getAccount); + vo1.setWorkNumber(getWorkNumber + " *必填项:(当前Excel数据中该学号已存在重复的!)"); + errMsg += countNum + " *必填项:(当前Excel数据中该学号已存在重复的)"; + ret = false; + countError++; + } + + /* if (!accountList.contains(req.getAccount())) { + accountList.add(req.getAccount()); + } else { + //包含excel数据中存在相同账号 + ++countNum; + vo1.setProfessional(getProfessional); + vo1.setGrade(getGrade); + vo1.setClasses(getClasses); + vo1.setUserName(getUserName); + vo1.setWorkNumber(getWorkNumber); + vo1.setPhone(getPhone); + vo1.setEmail(getEmail); + // vo1.setAccount(getAccount + " *必填项:(当前Excel数据中该账号已存在重复的)"); + errMsg += countNum + " *必填项:(当前Excel数据中该账号已存在重复的)"; + ret = false; + }*/ + + vo1.setIndex(ii); + + //校验学号是否存在汉字 + if (!getWorkNumber.trim().equals("")) { + if (isContainChinese(getWorkNumber)) { + ++countNum; + vo1.setProfessional(getProfessional); + vo1.setGrade(getGrade); + vo1.setClasses(getClasses); + // vo1.setAccount(getAccount); + vo1.setUserName(getUserName); + vo1.setPhone(getPhone); + vo1.setEmail(getEmail); + vo1.setWorkNumber(getWorkNumber + "* 学号不能存在汉字!"); + errMsg += countNum + " * 学号不能存在汉字!"; + ret = false; + countError++; + } + } + + String classId = ""; + //姓名 账号 学号 不为空则查询是否存在该生 + //如若已经存在则根据学生架构判断 如果存在同一个班级下才提示错误信息 + + StudentInfoResp stu = new StudentInfoResp(); + stu.setWorkNumber(getWorkNumber); + stu.setUserName(getUserName); + stu.setSchoolId(schoolId); + StudentInfoResp listResp = studentMapper.getUserInfo(stu);//连表查询 + + if (!getWorkNumber.equals("") && !getUserName.equals("")) { + UserAccount checkWorkNumber = new UserAccount(); + checkWorkNumber.setWorkNumber(getWorkNumber); + checkWorkNumber.setSchoolId(schoolId); + checkWorkNumber.setType(PlatformConstant.STUDENT_SIDE); + checkWorkNumber.setPlatformId(PlatformConstant.POST_STATION + ""); + + UserAccount getUserInfoByWorkNumber = studentMapper.checkAccountOrWorkNum(checkWorkNumber);//查询工号 + + if (listResp != null && getUserInfoByWorkNumber != null) { + //如果查询工号 以及 查询账号时 查询出来的信息一致则表示该用户已存在 + if (!getWorkNumber.equals(getUserInfoByWorkNumber.getWorkNumber().equals(listResp.getUserName())) && !listResp.getUserName().equals(getUserName)) { + ++countNum; + vo1.setProfessional(getProfessional); + vo1.setGrade(getGrade); + vo1.setClasses(getClasses); + // vo1.setAccount(getAccount); + vo1.setUserName(getUserName); + vo1.setWorkNumber(getWorkNumber); + vo1.setPhone(getPhone); + vo1.setEmail(getEmail); + errMsg += countNum + " * 该学号已存在!"; + ret = false; + countError++; + } + } else if (listResp != null || getUserInfoByWorkNumber != null) {//如果其中一个不为空表示该导入的用户账号或工号重复了 + ++countNum; + vo1.setProfessional(getProfessional); + vo1.setGrade(getGrade); + vo1.setClasses(getClasses); + // vo1.setAccount(getAccount); + vo1.setUserName(getUserName); + vo1.setWorkNumber(getWorkNumber); + vo1.setPhone(getPhone); + vo1.setEmail(getEmail); + errMsg += countNum + " * 学号已存在,姓名与学号不匹配!"; + ret = false; + countError++; + } + } + + //表示用户输入的都匹配 --->判断是否有输入组织架构 + if (listResp != null) {//表示存在该校存在该学生 + if (getProfessional.equals("") && getGrade.equals("") && getClasses.equals("")) {//表示已存在该用户 + ++countNum; + vo1.setProfessional(getProfessional); + vo1.setGrade(getGrade); + vo1.setClasses(getClasses); + // vo1.setAccount(getAccount); + vo1.setUserName(getUserName); + vo1.setWorkNumber(getWorkNumber); + vo1.setPhone(getPhone); + vo1.setEmail(getEmail); + errMsg += countNum + " * 该用户已存在!"; + ret = false; + countError++; + } else if (!getProfessional.equals("") && !getGrade.equals("") && !getClasses.equals("")) {//三层之前都不为空 则对用户输入的三层进行查询 + + //查询专业所属主键 + QueryWrapper queryWrapper1 = new QueryWrapper<>(); + queryWrapper1.eq("organization_name", getProfessional); + queryWrapper1.eq("is_del", DelConstant.NOT_DEL); + queryWrapper1.eq("school_id", schoolId); + queryWrapper1.eq("parent_id", schoolId); + queryWrapper1.eq("level", 1); + Architecture professional = architectureMapper.selectOne(queryWrapper1); + + if (professional == null) {//professional 为空表示用户输入的是自定义的一级架构 则新增专业 + Architecture addProfessional = new Architecture(); + addProfessional.setSchoolId(schoolId); + addProfessional.setParentId(schoolId); + addProfessional.setOrganizationName(getProfessional); + addProfessional.setLevel(1); + Integer addProfessionalRet = architectureMapper.insert(addProfessional); + if (addProfessionalRet > 0) {//执行新增专业成功后 + // 执行新增年级 + Architecture addGrade = new Architecture(); + addGrade.setSchoolId(schoolId); + addGrade.setParentId(addProfessional.getId()); + addGrade.setLevel(2); + addGrade.setOrganizationName(getGrade); + Integer addGradeRet = architectureMapper.insert(addGrade); + // 执行新增班级操作 + if (addGradeRet > 0) { + + Class addClass = new Class().setArchitectureId(addGrade.getId()).setClassName(getClasses); + Integer addClsssRet = classMapper.insert(addClass); + + if (addClsssRet > 0) { + QueryWrapper studentQueryWrapper = new QueryWrapper<>(); + studentQueryWrapper.eq("is_del", DelConstant.NOT_DEL); + studentQueryWrapper.eq("account_id", listResp.getAccountId()); + //此处判断是否存在别的班级中 + Student student = baseMapper.selectOne(studentQueryWrapper); + + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + if (student.getClassId().equals("1")) { //没有存在该班级中 直接拉入该班级 + updateWrapper.set("class_id", addClass.getId()); + } else { + updateWrapper.set("class_id", student.getClassId() + "," + addClass.getId());//该生存在于别的班级中 所以拼接 + } + updateWrapper.eq("account_id", listResp.getAccountId()); + updateWrapper.eq("is_del", 0); + baseMapper.update(new Student(), updateWrapper); + + } + } + } + + } else {//professional 不为空表示一级存在 + //根据专业id查询该专业下的年级 + QueryWrapper queryWrapper2 = new QueryWrapper<>(); + queryWrapper2.eq("is_del", DelConstant.NOT_DEL); + queryWrapper2.eq("school_id", schoolId); + queryWrapper2.eq("parent_id", professional.getId()); + queryWrapper2.eq("level", 2); + queryWrapper2.eq("organization_name", getGrade); + Architecture grade = architectureMapper.selectOne(queryWrapper2); + if (grade == null) {//如果二级为空表示自定义二级架构 则新增年级 + Architecture addGrade = new Architecture(); + addGrade.setSchoolId(schoolId); + addGrade.setParentId(professional.getId()); + addGrade.setLevel(2); + addGrade.setOrganizationName(getGrade); + architectureMapper.insert(addGrade); + //同时新增班级及拉入班级 + Class addClass = new Class(); + addClass.setArchitectureId(addGrade.getId()).setClassName(getClasses); + Integer addClsssRet = classMapper.insert(addClass); + + if (addClsssRet > 0) { + QueryWrapper studentQueryWrapper = new QueryWrapper<>(); + studentQueryWrapper.eq("is_del", DelConstant.NOT_DEL); + studentQueryWrapper.eq("account_id", listResp.getAccountId()); + //此处判断是否存在别的班级中 + Student student = baseMapper.selectOne(studentQueryWrapper); + + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + if (student.getClassId().equals("1")) { //没有存在该班级中 直接拉入该班级 + updateWrapper.set("class_id", addClass.getId()); + } else { + updateWrapper.set("class_id", student.getClassId() + "," + addClass.getId());//该生存在于别的班级中 所以拼接 + } + updateWrapper.eq("account_id", listResp.getAccountId()); + updateWrapper.eq("is_del", 0); + baseMapper.update(new Student(), updateWrapper); + + } + + } else {//表示该年级存在 + //根据年级id查询年级下的班级 + QueryWrapper queryWrapper3 = new QueryWrapper<>(); + queryWrapper3.eq("is_del", DelConstant.NOT_DEL); + queryWrapper3.eq("architecture_id", grade.getId()); + queryWrapper3.eq("class_name", getClasses); + Class class1 = classMapper.selectOne(queryWrapper3); + + if (class1 == null) {//classes为空表示自定义三级架构 执行新增操作 + Class addClass = new Class().setArchitectureId(grade.getId()).setClassName(getClasses); + classMapper.insert(addClass); + //新增班级同时拉入班级 + QueryWrapper studentQueryWrapper = new QueryWrapper<>(); + studentQueryWrapper.eq("is_del", DelConstant.NOT_DEL); + studentQueryWrapper.eq("account_id", listResp.getAccountId()); + Student student = baseMapper.selectOne(studentQueryWrapper); + + //没有存在该班级中 直接拉入该班级 + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + if (student.getClassId().equals("1")) {//表示该生还未加入班级 + updateWrapper.set("class_id", addClass.getId()); + } else { + updateWrapper.set("class_id", student.getClassId() + "," + addClass.getId()); + } + updateWrapper.eq("account_id", listResp.getAccountId()); + updateWrapper.eq("is_del", 0); + baseMapper.update(new Student(), updateWrapper); + + } else { + + QueryWrapper studentQueryWrapper = new QueryWrapper<>(); + studentQueryWrapper.eq("is_del", DelConstant.NOT_DEL); + studentQueryWrapper.eq("account_id", listResp.getAccountId()); + studentQueryWrapper.last(" and FIND_IN_SET(" + class1.getId() + ",class_id) "); + + Student checkReapt = baseMapper.selectOne(studentQueryWrapper); + if (checkReapt != null) { + ++countNum; + vo1.setProfessional(getProfessional); + vo1.setGrade(getGrade); + vo1.setClasses(getClasses); + // vo1.setAccount(getAccount); + vo1.setUserName(getUserName); + vo1.setWorkNumber(getWorkNumber); + vo1.setPhone(getPhone); + vo1.setEmail(getEmail); + errMsg += countNum + " * 该用户已存在该班级中了!"; + ret = false; + countError++; + } else { + //拉入该班级 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + queryWrapper.eq("account_id", listResp.getAccountId()); + Student student = baseMapper.selectOne(queryWrapper); + + //没有存在该班级中 直接拉入该班级 + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + if (student.getClassId().equals("1")) {//表示该生还未加入班级 + updateWrapper.set("class_id", class1.getId()); + } else { + updateWrapper.set("class_id", student.getClassId() + "," + class1.getId()); + } + updateWrapper.eq("account_id", listResp.getAccountId()); + updateWrapper.eq("is_del", 0); + baseMapper.update(new Student(), updateWrapper); + } + + } + } + + } + + } + + } else { + //不存在该生则校验学号账号新增学生操作 + //ret判断 新增成功的插入到数据库 否则则不新增至数据库 + //检验学生姓名 + if (getUserName.equals("")) { + ++countNum; + vo1.setUserName(getUserName + " *必填项:(学生姓名不能为空) "); + vo1.setProfessional(getProfessional); + vo1.setGrade(getGrade); + vo1.setClasses(getClasses); + // vo1.setAccount(getAccount); + vo1.setWorkNumber(getWorkNumber); + vo1.setPhone(getPhone); + vo1.setEmail(getEmail); + errMsg += countNum + "必填项:(学生姓名不能为空)"; + ret = false; + countError++; + } else { + vo1.setUserName(getUserName); + } + + /*if (getAccount.equals("")) { + ++countNum; + vo1.setAccount(getAccount + " *必填项:(学生账号不能为空)"); + vo1.setProfessional(getProfessional); + vo1.setGrade(getGrade); + vo1.setClasses(getClasses); + vo1.setUserName(getUserName); + vo1.setWorkNumber(getWorkNumber); + vo1.setPhone(getPhone); + vo1.setEmail(getEmail); + errMsg += countNum + " *必填项:(学生账号不能为空)"; + ret = false; + countError++; + } else { + vo1.setAccount(getAccount); + }*/ + if (getWorkNumber.equals("")) { + ++countNum; + vo1.setWorkNumber(getWorkNumber + " *必填项:(学号不能为空)"); + vo1.setProfessional(getProfessional); + vo1.setGrade(getGrade); + vo1.setClasses(getClasses); + // vo1.setAccount(getAccount); + vo1.setUserName(getUserName); + vo1.setPhone(getPhone); + vo1.setEmail(getEmail); + errMsg += countNum + " *必填项:(学号不能为空)"; + ret = false; + countError++; + } else { + vo1.setWorkNumber(getWorkNumber); + } + + //校验手机号、邮箱 + if (!getPhone.equals("")) { + //校验手机号格式 + if (validPhoneNum("0", getPhone) == false) { + ++countNum; + vo1.setPhone(getPhone + " *请输入正确的手机号!"); + vo1.setProfessional(getProfessional); + vo1.setGrade(getGrade); + vo1.setClasses(getClasses); + // vo1.setAccount(getAccount); + vo1.setUserName(getUserName); + vo1.setWorkNumber(getWorkNumber); + vo1.setPhone(getPhone); + vo1.setEmail(getEmail); + vo1.setProfessional(getProfessional); + vo1.setGrade(getGrade); + vo1.setClasses(getClasses); + vo1.setUserName(getUserName); + vo1.setWorkNumber(getWorkNumber); + vo1.setEmail(getEmail); + errMsg += countNum + " *请输入正确的手机号!"; + ret = false; + countError++; + }/* else { + //检验手机号 type 1为手机号 2为校验邮箱 + boolean checkPhone = userClient.checkPhoneOrEmailExist(getPhone, getEmail, 1); + if (checkPhone) { + ++countNum; + vo1.setProfessional(getProfessional); + vo1.setGrade(getGrade); + vo1.setClasses(getClasses); + // vo1.setAccount(getAccount); + vo1.setUserName(getUserName); + vo1.setWorkNumber(getWorkNumber); + vo1.setEmail(getEmail); + vo1.setPhone(getPhone + " *该手机号已被绑定!"); + errMsg += countNum + " *该手机号已被绑定!"; + ret = false; + countError++; + } + vo1.setPhone(getPhone); + }*/ + + } else { + vo1.setPhone(getPhone); + } + + if (!getEmail.equals("")) { + //校验邮箱格式 + if (isValidEmail(getEmail) == false) { + ++countNum; + vo1.setProfessional(getProfessional); + vo1.setGrade(getGrade); + vo1.setClasses(getClasses); + // vo1.setAccount(getAccount); + vo1.setUserName(getUserName); + vo1.setWorkNumber(getWorkNumber); + vo1.setPhone(getPhone); + vo1.setEmail(getEmail + "*请输入正确的邮箱格式!"); + errMsg += countNum + " *请输入正确的邮箱格式!"; + ret = false; + countError++; + } /*else { + //检验手机号 type 2为校验邮箱 + boolean checkEmail = userClient.checkPhoneOrEmailExist(getPhone, getEmail, 2); + if (checkEmail) { + ++countNum; + vo1.setProfessional(getProfessional); + vo1.setGrade(getGrade); + vo1.setClasses(getClasses); + // vo1.setAccount(getAccount); + vo1.setUserName(getUserName); + vo1.setWorkNumber(getWorkNumber); + vo1.setPhone(getPhone); + vo1.setEmail(getEmail + " *该邮箱已被绑定!"); + errMsg += countNum + " *该邮箱已被绑定!"; + ret = false; + countError++; + } + vo1.setEmail(getEmail); + }*/ + + } else { + vo1.setEmail(getEmail); + } + + if (ret) { + //执行新增操作 + // 学号(本校内、平台端(教师or学生)、平台来源) + // 账号、手机号、邮箱全平台判重 + UserInfo userInfo = new UserInfo(); + userInfo.setSchoolId(schoolId); + userInfo.setRoleId("0"); + userInfo.setUniqueIdentification(String.valueOf(System.currentTimeMillis())); + BeanUtils.copyProperties(req, userInfo); + studentMapper.addUserInfo(userInfo); + + UserAccount account = new UserAccount(); + account.setSchoolId(schoolId); + account.setPassword(MD5.encrypt("1122aa")); + account.setPlatformId(PlatformConstant.POST_STATION + "");//所属平台id 1.职站 + account.setType(PlatformConstant.STUDENT_SIDE);//平台端区分:0->教师端 1->学生端 2->无端 + account.setUserId(userInfo.getUserId()); + account.setRoleId("0"); + //22.4.13补充: 账号组成条件:平台(职站/数据平台/中台)-端(教师、学生端、无端(数据平台的用户))-学校(学校id)-学号/工号(用户输入的工号学号) + + account.setAccount(PlatformConstant.POST_STATION + "-" + PlatformConstant.STUDENT_SIDE + "-" + schoolId + "-" + req.getWorkNumber()); + BeanUtils.copyProperties(req, account); + account.setPhone(null); + if (getPhone != null && !getPhone.equals("")) { + account.setPhone(getPhone); + account.setPhoneBindingTime(DateUtil.currentDate()); + } + + studentMapper.addUserAccount(account); + + //新增学生(先默认为未指定班级) + Student addStudent = new Student(); + addStudent.setAccountId(account.getId()); + if (classId.equals("")) { + addStudent.setClassId("1"); + } else { + addStudent.setClassId(classId); + } + + BeanUtils.copyProperties(req, addStudent); + addStudent.setSchoolId(schoolId); + studentMapper.insert(addStudent); + + if (getProfessional.equals("") || getGrade.equals("") || getClasses.equals("")) { + ++countNum; + vo1.setProfessional(getProfessional); + vo1.setGrade(getGrade); + vo1.setClasses(getClasses); + // vo1.setAccount(getAccount); + vo1.setUserName(getUserName); + vo1.setWorkNumber(getWorkNumber); + vo1.setPhone(getPhone); + vo1.setEmail(getEmail); + errMsg += countNum + "该生已新增成功,请输入正确的学生架构才能将该生拉入班级中!"; + ret = false; + countError++;//countError:累计失败次数 + } else if (!getProfessional.equals("") && !getGrade.equals("") && !getClasses.equals("")) { + QueryWrapper queryWrapper1 = new QueryWrapper<>(); + queryWrapper1.eq("organization_name", getProfessional); + queryWrapper1.eq("is_del", DelConstant.NOT_DEL); + queryWrapper1.eq("school_id", schoolId); + queryWrapper1.eq("parent_id", schoolId); + queryWrapper1.eq("level", 1); + Architecture professional = architectureMapper.selectOne(queryWrapper1); + + if (professional == null) {//professional 为空表示用户输入的是自定义的一级架构 则新增专业 + Architecture addProfessional = new Architecture(); + addProfessional.setSchoolId(schoolId); + addProfessional.setParentId(schoolId); + addProfessional.setOrganizationName(getProfessional); + addProfessional.setLevel(1); + Integer addProfessionalRet = architectureMapper.insert(addProfessional); + if (addProfessionalRet > 0) {//执行新增专业成功后 + // 执行新增年级 + Architecture addGrade = new Architecture(); + addGrade.setSchoolId(schoolId); + addGrade.setParentId(addProfessional.getId()); + addGrade.setLevel(2); + addGrade.setOrganizationName(getGrade); + Integer addGradeRet = architectureMapper.insert(addGrade); + // 执行新增班级操作 + if (addGradeRet > 0) { + + Class addClass = new Class().setArchitectureId(addGrade.getId()).setClassName(getClasses); + Integer addClsssRet = classMapper.insert(addClass); + + classCheck(account, addClass, addClsssRet); + } + } + + } else {//professional 不为空表示一级存在 + //根据专业id查询该专业下的年级 + QueryWrapper queryWrapper2 = new QueryWrapper<>(); + queryWrapper2.eq("is_del", DelConstant.NOT_DEL); + queryWrapper2.eq("school_id", schoolId); + queryWrapper2.eq("parent_id", professional.getId()); + queryWrapper2.eq("level", 2); + queryWrapper2.eq("organization_name", getGrade); + Architecture grade = architectureMapper.selectOne(queryWrapper2); + if (grade == null) {//如果二级为空表示自定义二级架构 则新增年级 + Architecture addGrade = new Architecture(); + addGrade.setSchoolId(schoolId); + addGrade.setParentId(professional.getId()); + addGrade.setLevel(2); + addGrade.setOrganizationName(getGrade); + architectureMapper.insert(addGrade); + //同时新增班级及拉入班级 + Class addClass = new Class(); + addClass.setArchitectureId(addGrade.getId()).setClassName(getClasses); + Integer addClsssRet = classMapper.insert(addClass); + + classCheck(account, addClass, addClsssRet); + + } else {//表示该年级存在 + //根据年级id查询年级下的班级 + QueryWrapper queryWrapper3 = new QueryWrapper<>(); + queryWrapper3.eq("is_del", DelConstant.NOT_DEL); + queryWrapper3.eq("architecture_id", grade.getId()); + queryWrapper3.eq("class_name", getClasses); + Class class1 = classMapper.selectOne(queryWrapper3); + + if (class1 == null) {//classes为空表示自定义三级架构 执行新增操作 + Class addClass = new Class().setArchitectureId(grade.getId()).setClassName(getClasses); + classMapper.insert(addClass); + //新增班级同时拉入班级 + QueryWrapper studentQueryWrapper = new QueryWrapper<>(); + studentQueryWrapper.eq("is_del", DelConstant.NOT_DEL); + studentQueryWrapper.eq("account_id", account.getId()); + Student student = baseMapper.selectOne(studentQueryWrapper); + + //没有存在该班级中 直接拉入该班级 + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + if (student.getClassId().equals("1")) {//表示该生还未加入班级 + updateWrapper.set("class_id", addClass.getId()); + } else { + updateWrapper.set("class_id", student.getClassId() + "," + addClass.getId()); + } + updateWrapper.eq("account_id", account.getId()); + updateWrapper.eq("is_del", 0); + baseMapper.update(new Student(), updateWrapper); + + } else { + QueryWrapper studentQueryWrapper = new QueryWrapper<>(); + studentQueryWrapper.eq("is_del", DelConstant.NOT_DEL); + studentQueryWrapper.eq("account_id", account.getId()); + Student student = baseMapper.selectOne(studentQueryWrapper); + + //没有存在该班级中 直接拉入该班级 + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + if (student.getClassId().equals("1")) {//表示该生还未加入班级 + updateWrapper.set("class_id", class1.getId()); + } else { + updateWrapper.set("class_id", student.getClassId() + "," + class1.getId()); + } + updateWrapper.eq("account_id", account.getId()); + updateWrapper.eq("is_del", 0); + baseMapper.update(new Student(), updateWrapper); + } + } + + } + } + + } + } + + countSuccess++; //统计累计成功次数 + vo1.setPhone(getPhone); + vo1.setEmail(getEmail); + vo1.setFailureMsg(errMsg); + countNum = 0; + failVo1.add(vo1); + + } + String exportCode = ""; + + // 有导入失败的数据,才会存入redis + if (countError > 0) { + //生成token + exportCode = "FAILURE_IMPORT" + UUID.randomUUID().toString().replace("-", ""); + ValueOperations ops = stringRedisTemplate.opsForValue(); + + List collect = failVo1.stream().filter(importStudentFailureVo -> { + return !importStudentFailureVo.getFailureMsg().equals(""); + }).collect(Collectors.toList()); + + String failureVOJson = JSON.toJSONString(collect); + ops.set(exportCode, failureVOJson, 30 * 60, TimeUnit.SECONDS); + } + map.put("exportCode", exportCode);//返回导出code + //map.put("successNum", countSuccess + "");//本次新增成功数量 + map.put("failureNum", countError + "");//本次新增失败数量 + return map; + } catch (RuntimeException e) { + System.err.println(e.getMessage()); + throw new RuntimeException(); + } + + } + + private void classCheck(UserAccount account, Class addClass, Integer addClsssRet) { + if (addClsssRet > 0) { + QueryWrapper studentQueryWrapper = new QueryWrapper<>(); + studentQueryWrapper.eq("is_del", DelConstant.NOT_DEL); + studentQueryWrapper.eq("account_id", account.getId()); + //此处判断是否存在别的班级中 + Student student = baseMapper.selectOne(studentQueryWrapper); + + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + if (student.getClassId().equals("1")) { //没有存在该班级中 直接拉入该班级 + updateWrapper.set("class_id", addClass.getId()); + } else { + updateWrapper.set("class_id", student.getClassId() + "," + addClass.getId());//该生存在于别的班级中 所以拼接 + } + updateWrapper.eq("account_id", account.getId()); + updateWrapper.eq("is_del", 0); + baseMapper.update(new Student(), updateWrapper); + + } + } + + /** + * @Description : 校验邮箱 + * @Param email + * @Author Rong---2021/10/18 + */ + public static boolean isValidEmail(String email) { + if ((email != null) && (!email.isEmpty())) { + return Pattern.matches("^(\\w+([-.][A-Za-z0-9]+)*){3,18}@\\w+([-.][A-Za-z0-9]+)*\\.\\w+([-.][A-Za-z0-9]+)*$", email); + } + return false; + } + + /** + * @Description : 校验手机号 + * @Param checkType 校验类型:0校验手机号码,1校验座机号码,2两者都校验满足其一就可 + * @Param phoneNum + * @Author Rong---2021/10/18 + */ + public static boolean validPhoneNum(String checkType, String phoneNum) { + boolean flag = false; + Pattern p1 = null; + Pattern p2 = null; + Matcher m = null; + String regex = "^((13[0-9])|(14(0|[5-7]|9))|(15([0-3]|[5-9]))|(16(2|[5-7]))|(17[0-8])|(18[0-9])|(19([0-3]|[5-9])))\\d{8}$"; +// p1 = Pattern.compile("^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(17[0-9]{1}))+\\d{8})?$"); + p1 = Pattern.compile(regex, Pattern.CASE_INSENSITIVE); + p2 = Pattern.compile("^(0[0-9]{2,3}\\-)?([1-9][0-9]{6,7})$"); + if ("0".equals(checkType)) { + System.out.println(phoneNum.length()); + if (phoneNum.length() != 11) { + return false; + } else { + m = p1.matcher(phoneNum); + flag = m.matches(); + } + } else if ("1".equals(checkType)) { + if (phoneNum.length() < 11 || phoneNum.length() >= 16) { + return false; + } else { + m = p2.matcher(phoneNum); + flag = m.matches(); + } + } else if ("2".equals(checkType)) { + if (!((phoneNum.length() == 11 && p1.matcher(phoneNum).matches()) || (phoneNum.length() < 16 && p2.matcher(phoneNum).matches()))) { + return false; + } else { + flag = true; + } + } + return flag; + } + + public static void main(String[] args) { + boolean b = validPhoneNum("0", "19905350999"); + System.out.println(b); + } + + @Override + public void exportFailureRecord(HttpServletResponse response, String token) throws Exception { + if (org.apache.commons.lang3.StringUtils.isEmpty(token)) { + return; + } + ValueOperations ops = stringRedisTemplate.opsForValue(); + //获取数据 + String record = ops.get(token); + if (org.apache.commons.lang3.StringUtils.isEmpty(record)) { + return; + } + List parse = JSON.parseObject(record, new TypeReference>() { + }); + + parse.sort(Comparator.comparing(ImportStudentFailureVo::getIndex)); + + /*ClassPathResource classPathResource = new ClassPathResource("excel-template/学生导入失败数据导出模板.xlsx"); + InputStream inputStream = classPathResource.getInputStream(); +*/ + //3、通过工具类下载文件 + /*new ExcelExportUtil(ImportStudentFailureVo.class, Constant.ROW_INDEX, Constant.STYLE_INDEX). + export(response, inputStream, parse, "学生导入失败数据表.xlsx"); + + if (inputStream != null) { + inputStream.close(); + }*/ + // 告诉浏览器用什么软件可以打开此文件 + response.setHeader("content-Type", "application/vnd.ms-excel"); + // 下载文件的默认名称 + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("学生导入失败数据表", "UTF-8") + ".xls"); + //编码 + response.setCharacterEncoding("UTF-8"); + Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), ImportStudentFailureVo.class, parse); + ExportParams exportParams = new ExportParams(null, "delivery", ExcelType.XSSF); + exportParams.setStyle(ExcelStyleUtil.class); + workbook.write(response.getOutputStream()); + } + + @Override + public List organizationalStudentList(OrganizationStudentReq req) { + return studentMapper.organizationalStudentList(req); + } + + @Override + public Integer organizationalStudentListNum(OrganizationStudentReq req) { + return studentMapper.organizationalStudentListNum(req); + } + + @Override + public Integer updateAccountEnable(Integer id, Integer isEnable) { + return studentMapper.updateAccountEnable(id, isEnable); + } + + @Override + public Integer getUserId(Integer accountId) { + return baseMapper.getUserId(accountId); + } + + @Override + public Integer countClassSizes(Integer schoolId, Integer classId) { + return baseMapper.countClassSizes(schoolId, classId); + } + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/SysJobLogServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/SysJobLogServiceImpl.java new file mode 100644 index 0000000..22c93a8 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/SysJobLogServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.occupationlab.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.occupationlab.entity.SysJobLog; +import com.huoran.occupationlab.mapper.SysJobLogMapper; +import com.huoran.occupationlab.service.SysJobLogService; +import org.springframework.stereotype.Service; + +/** + * 定时任务 服务类 + * + * @author cheney + * @version V1.0 + * @date 2022年7月28日 + */ +@Service("sysJobLogService") +public class SysJobLogServiceImpl extends ServiceImpl implements SysJobLogService { + + +} \ No newline at end of file diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/SysJobServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/SysJobServiceImpl.java new file mode 100644 index 0000000..c089e52 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/SysJobServiceImpl.java @@ -0,0 +1,117 @@ +//package com.huoran.occupationlab.service.impl; +// +//import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +//import com.huoran.common.exception.BusinessException; +//import com.huoran.occupationlab.entity.SysJob; +//import com.huoran.occupationlab.job.utils.ScheduleUtils; +//import com.huoran.occupationlab.mapper.SysJobMapper; +//import com.huoran.occupationlab.service.SysJobService; +//import com.huoran.occupationlab.utils.job.Constant; +//import org.quartz.CronTrigger; +//import org.quartz.Scheduler; +//import org.springframework.stereotype.Service; +//import org.springframework.transaction.annotation.Transactional; +// +//import javax.annotation.PostConstruct; +//import javax.annotation.Resource; +//import java.util.List; +// +///** +// * 定时任务 服务类 +// * +// * @author cheney +// * @version V1.0 +// * @date 2022年7月28日 +// */ +// +//@Service("sysJobService") +//public class SysJobServiceImpl extends ServiceImpl implements SysJobService { +// @Resource +// private Scheduler scheduler; +// @Resource +// private SysJobMapper sysJobMapper; +// +// /** +// * 项目启动时,初始化定时器 +// */ +// +// @PostConstruct +// public void init() { +// List scheduleJobList = sysJobMapper.selectList(null); +// for (SysJob scheduleJob : scheduleJobList) { +// CronTrigger cronTrigger = ScheduleUtils.getCronTrigger(scheduler, scheduleJob.getId()); +// //如果不存在,则创建 +// if (cronTrigger == null) { +// ScheduleUtils.createScheduleJob(scheduler, scheduleJob); +// } else { +// ScheduleUtils.updateScheduleJob(scheduler, scheduleJob); +// } +// } +// } +// +// @Override +// public void saveJob(SysJob sysJob) { +// sysJob.setStatus(Constant.SCHEDULER_STATUS_NORMAL); +// this.save(sysJob); +// +// ScheduleUtils.createScheduleJob(scheduler, sysJob); +// } +// +// @Override +// public void updateJobById(SysJob sysJob) { +// SysJob sysJobEntity = this.getById(sysJob.getId()); +// if (sysJobEntity == null) { +// throw new BusinessException("获取定时任务异常"); +// } +// sysJob.setStatus(sysJobEntity.getStatus()); +// ScheduleUtils.updateScheduleJob(scheduler, sysJob); +// +// this.updateById(sysJob); +// } +// +// @Override +// public void delete(List ids) { +// for (Integer jobId : ids) { +// ScheduleUtils.deleteScheduleJob(scheduler, jobId); +// } +// sysJobMapper.deleteBatchIds(ids); +// } +// +// @Override +// @Transactional(rollbackFor = Exception.class) +// public void run(List ids) { +// for (Integer jobId : ids) { +// ScheduleUtils.run(scheduler, this.getById(jobId)); +// } +// } +// +// @Override +// @Transactional(rollbackFor = Exception.class) +// public void pause(List ids) { +// for (Integer jobId : ids) { +// ScheduleUtils.pauseJob(scheduler, jobId); +// } +// +// updateBatch(ids, Constant.SCHEDULER_STATUS_PAUSE); +// } +// +// @Override +// @Transactional(rollbackFor = Exception.class) +// public void resume(List ids) { +// for (Integer jobId : ids) { +// ScheduleUtils.resumeJob(scheduler, jobId); +// } +// +// updateBatch(ids, Constant.SCHEDULER_STATUS_NORMAL); +// } +// +// @Override +// public void updateBatch(List ids, int status) { +// ids.parallelStream().forEach(id -> { +// SysJob sysJobEntity = new SysJob(); +// sysJobEntity.setId(id); +// sysJobEntity.setStatus(status); +// baseMapper.updateById(sysJobEntity); +// }); +// } +//} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/SystemLogoServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/SystemLogoServiceImpl.java new file mode 100644 index 0000000..b7df518 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/SystemLogoServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.occupationlab.service.impl; + +import com.huoran.occupationlab.entity.SystemLogo; +import com.huoran.occupationlab.mapper.SystemLogoMapper; +import com.huoran.occupationlab.service.SystemLogoService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 职站教师端-系统logo设置 服务实现类 + *

+ * + * @author lr + * @since 2021-10-18 + */ +@Service +public class SystemLogoServiceImpl extends ServiceImpl implements SystemLogoService { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/TheoreticalCourseChapterServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/TheoreticalCourseChapterServiceImpl.java new file mode 100644 index 0000000..4c981ca --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/TheoreticalCourseChapterServiceImpl.java @@ -0,0 +1,165 @@ +package com.huoran.occupationlab.service.impl; + +import com.aliyuncs.exceptions.ClientException; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.common.utils.AliyunOssUtil; +import com.huoran.common.utils.VideoUtil; +import com.huoran.occupationlab.entity.TheoreticalCourseChapter; +import com.huoran.occupationlab.entity.TheoreticalCourseSubsection; +import com.huoran.occupationlab.entity.vo.ReorderVO; +import com.huoran.occupationlab.entity.vo.TheoreticalChapterVO; +import com.huoran.occupationlab.entity.vo.TheoreticalSubsectionVO; +import com.huoran.occupationlab.mapper.TheoreticalCourseChapterMapper; +import com.huoran.occupationlab.mapper.TheoreticalCourseSubsectionMapper; +import com.huoran.occupationlab.service.TheoreticalCourseChapterService; +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.util.ArrayList; +import java.util.List; + +/** + *

+ * 理论课程章节表 服务实现类 + *

+ * + * @author lr + * @since 2022-09-22 + */ +@Service +public class TheoreticalCourseChapterServiceImpl extends ServiceImpl implements TheoreticalCourseChapterService { + + @Autowired + private TheoreticalCourseSubsectionMapper theoreticalCourseSubsectionMapper; + + @Override + public List getChapterTree(String courseId) { + // 根据课程ID查询所有章节 + QueryWrapper chapterWrapper = new QueryWrapper<>(); + chapterWrapper.eq("course_id", courseId); + //降序查询 + chapterWrapper.orderByAsc("sort"); + List chapters = baseMapper.selectList(chapterWrapper); + + // 根据课程ID查询所有小节 + QueryWrapper subsectionWrapper = new QueryWrapper<>(); + subsectionWrapper.eq("course_id", courseId); + //降序查询 + subsectionWrapper.orderByAsc("sort"); + List subsections = theoreticalCourseSubsectionMapper.selectList(subsectionWrapper); + + List chapterVOList = new ArrayList<>(); + // 遍历封装 + for (TheoreticalCourseChapter c : chapters) { + TheoreticalChapterVO chapterVO = new TheoreticalChapterVO(); + //属性复制 + BeanUtils.copyProperties(c, chapterVO); + chapterVOList.add(chapterVO); + + List subsectionVOList = new ArrayList<>(); + for (TheoreticalCourseSubsection s : subsections) { + //判断小节是否属于某一章节 + if (c.getId().equals(s.getChapterId())) { + TheoreticalSubsectionVO subsectionVO = new TheoreticalSubsectionVO(); + BeanUtils.copyProperties(s, subsectionVO); + subsectionVOList.add(subsectionVO); + } + } + //设置小节 + chapterVO.setSubsectionList(subsectionVOList); + } + return chapterVOList; + } + + @Override + public boolean updateSort(ReorderVO reorderVO) { + List chapterVOList = reorderVO.getChapterVOList(); + if (chapterVOList != null && chapterVOList.size() != 0) { + chapterVOList.forEach(chapterVO -> { + TheoreticalCourseChapter courseChapter = new TheoreticalCourseChapter(); + courseChapter.setId(chapterVO.getId()); + courseChapter.setSort(chapterVO.getSort()); + baseMapper.updateById(courseChapter); + List subsectionList = chapterVO.getSubsectionList(); + if (subsectionList != null && subsectionList.size() != 0) { + subsectionList.forEach(subsectionVO -> { + TheoreticalCourseSubsection courseSubsection = new TheoreticalCourseSubsection(); + courseSubsection.setId(subsectionVO.getId()); + courseSubsection.setSort(subsectionVO.getSort()); + theoreticalCourseSubsectionMapper.updateById(courseSubsection); + }); + } + }); + return true; + } + return false; + } + + @Override + public boolean repeat(TheoreticalCourseChapter theoreticalCourseChapter) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("course_id", theoreticalCourseChapter.getCourseId()); + wrapper.eq("name", theoreticalCourseChapter.getName()); + Integer count = baseMapper.selectCount(wrapper); + return count > 0; + } + + @Override + public boolean saveChapter(TheoreticalCourseChapter theoreticalCourseChapter) { + //查询课程章节的总数 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("course_id", theoreticalCourseChapter.getCourseId()); + int count = baseMapper.selectCount(wrapper); + if (count == 0) { + theoreticalCourseChapter.setSort(1); + } else { + //查询课程章节最大排序数 + count = baseMapper.selectMaxSort(); + theoreticalCourseChapter.setSort(count + 1); + } + int insert = baseMapper.insert(theoreticalCourseChapter); + return insert > 0; + } + + /** + * 删除章节,删除小节及资源 + * + * @param chapterId 章节id + */ + @Override + @Transactional + public boolean removeChapter(Integer chapterId) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("chapter_id", chapterId); + List courseSubsections = theoreticalCourseSubsectionMapper.selectList(wrapper); + + if (courseSubsections != null && courseSubsections.size() != 0) { + //循环删除小节 + courseSubsections.forEach(subsection -> { + //删除资源 + boolean isVideo = VideoUtil.isVideo(subsection.getFileType()); + if (isVideo) { + try { + AliyunOssUtil.removeVideo(subsection.getFileId()); + } catch (ClientException e) { + e.printStackTrace(); + } + } else { + List keys = new ArrayList<>(); + keys.add(subsection.getFileName()); + try { + AliyunOssUtil.removeMoreVideo(keys); + } catch (ClientException e) { + e.printStackTrace(); + } + } + theoreticalCourseSubsectionMapper.deleteById(subsection.getId()); + }); + } + int count = baseMapper.deleteById(chapterId); + return count > 0; + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/TheoreticalCourseClassificationServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/TheoreticalCourseClassificationServiceImpl.java new file mode 100644 index 0000000..98decb6 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/TheoreticalCourseClassificationServiceImpl.java @@ -0,0 +1,67 @@ +package com.huoran.occupationlab.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.huoran.common.constant.PlatformConstant; +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.TheoreticalCourseClassification; +import com.huoran.occupationlab.entity.req.ClassificationPageReq; +import com.huoran.occupationlab.mapper.TheoreticalCourseClassificationMapper; +import com.huoran.occupationlab.service.TheoreticalCourseClassificationService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 理论课程分类信息 服务实现类 + *

+ * + * @author lr + * @since 2022-09-14 + */ +@Service +public class TheoreticalCourseClassificationServiceImpl extends ServiceImpl implements TheoreticalCourseClassificationService { + + @Override + public R checkRepeat(TheoreticalCourseClassification classification) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("classification_name", classification.getClassificationName()); + queryWrapper.eq("platform_source", classification.getPlatformSource()); + if (classification.getSchoolId() != null) { + queryWrapper.eq("school_id", classification.getSchoolId()); + } + + //id不得空表示编辑校验 + if (classification.getId() != null) { + queryWrapper.last(" and id != " + classification.getId()); + } + + TheoreticalCourseClassification courseClassification = baseMapper.selectOne(queryWrapper); + if (courseClassification != null) { + return R.error("当前分类已存在!"); + } + return R.ok(); + } + + @Override + public R pagingQuery(ClassificationPageReq pageReq) { + + IPage page = new Page(pageReq.getPageNum(), pageReq.getPageSize()); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("platform_source", pageReq.getPlatformSource()); + + if (pageReq.getSchoolId() != null) { + queryWrapper.eq("school_id", pageReq.getSchoolId()); + } + IPage iPage = baseMapper.selectPage(page, queryWrapper); + return R.ok().put("page", iPage); + } + + @Override + public R queryAllCategoriesOfSchools() { + return R.ok().put("data",baseMapper.queryAllCategoriesOfSchools()); + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/TheoreticalCourseCollectServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/TheoreticalCourseCollectServiceImpl.java new file mode 100644 index 0000000..b16f382 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/TheoreticalCourseCollectServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.occupationlab.service.impl; + +import com.huoran.occupationlab.entity.TheoreticalCourseCollect; +import com.huoran.occupationlab.mapper.TheoreticalCourseCollectMapper; +import com.huoran.occupationlab.service.TheoreticalCourseCollectService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 理论课程收藏表 服务实现类 + *

+ * + * @author lr + * @since 2023-04-18 + */ +@Service +public class TheoreticalCourseCollectServiceImpl extends ServiceImpl implements TheoreticalCourseCollectService { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/TheoreticalCourseConfigureServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/TheoreticalCourseConfigureServiceImpl.java new file mode 100644 index 0000000..7c60695 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/TheoreticalCourseConfigureServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.occupationlab.service.impl; + +import com.huoran.occupationlab.entity.TheoreticalCourseConfigure; +import com.huoran.occupationlab.mapper.TheoreticalCourseConfigureMapper; +import com.huoran.occupationlab.service.TheoreticalCourseConfigureService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 理论课程与理论课程分类配置表 服务实现类 + *

+ * + * @author lr + * @since 2022-09-14 + */ +@Service +public class TheoreticalCourseConfigureServiceImpl extends ServiceImpl implements TheoreticalCourseConfigureService { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/TheoreticalCourseRangeServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/TheoreticalCourseRangeServiceImpl.java new file mode 100644 index 0000000..e74c26d --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/TheoreticalCourseRangeServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.occupationlab.service.impl; + +import com.huoran.occupationlab.entity.TheoreticalCourseRange; +import com.huoran.occupationlab.mapper.TheoreticalCourseRangeMapper; +import com.huoran.occupationlab.service.TheoreticalCourseRangeService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 理论课程指定范围选择 服务实现类 + *

+ * + * @author lr + * @since 2022-09-19 + */ +@Service +public class TheoreticalCourseRangeServiceImpl extends ServiceImpl implements TheoreticalCourseRangeService { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/TheoreticalCourseServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/TheoreticalCourseServiceImpl.java new file mode 100644 index 0000000..4b52137 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/TheoreticalCourseServiceImpl.java @@ -0,0 +1,322 @@ +package com.huoran.occupationlab.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.huoran.api.UserClient; +import com.huoran.common.constant.ClassificationOfTheoreticalCoursesConstant; +import com.huoran.common.constant.PlatformConstant; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.occupationlab.entity.TheoreticalCourse; +import com.huoran.occupationlab.entity.TheoreticalCourseCollect; +import com.huoran.occupationlab.entity.TheoreticalCourseConfigure; +import com.huoran.occupationlab.entity.TheoreticalCourseRange; +import com.huoran.occupationlab.entity.req.AddTheoreticalCourseReq; +import com.huoran.occupationlab.entity.req.PageStudentTheoreticalCourseReq; +import com.huoran.occupationlab.entity.req.PageTheoreticalCourseReq; +import com.huoran.occupationlab.entity.resp.PageTheoreticalCourseByNakadaiResp; +import com.huoran.occupationlab.entity.resp.TheoreticalCourseDetailResp; +import com.huoran.occupationlab.entity.resp.TheoreticalCoursetRangeResp; +import com.huoran.occupationlab.mapper.TheoreticalCourseCollectMapper; +import com.huoran.occupationlab.mapper.TheoreticalCourseConfigureMapper; +import com.huoran.occupationlab.mapper.TheoreticalCourseMapper; +import com.huoran.occupationlab.mapper.TheoreticalCourseRangeMapper; +import com.huoran.occupationlab.service.TheoreticalCourseService; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; +import java.util.stream.Collectors; + +/** + *

+ * 理论课程基本信息 服务实现类 + *

+ * + * @author lr + * @since 2022-09-14 + */ +@Service +public class TheoreticalCourseServiceImpl extends ServiceImpl implements TheoreticalCourseService { + + @Autowired + private UserClient userClient; + + @Autowired + private TheoreticalCourseConfigureMapper configureMapper; + + @Autowired + private TheoreticalCourseRangeMapper courseRangeMapper; + + @Autowired + private TheoreticalCourseCollectMapper collectMapper; + + @Override + public R addTheoryCourses(AddTheoreticalCourseReq req, HttpServletRequest request) { + TheoreticalCourse theoreticalCourse = new TheoreticalCourse(); + String accountId = TokenUtils.getIdByJwtToken(request); + theoreticalCourse.setFounderId(Integer.valueOf(accountId)); + theoreticalCourse.setSchoolId(0); + //判断平台来源为职站时候才赋值学校id + if (req.getPlatformSource() == PlatformConstant.POST_STATION) { + theoreticalCourse.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); + } + BeanUtils.copyProperties(req, theoreticalCourse); + Integer addCoursesInfo = baseMapper.insert(theoreticalCourse); + + if (addCoursesInfo > 0) { + //新增课程基本信息后新增课程分类配置信息 + if (req.getSchoolClassificationsIds().size() > 0) { + for (Integer schoolClassificationsIds : req.getSchoolClassificationsIds()) { + TheoreticalCourseConfigure configure1 = new TheoreticalCourseConfigure(); + configure1.setCourseId(theoreticalCourse.getId()); + configure1.setClassificationId(schoolClassificationsIds); + configure1.setClassificationType(ClassificationOfTheoreticalCoursesConstant.SCHOOL_CLASSIFICATION); + configureMapper.insert(configure1); + } + } + + //学校课程分类 + if (req.getPlatformClassificationIds().size() > 0) { + for (Integer platformClassificationIds : req.getPlatformClassificationIds()) { + TheoreticalCourseConfigure configure2 = new TheoreticalCourseConfigure(); + configure2.setCourseId(theoreticalCourse.getId()); + configure2.setClassificationId(platformClassificationIds); + configure2.setClassificationId(platformClassificationIds); + configure2.setClassificationType(ClassificationOfTheoreticalCoursesConstant.NAKADAI_CLASSIFICATION); + configureMapper.insert(configure2); + } + } + + //判断学校指定范围 + if (req.getVisibleRange() == 2) { + if (req.getCourseRangeList().size() > 0) { + for (TheoreticalCourseRange range : req.getCourseRangeList()) { + range.setCourseId(theoreticalCourse.getId()); + courseRangeMapper.insert(range);//新增记录至指定范围配置表 + } + } + } + + } + + + return R.ok().put("courseId", theoreticalCourse.getId()); + } + + @Override + public R pageConditionalQueryCourse(PageTheoreticalCourseReq pageReq) { + if (pageReq.getPlatformSource() != PlatformConstant.POST_STATION) { + pageReq.setSchoolId(null); + } + Page page = new Page(pageReq.getPageNum(), pageReq.getPageSize()); + IPage pageList = baseMapper.pageConditionalQueryCourseByNakadai(page, pageReq); + return R.ok().put("page", pageList); + } + + /** + * 编辑理论课程 + * + * @param req + * @param request + * @return + */ + @Override + public R modifyTheoryCourses(AddTheoreticalCourseReq req, HttpServletRequest request) { + + + TheoreticalCourse courseInfo = baseMapper.selectById(req.getCourseId()); + + //查询课程指定范围配置表是否有该课程信息 + List courseRangeList = courseRangeMapper.getCourseRangeByCourseId(req.getCourseId()); + List idList = courseRangeList.stream().map(TheoreticalCourseRange::getId).collect(Collectors.toList()); + //中 台 权 限 :能选择发布全平台、指定院校 + //职站教师端权限:能选择发布全平台、本校 + if (req.getVisibleRange() != null) { + switch (req.getPlatformSource()) {//平台来源(0中台,1职站) + case 0: + //理论课程范围:(1:全平台 2.指定区域、院校) + if (req.getVisibleRange() == ClassificationOfTheoreticalCoursesConstant.ALL_PLATFORMS) {//全平台 + + if (courseRangeList.size() > 0) { + //删除原有指定范围配置表中的信息 + courseRangeMapper.deleteBatchIds(idList); + } + + } else if (req.getVisibleRange() == ClassificationOfTheoreticalCoursesConstant.SPECIFIED_RANGE) {//指定区域、院校 + //增加指定范围配置表的信息 + if (req.getCourseRangeList().size() > 0) { + for (TheoreticalCourseRange addCourseRange : req.getCourseRangeList()) { + addCourseRange.setCourseId(req.getCourseId()); + courseRangeMapper.insert(addCourseRange); + } + + } + } + break; + } + } + + BeanUtils.copyProperties(req, courseInfo); + courseInfo.setId(req.getCourseId()); + String accountId = TokenUtils.getIdByJwtToken(request); + courseInfo.setFounderId(Integer.valueOf(accountId)); + //判断平台来源为职站时候才赋值学校id + if (req.getPlatformSource() == PlatformConstant.POST_STATION) { + courseInfo.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); + } + + Integer addCoursesInfo = baseMapper.updateById(courseInfo); + + + //处理课程分类、平台课程分类 + if (req.getPlatformClassificationIds() != null) { + if (req.getPlatformClassificationIds().size() > 0) { + //删除当前课程分类配置表 分类类型为平台的 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("course_id", courseInfo.getId()); + queryWrapper.eq("classification_type", 0).select("config_id"); + //List list1 = configureMapper.selectList(queryWrapper); + configureMapper.delete(queryWrapper); + for (Integer platformClassificationIds : req.getPlatformClassificationIds()) { + TheoreticalCourseConfigure addPlatformClassification = new TheoreticalCourseConfigure(); + addPlatformClassification.setClassificationType(0); + addPlatformClassification.setCourseId(courseInfo.getId()); + addPlatformClassification.setClassificationId(platformClassificationIds); + configureMapper.insert(addPlatformClassification); + } + } + } + + if (req.getSchoolClassificationsIds() != null) { + if (req.getSchoolClassificationsIds().size() > 0) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("course_id", courseInfo.getId()); + //删除当前课程分类配置表 分类类型为学校的 + queryWrapper.eq("classification_type", 1).select("config_id"); + //List list2 = configureMapper.selectList(queryWrapper); + configureMapper.delete(queryWrapper); + + for (Integer schoolClassificationsId : req.getSchoolClassificationsIds()) { + TheoreticalCourseConfigure addSchoolClassifications = new TheoreticalCourseConfigure(); + addSchoolClassifications.setClassificationType(1); + addSchoolClassifications.setCourseId(courseInfo.getId()); + addSchoolClassifications.setClassificationId(schoolClassificationsId); + configureMapper.insert(addSchoolClassifications); + } + + } + } + + + return addCoursesInfo > 0 ? R.ok() : R.error(); + } + + @Override + public R theoryCoursesDetail(Integer id) { + TheoreticalCourseDetailResp detailResp = baseMapper.theoryCoursesDetail(id); + + //判断当前课程可见范围为指定范围查询范围配置表 + /* if (detailResp.getVisibleRange() == ClassificationOfTheoreticalCoursesConstant.SPECIFIED_RANGE) { + + }*/ + //查询指定院校信息 + List rangeRespList = courseRangeMapper.getRangeByCourseId(id); + if (rangeRespList.size() > 0) { + detailResp.setCourseRangeList(rangeRespList); + } + + + //查询课程分类信息 分类类型(0:中台分类 1:学校分类) + + List platformClassification = configureMapper.getConfigInfoByCourseId(id, 0); + if (platformClassification.size() > 0) { + detailResp.setPlatformClassificationList(platformClassification); + } + + List schoolClassification = configureMapper.getConfigInfoByCourseId(id, 1); + if (schoolClassification.size() > 0) { + detailResp.setSchoolClassificationsList(schoolClassification); + } + + + return R.ok().put("data", detailResp); + } + + @Override + public R pageConditionalQueryCourseByStudent(PageStudentTheoreticalCourseReq pageReq) { + Page page = new Page(pageReq.getPageNum(), pageReq.getPageSize()); + IPage pageList = null; + //来源(0.共享课堂 1.本校课程 2.收藏的课程) + switch (pageReq.getCourseSource()) { + case 0: + pageList = baseMapper.pageConditionalQueryCourseByStudent(page, pageReq); + break; + case 1: + pageList = baseMapper.theoreticalCoursesOfTheSchool(page, pageReq); + break; + case 2: + pageList = baseMapper.theCurrentUserFavoriteCourse(page, pageReq); + break; + } + + + for (PageTheoreticalCourseByNakadaiResp resp : pageList.getRecords()) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("account_id", pageReq.getAccountId()); + queryWrapper.eq("course_id", resp.getId()); + TheoreticalCourseCollect courseCollect = collectMapper.selectOne(queryWrapper); + + //是否收藏:(state = 1收藏,0取消收藏) + if (courseCollect != null) { + //收藏过 + resp.setCollectionStatus(1); + } else { + resp.setCollectionStatus(0); + } + } + return R.ok().put("page", pageList); + } + + @Override + public R studentLoginPreCourse(PageTheoreticalCourseReq pageReq) { + Page page = new Page(pageReq.getPageNum(), pageReq.getPageSize()); + IPage pageList = baseMapper.studentLoginPreCourse(page, pageReq); + + //浏览量作假数据处理:低于50以下的全部给予随机数 500-1000区间 + for (PageTheoreticalCourseByNakadaiResp object : pageList.getRecords()) { + if (object.getPageviews() <= 50) { + int r = (int) (500 + Math.random() * (1000 - 500 + 1)); + object.setPageviews(r); + } + } + + return R.ok().put("page", pageList); + } + + + @Override + public R checkRepeat(TheoreticalCourse theoreticalCourse) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("course_name", theoreticalCourse.getCourseName()); + queryWrapper.eq("platform_source", theoreticalCourse.getPlatformSource()); + if (theoreticalCourse.getSchoolId() != null) { + queryWrapper.eq("school_id", theoreticalCourse.getSchoolId()); + } + + //id不得空表示编辑校验 + if (theoreticalCourse.getId() != null) { + queryWrapper.last(" and id != " + theoreticalCourse.getId()); + } + + TheoreticalCourse course = baseMapper.selectOne(queryWrapper); + if (course != null) { + return R.error("当前课程名已存在!"); + } + return R.ok(); + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/TheoreticalCourseSubsectionServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/TheoreticalCourseSubsectionServiceImpl.java new file mode 100644 index 0000000..8c7ddff --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/TheoreticalCourseSubsectionServiceImpl.java @@ -0,0 +1,81 @@ +package com.huoran.occupationlab.service.impl; + +import com.aliyuncs.exceptions.ClientException; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.common.utils.AliyunOssUtil; +import com.huoran.common.utils.VideoUtil; +import com.huoran.occupationlab.entity.TheoreticalCourseSubsection; +import com.huoran.occupationlab.mapper.TheoreticalCourseSubsectionMapper; +import com.huoran.occupationlab.service.TheoreticalCourseSubsectionService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.List; + +/** + *

+ * 课程小节 服务实现类 + *

+ * + * @author lr + * @since 2022-09-22 + */ +@Service +public class TheoreticalCourseSubsectionServiceImpl extends ServiceImpl implements TheoreticalCourseSubsectionService { + + @Override + public boolean repeat(TheoreticalCourseSubsection theoreticalCourseSubsection) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("chapter_id", theoreticalCourseSubsection.getChapterId()); + wrapper.eq("course_id", theoreticalCourseSubsection.getCourseId()); + wrapper.eq("name", theoreticalCourseSubsection.getName()); + Integer count = baseMapper.selectCount(wrapper); + return count > 0; + } + + @Override + public boolean saveSubsection(TheoreticalCourseSubsection theoreticalCourseSubsection) { + //查询章节小节的总数 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("chapter_id", theoreticalCourseSubsection.getChapterId()); + int count = baseMapper.selectCount(wrapper); + if (count == 0) { + theoreticalCourseSubsection.setSort(1); + } else { + //查询章节小节最大排序数 + count = baseMapper.selectMaxSort(); + theoreticalCourseSubsection.setSort(count + 1); + } + int insert = baseMapper.insert(theoreticalCourseSubsection); + return insert > 0; + } + + /** + * 删除小节及资源 + * + * @param subsectionId 小节id + */ + @Transactional + @Override + public boolean removeSubsection(Integer subsectionId) throws ClientException { + TheoreticalCourseSubsection theoreticalCourseSubsection = baseMapper.selectById(subsectionId); + String fileType = theoreticalCourseSubsection.getFileType(); + //删除资源 + boolean isVideo = VideoUtil.isVideo(fileType); + if (isVideo) { + if (theoreticalCourseSubsection.getFileId()!=null){ +// AliyunOssUtil.removeVideo(theoreticalCourseSubsection.getFileId()); + System.out.println("无法删除"); + } + } else { + List keys = new ArrayList<>(); + keys.add(theoreticalCourseSubsection.getFileName()); + AliyunOssUtil.deleteFiles(keys); + } + //删除小节 + int count = baseMapper.deleteById(subsectionId); + return count > 0; + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/UserInfoServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/UserInfoServiceImpl.java new file mode 100644 index 0000000..6f661a0 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/UserInfoServiceImpl.java @@ -0,0 +1,39 @@ +package com.huoran.occupationlab.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.occupationlab.entity.HrUserInfo; +import com.huoran.occupationlab.mapper.UserInfoMapper; +import com.huoran.occupationlab.service.UserInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.HashMap; + +/** + *

+ * 用户信息表 服务实现类 + *

+ * + * @author Ning + * @since 2020-10-21 + */ +@Service +public class UserInfoServiceImpl extends ServiceImpl implements UserInfoService { + @Autowired + private UserInfoMapper userInfoMapper; + + @Override + public HrUserInfo getUserInfo(Integer userId) { + return baseMapper.selectById(userId); + } + + public HrUserInfo login(HashMap map) { + return baseMapper.login(map); + } + + @Override + public boolean updateTime(Integer userId) { + int size = baseMapper.updateTime(userId); + return size > 0; + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/UserManagementServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/UserManagementServiceImpl.java new file mode 100644 index 0000000..7b3f99f --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/UserManagementServiceImpl.java @@ -0,0 +1,265 @@ +package com.huoran.occupationlab.service.impl; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.TypeReference; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.common.response.R; +import com.huoran.occupationlab.entity.ClientManagement; +import com.huoran.occupationlab.entity.HrUserInfo; +import com.huoran.occupationlab.entity.UserManagement; +import com.huoran.occupationlab.entity.vo.UserInfo; +import com.huoran.occupationlab.entity.vo.UserManagementImportFailureVo; +import com.huoran.occupationlab.entity.vo.UserVO; +import com.huoran.occupationlab.mapper.UserManagementMapper; +import com.huoran.occupationlab.service.ClientManagementService; +import com.huoran.occupationlab.service.UserInfoService; +import com.huoran.occupationlab.service.UserManagementService; +import com.huoran.occupationlab.utils.ExcelImportHelper; +import com.huoran.occupationlab.utils.poi.CommonCode; +import com.huoran.occupationlab.utils.poi.ExcelExportUtil; +import com.huoran.occupationlab.utils.poi.ExceptionCast; +import org.apache.commons.lang.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.io.ClassPathResource; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.data.redis.core.ValueOperations; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.InputStream; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.concurrent.TimeUnit; + +/** + *

+ * 企业端用户管理 服务实现类 + *

+ * + * @author Ning + * @since 2020-10-27 + */ +@Service +public class UserManagementServiceImpl extends ServiceImpl implements UserManagementService { + + @Autowired + private UserInfoService userInfoService; + @Autowired + private ClientManagementService clientManagementService; + @Autowired + private UserManagementService userManagementService; + @Resource + StringRedisTemplate stringRedisTemplate; + + //查询用户列表 + @Override + public List queryList(HashMap map) { +// Object searchContent = map.get("searchContent"); +// QueryWrapper wrapper = new QueryWrapper<>(); +// if (searchContent!=null){ +// wrapper.like("name",searchContent).or().like("client_name",searchContent).or().like("account",searchContent); +// } + return baseMapper.queryList(map); + } + + //查询用户列表数量 + @Override + public int queryListCount(HashMap map) { + return baseMapper.queryListCount(map); + } + + //添加用户 + @Override + @Transactional + public boolean addUser(UserVO vo) { + UserInfo userInfo = vo.getUserInfo(); + UserManagement userManagement = vo.getUserManagement(); + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式 + userManagement.setLastLoginTime(df.format(new Date())); + if (userInfo != null && userManagement != null) { + userInfo.setPassword("1122aa"); + baseMapper.addUserInfo(userInfo); + Integer userId = userInfo.getUserId(); + userManagement.setUserId(userId); + int size = baseMapper.insert(userManagement); + return size > 0; + } else { + throw new RuntimeException(); + } + } + + //批量删除用户 + @Override + public boolean deleteUser(List userIds) { + int num = userIds.size(); + for (int i = 0; i < num; i++) { + Integer id = userIds.get(i); + Integer userId = baseMapper.selectUserId(id); + int del = baseMapper.deleteUser(userId); + } + int size = baseMapper.deleteBatchIds(userIds); + return size > 0; + } + + //修改用户 + @Override + @Transactional + public boolean updateUser(UserVO vo) { + UserManagement userManagement = vo.getUserManagement(); + //UserInfo userInfo = vo.getUserInfo(); + boolean ret = userManagementService.updateUser(vo); + int size = baseMapper.updateById(userManagement); + if (size > 0) { + return size > 0; + } else { + throw new RuntimeException("数据有误,修改失败!"); + } + } + + @Override + @Transactional + public Map upload(MultipartFile file) throws IOException { + List users = ExcelImportHelper.readUserManagement(file); + List failVo1 = new ArrayList<>(); + // 参数合法性校验,只能上传.xlsx后缀的文件 + if (StringUtils.isBlank(file.getOriginalFilename()) + || !file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")).equals(".xlsx")) { + ExceptionCast.cast(CommonCode.EXCEL_FILE_INVALID); + } + int size = users.size(); + Map map = new HashMap<>(); + Long ii = 1L;//用于记录序列号 + try { + for (int i = 0; i < users.size(); i++) { + UserManagement userManagement = users.get(i); + String name = userManagement.getName(); + String clientName = userManagement.getClientName(); + String account = userManagement.getAccount(); + userManagement = new UserManagement(); + UserInfo userInfo = new UserInfo(); + if (account != null && account != "") { + // R userInfos = userManagementService.getAccount(account); + + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("account", account).eq("isdel", 0); + HrUserInfo userInfos = userInfoService.getOne(wrapper); + + if (userInfos != null) { + UserManagementImportFailureVo vo = new UserManagementImportFailureVo(); + ++ii; + vo.setIndex(ii).setName(name).setClientName(clientName) + .setAccount(account + "(重复的账号!)").setFailureMsg("重复的账号!"); + failVo1.add(vo); + users.remove(i); + i--; + continue; + } else { + userManagement.setAccount(account); + userInfo.setAccount(account); + } + } + if (clientName != null && clientName != "") { + int clientNameSize = clientManagementService.queryClientNameSize(clientName); + if (clientNameSize < 1) { + UserManagementImportFailureVo vo = new UserManagementImportFailureVo(); + ++ii; + vo.setIndex(ii).setName(name).setClientName(clientName + "(客户名称不存在!)") + .setAccount(account).setFailureMsg("客户名称不存在!"); + failVo1.add(vo); + users.remove(i); + i--; + continue; + } else { + userManagement.setClientName(clientName); + } + } + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("client_name", clientName); + ClientManagement clientManagement = clientManagementService.getOne(wrapper); + if (clientManagement != null) { + Integer clientId = clientManagement.getId(); + if (clientId != null) { + userInfo.setClientId(clientId); + userInfo.setClientName(clientName); + userInfo.setUserName(name); + userInfo.setPassword("1122aa"); + userInfo.setRoleId("1"); + userInfo.setIsPort(2); + SimpleDateFormat da = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式 + String date = da.format(new Date());// new Date()为获取当前系统时间,也可使用当前时间戳 + long time = new Date().getTime(); + userInfo.setUniqueIdentificationAccount(time + ""); + userInfo.setCreationTime(date); + boolean user = baseMapper.addUserInfo(userInfo); + Integer userId = userInfo.getUserId(); + if (user) { + userManagement.setName(name); + userManagement.setClientId(clientId); + userManagement.setRoleId(1); + userManagement.setUserId(userId); + boolean userBoolean = userManagementService.save(userManagement); + if (!userBoolean) { + throw new RuntimeException("添加用户失败!"); + } + } else { + throw new RuntimeException("添加用户失败!"); + } + } + } else { + map.put("failura", "没有该客户,添加失败!"); + throw new RuntimeException(); + } + } + } catch (RuntimeException e) { + map.put("failura", "数据有误,添加失败!"); + throw new RuntimeException(e + "数据有误!"); + } + String token = ""; + + // 有导入失败的数据,才会存入redis + if (failVo1.size() > 0) { + //生成token + token = "FAILURE_IMPORT" + UUID.randomUUID().toString().replace("-", ""); + + ValueOperations ops = stringRedisTemplate.opsForValue(); + String failureVOJson = JSON.toJSONString(failVo1); + ops.set(token, failureVOJson, 30 * 60, TimeUnit.SECONDS); + } + map.put("token", token); + map.put("successNum", (size - failVo1.size()) + ""); + map.put("failureNum", failVo1.size() + ""); + return map; + } + + @Override + public void exportFailureRecord(HttpServletResponse response, String token) throws Exception { + if (StringUtils.isEmpty(token)) { + return; + } + ValueOperations ops = stringRedisTemplate.opsForValue(); + //获取数据 + String record = ops.get(token); + if (StringUtils.isEmpty(record)) { + return; + } + List parse = JSON.parseObject(record, new TypeReference>() { + }); + + parse.sort(Comparator.comparing(UserManagementImportFailureVo::getIndex)); + + //2.加载模板流数据 + org.springframework.core.io.Resource resource = new ClassPathResource("excel-template/用户管理导入失败数据导出模板.xlsx"); + InputStream inputStream = resource.getInputStream(); + + //3、通过工具类下载文件 + new ExcelExportUtil(UserManagementImportFailureVo.class, 2, 1). + export(response, inputStream, parse, "用户管理信息导入失败表.xlsx"); + + } +} \ No newline at end of file diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/UserRoleServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/UserRoleServiceImpl.java new file mode 100644 index 0000000..451950c --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/UserRoleServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.occupationlab.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.occupationlab.entity.AclUserRole; +import com.huoran.occupationlab.mapper.UserRoleMapper; +import com.huoran.occupationlab.service.UserRoleService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author testjava + * @since 2020-01-12 + */ +@Service +public class UserRoleServiceImpl extends ServiceImpl implements UserRoleService { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/UserScoreServiceImpl.java b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/UserScoreServiceImpl.java new file mode 100644 index 0000000..7ce7325 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/service/impl/UserScoreServiceImpl.java @@ -0,0 +1,20 @@ +package com.huoran.occupationlab.service.impl; + +import com.huoran.occupationlab.entity.UserScore; +import com.huoran.occupationlab.mapper.UserScoreMapper; +import com.huoran.occupationlab.service.UserScoreService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 用户分数表 服务实现类 + *

+ * + * @author Mr.JK + * @since 2021-09-14 + */ +@Service +public class UserScoreServiceImpl extends ServiceImpl implements UserScoreService { + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/utils/CollectionUtil.java b/occupationlab/src/main/java/com/huoran/occupationlab/utils/CollectionUtil.java new file mode 100644 index 0000000..d252e87 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/utils/CollectionUtil.java @@ -0,0 +1,69 @@ +package com.huoran.occupationlab.utils; + +import java.util.*; + +/** + * @Author chen + * @DATE 2022/4/1 11:36 + * @Version 1.0 + * 该类提供对集合类的高效操作 + */ +public class CollectionUtil { + /** + * 不允许实例化 + */ + private CollectionUtil() { + } + + /** + * 获取两个集合的不同元素 + * @param collmax + * @param collmin + * @return + */ + @SuppressWarnings({ "rawtypes", "unchecked" }) + public static Collection getDifferent(Collection collmax, Collection collmin) + { + //使用LinkedList防止差异过大时,元素拷贝 + Collection csReturn = new LinkedList(); + Collection max = collmax; + Collection min = collmin; + //先比较大小,这样会减少后续map的if判断次数 + if(collmax.size() map = new HashMap(max.size()); + for (Object object : max) { + map.put(object, 1); + } + for (Object object : min) { + if(map.get(object)==null) + { + csReturn.add(object); + }else{ + map.put(object, 2); + } + } + for (Map.Entry entry : map.entrySet()) { + if(entry.getValue()==1) + { + csReturn.add(entry.getKey()); + } + } + return csReturn; + } + /** + * 获取两个集合的不同元素,去除重复 + * @param collMax + * @param collMin + * @return + */ + @SuppressWarnings({ "rawtypes", "unchecked" }) + public static Collection getDifferentNoDuplicate (Collection collMax,Collection collMin) + { + return new HashSet(getDifferent(collMax, collMin)); + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/utils/Constant.java b/occupationlab/src/main/java/com/huoran/occupationlab/utils/Constant.java new file mode 100644 index 0000000..3b7c676 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/utils/Constant.java @@ -0,0 +1,339 @@ +/** + * Copyright (c) 2016-2019 人人开源 All rights reserved. + *

+ * https://www.renren.io + *

+ * 版权所有,侵权必究! + */ + +package com.huoran.occupationlab.utils; + +/** + * 常量 + * + * @author Rong + */ +public class Constant { + + /** + * 测评是否通过 1、通过/0、未通过 + */ + public static final String EVALUATIONN_PASSED = "通过"; + public static final String EVALUATIONN_NOT_PASSED = "未通过"; + + /** + * 及格分数 + */ + public static final int PASSING_SCORE = 60; + + /** + * 当前题目答案是否正确 1、正确/0、错误 + */ + public enum QuestionIsTure { + + TRUE(1, "正确"), + FALSE(0, "错误"); + + private Integer type; + private String desc; + + QuestionIsTure(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 void setDesc(String desc) { + this.desc = desc; + } + } + + /** + * 试题类型 + */ + public enum QuestionType { + /** + * 单选题 + */ + SINGLE_CHOICE("1", "单选题"), + /** + * 多选题 + */ + MULTIPLE_CHOICE("2", "多选题"), + /** + * 判断题 + */ + TRUE_OR_FALSE("3", "判断题"); + + private String type; //类型 + private String desc; //描述 + + QuestionType(String type, String desc) { + this.type = type; + this.desc = desc; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } + + } + + /** + * 项目是否提交1:已提交/0:未提交 + */ + public enum Submit { + + SUBMIT(1, "已提交"), + NOT_SUBMIT(0, "未提交"); + + + private Integer type; + private String desc; + + Submit(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 void setDesc(String desc) { + this.desc = desc; + } + } + + /** + * 是否删除:0使用,1删除,默认0使用 + */ + public enum IsDel { + /** + * 删除 + */ + DEL(1, "已删除"), + /** + * 不删除 + */ + NOT_DEL(0, "不删除"); + + private Integer type; //类型 + private String desc; //描述 + + IsDel(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 void setDesc(String desc) { + this.desc = desc; + } + } + + + /** + * 是否启用 + */ + public enum IsEnable { + /** + * 启用 + */ + ENABLE(1, "启用"), + /** + * 不启用 + */ + NOT_ENABLE(0, "不启用"); + + private Integer type; //类型 + private String desc; //描述 + + IsEnable(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 void setDesc(String desc) { + this.desc = desc; + } + } + + /** + * 评测规则类型 + */ + public enum RulesType { + /** + * 随机 + */ + RANDOM(1, "随机"), + /** + * 自定义 + */ + CUSTOMIZE(0, "自定义"); + + private Integer type; //类型 + private String desc; //描述 + + RulesType(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 void setDesc(String desc) { + this.desc = desc; + } + } + + + /** + * 当前题目状态 1、已作/0、未作 + */ + public enum QuestionStatus { + + MADE(1, "已作"), + NOT_MADE(0, "未作"); + + private Integer type; + private String desc; + + QuestionStatus(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 void setDesc(String desc) { + this.desc = desc; + } + } + + /** + * 试题选项A + */ + public static final String A = "A"; + /** + * 试题选项B + */ + public static final String B = "B"; + /** + * 试题选项C + */ + public static final String C = "C"; + /** + * 试题选项D + */ + public static final String D = "D"; + /** + * 试题选项E + */ + public static final String E = "E"; + /** + * 试题选项F + */ + public static final String F = "F"; + + /** + * 通过excel批量导入试题数据时起始行 + */ + public static final int CELL_INDEX = 0; + /** + * 需要提取的样式所在的行号 + */ + public static final int STYLE_INDEX = 2; + + + /** + * 通过excel批量导入试题数据时起始行(专门用于练习,考核报告的) + */ + public static final int ROW_INDEX_REPORT = 3; + + + /** + * 通过excel批量导入试题数据时起始行 + */ + public static final int ROW_INDEX = 2; + + + /** + * 测评规则表id + */ + public static final int EVALUATION_RULES_ID = 1; +} \ No newline at end of file diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/utils/CronUtils.java b/occupationlab/src/main/java/com/huoran/occupationlab/utils/CronUtils.java new file mode 100644 index 0000000..59d6733 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/utils/CronUtils.java @@ -0,0 +1,31 @@ +package com.huoran.occupationlab.utils; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Objects; + +public class CronUtils { + private static final SimpleDateFormat sdf = new SimpleDateFormat("ss mm HH dd MM ? yyyy"); + + /*** + * 功能描述:日期转换cron表达式 + * @param date + * @return + */ + public static String formatDateByPattern(Date date) { + String formatTimeStr = null; + if (Objects.nonNull(date)) { + formatTimeStr = sdf.format(date); + } + return formatTimeStr; + } + + /*** + * convert Date to cron, eg "0 07 10 15 1 ? 2016" + * @param date : 时间点 + * @return + */ + public static String getCron(Date date) { + return formatDateByPattern(date); + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/utils/DelTagsUtil.java b/occupationlab/src/main/java/com/huoran/occupationlab/utils/DelTagsUtil.java new file mode 100644 index 0000000..b273c33 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/utils/DelTagsUtil.java @@ -0,0 +1,55 @@ +package com.huoran.occupationlab.utils; + +/** + * @描述: + * @作者: Rong + * @日期: 2022/3/24 16:36 + */ +public class DelTagsUtil { + /** + * 去除html代码中含有的标签 + * + * @param htmlStr + * @return + */ + public static String delHtmlTags(String htmlStr) { + //定义script的正则表达式,去除js可以防止注入 + String scriptRegex = "]*?>[\\s\\S]*?<\\/script>"; + //定义style的正则表达式,去除style样式,防止css代码过多时只截取到css样式代码 + String styleRegex = "]*?>[\\s\\S]*?<\\/style>"; + //定义HTML标签的正则表达式,去除标签,只提取文字内容 + String htmlRegex = "<[^>]+>"; + //定义空格,回车,换行符,制表符 + String spaceRegex = "\\s*|\t|\r|\n"; + + // 过滤script标签 + htmlStr = htmlStr.replaceAll(scriptRegex, ""); + // 过滤style标签 + htmlStr = htmlStr.replaceAll(styleRegex, ""); + // 过滤html标签 + htmlStr = htmlStr.replaceAll(htmlRegex, ""); + // 过滤空格等 + htmlStr = htmlStr.replaceAll(spaceRegex, ""); + return htmlStr.trim(); // 返回文本字符串 + } + + /** + * 获取HTML代码里的内容 + * + * @param htmlStr + * @return + */ + public static String getTextFromHtml(String htmlStr) { + //去除html标签 + htmlStr = delHtmlTags(htmlStr); + //去除空格" " + htmlStr = htmlStr.replaceAll(" ", ""); + return htmlStr; + } + + public static void main(String[] args) { + String htmlStr = "import requests\nimport json\n\ndef get_sogou_img():\n    category = '卡通'\n    length = 5\n    imgs = requests.get(\n        'https://pic.sogou.com/pics/channel/getAllRecomPicByTag.jsp?category=%E5%A3%81%E7%BA%B8&tag=' + category + '&start=0&len=' + str(\n            length) + '&width=1920&height=1080')\n    jd = json.loads(imgs.text)\n    jd = jd['all_items']\n    imgs_url = []\n    for j in jd:\n        imgs_url.append(j['pic_url'])\n    print(imgs_url)\n1111111111111111111111111111\n\n\n\n\nif __name__ == \"__main__\":\n    get_sogou_img()\n" + ; + System.out.println(getTextFromHtml(htmlStr)); + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/utils/EXCELUtil.java b/occupationlab/src/main/java/com/huoran/occupationlab/utils/EXCELUtil.java new file mode 100644 index 0000000..548b39c --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/utils/EXCELUtil.java @@ -0,0 +1,181 @@ +package com.huoran.occupationlab.utils; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLConnection; +import java.util.ArrayList; +import java.util.List; + +import com.alibaba.fastjson.JSONException; +import com.alibaba.fastjson.JSONObject; +import org.apache.poi.hssf.usermodel.HSSFRichTextString; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.*; +import org.apache.poi.ss.usermodel.DateUtil; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.springframework.util.StringUtils; + +/** + * altered by Evan on 2019-3-4 + */ +public class EXCELUtil { + + public static void main(String[] args) throws IOException { + System.out.println("导出数据为:" + readFile("https://huoran.oss-cn-shenzhen.aliyuncs.com/20220408/xls/1512317574577676288.xls")); + } + + /** + * 将EXCEL数据封装成JSON列表 + * + * @param filePath 文件路径 + * @return + * @throws JSONException + */ + public static List readFile(String filePath) throws JSONException { + // 校验文件路径是否为空 + if (StringUtils.isEmpty(filePath)) return null; + + Workbook wb; + Sheet sheet; + Row row; + String cellData; + + // 读取Excel + wb = readExcel(filePath); + // 用来存放每一行数据的列表 + List jsonObjectList = new ArrayList<>(); + + if (wb != null) { + //获取第一个sheet + sheet = wb.getSheetAt(0); + //获取最大行数 + int rowNum = sheet.getPhysicalNumberOfRows(); + //获取第一行(通常第一行为列名) + row = sheet.getRow(0); + //获取最大列数 + int colNum = row.getPhysicalNumberOfCells(); + //用来存放列名 + List columnNameList = new ArrayList<>(); + //循环列,将列名取出放入List + for (int i = 0; i < colNum; i++) { + + if (row.getCell(i) == null) { + row.createCell(i).setCellValue(new HSSFRichTextString(String.valueOf(row.getCell(i).getStringCellValue()))); + } else { + // 获取列的值,放入列名列表内 + String columnName = row.getCell(i).getStringCellValue(); + columnNameList.add(columnName); + } + + } + + //循环行,从第二行开始取行数据(因为第一行为列名) + for (int i = 1; i < rowNum; i++) { + row = sheet.getRow(i); + if (row != null) { + List dataList = new ArrayList<>(); + //循环列,将行数据取出放入List + for (int j = 0; j < colNum; j++) { + cellData = (String) getCellFormatValue(row.getCell(j)); + dataList.add(cellData); + } + // 创建行数据JSON对象 + JSONObject jsonData = new JSONObject(); + for (int k = 0; k < dataList.size(); k++) { + // 按照 列名:行数据 的格式存放 + jsonData.put(columnNameList.get(k), dataList.get(k)); + } + jsonObjectList.add(jsonData); + } else { + break; + } + } + } + return jsonObjectList; + } + + /** + * 读取EXCEL + * + * @param filePath + * @return + */ + public static Workbook readExcel(String filePath) { + if (filePath == null) return null; + // 我是从阿里云里面读取,如果是本地路径请改成FileInputStream + URL httpUrl; + InputStream is = null; + try { + httpUrl = new URL(filePath); + URLConnection urlConnection = httpUrl.openConnection(); + is = urlConnection.getInputStream(); + } catch (MalformedURLException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + + Workbook wb = null; + + String extString = filePath.substring(filePath.lastIndexOf(".")); + try { + if (".xls".equals(extString)) { + wb = new HSSFWorkbook(is); + } else if (".xlsx".equals(extString)) { + wb = new XSSFWorkbook(is); + } else { + wb = null; + } + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return wb; + } + + /** + * 从row中取出数据 + * + * @param cell + * @return + */ + public static Object getCellFormatValue(Cell cell) { + Object cellValue; + if (cell != null) { + //判断cell类型 + switch (cell.getCellType()) { + case NUMERIC: { + cellValue = String.valueOf(cell.getNumericCellValue()); + break; + } + case FORMULA: { + //判断cell是否为日期格式 + if (DateUtil.isCellDateFormatted(cell)) { + //转换为日期格式YYYY-mm-dd + cellValue = cell.getDateCellValue(); + } else { + //数字 + cellValue = String.valueOf(cell.getNumericCellValue()); + } + break; + } + case STRING: { + cellValue = cell.getRichStringCellValue().getString(); + break; + } + default: + cellValue = String.valueOf(cell.getRichStringCellValue()); + break; + } + } else { + cellValue = ""; + } + return cellValue; + } + +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/utils/EasyExcelUtil.java b/occupationlab/src/main/java/com/huoran/occupationlab/utils/EasyExcelUtil.java new file mode 100644 index 0000000..fa31be2 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/utils/EasyExcelUtil.java @@ -0,0 +1,21 @@ +package com.huoran.occupationlab.utils; + +import com.alibaba.excel.EasyExcel; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; + +/** + * @Author chen + * @DATE 2020/10/19 14:45 + * @Version 1.0 + */ +public class EasyExcelUtil { + public static void download(HttpServletResponse response, Class head, List list) throws IOException { + response.setContentType("application/vnd.ms-excel"); + response.setCharacterEncoding("utf-8"); + response.setHeader("Content-disposition", "attachment;filename=applican.xlsx"); + EasyExcel.write(response.getOutputStream(), head).sheet("人员列表").doWrite(list); + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/utils/ExcelImportHelper.java b/occupationlab/src/main/java/com/huoran/occupationlab/utils/ExcelImportHelper.java new file mode 100644 index 0000000..4ab3eee --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/utils/ExcelImportHelper.java @@ -0,0 +1,618 @@ +package com.huoran.occupationlab.utils; + +import com.huoran.common.exception.CustomException; +import com.huoran.common.exception.ExceptionEnum; +import com.huoran.occupationlab.entity.ImportStaff; +import com.huoran.occupationlab.entity.ImportStudent; +import com.huoran.occupationlab.entity.UserManagement; +import com.huoran.occupationlab.entity.req.ExcelImpQuestionReq; +import com.huoran.occupationlab.entity.req.ExcelImpStaffReq; +import com.huoran.occupationlab.entity.req.ExcelImpStudentReq; +import org.apache.commons.lang.StringUtils; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.*; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.springframework.web.multipart.MultipartFile; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +public class ExcelImportHelper { + /** + * 读取学生管理 + * + * @param file + * @return + */ + public static List readStudentManagement(MultipartFile file) { + List list = new ArrayList(); + + Workbook workbook = getWorkbook(file); + ImportStudent importStudent = null; + // 循环工作表Sheet + for (int numSheet = 0; numSheet < workbook.getNumberOfSheets(); numSheet++) { + Sheet hssfSheet = workbook.getSheetAt(numSheet); + if (hssfSheet == null) { + continue; + } + Cell phone; + Cell email; + // 循环行Row//开始行2 + for (int rowNum = 2; rowNum <= hssfSheet.getLastRowNum(); rowNum++) { + Row row = hssfSheet.getRow(rowNum); + if (row != null) { + importStudent = new ImportStudent(); + row.getCell(0).setCellType(CellType.STRING); + Cell account = row.getCell(0); + row.getCell(1).setCellType(CellType.STRING); + Cell userName = row.getCell(1); + row.getCell(2).setCellType(CellType.STRING); + Cell workNumber = row.getCell(2); + if (row.getCell(3) != null) { + row.getCell(3).setCellType(CellType.STRING); + phone = row.getCell(3); + } else { + phone = row.createCell(3); + } + if (row.getCell(4) != null) { + row.getCell(4).setCellType(CellType.STRING); + email = row.getCell(4); + } else { + email = row.createCell(4); + } + //账号 + importStudent.setAccount(account.getStringCellValue()); + // 用户姓名 + importStudent.setUserName(userName.getStringCellValue()); + //学生学号 + importStudent.setWorkNumber(workNumber.getStringCellValue()); + //电话号 + importStudent.setPhone(phone.getStringCellValue()); + //绑定邮箱 + importStudent.setEmail(email.getStringCellValue()); + list.add(importStudent); + } + } + + } + + return list; + } + + /** + * 读取用户管理 + * + * @param file + * @return + */ + public static List readUserManagement(MultipartFile file) { + List list = new ArrayList(); + + Workbook workbook = getWorkbook(file); + UserManagement userManagement = null; + // 循环工作表Sheet + for (int numSheet = 0; numSheet < workbook.getNumberOfSheets(); numSheet++) { + Sheet hssfSheet = workbook.getSheetAt(numSheet); + if (hssfSheet == null) { + continue; + } + // 循环行Row//开始行2 + for (int rowNum = 2; rowNum <= hssfSheet.getLastRowNum(); rowNum++) { + Row row = hssfSheet.getRow(rowNum); + if (row != null) { + userManagement = new UserManagement(); + row.getCell(0).setCellType(CellType.STRING); + Cell account = row.getCell(0); + row.getCell(1).setCellType(CellType.STRING); + Cell name = row.getCell(1); + row.getCell(2).setCellType(CellType.STRING); + Cell clientName = row.getCell(2); + // 账号 + userManagement.setAccount(account.getStringCellValue()); + // 用户姓名 + userManagement.setName(name.getStringCellValue()); + // 客户名称 + userManagement.setClientName(clientName.getStringCellValue()); + list.add(userManagement); + } + } + + } + return list; + } + + private static Workbook getWorkbook(MultipartFile file) { + String fileName = file.getOriginalFilename(); + Workbook workbook = null; + + if (fileName.endsWith("xlsx")) { + try { + workbook = new XSSFWorkbook(file.getInputStream()); + } catch (IOException e) { + e.printStackTrace(); + } + } else if (fileName.endsWith("xls")) { + try { + workbook = new HSSFWorkbook(file.getInputStream()); + } catch (IOException e) { + e.printStackTrace(); + } + } + return workbook; + } + + /** + * 读取员工管理 + * + * @param file + * @return + */ + public static List managementReadStaff(MultipartFile file) { + List list = new ArrayList(); + Workbook workbook = getWorkbook(file); + ImportStaff staff = null; + // 循环工作表Sheet + for (int numSheet = 0; numSheet < workbook.getNumberOfSheets(); numSheet++) { + Sheet hssfSheet = workbook.getSheetAt(numSheet); + if (hssfSheet == null) { + continue; + } + // 循环行Row//开始行2 + for (int rowNum = 2; rowNum <= hssfSheet.getLastRowNum(); rowNum++) { + Row row = hssfSheet.getRow(rowNum); + Cell phone; + Cell email; + if (row != null) { + staff = new ImportStaff(); + //用户姓名 + row.getCell(0).setCellType(CellType.STRING); + Cell userName = row.getCell(0); + //账号 + row.getCell(1).setCellType(CellType.STRING); + Cell account = row.getCell(1); + //角色 + row.getCell(2).setCellType(CellType.STRING); + Cell role = row.getCell(2); + //工号 + row.getCell(3).setCellType(CellType.STRING); + Cell workNumber = row.getCell(3); + //员工组织架构名称 + row.getCell(4).setCellType(CellType.STRING); + Cell staffProfessionalArchitectureName = row.getCell(4); + //员工年级名称 + row.getCell(5).setCellType(CellType.STRING); + Cell staffGradeName = row.getCell(5); + //手机号 + if (row.getCell(6) != null) { + row.getCell(6).setCellType(CellType.STRING); + phone = row.getCell(6); + } else { + phone = row.createCell(6); + } + //邮箱 + if (row.getCell(7) != null) { + row.getCell(7).setCellType(CellType.STRING); + email = row.getCell(7); + } else { + email = row.createCell(7); + } + String roleName = role.getStringCellValue(); + //员工角色 + staff.setRoleName(roleName); + // 员工姓名 + staff.setUserName(userName.getStringCellValue()); + //用户账号 + staff.setAccount(account.getStringCellValue()); + // 员工工号 + staff.setWorkNumber(workNumber.getStringCellValue()); + //专业名称 + staff.setStaffGradeName(staffGradeName.getStringCellValue()); + //组织架构名称 + staff.setStaffProfessionalArchitectureName(staffProfessionalArchitectureName.getStringCellValue()); + //电话 + staff.setPhone(phone.getStringCellValue()); + //邮箱 + staff.setEmail(email.getStringCellValue()); + list.add(staff); + } + } + + } + return list; + } + + //判断row是否为空 + public static boolean isRowEmpty(Row row) { + if (null == row) { + return true; + } + int firstCellNum = row.getFirstCellNum(); //第一个列位置 + int lastCellNum = row.getLastCellNum(); //最后一列位置 + int nullCellNum = 0; //空列数量 + for (int c = firstCellNum; c < lastCellNum; c++) { + Cell cell = row.getCell(c); + if (null == cell || CellType.BLANK == cell.getCellType()) { + nullCellNum++; + continue; + } + cell.setCellType(CellType.STRING); + String cellValue = cell.getStringCellValue().trim(); + if (StringUtils.isEmpty(cellValue)) { + nullCellNum++; + } + } + //所有列都为空 + if (nullCellNum == (lastCellNum - firstCellNum)) { + return true; + } + return false; + } + + /** + * 读取题库 + * + * @param file + * @return + */ + public static List readQuestionManagement(MultipartFile file) { + List list = new ArrayList(); + + Workbook workbook = getWorkbook(file); + ExcelImpQuestionReq impQuestionReq = null; + // 循环工作表Sheet + for (int numSheet = 0; numSheet < workbook.getNumberOfSheets(); numSheet++) { + Sheet hssfSheet = workbook.getSheetAt(numSheet); + if (hssfSheet == null) { + continue; + } + + int count = 1; + // 循环行Row//开始行2 + for (int rowNum = 2; rowNum <= hssfSheet.getLastRowNum(); rowNum++) { + Row row = hssfSheet.getRow(rowNum); + + if (isRowEmpty(row)) { + count++; + if (count == hssfSheet.getLastRowNum()) { + throw new CustomException(ExceptionEnum.EXCEL_FILE_NULL); + } + continue; + } + + Cell questionStem;//题干 + Cell questionTypeName;//题型 + Cell optionA;//选项A + Cell optionB;//选项B + Cell optionC;//选项C + Cell optionD;//选项D + Cell optionE;//选项E + Cell optionF;//选项F + Cell answer;//正确答案 + Cell answerAnalysis;//答案解析 + if (row != null) { + + impQuestionReq = new ExcelImpQuestionReq(); + + if (row.getCell(9) != null) { + row.getCell(9).setCellType(CellType.STRING); + answerAnalysis = row.getCell(9); + } else { + answerAnalysis = row.createCell(9); + } + if (row.getCell(8) != null) { + row.getCell(8).setCellType(CellType.STRING); + answer = row.getCell(8); + } else { + answer = row.createCell(8); + } + if (row.getCell(7) != null) { + row.getCell(7).setCellType(CellType.STRING); + optionF = row.getCell(7); + } else { + optionF = row.createCell(7); + } + + if (row.getCell(6) != null) { + row.getCell(6).setCellType(CellType.STRING); + optionE = row.getCell(6); + } else { + optionE = row.createCell(6); + } + + if (row.getCell(5) != null) { + row.getCell(5).setCellType(CellType.STRING); + optionD = row.getCell(5); + } else { + optionD = row.createCell(5); + } + + if (row.getCell(4) != null) { + row.getCell(4).setCellType(CellType.STRING); + optionC = row.getCell(4); + } else { + optionC = row.createCell(4); + } + + if (row.getCell(3) != null) { + row.getCell(3).setCellType(CellType.STRING); + optionB = row.getCell(3); + } else { + optionB = row.createCell(3); + } + + if (row.getCell(2) != null) { + row.getCell(2).setCellType(CellType.STRING); + optionA = row.getCell(2); + } else { + optionA = row.createCell(3); + } + + if (row.getCell(1) != null) { + row.getCell(1).setCellType(CellType.STRING); + questionTypeName = row.getCell(1); + } else { + questionTypeName = row.createCell(1); + } + + if (row.getCell(0) != null) { + row.getCell(0).setCellType(CellType.STRING); + questionStem = row.getCell(0); + } else { + questionStem = row.createCell(0); + } + + impQuestionReq.setQuestionStem(questionStem.getStringCellValue()); + impQuestionReq.setQuestionType(questionTypeName.getStringCellValue()); + impQuestionReq.setOptionA(optionA.getStringCellValue()); + impQuestionReq.setOptionB(optionB.getStringCellValue()); + impQuestionReq.setOptionC(optionC.getStringCellValue()); + impQuestionReq.setOptionD(optionD.getStringCellValue()); + impQuestionReq.setOptionE(optionE.getStringCellValue()); + impQuestionReq.setOptionF(optionF.getStringCellValue()); + impQuestionReq.setAnswer(answer.getStringCellValue()); + impQuestionReq.setAnswerAnalysis(answerAnalysis.getStringCellValue()); + + list.add(impQuestionReq); + } + } + + } + + return list; + } + + /** + * 读取职站学生管理 + * + * @param file + * @return + */ + public static List readStudent(MultipartFile file) { + List list = new ArrayList(); + + Workbook workbook = getWorkbook(file); + ExcelImpStudentReq excelImpStudentReq = null; + // 循环工作表Sheet + for (int numSheet = 0; numSheet < workbook.getNumberOfSheets(); numSheet++) { + Sheet hssfSheet = workbook.getSheetAt(numSheet); + if (hssfSheet == null) { + continue; + } + + int count = 1; + // 循环行Row//开始行2 + for (int rowNum = 2; rowNum <= hssfSheet.getLastRowNum(); rowNum++) { + Row row = hssfSheet.getRow(rowNum); + + if (isRowEmpty(row)) { + count++; + if (count == hssfSheet.getLastRowNum()) { + throw new CustomException(ExceptionEnum.EXCEL_FILE_NULL); + } + continue; + } + + Cell userName;//学生姓名 + // Cell account;//学生账号 + Cell workNumber;//学号 + Cell professional;//专业 + Cell grade;//年级 + Cell classes;//班级 + Cell phone;//手机号 + Cell email;//邮箱 + if (row != null) { + + excelImpStudentReq = new ExcelImpStudentReq(); + + if (row.getCell(6) != null) { + row.getCell(6).setCellType(CellType.STRING); + email = row.getCell(6); + } else { + email = row.createCell(6); + } + + if (row.getCell(5) != null) { + row.getCell(5).setCellType(CellType.STRING); + phone = row.getCell(5); + } else { + phone = row.createCell(5); + } + + if (row.getCell(4) != null) { + row.getCell(4).setCellType(CellType.STRING); + classes = row.getCell(4); + } else { + classes = row.createCell(4); + } + + if (row.getCell(3) != null) { + row.getCell(3).setCellType(CellType.STRING); + grade = row.getCell(3); + } else { + grade = row.createCell(3); + } + + if (row.getCell(2) != null) { + row.getCell(2).setCellType(CellType.STRING); + professional = row.getCell(2); + } else { + professional = row.createCell(2); + } + + if (row.getCell(1) != null) { + row.getCell(1).setCellType(CellType.STRING); + workNumber = row.getCell(1); + } else { + workNumber = row.createCell(1); + } + + // if (row.getCell(1) != null) { + // row.getCell(1).setCellType(CellType.STRING); + // account = row.getCell(1); + // } else { + // account = row.createCell(1); + // } + + if (row.getCell(0) != null) { + row.getCell(0).setCellType(CellType.STRING); + userName = row.getCell(0); + } else { + userName = row.createCell(0); + } + + excelImpStudentReq.setUserName(userName.getStringCellValue()); + // excelImpStudentReq.setAccount(account.getStringCellValue()); + excelImpStudentReq.setWorkNumber(workNumber.getStringCellValue()); + excelImpStudentReq.setProfessional(professional.getStringCellValue()); + excelImpStudentReq.setGrade(grade.getStringCellValue()); + excelImpStudentReq.setClasses(classes.getStringCellValue()); + excelImpStudentReq.setPhone(phone.getStringCellValue()); + excelImpStudentReq.setEmail(email.getStringCellValue()); + + list.add(excelImpStudentReq); + } + } + + } + + return list; + } + + /** + * @Description : 读取职站员工管理 + * @Param file + * @Author Rong---2021/10/15 + */ + public static List readStaff(MultipartFile file) { + List list = new ArrayList(); + + Workbook workbook = getWorkbook(file); + ExcelImpStaffReq excelImpStaffReq = null; + // 循环工作表Sheet + for (int numSheet = 0; numSheet < workbook.getNumberOfSheets(); numSheet++) { + Sheet hssfSheet = workbook.getSheetAt(numSheet); + if (hssfSheet == null) { + continue; + } + + int count = 1; + // 循环行Row//开始行2 + for (int rowNum = 2; rowNum <= hssfSheet.getLastRowNum(); rowNum++) { + Row row = hssfSheet.getRow(rowNum); + + if (isRowEmpty(row)) { + count++; + if (count == hssfSheet.getLastRowNum()) { + throw new CustomException(ExceptionEnum.EXCEL_FILE_NULL); + } + continue; + } + + Cell userName;//姓名 + // Cell account;//账号 + Cell workNumber;//工号 + Cell firstDept;//一级部门 + Cell secondDept;//二级部门 + Cell roleName;//角色 + Cell phone;//手机号 + Cell email;//邮箱 + if (row != null) { + + excelImpStaffReq = new ExcelImpStaffReq(); + + if (row.getCell(6) != null) { + row.getCell(6).setCellType(CellType.STRING); + email = row.getCell(6); + } else { + email = row.createCell(6); + } + + if (row.getCell(5) != null) { + row.getCell(5).setCellType(CellType.STRING); + phone = row.getCell(5); + } else { + phone = row.createCell(5); + } + + if (row.getCell(4) != null) { + row.getCell(4).setCellType(CellType.STRING); + secondDept = row.getCell(4); + } else { + secondDept = row.createCell(4); + } + + if (row.getCell(3) != null) { + row.getCell(3).setCellType(CellType.STRING); + firstDept = row.getCell(3); + } else { + firstDept = row.createCell(3); + } + + if (row.getCell(2) != null) { + row.getCell(2).setCellType(CellType.STRING); + workNumber = row.getCell(2); + } else { + workNumber = row.createCell(2); + } + + if (row.getCell(1) != null) { + row.getCell(1).setCellType(CellType.STRING); + roleName = row.getCell(1); + } else { + roleName = row.createCell(1); + } + + /* if (row.getCell(1) != null) { + row.getCell(1).setCellType(CellType.STRING); + account = row.getCell(1); + } else { + account = row.createCell(1); + }*/ + + if (row.getCell(0) != null) { + row.getCell(0).setCellType(CellType.STRING); + userName = row.getCell(0); + } else { + userName = row.createCell(0); + } + + excelImpStaffReq.setUserName(userName.getStringCellValue()); + // excelImpStaffReq.setAccount(account.getStringCellValue()); + excelImpStaffReq.setWorkNumber(workNumber.getStringCellValue()); + excelImpStaffReq.setFirstDept(firstDept.getStringCellValue()); + excelImpStaffReq.setSecondDept(secondDept.getStringCellValue()); + excelImpStaffReq.setRoleName(roleName.getStringCellValue()); + excelImpStaffReq.setPhone(phone.getStringCellValue()); + excelImpStaffReq.setEmail(email.getStringCellValue()); + + list.add(excelImpStaffReq); + } + } + + } + + return list; + } + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/utils/ImgUtil.java b/occupationlab/src/main/java/com/huoran/occupationlab/utils/ImgUtil.java new file mode 100644 index 0000000..6837ab5 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/utils/ImgUtil.java @@ -0,0 +1,92 @@ +package com.huoran.occupationlab.utils; + +import org.apache.commons.codec.binary.Base64; +//import sun.misc.BASE64Encoder; + +import java.io.*; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; + +public class ImgUtil { + public static String getImagePathStr(String imgFile) { + InputStream in = null; + byte[] data = null; + try { + in = new FileInputStream(imgFile); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + try { + data = new byte[in.available()]; + // 注:FileInputStream.available()方法能够从输入流中阻断由下一个方法调用这个输入流中读取的剩余字节数 + in.read(data); + in.close(); + } catch (IOException e) { + e.printStackTrace(); + } + +// BASE64Encoder encoder = new BASE64Encoder(); + return Base64.encodeBase64String(data); + + } + + + public static List getAppImageList(String imgURl){ + ArrayList arrayList = new ArrayList<>(); + if(imgURl == null || "".equals(imgURl)){ + return arrayList; + } + String[] imgURlList = imgURl.split(","); + for (String str:imgURlList) { + if(!"".equals(str)){ + arrayList.add(getImagePathStr(str)); + } + } + return arrayList; + } + + + + /** + * 服务器图片转换base64 path:服务器图片路径 返回 base64编码(String 类型) + * @param path + * @return + */ + public static String imgToBase64(String path){ + byte[] data = null; + InputStream in = null; + ByteArrayOutputStream out = null; + try{ + URL url = new URL(path); + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + connection.setRequestMethod("GET"); + connection.setConnectTimeout(5000); + connection.setReadTimeout(5000); + in = connection.getInputStream(); + out = new ByteArrayOutputStream(); + byte[] b = new byte[1024]; + int len = 0; + while((len =in.read(b)) != -1){ + out.write(b,0,len); + } + }catch (Exception e){ + e.printStackTrace(); + }finally { + try{ + if(in != null ){ + in.close(); + } + }catch (IOException e){ + e.getStackTrace(); + } + } + System.out.println("转换后的图片大小:"+out.toByteArray().length/1024); +// BASE64Encoder base = new BASE64Encoder(); + return Base64.encodeBase64String(out.toByteArray()); + + } + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/utils/SemesterDateUtils.java b/occupationlab/src/main/java/com/huoran/occupationlab/utils/SemesterDateUtils.java new file mode 100644 index 0000000..eecd527 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/utils/SemesterDateUtils.java @@ -0,0 +1,151 @@ +package com.huoran.occupationlab.utils; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class SemesterDateUtils { + + /* public static void main(String[] args) { + + Calendar calendar = Calendar.getInstance(); + // 获取当前年 + int year = calendar.get(Calendar.YEAR); + // 获取当前月 + int month = calendar.get(Calendar.MONTH) + 1; + + //打印出当前学期 + System.out.println(getCurrentSemester(year, month)); + + + } + + //获取当前学期 + public static String getCurrentSemester(Integer year, Integer month) { + StringBuilder sb = new StringBuilder(); + String num = "上"; //默认设成第一学期 + //如果是当前的9月1日到1月30之间,就是本年加上下一年的学期,学期是第一学期 + if (month >= 9 && month <= 12) { //当年的9至12月份 + // sb.append(year); + // sb.append("-"); + sb.append(year + 1); + } else if (month == 1 || month == 2) { //1,2月份为上学期 + // sb.append(year - 1); + // sb.append("-"); + sb.append(year); + + } else if (month >= 2 && month < 9) { //下学期 //如果是2至8月,那它就是上一年加上本年的学期,学期是下学期 + // sb.append(year - 1); + // sb.append("-"); + sb.append(year); + num = "下"; + } + //sb.append("第"); + sb.append(num); + sb.append("学期"); + return sb.toString(); + }*/ + + + public static String getYear(String content) { + + String year = null; + + if (content != null) { + + //正则表达式 + + String pat = "\\d{4}-\\d{2}-\\d{2}"; + + Pattern pattern = Pattern.compile(pat); // 实例化Pattern类 + + Matcher m = pattern.matcher(content); // 实例化Matcher类 + + if (m.matches()) { // 进行验证的匹配,使用正则 + + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + + Date date = null; + + try { + + date = format.parse(content); + + Calendar cal = Calendar.getInstance(); + + cal.setTime(date); + + year = "" + cal.get(Calendar.YEAR); + + } catch (ParseException e) { + + e.printStackTrace(); + + } + + } + + } + + return year; + + } + + public static String getMonth(String content) { + + String month = null; + + if (content != null) { + + //正则表达式 + + String pat = "\\d{4}-\\d{2}-\\d{2}"; + + Pattern pattern = Pattern.compile(pat); // 实例化Pattern类 + + Matcher m = pattern.matcher(content); // 实例化Matcher类 + + if (m.matches()) { // 进行验证的匹配,使用正则 + + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + + Date date = null; + + try { + + date = format.parse(content); + + Calendar cal = Calendar.getInstance(); + + cal.setTime(date); + + int num = cal.get(Calendar.MONTH) + 1; + + month = "" + num; + + } catch (ParseException e) { + + e.printStackTrace(); + + } + + } + + } + + return month; + + } + + public static void main(String[] args) { + + + System.out.println("month is:" + getMonth("2022-09-07")); + + System.out.println("year is:" + getYear("2022-09-07")); + + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/utils/SpringContextUtils.java b/occupationlab/src/main/java/com/huoran/occupationlab/utils/SpringContextUtils.java new file mode 100644 index 0000000..6bef595 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/utils/SpringContextUtils.java @@ -0,0 +1,33 @@ +package com.huoran.occupationlab.utils; + +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.stereotype.Component; + +/** + * SpringContextUtils + * + * @author cheney + * @version V1.0 + * @date 2022年7月28日 + */ +@Component +public class SpringContextUtils implements ApplicationContextAware { + private static ApplicationContext applicationContext; + + @Override + public void setApplicationContext(ApplicationContext applicationContext) + throws BeansException { + SpringContextUtils.applicationContext = applicationContext; + } + + public static Object getBean(String name) { + try { + return applicationContext.getBean(name); + } catch (Exception e) { + return null; + } + } + +} \ No newline at end of file diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/utils/StatusConverter.java b/occupationlab/src/main/java/com/huoran/occupationlab/utils/StatusConverter.java new file mode 100644 index 0000000..c54cbbb --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/utils/StatusConverter.java @@ -0,0 +1,64 @@ +package com.huoran.occupationlab.utils; + +import com.alibaba.excel.converters.Converter; +import com.alibaba.excel.enums.CellDataTypeEnum; +import com.alibaba.excel.metadata.CellData; +import com.alibaba.excel.metadata.GlobalConfiguration; +import com.alibaba.excel.metadata.property.ExcelContentProperty; + +/** + * @Author chen + * @DATE 2020/10/19 15:44 + * @Version 1.0 + * 状态转换器 + */ +public class StatusConverter implements Converter { + + @Override + public Class supportJavaTypeKey() { + return Integer.class; + } + + @Override + public CellDataTypeEnum supportExcelTypeKey() { + return CellDataTypeEnum.STRING; + } + + /** + * 这里读的时候会调用 + * + * @param cellData NotNull + * @param contentProperty Nullable + * @param globalConfiguration NotNull + * @return + */ + @Override + public Integer convertToJavaData(CellData cellData, ExcelContentProperty contentProperty, + GlobalConfiguration globalConfiguration) { + return 0; + } + + /** + * 这里是写的时候会调用 + * + * @param value NotNull + * @param contentProperty Nullable + * @param globalConfiguration NotNull + * @return + */ + @Override + public CellData convertToExcelData(Integer value, ExcelContentProperty contentProperty, + GlobalConfiguration globalConfiguration) { + + switch (value) { + case 0: + return new CellData("已禁用"); + case 1: + return new CellData("未禁用"); + default: + return new CellData(String.valueOf(value)); + } + + } + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/utils/WordUtil.java b/occupationlab/src/main/java/com/huoran/occupationlab/utils/WordUtil.java new file mode 100644 index 0000000..8a7889d --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/utils/WordUtil.java @@ -0,0 +1,82 @@ +package com.huoran.occupationlab.utils; + +import com.huoran.occupationlab.entity.ExperimentalReport; +import freemarker.template.Configuration; +import freemarker.template.Template; +import freemarker.template.Version; + +import java.io.*; +import java.util.HashMap; +import java.util.Map; + +/** + * @ClassName WordUtil + * @Description 使用Freemarker生成Word文档工具类 + * @Author Fclever + * @Date 2021/8/11 10:06 + **/ +public class WordUtil { + + /** + * 使用Freemarker自动生成Word文档 + * + * @param dataMap 保存Word文档中所需要的数据 + * @param templatePath 模板文件的绝对路径 + * @param templateFile 模板文件的名称 + * @param generateFile 生成文件的路径+名称 + * @throws Exception + */ + public static void generateWord(Map dataMap, String templatePath, String templateFile, String generateFile) { + // 设置FreeMarker的版本 + Configuration configuration = new Configuration(new Version("2.3.28")); + // 设置Freemarker的编码格式 + configuration.setDefaultEncoding("UTF-8"); + Writer out = null; + try { + // 设置FreeMarker生成Word文档所需要的模板的路径 + configuration.setDirectoryForTemplateLoading(new File(templatePath)); + // 设置FreeMarker生成Word文档所需要的模板名称 + Template t = configuration.getTemplate(templateFile, "UTF-8"); + // 创建一个Word文档的输出流 + out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(generateFile)), "UTF-8")); + //FreeMarker使用Word模板和数据生成Word文档 + t.process(dataMap, out); + } catch (Exception e) { + e.printStackTrace(); + } + if (out != null) { + try { + out.flush(); + out.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + /* *//** + * 获取生成普通文本所需数据 + * + * @return + *//* + private static Map getTextData(ExperimentalReport report) { + *//* + * 创建一个Map对象,将Word文档需要的数据都保存到该Map对象中 + *//* + Map dataMap = new HashMap<>(); + dataMap.put("userName", report.getUserName()); + dataMap.put("workNumber", report.getWorkNumber()); + dataMap.put("className", report.getClassName()); + dataMap.put("projectName", report.getProjectName()); + dataMap.put("summarize", report.getSummarize()); + dataMap.put("instructor", report.getInstructor()); + return dataMap; + }*/ + + /*public static void main(String[] args) { + WordUtil.generateWord(getTextData(), "D:\\huoran\\huorantech\\occupationlab\\src\\main\\resources\\excel-template\\", + "exportWord.ftl" + , "D:\\huoran\\huorantech\\occupationlab\\src\\main\\resources\\excel-template\\exportWord.doc"); + }*/ +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/utils/XlsUtils.java b/occupationlab/src/main/java/com/huoran/occupationlab/utils/XlsUtils.java new file mode 100644 index 0000000..a839cb8 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/utils/XlsUtils.java @@ -0,0 +1,107 @@ +package com.huoran.occupationlab.utils; + +import java.io.*; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLConnection; +import java.text.SimpleDateFormat; +import java.util.*; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import org.apache.poi.hssf.usermodel.*; +import org.apache.poi.ss.usermodel.*; +import org.apache.poi.ss.usermodel.DateUtil; +import org.apache.poi.xssf.usermodel.XSSFCell; +import org.apache.poi.xssf.usermodel.XSSFRow; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLConnection; +import java.util.ArrayList; +import java.util.List; + +import com.alibaba.fastjson.JSONException; +import com.alibaba.fastjson.JSONObject; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.*; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.springframework.util.StringUtils; + +public class XlsUtils { + + public static void main(String[] args) throws IOException { + System.out.println("导出数据为:" + readFileJoinTender("https://huoran.oss-cn-shenzhen.aliyuncs.com/20220408/xls/1512275189860687872.xls")); + } + + private static List readFileJoinTender(String path) { + List list = new ArrayList<>(); + //excel文件路径 + try { + + Workbook wb = getWorkbook(path); + JSONArray jsons = new JSONArray(); + //开始解析 + //读取sheet 0 + Sheet sheet = wb.getSheetAt(0); + //第一行是列名,所以不读 + int firstRowIndex = sheet.getFirstRowNum() + 1; + int lastRowIndex = sheet.getLastRowNum(); + + //遍历行 + for (int rIndex = firstRowIndex; rIndex <= lastRowIndex; rIndex++) { + Row row = sheet.getRow(rIndex); + + if (row != null) { + int indexMin = row.getFirstCellNum(); + int indexMax = row.getLastCellNum(); + for (int i = indexMin; i < indexMax; i++) { + Cell cell = row.getCell(i); + + JSONObject object = new JSONObject(); + if (cell != null) { + // System.out.println(cell.toString()); + // list.add(cell.toString()); + object.put("key", cell.toString()); + //加入json队列 + jsons.add(object); + + } + + } + } + } + + System.out.println("对队列进行输出或者其他操作" + jsons.toJSONString()); + + } catch (Exception e) { + e.printStackTrace(); + } + return list; + } + + public static Workbook getWorkbook(String path) throws Exception { + String type = path.substring(path.lastIndexOf(".") + 1); + Workbook wb; + //根据文件后缀(xls/xlsx)进行判断 + InputStream input = new URL(path).openStream(); + if ("xls".equals(type)) { + + //文件流对象 + wb = new HSSFWorkbook(input); + } else if ("xlsx".equals(type)) { + wb = new XSSFWorkbook(input); + } else { + throw new Exception("文件 类型错误"); + } + return wb; + } + +} + diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/utils/job/Constant.java b/occupationlab/src/main/java/com/huoran/occupationlab/utils/job/Constant.java new file mode 100644 index 0000000..579b54b --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/utils/job/Constant.java @@ -0,0 +1,17 @@ +package com.huoran.occupationlab.utils.job; + +/** + * Constant + * + * @author cheney + * @version V1.0 + * @date 2022年7月28日 + */ +public class Constant { + + /** + * 定时任务状态 + */ + public static final Integer SCHEDULER_STATUS_NORMAL = 0; + public static final Integer SCHEDULER_STATUS_PAUSE = 1; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/utils/oss/AliyunOssUtil.java b/occupationlab/src/main/java/com/huoran/occupationlab/utils/oss/AliyunOssUtil.java new file mode 100644 index 0000000..63000cb --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/utils/oss/AliyunOssUtil.java @@ -0,0 +1,287 @@ +package com.huoran.occupationlab.utils.oss; + +import cn.hutool.core.util.IdUtil; +import com.aliyun.oss.ClientException; +import com.aliyun.oss.OSS; +import com.aliyun.oss.OSSClientBuilder; +import com.aliyun.oss.OSSException; +import com.aliyun.oss.model.*; +import com.huoran.common.entity.FilesResult; +import com.huoran.common.utils.ConstantPropertiesUtil; +import org.apache.commons.lang.StringUtils; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.URLEncoder; +import java.util.List; + +public class AliyunOssUtil { + + /** + * 创建存储空间 + * + * @param ossClient oss客户端 + */ + public static void createBucket(OSS ossClient) { + // 判断存储空间是否存在,不存在,则创建 + if (!ossClient.doesBucketExist(ConstantPropertiesUtil.BUCKET_NAME)) { + // 创建CreateBucketRequest对象,设置仓库名称 + CreateBucketRequest bucketRequest = new CreateBucketRequest(ConstantPropertiesUtil.BUCKET_NAME); + // 设置存储空间的权限为公共读,默认是私有。 + bucketRequest.setCannedACL(CannedAccessControlList.PublicRead); + // 此处以设置存储空间的存储类型为标准存储为例。 + // createBucketRequest.setStorageClass(StorageClass.Standard); + // 默认情况下,数据容灾类型为本地冗余存储,即DataRedundancyType.LRS。如果需要设置数据容灾类型为同城冗余存储,请替换为DataRedundancyType.ZRS。 + // createBucketRequest.setDataRedundancyType(DataRedundancyType.ZRS) + // 创建存储空间。 + ossClient.createBucket(bucketRequest); + + } + } + + /** + * 上传文件 + * + * @param file 文件 + * @return 返回文件上传结果 + * @throws OSSException oss异常 + * @throws ClientException 客户端异常 + * @throws IOException io异常 + */ + public static FilesResult uploadFile(MultipartFile file, String tableName) throws OSSException, ClientException, IOException { + + //获取访问key + String endPoint = ConstantPropertiesUtil.END_POINT; + String accessKeyId = ConstantPropertiesUtil.ACCESS_KEY_ID; + String accessKeySecret = ConstantPropertiesUtil.ACCESS_KEY_SECRET; + //创建ossClient + OSS ossClient = new OSSClientBuilder().build(endPoint, accessKeyId, accessKeySecret); + + FilesResult result = new FilesResult(); + // 创建存储空间 + createBucket(ossClient); + + //获取上传文件流 + InputStream inputStream = file.getInputStream(); + //获取当前日期构建日期路径:PythonDataExcel/文件名 +// String currentDate = new DateTime().toString("yyyyMMdd"); + //获取上传的文件名称(此处filename直接取的TableName) +// String fileName = file.getOriginalFilename(); + + String fileName = tableName; + result.setOriginalFileName(StringUtils.substringBefore(fileName,".")); + + // 获取文件尾缀 + assert fileName != null; + String ext = fileName.substring(fileName.lastIndexOf(".")); + // 获取文件类型,大小 + String fileType = getFileType(ext); + long fileSize = file.getSize(); + + result.setFileType(fileType); + result.setFileSize(String.valueOf(fileSize)); + //获取随机值 + String snowflakeId = IdUtil.getSnowflake(6, 4).nextIdStr(); + //文件名:雪花算法.文件扩展名 +// String newName = snowflakeId + ext; + String sort = ext.substring(ext.lastIndexOf(".") + 1); + result.setFileType(sort); + //组合新的文件名 + String fileUrl = "PythonDataExcel/" + fileName; + result.setOssFileName(fileUrl); + // 设置上传时存储类型与访问权限 + ObjectMetadata metadata = new ObjectMetadata(); + // 指定该Object被下载时的网页的缓存行为 + metadata.setCacheControl("no-cache"); + // 指定该Object下设置Header + metadata.setHeader("Pragma", "no-cache"); + // 指定该Object被下载时的内容编码格式 + metadata.setContentEncoding("utf-8"); + // 文件的MIME,定义文件的类型及网页编码,决定浏览器将以什么形式、什么编码读取文件。如果用户没有指定则根据Key或文件名的扩展名生成, + // 如果没有扩展名则填默认值application/octet-stream + metadata.setContentType(fileType); + // 指定该Object被下载时的名称(指示MINME用户代理如何显示附加的文件,打开或下载,及文件名称) + metadata.setContentDisposition("filename/filesize=" + file.getName() + "/" + fileSize + "Byte."); + + //上传文件 (上传文件流的形式) + ossClient.putObject(ConstantPropertiesUtil.BUCKET_NAME, fileUrl, inputStream, metadata); + // 关闭OSSClient。 + ossClient.shutdown(); + + // 拼接文件url地址,返回控制层 + String tempEndpoint = ConstantPropertiesUtil.END_POINT; + String endpoint = tempEndpoint.substring(tempEndpoint.lastIndexOf("/") + 1, tempEndpoint.length()); + String url = "https://" + ConstantPropertiesUtil.BUCKET_NAME + "." + endpoint + "/" + fileUrl; + + result.setFileUrl(url); + + // 关闭OSSClient。 + ossClient.shutdown(); + + return result; + } + + /** + * 文件下载 + * + * @param response 响应对象 + * @param ossClient oss客户端 + * @param objectName 文件名 + */ + public static void downloadFiles(HttpServletResponse response, OSS ossClient, String objectName) throws IOException { + + // ossObject包含文件所在的存储空间名称、文件名称、文件元信息以及一个输入流。 + OSSObject ossObject = ossClient.getObject(ConstantPropertiesUtil.BUCKET_NAME, objectName); + InputStream input = null; + OutputStream outputStream = null; + try { + // 获取文件名 + String fileName = objectName.substring(objectName.lastIndexOf("/") + 1); + //获取输入流 + input = ossObject.getObjectContent(); + // 获取OutputStream输出流 + outputStream = response.getOutputStream(); + byte[] buffer = new byte[input.available()]; + + response.setHeader("content-Type", "application/octet-stream"); + response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8")); + response.flushBuffer(); + + for (int length = 0; (length = input.read(buffer)) > 0; ) { + outputStream.write(buffer, 0, length); + } + + } catch (IOException e) { + e.printStackTrace(); + throw e; + } finally { + if (null != outputStream) { + try { + outputStream.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (null != input) { + try { + input.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + // 关闭OSSClient。 + ossClient.shutdown(); + } + + } + + /** + * *** 谨慎操作 *** + * 删除存储空间 + * + * @param bucketName 存储空间名称 + */ + public static void deleteBucket(String bucketName) { + String endPoint = ConstantPropertiesUtil.END_POINT; + String accessKeyId = ConstantPropertiesUtil.ACCESS_KEY_ID; + String accessKeySecret = ConstantPropertiesUtil.ACCESS_KEY_SECRET; + // 创建OSSClient实例。 + OSS ossClient = new OSSClientBuilder().build(endPoint, accessKeyId, accessKeySecret); + // 删除存储空间。 + ossClient.deleteBucket(bucketName); + // 关闭OSSClient。 + ossClient.shutdown(); + } + + /** + * 创建文件夹 + * + * @param ossClient oss连接 + * @param bucketName 存储空间 + * @param folder 文件夹名,如 "qj_nanjing/" + * @return 返回创建的文件夹名 + */ + public static String createFolder(OSS ossClient, String bucketName, String folder) { + // 判断文件夹是否存在,不存在则创建 + if (!ossClient.doesObjectExist(bucketName, folder)) { + // 创建文件夹 + ossClient.putObject(bucketName, folder, new ByteArrayInputStream(new byte[0])); + // 得到文件夹名 + OSSObject object = ossClient.getObject(bucketName, folder); + return object.getKey(); + } + return folder; + } + + /** + * 批量删除文件。key等同于ObjectName,表示删除OSS文件时需要指定包含文件后缀在内的完整路径,例如abc/efg/123.jpg。 + * + * @param keys 文件完整路径 + */ + public static List deleteFiles(List keys) { + String endPoint = ConstantPropertiesUtil.END_POINT; + String accessKeyId = ConstantPropertiesUtil.ACCESS_KEY_ID; + String accessKeySecret = ConstantPropertiesUtil.ACCESS_KEY_SECRET; + String bucketName = ConstantPropertiesUtil.BUCKET_NAME; + // 创建OSSClient实例。 + OSS ossClient = new OSSClientBuilder().build(endPoint, accessKeyId, accessKeySecret); + + DeleteObjectsResult deleteObjectsResult = ossClient.deleteObjects(new DeleteObjectsRequest(bucketName).withKeys(keys)); + List deletedObjects = deleteObjectsResult.getDeletedObjects(); + // 关闭OSSClient。 + ossClient.shutdown(); + //返回删除成功文件列表 + return deletedObjects; + } + + /** + * 获取文件类型 + * + * @param fileExtension 文件后缀 + * @return 返回类型 + */ + public static String getFileType(String fileExtension) { + if (".bmp".equalsIgnoreCase(fileExtension)) { + return "image/bmp"; + } + if (".gif".equalsIgnoreCase(fileExtension)) { + return "image/gif"; + } + if (".jpeg".equalsIgnoreCase(fileExtension) || ".jpg".equalsIgnoreCase(fileExtension) || ".png".equalsIgnoreCase(fileExtension)) { + return "image/jpg"; + } + if (".html".equalsIgnoreCase(fileExtension)) { + return "text/html"; + } + if (".txt".equalsIgnoreCase(fileExtension)) { + return "text/plain"; + } + if (".vsd".equalsIgnoreCase(fileExtension)) { + return "application/vnd.visio"; + } + if (".ppt".equalsIgnoreCase(fileExtension) || ".pptx".equalsIgnoreCase(fileExtension)) { + return "application/vnd.ms-powerpoint"; + } + if (".doc".equalsIgnoreCase(fileExtension) || ".docx".equalsIgnoreCase(fileExtension)) { + return "application/msword"; + } + if (".xml".equalsIgnoreCase(fileExtension)) { + return "text/xml"; + } + if (".mp4".equalsIgnoreCase(fileExtension) || ".avi".equalsIgnoreCase(fileExtension)) { + return "video/mp4"; + } + if (".mpg".equalsIgnoreCase(fileExtension) || ".mpeg".equalsIgnoreCase(fileExtension)) { + return "video/mpeg"; + } + if ("pdf".equalsIgnoreCase(fileExtension)) { + return "application/pdf"; + } + return "application/octet-stream"; + } + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/utils/oss/AliyunVodSDKUtil.java b/occupationlab/src/main/java/com/huoran/occupationlab/utils/oss/AliyunVodSDKUtil.java new file mode 100644 index 0000000..65552df --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/utils/oss/AliyunVodSDKUtil.java @@ -0,0 +1,17 @@ +package com.huoran.occupationlab.utils.oss; + +import com.aliyuncs.DefaultAcsClient; +import com.aliyuncs.profile.DefaultProfile; + +/** + * @Author chen + * @DATE 2020/10/12 9:10 + * @Version 1.0 + */ +public class AliyunVodSDKUtil { + public static DefaultAcsClient initVodClient(String accessKeyId, String accessKeySecret) { + String regionId = "cn-shanghai"; // 点播服务接入区域 + DefaultProfile profile = DefaultProfile.getProfile(regionId, accessKeyId, accessKeySecret); + return new DefaultAcsClient(profile); + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/utils/poi/CommonCode.java b/occupationlab/src/main/java/com/huoran/occupationlab/utils/poi/CommonCode.java new file mode 100644 index 0000000..7b00811 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/utils/poi/CommonCode.java @@ -0,0 +1,54 @@ +package com.huoran.occupationlab.utils.poi; + +import com.huoran.occupationlab.utils.poi.ResultCode; +import lombok.ToString; + +@ToString +public enum CommonCode implements ResultCode { + + + SUCCESS(true, 10000, "操作成功!"), + UNAUTHENTICATED(false, 10001, "此操作需要登陆系统!"), + UNAUTHORISE(false, 10002, "权限不足,无权操作!"), + QUESTIONTYPE_INVALID(false, 10006, "题型错误!"), + INVALID_PARAM(false, 10003, "非法参数!"), + QUESTION_NUM_INVALID(false, 10004, "测评题目数量设置超出范围!"), + QUESTION_EXISTS(false, 10005, "此题已存在!"), + QUESTION_TYPE_INVALID(false, 10006, "题型错误!"), + EXCEL_INVALID(false, 10007, "excel表内容错误!"), + EVALUATION_TIME_INVALID(false, 10008, "测评时间错误!"), + EXCEL_FILE_INVALID(false, 10009, "上传excel文件错误!"), + REPEAT_INEXCEL(false, 10010, "试题在excel表中重复!"), + EVALUATION_QUESTION_NUM_INVALID(false, 10011, "当前测评题数设置为0,请先设置测评题数!"), + FAIL(false, 11111, "操作失败!"), + SERVER_ERROR(false, 99999, "抱歉,系统繁忙,请稍后重试!"); + //操作是否成功 + boolean success; + //操作代码 + int code; + //提示信息 + String message; + + CommonCode(boolean success, int code, String message) { + this.success = success; + this.code = code; + this.message = message; + } + + @Override + public boolean success() { + return success; + } + + @Override + public int code() { + return code; + } + + @Override + public String message() { + return message; + } + + +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/utils/poi/CustomException.java b/occupationlab/src/main/java/com/huoran/occupationlab/utils/poi/CustomException.java new file mode 100644 index 0000000..fc59681 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/utils/poi/CustomException.java @@ -0,0 +1,28 @@ +package com.huoran.occupationlab.utils.poi; + +import com.huoran.common.response.R; +import com.huoran.occupationlab.utils.poi.ResultCode; + +/** + * @author 世杰 + * @date 2020/3/24 22:47 + */ +public class CustomException extends RuntimeException { + private com.huoran.occupationlab.utils.poi.ResultCode resultCode; + + public CustomException(Integer code, String message) { + //异常信息为错误代码+异常信息 + super("错误代码:" + code + "错误信息:" + message); + this.resultCode = resultCode; + } + + public CustomException(com.huoran.occupationlab.utils.poi.ResultCode resultCode) { + //异常信息为错误代码+异常信息 + super("错误代码:" + resultCode.code() + "错误信息:" + resultCode.message()); + this.resultCode = resultCode; + } + + public ResultCode getResultCode() { + return this.resultCode; + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/utils/poi/ExcelAttribute.java b/occupationlab/src/main/java/com/huoran/occupationlab/utils/poi/ExcelAttribute.java new file mode 100644 index 0000000..fb709ed --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/utils/poi/ExcelAttribute.java @@ -0,0 +1,25 @@ +package com.huoran.occupationlab.utils.poi; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) +public @interface ExcelAttribute { + /** + * 对应的列名称 + */ + String name() default ""; + + /** + * excel列的索引 + */ + int sort(); + + /** + * 字段类型对应的格式 + */ + String format() default ""; +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/utils/poi/ExcelExportUtil.java b/occupationlab/src/main/java/com/huoran/occupationlab/utils/poi/ExcelExportUtil.java new file mode 100644 index 0000000..8d3b468 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/utils/poi/ExcelExportUtil.java @@ -0,0 +1,99 @@ +package com.huoran.occupationlab.utils.poi; + +import lombok.Data; +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; + +import javax.servlet.http.HttpServletResponse; +import java.io.InputStream; +import java.lang.reflect.Field; +import java.net.URLEncoder; +import java.util.List; +import java.util.concurrent.atomic.AtomicInteger; + +/** + * 导出Excel工具类 + * 基于模板打印的方式导出: + */ +@Data +public class ExcelExportUtil { + + private int rowIndex; //写入数据的起始行 + private int styleIndex; //需要提取的样式所在的行号 + private Class clazz; //对象的字节码 + private Field fields[]; //对象中的所有属性 + + public ExcelExportUtil(Class clazz, int rowIndex, int styleIndex) { + this.clazz = clazz; + this.rowIndex = rowIndex; + this.styleIndex = styleIndex; + fields = clazz.getDeclaredFields(); + } + + /** + * 基于注解导出 + * 参数: + * response: + * InputStream:模板的输入流 + * objs:数据 + * fileName:生成的文件名 + */ + public void export(HttpServletResponse response, InputStream is, List objs, String fileName) throws Exception { + + //1.根据模板创建工作簿 + XSSFWorkbook workbook = new XSSFWorkbook(is); + //2.读取工作表 + Sheet sheet = workbook.getSheetAt(0); + Row row1 = sheet.getRow(styleIndex); + //3.提取公共的样式 + CellStyle[] styles = getTemplateStyles(row1); + //4.根据数据创建每一行和每一个单元格的数据2 + AtomicInteger datasAi = new AtomicInteger(rowIndex); //数字 + for (T t : objs) { + //datasAi.getAndIncrement() :获取数字,并++ i++ + Row row = sheet.createRow(datasAi.getAndIncrement()); + for (int i = 0; i < styles.length; i++) { + Cell cell = row.createCell(i); + cell.setCellStyle(styles[i]); + for (Field field : fields) { + if (field.isAnnotationPresent(com.huoran.occupationlab.utils.poi.ExcelAttribute.class)) { + field.setAccessible(true); + com.huoran.occupationlab.utils.poi.ExcelAttribute ea = field.getAnnotation(ExcelAttribute.class); + if (i == ea.sort()) { + if (field.get(t) != null) { + cell.setCellValue(field.get(t).toString()); + } + } + } + } + } + } + fileName = URLEncoder.encode(fileName, "UTF-8"); + response.setContentType("application/octet-stream"); + response.setHeader("content-disposition", "attachment;filename=" + new String(fileName.getBytes("ISO8859-1"))); + response.setHeader("filename", fileName); + workbook.write(response.getOutputStream()); + } + + CellStyle[] getTemplateStyles(Row row) { + CellStyle[] styles = new CellStyle[row.getLastCellNum()]; + for (int i = 0; i < row.getLastCellNum(); i++) { + if (row.getCell(i) == null) { + styles[i] = row.createCell(i).getCellStyle(); + } else { + styles[i] = row.getCell(i).getCellStyle(); + } + } + return styles; + } +// CellStyle[] getTemplateStyles(Row row) { +// CellStyle[] styles = new CellStyle[row.getLastCellNum()]; +// for (int i = 0; i < row.getLastCellNum(); i++) { +// styles[i] = row.getCell(i).getCellStyle(); +// } +// return styles; +// } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/utils/poi/ExcelImportUtil.java b/occupationlab/src/main/java/com/huoran/occupationlab/utils/poi/ExcelImportUtil.java new file mode 100644 index 0000000..c2bc797 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/utils/poi/ExcelImportUtil.java @@ -0,0 +1,123 @@ +package com.huoran.occupationlab.utils.poi;//package com.huoran.enterprise.utils.poi; +// +//import org.apache.poi.ss.usermodel.Cell; +//import org.apache.poi.ss.usermodel.DateUtil; +//import org.apache.poi.ss.usermodel.Row; +//import org.apache.poi.ss.usermodel.Sheet; +//import org.apache.poi.xssf.usermodel.XSSFWorkbook; +// +//import java.io.InputStream; +//import java.lang.reflect.Field; +//import java.math.BigDecimal; +//import java.text.SimpleDateFormat; +//import java.util.ArrayList; +//import java.util.Date; +//import java.util.List; +// +// +//public class ExcelImportUtil { +// +// private Class clazz; +// private Field fields[]; +// +// public ExcelImportUtil(Class clazz) { +// this.clazz = clazz; +// fields = clazz.getDeclaredFields(); +// } +// +// /** +// * 基于注解读取excel +// */ +// public List readExcel(InputStream is, int rowIndex, int cellIndex) { +// List list = new ArrayList<>(); +// T entity = null; +// try { +// XSSFWorkbook workbook = new XSSFWorkbook(is); +// Sheet sheet = workbook.getSheetAt(0); +// // 不准确 +// // int rowLength = sheet.getLastRowNum(); +// // System.out.println(sheet.getLastRowNum()); +// for (int rowNum = rowIndex; rowNum <= sheet.getLastRowNum(); rowNum++) { +// Row row = sheet.getRow(rowNum); +// entity = (T) clazz.newInstance(); +// // System.out.println(row.getLastCellNum()); +// for (int j = cellIndex; j < row.getLastCellNum(); j++) { +// Cell cell = row.getCell(j); +// for (Field field : fields) { +// if (field.isAnnotationPresent(ExcelAttribute.class)) { +// field.setAccessible(true); +// ExcelAttribute ea = field.getAnnotation(ExcelAttribute.class); +// if (j == ea.sort()) { +// field.set(entity, covertAttrType(field, cell)); +// } +// } +// } +// } +// Field field = entity.getClass().getDeclaredField("index"); +// field.setAccessible(true); +// field.set(entity, rowNum + 1); +// list.add(entity); +// } +// } catch (Exception e) { +// e.printStackTrace(); +// } +// return list; +// } +// +// /** +// * 类型转换 将cell 单元格格式转为 字段类型 +// */ +// private Object covertAttrType(Field field, Cell cell) throws Exception { +// String fieldType = field.getType().getSimpleName(); +// if ("String".equals(fieldType)) { +// return getValue(cell); +// } else if ("Date".equals(fieldType)) { +// return new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").parse(getValue(cell)); +// } else if ("int".equals(fieldType) || "Integer".equals(fieldType)) { +// return Integer.parseInt(getValue(cell)); +// } else if ("double".equals(fieldType) || "Double".equals(fieldType)) { +// return Double.parseDouble(getValue(cell)); +// } else { +// return null; +// } +// } +// +// +// /** +// * 格式转为String +// * +// * @param cell +// * @return +// */ +//// public String getValue(Cell cell) { +//// if (cell == null) { +//// return ""; +//// } +//// switch (cell.getCellType()) { +//// case STRING: +//// return cell.getRichStringCellValue().getString().trim(); +//// case NUMERIC: +//// if (DateUtil.isCellDateFormatted(cell)) { +//// Date dt = DateUtil.getJavaDate(cell.getNumericCellValue()); +//// return new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(dt); +//// } else { +//// // 防止数值变成科学计数法 +//// String strCell = ""; +//// Double num = cell.getNumericCellValue(); +//// BigDecimal bd = new BigDecimal(num.toString()); +//// if (bd != null) { +//// strCell = bd.toPlainString(); +//// } +//// // 去除 浮点型 自动加的 .0 +//// if (strCell.endsWith(".0")) { +//// strCell = strCell.substring(0, strCell.indexOf(".")); +//// } +//// return strCell; +//// } +//// case BOOLEAN: +//// return String.valueOf(cell.getBooleanCellValue()); +//// default: +//// return ""; +//// } +//// } +//} \ No newline at end of file diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/utils/poi/ExcelStyleUtil.java b/occupationlab/src/main/java/com/huoran/occupationlab/utils/poi/ExcelStyleUtil.java new file mode 100644 index 0000000..e5d0917 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/utils/poi/ExcelStyleUtil.java @@ -0,0 +1,187 @@ +package com.huoran.occupationlab.utils.poi; + +import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity; +import cn.afterturn.easypoi.excel.entity.params.ExcelForEachParams; +import cn.afterturn.easypoi.excel.export.styler.IExcelExportStyler; +import org.apache.poi.ss.usermodel.*; + +/** + * @ProjectName: huorantech + * @Package: com.huoran.common.utils + * @ClassName: ExcelStyleUtil + * @Description: easy poi导出设置样式 + * @Author: Maureen.Rong + * @CreateDate: 2021/9/1 14:29 + * @UpdateDate: 2021/9/1 14:29 + * @Version: 1.0 + */ +public class ExcelStyleUtil implements IExcelExportStyler { + private static final short STRING_FORMAT = (short) BuiltinFormats.getBuiltinFormat("TEXT"); + private static final short FONT_SIZE_TEN = 9; + private static final short FONT_SIZE_ELEVEN = 10; + private static final short FONT_SIZE_TWELVE = 50; + + /** + * 大标题样式 + */ + private CellStyle headerStyle; + /** + * 每列标题样式 + */ + private CellStyle titleStyle; + /** + * 数据行样式 + */ + private CellStyle styles; + + public ExcelStyleUtil(Workbook workbook) { + this.init(workbook); + } + + /** + * 初始化样式 + * + * @param workbook + */ + private void init(Workbook workbook) { + this.headerStyle = initHeaderStyle(workbook); + this.titleStyle = initTitleStyle(workbook); + this.styles = initStyles(workbook); + } + + /** + * 大标题样式 + * + * @param color + * @return + */ + @Override + public CellStyle getHeaderStyle(short color) { + return headerStyle; + } + + /** + * 每列标题样式 + * + * @param color + * @return + */ + @Override + public CellStyle getTitleStyle(short color) { + return titleStyle; + } + + /** + * 数据行样式 + * + * @param parity 可以用来表示奇偶行 + * @param entity 数据内容 + * @return 样式 + */ + @Override + public CellStyle getStyles(boolean parity, ExcelExportEntity entity) { + return styles; + } + + /** + * 获取样式方法 + * + * @param dataRow 数据行 + * @param obj 对象 + * @param data 数据 + */ + @Override + public CellStyle getStyles(Cell cell, int dataRow, ExcelExportEntity entity, Object obj, Object data) { + return getStyles(true, entity); + } + + /** + * 模板使用的样式设置 + */ + @Override + public CellStyle getTemplateStyles(boolean isSingle, ExcelForEachParams excelForEachParams) { + return null; + } + + /** + * 初始化--大标题样式 + * + * @param workbook + * @return + */ + private CellStyle initHeaderStyle(Workbook workbook) { + CellStyle style = getBaseCellStyle(workbook); + style.setFont(getFont(workbook, FONT_SIZE_TWELVE, true)); + return style; + } + + /** + * 初始化--每列标题样式 + * + * @param workbook + * @return + */ + private CellStyle initTitleStyle(Workbook workbook) { + CellStyle style = getBaseCellStyle(workbook); + style.setFont(getFont(workbook, FONT_SIZE_ELEVEN, false)); + //背景色 + style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); + style.setFillPattern(FillPatternType.SOLID_FOREGROUND); + return style; + } + + /** + * 初始化--数据行样式 + * + * @param workbook + * @return + */ + private CellStyle initStyles(Workbook workbook) { + CellStyle style = getBaseCellStyle(workbook); + style.setFont(getFont(workbook, FONT_SIZE_TEN, false)); + style.setDataFormat(STRING_FORMAT); + return style; + } + + /** + * 基础样式 + * + * @return + */ + private CellStyle getBaseCellStyle(Workbook workbook) { + CellStyle style = workbook.createCellStyle(); + //下边框 + style.setBorderBottom(BorderStyle.THIN); + //左边框 + style.setBorderLeft(BorderStyle.THIN); + //上边框 + style.setBorderTop(BorderStyle.THIN); + //右边框 + style.setBorderRight(BorderStyle.THIN); + //水平居中 + style.setAlignment(HorizontalAlignment.CENTER); + //上下居中 + style.setVerticalAlignment(VerticalAlignment.CENTER); + //设置自动换行 + style.setWrapText(true); + return style; + } + + /** + * 字体样式 + * + * @param size 字体大小 + * @param isBold 是否加粗 + * @return + */ + private Font getFont(Workbook workbook, short size, boolean isBold) { + Font font = workbook.createFont(); + //字体样式 + font.setFontName("宋体"); + //是否加粗 + font.setBold(isBold); + //字体大小 + font.setFontHeightInPoints(size); + return font; + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/utils/poi/ExceptionCast.java b/occupationlab/src/main/java/com/huoran/occupationlab/utils/poi/ExceptionCast.java new file mode 100644 index 0000000..29727cd --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/utils/poi/ExceptionCast.java @@ -0,0 +1,15 @@ +package com.huoran.occupationlab.utils.poi; + +import com.huoran.occupationlab.utils.poi.CustomException; +import com.huoran.occupationlab.utils.poi.ResultCode; + +/** + * @author 世杰 + * @date 2020/3/24 23:04 + */ +public class ExceptionCast { + //使用此静态方法抛出自定义异常 + public static void cast(ResultCode resultCode) { + throw new CustomException(resultCode); + } +} diff --git a/occupationlab/src/main/java/com/huoran/occupationlab/utils/poi/ResultCode.java b/occupationlab/src/main/java/com/huoran/occupationlab/utils/poi/ResultCode.java new file mode 100644 index 0000000..a7ba2d0 --- /dev/null +++ b/occupationlab/src/main/java/com/huoran/occupationlab/utils/poi/ResultCode.java @@ -0,0 +1,21 @@ +package com.huoran.occupationlab.utils.poi; + +/** + * Created by mrt on 2018/3/5. + * 10000-- 通用错误代码 + * 22000-- 媒资错误代码 + * 23000-- 用户中心错误代码 + * 24000-- cms错误代码 + * 25000-- 文件系统 + */ +public interface ResultCode { + //操作是否成功,true为成功,false操作失败 + boolean success(); + + //操作代码 + int code(); + + //提示信息 + String message(); + +} diff --git a/occupationlab/src/main/resources/bootstrap.properties b/occupationlab/src/main/resources/bootstrap.properties new file mode 100644 index 0000000..43519d9 --- /dev/null +++ b/occupationlab/src/main/resources/bootstrap.properties @@ -0,0 +1,33 @@ +#职站 +spring.application.name=occupationlab + +#addr +spring.cloud.nacos.config.server-addr=127.0.0.1:8848 + +#namespace +spring.cloud.nacos.config.namespace=kindergarten-microservice-configuration-namespace + +#spring.profiles.active=dev +#thread +occupationlab.thread.core-size=20 +occupationlab.thread.max-size=200 +occupationlab.thread.keep-alive-time=10 + +# 某些类对象无法序列化的时候,是否报错 +#spring.jackson.serialization.fail-on-empty-beans=true +# json对象中有不存在的属性时候,是否报错 +#spring.jackson.deserialization.fail-on-unknown-properties=true + + +#以下是补充配置 +spring.datasource.type=com.zaxxer.hikari.HikariDataSource +spring.datasource.hikari.minimum-idle=5 +spring.datasource.hikari.maximum-pool-size=15 +spring.datasource.hikari.auto-commit=true +spring.datasource.hikari.idle-timeout=30000 +spring.datasource.hikari.pool-name=DatebookHikariCP +spring.datasource.hikari.max-lifetime=500000 +spring.datasource.hikari.connection-timeout=30000 +spring.datasource.hikari.connection-test-query=SELECT 1 + + diff --git a/occupationlab/src/main/resources/excel-template/bank.ftl b/occupationlab/src/main/resources/excel-template/bank.ftl new file mode 100644 index 0000000..88af47e --- /dev/null +++ b/occupationlab/src/main/resources/excel-template/bank.ftl @@ -0,0 +1,3285 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 标准实验报告 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 基本信息 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 学生姓名 + + + + + + + + + + + + + + : + + + + + + + + + + + + + + + + + + + + + + ${userName!} + + + + + + + + + + + + + + + + + + + + + + + + + + + 试验时间 + + + + + + + + + + + + + : + + + + + + + + + + + ${submitTime!} + + + + + + + + + + + + + + + + + + + + + + + + + + + 学生班级 + + + + + + + + + + + + + : + + + + + + + + + + + ${className!} + + + + + + + + + + + + + + + + + + + + + + 实验成绩 + + + + + + + + + + + + + : + + + + + + + + + + + ${score!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 学号 + + + + + + + + + + + + + : + + + + + + + + + + + ${workNumber!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验学时 + + + + + + + + + + + + + : + + + + + + + + + + + ${timeSum!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 指导老师 + + + + + + + + + + + + + : + + + + + + + + + + + ${instructor!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验项目名称 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${projectName!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验目的 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${purpose!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验数据 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 序号 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 判分点 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 考核点 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 参考答案 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 学生答案 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 分值 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 得分 + + + + + + <#list experimentalDataList as data> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.id!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.judgmentName!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.assessmentPoint!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.referenceAnswer!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.answer!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.quesScore!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.score!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验总结与体会 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 总感觉军军军军军军 + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 423 + 478 + 0 + 0 + 154 + false + false + 808 + WPS Office_11.1.0.13703_F1E327BC-269C-435d-A152-05C5408002CA + 0 + + + + + + + 2022-03-25T03:10:00Z + Hello + rong + 2023-10-25T08:09:49Z + 1 + + + + + + + + 2052-11.1.0.13703 + + + 2124D8FADC4D4677BEFA07ADCD9514A7 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAElBMVEUAAAAAfv8Afv8Afv8Afv8A + fv+el/cYAAAABXRSTlMAqpfd2z124asAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAAkSURBVCiRY2Cg + G2BFBkRKMDNCAAu6BBOUxUS0UcPeDlIlaAoAstwDOYaAcLoAAAAASUVORK5CYII= + + + + iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAALVBMVEUAAAAAfv8Afv8Ad/8Afv8A + fv8Aff8Aff8Af/8Afv8Af/8Aff8Afv8Af/8Afv9+TCfvAAAADnRSTlMA5MYD3Jr17IuJSx3Wo4N5 + 2H8AAAAJcEhZcwAADsQAAA7EAZUrDhsAAABUSURBVCiRvY3ZCoAwDARjNr21//+5YorQSyg+dJ4G + hmSJdiG5QqqQG7pwKGMwxcz6xeeGZcWOG1Cu9Ve/AvM8BMBPgouPRNcHTsUSN0ECXoU/aRc35zgI + 8eK691UAAAAASUVORK5CYII= + + + + iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAALVBMVEUAAAAAeP8Afv8Afv8Afv8A + e/8Afv8Af/8AgP8Aff8AgP8Afv8Af/8Afv8Afv+RS+oMAAAADnRSTlMADNRdph/Ep0TmYFXDRfNw + SsgAAAAJcEhZcwAADsQAAA7EAZUrDhsAAABvSURBVCiRvZDbEoAgCEQFNG/F/39uUI1jJtNT7YPD + nFUWce5XASLMePLMPj1wWPjQGgae+VK+O3o/EkV90/NNQIVCUKXockBzAZkRolbNEMRUNIFIDnw3 + zFZm+Dmun4xrf7CtZBm45syX6Oy1f6cdwqsGnX1mG3QAAAAASUVORK5CYII= + + + + iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAclBMVEUAAAAAfv8Afv8Ahf8Afv8A + fv8Afv8Afv8AfP8Afv8Afv8Afv8Af/8Af/8Afv8AgP8Aff8Afv8AgP8Af/8Aff8AgP8Ae/8Afv8A + fv8Afv8Afv8Af/8Af/8Afv8Afv8Af/8Aff8Af/8Afv8Af/8Aff8Afv/G+dOvAAAAJXRSTlMA990F + 7Mumggm9tpJiW0UmrI1STCweDunf0s6pn5aIh3pwb2g/g62ubAAAAAlwSFlzAAAOxAAADsQBlSsO + GwAAAJZJREFUKJG9j0cWwyAMBb8oBpe4xXZ6j+5/xZiwEqyTWen9UQHgn4ylMdWYxfrEu743XOhE + 1HxdIz/wIPOZz7EoaBbiwV0sJn7KTQS0SzcBVAvh2GsqVYmFnRAtb3BnbtDwVl5XB8AarZVK3hs6 + C4XXOinxVAVx3Kc/R0XWkE1OBy78Jd0E3KJoM+GieGeiUyG3PhM/5AOdtQnIhXjAuAAAAABJRU5E + rkJgghjj + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/occupationlab/src/main/resources/excel-template/bank1.ftl b/occupationlab/src/main/resources/excel-template/bank1.ftl new file mode 100644 index 0000000..ba20395 --- /dev/null +++ b/occupationlab/src/main/resources/excel-template/bank1.ftl @@ -0,0 +1,3350 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 标准实验报告 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -102235 + + + 65405 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 基本信息 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 学生姓名 + + + + + + + + + + + + + + + : + + + + + + + + + + + ${userName!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 试验时间 + + + + + + + + + + + + + + : + + + + + + + + + + + ${submitTime!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 学生班级 + + + + + + + + + + + + + + : + + + + + + + + + + + ${className!} + + + + + + + + + + + + + + + + + + + + + + + + 实验成绩 + + + + + + + + + + + + + + : + + + + + + + + + + + ${score!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 学生学 + + + + + + + + + + + + + + + + + + + + + + + + + + + : + + + + + + + + + + + ${workNumber!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验学时 + + + + + + + + + + + + + + : + + + + + + + + + + + ${timeSum!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 指导老师 + + + + + + + + + + + + + + : + + + + + + + + + + + + ${instructor!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -102235 + + + 51435 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验项目名称 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${projectName!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -95250 + + + 71755 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验目的 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${purpose!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -47625 + + + 78740 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验数据 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 序号 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 判分点 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 考核点 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 参考答案 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 学生答案 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 分值 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 得分 + + + + + + <#list experimentalDataList as data> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.id!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.judgmentName!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.assessmentPoint!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.referenceAnswer!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.answer!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.quesScore!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.score!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -22860 + + + 64770 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验总结与体会 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${summarize!} + + + + + + + + + + + + + + + + + + + + + 1 + 151 + 191 + 0 + 0 + 1 + false + false + 518 + WPS Office_11.1.0.13703_F1E327BC-269C-435d-A152-05C5408002CA + 0 + + + + + + + 2022-03-25T03:10:00Z + Hello + rong + 2023-10-25T10:00:39Z + 1 + + + + + + + + 2052-11.1.0.13703 + + + 6688675D522C4567B48CD6A8387DA695 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAElBMVEUAAAAAfv8Afv8Afv8Afv8A + fv+el/cYAAAABXRSTlMAqpfd2z124asAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAAkSURBVCiRY2Cg + G2BFBkRKMDNCAAu6BBOUxUS0UcPeDlIlaAoAstwDOYaAcLoAAAAASUVORK5CYII= + + + + iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAALVBMVEUAAAAAfv8Afv8Ad/8Afv8A + fv8Aff8Aff8Af/8Afv8Af/8Aff8Afv8Af/8Afv9+TCfvAAAADnRSTlMA5MYD3Jr17IuJSx3Wo4N5 + 2H8AAAAJcEhZcwAADsQAAA7EAZUrDhsAAABUSURBVCiRvY3ZCoAwDARjNr21//+5YorQSyg+dJ4G + hmSJdiG5QqqQG7pwKGMwxcz6xeeGZcWOG1Cu9Ve/AvM8BMBPgouPRNcHTsUSN0ECXoU/aRc35zgI + 8eK691UAAAAASUVORK5CYII= + + + + iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAALVBMVEUAAAAAeP8Afv8Afv8Afv8A + e/8Afv8Af/8AgP8Aff8AgP8Afv8Af/8Afv8Afv+RS+oMAAAADnRSTlMADNRdph/Ep0TmYFXDRfNw + SsgAAAAJcEhZcwAADsQAAA7EAZUrDhsAAABvSURBVCiRvZDbEoAgCEQFNG/F/39uUI1jJtNT7YPD + nFUWce5XASLMePLMPj1wWPjQGgae+VK+O3o/EkV90/NNQIVCUKXockBzAZkRolbNEMRUNIFIDnw3 + zFZm+Dmun4xrf7CtZBm45syX6Oy1f6cdwqsGnX1mG3QAAAAASUVORK5CYII= + + + + iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAclBMVEUAAAAAfv8Afv8Ahf8Afv8A + fv8Afv8Afv8AfP8Afv8Afv8Afv8Af/8Af/8Afv8AgP8Aff8Afv8AgP8Af/8Aff8AgP8Ae/8Afv8A + fv8Afv8Afv8Af/8Af/8Afv8Afv8Af/8Aff8Af/8Afv8Af/8Aff8Afv/G+dOvAAAAJXRSTlMA990F + 7Mumggm9tpJiW0UmrI1STCweDunf0s6pn5aIh3pwb2g/g62ubAAAAAlwSFlzAAAOxAAADsQBlSsO + GwAAAJZJREFUKJG9j0cWwyAMBb8oBpe4xXZ6j+5/xZiwEqyTWen9UQHgn4ylMdWYxfrEu743XOhE + 1HxdIz/wIPOZz7EoaBbiwV0sJn7KTQS0SzcBVAvh2GsqVYmFnRAtb3BnbtDwVl5XB8AarZVK3hs6 + C4XXOinxVAVx3Kc/R0XWkE1OBy78Jd0E3KJoM+GieGeiUyG3PhM/5AOdtQnIhXjAuAAAAABJRU5E + rkJgghjj + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/occupationlab/src/main/resources/excel-template/export.ftl b/occupationlab/src/main/resources/excel-template/export.ftl new file mode 100644 index 0000000..eabb225 --- /dev/null +++ b/occupationlab/src/main/resources/excel-template/export.ftl @@ -0,0 +1,2984 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 标准实验报告 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 基本信息 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 学生姓名 + + + + + + + + + + + + + + : + + + + + + + + + + + ${userName!} + + + + + + + + + + + + + + + + + + + + + + + + + + + 试验时间 + + + + + + + + + + + + + : + + + + + + + + + + + ${submitTime!} + + + + + + + + + + + + + + + + + + + + + + + + + + + 学生班级 + + + + + + + + + + + + + : + + + + + + + + + + + ${className!} + + + + + + + + + + + + + + + + + + + + 实验成绩 + + + + + + + + + + + + + : + + + + + + + + + + + ${score!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 学号 + + + + + + + + + + + + + : + + + + + + + + + + + ${workNumber!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验学时 + + + + + + + + + + + + + : + + + + + + + + + + + ${timeSum!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + 指导老师 + + + + + + + + + + + + + : + + + + + + + + + + + ${instructor!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验项目名称 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${projectName!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验目的 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${purpose!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验 + + + + + + + + + + + + + + + + + 数据 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 序号 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 判分点 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 参考答案 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 学生答案 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 得分 + + + + + <#list experimentalDataList as data> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.id!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.judgmentName!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.referenceAnswer!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.answer!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.score!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验总结与体会 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${summarize!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 87 + 290 + 0 + 0 + 1 + false + false + 616 + WPS Office_11.1.0.11365_F1E327BC-269C-435d-A152-05C5408002CA + 0 + + + + + + + 2022-03-25T03:10:00Z + Hello + Hello + 2022-03-25T03:26:55Z + 1 + + + + + + + + 2052-11.1.0.11365 + + + C90992013AE14A128CE039DC2F52DD41 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAElBMVEUAAAAAfv8Afv8Afv8Afv8A + fv+el/cYAAAABXRSTlMAqpfd2z124asAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAAkSURBVCiRY2Cg + G2BFBkRKMDNCAAu6BBOUxUS0UcPeDlIlaAoAstwDOYaAcLoAAAAASUVORK5CYII= + + + + iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAALVBMVEUAAAAAfv8Afv8Ad/8Afv8A + fv8Aff8Aff8Af/8Afv8Af/8Aff8Afv8Af/8Afv9+TCfvAAAADnRSTlMA5MYD3Jr17IuJSx3Wo4N5 + 2H8AAAAJcEhZcwAADsQAAA7EAZUrDhsAAABUSURBVCiRvY3ZCoAwDARjNr21//+5YorQSyg+dJ4G + hmSJdiG5QqqQG7pwKGMwxcz6xeeGZcWOG1Cu9Ve/AvM8BMBPgouPRNcHTsUSN0ECXoU/aRc35zgI + 8eK691UAAAAASUVORK5CYII= + + + + iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAALVBMVEUAAAAAeP8Afv8Afv8Afv8A + e/8Afv8Af/8AgP8Aff8AgP8Afv8Af/8Afv8Afv+RS+oMAAAADnRSTlMADNRdph/Ep0TmYFXDRfNw + SsgAAAAJcEhZcwAADsQAAA7EAZUrDhsAAABvSURBVCiRvZDbEoAgCEQFNG/F/39uUI1jJtNT7YPD + nFUWce5XASLMePLMPj1wWPjQGgae+VK+O3o/EkV90/NNQIVCUKXockBzAZkRolbNEMRUNIFIDnw3 + zFZm+Dmun4xrf7CtZBm45syX6Oy1f6cdwqsGnX1mG3QAAAAASUVORK5CYII= + + + + iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAclBMVEUAAAAAfv8Afv8Ahf8Afv8A + fv8Afv8Afv8AfP8Afv8Afv8Afv8Af/8Af/8Afv8AgP8Aff8Afv8AgP8Af/8Aff8AgP8Ae/8Afv8A + fv8Afv8Afv8Af/8Af/8Afv8Afv8Af/8Aff8Af/8Afv8Af/8Aff8Afv/G+dOvAAAAJXRSTlMA990F + 7Mumggm9tpJiW0UmrI1STCweDunf0s6pn5aIh3pwb2g/g62ubAAAAAlwSFlzAAAOxAAADsQBlSsO + GwAAAJZJREFUKJG9j0cWwyAMBb8oBpe4xXZ6j+5/xZiwEqyTWen9UQHgn4ylMdWYxfrEu743XOhE + 1HxdIz/wIPOZz7EoaBbiwV0sJn7KTQS0SzcBVAvh2GsqVYmFnRAtb3BnbtDwVl5XB8AarZVK3hs6 + C4XXOinxVAVx3Kc/R0XWkE1OBy78Jd0E3KJoM+GieGeiUyG3PhM/5AOdtQnIhXjAuAAAAABJRU5E + rkJggg== + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/occupationlab/src/main/resources/excel-template/exportBankExperimentReport.ftl b/occupationlab/src/main/resources/excel-template/exportBankExperimentReport.ftl new file mode 100644 index 0000000..7418bb6 --- /dev/null +++ b/occupationlab/src/main/resources/excel-template/exportBankExperimentReport.ftl @@ -0,0 +1,3102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 标准实验报告 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 基本信息 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 学生姓名 + + + + + + + + + + + + + + : + + + + + + + + + + + ${userName!} + + + + + + + + + + + + + + + + + + + + + + + + + + + 试验时间 + + + + + + + + + + + + + : + + + + + + + + + + + ${submitTime!} + + + + + + + + + + + + + + + + + + + + + + + + + + + 学生班级 + + + + + + + + + + + + + : + + + + + + + + + + + ${className!} + + + + + + + + + + + + + + + + + + + + 实验成绩 + + + + + + + + + + + + + : + + + + + + + + + + + ${score!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 学号 + + + + + + + + + + + + + : + + + + + + + + + + + ${workNumber!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验学时 + + + + + + + + + + + + + : + + + + + + + + + + + ${timeSum!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + 指导老师 + + + + + + + + + + + + + : + + + + + + + + + + + ${instructor!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验项目名称 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${projectName!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验目的 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${purpose!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验 + + + + + + + + + + + + + + + + + 数据 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 序号 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 判分点 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 考核点 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 参考答案 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 学生答案 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 得分 + + + + + <#list experimentalDataList as data> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.id!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.judgmentName!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.assessmentPoint!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.referenceAnswer!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.answer!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.score!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验总结与体会 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${summarize!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 91 + 317 + 0 + 0 + 151 + false + false + 643 + WPS Office_11.1.0.11365_F1E327BC-269C-435d-A152-05C5408002CA + 0 + + + + + + + 2022-03-25T03:10:00Z + Hello + Hello + 2022-03-25T06:12:21Z + 1 + + + + + + + + 2052-11.1.0.11365 + + + 74A242D1521E43DCAA703F29EF0E76BC + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAElBMVEUAAAAAfv8Afv8Afv8Afv8A + fv+el/cYAAAABXRSTlMAqpfd2z124asAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAAkSURBVCiRY2Cg + G2BFBkRKMDNCAAu6BBOUxUS0UcPeDlIlaAoAstwDOYaAcLoAAAAASUVORK5CYII= + + + + iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAALVBMVEUAAAAAfv8Afv8Ad/8Afv8A + fv8Aff8Aff8Af/8Afv8Af/8Aff8Afv8Af/8Afv9+TCfvAAAADnRSTlMA5MYD3Jr17IuJSx3Wo4N5 + 2H8AAAAJcEhZcwAADsQAAA7EAZUrDhsAAABUSURBVCiRvY3ZCoAwDARjNr21//+5YorQSyg+dJ4G + hmSJdiG5QqqQG7pwKGMwxcz6xeeGZcWOG1Cu9Ve/AvM8BMBPgouPRNcHTsUSN0ECXoU/aRc35zgI + 8eK691UAAAAASUVORK5CYII= + + + + iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAALVBMVEUAAAAAeP8Afv8Afv8Afv8A + e/8Afv8Af/8AgP8Aff8AgP8Afv8Af/8Afv8Afv+RS+oMAAAADnRSTlMADNRdph/Ep0TmYFXDRfNw + SsgAAAAJcEhZcwAADsQAAA7EAZUrDhsAAABvSURBVCiRvZDbEoAgCEQFNG/F/39uUI1jJtNT7YPD + nFUWce5XASLMePLMPj1wWPjQGgae+VK+O3o/EkV90/NNQIVCUKXockBzAZkRolbNEMRUNIFIDnw3 + zFZm+Dmun4xrf7CtZBm45syX6Oy1f6cdwqsGnX1mG3QAAAAASUVORK5CYII= + + + + iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAclBMVEUAAAAAfv8Afv8Ahf8Afv8A + fv8Afv8Afv8AfP8Afv8Afv8Afv8Af/8Af/8Afv8AgP8Aff8Afv8AgP8Af/8Aff8AgP8Ae/8Afv8A + fv8Afv8Afv8Af/8Af/8Afv8Afv8Af/8Aff8Af/8Afv8Af/8Aff8Afv/G+dOvAAAAJXRSTlMA990F + 7Mumggm9tpJiW0UmrI1STCweDunf0s6pn5aIh3pwb2g/g62ubAAAAAlwSFlzAAAOxAAADsQBlSsO + GwAAAJZJREFUKJG9j0cWwyAMBb8oBpe4xXZ6j+5/xZiwEqyTWen9UQHgn4ylMdWYxfrEu743XOhE + 1HxdIz/wIPOZz7EoaBbiwV0sJn7KTQS0SzcBVAvh2GsqVYmFnRAtb3BnbtDwVl5XB8AarZVK3hs6 + C4XXOinxVAVx3Kc/R0XWkE1OBy78Jd0E3KJoM+GieGeiUyG3PhM/5AOdtQnIhXjAuAAAAABJRU5E + rkJggg== + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/occupationlab/src/main/resources/excel-template/now.ftl b/occupationlab/src/main/resources/excel-template/now.ftl new file mode 100644 index 0000000..d117cb9 --- /dev/null +++ b/occupationlab/src/main/resources/excel-template/now.ftl @@ -0,0 +1,2090 @@ + + + + Administrator + rong + 2022-11-18T07:56:31Z + 2023-06-16T06:07:40Z + 4320 + 1 + 184 + 441 + 0 + 0 + 598 + 14 + + + 2052-11.1.0.13703 + ACD9B54CA54342F39DABFA5AFBBAC87E + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 标准实验报告 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 基本信息 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 学生姓名:${userName!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 学生学号:${workNumber!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验时间:${submitTime!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验成绩:${score!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 学生班级:${className!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 指导老师:${instructor!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验学时:${period!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验项目名称 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${projectName!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验目的 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${purpose!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验数据 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 序号 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 判分点 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 参考答案 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 分值 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 学生答案 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 运行结果 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 得分 + + + + + <#list experimentalDataList as data> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.id!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.judgmentName!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.referenceAnswer!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.quesScore!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.answer!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.runResult!} + + <#if data.runThePictureList??> + <#list data.runThePictureList as picture> + + + + + + + + + + + + + ${picture!} + + + + + + + + + + + + + + + + + <#-- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.quesScore!} + + + --> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.score!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验总结与体会 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${summarize!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/occupationlab/src/main/resources/excel-template/practiceScoreList.ftl b/occupationlab/src/main/resources/excel-template/practiceScoreList.ftl new file mode 100644 index 0000000..1c52664 --- /dev/null +++ b/occupationlab/src/main/resources/excel-template/practiceScoreList.ftl @@ -0,0 +1,886 @@ + + + + Administrator + rong + 2023-07-31T09:46:07Z + 2023-07-31T09:50:25Z + 4320 + 1 + 32 + 32 + 0 + 0 + 32 + 14 + + + 2052-11.1.0.13703 + 00B6E100E7F8430F9122B2E4FC014355 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 课程名称:${goodsName} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 班级名称:${className} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 导出时间:${derivationTime} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 姓名 + + + + + + + + + + + + + + + + + + + + + + + + 学号 + + + + + + + + + + + + + + + + + + + + + + + + 项目名称 + + + + + + + + + + + + + + + + + + + + + + + + 平均练习时长 + + + + + + + + + + + + + + + + + + + + + + + + 平均分 + + + + + + <#list practicePerformanceData as data> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.userName!} + + + + + + + + + + + + + + + + + + + + + + + + 4533 + + + + + + + + + + + + + + + + + + + + + + + + 科目一 + + + + + + + + + + + + + + + + + + + + + + + + 90min + + + + + + + + + + + + + + + + + + + + + + + + 90 + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/occupationlab/src/main/resources/excel-template/programmingClassExperimentReportExport.ftl b/occupationlab/src/main/resources/excel-template/programmingClassExperimentReportExport.ftl new file mode 100644 index 0000000..cf56b20 --- /dev/null +++ b/occupationlab/src/main/resources/excel-template/programmingClassExperimentReportExport.ftl @@ -0,0 +1,1891 @@ + + + + + Administrator + rong + 2022-11-18T07:56:31Z + 2023-06-16T03:41:06Z + 1440 + 1 + 176 + 453 + 0 + 0 + 610 + 14 + + + 2052-11.1.0.13703 + 99E93BE3C2BE433DB3FC698D72A4D84E + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 标准实验报告 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 基本信息 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 学生姓名:${userName!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 学生学号:${workNumber!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验时间:${submitTime!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验成绩:${score!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 学生班级:${className!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 指导老师:${instructor!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验学时:${timeSum!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验项目名称 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${projectName!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验目的 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${purpose!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验数据 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 序号 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 判分点 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 参考答案 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 学生答案 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 学生运行结果 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 得分 + + + + + + <#list experimentalDataList as data> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.id!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.judgmentName!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.referenceAnswer!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.answer!} + + + + <#if data.runThePictureList??> + <#list data.runThePictureList as picture> + + + + + + + + + + + + + ${picture!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.runResult!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.score!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验总结与体会 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${summarize!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/occupationlab/src/main/resources/excel-template/python.ftl b/occupationlab/src/main/resources/excel-template/python.ftl new file mode 100644 index 0000000..f3812b6 --- /dev/null +++ b/occupationlab/src/main/resources/excel-template/python.ftl @@ -0,0 +1,2072 @@ + + + + + Administrator + rong + 2022-11-18T07:56:31Z + 2023-06-20T02:49:24Z + 2880 + 1 + 200 + 441 + 0 + 0 + 519 + 14 + + + 2052-11.1.0.13703 + D99024E4D5AF470BA29A9E76AF6CE8C6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 标准实验报告 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 基本信息 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 学生姓名:${userName!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 学生学号:${workNumber!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验时间:${submitTime!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验成绩:${score!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 学生班级:${className!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 指导老师:${instructor!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验学时:${period!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验项目名称 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${projectName!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验目的 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${purpose!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验数据 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 序号 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 判分点 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 参考答案 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 学生答案 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 学生运行结果 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 分值 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 得分 + + + + + <#list experimentalDataList as data> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.id!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.judgmentName!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.referenceAnswer!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.answer!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.runResult!} + + <#if data.runThePictureList??> + <#list data.runThePictureList as picture> + + + + + + + + + + + + + + ${picture!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.quesScore!} + + <#-- + + + + + + + + + + + + + --> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.score!} + + <#-- + + + + + + + + + + + + + --> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验总结与体会 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${summarize!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/occupationlab/src/main/resources/excel-template/rong.ftl b/occupationlab/src/main/resources/excel-template/rong.ftl new file mode 100644 index 0000000..0889020 --- /dev/null +++ b/occupationlab/src/main/resources/excel-template/rong.ftl @@ -0,0 +1,2054 @@ + + + + + Administrator + rong + 2022-11-18T07:56:31Z + 2023-06-19T10:24:58Z + 0 + 2 + 196 + 452 + 0 + 0 + 610 + 14 + + + 2052-11.1.0.13703 + EF7DFBDD3EB5435B8946A481C09D6EAA + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 标准实验报告 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 基本信息 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 学生姓名:${userName!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 学生学号:${workNumber!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验时间:${submitTime!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验成绩:${score!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 学生班级:${className!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 指导老师:${instructor!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验学时:${period!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验项目名称 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${projectName!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验目的 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${purpose!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验数据 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 序号 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 判分点 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 参考答案 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 学生答案 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 学生运行结果 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 分值 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 得分 + + + + + <#list experimentalDataList as data> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.id!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.judgmentName!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.referenceAnswer!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.answer!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.runResult!} + + <#if data.runThePictureList??> + <#list data.runThePictureList as picture> + + + + + + + + + + + + + ${picture!} + + + + + + + + + + + + + + + <#-- + + + + + + + + + + + + + + + + + + + + + + --> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.quesScore!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${data.score!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 实验总结与体会 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${summarize!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/occupationlab/src/main/resources/excel-template/员工导入失败数据导出模板.xlsx b/occupationlab/src/main/resources/excel-template/员工导入失败数据导出模板.xlsx new file mode 100644 index 0000000..817bfe0 Binary files /dev/null and b/occupationlab/src/main/resources/excel-template/员工导入失败数据导出模板.xlsx differ diff --git a/occupationlab/src/main/resources/excel-template/学生导入失败数据导出模板.xlsx b/occupationlab/src/main/resources/excel-template/学生导入失败数据导出模板.xlsx new file mode 100644 index 0000000..5aaf60f Binary files /dev/null and b/occupationlab/src/main/resources/excel-template/学生导入失败数据导出模板.xlsx differ diff --git a/occupationlab/src/main/resources/excel-template/练习实验成绩.xlsx b/occupationlab/src/main/resources/excel-template/练习实验成绩.xlsx new file mode 100644 index 0000000..61557ad Binary files /dev/null and b/occupationlab/src/main/resources/excel-template/练习实验成绩.xlsx differ diff --git a/occupationlab/src/main/resources/excel-template/试题导入失败数据导出模板.xlsx b/occupationlab/src/main/resources/excel-template/试题导入失败数据导出模板.xlsx new file mode 100644 index 0000000..96a1301 Binary files /dev/null and b/occupationlab/src/main/resources/excel-template/试题导入失败数据导出模板.xlsx differ diff --git a/occupationlab/src/test/java/com/huoran/occupationlab/OccupationlabApplicationTests.java b/occupationlab/src/test/java/com/huoran/occupationlab/OccupationlabApplicationTests.java new file mode 100644 index 0000000..08e8927 --- /dev/null +++ b/occupationlab/src/test/java/com/huoran/occupationlab/OccupationlabApplicationTests.java @@ -0,0 +1,153 @@ +/* +package com.huoran.occupationlab; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.huoran.api.JudgmentPointClient; +import com.huoran.occupationlab.entity.HrProject; +import com.huoran.occupationlab.entity.HrScore; +import com.huoran.occupationlab.entity.ProjectJudgment; +import com.huoran.occupationlab.entity.ProjectManage; +import com.huoran.occupationlab.mapper.ProjectJudgmentMapper; +import com.huoran.occupationlab.mapper.ProjectManageMapper; +import org.apache.http.HttpEntity; +import org.apache.http.HttpStatus; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.util.EntityUtils; +import org.junit.jupiter.api.Test; +import org.junit.runner.RunWith; +import org.springframework.amqp.core.AmqpAdmin; +import org.springframework.amqp.core.DirectExchange; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.util.ObjectUtils; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +*/ +/** + * 迁移项目管理已经项目管理中间表 + *//* + +@RunWith(SpringRunner.class) +@SpringBootTest +class OccupationlabApplicationTests { + + @Autowired + private ProjectManageMapper projectManageMapper; + + @Autowired + private ProjectJudgmentMapper projectJudgmentMapper; + + @Autowired + private JudgmentPointClient judgmentPointClient; + + @Autowired + AmqpAdmin amqpAdmin; + + @Test + void create() { + DirectExchange directExchange = new DirectExchange("java-exchanges",true,false); + amqpAdmin.declareExchange(directExchange); + } + + @Test + void contextLoads() { + + //判分点绑定为空 + List ret = new ArrayList<>(); + List retJudg = new ArrayList<>(); + + List ids = Arrays.asList(); + for (Integer id : ids) { + CloseableHttpClient httpClient = HttpClientBuilder.create().build(); + HttpGet httpGet = new HttpGet("http://www.occupationlab.com/project/ProjectManagement/getProjectId?projectId=" + id); + CloseableHttpResponse response = null; + + try { + response = httpClient.execute(httpGet);//执行请求 + if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {//请求成功执行 + HttpEntity entity = response.getEntity();//获取返回的数据 + String s = EntityUtils.toString(entity);//转换成字符串 + JSONObject datas = JSONObject.parseObject(s);//转换成JSON格式 + Integer status = (Integer) datas.get("status");//获取返回数据状态,get获取的字段需要根据提供的返回值去获取 + if (status == 200) {//返回的状态 + JSONArray data = JSONArray.parseArray(datas.get("message").toString()); + JSONObject Project = JSONObject.parseObject(data.get(0).toString()); + JSONArray Score = JSONArray.parseArray(data.get(1).toString()); + + HrProject hrProject = JSONObject.parseObject(Project.toString(), HrProject.class); + List hrScores = JSONArray.parseArray(Score.toString(), HrScore.class); + + if (ObjectUtils.isEmpty(hrProject)){ + + } + ProjectManage projectManage = new ProjectManage(); + projectManage.setProjectName(hrProject.getProjectName()); + projectManage.setState(hrProject.getState()); + projectManage.setPermissions(hrProject.getProjectPermissions()); + projectManage.setExperimentTarget(hrProject.getExperimentalGoal()); + projectManage.setExperimentDescription(hrProject.getCaseDescription()); + projectManage.setExperimentHint(hrProject.getExperimentSuggests()); + projectManage.setHintOpen(hrProject.getExperimentIntroductionIsEnable()); + projectManage.setIsDel(0); + projectManage.setIsOpen(0); + projectManage.setZtOpen(0); + projectManage.setZtDel(0); + projectManage.setFounder(0); + + + projectManage.setSystemId(10); + projectManageMapper.insert(projectManage); + + if (ObjectUtils.isEmpty(hrScores)){ + ret.add(hrProject.getProjectName()); + }else { + int i = 1; + List bands = new ArrayList<>(); + for (HrScore hrScore : hrScores) { + //查询对应判分点分数id + Integer bcId = projectJudgmentMapper.tempSelectBcId(hrScore.getJudgmentPointsName(),hrScore.getExperimentalRequirements()); + + //新增中间表 + ProjectJudgment projectJudgment = new ProjectJudgment(); + projectJudgment.setScore(hrScore.getScore()); + projectJudgment.setProjectId(projectManage.getProjectId()); + projectJudgment.setJudgmentId(bcId); + projectJudgment.setSort(i++); + projectJudgmentMapper.insert(projectJudgment); + + Thread.sleep(1000); + //判分点绑定中间表 + int bandcount = judgmentPointClient.bcBandingProject(bcId, projectManage.getProjectId(),1); + bands.add(bandcount); + } + if (bands.size() != hrScores.size()){ + retJudg.add(hrProject.getProjectName()); + } + } + + } + } + + } catch (IOException e) { + e.printStackTrace(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + ret.stream().peek((r) -> System.out.println(r)); + ret.forEach((r) -> System.out.println(r)); + retJudg.forEach((r) -> System.out.println()); + } + +} +*/ diff --git a/occupationlab/src/test/java/com/huoran/occupationlab/code/CodeGenerator.java b/occupationlab/src/test/java/com/huoran/occupationlab/code/CodeGenerator.java new file mode 100644 index 0000000..74b14c7 --- /dev/null +++ b/occupationlab/src/test/java/com/huoran/occupationlab/code/CodeGenerator.java @@ -0,0 +1,81 @@ +package com.huoran.occupationlab.code; + +import com.baomidou.mybatisplus.annotation.DbType; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.generator.AutoGenerator; +import com.baomidou.mybatisplus.generator.config.DataSourceConfig; +import com.baomidou.mybatisplus.generator.config.GlobalConfig; +import com.baomidou.mybatisplus.generator.config.PackageConfig; +import com.baomidou.mybatisplus.generator.config.StrategyConfig; +import com.baomidou.mybatisplus.generator.config.rules.DateType; +import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; +import org.junit.Test; + +/** + * @Author chen + * @DATE 2021/8/10 15:42 + * @Version 1.0 + */ +public class CodeGenerator { + + @Test + public void run() { + + // 1、创建代码生成器 + AutoGenerator mpg = new AutoGenerator(); + + // 2、全局配置 + GlobalConfig gc = new GlobalConfig(); + String projectPath = System.getProperty("user.dir"); + gc.setOutputDir(projectPath + "/src/main/java"); + + + gc.setAuthor("lr");//设置作者 + gc.setOpen(false); //生成后是否打开资源管理器 + gc.setFileOverride(false); //重新生成时文件是否覆盖 + gc.setServiceName("%sService"); //去掉Service接口的首字母I + gc.setIdType(IdType.ID_WORKER_STR); //主键策略 + gc.setDateType(DateType.ONLY_DATE);//定义生成的实体类中日期类型 + gc.setSwagger2(true);//开启Swagger2模式 + + mpg.setGlobalConfig(gc); + + // 3、数据源配置 + DataSourceConfig dsc = new DataSourceConfig(); + dsc.setUrl("jdbc:mysql://139.9.47.170:3306/occupationlab?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8"); + dsc.setDriverName("com.mysql.cj.jdbc.Driver"); + dsc.setUsername("root"); + dsc.setPassword("HuoRan@2021"); + dsc.setDbType(DbType.MYSQL); + mpg.setDataSource(dsc); + + // 4、包配置 + PackageConfig pc = new PackageConfig(); + pc.setParent("com.huoran.occupationlab"); + //pc.setModuleName("occupationlab"); //模块名 + pc.setController("controller"); + pc.setEntity("entity"); + pc.setService("service"); + pc.setServiceImpl("service.impl"); + pc.setMapper("mapper"); + mpg.setPackageInfo(pc); + + // 5、策略配置 + StrategyConfig strategy = new StrategyConfig(); + strategy.setInclude("ol_school_project_hint_open"); + strategy.setNaming(NamingStrategy.underline_to_camel);//数据库表映射到实体的命名策略 + strategy.setTablePrefix("ol_"); //生成实体时去掉表前缀 + + strategy.setColumnNaming(NamingStrategy.underline_to_camel);//数据库表字段映射到实体的命名策略 + strategy.setEntityLombokModel(true); // lombok 模型 @Accessors(chain = true) setter链式操作 + + strategy.setRestControllerStyle(true); //restful api风格控制器 + strategy.setControllerMappingHyphenStyle(true); //url中驼峰转连字符 + + mpg.setStrategy(strategy); + + + // 6、执行 + mpg.execute(); + } +} diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..2cacb9e --- /dev/null +++ b/pom.xml @@ -0,0 +1,241 @@ + + + 4.0.0 + + common + gateway + nakadai + users + occupationlab + api + competition + websocket + + + + org.springframework.boot + spring-boot-starter-parent + 2.2.9.RELEASE + + com.huoran.parent + huoran + 1.0-SNAPSHOT + pom + huoran + 项目父工程 + + + 1.8 + UTF-8 + UTF-8 + 3.0.5 + 3.3.2 + 2.0 + 2.9.2 + 1.9.3 + 1.5.21 + 2.6 + 2.1.1 + 4.3.3 + 3.1.0 + 2.15.2 + 1.4.14 + 1.4.11 + 0.2.2.RELEASE + 4.0.1 + 4.0.1 + 4.1.3 + 4.1.3 + 4.1.3 + 2.3.28 + Hoxton.SR8 + 2.2.3.RELEASE + 2.3.2.RELEASE + 1.2.61 + 3.17.4 + 1.4.0 + 2.3.2 + + + + + + com.aliyun + aliyun-java-sdk-imm + 1.15.7 + + + + com.alibaba + fastjson + ${fastjson.version} + + + + + org.redisson + redisson-spring-boot-starter + ${redisson.version} + + + + + org.springframework.cloud + spring-cloud-dependencies + Hoxton.RELEASE + pom + import + + + + org.springframework.cloud + spring-cloud-alibaba-dependencies + ${cloud-alibaba.version} + pom + import + + + + + com.baomidou + mybatis-plus-boot-starter + ${mybatis-plus.version} + + + + com.baomidou + dynamic-datasource-spring-boot-starter + ${dynamic.version} + + + + + org.apache.velocity + velocity-engine-core + ${velocity.version} + + + + + + com.github.xiaoymin + swagger-bootstrap-ui + ${swagger-ui.version} + + + io.springfox + springfox-swagger2 + ${swagger.version} + + + + io.springfox + springfox-swagger-ui + ${swagger.version} + + + io.swagger + swagger-annotations + ${swagger-models.version} + + + io.swagger + swagger-models + ${swagger-models.version} + + + + com.alibaba + easyexcel + ${easyexcel-version} + + + + commons-io + commons-io + ${commons-io.version} + + + + com.aliyun.oss + aliyun-sdk-oss + ${aliyun-sdk-oss.version} + + + + com.aliyun + aliyun-java-sdk-vod + ${aliyun-java-sdk-vod.version} + + + + com.aliyun + aliyun-sdk-vod-upload + ${aliyun-sdk-vod-upload.version} + + + + + + + cn.afterturn + easypoi-base + ${easypoi-base.version} + + + cn.afterturn + easypoi-web + ${easypoi-web.version} + + + cn.afterturn + easypoi-annotation + ${easypoi-annotation.version} + + + + org.apache.poi + poi-ooxml + ${poi-ooxml.version} + + + org.apache.poi + poi + ${poi.version} + + + org.freemarker + freemarker + ${freemarker.version} + + + + + org.apache.shiro + shiro-spring + ${shiro.version} + + + + + org.quartz-scheduler + quartz + ${quartz.version} + + + com.mchange + c3p0 + + + com.zaxxer + HikariCP-java6 + + + + + + + + \ No newline at end of file diff --git a/users/pom.xml b/users/pom.xml new file mode 100644 index 0000000..83328d9 --- /dev/null +++ b/users/pom.xml @@ -0,0 +1,113 @@ + + + 4.0.0 + + huoran + com.huoran.parent + 1.0-SNAPSHOT + + + com.huoran + users + 1.0.0 + users + jar + 多平台用户统一管理 + + + 1.8 + UTF-8 + UTF-8 + + + + + com.github.binarywang + weixin-java-miniapp + 3.6.0 + + + + org.springframework.boot + spring-boot-starter-actuator + + + + com.huoran.common + common + 0.0.1-SNAPSHOT + + + + com.huoran.api + api + 1.0-SNAPSHOT + compile + + + + com.github.whvcse + easy-captcha + 1.6.2 + + + + org.springframework.boot + spring-boot-starter + + + + org.springframework.boot + spring-boot-starter-test + test + + + + org.apache.poi + poi-ooxml + + + org.apache.poi + poi + + + + + + + + + src/main/java + + **/*.xml + + + + src/main/resources + + **/*.properties + **/*.xlsx + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + true + + + + + + diff --git a/users/src/main/java/com/huoran/users/UsersApplication.java b/users/src/main/java/com/huoran/users/UsersApplication.java new file mode 100644 index 0000000..edee6d6 --- /dev/null +++ b/users/src/main/java/com/huoran/users/UsersApplication.java @@ -0,0 +1,21 @@ +package com.huoran.users; + +import org.mybatis.spring.annotation.MapperScan; +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; + +@SpringBootApplication +@EnableDiscoveryClient +@EnableFeignClients(basePackages = "com.huoran.api") +@MapperScan(basePackages = "com.huoran.users.mapper") +@ComponentScan(basePackages = {"com.huoran"}) +public class UsersApplication { + + public static void main(String[] args) { + SpringApplication.run(UsersApplication.class, args); + } + +} diff --git a/users/src/main/java/com/huoran/users/config/SwaggerConfig.java b/users/src/main/java/com/huoran/users/config/SwaggerConfig.java new file mode 100644 index 0000000..85a345a --- /dev/null +++ b/users/src/main/java/com/huoran/users/config/SwaggerConfig.java @@ -0,0 +1,67 @@ +package com.huoran.users.config; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.ParameterBuilder; +import springfox.documentation.builders.PathSelectors; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.schema.ModelRef; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.service.Parameter; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger.web.DocExpansion; +import springfox.documentation.swagger.web.OperationsSorter; +import springfox.documentation.swagger.web.UiConfiguration; +import springfox.documentation.swagger.web.UiConfigurationBuilder; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +import java.util.ArrayList; +import java.util.List; + +@Configuration +@EnableSwagger2 +@Profile({"dev","test"}) +public class SwaggerConfig { + + @Bean + public Docket createRestApi() { + // 构造token给测试的时候填写 + ParameterBuilder tokenPar = new ParameterBuilder(); + List pars = new ArrayList(); + tokenPar.name("token").description("用户令牌(不需用户鉴权的不需要传)").modelRef(new ModelRef("string")).parameterType("header") + .required(false).build(); + pars.add(tokenPar.build()); + + return new Docket(DocumentationType.SWAGGER_2) + .apiInfo(apiInfo()) + .select() + .apis(RequestHandlerSelectors.basePackage("com.huoran.users.controller")) + .apis(RequestHandlerSelectors.withClassAnnotation(Api.class)) + .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) + .paths(PathSelectors.any()) + .build().globalOperationParameters(pars); + } + + + + @Bean + UiConfiguration uiConfig() { + return UiConfigurationBuilder.builder().docExpansion(DocExpansion.LIST).operationsSorter(OperationsSorter.ALPHA).build(); + } + + private ApiInfo apiInfo() { + return new ApiInfoBuilder() + .title("用户管理微服务接口文档") + .description("Rong") + .contact("developer@mail.com") + .version("1.0") + .build(); + } + + +} \ No newline at end of file diff --git a/users/src/main/java/com/huoran/users/config/WeChatConfig.java b/users/src/main/java/com/huoran/users/config/WeChatConfig.java new file mode 100644 index 0000000..3c26df5 --- /dev/null +++ b/users/src/main/java/com/huoran/users/config/WeChatConfig.java @@ -0,0 +1,69 @@ +package com.huoran.users.config; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; + +import java.io.Serializable; + +/** + * 微信配置类 + */ +@Configuration +@Data +@NoArgsConstructor +@AllArgsConstructor +public class WeChatConfig implements Serializable { + + /** + * 开放平台appid + */ + @Value("${wxopen.appid}") + private String openAppid; + + /** + * 开放平台appsecret + */ + @Value("${wxopen.appsecret}") + private String openAppsecret; + + /** + * 开放平台回调url + */ + @Value("${wxopen.redirect_url}") + private String openRedirectUrl; + + /** + * 绑定微信回调url + */ + @Value("${wxopen.wechat_binding_redirect_url}") + private String weChatBindingRedirectUrl; + + /** + * 微信开放平台二维码连接 + */ + private String OPEN_QRCODE_URL= "https://open.weixin.qq.com/" + + "connect/qrconnect?appid=%s&redirect_uri=%s&response_type=code&scope=snsapi_login&state=%s#wechat_redirect"; + + /** + * 开放平台获取access_token地址 + */ + private String OPEN_ACCESS_TOKEN_URL="https://api.weixin.qq.com/sns/oauth2/access_token?appid=%s&secret=%s&code=%s&grant_type=authorization_code"; + + /** + * 获取用户信息 + */ + private String OPEN_USER_INFO_URL ="https://api.weixin.qq.com/sns/userinfo?access_token=%s&openid=%s&lang=zh_CN"; + + // 设置@Value注解取值不到忽略(不报错) + @Bean + public static PropertySourcesPlaceholderConfigurer placeholderConfigurer() { + PropertySourcesPlaceholderConfigurer c = new PropertySourcesPlaceholderConfigurer(); + c.setIgnoreUnresolvablePlaceholders(true); + return c; + } +} diff --git a/users/src/main/java/com/huoran/users/config/WeChatPropertiesUtil.java b/users/src/main/java/com/huoran/users/config/WeChatPropertiesUtil.java new file mode 100644 index 0000000..81395e0 --- /dev/null +++ b/users/src/main/java/com/huoran/users/config/WeChatPropertiesUtil.java @@ -0,0 +1,52 @@ +package com.huoran.users.config; + +import org.springframework.beans.factory.InitializingBean; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +/** + * @Author chen + * @DATE 2020/9/8 13:57 + * @Version 1.0 + */ +@Component +public class WeChatPropertiesUtil implements InitializingBean { + + @Value("${partner.wxopen.appid}") + private String partnerAppId; + + @Value("${partner.wxopen.appsecret}") + private String partnerAppSecret; + + @Value("${partner.wxopen.redirect_url}") + private String partnerRedirectUrl; + + + @Value("${operation.wxopen.appid}") + private String operationAppId; + + @Value("${operation.wxopen.appsecret}") + private String operationAppSecret; + + @Value("${operation.wxopen.redirect_url}") + private String operationRedirectUrl; + + public static String PARTNER_WX_OPEN_APP_ID; + public static String PARTNER_WX_OPEN_APP_SECRET; + public static String PARTNER_WX_OPEN_REDIRECT_URL; + + + public static String OPERATION_WX_OPEN_APP_ID; + public static String OPERATION_WX_OPEN_APP_SECRET; + public static String OPERATION_WX_OPEN_REDIRECT_URL; + + @Override + public void afterPropertiesSet() throws Exception { + PARTNER_WX_OPEN_APP_ID = partnerAppId; + PARTNER_WX_OPEN_APP_SECRET = partnerAppSecret; + PARTNER_WX_OPEN_REDIRECT_URL = partnerRedirectUrl; + OPERATION_WX_OPEN_APP_ID = operationAppId; + OPERATION_WX_OPEN_APP_SECRET = operationAppSecret; + OPERATION_WX_OPEN_REDIRECT_URL = operationRedirectUrl; + } +} diff --git a/users/src/main/java/com/huoran/users/controller/AppletMyController.java b/users/src/main/java/com/huoran/users/controller/AppletMyController.java new file mode 100644 index 0000000..874cfee --- /dev/null +++ b/users/src/main/java/com/huoran/users/controller/AppletMyController.java @@ -0,0 +1,108 @@ +package com.huoran.users.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.huoran.common.constant.DelConstant; +import com.huoran.common.constant.PlatformConstant; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.users.entity.HrUserAccount; +import com.huoran.users.entity.vo.CheckVo; +import com.huoran.users.service.IHrUserAccountService; +import com.huoran.users.service.IHrUserInfoService; +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.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletRequest; + + +@Api(value = "小程序-我的", tags = "小程序-我的") +@RestController +@RequestMapping("/users/applets/mine") +public class AppletMyController { + + + @Autowired + public IHrUserInfoService userInfoService; + + @Autowired + public IHrUserAccountService userAccountService; + + + @ApiOperation(value = "更改手机号") + @PostMapping("/changePhoneNumber") + public R changePhoneNumber(@RequestParam(name = "phone", required = true) @ApiParam(value = "要更改的手机号") String phone, + @RequestParam(name = "code", required = true) @ApiParam(value = "验证码") String code, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + + CheckVo checkVo = new CheckVo(); + checkVo.setOpener(code); + checkVo.setPhone(phone); + return userAccountService.changePhoneNumber(checkVo,Integer.valueOf(accountId)); + } + + + + @ApiOperation(value = "更改账号前判断账号是否存在") + @PostMapping("/checkIfAnAccountExists") + public R checkIfAnAccountExists(@RequestParam(name = "account", required = true) @ApiParam(value = "账号") String account, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + queryWrapper.eq("account",account); + + HrUserAccount userAccount = userAccountService.getOne(queryWrapper); + if (userAccount!=null){ + if (accountId.equals(String.valueOf(userAccount.getId()))){ + return R.ok(); + } + return R.error("账号已存在!"); + }else { + return R.ok(); + } + + + } + + + @ApiOperation(value = "更改手机号前判断该手机号是否存在") + @PostMapping("/checkIfThePhoneNumberExists") + public R checkIfThePhoneNumberExists(@RequestParam(name = "phone", required = true) @ApiParam(value = "手机号") String phone, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + queryWrapper.eq("phone",phone); + queryWrapper.eq("platform_id", PlatformConstant.ACCESSORY); + HrUserAccount userAccount = userAccountService.getOne(queryWrapper); + if (userAccount!=null){ + /*if (String.valueOf(userAccount.getId()).equals(accountId)&&userAccount.getPhone().equals(phone)){ + return R.error("更改的号码不能为当前号码!"); + }*/ + return R.error("当前手机号已存在,请更换手机号!"); + }else { + return R.ok(); + } + + + } + + @ApiOperation(value = "更改账号") + @PostMapping("/changeAccount") + public R changeAccount(@RequestParam(name = "account", required = true) @ApiParam(value = "账号") String account, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.set("account",account); + updateWrapper.eq("is_del", DelConstant.NOT_DEL); + updateWrapper.eq("id",accountId); + + boolean result = userAccountService.update(new HrUserAccount(),updateWrapper); + return result?R.ok():R.error(); + } + +} diff --git a/users/src/main/java/com/huoran/users/controller/DataPermissionController.java b/users/src/main/java/com/huoran/users/controller/DataPermissionController.java new file mode 100644 index 0000000..dbc6cab --- /dev/null +++ b/users/src/main/java/com/huoran/users/controller/DataPermissionController.java @@ -0,0 +1,38 @@ +package com.huoran.users.controller; + + +import com.huoran.common.constant.PlatformConstant; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.users.entity.DataPermission; +import com.huoran.users.entity.HrPersonalFile; +import com.huoran.users.entity.HrUserAccount; +import com.huoran.users.entity.HrUserInfo; +import com.huoran.users.entity.vo.UserPersonalEntityVo; +import com.huoran.users.service.DataPermissionService; +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 javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + *

+ * 前端控制器 + *

+ * + * @author chen + * @since 2022-10-13 + */ + +@Api(tags = "数据权限管理") +@RestController +@RequestMapping("/users/dataPermission") +public class DataPermissionController { + + +} + diff --git a/users/src/main/java/com/huoran/users/controller/DataUserInfoController.java b/users/src/main/java/com/huoran/users/controller/DataUserInfoController.java new file mode 100644 index 0000000..80b3f84 --- /dev/null +++ b/users/src/main/java/com/huoran/users/controller/DataUserInfoController.java @@ -0,0 +1,368 @@ +package com.huoran.users.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.huoran.api.UserClient; +import com.huoran.common.constant.DelConstant; +import com.huoran.common.constant.PlatformConstant; +import com.huoran.common.response.R; +import com.huoran.common.utils.DateUtils; +import com.huoran.common.utils.MD5; +import com.huoran.common.utils.TokenUtils; +import com.huoran.users.entity.HrUserAccount; +import com.huoran.users.entity.HrUserInfo; +import com.huoran.users.entity.req.DataUserListReq; +import com.huoran.users.entity.req.ModifyUserInfoReq; +import com.huoran.users.entity.req.SaveUserInfoReq; +import com.huoran.users.entity.res.DataUserInfoResp; +import com.huoran.users.entity.res.UserRoleResp; +import com.huoran.users.service.IHrUserAccountService; +import com.huoran.users.service.IHrUserInfoService; +import com.huoran.users.service.UserRoleService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.util.List; +import java.util.Map; + +/** + *

+ * 用户信息表 前端控制器 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@RestController +@RequestMapping("/users/data/user") +@Api(value = "API - 用户管理", tags = "数据平台-用户管理") +public class DataUserInfoController { + + @Autowired + public IHrUserInfoService service; + + @Autowired + public IHrUserAccountService accountService; + + @Autowired + private UserClient userClient; + + @Autowired + private UserRoleService userRoleService; + + /** + * 新增用户 + * + * @param hrUserInfo + * @return + */ + @PostMapping("/save") + @ApiOperation(value = "新增用户") + public R save(@RequestBody @Valid SaveUserInfoReq hrUserInfo, HttpServletRequest request) { + + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + hrUserInfo.setSchoolId(schoolId); + //统计该院校下可启用的账号数量 + int availableNum = accountService.getAvailableNum(hrUserInfo.getSchoolId()); + + //查询现在该院校已启用的账号数量 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("school_id", hrUserInfo.getSchoolId()); + queryWrapper.eq("is_enable", DelConstant.IS_ENABLE); + List getNum = accountService.list(queryWrapper); + + //设置默认密码 + hrUserInfo.setPassword(MD5.encrypt("1122aa")); + HrUserInfo userInfo = new HrUserInfo(); + userInfo.setRoleId("0"); + BeanUtils.copyProperties(hrUserInfo, userInfo); + HrUserAccount userAccount = new HrUserAccount(); + BeanUtils.copyProperties(hrUserInfo, userAccount); + availableNum = availableNum - 1;//todo 减1是因为客户也包含了算启用的用户 + + //判断该院校已启用账户总数量是否小于该院校可启用的账户数量 + if (getNum.size() <= availableNum) { + userAccount.setIsEnable(DelConstant.IS_ENABLE);//设置为已启用 + } else { + userAccount.setIsEnable(DelConstant.NO_ENABLE);//设置为未启用 + } + boolean ret1 = service.save(userInfo); + userAccount.setUserId(userInfo.getUserId()); + userAccount.setPlatformId(PlatformConstant.DATA_PLATFORM + ""); + userAccount.setRoleId("0"); + boolean ret2 = accountService.save(userAccount); + + //账号赋予角色 + userClient.rolePermissionService(userAccount.getId(), hrUserInfo.getRoleIds(),null); + + return ret1 && ret2 ? R.ok() : R.error("新增失败"); + + } + + /** + * 编辑用户 + * + * @param hrUserInfo + * @return + */ + @PostMapping("/modify") + @ApiOperation(value = "编辑用户") + public R modify(@RequestBody @Valid ModifyUserInfoReq hrUserInfo, HttpServletRequest request) { + + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + //当要启用用户时候判断该院校的可启用账号是否还能再启用 + if (hrUserInfo.getIsEnable() == DelConstant.IS_ENABLE) { + //查询现在该院校已启用的账号数量 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("school_id", schoolId); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + queryWrapper.eq("is_enable", DelConstant.IS_ENABLE); + //增加限制只统计数据平台的用户已启用账户数量 2023.10.23 + queryWrapper.last(" AND FIND_IN_SET( platform_id, '2' ) "); + List getNum = accountService.list(queryWrapper); + + //统计该院校下可启用的账号数量 + int availableNum = accountService.getAvailableNum(Integer.valueOf(schoolId)); + + + + + availableNum = availableNum - 1;//todo 减1是因为客户也包含了算启用的用户 + if (availableNum < getNum.size()) { + return R.error("可启用账户数量不足"); + } + } + + //账号 用户姓名 账户角色 手机号 邮箱 学号工号 + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.set("account", hrUserInfo.getAccount()); + updateWrapper.set("work_number", hrUserInfo.getWorkNumber()); + + //查询原来该用户的角色信息 + List roleRespList = userRoleService.getUserRoleByAccountId(hrUserInfo.getAccountId()); + + if (roleRespList.size() > 0) { + for (UserRoleResp roleResp : roleRespList) { + //删除该用户原有角色 + userClient.delRoleByAccountId(roleResp.getRoleId(), hrUserInfo.getAccountId()); + } + } + + //重新账号赋予角色 + userClient.rolePermissionService(hrUserInfo.getAccountId(), hrUserInfo.getRoleIds(),null); + if (hrUserInfo.getIsEnable() != null) { + updateWrapper.set("is_enable", hrUserInfo.getIsEnable()); + } + updateWrapper.eq("id", hrUserInfo.getAccountId()); + updateWrapper.set("phone", hrUserInfo.getPhone()); + if (hrUserInfo.getPhone() != null) { + updateWrapper.set("phone_binding_time", DateUtils.getNowTime()); + } + + /*if (hrUserInfo.getPhone() != null||!hrUserInfo.getPhone().equals("")) { + updateWrapper.set("phone_binding_time", new Date()); + }*/ + boolean ret = accountService.update(new HrUserAccount(), updateWrapper); + + UpdateWrapper userWrapper = new UpdateWrapper(); + userWrapper.set("user_name", hrUserInfo.getUserName()); + userWrapper.set("email", hrUserInfo.getEmail()); + userWrapper.eq("user_id", hrUserInfo.getUserId()); + + boolean retUser = service.update(new HrUserInfo(), userWrapper); + + return ret && retUser ? R.ok() : R.error(); + + } + + /** + * 校验账号以及学号或工号 + * + * @param account + * @param workNumber + * @param type + * @return + */ + @GetMapping("/checkAccount") + @ApiOperation(value = "校验账户") + public R checkAccount(@RequestParam(name = "account", required = false) @ApiParam(value = "需要校验的账号") String account, + @RequestParam(name = "workNumber", required = false) @ApiParam(value = "需要校验的工号/学号") String workNumber, + @RequestParam(name = "type", required = true) @ApiParam(value = "1.账号 2.学号/工号") Integer type, + @RequestParam(name = "platformId", required = true) @ApiParam(value = "平台 数据平台为2") Integer platformId, + HttpServletRequest request) { + + String schoolId = request.getHeader("schoolId"); + + String msg = ""; + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + queryWrapper.eq("platform_id", platformId); + + if (type == 1) { + queryWrapper.eq("account", account); + msg = "账号"; + } else if (type == 2) { + queryWrapper.eq("work_number", workNumber); + queryWrapper.eq("school_id", schoolId); + msg = "学号/工号"; + } + + HrUserAccount accountList = accountService.getOne(queryWrapper); + if (accountList != null) { + return R.error("该" + msg + "已被使用,请重新设置!"); + } + + return R.ok(); + } + + /** + * 数据平台——用户管理列表 + * + * @param req + * @return + */ + @PostMapping("/getUserList") + @ApiOperation(value = "数据平台——用户管理列表", response = DataUserInfoResp.class) + public R getUserList(@RequestBody DataUserListReq req, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + req.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); + IPage getDataUserList = accountService.getDataUserList(req); + return R.ok().put("pageList", getDataUserList); + } + + /** + * 本校累计用户数量 + * + * @param schoolId + * @return + */ + @GetMapping("/getUserTotalBySchoolId") + @ApiOperation(value = "本校累计用户数量") + public R userTotalBySchool(@RequestParam(name = "schoolId", required = true) Integer schoolId) { + return accountService.getUserTotalBySchoolId(schoolId); + } + + /** + * 查看用户详情 + * + * @param + * @return + */ + @PostMapping("/getDetail") + @ApiOperation(value = "查看用户详情") + public R getDetail(@ApiParam(name = "accountId", value = "账号id", required = true) Integer accountId) { + + //查询原来该用户的角色信息 + List roleRespList = userRoleService.getUserRoleByAccountId(accountId); + DataUserInfoResp detail = service.getDetail(accountId); + detail.setRoleId(roleRespList); + + return R.ok().put("data", detail); + + } + + /** + * 批量导入用户信息 + * + * @param file + * @return + */ + @ApiOperation(value = "批量导入用户信息") + @PostMapping("/uploadFile") + public R uploadFile(@ApiParam(name = "file", value = "用户信息文件", required = true) MultipartFile file + , HttpServletRequest request) throws Exception { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + Map upload = service.upload(file, schoolId); + return R.ok().put("data", upload); + } + + /** + * 批量导入用户信息失败数据导出 + * + * @param response + * @param token + * @throws Exception + */ + @ApiOperation(value = "批量导入用户信息失败数据导出") + @GetMapping("/export_failure") + public void exportFailureRecord(HttpServletResponse response, @RequestParam String token) throws Exception { + service.exportFailureRecord(response, token); + } + + /** + * 批量逻辑删除数据平台用户(默认情况下只针对account表删除) + * 当 当前用户在平台只有一个账号时,删除账号的同时需要删除用户 + * + * @param accountIds + * @return + */ + @PostMapping("/delete") + @ApiOperation(value = "根据主键删除") + public R delete(@ApiParam(name = "accountIds", value = "多个账号id", required = true) @RequestParam("accountIds") List accountIds) { + boolean remove = false; + if (accountIds != null && accountIds.size() != 0) { + for (Integer id : accountIds) { + //remove = service.removeById(id); + + //查询原来该用户的角色信息 + List roleRespList = userRoleService.getUserRoleByAccountId(id); + + if (roleRespList.size() > 0) { + for (UserRoleResp roleResp : roleRespList) { + //删除该用户原有角色 + userClient.delRoleByAccountId(roleResp.getRoleId(), id); + } + } + + //查询该id是否有绑定相同的userId + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("id", id); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + //获取到该绑定的userId + HrUserAccount account = accountService.getOne(queryWrapper); + + //查询相同的userId + QueryWrapper queryWrapper1 = new QueryWrapper<>(); + queryWrapper1.eq("user_id", account.getUserId()); + queryWrapper1.eq("is_del", DelConstant.NOT_DEL); + + //该用户绑定的账户小于等于0时 同时删除user表和account表的数据 + List accountList = accountService.list(queryWrapper1); + if (accountList.size() <= 1) { + service.update(new HrUserInfo(), new UpdateWrapper().set("is_del", DelConstant.IS_DEL).eq("user_id", account.getUserId())); + } + + remove = accountService.update(new HrUserAccount(), new UpdateWrapper().set("is_del", DelConstant.IS_DEL).eq("id", id)); + } + } + + return remove ? R.ok() : R.error("删除失败"); + + } + + /** + * @Description : 根据token获取当前账户学校id + * @Param req + * @Param request + * @Author Rong---2021/11/9 + */ + @PostMapping("/getSchoolIdByToken") + @ApiOperation(value = "根据token获取当前账户学校id") + public R getSchoolIdByToken(HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer schoolId = userClient.getSchoolIdByAccountId(accountId); + return R.ok().put("schoolId", schoolId); + } +} diff --git a/users/src/main/java/com/huoran/users/controller/HrPersonalFileController.java b/users/src/main/java/com/huoran/users/controller/HrPersonalFileController.java new file mode 100644 index 0000000..598bef8 --- /dev/null +++ b/users/src/main/java/com/huoran/users/controller/HrPersonalFileController.java @@ -0,0 +1,20 @@ +package com.huoran.users.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 个人档案表 前端控制器 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@RestController +@RequestMapping("/users/personalFile") +public class HrPersonalFileController { + +} diff --git a/users/src/main/java/com/huoran/users/controller/HrUserAccountController.java b/users/src/main/java/com/huoran/users/controller/HrUserAccountController.java new file mode 100644 index 0000000..c261e6e --- /dev/null +++ b/users/src/main/java/com/huoran/users/controller/HrUserAccountController.java @@ -0,0 +1,342 @@ +package com.huoran.users.controller; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.huoran.common.constant.DelConstant; +import com.huoran.common.constant.SMSTemplate; +import com.huoran.common.response.R; +import com.huoran.common.utils.*; + +import com.huoran.users.entity.HrUserAccount; +import com.huoran.users.entity.HrUserInfo; +import com.huoran.users.entity.req.ResetPwdReq; +import com.huoran.users.entity.req.UserInfoReq; +import com.huoran.users.entity.res.ProfileDetailsRes; +import com.huoran.users.entity.res.UserInfoDetailsRes; +import com.huoran.users.entity.res.UserSysDetailRes; +import com.huoran.users.entity.vo.CheckVo; +import com.huoran.users.service.IHrUserAccountService; +import com.huoran.users.service.IHrUserInfoService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; + +import io.swagger.annotations.ApiParam; +import org.apache.commons.lang3.StringUtils; +import org.apache.ibatis.annotations.Param; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +/** + *

+ * 各个平台账号表 前端控制器 + *

+ * + * @author Qyq + * @since 2021-06-18 + */ +@Api(value = "用户管理", tags = "用户管理") +@RestController +@RequestMapping("/users/userAccount") +public class HrUserAccountController { + + @Autowired + private IHrUserAccountService iHrUserAccountService; + + @Autowired + private IHrUserInfoService iHrUserInfoService; + + /** + * 查询用户管理列表 + */ + @ApiOperation(value = "查询用户管理列表", notes = "查询用户管理列表") + @PostMapping("/queryUserInfoList") + public R queryUserInfoList(@RequestBody UserInfoReq userInfoReq) { + return iHrUserAccountService.queryPage( userInfoReq); + } + + /** + * 密码重置,以手机号的维度,重置所有账号密码为1122aa + */ + @ApiOperation(value = "密码重置") + @GetMapping("/resetPwd") + public R resetPwd(@RequestParam("userId") Integer userId) { + int result = iHrUserAccountService.resetPwd(userId); + return result > 0 ? R.ok() : R.error(); + } + + /** + * 删除用户以及账号 + */ + @ApiOperation(value = "删除用户以及账号") + @GetMapping("/delUserAccount") + public R delUserAccount(@RequestParam("userId") Integer userId, @RequestParam("isdel") Integer isdel) { + int result = iHrUserAccountService.delUserAccount(userId, isdel); + return result > 0 ? R.ok() : R.error(); + } + + /** + * 批量删除用户以及账号 + * + * @param ids 用户id + * @return + */ + @PostMapping("/delUserAccounts") + @ApiOperation(value = "批量删除用户以及账号") + public R delUserAccounts(@RequestBody List ids) { + int result = iHrUserAccountService.delUserAccounts(ids); + return result > 0 ? R.ok("删除成功!") : R.error(); + } + + /** + * 查看用户系统绑定详情 + */ + @ApiOperation(value = "查看用户系统绑定详情", response = UserSysDetailRes.class) + @GetMapping("/selectUserSysBind") + public R selectUserSysBind(@RequestParam("userId") Integer userId, @RequestParam("platformId") Integer platformId) { + UserSysDetailRes result = iHrUserAccountService.selectUserSysBind(userId, platformId); + return R.ok().put("result", result); + } + + /** + * 查看个人账号信息详情 + */ + @ApiOperation(value = "查看个人账号信息详情", response = HrUserAccount.class) + @GetMapping("/selectAccountDetail") + public R selectAccountDetail(@RequestParam("accountId") Integer accountId) { + HrUserAccount result = iHrUserAccountService.selectAccountDetail(accountId); + return R.ok().put("result", result); + } + + /** + * 查看用户详情 + * + * @return + */ + @ApiOperation(value = "查看用户详情", response = UserInfoDetailsRes.class) + @GetMapping("/queryUserInfoDetails") + public R queryUserInfoDetails(@Param("userId") Integer userId, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + if (userId == null) { + userId = iHrUserAccountService.getUserIdByAccountId(accountId); + } + UserInfoDetailsRes result = iHrUserAccountService.queryUserInfoDetails(userId); + return R.ok().put("result", result); + } + + /** + * 修改用户头像 + * + * @return + */ + @ApiOperation(value = "修改用户头像") + @PostMapping("/updateUserAvatars") + public R updateUserAvatars(HttpServletRequest request, MultipartFile file) { + String accountId = TokenUtils.getIdByJwtToken(request); + Integer userId = iHrUserAccountService.getUserIdByAccountId(accountId); + return iHrUserAccountService.updateUserAvatars(userId, file); + } + + /** + * 修改账号禁用启用功能 + * + * @param id + * @param isEnable + * @return + */ + @ApiOperation(value = "修改账号禁用启用功能") + @GetMapping("/updateAccountEnable") + public R updateAccountEnable(@RequestParam("id") @ApiParam(value = "账号id") Integer id, @RequestParam("isEnable") Integer isEnable) { + int result = iHrUserAccountService.updateAccountEnable(id, isEnable); + return result > 0 ? R.ok() : R.error(); + } + + /** + * @Description : 中台一键禁用——修改用户下所有账号禁用启用功能 + * @Param id + * @Param isEnable + * @Author Rong---2022/4/20 + */ + @ApiOperation(value = "中台一键禁用——修改用户下所有账号禁用启用功能") + @GetMapping("/updateAccountAllEnable") + public R updateAccountAllEnable(@RequestParam("id") @ApiParam(value = "用户id") Integer id, + @RequestParam("isEnable") @ApiParam(value = "是否禁用(0->禁用,1->启用)") Integer isEnable) { + int result = iHrUserAccountService.updateAccountAllEnable(id, isEnable); + return result > 0 ? R.ok() : R.error(); + } + + /** + * 修改个人中心 + * + * @param req + * @return + */ + @ApiOperation(value = "修改个人中心") + @PostMapping("/updatePersonCenter") + public R updatePersonCenter(@RequestBody UserInfoDetailsRes req) { + int result = iHrUserAccountService.updatePersonCenter(req); + return result > 0 ? R.ok() : R.error(); + } + + /** + * 更换手机号或邮箱--发送手机验证码 + * + * @return + */ + @ApiOperation(value = "更换手机号或邮箱--发送手机验证码") + @PostMapping("/sendPhoneOrEmailCode") + public R sendPhoneOrEmailCode(@RequestBody CheckVo checkVo) { + + R result = iHrUserInfoService.sendCheckPhoneCode(checkVo); + return result; + } + + /** + * 绑定手机或邮箱 + * + * @param checkVo + * @return + */ + @ApiOperation(value = "绑定手机或邮箱") + @PostMapping("/bindPhoneOrEmail") + public R bindPhoneOrEmail(@RequestBody CheckVo checkVo, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + String token = ""; + //未登录情况判断,并返回token + if (!StrUtil.isNotEmpty(accountId)) { + accountId = iHrUserAccountService.getAccountId(checkVo); + token = JwtUtils.getJwtToken(accountId); + } + Integer userId = iHrUserAccountService.getUserIdByAccountId(accountId); + R result = iHrUserInfoService.bindPhone(checkVo, userId); + result.put("token", token); + return result; + } + + /** + * 校验更换密码 + * + * @param resetPwdReq + * @return + */ + @ApiOperation(value = "校验更换密码") + @PostMapping("/examinePassword") + public R examinePassword(@RequestBody ResetPwdReq resetPwdReq, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + resetPwdReq.setAccountId(Integer.valueOf(accountId)); + R result = iHrUserAccountService.examinePassword(resetPwdReq); + return result; + } + + /** + * 根据账号id获取用户id + */ + @GetMapping("/getUserId") + @ApiOperation(value = "根据账号id获取用户id") + public Integer getUserIdByAccountId(@RequestParam String accountId) { + return iHrUserAccountService.getUserIdByAccountId(accountId); + } + + /** + * 根据账号id获取学校id + */ + @GetMapping("/getSchoolIdByAccountId") + @ApiOperation(value = "根据账号id获取学校id") + public Integer getSchoolIdByAccountId(@RequestParam("accountId") String accountId) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + queryWrapper.eq("id", accountId); + + Integer schoolId = iHrUserAccountService.getOne(queryWrapper).getSchoolId(); + return schoolId; + } + + /** + * 账号注册(数据平台注册) + */ + @ApiOperation(value = "账号注册") + @PostMapping("/registerAccount") + public R registerAccount(@RequestBody ResetPwdReq resetPwdReq, HttpServletRequest request) { + + return R.ok(); + } + + @ApiOperation(value = "中台查看用户详情", response = UserInfoDetailsRes.class) + @GetMapping("/viewUserDetailsforNakadai") + public R viewUserDetailsforNakadai(@RequestParam @Param("userId") Integer userId, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + if (userId == null) { + userId = iHrUserAccountService.getUserIdByAccountId(accountId); + } + UserInfoDetailsRes result = iHrUserAccountService.viewUserDetailsforNakadai(userId); + return R.ok().put("result", result); + } + + @ApiOperation(value = "中台一键启用前——用户判断是否能够一键启用(判断当前用户是否有数据平台的账号绑定,需要判断院校可用账号数量)") + @PostMapping("/oneClickEnableVerification") + public R oneClickEnableVerification(@RequestParam("accountId") @ApiParam(value = "账号id") Integer accountId) { + return iHrUserAccountService.oneClickEnableVerification(accountId); + } + + @ApiOperation(value = "个人档案", response = UserInfoDetailsRes.class) + @GetMapping("/personalFile") + public R personalFile(@RequestParam("userId") @Param("userId") Integer userId, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + if (userId == null) { + userId = iHrUserAccountService.getUserIdByAccountId(accountId); + } + ProfileDetailsRes result = iHrUserAccountService.personalFile(userId); + return R.ok().put("result", result); + } + + @ApiOperation(value = "解绑手机号(该接口可用于token、账号id参数)") + @GetMapping("/unbindMobilePhone") + public R unbindMobilePhone(@RequestParam(value = "accountId", required = false) @ApiParam("accountId") Integer accountId, HttpServletRequest request) { + String account_id = TokenUtils.getIdByJwtToken(request);//token解析出来的账号id + + if (accountId == null) { + return iHrUserAccountService.unbindMobilePhone(Integer.valueOf(account_id)); + } + + return iHrUserAccountService.unbindMobilePhone(accountId); + + } + + @ApiOperation(value = "根据学校学号查询学校学生") + @GetMapping("/enquireAboutSchoolStudents") + public R enquireAboutSchoolStudents(@RequestParam Integer schoolId,@RequestParam String workNumber,@RequestParam(required = false) Integer applyFor) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("school_id",schoolId); + wrapper.eq("work_number",workNumber); + wrapper.eq("platform_id",1); + wrapper.eq("type",1); + HrUserAccount one = iHrUserAccountService.getOne(wrapper); + if (one==null && applyFor!=null && applyFor == 1){ + return R.ok(); + } + if (one==null){ + return R.error("学生不存在"); + } + if (one.getIsEnable()==0){ + return R.error("该学生已禁用,请启用后再进行操作"); + } + if (applyFor!=null && applyFor == 1){ + return R.error("学生已存在"); + } + HrUserInfo byId = iHrUserInfoService.getById(one.getUserId()); + one.setUserName(byId.getUserName()); + return R.ok().put("account", one); + } + +} + diff --git a/users/src/main/java/com/huoran/users/controller/HrUserInfoController.java b/users/src/main/java/com/huoran/users/controller/HrUserInfoController.java new file mode 100644 index 0000000..6cfe2af --- /dev/null +++ b/users/src/main/java/com/huoran/users/controller/HrUserInfoController.java @@ -0,0 +1,140 @@ +package com.huoran.users.controller; + +import com.huoran.common.constant.PlatformConstant; +import com.huoran.common.response.R; +import com.huoran.common.utils.MD5; +import com.huoran.common.utils.TokenUtils; +import com.huoran.users.entity.HrPersonalFile; +import com.huoran.users.entity.HrUserAccount; +import com.huoran.users.entity.HrUserInfo; +import com.huoran.users.entity.vo.UserPersonalEntityVo; +import com.huoran.users.service.IHrPersonalFileService; +import com.huoran.users.service.IHrUserAccountService; +import com.huoran.users.service.IHrUserInfoService; +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 javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + *

+ * 用户信息表 前端控制器 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@RestController +@RequestMapping("/users/userInfo") +@Api(value = "用户管理", tags = "用户管理") +public class HrUserInfoController { + + @Autowired + private IHrUserInfoService iHrUserInfoService; + + @Autowired + private IHrUserAccountService iHrUserAccountService; + + @Autowired + private IHrPersonalFileService iHrPersonalFileService; + + @Autowired + private IHrPersonalFileService personalFileService; + + /** + * 查询用户信息 + * + * @param request + * @return + */ + @GetMapping("/getUserInfo") + @ApiOperation(value = "查询用户信息") + public R userInfo(HttpServletRequest request) { + + String accountId = TokenUtils.getIdByJwtToken(request); + Integer userId = iHrUserAccountService.getUserIdByAccountId(accountId); + + return R.ok(iHrUserInfoService.queryUserInfoById(userId, Integer.valueOf(accountId))); + } + + /** + * 修改更新用户 + */ + @PostMapping("/updateUser") + @ApiOperation(value = "更新用户") + public R updateUser(@RequestBody UserPersonalEntityVo vo) { + + HrUserInfo userInfo = vo.getHrUserInfo(); + HrUserAccount userAccount = vo.getHrUserAccount(); + Integer userId = userInfo.getUserId(); + + //验证账号是否存在 -- 根据平台id + int num = iHrUserInfoService.queryAccountExistByPlatformId(userAccount.getAccount(), userAccount.getUserId(), PlatformConstant.DATA_PLATFORM); + if (num >= 1) { + return R.error(500, "更新失败,账号不能重复"); + } + + //更新用户 + iHrUserInfoService.updateUserInfoById(userInfo); + //更新账户 + Integer count = iHrUserAccountService.updateAccount(userAccount); + if (count <= 0) { + return R.error(500, "账号更新失败!"); + } + if (vo.getHrPersonalFileEntities()!=null){ + List entityList = vo.getHrPersonalFileEntities(); + for (int i = 0; i < entityList.size(); i++) { + HrPersonalFile personalFile = entityList.get(i); + Integer personalFileId = personalFile.getPersonalFileId(); + if (personalFile.getPersonalCareerId() == null) { + return R.error(403, "false,personalCareerId can not be empty!!!"); + } + if (personalFileId == null) { + iHrPersonalFileService.insertPersonalInfo(personalFile); + } else { + iHrPersonalFileService.updateUserPersonal(personalFile); + } + } + } + return R.ok(); + } + + /** + * @Description : 校验用户手机号是否存在 + * @Param phone + * @Author Rong---2021/10/18 + */ + @GetMapping("/checkPhoneOrEmailExist") + @ApiOperation(value = "校验用户手机号或邮箱是否存在") + public boolean checkPhoneOrEmailExist(@ApiParam(name = "phone", value = "要校验的手机号码", required = false) @RequestParam("phone") String phone, + @ApiParam(name = "email", value = "要校验的邮箱", required = false) @RequestParam("email") String email, + @ApiParam(name = "type", value = "校验类型", required = false) @RequestParam("type") Integer type) { + return iHrUserInfoService.checkPhoneOrEmailExist(phone, email, type); + } + + @PostMapping("/deleteProfile") + @ApiOperation(value = "删除个人档案") + public R deleteProfile(@ApiParam(name = "personalFileIds", value = "个人档案id", required = true) @RequestParam("personalFileIds") List personalFileIds) { + boolean ret = false; + if (personalFileIds.size() > 0) { + ret = personalFileService.removeByIds(personalFileIds); + } + return ret ? R.ok() : R.error("删除个人档案失败"); + + } + + /** + * @Description : 查询用户名称 + * @Param id + * @Author Rong---2021/12/30 + */ + @GetMapping("/getUserName") + @ApiOperation(value = "查询用户名称") + public String getUserName(@RequestParam("accountId") Integer accountId) { + return iHrUserInfoService.getUserName(accountId); + } +} diff --git a/users/src/main/java/com/huoran/users/controller/OccupationlabUserInfoController.java b/users/src/main/java/com/huoran/users/controller/OccupationlabUserInfoController.java new file mode 100644 index 0000000..852f912 --- /dev/null +++ b/users/src/main/java/com/huoran/users/controller/OccupationlabUserInfoController.java @@ -0,0 +1,152 @@ +package com.huoran.users.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.huoran.common.constant.DelConstant; +import com.huoran.common.response.R; +import com.huoran.common.utils.MD5; +import com.huoran.users.entity.HrUserAccount; +import com.huoran.users.entity.HrUserInfo; +import com.huoran.users.entity.req.DataUserListReq; +import com.huoran.users.entity.req.ModifyUserInfoReq; +import com.huoran.users.entity.req.SaveUserInfoReq; +import com.huoran.users.entity.res.DataUserInfoResp; +import com.huoran.users.service.IHrUserAccountService; +import com.huoran.users.service.IHrUserInfoService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.util.List; +import java.util.Map; + +/** + *

+ * 用户信息表 前端控制器 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@RestController +@RequestMapping("/users/occupationlab/user") +@Api(value = "API - 用户管理", tags = "职站-用户管理") +public class OccupationlabUserInfoController { + + @Autowired + public IHrUserInfoService service; + + @Autowired + public IHrUserAccountService accountService; + + /** + * 按帐户获取详细信息 + * + * @param + * @return + */ + @PostMapping("/getDetailByAccount") + @ApiOperation(value = "查看用户详情") + public R getDetailByAccount(@ApiParam(name = "account", value = "输入的学生账号", required = true) String account, + @ApiParam(name = "schoolId", value = "学校id", required = true) Integer schoolId, + @ApiParam(name = "platformId", value = "所属平台id(1.职站 2.数据平台 3.中台)", required = true) Integer platformId, + @ApiParam(name = "type", value = "平台端区分:0教师 1学生 2无端", required = true) Integer type) { + //查询同校且同平台以及同端下 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("school_id", schoolId); + queryWrapper.eq("platform_id", platformId); + queryWrapper.eq("type", type); + queryWrapper.eq("account", account); + queryWrapper.eq("is_enable", DelConstant.IS_ENABLE); + return R.ok().put("data", accountService.getOne(queryWrapper)); + + } + + /** + * 批量逻辑删除职站平台用户(默认情况下只针对account表删除) + * 删除账号的同时需要删除用户 + * + * @param accountIds + * @return + */ + @PostMapping("/delStudent") + @ApiOperation(value = "根据主键删除") + public void delStudent(@ApiParam(name = "accountIds", value = "多个账号id", required = true) @RequestParam("accountIds") List accountIds) { + + if (accountIds != null && accountIds.size() != 0) { + for (Integer id : accountIds) { + + //查询该id是否有绑定相同的userId + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + queryWrapper.eq("id", id); + + //获取到该绑定的userId + HrUserAccount account = accountService.getOne(queryWrapper); + + //查询相同的userId + QueryWrapper queryWrapper1 = new QueryWrapper<>(); + queryWrapper1.eq("is_del", DelConstant.NOT_DEL); + queryWrapper1.eq("user_id", account.getUserId()); + //该用户绑定的账户小于等于0时 同时删除user表和account表的数据 + HrUserAccount userAccount = accountService.getOne(queryWrapper1); + if (userAccount != null) { + service.update(new HrUserInfo(), new UpdateWrapper() + .set("is_del", DelConstant.IS_DEL) + .eq("user_id", account.getUserId())); + } + + accountService.update(new HrUserAccount(), new UpdateWrapper() + .set("is_del", DelConstant.IS_DEL) + .eq("id", id)); + } + } + } + + /** + * @Description : 根据账号id删除账号、用户表信息 + * @Param accountId + * @Author Rong---2021/10/14 + */ + @PostMapping("/delAccountAndUser") + @ApiOperation(value = "删除账号、用户表信息") + public void delAccountAndUser(@ApiParam(name = "accountId", value = "账号id", required = true) @RequestParam("accountId") Integer accountId) { + + //查询该id是否有绑定相同的userId + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + queryWrapper.eq("id", accountId); + + //获取到该绑定的userId + HrUserAccount account = accountService.getOne(queryWrapper); + + //查询相同的userId + QueryWrapper queryWrapper1 = new QueryWrapper<>(); + + queryWrapper1.eq("is_del", DelConstant.NOT_DEL); + queryWrapper1.eq("user_id", account.getUserId()); + + //该用户绑定的账户小于等于0时 同时删除user表和account表的数据 + List accountList = accountService.list(queryWrapper1); + if (accountList.size() <= 1) { + service.update(new HrUserInfo(), new UpdateWrapper() + .set("is_del", DelConstant.IS_DEL) + .eq("user_id", account.getUserId())); + } + + accountService.update(new HrUserAccount(), new UpdateWrapper() + .set("is_del", DelConstant.IS_DEL) + .eq("id", accountId)); + + } +} + + diff --git a/users/src/main/java/com/huoran/users/controller/PermissionController.java b/users/src/main/java/com/huoran/users/controller/PermissionController.java new file mode 100644 index 0000000..6ae3efd --- /dev/null +++ b/users/src/main/java/com/huoran/users/controller/PermissionController.java @@ -0,0 +1,79 @@ +package com.huoran.users.controller; + + +import com.huoran.common.response.R; +import com.huoran.users.entity.Permission; +import com.huoran.users.service.PermissionService; +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 javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + *

+ * 权限表 前端控制器 + *

+ * + * @author chen + * @since 2021-09-29 + */ +@Api(tags = "权限菜单管理") +@RestController +@RequestMapping("/users/permission") +public class PermissionController { + + @Autowired + private PermissionService permissionService; + + @ApiOperation(value = "根据平台id查询所有菜单") + @GetMapping("queryAllMenus") + public R indexAllPermission( + @ApiParam(name = "platformId", value = "平台id", required = true) + @RequestParam Integer platformId, + @ApiParam(name = "port", value = "默认pc端为0、小程序端为1", required = false) + @RequestParam(required = false) Integer port) { + List list = permissionService.queryAllMenu(platformId,port); + return R.ok().put("children",list); + } + + @ApiOperation(value = "递归删除菜单") + @PostMapping("remove") + public R remove(@RequestParam Integer id) { + permissionService.removeChildById(id); + return R.ok(); + } + + @ApiOperation(value = "给角色分配权限") + @PostMapping("/doAssign") + public R doAssign(Integer roleId,Integer[] permissionId) { + permissionService.saveRolePermissionRelationShip(roleId,permissionId); + return R.ok(); + } + +/* @ApiOperation(value = "获取角色权限菜单") + @GetMapping("obtain") + public R obtain(@RequestParam String roleId) { + List list = permissionService.selectRoleMenu(roleId); + return R.ok().put("permissionMenu", list); + }*/ + + @ApiOperation(value = "新增菜单") + @PostMapping("save") + public R save(@RequestBody Permission permission) { + permissionService.save(permission); + return R.ok(); + } + + @ApiOperation(value = "修改菜单") + @PostMapping("update") + public R updateById(@RequestBody Permission permission) { + permissionService.updateById(permission); + return R.ok(); + } + +} + diff --git a/users/src/main/java/com/huoran/users/controller/PlatformLoginController.java b/users/src/main/java/com/huoran/users/controller/PlatformLoginController.java new file mode 100644 index 0000000..4bc7bcb --- /dev/null +++ b/users/src/main/java/com/huoran/users/controller/PlatformLoginController.java @@ -0,0 +1,21 @@ +package com.huoran.users.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 各平台登录统计 前端控制器 + *

+ * + * @author chen + * @since 2022-09-13 + */ +@RestController +@RequestMapping("/platform-login") +public class PlatformLoginController { + +} + diff --git a/users/src/main/java/com/huoran/users/controller/RegisterController.java b/users/src/main/java/com/huoran/users/controller/RegisterController.java new file mode 100644 index 0000000..ee936d8 --- /dev/null +++ b/users/src/main/java/com/huoran/users/controller/RegisterController.java @@ -0,0 +1,30 @@ +package com.huoran.users.controller; + +import com.huoran.common.response.R; +import com.huoran.users.entity.req.RegisterReq; +import com.huoran.users.service.IHrUserAccountService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +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.RestController; + +import javax.validation.Valid; + +@Api(tags = "注册管理") +@RestController +@RequestMapping("/users/register") +public class RegisterController { + + @Autowired + private IHrUserAccountService userAccountService; + + @ApiOperation(value = "学生账号申请注册") + @PostMapping("/studentAccountApplication") + public R studentAccountApplication(@RequestBody @Valid RegisterReq registerReq) { + return userAccountService.studentAccountApplication(registerReq); + } + +} diff --git a/users/src/main/java/com/huoran/users/controller/RoleController.java b/users/src/main/java/com/huoran/users/controller/RoleController.java new file mode 100644 index 0000000..da98e57 --- /dev/null +++ b/users/src/main/java/com/huoran/users/controller/RoleController.java @@ -0,0 +1,232 @@ +package com.huoran.users.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.api.UserClient; +import com.huoran.common.constant.DelConstant; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.users.entity.*; +import com.huoran.users.entity.vo.DataPermissionVo; +import com.huoran.users.service.*; +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 javax.servlet.http.HttpServletRequest; +import javax.validation.Valid; +import java.util.ArrayList; +import java.util.List; + +/** + *

+ * 角色表 前端控制器 + *

+ * + * @author chen + * @since 2021-09-29 + */ +@Api(tags = "角色管理") +@RestController +@RequestMapping("/users/role") +public class RoleController { + + @Autowired + private RoleService roleService; + + @Autowired + private PermissionService permissionService; + + @Autowired + private RolePermissionService rolePermissionService; + + @Autowired + private IHrUserAccountService userAccountService; + + @Autowired + private UserRoleService userRoleService; + + @Autowired + private UserClient userClient; + + @Autowired + DataPermissionService dataPermissionService; + + @ApiOperation(value = "角色分页列表查询") + @GetMapping("/list") + public R index( + @ApiParam(name = "page", value = "当前页码", required = true) + @RequestParam Integer page, + @ApiParam(name = "size", value = "每页记录数", required = true) + @RequestParam Integer size, + @ApiParam(name = "platformId", value = "平台id", required = true) + @RequestParam Integer platformId, + @ApiParam(name = "name", value = "角色名称", required = false) + @RequestParam(required = false) String name, + @ApiParam(name = "port", value = "端口(pc端为0、小程序端为1)", required = false) + @RequestParam(required = false) String port, HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + HrUserAccount userAccount = userAccountService.getById(Integer.valueOf(accountId)); + + Page pageParam = new Page<>(page, size); + QueryWrapper wrapper = new QueryWrapper<>(); + if (!"".equals(name)) { + wrapper.like("role_name", name); + } + if (!"".equals(port)) { + wrapper.eq("port", port); + } + wrapper.eq("school_id", userAccount.getSchoolId()); + wrapper.eq("platform_id", platformId); + IPage rolePage = roleService.page(pageParam, wrapper); + return R.ok().put("rolePage", rolePage); + } + + @ApiOperation(value = "获取角色详情") + @GetMapping("/obtainDetails") + public R obtainDetails( + @ApiParam(name = "id", value = "角色id", required = true) + @RequestParam String id) { + Role role = roleService.getById(id); + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("role_id", id).select("permission_id"); + List list = rolePermissionService.list(wrapper); + List permissionList = new ArrayList<>(); + list.forEach(rolePermission -> { + permissionList.add(rolePermission.getPermissionId()); + }); + List permissionVoList = dataPermissionService.selectDataPermission(id); + return R.ok().put("role", role).put("permissionList", permissionList).put("permissionVoList",permissionVoList); + } + + @ApiOperation(value = "新增或更新角色") + @PostMapping("/saveOrUpdate") + public R save( + @ApiParam(name = "role", value = "角色信息", required = true) + @Valid @RequestBody Role role, HttpServletRequest request) { + //编辑判重 + if (role.getId() != null) { + //名称判重 + boolean isRepeat = roleService.repeat(role); + if (isRepeat) { + return R.error("角色已存在"); + } + //新增判重 + } else { + String accountId = TokenUtils.getIdByJwtToken(request); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + queryWrapper.eq("id", accountId); + Integer schoolId = userAccountService.getOne(queryWrapper).getSchoolId(); + role.setSchoolId(schoolId); + QueryWrapper roleWrapper = new QueryWrapper<>(); + roleWrapper.eq("role_name", role.getRoleName()); + roleWrapper.eq("school_id", role.getSchoolId()); + roleWrapper.eq("platform_id", role.getPlatformId()); + int count = roleService.count(roleWrapper); + if (count > 0) { + return R.error("角色已存在"); + } + } + roleService.saveOrUpdate(role); + //分配权限 + permissionService.saveRolePermissionRelationShip(role.getId(), role.getPermissionId()); +// 目前中台分配数据权限 + if (role.getPlatformId()==3){ + //分配数据权限 + permissionService.assigningDataPermissions(role.getId(),role.getDataPermissionList()); + } + return R.ok().put("roleId", role.getId()); + } + + @ApiOperation(value = "批量删除角色") + @PostMapping("/batchRemove") + public R batchRemove( + @ApiParam(name = "roleIds", value = "多个角色id", required = true) + @RequestParam("roleIds") List roleIds) { + if (roleIds != null && !roleIds.isEmpty()) { + boolean remove = roleService.batchRemove(roleIds); + return remove ? R.ok() : R.error(); + } else { + return R.error(); + } + } + + //远程调用 + @ApiOperation(value = "删除某用户下的某个角色") + @PostMapping("/delRoleByAccountId") + public R delRoleByAccountId( + @ApiParam(name = "roleId", value = "角色id", required = true) @RequestParam("roleId") Integer roleId, + @ApiParam(name = "accountId", value = "账号id", required = true) @RequestParam("accountId") Integer accountId) { + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.set("is_del", DelConstant.IS_DEL) + .eq("role_id", roleId) + .eq("account_id", accountId); + boolean ret = userRoleService.update(new UserRole(), updateWrapper); + return ret ? R.ok() : R.error(); + } + + /** + * 为客户添加超管角色等相关操作 + * + * @param schoolId 学校id + * @param accountId 账号id + */ + @PostMapping("/addCustomerAdmin") + public boolean addCustomerAdmin( + @RequestParam("schoolId") Integer schoolId, @RequestParam("accountId") String accountId) { + return roleService.addCustomerAdmin(schoolId, accountId); + } + + @ApiOperation(value = "判断该角色是否存在(远程调用,无需调用)") + @PostMapping("/checkRoleIsExist") + public Role checkRoleIsExist(@ApiParam(name = "roleName", value = "角色名称", required = true) String roleName, + @ApiParam(name = "schoolId", value = "学校id", required = true) Integer schoolId, + @ApiParam(name = "platformId", value = "平台id", required = true) Integer platformId) { + return roleService.getRoleInfo(schoolId, roleName,platformId); + } + + @ApiOperation(value = "根据账号id查询用户的角色(远程调用)") + @PostMapping("/checkIsSuperTube") + public boolean checkIsSuperTube(@ApiParam(name = "accountId", value = "账号id", required = true) @RequestParam("accountId") String accountId) { + return userRoleService.checkIsSuperTube(accountId); + } + + @ApiOperation(value = "根据账号id查询用户某平台下的全部角色(远程调用)") + @PostMapping("/getUserAllRole") + public String getUserAllRole(@ApiParam(name = "accountId", value = "账号id", required = true) @RequestParam("accountId") String accountId, + @ApiParam(name = "platformId", value = "平台id(1.职站 2.数据平台 3.中台)", required = true) @RequestParam("platformId") Integer platformId) { + return userRoleService.getUserAllRole(Integer.valueOf(accountId), platformId); + } + + + + @ApiOperation(value = "根据学校id查询该校下的超管、管理员的账号id(远程调用)") + @PostMapping("/getAccountIdsBySchoolId") + public List getAccountIdsBySchoolId(@ApiParam(name = "schoolId", value = "学校id", required = true) @RequestParam("schoolId") Integer schoolId, + @ApiParam(name = "platformId", value = "平台id(1.职站 2.数据平台 3.中台)", required = true) @RequestParam("platformId") Integer platformId) { + return userRoleService.getAccountIdsBySchoolId(schoolId, platformId); + } + + + @ApiOperation(value = "根据查询用户某平台下的全部角色") + @PostMapping("/getUserAllRoleByToken") + public String getUserAllRoleByToken(@ApiParam(name = "platformId", value = "平台id(1.职站 2.数据平台 3.中台)", required = true) @RequestParam("platformId") Integer platformId, @RequestHeader String token) { + //token查询学校id + Integer schoolId = userClient.getSchoolIdByAccountId(TokenUtils.getIdByJwtToken(token)); + + String accountId = TokenUtils.getIdByJwtToken(token); + return userRoleService.getUserAllRole(Integer.valueOf(accountId), platformId); + } + + @ApiOperation(value = "客户重新分配权限") + @PostMapping("/reassignmentPermissions") + public R reassignmentPermissions() { + return roleService.reassignmentPermissions(); + } +} + diff --git a/users/src/main/java/com/huoran/users/controller/RolePermissionController.java b/users/src/main/java/com/huoran/users/controller/RolePermissionController.java new file mode 100644 index 0000000..d5068de --- /dev/null +++ b/users/src/main/java/com/huoran/users/controller/RolePermissionController.java @@ -0,0 +1,21 @@ +package com.huoran.users.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 角色权限表 前端控制器 + *

+ * + * @author chen + * @since 2021-09-29 + */ +@RestController +@RequestMapping("/users/role-permission") +public class RolePermissionController { + +} + diff --git a/users/src/main/java/com/huoran/users/controller/SupplierController.java b/users/src/main/java/com/huoran/users/controller/SupplierController.java new file mode 100644 index 0000000..77a2efa --- /dev/null +++ b/users/src/main/java/com/huoran/users/controller/SupplierController.java @@ -0,0 +1,66 @@ +package com.huoran.users.controller; + + +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.users.entity.Permission; +import com.huoran.users.entity.Supplier; +import com.huoran.users.service.SupplierService; +import com.huoran.users.service.UserRoleService; +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.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + *

+ * 供应商表 前端控制器 + *

+ * + * @author chen + * @since 2022-10-13 + */ +@Api(tags = "供应商管理") +@RestController +@RequestMapping("/users/supplier") +public class SupplierController { + + @Autowired + SupplierService supplierService; + + @Autowired + private UserRoleService userRoleService; + + @ApiOperation(value = "查询所有供应商列表") + @GetMapping("/getSupplierList") + public R getSupplierList() { + List list = supplierService.list(null); + return R.ok().put("supplierList", list); + } + + @ApiOperation(value = "根据角色查询供应商列表") + @GetMapping("/getSupplierListByRole") + public R getsTheSupplierListByRole(HttpServletRequest request,@RequestParam Integer permissionId) { + String accountId = TokenUtils.getIdByJwtToken(request); + List roles = userRoleService.queryAccountRoles(accountId,null); + String roleIds = ""; + if (!roles.isEmpty()){ + for (Integer id : roles) { + roleIds += id +","; + } + roleIds = roleIds.substring(0,roleIds.length()-1); + } + List list = supplierService.querySupplierList(roleIds,permissionId); + return R.ok().put("supplierList", list); + } + +} + diff --git a/users/src/main/java/com/huoran/users/controller/SysPlatformController.java b/users/src/main/java/com/huoran/users/controller/SysPlatformController.java new file mode 100644 index 0000000..0fe0f07 --- /dev/null +++ b/users/src/main/java/com/huoran/users/controller/SysPlatformController.java @@ -0,0 +1,20 @@ +package com.huoran.users.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 平台表 前端控制器 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@RestController +@RequestMapping("/users/sysPlatform") +public class SysPlatformController { + +} diff --git a/users/src/main/java/com/huoran/users/controller/UserLoginController.java b/users/src/main/java/com/huoran/users/controller/UserLoginController.java new file mode 100644 index 0000000..52ddb38 --- /dev/null +++ b/users/src/main/java/com/huoran/users/controller/UserLoginController.java @@ -0,0 +1,370 @@ +package com.huoran.users.controller; + +import com.huoran.common.constant.LoginDistConstant; +import com.huoran.common.constant.OrderConstant; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.users.entity.HrUserAccount; +import com.huoran.users.entity.PlatformLogin; +import com.huoran.users.entity.dto.LoginDTO; +import com.huoran.users.entity.req.AppletCallbackReq; +import com.huoran.users.entity.req.UnbindAccountsReq; +import com.huoran.users.entity.req.WxUserBindingReq; +import com.huoran.users.entity.vo.LoginVo; +import com.huoran.users.entity.vo.WxMssVo; +import com.huoran.users.service.IHrUserAccountService; +import com.huoran.users.service.IHrUserInfoService; +import com.huoran.users.service.PlatformLoginService; +import com.huoran.users.service.UserRoleService; +import com.huoran.users.weixin.mp.aes.AesException; +import com.huoran.users.weixin.mp.aes.SHA1; +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 javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.List; +import java.util.Map; + +/** + * @Author chen + * @DATE 2021/7/7 15:16 + * @Version 1.0 + */ +@Api(tags = "登录管理") +@RestController +@RequestMapping("/users/user") +public class UserLoginController { + + @Autowired + private IHrUserInfoService userInfoService; + + @Autowired + private IHrUserAccountService userAccountService; + + @Autowired + private PlatformLoginService platformLoginService; + + @Autowired + private UserRoleService userRoleService; + + @Autowired + HrUserAccountController accountController; + + @ApiOperation(value = "根据手机号查询当前平台的其他账号用户信息") + @PostMapping(value = "/getOtherAccountByPhone") + public R getOtherAccountByPhone( + @ApiParam(name = "phone", value = "手机号", required = true) + @RequestParam String phone, + @ApiParam(name = "platform", value = "平台id", required = true) + @RequestParam String platform){ + List hrUserAccounts = userInfoService.getOtherAccount(phone, platform); + return R.ok().put("userAccounts",hrUserAccounts); + } + + @ApiOperation(value = "根据手机号解除所有绑定账号且与当前用户进行绑定") + @PostMapping(value = "/unbindAccounts") + public R unbindAccounts(@RequestBody @Valid UnbindAccountsReq accountsReq){ + return userInfoService.unbindAccounts(accountsReq); + } + + /** + * 登录发送手机/邮箱验证码 + */ + @ApiOperation(value = "登录发送手机/邮箱验证码") + @PostMapping("/sendPhoneVerificationCode") + public R sendPhoneVerificationCode( + @ApiParam(name = "phoneOrEmail", value = "手机或邮箱", required = true) + @RequestParam String phoneOrEmail, + @ApiParam(name = "loginOrBind", value = "登录状态为0、绑定状态为1", required = true) + @RequestParam Integer loginOrBind, + @ApiParam(name = "platform", value = "平台id", required = true) + @RequestParam String platform) { + return userInfoService.sendPhoneVerificationCode(phoneOrEmail,loginOrBind,platform); + } + + /** + * 根据账号id返回token + */ + @ApiOperation(value = "根据账号id返回token") + @PostMapping("/getToken") + public R getToken(@RequestParam String id) { + return userInfoService.getToken(id); + } + + @ApiOperation(value = "账号是否禁用") + @GetMapping(value = "/accountIsDisabled") + public boolean accountIsDisabled(@RequestParam("token") String token){ + String id = TokenUtils.getIdByJwtToken(token); + HrUserAccount hrUserAccount = userAccountService.getById(id); + //是否禁用 + return hrUserAccount.getIsEnable().equals(OrderConstant.Not_enabled); + } + + @ApiOperation(value = "平台登录统计") + @GetMapping(value = "/platformLoginStatistics") + public R platformLoginStatistics( + @ApiParam(name = "platform", value = "平台id", required = true) + @RequestParam Integer platform,HttpServletRequest request){ + String id = TokenUtils.getIdByJwtToken(request); + Integer schoolId = null; + if (id!=null){ + schoolId = userAccountService.querySchoolIdByAccountId(id); + } + return platformLoginService.platformLoginStatistics(platform,schoolId); + } + + /** + * 登录成功后返回token值,用于其他模块验证 + * @param loginVo 登录信息 + * @return loginVo + */ + @ApiOperation(value = "登录认证") + @PostMapping("/login") + public R login(@RequestBody @Valid LoginVo loginVo) { + LoginDTO data = userInfoService.login(loginVo); + String id = TokenUtils.getIdByJwtToken(data.getToken()); + //统计平台登录次数 + if (!data.isCustomer()){ + Integer schoolId = userAccountService.querySchoolIdByAccountId(id); + PlatformLogin platformLogin = new PlatformLogin(); + platformLogin.setPlatform(loginVo.getPlatform()); + platformLogin.setSchoolId(schoolId); + platformLoginService.save(platformLogin); + } + //手机号登录返回选择数据 + if (loginVo.getDistinguish().equals(LoginDistConstant.PHONE_EMAIL_LOGIN)) { + return R.ok().put("data", data); + } + HrUserAccount account = userAccountService.getById(id); + String name = account.getAccount(); + List roles = userRoleService.queryAccountRoles(id,null); + if (loginVo.getType()!=1 && roles!=null && roles.isEmpty()){ + return R.error("该账号无角色权限,无法登录,请联系管理员添加角色!"); + } + return R.ok("认证成功,欢迎 "+name+" 回来!").put("data", data); + } + + /** + * 是否为客户 + */ + @ApiOperation(value = "是否为客户") + @GetMapping("/isClient") + public R isClient(HttpServletRequest request) { + String id = TokenUtils.getIdByJwtToken(request); + HrUserAccount account = userAccountService.getById(id); + //查询学校id + Integer schoolId = accountController.getSchoolIdByAccountId(id); + if (account.getCustomerId()==null){ + return R.ok().put("customer",false).put("schoolId",schoolId); + } + String clientName = userAccountService.queryClientName(account.getCustomerId()); + return R.ok().put("customer",true). + put("customerName",clientName). + put("customerId",account.getCustomerId()). + put("schoolId",schoolId); + } + + @ApiOperation(value = "登录验证码") + @GetMapping(value = "/captcha",produces = "image/png") + public void captcha( + @ApiParam(name = "random", value = "随机数", required = true) + @RequestParam String random, HttpServletResponse response){ + userInfoService.createCaptcha(random,response); + } + + + /** + * 微信小程序绑定回调 + */ + @ApiOperation(value = "微信小程序绑定回调(合伙人版)") + @PostMapping("/weChatAppletCallbackByPartner") + public R weChatCallbackByPartner(@RequestBody AppletCallbackReq appletCallbackReq, HttpServletResponse response) throws Exception { + + Map result = userInfoService.weChatAppletCallbackByPartner(appletCallbackReq, response); + + return R.ok().put("data",result); + } + + @ApiOperation(value = "微信小程序绑定回调(运营版)") + @PostMapping("/weChatAppletCallbackByOperation") + public R weChatCallback(@RequestBody AppletCallbackReq appletCallbackReq, HttpServletResponse response) throws Exception { + + Map result = userInfoService.weChatAppletCallbackByOperation(appletCallbackReq, response); + + return R.ok().put("data",result); + } + + + @ApiOperation(value = "微信小程序授权(获取sessionKey)") + @PostMapping("/getSessionKey") + public R getSessionKey(@RequestBody AppletCallbackReq appletCallbackReq, HttpServletResponse response) throws Exception { + return userInfoService.getSessionKey(appletCallbackReq, response); + } + + @ApiOperation(value = "微信小程序登录(根据openid)") + @PostMapping("/loginByOpenid") + public R loginByOpenid(@RequestParam String openid) { + return userInfoService.loginByOpenid(openid); + } + + @ApiOperation(value = "微信小程序更新用户头像") + @PostMapping("/updateAvatars") + public R updateAvatars(@RequestParam String url,HttpServletRequest request){ + String id = TokenUtils.getIdByJwtToken(request); + return userInfoService.updateAvatars(url,id); + } + + /** + * 用户绑定 + */ + @ApiOperation(value = "微信用户绑定登录") + @PostMapping("/userBinding") + public R userBinding(@RequestBody WxUserBindingReq userBindingReq) throws IOException { + String token = userInfoService.userBinding(userBindingReq); + return R.ok().put("token",token); + } + + //发送消息通知 + @ApiOperation(value = "消息通知") + @PostMapping("/pushMessage") + public R pushMessage(@RequestBody WxMssVo wxMssVo){ + return userInfoService.messageNotification(wxMssVo); + } + + /** + * 后台保存用户同意消息推送的接口 + */ + /*@RequestMapping(value="/SaveMessageAuthority.do" ,produces = "application/json;charset=UTF-8") + @ResponseBody + public String SaveMessageAuthority(String openId,String templateId,String userName ,String idCard) throws Exception { + try { + WeChatMessageAuthorityPO weChatMessageAuthority = new WeChatMessageAuthorityPO(); + weChatMessageAuthority.setOpenId(openId); + weChatMessageAuthority.setTemplateId(templateId); + weChatMessageAuthority.setIdCard(idCard); +// String temp = request.getParameter("studentName"); + if(StringUtils.isNotEmpty(userName)){ + userName = java.net.URLDecoder.decode(userName,"UTF-8"); + weChatMessageAuthority.setUserName(userName); + } + weChatMessageAuthority.setCreateDate(new Date()); + weChatMessageAuthority.setIsSend(BaseStaticParameter.NO); + iWxMassageAuthorityService.saveOrUpdate(weChatMessageAuthority); + + }catch (Exception e){ + e.printStackTrace(); + return "false"; + } + + return "true"; + }*/ + + /** + * 后台发送推送信息 + */ + /*public static boolean sendNearRemindMessage(String openId,String serveName,String windowName,String lineNumber,String waitNumber,String msg) throws Exception { + + WxMaSubscribeMessage subscribeMessage = new WxMaSubscribeMessage(); + + //跳转小程序页面路径 + subscribeMessage.setPage("pages/index/index"); + //模板消息id + subscribeMessage.setTemplateId(WxMaConfiguration.templateId); + //给谁推送 用户的openid (可以调用根据code换openid接口) + subscribeMessage.setToUser(openId); + //==========================================创建一个参数集合======================================================== + ArrayList wxMaSubscribeData = new ArrayList<>(); + +// 订阅消息参数值内容限制说明 +// ---摘自微信小程序官方:https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/subscribe-message/subscribeMessage.send.html +// 参数类别 参数说明 参数值限制 说明 +// thing.DATA 事物 20个以内字符 可汉字、数字、字母或符号组合 +// number.DATA 数字 32位以内数字 只能数字,可带小数 +// letter.DATA 字母 32位以内字母 只能字母 +// symbol.DATA 符号 5位以内符号 只能符号 +// character_string.DATA 字符串 32位以内数字、字母或符号 可数字、字母或符号组合 +// time.DATA 时间 24小时制时间格式(支持+年月日) 例如:15:01,或:2019年10月1日 15:01 +// date.DATA 日期 年月日格式(支持+24小时制时间) 例如:2019年10月1日,或:2019年10月1日 15:01 +// amount.DATA 金额 1个币种符号+10位以内纯数字,可带小数,结尾可带“元” 可带小数 +// phone_number.DATA 电话 17位以内,数字、符号 电话号码,例:+86-0766-66888866 +// car_number.DATA 车牌 8位以内,第一位与最后一位可为汉字,其余为字母或数字 车牌号码:粤A8Z888挂 +// name.DATA 姓名 10个以内纯汉字或20个以内纯字母或符号 中文名10个汉字内;纯英文名20个字母内;中文和字母混合按中文名算,10个字内 +// phrase.DATA 汉字 5个以内汉字 5个以内纯汉字,例如:配送中 + + WxMaSubscribeData wxMaSubscribeData1 = new WxMaSubscribeData(); + wxMaSubscribeData1.setName("thing1"); + wxMaSubscribeData1.setValue(serveName); + wxMaSubscribeData.add(wxMaSubscribeData1); + + WxMaSubscribeData wxMaSubscribeData2 = new WxMaSubscribeData(); + wxMaSubscribeData2.setName("thing6"); + wxMaSubscribeData2.setValue(windowName); + wxMaSubscribeData.add(wxMaSubscribeData2); + + WxMaSubscribeData wxMaSubscribeData3 = new WxMaSubscribeData(); + wxMaSubscribeData3.setName("character_string2"); + wxMaSubscribeData3.setValue(lineNumber); + wxMaSubscribeData.add(wxMaSubscribeData3); + + WxMaSubscribeData wxMaSubscribeData4 = new WxMaSubscribeData(); + wxMaSubscribeData4.setName("number3"); + wxMaSubscribeData4.setValue(waitNumber); + wxMaSubscribeData.add(wxMaSubscribeData4); + + WxMaSubscribeData wxMaSubscribeData5 = new WxMaSubscribeData(); + wxMaSubscribeData5.setName("thing5"); + wxMaSubscribeData5.setValue(msg);//"快到您了,请关注窗口和叫号情况" + wxMaSubscribeData.add(wxMaSubscribeData5); + + //把集合给大的data + subscribeMessage.setData(wxMaSubscribeData); + //=========================================封装参数集合完毕======================================================== + + try { + System.out.println(JsonUtil.toJSONString(subscribeMessage)); + //获取微信小程序配置: + + final WxMaService wxService = WxMaConfiguration.getMaService(WxMaConfiguration.appid); + //进行推送 + wxService.getMsgService().sendSubscribeMsg(subscribeMessage); + return true; + } catch (Exception e) { + e.printStackTrace(); + System.out.println(e.toString()); + } + return false; + }*/ + + @ApiOperation(value = "公众号配置") + @GetMapping("/publicConfiguration") + protected void publicConfiguration(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + // TODO Auto-generated method stub + + String signature=request.getParameter("signature"); + String timestamp=request.getParameter("timestamp"); + String nonce=request.getParameter("nonce"); + String echostr=request.getParameter("echostr"); + String token="somelog";//这里填基本配置中的token + String jiami=""; + try { + jiami= SHA1.getSHA1(token, timestamp, nonce,"");//这里是对三个参数进行加密 + } catch (AesException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + System.out.println("加密"+jiami); + System.out.println("本身"+signature); + PrintWriter out=response.getWriter(); + if(jiami.equals(signature)) out.print(echostr); + } + + +} diff --git a/users/src/main/java/com/huoran/users/controller/UserRoleController.java b/users/src/main/java/com/huoran/users/controller/UserRoleController.java new file mode 100644 index 0000000..285b16e --- /dev/null +++ b/users/src/main/java/com/huoran/users/controller/UserRoleController.java @@ -0,0 +1,113 @@ +package com.huoran.users.controller; + + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.common.response.R; +import com.huoran.common.utils.TokenUtils; +import com.huoran.users.entity.Permission; +import com.huoran.users.entity.RolePermission; +import com.huoran.users.entity.UserRole; +import com.huoran.users.entity.vo.DataPermissionVo; +import com.huoran.users.service.PermissionService; +import com.huoran.users.service.RolePermissionService; +import com.huoran.users.service.UserRoleService; +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 javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + *

+ * 用户角色表 前端控制器 + *

+ * + * @author chen + * @since 2021-09-29 + */ +@Api(tags = "账号角色管理") +@RestController +@RequestMapping("/users/user-role") +public class UserRoleController { + + @Autowired + private UserRoleService userRoleService; + + @Autowired + private PermissionService permissionService; + + @Autowired + private RolePermissionService rolePermissionService; + + @ApiOperation(value = "查询当前平台登录账号角色权限菜单") + @GetMapping("/getUserRolesPermissionMenu") + public R getUserRolesPermissionMenu( + @ApiParam(name = "platformId", value = "平台id", required = true) + @RequestParam Integer platformId, + @ApiParam(name = "teamId", value = "团队id", required = false) + @RequestParam(required = false) Integer teamId,HttpServletRequest request) { + String accountId = TokenUtils.getIdByJwtToken(request); + List roles = userRoleService.queryAccountRoles(accountId,teamId); + String roleIds = ""; + if (roles!=null && !roles.isEmpty()){ + for (Integer id : roles) { + roleIds += id +","; + } + roleIds = roleIds.substring(0,roleIds.length()-1); + }else { + return R.error("该账号无权限!"); + } + List list = permissionService.selectRoleMenu(roleIds,platformId); + + List permissionVoList = null; + //中台查询数据权限 + if (platformId==3){ + permissionVoList = permissionService.queryDataPermission(roleIds); + } + return R.ok().put("permissionMenu", list).put("dataPermissionList",permissionVoList); + } + + @ApiOperation(value = "账号赋予角色") + @PostMapping("/rolePermissionService") + public R accountAssignmentRoles( + @ApiParam(name = "accountId", value = "账号id", required = true) + @RequestParam Integer accountId, + @ApiParam(name = "roleIds", value = "角色ids", required = true) + @RequestParam List roleIds, + @ApiParam(name = "teamId", value = "团队id", required = false) + @RequestParam(value = "teamId",required = false) Integer teamId) { + int save = 0; + if (!roleIds.isEmpty()){ + for (Integer roleId:roleIds){ + UserRole userRole = new UserRole(); + userRole.setAccountId(accountId); + userRole.setRoleId(roleId); + if (teamId!=null){ + userRole.setTeamId(teamId); + } + userRoleService.save(userRole); + ++save; + } + } + return save > 0 ? R.ok() : R.error(); + } + + @ApiOperation(value = "角色赋予所有权限") + @GetMapping("/grantAllPermissions") + public void grantAllPermissions(@RequestParam Integer roleId) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.select("id"); + List list = permissionService.list(wrapper); + list.forEach(permission -> { + RolePermission rolePermission = new RolePermission(); + rolePermission.setRoleId(roleId); + rolePermission.setPermissionId(permission.getId()); + rolePermissionService.save(rolePermission); + }); + } + +} + diff --git a/users/src/main/java/com/huoran/users/entity/Class.java b/users/src/main/java/com/huoran/users/entity/Class.java new file mode 100644 index 0000000..c66457c --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/Class.java @@ -0,0 +1,45 @@ +package com.huoran.users.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + *

+ * 班级表 + *

+ * + * @author lr + * @since 2021-08-18 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ol_class") +@ApiModel(value = "Class对象", description = "班级表") +public class Class implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "班级名称") + private String className; + + @ApiModelProperty(value = "是否删除(0、未删除 1、已删除)") + private Integer isDel; + + @ApiModelProperty(value = "创建时间") + private String createTime; + + +} diff --git a/users/src/main/java/com/huoran/users/entity/DataPermission.java b/users/src/main/java/com/huoran/users/entity/DataPermission.java new file mode 100644 index 0000000..a1b2e3b --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/DataPermission.java @@ -0,0 +1,58 @@ +package com.huoran.users.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; +import java.util.Date; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * + *

+ * + * @author chen + * @since 2022-10-13 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="DataPermission对象", description="") +public class DataPermission implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "权限id") + private Integer permissionId; + + @ApiModelProperty(value = "供应商id") + private Integer supplierId; + + @ApiModelProperty(value = "角色id") + private Integer roleId; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date updateTime; + + +} diff --git a/users/src/main/java/com/huoran/users/entity/DataRole.java b/users/src/main/java/com/huoran/users/entity/DataRole.java new file mode 100644 index 0000000..0b77371 --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/DataRole.java @@ -0,0 +1,48 @@ +package com.huoran.users.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @描述:数据平台-角色表 + * @作者: Rong + * @日期: 2021-06-24 + */ +@Data +@ApiModel(value = "数据平台-角色表") +@TableName("data_role") +public class DataRole implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.ID_WORKER_STR) + @ApiModelProperty(value = "角色id") + private String id; + + @ApiModelProperty(value = "角色名称") + private String roleName; + + @ApiModelProperty(value = "角色编码") + private String roleCode; + + @ApiModelProperty(value = "备注") + private String remark; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "绑定客户id") + private Integer clientId; + + +} \ No newline at end of file diff --git a/users/src/main/java/com/huoran/users/entity/HrPersonalFile.java b/users/src/main/java/com/huoran/users/entity/HrPersonalFile.java new file mode 100644 index 0000000..7bd9336 --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/HrPersonalFile.java @@ -0,0 +1,96 @@ +package com.huoran.users.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; + +/** + *

+ * 个人档案表 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@Data +@TableName("hr_personal_file") +public class HrPersonalFile implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 个人档案id + */ + @TableId(value = "personal_file_id", type = IdType.AUTO) + private Integer personalFileId; + + /** + * 个人职业id(1、学生 2、老师) + */ + private Integer personalCareerId; + + /** + * 学校id + */ + private Integer schoolId; + + /** + * 学校名称 + */ + private String schoolName; + + /** + * 绑定学科id + */ + private Integer disciplineId; + + /** + * 绑定学科名称 + */ + private String disciplineName; + + /** + * 绑定专业类id + */ + private Integer professionalClassId; + + /** + * 绑定专业类名称 + */ + private String professionalClassName; + + /** + * 绑定专业id + */ + private Integer professionalId; + + /** + * 绑定专业名称 + */ + private String professionalName; + + /** + * 用户id + */ + private Integer userId; + + /** + * 创建时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + /** + * 修改时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + +} diff --git a/users/src/main/java/com/huoran/users/entity/HrUserAccount.java b/users/src/main/java/com/huoran/users/entity/HrUserAccount.java new file mode 100644 index 0000000..f53030c --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/HrUserAccount.java @@ -0,0 +1,133 @@ +package com.huoran.users.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + *

+ * 各个平台账号表 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@Data +@TableName("hr_user_account") +public class HrUserAccount implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键id(平台用户id) + */ + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + /** + * 用户表id + */ + private Integer userId; + + @TableField(exist = false) + private String userName; + + private Integer customerId; + + /** + * 账号(此字段弃用)显示学号/工号 + */ + private String account; + + /** + * 密码 + */ + private String password; + + /** + * 工号 + */ + private String workNumber; + + @ApiModelProperty("手机号(平台唯一标识)") + // @TableField(strategy = FieldStrategy.IGNORED) + private String phone; + + /** + * 角色id (此字段弃用,角色参见user_role表) + */ + private String roleId; + + /** + * 绑定院校id + */ + private Integer schoolId; + + @TableField(exist = false) + private String schoolName; + + /** + * 所属平台:1->职站 2->数据平台 + */ + private String platformId; + + @TableField(exist = false) + private String platformName; + + /** + * 平台(系统)绑定时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private Date platformBindTime; + + /** + * 平台端区分:0->教师端 1->学生端 + */ + private Integer type; + + @TableField(exist = false) + private String typeName; + + /** + * 是否删除(0、未删除 1、已删除) + */ + @TableLogic + private Integer isDel; + + /** + * 是否禁用(0->禁用,1->启用) + */ + //@TableLogic(delval = "0", value = "1") + private Integer isEnable; + + + /** + * 创建时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + /** + * 修改时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "绑定时间") + private String phoneBindingTime; + + @ApiModelProperty(value = "小程序openid") + private String appOpenId; + + @ApiModelProperty(value = "开放平台与公众平台唯一id") + private String unionid; + +} diff --git a/users/src/main/java/com/huoran/users/entity/HrUserInfo.java b/users/src/main/java/com/huoran/users/entity/HrUserInfo.java new file mode 100644 index 0000000..cbc6f1a --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/HrUserInfo.java @@ -0,0 +1,181 @@ +package com.huoran.users.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 用户信息表 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@Data +@TableName("hr_user_info") +public class HrUserInfo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 用户id + */ + @ApiModelProperty("用户id") + @TableId(value = "user_id", type = IdType.AUTO) + private Integer userId; + + /** + * 用户姓名 + */ + @ApiModelProperty("用户姓名") + private String userName; + + /** + * 唯一标识账号 + */ + @ApiModelProperty("唯一标识账号") + private String uniqueIdentification; + + /** + * 证件类型(1、身份证) + */ + @ApiModelProperty("证件类型(1、身份证)") + private Integer documentType; + + /** + * 证件号码 + */ + @ApiModelProperty("证件号码") + private String idNumber; + + /** + * 绑定省份id + */ + @ApiModelProperty("绑定省份id") + private Integer provinceId; + + @ApiModelProperty("省份名称") + @TableField(exist = false) + private String provinceName; + + /** + * 绑定城市id + */ + @ApiModelProperty("绑定城市id") + private Integer cityId; + + @ApiModelProperty("城市名称") + @TableField(exist = false) + private String cityName; + + /** + * 国家归属地 + */ + @ApiModelProperty("国家归属地") + private String countries; + + /** + * 出生日期 + */ + @ApiModelProperty("出生日期") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private Date dateBirth; + + /** + * 教育程度 + */ + @ApiModelProperty("教育程度") + private Integer educationDegree; + + /** + * 绑定学校id + */ + @ApiModelProperty("绑定学校id") + private Integer schoolId; + + @ApiModelProperty("学校名称") + @TableField(exist = false) + private String schoolName; + + /** + * 电话(此字段弃用) + */ + /*@ApiModelProperty("电话") + private String phone;*/ + + @ApiModelProperty("邮箱") + private String email; + + @ApiModelProperty("微信号") + private String wechatId; + + /** + * 登陆次数 + */ + @ApiModelProperty("登陆次数") + private Integer loginNumber; + + /** + * 性别(1、男 2、女) + */ + @ApiModelProperty("性别(1、男 2、女)") + private Integer sex; + + /** + * 用户头像路径 + */ + @ApiModelProperty("用户头像路径") + private String userAvatars; + + /** + * 是否删除(0->未删除;1->已删除) + */ + @ApiModelProperty("是否删除(0->未删除;1->已删除)") + @TableLogic + private Integer isDel; + + /** + * 最后登陆时间 + */ + @ApiModelProperty("最后登陆时间") + private Date lastLoginTime; + + /** + * 绑定多个角色id + */ + @ApiModelProperty("绑定多个角色id") + private String roleId; + + /** + * 是否禁用(0->禁用,1->启用) + */ + @ApiModelProperty("是否禁用(0->禁用,1->启用)") + private Integer isEnable; + + /** + * 组织关系:1->有组织关系;2->无组织关系; + */ + @ApiModelProperty("组织关系:1->有组织关系;2->无组织关系;") + private Integer organizationalRelation; + + /** + * 更新时间 + */ + @ApiModelProperty("更新时间") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @TableField(fill = FieldFill.INSERT) + private Date createTime; +} diff --git a/users/src/main/java/com/huoran/users/entity/Order.java b/users/src/main/java/com/huoran/users/entity/Order.java new file mode 100644 index 0000000..feb6528 --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/Order.java @@ -0,0 +1,92 @@ +package com.huoran.users.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 订单表 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@Data +@TableName("hr_order") +public class Order implements Serializable { + + private static final long serialVersionUID = -6471558434681123441L; + + @ApiModelProperty(value = "主键Id") + @TableId(value = "order_id", type = IdType.AUTO) + private Integer orderId; + + @ApiModelProperty(value = "订单编号") + private String orderNumber; + + @ApiModelProperty(value = "订单内容") + @TableField(exist = false) + private String orderContent; + + @ApiModelProperty(value = "绑定客户id") + private Integer customerId; + + @ApiModelProperty(value = "订单客户名称") + @NotNull(message = "客户名称不能为空") + private String customerName; + + @ApiModelProperty(value = "订单金额") + @NotNull(message = "订单金额不能为空") + private String orderAmount; + + @ApiModelProperty(value = "订单名称") + private String orderName; + + @ApiModelProperty(value = "订单类型(1、正式 2、试用)") + @NotNull(message = "订单金额不能为空") + private Integer orderType; + + @ApiModelProperty(value = "订单状态(1、待发货 2、已完成 3、已取消)") + private Integer orderStatus; + + @ApiModelProperty(value = "订单性质(1、初签 2、续签)") + private Integer orderNature; + + @ApiModelProperty(value = "省份id") + @NotNull(message = "省份不能为空") + private Integer provinceId; + + @ApiModelProperty(value = "城市id") + @NotNull(message = "城市不能为空") + private Integer cityId; + + @ApiModelProperty(value = "订单联系人") + private String orderContact; + + @ApiModelProperty(value = "电话") + private String phone; + + @ApiModelProperty(value = "邮箱") + private String email; + + @ApiModelProperty(value = "是否删除(0、未删除 1、已删除)") + @TableLogic(value = "0",delval = "1") + private int isDel; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date updateTime; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date createTime; + +} diff --git a/users/src/main/java/com/huoran/users/entity/OrderOther.java b/users/src/main/java/com/huoran/users/entity/OrderOther.java new file mode 100644 index 0000000..691bf54 --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/OrderOther.java @@ -0,0 +1,101 @@ +package com.huoran.users.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.Size; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + *

+ * 订单其他信息(包含课程权限、数据平台权限、合同信息等) + *

+ * + * @author cheney + * @since 2021-07-01 + */ +@Data +@TableName("order_other") +@ApiModel(value="OrderOther对象", description="订单其他信息(包含课程权限、数据平台权限、合同信息等)") +public class OrderOther implements Serializable { + + private static final long serialVersionUID = 6473128434681123441L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "订单id") + private Integer orderId; + + @ApiModelProperty(value = "数据产品或课程id(根据权限authority字段判断)") + private Integer dataOrCourseId; + + @ApiModelProperty(value = "数据产品或课程名称") + private String productName; + + @ApiModelProperty(value = "端口id(预留处理)") + private Integer portId; + + @ApiModelProperty(value = "使用期限(以月为单位)") + private Integer periodOfUse; + + @ApiModelProperty(value = "剩余期限(以天为单位)") + private Integer remainingPeriod; + + @ApiModelProperty(value = "成交价(以万位单位)") + private BigDecimal finalPrice; + + @ApiModelProperty(value = "总金额(以万为单位)") + private BigDecimal totalAmount; + + @ApiModelProperty(value = "市场价(以万为单位)") + private BigDecimal marketValue; + + @ApiModelProperty(value = "折扣率(百分比)") + private String discountRate; + + @ApiModelProperty(value = "是否发货(0未发货,1已发货,默认不发货)") + @Size(max = 1) + private Integer ship; + + @ApiModelProperty(value = "区分权限(0为数据平台权限,1为课程权限,对应data_or_course_id)") + @Size(max = 1) + private Integer authority; + + @ApiModelProperty(value = "是否开启(0不开启,1开启,发货后,默认开启)") + @Size(max = 1) + private Integer isEnable; + + @ApiModelProperty(value = "账号数") + private Integer accountNum; + + @ApiModelProperty(value = "是否删除(0、未删除 1、已删除)") + @TableLogic(value = "0",delval = "1") + private Integer isDel; + + @ApiModelProperty(value = "使用开始时间") + @TableField(fill = FieldFill.INSERT) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date startTime; + + @ApiModelProperty(value = "使用结束时间") + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date endTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date updateTime; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date createTime; + +} diff --git a/users/src/main/java/com/huoran/users/entity/Permission.java b/users/src/main/java/com/huoran/users/entity/Permission.java new file mode 100644 index 0000000..3c27e50 --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/Permission.java @@ -0,0 +1,91 @@ +package com.huoran.users.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; +import java.io.Serializable; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 权限表 + *

+ * + * @author chen + * @since 2021-09-29 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("acl_permission") +@ApiModel(value="Permission对象", description="权限表") +public class Permission implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "所属上级") + private Integer pid; + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + @ApiModelProperty(value = "平台id") + private Integer platformId; + + @ApiModelProperty(value = "pc端为0、小程序端为1") + private Integer port; + + @ApiModelProperty(value = "权限名称") + private String name; + + @ApiModelProperty(value = "权限类型(1:菜单,2:按钮)") + private Integer type; + + @ApiModelProperty(value = "权限值") + private String permissionValue; + + @ApiModelProperty(value = "访问路径") + private String path; + + @ApiModelProperty(value = "组件路径") + private String component; + + @ApiModelProperty(value = "图标") + private String icon; + + @ApiModelProperty(value = "状态(0:正常,1:禁止)") + private Integer status; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date updateTime; + + @ApiModelProperty(value = "层级") + @TableField(exist = false) + private Integer level; + + @ApiModelProperty(value = "下级") + @TableField(exist = false) + private List children; + +/* @ApiModelProperty(value = "是否选中") + @TableField(exist = false) + private boolean isSelect;*/ +} diff --git a/users/src/main/java/com/huoran/users/entity/PlatformLogin.java b/users/src/main/java/com/huoran/users/entity/PlatformLogin.java new file mode 100644 index 0000000..2882242 --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/PlatformLogin.java @@ -0,0 +1,47 @@ +package com.huoran.users.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 各平台登录统计 + *

+ * + * @author chen + * @since 2022-09-13 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="PlatformLogin对象", description="各平台登录统计") +public class PlatformLogin implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "平台id") + private Integer platform; + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + +} diff --git a/users/src/main/java/com/huoran/users/entity/Role.java b/users/src/main/java/com/huoran/users/entity/Role.java new file mode 100644 index 0000000..0b0d303 --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/Role.java @@ -0,0 +1,80 @@ +package com.huoran.users.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; +import java.io.Serializable; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotNull; + +/** + *

+ * 角色表 + *

+ * + * @author chen + * @since 2021-09-29 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("acl_role") +@ApiModel(value="Role对象", description="角色表") +public class Role implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "角色id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + @ApiModelProperty(value = "平台id") + @NotNull(message = "平台id不能为空") + private Integer platformId; + + @ApiModelProperty(value = "pc端为0、小程序端为1") + private Integer port; + + @ApiModelProperty(value = "角色名称") + @NotNull(message = "角色名称不能为空") + @Length(max = 20,message = "角色名称请输入20个字以内") + private String roleName; + + @ApiModelProperty(value = "角色编码") + private String roleCode; + + @ApiModelProperty(value = "备注") + @Length(max = 50,message = "描述请输入50个字以内") + private String remark; + + @ApiModelProperty(value = "权限id") + @TableField(exist = false) + private Integer[] permissionId; + + @ApiModelProperty(value = "数据权限集合") + @TableField(exist = false) + private List dataPermissionList; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date updateTime; + +} diff --git a/users/src/main/java/com/huoran/users/entity/RolePermission.java b/users/src/main/java/com/huoran/users/entity/RolePermission.java new file mode 100644 index 0000000..7167c99 --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/RolePermission.java @@ -0,0 +1,52 @@ +package com.huoran.users.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 角色权限表 + *

+ * + * @author chen + * @since 2021-09-29 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("acl_role_permission") +@ApiModel(value="RolePermission对象", description="角色权限表") +public class RolePermission implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "角色id") + private Integer roleId; + + @ApiModelProperty(value = "权限id") + private Integer permissionId; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date updateTime; + +} diff --git a/users/src/main/java/com/huoran/users/entity/Student.java b/users/src/main/java/com/huoran/users/entity/Student.java new file mode 100644 index 0000000..77abbb2 --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/Student.java @@ -0,0 +1,47 @@ +package com.huoran.users.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * @描述:学生表 + * @作者: Rong + * @日期: 2021-08-25 + */ +@Data +@ApiModel(value = "学生表") +@TableName("ol_student") +public class Student implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "主键") + private Integer id; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "班级id(可多个班级逗号隔开,未加入班级的默认为0)") + private Integer classId; + + @ApiModelProperty(value = "创建时间") + private LocalDateTime createTime; + + @ApiModelProperty(value = "更新时间") + private LocalDateTime updateTime; + + private Integer isDel; + + +} \ No newline at end of file diff --git a/users/src/main/java/com/huoran/users/entity/Supplier.java b/users/src/main/java/com/huoran/users/entity/Supplier.java new file mode 100644 index 0000000..ef0f293 --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/Supplier.java @@ -0,0 +1,50 @@ +package com.huoran.users.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 供应商表 + *

+ * + * @author chen + * @since 2022-10-13 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("hr_supplier") +@ApiModel(value="Supplier对象", description="供应商表") +public class Supplier implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键id") + @TableId(value = "supplier_id", type = IdType.AUTO) + private Integer supplierId; + + @ApiModelProperty(value = "供应商名称") + private String supplierName; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date updateTime; + + +} diff --git a/users/src/main/java/com/huoran/users/entity/SysPlatform.java b/users/src/main/java/com/huoran/users/entity/SysPlatform.java new file mode 100644 index 0000000..dbd0d96 --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/SysPlatform.java @@ -0,0 +1,56 @@ +package com.huoran.users.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; + +/** + *

+ * 平台表 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@Data +@TableName("sys_platform") +public class SysPlatform implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 平台id + */ + @TableId(value = "platform_id", type = IdType.AUTO) + private Integer platformId; + + /** + * 平台名称 + */ + private String platformName; + + /** + * 平台域名 + */ + private String domainName; + + /** + * 创建时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + /** + * 修改时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + +} diff --git a/users/src/main/java/com/huoran/users/entity/UserRole.java b/users/src/main/java/com/huoran/users/entity/UserRole.java new file mode 100644 index 0000000..0cd2283 --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/UserRole.java @@ -0,0 +1,60 @@ +package com.huoran.users.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 用户角色表 + *

+ * + * @author chen + * @since 2021-09-29 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("acl_user_role") +@ApiModel(value="UserRole对象", description="用户角色表") +public class UserRole implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "角色id") + private Integer roleId; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "逻辑删除 1(true)已删除, 0(false)未删除") + @TableLogic + private Boolean isDel; + + @ApiModelProperty(value = "团队id") + private Integer teamId; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") + private Date updateTime; + + +} diff --git a/users/src/main/java/com/huoran/users/entity/dto/LoginDTO.java b/users/src/main/java/com/huoran/users/entity/dto/LoginDTO.java new file mode 100644 index 0000000..520d978 --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/dto/LoginDTO.java @@ -0,0 +1,36 @@ +package com.huoran.users.entity.dto; + +import com.huoran.users.entity.HrUserAccount; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * @Author chen + * @DATE 2021/7/7 16:24 + * @Version 1.0 + */ +@Data +@Accessors(chain = true) +@ApiModel(value = "LoginDTO",description = "登录传输信息") +public class LoginDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("token") + private String token; + + @ApiModelProperty("是否为客户") + private boolean customer; + + @ApiModelProperty("客户名称") + private String customerName; + + @ApiModelProperty("手机绑定账号信息") + private ArrayList userAccounts; +} diff --git a/users/src/main/java/com/huoran/users/entity/dto/MiniprogramData.java b/users/src/main/java/com/huoran/users/entity/dto/MiniprogramData.java new file mode 100644 index 0000000..e99e75c --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/dto/MiniprogramData.java @@ -0,0 +1,12 @@ +package com.huoran.users.entity.dto; + +import lombok.Data; + +@Data +public class MiniprogramData { + + + private String appid; + + private String pagepath; +} diff --git a/users/src/main/java/com/huoran/users/entity/dto/PushDTO.java b/users/src/main/java/com/huoran/users/entity/dto/PushDTO.java new file mode 100644 index 0000000..2f1007d --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/dto/PushDTO.java @@ -0,0 +1,34 @@ +package com.huoran.users.entity.dto; + +import lombok.Data; + +import java.util.Map; + +@Data +public class PushDTO { + /** + * 用户openid + */ + private String touser; + /** + * //模版id + */ + private String template_id; + /** + * 默认 + */ + private String page = "pages/index/index"; + /** + * 跳转小程序页面 + */ + private MiniprogramData miniprogram; + /** + * 放大那个推送字段 + */ + private String emphasisKeyword = "keyword1.DATA"; + /** + * 推送文字 + */ + private Map data; + +} diff --git a/users/src/main/java/com/huoran/users/entity/dto/TemplateData.java b/users/src/main/java/com/huoran/users/entity/dto/TemplateData.java new file mode 100644 index 0000000..8d8d11c --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/dto/TemplateData.java @@ -0,0 +1,12 @@ +package com.huoran.users.entity.dto; + +import lombok.Data; + +@Data +public class TemplateData { + private String value; + + public TemplateData(String value) { + this.value = value; + } +} diff --git a/users/src/main/java/com/huoran/users/entity/req/AddArchitectureReq.java b/users/src/main/java/com/huoran/users/entity/req/AddArchitectureReq.java new file mode 100644 index 0000000..32f633e --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/req/AddArchitectureReq.java @@ -0,0 +1,41 @@ +package com.huoran.users.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + *

+ * 学生组织架构 + *

+ * + * @author lr + * @since 2021-08-24 + */ +@Data +@ApiModel(value = "新增组织架构请参数", description = "新增组织架构请参数") +public class AddArchitectureReq { + + + @ApiModelProperty(value = "组织名称") + @NotNull(message = "组织名称不能为空") + private String organizationName; + + @ApiModelProperty(value = "父id 一级为0") + @NotNull(message = "父id不能为空") + private Integer parentId; + + + @ApiModelProperty(value = "学校id") + @NotNull(message = "学校id不能为空") + private Integer schoolId; + + + @ApiModelProperty(value = "层级") + @NotNull(message = "层级不能为空") + private Integer level; + + +} diff --git a/users/src/main/java/com/huoran/users/entity/req/AddStudentReq.java b/users/src/main/java/com/huoran/users/entity/req/AddStudentReq.java new file mode 100644 index 0000000..4e02f84 --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/req/AddStudentReq.java @@ -0,0 +1,37 @@ +package com.huoran.users.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +/** + *

+ * 学生表 + *

+ * + * @author lr + * @since 2021-08-24 + */ +@Data +@ApiModel(value = "Student对象", description = "学生表") +public class AddStudentReq { + + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "班级id(可多个班级逗号隔开,未加入班级的默认为0)") + private Integer classId; + + @ApiModelProperty(value = "创建时间") + private Date createTime; + + @ApiModelProperty(value = "更新时间") + private Date updateTime; + + private Integer isDel; + + +} diff --git a/users/src/main/java/com/huoran/users/entity/req/AppletCallbackReq.java b/users/src/main/java/com/huoran/users/entity/req/AppletCallbackReq.java new file mode 100644 index 0000000..9a36107 --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/req/AppletCallbackReq.java @@ -0,0 +1,14 @@ +package com.huoran.users.entity.req; + +import lombok.Data; + +/** + * @Author chen + * @DATE 2022/7/12 15:03 + * @Version 1.0 + */ +@Data +public class AppletCallbackReq { + private String code; + private String avatarUrl; +} diff --git a/users/src/main/java/com/huoran/users/entity/req/DataUserListReq.java b/users/src/main/java/com/huoran/users/entity/req/DataUserListReq.java new file mode 100644 index 0000000..d291584 --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/req/DataUserListReq.java @@ -0,0 +1,47 @@ +package com.huoran.users.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @描述:数据平台产品表 + * @作者: Rong + * @日期: 2021-06-28 + */ +@Data +@ApiModel(value = "用户管理-请求参数") +public class DataUserListReq { + + + @ApiModelProperty(value = "开始时间") + private String createTime; + + @ApiModelProperty(value = "更新时间") + private String endTime; + + @ApiModelProperty(value = "是否禁用(0->禁用,1->启用)") + private Integer isEnable; + + @ApiModelProperty(value = "关键词(员工、姓名、工号)") + private String keyWord; + + + @ApiModelProperty(value = "所属平台:1->职站 2->数据平台") + private String platformId; + + + @ApiModelProperty(value = "数据平台角色id") + private String roleId; + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + + @ApiModelProperty(value = "当前页数") + private Integer pageNum; + @ApiModelProperty(value = "当前页需要显示的数量") + private Integer pageSize; + + +} \ No newline at end of file diff --git a/users/src/main/java/com/huoran/users/entity/req/ExcelImpUserInfoReq.java b/users/src/main/java/com/huoran/users/entity/req/ExcelImpUserInfoReq.java new file mode 100644 index 0000000..c2ec427 --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/req/ExcelImpUserInfoReq.java @@ -0,0 +1,65 @@ +package com.huoran.users.entity.req; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.util.Date; + +/** + * @描述:用户信息表 + * @作者: Rong + * @日期: 2021-07-01 + */ +@Data +@ApiModel(value = "批量导入所需") +public class ExcelImpUserInfoReq { + + + + @ApiModelProperty(value = "用户姓名") + @NotBlank(message = "用户姓名不能为空") + private String userName; + + @ApiModelProperty(value = "唯一标识账号") + private String uniqueIdentification; + + + @ApiModelProperty(value = "工号") + @NotBlank(message = "工号不能为空") + private String workNumber; + + @ApiModelProperty(value = "绑定的角色id") + @NotBlank(message = "角色不能为空") + private String roleId; + + @ApiModelProperty(value = "绑定院校id") + private Integer schoolId; + + @ApiModelProperty(value = "所属平台:1->职站 2->数据平台") + private Integer platformId; + + @ApiModelProperty(value = "平台端区分:0->教师端 1->学生端") + private Integer type; + + @ApiModelProperty(value = "邮箱") + private String email; + + @ApiModelProperty(value = "手机号") + private String phone; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + +} \ No newline at end of file diff --git a/users/src/main/java/com/huoran/users/entity/req/ModifyUserInfoReq.java b/users/src/main/java/com/huoran/users/entity/req/ModifyUserInfoReq.java new file mode 100644 index 0000000..09aad5b --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/req/ModifyUserInfoReq.java @@ -0,0 +1,70 @@ +package com.huoran.users.entity.req; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.util.Date; +import java.util.List; + +/** + * @描述:用户信息表 + * @作者: Rong + * @日期: 2021-07-01 + */ +@Data +@ApiModel(value = "用户信息表") +public class ModifyUserInfoReq { + + + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "用户id") + private Integer userId; + + + @ApiModelProperty(value = "用户token") + private String token; + + @ApiModelProperty(value = "用户姓名") + @NotBlank(message = "用户姓名不能为空") + private String userName; + + @ApiModelProperty(value = "账号") + @NotBlank(message = "账号不能为空") + private String account; + + + @ApiModelProperty(value = "工号") + @NotBlank(message = "工号不能为空") + private String workNumber; + + + @ApiModelProperty(value = "邮箱") + private String email; + + @ApiModelProperty(value = "手机号") + private String phone; + + + @ApiModelProperty(value = "是否禁用(0->禁用,1->启用)") + private Integer isEnable; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "账户id") + private Integer accountId; + + /*@ApiModelProperty(value = "绑定院校id") + private Integer schoolId;*/ + + + @ApiModelProperty(value = "绑定的多个角色id") + private List roleIds; +} \ No newline at end of file diff --git a/users/src/main/java/com/huoran/users/entity/req/RegisterReq.java b/users/src/main/java/com/huoran/users/entity/req/RegisterReq.java new file mode 100644 index 0000000..e088e78 --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/req/RegisterReq.java @@ -0,0 +1,47 @@ +package com.huoran.users.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +@Data +public class RegisterReq { + + @ApiModelProperty(value = "学号/工号") + @NotNull(message = "学生学号不能为空!") + private String workNumber; + + @ApiModelProperty(value = "学生姓名") + @NotNull(message = "学生姓名不能为空!") + private String userName; + + @NotNull(message = "账号不能为空!") + @ApiModelProperty(value = "账号") + private String account; + + @NotNull(message = "密码不能为空!") + @ApiModelProperty(value = "密码") + private String password; + + @ApiModelProperty(value = "唯一标识账号") + @NotNull(message = "唯一标识不能为空!") + private String uniqueIdentification; + + @ApiModelProperty(value = "电话") + @NotNull(message = "手机号不能为空") + private String phone; + + @ApiModelProperty(value = "邮箱") + private String email; + + @ApiModelProperty(value = "学校id") + private Integer schoolId; + + @ApiModelProperty("验证码") + private String code; + + @ApiModelProperty("内部标识") + private Integer identification; +} diff --git a/users/src/main/java/com/huoran/users/entity/req/ResetPwdReq.java b/users/src/main/java/com/huoran/users/entity/req/ResetPwdReq.java new file mode 100644 index 0000000..52823da --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/req/ResetPwdReq.java @@ -0,0 +1,54 @@ +package com.huoran.users.entity.req; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Pattern; +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 客户表 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@Data +public class ResetPwdReq implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 原密码 + */ + @NotBlank(message = "原密码不能为空!") + @ApiModelProperty("原密码") + private String password; + + /** + * 新密码1 + */ + @ApiModelProperty("新密码1") + @NotBlank(message = "新密码不能为空!") + private String newPassword; + + /** + * 新密码2 + */ + @NotBlank(message = "新密码不能为空!") + @ApiModelProperty("新密码2") + private String reNewPassword; + + /** + * 账号ID + */ + @ApiModelProperty("账号ID") + @NotNull(message = "账号ID不能为空!") + private Integer accountId; + +} diff --git a/users/src/main/java/com/huoran/users/entity/req/SaveUserInfoReq.java b/users/src/main/java/com/huoran/users/entity/req/SaveUserInfoReq.java new file mode 100644 index 0000000..63d5211 --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/req/SaveUserInfoReq.java @@ -0,0 +1,81 @@ +package com.huoran.users.entity.req; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.util.Date; +import java.util.List; + +/** + * @描述:用户信息表 + * @作者: Rong + * @日期: 2021-07-01 + */ +@Data +@ApiModel(value = "用户信息表") +public class SaveUserInfoReq { + + + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "用户id") + private Integer userId; + + @ApiModelProperty(value = "用户姓名") + private String userName; + + @ApiModelProperty(value = "账号") + @NotBlank(message = "账号不能为空") + private String account; + + @ApiModelProperty(value = "唯一标识账号") + private String uniqueIdentification; + + @ApiModelProperty(value = "密码") + private String password; + + @ApiModelProperty(value = "工号") + @NotBlank(message = "工号不能为空") + private String workNumber; + + + @ApiModelProperty(value = "绑定的多个角色id") + private List roleIds; + + + @ApiModelProperty(value = "角色id") + private String roleId; + + @ApiModelProperty(value = "绑定院校id") + private Integer schoolId; + + @ApiModelProperty(value = "所属平台:1->职站 2->数据平台") + private Integer platformId; + + + @ApiModelProperty(value = "平台端区分:0->教师端 1->学生端") + private Integer type; + + @ApiModelProperty(value = "邮箱") + private String email; + + @ApiModelProperty(value = "手机号") + private String phone; + + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + + + +} \ No newline at end of file diff --git a/users/src/main/java/com/huoran/users/entity/req/UnbindAccountsReq.java b/users/src/main/java/com/huoran/users/entity/req/UnbindAccountsReq.java new file mode 100644 index 0000000..143e32d --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/req/UnbindAccountsReq.java @@ -0,0 +1,41 @@ +package com.huoran.users.entity.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + * @Author chen + * @DATE 2022/4/25 16:48 + * @Version 1.0 + */ +@Data +public class UnbindAccountsReq { + + private List accountIds; + + @ApiModelProperty("手机号") + private String phone; + + @NotNull(message = "验证码不能为空") + private String code; + + @ApiModelProperty("学号/工号") + private String workNumber; + + @ApiModelProperty("学校") + private Integer schoolId; + + @ApiModelProperty("密码") + private String password; + + @ApiModelProperty("平台标识,1职站,2数据平台,3中台") + private Integer platform; + + @ApiModelProperty("平台端区分:0->教师端 1->学生端 2->无端") + private Integer type; + + +} diff --git a/users/src/main/java/com/huoran/users/entity/req/UserInfoReq.java b/users/src/main/java/com/huoran/users/entity/req/UserInfoReq.java new file mode 100644 index 0000000..adfa780 --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/req/UserInfoReq.java @@ -0,0 +1,42 @@ +package com.huoran.users.entity.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * @Author huoran + * @DATE 2021/6/7 16:20 + * @Version 1.0 + */ +@Data +public class UserInfoReq { + + @ApiModelProperty("国家") + private String countries; + @ApiModelProperty("省份id") + private Integer provinceId; + @ApiModelProperty("城市id") + private Integer cityId; + @ApiModelProperty("学校id") + @NotNull(message = "学校不能为空") + private String schoolId; + @ApiModelProperty("角色id") + private String roleId; + @ApiModelProperty("搜索内容") + private String searchContent; + @ApiModelProperty("月份") + private Integer month; + @ApiModelProperty("创建时间") + private String creationTime; + @ApiModelProperty("结束时间") + private String endTime; + @ApiModelProperty("平台id") + private Integer platformId; + + private Integer pageNum; + + private Integer pageSize; + +} diff --git a/users/src/main/java/com/huoran/users/entity/req/WxUserBindingReq.java b/users/src/main/java/com/huoran/users/entity/req/WxUserBindingReq.java new file mode 100644 index 0000000..1452c47 --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/req/WxUserBindingReq.java @@ -0,0 +1,16 @@ +package com.huoran.users.entity.req; + +import lombok.Data; + +/** + * @Author chen + * @DATE 2022/6/2 16:10 + * @Version 1.0 + */ +@Data +public class WxUserBindingReq { + private String openid; + private String phone; + private String unionid; + private Integer platformId; +} diff --git a/users/src/main/java/com/huoran/users/entity/res/DataUserInfoResp.java b/users/src/main/java/com/huoran/users/entity/res/DataUserInfoResp.java new file mode 100644 index 0000000..624ce21 --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/res/DataUserInfoResp.java @@ -0,0 +1,118 @@ +package com.huoran.users.entity.res; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; +import java.util.List; + +/** + * @描述:用户信息表 + * @作者: Rong + * @日期: 2021-07-01 + */ +@Data +@ApiModel(value = "用户信息") +public class DataUserInfoResp { + + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "用户id") + private Integer userId; + + @ApiModelProperty(value = "用户姓名") + private String userName; + + @ApiModelProperty(value = "唯一标识账号") + private String uniqueIdentification; + + @ApiModelProperty(value = "证件类型(1、身份证)") + private Integer documentType; + + @ApiModelProperty(value = "证件号码") + private String idNumber; + + @ApiModelProperty(value = "绑定省份id") + private Integer provinceId; + + @ApiModelProperty(value = "绑定城市id") + private Integer cityId; + + @ApiModelProperty(value = "国家归属地") + private String countries; + + @ApiModelProperty(value = "出生日期") + private String dateBirth; + + @ApiModelProperty(value = "教育程度") + private Integer educationDegree; + + @ApiModelProperty(value = "绑定学校id") + private Integer schoolId; + + @ApiModelProperty(value = "电话") + private String phone; + + @ApiModelProperty(value = "登陆次数") + private Integer loginNumber; + + @ApiModelProperty(value = "性别(1、男 2、女)") + private Integer sex; + + @ApiModelProperty(value = "用户头像路径") + private String userAvatars; + + @ApiModelProperty(value = "是否删除(0->未删除;1->已删除)") + private Integer isDel; + + @ApiModelProperty(value = "最后登陆时间") + private String lastLoginTime; + + @ApiModelProperty(value = "绑定多个角色信息") + List roleId; + + @ApiModelProperty(value = "是否禁用(0->禁用,1->启用)") + private Integer isEnable; + + @ApiModelProperty(value = "组织关系:1->有组织关系;2->无组织关系;") + private Integer organizationalRelation; + + @ApiModelProperty(value = "更新时间") + private String updateTime; + + @ApiModelProperty(value = "创建时间") + private String createTime; + + @ApiModelProperty(value = "账号") + private String account; + + @ApiModelProperty(value = "密码") + private String password; + + @ApiModelProperty(value = "工号") + private String workNumber; + + @ApiModelProperty(value = "所属平台:1->职站 2->数据平台") + private String platformId; + + @ApiModelProperty(value = "平台(系统)绑定时间") + private Date platformBindTime; + + @ApiModelProperty(value = "平台端区分:0->教师端 1->学生端") + private Integer type; + + @ApiModelProperty(value = "邮箱") + private String email; + + @ApiModelProperty(value = "微信号") + private String wechatId; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "账号角色") + private String roleName; + +} \ No newline at end of file diff --git a/users/src/main/java/com/huoran/users/entity/res/LoginStatisticsResp.java b/users/src/main/java/com/huoran/users/entity/res/LoginStatisticsResp.java new file mode 100644 index 0000000..c6b3838 --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/res/LoginStatisticsResp.java @@ -0,0 +1,17 @@ +package com.huoran.users.entity.res; + +import lombok.Data; + +/** + * @Author chen + * @DATE 2022/9/13 11:26 + * @Version 1.0 + */ +@Data +public class LoginStatisticsResp { + + private String today; + + private Integer quantity; + +} diff --git a/users/src/main/java/com/huoran/users/entity/res/PersonalFileResp.java b/users/src/main/java/com/huoran/users/entity/res/PersonalFileResp.java new file mode 100644 index 0000000..f81797c --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/res/PersonalFileResp.java @@ -0,0 +1,44 @@ +package com.huoran.users.entity.res; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * @描述:个人档案表 + * @作者: Rong + * @日期: 2022-04-21 + */ +@Data +@ApiModel(value = "个人档案表") +@TableName("hr_personal_file") +public class PersonalFileResp { + + @ApiModelProperty(value = "个人档案id") + private Integer personalFileId; + + @ApiModelProperty(value = "个人职业id(1、学生 2、老师)") + private Integer personalCareerId; + + @ApiModelProperty(value = "学校名称") + private String schoolName; + + @ApiModelProperty(value = "绑定学科名称") + private String disciplineName; + + @ApiModelProperty(value = "绑定专业类名称") + private String professionalClassName; + + @ApiModelProperty(value = "绑定专业名称") + private String professionalName; + +} \ No newline at end of file diff --git a/users/src/main/java/com/huoran/users/entity/res/ProfileDetailsRes.java b/users/src/main/java/com/huoran/users/entity/res/ProfileDetailsRes.java new file mode 100644 index 0000000..7159d9b --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/res/ProfileDetailsRes.java @@ -0,0 +1,73 @@ +package com.huoran.users.entity.res; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.huoran.common.entity.resp.PhoneBindingrResp; +import com.huoran.users.entity.HrPersonalFile; +import com.huoran.users.entity.HrUserAccount; +import com.huoran.users.entity.HrUserInfo; +import com.huoran.users.entity.SysPlatform; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.ToString; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +@Data +@ToString +public class ProfileDetailsRes { + + @ApiModelProperty("用户id") + private Integer userId; + + @ApiModelProperty("账号id") + private Integer accountId; + + @ApiModelProperty("用户姓名") + private String userName; + + @ApiModelProperty("证件号码") + private String idNumber; + + @ApiModelProperty("省份名称") + private String provinceName; + + @ApiModelProperty("城市名称") + private String cityName; + + @ApiModelProperty("所属国家") + private String countries; + + @ApiModelProperty("出生日期") + private String dateBirth; + + @ApiModelProperty("教育程度") + private Integer educationDegree; + + @ApiModelProperty("电话") + private String phone; + + @ApiModelProperty("性别(1、男 2、女)") + private Integer sex; + + @ApiModelProperty("平台端区分:0->教师端 1->学生端 2->无端") + private Integer type; + + @ApiModelProperty("角色") + private String roleName; + + @ApiModelProperty("学号/工号") + private String workNumber; + + @ApiModelProperty("个人档案List") + private List personalFileList; + + @ApiModelProperty("中台个人档案List") + private List nakadaiPersonalFileList; + +} diff --git a/users/src/main/java/com/huoran/users/entity/res/UserAccountListRes.java b/users/src/main/java/com/huoran/users/entity/res/UserAccountListRes.java new file mode 100644 index 0000000..fd10030 --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/res/UserAccountListRes.java @@ -0,0 +1,78 @@ +package com.huoran.users.entity.res; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.ToString; + +import java.io.Serializable; + +/** + *

+ * 用户管理列表 + *

+ * + * @author Qyq + * @since 2021-03-17 + */ +@Data +@ToString +public class UserAccountListRes implements Serializable { + + @ApiModelProperty("主键id") + @TableId(value = "id", type = IdType.ID_WORKER) + private Integer id; + + /** + * 用户表id + */ + @ApiModelProperty("用户表id") + private Integer userId; + + /** + * 账号 + */ + @ApiModelProperty("账号") + private String account; + + /** + * 工号 + */ + @ApiModelProperty("工号") + private String workNumber; + + /** + * 绑定的角色id + */ + @ApiModelProperty("绑定的角色id") + private String roleId; + + /** + * 绑定院校id + */ + @ApiModelProperty("绑定院校id") + private Integer schoolId; + + @ApiModelProperty("绑定院校名称") + private String schoolName; + + /** + * 所属平台:1->职站 2->数据平台 + */ + @ApiModelProperty("所属平台:1->职站 2->数据平台") + private Integer platformId; + + @ApiModelProperty("所属平台名称") + private String platformName; + + /** + * 平台端区分:0->教师端 1->学生端 + */ + @ApiModelProperty("平台端区分:0->教师端 1->学生端") + private Integer type; + + @ApiModelProperty("是否禁用(0->禁用,1->启用)") + private Integer isEnable; + +} diff --git a/users/src/main/java/com/huoran/users/entity/res/UserInfoDetailsRes.java b/users/src/main/java/com/huoran/users/entity/res/UserInfoDetailsRes.java new file mode 100644 index 0000000..07d783c --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/res/UserInfoDetailsRes.java @@ -0,0 +1,66 @@ +package com.huoran.users.entity.res; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; + +import com.huoran.common.entity.resp.PhoneBindingrResp; +import com.huoran.users.entity.HrPersonalFile; +import com.huoran.users.entity.HrUserAccount; +import com.huoran.users.entity.HrUserInfo; +import com.huoran.users.entity.SysPlatform; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.ToString; + +import java.io.Serializable; +import java.util.List; + +/** + *

+ * 用户管理列表 + *

+ * + * @author Qyq + * @since 2021-03-17 + */ +@Data +@ToString +public class UserInfoDetailsRes implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 用户id + */ + @ApiModelProperty("用户id") + @TableId(value = "userId", type = IdType.AUTO) + private Integer userId; + + /** + * 用户对象 + */ + @ApiModelProperty("用户对象") + private HrUserInfo hrUserInfo; + + @ApiModelProperty("账号List") + private List userAccountList; + + @ApiModelProperty("账号对象") + private HrUserAccount userAccount; + + /** + * 个人档案List + */ + @ApiModelProperty("个人档案List") + private List personalFileList; + + /** + * 已绑定系统/平台List + */ + @ApiModelProperty("已绑定系统/平台List") + private List platformList; + + @ApiModelProperty("已绑定平台和用户信息") + private List bindingPlatformAndUserList; + +} diff --git a/users/src/main/java/com/huoran/users/entity/res/UserInfoListRes.java b/users/src/main/java/com/huoran/users/entity/res/UserInfoListRes.java new file mode 100644 index 0000000..1c6b97f --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/res/UserInfoListRes.java @@ -0,0 +1,89 @@ +package com.huoran.users.entity.res; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.ToString; + +import java.io.Serializable; + +/** + *

+ * 用户管理列表 + *

+ * + * @author Qyq + * @since 2021-03-17 + */ +@Data +@ToString +public class UserInfoListRes implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 用户id + */ + @ApiModelProperty("用户id") + @TableId(value = "userId", type = IdType.AUTO) + private Integer userId; + + @ApiModelProperty("账号id") + private Integer accountId; + + /** + * 用户账号 + */ + @ApiModelProperty("用户账号") + private String account; + + /** + * 用户姓名 + */ + @ApiModelProperty("用户姓名") + private String userName; + + /** + * 学校名称 + */ + @ApiModelProperty("学校名称") + private String schoolName; + + /** + * 平台来源 + */ + @ApiModelProperty("平台来源") + private String platformName; + + /** + * 手机号 + */ + @ApiModelProperty("手机号") + private String phone; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + private String createTime; + + @ApiModelProperty("最近登录时间") + private String lastLoginTime; + + /** + * 登录次数 + */ + @ApiModelProperty("登录次数") + private Integer logInNumber; + + @ApiModelProperty("是否禁用(0->禁用,1->启用)") + private Integer isEnable; + + @ApiModelProperty("省份") + private String provinceName; + + @ApiModelProperty("城市") + private String cityName; + +} diff --git a/users/src/main/java/com/huoran/users/entity/res/UserRoleResp.java b/users/src/main/java/com/huoran/users/entity/res/UserRoleResp.java new file mode 100644 index 0000000..20be286 --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/res/UserRoleResp.java @@ -0,0 +1,38 @@ +package com.huoran.users.entity.res; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 用户角色表 + *

+ * + * @author chen + * @since 2021-09-29 + */ +@Data +@Accessors(chain = true) +public class UserRoleResp { + + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "角色id") + private Integer roleId; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "角色名称") + private String roleName; + +} diff --git a/users/src/main/java/com/huoran/users/entity/res/UserSchoolDetailRes.java b/users/src/main/java/com/huoran/users/entity/res/UserSchoolDetailRes.java new file mode 100644 index 0000000..0b389d0 --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/res/UserSchoolDetailRes.java @@ -0,0 +1,38 @@ +package com.huoran.users.entity.res; + + +import com.huoran.users.entity.HrUserAccount; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.ToString; + +import java.io.Serializable; +import java.util.List; + +/** + *

+ * 用户管理列表 + *

+ * + * @author Qyq + * @since 2021-03-17 + */ +@Data +@ToString +public class UserSchoolDetailRes implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 院校id + */ + @ApiModelProperty("院校id") + private Integer schoolId; + + /** + * 账号集合 + */ + @ApiModelProperty("账号集合") + private List accountList; + +} diff --git a/users/src/main/java/com/huoran/users/entity/res/UserSysDetailRes.java b/users/src/main/java/com/huoran/users/entity/res/UserSysDetailRes.java new file mode 100644 index 0000000..3c5c0c7 --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/res/UserSysDetailRes.java @@ -0,0 +1,54 @@ +package com.huoran.users.entity.res; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.ToString; + +import java.io.Serializable; +import java.util.Map; + +/** + *

+ * 用户管理列表 + *

+ * + * @author Qyq + * @since 2021-03-17 + */ +@Data +@ToString +public class UserSysDetailRes implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 用户id + */ + @ApiModelProperty("用户id") + @TableId(value = "userId", type = IdType.AUTO) + private Integer userId; + + /** + * 所属平台 + */ + @ApiModelProperty("所属平台") + private Integer platformId; + + /** + * 组织关系 + */ + @ApiModelProperty("组织关系") + private Integer organizationalRelation; + + /** + * 集合层 + */ +// @ApiModelProperty("集合层") +// private List bigList; + + @ApiModelProperty("集合层") + private Map map; + +} diff --git a/users/src/main/java/com/huoran/users/entity/vo/CheckVo.java b/users/src/main/java/com/huoran/users/entity/vo/CheckVo.java new file mode 100644 index 0000000..531e75a --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/vo/CheckVo.java @@ -0,0 +1,68 @@ +package com.huoran.users.entity.vo; + +/** + * @description + * @author: Mr.JK + * @create: 2021-07-05 18:25 + **/ + + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + * @description + * @author: Mr.JK + * @create: 2021-06-22 15:47 + **/ +@Data +@Accessors(chain = true) +@ApiModel(value = "CheckVo",description = "验证码校验参数") +public class CheckVo implements Serializable { + + private static final long serialVersionUID = 1L; + //用户id + @ApiModelProperty("用户id") + private Integer userId; + //用户的邮箱地址 + @ApiModelProperty("用户的邮箱地址") + private String email; + //验证码 + @ApiModelProperty("验证码") + private String checkCode; + //用户电话号码 + @ApiModelProperty("用户电话号码") + private String phone; + //验证码存入时间(实际时间-允许验证时间) + @ApiModelProperty("验证码存入时间(实际时间-允许验证时间)") + private String setTime; + //验证码类型(1邮箱验证码,2手机验证码) + @ApiModelProperty("验证码类型(1邮箱验证码,2手机验证码)") + private Integer types; + //用户输入的验证码 + @ApiModelProperty("用户输入的验证码") + private String code; + @ApiModelProperty("学校id") + private String schoolId; + //密码 + @ApiModelProperty("密码") + private String password; + @ApiModelProperty(value = "验证key") + private String opener; + + @ApiModelProperty(value = "用户账号") + private String account; + + @ApiModelProperty(value = "平台标识,1职站,2数据,3中台") + private String platform; + + @ApiModelProperty(value = "账号标识,0->教师端 1->学生端 2->无端") + private String mark; + +} diff --git a/users/src/main/java/com/huoran/users/entity/vo/DataPermissionVo.java b/users/src/main/java/com/huoran/users/entity/vo/DataPermissionVo.java new file mode 100644 index 0000000..968acca --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/vo/DataPermissionVo.java @@ -0,0 +1,24 @@ +package com.huoran.users.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class DataPermissionVo { + + @ApiModelProperty(value = "权限id") + private Integer permissionId; + + @ApiModelProperty(value = "权限名称") + private String permissionName; + + @ApiModelProperty(value = "供应商id") + private String supplierId; + + @ApiModelProperty(value = "供应商名称") + private String supplierName; + + @ApiModelProperty(value = "是否查询全部") + private boolean all; + +} diff --git a/users/src/main/java/com/huoran/users/entity/vo/LoginVo.java b/users/src/main/java/com/huoran/users/entity/vo/LoginVo.java new file mode 100644 index 0000000..ae78ace --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/vo/LoginVo.java @@ -0,0 +1,56 @@ +package com.huoran.users.entity.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +/** + * @Author chen + * @DATE 2021/7/7 15:22 + * @Version 1.0 + */ +@Data +@Accessors(chain = true) +@ApiModel(value = "LoginVo",description = "登录参数") +public class LoginVo { + + @ApiModelProperty("验证码") + @NotEmpty(message = "验证码不能为空") + private String code; + + @ApiModelProperty("平台标识,1职站,2数据平台,3中台") + @NotNull(message = "登录平台不能为空") + private Integer platform; + + @ApiModelProperty("平台端区分:0->教师端 1->学生端 2->无端") + @NotNull(message = "平台端口不能为空") + private Integer type; + + @ApiModelProperty("随机数") + // @NotNull(message = "随机数不能为空") + private String random; + + @ApiModelProperty("区分手机号账号登录,1为账号登录,2为手机号或邮箱登录") + @NotNull(message = "登录类型不能为空") + private Integer distinguish; + + @ApiModelProperty("学号/工号") + // @NotEmpty(message = "学号/工号不能为空") + private String workNumber; + + @ApiModelProperty("账号") + // @NotEmpty(message = "账号不能为空") + private String account; + + @ApiModelProperty("学校") + private Integer schoolId; + + @ApiModelProperty("密码") + // @NotEmpty(message = "密码不能为空") + private String password; + +} diff --git a/users/src/main/java/com/huoran/users/entity/vo/MessageBodyVo.java b/users/src/main/java/com/huoran/users/entity/vo/MessageBodyVo.java new file mode 100644 index 0000000..97fda63 --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/vo/MessageBodyVo.java @@ -0,0 +1,17 @@ +package com.huoran.users.entity.vo; + +import lombok.Data; + +@Data +public class MessageBodyVo { + //公众平台里边模板id + String templateId = "8pDVfWYqh9c-nn3CeA1NXM58pmoyQXZzkVnRFKy_l2A"; + String openId; + //服务通知中进入小程序的入口 + String page; + //学校、订单内容、审核状态 + String school; + String content; + String state; + +} diff --git a/users/src/main/java/com/huoran/users/entity/vo/UseImportFailureVo.java b/users/src/main/java/com/huoran/users/entity/vo/UseImportFailureVo.java new file mode 100644 index 0000000..fa40847 --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/vo/UseImportFailureVo.java @@ -0,0 +1,33 @@ +package com.huoran.users.entity.vo; + +import com.huoran.users.utils.poi.ExcelAttribute; +import lombok.Data; +import lombok.ToString; +import lombok.experimental.Accessors; + +@Data +@ToString +@Accessors(chain = true) +public class UseImportFailureVo { + + //第几行 + private Long index; + //账号 + /*@ExcelAttribute(sort = 0) + private String account;*/ + //用户姓名 + @ExcelAttribute(sort = 0) + private String userName; + //账户角色 + @ExcelAttribute(sort = 1) + private String roleId; + //邮箱 + @ExcelAttribute(sort = 2) + private String email; + //*学号/工号 + @ExcelAttribute(sort = 3) + private String workNumber; + //失败原因 + @ExcelAttribute(sort = 4) + private String failureMsg; +} diff --git a/users/src/main/java/com/huoran/users/entity/vo/UserPersonalEntityVo.java b/users/src/main/java/com/huoran/users/entity/vo/UserPersonalEntityVo.java new file mode 100644 index 0000000..7637363 --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/vo/UserPersonalEntityVo.java @@ -0,0 +1,23 @@ +package com.huoran.users.entity.vo; + +import com.huoran.users.entity.HrPersonalFile; +import com.huoran.users.entity.HrUserAccount; +import com.huoran.users.entity.HrUserInfo; +import lombok.Data; + +import java.util.List; + +/** + * @description + * @author: Mr.JK + * @create: 2021-06-22 14:53 + **/ +@Data +public class UserPersonalEntityVo { + + private List hrPersonalFileEntities; + + private HrUserInfo hrUserInfo; + + private HrUserAccount hrUserAccount; +} diff --git a/users/src/main/java/com/huoran/users/entity/vo/WxMssVo.java b/users/src/main/java/com/huoran/users/entity/vo/WxMssVo.java new file mode 100644 index 0000000..fc59e29 --- /dev/null +++ b/users/src/main/java/com/huoran/users/entity/vo/WxMssVo.java @@ -0,0 +1,35 @@ +package com.huoran.users.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.HashMap; + +@Data +public class WxMssVo { + //小程序用户的OpenId + @ApiModelProperty("openId") + private String touser; + //模板id + @ApiModelProperty("模板ID") + private String template_id; + //跳转首页 + @ApiModelProperty("跳转首页route") + private String page; + //接口凭证 + @ApiModelProperty("接口凭证") + private String access_token; + //环境状态 + @ApiModelProperty("环境状态") + private String miniprogram_state; + //语言 + @ApiModelProperty("语言") + private String lang; + //请求路径 + @ApiModelProperty("请求路径") + private String request_url; + //放置数据 + @ApiModelProperty("详细内容") + private HashMap map = new HashMap<>(3); + +} diff --git a/users/src/main/java/com/huoran/users/mapper/ClassMapper.java b/users/src/main/java/com/huoran/users/mapper/ClassMapper.java new file mode 100644 index 0000000..23cbb16 --- /dev/null +++ b/users/src/main/java/com/huoran/users/mapper/ClassMapper.java @@ -0,0 +1,16 @@ +package com.huoran.users.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.users.entity.Class; + +/** + *

+ * 班级表 Mapper 接口 + *

+ * + * @author lr + * @since 2021-08-18 + */ +public interface ClassMapper extends BaseMapper { + +} diff --git a/users/src/main/java/com/huoran/users/mapper/DataPermissionMapper.java b/users/src/main/java/com/huoran/users/mapper/DataPermissionMapper.java new file mode 100644 index 0000000..c998c67 --- /dev/null +++ b/users/src/main/java/com/huoran/users/mapper/DataPermissionMapper.java @@ -0,0 +1,21 @@ +package com.huoran.users.mapper; + +import com.huoran.users.entity.DataPermission; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.users.entity.vo.DataPermissionVo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author chen + * @since 2022-10-13 + */ +public interface DataPermissionMapper extends BaseMapper { + + List selectDataPermission(@Param("roleIds") String roleIds); +} diff --git a/users/src/main/java/com/huoran/users/mapper/HrPersonalFileMapper.java b/users/src/main/java/com/huoran/users/mapper/HrPersonalFileMapper.java new file mode 100644 index 0000000..d460c61 --- /dev/null +++ b/users/src/main/java/com/huoran/users/mapper/HrPersonalFileMapper.java @@ -0,0 +1,30 @@ +package com.huoran.users.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.users.entity.HrPersonalFile; +import com.huoran.users.entity.res.PersonalFileResp; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 个人档案表 Mapper 接口 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@Mapper +public interface HrPersonalFileMapper extends BaseMapper { + + Boolean insertPersonalfileList(@Param("personalFileList") List personalFileList); + + void insertPersonalInfo(HrPersonalFile personalFile); + + void updateUserPersonal(HrPersonalFile vo); + + List personalFileListByUserId(Integer usersId); +} diff --git a/users/src/main/java/com/huoran/users/mapper/HrUserAccountMapper.java b/users/src/main/java/com/huoran/users/mapper/HrUserAccountMapper.java new file mode 100644 index 0000000..0870f2b --- /dev/null +++ b/users/src/main/java/com/huoran/users/mapper/HrUserAccountMapper.java @@ -0,0 +1,63 @@ +package com.huoran.users.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huoran.common.entity.Student; +import com.huoran.common.entity.UserAccount; +import com.huoran.common.entity.UserInfo; +import com.huoran.users.entity.HrUserAccount; +import com.huoran.users.entity.req.UserInfoReq; +import com.huoran.users.entity.res.DataUserInfoResp; +import com.huoran.users.entity.res.UserAccountListRes; +import com.huoran.users.entity.res.UserInfoListRes; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + *

+ * 各个平台账号表 Mapper 接口 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@Mapper +public interface HrUserAccountMapper extends BaseMapper { + List pageByCondition(@Param("userInfoReq") UserInfoReq userInfoReq); + List pageByConditionNum(@Param("userInfoReq") UserInfoReq userInfoReq); + List selectUserSysBindById(@Param("userId") Integer userId, @Param("platformId") Integer platformId); + + int queryAccountExist(@Param("account") String account,@Param("userId") Integer userId); + + IPage getDataUserList(Page page, @Param("params") Map params); + + List queryEmail(String email); + + List queryPhone(String phone); + + Integer queryAccountExistByPlatformId(@Param("account") String account, @Param("userId") Integer userId,@Param("platformId") String platformId); + + boolean delUserAccounts(@Param("ids") List ids); + + //统计某院校下可开启启用的账号数量 + Integer getAvailableNum(@Param("schoolId")Integer schoolId); + + String querySchoolNameBySchoolId(Integer schoolId); + + String selectClientName(Integer customerId); + + //解绑手机号 + boolean unbindMobilePhone(@Param("accountId")Integer accountId); + + Integer selectTeam(Integer id); + + boolean addUserInfo(UserInfo userInfo); + + boolean addUserAccount(UserAccount account); + + boolean save(Student student); +} diff --git a/users/src/main/java/com/huoran/users/mapper/HrUserInfoMapper.java b/users/src/main/java/com/huoran/users/mapper/HrUserInfoMapper.java new file mode 100644 index 0000000..dec435a --- /dev/null +++ b/users/src/main/java/com/huoran/users/mapper/HrUserInfoMapper.java @@ -0,0 +1,57 @@ +package com.huoran.users.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.common.entity.resp.PhoneBindingrResp; +import com.huoran.users.entity.DataRole; +import com.huoran.users.entity.HrUserAccount; +import com.huoran.users.entity.HrUserInfo; +import com.huoran.users.entity.SysPlatform; +import com.huoran.users.entity.res.DataUserInfoResp; +import com.huoran.users.entity.res.ProfileDetailsRes; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.springframework.web.bind.annotation.RequestParam; + +import java.util.List; +import java.util.Map; + +/** + *

+ * 用户信息表 Mapper 接口 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@Mapper +public interface HrUserInfoMapper extends BaseMapper { + + List selectUserPlatformById(Integer userId); + + DataUserInfoResp getDetail(Integer userId); + + HrUserAccount getAccount(@Param("params") Map params); + + //数据平台:查询是否有该角色 + DataRole getRole(@Param("role_name") String roleName, @Param("client_id") String client_id); + + String queryUserPassword(Integer userId); + + void userInfoUpdateUserInfoById(HrUserInfo entity); + + boolean delUserInfos(@Param("ids") List ids); + + String selectSchoolName(Integer schoolId); + + String selectCustomerName(Integer customerId); + + Integer selectCustomerId(String account); + + HrUserInfo selectByUserId(Integer userId); + + String getUserName(@RequestParam("accountId") Integer accountId); + + List userBindingPhoneInfo(@Param("account") HrUserAccount account); + + ProfileDetailsRes personalFile(Integer userId); +} diff --git a/users/src/main/java/com/huoran/users/mapper/PermissionMapper.java b/users/src/main/java/com/huoran/users/mapper/PermissionMapper.java new file mode 100644 index 0000000..26ebfeb --- /dev/null +++ b/users/src/main/java/com/huoran/users/mapper/PermissionMapper.java @@ -0,0 +1,20 @@ +package com.huoran.users.mapper; + +import com.huoran.users.entity.Permission; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 权限表 Mapper 接口 + *

+ * + * @author chen + * @since 2021-09-29 + */ +public interface PermissionMapper extends BaseMapper { + + List selectRolePermission(@Param("roleIds") String roleIds,@Param("platformId") Integer platformId); +} diff --git a/users/src/main/java/com/huoran/users/mapper/PlatformLoginMapper.java b/users/src/main/java/com/huoran/users/mapper/PlatformLoginMapper.java new file mode 100644 index 0000000..0ccf7d8 --- /dev/null +++ b/users/src/main/java/com/huoran/users/mapper/PlatformLoginMapper.java @@ -0,0 +1,21 @@ +package com.huoran.users.mapper; + +import com.huoran.users.entity.PlatformLogin; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.users.entity.res.LoginStatisticsResp; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 各平台登录统计 Mapper 接口 + *

+ * + * @author chen + * @since 2022-09-13 + */ +public interface PlatformLoginMapper extends BaseMapper { + + List platformLoginStatistics(@Param("platform") Integer platform,@Param("schoolId") Integer schoolId); +} diff --git a/users/src/main/java/com/huoran/users/mapper/RoleMapper.java b/users/src/main/java/com/huoran/users/mapper/RoleMapper.java new file mode 100644 index 0000000..42d1108 --- /dev/null +++ b/users/src/main/java/com/huoran/users/mapper/RoleMapper.java @@ -0,0 +1,17 @@ +package com.huoran.users.mapper; + +import com.huoran.users.entity.Role; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 角色表 Mapper 接口 + *

+ * + * @author chen + * @since 2021-09-29 + */ +public interface RoleMapper extends BaseMapper { + + Integer selectCustomerSuper(Integer id); +} diff --git a/users/src/main/java/com/huoran/users/mapper/RolePermissionMapper.java b/users/src/main/java/com/huoran/users/mapper/RolePermissionMapper.java new file mode 100644 index 0000000..7e10647 --- /dev/null +++ b/users/src/main/java/com/huoran/users/mapper/RolePermissionMapper.java @@ -0,0 +1,19 @@ +package com.huoran.users.mapper; + +import com.huoran.users.entity.RolePermission; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 角色权限表 Mapper 接口 + *

+ * + * @author chen + * @since 2021-09-29 + */ +public interface RolePermissionMapper extends BaseMapper { + +} diff --git a/users/src/main/java/com/huoran/users/mapper/StudentMapper.java b/users/src/main/java/com/huoran/users/mapper/StudentMapper.java new file mode 100644 index 0000000..7c40003 --- /dev/null +++ b/users/src/main/java/com/huoran/users/mapper/StudentMapper.java @@ -0,0 +1,16 @@ +package com.huoran.users.mapper; + +import com.huoran.users.entity.Student; +import org.apache.ibatis.annotations.Mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @描述:学生表 Mapper 接口 + * @作者: Rong + * @日期: 2021-08-25 + */ +@Mapper +public interface StudentMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/users/src/main/java/com/huoran/users/mapper/SupplierMapper.java b/users/src/main/java/com/huoran/users/mapper/SupplierMapper.java new file mode 100644 index 0000000..2c506b3 --- /dev/null +++ b/users/src/main/java/com/huoran/users/mapper/SupplierMapper.java @@ -0,0 +1,22 @@ +package com.huoran.users.mapper; + +import com.huoran.users.entity.DataPermission; +import com.huoran.users.entity.Supplier; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 供应商表 Mapper 接口 + *

+ * + * @author chen + * @since 2022-10-13 + */ +public interface SupplierMapper extends BaseMapper { + + List selectSupplierList(@Param("roles") String roles,@Param("permissionId") Integer permissionId); + +} diff --git a/users/src/main/java/com/huoran/users/mapper/SysPlatformMapper.java b/users/src/main/java/com/huoran/users/mapper/SysPlatformMapper.java new file mode 100644 index 0000000..09f3a90 --- /dev/null +++ b/users/src/main/java/com/huoran/users/mapper/SysPlatformMapper.java @@ -0,0 +1,19 @@ +package com.huoran.users.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.users.entity.SysPlatform; +import org.apache.ibatis.annotations.Mapper; + +/** + *

+ * 平台表 Mapper 接口 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@Mapper +public interface SysPlatformMapper extends BaseMapper { + +} diff --git a/users/src/main/java/com/huoran/users/mapper/UserRoleMapper.java b/users/src/main/java/com/huoran/users/mapper/UserRoleMapper.java new file mode 100644 index 0000000..750006e --- /dev/null +++ b/users/src/main/java/com/huoran/users/mapper/UserRoleMapper.java @@ -0,0 +1,29 @@ +package com.huoran.users.mapper; + +import com.huoran.users.entity.UserRole; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huoran.users.entity.res.UserRoleResp; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 用户角色表 Mapper 接口 + *

+ * + * @author chen + * @since 2021-09-29 + */ +public interface UserRoleMapper extends BaseMapper { + + List selectAccountRoles(@Param("accountId")String accountId,@Param("teamId")Integer teamId); + + List checkIsSuperTube(String accountId); + + List getUserRoleByAccountId(@Param("accountId") Integer accountId); + + String getUserAllRole(@Param("accountId")Integer accountId, @Param("platformId")Integer platformId); + + List getAccountIdsBySchoolId(@Param("schoolId")Integer schoolId, @Param("platformId")Integer platformId); +} diff --git a/users/src/main/java/com/huoran/users/mapper/xml/ClassMapper.xml b/users/src/main/java/com/huoran/users/mapper/xml/ClassMapper.xml new file mode 100644 index 0000000..1afc506 --- /dev/null +++ b/users/src/main/java/com/huoran/users/mapper/xml/ClassMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/users/src/main/java/com/huoran/users/mapper/xml/DataPermissionMapper.xml b/users/src/main/java/com/huoran/users/mapper/xml/DataPermissionMapper.xml new file mode 100644 index 0000000..fb1699c --- /dev/null +++ b/users/src/main/java/com/huoran/users/mapper/xml/DataPermissionMapper.xml @@ -0,0 +1,19 @@ + + + + + + diff --git a/users/src/main/java/com/huoran/users/mapper/xml/HrPersonalFileMapper.xml b/users/src/main/java/com/huoran/users/mapper/xml/HrPersonalFileMapper.xml new file mode 100644 index 0000000..510c2e9 --- /dev/null +++ b/users/src/main/java/com/huoran/users/mapper/xml/HrPersonalFileMapper.xml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + INSERT INTO hr_personal_file ( user_id, personal_career_id, school_id, school_name, discipline_id, discipline_name, professional_id, professional_name, professional_class_id, professional_class_name, update_time ) + VALUES + (#{userId},#{personalCareerId},#{schoolId},#{schoolName},#{disciplineId},#{disciplineName},#{professionalId},#{professionalName},#{professionalClassId},#{professionalClassName},NOW()) + + + + UPDATE + hr_personal_file per + + per.personal_career_id = #{personalCareerId}, + per.school_id = #{schoolId}, + per.school_id = NULL, + per.school_name = #{schoolName}, + per.school_name = NULL, + per.discipline_id = #{disciplineId}, + per.discipline_id = NULL, + per.discipline_name = #{disciplineName}, + per.discipline_name = NULL, + per.professional_id = #{professionalId}, + per.professional_id = NULL, + per.professional_name = #{professionalName}, + per.professional_name = NULL, + per.professional_class_id = #{professionalClassId}, + per.professional_class_id = NULL, + per.professional_class_name = #{professionalClassName}, + per.professional_class_name = NULL, + per.update_time = NOW() + + WHERE + per.user_id = #{userId} + AND + per.personal_file_id = #{personalFileId} + + + + + + + + diff --git a/users/src/main/java/com/huoran/users/mapper/xml/HrUserAccountMapper.xml b/users/src/main/java/com/huoran/users/mapper/xml/HrUserAccountMapper.xml new file mode 100644 index 0000000..5079e0f --- /dev/null +++ b/users/src/main/java/com/huoran/users/mapper/xml/HrUserAccountMapper.xml @@ -0,0 +1,1133 @@ + + + + + + INSERT INTO nakadai.hr_user_info (user_name, unique_identification, school_id, email, role_id, + create_time, update_time) + VALUES (#{userName}, #{uniqueIdentification}, #{schoolId}, #{email}, #{roleId}, now(), now()) + + + + + + INSERT INTO nakadai.hr_user_account(user_id, account, password, work_number, role_id, school_id, platform_id, + type, create_time, update_time, phone_binding_time, phone) + VALUES (#{userId}, #{account}, #{password}, #{workNumber}, #{roleId}, #{schoolId}, #{platformId}, #{type}, + now(), now(), #{phoneBindingTime}, #{phone}) + + + + + INSERT INTO occupationlab.ol_student(`account_id`, `class_id`, `school_id`, `create_time`, `update_time`) + VALUES (#{accountId}, #{classId}, #{schoolId}, now(), now()); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + UPDATE hr_user_account set is_del=1 + WHERE user_id IN + + #{ids} + + + + + + + + + + + + + + UPDATE hr_user_account + SET phone = null + WHERE id = #{accountId} + + + diff --git a/users/src/main/java/com/huoran/users/mapper/xml/HrUserInfoMapper.xml b/users/src/main/java/com/huoran/users/mapper/xml/HrUserInfoMapper.xml new file mode 100644 index 0000000..7be8383 --- /dev/null +++ b/users/src/main/java/com/huoran/users/mapper/xml/HrUserInfoMapper.xml @@ -0,0 +1,302 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + update hr_user_info + + + countries = #{countries}, + + + city_id = #{cityId}, + + + date_birth = #{dateBirth}, + + + document_type = #{documentType}, + + + education_degree = #{educationDegree}, + + + id_number = #{idNumber}, + + + province_id = #{provinceId}, + + + sex = #{sex}, + + + user_name = #{userName}, + + + school_id = #{schoolId}, + + + + email = #{email}, + + + update_time = now() + + + WHERE user_id = #{userId}; + + + + UPDATE hr_user_info set is_del=1 + WHERE user_id IN + + #{ids} + + + + + + + + diff --git a/users/src/main/java/com/huoran/users/mapper/xml/PermissionMapper.xml b/users/src/main/java/com/huoran/users/mapper/xml/PermissionMapper.xml new file mode 100644 index 0000000..110ec4c --- /dev/null +++ b/users/src/main/java/com/huoran/users/mapper/xml/PermissionMapper.xml @@ -0,0 +1,14 @@ + + + + + + diff --git a/users/src/main/java/com/huoran/users/mapper/xml/PlatformLoginMapper.xml b/users/src/main/java/com/huoran/users/mapper/xml/PlatformLoginMapper.xml new file mode 100644 index 0000000..f519562 --- /dev/null +++ b/users/src/main/java/com/huoran/users/mapper/xml/PlatformLoginMapper.xml @@ -0,0 +1,42 @@ + + + + + + diff --git a/users/src/main/java/com/huoran/users/mapper/xml/RoleMapper.xml b/users/src/main/java/com/huoran/users/mapper/xml/RoleMapper.xml new file mode 100644 index 0000000..fb7e186 --- /dev/null +++ b/users/src/main/java/com/huoran/users/mapper/xml/RoleMapper.xml @@ -0,0 +1,18 @@ + + + + + + diff --git a/users/src/main/java/com/huoran/users/mapper/xml/RolePermissionMapper.xml b/users/src/main/java/com/huoran/users/mapper/xml/RolePermissionMapper.xml new file mode 100644 index 0000000..d13c531 --- /dev/null +++ b/users/src/main/java/com/huoran/users/mapper/xml/RolePermissionMapper.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/users/src/main/java/com/huoran/users/mapper/xml/StudentMapper.xml b/users/src/main/java/com/huoran/users/mapper/xml/StudentMapper.xml new file mode 100644 index 0000000..84c55ff --- /dev/null +++ b/users/src/main/java/com/huoran/users/mapper/xml/StudentMapper.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/users/src/main/java/com/huoran/users/mapper/xml/SupplierMapper.xml b/users/src/main/java/com/huoran/users/mapper/xml/SupplierMapper.xml new file mode 100644 index 0000000..655cb1a --- /dev/null +++ b/users/src/main/java/com/huoran/users/mapper/xml/SupplierMapper.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/users/src/main/java/com/huoran/users/mapper/xml/SysPlatformMapper.xml b/users/src/main/java/com/huoran/users/mapper/xml/SysPlatformMapper.xml new file mode 100644 index 0000000..6fe391d --- /dev/null +++ b/users/src/main/java/com/huoran/users/mapper/xml/SysPlatformMapper.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/users/src/main/java/com/huoran/users/mapper/xml/UserRoleMapper.xml b/users/src/main/java/com/huoran/users/mapper/xml/UserRoleMapper.xml new file mode 100644 index 0000000..9939af9 --- /dev/null +++ b/users/src/main/java/com/huoran/users/mapper/xml/UserRoleMapper.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + diff --git a/users/src/main/java/com/huoran/users/service/DataPermissionService.java b/users/src/main/java/com/huoran/users/service/DataPermissionService.java new file mode 100644 index 0000000..cd22095 --- /dev/null +++ b/users/src/main/java/com/huoran/users/service/DataPermissionService.java @@ -0,0 +1,20 @@ +package com.huoran.users.service; + +import com.huoran.users.entity.DataPermission; +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.users.entity.vo.DataPermissionVo; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author chen + * @since 2022-10-13 + */ +public interface DataPermissionService extends IService { + + List selectDataPermission(String roleIds); +} diff --git a/users/src/main/java/com/huoran/users/service/IHrPersonalFileService.java b/users/src/main/java/com/huoran/users/service/IHrPersonalFileService.java new file mode 100644 index 0000000..757ddd1 --- /dev/null +++ b/users/src/main/java/com/huoran/users/service/IHrPersonalFileService.java @@ -0,0 +1,20 @@ +package com.huoran.users.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.users.entity.HrPersonalFile; + +/** + *

+ * 个人档案表 服务类 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +public interface IHrPersonalFileService extends IService { + + void insertPersonalInfo(HrPersonalFile personalFile); + + void updateUserPersonal(HrPersonalFile personalFile); + +} diff --git a/users/src/main/java/com/huoran/users/service/IHrUserAccountService.java b/users/src/main/java/com/huoran/users/service/IHrUserAccountService.java new file mode 100644 index 0000000..d5c6119 --- /dev/null +++ b/users/src/main/java/com/huoran/users/service/IHrUserAccountService.java @@ -0,0 +1,87 @@ +package com.huoran.users.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.common.response.R; +import com.huoran.users.entity.HrUserAccount; +import com.huoran.users.entity.req.*; +import com.huoran.users.entity.res.DataUserInfoResp; +import com.huoran.users.entity.res.ProfileDetailsRes; +import com.huoran.users.entity.res.UserInfoDetailsRes; +import com.huoran.users.entity.res.UserSysDetailRes; +import com.huoran.users.entity.vo.CheckVo; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; + +/** + *

+ * 各个平台账号表 服务类 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +public interface IHrUserAccountService extends IService { + R queryPage(UserInfoReq userInfoReq); + + int resetPwd(Integer userId); + + int delUserAccount(Integer userId, Integer isdel); + + UserSysDetailRes selectUserSysBind(Integer userId, Integer platformId); + + HrUserAccount selectAccountDetail(Integer accountId); + + UserInfoDetailsRes queryUserInfoDetails(Integer userId); + + R updateUserAvatars(Integer userId, MultipartFile file); + + int updatePersonCenter(UserInfoDetailsRes req); + + //数据平台用户管理列表 + IPage getDataUserList(DataUserListReq req); + + R getUserTotalBySchoolId(Integer schoolId); + + int updateAccountEnable(Integer id, Integer isEnable); + + String queryPassword(Integer accountId, Integer platformId); + + int updateAccountAllEnable(Integer id, Integer isEnable); + + int updateAccountAllAvaliable(Integer id, Integer isEnable); + + R examinePassword(ResetPwdReq resetPwdReq); + + int delUserAccounts(List ids); + + Integer getUserIdByAccountId(String accountId); + + //统计某院校下可开启启用的账号数量 + Integer getAvailableNum(Integer schoolId); + + String getAccountId(CheckVo checkVo); + + Integer updateAccount(HrUserAccount userAccount); + + String queryClientName(Integer customerId); + + //中台查看用户详情 + UserInfoDetailsRes viewUserDetailsforNakadai(Integer userId); + + R oneClickEnableVerification(Integer accountId); + + //个人档案 + ProfileDetailsRes personalFile(Integer userId); + + //解绑手机号 + R unbindMobilePhone(Integer accountId); + + //更改手机号 + R changePhoneNumber(CheckVo checkVo,Integer accountId); + + Integer querySchoolIdByAccountId(String id); + + R studentAccountApplication(RegisterReq registerReq); +} diff --git a/users/src/main/java/com/huoran/users/service/IHrUserInfoService.java b/users/src/main/java/com/huoran/users/service/IHrUserInfoService.java new file mode 100644 index 0000000..437f67a --- /dev/null +++ b/users/src/main/java/com/huoran/users/service/IHrUserInfoService.java @@ -0,0 +1,82 @@ +package com.huoran.users.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.common.response.R; +import com.huoran.users.entity.HrUserAccount; +import com.huoran.users.entity.HrUserInfo; +import com.huoran.users.entity.dto.LoginDTO; +import com.huoran.users.entity.req.AppletCallbackReq; +import com.huoran.users.entity.req.UnbindAccountsReq; +import com.huoran.users.entity.req.WxUserBindingReq; +import com.huoran.users.entity.res.DataUserInfoResp; +import com.huoran.users.entity.vo.CheckVo; +import com.huoran.users.entity.vo.LoginVo; +import com.huoran.users.entity.vo.WxMssVo; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + *

+ * 用户信息表 服务类 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +public interface IHrUserInfoService extends IService { + + DataUserInfoResp getDetail(Integer userId); + + R queryUserInfoById(Integer userId, Integer accountId); + + Integer queryAccountExistByPlatformId(String account, Integer userId, Integer platformId); + + void updateUserInfoById(HrUserInfo userInfo); + + LoginDTO login(LoginVo loginVo); + + void createCaptcha(String random, HttpServletResponse response); + + Map upload(MultipartFile file, Integer schoolId) throws IOException; + + void exportFailureRecord(HttpServletResponse response, String token) throws Exception; + + boolean queryPhone(String phone); + + boolean queryEmail(String email); + + R sendCheckPhoneCode(CheckVo checkVo); + + R bindPhone(CheckVo checkVo, Integer userId); + + List getOtherAccount(String phone, String platform); + + boolean checkPhoneOrEmailExist(@RequestParam("phone") String phone, @RequestParam("email") String email, @RequestParam("type") Integer type); + + String getUserName(@RequestParam("accountId") Integer accountId); + + R sendPhoneVerificationCode(String phoneOrEmail,Integer loginOrBind,String platform); + + R getToken(String id); + + R unbindAccounts(UnbindAccountsReq accountsReq); + + Map weChatAppletCallbackByPartner(AppletCallbackReq appletCallbackReq, HttpServletResponse response) throws Exception; + + Map weChatAppletCallbackByOperation(AppletCallbackReq appletCallbackReq, HttpServletResponse response) throws Exception; + + String userBinding(WxUserBindingReq userBindingReq); + + R messageNotification(WxMssVo wxMssVo); + + R getSessionKey(AppletCallbackReq appletCallbackReq, HttpServletResponse response) throws Exception; + + R loginByOpenid(String openid); + + R updateAvatars(String url,String id); +} diff --git a/users/src/main/java/com/huoran/users/service/ISysPlatformService.java b/users/src/main/java/com/huoran/users/service/ISysPlatformService.java new file mode 100644 index 0000000..f95de10 --- /dev/null +++ b/users/src/main/java/com/huoran/users/service/ISysPlatformService.java @@ -0,0 +1,16 @@ +package com.huoran.users.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.users.entity.SysPlatform; + +/** + *

+ * 平台表 服务类 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +public interface ISysPlatformService extends IService { + +} diff --git a/users/src/main/java/com/huoran/users/service/PermissionService.java b/users/src/main/java/com/huoran/users/service/PermissionService.java new file mode 100644 index 0000000..70cf536 --- /dev/null +++ b/users/src/main/java/com/huoran/users/service/PermissionService.java @@ -0,0 +1,31 @@ +package com.huoran.users.service; + +import com.huoran.users.entity.DataPermission; +import com.huoran.users.entity.Permission; +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.users.entity.vo.DataPermissionVo; + +import java.util.List; + +/** + *

+ * 权限表 服务类 + *

+ * + * @author chen + * @since 2021-09-29 + */ +public interface PermissionService extends IService { + + List queryAllMenu(Integer platformId,Integer port); + + void removeChildById(Integer id); + + void saveRolePermissionRelationShip(Integer roleId, Integer[] permissionId); + + List selectRoleMenu(String roleIds,Integer platformId); + + void assigningDataPermissions(Integer id, List dataPermissionList); + + List queryDataPermission(String roleIds); +} diff --git a/users/src/main/java/com/huoran/users/service/PlatformLoginService.java b/users/src/main/java/com/huoran/users/service/PlatformLoginService.java new file mode 100644 index 0000000..8a641af --- /dev/null +++ b/users/src/main/java/com/huoran/users/service/PlatformLoginService.java @@ -0,0 +1,18 @@ +package com.huoran.users.service; + +import com.huoran.common.response.R; +import com.huoran.users.entity.PlatformLogin; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 各平台登录统计 服务类 + *

+ * + * @author chen + * @since 2022-09-13 + */ +public interface PlatformLoginService extends IService { + + R platformLoginStatistics(Integer platform,Integer schoolId); +} diff --git a/users/src/main/java/com/huoran/users/service/RolePermissionService.java b/users/src/main/java/com/huoran/users/service/RolePermissionService.java new file mode 100644 index 0000000..50f547a --- /dev/null +++ b/users/src/main/java/com/huoran/users/service/RolePermissionService.java @@ -0,0 +1,18 @@ +package com.huoran.users.service; + +import com.huoran.users.entity.RolePermission; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + *

+ * 角色权限表 服务类 + *

+ * + * @author chen + * @since 2021-09-29 + */ +public interface RolePermissionService extends IService { + +} diff --git a/users/src/main/java/com/huoran/users/service/RoleService.java b/users/src/main/java/com/huoran/users/service/RoleService.java new file mode 100644 index 0000000..2274783 --- /dev/null +++ b/users/src/main/java/com/huoran/users/service/RoleService.java @@ -0,0 +1,28 @@ +package com.huoran.users.service; + +import com.huoran.common.response.R; +import com.huoran.users.entity.Role; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + *

+ * 角色表 服务类 + *

+ * + * @author chen + * @since 2021-09-29 + */ +public interface RoleService extends IService { + + boolean repeat(Role role); + + boolean batchRemove(List roleIds); + + boolean addCustomerAdmin(Integer schoolId, String accountId); + + Role getRoleInfo(Integer schoolId,String roleName,Integer platformId); + + R reassignmentPermissions(); +} diff --git a/users/src/main/java/com/huoran/users/service/StudentService.java b/users/src/main/java/com/huoran/users/service/StudentService.java new file mode 100644 index 0000000..97c16f0 --- /dev/null +++ b/users/src/main/java/com/huoran/users/service/StudentService.java @@ -0,0 +1,14 @@ +package com.huoran.users.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.users.entity.Student; + +/** + * @描述:学生表 service接口 + * @作者: Rong + * @日期: 2021-08-25 + */ +public interface StudentService extends IService { + + +} \ No newline at end of file diff --git a/users/src/main/java/com/huoran/users/service/SupplierService.java b/users/src/main/java/com/huoran/users/service/SupplierService.java new file mode 100644 index 0000000..2c6057d --- /dev/null +++ b/users/src/main/java/com/huoran/users/service/SupplierService.java @@ -0,0 +1,21 @@ +package com.huoran.users.service; + +import com.huoran.users.entity.DataPermission; +import com.huoran.users.entity.Supplier; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + *

+ * 供应商表 服务类 + *

+ * + * @author chen + * @since 2022-10-13 + */ +public interface SupplierService extends IService { + + List querySupplierList(String roles,Integer permissionId); + +} diff --git a/users/src/main/java/com/huoran/users/service/UserRoleService.java b/users/src/main/java/com/huoran/users/service/UserRoleService.java new file mode 100644 index 0000000..d919e49 --- /dev/null +++ b/users/src/main/java/com/huoran/users/service/UserRoleService.java @@ -0,0 +1,31 @@ +package com.huoran.users.service; + +import com.huoran.common.response.R; +import com.huoran.users.entity.UserRole; +import com.baomidou.mybatisplus.extension.service.IService; +import com.huoran.users.entity.res.UserRoleResp; + +import java.util.List; + +/** + *

+ * 用户角色表 服务类 + *

+ * + * @author chen + * @since 2021-09-29 + */ +public interface UserRoleService extends IService { + + List queryAccountRoles(String accountId,Integer teamId); + + boolean checkIsSuperTube(String accountId); + + List getUserRoleByAccountId(Integer accountId); + + String getUserAllRole(Integer accountId, Integer platformId); + + List getAccountIdsBySchoolId(Integer schoolId, Integer platformId); + + boolean queryTeacherAccount(String id); +} diff --git a/users/src/main/java/com/huoran/users/service/impl/DataPermissionServiceImpl.java b/users/src/main/java/com/huoran/users/service/impl/DataPermissionServiceImpl.java new file mode 100644 index 0000000..640358b --- /dev/null +++ b/users/src/main/java/com/huoran/users/service/impl/DataPermissionServiceImpl.java @@ -0,0 +1,26 @@ +package com.huoran.users.service.impl; + +import com.huoran.users.entity.DataPermission; +import com.huoran.users.entity.vo.DataPermissionVo; +import com.huoran.users.mapper.DataPermissionMapper; +import com.huoran.users.service.DataPermissionService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 服务实现类 + *

+ * + * @author chen + * @since 2022-10-13 + */ +@Service +public class DataPermissionServiceImpl extends ServiceImpl implements DataPermissionService { + @Override + public List selectDataPermission(String roleIds) { + return baseMapper.selectDataPermission(roleIds); + } +} diff --git a/users/src/main/java/com/huoran/users/service/impl/HrPersonalFileServiceImpl.java b/users/src/main/java/com/huoran/users/service/impl/HrPersonalFileServiceImpl.java new file mode 100644 index 0000000..91819a1 --- /dev/null +++ b/users/src/main/java/com/huoran/users/service/impl/HrPersonalFileServiceImpl.java @@ -0,0 +1,35 @@ +package com.huoran.users.service.impl; + + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.users.entity.HrPersonalFile; +import com.huoran.users.mapper.HrPersonalFileMapper; +import com.huoran.users.service.IHrPersonalFileService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + *

+ * 个人档案表 服务实现类 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@Service +public class HrPersonalFileServiceImpl extends ServiceImpl implements IHrPersonalFileService { + + @Autowired + private HrPersonalFileMapper hrPersonalFileMapper; + + @Override + public void insertPersonalInfo(HrPersonalFile personalFile) { + hrPersonalFileMapper.insertPersonalInfo(personalFile); + } + + @Override + public void updateUserPersonal(HrPersonalFile personalFile) { + hrPersonalFileMapper.updateUserPersonal(personalFile); + } + +} diff --git a/users/src/main/java/com/huoran/users/service/impl/HrUserAccountServiceImpl.java b/users/src/main/java/com/huoran/users/service/impl/HrUserAccountServiceImpl.java new file mode 100644 index 0000000..627be19 --- /dev/null +++ b/users/src/main/java/com/huoran/users/service/impl/HrUserAccountServiceImpl.java @@ -0,0 +1,565 @@ +package com.huoran.users.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +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.huoran.common.constant.DelConstant; +import com.huoran.common.constant.PlatformConstant; +import com.huoran.common.constant.SMSTemplate; +import com.huoran.common.entity.FilesResult; +import com.huoran.common.entity.Student; +import com.huoran.common.entity.UserAccount; +import com.huoran.common.entity.UserInfo; +import com.huoran.common.entity.resp.PhoneBindingrResp; +import com.huoran.common.exception.CustomException; +import com.huoran.common.exception.ExceptionEnum; +import com.huoran.common.response.R; +import com.huoran.common.utils.AliyunOssUtil; +import com.huoran.common.utils.DateUtil; +import com.huoran.common.utils.MD5; +import com.huoran.users.entity.HrPersonalFile; +import com.huoran.users.entity.HrUserAccount; +import com.huoran.users.entity.HrUserInfo; +import com.huoran.users.entity.SysPlatform; +import com.huoran.users.entity.req.*; +import com.huoran.users.entity.res.*; +import com.huoran.users.entity.vo.CheckVo; +import com.huoran.users.mapper.HrPersonalFileMapper; +import com.huoran.users.mapper.HrUserAccountMapper; +import com.huoran.users.mapper.HrUserInfoMapper; +import com.huoran.users.service.IHrUserAccountService; +import com.huoran.users.service.PlatformLoginService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.BeanFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; + +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + *

+ * 各个平台账号表 服务实现类 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@Service +public class HrUserAccountServiceImpl extends ServiceImpl implements IHrUserAccountService { + + @Autowired + private HrUserAccountMapper hrUserAccountMapper; + @Autowired + private HrUserInfoMapper hrUserInfoMapper; + + @Autowired + private HrUserInfoServiceImpl hrUserInfoService; + @Autowired + private HrPersonalFileMapper hrPersonalFileMapper; + @Autowired + private StringRedisTemplate stringRedisTemplate; + + @Autowired + private BeanFactory beanFactory; + + @Autowired + private IHrUserAccountService userAccountService; + + @Autowired + private PlatformLoginService platformLoginService; + + //针对数据平台用户禁用启用判断 + public boolean disableEnableForDataPlatformUsersChecker(Integer accountId) { + HrUserAccount account = hrUserAccountMapper.selectById(accountId); + if (account.getPlatformId().contains(PlatformConstant.DATA_PLATFORM + "")) {//判断当前账号所属平台是否包含数据平台 + //如若为数据平台用户,启用前需要判断当前院校可用账户数量 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("school_id", account.getSchoolId()); + queryWrapper.eq("is_enable", DelConstant.IS_ENABLE); + List getNum = baseMapper.selectList(queryWrapper);//查询现在该院校已启用的账号数量 + + int availableNum = baseMapper.getAvailableNum(account.getSchoolId()) - 1;//统计该院校下可启用的账号数量 减1是因为客户也包含了算启用的用户 + + //判断该院校已启用账户总数量是否小于该院校可启用的账户数量 + if (availableNum < getNum.size()) { + //throw new CustomException(ExceptionEnum.DATA_PLATFORM_ACCOUNT_AVALIABLE_FAIL); + return false; + } + + } + return true; + } + + @Override + public R queryPage(UserInfoReq userInfoReq) { + userInfoReq.setPageNum((userInfoReq.getPageNum() - 1) * userInfoReq.getPageSize()); + List list = hrUserAccountMapper.pageByCondition(userInfoReq); + Integer totalCount = hrUserAccountMapper.pageByConditionNum(userInfoReq).size(); + + return R.ok().put("page", list).put("total", totalCount); + } + + @Override + public int resetPwd(Integer userId) { + HrUserAccount hrUserAccount = new HrUserAccount(); + hrUserAccount.setPassword(MD5.encrypt("1122aa")); + return baseMapper.update(hrUserAccount, new QueryWrapper().eq("user_id", userId)); + } + + @Override + @Transactional + public int delUserAccount(Integer userId, Integer isdel) { + //设置用户表用户为已删除 + HrUserInfo hrUserInfo = new HrUserInfo(); + hrUserInfo.setIsDel(isdel); + hrUserInfoMapper.update(hrUserInfo, new QueryWrapper().eq("user_id", userId)); + //设置账号表与用户相关的所有账号都设置为已删除 + HrUserAccount hrUserAccount = new HrUserAccount(); + hrUserAccount.setIsDel(isdel); + int userId1 = hrUserAccountMapper.update(hrUserAccount, new QueryWrapper().eq("user_id", userId)); + return userId1; + } + + @Override + public int delUserAccounts(List ids) { + //删除用户表 + boolean i = hrUserInfoMapper.delUserInfos(ids); + + //删除账号表 + boolean n = hrUserAccountMapper.delUserAccounts(ids); + return i & n == true ? 1 : 0; + } + + @Override + public UserSysDetailRes selectUserSysBind(Integer userId, Integer platformId) { + //根据用户id以及平台id将对应的用户及账号信息查询出来 + List list = hrUserAccountMapper.selectUserSysBindById(userId, platformId); + + //先根据院校分组,再根据平台端分组 + Map>> group2 = list.stream().collect(Collectors.groupingBy(UserAccountListRes::getSchoolName, Collectors.groupingBy(UserAccountListRes::getType))); + UserSysDetailRes res = new UserSysDetailRes(); + res.setUserId(userId); + res.setPlatformId(platformId); + res.setMap(group2); + return res; + } + + @Override + public HrUserAccount selectAccountDetail(Integer accountId) { + + return hrUserAccountMapper.selectOne(new QueryWrapper().eq("id", accountId)); + } + + @Override + public UserInfoDetailsRes queryUserInfoDetails(Integer userId) { + + UserInfoDetailsRes res = new UserInfoDetailsRes(); + + //查询用户信息 + HrUserInfo hrUserInfo = hrUserInfoMapper.selectByUserId(userId); + res.setHrUserInfo(hrUserInfo); + + //查询账号信息 + HrUserAccount userAccount = baseMapper.selectOne(new QueryWrapper().eq("user_id", userId)); + + //查询已绑定系统详情 + List platformList = hrUserInfoMapper.selectUserPlatformById(userId); + + //查询账号详情List + List userAccountList = hrUserAccountMapper.selectList(new QueryWrapper() + .eq("user_id", userId).select("account")); + + //查询个人档案List + List personalFileList = hrPersonalFileMapper.selectList(new QueryWrapper() + .eq("user_id", userId)); + + res.setPlatformList(platformList); + res.setUserAccountList(userAccountList); + res.setPersonalFileList(personalFileList); + res.setUserAccount(userAccount); + return res; + } + + @Override + public R updateUserAvatars(Integer userId, MultipartFile file) { + HrUserInfo hrUserInfo = new HrUserInfo(); + hrUserInfo.setUserId(userId); + + FilesResult result = null; + int i = 0; + String userAvatars = ""; + try { + result = AliyunOssUtil.uploadFile(file); + //用户图片路径 + userAvatars = result.getFileUrl(); + hrUserInfo.setUserAvatars(userAvatars); + i = hrUserInfoMapper.updateById(hrUserInfo); + } catch (IOException e) { + e.printStackTrace(); + } + return i > 0 ? R.ok(userAvatars) : R.error(); + } + + @Override + public int updatePersonCenter(UserInfoDetailsRes req) { + + //修改个人信息 + int i = hrUserInfoMapper.updateById(req.getHrUserInfo()); + + //验证账号是否存在 + for (HrUserAccount hrUserAccount : req.getUserAccountList()) { + int count = hrUserAccountMapper.queryAccountExist(hrUserAccount.getAccount(), req.getUserId()); + if (count > 0) { + throw new CustomException(ExceptionEnum.EXIST_ACCOUNT); + } + } + + //修改账号信息 + for (HrUserAccount account : req.getUserAccountList()) { + hrUserAccountMapper.updateById(account); + } + + //根据用户id删除个人档案信息 + hrPersonalFileMapper.delete(new QueryWrapper().eq("user_id", req.getUserId())); + //新增个人档案信息 + if (req.getPersonalFileList() != null && !req.getPersonalFileList().isEmpty()) { + Boolean n = hrPersonalFileMapper.insertPersonalfileList(req.getPersonalFileList()); + } + + return 1; + } + + @Override + public IPage getDataUserList(DataUserListReq req) { + Page page = new Page(req.getPageNum(), req.getPageSize()); + Map map = new HashMap(); + map.put("createTime", req.getCreateTime()); + map.put("endTime", req.getEndTime()); + map.put("platformId", req.getPlatformId()); + map.put("roleId", req.getRoleId()); + map.put("isEnable", req.getIsEnable()); + map.put("keyWord", req.getKeyWord()); + map.put("schoolId", req.getSchoolId()); + + map.put("pageNum", req.getPageNum()); + map.put("pageSize", req.getPageSize()); + return hrUserAccountMapper.getDataUserList(page, map); + } + + @Override + public R getUserTotalBySchoolId(Integer schoolId) { + Integer totalCount = hrUserAccountMapper.selectCount(new QueryWrapper() + .eq("school_id", schoolId).eq("is_del", DelConstant.NOT_DEL).eq("platform_id", PlatformConstant.DATA_PLATFORM)); + return R.ok().put("totalCount", totalCount); + } + + @Override + public int updateAccountEnable(Integer id, Integer isEnable) { + + //是否禁用(0->禁用,1->启用) + if (isEnable == 1) { + boolean result = disableEnableForDataPlatformUsersChecker(id); + if (result == false) { + throw new CustomException(ExceptionEnum.ACCOUNT_AVALIABLE); + } + } + + HrUserAccount hrUserAccount = new HrUserAccount(); + hrUserAccount.setIsEnable(isEnable); + hrUserAccount.setId(id); + return hrUserAccountMapper.updateById(hrUserAccount); + } + + @Override + public String queryPassword(Integer accountId, Integer platformId) { + + HrUserAccount userAccount = hrUserAccountMapper.selectOne(new QueryWrapper().eq("id", accountId).eq("platform_id", platformId)); + return userAccount.getPassword(); + } + + @Override + public int updateAccountAllEnable(Integer userId, Integer isEnable) { + + UserInfoDetailsRes userInfoDetailsRes = this.viewUserDetailsforNakadai(userId); + userInfoDetailsRes.getBindingPlatformAndUserList().forEach(res -> { + //isEnable:是否禁用(0->禁用,1->启用) + HrUserAccount userAccount = new HrUserAccount(); + userAccount.setIsEnable(isEnable); + userAccount.setId(res.getAccountId()); + baseMapper.updateById(userAccount); + }); + return 1; + + } + + @Override + public int updateAccountAllAvaliable(Integer id, Integer isEnable) { + //修改用户启用禁用状态 + HrUserInfo hrUserInfo = new HrUserInfo(); + hrUserInfo.setIsEnable(isEnable); + hrUserInfo.setUserId(id); + hrUserInfoMapper.updateById(hrUserInfo); + //修改账号启用禁用状态 + HrUserAccount hrUserAccount = new HrUserAccount(); + hrUserAccount.setIsEnable(isEnable); + hrUserAccount.setUserId(id); + return hrUserAccountMapper.update(hrUserAccount, new QueryWrapper().eq("user_id", id)); + } + + @Override + public R examinePassword(ResetPwdReq resetPwdReq) { + //校验新密码必须与新密码一致 + if (!resetPwdReq.getNewPassword().equals(resetPwdReq.getReNewPassword())) { + return R.error("输入的新密码不一致,请重新确认哦!"); + } + //校验原密码是否输入正确 + HrUserAccount hrUserAccount = this.baseMapper.selectById(resetPwdReq.getAccountId()); + if (MD5.encrypt(resetPwdReq.getPassword()).equals(hrUserAccount.getPassword())) { + HrUserAccount account = new HrUserAccount(); + account.setPassword(MD5.encrypt(resetPwdReq.getNewPassword())); + account.setId(resetPwdReq.getAccountId()); + int i = this.baseMapper.updateById(account); + return i > 0 ? R.ok() : R.error("更新密码失败!"); + } else { + return R.error("原密码错误,更新密码失败!"); + } + } + + @Override + public Integer getUserIdByAccountId(String accountId) { + HrUserAccount hrUserAccount = hrUserAccountMapper.selectOne(new QueryWrapper().eq("id", accountId)); + return hrUserAccount.getUserId(); + } + + @Override + public Integer getAvailableNum(Integer schoolId) { + return baseMapper.getAvailableNum(schoolId); + } + + @Override + public String getAccountId(CheckVo checkVo) { + HrUserAccount hrUserAccount = hrUserAccountMapper. + selectOne(new QueryWrapper(). + eq("school_id",checkVo.getSchoolId()). + eq("work_number", checkVo.getAccount()). + eq("type", checkVo.getMark()). + last(" and FIND_IN_SET( " + checkVo.getPlatform() + ", platform_id )"). + select("id")); + return hrUserAccount.getId().toString(); + } + + @Override + public Integer updateAccount(HrUserAccount userAccount) { + return hrUserAccountMapper.update(userAccount, new UpdateWrapper().eq("id", userAccount.getId())); + } + + @Override + public String queryClientName(Integer customerId) { + return baseMapper.selectClientName(customerId); + } + + /** + * @Description : 中台用户管理查看用户详情 + * @Param userId + * @Author Rong---2022/4/19 + */ + @Override + public UserInfoDetailsRes viewUserDetailsforNakadai(Integer userId) { + UserInfoDetailsRes res = new UserInfoDetailsRes(); + + //查询用户信息 + HrUserInfo hrUserInfo = hrUserInfoMapper.selectByUserId(userId); + res.setHrUserInfo(hrUserInfo); + + //查询账号详情List + HrUserAccount userAccount = hrUserAccountMapper.selectOne(new QueryWrapper() + .eq("user_id", userId)); + List bindingrRespList = null; + + HrUserAccount parameter = new HrUserAccount(); + if (userAccount.getPhone() == null || userAccount.getPhone().equals("")) { + parameter.setUserId(hrUserInfo.getUserId()); + } else { + parameter.setPhone(userAccount.getPhone()); + } + bindingrRespList = hrUserInfoMapper.userBindingPhoneInfo(parameter); + + bindingrRespList.forEach(l -> { + if (l.getType() == 1) { + l.setRoleName("学生"); + } + }); + + res.setBindingPlatformAndUserList(bindingrRespList); + res.setUserAccount(userAccount); + return res; + } + + @Override + public R oneClickEnableVerification(Integer accountId) { + + HrUserAccount account = baseMapper.selectById(accountId); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("school_id", account.getSchoolId()); + queryWrapper.eq("is_enable", DelConstant.IS_ENABLE); + List getNum = baseMapper.selectList(queryWrapper);//查询现在该院校已启用的账号数量 + + int availableNum = baseMapper.getAvailableNum(account.getSchoolId()) - 1;//统计该院校下可启用的账号数量 减1是因为客户也包含了算启用的用户 + + //判断当前被启用的账户是否绑定手机号 如已绑定,查询全部绑定为一个手机号下的信息 单独判断数据平台下的账号 + UserInfoDetailsRes userInfoDetailsRes = this.viewUserDetailsforNakadai(account.getUserId()); + if (userInfoDetailsRes.getBindingPlatformAndUserList().size() > 0) { + userInfoDetailsRes.getBindingPlatformAndUserList().forEach(res -> { + if (res.getPlatformName().contains("数据前瞻")) { + //判断该院校已启用账户总数量是否小于该院校可启用的账户数量 + if (availableNum < getNum.size()) { + throw new CustomException(ExceptionEnum.DATA_PLATFORM_ACCOUNT_AVALIABLE_FAIL); + } + } + }); + } + + return R.ok(); + } + + /** + * @Description : 中台查看-个人档案 + * @Param userId + * @Author Rong---2022/4/20 + */ + @Override + public ProfileDetailsRes personalFile(Integer userId) { + + //查询用户信息 + ProfileDetailsRes personalFile = hrUserInfoMapper.personalFile(userId); + //平台端区分:0->教师端 1->学生端 2->无端 增加判断平台端为1学生端的时候设置角色 因为学生是没有角色的! + if (personalFile.getType() == 1) { + personalFile.setRoleName("学生"); + } + + //查询个人档案 + List personalFileList = hrPersonalFileMapper.personalFileListByUserId(userId); + + personalFile.setNakadaiPersonalFileList(personalFileList); + + return personalFile; + } + + @Override + public R unbindMobilePhone(Integer accountId) { + boolean result = baseMapper.unbindMobilePhone(accountId); + return result ? R.ok() : R.error(); + } + + @Override + public R changePhoneNumber(CheckVo checkVo, Integer accountId) { + + String key = StringUtils.join(checkVo.getPhone(), SMSTemplate.AUTHENTICATION_CODE); + String opener = stringRedisTemplate.opsForValue().get(key);//获取验证码 + + if (opener == null) { + return R.error("验证码已过期或不存在,请重新发送验证码"); + } + + + if (opener.equals(checkVo.getOpener())) { + HrUserAccount account = new HrUserAccount(); + account.setPhone(checkVo.getPhone()); + account.setId(accountId); + int updateCode = baseMapper.updateById(account); + + return updateCode>0?R.ok():R.error(); + } + return R.error("更改失败!"); + } + + @Override + public Integer querySchoolIdByAccountId(String accountId) { + if (StringUtils.isEmpty(accountId)){ + return null; + } + HrUserAccount hrUserAccount = baseMapper.selectById(accountId); + return hrUserAccount.getSchoolId(); + } + + @Override + public R studentAccountApplication(RegisterReq registerReq) { + + if (registerReq.getIdentification() ==null || registerReq.getIdentification() != 1) { +// 手机验证码验证 + String key = StringUtils.join(registerReq.getPhone(), SMSTemplate.AUTHENTICATION_CODE); + String value = stringRedisTemplate.opsForValue().get(key); + if (StringUtils.isEmpty(value)) { + throw new CustomException(ExceptionEnum.CODE_EXPIRED); + } + //验证验证码 + if (!registerReq.getCode().equals(value)) { + return R.error("手机验证码错误!"); + } + } + + //学号判重依据学校id、平台端(教师、学生端、无端(数据平台的用户)) 以及 平台来源(职站、数据平台) + //账号组成条件:平台(职站/数据平台/中台)-端(教师、学生端、无端(数据平台的用户))-学校(学校id)-学号/工号(用户输入的工号学号) + UserInfo userInfo = new UserInfo(); + BeanUtils.copyProperties(registerReq, userInfo); + userInfo.setSchoolId(registerReq.getSchoolId()); + userInfo.setRoleId("0"); + boolean addUserRet = baseMapper.addUserInfo(userInfo); + + UserAccount account = new UserAccount(); + BeanUtils.copyProperties(registerReq, account); + account.setSchoolId(registerReq.getSchoolId()); + account.setPassword(MD5.encrypt(registerReq.getPassword())); + account.setPlatformId("1");//所属平台id 1.职站 + account.setType(1);//平台端区分:0->教师端 1->学生端 2->无端 + account.setUserId(userInfo.getUserId()); + account.setRoleId("0"); + + account.setPhone(null); + if (!registerReq.getPhone().equals("")) { + account.setPhone(registerReq.getPhone()); + account.setPhoneBindingTime(DateUtil.currentDate()); + } + boolean addAccountRet = baseMapper.addUserAccount(account); + + Student student = new Student(); + BeanUtils.copyProperties(registerReq, student); + student.setAccountId(account.getId()); + student.setClassId("1"); + + boolean save = baseMapper.save(student); + + //新增学生完之后进行登录操作 + /*LoginVo loginVo = new LoginVo(); + loginVo.setSchoolId(registerReq.getSchoolId()); + loginVo.setWorkNumber(account.getWorkNumber()); + loginVo.setType(1); + loginVo.setPlatform(1); + HashMap hashMap = hrUserInfoService.workNumberLogin(loginVo); + + //统计平台登录次数 + Integer schoolId = userAccountService.querySchoolIdByAccountId(account.getId().toString()); + PlatformLogin platformLogin = new PlatformLogin(); + platformLogin.setPlatform(loginVo.getPlatform()); + platformLogin.setSchoolId(schoolId); + platformLoginService.save(platformLogin); + + LoginDTO data = new LoginDTO(); + data.setToken((String) hashMap.get("token")); + data.setCustomer(false); + return R.ok("认证成功,欢迎 "+registerReq.getUserName()+" 回来!").put("data", data);*/ + return save ? R.ok("账号申请已提交,需管理员审核,请10分钟后再登录").put("account",account.getId()) : R.error(); + } + +} diff --git a/users/src/main/java/com/huoran/users/service/impl/HrUserInfoServiceImpl.java b/users/src/main/java/com/huoran/users/service/impl/HrUserInfoServiceImpl.java new file mode 100644 index 0000000..ae2fd95 --- /dev/null +++ b/users/src/main/java/com/huoran/users/service/impl/HrUserInfoServiceImpl.java @@ -0,0 +1,1564 @@ +package com.huoran.users.service.impl; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.log.Log; +import cn.hutool.log.LogFactory; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.TypeReference; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.google.common.collect.Maps; +import com.huoran.api.NakadaiClient; +import com.huoran.api.UserClient; +import com.huoran.common.constant.*; +import com.huoran.common.exception.CustomException; +import com.huoran.common.exception.ExceptionEnum; +import com.huoran.common.response.R; +import com.huoran.common.utils.*; +import com.huoran.users.config.WeChatPropertiesUtil; +import com.huoran.users.entity.*; +import com.huoran.users.entity.dto.LoginDTO; +import com.huoran.users.entity.req.*; +import com.huoran.users.entity.res.DataUserInfoResp; +import com.huoran.users.entity.vo.CheckVo; +import com.huoran.users.entity.vo.LoginVo; +import com.huoran.users.entity.vo.UseImportFailureVo; +import com.huoran.users.entity.vo.WxMssVo; +import com.huoran.users.mapper.HrPersonalFileMapper; +import com.huoran.users.mapper.HrUserAccountMapper; +import com.huoran.users.mapper.HrUserInfoMapper; +import com.huoran.users.mapper.RoleMapper; +import com.huoran.users.service.IHrUserInfoService; +import com.huoran.users.utils.EmailUtil; +import com.huoran.users.utils.ExcelImportHelper; +import com.huoran.users.utils.HttpClientUtils; +import com.huoran.users.utils.WeChatUtil; +import com.huoran.users.utils.poi.CommonCode; +import com.huoran.users.utils.poi.Constant; +import com.huoran.users.utils.poi.ExcelExportUtil; +import com.huoran.users.utils.poi.ExceptionCast; +import com.wf.captcha.ArithmeticCaptcha; +import com.wf.captcha.base.Captcha; +import lombok.SneakyThrows; +import org.apache.commons.collections4.map.HashedMap; +import org.apache.commons.lang3.StringUtils; +import org.apache.http.HttpEntity; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.util.EntityUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.io.ClassPathResource; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.data.redis.core.ValueOperations; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.InputStream; +import java.util.*; +import java.util.concurrent.TimeUnit; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + +/** + *

+ * 用户信息表 服务实现类 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@Service +public class HrUserInfoServiceImpl extends ServiceImpl implements IHrUserInfoService { + @Autowired + private HrUserAccountMapper userAccountMapper; + static Log log = LogFactory.get(HrUserInfoServiceImpl.class); + @Resource + StringRedisTemplate stringRedisTemplate; + + @Autowired + private HrUserInfoMapper hrUserInfoMapper; + + @Autowired + private NakadaiClient nakadaiClient; + + @Autowired + private HrPersonalFileMapper hrPersonalFileMapper; + + @Autowired + private HrUserAccountMapper hrUserAccountMapper; + + @Autowired + private RoleMapper roleMapper; + + @Autowired + private UserClient userClient; + + @Autowired + private EmailUtil emailUtil; + + @Autowired + private RedisTemplate redisTemplate; + + private static final String REQUEST_URL = "https://api.weixin.qq.com/sns/jscode2session"; + private static final String GRANT_TYPE = "authorization_code"; + + public static boolean checkEmail(String email) { + boolean flag = false; + try { + String check = "^([a-z0-9A-Z]+[-|_|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$"; + Pattern regex = Pattern.compile(check); + Matcher matcher = regex.matcher(email); + flag = matcher.matches(); + } catch (Exception e) { + flag = false; + } + return flag; + } + + @Override + public DataUserInfoResp getDetail(Integer userId) { + return baseMapper.getDetail(userId); + } + + @Override + public Map upload(MultipartFile file, Integer schoolId) throws IOException { + List users = ExcelImportHelper.readUser(file); + if (users.size() <= 0) { + ExceptionCast.cast(CommonCode.EXCEL_FILE_FORMAT_ERROR); + } + int count = 0; + List failVo1 = new ArrayList<>(); + // 参数合法性校验,只能上传.xlsx后缀的文件 + if (StringUtils.isBlank(file.getOriginalFilename()) + || !file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")).equals(".xlsx")) { + ExceptionCast.cast(CommonCode.EXCEL_FILE_INVALID); + } + int size = users.size(); + Map map = new HashMap<>(); + Long ii = 1L;//用于记录序列号 + try { + for (int i = 0; i < users.size(); i++) { + ExcelImpUserInfoReq req = users.get(i); + // String account = req.getAccount().replaceAll("\\u00A0", "").trim();//账号 + String userName = req.getUserName().replaceAll("\\u00A0", "").trim();//用户名 + String roleName = req.getRoleId();//角色名称 + String email = req.getEmail();//邮箱 + String workNubmer = req.getWorkNumber().replaceAll("\\u00A0", "").trim();//学号/工号 + String phone = req.getPhone().replaceAll("\\u00A0", "").trim(); + SaveUserInfoReq userInfoReq = new SaveUserInfoReq(); + + //职工账号,用户姓名,账号角色,工号为空 某列为空就提示错误 + // if (account.equals("")) { + // UseImportFailureVo vo = new UseImportFailureVo(); + // vo.setIndex(ii).setUserName(userName) + // .setRoleId(roleName) + // .setAccount(account + " *必填项:(账号不能为空)") + // .setEmail(email) + // .setWorkNumber(workNubmer) + // .setFailureMsg("账号不能为空!"); + // + // users.remove(i); + // i--; + // failVo1.add(vo); + // continue; + // } + + //校验姓名 + if (userName.equals("")) { + UseImportFailureVo vo = new UseImportFailureVo(); + ++ii; + vo.setIndex(ii) + .setUserName(req.getUserName() + " 必填项:((姓名不能为空)") + // .setAccount(req.getAccount()) + .setWorkNumber(req.getWorkNumber()) + .setEmail(req.getEmail()). + setRoleId(req.getRoleId()) + .setFailureMsg("姓名不能为空!"); + users.remove(i); + i--; + failVo1.add(vo); + continue; + } + + //校验角色 + if (roleName.equals("")) { + UseImportFailureVo vo = new UseImportFailureVo(); + vo.setIndex(ii).setUserName(userName) + .setRoleId(roleName + " *必填项:(角色不能为空)") + // .setAccount(account) + .setEmail(email) + .setWorkNumber(workNubmer) + .setFailureMsg("角色不能为空!"); + + users.remove(i); + i--; + failVo1.add(vo); + continue; + } else { + userInfoReq.setRoleId(roleName); + } + + //校验工号 + if (workNubmer.equals("")) { + UseImportFailureVo vo = new UseImportFailureVo(); + vo.setIndex(ii).setUserName(userName) + .setRoleId(roleName) + // .setAccount(account) + .setEmail(email) + .setWorkNumber(workNubmer + " *必填项:(学号/工号不能为空)") + .setFailureMsg("学号/工号不能为空!"); + + users.remove(i); + i--; + failVo1.add(vo); + continue; + } else { + userInfoReq.setWorkNumber(workNubmer); + } + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("school_id", schoolId); + wrapper.eq("role_name", roleName); + Role role = roleMapper.selectOne(wrapper); + + if (role == null) { + UseImportFailureVo vo = new UseImportFailureVo(); + ++ii; + vo.setIndex(ii).setUserName(userName) + .setRoleId(roleName + "(不存在该角色!)") + // .setAccount(account) + .setEmail(email) + .setWorkNumber(workNubmer) + .setFailureMsg("不存在该角色!"); + + users.remove(i); + i--; + failVo1.add(vo); + continue; + } + + //校验工号 + Map checkWorkNum = new HashMap<>(); + checkWorkNum.put("platformId", PlatformConstant.DATA_PLATFORM); + checkWorkNum.put("workNumber", workNubmer); + checkWorkNum.put("type", 2); + checkWorkNum.put("schoolId", schoolId); + HrUserAccount userAccount = baseMapper.getAccount(checkWorkNum); + if (userAccount != null) { + UseImportFailureVo vo = new UseImportFailureVo(); + ++ii; + vo.setIndex(ii).setUserName(userName) + .setRoleId(roleName) + // .setAccount(account) + .setEmail(email) + .setWorkNumber(workNubmer + "(重复的工号)!)") + .setFailureMsg("重复的工号!"); + + users.remove(i); + i--; + failVo1.add(vo); + continue; + } + + if (email != null && email != "") { + + if (checkEmail(email)) { + userInfoReq.setEmail(email); + } else { + UseImportFailureVo vo = new UseImportFailureVo(); + ++ii; + vo.setIndex(ii).setUserName(userName) + .setRoleId(roleName) + // .setAccount(account) + .setEmail(email + "(请输入正确的邮箱格式)!)") + .setWorkNumber(workNubmer) + .setFailureMsg("请输入正确的邮箱格式!"); + + users.remove(i); + i--; + failVo1.add(vo); + continue; + } + + } + + ++ii; + if (!users.isEmpty() && users.size() > 0) { + + //查询角色 + // DataRole getRole = baseMapper.getRole(roleName, String.valueOf(schoolId)); + + QueryWrapper wrapper1 = new QueryWrapper<>(); + wrapper1.eq("school_id", schoolId); + wrapper1.eq("role_name", roleName); + Role getRole = roleMapper.selectOne(wrapper1); + + req.setRoleId(getRole.getId() + ""); + + List roleIds = new ArrayList<>(); + roleIds.add(getRole.getId()); + + req.setUniqueIdentification(String.valueOf(System.currentTimeMillis())); + req.setSchoolId(schoolId); + + //用户信息 + HrUserInfo addUser = new HrUserInfo(); + BeanUtils.copyProperties(req, addUser); + + //账户信息 + HrUserAccount addAccount = new HrUserAccount(); + BeanUtils.copyProperties(req, addAccount); + + //统计该院校下可启用的账号数量 + int availableNum = userAccountMapper.getAvailableNum(req.getSchoolId()); + + //查询现在该院校已启用的账号数量 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("school_id", req.getSchoolId()); + queryWrapper.eq("is_enable", DelConstant.IS_ENABLE); + List getNum = userAccountMapper.selectList(queryWrapper); + + availableNum = availableNum - 1;//todo 减1是因为客户也包含了算启用的用户 + + //判断该院校已启用账户总数量是否小于该院校可启用的账户数量 + if (getNum.size() <= availableNum) { + addUser.setIsEnable(DelConstant.IS_ENABLE);//设置为已启用 + } else { + addUser.setIsEnable(DelConstant.NO_ENABLE);//设置为未启用 + } + addUser.setRoleId("0"); + + int ret1 = baseMapper.insert(addUser); + addAccount.setPassword(MD5.encrypt("1122aa")); + addAccount.setUserId(addUser.getUserId()); + addAccount.setPlatformId(PlatformConstant.DATA_PLATFORM.toString()); + addAccount.setIsEnable(addUser.getIsEnable()); + //22.4.13补充: 账号组成条件:平台(职站/数据平台/中台)-端(教师、学生端、无端(数据平台的用户))-学校(学校id)-学号/工号(用户输入的工号学号) + addAccount.setAccount(PlatformConstant.DATA_PLATFORM + "-" + PlatformConstant + .UNPROVOKED + "-" + schoolId + "-" + req.getWorkNumber()); + addAccount.setRoleId("0"); + addAccount.setPhone(null); + if (!phone.equals("")) { + addAccount.setPhone(phone); + addAccount.setPhoneBindingTime(DateUtils.getNowTime()); + } + int ret2 = userAccountMapper.insert(addAccount); + + //重新账号赋予角色 + userClient.rolePermissionService(addAccount.getId(), roleIds,null); + + if (StringUtils.isEmpty(String.valueOf(ret1)) && StringUtils.isEmpty(String.valueOf(ret2))) { + throw new RuntimeException(); + } + } + } + } catch (RuntimeException e) { + map.put("failura", "数据有误,添加失败!"); + throw new RuntimeException(); + } + String token = ""; + + // 有导入失败的数据,才会存入redis + if (failVo1.size() > 0) { + //生成token + token = "FAILURE_IMPORT" + UUID.randomUUID().toString().replace("-", ""); + ValueOperations ops = stringRedisTemplate.opsForValue(); + String failureVOJson = JSON.toJSONString(failVo1); + ops.set(token, failureVOJson, 30 * 60, TimeUnit.SECONDS); + } + map.put("token", token); + map.put("successNum", (size - failVo1.size()) + ""); + map.put("failureNum", failVo1.size() + ""); + return map; + } + + @Override + public void exportFailureRecord(HttpServletResponse response, String token) throws Exception { + if (StringUtils.isEmpty(token)) { + return; + } + ValueOperations ops = stringRedisTemplate.opsForValue(); + //获取数据 + String record = ops.get(token); + if (StringUtils.isEmpty(record)) { + return; + } + List parse = JSON.parseObject(record, new TypeReference>() { + }); + + parse.sort(Comparator.comparing(UseImportFailureVo::getIndex)); + + ClassPathResource classPathResource = new ClassPathResource("excleTemplate/用户导入失败数据导出模板.xlsx"); + InputStream inputStream = classPathResource.getInputStream(); + + //3、通过工具类下载文件 + new ExcelExportUtil(UseImportFailureVo.class, Constant.ROW_INDEX, Constant.STYLE_INDEX). + export(response, inputStream, parse, "导入失败数据表.xlsx"); + + if (inputStream != null) { + inputStream.close(); + } + } + + @Override + public boolean queryPhone(String phone) { + int count = hrUserAccountMapper.selectCount(new QueryWrapper() + .eq("phone", phone).eq("is_del", 0)); + return count > 0 ? true : false; + } + + @Override + public boolean queryEmail(String email) { + int count = this.baseMapper.selectCount(new QueryWrapper() + .eq("email", email).eq("is_del", 0)); + return count > 0 ? true : false; + } + + @Override + public R sendCheckPhoneCode(CheckVo checkVo) { + boolean re = true; + boolean isSend; + String phoneOrEmail = ""; + + String msg = ""; + if (checkVo.getTypes().equals(1)) {//邮箱验证码 + phoneOrEmail = checkVo.getEmail(); +/* re = this.queryEmail(checkVo.getEmail()); + phoneOrEmail = checkVo.getEmail(); + msg = "邮箱已存在!";*/ + } else {//手机验证码 + phoneOrEmail = checkVo.getPhone(); +/* re = this.queryPhone(checkVo.getPhone()); + phoneOrEmail = checkVo.getPhone(); + msg = "手机号已存在!";*/ + } + +/* if (re) { + return R.error(403, msg); + }*/ + + //先从redis中查询该手机号的验证码是否过期,未过期直接返回发送成功,防重放 + //为了保证该手机号5分钟内在其他场景下内正常使用,存入的key需要与短信模板进行拼接 + String key = StringUtils.join(phoneOrEmail, SMSTemplate.AUTHENTICATION_CODE); + System.out.println(key); + String code = stringRedisTemplate.opsForValue().get(key); + if (!StringUtils.isEmpty(code)) { + return R.ok("验证码已发,请勿重复操作!"); + } + code = RandomUtil.getSixBitRandom(); + Map param = new HashMap<>(); + param.put("code", code); + if (checkVo.getTypes().equals(1)) {//邮箱验证码 +// isSend = EmailUtils.sendEmail(phoneOrEmail, code); + emailUtil.sendMessage(phoneOrEmail, + "职站", + "尊敬的用户,欢迎使用职站,您本次的验证码是: "+code+",有效时间为5分钟"); + isSend = true; + } else {//手机验证码 + isSend = SendSMSUtils.send(phoneOrEmail, SMSTemplate.AUTHENTICATION_CODE, param); + } + + if (isSend) { + stringRedisTemplate.opsForValue().set(key, code, 5, TimeUnit.MINUTES); + CheckVo checkVo1 = new CheckVo(); + checkVo1.setOpener(key); + return R.ok(checkVo1); + } else { + return R.error("验证码发送失败,请稍后重试!"); + } + } + + @Override + public R sendPhoneVerificationCode(String phoneOrEmail, Integer loginOrBind, String platform) { + + boolean isSend = false; + //先从redis中查询该手机号的验证码是否过期,未过期直接返回发送成功,防重放 + //为了保证该手机号5分钟内在其他场景下内正常使用,存入的key需要与短信模板进行拼接 + String key = StringUtils.join(phoneOrEmail, SMSTemplate.AUTHENTICATION_CODE); + String code = stringRedisTemplate.opsForValue().get(key); + if (!StringUtils.isEmpty(code)) { + return R.ok("验证码已发,请勿重复操作!"); + } + code = RandomUtil.getSixBitRandom(); + Map param = new HashMap<>(); + param.put("code", code); + + if (EmailUtils.isEmail(phoneOrEmail)) {//邮箱验证码 + //发送前验证邮箱是否可以正常使用 + QueryWrapper userInfoQueryWrapper = new QueryWrapper<>(); + userInfoQueryWrapper.eq("email", phoneOrEmail). + eq("is_enable", 1); + List hrUserInfos = hrUserInfoMapper.selectList(userInfoQueryWrapper); + + //邮箱不存在 + if (ObjectUtil.isNull(hrUserInfos) || hrUserInfos.size() <= 0) { + throw new CustomException(ExceptionEnum.MAIL_NOT_EXIST); + } + isSend = EmailUtils.sendEmail(phoneOrEmail, code); + } else { + //登录验证手机是否存在,区分平台 + //TODO 判断用户是否禁用,给出对应提示 + if (loginOrBind.equals(0)) { + //发送前验证手机号是否可以正常使用 + QueryWrapper accountQueryWrapper = new QueryWrapper<>(); + accountQueryWrapper.eq("phone", phoneOrEmail). + eq("platform_id", platform). + eq("is_enable", 1); + List hrUserAccounts = hrUserAccountMapper.selectList(accountQueryWrapper); + + //手机号不存在 + if (ObjectUtil.isNull(hrUserAccounts) || hrUserAccounts.size() <= 0) { + throw new CustomException(ExceptionEnum.PHONE_NOT_EXIST); + } + } + isSend = SendSMSUtils.send(phoneOrEmail, SMSTemplate.AUTHENTICATION_CODE, param); + } + + if (isSend) { + stringRedisTemplate.opsForValue().set(key, code, 2, TimeUnit.MINUTES); + return R.ok("发送成功,请注意查收!"); + } else { + return R.error("发送失败,请稍后重试!"); + } + + } + + @Transactional + @Override + public R bindPhone(CheckVo checkVo, Integer userId) { + String opener = stringRedisTemplate.opsForValue().get(checkVo.getOpener());//获取验证码 + if (opener == null) { + return R.error("验证码已过期或不存在,请重新发送验证码"); + } else if (opener.equals(checkVo.getCode())) { + + HrUserInfo hrUserInfo = new HrUserInfo(); + hrUserInfo.setUserId(userId); + hrUserInfo.setEmail(checkVo.getEmail()); + + int i = baseMapper.updateById(hrUserInfo); + + /*HrUserAccount userAccount = new HrUserAccount(); + userAccount.setUserId(userId); + userAccount.setPhone(checkVo.getPhone());*/ + if (StringUtils.isNotEmpty(checkVo.getPhone())){ + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.set("phone", checkVo.getPhone()); + updateWrapper.set("phone_binding_time", new Date()); + updateWrapper.eq("user_id", userId); + hrUserAccountMapper.update(new HrUserAccount(), updateWrapper); + } + + if (i > 0 ) { + return R.ok(); + } else { + return R.error("绑定失败!"); + } + } + return R.error("绑定失败!"); + } + + @Override + public R queryUserInfoById(Integer userId, Integer accountId) { + HrUserInfo userInfo = hrUserInfoMapper.selectOne(new QueryWrapper().eq("user_id", userId)); + List personalFiles = hrPersonalFileMapper.selectList(new QueryWrapper().eq("user_id", userId)); + HrUserAccount hrUserAccount = hrUserAccountMapper + .selectOne(new QueryWrapper().eq("id", accountId)); +// .last(" and FIND_IN_SET( " + PlatformConstant.DATA_PLATFORM + ", platform_id )")); + + String schoolName = hrUserAccountMapper.querySchoolNameBySchoolId(hrUserAccount.getSchoolId()); + return R.ok().put("userInfo", userInfo).put("personalFiles", personalFiles).put("userAccount", hrUserAccount).put("schoolName", schoolName); + } + + @Override + public Integer queryAccountExistByPlatformId(String account, Integer userId, Integer platformId) { + return hrUserAccountMapper.queryAccountExistByPlatformId(account, userId, String.valueOf(platformId)); + } + + @Override + public void updateUserInfoById(HrUserInfo entity) { + hrUserInfoMapper.userInfoUpdateUserInfoById(entity); + } + + @Override + public LoginDTO login(LoginVo loginVo) { + //校验参数、校验验证码、获取用户信息、校验密码、校验是否被禁用、返回token + LoginDTO loginDTO = new LoginDTO(); + + //根据手机号或邮箱登录 + if (loginVo.getDistinguish().equals(LoginDistConstant.PHONE_EMAIL_LOGIN)) { + HashMap map = phoneOrEmailLogin(loginVo); + if (ObjectUtil.isNull(map)) { + throw new CustomException(ExceptionEnum.ACCOUNT_NOT_EXIST); + } + loginDTO.setUserAccounts((ArrayList) map.get("userAccounts")); + loginDTO.setToken((String) map.get("token")); + return loginDTO; + } + + //验证码校验 +// Boolean check = check(loginVo.getRandom(), loginVo.getCode()); + if (true) { + //账号、学号、工号登录 + if (loginVo.getDistinguish() == 1) { + + //登录集成判断,学号跟账号只能允许为空一个,都为空抛出异常 + if (loginVo.getWorkNumber() == null & loginVo.getAccount() == null) { + throw new CustomException(ExceptionEnum.EMPTY_PARAMETER); + } + + //账号为空,根据学号、工号进行登录判断 + if (StrUtil.isBlank(loginVo.getAccount())) { + //根据学号、工号进行登录,验证相关基本信息 + Integer schoolId = loginVo.getSchoolId(); + String workNumber = loginVo.getWorkNumber(); + if (schoolId == null) { + throw new CustomException(ExceptionEnum.EMPTY_SCHOOL); + } + if (workNumber == null) { + throw new CustomException(ExceptionEnum.EMPTY_WORK_NUMBER); + } + HashMap hashMap = workNumberLogin(loginVo); + loginDTO.setToken((String) hashMap.get("token")); + return loginDTO; + } + + //账号登录 + HashMap hashMap = accountLogin(loginVo); + if (ObjectUtil.isNull(hashMap)) { + throw new CustomException(ExceptionEnum.ACCOUNT_NOT_EXIST); + } + loginDTO.setToken((String) hashMap.get("token")); + return loginDTO; + } + } + return null; + } + + /** + * 根据学号工号登录 + * + * @param loginVo 登录账号 + * @return token + */ + public HashMap workNumberLogin(LoginVo loginVo) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("school_id", loginVo.getSchoolId()) + .eq("work_number", loginVo.getWorkNumber()) + .eq("type", loginVo.getType()) + .eq("platform_id", loginVo.getPlatform()); + //判断学号、工号是否存在 + HrUserAccount hrUserAccount = hrUserAccountMapper.selectOne(wrapper); + //学号不存在 + if (ObjectUtil.isNull(hrUserAccount) && loginVo.getType() == 1) { + throw new CustomException(ExceptionEnum.STUDENT_ID_NOT_EXIST); + } + //工号不存在 + if (ObjectUtil.isNull(hrUserAccount) && loginVo.getType() == 0) { + throw new CustomException(ExceptionEnum.JOB_ID_NOT_EXIST); + } + return this.queryAccountInfo(hrUserAccount, loginVo.getPassword(), true); + } + + /** + * 根据账号登录 + * + * @param loginVo 登录账号 + * @return token + */ + public HashMap accountLogin(LoginVo loginVo) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("account", loginVo.getAccount()).last("and FIND_IN_SET(" + loginVo.getPlatform() + ",platform_id)"); + //判断账号是否存在 + HrUserAccount hrUserAccount = hrUserAccountMapper.selectOne(wrapper); + if (ObjectUtil.isNull(hrUserAccount)) { + throw new CustomException(ExceptionEnum.ACCOUNT_NOT_EXIST); + } + //无端用户无须判断 + /*if (hrUserAccount.getType()!=2){ + //查询平台权限 + if (!loginVo.getType().equals(hrUserAccount.getType())){ + throw new CustomException(ExceptionEnum.NOT_AUTHORITY); + } + }*/ + return this.queryAccountInfo(hrUserAccount, loginVo.getPassword(), false); + } + + /** + * 根据手机号或邮箱登录 + * + * @param loginVo 手机号或邮箱 + * @return token + */ + public HashMap phoneOrEmailLogin(LoginVo loginVo) { + HashMap hashMap = Maps.newHashMap(); + //手机验证码登录验证 + //根据账号表查询手机号、用户表查询邮箱(用户表中手机号已弃用) + if (EmailUtils.isEmail(loginVo.getAccount())) { + //查询邮箱是否存在 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("email", loginVo.getAccount()); + List hrUserInfos = hrUserInfoMapper.selectList(wrapper); + + if (hrUserInfos.size() > 0) { + ArrayList accounts = new ArrayList<>(); + //获取用户id + for (HrUserInfo userInfo : hrUserInfos) { + HrUserAccount account = hrUserAccountMapper.selectOne(new QueryWrapper(). + select("work_number", "school_id", "id", "is_enable"). + eq("user_id", userInfo.getUserId()). + last("and FIND_IN_SET(" + loginVo.getPlatform() + ",platform_id)")); + account.setUserName(userInfo.getUserName()); + accounts.add(account); + } + + accounts.forEach(hrUserAccount -> { + hrUserAccount.setSchoolName(hrUserAccountMapper.querySchoolNameBySchoolId(hrUserAccount.getSchoolId())); + }); + + hashMap.put("userAccounts", accounts); + return hashMap; + } + + //根据所有用户查询账号数据 + /*//用户登录 + if (ObjectUtil.isNotNull(hrUserInfo)) { + QueryWrapper accountQueryWrapper = new QueryWrapper<>(); + accountQueryWrapper. + eq("user_id", hrUserInfo.getUserId()). + last("and FIND_IN_SET(" + loginVo.getPlatform() + ",platform_id)"); + //判断账号是否存在 + QueryWrapper wrapperExist = new QueryWrapper<>(); + wrapperExist.eq("user_id", hrUserInfo.getUserId()); + HrUserAccount hrUserAccount = hrUserAccountMapper.selectOne(wrapperExist); + if (ObjectUtil.isNull(hrUserAccount)) { + if (EmailUtils.isEmail(loginVo.getAccount())) { + throw new CustomException(ExceptionEnum.MAIL_NOT_EXIST); + } + throw new CustomException(ExceptionEnum.PHONE_NOT_EXIST); + } + + return this.queryAccountInfo(accountQueryWrapper, loginVo.getPassword(), loginVo.getPlatform()); + }*/ + + /*//客户登录,用户查询不到,查询客户手机号和邮箱 + Integer customerId = hrUserInfoMapper.selectCustomerId(loginVo.getAccount()); + //客户存在,提示不允许使用手机号和邮箱登录 + if (customerId != null) { + throw new CustomException(ExceptionEnum.NOT_ALLOWED); + }*/ + + //邮箱不存在 + throw new CustomException(ExceptionEnum.MAIL_NOT_EXIST); + } + + //查询手机号是否存在,发送之前已经查询一次 + /*QueryWrapper accountQueryWrapper = new QueryWrapper<>(); + accountQueryWrapper.eq("phone", loginVo.getAccount()). + eq("is_enable",1). + last("and FIND_IN_SET(" + loginVo.getPlatform() + ",platform_id)"); + List hrUserAccounts = hrUserAccountMapper.selectList(accountQueryWrapper); + + //手机号不存在 + if (ObjectUtil.isNull(hrUserAccounts) || hrUserAccounts.size()<=0) { + throw new CustomException(ExceptionEnum.PHONE_NOT_EXIST); + }*/ + + return this.phoneVerification(loginVo); + + } + + public HashMap phoneVerification(LoginVo loginVo) { + HashMap hashMap = Maps.newHashMap(); + + //中台手机号登录验证登录密码 + if (loginVo.getPlatform()==3){ + HrUserAccount hrUserAccount = hrUserAccountMapper.selectOne(new QueryWrapper(). + eq("phone", loginVo.getAccount()).eq("platform_id",loginVo.getPlatform())); + + if (ObjectUtil.isNull(hrUserAccount)) { + throw new CustomException(ExceptionEnum.PHONE_NOT_EXIST); + }else { + //校验密码 + if (!hrUserAccount.getPassword().equals(MD5.encrypt(loginVo.getPassword()))) { + throw new CustomException(ExceptionEnum.WRONG_PASSWORD); + } + //是否禁用 + if (hrUserAccount.getIsEnable().equals(OrderConstant.Not_enabled)) { + throw new CustomException(ExceptionEnum.ACCOUNT_DISABLED); + } + //更新用户信息 + updateUserInfo(hrUserAccount.getUserId(), false, hrUserAccount.getId()); + + hashMap.put("token", JwtUtils.getJwtToken(StringUtils.join(hrUserAccount.getId()))); + return hashMap; + } + + } + String key = StringUtils.join(loginVo.getAccount(), SMSTemplate.AUTHENTICATION_CODE); + String value = stringRedisTemplate.opsForValue().get(key); + if (StringUtils.isEmpty(value)) { + throw new CustomException(ExceptionEnum.CODE_EXPIRED); + } + //验证验证码 + if (loginVo.getCode().equals(value)) { + List hrUserAccounts = getOtherAccount(loginVo.getAccount(), loginVo.getPlatform().toString()); + hashMap.put("userAccounts", hrUserAccounts); + if (hrUserAccounts.size()==1){ + hashMap.put("token", JwtUtils.getJwtToken(StringUtils.join(hrUserAccounts.get(0).getId()))); + } + return hashMap; + } + + throw new CustomException(ExceptionEnum.CODE_ERROR); + } + + @Override + public R unbindAccounts(UnbindAccountsReq accountsReq) { + + String key = StringUtils.join(accountsReq.getPhone(), SMSTemplate.AUTHENTICATION_CODE); + String value = stringRedisTemplate.opsForValue().get(key); + if (StringUtils.isEmpty(value)) { + throw new CustomException(ExceptionEnum.CODE_EXPIRED); + } + //验证验证码 + if (accountsReq.getCode().equals(value)) { + List accountIds = accountsReq.getAccountIds(); + if (accountIds.size() > 0) { + for (Integer accountId : accountIds) { +/* HrUserAccount userAccount = new HrUserAccount(); + userAccount.setId(accountId); + userAccount.setPhone(null); + hrUserAccountMapper.updateById(userAccount);*/ + //解绑手机号 + hrUserAccountMapper.unbindMobilePhone(accountId); + } + } + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("school_id", accountsReq.getSchoolId()) + .eq("work_number", accountsReq.getWorkNumber()) + .eq("type", accountsReq.getType()) + .eq("platform_id", accountsReq.getPlatform()); + //手机绑定 + HrUserAccount hrUserAccount = hrUserAccountMapper.selectOne(wrapper); + hrUserAccount.setPhone(accountsReq.getPhone()); + int update = hrUserAccountMapper.updateById(hrUserAccount); + if (update > 0) { + LoginDTO loginDTO = new LoginDTO(); + //登录验证 + HashMap hashMap = queryAccountInfo(hrUserAccount, accountsReq.getPassword(), true); + if (ObjectUtil.isNull(hashMap)) { + throw new CustomException(ExceptionEnum.ACCOUNT_NOT_EXIST); + } + loginDTO.setToken((String) hashMap.get("token")); + return R.ok("认证成功,欢迎 " + hrUserAccount.getWorkNumber() + " 回来!").put("data", loginDTO); + } + } + return R.error(); + } + + /* + 根据手机号或邮箱登录,@param loginVo 手机号或邮箱 + public HashMap phoneOrEmailLogin(LoginVo loginVo) { + //根据账号表查询手机号、用户表查询邮箱(用户表中手机号已弃用) + if (EmailUtils.isEmail(loginVo.getAccount())) { + //邮箱查询 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("email", loginVo.getAccount()); + HrUserInfo hrUserInfo = hrUserInfoMapper.selectOne(wrapper); + + //用户登录 + if (ObjectUtil.isNotNull(hrUserInfo)) { + QueryWrapper accountQueryWrapper = new QueryWrapper<>(); + accountQueryWrapper. + eq("user_id", hrUserInfo.getUserId()). + last("and FIND_IN_SET(" + loginVo.getPlatform() + ",platform_id)"); + //判断账号是否存在 + QueryWrapper wrapperExist = new QueryWrapper<>(); + wrapperExist.eq("user_id", hrUserInfo.getUserId()); + HrUserAccount hrUserAccount = hrUserAccountMapper.selectOne(wrapperExist); + if (ObjectUtil.isNull(hrUserAccount)) { + if (EmailUtils.isEmail(loginVo.getAccount())) { + throw new CustomException(ExceptionEnum.MAIL_NOT_EXIST); + } + throw new CustomException(ExceptionEnum.PHONE_NOT_EXIST); + } + //无端用户无须判断 + *//*if (hrUserAccount.getType()!=2){ + //查询平台权限 + if (!loginVo.getType().equals(hrUserAccount.getType())){ + throw new CustomException(ExceptionEnum.NOT_AUTHORITY); + } + }*//* + return this.queryAccountInfo(accountQueryWrapper, loginVo.getPassword(), loginVo.getPlatform()); + } + + //客户登录,用户查询不到,查询客户手机号和邮箱 + Integer customerId = hrUserInfoMapper.selectCustomerId(loginVo.getAccount()); + //客户存在,提示不允许使用手机号和邮箱登录 + if (customerId != null) { + throw new CustomException(ExceptionEnum.NOT_ALLOWED); + } + + //邮箱不存在 + throw new CustomException(ExceptionEnum.MAIL_NOT_EXIST); + } + + //手机号进行查询,查询多个账号 + QueryWrapper accountQueryWrapper = new QueryWrapper<>(); + accountQueryWrapper.eq("phone", loginVo.getAccount()). + last("and FIND_IN_SET(" + loginVo.getPlatform() + ",platform_id)"); + //账号表不存在,查询客户表 + if (ObjectUtil.isNull(accountQueryWrapper)) { + //客户登录,用户查询不到,查询客户手机号和邮箱 + Integer customerId = hrUserInfoMapper.selectCustomerId(loginVo.getAccount()); + //客户存在,提示不允许使用手机号和邮箱登录 + if (customerId != null) { + throw new CustomException(ExceptionEnum.NOT_ALLOWED); + } + }else { + return this.queryAccountInfo(accountQueryWrapper, loginVo.getPassword(), loginVo.getPlatform()); + } + + throw new CustomException(ExceptionEnum.PHONE_NOT_EXIST); + }*/ + + /** + * 账号信息效验,生成token + * + * @param password 密码 + * @return token + */ + public HashMap queryAccountInfo(HrUserAccount hrUserAccount, String password, boolean verify) { + HashMap hashMap = Maps.newHashMap(); + if (ObjectUtil.isNotNull(hrUserAccount)) { + //校验密码 + if (!hrUserAccount.getPassword().equals(MD5.encrypt(password))) { + throw new CustomException(ExceptionEnum.WRONG_PASSWORD); + } + //是否禁用 + if (hrUserAccount.getIsEnable().equals(OrderConstant.Not_enabled)) { + throw new CustomException(ExceptionEnum.ACCOUNT_DISABLED); + } + //验证手机号是否绑定 + if (verify) { + if (ObjectUtil.isEmpty(hrUserAccount.getPhone())) { + throw new CustomException(ExceptionEnum.NO_BIND_PHONE); + } + } + //客户为空,更新用户信息 + if (hrUserAccount.getUserId() != null) { + boolean customer = false; + if (hrUserAccount.getCustomerId() != null) { + customer = true; + } + //更新用户信息 + updateUserInfo(hrUserAccount.getUserId(), customer, hrUserAccount.getId()); + // hashMap.put("customer", false); + } + //客户不为为空,判断有无订单,订单时间未过期,产品是否启用,是否发货(取消验证) + /*if (hrUserAccount.getCustomerId() != null) { + customerVerification(hrUserAccount.getCustomerId(), platform); + String customerName = baseMapper.selectCustomerName(hrUserAccount.getCustomerId()); + hashMap.put("customer", true); + hashMap.put("customerName", customerName); + }*/ + hashMap.put("token", JwtUtils.getJwtToken(StringUtils.join(hrUserAccount.getId()))); + return hashMap; + } + throw new CustomException(ExceptionEnum.NOT_AUTHORITY); + } + + @Override + public R getToken(String id) { + String token = JwtUtils.getJwtToken(id); + LoginDTO data = new LoginDTO(); + data.setToken(token); + HrUserAccount account = hrUserAccountMapper.selectById(id); + String name = account.getAccount(); +/* List roles = userRoleService.queryAccountRoles(id); + if (loginVo.getType()!=1 && roles!=null && roles.size()<=0){ + return R.error("该账号无角色权限,无法登录,请联系管理员添加角色!"); + }*/ + return R.ok("认证成功,欢迎 " + name + " 回来!").put("data", data); + // return R.ok().put("token",token); + } + + /** + * 客户账号验证 + * + * @param customerId 客户id + * @param platform 平台 + */ + public void customerVerification(Integer customerId, Integer platform) { + R customerOrder = nakadaiClient.getCustomerOrder(customerId); + Object orderList = customerOrder.get("orderList"); + String jsonString = JSON.toJSONString(orderList); + List orders = JSON.parseArray(jsonString, Order.class); + + //客户无订单 + if (orders.size() == 0) { + throw new CustomException(ExceptionEnum.NO_ORDER); + } + Integer authority = 0; + //数据平台登录 + if (platform.equals(PlatformConstant.DATA_PLATFORM)) { + authority = 0; + } + //职站登录 + if (platform.equals(PlatformConstant.POST_STATION)) { + authority = 1; + } + List orderOthers = new ArrayList<>(); + for (Order order : orders) { + R orderOther = nakadaiClient.getOrderOther(order.getOrderId(), authority); + Object orderOtherList = orderOther.get("orderOtherList"); + String toJSONString = JSON.toJSONString(orderOtherList); + List otherList = JSON.parseArray(toJSONString, OrderOther.class); + if (otherList.size() != 0) { + orderOthers.addAll(otherList); + } + } + List ship = new ArrayList<>(); + List isEnable = new ArrayList<>(); + orderOthers.forEach(orderOther -> { + ship.add(orderOther.getShip()); + isEnable.add(orderOther.getIsEnable()); + }); + //订单都未发货 + boolean contains = ship.contains(OrderConstant.SHIPPED); + if (!contains) { + throw new CustomException(ExceptionEnum.NO_SHIPPED); + } + //订单都未启用 + boolean enable = isEnable.contains(OrderConstant.Enable); + if (!enable) { + throw new CustomException(ExceptionEnum.NO_ENABLE); + } + //过滤订单信息 + List collect = orderOthers.stream().filter(orderOther -> { + return orderOther.getIsEnable() == 1; + }).collect(Collectors.toList()); + List maturity = new ArrayList<>(); + //查询订单是否到期 + collect.forEach(orderOther -> { + Date startTime = orderOther.getStartTime(); + Date endTime = orderOther.getEndTime(); + boolean in = DateUtil.isIn(new Date(), startTime, endTime); + maturity.add(in); + }); + //订单都过期 + boolean end = maturity.contains(true); + if (!end) { + throw new CustomException(ExceptionEnum.MATURITY); + } + } + + /** + * 更新用户信息,登录次数和时间 + */ + public void updateUserInfo(Integer userId, boolean customer, Integer accountId) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("user_id", userId); + HrUserInfo userInfo = baseMapper.selectOne(wrapper); + +// HrUserAccount userAccount = userAccountMapper.selectById(accountId); + + if (ObjectUtil.isNull(userInfo)) { + throw new CustomException(ExceptionEnum.USER_NOT_EXIST); + } + //手机号验证 + /*if (!customer){ + //更新用户信息之前,判断用户是否绑定手机号 + if (StrUtil.isEmpty(userInfo.getPhone()) || StrUtil.isBlank(userInfo.getPhone()) || StrUtil.isNullOrUndefined(userInfo.getPhone())) { + throw new CustomException(ExceptionEnum.NO_BIND_PHONE); + } + }*/ + userInfo.setLastLoginTime(new Date()); + //新用户首次登录跳转至日志通知 + if (userInfo.getLoginNumber() == 0) { + redisTemplate.opsForValue().set(accountId.toString(), "true"); + } + userInfo.setLoginNumber(userInfo.getLoginNumber() + 1); + baseMapper.updateById(userInfo); + } + + /** + * 校验验证码 + * + * @param random 随机数 + * @param code 验证码 + * @return boolean + */ + public Boolean check(String random, String code) { + String value = redisTemplate.opsForValue().get(random); + //验证码已过期 + if (StringUtils.isEmpty(value)) { + throw new CustomException(ExceptionEnum.CODE_EXPIRED); + } + //验证码错误 + if (!code.equals(value)) { + throw new CustomException(ExceptionEnum.CODE_ERROR); + } + return redisTemplate.delete(random); + } + + /** + * 生成算数图形验证码 + * + * @param random 随机数 + * @param response 图形验证码 + */ + @Override + public void createCaptcha(String random, HttpServletResponse response) { + Captcha captcha = new ArithmeticCaptcha(); + //生成验证码 + String text = captcha.text(); + //缓存验证码 + redisTemplate.opsForValue().set(random, text, 5, TimeUnit.MINUTES); + response.setContentType(MediaType.IMAGE_PNG_VALUE); + response.setHeader(HttpHeaders.PRAGMA, "No-cache"); + response.setHeader(HttpHeaders.CACHE_CONTROL, "No-cache"); + response.setDateHeader(HttpHeaders.EXPIRES, 0L); + try { + captcha.out(response.getOutputStream()); + } catch (IOException e) { + e.printStackTrace(); + } + } + + @Override + public List getOtherAccount(String phone, String platform) { + + //根据手机号查询当前平台的其他账号用户信息 + List hrUserAccounts = hrUserAccountMapper.selectList(new QueryWrapper(). + select("work_number", "school_id", "id", "user_id", "is_enable"). + eq("phone", phone). + last("and FIND_IN_SET(" + platform + ",platform_id)")); + + if (hrUserAccounts != null && hrUserAccounts.size() > 0) { + hrUserAccounts.forEach(hrUserAccount -> { + hrUserAccount.setSchoolName(hrUserAccountMapper.querySchoolNameBySchoolId(hrUserAccount.getSchoolId())); + HrUserInfo userInfo = hrUserInfoMapper.selectById(hrUserAccount.getUserId()); + hrUserAccount.setUserName(userInfo.getUserName()); + }); + + return hrUserAccounts; + } + return null; + } + + /** + * @Description : 校验手机号码 + * @Param phone + * @Author Rong---2021/10/18 + */ + @Override + public boolean checkPhoneOrEmailExist(String phone, String email, Integer type) { + + switch (type) { + case 1: + QueryWrapper accountQueryWrapper = new QueryWrapper<>(); + accountQueryWrapper.eq("is_del", DelConstant.NOT_DEL); + accountQueryWrapper.eq("phone", phone); + Integer count = hrUserAccountMapper.selectCount(accountQueryWrapper); + return count > 0; + case 2: + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("is_del", DelConstant.NOT_DEL); + queryWrapper.eq("email", email); + Integer count1 = baseMapper.selectCount(queryWrapper); + return count1 > 0; + } + return false; + } + + @Override + public String getUserName(Integer accountId) { + return baseMapper.getUserName(accountId); + } + + private R getAccountList(Integer userId) { + //根据用户id查询账号 + List accountList = hrUserAccountMapper.selectList(new QueryWrapper(). + eq("user_id", userId).select("account", "school_id", "platform_id", "type")); + //只有一个账号无选择列表进行选择 + if (accountList.size() == 1) { + return R.ok(); + } + accountList.forEach(account -> { + Integer schoolId = account.getSchoolId(); + String schoolName = baseMapper.selectSchoolName(schoolId); + account.setSchoolName(schoolName); + if (account.getPlatformId().contains(PlatformConstant.POST_STATION.toString())) { + account.setPlatformName("职站"); + } + if (account.getPlatformId().contains(PlatformConstant.DATA_PLATFORM.toString())) { + account.setPlatformName("数据平台"); + } + if (account.getPlatformId().contains(PlatformConstant.NAKADAI.toString())) { + account.setPlatformName("中台"); + } + if (account.getType().equals(0)) { + account.setTypeName("教师端"); + } + if (account.getType().equals(1)) { + account.setTypeName("学生端"); + } + if (account.getType().equals(2)) { + account.setTypeName("该平台不区分端口!"); + } + }); + return R.ok().put("accountList", accountList); + } + + /** + * 根据code获取用户openid + * @param code 微信登录code + * @return OpenId + * @throws Exception + */ + private JSONObject getSessionKeyOrOpenIdByPartner(String code) throws Exception { + Map requestUrlParam = new HashMap<>(); + // 小程序appId,自己补充 + requestUrlParam.put("appid", WeChatPropertiesUtil.PARTNER_WX_OPEN_APP_ID); + // 小程序secret,自己补充 + requestUrlParam.put("secret", WeChatPropertiesUtil.PARTNER_WX_OPEN_APP_SECRET); + // 小程序端返回的code + requestUrlParam.put("js_code", code); + // 默认参数 + requestUrlParam.put("grant_type", GRANT_TYPE); + + // 发送post请求读取调用微信接口获取openid用户唯一标识 + String result = HttpClientUtils.doPost(REQUEST_URL, requestUrlParam); + return JSON.parseObject(result); + } + + private JSONObject getSessionKeyOrOpenIdByOperation(String code) throws Exception { + Map requestUrlParam = new HashMap<>(); + // 小程序appId,自己补充 + requestUrlParam.put("appid", WeChatPropertiesUtil.OPERATION_WX_OPEN_APP_ID); + // 小程序secret,自己补充 + requestUrlParam.put("secret", WeChatPropertiesUtil.OPERATION_WX_OPEN_APP_SECRET); + // 小程序端返回的code + requestUrlParam.put("js_code", code); + // 默认参数 + requestUrlParam.put("grant_type", GRANT_TYPE); + + // 发送post请求读取调用微信接口获取openid用户唯一标识 + String result = HttpClientUtils.doPost(REQUEST_URL, requestUrlParam); + return JSON.parseObject(result); + } + + /** + * 微信接口请求令牌:生产环境下 要用redis缓存起来 + * @return AccessToken + */ + /*public String getAccessToken() { + String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + + WeChatPropertiesUtil.WX_OPEN_APP_ID + "&secret=" + WeChatPropertiesUtil.WX_OPEN_APP_SECRET; + String accessToken = null; + try { + URL urlGet = new URL(url); + HttpURLConnection http = (HttpURLConnection) urlGet.openConnection(); + http.setRequestMethod("GET"); // 必须是get方式请求 + http.setRequestProperty("Content-Type","application/x-www-form-urlencoded"); + http.setDoOutput(true); + http.setDoInput(true); + System.setProperty("sun.net.client.defaultConnectTimeout", "30000");// 连接超时30秒 + System.setProperty("sun.net.client.defaultReadTimeout", "30000"); // 读取超时30秒 + http.connect(); + InputStream is = http.getInputStream(); + int size = is.available(); + byte[] jsonBytes = new byte[size]; + is.read(jsonBytes); + String message = new String(jsonBytes, "UTF-8"); + JSONObject demoJson = JSONObject.parseObject(message); + accessToken = demoJson.getString("access_token"); + is.close(); + } catch (Exception e) { + e.printStackTrace(); + } + return accessToken; + }*/ + + @Override + public Map weChatAppletCallbackByPartner(AppletCallbackReq appletCallbackReq, HttpServletResponse response) throws Exception { + String code = appletCallbackReq.getCode(); + + Map data = new HashedMap(); + // try { + JSONObject sessionKeyOrOpenId = this.getSessionKeyOrOpenIdByPartner(code); + Object openid = sessionKeyOrOpenId.get("openid"); + //根据openid查询用户,存在则返回登录状态 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("app_open_id",openid); + wrapper.eq("platform_id",4); + HrUserAccount userAccount = hrUserAccountMapper.selectOne(wrapper); + if (ObjectUtil.isNull(userAccount)){ + data.put("state", "bind"); + }else { + //登录查询是否有团队 + Integer exist = hrUserAccountMapper.selectTeam(userAccount.getId()); + if (exist>0){ + //更新登录时间 + updateUserInfo(userAccount.getUserId(),false,userAccount.getId()); + data.put("state", "login"); + data.put("token", JwtUtils.getJwtToken(userAccount.getId().toString())); + data.put("accountId", userAccount.getId()); + }else { + throw new CustomException(ExceptionEnum.TEAM_NOT_EXIST); + } + } + System.out.println(sessionKeyOrOpenId); + data.put("sessionKey", sessionKeyOrOpenId); + return data; + } + + + @Override + public R getSessionKey(AppletCallbackReq appletCallbackReq, HttpServletResponse response) throws Exception { + String code = appletCallbackReq.getCode(); + JSONObject sessionKeyOrOpenId = this.getSessionKeyOrOpenIdByPartner(code); + return R.ok().put("sessionKey", sessionKeyOrOpenId); + } + + @Override + public R loginByOpenid(String openid) { + Map data = new HashedMap(); + //根据openid查询用户,存在则返回登录状态 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("app_open_id",openid); + wrapper.eq("platform_id",4); + HrUserAccount userAccount = hrUserAccountMapper.selectOne(wrapper); + if (ObjectUtil.isNull(userAccount)){ + return R.error("账号不存在!"); + }else { + //更新登录时间 + updateUserInfo(userAccount.getUserId(),false,userAccount.getId()); + data.put("state", "login"); + data.put("token", JwtUtils.getJwtToken(userAccount.getId().toString())); + data.put("accountId", userAccount.getId()); + } + return R.ok().put("data",data); + } + + @Override + public R updateAvatars(String url,String id) { + //更新用户头像 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("platform_id",4); + wrapper.eq("id",id); + HrUserAccount userAccount = hrUserAccountMapper.selectOne(wrapper); + + HrUserInfo userInfo = hrUserInfoMapper.selectById(userAccount.getUserId()); + if (url!=null){ + userInfo.setUserAvatars(url); + hrUserInfoMapper.updateById(userInfo); + } + return R.ok(); + } + + @Override + public Map weChatAppletCallbackByOperation(AppletCallbackReq appletCallbackReq, HttpServletResponse response) throws Exception { + String code = appletCallbackReq.getCode(); + + Map data = new HashedMap(); + JSONObject sessionKeyOrOpenId = this.getSessionKeyOrOpenIdByOperation(code); + Object openid = sessionKeyOrOpenId.get("openid"); + //根据openid查询用户,存在则返回登录状态 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("app_open_id",openid); + wrapper.eq("platform_id",3); + HrUserAccount userAccount = hrUserAccountMapper.selectOne(wrapper); + if (ObjectUtil.isNull(userAccount)){ + data.put("state", "bind"); + }else { + //更新登录时间 + updateUserInfo(userAccount.getUserId(),false,userAccount.getId()); + data.put("state", "login"); + data.put("token", JwtUtils.getJwtToken(userAccount.getId().toString())); + data.put("accountId", userAccount.getId()); + } + System.out.println(sessionKeyOrOpenId); + data.put("sessionKey", sessionKeyOrOpenId); + return data; + } + + @Override + public String userBinding(WxUserBindingReq userBindingReq) { + if (userBindingReq.getPlatformId()==4){ + //根据手机号查询用户是否存在 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("phone",userBindingReq.getPhone()); + wrapper.eq("platform_id",4); + wrapper.eq("is_enable",1); + HrUserAccount userAccount = hrUserAccountMapper.selectOne(wrapper); + if (ObjectUtil.isNull(userAccount)){ + throw new CustomException(ExceptionEnum.USER_NOT_EXIST); + } + //更新登录时间 + updateUserInfo(userAccount.getUserId(),false,userAccount.getId()); + //查询是否有团队 + Integer exist = hrUserAccountMapper.selectTeam(userAccount.getId()); + if (exist>0){ + userAccount.setAppOpenId(userBindingReq.getOpenid()); + userAccount.setUnionid(userBindingReq.getUnionid()); + hrUserAccountMapper.updateById(userAccount); + return JwtUtils.getJwtToken(userAccount.getId().toString()); + } + throw new CustomException(ExceptionEnum.TEAM_NOT_EXIST); + }else { + //根据手机号查询用户是否存在 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("phone",userBindingReq.getPhone()); + wrapper.eq("platform_id",3); + wrapper.eq("is_enable",1); + HrUserAccount userAccount = hrUserAccountMapper.selectOne(wrapper); + if (ObjectUtil.isNull(userAccount)){ + throw new CustomException(ExceptionEnum.USER_NOT_EXIST); + } + //更新登录时间 + updateUserInfo(userAccount.getUserId(),false,userAccount.getId()); + userAccount.setAppOpenId(userBindingReq.getOpenid()); + userAccount.setUnionid(userBindingReq.getUnionid()); + hrUserAccountMapper.updateById(userAccount); + return JwtUtils.getJwtToken(userAccount.getId().toString()); + } + } + + /** + * 参数以raw的方式做post请求 + * @param url + * @param stringJson + * @param headers + * @param encode + * @return + */ + public static String httpPostRaw(String url, String stringJson, Map headers, String encode) { + String str = ""; + if (encode == null) { + encode = "utf-8"; + } + // HttpClients.createDefault()等价于 HttpClientBuilder.create().build(); + CloseableHttpClient closeableHttpClient = HttpClients.createDefault(); + HttpPost httpost = new HttpPost(url); + + // 设置header + httpost.setHeader("Content-type", "application/json"); + if (headers != null && headers.size() > 0) { + for (Map.Entry entry : headers.entrySet()) { + httpost.setHeader(entry.getKey(), entry.getValue()); + } + } + // 组织请求参数 + StringEntity stringEntity = new StringEntity(stringJson, encode); + httpost.setEntity(stringEntity); + String content = null; + CloseableHttpResponse httpResponse = null; + try { + // 响应信息 + httpResponse = closeableHttpClient.execute(httpost); + HttpEntity entity = httpResponse.getEntity(); + content = EntityUtils.toString(entity, encode); + System.out.println(content); + str = content; + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + httpResponse.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + try { // 关闭连接、释放资源 + closeableHttpClient.close(); + } catch (IOException e) { + e.printStackTrace(); + } + return str; + } + + @Override + @SneakyThrows + public R messageNotification(WxMssVo wxMssVo) { + //miniprogram_state string 是 跳转小程序类型:developer为开发版;trial为体验版;formal为正式版;默认为正式版 + //lang string 是 进入小程序查看”的语言类型,支持zh_CN(简体中文)、en_US(英文)、zh_HK(繁体中文)、zh_TW(繁体中文),默认为zh_CN + //拼接消息内容 +// wxMssVo.setTemplate_id("8pDVfWYqh9c-nn3CeA1NXM58pmoyQXZzkVnRFKy_l2A"); + wxMssVo.setMiniprogram_state("trial"); + wxMssVo.setLang("zh_CN"); + String accessToken=null; + try { + //设置openId +// wxMssVo.setTouser("osj9X5LWbk5nPxxw0AJ5un5XJ8cs"); +// 设置accessToken + accessToken= WeChatUtil.getAccessToken(); + } catch (IOException e) { + e.printStackTrace(); + } +// 设置小程序 跳转首页 +// wxMssVo.setPage("pages/index/index"); + + wxMssVo.setRequest_url("https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=" + accessToken); +// 将模板中的值一一赋值 发送到小程序的数据要转化为json格式 可以使用下面的方法直接拼接成JSONObject + cn.hutool.json.JSONObject jsonObject = new cn.hutool.json.JSONObject(); + cn.hutool.json.JSONObject dataInfo = new cn.hutool.json.JSONObject(); + dataInfo.putOpt("value", new Date()); + jsonObject.putOpt("time5", dataInfo); + +// 使用map结合模板 后续再加遍历拼接成JSONObject +// HashMap map = new HashMap<>(3); +// //根据模板写值 +// map.put("thing2", "测试学校"); +// map.put("thing8","下班打卡"); +// map.put("phrase10","下班打卡"); +// wxMssVo.setMap(map); + String s = WeChatUtil.sendTemplateMessage(wxMssVo); + return R.ok().put("s",s); + + /*// 微信小程序ID + String appid = WeChatPropertiesUtil.PARTNER_WX_OPEN_APP_ID; + // 微信小程序秘钥 + String secret =WeChatPropertiesUtil.PARTNER_WX_OPEN_APP_SECRET; + + String urlAt="https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid="+appid+"&secret="+secret; + // 发送请求,返回Json字符串 + String strAt = WeChatUtil.httpRequest(urlAt, "GET", null); + // 转成Json对象 获取openid + JSONObject fromObject = JSONObject.parseObject(strAt); + //获取at + String accessToken = fromObject.getString("access_token"); + System.out.println("后台获取的"+accessToken); + + String url = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token="+accessToken; + // 发送请求,返回Json字符串 + String str1 = WeChatUtil.httpRequest(url, "POST", format); + // 转成Json对象 获取openid + JSONObject fromObject1 = JSONObject.parseObject(str1); + + System.out.println("jsonObject____============"+fromObject1.toString()); +*/ + } + + + + +} diff --git a/users/src/main/java/com/huoran/users/service/impl/PermissionServiceImpl.java b/users/src/main/java/com/huoran/users/service/impl/PermissionServiceImpl.java new file mode 100644 index 0000000..688d72d --- /dev/null +++ b/users/src/main/java/com/huoran/users/service/impl/PermissionServiceImpl.java @@ -0,0 +1,172 @@ +package com.huoran.users.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.users.entity.DataPermission; +import com.huoran.users.entity.Permission; +import com.huoran.users.entity.RolePermission; +import com.huoran.users.entity.vo.DataPermissionVo; +import com.huoran.users.mapper.PermissionMapper; +import com.huoran.users.mapper.SupplierMapper; +import com.huoran.users.service.DataPermissionService; +import com.huoran.users.service.PermissionService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.users.service.RolePermissionService; +import com.huoran.users.service.SupplierService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; + +import java.util.ArrayList; +import java.util.List; + +/** + *

+ * 权限表 服务实现类 + *

+ * + * @author chen + * @since 2021-09-29 + */ +@Service +public class PermissionServiceImpl extends ServiceImpl implements PermissionService { + + @Autowired + private RolePermissionService rolePermissionService; + + @Autowired + private DataPermissionService dataPermissionService; + + @Autowired + private SupplierService supplierService; + + @Override + public List queryAllMenu(Integer platformId,Integer port) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("platform_id",platformId); + if (port!=null){ + wrapper.eq("port",port); + }else { + wrapper.eq("port",0); + } + List permissionList = baseMapper.selectList(wrapper); + return build(permissionList); + } + + @Override + public void removeChildById(Integer id) { + List idList = new ArrayList<>(); + this.selectChildListById(id, idList); + idList.add(id); + baseMapper.deleteBatchIds(idList); + } + + /** + * 递归获取子节点 + */ + private void selectChildListById(Integer id, List idList) { + List childList = baseMapper.selectList(new QueryWrapper().eq("pid", id).select("id")); + childList.forEach(item -> { + idList.add(item.getId()); + this.selectChildListById(item.getId(), idList); + }); + } + + /** + * 给角色分配权限 + * @param roleId 角色 + * @param permissionIds 权限值 + */ + @Override + public void saveRolePermissionRelationShip(Integer roleId, Integer[] permissionIds) { + //给角色分配权限之前,删除之前所有角色权限 + rolePermissionService.remove(new QueryWrapper().eq("role_id", roleId)); + + List rolePermissionList = new ArrayList<>(); + for(Integer permissionId : permissionIds) { + if(StringUtils.isEmpty(permissionId)) { + continue; + } + RolePermission rolePermission = new RolePermission(); + rolePermission.setRoleId(roleId); + rolePermission.setPermissionId(permissionId); + rolePermissionList.add(rolePermission); + } + rolePermissionService.saveBatch(rolePermissionList); + } + + @Override + public void assigningDataPermissions(Integer roleId, List dataPermissionList) { + //给角色数据权限之前,删除之前所有角色数据权限 + dataPermissionService.remove(new QueryWrapper().eq("role_id", roleId)); + //添加数据权限 + for (DataPermission dataPermission : dataPermissionList) { + dataPermission.setRoleId(roleId); + dataPermissionService.save(dataPermission); + } + + } + + /** + * 根据角色id获取权限菜单 + * @param roleIds 角色id + * @return 权限菜单 + */ + @Override + public List selectRoleMenu(String roleIds,Integer platformId) { + List allPermissionList = baseMapper.selectRolePermission(roleIds,platformId); + return build(allPermissionList); + } + + @Override + public List queryDataPermission(String roleIds) { + List dataPermissionList = dataPermissionService.selectDataPermission(roleIds); + int count = supplierService.count(null); + for (DataPermissionVo dataPermissionVo : dataPermissionList) { +// 客户权限id +// if (dataPermissionVo.getPermissionId()==135){ +// 客户拥有所有供应商,默认查询全部客户,包括未下单客户 + if (dataPermissionVo.getSupplierId().length() == count*2-1){ + dataPermissionVo.setAll(true); + } +// } + } + return dataPermissionList; + } + + /** + * 使用递归方法建菜单 + * @param treeNodes 权限菜单 + * @return 权限菜单 + */ + private static List build(List treeNodes) { + List trees = new ArrayList<>(); + for (Permission treeNode : treeNodes) { + if (treeNode.getPid()==0) { + treeNode.setLevel(1); + trees.add(findChildren(treeNode,treeNodes)); + } + } + return trees; + } + + /** + * 递归查找子节点 + * @param treeNodes 权限子菜单 + * @return 权限子菜单 + */ + private static Permission findChildren(Permission treeNode,List treeNodes) { + treeNode.setChildren(new ArrayList()); + + for (Permission it : treeNodes) { + if(treeNode.getId().equals(it.getPid())) { + int level = treeNode.getLevel() + 1; + it.setLevel(level); + if (treeNode.getChildren() == null) { + treeNode.setChildren(new ArrayList<>()); + } + treeNode.getChildren().add(findChildren(it,treeNodes)); + } + } + return treeNode; + } +} diff --git a/users/src/main/java/com/huoran/users/service/impl/PlatformLoginServiceImpl.java b/users/src/main/java/com/huoran/users/service/impl/PlatformLoginServiceImpl.java new file mode 100644 index 0000000..61dfbe0 --- /dev/null +++ b/users/src/main/java/com/huoran/users/service/impl/PlatformLoginServiceImpl.java @@ -0,0 +1,29 @@ +package com.huoran.users.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.common.response.R; +import com.huoran.users.entity.PlatformLogin; +import com.huoran.users.entity.res.LoginStatisticsResp; +import com.huoran.users.mapper.PlatformLoginMapper; +import com.huoran.users.service.PlatformLoginService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 各平台登录统计 服务实现类 + *

+ * + * @author chen + * @since 2022-09-13 + */ +@Service +public class PlatformLoginServiceImpl extends ServiceImpl implements PlatformLoginService { + + @Override + public R platformLoginStatistics(Integer platform,Integer schoolId) { + List loginStatisticsResp = baseMapper.platformLoginStatistics(platform,schoolId); + return R.ok().put("data",loginStatisticsResp); + } +} diff --git a/users/src/main/java/com/huoran/users/service/impl/RolePermissionServiceImpl.java b/users/src/main/java/com/huoran/users/service/impl/RolePermissionServiceImpl.java new file mode 100644 index 0000000..d370239 --- /dev/null +++ b/users/src/main/java/com/huoran/users/service/impl/RolePermissionServiceImpl.java @@ -0,0 +1,22 @@ +package com.huoran.users.service.impl; + +import com.huoran.users.entity.RolePermission; +import com.huoran.users.mapper.RolePermissionMapper; +import com.huoran.users.service.RolePermissionService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 角色权限表 服务实现类 + *

+ * + * @author chen + * @since 2021-09-29 + */ +@Service +public class RolePermissionServiceImpl extends ServiceImpl implements RolePermissionService { + +} diff --git a/users/src/main/java/com/huoran/users/service/impl/RoleServiceImpl.java b/users/src/main/java/com/huoran/users/service/impl/RoleServiceImpl.java new file mode 100644 index 0000000..e41cdac --- /dev/null +++ b/users/src/main/java/com/huoran/users/service/impl/RoleServiceImpl.java @@ -0,0 +1,203 @@ +package com.huoran.users.service.impl; + +import cn.hutool.core.date.DateUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.google.common.collect.Lists; +import com.huoran.common.response.R; +import com.huoran.users.entity.*; +import com.huoran.users.mapper.*; +import com.huoran.users.service.RolePermissionService; +import com.huoran.users.service.RoleService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +/** + *

+ * 角色表 服务实现类 + *

+ * + * @author chen + * @since 2021-09-29 + */ +@Service +public class RoleServiceImpl extends ServiceImpl implements RoleService { + + @Autowired + private RolePermissionMapper rolePermissionMapper; + + @Autowired + private RolePermissionService rolePermissionService; + + @Autowired + private PermissionMapper permissionMapper; + + @Autowired + private UserRoleMapper userRoleMapper; + + @Autowired + private HrUserAccountMapper accountMapper; + + @Override + public boolean repeat(Role role) { + QueryWrapper roleQueryWrapper = new QueryWrapper<>(); + roleQueryWrapper.eq("role_name",role.getRoleName()); + roleQueryWrapper.eq("school_id",role.getSchoolId()); + roleQueryWrapper.eq("platform_id",role.getPlatformId()); + roleQueryWrapper.last("and id not in ("+role.getId()+")"); + Integer count = baseMapper.selectCount(roleQueryWrapper); + return count>0; + } + + @Override + public boolean batchRemove(List roleIds) { + //删除该角色对应的权限 + for (Integer roleId : roleIds) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("role_id",roleId); + rolePermissionMapper.delete(wrapper); + + QueryWrapper userRoleQueryWrapper = new QueryWrapper<>(); + userRoleQueryWrapper.eq("role_id",roleId); + userRoleMapper.delete(userRoleQueryWrapper); + } + //删除角色 + int deleteBatchIds = baseMapper.deleteBatchIds(roleIds); + return deleteBatchIds > 0; + } + + @Override + public Role getRoleInfo(Integer schoolId, String roleName,Integer platformId) { + QueryWrapper roleQueryWrapper = new QueryWrapper<>(); + roleQueryWrapper.eq("role_name",roleName); + roleQueryWrapper.eq("school_id",schoolId); + roleQueryWrapper.eq("platform_id",platformId); + return baseMapper.selectOne(roleQueryWrapper); + } + + @Override + public boolean addCustomerAdmin(Integer schoolId, String accountId) { + /*QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("school_id",schoolId).eq("platform_id",platformId).eq("role_name","超级管理员"); + Role one = baseMapper.selectOne(queryWrapper);*/ + + ArrayList platformIds = Lists.newArrayList(); + platformIds.add(1); + platformIds.add(2); + for (Integer platformId : platformIds) { + //添加该学校角色 + Role role = new Role(); + role.setRoleName("超级管理员"); + role.setSchoolId(schoolId); + role.setPlatformId(platformId); + role.setRoleCode(DateUtil.format(new Date(), "yyyy-MM-dd")); + role.setRemark("系统默认角色,用于系统及用户的整体管理,可查看和操作所有功能,不可删除"); + int insert = baseMapper.insert(role); + if (insert>0){ + // 角色赋予所有权限 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.select("id").eq("platform_id",platformId); + List list = permissionMapper.selectList(wrapper); + list.forEach(permission -> { + RolePermission rolePermission = new RolePermission(); + rolePermission.setRoleId(role.getId()); + rolePermission.setPermissionId(permission.getId()); + rolePermissionMapper.insert(rolePermission); + }); + UserRole userRole = new UserRole(); + userRole.setRoleId(role.getId()); + userRole.setAccountId(Integer.parseInt(accountId)); + //账号赋予角色 + userRoleMapper.insert(userRole); + } + } + //添加该学校管理员角色 + Role role = new Role(); + role.setRoleName("管理员"); + role.setSchoolId(schoolId); + role.setPlatformId(1); + role.setRoleCode(DateUtil.format(new Date(), "yyyy-MM-dd")); + role.setRemark("系统默认角色,用于系统及用户的整体管理,可查看和操作所有功能"); + int insert = baseMapper.insert(role); + if (insert>0){ + // 角色赋予所有权限 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.select("id").eq("platform_id",1); + List list = permissionMapper.selectList(wrapper); + list.forEach(permission -> { + RolePermission rolePermission = new RolePermission(); + rolePermission.setRoleId(role.getId()); + rolePermission.setPermissionId(permission.getId()); + rolePermissionMapper.insert(rolePermission); + }); + UserRole userRole = new UserRole(); + userRole.setRoleId(role.getId()); + userRole.setAccountId(Integer.parseInt(accountId)); + //账号赋予角色 + userRoleMapper.insert(userRole); + } + + //添加该学校员工角色 + Role role1 = new Role(); + role1.setRoleName("用户"); + role1.setSchoolId(schoolId); + role1.setPlatformId(2); + role1.setRoleCode(DateUtil.format(new Date(), "yyyy-MM-dd")); + role1.setRemark("系统默认角色,普通用户所属,可查看数据"); + int insert1 = baseMapper.insert(role1); + if (insert1>0){ + // 角色赋予数据权限 + List list = new ArrayList<>(); + list.add(110); + list.add(129); + list.add(130); + list.add(131); + list.forEach(permissionId -> { + RolePermission rolePermission = new RolePermission(); + rolePermission.setRoleId(role1.getId()); + rolePermission.setPermissionId(permissionId); + rolePermissionMapper.insert(rolePermission); + }); + UserRole userRole = new UserRole(); + userRole.setRoleId(role1.getId()); + userRole.setAccountId(Integer.parseInt(accountId)); + //账号赋予角色 + userRoleMapper.insert(userRole); + } + return true; + } + + @Override + public R reassignmentPermissions() { + //查询所有客户,更新他们所在职站的超管权限 + List accountList = accountMapper.selectList(new QueryWrapper().isNotNull("customer_id")); + //查询所有权限 + List permissions = permissionMapper.selectList(new QueryWrapper(). + eq("platform_id", 1).eq("port", 0)); + + for (HrUserAccount userAccount : accountList) { + Integer roleId = baseMapper.selectCustomerSuper(userAccount.getId()); + //给角色分配权限之前,删除之前所有角色权限 + rolePermissionMapper.delete(new QueryWrapper().eq("role_id", roleId)); + + List rolePermissionList = new ArrayList<>(); + for(Permission permission : permissions) { + if(StringUtils.isEmpty(permission.getId())) { + continue; + } + RolePermission rolePermission = new RolePermission(); + rolePermission.setRoleId(roleId); + rolePermission.setPermissionId(permission.getId()); + rolePermissionList.add(rolePermission); + } + rolePermissionService.saveBatch(rolePermissionList); + } + + return null; + } +} diff --git a/users/src/main/java/com/huoran/users/service/impl/StudentServiceImpl.java b/users/src/main/java/com/huoran/users/service/impl/StudentServiceImpl.java new file mode 100644 index 0000000..ff20cac --- /dev/null +++ b/users/src/main/java/com/huoran/users/service/impl/StudentServiceImpl.java @@ -0,0 +1,26 @@ +package com.huoran.users.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.users.entity.Student; +import com.huoran.users.mapper.StudentMapper; +import com.huoran.users.service.StudentService; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + +import javax.annotation.Resource; + +/** + * @描述:学生表 服务类 + * @作者: Rong + * @日期: 2021-08-25 + */ +@Service +public class StudentServiceImpl extends ServiceImpl implements StudentService { + + @Autowired + private StudentMapper mapper; + +} + + + diff --git a/users/src/main/java/com/huoran/users/service/impl/SupplierServiceImpl.java b/users/src/main/java/com/huoran/users/service/impl/SupplierServiceImpl.java new file mode 100644 index 0000000..658224d --- /dev/null +++ b/users/src/main/java/com/huoran/users/service/impl/SupplierServiceImpl.java @@ -0,0 +1,28 @@ +package com.huoran.users.service.impl; + +import com.huoran.users.entity.DataPermission; +import com.huoran.users.entity.Supplier; +import com.huoran.users.mapper.SupplierMapper; +import com.huoran.users.service.SupplierService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 供应商表 服务实现类 + *

+ * + * @author chen + * @since 2022-10-13 + */ +@Service +public class SupplierServiceImpl extends ServiceImpl implements SupplierService { + + @Override + public List querySupplierList(String roles,Integer permissionId) { + return baseMapper.selectSupplierList(roles,permissionId); + } + +} diff --git a/users/src/main/java/com/huoran/users/service/impl/SysPlatformServiceImpl.java b/users/src/main/java/com/huoran/users/service/impl/SysPlatformServiceImpl.java new file mode 100644 index 0000000..e6d35f8 --- /dev/null +++ b/users/src/main/java/com/huoran/users/service/impl/SysPlatformServiceImpl.java @@ -0,0 +1,21 @@ +package com.huoran.users.service.impl; + + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huoran.users.entity.SysPlatform; +import com.huoran.users.mapper.SysPlatformMapper; +import com.huoran.users.service.ISysPlatformService; +import org.springframework.stereotype.Service; + +/** + *

+ * 平台表 服务实现类 + *

+ * + * @author huoran + * @since 2021-06-28 + */ +@Service +public class SysPlatformServiceImpl extends ServiceImpl implements ISysPlatformService { + +} diff --git a/users/src/main/java/com/huoran/users/service/impl/UserRoleServiceImpl.java b/users/src/main/java/com/huoran/users/service/impl/UserRoleServiceImpl.java new file mode 100644 index 0000000..609c3b7 --- /dev/null +++ b/users/src/main/java/com/huoran/users/service/impl/UserRoleServiceImpl.java @@ -0,0 +1,69 @@ +package com.huoran.users.service.impl; + +import com.huoran.common.response.R; +import com.huoran.users.entity.UserRole; +import com.huoran.users.entity.res.UserRoleResp; +import com.huoran.users.mapper.UserRoleMapper; +import com.huoran.users.service.UserRoleService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 用户角色表 服务实现类 + *

+ * + * @author chen + * @since 2021-09-29 + */ +@Service +public class UserRoleServiceImpl extends ServiceImpl implements UserRoleService { + @Override + public List queryAccountRoles(String accountId,Integer teamId) { + return baseMapper.selectAccountRoles(accountId,teamId); + } + + @Override + public boolean checkIsSuperTube(String accountId) { + List list = baseMapper.checkIsSuperTube(accountId); + if (list.size() > 0) { + for (String userRole : list) { + if (userRole.trim().equals("超级管理员")) { + return true; + } + } + } + return false; + } + + @Override + public List getUserRoleByAccountId(Integer accountId) { + return baseMapper.getUserRoleByAccountId(accountId); + } + + @Override + public String getUserAllRole(Integer accountId, Integer platformId) { + return baseMapper.getUserAllRole(accountId, platformId); + } + + @Override + public List getAccountIdsBySchoolId(Integer schoolId, Integer platformId) { + return baseMapper.getAccountIdsBySchoolId(schoolId, platformId); + } + + @Override + public boolean queryTeacherAccount(String id) { + List list = baseMapper.checkIsSuperTube(id); + if (list.size() > 0) { + /*for (String userRole : list) { + if (userRole.trim().equals("老师") || userRole.trim().equals("管理员")) { + return true; + } + }*/ + return true; + } + return false; + } +} diff --git a/users/src/main/java/com/huoran/users/utils/EmailUtil.java b/users/src/main/java/com/huoran/users/utils/EmailUtil.java new file mode 100644 index 0000000..a53554e --- /dev/null +++ b/users/src/main/java/com/huoran/users/utils/EmailUtil.java @@ -0,0 +1,122 @@ +package com.huoran.users.utils; + +import com.huoran.common.exception.CustomException; +import com.huoran.common.exception.ExceptionEnum; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.mail.javamail.JavaMailSender; +import org.springframework.mail.javamail.MimeMessageHelper; +import org.springframework.stereotype.Component; + +import javax.mail.internet.InternetAddress; +import javax.mail.internet.MimeMessage; +import java.io.File; + +/** + * @Author chen + * @DATE 2022/6/10 14:23 + * @Version 1.0 + * @Description 邮件发送工具 + */ +@Component +public class EmailUtil { + + @Value("${spring.mail.from}") // 从application.yml配置文件中获取 + private String from; // 发送发邮箱地址 + + @Value("${email.url}") // 从application.yml配置文件中获取 + private String url; // 发送附件地址 + + @Autowired + private JavaMailSender mailSender; + + /** + * 发送纯文本邮件信息 + * + * @param to 接收方 + * @param subject 邮件主题 + * @param content 邮件内容(发送内容) + */ + public void sendMessage(String to, String subject, String content) { + + MimeMessage mimeMessage = mailSender.createMimeMessage(); + // 创建一个邮件对象 + // SimpleMailMessage msg = new SimpleMailMessage(); + try { + MimeMessageHelper msg = new MimeMessageHelper(mimeMessage, true); + msg.setFrom(new InternetAddress(from, "或然科技", "UTF-8")); // 设置发送发 + msg.setTo(to); // 设置接收方 + msg.setSubject(subject); // 设置邮件主题 + msg.setText(content); // 设置邮件内容 + // 发送邮件 + mailSender.send(mimeMessage); + } catch (Exception e) { + e.printStackTrace(); + throw new CustomException(ExceptionEnum.ENTER_CORRECT_EMAIL); + } + } + + /** + * 发送带附件的邮件信息 + * + * @param to 接收方 + * @param subject 邮件主题 + * @param content 邮件内容(发送内容) + * @param files 文件数组 // 可发送多个附件 + */ + public void sendMessageCarryFiles(String to, String subject, String content, File[] files) { + MimeMessage mimeMessage = mailSender.createMimeMessage(); + try { + MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true); + helper.setFrom(from); // 设置发送发 + helper.setTo(to); // 设置接收方 + helper.setSubject(subject); // 设置邮件主题 + helper.setText(content); // 设置邮件内容 + if (files != null && files.length > 0) { // 添加附件(多个) + for (File file : files) { + helper.addAttachment(file.getName(), file); + } + } + // 发送邮件 + mailSender.send(mimeMessage); + } catch (Exception e) { + e.printStackTrace(); + throw new CustomException(ExceptionEnum.ENTER_CORRECT_EMAIL); + } + } + + /** + * 发送带附件的邮件信息 + * + * @param to 接收方 + * @param subject 邮件主题 + * @param content 邮件内容(发送内容) + * // * @param file 单个文件 + */ + public void sendMessageCarryFile(String to, String subject, String content, String fileName) { + MimeMessage mimeMessage = mailSender.createMimeMessage(); + try { + File file = new File(url + fileName); + MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true); + helper.setFrom(new InternetAddress(from, "或然科技", "UTF-8")); // 设置发送方 + helper.setTo(to); // 设置接收方 + helper.setSubject(subject); // 设置邮件主题 + helper.setText(content); // 设置邮件内容 + helper.addAttachment(file.getName(), file); // 单个附件 + // 发送邮件 + mailSender.send(mimeMessage); + } catch (Exception e) { + e.printStackTrace(); + throw new CustomException(ExceptionEnum.ENTER_CORRECT_EMAIL); + } + } + + public String getFrom() { + return from; + } + + public void setFrom(String from) { + this.from = from; + } +} + diff --git a/users/src/main/java/com/huoran/users/utils/ExcelImportHelper.java b/users/src/main/java/com/huoran/users/utils/ExcelImportHelper.java new file mode 100644 index 0000000..c005c44 --- /dev/null +++ b/users/src/main/java/com/huoran/users/utils/ExcelImportHelper.java @@ -0,0 +1,183 @@ +package com.huoran.users.utils; + +import com.huoran.users.entity.req.ExcelImpUserInfoReq; +import com.huoran.users.utils.poi.CommonCode; +import com.huoran.users.utils.poi.ExceptionCast; +import org.apache.commons.lang.StringUtils; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.*; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.springframework.web.multipart.MultipartFile; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +public class ExcelImportHelper { + //判断row是否为空 + public static boolean isRowEmpty(Row row) { + if (null == row) { + return true; + } + int firstCellNum = row.getFirstCellNum(); //第一个列位置 + int lastCellNum = row.getLastCellNum(); //最后一列位置 + int nullCellNum = 0; //空列数量 + for (int c = firstCellNum; c < lastCellNum; c++) { + Cell cell = row.getCell(c); + if (null == cell || CellType.BLANK == cell.getCellType()) { + nullCellNum++; + continue; + } + cell.setCellType(CellType.STRING); + String cellValue = cell.getStringCellValue().trim(); + if (StringUtils.isEmpty(cellValue)) { + nullCellNum++; + } + } + //所有列都为空 + if (nullCellNum == (lastCellNum - firstCellNum)) { + return true; + } + return false; + } + + /** + * 读取用户管理 + * + * @param file + * @return + */ + public static List readUser(MultipartFile file) { + List list = new ArrayList(); + + Workbook workbook = getWorkbook(file); + ExcelImpUserInfoReq impUserInfoReq = null; + // 循环工作表Sheet + for (int numSheet = 0; numSheet < workbook.getNumberOfSheets(); numSheet++) { + Sheet hssfSheet = workbook.getSheetAt(numSheet); + if (hssfSheet == null) { + continue; + } + + int count = 1; + // 循环行Row//开始行2 + for (int rowNum = 2; rowNum <= hssfSheet.getLastRowNum(); rowNum++) { + Row row = hssfSheet.getRow(rowNum); + + if (isRowEmpty(row)) { + count++; + if (count == hssfSheet.getLastRowNum()) { + ExceptionCast.cast(CommonCode.EXCEL_FILE_NULL); + } + continue; + } + + // Cell account; + Cell name; + Cell roleId; + Cell email; + Cell workNumber; + Cell phone; + if (row != null) { + + impUserInfoReq = new ExcelImpUserInfoReq(); + + // if (row.getCell(0) != null) { + // row.getCell(0).setCellType(CellType.STRING); + // account = row.getCell(0); + // } else { + // account = row.createCell(0); + // } + + if (row.getCell(0) != null) { + row.getCell(0).setCellType(CellType.STRING); + name = row.getCell(0); + } else { + name = row.createCell(0); + } + + if (row.getCell(1) != null) { + row.getCell(1).setCellType(CellType.STRING); + roleId = row.getCell(1); + } else { + roleId = row.createCell(1); + } + + if (row.getCell(2) != null) { + row.getCell(2).setCellType(CellType.STRING); + email = row.getCell(2); + } else { + email = row.createCell(2); + } + + if (row.getCell(3) != null) { + row.getCell(3).setCellType(CellType.STRING); + workNumber = row.getCell(3); + } else { + workNumber = row.createCell(3); + } + + if (row.getCell(4) != null) { + row.getCell(4).setCellType(CellType.STRING); + phone = row.getCell(4); + } else { + phone = row.createCell(4); + } + + + /*row.getCell(0).setCellType(CellType.STRING); + account = row.getCell(0); + + row.getCell(1).setCellType(CellType.STRING); + name = row.getCell(1); + row.getCell(2).setCellType(CellType.STRING); + roleId = row.getCell(2); + + row.getCell(3).setCellType(CellType.STRING); + email = row.getCell(3); + + row.getCell(4).setCellType(CellType.STRING); + workNumber = row.getCell(4);*/ + + // 账号 + // impUserInfoReq.setAccount(account.getStringCellValue()); + // 用户姓名 + impUserInfoReq.setUserName(name.getStringCellValue()); + // 账户角色 + impUserInfoReq.setRoleId(roleId.getStringCellValue()); + //邮箱 + impUserInfoReq.setEmail(email.getStringCellValue()); + //学号工号 + impUserInfoReq.setWorkNumber(workNumber.getStringCellValue()); + + impUserInfoReq.setPhone(phone.getStringCellValue()); + + list.add(impUserInfoReq); + } + } + + } + + return list; + } + + private static Workbook getWorkbook(MultipartFile file) { + String fileName = file.getOriginalFilename(); + Workbook workbook = null; + + if (fileName.endsWith("xlsx")) { + try { + workbook = new XSSFWorkbook(file.getInputStream()); + } catch (IOException e) { + e.printStackTrace(); + } + } else if (fileName.endsWith("xls")) { + try { + workbook = new HSSFWorkbook(file.getInputStream()); + } catch (IOException e) { + e.printStackTrace(); + } + } + return workbook; + } +} diff --git a/users/src/main/java/com/huoran/users/utils/HttpClientUtils.java b/users/src/main/java/com/huoran/users/utils/HttpClientUtils.java new file mode 100644 index 0000000..74892a9 --- /dev/null +++ b/users/src/main/java/com/huoran/users/utils/HttpClientUtils.java @@ -0,0 +1,75 @@ +package com.huoran.users.utils; + +import org.apache.http.NameValuePair; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.entity.UrlEncodedFormEntity; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.util.EntityUtils; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * @Author chen + * @DATE 2022/5/31 11:09 + * @Version 1.0 + */ +public class HttpClientUtils { + + final static int TIMEOUT = 1000; + + final static int TIMEOUT_MSEC = 5 * 1000; + + public static String doPost(String url, Map paramMap) throws IOException { + // 创建Httpclient对象 + CloseableHttpClient httpClient = HttpClients.createDefault(); + CloseableHttpResponse response = null; + String resultString = ""; + + try { + // 创建Http Post请求 + HttpPost httpPost = new HttpPost(url); + + // 创建参数列表 + if (paramMap != null) { + List paramList = new ArrayList<>(); + for (String key : paramMap.keySet()) { + paramList.add(new BasicNameValuePair(key, paramMap.get(key))); + } + // 模拟表单 + UrlEncodedFormEntity entity = new UrlEncodedFormEntity(paramList); + httpPost.setEntity(entity); + } + + httpPost.setConfig(builderRequestConfig()); + + // 执行http请求 + response = httpClient.execute(httpPost); + + resultString = EntityUtils.toString(response.getEntity(), "UTF-8"); + } catch (Exception e) { + throw e; + } finally { + try { + response.close(); + } catch (IOException e) { + throw e; + } + } + + return resultString; + } + + private static RequestConfig builderRequestConfig() { + return RequestConfig.custom() + .setConnectTimeout(TIMEOUT_MSEC) + .setConnectionRequestTimeout(TIMEOUT_MSEC) + .setSocketTimeout(TIMEOUT_MSEC).build(); + } +} diff --git a/users/src/main/java/com/huoran/users/utils/HttpUtils.java b/users/src/main/java/com/huoran/users/utils/HttpUtils.java new file mode 100644 index 0000000..a16a4f6 --- /dev/null +++ b/users/src/main/java/com/huoran/users/utils/HttpUtils.java @@ -0,0 +1,107 @@ +package com.huoran.users.utils; + +import com.google.gson.Gson; +import org.apache.http.HttpEntity; +import org.apache.http.HttpResponse; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.util.EntityUtils; + +import java.util.HashMap; +import java.util.Map; + +/** + * 封装http get post + */ +public class HttpUtils { + + private static final Gson gson = new Gson(); + + /** + * get方法 + * @param url + * @return + */ + public static Map doGet(String url){ + + Map map = new HashMap<>(); + CloseableHttpClient httpClient = HttpClients.createDefault(); + + RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(5000) //连接超时 + .setConnectionRequestTimeout(5000)//请求超时 + .setSocketTimeout(5000) + .setRedirectsEnabled(true) //允许自动重定向 + .build(); + + HttpGet httpGet = new HttpGet(url); + httpGet.setConfig(requestConfig); + + try{ + HttpResponse httpResponse = httpClient.execute(httpGet); + if(httpResponse.getStatusLine().getStatusCode() == 200){ + + String jsonResult = EntityUtils.toString( httpResponse.getEntity()); + map = gson.fromJson(jsonResult,map.getClass()); + } + + }catch (Exception e){ + e.printStackTrace(); + }finally { + try { + httpClient.close(); + }catch (Exception e){ + e.printStackTrace(); + } + } + return map; + } + + /** + * 封装post + * @return + */ + public static String doPost(String url, String data,int timeout){ + CloseableHttpClient httpClient = HttpClients.createDefault(); + //超时设置 + + RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(timeout) //连接超时 + .setConnectionRequestTimeout(timeout)//请求超时 + .setSocketTimeout(timeout) + .setRedirectsEnabled(true) //允许自动重定向 + .build(); + + HttpPost httpPost = new HttpPost(url); + httpPost.setConfig(requestConfig); + httpPost.addHeader("Content-Type","text/html; chartset=UTF-8"); + + if(data != null && data instanceof String){ //使用字符串传参 + StringEntity stringEntity = new StringEntity(data,"UTF-8"); + httpPost.setEntity(stringEntity); + } + + try{ + CloseableHttpResponse httpResponse = httpClient.execute(httpPost); + HttpEntity httpEntity = httpResponse.getEntity(); + if(httpResponse.getStatusLine().getStatusCode() == 200){ + String result = EntityUtils.toString(httpEntity); + return result; + } + + }catch (Exception e){ + e.printStackTrace(); + }finally { + try{ + httpClient.close(); + }catch (Exception e){ + e.printStackTrace(); + } + } + return null; + } + +} \ No newline at end of file diff --git a/users/src/main/java/com/huoran/users/utils/WeChatUtil.java b/users/src/main/java/com/huoran/users/utils/WeChatUtil.java new file mode 100644 index 0000000..97a2c93 --- /dev/null +++ b/users/src/main/java/com/huoran/users/utils/WeChatUtil.java @@ -0,0 +1,149 @@ +package com.huoran.users.utils; + +import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; +import com.huoran.users.config.WeChatPropertiesUtil; +import com.huoran.users.entity.vo.WxMssVo; +import org.apache.http.HttpEntity; +import org.apache.http.HttpResponse; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.util.EntityUtils; + +import javax.net.ssl.HttpsURLConnection; +import java.io.*; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.Map; +import java.util.Set; + +public class WeChatUtil { + public static String httpRequest(String requestUrl,String requestMethod,String output){ + try{ + URL url = new URL(requestUrl); + HttpsURLConnection connection = (HttpsURLConnection) url.openConnection(); + connection.setDoOutput(true); + connection.setDoInput(true); + connection.setUseCaches(false); + if(null != output){ + OutputStream outputStream = connection.getOutputStream(); + outputStream.write(output.getBytes("utf-8")); + outputStream.close(); + } + // 从输入流读取返回内容 + InputStream inputStream = connection.getInputStream(); + InputStreamReader inputStreamReader = new InputStreamReader(inputStream, "utf-8"); + BufferedReader bufferedReader = new BufferedReader(inputStreamReader); + String str = null; + StringBuffer buffer = new StringBuffer(); + while ((str = bufferedReader.readLine()) != null){ + buffer.append(str); + } + bufferedReader.close(); + inputStreamReader.close(); + inputStream.close(); + inputStream = null; + connection.disconnect(); + return buffer.toString(); + }catch(Exception e){ + e.printStackTrace(); + } + return ""; + } + + /** + * 根据AppID和AppSecret获取最新可用的AccessToken + * @return + */ + public static String getAccessToken() throws IOException { +// https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET +// String appid = PropUtils.getProp("APPID"); +// String appsecret = PropUtils.getProp("APPSECRET"); + // 微信小程序ID + String appid = WeChatPropertiesUtil.PARTNER_WX_OPEN_APP_ID; + // 微信小程序秘钥 + String appsecret =WeChatPropertiesUtil.PARTNER_WX_OPEN_APP_SECRET; + + //构建url,用于向微信服务器请求用户的openId + StringBuffer url = new StringBuffer("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&"); + url.append("appid=").append(appid) + .append("&secret=").append(appsecret); + + //向微信的服务器发送Get请求 + HttpClient client = HttpClientBuilder.create().build(); + HttpGet httpGet = new HttpGet(url.toString()); + HttpResponse httpResponse = client.execute(httpGet); + HttpEntity result = httpResponse.getEntity(); + String resultStr = EntityUtils.toString(result); + System.out.println(resultStr); + JSONObject resultJsonObject = JSONUtil.parseObj(resultStr); + String accessToken = (String) resultJsonObject.get("access_token"); + return accessToken; + } + + //发送模板消息 + public static String sendTemplateMessage(WxMssVo wxMssVo) { + String info = ""; + try { + //创建连接 + URL url = new URL(wxMssVo.getRequest_url()); + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + connection.setDoOutput(true); + connection.setDoInput(true); + connection.setRequestMethod("POST"); + connection.setUseCaches(false); + connection.setInstanceFollowRedirects(true); + connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); + connection.setRequestProperty("Content-Type", "utf-8"); + connection.connect(); + + //POST请求 + DataOutputStream out = new DataOutputStream(connection.getOutputStream()); + JSONObject obj = new JSONObject(); + + //设置参数 + //不可缺失 缺失会出现invalid openid rid + //putOpt 等效于当两个参数都为非空时;除此之外什么都不做。put(name, value) + obj.putOpt("touser", wxMssVo.getTouser()); + //不可缺失 缺失出现invalid template_id + obj.putOpt("template_id", wxMssVo.getTemplate_id()); + obj.putOpt("page", wxMssVo.getPage()); + + JSONObject jsonObject = new JSONObject(); + + //发送自定义数据 + Set> entries = wxMssVo.getMap().entrySet(); + + for (Map.Entryentry:entries){ + + JSONObject dataInfo = new JSONObject(); + dataInfo.putOpt("value", entry.getValue()); + jsonObject.putOpt(entry.getKey(), dataInfo); + } + obj.putOpt("data", jsonObject); + + System.out.println(obj.toString()); + out.write(obj.toString().getBytes()); + out.flush(); + out.close(); + + //读取响应 + BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); + String lines; + StringBuffer sb = new StringBuffer(""); + while ((lines = reader.readLine()) != null) { + lines = new String(lines.getBytes(), "utf-8"); + sb.append(lines); + } + info = sb.toString(); + System.out.println(sb); + reader.close(); + // 断开连接 + connection.disconnect(); + } catch (Exception e) { + e.printStackTrace(); + } + return info; + } +} diff --git a/users/src/main/java/com/huoran/users/utils/poi/CommonCode.java b/users/src/main/java/com/huoran/users/utils/poi/CommonCode.java new file mode 100644 index 0000000..c056611 --- /dev/null +++ b/users/src/main/java/com/huoran/users/utils/poi/CommonCode.java @@ -0,0 +1,40 @@ +package com.huoran.users.utils.poi; + +import lombok.ToString; + +@ToString +public enum CommonCode implements ResultCode { + EXCEL_FILE_INVALID(false, 10009, "上传excel文件错误!"), + EXCEL_FILE_NULL(false, 100011, "导入失败,导入数据为空!"), + EXCEL_FILE_FORMAT_ERROR(false, 100012, "请根据模板使用说明录入正确的用户信息!"); + + //操作是否成功 + boolean success; + //操作代码 + int code; + //提示信息 + String message; + + CommonCode(boolean success, int code, String message) { + this.success = success; + this.code = code; + this.message = message; + } + + @Override + public boolean success() { + return success; + } + + @Override + public int code() { + return code; + } + + @Override + public String message() { + return message; + } + + +} diff --git a/users/src/main/java/com/huoran/users/utils/poi/Constant.java b/users/src/main/java/com/huoran/users/utils/poi/Constant.java new file mode 100644 index 0000000..204d5ef --- /dev/null +++ b/users/src/main/java/com/huoran/users/utils/poi/Constant.java @@ -0,0 +1,494 @@ +/** + * Copyright (c) 2016-2019 人人开源 All rights reserved. + *

+ * https://www.renren.io + *

+ * 版权所有,侵权必究! + */ + +package com.huoran.users.utils.poi; + +/** + * 常量 + * + * @author Mark sunlightcs@gmail.com + */ +public class Constant { + /** + * 超级管理员ID + */ + public static final int SUPER_ADMIN = 1; + /** + * 管理员 + */ + public static final int ADMIN = 2; + /** + * 教师 + */ + public static final int TEACHER = 3; + /** + * 学生 + */ + public static final int STUDENT = 4; + /** + * 当前页码 + */ + public static final String PAGE = "page"; + /** + * 每页显示记录数 + */ + public static final String LIMIT = "limit"; + /** + * 排序字段 + */ + public static final String ORDER_FIELD = "sidx"; + /** + * 排序方式 + */ + public static final String ORDER = "order"; + /** + * 升序 + */ + public static final String ASC = "asc"; + /** + * 通过excel批量导入试题数据时起始行 + */ + public static final int ROW_INDEX = 2; + /** + * 通过excel批量导入试题数据时起始行 + */ + public static final int CELL_INDEX = 0; + /** + * 需要提取的样式所在的行号 + */ + public static final int STYLE_INDEX = 2; + /** + * 通过excel批量导入试题数据时起始行(专门用于练习,考核报告的) + */ + public static final int ROW_INDEX_REPORT = 3; + /** + * 试题选项A + */ + public static final String A = "A"; + /** + * 试题选项B + */ + public static final String B = "B"; + /** + * 试题选项C + */ + public static final String C = "C"; + /** + * 试题选项D + */ + public static final String D = "D"; + /** + * 试题选项E + */ + public static final String E = "E"; + /** + * 试题选项F + */ + public static final String F = "F"; + /** + * excel模板信息表id + */ + public static final int XLSX_TEMPLATE_ID = 1; + /** + * 测评规则表id + */ + public static final int EVALUATION_RULES_ID = 1; + /** + * excel后缀 + */ + public static final String EXCEL_SUFFIX = ".xlsx"; + /** + * 测评总分 + */ + public static final int EVALUATION_SCORE = 100; + /** + * 及格分数 + */ + public static final int PASSING_SCORE = 80; + /** + * 测评是否通过 1、通过/0、未通过 + */ + public static final String EVALUATIONN_PASSED = "通过"; + public static final String EVALUATIONN_NOT_PASSED = "未通过"; + + /** + * 菜单类型 + * + * @author chenshun + * @email sunlightcs@gmail.com + * @date 2016年11月15日 下午1:24:29 + */ + public enum MenuType { + /** + * 目录 + */ + CATALOG(0), + /** + * 菜单 + */ + MENU(1), + /** + * 按钮 + */ + BUTTON(2); + + private int value; + + MenuType(int value) { + this.value = value; + } + + public int getValue() { + return value; + } + } + + /** + * 定时任务状态 + * + * @author chenshun + * @email sunlightcs@gmail.com + * @date 2016年12月3日 上午12:07:22 + */ + public enum ScheduleStatus { + /** + * 正常 + */ + NORMAL(0), + /** + * 暂停 + */ + PAUSE(1); + + private int value; + + ScheduleStatus(int value) { + this.value = value; + } + + public int getValue() { + return value; + } + } + + /** + * 云服务商 + */ + public enum CloudService { + /** + * 七牛云 + */ + QINIU(1), + /** + * 阿里云 + */ + ALIYUN(2), + /** + * 腾讯云 + */ + QCLOUD(3); + + private int value; + + CloudService(int value) { + this.value = value; + } + + public int getValue() { + return value; + } + } + + /** + * 是否启用 + */ + public enum IsEnable { + /** + * 启用 + */ + ENABLE(1, "启用"), + /** + * 不启用 + */ + NOT_ENABLE(0, "不启用"); + + private Integer type; //类型 + private String desc; //描述 + + IsEnable(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 void setDesc(String desc) { + this.desc = desc; + } + } + + + /** + * 是否删除:0使用,1删除,默认0使用 + */ + public enum IsDel { + /** + * 删除 + */ + DEL(1, "已删除"), + /** + * 不删除 + */ + NOT_DEL(0, "不删除"); + + private Integer type; //类型 + private String desc; //描述 + + IsDel(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 void setDesc(String desc) { + this.desc = desc; + } + } + + /** + * 评测规则类型 + */ + public enum RulesType { + /** + * 随机 + */ + RANDOM(1, "随机"), + /** + * 自定义 + */ + CUSTOMIZE(0, "自定义"); + + private Integer type; //类型 + private String desc; //描述 + + RulesType(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 void setDesc(String desc) { + this.desc = desc; + } + } + + /** + * 试题类型 + */ + public enum QuestionType { + /** + * 单选题 + */ + SINGLE_CHOICE(1, "单选题"), + /** + * 多选题 + */ + MULTIPLE_CHOICE(2, "多选题"), + /** + * 判断题 + */ + TRUE_OR_FALSE(3, "判断题"); + + private Integer type; //类型 + private String desc; //描述 + + QuestionType(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 void setDesc(String desc) { + this.desc = desc; + } + + } + + /** + * 项目是否提交1:已提交/0:未提交 + */ + public enum Submit { + + SUBMIT(1, "已提交"), + NOT_SUBMIT(0, "未提交"); + + + private Integer type; + private String desc; + + Submit(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 void setDesc(String desc) { + this.desc = desc; + } + } + + 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 void setDesc(String desc) { + this.desc = desc; + } + } + + /** + * 当前题目答案是否正确 1、正确/0、错误 + */ + public enum QuestionIsTure { + + TRUE(1, "正确"), + FALSE(0, "错误"); + + private Integer type; + private String desc; + + QuestionIsTure(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 void setDesc(String desc) { + this.desc = desc; + } + } + + /** + * 当前题目状态 1、已作/0、未作 + */ + public enum QuestionStatus { + + MADE(1, "已作"), + NOT_MADE(0, "未作"); + + private Integer type; + private String desc; + + QuestionStatus(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 void setDesc(String desc) { + this.desc = desc; + } + } +} \ No newline at end of file diff --git a/users/src/main/java/com/huoran/users/utils/poi/CustomException.java b/users/src/main/java/com/huoran/users/utils/poi/CustomException.java new file mode 100644 index 0000000..be9395d --- /dev/null +++ b/users/src/main/java/com/huoran/users/utils/poi/CustomException.java @@ -0,0 +1,19 @@ +package com.huoran.users.utils.poi; + +/** + * @author 世杰 + * @date 2020/3/24 22:47 + */ +public class CustomException extends RuntimeException { + private ResultCode resultCode; + + public CustomException(ResultCode resultCode) { + //异常信息为错误代码+异常信息 + super("错误代码:" + resultCode.code() + "错误信息:" + resultCode.message()); + this.resultCode = resultCode; + } + + public ResultCode getResultCode() { + return this.resultCode; + } +} diff --git a/users/src/main/java/com/huoran/users/utils/poi/ExcelAttribute.java b/users/src/main/java/com/huoran/users/utils/poi/ExcelAttribute.java new file mode 100644 index 0000000..ec1917d --- /dev/null +++ b/users/src/main/java/com/huoran/users/utils/poi/ExcelAttribute.java @@ -0,0 +1,25 @@ +package com.huoran.users.utils.poi; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) +public @interface ExcelAttribute { + /** + * 对应的列名称 + */ + String name() default ""; + + /** + * excel列的索引 + */ + int sort(); + + /** + * 字段类型对应的格式 + */ + String format() default ""; +} diff --git a/users/src/main/java/com/huoran/users/utils/poi/ExcelExportUtil.java b/users/src/main/java/com/huoran/users/utils/poi/ExcelExportUtil.java new file mode 100644 index 0000000..083c8cb --- /dev/null +++ b/users/src/main/java/com/huoran/users/utils/poi/ExcelExportUtil.java @@ -0,0 +1,165 @@ +package com.huoran.users.utils.poi; + +import lombok.Data; +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; + +import javax.servlet.http.HttpServletResponse; +import java.io.InputStream; +import java.lang.reflect.Field; +import java.net.URLEncoder; +import java.util.List; +import java.util.concurrent.atomic.AtomicInteger; + +/** + * 导出Excel工具类 + * 基于模板打印的方式导出: + */ +@Data +public class ExcelExportUtil { + + private int rowIndex; //写入数据的起始行 + private int styleIndex; //需要提取的样式所在的行号 + private Class clazz; //对象的字节码 + private Field fields[]; //对象中的所有属性 + + public ExcelExportUtil(Class clazz, int rowIndex, int styleIndex) { + this.clazz = clazz; + this.rowIndex = rowIndex; + this.styleIndex = styleIndex; + fields = clazz.getDeclaredFields(); + } + + /** + * 基于注解导出 + * 参数: + * response: + * InputStream:模板的输入流 + * objs:数据 + * fileName:生成的文件名 + */ + public void export(HttpServletResponse response, InputStream is, List objs, String fileName) throws Exception { + + //1.根据模板创建工作簿 + XSSFWorkbook workbook = new XSSFWorkbook(is); + //2.读取工作表 + Sheet sheet = workbook.getSheetAt(0); + Row row1 = sheet.getRow(styleIndex); + //3.提取公共的样式 + CellStyle[] styles = getTemplateStyles(row1); + //4.根据数据创建每一行和每一个单元格的数据2 + AtomicInteger datasAi = new AtomicInteger(rowIndex); //数字 + for (T t : objs) { + //datasAi.getAndIncrement() :获取数字,并++ i++ + Row row = sheet.createRow(datasAi.getAndIncrement()); + for (int i = 0; i < styles.length; i++) { + Cell cell = row.createCell(i); + cell.setCellStyle(styles[i]); + for (Field field : fields) { + if (field.isAnnotationPresent(ExcelAttribute.class)) { + field.setAccessible(true); + ExcelAttribute ea = field.getAnnotation(ExcelAttribute.class); + if (i == ea.sort()) { + if (field.get(t) != null) { + cell.setCellValue(field.get(t).toString()); + } + } + } + } + } + } + fileName = URLEncoder.encode(fileName, "UTF-8"); + response.setContentType("application/octet-stream"); + response.setHeader("content-disposition", "attachment;filename=" + new String(fileName.getBytes("ISO8859-1"))); + response.setHeader("filename", fileName); + workbook.write(response.getOutputStream()); + } + + CellStyle[] getTemplateStyles(Row row) { + CellStyle[] styles = new CellStyle[row.getLastCellNum()]; + for (int i = 0; i < row.getLastCellNum(); i++) { + if (row.getCell(i)==null){ + styles[i] = row.createCell(i).getCellStyle(); + }else{ + styles[i] = row.getCell(i).getCellStyle(); + } + } + return styles; + } + + /* *//** + * 基于注解导出(新增需求拓展) + * 参数: + * response: + * InputStream:模板的输入流 + * objs:数据 + * obj:拓展对象 + * fileName:生成的文件名 + *//* + public void exportExpand(HttpServletResponse response, InputStream is, List objs,Object obj, String fileName) throws Exception { + + //1.根据模板创建工作簿 + XSSFWorkbook workbook = new XSSFWorkbook(is); + //2.读取工作表 + Sheet sheet = workbook.getSheetAt(0); + Row row1 = sheet.getRow(styleIndex); + //3.提取公共的样式 + CellStyle[] styles = getTemplateStyles(row1); + + //导出学生姓名,学号 + Sheet sheet1 = this.exportStudentInfo(sheet,(StudentVo)obj); + + //4.根据数据创建每一行和每一个单元格的数据2 + AtomicInteger datasAi = new AtomicInteger(rowIndex); //数字 + for (T t : objs) { + //datasAi.getAndIncrement() :获取数字,并++ i++ + Row row = sheet1.createRow(datasAi.getAndIncrement()); + for (int i = 0; i < styles.length; i++) { + Cell cell = row.createCell(i); + cell.setCellStyle(styles[i]); + for (Field field : fields) { + if (field.isAnnotationPresent(ExcelAttribute.class)) { + field.setAccessible(true); + ExcelAttribute ea = field.getAnnotation(ExcelAttribute.class); + if (i == ea.sort()) { + if (field.get(t) != null) { + cell.setCellValue(field.get(t).toString()); + } + } + } + } + } + } + fileName = URLEncoder.encode(fileName, "UTF-8"); + response.setContentType("application/octet-stream"); + response.setHeader("content-disposition", "attachment;filename=" + new String(fileName.getBytes("ISO8859-1"))); + response.setHeader("filename", fileName); + workbook.write(response.getOutputStream()); + }*/ +// CellStyle[] getTemplateStyles(Row row) { +// CellStyle[] styles = new CellStyle[row.getLastCellNum()]; +// for (int i = 0; i < row.getLastCellNum(); i++) { +// styles[i] = row.getCell(i).getCellStyle(); +// } +// return styles; +// } + + + /* *//** + * 添加姓名,学号的导出 + * @param sheet + * @return + *//* + private Sheet exportStudentInfo(Sheet sheet,StudentVo studentVo){ + Integer ROW_INDEX = 1; + Integer CELL_INDEX_NAME = 1; + Integer CELL_INDEX_WORKNUMBER = 3; + + sheet.getRow(ROW_INDEX).getCell(CELL_INDEX_NAME).setCellValue(studentVo.getUserName()); + sheet.getRow(ROW_INDEX).getCell(CELL_INDEX_WORKNUMBER).setCellValue(studentVo.getWorkNumber()); + return sheet; + }*/ +} diff --git a/users/src/main/java/com/huoran/users/utils/poi/ExceptionCast.java b/users/src/main/java/com/huoran/users/utils/poi/ExceptionCast.java new file mode 100644 index 0000000..5fc0340 --- /dev/null +++ b/users/src/main/java/com/huoran/users/utils/poi/ExceptionCast.java @@ -0,0 +1,12 @@ +package com.huoran.users.utils.poi; + +/** + * @author 世杰 + * @date 2020/3/24 23:04 + */ +public class ExceptionCast { + //使用此静态方法抛出自定义异常 + public static void cast(ResultCode resultCode) { + throw new CustomException(resultCode); + } +} diff --git a/users/src/main/java/com/huoran/users/utils/poi/ResultCode.java b/users/src/main/java/com/huoran/users/utils/poi/ResultCode.java new file mode 100644 index 0000000..2dd76fe --- /dev/null +++ b/users/src/main/java/com/huoran/users/utils/poi/ResultCode.java @@ -0,0 +1,21 @@ +package com.huoran.users.utils.poi; + +/** + * Created by mrt on 2018/3/5. + * 10000-- 通用错误代码 + * 22000-- 媒资错误代码 + * 23000-- 用户中心错误代码 + * 24000-- cms错误代码 + * 25000-- 文件系统 + */ +public interface ResultCode { + //操作是否成功,true为成功,false操作失败 + boolean success(); + + //操作代码 + int code(); + + //提示信息 + String message(); + +} diff --git a/users/src/main/java/com/huoran/users/weixin/mp/aes/.WXBizMsgCrypt.java.swp b/users/src/main/java/com/huoran/users/weixin/mp/aes/.WXBizMsgCrypt.java.swp new file mode 100644 index 0000000..27e0c27 Binary files /dev/null and b/users/src/main/java/com/huoran/users/weixin/mp/aes/.WXBizMsgCrypt.java.swp differ diff --git a/users/src/main/java/com/huoran/users/weixin/mp/aes/AesException.java b/users/src/main/java/com/huoran/users/weixin/mp/aes/AesException.java new file mode 100644 index 0000000..c03b411 --- /dev/null +++ b/users/src/main/java/com/huoran/users/weixin/mp/aes/AesException.java @@ -0,0 +1,59 @@ +package com.huoran.users.weixin.mp.aes; + +@SuppressWarnings("serial") +public class AesException extends Exception { + + public final static int OK = 0; + public final static int ValidateSignatureError = -40001; + public final static int ParseXmlError = -40002; + public final static int ComputeSignatureError = -40003; + public final static int IllegalAesKey = -40004; + public final static int ValidateAppidError = -40005; + public final static int EncryptAESError = -40006; + public final static int DecryptAESError = -40007; + public final static int IllegalBuffer = -40008; + //public final static int EncodeBase64Error = -40009; + //public final static int DecodeBase64Error = -40010; + //public final static int GenReturnXmlError = -40011; + + private int code; + + private static String getMessage(int code) { + switch (code) { + case ValidateSignatureError: + return "签名验证错误"; + case ParseXmlError: + return "xml解析失败"; + case ComputeSignatureError: + return "sha加密生成签名失败"; + case IllegalAesKey: + return "SymmetricKey非法"; + case ValidateAppidError: + return "appid校验失败"; + case EncryptAESError: + return "aes加密失败"; + case DecryptAESError: + return "aes解密失败"; + case IllegalBuffer: + return "解密后得到的buffer非法"; +// case EncodeBase64Error: +// return "base64加密错误"; +// case DecodeBase64Error: +// return "base64解密错误"; +// case GenReturnXmlError: +// return "xml生成失败"; + default: + return null; // cannot be + } + } + + public int getCode() { + return code; + } + + AesException(int code) { + super(getMessage(code)); + this.code = code; + } + +} diff --git a/users/src/main/java/com/huoran/users/weixin/mp/aes/ByteGroup.java b/users/src/main/java/com/huoran/users/weixin/mp/aes/ByteGroup.java new file mode 100644 index 0000000..3e42c1b --- /dev/null +++ b/users/src/main/java/com/huoran/users/weixin/mp/aes/ByteGroup.java @@ -0,0 +1,26 @@ +package com.huoran.users.weixin.mp.aes; + +import java.util.ArrayList; + +class ByteGroup { + ArrayList byteContainer = new ArrayList(); + + public byte[] toBytes() { + byte[] bytes = new byte[byteContainer.size()]; + for (int i = 0; i < byteContainer.size(); i++) { + bytes[i] = byteContainer.get(i); + } + return bytes; + } + + public ByteGroup addBytes(byte[] bytes) { + for (byte b : bytes) { + byteContainer.add(b); + } + return this; + } + + public int size() { + return byteContainer.size(); + } +} diff --git a/users/src/main/java/com/huoran/users/weixin/mp/aes/PKCS7Encoder.java b/users/src/main/java/com/huoran/users/weixin/mp/aes/PKCS7Encoder.java new file mode 100644 index 0000000..bfbc291 --- /dev/null +++ b/users/src/main/java/com/huoran/users/weixin/mp/aes/PKCS7Encoder.java @@ -0,0 +1,67 @@ +/** + * 对公众平台发送给公众账号的消息加解密示例代码. + * + * @copyright Copyright (c) 1998-2014 Tencent Inc. + */ + +// ------------------------------------------------------------------------ + +package com.huoran.users.weixin.mp.aes; + +import java.nio.charset.Charset; +import java.util.Arrays; + +/** + * 提供基于PKCS7算法的加解密接口. + */ +class PKCS7Encoder { + static Charset CHARSET = Charset.forName("utf-8"); + static int BLOCK_SIZE = 32; + + /** + * 获得对明文进行补位填充的字节. + * + * @param count 需要进行填充补位操作的明文字节个数 + * @return 补齐用的字节数组 + */ + static byte[] encode(int count) { + // 计算需要填充的位数 + int amountToPad = BLOCK_SIZE - (count % BLOCK_SIZE); + if (amountToPad == 0) { + amountToPad = BLOCK_SIZE; + } + // 获得补位所用的字符 + char padChr = chr(amountToPad); + String tmp = new String(); + for (int index = 0; index < amountToPad; index++) { + tmp += padChr; + } + return tmp.getBytes(CHARSET); + } + + /** + * 删除解密后明文的补位字符 + * + * @param decrypted 解密后的明文 + * @return 删除补位字符后的明文 + */ + static byte[] decode(byte[] decrypted) { + int pad = (int) decrypted[decrypted.length - 1]; + if (pad < 1 || pad > 32) { + pad = 0; + } + return Arrays.copyOfRange(decrypted, 0, decrypted.length - pad); + } + + /** + * 将数字转化成ASCII码对应的字符,用于对明文进行补码 + * + * @param a 需要转化的数字 + * @return 转化得到的字符 + */ + static char chr(int a) { + byte target = (byte) (a & 0xFF); + return (char) target; + } + +} diff --git a/users/src/main/java/com/huoran/users/weixin/mp/aes/SHA1.java b/users/src/main/java/com/huoran/users/weixin/mp/aes/SHA1.java new file mode 100644 index 0000000..a129474 --- /dev/null +++ b/users/src/main/java/com/huoran/users/weixin/mp/aes/SHA1.java @@ -0,0 +1,61 @@ +/** + * 对公众平台发送给公众账号的消息加解密示例代码. + * + * @copyright Copyright (c) 1998-2014 Tencent Inc. + */ + +// ------------------------------------------------------------------------ + +package com.huoran.users.weixin.mp.aes; + +import java.security.MessageDigest; +import java.util.Arrays; + +/** + * SHA1 class + * + * 计算公众平台的消息签名接口. + */ +public class SHA1 { + + /** + * 用SHA1算法生成安全签名 + * @param token 票据 + * @param timestamp 时间戳 + * @param nonce 随机字符串 + * @param encrypt 密文 + * @return 安全签名 + * @throws AesException + */ + public static String getSHA1(String token, String timestamp, String nonce, String encrypt) throws AesException + { + try { + String[] array = new String[] { token, timestamp, nonce, encrypt }; + StringBuffer sb = new StringBuffer(); + // 字符串排序 + Arrays.sort(array); + for (int i = 0; i < 4; i++) { + sb.append(array[i]); + } + String str = sb.toString(); + // SHA1签名生成 + MessageDigest md = MessageDigest.getInstance("SHA-1"); + md.update(str.getBytes()); + byte[] digest = md.digest(); + + StringBuffer hexstr = new StringBuffer(); + String shaHex = ""; + for (int i = 0; i < digest.length; i++) { + shaHex = Integer.toHexString(digest[i] & 0xFF); + if (shaHex.length() < 2) { + hexstr.append(0); + } + hexstr.append(shaHex); + } + return hexstr.toString(); + } catch (Exception e) { + e.printStackTrace(); + throw new AesException(AesException.ComputeSignatureError); + } + } +} diff --git a/users/src/main/java/com/huoran/users/weixin/mp/aes/WXBizMsgCrypt.java b/users/src/main/java/com/huoran/users/weixin/mp/aes/WXBizMsgCrypt.java new file mode 100644 index 0000000..e32fde7 --- /dev/null +++ b/users/src/main/java/com/huoran/users/weixin/mp/aes/WXBizMsgCrypt.java @@ -0,0 +1,288 @@ +/** + * 对公众平台发送给公众账号的消息加解密示例代码. + * + * @copyright Copyright (c) 1998-2014 Tencent Inc. + */ + +// ------------------------------------------------------------------------ + +/** + * 针对org.apache.commons.codec.binary.Base64, + * 需要导入架包commons-codec-1.9(或commons-codec-1.8等其他版本) + * 官方下载地址:http://commons.apache.org/proper/commons-codec/download_codec.cgi + */ +package com.huoran.users.weixin.mp.aes; + +import org.apache.commons.codec.binary.Base64; + +import javax.crypto.Cipher; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; +import java.nio.charset.Charset; +import java.util.Arrays; +import java.util.Random; + +/** + * 提供接收和推送给公众平台消息的加解密接口(UTF8编码的字符串). + *

    + *
  1. 第三方回复加密消息给公众平台
  2. + *
  3. 第三方收到公众平台发送的消息,验证消息的安全性,并对消息进行解密。
  4. + *
+ * 说明:异常java.security.InvalidKeyException:illegal Key Size的解决方案 + *
    + *
  1. 在官方网站下载JCE无限制权限策略文件(JDK7的下载地址: + * http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html
  2. + *
  3. 下载后解压,可以看到local_policy.jar和US_export_policy.jar以及readme.txt
  4. + *
  5. 如果安装了JRE,将两个jar文件放到%JRE_HOME%\lib\security目录下覆盖原来的文件
  6. + *
  7. 如果安装了JDK,将两个jar文件放到%JDK_HOME%\jre\lib\security目录下覆盖原来文件
  8. + *
+ */ +public class WXBizMsgCrypt { + static Charset CHARSET = Charset.forName("utf-8"); + Base64 base64 = new Base64(); + byte[] aesKey; + String token; + String appId; + + /** + * 构造函数 + * @param token 公众平台上,开发者设置的token + * @param encodingAesKey 公众平台上,开发者设置的EncodingAESKey + * @param appId 公众平台appid + * + * @throws AesException 执行失败,请查看该异常的错误码和具体的错误信息 + */ + public WXBizMsgCrypt(String token, String encodingAesKey, String appId) throws AesException { + if (encodingAesKey.length() != 43) { + throw new AesException(AesException.IllegalAesKey); + } + + this.token = token; + this.appId = appId; + aesKey = Base64.decodeBase64(encodingAesKey + "="); + } + + // 生成4个字节的网络字节序 + byte[] getNetworkBytesOrder(int sourceNumber) { + byte[] orderBytes = new byte[4]; + orderBytes[3] = (byte) (sourceNumber & 0xFF); + orderBytes[2] = (byte) (sourceNumber >> 8 & 0xFF); + orderBytes[1] = (byte) (sourceNumber >> 16 & 0xFF); + orderBytes[0] = (byte) (sourceNumber >> 24 & 0xFF); + return orderBytes; + } + + // 还原4个字节的网络字节序 + int recoverNetworkBytesOrder(byte[] orderBytes) { + int sourceNumber = 0; + for (int i = 0; i < 4; i++) { + sourceNumber <<= 8; + sourceNumber |= orderBytes[i] & 0xff; + } + return sourceNumber; + } + + // 随机生成16位字符串 + String getRandomStr() { + String base = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + Random random = new Random(); + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < 16; i++) { + int number = random.nextInt(base.length()); + sb.append(base.charAt(number)); + } + return sb.toString(); + } + + /** + * 对明文进行加密. + * + * @param text 需要加密的明文 + * @return 加密后base64编码的字符串 + * @throws AesException aes加密失败 + */ + String encrypt(String randomStr, String text) throws AesException { + ByteGroup byteCollector = new ByteGroup(); + byte[] randomStrBytes = randomStr.getBytes(CHARSET); + byte[] textBytes = text.getBytes(CHARSET); + byte[] networkBytesOrder = getNetworkBytesOrder(textBytes.length); + byte[] appidBytes = appId.getBytes(CHARSET); + + // randomStr + networkBytesOrder + text + appid + byteCollector.addBytes(randomStrBytes); + byteCollector.addBytes(networkBytesOrder); + byteCollector.addBytes(textBytes); + byteCollector.addBytes(appidBytes); + + // ... + pad: 使用自定义的填充方式对明文进行补位填充 + byte[] padBytes = PKCS7Encoder.encode(byteCollector.size()); + byteCollector.addBytes(padBytes); + + // 获得最终的字节流, 未加密 + byte[] unencrypted = byteCollector.toBytes(); + + try { + // 设置加密模式为AES的CBC模式 + Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding"); + SecretKeySpec keySpec = new SecretKeySpec(aesKey, "AES"); + IvParameterSpec iv = new IvParameterSpec(aesKey, 0, 16); + cipher.init(Cipher.ENCRYPT_MODE, keySpec, iv); + + // 加密 + byte[] encrypted = cipher.doFinal(unencrypted); + + // 使用BASE64对加密后的字符串进行编码 + String base64Encrypted = base64.encodeToString(encrypted); + + return base64Encrypted; + } catch (Exception e) { + e.printStackTrace(); + throw new AesException(AesException.EncryptAESError); + } + } + + /** + * 对密文进行解密. + * + * @param text 需要解密的密文 + * @return 解密得到的明文 + * @throws AesException aes解密失败 + */ + String decrypt(String text) throws AesException { + byte[] original; + try { + // 设置解密模式为AES的CBC模式 + Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding"); + SecretKeySpec key_spec = new SecretKeySpec(aesKey, "AES"); + IvParameterSpec iv = new IvParameterSpec(Arrays.copyOfRange(aesKey, 0, 16)); + cipher.init(Cipher.DECRYPT_MODE, key_spec, iv); + + // 使用BASE64对密文进行解码 + byte[] encrypted = Base64.decodeBase64(text); + + // 解密 + original = cipher.doFinal(encrypted); + } catch (Exception e) { + e.printStackTrace(); + throw new AesException(AesException.DecryptAESError); + } + + String xmlContent, from_appid; + try { + // 去除补位字符 + byte[] bytes = PKCS7Encoder.decode(original); + + // 分离16位随机字符串,网络字节序和AppId + byte[] networkOrder = Arrays.copyOfRange(bytes, 16, 20); + + int xmlLength = recoverNetworkBytesOrder(networkOrder); + + xmlContent = new String(Arrays.copyOfRange(bytes, 20, 20 + xmlLength), CHARSET); + from_appid = new String(Arrays.copyOfRange(bytes, 20 + xmlLength, bytes.length), + CHARSET); + } catch (Exception e) { + e.printStackTrace(); + throw new AesException(AesException.IllegalBuffer); + } + + // appid不相同的情况 + if (!from_appid.equals(appId)) { + throw new AesException(AesException.ValidateAppidError); + } + return xmlContent; + + } + + /** + * 将公众平台回复用户的消息加密打包. + *
    + *
  1. 对要发送的消息进行AES-CBC加密
  2. + *
  3. 生成安全签名
  4. + *
  5. 将消息密文和安全签名打包成xml格式
  6. + *
+ * + * @param replyMsg 公众平台待回复用户的消息,xml格式的字符串 + * @param timeStamp 时间戳,可以自己生成,也可以用URL参数的timestamp + * @param nonce 随机串,可以自己生成,也可以用URL参数的nonce + * + * @return 加密后的可以直接回复用户的密文,包括msg_signature, timestamp, nonce, encrypt的xml格式的字符串 + * @throws AesException 执行失败,请查看该异常的错误码和具体的错误信息 + */ + public String encryptMsg(String replyMsg, String timeStamp, String nonce) throws AesException { + // 加密 + String encrypt = encrypt(getRandomStr(), replyMsg); + + // 生成安全签名 + if (timeStamp == "") { + timeStamp = Long.toString(System.currentTimeMillis()); + } + + String signature = SHA1.getSHA1(token, timeStamp, nonce, encrypt); + + // System.out.println("发送给平台的签名是: " + signature[1].toString()); + // 生成发送的xml + String result = XMLParse.generate(encrypt, signature, timeStamp, nonce); + return result; + } + + /** + * 检验消息的真实性,并且获取解密后的明文. + *
    + *
  1. 利用收到的密文生成安全签名,进行签名验证
  2. + *
  3. 若验证通过,则提取xml中的加密消息
  4. + *
  5. 对消息进行解密
  6. + *
+ * + * @param msgSignature 签名串,对应URL参数的msg_signature + * @param timeStamp 时间戳,对应URL参数的timestamp + * @param nonce 随机串,对应URL参数的nonce + * @param postData 密文,对应POST请求的数据 + * + * @return 解密后的原文 + * @throws AesException 执行失败,请查看该异常的错误码和具体的错误信息 + */ + public String decryptMsg(String msgSignature, String timeStamp, String nonce, String postData) + throws AesException { + + // 密钥,公众账号的app secret + // 提取密文 + Object[] encrypt = XMLParse.extract(postData); + + // 验证安全签名 + String signature = SHA1.getSHA1(token, timeStamp, nonce, encrypt[1].toString()); + + // 和URL中的签名比较是否相等 + // System.out.println("第三方收到URL中的签名:" + msg_sign); + // System.out.println("第三方校验签名:" + signature); + if (!signature.equals(msgSignature)) { + throw new AesException(AesException.ValidateSignatureError); + } + + // 解密 + String result = decrypt(encrypt[1].toString()); + return result; + } + + /** + * 验证URL + * @param msgSignature 签名串,对应URL参数的msg_signature + * @param timeStamp 时间戳,对应URL参数的timestamp + * @param nonce 随机串,对应URL参数的nonce + * @param echoStr 随机串,对应URL参数的echostr + * + * @return 解密之后的echostr + * @throws AesException 执行失败,请查看该异常的错误码和具体的错误信息 + */ + public String verifyUrl(String msgSignature, String timeStamp, String nonce, String echoStr) + throws AesException { + String signature = SHA1.getSHA1(token, timeStamp, nonce, echoStr); + + if (!signature.equals(msgSignature)) { + throw new AesException(AesException.ValidateSignatureError); + } + + String result = decrypt(echoStr); + return result; + } + +} \ No newline at end of file diff --git a/users/src/main/java/com/huoran/users/weixin/mp/aes/WXBizMsgCryptTest.java b/users/src/main/java/com/huoran/users/weixin/mp/aes/WXBizMsgCryptTest.java new file mode 100644 index 0000000..b75725f --- /dev/null +++ b/users/src/main/java/com/huoran/users/weixin/mp/aes/WXBizMsgCryptTest.java @@ -0,0 +1,154 @@ +/* +package com.huoran.users.weixin.mp.aes; + +import static org.junit.Assert.*; + +import java.io.IOException; +import java.io.StringReader; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + +public class WXBizMsgCryptTest { + String encodingAesKey = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFG"; + String token = "pamtest"; + String timestamp = "1409304348"; + String nonce = "xxxxxx"; + String appId = "wxb11529c136998cb6"; + String replyMsg = "我是中文abcd123"; + String xmlFormat = ""; + String afterAesEncrypt = "jn1L23DB+6ELqJ+6bruv21Y6MD7KeIfP82D6gU39rmkgczbWwt5+3bnyg5K55bgVtVzd832WzZGMhkP72vVOfg=="; + String randomStr = "aaaabbbbccccdddd"; + + String replyMsg2 = "1407743423"; + String afterAesEncrypt2 = "jn1L23DB+6ELqJ+6bruv23M2GmYfkv0xBh2h+XTBOKVKcgDFHle6gqcZ1cZrk3e1qjPQ1F4RsLWzQRG9udbKWesxlkupqcEcW7ZQweImX9+wLMa0GaUzpkycA8+IamDBxn5loLgZpnS7fVAbExOkK5DYHBmv5tptA9tklE/fTIILHR8HLXa5nQvFb3tYPKAlHF3rtTeayNf0QuM+UW/wM9enGIDIJHF7CLHiDNAYxr+r+OrJCmPQyTy8cVWlu9iSvOHPT/77bZqJucQHQ04sq7KZI27OcqpQNSto2OdHCoTccjggX5Z9Mma0nMJBU+jLKJ38YB1fBIz+vBzsYjrTmFQ44YfeEuZ+xRTQwr92vhA9OxchWVINGC50qE/6lmkwWTwGX9wtQpsJKhP+oS7rvTY8+VdzETdfakjkwQ5/Xka042OlUb1/slTwo4RscuQ+RdxSGvDahxAJ6+EAjLt9d8igHngxIbf6YyqqROxuxqIeIch3CssH/LqRs+iAcILvApYZckqmA7FNERspKA5f8GoJ9sv8xmGvZ9Yrf57cExWtnX8aCMMaBropU/1k+hKP5LVdzbWCG0hGwx/dQudYR/eXp3P0XxjlFiy+9DMlaFExWUZQDajPkdPrEeOwofJb"; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + } + + @Before + public void setUp() throws Exception { + + } + + @After + public void tearDown() throws Exception { + } + + @Test + public void testNormal() throws ParserConfigurationException, SAXException, IOException { + try { + WXBizMsgCrypt pc = new WXBizMsgCrypt(token, encodingAesKey, appId); + String afterEncrpt = pc.encryptMsg(replyMsg, timestamp, nonce); + + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + DocumentBuilder db = dbf.newDocumentBuilder(); + StringReader sr = new StringReader(afterEncrpt); + InputSource is = new InputSource(sr); + Document document = db.parse(is); + + Element root = document.getDocumentElement(); + NodeList nodelist1 = root.getElementsByTagName("Encrypt"); + NodeList nodelist2 = root.getElementsByTagName("MsgSignature"); + + String encrypt = nodelist1.item(0).getTextContent(); + String msgSignature = nodelist2.item(0).getTextContent(); + String fromXML = String.format(xmlFormat, encrypt); + + // 第三方收到公众号平台发送的消息 + String afterDecrpt = pc.decryptMsg(msgSignature, timestamp, nonce, fromXML); + assertEquals(replyMsg, afterDecrpt); + } catch (AesException e) { + fail("正常流程,怎么就抛出异常了??????"); + } + } + + @Test + public void testAesEncrypt() { + try { + WXBizMsgCrypt pc = new WXBizMsgCrypt(token, encodingAesKey, appId); + assertEquals(afterAesEncrypt, pc.encrypt(randomStr, replyMsg)); + } catch (AesException e) { + e.printStackTrace(); + fail("no异常"); + } + } + + @Test + public void testAesEncrypt2() { + try { + WXBizMsgCrypt pc = new WXBizMsgCrypt(token, encodingAesKey, appId); + assertEquals(afterAesEncrypt2, pc.encrypt(randomStr, replyMsg2)); + + } catch (AesException e) { + e.printStackTrace(); + fail("no异常"); + } + } + + @Test + public void testIllegalAesKey() { + try { + new WXBizMsgCrypt(token, "abcde", appId); + } catch (AesException e) { + assertEquals(AesException.IllegalAesKey, e.getCode()); + return; + } + fail("错误流程不抛出异常???"); + } + + @Test + public void testValidateSignatureError() throws ParserConfigurationException, SAXException, + IOException { + try { + WXBizMsgCrypt pc = new WXBizMsgCrypt(token, encodingAesKey, appId); + String afterEncrpt = pc.encryptMsg(replyMsg, timestamp, nonce); + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + DocumentBuilder db = dbf.newDocumentBuilder(); + StringReader sr = new StringReader(afterEncrpt); + InputSource is = new InputSource(sr); + Document document = db.parse(is); + + Element root = document.getDocumentElement(); + NodeList nodelist1 = root.getElementsByTagName("Encrypt"); + + String encrypt = nodelist1.item(0).getTextContent(); + String fromXML = String.format(xmlFormat, encrypt); + pc.decryptMsg("12345", timestamp, nonce, fromXML); // 这里签名错误 + } catch (AesException e) { + assertEquals(AesException.ValidateSignatureError, e.getCode()); + return; + } + fail("错误流程不抛出异常???"); + } + + @Test + public void testVerifyUrl() throws AesException { + WXBizMsgCrypt wxcpt = new WXBizMsgCrypt("QDG6eK", + "jWmYm7qr5nMoAUwZRjGtBxmz3KA1tkAj3ykkR6q2B2C", "wx5823bf96d3bd56c7"); + String verifyMsgSig = "5c45ff5e21c57e6ad56bac8758b79b1d9ac89fd3"; + String timeStamp = "1409659589"; + String nonce = "263014780"; + String echoStr = "P9nAzCzyDtyTWESHep1vC5X9xho/qYX3Zpb4yKa9SKld1DsH3Iyt3tP3zNdtp+4RPcs8TgAE7OaBO+FZXvnaqQ=="; + wxcpt.verifyUrl(verifyMsgSig, timeStamp, nonce, echoStr); + // 只要不抛出异常就好 + } +} +*/ diff --git a/users/src/main/java/com/huoran/users/weixin/mp/aes/XMLParse.java b/users/src/main/java/com/huoran/users/weixin/mp/aes/XMLParse.java new file mode 100644 index 0000000..87a8339 --- /dev/null +++ b/users/src/main/java/com/huoran/users/weixin/mp/aes/XMLParse.java @@ -0,0 +1,71 @@ +/** + * 对公众平台发送给公众账号的消息加解密示例代码. + * + * @copyright Copyright (c) 1998-2014 Tencent Inc. + */ + +// ------------------------------------------------------------------------ + +package com.huoran.users.weixin.mp.aes; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import java.io.StringReader; + +/** + * XMLParse class + * + * 提供提取消息格式中的密文及生成回复消息格式的接口. + */ +class XMLParse { + + /** + * 提取出xml数据包中的加密消息 + * @param xmltext 待提取的xml字符串 + * @return 提取出的加密消息字符串 + * @throws AesException + */ + public static Object[] extract(String xmltext) throws AesException { + Object[] result = new Object[3]; + try { + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + DocumentBuilder db = dbf.newDocumentBuilder(); + StringReader sr = new StringReader(xmltext); + InputSource is = new InputSource(sr); + Document document = db.parse(is); + + Element root = document.getDocumentElement(); + NodeList nodelist1 = root.getElementsByTagName("Encrypt"); + NodeList nodelist2 = root.getElementsByTagName("ToUserName"); + result[0] = 0; + result[1] = nodelist1.item(0).getTextContent(); + result[2] = nodelist2.item(0).getTextContent(); + return result; + } catch (Exception e) { + e.printStackTrace(); + throw new AesException(AesException.ParseXmlError); + } + } + + /** + * 生成xml消息 + * @param encrypt 加密后的消息密文 + * @param signature 安全签名 + * @param timestamp 时间戳 + * @param nonce 随机字符串 + * @return 生成的xml字符串 + */ + public static String generate(String encrypt, String signature, String timestamp, String nonce) { + + String format = "\n" + "\n" + + "\n" + + "%3$s\n" + "\n" + ""; + return String.format(format, encrypt, signature, timestamp, nonce); + + } +} diff --git a/users/src/main/resources/bootstrap.properties b/users/src/main/resources/bootstrap.properties new file mode 100644 index 0000000..a01feb2 --- /dev/null +++ b/users/src/main/resources/bootstrap.properties @@ -0,0 +1,30 @@ +spring.application.name=users + +#addr +spring.cloud.nacos.config.server-addr=127.0.0.1:8848 + +#namespace +spring.cloud.nacos.config.namespace=kindergarten-microservice-configuration-namespace + + +#合伙人微信小程序配置 +partner.wxopen.appid=wx2b506fdb0eeee65d +partner.wxopen.appsecret=d14ccc2f188e6e64a263086f91dfa71c +#wxopen.redirect_url=http://www.occupationlab.com/apiHrmsAuth/hrms/auth/userlogin/user/callback +partner.wxopen.redirect_url=http://192.168.31.116:9000/apiHrmsAuth/hrms/auth/userlogin/user/callback + +#运营微信小程序配置 +operation.wxopen.appid=wx88cd6037d54f230a +operation.wxopen.appsecret=82c18212b17bf8b2fa17c680feb5b012 +operation.wxopen.redirect_url=http://192.168.31.116:9000/apiHrmsAuth/hrms/auth/userlogin/user/callback + +#邮箱配置 +spring.mail.host=smtp.qq.com +spring.mail.port=587 +spring.mail.username=1251790704@qq.com +spring.mail.password=tgbteukyosdnhadh +spring.mail.default-encoding=UTF-8 +spring.mail.properties.mail.smtp.socketFactoryClass=javax.net.ssl.SSLSocketFactory +spring.mail.properties.mail.debug=true +spring.mail.from=1251790704@qq.com + diff --git a/users/src/main/resources/excleTemplate/用户导入失败数据导出模板.xlsx b/users/src/main/resources/excleTemplate/用户导入失败数据导出模板.xlsx new file mode 100644 index 0000000..e5d5850 Binary files /dev/null and b/users/src/main/resources/excleTemplate/用户导入失败数据导出模板.xlsx differ diff --git a/users/src/test/java/com/huoran/users/test/AddressUtils.java b/users/src/test/java/com/huoran/users/test/AddressUtils.java new file mode 100644 index 0000000..98f27f1 --- /dev/null +++ b/users/src/test/java/com/huoran/users/test/AddressUtils.java @@ -0,0 +1,202 @@ +package com.huoran.users.test; + +/** + * @Author chen + * @DATE 2021/11/25 14:48 + * @Version 1.0 + */ +import java.io.BufferedReader; +import java.io.DataOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.UnsupportedEncodingException; +import java.net.HttpURLConnection; +import java.net.URL; + +/** + * 根据IP地址获取详细的地域信息 + * 淘宝API : http://ip.taobao.com/service/getIpInfo.php?ip=218.192.3.42 + * 新浪API : http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=json&ip=218.192.3.42 + * @File AddressUtils.java + * @Package org.gditc.weicommunity.util + * @Description TODO + * @Copyright Copyright © 2014 + * @Site https://github.com/Cryhelyxx + * @Blog http://blog.csdn.net/Cryhelyxx + * @Email cryhelyxx@gmail.com + * @Company GDITC + * @Date 2014年11月6日 下午1:46:37 + * @author Cryhelyxx + * @version 1.0 + */ +public class AddressUtils { + /** + * + * @param content + * 请求的参数 格式为:name=xxx&pwd=xxx + // * @param encoding + * 服务器端请求编码。如GBK,UTF-8等 + * @return + * @throws UnsupportedEncodingException + */ + public static String getAddresses(String content, String encodingString) + throws UnsupportedEncodingException { + // 这里调用淘宝API + String urlStr = "http://whois.pconline.com.cn/"; + // 从http://whois.pconline.com.cn取得IP所在的省市区信息 + String returnStr = getResult(urlStr, content, encodingString); + if (returnStr != null) { + // 处理返回的省市区信息 + System.out.println("(1) unicode转换成中文前的returnStr : " + returnStr); + returnStr = decodeUnicode(returnStr); + System.out.println("(2) unicode转换成中文后的returnStr : " + returnStr); + String[] temp = returnStr.split(","); + if(temp.length<3){ + return "0";//无效IP,局域网测试 + } + return returnStr; + } + return null; + } + /** + * @param urlStr + * 请求的地址 + * @param content + * 请求的参数 格式为:name=xxx&pwd=xxx + * @param encoding + * 服务器端请求编码。如GBK,UTF-8等 + * @return + */ + private static String getResult(String urlStr, String content, String encoding) { + URL url = null; + HttpURLConnection connection = null; + try { + url = new URL(urlStr); + connection = (HttpURLConnection) url.openConnection();// 新建连接实例 + connection.setConnectTimeout(2000);// 设置连接超时时间,单位毫秒 + connection.setReadTimeout(2000);// 设置读取数据超时时间,单位毫秒 + connection.setDoOutput(true);// 是否打开输出流 true|false + connection.setDoInput(true);// 是否打开输入流true|false + connection.setRequestMethod("POST");// 提交方法POST|GET + connection.setUseCaches(false);// 是否缓存true|false + connection.connect();// 打开连接端口 + DataOutputStream out = new DataOutputStream(connection + .getOutputStream());// 打开输出流往对端服务器写数据 + out.writeBytes(content);// 写数据,也就是提交你的表单 name=xxx&pwd=xxx + out.flush();// 刷新 + out.close();// 关闭输出流 + BufferedReader reader = new BufferedReader(new InputStreamReader( + connection.getInputStream(), encoding));// 往对端写完数据对端服务器返回数据 + // ,以BufferedReader流来读取 + StringBuffer buffer = new StringBuffer(); + String line = ""; + while ((line = reader.readLine()) != null) { + buffer.append(line); + } + reader.close(); + return buffer.toString(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + if (connection != null) { + connection.disconnect();// 关闭连接 + } + } + return null; + } + /** + * unicode 转换成 中文 + * + * @author fanhui 2007-3-15 + * @param theString + * @return + */ + public static String decodeUnicode(String theString) { + char aChar; + int len = theString.length(); + StringBuffer outBuffer = new StringBuffer(len); + for (int x = 0; x < len;) { + aChar = theString.charAt(x++); + if (aChar == '\\') { + aChar = theString.charAt(x++); + if (aChar == 'u') { + int value = 0; + for (int i = 0; i < 4; i++) { + aChar = theString.charAt(x++); + switch (aChar) { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + value = (value << 4) + aChar - '0'; + break; + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + value = (value << 4) + 10 + aChar - 'a'; + break; + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + value = (value << 4) + 10 + aChar - 'A'; + break; + default: + throw new IllegalArgumentException( + "Malformed encoding."); + } + } + outBuffer.append((char) value); + } else { + if (aChar == 't') { + aChar = '\t'; + } else if (aChar == 'r') { + aChar = '\r'; + } else if (aChar == 'n') { + aChar = '\n'; + } else if (aChar == 'f') { + aChar = '\f'; + } + outBuffer.append(aChar); + } + } else { + outBuffer.append(aChar); + } + } + return outBuffer.toString(); + } + // 测试 + // public static void main(String[] args) { + // AddressUtils addressUtils = new AddressUtils(); + // // 测试ip 219.136.134.157 中国=华南=广东省=广州市=越秀区=电信 + // String ip = "122.49.20.247"; + // String address = ""; + // try { + // address = addressUtils.getAddresses("ip="+ip, "utf-8"); + // } catch (UnsupportedEncodingException e) { + // // TODO Auto-generated catch block + // e.printStackTrace(); + // } + // System.out.println(address); + // // 输出结果为:广东省,广州市,越秀区 + // } + + public static void main(String[] args) { + String id = "0,5,25,33,45,3,2"; + int i = id.lastIndexOf(","); + String substring = id.substring(i+1, id.length()); + System.out.println(substring); + + } +} diff --git a/users/src/test/java/com/huoran/users/test/CodeGenerator.java b/users/src/test/java/com/huoran/users/test/CodeGenerator.java new file mode 100644 index 0000000..58793ec --- /dev/null +++ b/users/src/test/java/com/huoran/users/test/CodeGenerator.java @@ -0,0 +1,81 @@ +package com.huoran.users.test; + +import com.baomidou.mybatisplus.annotation.DbType; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.generator.AutoGenerator; +import com.baomidou.mybatisplus.generator.config.DataSourceConfig; +import com.baomidou.mybatisplus.generator.config.GlobalConfig; +import com.baomidou.mybatisplus.generator.config.PackageConfig; +import com.baomidou.mybatisplus.generator.config.StrategyConfig; +import com.baomidou.mybatisplus.generator.config.rules.DateType; +import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; +import org.junit.Test; + +/** + * @Author chen + * @DATE 2021/8/10 15:42 + * @Version 1.0 + */ +public class CodeGenerator { + + @Test + public void run() { + + // 1、创建代码生成器 + AutoGenerator mpg = new AutoGenerator(); + + // 2、全局配置 + GlobalConfig gc = new GlobalConfig(); + String projectPath = System.getProperty("user.dir"); + gc.setOutputDir(projectPath + "/src/main/java"); + + + gc.setAuthor("chen");//设置作者 + gc.setOpen(false); //生成后是否打开资源管理器 + gc.setFileOverride(false); //重新生成时文件是否覆盖 + gc.setServiceName("%sService"); //去掉Service接口的首字母I + gc.setIdType(IdType.AUTO); //主键策略 + gc.setDateType(DateType.ONLY_DATE);//定义生成的实体类中日期类型 + gc.setSwagger2(true);//开启Swagger2模式 + + mpg.setGlobalConfig(gc); + + // 3、数据源配置 + DataSourceConfig dsc = new DataSourceConfig(); + dsc.setUrl("jdbc:mysql://rm-wz9y13wf7u8q8610fwo.mysql.rds.aliyuncs.com:3306/nakadai?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8"); + dsc.setDriverName("com.mysql.cj.jdbc.Driver"); + dsc.setUsername("super"); + dsc.setPassword("huoran888"); + dsc.setDbType(DbType.MYSQL); + mpg.setDataSource(dsc); + + // 4、包配置 + PackageConfig pc = new PackageConfig(); + pc.setParent("com.huoran.users"); + //pc.setModuleName("occupationlab"); //模块名 + pc.setController("controller"); + pc.setEntity("entity"); + pc.setService("service"); + pc.setServiceImpl("service.impl"); + pc.setMapper("mapper"); + mpg.setPackageInfo(pc); + + // 5、策略配置 + StrategyConfig strategy = new StrategyConfig(); + strategy.setInclude("acl_permission","acl_role","acl_role_permission","acl_user_role"); + strategy.setNaming(NamingStrategy.underline_to_camel);//数据库表映射到实体的命名策略 + strategy.setTablePrefix("acl_"); //生成实体时去掉表前缀 + + strategy.setColumnNaming(NamingStrategy.underline_to_camel);//数据库表字段映射到实体的命名策略 + strategy.setEntityLombokModel(true); // lombok 模型 @Accessors(chain = true) setter链式操作 + + strategy.setRestControllerStyle(true); //restful api风格控制器 + strategy.setControllerMappingHyphenStyle(true); //url中驼峰转连字符 + + mpg.setStrategy(strategy); + + + // 6、执行 + mpg.execute(); + } +} diff --git a/users/src/test/java/com/huoran/users/test/JunitTest.java b/users/src/test/java/com/huoran/users/test/JunitTest.java new file mode 100644 index 0000000..f545f09 --- /dev/null +++ b/users/src/test/java/com/huoran/users/test/JunitTest.java @@ -0,0 +1,99 @@ +package com.huoran.users.test; + +import cn.hutool.json.JSONObject; +import com.huoran.users.entity.vo.WxMssVo; +import com.huoran.users.service.IHrUserInfoService; +import com.huoran.users.service.RoleService; +import com.huoran.users.utils.WeChatUtil; +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.io.IOException; +import java.util.Date; +import java.util.HashMap; + +/** + * @Author chen + * @DATE 2021/7/5 18:06 + * @Version 1.0 + */ +@RunWith(SpringRunner.class) +@SpringBootTest +public class JunitTest { + + @Autowired + private RoleService roleService; + @Autowired + private IHrUserInfoService userInfoService; + + @Test + public void test() { + roleService.addCustomerAdmin(99,"2"); + } + + @Test + public void publishModelMessage(){ + WxMssVo wxMssVo = new WxMssVo(); + //设置模板id + wxMssVo.setTemplate_id("8pDVfWYqh9c-nn3CeA1NXM58pmoyQXZzkVnRFKy_l2A"); + wxMssVo.setMiniprogram_state("trial"); + wxMssVo.setLang("zh_CN"); + String accessToken=null; + try { + //设置openId + wxMssVo.setTouser("osj9X5LWbk5nPxxw0AJ5un5XJ8cs"); +// 设置accessToken + accessToken= WeChatUtil.getAccessToken(); + } catch (IOException e) { + e.printStackTrace(); + } +// 设置小程序 跳转首页 + wxMssVo.setPage("pages/index/index"); + + wxMssVo.setRequest_url("https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=" + accessToken); +// 将模板中的值一一赋值 发送到小程序的数据要转化为json格式 可以使用下面的方法直接拼接成JSONObject + JSONObject jsonObject = new JSONObject(); + JSONObject dataInfo = new JSONObject(); + dataInfo.putOpt("value", new Date()); + jsonObject.putOpt("time5", dataInfo); + +// 使用map结合模板 后续再加遍历拼接成JSONObject + HashMap map = new HashMap<>(3); + //根据模板写值 + map.put("thing2", "测试学校"); + map.put("thing8","下班打卡"); + map.put("phrase10","下班打卡"); + wxMssVo.setMap(map); + WeChatUtil.sendTemplateMessage(wxMssVo); + + + + /*String openid = "osj9X5LWbk5nPxxw0AJ5un5XJ8cs"; + String templateId = "8pDVfWYqh9c-nn3CeA1NXM58pmoyQXZzkVnRFKy_l2A"; + //拼接推送的模版 + PushDTO pushDTO = new PushDTO(); + + //用户的openId + pushDTO.setTouser(openid); + pushDTO.setTemplate_id(templateId); + MiniprogramData miniprogram = new MiniprogramData(); + pushDTO.setMiniprogram(miniprogram); + Map data = new HashMap<>(); + data.put("thing2", "新婴儿奶瓶"); + data.put("thing8", "11231323"); + data.put("phrase10", "下班打卡"); + pushDTO.setData(data); + System.out.println("发送的模板" + data); + Date date = new Date(); + ResponseEntity stringResponseEntity = userInfoService.messageNotification(pushDTO); + + System.out.println(stringResponseEntity);*/ + + + + } + +} diff --git a/websocket/pom.xml b/websocket/pom.xml new file mode 100644 index 0000000..e0674c7 --- /dev/null +++ b/websocket/pom.xml @@ -0,0 +1,59 @@ + + + + huoran + com.huoran.parent + 1.0-SNAPSHOT + + 4.0.0 + + websocket + + + 8 + 8 + UTF-8 + 3.17.4 + + + + + + + + + io.springfox + springfox-swagger2 + + + + org.springframework.boot + spring-boot-starter-data-redis + 2.7.12 + + + + org.springframework.boot + spring-boot-starter-websocket + + + + org.projectlombok + lombok + + + + + com.alibaba + fastjson + + + + + \ No newline at end of file diff --git a/websocket/src/main/java/com/huoran/websocket/WebSocketServer.java b/websocket/src/main/java/com/huoran/websocket/WebSocketServer.java new file mode 100644 index 0000000..76bc7c0 --- /dev/null +++ b/websocket/src/main/java/com/huoran/websocket/WebSocketServer.java @@ -0,0 +1,18 @@ +package com.huoran.websocket; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; + +/** + * websocket 服务 (无需启动) + @author wangsong + @date 2023/05/17 + */ +@SpringBootApplication(scanBasePackages = {"com.huoran"}, exclude = {DataSourceAutoConfiguration.class}) +public class WebSocketServer { + + public static void main(String[] args) { + SpringApplication.run(WebSocketServer.class, args); + } +} diff --git a/websocket/src/main/java/com/huoran/websocket/config/RedisConfig.java b/websocket/src/main/java/com/huoran/websocket/config/RedisConfig.java new file mode 100644 index 0000000..313a901 --- /dev/null +++ b/websocket/src/main/java/com/huoran/websocket/config/RedisConfig.java @@ -0,0 +1,162 @@ +//package com.huoran.websocket.config; +// +//import com.fasterxml.jackson.annotation.JsonAutoDetect; +//import com.fasterxml.jackson.annotation.JsonTypeInfo; +//import com.fasterxml.jackson.annotation.PropertyAccessor; +//import com.fasterxml.jackson.databind.ObjectMapper; +//import com.fasterxml.jackson.databind.SerializationFeature; +//import com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator; +//import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +//import com.huoran.websocket.constant.CacheModeConst; +//import lombok.extern.slf4j.Slf4j; +//import org.springframework.beans.factory.annotation.Value; +//import org.springframework.cache.CacheManager; +//import org.springframework.cache.annotation.CachingConfigurerSupport; +//import org.springframework.cache.annotation.EnableCaching; +//import org.springframework.context.annotation.Bean; +//import org.springframework.context.annotation.Configuration; +//import org.springframework.data.redis.cache.RedisCacheConfiguration; +//import org.springframework.data.redis.cache.RedisCacheManager; +//import org.springframework.data.redis.connection.RedisConnectionFactory; +//import org.springframework.data.redis.core.RedisTemplate; +//import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; +//import org.springframework.data.redis.serializer.RedisSerializationContext; +//import org.springframework.data.redis.serializer.RedisSerializer; +//import org.springframework.data.redis.serializer.StringRedisSerializer; +// +//import java.time.Duration; +// +// +///*** +// * +// * 处理 redis缓存key 乱码, 以及保存对象数据设置为 json存储(默认二进制) +// * +// *

+// * 继承CachingConfigurerSupport, 为了自定义生成KEY的策略。可以不继承。 +// * 注解 @EnableCaching 表示 启用缓存,这个注解很重要;可以使用 +// *

+// * @author wangsong +// * @date 2021/3/2 0002 17:38 +// * @return +// * @version 1.0.1 +// */ +//@Configuration +//@EnableCaching +//@Slf4j +//public class RedisConfig extends CachingConfigurerSupport { +// +// /** +// * 缓存模式 +// * singlenode : 单节点模式, 数据直接挂载到指定的 db 中 +// * multinode : 多节点模式, 数据挂载到指定的 db 下的子模块中, 同下方参数的 moduleName 值 +// *

+// * 默认: 单节点模式, 如果开启 modularity 模块化模式后没有设置 moduleName 值, 那么模块名称默认使用 【no-project-name】 +// */ +// @Value("${spring.redis.cacheMode:singlenode}") +// protected String cacheMode; +// +// /** +// * 当前项目模块名称, 作用于 redis 前缀 +// */ +// @Value("${spring.application.name:no-project-name}") +// protected String moduleName; +// +// /** +// * 缓存对象 bean 配置 +// * +// * @param redisConnectionFactory +// * @return +// */ +// @Bean(name = "redisTemplate") +// public RedisTemplate redisTemplate(RedisConnectionFactory redisConnectionFactory) { +// RedisTemplate template = new RedisTemplate<>(); +// template.setConnectionFactory(redisConnectionFactory); +// +// // key 的序列化规则 默认单节点模式 +// RedisSerializer redisKeySerializer = new StringRedisSerializer(); +// if (cacheMode.equals(CacheModeConst.MULTINODE)) { +// // 多节点模式 +// redisKeySerializer = new RedisKeySerializer(moduleName); +// } +// template.setKeySerializer(redisKeySerializer); +// template.setHashKeySerializer(redisKeySerializer); +// +// // value 的序列化规则 +// // 使用Jackson2JsonRedisSerializer来序列化和反序列化redis的value值 +// Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer<>(Object.class); +// ObjectMapper om = new ObjectMapper(); +// om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); +// /// om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL); +// om.activateDefaultTyping(LaissezFaireSubTypeValidator.instance, ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.PROPERTY); +// // 解决 jackson2 无法反序列化 LocalDateTime 的问题 +// om.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); +// om.registerModule(new JavaTimeModule()); +// jackson2JsonRedisSerializer.setObjectMapper(om); +// template.setValueSerializer(jackson2JsonRedisSerializer); +// template.setHashValueSerializer(jackson2JsonRedisSerializer); +// template.afterPropertiesSet(); +// return template; +// } +// +// +// /** +// * 缓存管理器配置 +// * +// *

缓存注解配置

+// * +// * @param factory +// * @return +// */ +// @Bean +// public CacheManager cacheManager(RedisConnectionFactory factory) { +// // key 的序列化规则 +// RedisSerializer redisKeySerializer = new StringRedisSerializer(); +// +// // vulue 序列化规则 +// Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer<>(Object.class); +// //解决查询缓存转换异常的问题 +// ObjectMapper om = new ObjectMapper(); +// om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); +// om.activateDefaultTyping(LaissezFaireSubTypeValidator.instance, ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.PROPERTY); +// jackson2JsonRedisSerializer.setObjectMapper(om); +// // 解决 jackson2 无法反序列化 LocalDateTime 的问题 +// om.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); +// om.registerModule(new JavaTimeModule()); +// +// String prefixCacheNameWith = ""; +// // 多节点模式 +// if (cacheMode.equals(CacheModeConst.MULTINODE)) { +// prefixCacheNameWith = moduleName + ":"; +// } +// // 配置序列化(解决乱码的问题) +// RedisCacheConfiguration config = RedisCacheConfiguration.defaultCacheConfig() +// // 设置缓存的默认过期时间,也是使用Duration设置 +// .entryTtl(Duration.ofMinutes(0)).prefixKeysWith(prefixCacheNameWith) +// // .computePrefixWith(name -> ":") +//// .prefixCacheNameWith(prefixCacheNameWith) +// .serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(redisKeySerializer)) +// .serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(jackson2JsonRedisSerializer)); +// log.info("redis 分布式缓存管理器注册成功, 可以使用缓存注解进行缓存数据"); +// return RedisCacheManager +// .builder(factory) +// .cacheDefaults(config) +// .build(); +// } +// +// +// /** +// * 分布式锁 +// * +// * @param redissonClient +// * @author wangsong +// */ +///* +// @Bean +// @Lazy +// public DistributedLockTemplate distributedLockTemplate(RedissonClient redissonClient) { +// return new SingleDistributedLockTemplate(redissonClient); +// } +//*/ +// +//} +// diff --git a/websocket/src/main/java/com/huoran/websocket/config/RedisKeySerializer.java b/websocket/src/main/java/com/huoran/websocket/config/RedisKeySerializer.java new file mode 100644 index 0000000..e4a3fe9 --- /dev/null +++ b/websocket/src/main/java/com/huoran/websocket/config/RedisKeySerializer.java @@ -0,0 +1,43 @@ +package com.huoran.websocket.config; + + +import org.springframework.data.redis.serializer.StringRedisSerializer; +import org.springframework.lang.Nullable; + +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; + +/** + * 为redis key 统一加上前缀 + * @author wangsong + * @date 2023/05/17 + */ +public class RedisKeySerializer extends StringRedisSerializer { + + /**: + * 编码格式 + */ + private final Charset charset = StandardCharsets.UTF_8; + + /** + * 前缀 + */ + private String prefixKey; + + public RedisKeySerializer(String prefixKey) { + this.prefixKey = prefixKey + ":"; + } + + + @Override + public String deserialize(@Nullable byte[] bytes) { + return (bytes == null ? null : new String(bytes, charset).replaceFirst(prefixKey, "")); + } + + @Override + public byte[] serialize(@Nullable String string) { + return (string == null ? null : (prefixKey + string).getBytes(charset)); + } + +} + diff --git a/websocket/src/main/java/com/huoran/websocket/config/RedisListenerConfig.java b/websocket/src/main/java/com/huoran/websocket/config/RedisListenerConfig.java new file mode 100644 index 0000000..216da23 --- /dev/null +++ b/websocket/src/main/java/com/huoran/websocket/config/RedisListenerConfig.java @@ -0,0 +1,25 @@ +package com.huoran.websocket.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.redis.connection.RedisConnectionFactory; +import org.springframework.data.redis.listener.RedisMessageListenerContainer; + +/*** + * redis key过期监听器注入bean + * @author wangsong + * @mail 1720696548@qq.com + * @date 2021/3/2 0002 17:04 + * @version 1.0.1 + */ +@Configuration +public class RedisListenerConfig { + + @Bean + RedisMessageListenerContainer container(RedisConnectionFactory connectionFactory) { + + RedisMessageListenerContainer container = new RedisMessageListenerContainer(); + container.setConnectionFactory(connectionFactory); + return container; + } +} diff --git a/websocket/src/main/java/com/huoran/websocket/config/WebSocketConfig.java b/websocket/src/main/java/com/huoran/websocket/config/WebSocketConfig.java new file mode 100644 index 0000000..3bab33c --- /dev/null +++ b/websocket/src/main/java/com/huoran/websocket/config/WebSocketConfig.java @@ -0,0 +1,51 @@ +package com.huoran.websocket.config; + +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.web.servlet.ServletContextInitializer; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.socket.server.standard.ServerEndpointExporter; +import org.springframework.web.util.WebAppRootListener; + +import javax.servlet.ServletContext; + + +/** + * WebSocket 配置类 + * @author 王松 + * @mail 1720696548@qq.com + * @date 2020/6/30 0030 9:26 + */ + +@Configuration +@ComponentScan +@EnableAutoConfiguration +public class WebSocketConfig implements ServletContextInitializer { + /** + * 服务器节点 + *

+ * 如果使用独立的servlet容器,而不是直接使用springboot的内置容器,就不要注入ServerEndpointExporter,因为它将由容器自己提供和管理 + * + * @return + */ + @Bean + public ServerEndpointExporter serverEndpointExporter() { + return new ServerEndpointExporter(); + } + + /** + * 配置websocket内容传输大小,1024 = 1kb (如果太大会导致堆空间不足,每个连接都会占用 200kb 堆空间) + * @author wangsong + * @param servletContext + * @date 2020/12/6 0006 13:49 + * @return void + * @version 1.0.1 + */ + @Override + public void onStartup(ServletContext servletContext) { + servletContext.addListener(WebAppRootListener.class); + servletContext.setInitParameter("org.apache.tomcat.websocket.textBufferSize", (1024 * 200) + ""); + servletContext.setInitParameter("org.apache.tomcat.websocket.binaryBufferSize", (1024 * 200) + ""); + } +} diff --git a/websocket/src/main/java/com/huoran/websocket/config/error/WebSocketErrorException.java b/websocket/src/main/java/com/huoran/websocket/config/error/WebSocketErrorException.java new file mode 100644 index 0000000..e103ad6 --- /dev/null +++ b/websocket/src/main/java/com/huoran/websocket/config/error/WebSocketErrorException.java @@ -0,0 +1,63 @@ +package com.huoran.websocket.config.error; + + +import com.huoran.websocket.config.result.WebSocketRType; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import org.springframework.stereotype.Component; + + +/** + * 自定义异常类,通过此类可返回各种自定义异常信息,由GlobalExceptionHandler 处理返回 + *

+ * 使用:throw new ErrorException("1000000","自定义异常测试"); + * 返回:{"code": "1000000","msg": "自定义异常测试"} + *

+ * + * @author wangsong + * @version 1.0.0 + * @email 1720696548@qq.com + * @date 2020/2/9 0009 12:44 + */ +@EqualsAndHashCode(callSuper = true) +@Component +@Data +@NoArgsConstructor +public class WebSocketErrorException extends RuntimeException { + + private Integer code; + private String msg; + + + /** + * 直接传递 + * + * @param code code + * @param msg msg + * @return + * @version 1.0.0 + */ + public WebSocketErrorException(Integer code, String msg) { + this.code = code; + this.msg = msg; + } + + + public WebSocketErrorException(String msg) { + this.code = WebSocketRType.FILE_UPLOAD_FAILED.getValue(); + this.msg = msg; + } + + + /** + * 枚举传递(建议先定义枚举) + * + * @param rType rType + * @version 1.0.0 + */ + public WebSocketErrorException(WebSocketRType rType) { + this.code = rType.getValue(); + this.msg = rType.getMsg(); + } +} diff --git a/websocket/src/main/java/com/huoran/websocket/config/error/WebSocketGlobalExceptionHandler.java b/websocket/src/main/java/com/huoran/websocket/config/error/WebSocketGlobalExceptionHandler.java new file mode 100644 index 0000000..4ca16ed --- /dev/null +++ b/websocket/src/main/java/com/huoran/websocket/config/error/WebSocketGlobalExceptionHandler.java @@ -0,0 +1,38 @@ +package com.huoran.websocket.config.error; + + +import com.huoran.websocket.config.result.WebSocketR; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.RestControllerAdvice; + + +/** + * 异常处理类/ 全局异常 /自定义异常 + * @author wangsong + * @mail 1720696548@qq.com + * @date 2022/8/22 0022 20:53 + * @version 1.0.0 + */ +@RestControllerAdvice +@Slf4j +public class WebSocketGlobalExceptionHandler { + + /** + * 全局异常|受检查异常 --> Exception 。可以理解为错误,必须要开发者解决以后才能编译通过,这里JSR 303 为受检查异常 + * 全局异常|运行时异常 --> RuntimeException extends Exception: 运行时异常,又称不受检查异常,不受检查! + * 受检查异常解决的方法有两种1:throw到上层,2,try-catch处理。 + * + * @param e + * @return io.github.wslxm.admincore.platform.vo.ResponseData + * @author ws + * @mail 1720696548@qq.com + * @date 2020/2/9 0009 10:06 + */ + @ExceptionHandler(WebSocketErrorException.class) + public WebSocketR exceptionHandler(WebSocketErrorException e) { + return WebSocketR.error(e.getCode(), e.getMsg()); + } +} + + diff --git a/websocket/src/main/java/com/huoran/websocket/config/init/ApplicationClosedEventListener.java b/websocket/src/main/java/com/huoran/websocket/config/init/ApplicationClosedEventListener.java new file mode 100644 index 0000000..54a6d27 --- /dev/null +++ b/websocket/src/main/java/com/huoran/websocket/config/init/ApplicationClosedEventListener.java @@ -0,0 +1,34 @@ +package com.huoran.websocket.config.init; + + +import com.huoran.websocket.constant.WebsocketConst; +import com.huoran.websocket.util.RedisUtil; +import com.huoran.websocket.util.WebsocketSpringContextUtil; +import lombok.extern.slf4j.Slf4j; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.ApplicationListener; +import org.springframework.context.event.ContextClosedEvent; +import org.springframework.stereotype.Component; + +/** + * + * 项目完全停止时执行的一些处理操作 + * @author wangsong + * @mail 1720696548@qq.com + * @date 2020/7/23 0023 9:04 + * @version 1.0.1 + */ +@Component +@Slf4j +public class ApplicationClosedEventListener implements ApplicationListener { + private static Logger logger = LoggerFactory.getLogger(ApplicationClosedEventListener.class); + + @Override + public void onApplicationEvent(ContextClosedEvent contextClosedEvent) { + // 服务重启清空 reids 在线用户缓存 + RedisUtil redisUtil = WebsocketSpringContextUtil.getBean(RedisUtil.class); + redisUtil.delete(WebsocketConst.WEBSOCKET_CACHE_KEY); + logger.info("程序已停止"); + } +} diff --git a/websocket/src/main/java/com/huoran/websocket/config/result/WebSocketR.java b/websocket/src/main/java/com/huoran/websocket/config/result/WebSocketR.java new file mode 100644 index 0000000..045aa38 --- /dev/null +++ b/websocket/src/main/java/com/huoran/websocket/config/result/WebSocketR.java @@ -0,0 +1 @@ +package com.huoran.websocket.config.result; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; /** * 返回的数据格式 * * @author 王松 * @WX-QQ 1720696548 * @date 2019/11/14 14:55 */ @Data @ApiModel(value = "WebSocketR", description = "统一返回格式") public class WebSocketR implements Serializable { private static final long serialVersionUID = -5666504070515657048L; @ApiModelProperty(value = "状态码") private Integer code; @ApiModelProperty(value = "状态描叙") private String msg; /** * 注解 @JsonInclude(value = JsonInclude.Include.NON_EMPTY) 设置空不返回 */ @ApiModelProperty(value = "返回数据") private T data; @ApiModelProperty(value = "错误的栈内存信息") private String errorMsg; private WebSocketR(Integer code, String msg, T data, String errorMsg) { this.code = code; this.data = data; this.msg = msg; this.errorMsg = errorMsg; } public static WebSocketR success() { return new WebSocketR<>(WebSocketRType.SYS_SUCCESS.getValue(), WebSocketRType.SYS_SUCCESS.getMsg(), null, null); } public static WebSocketR success(T data) { return new WebSocketR<>(WebSocketRType.SYS_SUCCESS.getValue(), WebSocketRType.SYS_SUCCESS.getMsg(), data, null); } public static WebSocketR error(Integer code, String msg) { return new WebSocketR<>(code, msg, null, null); } } \ No newline at end of file diff --git a/websocket/src/main/java/com/huoran/websocket/config/result/WebSocketRType.java b/websocket/src/main/java/com/huoran/websocket/config/result/WebSocketRType.java new file mode 100644 index 0000000..9c0b0b2 --- /dev/null +++ b/websocket/src/main/java/com/huoran/websocket/config/result/WebSocketRType.java @@ -0,0 +1,30 @@ +package com.huoran.websocket.config.result; + +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * 异常常量类 + * + * @author ws + * @mail 1720696548@qq.com + * @date 2020/2/9 0009 11:16 + * @return + */ + +@Getter +@NoArgsConstructor +public enum WebSocketRType { + + // 系统相关 - 服务器内置状态码 + SYS_SUCCESS(200, "成功"), + FILE_UPLOAD_FAILED(100002, "websocket服务错误"), + ; + private Integer value; + private String msg; + + WebSocketRType(Integer value, String msg) { + this.value = value; + this.msg = msg; + } +} diff --git a/websocket/src/main/java/com/huoran/websocket/constant/CacheModeConst.java b/websocket/src/main/java/com/huoran/websocket/constant/CacheModeConst.java new file mode 100644 index 0000000..9d60b1c --- /dev/null +++ b/websocket/src/main/java/com/huoran/websocket/constant/CacheModeConst.java @@ -0,0 +1,22 @@ + +package com.huoran.websocket.constant; + +/** + * 缓存模式 + * @author wangsong + * @date 2023/3/14 0014 21:27 + * @return + * @version 1.0.0 + */ +public interface CacheModeConst { + + /** + * 单节点模式 + */ + String SINGLENODE = "singlenode"; + /** + * 模块化模式 + */ + String MULTINODE = "multinode"; + +} diff --git a/websocket/src/main/java/com/huoran/websocket/constant/WebsocketConst.java b/websocket/src/main/java/com/huoran/websocket/constant/WebsocketConst.java new file mode 100644 index 0000000..9a0ef83 --- /dev/null +++ b/websocket/src/main/java/com/huoran/websocket/constant/WebsocketConst.java @@ -0,0 +1,13 @@ +package com.huoran.websocket.constant; + +/** + * 常量类 + * @author wangsong + * @mail 1720696548@qq.com + * @date 2023/2/2 0002 10:17 + * @version 1.0.0 + */ +public interface WebsocketConst { + + public final static String WEBSOCKET_CACHE_KEY = "websocket"; +} diff --git a/websocket/src/main/java/com/huoran/websocket/controller/WebsocketController.java b/websocket/src/main/java/com/huoran/websocket/controller/WebsocketController.java new file mode 100644 index 0000000..f3f4bf4 --- /dev/null +++ b/websocket/src/main/java/com/huoran/websocket/controller/WebsocketController.java @@ -0,0 +1,120 @@ +package com.huoran.websocket.controller; + + +import com.huoran.websocket.config.result.WebSocketR; +import com.huoran.websocket.model.dto.WebsocketMsgDTO; +import com.huoran.websocket.service.WebsocketService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.text.SimpleDateFormat; +import java.util.*; + +/** + * websocket类 + */ +@Api(value = "WebsocketController", tags = "Websocket --> 消息通知/即时通讯") +@RequestMapping("/api/open/websocket") +@RestController +@Slf4j +public class WebsocketController { + + + @Autowired + private HttpServletRequest request; + + @Autowired + private WebsocketService websocketService; + + + private final static String HTTPS = "https"; + private static List LOCALHOSTS = null; + + public WebsocketController() { + LOCALHOSTS = new ArrayList<>(); + LOCALHOSTS.add("127.0.0.1"); + LOCALHOSTS.add("localhost"); + } + + + /** + * websocket 端口号 + */ + @Value("${server.port}") + private String port; + + /** + * websocket接口, WebsocketServiceImpl的 @ServerEndpoint 内参数=socket接口名 + */ + private static String INTERFACE_NAME = "/websocket"; + + + /** + * 获取webSocket 连接地址, // 实际情况根据用户 token获取用户信息返回 + * 获取socket地址 + * 获取用户名 + * 获取用户Id + */ + @RequestMapping(value = "/getPath", method = RequestMethod.GET) + @ApiOperation("获取模拟游客登录的 websocket 连接地址") + public Object getPath() { + // 获取地址 127.0.0.1 | localhost | 线上域名 + String serverName = request.getServerName(); + // 随机用户id + 用户名 + String userId = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()); + String username = "游客:" + new SimpleDateFormat("ssSSS").format(new Date()); + + // 判断是https请求还是http,对应使用 ws 或 wss + String serverPrefix = "ws://"; + String referer = request.getHeader("referer"); + if (referer != null && !"".equals(referer) && HTTPS.equals(referer.substring(0, HTTPS.length()))) { + serverPrefix = "wss://"; + } + // 如果是线上 (域名+socket地址+id+用户名) + String path = serverPrefix + serverName + INTERFACE_NAME + "/" + userId + "/" + username; + // 如果是本地 (ip + 端口 + socket地址 + id +用户名) + if (LOCALHOSTS.contains(serverName)) { + path = serverPrefix + serverName + ":" + port + INTERFACE_NAME + "/" + userId + "/" + username; + } + // 返回参数 + Map map = new HashMap<>(4); + map.put("path", path); + map.put("userId", userId); + map.put("username", username); + log.info("websocket请求地址:" + path); + return WebSocketR.success(map); + } + + + @RequestMapping(value = "/send", method = RequestMethod.POST) + @ApiOperation("发送消息") + public Object send(@RequestBody WebsocketMsgDTO dto) { + websocketService.send(dto); + return WebSocketR.success(); + } + + @RequestMapping(value = "/getOnlineCount", method = RequestMethod.GET) + @ApiOperation("获取当前在线人数") + public Object getOnlineCount() { + Integer onlineCount = websocketService.getOnlineCount(); + return WebSocketR.success(onlineCount); + } + + @RequestMapping(value = "/getOnlineUsers", method = RequestMethod.GET) + @ApiOperation("获取当前在线用户列表") + public Object getOnlineUsersList() { + return WebSocketR.success(websocketService.getOnlineUsers()); + } + + + @RequestMapping(value = "/isOnline", method = RequestMethod.GET) + @ApiOperation("判断指定用户是否在线") + public Object isOnline(@RequestParam String userId) { + return WebSocketR.success(websocketService.isOnline(userId)); + } +} diff --git a/websocket/src/main/java/com/huoran/websocket/desc.md b/websocket/src/main/java/com/huoran/websocket/desc.md new file mode 100644 index 0000000..fb08c78 --- /dev/null +++ b/websocket/src/main/java/com/huoran/websocket/desc.md @@ -0,0 +1,6 @@ +通用功能 -- websocket及时通知(可移除) + +注意与系统 xjAdminMsg 及时通知表有关联 +注意websocket同时在线人数 1300已经到达颠覆值, 一般情况下(4核8线程服务器),只能维持在 500-700人同时在线 +jwm调优的情况下,可以能加置 1000人左右 + diff --git a/websocket/src/main/java/com/huoran/websocket/model/dto/WebsocketMsgDTO.java b/websocket/src/main/java/com/huoran/websocket/model/dto/WebsocketMsgDTO.java new file mode 100644 index 0000000..e39c48d --- /dev/null +++ b/websocket/src/main/java/com/huoran/websocket/model/dto/WebsocketMsgDTO.java @@ -0,0 +1,41 @@ +package com.huoran.websocket.model.dto; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + + +/*** + * websocket客服端-发送消息-入参参数 + * @author 王松 + * @mail 1720696548@qq.com + * @date 2020/6/30 0030 18:24 + */ +@Data +@NoArgsConstructor +public class WebsocketMsgDTO implements Serializable { + + private static final long serialVersionUID = 4019037058499751265L; + /** + * 发送人id + */ + private String form; + /** + * 发送人用户名 + */ + private String username; + /** + * 接收人用户Id (目标ID,逗号分隔) (所有人使用-ALL) + */ + private String to; + /** + * 发送内容 + */ + private String content; + /** + * 扩暂发送内容 + */ + private String extras; + +} diff --git a/websocket/src/main/java/com/huoran/websocket/model/entity/OnlineUser.java b/websocket/src/main/java/com/huoran/websocket/model/entity/OnlineUser.java new file mode 100644 index 0000000..dd4a128 --- /dev/null +++ b/websocket/src/main/java/com/huoran/websocket/model/entity/OnlineUser.java @@ -0,0 +1,54 @@ +package com.huoran.websocket.model.entity; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.websocket.Session; +import java.io.Serializable; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; + +/*** + * 当前在线列表信息 + * @author 王松 + * @mail 1720696548@qq.com + * @date 2020/7/1 0001 11:58 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class OnlineUser implements Serializable { + private static final long serialVersionUID = 6239537958223115071L; + /** + * 用户ID + */ + private String userId; + /** + * 用户名称 + */ + private String username; + /** + * 用户会话 (使用该对象进行消息发送) + */ + private Session session; + /** + * 连接时间 + */ + private String createTime; + + /** + * @param userId 用户id + * @param username 用户名称 + * @param username 用户头像 + * @param session 用户session 回话信息 + */ + public OnlineUser(String userId, String username, Session session) { + this.userId = userId; + this.username = username; + this.session = session; + // + DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + this.createTime = df.format(LocalDateTime.now()); + } +} diff --git a/websocket/src/main/java/com/huoran/websocket/model/entity/RedisOnlineUser.java b/websocket/src/main/java/com/huoran/websocket/model/entity/RedisOnlineUser.java new file mode 100644 index 0000000..65e3743 --- /dev/null +++ b/websocket/src/main/java/com/huoran/websocket/model/entity/RedisOnlineUser.java @@ -0,0 +1,51 @@ +package com.huoran.websocket.model.entity; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; + +/*** + * 当前在线列表信息 + * @author 王松 + * @mail 1720696548@qq.com + * @date 2020/7/1 0001 11:58 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class RedisOnlineUser implements Serializable { + private static final long serialVersionUID = 6239537958223115071L; + /** + * 用户ID + */ + private String userId; + /** + * 用户名称 + */ + private String username; + /** + * 用户会话 (使用该对象进行消息发送) + */ + private String sessionId; + /** + * 连接时间 + */ + private String createTime; + + /** + * @param userId 用户id + * @param username 用户名称 + * @param username 用户头像 + */ + public RedisOnlineUser(String userId, String username,String sessionId) { + this.userId = userId; + this.username = username; + this.sessionId = sessionId; + DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + this.createTime = df.format(LocalDateTime.now()); + } +} diff --git a/websocket/src/main/java/com/huoran/websocket/model/vo/OnlineUserVO.java b/websocket/src/main/java/com/huoran/websocket/model/vo/OnlineUserVO.java new file mode 100644 index 0000000..623cd4e --- /dev/null +++ b/websocket/src/main/java/com/huoran/websocket/model/vo/OnlineUserVO.java @@ -0,0 +1,27 @@ +package com.huoran.websocket.model.vo; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author wangsong + * 在线列表信息返回 + */ +@Data +public class OnlineUserVO implements Serializable { + + private static final long serialVersionUID = -5554343409782021987L; + /** + * 用户ID + */ + private String userId; + /** + * 用户名称 + */ + private String username; + /** + * 连接时间 + */ + private String createTime; +} diff --git a/websocket/src/main/java/com/huoran/websocket/model/vo/SendMsgVO.java b/websocket/src/main/java/com/huoran/websocket/model/vo/SendMsgVO.java new file mode 100644 index 0000000..d110cfa --- /dev/null +++ b/websocket/src/main/java/com/huoran/websocket/model/vo/SendMsgVO.java @@ -0,0 +1,64 @@ +package com.huoran.websocket.model.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; + + +/** + * websocket客户端-接收端-返回参数 + * + * @author 王松 + * @mail 1720696548@qq.com + * @date 2020/6/30 0030 18:24 + */ +@Data +public class SendMsgVO implements Serializable { + private static final long serialVersionUID = -9051438901021877148L; + + /** + * 发送人用户Id (来源Id,上线为上线线人的用户Id) + */ + @ApiModelProperty("发送人账号Id") + private String from; + /** + * 发送人用户名 (上下线为上线线人的用户名) + */ + @ApiModelProperty("发送人用户名 (上下线为上线线人的用户名)") + private String username; + + /** + * 接收人用户Id (目标ID,逗号分隔) (所有人使用-ALL,包括自己在内也能接收) + */ + @ApiModelProperty("接收人用户Id (目标ID,逗号分隔) (所有人使用-ALL,包括自己在内也能接收)") + private String to; + /** + * 发送内容(text/json) + */ + @ApiModelProperty("发送内容(text/json),content定义:1赛事、2创业、3考核、4模型。-号拼接携带id。例:3-2:表示属于考核消息,2为考核id") + private String content; + /** + * 扩展消息字段(text/json) + */ + @ApiModelProperty("扩展消息字段(默认为空)") + private String extras; + /** + * 当前在线人数 + */ + @ApiModelProperty("当前在线人数") + private Integer onlineNum; + /** + * 消息创建时间(YYYY-MM-DD ) + */ + @ApiModelProperty("消息创建时间(YYYY-MM-DD )") + private String createTime; + + + public SendMsgVO() { + DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + this.createTime = df.format(LocalDateTime.now()); + } +} diff --git a/websocket/src/main/java/com/huoran/websocket/server/OpenWebSocketApi.java b/websocket/src/main/java/com/huoran/websocket/server/OpenWebSocketApi.java new file mode 100644 index 0000000..ac2a637 --- /dev/null +++ b/websocket/src/main/java/com/huoran/websocket/server/OpenWebSocketApi.java @@ -0,0 +1,84 @@ +package com.huoran.websocket.server; + +import com.alibaba.fastjson.JSON; +import com.huoran.websocket.model.entity.OnlineUser; +import com.huoran.websocket.model.vo.SendMsgVO; +import lombok.extern.slf4j.Slf4j; + +import javax.websocket.Session; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Set; + +/** + * wensocket 提供的 api 方法 + * + * @author wangsong + * @date 2023/05/24 + */ +@Slf4j +public class OpenWebSocketApi { + + /** + * 消息发送( 遍历用户Id , 在通过sendMsg方法发送消息) + *

+ * 提供给外部或当前监听消息发送消息 + *

+ * + * @param sendMsg:消息内容 + */ + public static void send(SendMsgVO sendMsg) { + List all = Arrays.asList("all", "ALL"); + if (all.contains(sendMsg.getTo())) { + // 发送消息给所有人 + Set userIds = WebsocketServer.getClients().keySet(); + for (String userId : userIds) { + sendMsg(userId, sendMsg); + } + } else { + // 发送消息给指定人 + String[] userIds = sendMsg.getTo().split(","); + for (String userId : userIds) { + sendMsg(userId, sendMsg); + } + } + } + + + /** + * 消息发送(最后发送, 在send方法中循环用户Id 列表依次发送消息给指定人) + *

+ * // 消息发送(同步:getBasicRemote 异步:getAsyncRemote) + *

+ * + * @param userId 消息接收人ID , onlineUsers 的 key + * @param sendMsg 消息内容 + */ + private static boolean sendMsg(String userId, SendMsgVO sendMsg) { + // 判断用户是否在线, 在线发送消息推送 + if (!WebsocketServer.getClients().containsKey(userId)) { + log.info("websocket用户ID:{} 不在线: 推送信息失败, 消息:{} ", userId, JSON.toJSONString(sendMsg.toString())); + } + List onlineUsers = WebsocketServer.getClients().get(userId); + try { + for (OnlineUser onlineUser : onlineUsers) { + Session session = onlineUser.getSession(); + if (session == null) { + continue; + } + if (!session.isOpen()) { + session.close(); + } + // 此处存在同一个 session 被多个线程调用问题, 使用 synchronized 锁定排队执行 + synchronized (session){ + onlineUser.getSession().getBasicRemote().sendText(JSON.toJSONString(sendMsg)); + } + } + return true; + } catch (IOException e) { + log.error(e.toString()); + return false; + } + } +} diff --git a/websocket/src/main/java/com/huoran/websocket/server/WebsocketServer.java b/websocket/src/main/java/com/huoran/websocket/server/WebsocketServer.java new file mode 100644 index 0000000..3555d51 --- /dev/null +++ b/websocket/src/main/java/com/huoran/websocket/server/WebsocketServer.java @@ -0,0 +1,282 @@ +package com.huoran.websocket.server; + +import com.alibaba.fastjson.JSON; +import com.huoran.websocket.constant.WebsocketConst; +import com.huoran.websocket.model.dto.WebsocketMsgDTO; +import com.huoran.websocket.model.entity.OnlineUser; +import com.huoran.websocket.model.entity.RedisOnlineUser; +import com.huoran.websocket.model.vo.SendMsgVO; +import com.huoran.websocket.service.WebsocketService; +import com.huoran.websocket.topic.WebsocketMsgPublisher; +import com.huoran.websocket.util.RedisUtil; +import com.huoran.websocket.util.WebsocketSpringContextUtil; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import javax.websocket.*; +import javax.websocket.server.PathParam; +import javax.websocket.server.ServerEndpoint; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +/** + * @author wangsong + * Websocket 监听类(连接,断点,消息发送等) + *

+ * /websocket/{userId}/{username} = /websocket/用户Id/用户名 来连接websocket,该参数会带到每一个监听方法中 + * 同一个账号重复登录, 会被挤下线 + *

+ * @ServerEndpoint: socket链接地址 + */ +@ServerEndpoint("/websocket/{userId}/{username}") +@Slf4j +@Component +public class WebsocketServer { + + + /** + * 所有用户信息(session + userId + username + createTime --> 以用户的id为key, 通过用户key来获取用户session进行消息发送) + */ + private final static Map> CLIENTS = new ConcurrentHashMap<>(); + + /** + * 获取在线用户列表 + * + * @return {@link Map}<{@link String}, {@link List}<{@link OnlineUser}>> + */ + public static Map> getClients() { + return CLIENTS; + } + + /** + * 监听连接(有用户连接,立马到来执行这个方法),session 发生变化 + * + * @param userId 用户id + * @param username 用户名 + * @param session 当前用户会话 + * @return void + * @date 2020/6/30 0030 9:28 + */ + @OnOpen + public void onOpen(@PathParam("userId") String userId, @PathParam("username") String username, Session session) { + WebsocketService websocketService = WebsocketSpringContextUtil.getBean(WebsocketService.class); + Integer onlineCount = websocketService.getOnlineCount(); + // 保存到当前服务器 + onlineLocal(userId, username, session); + onlineRedis(userId, username, session, onlineCount); + // 给自己发条消息,告诉自己连接成功 + try { + SendMsgVO sendMsgVO = new SendMsgVO(); + sendMsgVO.setFrom(userId); + sendMsgVO.setUsername(username); + sendMsgVO.setTo(userId); + sendMsgVO.setContent("欢迎您: " + username); + sendMsgVO.setExtras(null); + sendMsgVO.setOnlineNum(websocketService.getOnlineCount()); + session.getBasicRemote().sendText(JSON.toJSONString(sendMsgVO)); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + + /** + * 监听断开连接(有用户退出,会立马到来执行这个方法) + * + * @param userId 用户id + * @param username 用户名 + * @param session 当前用户会话 + */ + @OnClose + public void onClose(@PathParam("userId") String userId, @PathParam("username") String username, Session session) { + // 移除本地在线状态 + offLineLocal(userId, session); + // 移除 redis 在线状态 + offLineRedis(userId, session); + // 关闭 (避免没有正常关闭主动在关闭一次) + try { + session.close(); + } catch (IOException e) { + throw new RuntimeException(e); + } + WebsocketService websocketService = WebsocketSpringContextUtil.getBean(WebsocketService.class); + log.info(username + ":已离线! 当前在线人数" + websocketService.getOnlineCount()); + } + + + /** + * 异常停止 + * + * @param userId 用户id + * @param username 用户名 + * @param session 当前用户会话 + * @param e 异常信息 + */ + @OnError + public void onError(@PathParam("userId") String userId, @PathParam("username") String username, Session session, Throwable e) { + log.info("服务端发生了错误" + e); + // 关闭 (避免没有正常关闭主动在关闭一次) + try { + session.close(); + } catch (IOException e1) { + throw new RuntimeException(e1); + } + } + + + /** + * 监听消息发送(收到客户端的消息立即执行) + * + * @param userId 用户id + * @param username 用户名 + * @param message 传递的消息内容, json数据( to=接收人用户Id (目标ID,逗号分隔) || content=内容 || content=消息类型) + * @param session 当前用户会话 + *

+ * // 前端发送内容格式 + * .... + * // 拼接参数 + * let message = {"content": "测试发送消息", "to": "ALL"} + * .... + */ + @OnMessage + public void onMessage(@PathParam("userId") String userId, @PathParam("username") String username, String message, Session session) { + WebsocketMsgPublisher websocketMsgPublisher = WebsocketSpringContextUtil.getBean(WebsocketMsgPublisher.class); + WebsocketService websocketService = WebsocketSpringContextUtil.getBean(WebsocketService.class); + // 请求参数(接收人+发送内容) + try { + System.out.println(message); + WebsocketMsgDTO sendMsgDTO = JSON.parseObject(message, WebsocketMsgDTO.class); + // 接收到消息 发送 + SendMsgVO sendMsgVO = new SendMsgVO(); + sendMsgVO.setFrom(userId); + sendMsgVO.setUsername(username); + sendMsgVO.setTo("all"); + sendMsgVO.setContent(sendMsgDTO.getContent()); + sendMsgVO.setExtras(null); + sendMsgVO.setOnlineNum(websocketService.getOnlineCount()); + websocketMsgPublisher.sendMsg(sendMsgVO); + } catch (Exception e) { + // 给发送人 推送发送错误信息 + log.error("发送的消息格式错误"); + // 发送消息 + String content = "发送的消息格式错误"; + SendMsgVO sendMsgVO = new SendMsgVO(); + sendMsgVO.setFrom(userId); + sendMsgVO.setUsername(username); + sendMsgVO.setTo(userId); + sendMsgVO.setContent(content); + sendMsgVO.setExtras(null); + sendMsgVO.setOnlineNum(websocketService.getOnlineCount()); + websocketMsgPublisher.sendMsg(sendMsgVO); + } + } + + + /** + * 上线 保存在线状态到本地 + * + * @param userId 用户id + * @param session 会话 + */ + private void onlineLocal(String userId, String username, Session session) { + if (CLIENTS.containsKey(userId)) { + // 保存已存在用户的 session 会话 + CLIENTS.get(userId).add(new OnlineUser(userId, username, session)); + } else { + // 保存用户 session 会话 + ArrayList onlineUsers = new ArrayList<>(); + onlineUsers.add(new OnlineUser(userId, username, session)); + CLIENTS.put(userId, onlineUsers); + } + } + + /** + * 上线 保存在线状态 Redis + * + * @param userId 用户id + * @param session 会话 + */ + private void onlineRedis(String userId, String username, Session session, Integer onlineCount) { + RedisUtil redisUtil = WebsocketSpringContextUtil.getBean(RedisUtil.class); + // 保存到 redis + boolean isUser = redisUtil.hHasKey(WebsocketConst.WEBSOCKET_CACHE_KEY, userId); + if (isUser) { + // 已存在, 多地登录追加重复登录用户信息到 redis 中 + List redisOnlineUsers = (List) redisUtil.hGet(WebsocketConst.WEBSOCKET_CACHE_KEY, userId); + redisOnlineUsers.add(new RedisOnlineUser(userId, username, session.getId())); + redisUtil.hPut(WebsocketConst.WEBSOCKET_CACHE_KEY, userId, redisOnlineUsers); + log.info("重复登录 !sessionId:{} userId:{} -> {} userName:{} 当前在线人数:{}", session.getId(), redisOnlineUsers.size(), userId, username, onlineCount); + } else { + // 保存用户到 redis 中 + ArrayList redisOnlineUsers = new ArrayList<>(); + redisOnlineUsers.add(new RedisOnlineUser(userId, username, session.getId())); + redisUtil.hPut(WebsocketConst.WEBSOCKET_CACHE_KEY, userId, redisOnlineUsers); + log.info("有新连接加入!sessionId:{} userId:{} userName:{} 当前在线人数:{}", session.getId(), userId, username, onlineCount + 1); + } + } + + + /** + * websocket 下线处理 + * session 连接状态 + */ + private void offLineLocal(String userId, Session session) { + // 剔除下线用户 (当前服务中剔除) + List onlineUsers = CLIENTS.get(userId); + // 删除当前 session 连接 + for (OnlineUser onlineUser : onlineUsers) { + if (onlineUser.getSession() == session) { + onlineUsers.remove(onlineUser); + break; + } + } + // 如果同一用户已不存在任意连接 + if (onlineUsers.size() == 0) { + CLIENTS.remove(userId); + } else { + CLIENTS.put(userId, onlineUsers); + } + } + + /** + * 从 redis 中移除用户在线状态 + * + * @param userId 用户id + * @param session 会话 + */ + private void offLineRedis(String userId, Session session) { + RedisUtil redisUtil = WebsocketSpringContextUtil.getBean(RedisUtil.class); + List redisOnlineUsers = (List) redisUtil.hGet(WebsocketConst.WEBSOCKET_CACHE_KEY, userId); + for (RedisOnlineUser redisOnlineUser : redisOnlineUsers) { + if (redisOnlineUser.getSessionId().equals(session.getId())) { + redisOnlineUsers.remove(redisOnlineUser); + break; + } + } + if (redisOnlineUsers.size() == 0) { + redisUtil.hDelete(WebsocketConst.WEBSOCKET_CACHE_KEY, userId); + } else { + redisUtil.hPut(WebsocketConst.WEBSOCKET_CACHE_KEY, userId, redisOnlineUsers); + } + } + + + /** + * 组装 消息通知需要的内容格式 + * + * @param title 通知标题 + * @param message 通知消息 + */ + private String assembleNoticeMsg(String title, String message) { + Map moticeMsgData = new HashMap<>(2); + Map moticeContent = new HashMap<>(4); + moticeContent.put("title", title); + moticeContent.put("message", message); + moticeMsgData.put("content", JSON.toJSONString(moticeContent)); + return JSON.toJSONString(moticeMsgData); + } +} \ No newline at end of file diff --git a/websocket/src/main/java/com/huoran/websocket/service/WebsocketService.java b/websocket/src/main/java/com/huoran/websocket/service/WebsocketService.java new file mode 100644 index 0000000..46a8931 --- /dev/null +++ b/websocket/src/main/java/com/huoran/websocket/service/WebsocketService.java @@ -0,0 +1,52 @@ +package com.huoran.websocket.service; + + +import com.huoran.websocket.model.dto.WebsocketMsgDTO; +import com.huoran.websocket.model.vo.OnlineUserVO; + +import java.util.Map; + +/** + * @author wangsong + * websocket 监听类(连接,断点,消息发送等) + *

+ * /websocket/{userId}/{username} = /websocket/用户Id/用户名 来连接websocket,该参数会带到每一个监听方法中 + *

+ */ +public interface WebsocketService { + + /** + * 发送消息 + * + * @param dto + * @version 1.0.0 + */ + void send(WebsocketMsgDTO dto); + + /** + * 获取当前在线列表 + * + * @return 用户map列表, ket = 用户id + * @version 1.0.0 + */ + Map getOnlineUsers(); + + /** + * 获取在线人数 + * + * @return int + * @version 1.0.0 + */ + Integer getOnlineCount(); + + + /**在线 + * 判断指定用户是否在线 + * @return true 在线 / false 不在线 + * @param userId 用户id + */ + boolean isOnline(String userId); + +} + + diff --git a/websocket/src/main/java/com/huoran/websocket/service/impl/WebsocketServiceImpl.java b/websocket/src/main/java/com/huoran/websocket/service/impl/WebsocketServiceImpl.java new file mode 100644 index 0000000..cdb3246 --- /dev/null +++ b/websocket/src/main/java/com/huoran/websocket/service/impl/WebsocketServiceImpl.java @@ -0,0 +1,78 @@ +package com.huoran.websocket.service.impl; + + +import com.huoran.websocket.constant.WebsocketConst; +import com.huoran.websocket.model.dto.WebsocketMsgDTO; +import com.huoran.websocket.model.vo.OnlineUserVO; +import com.huoran.websocket.model.vo.SendMsgVO; +import com.huoran.websocket.service.WebsocketService; +import com.huoran.websocket.topic.WebsocketMsgPublisher; +import com.huoran.websocket.util.RedisUtil; +import com.huoran.websocket.util.WebsocketSpringContextUtil; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.HashMap; +import java.util.Map; + + +/** + * @author wangsong + * websocket 监听类(连接,断点,消息发送等) + *

+ * /websocket/{userId}/{username} = /websocket/用户Id/用户名 来连接websocket,该参数会带到每一个监听方法中 + *

+ * @ServerEndpoint: socket链接地址 + */ +@Service +public class WebsocketServiceImpl implements WebsocketService { + + @Autowired + private WebsocketMsgPublisher msgPublisher; + + + @Override + public void send(WebsocketMsgDTO dto) { + SendMsgVO sendMsgVO = new SendMsgVO(); + sendMsgVO.setFrom(dto.getForm()); + sendMsgVO.setUsername(dto.getUsername()); + sendMsgVO.setTo(dto.getTo()); + sendMsgVO.setContent(dto.getContent()); + sendMsgVO.setExtras(dto.getExtras()); + sendMsgVO.setOnlineNum(this.getOnlineCount()); + DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + sendMsgVO.setCreateTime(df.format(LocalDateTime.now())); + // 发送 redis 订阅消息 + msgPublisher.sendMsg(sendMsgVO); + } + + @Override + public Map getOnlineUsers() { + RedisUtil redisUtil = WebsocketSpringContextUtil.getBean(RedisUtil.class); + Map objectObjectMap = redisUtil.hEntries(WebsocketConst.WEBSOCKET_CACHE_KEY); + Map map = new HashMap<>(4); + for (Object key : objectObjectMap.keySet()) { + OnlineUserVO vo = new OnlineUserVO(); + BeanUtils.copyProperties(objectObjectMap.get(key), vo); + map.put(key, vo); + } + return map; + } + + @Override + public Integer getOnlineCount() { + RedisUtil redisUtil = WebsocketSpringContextUtil.getBean(RedisUtil.class); + Long count = redisUtil.hSize(WebsocketConst.WEBSOCKET_CACHE_KEY); + return Integer.parseInt(count + ""); + } + + + @Override + public boolean isOnline(String userId) { + RedisUtil redisUtil = WebsocketSpringContextUtil.getBean(RedisUtil.class); + return redisUtil.hHasKey(WebsocketConst.WEBSOCKET_CACHE_KEY, userId); + } +} \ No newline at end of file diff --git a/websocket/src/main/java/com/huoran/websocket/topic/PubConfig.java b/websocket/src/main/java/com/huoran/websocket/topic/PubConfig.java new file mode 100644 index 0000000..546f1de --- /dev/null +++ b/websocket/src/main/java/com/huoran/websocket/topic/PubConfig.java @@ -0,0 +1,23 @@ +package com.huoran.websocket.topic; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.redis.listener.ChannelTopic; + +/** + * 发布者配置 + @author wangsong + @date 2023/05/17 + */ +@Configuration +public class PubConfig { + + /** + * 订阅发布的主题 + * @return + */ + @Bean + public ChannelTopic topic() { + return new ChannelTopic("pubsub:queue-websocket"); + } +} diff --git a/websocket/src/main/java/com/huoran/websocket/topic/SubConfig.java b/websocket/src/main/java/com/huoran/websocket/topic/SubConfig.java new file mode 100644 index 0000000..60066c2 --- /dev/null +++ b/websocket/src/main/java/com/huoran/websocket/topic/SubConfig.java @@ -0,0 +1,37 @@ +package com.huoran.websocket.topic; + +import com.huoran.websocket.server.WebsocketServer; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Primary; +import org.springframework.data.redis.connection.RedisConnectionFactory; +import org.springframework.data.redis.listener.ChannelTopic; +import org.springframework.data.redis.listener.RedisMessageListenerContainer; +import org.springframework.data.redis.listener.adapter.MessageListenerAdapter; + +/** + * 订阅者配置 + * @author wangsong + * @date 2023/05/17 + */ +@Configuration +public class SubConfig { + + @Autowired + private WebsocketServer websocketServer; + + @Bean + public MessageListenerAdapter messageListener() { + return new MessageListenerAdapter(new WebsocketMsgListener(websocketServer)); + } + + @Bean + @Primary + public RedisMessageListenerContainer redisContainer(RedisConnectionFactory factory) { + RedisMessageListenerContainer container = new RedisMessageListenerContainer(); + container.setConnectionFactory(factory); + container.addMessageListener(messageListener(), new ChannelTopic("pubsub:queue-websocket")); + return container; + } +} diff --git a/websocket/src/main/java/com/huoran/websocket/topic/WebsocketMsgListener.java b/websocket/src/main/java/com/huoran/websocket/topic/WebsocketMsgListener.java new file mode 100644 index 0000000..de895cf --- /dev/null +++ b/websocket/src/main/java/com/huoran/websocket/topic/WebsocketMsgListener.java @@ -0,0 +1,35 @@ +package com.huoran.websocket.topic; + +import com.alibaba.fastjson.JSON; +import com.huoran.websocket.model.vo.SendMsgVO; +import com.huoran.websocket.server.OpenWebSocketApi; +import com.huoran.websocket.server.WebsocketServer; +import org.springframework.data.redis.connection.Message; +import org.springframework.data.redis.connection.MessageListener; +import org.springframework.stereotype.Component; + +/** + * 订阅者 + *@author wangsong + * @date 2023/05/17 + */ +@Component +public class WebsocketMsgListener implements MessageListener { + + private WebsocketServer websocketServer; + + public WebsocketMsgListener(WebsocketServer websocketServer) { + this.websocketServer = websocketServer; + } + + + @Override + public void onMessage(Message message, byte[] pattern) { + String messageStr = new String(message.getBody()); + SendMsgVO sendMsgVO = JSON.parseObject(messageStr, SendMsgVO.class); + + // 发送消息 + OpenWebSocketApi.send(sendMsgVO); + } +} + diff --git a/websocket/src/main/java/com/huoran/websocket/topic/WebsocketMsgPublisher.java b/websocket/src/main/java/com/huoran/websocket/topic/WebsocketMsgPublisher.java new file mode 100644 index 0000000..5a9da55 --- /dev/null +++ b/websocket/src/main/java/com/huoran/websocket/topic/WebsocketMsgPublisher.java @@ -0,0 +1,28 @@ +package com.huoran.websocket.topic; + +import com.huoran.websocket.model.vo.SendMsgVO; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.listener.ChannelTopic; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; + +/**websocket味精出版商 + * 发布者 + * @author wangsong + * @date 2023/05/17 + */ +@Component +public class WebsocketMsgPublisher { + + @Resource + private RedisTemplate redisTemplate; + + @Resource + private ChannelTopic topic; + + public void sendMsg(SendMsgVO sendMsgVO ) { + redisTemplate.convertAndSend(topic.getTopic(), sendMsgVO); + } + +} diff --git a/websocket/src/main/java/com/huoran/websocket/util/RedisUtil.java b/websocket/src/main/java/com/huoran/websocket/util/RedisUtil.java new file mode 100644 index 0000000..c62d67a --- /dev/null +++ b/websocket/src/main/java/com/huoran/websocket/util/RedisUtil.java @@ -0,0 +1,641 @@ +package com.huoran.websocket.util; + + +import lombok.extern.slf4j.Slf4j; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; + +import javax.annotation.Resource; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.concurrent.TimeUnit; + +@SuppressWarnings("all") +@Component +@Slf4j +public class RedisUtil { + + @Resource + private RedisTemplate redisTemplate; + + + + /** + * 指定缓存失效时间 + * + * @param key 键 + * @param time 时间(秒) + * @return + */ + public boolean expire(String key, long time) { + try { + if (time > 0) { + redisTemplate.expire(key, time, TimeUnit.SECONDS); + } + return true; + } catch (Exception e) { + log.error(e.toString()); + return false; + } + } + + /** + * 根据key 获取过期时间 + * + * @param key 键 不能为null + * @return 时间(秒) 返回0代表为永久有效 + */ + public long getExpire(String key) { + return redisTemplate.getExpire(key, TimeUnit.SECONDS); + } + + /** + * 判断key是否存在 + * + * @param key 键 + * @return true 存在 false不存在 + */ + public boolean hasKey(String key) { + try { + return redisTemplate.hasKey(key); + } catch (Exception e) { + log.error(e.toString()); + return false; + } + } + + /** + * 删除缓存 + * + * @param key 可以传一个值 或多个 + */ + public void delete(String... key) { + if (key != null && key.length > 0) { + if (key.length == 1) { + redisTemplate.delete(key[0]); + } else { + redisTemplate.delete((Collection) CollectionUtils.arrayToList(key)); + } + } + } + + /** + * 删除缓存 + * + * @param key 可以传一个值 或多个 + */ + public void delete(Set keys) { + if (keys != null && !keys.isEmpty()) { + redisTemplate.delete(keys); + } + } + + //============================String============================= + + /** + * 普通缓存获取 + * + * @param key 键 + * @return 值 + */ + public Object get(String key) { + return key == null ? null : redisTemplate.opsForValue().get(key); + } + + + /** + * 根据前缀获取所有的key + * 例如:pro_* + */ + public Set getListKey(String prefix) { + Set keys = redisTemplate.keys(prefix + "*"); + return keys; + } + + + /** + * 普通缓存放入 + * + * @param key 键 + * @param value 值 + * @return true成功 false失败 + */ + public boolean set(String key, Object value) { + try { + redisTemplate.opsForValue().set(key, value); + return true; + } catch (Exception e) { + log.error(e.toString()); + return false; + } + } + + + /** + * 普通缓存放入并设置时间 + * + * @param key 键 + * @param value 值 + * @param time 时间(秒) time要大于0 如果time小于等于0 将设置无限期 + * @return true成功 false 失败 + */ + public boolean set(String key, Object value, long time) { + try { + if (time > 0) { + redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS); + } else { + set(key, value); + } + return true; + } catch (Exception e) { + log.error(e.toString()); + return false; + } + } + + /** + * 递增 或 递减 + * + * @param key 键 + * @param delta 要增加或减少几(+正数 -负数) + * @return + */ + public long increment(String key, long delta) { + return redisTemplate.opsForValue().increment(key, delta); + } + + + //================================Map================================= + + /** + * HashGet + * + * @param key 键 不能为null + * @param item 项 不能为null + * @return 值 + */ + public Object hGet(String key, String item) { + return redisTemplate.opsForHash().get(key, item); + } + + /** + * 获取hashKey对应的所有键值 + * + * @param key 键 + * @return 对应的多个键值 + */ + public Map hEntries(String key) { + return redisTemplate.opsForHash().entries(key); + } + + /** + * 获取hashKey对应的数据量 + * + * @param key 键 + * @return 对应的多个键值 + */ + public Long hSize(String key) { + return redisTemplate.opsForHash().size(key); + } + + /** + * HashSet + * + * @param key 键 + * @param map 对应多个键值 + * @return true 成功 false 失败 + */ + public boolean hPutAll(String key, Map map) { + try { + redisTemplate.opsForHash().putAll(key, map); + return true; + } catch (Exception e) { + log.error(e.toString()); + return false; + } + } + + /** + * HashSet 并设置时间 + * + * @param key 键 + * @param map 对应多个键值 + * @param time 时间(秒) + * @return true成功 false失败 + */ + public boolean hPutAll(String key, Map map, long time) { + try { + redisTemplate.opsForHash().putAll(key, map); + if (time > 0) { + expire(key, time); + } + return true; + } catch (Exception e) { + log.error(e.toString()); + return false; + } + } + + /** + * 向一张hash表中放入数据,如果不存在将创建 + * + * @param key 键 + * @param item 项 + * @param value 值 + * @return true 成功 false失败 + */ + public boolean hPut(String key, String item, Object value) { + try { + redisTemplate.opsForHash().put(key, item, value); + return true; + } catch (Exception e) { + log.error(e.toString()); + return false; + } + } + + /** + * 向一张hash表中放入数据,如果不存在将创建 + * + * @param key 键 + * @param item 项 + * @param value 值 + * @param time 时间(秒) 注意:如果已存在的hash表有时间,这里将会替换原有的时间 + * @return true 成功 false失败 + */ + public boolean hPut(String key, String item, Object value, long time) { + try { + redisTemplate.opsForHash().put(key, item, value); + if (time > 0) { + expire(key, time); + } + return true; + } catch (Exception e) { + log.error(e.toString()); + return false; + } + } + + /** + * 删除hash表中的值 + * + * @param key 键 不能为null + * @param item 项 可以使多个 不能为null + */ + public void hDelete(String key, Object... item) { + redisTemplate.opsForHash().delete(key, item); + } + + /** + * 判断hash表中是否有该项的值 + * + * @param key 键 不能为null + * @param item 项 不能为null + * @return true 存在 false不存在 + */ + public boolean hHasKey(String key, String item) { + return redisTemplate.opsForHash().hasKey(key, item); + } + + /** + * hash递增 如果不存在,就会创建一个 并把新增后的值返回 + * + * @param key 键 + * @param item 项 + * @param by 要增加或减少几(+ 正数 -负数) + * @return + */ + public double hIncrement(String key, String item, double by) { + return redisTemplate.opsForHash().increment(key, item, by); + } + + + //============================set============================= + + /** + * 根据key获取Set中的所有值 + * + * @param key 键 + * @return + */ + public Set sMembers(String key) { + try { + return redisTemplate.opsForSet().members(key); + } catch (Exception e) { + log.error(e.toString()); + return null; + } + } + + /** + * 根据value从一个set中查询,是否存在 + * + * @param key 键 + * @param value 值 + * @return true 存在 false不存在 + */ + public boolean sIsMember(String key, Object value) { + try { + return redisTemplate.opsForSet().isMember(key, value); + } catch (Exception e) { + log.error(e.toString()); + return false; + } + } + + /** + * 将数据放入set缓存 + * + * @param key 键 + * @param values 值 可以是多个 + * @return 成功个数 + */ + public long sAdd(String key, Object... values) { + try { + return redisTemplate.opsForSet().add(key, values); + } catch (Exception e) { + log.error(e.toString()); + return 0; + } + } + + /** + * 将set数据放入缓存 + * + * @param key 键 + * @param time 时间(秒) + * @param values 值 可以是多个 + * @return 成功个数 + */ + public long sAdd(String key, long time, Object... values) { + try { + Long count = redisTemplate.opsForSet().add(key, values); + if (time > 0) { + expire(key, time); + } + return count; + } catch (Exception e) { + log.error(e.toString()); + return 0; + } + } + + /** + * 获取set缓存的长度 + * + * @param key 键 + * @return + */ + public long sSize(String key) { + try { + return redisTemplate.opsForSet().size(key); + } catch (Exception e) { + log.error(e.toString()); + return 0; + } + } + + /** + * 移除值为value的 + * + * @param key 键 + * @param values 值 可以是多个 + * @return 移除的个数 + */ + public long sRemove(String key, Object... values) { + try { + Long count = redisTemplate.opsForSet().remove(key, values); + return count; + } catch (Exception e) { + log.error(e.toString()); + return 0; + } + } + + + //===============================list================================= + + /** + * 获取list缓存的内容 + * + * @param key 键 + * @param start 开始 + * @param end 结束 0 到 -1代表所有值 + * @return + */ + public List lRange(String key, long start, long end) { + try { + return redisTemplate.opsForList().range(key, start, end); + } catch (Exception e) { + log.error(e.toString()); + return null; + } + } + + /** + * 获取list缓存的长度 + * + * @param key 键 + * @return + */ + public long lSize(String key) { + try { + return redisTemplate.opsForList().size(key); + } catch (Exception e) { + log.error(e.toString()); + return 0; + } + } + + /** + * 通过索引 获取list中的值 + * + * @param key 键 + * @param index 索引 index>=0时, 0 表头,1 第二个元素,依次类推;index<0时,-1,表尾,-2倒数第二个元素,依次类推 + * @return + */ + public Object lIndex(String key, long index) { + try { + return redisTemplate.opsForList().index(key, index); + } catch (Exception e) { + log.error(e.toString()); + return null; + } + } + + /** + * 将list放入缓存 + * + * @param key 键 + * @param value 值 + * @param time 时间(秒) + * @return + */ + public boolean lRightPush(String key, Object value) { + try { + redisTemplate.opsForList().rightPush(key, value); + return true; + } catch (Exception e) { + log.error(e.toString()); + return false; + } + } + + /** + * 将list放入缓存 + * + * @param key 键 + * @param value 值 + * @param time 时间(秒) + * @return + */ + public boolean lRightPush(String key, Object value, long time) { + try { + redisTemplate.opsForList().rightPush(key, value); + if (time > 0) { + expire(key, time); + } + return true; + } catch (Exception e) { + log.error(e.toString()); + return false; + } + } + + /** + * 将list放入缓存 + * + * @param key 键 + * @param value 值 + * @param time 时间(秒) + * @return + */ + public boolean lRightPushAll(String key, List value) { + try { + redisTemplate.opsForList().rightPushAll(key, value); + return true; + } catch (Exception e) { + log.error(e.toString()); + return false; + } + } + + /** + * 将list放入缓存 + * + * @param key 键 + * @param value 值 + * @param time 时间(秒) + * @return + */ + public boolean lRightPushAll(String key, List value, long time) { + try { + redisTemplate.opsForList().rightPushAll(key, value); + if (time > 0) { + expire(key, time); + } + return true; + } catch (Exception e) { + log.error(e.toString()); + return false; + } + } + + /** + * 根据索引修改list中的某条数据 + * + * @param key 键 + * @param index 索引 + * @param value 值 + * @return + */ + public boolean lSet(String key, long index, Object value) { + try { + redisTemplate.opsForList().set(key, index, value); + return true; + } catch (Exception e) { + log.error(e.toString()); + return false; + } + } + + /** + * 移除N个值为value + * + * @param key 键 + * @param count 移除多少个 + * @param value 值 + * @return 移除的个数 + */ + public long lRemove(String key, long count, Object value) { + try { + Long remove = redisTemplate.opsForList().remove(key, count, value); + return remove; + } catch (Exception e) { + log.error(e.toString()); + return 0; + } + } + + + /** + * 生成分布式 各类订单号 + *

+ * 获取20位的各类订单号, 【yyyyMMddHHmmss + 6位秒级自增值 (同一个key最高支持1秒生成999999个订单编号)】 + *

+ * + * @param redisKey redis唯一编号的缓存key, 用于实现编号自增长, 不同的订单号使用不同redisKey, 如商品订单号为【goods-order-no】,支付订单号为【pay-order-no】 + * @return + */ + public String getOrderNo(String redisKey) { + return this.getNo(redisKey, "", "yyyyMMddHHmmss", 6, 1L); + } + + /** + * 生成分布式 各类数据编号 + *

+ * 获取自定义前缀 + 6位的各类数据编号, 【日(01-31)+秒(00-59) + 2位秒级自增值】 (同一个key最高1秒支持99个不重复数据编号,允许超过,超过后编号位数将增加(秒级,下一秒的编号恢复正常位数)) + *

+ * + * @param redisKey redis唯一编号的缓存key, 用于实现编号自增长, 不同的数据号使用不同redisKey, 如用户为【uset-data-no】,部门为【dep-data-no】 + * @param noPrefix 生成后的编号前缀: 如:用户唯一编号使用前缀【YB】-生成后编号格式为【YB012401】 + * @return + */ + public String getDataNo(String redisKey, String noPrefix) { + return this.getNo(redisKey, noPrefix, "ddss", 2, 1L); + } + + + /** + * 获取唯一编号 + *

+ * 分布式架构获取唯一编号(基于redis)--> 订单号,交易号,退款号等等 + * 如果需要 redis 集群,需设置自增歩长,请使用命令设置或使用其他方法规避 + *

+ * + * @param redisKey redis-缓存key前缀 实际key等于前缀+每秒时间戳 (同一秒delta 自增,下一秒根据时间戳生成新的key,delta重新计算) + * @param noPrefix 编号前缀 实际编号开头 + * @param incrementLen 自增值位数 + * @param format 时间格式: 格式 yyyyMMddHHmmssSSS,必须存在ss秒的单位,否则可能会生成重复的编号 + * @param delta 默认初始自增值 + * *** 2019-10-20 12:00:01 000001 --> 20191020120001000001,20191020120001000002,20191020120001000003...... + * *** 2019-10-20 12:00:02 000001 --> 20191020120002000001,20191020120002000002,20191020120002000003...... + * @return java.lang.String + * @author ws + * @mail 1720696548@qq.com + * @date 2020/2/20 0020 15:59 + */ + public String getNo(String redisKey, String noPrefix, String format, Integer incrementLen, Long delta) { + // 生成14位的时间戳(每秒使用新的时间戳当key) + String timeStamp = new SimpleDateFormat(format).format(new Date()); + // 获得redis-key + String newKey = redisKey + ":" + timeStamp; + // 获取自增值(时间戳+自定义key) + Long increment = redisTemplate.opsForValue().increment(newKey, delta); + // 设置时间戳生成的key的有效期为2秒, 删除已无用的key + redisTemplate.expire(newKey, 2, TimeUnit.SECONDS); + // 获取订单号,时间戳 + 唯一自增Id(6位数,不过前方补0) + return noPrefix + timeStamp + String.format("%0" + incrementLen + "d", increment); + } +} diff --git a/websocket/src/main/java/com/huoran/websocket/util/WebsocketSpringContextUtil.java b/websocket/src/main/java/com/huoran/websocket/util/WebsocketSpringContextUtil.java new file mode 100644 index 0000000..11b5f6c --- /dev/null +++ b/websocket/src/main/java/com/huoran/websocket/util/WebsocketSpringContextUtil.java @@ -0,0 +1,81 @@ +package com.huoran.websocket.util; + +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.stereotype.Component; + +/** + * @author wangsong + */ +@Component +public class WebsocketSpringContextUtil implements ApplicationContextAware { + + /** + * 上下文对象实例 + */ + private static ApplicationContext applicationContext; + + @Override + @Autowired + public void setApplicationContext(ApplicationContext inApplicationContext) throws BeansException { + applicationContext = inApplicationContext; + } + + /** + * 获取applicationContext + * + * @return + */ + public static ApplicationContext getApplicationContext() { + return applicationContext; + } + + /** + * 通过name获取 Bean. + * + * @param name + * @return + */ + public static Object getBean(String name) { + return getApplicationContext().getBean(name); + } + + /** + * 通过class获取Bean. + * + * @param clazz + * @param + * @return + */ + public static T getBean(Class clazz) { + return getApplicationContext().getBean(clazz); + } + + /** + * 通过name,以及Clazz返回指定的Bean + * + * @param name + * @param clazz + * @param + * @return + */ + public static T getBean(String name, Class clazz) { + return getApplicationContext().getBean(name, clazz); + } + + + /** + * 获取当前启动环境 + * @return + */ + public static String getActiveProfile() { + String[] activeProfiles = getApplicationContext().getEnvironment().getActiveProfiles(); + if (activeProfiles.length == 0) { + return null; + } + return activeProfiles[0]; + } + +} \ No newline at end of file diff --git a/websocket/src/main/resources/application.yml b/websocket/src/main/resources/application.yml new file mode 100644 index 0000000..9587004 --- /dev/null +++ b/websocket/src/main/resources/application.yml @@ -0,0 +1,24 @@ +## 服务 +server: + port: 9999 + +spring: +# redis 配置 + redis: + redisson: + file: classpath:redisson.yml + +## swagger配置 +#swagger: +# ## (模块名称 | 扫包路径),最多可配置10个 +# packages: +# - "websocket测试接口 | io.github.wslxm.springbootplus2.websocket.controller" +# author: wangsong # 作者/负责人-姓名 +# email: 1270696548@qq.com # 作者/负责人-邮箱 +# url: https://gitee.com/wslxm/spring-boot-plus2 # 作者/负责人-个人社交地址 +# termsOfServiceUrl: # 服务条款-访问地址 +# version: 2.0.0 # 版本号 +# defaultKey: TOKEN # 默认请求头key +# defaultValue: token # 默认请求头值-当为token时,可以访问任意接口, 但接口中存在获取token用户信息时,将返回jwt解析错误 +# isShow: true # 是否开启文档 true展示 false隐藏 + diff --git a/websocket/src/main/resources/redisson.yml b/websocket/src/main/resources/redisson.yml new file mode 100644 index 0000000..f044040 --- /dev/null +++ b/websocket/src/main/resources/redisson.yml @@ -0,0 +1,39 @@ +## 单节点配置 +#singleServerConfig: +# # 节点地址 / 密码 / 数据库编号 +# address: redis://127.0.0.1:6379 +## password: +# database: 1 +# # 连接空闲超时,单位:毫秒 +# idleConnectionTimeout: 10000 +# # 连接超时,单位:毫秒 +# connectTimeout: 10000 +# # 命令等待超时,单位:毫秒 +# timeout: 3000 +# # 命令失败重试次数,如果尝试达到 retryAttempts(命令失败重试次数) 仍然不能将命令发送至某个指定的节点时,将抛出错误。 +# # 如果尝试在此限制之内发送成功,则开始启用 timeout(命令等待超时) 计时。 +# retryAttempts: 3 +# # 命令重试发送时间间隔,单位:毫秒 +# retryInterval: 1500 +# # 单个连接最大订阅数量 +# subscriptionsPerConnection: 5 +# # 客户端名称 +# clientName: axin +# # 发布和订阅连接的最小空闲连接数 +# subscriptionConnectionMinimumIdleSize: 1 +# # 发布和订阅连接池大小 +# subscriptionConnectionPoolSize: 5 +# # 最小空闲连接数 +# connectionMinimumIdleSize: 4 +# # 连接池大小 +# connectionPoolSize: 8 +# # DNS监测时间间隔,单位:毫秒 +# dnsMonitoringInterval: 5000 +## 线程池数量,默认值: 当前处理核数量 * 2 +##threads: 0 +## Netty线程池数量,默认值: 当前处理核数量 * 2 +##nettyThreads: 0 +## 编码 +#codec: ! {} +## 传输模式 +#transportMode: "NIO" \ No newline at end of file