Commit b0c4f68b by aye

代码提交

parent f342210e
<component name="libraryTable">
<library name="Maven: com.alibaba:fastjson:1.2.54">
<CLASSES>
<root url="jar://D:/Tool/apache-maven-3.3.1/maven-repository/com/alibaba/fastjson/1.2.54/fastjson-1.2.54.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://D:/Tool/apache-maven-3.3.1/maven-repository/com/alibaba/fastjson/1.2.54/fastjson-1.2.54-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://D:/Tool/apache-maven-3.3.1/maven-repository/com/alibaba/fastjson/1.2.54/fastjson-1.2.54-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
...@@ -168,6 +168,7 @@ ...@@ -168,6 +168,7 @@
<orderEntry type="library" name="Maven: org.json:json:20170516" level="project" /> <orderEntry type="library" name="Maven: org.json:json:20170516" level="project" />
<orderEntry type="library" name="Maven: org.modelmapper:modelmapper:2.3.2" level="project" /> <orderEntry type="library" name="Maven: org.modelmapper:modelmapper:2.3.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.16.22" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.16.22" level="project" />
<orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.54" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-test:2.0.6.RELEASE" level="project" /> <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-test:2.0.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-test:2.0.6.RELEASE" level="project" /> <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-test:2.0.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-test-autoconfigure:2.0.6.RELEASE" level="project" /> <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-test-autoconfigure:2.0.6.RELEASE" level="project" />
......
package com.jty.wsxt.application.service; package com.jty.wsxt.application.service;
import com.jty.wsxt.domain.model.auth.role.AuthRole; import com.jty.wsxt.domain.model.auth.role.AuthRole;
import com.jty.nrsc.interfaces.dto.AuthRoleDto; import com.jty.wsxt.interfaces.dto.AuthRoleDto;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
/** /**
......
package com.jty.wsxt.application.service; package com.jty.wsxt.application.service;
import com.jty.wsxt.domain.model.auth.history.AuthUserHistory; import com.jty.wsxt.domain.model.auth.history.AuthUserHistory;
import com.jty.nrsc.interfaces.dto.AuthUserHistoryDto; import com.jty.wsxt.interfaces.dto.AuthUserHistoryDto;
import com.jty.nrsc.interfaces.dto.OperatorDto; import com.jty.wsxt.interfaces.dto.OperatorDto;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
/** /**
......
...@@ -2,9 +2,9 @@ package com.jty.wsxt.application.service; ...@@ -2,9 +2,9 @@ package com.jty.wsxt.application.service;
import com.jty.wsxt.domain.model.auth.user.nrsc.NrscTeacher; import com.jty.wsxt.domain.model.auth.user.nrsc.NrscTeacher;
import com.jty.nrsc.interfaces.dto.NrscTeacherDto; import com.jty.wsxt.interfaces.dto.NrscTeacherDto;
import com.jty.nrsc.interfaces.dto.NrscTeacherSearchDto; import com.jty.wsxt.interfaces.dto.NrscTeacherSearchDto;
import com.jty.nrsc.interfaces.dto.OperatorDto; import com.jty.wsxt.interfaces.dto.OperatorDto;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
/** /**
......
...@@ -4,9 +4,9 @@ import com.jty.wsxt.application.service.AuthRoleServer; ...@@ -4,9 +4,9 @@ import com.jty.wsxt.application.service.AuthRoleServer;
import com.jty.wsxt.domain.DomainRegistry; import com.jty.wsxt.domain.DomainRegistry;
import com.jty.wsxt.domain.model.auth.authority.AuthAuthority; import com.jty.wsxt.domain.model.auth.authority.AuthAuthority;
import com.jty.wsxt.domain.model.auth.role.AuthRole; import com.jty.wsxt.domain.model.auth.role.AuthRole;
import com.jty.nrsc.infrastructure.support.BusinessException; import com.jty.wsxt.infrastructure.support.BusinessException;
import com.jty.nrsc.infrastructure.support.ResultCode; import com.jty.wsxt.infrastructure.support.ResultCode;
import com.jty.nrsc.interfaces.dto.AuthRoleDto; import com.jty.wsxt.interfaces.dto.AuthRoleDto;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.springframework.data.domain.Example; import org.springframework.data.domain.Example;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
......
...@@ -4,11 +4,11 @@ import com.jty.wsxt.application.service.AuthUserServer; ...@@ -4,11 +4,11 @@ import com.jty.wsxt.application.service.AuthUserServer;
import com.jty.wsxt.domain.DomainRegistry; import com.jty.wsxt.domain.DomainRegistry;
import com.jty.wsxt.domain.model.auth.history.*; import com.jty.wsxt.domain.model.auth.history.*;
import com.jty.wsxt.domain.model.auth.user.AuthUser; import com.jty.wsxt.domain.model.auth.user.AuthUser;
import com.jty.nrsc.infrastructure.DomainEventPublisher; import com.jty.wsxt.infrastructure.DomainEventPublisher;
import com.jty.nrsc.infrastructure.support.BusinessException; import com.jty.wsxt.infrastructure.support.BusinessException;
import com.jty.nrsc.infrastructure.support.ResultCode; import com.jty.wsxt.infrastructure.support.ResultCode;
import com.jty.nrsc.interfaces.dto.AuthUserHistoryDto; import com.jty.wsxt.interfaces.dto.AuthUserHistoryDto;
import com.jty.nrsc.interfaces.dto.OperatorDto; import com.jty.wsxt.interfaces.dto.OperatorDto;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example; import org.springframework.data.domain.Example;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
......
...@@ -8,11 +8,11 @@ import com.jty.wsxt.domain.model.auth.user.AuthUser; ...@@ -8,11 +8,11 @@ import com.jty.wsxt.domain.model.auth.user.AuthUser;
import com.jty.wsxt.domain.model.auth.user.nrsc.NrscTeacher; import com.jty.wsxt.domain.model.auth.user.nrsc.NrscTeacher;
import com.jty.wsxt.domain.model.stage.BasicStage; import com.jty.wsxt.domain.model.stage.BasicStage;
import com.jty.wsxt.domain.model.subject.BasicSubject; import com.jty.wsxt.domain.model.subject.BasicSubject;
import com.jty.nrsc.infrastructure.support.BusinessException; import com.jty.wsxt.infrastructure.support.BusinessException;
import com.jty.nrsc.infrastructure.support.ResultCode; import com.jty.wsxt.infrastructure.support.ResultCode;
import com.jty.nrsc.interfaces.dto.NrscTeacherDto; import com.jty.wsxt.interfaces.dto.NrscTeacherDto;
import com.jty.nrsc.interfaces.dto.NrscTeacherSearchDto; import com.jty.wsxt.interfaces.dto.NrscTeacherSearchDto;
import com.jty.nrsc.interfaces.dto.OperatorDto; import com.jty.wsxt.interfaces.dto.OperatorDto;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.hibernate.query.criteria.internal.OrderImpl; import org.hibernate.query.criteria.internal.OrderImpl;
......
package com.jty.wsxt.domain.model.auth.history; package com.jty.wsxt.domain.model.auth.history;
import com.jty.wsxt.domain.DomainRegistry;
import com.jty.wsxt.domain.model.auth.user.DisableUserEvent; import com.jty.wsxt.domain.model.auth.user.DisableUserEvent;
import com.jty.nrsc.infrastructure.DomainEventSubscriber; import com.jty.wsxt.infrastructure.DomainEventSubscriber;
/** /**
* DisableUserSubscriber * DisableUserSubscriber
......
package com.jty.wsxt.domain.model.auth.history; package com.jty.wsxt.domain.model.auth.history;
import com.jty.wsxt.domain.model.auth.user.EnableUserEvent; import com.jty.wsxt.domain.model.auth.user.EnableUserEvent;
import com.jty.nrsc.infrastructure.DomainEventSubscriber; import com.jty.wsxt.infrastructure.DomainEventSubscriber;
/** /**
* 说明 * 说明
......
...@@ -4,8 +4,8 @@ import com.jty.wsxt.domain.DomainRegistry; ...@@ -4,8 +4,8 @@ import com.jty.wsxt.domain.DomainRegistry;
import com.jty.wsxt.domain.model.auth.user.AuthUser; import com.jty.wsxt.domain.model.auth.user.AuthUser;
import com.jty.wsxt.domain.model.auth.authority.AuthAuthority; import com.jty.wsxt.domain.model.auth.authority.AuthAuthority;
import com.jty.wsxt.domain.shared.IdentifiedEntityObject; import com.jty.wsxt.domain.shared.IdentifiedEntityObject;
import com.jty.nrsc.infrastructure.support.BusinessException; import com.jty.wsxt.infrastructure.support.BusinessException;
import com.jty.nrsc.infrastructure.support.ResultCode; import com.jty.wsxt.infrastructure.support.ResultCode;
import lombok.Data; import lombok.Data;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
......
...@@ -4,10 +4,10 @@ import com.jty.wsxt.domain.DomainRegistry; ...@@ -4,10 +4,10 @@ import com.jty.wsxt.domain.DomainRegistry;
import com.jty.wsxt.domain.model.auth.role.AuthRole; import com.jty.wsxt.domain.model.auth.role.AuthRole;
import com.jty.wsxt.domain.model.auth.history.ManagerId; import com.jty.wsxt.domain.model.auth.history.ManagerId;
import com.jty.wsxt.domain.shared.IdentifiedEntityObject; import com.jty.wsxt.domain.shared.IdentifiedEntityObject;
import com.jty.nrsc.infrastructure.DomainEventPublisher; import com.jty.wsxt.infrastructure.DomainEventPublisher;
import com.jty.nrsc.infrastructure.support.BusinessException; import com.jty.wsxt.infrastructure.support.BusinessException;
import com.jty.nrsc.infrastructure.support.ResultCode; import com.jty.wsxt.infrastructure.support.ResultCode;
import com.jty.nrsc.interfaces.dto.OperatorDto; import com.jty.wsxt.interfaces.dto.OperatorDto;
import lombok.Data; import lombok.Data;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
......
package com.jty.wsxt.domain.model.auth.user; package com.jty.wsxt.domain.model.auth.user;
import com.jty.wsxt.domain.model.auth.history.ManagerId; import com.jty.wsxt.domain.model.auth.history.ManagerId;
import com.jty.nrsc.infrastructure.DomainEvent; import com.jty.wsxt.infrastructure.DomainEvent;
import com.jty.nrsc.interfaces.dto.OperatorDto; import com.jty.wsxt.interfaces.dto.OperatorDto;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
......
package com.jty.wsxt.domain.model.auth.user; package com.jty.wsxt.domain.model.auth.user;
import com.jty.wsxt.domain.model.auth.history.ManagerId; import com.jty.wsxt.domain.model.auth.history.ManagerId;
import com.jty.nrsc.infrastructure.DomainEvent; import com.jty.wsxt.infrastructure.DomainEvent;
import com.jty.nrsc.interfaces.dto.OperatorDto; import com.jty.wsxt.interfaces.dto.OperatorDto;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
......
...@@ -5,8 +5,8 @@ import com.jty.wsxt.domain.model.auth.user.AuthUser; ...@@ -5,8 +5,8 @@ import com.jty.wsxt.domain.model.auth.user.AuthUser;
import com.jty.wsxt.domain.model.stage.BasicStage; import com.jty.wsxt.domain.model.stage.BasicStage;
import com.jty.wsxt.domain.model.subject.BasicSubject; import com.jty.wsxt.domain.model.subject.BasicSubject;
import com.jty.wsxt.domain.shared.IdentifiedEntityObject; import com.jty.wsxt.domain.shared.IdentifiedEntityObject;
import com.jty.nrsc.infrastructure.support.BusinessException; import com.jty.wsxt.infrastructure.support.BusinessException;
import com.jty.nrsc.infrastructure.support.ResultCode; import com.jty.wsxt.infrastructure.support.ResultCode;
import lombok.Data; import lombok.Data;
import org.hibernate.annotations.NotFound; import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction; import org.hibernate.annotations.NotFoundAction;
......
...@@ -7,9 +7,9 @@ eureka: ...@@ -7,9 +7,9 @@ eureka:
prefer-ip-address: true prefer-ip-address: true
server: server:
port: 9998 port: 9997
servlet: servlet:
context-path: /manage context-path: /auth
spring: spring:
application: application:
...@@ -29,9 +29,9 @@ spring: ...@@ -29,9 +29,9 @@ spring:
# password: dev@MySQL123 # password: dev@MySQL123
datasource: datasource:
url: ${JDBC_URL:jdbc:mysql://192.168.2.244:3306/nrsc_question?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&useSSL=false} url: ${JDBC_URL:jdbc:mysql://192.168.2.244:3306/jty-wsxt?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&useSSL=false}
username: ${JDBC_USERNAME:root} username: ${JDBC_USERNAME:dev}
password: ${JDBC_PASSWORD:root} password: ${JDBC_PASSWORD:dev@MySQL123}
jpa: jpa:
hibernate: hibernate:
ddl-auto: update ddl-auto: update
......
...@@ -2,31 +2,31 @@ ...@@ -2,31 +2,31 @@
"hints": [], "hints": [],
"groups": [ "groups": [
{ {
"sourceType": "com.jty.nrsc.infrastructure.properties.SecurityProperties", "sourceType": "com.jty.wsxt.infrastructure.properties.SecurityProperties",
"name": "jty.security", "name": "jty.security",
"type": "com.jty.nrsc.infrastructure.properties.SecurityProperties" "type": "com.jty.wsxt.infrastructure.properties.SecurityProperties"
} }
], ],
"properties": [ "properties": [
{ {
"sourceType": "com.jty.nrsc.infrastructure.properties.SecurityProperties", "sourceType": "com.jty.wsxt.infrastructure.properties.SecurityProperties",
"name": "jty.security.code", "name": "jty.security.code",
"type": "com.jty.nrsc.infrastructure.properties.ValidateCodeProperties" "type": "com.jty.wsxt.infrastructure.properties.ValidateCodeProperties"
}, },
{ {
"sourceType": "com.jty.nrsc.infrastructure.properties.SecurityProperties", "sourceType": "com.jty.wsxt.infrastructure.properties.SecurityProperties",
"defaultValue": 2, "defaultValue": 2,
"name": "jty.security.fail-count", "name": "jty.security.fail-count",
"type": "java.lang.Integer" "type": "java.lang.Integer"
}, },
{ {
"sourceType": "com.jty.nrsc.infrastructure.properties.SecurityProperties", "sourceType": "com.jty.wsxt.infrastructure.properties.SecurityProperties",
"defaultValue": "\/login.html", "defaultValue": "\/login.html",
"name": "jty.security.login-page", "name": "jty.security.login-page",
"type": "java.lang.String" "type": "java.lang.String"
}, },
{ {
"sourceType": "com.jty.nrsc.infrastructure.properties.SecurityProperties", "sourceType": "com.jty.wsxt.infrastructure.properties.SecurityProperties",
"defaultValue": false, "defaultValue": false,
"name": "jty.security.school-enable", "name": "jty.security.school-enable",
"type": "java.lang.Boolean" "type": "java.lang.Boolean"
......
...@@ -116,6 +116,7 @@ ...@@ -116,6 +116,7 @@
<orderEntry type="library" name="Maven: com.netflix.ribbon:ribbon-eureka:2.2.5" level="project" /> <orderEntry type="library" name="Maven: com.netflix.ribbon:ribbon-eureka:2.2.5" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" /> <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.16.22" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.16.22" level="project" />
<orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.54" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-test:2.0.6.RELEASE" level="project" /> <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-test:2.0.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.0.6.RELEASE" level="project" /> <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.0.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.0.6.RELEASE" level="project" /> <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.0.6.RELEASE" level="project" />
......
...@@ -3,7 +3,7 @@ spring: ...@@ -3,7 +3,7 @@ spring:
name: eureka-server name: eureka-server
server: server:
port: 8762 port: 8763
eureka: eureka:
instance: instance:
......
...@@ -116,6 +116,7 @@ ...@@ -116,6 +116,7 @@
<orderEntry type="library" name="Maven: xmlpull:xmlpull:1.1.3.1" level="project" /> <orderEntry type="library" name="Maven: xmlpull:xmlpull:1.1.3.1" level="project" />
<orderEntry type="library" name="Maven: xpp3:xpp3_min:1.1.4c" level="project" /> <orderEntry type="library" name="Maven: xpp3:xpp3_min:1.1.4c" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.16.22" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.16.22" level="project" />
<orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.54" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-test:2.0.6.RELEASE" level="project" /> <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-test:2.0.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.0.6.RELEASE" level="project" /> <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.0.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.0.6.RELEASE" level="project" /> <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.0.6.RELEASE" level="project" />
......
server: server:
port: 9007 port: 9008
servlet: servlet:
context-path: /v1/nrsc context-path: /v1/wsxt
eureka: eureka:
client: client:
...@@ -24,9 +24,9 @@ spring: ...@@ -24,9 +24,9 @@ spring:
- StripPrefix= 2 - StripPrefix= 2
- id: service-question - id: service-question
uri: lb://service-question uri: lb://service-paper
predicates: predicates:
- Path=${server.servlet.context-path}/service-question/** - Path=${server.servlet.context-path}/paper/**
filters: filters:
- StripPrefix= 2 - StripPrefix= 2
......
...@@ -30,6 +30,12 @@ ...@@ -30,6 +30,12 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.54</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
</dependency> </dependency>
......
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
<orderEntry type="library" name="Maven: org.aspectj:aspectjrt:1.8.13" level="project" /> <orderEntry type="library" name="Maven: org.aspectj:aspectjrt:1.8.13" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" /> <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.16.22" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.16.22" level="project" />
<orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.54" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-test:2.0.6.RELEASE" level="project" /> <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-test:2.0.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.0.6.RELEASE" level="project" /> <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.0.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.0.6.RELEASE" level="project" /> <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.0.6.RELEASE" level="project" />
......
package com.jty.wsxt.application.service; package com.jty.wsxt.application.service;
import com.jty.wsxt.interfaces.dto.ModuleDto;
/** /**
* ModuleService * ModuleService
* *
...@@ -7,4 +9,15 @@ package com.jty.wsxt.application.service; ...@@ -7,4 +9,15 @@ package com.jty.wsxt.application.service;
* @since 2019-6-21 11:33:48 * @since 2019-6-21 11:33:48
*/ */
public interface ModuleService { public interface ModuleService {
/**
* 新增模块
* @param moduleDto moduleDto
*/
void addModule(ModuleDto moduleDto);
/**
* 删除模块
* @param moduleId moduleId
*/
void deleteModule(Integer moduleId);
} }
package com.jty.wsxt.application.service; package com.jty.wsxt.application.service;
import com.jty.wsxt.domain.model.paper.Paper;
import com.jty.wsxt.interfaces.dto.PaperDto;
import org.springframework.data.domain.Page;
/** /**
* PaperService * PaperService
* *
...@@ -7,4 +11,17 @@ package com.jty.wsxt.application.service; ...@@ -7,4 +11,17 @@ package com.jty.wsxt.application.service;
* @since 2019-6-21 11:35:20 * @since 2019-6-21 11:35:20
*/ */
public interface PaperService { public interface PaperService {
/**
* 新增试卷
* @param paperDto paperDto
*/
void addPaper(PaperDto paperDto);
Page<Paper> findPagePaper(PaperDto paperDto);
/**
* 删除试卷
* @param paperId paperId
*/
void deletePaper(Integer paperId);
} }
package com.jty.wsxt.application.service; package com.jty.wsxt.application.service;
import com.jty.wsxt.interfaces.dto.SubjectDto;
/** /**
* SubjectService * SubjectService
* *
...@@ -7,4 +9,15 @@ package com.jty.wsxt.application.service; ...@@ -7,4 +9,15 @@ package com.jty.wsxt.application.service;
* @since 2019-6-21 11:34:41 * @since 2019-6-21 11:34:41
*/ */
public interface SubjectService { public interface SubjectService {
/**
* 新增学科
* @param subjectDto subjectDto
*/
void addSubject(SubjectDto subjectDto);
/**
* 删除学科
* @param subjectId subjectId
*/
void deleteSubject(Integer subjectId);
} }
package com.jty.wsxt.application.service; package com.jty.wsxt.application.service;
import com.jty.wsxt.interfaces.dto.TypeDto;
/** /**
* TypeService * TypeService
* *
...@@ -7,4 +9,15 @@ package com.jty.wsxt.application.service; ...@@ -7,4 +9,15 @@ package com.jty.wsxt.application.service;
* @since 2019-6-21 11:35:54 * @since 2019-6-21 11:35:54
*/ */
public interface TypeService { public interface TypeService {
/**
* 新增类型
* @param typeDto typeDto
*/
void addType(TypeDto typeDto);
/**
* 删除类型
* @param typeId typeId
*/
void deleteType(Integer typeId);
} }
package com.jty.wsxt.application.service.impl; package com.jty.wsxt.application.service.impl;
import com.jty.wsxt.application.service.ModuleService; import com.jty.wsxt.application.service.ModuleService;
import com.jty.wsxt.domain.DomainRegistry;
import com.jty.wsxt.domain.model.module.Module;
import com.jty.wsxt.infrastructure.support.BusinessException;
import com.jty.wsxt.infrastructure.support.ResultCode;
import com.jty.wsxt.interfaces.dto.ModuleDto;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
...@@ -11,4 +16,26 @@ import org.springframework.stereotype.Service; ...@@ -11,4 +16,26 @@ import org.springframework.stereotype.Service;
*/ */
@Service @Service
public class ModuleServiceImpl implements ModuleService { public class ModuleServiceImpl implements ModuleService {
@Override
public void addModule(ModuleDto moduleDto) {
Module module = DomainRegistry.moduleRepository().findByName(moduleDto.getName()).orElse(null);
if(module != null){
if(!module.getUsed()) {
throw new BusinessException(ResultCode.DATA_ALREADY_EXISTED);
}else {
module.setUsed(true);
}
}else {
module = new Module();
module.setName(moduleDto.getName());
}
module.save();
}
@Override
public void deleteModule(Integer moduleId) {
Module module = DomainRegistry.moduleRepository().findById(moduleId).orElseThrow(()->new BusinessException(ResultCode.RESULT_DATA_NONE));
module.setUsed(false);
module.save();
}
} }
package com.jty.wsxt.application.service.impl; package com.jty.wsxt.application.service.impl;
import com.jty.wsxt.application.service.PaperService; import com.jty.wsxt.application.service.PaperService;
import com.jty.wsxt.domain.DomainRegistry;
import com.jty.wsxt.domain.model.paper.Paper;
import com.jty.wsxt.infrastructure.support.BusinessException;
import com.jty.wsxt.infrastructure.support.ResultCode;
import com.jty.wsxt.interfaces.dto.PaperDto;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.ExampleMatcher;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSON;
/** /**
* PaperServiceImpl * PaperServiceImpl
...@@ -11,4 +22,38 @@ import org.springframework.stereotype.Service; ...@@ -11,4 +22,38 @@ import org.springframework.stereotype.Service;
*/ */
@Service @Service
public class PaperServiceImpl implements PaperService { public class PaperServiceImpl implements PaperService {
@Override
public void addPaper(PaperDto paperDto) {
Paper paper = new Paper();
BeanUtils.copyProperties(paperDto,paper,"answer","firstFeedback","secondFeedback");
paper.setAnswer(JSON.toJSONString(paperDto.getAnswer()));
paper.save();
}
@Override
public Page<Paper> findPagePaper(PaperDto paperDto) {
Paper paper = new Paper();
if(paperDto.getCreatorId() != null){
paper.setCreatorId(paperDto.getCreatorId());
}
if(paperDto.getModuleId() != null){
paper.setModuleId(paperDto.getModuleId());
}
if(paperDto.getSubjectId() != null){
paper.setSubjectId(paperDto.getSubjectId());
}
if(paperDto.getTypeId() != null){
paper.setTypeId(paperDto.getTypeId());
}
ExampleMatcher matcher = ExampleMatcher.matching().withMatcher("name",ExampleMatcher.GenericPropertyMatchers.contains());
Example<Paper> example = Example.of(paper,matcher);
return DomainRegistry.paperRepository().findAll(example,paperDto.getPageable());
}
@Override
public void deletePaper(Integer paperId) {
Paper paper = DomainRegistry.paperRepository().findById(paperId).orElseThrow(()->new BusinessException(ResultCode.RESULT_DATA_NONE));
paper.delete();
}
} }
package com.jty.wsxt.application.service.impl; package com.jty.wsxt.application.service.impl;
import com.jty.wsxt.application.service.SubjectService; import com.jty.wsxt.application.service.SubjectService;
import com.jty.wsxt.domain.DomainRegistry;
import com.jty.wsxt.domain.model.module.Module;
import com.jty.wsxt.domain.model.subject.Subject;
import com.jty.wsxt.infrastructure.support.BusinessException;
import com.jty.wsxt.infrastructure.support.ResultCode;
import com.jty.wsxt.interfaces.dto.SubjectDto;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
...@@ -11,4 +17,26 @@ import org.springframework.stereotype.Service; ...@@ -11,4 +17,26 @@ import org.springframework.stereotype.Service;
*/ */
@Service @Service
public class SubjectServiceImpl implements SubjectService { public class SubjectServiceImpl implements SubjectService {
@Override
public void addSubject(SubjectDto subjectDto) {
Subject subject = DomainRegistry.subjectRepository().findByName(subjectDto.getName()).orElse(null);
if(subject != null){
if(!subject.getUsed()) {
throw new BusinessException(ResultCode.DATA_ALREADY_EXISTED);
}else {
subject.setUsed(true);
}
}else {
subject = new Subject();
subject.setName(subjectDto.getName());
}
subject.save();
}
@Override
public void deleteSubject(Integer subjectId) {
Subject subject = DomainRegistry.subjectRepository().findById(subjectId).orElseThrow(()->new BusinessException(ResultCode.RESULT_DATA_NONE));
subject.setUsed(false);
subject.save();
}
} }
package com.jty.wsxt.application.service.impl; package com.jty.wsxt.application.service.impl;
import com.jty.wsxt.application.service.TypeService; import com.jty.wsxt.application.service.TypeService;
import com.jty.wsxt.domain.DomainRegistry;
import com.jty.wsxt.domain.model.subject.Subject;
import com.jty.wsxt.domain.model.type.Type;
import com.jty.wsxt.infrastructure.support.BusinessException;
import com.jty.wsxt.infrastructure.support.ResultCode;
import com.jty.wsxt.interfaces.dto.TypeDto;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
...@@ -11,4 +17,26 @@ import org.springframework.stereotype.Service; ...@@ -11,4 +17,26 @@ import org.springframework.stereotype.Service;
*/ */
@Service @Service
public class TypeServiceImpl implements TypeService { public class TypeServiceImpl implements TypeService {
@Override
public void addType(TypeDto typeDto) {
Type type = DomainRegistry.typeRepository().findByName(typeDto.getName()).orElse(null);
if(type != null){
if(!type.getUsed()) {
throw new BusinessException(ResultCode.DATA_ALREADY_EXISTED);
}else {
type.setUsed(true);
}
}else {
type = new Type();
type.setName(typeDto.getName());
}
type.save();
}
@Override
public void deleteType(Integer typeId) {
Type type = DomainRegistry.typeRepository().findById(typeId).orElseThrow(()->new BusinessException(ResultCode.RESULT_DATA_NONE));
type.setUsed(false);
type.save();
}
} }
package com.jty.wsxt.domain.model.module; package com.jty.wsxt.domain.model.module;
import com.jty.wsxt.domain.DomainRegistry;
import com.jty.wsxt.domain.shared.IdentifiedEntityObject; import com.jty.wsxt.domain.shared.IdentifiedEntityObject;
import lombok.Data; import lombok.Data;
...@@ -17,12 +18,16 @@ public class Module extends IdentifiedEntityObject<Module> { ...@@ -17,12 +18,16 @@ public class Module extends IdentifiedEntityObject<Module> {
private String name; private String name;
private String ordinal;
private Integer typeId; private Integer typeId;
private Boolean used = true;
@Override @Override
public boolean sameIdentityAs(Module other) { public boolean sameIdentityAs(Module other) {
return false; return false;
} }
public void save(){
DomainRegistry.moduleRepository().save(this);
}
} }
...@@ -2,6 +2,8 @@ package com.jty.wsxt.domain.model.module; ...@@ -2,6 +2,8 @@ package com.jty.wsxt.domain.model.module;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import java.util.Optional;
/** /**
* ModuleRepository * ModuleRepository
* *
...@@ -9,4 +11,7 @@ import org.springframework.data.jpa.repository.JpaRepository; ...@@ -9,4 +11,7 @@ import org.springframework.data.jpa.repository.JpaRepository;
* @since 2019-6-21 11:17:11 * @since 2019-6-21 11:17:11
*/ */
public interface ModuleRepository extends JpaRepository<Module,Integer> { public interface ModuleRepository extends JpaRepository<Module,Integer> {
Optional<Module> findByNameAndUsed(String name,boolean used);
Optional<Module> findByName(String name);
} }
package com.jty.wsxt.domain.model.paper; package com.jty.wsxt.domain.model.paper;
import com.jty.wsxt.domain.DomainRegistry;
import com.jty.wsxt.domain.model.module.Module; import com.jty.wsxt.domain.model.module.Module;
import com.jty.wsxt.domain.shared.IdentifiedEntityObject; import com.jty.wsxt.domain.shared.IdentifiedEntityObject;
import lombok.Data; import lombok.Data;
...@@ -38,4 +39,12 @@ public class Paper extends IdentifiedEntityObject<Module> { ...@@ -38,4 +39,12 @@ public class Paper extends IdentifiedEntityObject<Module> {
public boolean sameIdentityAs(Module other) { public boolean sameIdentityAs(Module other) {
return false; return false;
} }
public void save(){
DomainRegistry.paperRepository().save(this);
}
public void delete(){
DomainRegistry.paperRepository().delete(this);
}
} }
package com.jty.wsxt.domain.model.paper; package com.jty.wsxt.domain.model.paper;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
/** /**
* PaperRepository * PaperRepository
...@@ -8,5 +9,5 @@ import org.springframework.data.jpa.repository.JpaRepository; ...@@ -8,5 +9,5 @@ import org.springframework.data.jpa.repository.JpaRepository;
* @author Manjiajie * @author Manjiajie
* @since 2019-6-21 11:17:05 * @since 2019-6-21 11:17:05
*/ */
public interface PaperRepository extends JpaRepository<Paper,Integer> { public interface PaperRepository extends JpaRepository<Paper,Integer>, JpaSpecificationExecutor<Paper> {
} }
package com.jty.wsxt.domain.model.subject; package com.jty.wsxt.domain.model.subject;
import com.jty.wsxt.domain.DomainRegistry;
import com.jty.wsxt.domain.shared.IdentifiedEntityObject; import com.jty.wsxt.domain.shared.IdentifiedEntityObject;
import lombok.Data; import lombok.Data;
...@@ -17,10 +18,14 @@ public class Subject extends IdentifiedEntityObject<Subject> { ...@@ -17,10 +18,14 @@ public class Subject extends IdentifiedEntityObject<Subject> {
private String name; private String name;
private String ordinal; private Boolean used;
@Override @Override
public boolean sameIdentityAs(Subject other) { public boolean sameIdentityAs(Subject other) {
return false; return false;
} }
public void save(){
DomainRegistry.subjectRepository().save(this);
}
} }
package com.jty.wsxt.domain.model.subject; package com.jty.wsxt.domain.model.subject;
import com.jty.wsxt.domain.model.module.Module;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import java.util.Optional;
/** /**
* SubjectRepository * SubjectRepository
* *
...@@ -9,4 +12,5 @@ import org.springframework.data.jpa.repository.JpaRepository; ...@@ -9,4 +12,5 @@ import org.springframework.data.jpa.repository.JpaRepository;
* @since 2019-6-21 11:17:43 * @since 2019-6-21 11:17:43
*/ */
public interface SubjectRepository extends JpaRepository<Subject,Integer> { public interface SubjectRepository extends JpaRepository<Subject,Integer> {
Optional<Subject> findByName(String name);
} }
package com.jty.wsxt.domain.model.type; package com.jty.wsxt.domain.model.type;
import com.jty.wsxt.domain.DomainRegistry;
import com.jty.wsxt.domain.shared.IdentifiedEntityObject; import com.jty.wsxt.domain.shared.IdentifiedEntityObject;
import lombok.Data; import lombok.Data;
...@@ -19,10 +20,14 @@ public class Type extends IdentifiedEntityObject<Type> { ...@@ -19,10 +20,14 @@ public class Type extends IdentifiedEntityObject<Type> {
private Integer subjectId; private Integer subjectId;
private String ordinal; private Boolean used;
@Override @Override
public boolean sameIdentityAs(Type other) { public boolean sameIdentityAs(Type other) {
return false; return false;
} }
public void save(){
DomainRegistry.typeRepository().save(this);
}
} }
...@@ -2,6 +2,8 @@ package com.jty.wsxt.domain.model.type; ...@@ -2,6 +2,8 @@ package com.jty.wsxt.domain.model.type;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import java.util.Optional;
/** /**
* TypeRepository * TypeRepository
* *
...@@ -9,4 +11,5 @@ import org.springframework.data.jpa.repository.JpaRepository; ...@@ -9,4 +11,5 @@ import org.springframework.data.jpa.repository.JpaRepository;
* @since 2019-6-21 11:18:51 * @since 2019-6-21 11:18:51
*/ */
public interface TypeRepository extends JpaRepository<Type,Integer> { public interface TypeRepository extends JpaRepository<Type,Integer> {
Optional<Type> findByName(String name);
} }
package com.jty.wsxt.interfaces.controller;
import org.springframework.web.bind.annotation.RestController;
/**
* ModuleController
*
* @author Manjiajie
* @since 2019-6-21 13:41:30
*/
@RestController
public class ModuleController {
}
package com.jty.wsxt.interfaces.controller;
import com.jty.wsxt.application.ApplicationRegistry;
import com.jty.wsxt.application.feign.UserFeign;
import com.jty.wsxt.interfaces.dto.PaperDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
/**
* PaperController
*
* @author Manjiajie
* @since 2019-6-21 13:42:12
*/
@RestController
public class PaperController {
private final UserFeign userFeign;
@Autowired
public PaperController(UserFeign userFeign) {
this.userFeign = userFeign;
}
@PostMapping
public void addPaper(@RequestBody PaperDto paperDto){
paperDto.setCreatorId(userFeign.getLoginId());
ApplicationRegistry.paperService().addPaper(paperDto);
}
@GetMapping("/papers")
public void getPapers(PaperDto paperDto){
}
}
package com.jty.wsxt.interfaces.controller;
import org.springframework.web.bind.annotation.RestController;
/**
* SubjectController
*
* @author Manjiajie
* @since 2019-6-21 13:41:16
*/
@RestController
public class SubjectController {
}
package com.jty.wsxt.interfaces.controller;
import org.springframework.web.bind.annotation.RestController;
/**
* TypeController
*
* @author Manjiajie
* @since 2019-6-21 13:41:10
*/
@RestController
public class TypeController {
}
package com.jty.wsxt.interfaces.dto;
import lombok.Data;
/**
* ModuleDto
*
* @author Manjiajie
* @since 2019-6-21 14:24:38
*/
@Data
public class ModuleDto extends SuperDto {
}
package com.jty.wsxt.interfaces.dto;
import lombok.Data;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
/**
* 分页查询基础数据Dto
*
* @author Manjiajie
* @since 2019-6-13 08:46:19
*/
@Data
public class PageableDto {
Integer pageNumber=0;
Integer pageSize=20;
String orderBy="id";
String direction="asc";
public Pageable getPageable(){
if(pageNumber<1){
pageNumber=1;
}
if(pageSize>50||pageSize<1){
pageSize=20;
}
if("desc".equalsIgnoreCase(direction)){
return PageRequest.of(pageNumber-1, pageSize, Sort.by(Sort.Order.desc(orderBy)));
}else {
return PageRequest.of(pageNumber-1, pageSize, Sort.by(Sort.Order.asc(orderBy)));
}
}
public Integer getFrom(){
if(pageNumber>1){
return (pageNumber-1)*pageSize;
}
else {
return 0;
}
}
}
package com.jty.wsxt.interfaces.dto;
import lombok.Data;
/**
* PaperDto
*
* @author Manjiajie
* @since 2019-6-21 15:16:27
*/
@Data
public class PaperDto extends SuperDto {
private Integer moduleId;
private Integer creatorId;
private Integer subjectId;
private Integer typeId;
private Integer specialistId;
private String[] answer;
private String[] firstFeedback;
private String[] secondFeedback;
}
package com.jty.wsxt.interfaces.dto;
import lombok.Data;
/**
* SubjectDto
*
* @author Manjiajie
* @since 2019-6-21 15:00:39
*/
@Data
public class SubjectDto extends SuperDto {
}
package com.jty.wsxt.interfaces.dto;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* SuperDto
*
* @author Manjiajie
* @since 2019-6-21 15:10:35
*/
@Data
public class SuperDto extends PageableDto {
private Integer id;
private String name;
}
package com.jty.wsxt.interfaces.dto;
import lombok.Data;
/**
* TypeDto
*
* @author Manjiajie
* @since 2019-6-21 15:06:10
*/
@Data
public class TypeDto extends SuperDto {
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment