孙镇亮 5 years ago
parent
commit
8156983548

+ 7 - 0
pom.xml

@@ -159,6 +159,13 @@
 			<systemPath>${project.basedir}/libs/SADK-3.2.5.2.jar</systemPath>
 		</dependency>
 		<dependency>
+			<groupId>com.google.gson.Gson</groupId>
+			<artifactId>com.google.gson.Gson</artifactId>
+			<version>2.6.2</version>
+			<scope>system</scope>
+			<systemPath>${project.basedir}/libs/gson-2.6.2.jar</systemPath>
+		</dependency>
+		<dependency>
 			<groupId>org.springframework.cloud</groupId>
 			<artifactId>spring-cloud-starter-openfeign</artifactId>
 		</dependency>

+ 1 - 2
src/main/java/com/ym/mec/collectfee/controller/UserController.java

@@ -51,10 +51,9 @@ public class UserController extends BaseController {
             return failed(Constants.PARAM_VERIFY_ERROR_MSG);
         }
         ApplyInfo userByPhone = applyInfoService.findUserByPhone(phone, null);
-        if(userByPhone != null & userByPhone.getClassId()!=clazzId){//如果改用户存在其他团中
+        if(userByPhone != null && userByPhone.getClassId()!=clazzId){//如果改用户存在其他团中
         	return failed(Constants.PARAM_EXIST_ERROR_MSG);
         }
-        userByPhone = applyInfoService.findUserByPhone(phone, clazzId);
         School school = schoolService.get(clazzId);
         if(userByPhone != null){
         	userByPhone.setPushStatus(school.getStatus());

+ 15 - 8
src/main/java/com/ym/mec/collectfee/service/impl/SchoolServiceImpl.java

@@ -1,5 +1,13 @@
 package com.ym.mec.collectfee.service.impl;
 
+import java.util.Date;
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
 import com.ym.mec.collectfee.common.dao.BaseDAO;
 import com.ym.mec.collectfee.common.service.impl.BaseServiceImpl;
 import com.ym.mec.collectfee.common.sms.SmsExample;
@@ -9,13 +17,8 @@ import com.ym.mec.collectfee.entity.Course;
 import com.ym.mec.collectfee.entity.ResponseCourseEntity;
 import com.ym.mec.collectfee.entity.School;
 import com.ym.mec.collectfee.service.SchoolService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.Date;
-import java.util.List;
+import com.ym.mec.collectfee.utils.Constants;
+import com.ym.mec.collectfee.utils.yqpay.DateUtils;
 
 @Service
 public class SchoolServiceImpl extends BaseServiceImpl<Integer, School> implements SchoolService {
@@ -77,7 +80,11 @@ public class SchoolServiceImpl extends BaseServiceImpl<Integer, School> implemen
 			//获取所有用户手机号列表
 			List<String> userPhone = applyInfoDao.findUserByClass(classId,null);
 			String[] objects = (String[]) userPhone.toArray();
-//			SmsExample.setBatchOnlySms(appId,secretKey,host,algorithm,"开团了",null,objects,isGizp,encode);
+			SmsExample.setBatchOnlySms(appId,secretKey,host,algorithm,String.format(Constants.SMS_TEMPLATE, DateUtils.getDayForAfter(new Date(), 2)),null,objects,isGizp,encode);
 		}
 	}
+	
+//	public static void main(String[] args) {
+//		System.out.println(String.format(Constants.SMS_TEMPLATE, DateUtils.getDayForAfter(new Date(), 2)));
+//	}
 }

+ 2 - 0
src/main/java/com/ym/mec/collectfee/utils/Constants.java

@@ -3,4 +3,6 @@ package com.ym.mec.collectfee.utils;
 public interface Constants {
     String PARAM_VERIFY_ERROR_MSG = "参数校验异常";
     String PARAM_EXIST_ERROR_MSG = "该用户已在其他乐团报名";
+    
+    String SMS_TEMPLATE = "家长您好:恭喜您的孩子被管乐团录取!请您收到录取通知书后,于%s晚24:00前点此链接%s或扫录取通知书上的二维码为学生完成入团注册缴费手续,专业以录取专业为准。完成后请关注深圳大雅乐盟(D-Y-M-E)点击菜单栏乐人进入乐团助手页面,查看课程安排。";
 }

+ 9 - 0
src/main/java/com/ym/mec/collectfee/utils/yqpay/DateUtils.java

@@ -371,5 +371,14 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
             return -1;
         }
     }
+    
+    public static String getDayForAfter(Date d, int day){
+    	Calendar now =Calendar.getInstance();
+	    now.setTime(d);
+	    now.set(Calendar.DATE,now.get(Calendar.DATE)+day);
+	    SimpleDateFormat simpleFormat = new SimpleDateFormat("yyyy-MM-dd");
+	    return simpleFormat.format(now.getTime());
+
+    }
 
 }

+ 3 - 3
src/main/resources/application.yml

@@ -1,7 +1,7 @@
 server:
-  port: 8005
-#  servlet:
-#    contextPath: /api
+  port: 9000
+  servlet:
+    contextPath: /api
 
 spring:
   application: