Ver código fonte

Merge branch 'master' of http://git.dayaedu.com/yonge/edu-saas

zouxuan 5 anos atrás
pai
commit
add08b0961
26 arquivos alterados com 343 adições e 71 exclusões
  1. 7 4
      edu-common/src/main/java/com/keao/edu/common/service/impl/BaseServiceImpl.java
  2. 8 0
      edu-thirdparty/pom.xml
  3. 13 1
      edu-thirdparty/src/main/java/com/keao/edu/thirdparty/message/MessageSenderPlugin.java
  4. 13 34
      edu-thirdparty/src/main/java/com/keao/edu/thirdparty/message/MessageSenderPluginContext.java
  5. 6 0
      edu-thirdparty/src/main/java/com/keao/edu/thirdparty/message/SendMode.java
  6. 12 2
      edu-thirdparty/src/main/java/com/keao/edu/thirdparty/message/provider/JiguangPushPlugin.java
  7. 12 2
      edu-thirdparty/src/main/java/com/keao/edu/thirdparty/message/provider/MOxintongSMSPlugin.java
  8. 12 2
      edu-thirdparty/src/main/java/com/keao/edu/thirdparty/message/provider/ShiyuanSMSPlugin.java
  9. 17 10
      edu-thirdparty/src/main/java/com/keao/edu/thirdparty/message/provider/YimeiSmsPlugin.java
  10. 2 0
      edu-thirdparty/src/main/java/com/keao/edu/thirdparty/storage/StoragePlugin.java
  11. 38 0
      edu-thirdparty/src/main/java/com/keao/edu/thirdparty/storage/StoragePluginContext.java
  12. 8 3
      edu-thirdparty/src/main/java/com/keao/edu/thirdparty/storage/provider/AliyunOssStoragePlugin.java
  13. 84 0
      edu-thirdparty/src/main/java/com/keao/edu/thirdparty/storage/provider/QiniuKodoStoragePlugin.java
  14. 22 0
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/ExamOrderController.java
  15. 2 3
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/ExamRegistrationController.java
  16. 11 0
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/ExaminationBasicController.java
  17. 12 1
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/entity/ExamRegistration.java
  18. 8 0
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/entity/ExaminationBasic.java
  19. 1 1
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/enums/StudentRegistrationStatusEnum.java
  20. 6 0
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/ExamRegistrationPaymentService.java
  21. 1 1
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamOrganizationRelationServiceImpl.java
  22. 7 0
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamRegistrationPaymentServiceImpl.java
  23. 28 5
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamRegistrationServiceImpl.java
  24. 6 0
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/TenantInfoServiceImpl.java
  25. 6 1
      edu-user/edu-user-server/src/main/resources/config/mybatis/ExamRegistrationMapper.xml
  26. 1 1
      edu-user/edu-user-server/src/main/resources/config/mybatis/TenantInfoMapper.xml

+ 7 - 4
edu-common/src/main/java/com/keao/edu/common/service/impl/BaseServiceImpl.java

@@ -23,10 +23,7 @@ import java.math.BigDecimal;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * SERVICE操作基类
@@ -121,6 +118,9 @@ public abstract class BaseServiceImpl<PK extends Serializable, T> implements Bas
 
 	@Override
 	public <K extends List, Y, Z> Map<Y,Z> getMap(String tableName, String columnKey, String columnValue, K ids, Class<Y> keyType, Class<Z> valueType){
+		if(CollectionUtils.isEmpty(ids)){
+			return Collections.emptyMap();
+		}
 		StringBuffer sql=new StringBuffer();
 		Map<Y,Z> result=new HashMap();
 		try {
@@ -226,6 +226,9 @@ public abstract class BaseServiceImpl<PK extends Serializable, T> implements Bas
 
 	@Override
 	public <K extends List> Map<String, String> getMap(String tableName, String columnKey, String columnValue, K ids) {
+		if(CollectionUtils.isEmpty(ids)){
+			return Collections.emptyMap();
+		}
 		StringBuffer sql=new StringBuffer();
 		Map<String, String> result=new HashMap();
 		try {

+ 8 - 0
edu-thirdparty/pom.xml

@@ -20,11 +20,19 @@
             <artifactId>spring-context</artifactId>
             <scope>compile</scope>
         </dependency>
+        
         <dependency>
             <groupId>com.aliyun.oss</groupId>
             <artifactId>aliyun-sdk-oss</artifactId>
             <version>2.8.3</version>
         </dependency>
+
+		<dependency>
+			<groupId>com.qiniu</groupId>
+			<artifactId>qiniu-java-sdk</artifactId>
+			<version>7.2.29</version>
+		</dependency>
+        
         <dependency>
             <groupId>com.keao.edu</groupId>
             <artifactId>edu-util</artifactId>

+ 13 - 1
edu-thirdparty/src/main/java/com/keao/edu/thirdparty/message/MessageSenderPlugin.java

@@ -3,7 +3,19 @@ package com.keao.edu.thirdparty.message;
 import java.io.IOException;
 
 public interface MessageSenderPlugin {
-	
+
+	/**
+	 * 发送方名称
+	 * @return
+	 */
+	public String getName();
+
+	/**
+	 * 发送模式(SMS/PUSH/EMAIL)
+	 * @return
+	 */
+	public SendMode sendMode();
+
 	/**
 	 * 发送消息至目的地
 	 * @param subject 消息主题

+ 13 - 34
edu-thirdparty/src/main/java/com/keao/edu/thirdparty/message/MessageSenderPluginContext.java

@@ -4,20 +4,12 @@ import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.BeansException;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
 import org.springframework.stereotype.Component;
 
 import com.keao.edu.thirdparty.exception.ThirdpartyException;
-import com.keao.edu.thirdparty.message.provider.JiguangPushPlugin;
-import com.keao.edu.thirdparty.message.provider.MOxintongSMSPlugin;
-import com.keao.edu.thirdparty.message.provider.ShiyuanSMSPlugin;
-import com.keao.edu.thirdparty.message.provider.YimeiSmsPlugin;
 
 @Component
-public class MessageSenderPluginContext implements ApplicationContextAware {
+public class MessageSenderPluginContext {
 
 	public enum MessageSender {
 
@@ -39,22 +31,7 @@ public class MessageSenderPluginContext implements ApplicationContextAware {
 
 	private MessageSenderPlugin messageSenderPlugin;
 
-	private ApplicationContext applicationContext;
-
-	private final Map<String, String> mapper = new HashMap<String, String>() {
-
-		/**
-		 * 
-		 */
-		private static final long serialVersionUID = -3964872523891264522L;
-
-		{
-			put(StringUtils.lowerCase(JiguangPushPlugin.getName()), StringUtils.uncapitalize(JiguangPushPlugin.class.getSimpleName()));
-			put(StringUtils.lowerCase(MOxintongSMSPlugin.getName()), StringUtils.uncapitalize(MOxintongSMSPlugin.class.getSimpleName()));
-			put(StringUtils.lowerCase(ShiyuanSMSPlugin.getName()), StringUtils.uncapitalize(ShiyuanSMSPlugin.class.getSimpleName()));
-			put(StringUtils.lowerCase(YimeiSmsPlugin.getName()), StringUtils.uncapitalize(YimeiSmsPlugin.class.getSimpleName()));
-		}
-	};
+	private static final Map<String, MessageSenderPlugin> mapper = new HashMap<String, MessageSenderPlugin>();
 
 	/**
 	 * 发送消息至目的地
@@ -90,19 +67,21 @@ public class MessageSenderPluginContext implements ApplicationContextAware {
 		return messageSenderPlugin.batchSend(subject, content, receivers, url, jpushType);
 	}
 
-	@Override
-	public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
-		this.applicationContext = applicationContext;
-	}
-
 	private MessageSenderPlugin getMessageSenderPlugin(MessageSender messageSender) {
-		String beanId = mapper.get(StringUtils.lowerCase(messageSender.name()));
+		MessageSenderPlugin messageSenderPlugin = mapper.get(messageSender.name());
 
-		if (StringUtils.isBlank(beanId)) {
-			throw new ThirdpartyException("消息提供方:{}不存在", beanId);
+		if (messageSenderPlugin == null) {
+			throw new ThirdpartyException("消息提供方:{}不存在", messageSender.name());
 		}
 
-		return applicationContext.getBean(beanId, MessageSenderPlugin.class);
+		return messageSenderPlugin;
+	}
+
+	public static void addMessageSender(MessageSenderPlugin messageSenderPlugin) {
+		if (mapper.containsKey(messageSenderPlugin.getName())) {
+			throw new ThirdpartyException("消息提供方:{}不存在", messageSenderPlugin.getName());
+		}
+		mapper.put(messageSenderPlugin.getName(), messageSenderPlugin);
 	}
 
 }

+ 6 - 0
edu-thirdparty/src/main/java/com/keao/edu/thirdparty/message/SendMode.java

@@ -0,0 +1,6 @@
+package com.keao.edu.thirdparty.message;
+
+public enum SendMode {
+
+	PUSH, EMAIL, SMS;
+}

+ 12 - 2
edu-thirdparty/src/main/java/com/keao/edu/thirdparty/message/provider/JiguangPushPlugin.java

@@ -14,6 +14,9 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.keao.edu.thirdparty.exception.ThirdpartyException;
 import com.keao.edu.thirdparty.message.MessageSenderPlugin;
+import com.keao.edu.thirdparty.message.MessageSenderPluginContext;
+import com.keao.edu.thirdparty.message.SendMode;
+import com.keao.edu.thirdparty.message.MessageSenderPluginContext.MessageSender;
 import com.keao.edu.util.http.HttpUtil;
 
 /**
@@ -46,8 +49,14 @@ public class JiguangPushPlugin implements MessageSenderPlugin, InitializingBean
 	@Value("${push.jiguang.reqURL:https://api.jpush.cn/v3/push}")
 	private String reqURL = "https://api.jpush.cn/v3/push";// 请求极光地址
 
-	public static String getName() {
-		return "jiguang";
+	@Override
+	public String getName() {
+		return MessageSender.JIGUANG.name();
+	}
+
+	@Override
+	public SendMode sendMode() {
+		return SendMode.PUSH;
 	}
 
 	/**
@@ -174,6 +183,7 @@ public class JiguangPushPlugin implements MessageSenderPlugin, InitializingBean
 		if (StringUtils.isBlank(reqURL)) {
 			throw new RuntimeException("Init parameter [reqURL] can not blank");
 		}*/
+		MessageSenderPluginContext.addMessageSender(this);
 	}
 
 	@Override

+ 12 - 2
edu-thirdparty/src/main/java/com/keao/edu/thirdparty/message/provider/MOxintongSMSPlugin.java

@@ -13,6 +13,9 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.keao.edu.thirdparty.exception.ThirdpartyException;
 import com.keao.edu.thirdparty.message.MessageSenderPlugin;
+import com.keao.edu.thirdparty.message.MessageSenderPluginContext;
+import com.keao.edu.thirdparty.message.SendMode;
+import com.keao.edu.thirdparty.message.MessageSenderPluginContext.MessageSender;
 import com.keao.edu.util.http.HttpUtil;
 
 /**
@@ -30,8 +33,14 @@ public class MOxintongSMSPlugin implements MessageSenderPlugin, InitializingBean
 	@Value("${Moxintong.reqUrl:1}")
 	private String reqUrl;
 
-	public static String getName() {
-		return "moxintong";
+	@Override
+	public String getName() {
+		return MessageSender.MOXINGTONG.name();
+	}
+
+	@Override
+	public SendMode sendMode() {
+		return SendMode.SMS;
 	}
 
 	@Override
@@ -96,6 +105,7 @@ public class MOxintongSMSPlugin implements MessageSenderPlugin, InitializingBean
 		if (StringUtils.isBlank(pwd)) {
 			throw new RuntimeException("Init parameter [pwd] can not blank");
 		}
+		MessageSenderPluginContext.addMessageSender(this);
 	}
 
 	public void setUsername(String username) {

+ 12 - 2
edu-thirdparty/src/main/java/com/keao/edu/thirdparty/message/provider/ShiyuanSMSPlugin.java

@@ -12,6 +12,9 @@ import org.springframework.stereotype.Service;
 import com.alibaba.fastjson.JSONObject;
 import com.keao.edu.thirdparty.exception.ThirdpartyException;
 import com.keao.edu.thirdparty.message.MessageSenderPlugin;
+import com.keao.edu.thirdparty.message.MessageSenderPluginContext;
+import com.keao.edu.thirdparty.message.SendMode;
+import com.keao.edu.thirdparty.message.MessageSenderPluginContext.MessageSender;
 import com.keao.edu.util.http.HttpUtil;
 
 /**
@@ -39,8 +42,14 @@ public class ShiyuanSMSPlugin implements MessageSenderPlugin, InitializingBean {
 	// private String product = "";//产品ID(不用填写)
 	// private String extno = "";//扩展码(不用填写)
 
-	public static String getName() {
-		return "shiyuan";
+	@Override
+	public String getName() {
+		return MessageSender.SHIYUAN.name();
+	}
+
+	@Override
+	public SendMode sendMode() {
+		return SendMode.SMS;
 	}
 
 	@Override
@@ -55,6 +64,7 @@ public class ShiyuanSMSPlugin implements MessageSenderPlugin, InitializingBean {
 		if (StringUtils.isBlank(pswd)) {
 			throw new RuntimeException("Init parameter [pswd] can not blank");
 		}
+		MessageSenderPluginContext.addMessageSender(this);
 	}
 
 	public void setReqURL(String reqURL) {

+ 17 - 10
edu-thirdparty/src/main/java/com/keao/edu/thirdparty/message/provider/YimeiSmsPlugin.java

@@ -15,6 +15,9 @@ import org.springframework.stereotype.Service;
 import com.alibaba.fastjson.JSONObject;
 import com.keao.edu.thirdparty.exception.ThirdpartyException;
 import com.keao.edu.thirdparty.message.MessageSenderPlugin;
+import com.keao.edu.thirdparty.message.MessageSenderPluginContext;
+import com.keao.edu.thirdparty.message.SendMode;
+import com.keao.edu.thirdparty.message.MessageSenderPluginContext.MessageSender;
 import com.keao.edu.util.date.DateUtil;
 import com.keao.edu.util.http.HttpUtil;
 
@@ -33,8 +36,14 @@ public class YimeiSmsPlugin implements MessageSenderPlugin, InitializingBean {
 	@Value("${com.properties.sms-host-dev:http://bjmtn.b2m.cn}")
 	private String host;
 
-	public static String getName() {
-		return "yimei";
+	@Override
+	public String getName() {
+		return MessageSender.YIMEI.name();
+	}
+
+	@Override
+	public SendMode sendMode() {
+		return SendMode.SMS;
 	}
 
 	private String getParam(String subject, String content, String receiver, String host) {
@@ -46,11 +55,9 @@ public class YimeiSmsPlugin implements MessageSenderPlugin, InitializingBean {
 			param.put("sign", DigestUtils.md5Hex(appId + secretKey + timestamp));
 			param.put("content", content);
 			param.put("mobiles", receiver);
-			
-			long startTime = System.currentTimeMillis();
-			String result =  HttpUtil.postForHttp(host, param);
-			logger.info("调用亿美接口共消耗{}毫秒",System.currentTimeMillis() - startTime);
-			
+
+			String result = HttpUtil.postForHttp(host, param);
+
 			return result;
 		} catch (Exception e) {
 			throw new ThirdpartyException("调用发送短信接口出现异常", e);
@@ -58,7 +65,7 @@ public class YimeiSmsPlugin implements MessageSenderPlugin, InitializingBean {
 	}
 
 	@Override
-	public boolean send(String subject, String content, String receiver, String url,String jpushType) throws Exception {
+	public boolean send(String subject, String content, String receiver, String url, String jpushType) throws Exception {
 		String result = getParam(subject, content, receiver, host + "/simpleinter/sendSMS");
 		JSONObject json = JSONObject.parseObject(result);
 		if ("SUCCESS".equals(json.get("code"))) {
@@ -70,7 +77,7 @@ public class YimeiSmsPlugin implements MessageSenderPlugin, InitializingBean {
 	}
 
 	@Override
-	public boolean batchSend(String subject, String content, String[] receivers, String url,String jpushType) throws Exception {
+	public boolean batchSend(String subject, String content, String[] receivers, String url, String jpushType) throws Exception {
 		String join = StringUtils.join(receivers, ",");
 		String result = getParam(subject, content, join, host + "/simpleinter/sendSMS");
 		logger.info("调用短信接口返回:{}", result);
@@ -84,6 +91,6 @@ public class YimeiSmsPlugin implements MessageSenderPlugin, InitializingBean {
 
 	@Override
 	public void afterPropertiesSet() throws Exception {
-
+		MessageSenderPluginContext.addMessageSender(this);
 	}
 }

+ 2 - 0
edu-thirdparty/src/main/java/com/keao/edu/thirdparty/storage/StoragePlugin.java

@@ -4,6 +4,8 @@ import java.io.File;
 import java.io.IOException;
 
 public interface StoragePlugin {
+	
+	String getName();
 
 	/**
 	 * 上传文件

+ 38 - 0
edu-thirdparty/src/main/java/com/keao/edu/thirdparty/storage/StoragePluginContext.java

@@ -0,0 +1,38 @@
+package com.keao.edu.thirdparty.storage;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.springframework.stereotype.Component;
+
+import com.keao.edu.thirdparty.exception.ThirdpartyException;
+
+@Component
+public class StoragePluginContext {
+
+	private static final Map<String, StoragePlugin> mapper = new HashMap<String, StoragePlugin>();
+	
+	public static void addStoragePlugin(StoragePlugin storagePlugin) {
+		if (mapper.containsKey(storagePlugin.getName())) {
+			throw new ThirdpartyException("消息提供方:{}不存在", storagePlugin.getName());
+		}
+		mapper.put(storagePlugin.getName(), storagePlugin);
+	}
+	
+	public String uploadFile(String storagePluginName, String folderName, File file){
+		StoragePlugin StoragePlugin = getStoragePlugin(storagePluginName);
+		return StoragePlugin.uploadFile(folderName, file);
+	}
+
+	private StoragePlugin getStoragePlugin(String storagePluginName) {
+		StoragePlugin storagePlugin = mapper.get(storagePluginName);
+
+		if (storagePlugin == null) {
+			throw new ThirdpartyException("消息提供方:{}不存在", storagePluginName);
+		}
+
+		return storagePlugin;
+	}
+
+}

+ 8 - 3
edu-thirdparty/src/main/java/com/keao/edu/thirdparty/storage/provider/AliyunOssStoragePlugin.java

@@ -1,11 +1,12 @@
 package com.keao.edu.thirdparty.storage.provider;
 
-
 import com.aliyun.oss.ClientConfiguration;
 import com.aliyun.oss.OSSClient;
 import com.aliyun.oss.model.OSSObject;
 import com.keao.edu.thirdparty.exception.ThirdpartyException;
 import com.keao.edu.thirdparty.storage.StoragePlugin;
+import com.keao.edu.thirdparty.storage.StoragePluginContext;
+
 import org.apache.poi.util.IOUtils;
 import org.springframework.beans.factory.DisposableBean;
 import org.springframework.beans.factory.InitializingBean;
@@ -18,6 +19,8 @@ import java.io.IOException;
 @Component
 public class AliyunOssStoragePlugin implements StoragePlugin, InitializingBean, DisposableBean {
 
+	public final static String PLUGIN_NAME = "Aliyun";
+
 	@Value("${storage.oss.endpoint:oss-cn-beijing.aliyuncs.com}")
 	private String endpoint;
 
@@ -32,8 +35,8 @@ public class AliyunOssStoragePlugin implements StoragePlugin, InitializingBean,
 
 	private OSSClient ossClient;
 
-	public static String getName() {
-		return "Aliyun";
+	public String getName() {
+		return PLUGIN_NAME;
 	}
 
 	@Override
@@ -57,6 +60,8 @@ public class AliyunOssStoragePlugin implements StoragePlugin, InitializingBean,
 		conf.setSupportCname(true);
 
 		ossClient = new OSSClient(endpoint, accessKeyId, accessKeySecret, conf);
+		
+		StoragePluginContext.addStoragePlugin(this);
 	}
 
 	@Override

+ 84 - 0
edu-thirdparty/src/main/java/com/keao/edu/thirdparty/storage/provider/QiniuKodoStoragePlugin.java

@@ -0,0 +1,84 @@
+package com.keao.edu.thirdparty.storage.provider;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URLEncoder;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.DisposableBean;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import com.keao.edu.thirdparty.exception.ThirdpartyException;
+import com.keao.edu.thirdparty.storage.StoragePlugin;
+import com.keao.edu.thirdparty.storage.StoragePluginContext;
+import com.qiniu.util.Auth;
+
+@Component
+public class QiniuKodoStoragePlugin implements StoragePlugin, InitializingBean, DisposableBean {
+
+	public final static String PLUGIN_NAME = "QiNiu";
+
+	@Value("${storage.qiniu.kedo.accessKeyId:LTAI4Fdhxwfo7FsBDZKK8Wfv}")
+	private String accessKeyId;
+
+	@Value("${storage.qiniu.kedo.accessKeySecret:ERRma4P9VWbD98n93gspnZXmoq7rn5}")
+	private String accessKeySecret;
+
+	@Value("${storage.qiniu.kedo.bucketName:daya-online}")
+	private String bucketName;
+
+	private Auth auth;
+
+	public String getName() {
+		return PLUGIN_NAME;
+	}
+
+	@Override
+	public void afterPropertiesSet() throws Exception {
+		auth = Auth.create(accessKeyId, accessKeySecret);
+
+		StoragePluginContext.addStoragePlugin(this);
+	}
+
+	@Override
+	public String uploadFile(String folderName, File file) {
+		String upToken = auth.uploadToken(bucketName, file.getName());
+		if (StringUtils.isBlank(upToken)) {
+			throw new ThirdpartyException("使用七牛-对象存储上传失败");
+		}
+		return String.format("%s/%s", bucketName, folderName + "/" + file.getName());
+	}
+
+	@Override
+	public byte[] getFile(String folderName, String fileName) throws IOException {
+		String encodedFileName = URLEncoder.encode(folderName + "/" + fileName, "utf-8").replace("+", "%20");
+		String publicUrl = String.format("%s/%s", bucketName, encodedFileName);
+		long expireInSeconds = 3600;// 1小时,可以自定义链接过期时间
+		String finalUrl = auth.privateDownloadUrl(publicUrl, expireInSeconds);
+		return FileUtils.readFileToByteArray(new File(finalUrl));
+	}
+
+	@Override
+	public void destroy() throws Exception {
+
+	}
+
+	public void setAccessKeyId(String accessKeyId) {
+		this.accessKeyId = accessKeyId;
+	}
+
+	public void setAccessKeySecret(String accessKeySecret) {
+		this.accessKeySecret = accessKeySecret;
+	}
+
+	public void setBucketName(String bucketName) {
+		this.bucketName = bucketName;
+	}
+
+	public static void main(String[] args) throws Exception {
+
+	}
+}

+ 22 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/ExamOrderController.java

@@ -5,13 +5,18 @@ import com.keao.edu.auth.api.client.SysUserFeignService;
 import com.keao.edu.auth.api.entity.SysUser;
 import com.keao.edu.common.controller.BaseController;
 import com.keao.edu.common.entity.HttpResponseResult;
+import com.keao.edu.common.page.PageInfo;
 import com.keao.edu.thirdparty.adapay.ConfigInit;
 import com.keao.edu.thirdparty.adapay.Payment;
 import com.keao.edu.thirdparty.yqpay.Msg;
 import com.keao.edu.user.dto.StudentExamPaymentDto;
+import com.keao.edu.user.entity.Employee;
+import com.keao.edu.user.entity.ExamRegistration;
 import com.keao.edu.user.entity.ExamRegistrationPayment;
 import com.keao.edu.user.entity.ExamSong;
 import com.keao.edu.user.enums.TransStatusEnum;
+import com.keao.edu.user.page.ExamRegistrationQueryInfo;
+import com.keao.edu.user.service.EmployeeService;
 import com.keao.edu.user.service.ExamRegistrationPaymentService;
 import com.keao.edu.user.service.ExamRegistrationService;
 import com.keao.edu.util.date.DateUtil;
@@ -21,6 +26,7 @@ import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
 import java.math.BigDecimal;
@@ -37,6 +43,22 @@ public class ExamOrderController extends BaseController {
     private ExamRegistrationPaymentService examRegistrationPaymentService;
     @Autowired
     private SysUserFeignService sysUserFeignService;
+    @Autowired
+    private EmployeeService employeeService;
+
+    @ApiOperation(value = "缴费列表")
+    @GetMapping(value = "list")
+    @PreAuthorize("@pcs.hasPermissions('examOrder/pageList')")
+    public HttpResponseResult<PageInfo<ExamRegistration>> list(ExamRegistrationQueryInfo queryInfo) {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (!sysUser.getIsSuperAdmin() && Objects.isNull(queryInfo.getOrganId())) {
+            Employee employee = employeeService.get(sysUser.getId());
+            if (Objects.nonNull(employee)) {
+                queryInfo.setOrganId(employee.getOrganId());
+            }
+        }
+        return succeed(examRegistrationPaymentService.pageList(queryInfo));
+    }
 
     @ApiOperation("获取用户项目未支付的订单")
     @ApiImplicitParams({

+ 2 - 3
edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/ExamRegistrationController.java

@@ -108,16 +108,15 @@ public class ExamRegistrationController extends BaseController {
     }
 
 
-    @ApiOperation(value = "获取报名信息")
+    @ApiOperation(value = "获取报名信息(报名)")
     @GetMapping(value = "getExamRegistration")
     @ApiImplicitParams({@ApiImplicitParam(name = "examRegistrationId", value = "报名id", required = true, dataType = "int")})
     public HttpResponseResult<ExamRegistration> getExamRegistration(Long examRegistrationId) {
         return succeed(examRegistrationService.getExamRegistration(examRegistrationId));
     }
 
-    @ApiOperation(value = "重新支付")
+    @ApiOperation(value = "重新支付(报名用)")
     @PostMapping(value = "repay")
-    @PreAuthorize("@pcs.hasPermissions('examRegistration/add')")
     public HttpResponseResult repay(@RequestParam String orderNo) throws Exception {
         SysUser student = sysUserFeignService.queryUserInfo();
         return succeed(examRegistrationService.repay(student.getId(), orderNo));

+ 11 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/ExaminationBasicController.java

@@ -1,11 +1,15 @@
 package com.keao.edu.user.controller;
 
+import com.keao.edu.auth.api.client.SysUserFeignService;
+import com.keao.edu.auth.api.entity.SysUser;
 import com.keao.edu.common.controller.BaseController;
 import com.keao.edu.common.entity.HttpResponseResult;
 import com.keao.edu.common.page.PageInfo;
 import com.keao.edu.user.dto.ExaminationBasicDto;
+import com.keao.edu.user.entity.Employee;
 import com.keao.edu.user.entity.ExaminationBasic;
 import com.keao.edu.user.page.ExaminationQueryInfo;
+import com.keao.edu.user.service.EmployeeService;
 import com.keao.edu.user.service.ExaminationBasicService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -23,6 +27,10 @@ public class ExaminationBasicController extends BaseController {
 
     @Autowired
     private ExaminationBasicService examinationBasicService;
+    @Autowired
+    private SysUserFeignService sysUserFeignService;
+    @Autowired
+    private EmployeeService employeeService;
 
     @ApiOperation("查询指定考级项目")
     @GetMapping(value = "/getExaminationBasic")
@@ -39,6 +47,9 @@ public class ExaminationBasicController extends BaseController {
     @ApiOperation("创建考级项目")
     @PostMapping(value = "/addExaminationBasic")
     public HttpResponseResult<ExaminationBasic> addExaminationBasic(@RequestBody ExaminationBasic examinationBasic){
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        Employee employee = employeeService.get(sysUser.getId());
+
         return succeed(examinationBasicService.addExaminationBasic(examinationBasic));
     }
 

+ 12 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/entity/ExamRegistration.java

@@ -17,6 +17,9 @@ public class ExamRegistration {
 	
 	@ApiModelProperty(value = "考级项目编号")
 	private Integer examinationBasicId;
+
+	@ApiModelProperty(value = "考级项目详情")
+	private ExaminationBasic examinationBasic;
 	
 	@ApiModelProperty(value = "学员编号")
 	private Integer studentId;
@@ -137,7 +140,15 @@ public class ExamRegistration {
 	public Integer getExaminationBasicId(){
 		return this.examinationBasicId;
 	}
-			
+
+	public ExaminationBasic getExaminationBasic() {
+		return examinationBasic;
+	}
+
+	public void setExaminationBasic(ExaminationBasic examinationBasic) {
+		this.examinationBasic = examinationBasic;
+	}
+
 	public void setStudentId(Integer studentId){
 		this.studentId = studentId;
 	}

+ 8 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/entity/ExaminationBasic.java

@@ -55,6 +55,14 @@ public class ExaminationBasic {
 
 	private String tenantId;
 
+	public ExaminationBasic() {
+	}
+
+	public ExaminationBasic(Integer id, String name) {
+		this.id = id;
+		this.name = name;
+	}
+
 	public String getMemo() {
 		return memo;
 	}

+ 1 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/enums/StudentRegistrationStatusEnum.java

@@ -24,7 +24,7 @@ public enum  StudentRegistrationStatusEnum implements BaseEnum<String, StudentRe
 
     @Override
     public String getCode() {
-        return null;
+        return code;
     }
 
     public void setCode(String code) {

+ 6 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/ExamRegistrationPaymentService.java

@@ -1,8 +1,11 @@
 package com.keao.edu.user.service;
 
+import com.keao.edu.common.page.PageInfo;
 import com.keao.edu.common.service.BaseService;
 import com.keao.edu.user.dto.StudentExamPaymentDto;
+import com.keao.edu.user.entity.ExamRegistration;
 import com.keao.edu.user.entity.ExamRegistrationPayment;
+import com.keao.edu.user.page.ExamRegistrationQueryInfo;
 
 import java.util.List;
 import java.util.Map;
@@ -43,6 +46,9 @@ public interface ExamRegistrationPaymentService extends BaseService<Long, ExamRe
     ExamRegistrationPayment updateOrder(Map<String,String> rpMap);
 
 
+    PageInfo<ExamRegistration> pageList(ExamRegistrationQueryInfo queryInfo);
+
+
     /**
      * 查询订单订单状态
      *

+ 1 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamOrganizationRelationServiceImpl.java

@@ -157,7 +157,7 @@ public class ExamOrganizationRelationServiceImpl extends BaseServiceImpl<Long, E
 			if(YesOrNoEnum.YES.equals(examOrgan.getSendUrlFlag())){
 				continue;
 			}
-			String registrationUrl = baseUrl + "examId=" + examOrgan.getExaminationBasicId();
+			String registrationUrl = baseUrl + "examId=" + examOrgan.getExaminationBasicId() + "&organId=" + examOrgan.getOrganId();
 			String registShortUrl = shortUrlService.createShortUrl(registrationUrl);
 
 			examOrgan.setUrl(registShortUrl);

+ 7 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamRegistrationPaymentServiceImpl.java

@@ -3,6 +3,7 @@ package com.keao.edu.user.service.impl;
 import com.alibaba.fastjson.JSON;
 import com.keao.edu.common.dal.BaseDAO;
 import com.keao.edu.common.exception.BizException;
+import com.keao.edu.common.page.PageInfo;
 import com.keao.edu.common.service.impl.BaseServiceImpl;
 import com.keao.edu.thirdparty.adapay.Payment;
 import com.keao.edu.thirdparty.yqpay.Msg;
@@ -15,6 +16,7 @@ import com.keao.edu.user.entity.ExamRegistration;
 import com.keao.edu.user.entity.ExamRegistrationPayment;
 import com.keao.edu.user.enums.StudentRegistrationStatusEnum;
 import com.keao.edu.user.enums.TransStatusEnum;
+import com.keao.edu.user.page.ExamRegistrationQueryInfo;
 import com.keao.edu.user.service.ExamRegistrationPaymentService;
 import com.keao.edu.user.service.ExamRegistrationService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -92,6 +94,11 @@ public class ExamRegistrationPaymentServiceImpl extends BaseServiceImpl<Long, Ex
     }
 
     @Override
+    public PageInfo<ExamRegistration> pageList(ExamRegistrationQueryInfo queryInfo) {
+        return null;
+    }
+
+    @Override
     public void queryOrderStatus() throws Exception {
         yqPayQuery();
         adaPayQuery();

+ 28 - 5
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamRegistrationServiceImpl.java

@@ -91,8 +91,19 @@ public class ExamRegistrationServiceImpl extends BaseServiceImpl<Long, ExamRegis
         examRegistration.setStatus(StudentRegistrationStatusEnum.PAY_WAIT);
         examRegistration.setLevelFee(examSubjectSong.getRegistrationFee());
         examRegistration.setTheoryLevelFee(theoryLevelFee);
+        examRegistration.setCreateTime(nowDate);
+        examRegistration.setUpdateTime(nowDate);
         examRegistrationDao.insert(examRegistration);
 
+        ExamRegistrationPayment examIngOrder = examRegistrationPaymentService.getExamIngOrder(examinationBasic.getId(), examRegistration.getSubjectId());
+        if (examIngOrder != null) {
+            examIngOrder.setTransStatus(TransStatusEnum.CLOSE);
+            examIngOrder.setMemo("用户主动放弃支付");
+            if (examRegistrationPaymentService.update(examIngOrder) <= 0) {
+                throw new BizException("未支付订单关闭失败");
+            }
+        }
+
         ExamRegistrationPayment examRegistrationPayment = new ExamRegistrationPayment();
         examRegistrationPayment.setTenantId(examinationBasic.getTenantId());
         examRegistrationPayment.setExamRegistrationId(examRegistration.getId().longValue());
@@ -105,6 +116,7 @@ public class ExamRegistrationServiceImpl extends BaseServiceImpl<Long, ExamRegis
         examRegistrationPayment.setUpdateTime(nowDate);
         examRegistrationPaymentService.insert(examRegistrationPayment);
 
+        HashMap<String, Object> rpMap = new HashMap<>();
         String baseApiUrl = sysConfigDao.findConfigValue("base_api_url");
         Map<String, Object> payMap = payService.getPayMap(
                 amount,
@@ -117,7 +129,9 @@ public class ExamRegistrationServiceImpl extends BaseServiceImpl<Long, ExamRegis
         examRegistrationPayment.setTransNo((String) payMap.get("routingMerNos"));
         examRegistrationPayment.setPayType((String) payMap.get("type"));
         examRegistrationPaymentService.update(examRegistrationPayment);
-        return payMap;
+        rpMap.put("examRegister", examRegistration);
+        rpMap.put("payMap", payMap);
+        return rpMap;
     }
 
     @Override
@@ -135,13 +149,18 @@ public class ExamRegistrationServiceImpl extends BaseServiceImpl<Long, ExamRegis
             pageInfo.setTotal(count);
             params.put("offset", pageInfo.getOffset());
             dataList = this.getDAO().queryPage(params);
-            List<Integer> organIds = dataList.stream().map(ExamRegistration::getOrganId).collect(Collectors.toList());
+            List<Integer> examIds = dataList.stream().filter(e->Objects.nonNull(e.getOrganId())).map(ExamRegistration::getExaminationBasicId).collect(Collectors.toList());
+            Map<Integer, String> examIdNameMap = this.getMap("examination_basic", "id_", "name_", examIds, Integer.class, String.class);
+
+            List<Integer> organIds = dataList.stream().filter(e->Objects.nonNull(e.getOrganId())).map(ExamRegistration::getOrganId).collect(Collectors.toList());
             Map<Integer, String> organIdNameMap = this.getMap("organization", "id_", "name_", organIds, Integer.class, String.class);
+
             List<Integer> subjectIds = dataList.stream().map(ExamRegistration::getSubjectId).collect(Collectors.toList());
             Map<Integer, String> subjectIdNameMap = this.getMap("subject", "id_", "name_", subjectIds, Integer.class, String.class);
             for (ExamRegistration examRegistration : dataList) {
-                examRegistration.getOrganization().setName(organIdNameMap.get(examRegistration.getOrganId()));
-                examRegistration.getSubject().setName(subjectIdNameMap.get(examRegistration.getStudentId()));
+                examRegistration.setOrganization(new Organization(examRegistration.getOrganId(), organIdNameMap.get(examRegistration.getOrganId())));
+                examRegistration.getSubject().setName(subjectIdNameMap.get(examRegistration.getSubjectId()));
+                examRegistration.setExaminationBasic(new ExaminationBasic(examRegistration.getExaminationBasicId(), examIdNameMap.get(examRegistration.getExaminationBasicId())));
             }
         }
 
@@ -243,6 +262,7 @@ public class ExamRegistrationServiceImpl extends BaseServiceImpl<Long, ExamRegis
         if (examinationBasic == null || !examinationBasic.getStatus().equals(ExamStatusEnum.APPLYING)) {
             throw new BizException("项目不在报名中,请核对");
         }
+        Map<String, Object> rpMap = new HashMap<>();
         String baseApiUrl = sysConfigDao.findConfigValue("base_api_url");
         Map<String, Object> payMap = payService.getPayMap(
                 order.getTransAmount(),
@@ -255,6 +275,9 @@ public class ExamRegistrationServiceImpl extends BaseServiceImpl<Long, ExamRegis
         order.setTransNo((String) payMap.get("routingMerNos"));
         order.setPayType((String) payMap.get("type"));
         examRegistrationPaymentService.update(order);
-        return payMap;
+        ExamRegistration examRegistration = examRegistrationDao.get(order.getExamRegistrationId());
+        rpMap.put("examRegister", examRegistration);
+        rpMap.put("payMap", payMap);
+        return rpMap;
     }
 }

+ 6 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/TenantInfoServiceImpl.java

@@ -14,6 +14,7 @@ import com.keao.edu.user.dao.TenantInfoDao;
 import com.keao.edu.user.entity.Employee;
 import com.keao.edu.user.entity.Organization;
 import com.keao.edu.user.entity.TenantInfo;
+import com.keao.edu.user.enums.YesOrNoEnum;
 import com.keao.edu.user.service.TenantInfoService;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -63,11 +64,16 @@ public class TenantInfoServiceImpl extends BaseServiceImpl<Integer, TenantInfo>
 		sysUserDao.insert(sysUser);
 
 		Organization organ=new Organization();
+		organ.setUserId(sysUser.getId());
 		organ.setTenantId(tenantInfo.getId().toString());
 		organ.setParentOrganId(sysUser.getId());
 		organ.setLevel(0);
 		organ.setParentOrganIdTag(sysUser.getId().toString());
 		organ.setId(sysUser.getId());
+		organ.setName(sysUser.getRealName());
+		organ.setContactName(tenantInfo.getContactName());
+		organ.setContactPhone(tenantInfo.getContactPhone());
+		organ.setIsAllowArrangeExam(YesOrNoEnum.YES);
 		organizationDao.insert(organ);
 
 		Employee employee = new Employee();

+ 6 - 1
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamRegistrationMapper.xml

@@ -141,14 +141,19 @@
 	<select id="queryPage" resultMap="ExamRegistration" parameterType="map">
 		SELECT
 			er.id_,
+			er.examination_basic_id_,
+			er.exam_music_theory_level_,
 			er.card_no_,
 			er.student_id_,
 			su.real_name_ sys_user_real_name_,
+			er.level_fee_,
+			er.theory_level_fee_,
 			er.organ_id_,
 			er.subject_id_,
 			er.level_,
 			erp.trans_amount_,
-			er.status_
+			er.status_,
+			er.create_time_
 		FROM
 			exam_registration er
 			LEFT JOIN sys_user su ON er.student_id_ = su.id_

+ 1 - 1
edu-user/edu-user-server/src/main/resources/config/mybatis/TenantInfoMapper.xml

@@ -82,7 +82,7 @@
 	<select id="queryPage" resultMap="TenantInfo" parameterType="map">
 		SELECT * FROM tenant_info
 		<include refid="queryPageCondition"/>
-		ORDER BY update_time_ DESC
+		ORDER BY id_ DESC
 		<include refid="global.limit"/>
 	</select>