Browse Source

Merge remote-tracking branch 'origin/dev'

guq 6 years ago
parent
commit
6228863829
15 changed files with 86 additions and 61 deletions
  1. 7 1
      README.md
  2. 1 1
      applications/school/school-server/pom.xml
  3. 0 10
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/SchoolApplication.java
  4. 5 5
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/impl/WxMeetingServiceImpl.java
  5. 4 4
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/impl/WxNotifyServiceImpl.java
  6. 4 4
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/impl/WxOaApproveServiceImpl.java
  7. 3 3
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/impl/WxOaLeaveServiceImpl.java
  8. 3 3
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/impl/WxPrincipalMailboxServiceImpl.java
  9. 3 3
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/impl/WxTaskNotifyServiceImpl.java
  10. 5 5
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/support/RemindTask.java
  11. 8 1
      applications/wechat/wechat-api/pom.xml
  12. 0 4
      applications/wechat/wechat-api/src/main/java/com/usoftchina/smartschool/wechat/WxApiApplication.java
  13. 15 0
      applications/wechat/wechat-api/src/main/java/com/usoftchina/smartschool/wechat/api/WxPushApi.java
  14. 2 17
      applications/wechat/wechat-server/src/main/java/com/usoftchina/smartschool/wechat/WechatApplication.java
  15. 26 0
      applications/wechat/wechat-server/src/main/java/com/usoftchina/smartschool/wechat/controller/WxPushController.java

+ 7 - 1
README.md

@@ -119,4 +119,10 @@
 #接口环境
 [智慧校园接口地址](https://school-api.ubtob.com)
 [微信端web](https://school-wechat.ubtob.com)
-[pc端web地址](https://school.ubtob.com)
+[pc端web地址](https://school.ubtob.com
+
+
+#程序发布
+1. 将代码合并至master,推送至远程
+2. 登陆[jenkins](http://10.10.100.200:5001/job/school/)
+3. 先构建smartschool-platform-prod任务,等任务正确构建完成,再构建其它剩余任务

+ 1 - 1
applications/school/school-server/pom.xml

@@ -80,7 +80,7 @@
         <!--webAPP-->
         <dependency>
             <groupId>com.usoftchina.smartschool</groupId>
-            <artifactId>wechat-server</artifactId>
+            <artifactId>wechat-api</artifactId>
         </dependency>
         <dependency>
             <groupId>commons-httpclient</groupId>

+ 0 - 10
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/SchoolApplication.java

@@ -19,19 +19,9 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
 @ServletComponentScan
 @EnableEurekaClient
 @EnableFeignClients("com.usoftchina.smartschool")
-@ComponentScan(basePackages = {"com.usoftchina.smartschool"})
 public class SchoolApplication extends WebMvcConfigurerAdapter {
     public static void main(String[] args) {
         SpringApplication.run(SchoolApplication.class, args);
     }
 
-    @Override
-    public void addCorsMappings(CorsRegistry registry) {
-
-        registry.addMapping("/**")
-                .allowCredentials(true)
-                .allowedHeaders("*")
-                .allowedOrigins("*")
-                .allowedMethods("*");
-    }
 }

+ 5 - 5
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/impl/WxMeetingServiceImpl.java

@@ -13,7 +13,7 @@ import com.usoftchina.smartschool.school.wxschool.basic.service.WxMeetingService
 import com.usoftchina.smartschool.school.wxschool.support.RemindTask;
 import com.usoftchina.smartschool.school.wxschool.utils.DateFormatUtil;
 import com.usoftchina.smartschool.school.wxschool.utils.ObjectUtils;
-import com.usoftchina.smartschool.wechat.service.WxPushService;
+import com.usoftchina.smartschool.wechat.api.WxPushApi;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -32,7 +32,7 @@ public class WxMeetingServiceImpl implements WxMeetingService {
 	private WxTeacherMapper teacherMapper;
 
 	@Autowired
-	private WxPushService wxPushService;
+	private WxPushApi wxPushApi;
 
 	@Autowired
 	private WxSchoolMapper wxSchoolMapper;
@@ -80,9 +80,9 @@ public class WxMeetingServiceImpl implements WxMeetingService {
 				meetingRecordsMapper.save(meetingRecordsDO);
 			}
 			Timer timer = new Timer();
-			timer.schedule(new RemindTask(teacherMapper,wxSchoolMapper,wxPushService,meetingMapper,1,meetingDO), startDate);
-			timer.schedule(new RemindTask(teacherMapper,wxSchoolMapper,wxPushService,meetingMapper,2,meetingDO), endDate);
-			timer.schedule(new RemindTask(teacherMapper,wxSchoolMapper,wxPushService,meetingMapper,3,meetingDO), reminderDate);
+			timer.schedule(new RemindTask(teacherMapper,wxSchoolMapper,wxPushApi,meetingMapper,1,meetingDO), startDate);
+			timer.schedule(new RemindTask(teacherMapper,wxSchoolMapper,wxPushApi,meetingMapper,2,meetingDO), endDate);
+			timer.schedule(new RemindTask(teacherMapper,wxSchoolMapper,wxPushApi,meetingMapper,3,meetingDO), reminderDate);
 			return "创建成功";
 		}else {
 			throw new Exception("创建失败,请核查");

+ 4 - 4
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/impl/WxNotifyServiceImpl.java

@@ -6,7 +6,7 @@ import com.usoftchina.smartschool.school.po.*;
 import com.usoftchina.smartschool.school.wxschool.basic.service.WxNotifyService;
 import com.usoftchina.smartschool.school.wxschool.mapper.*;
 import com.usoftchina.smartschool.school.wxschool.utils.ObjectUtils;
-import com.usoftchina.smartschool.wechat.service.WxPushService;
+import com.usoftchina.smartschool.wechat.api.WxPushApi;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -29,7 +29,7 @@ public class WxNotifyServiceImpl implements WxNotifyService {
 	private WxStudentMapper studentMapper;
 
 	@Autowired
-	private WxPushService wxPushService;
+	private WxPushApi wxPushApi;
 
 	@Autowired
 	private WxSchoolMapper wxSchoolMapper;
@@ -91,7 +91,7 @@ public class WxNotifyServiceImpl implements WxNotifyService {
 					notifyrecordsMapper.save(notifyrecordsDO);
 					TeacherDO teacherDO = teacherMapper.get(l);
 					SchoolDO schoolDO = wxSchoolMapper.get(teacherDO.getSchoolId());
-					wxPushService.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),teacherDO.getOpenid(), "h0BkcnTo24b2jsficMeVO0B17GvE-VzlPvF0fVXea4w", "您好,您有一条通知", schoolDO.getSchoolName(),teacherMapper.get(notifyCreator).getTeacherName(),format.format(new Date()),notifyDetails, "点击查看详情", "");
+					wxPushApi.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),teacherDO.getOpenid(), "h0BkcnTo24b2jsficMeVO0B17GvE-VzlPvF0fVXea4w", "您好,您有一条通知", schoolDO.getSchoolName(),teacherMapper.get(notifyCreator).getTeacherName(),format.format(new Date()),notifyDetails, "点击查看详情", "");
 				}
 			}
 			List<Long> stuIds = JSON.parseArray(notifyStu, Long.class);
@@ -105,7 +105,7 @@ public class WxNotifyServiceImpl implements WxNotifyService {
 					notifyrecordsMapper.save(notifyrecordsDO);
 					ParentsDO parentsDO = wxParentsMapper.get(l);
 					SchoolDO schoolDO = wxSchoolMapper.get(parentsDO.getSchoolId());
-					wxPushService.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),parentsDO.getOpenid(), "h0BkcnTo24b2jsficMeVO0B17GvE-VzlPvF0fVXea4w", "您好,您有一条通知", schoolDO.getSchoolName(),teacherMapper.get(notifyCreator).getTeacherName(),format.format(new Date()),notifyDetails, "点击查看详情", "");
+					wxPushApi.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),parentsDO.getOpenid(), "h0BkcnTo24b2jsficMeVO0B17GvE-VzlPvF0fVXea4w", "您好,您有一条通知", schoolDO.getSchoolName(),teacherMapper.get(notifyCreator).getTeacherName(),format.format(new Date()),notifyDetails, "点击查看详情", "");
 				}
 			}
 			return "创建成功";

+ 4 - 4
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/impl/WxOaApproveServiceImpl.java

@@ -15,7 +15,7 @@ import com.usoftchina.smartschool.school.wxschool.oaBean.Manager;
 import com.usoftchina.smartschool.school.wxschool.basic.service.WxOaApproveService;
 import com.usoftchina.smartschool.school.wxschool.utils.DateFormatUtil;
 import com.usoftchina.smartschool.school.wxschool.utils.ObjectUtils;
-import com.usoftchina.smartschool.wechat.service.WxPushService;
+import com.usoftchina.smartschool.wechat.api.WxPushApi;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -35,7 +35,7 @@ public class WxOaApproveServiceImpl implements WxOaApproveService {
 	private WxTeacherMapper teacherMapper;
 
 	@Autowired
-	private WxPushService wxPushService;
+	private WxPushApi wxPushApi;
 
 	@Autowired
 	private WxSchoolMapper wxSchoolMapper;
@@ -77,9 +77,9 @@ public class WxOaApproveServiceImpl implements WxOaApproveService {
 						oaArticlesMapper.save(articles);
 					}
 				}
-				wxPushService.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),teacherDO.getOpenid(),"ohqfldHKfEmZPrLthLYt3h5SEjqd0AY7UFdngTDLTFY","您有一个待审批事项",approveTitle,teacher.getTeacherName(),format.format(new Date()),approveDetails,"点击查看详情","");
+				wxPushApi.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),teacherDO.getOpenid(),"ohqfldHKfEmZPrLthLYt3h5SEjqd0AY7UFdngTDLTFY","您有一个待审批事项",approveTitle,teacher.getTeacherName(),format.format(new Date()),approveDetails,"点击查看详情","");
 			}else {
-				wxPushService.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),teacherDO.getOpenid(),"ohqfldHKfEmZPrLthLYt3h5SEjqd0AY7UFdngTDLTFY","您有一个待审批事项",approveTitle,teacher.getTeacherName(),format.format(new Date()),approveDetails,"点击查看详情","");
+				wxPushApi.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),teacherDO.getOpenid(),"ohqfldHKfEmZPrLthLYt3h5SEjqd0AY7UFdngTDLTFY","您有一个待审批事项",approveTitle,teacher.getTeacherName(),format.format(new Date()),approveDetails,"点击查看详情","");
 			}
 			return i;
 		}else {

+ 3 - 3
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/impl/WxOaLeaveServiceImpl.java

@@ -8,7 +8,7 @@ import com.usoftchina.smartschool.school.wxschool.mapper.*;
 import com.usoftchina.smartschool.school.wxschool.basic.service.WxOaLeaveService;
 import com.usoftchina.smartschool.school.wxschool.utils.DateFormatUtil;
 import com.usoftchina.smartschool.school.wxschool.utils.ObjectUtils;
-import com.usoftchina.smartschool.wechat.service.WxPushService;
+import com.usoftchina.smartschool.wechat.api.WxPushApi;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -33,7 +33,7 @@ public class WxOaLeaveServiceImpl implements WxOaLeaveService {
 	private WxOaLeaveReplyMapper oaLeaveReplyMapper;
 
 	@Autowired
-	private WxPushService wxPushService;
+	private WxPushApi wxPushApi;
 
 	@Autowired
 	private WxSchoolMapper wxSchoolMapper;
@@ -67,7 +67,7 @@ public class WxOaLeaveServiceImpl implements WxOaLeaveService {
 				for (Long teacherId:longs) {
 					TeacherDO teacherDO = teacherMapper.get(teacherId);
 					SchoolDO schoolDO = wxSchoolMapper.get(teacherDO.getSchoolId());
-					wxPushService.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),teacherDO.getOpenid(), "QC8H4hQd1Fh0wqaaE3mbAxvoBC6y-XkHctIe8Kx6gcA", "您好,您有一个来自家长的请假申请",studentMapper.get(lvProposer).getStuName(), json.getString("startDate")+"-"+json.getString("endDate"), leave.getLvDetails(),"-", "点击查看详情", "");
+					wxPushApi.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),teacherDO.getOpenid(), "QC8H4hQd1Fh0wqaaE3mbAxvoBC6y-XkHctIe8Kx6gcA", "您好,您有一个来自家长的请假申请",studentMapper.get(lvProposer).getStuName(), json.getString("startDate")+"-"+json.getString("endDate"), leave.getLvDetails(),"-", "点击查看详情", "");
 				}
 				return "申请成功";
 			}else {

+ 3 - 3
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/impl/WxPrincipalMailboxServiceImpl.java

@@ -7,7 +7,7 @@ import com.usoftchina.smartschool.school.wxschool.mapper.*;
 import com.usoftchina.smartschool.school.wxschool.basic.service.WxPrincipalMailboxService;
 import com.usoftchina.smartschool.school.wxschool.utils.JavaBeanUtil;
 import com.usoftchina.smartschool.school.wxschool.utils.ObjectUtils;
-import com.usoftchina.smartschool.wechat.service.WxPushService;
+import com.usoftchina.smartschool.wechat.api.WxPushApi;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -37,7 +37,7 @@ public class WxPrincipalMailboxServiceImpl implements WxPrincipalMailboxService
 	private WxSchoolMapper schoolMapper;
 
 	@Autowired
-	private WxPushService wxPushService;
+	private WxPushApi wxPushApi;
 
 	/**
 	 * 校长信箱创建
@@ -55,7 +55,7 @@ public class WxPrincipalMailboxServiceImpl implements WxPrincipalMailboxService
 			SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
 			SchoolDO schoolDO = schoolMapper.get(schoolId);
 			TeacherDO teacherDO = teacherMapper.get(principalMailboxDO.getNotifier());
-			wxPushService.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),teacherDO.getOpenid(), "h0BkcnTo24b2jsficMeVO0B17GvE-VzlPvF0fVXea4w", "您有一个新的邮件通知",schoolDO.getSchoolName(),parentsMapper.get(principalMailboxDO.getMailboxCreator()).getParentsName(), simpleDateFormat.format(new Date()), principalMailboxDO.getMailboxContext(),"点击查看详情", "");
+			wxPushApi.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),teacherDO.getOpenid(), "h0BkcnTo24b2jsficMeVO0B17GvE-VzlPvF0fVXea4w", "您有一个新的邮件通知",schoolDO.getSchoolName(),parentsMapper.get(principalMailboxDO.getMailboxCreator()).getParentsName(), simpleDateFormat.format(new Date()), principalMailboxDO.getMailboxContext(),"点击查看详情", "");
 			return principalMailboxDO.getMailboxId();
 		}else {
 			throw new Exception("提交失败,请重新提交");

+ 3 - 3
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/impl/WxTaskNotifyServiceImpl.java

@@ -8,7 +8,7 @@ import com.usoftchina.smartschool.school.wxschool.mapper.*;
 import com.usoftchina.smartschool.school.wxschool.utils.DateFormatUtil;
 import com.usoftchina.smartschool.school.wxschool.utils.JavaBeanUtil;
 import com.usoftchina.smartschool.school.wxschool.utils.ObjectUtils;
-import com.usoftchina.smartschool.wechat.service.WxPushService;
+import com.usoftchina.smartschool.wechat.api.WxPushApi;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -37,7 +37,7 @@ public class WxTaskNotifyServiceImpl implements WxTaskNotifyService {
 	private WxStudentMapper studentMapper;
 
 	@Autowired
-	private WxPushService wxPushService;
+	private WxPushApi wxPushApi;
 
 	@Autowired
 	private WxSchoolMapper wxSchoolMapper;
@@ -75,7 +75,7 @@ public class WxTaskNotifyServiceImpl implements WxTaskNotifyService {
 				SchoolDO schoolDO = wxSchoolMapper.get(schoolId);
 				List<Long> longs = JSON.parseArray(taskNotifier, Long.class);
 				for (Long parentId:longs) {
-					wxPushService.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),parentsMapper.get(parentId).getOpenid(), "WwKtiHd4lso9axuavfLdpHIVbzTiopOTyh_uCsL3ZI8",taskTitle,"-",format.format(new Date()), taskContext,"-", "点击查看详情", "");
+					wxPushApi.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),parentsMapper.get(parentId).getOpenid(), "WwKtiHd4lso9axuavfLdpHIVbzTiopOTyh_uCsL3ZI8",taskTitle,"-",format.format(new Date()), taskContext,"-", "点击查看详情", "");
 				}
 			}
 			return "作业发布成功";

+ 5 - 5
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/support/RemindTask.java

@@ -6,7 +6,7 @@ import com.usoftchina.smartschool.school.po.SchoolDO;
 import com.usoftchina.smartschool.school.wxschool.mapper.WxMeetingMapper;
 import com.usoftchina.smartschool.school.wxschool.mapper.WxSchoolMapper;
 import com.usoftchina.smartschool.school.wxschool.mapper.WxTeacherMapper;
-import com.usoftchina.smartschool.wechat.service.WxPushService;
+import com.usoftchina.smartschool.wechat.api.WxPushApi;
 import org.springframework.beans.factory.annotation.Autowired;
 
 import java.text.SimpleDateFormat;
@@ -21,7 +21,7 @@ public class RemindTask extends TimerTask {
     private WxMeetingMapper meetingMapper;
 
     @Autowired
-    private WxPushService wxPushService;
+    private WxPushApi wxPushApi;
 
     @Autowired
     private WxSchoolMapper wxSchoolMapper;
@@ -33,11 +33,11 @@ public class RemindTask extends TimerTask {
 
     private Integer i;
 
-    public RemindTask(WxTeacherMapper teacherM,WxSchoolMapper wxSchool,WxPushService wxPushs,WxMeetingMapper nm, Integer ll, MeetingDO meet){//关键点解决 null指针错误,
+    public RemindTask(WxTeacherMapper teacherM,WxSchoolMapper wxSchool,WxPushApi wxPushs,WxMeetingMapper nm, Integer ll, MeetingDO meet){//关键点解决 null指针错误,
         teacherMapper = teacherM;
         wxSchoolMapper = wxSchool;
         meetingMapper=nm;
-        wxPushService = wxPushs;
+        wxPushApi = wxPushs;
         meetingDO = meet;
         i= ll;
         }
@@ -53,7 +53,7 @@ public class RemindTask extends TimerTask {
                 List<Long> list = removeDuplicate(longs);
                 for (Long teacherId:list) {
                     SchoolDO schoolDO = wxSchoolMapper.get(meetingDO.getSchoolId());
-                    wxPushService.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),teacherMapper.get(teacherId).getOpenid(), "_hX_lGEG1W1bJmW37VBaPYQoLrRrUAlNCSScezZQQWk","您好,您有一条新的会议通知", meetingDO.getMeetingName(),simpleDateFormat.format(meetingDO.getStartDate()),meetingDO.getMeetingAddress(),"-", "点击查看详情", "");
+                    wxPushApi.wxPush(schoolDO.getSchoolAppid(),schoolDO.getSchoolSecret(),teacherMapper.get(teacherId).getOpenid(), "_hX_lGEG1W1bJmW37VBaPYQoLrRrUAlNCSScezZQQWk","您好,您有一条新的会议通知", meetingDO.getMeetingName(),simpleDateFormat.format(meetingDO.getStartDate()),meetingDO.getMeetingAddress(),"-", "点击查看详情", "");
                 }
 
             }

+ 8 - 1
applications/wechat/wechat-api/pom.xml

@@ -32,7 +32,14 @@
             <artifactId>lombok</artifactId>
             <version>${lombok.version}</version>
         </dependency>
-
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-openfeign</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.usoftchina.smartschool</groupId>
+            <artifactId>core</artifactId>
+        </dependency>
         <dependency>
             <groupId>com.thoughtworks.xstream</groupId>
             <artifactId>xstream</artifactId>

+ 0 - 4
applications/wechat/wechat-api/src/main/java/com/usoftchina/smartschool/wechat/WxApiApplication.java

@@ -1,4 +0,0 @@
-package com.usoftchina.smartschool.wechat;
-
-public class WxApiApplication {
-}

+ 15 - 0
applications/wechat/wechat-api/src/main/java/com/usoftchina/smartschool/wechat/api/WxPushApi.java

@@ -0,0 +1,15 @@
+package com.usoftchina.smartschool.wechat.api;
+
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+@FeignClient(name = "wechat-server")
+public interface WxPushApi {
+
+    @PostMapping("/wxpush")
+    public String wxPush(@RequestParam("appId")String appId, @RequestParam("secret") String secret, @RequestParam("openid") String openid, @RequestParam("templateId")String templateId,
+                         @RequestParam("title")String title, @RequestParam("keyword1")String keyword1, @RequestParam("keyword2")String keyword2, @RequestParam("keyword3")String keyword3,
+                         @RequestParam("keyword4")String keyword4, @RequestParam("remark")String remark, @RequestParam("url")String url);
+
+}

+ 2 - 17
applications/wechat/wechat-server/src/main/java/com/usoftchina/smartschool/wechat/WechatApplication.java

@@ -24,25 +24,10 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
 @ServletComponentScan
 @MapperScan("com.usoftchina.smartschool.wechat.mapper")
 @EnableEurekaClient
-@EnableFeignClients("com.usoftchina.smartschool.wechat")
-@ComponentScan(basePackages = {"com.usoftchina.smartschool.wechat"})
-public class WechatApplication  extends WebMvcConfigurerAdapter {
+@EnableFeignClients("com.usoftchina.smartschool")
+public class WechatApplication  {
     public static void main(String[] args) {
         SpringApplication.run(WechatApplication.class, args);
     }
 
-    //解决跨域问题
-    @Override
-    public void addCorsMappings(CorsRegistry registry) {
-        registry.addMapping("/**")
-                .allowedHeaders("*")
-                .allowedOrigins("*")
-                .allowedMethods("*")
-                .allowCredentials(true).maxAge(3600000);
-    }
-
-    @Bean
-    public RestTemplate restTemplate(){
-        return new RestTemplate();
-    }
 }

+ 26 - 0
applications/wechat/wechat-server/src/main/java/com/usoftchina/smartschool/wechat/controller/WxPushController.java

@@ -0,0 +1,26 @@
+package com.usoftchina.smartschool.wechat.controller;
+
+import com.usoftchina.smartschool.wechat.service.WxPushService;
+import org.apache.ibatis.annotations.Param;
+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: guq
+ * @create: 2019-01-27 12:41
+ **/
+@RestController
+public class WxPushController {
+
+    @Autowired
+    private WxPushService wxPushService;
+
+    @PostMapping("/wxpush")
+    public String wxPush(@RequestParam("appId")String appId, @RequestParam("secret") String secret, @RequestParam("openid") String openid, @RequestParam("templateId")String templateId, @RequestParam("title")String title, @RequestParam("keyword1")String keyword1, @RequestParam("keyword2")String keyword2, @RequestParam("keyword3")String keyword3, @RequestParam("keyword4")String keyword4, @RequestParam("remark")String remark, @RequestParam("url")String url){
+        return wxPushService.wxPush(appId, secret,openid, templateId, title, keyword1, keyword2, keyword3, keyword4, remark, url);
+    };
+
+}