傅行帆 5 лет назад
Родитель
Сommit
f7eccfd90b

+ 36
- 11
src/main/java/com/huiju/estateagents/controller/TaOfficeContactController.java Просмотреть файл

@@ -18,6 +18,8 @@ import org.springframework.web.bind.annotation.*;
18 18
 
19 19
 import javax.servlet.http.HttpServletRequest;
20 20
 import javax.servlet.http.HttpServletResponse;
21
+import java.time.LocalDateTime;
22
+import java.util.Map;
21 23
 
22 24
 /**
23 25
  * <p>
@@ -80,21 +82,36 @@ public class TaOfficeContactController extends BaseController {
80 82
 
81 83
     /**
82 84
      * 保存对象
83
-     * @param taOfficeContact 实体对象
84 85
      * @return
85 86
      */
86
-    @RequestMapping(value="/office/taOfficeContact",method= RequestMethod.POST)
87
-    public ResponseBean taOfficeContactAdd(@RequestBody TaOfficeContact taOfficeContact, HttpServletRequest request, HttpServletResponse response){
88
-        response.setHeader("Access-Control-Allow-Origin","*");
89
-        response.setHeader("Access-Control-Allow-Methods","*");
87
+    @RequestMapping(value="/official/taOfficeContact",method= RequestMethod.POST)
88
+    public ResponseBean taOfficeContactAdd(HttpServletRequest request, HttpServletResponse response){
89
+        TaOfficeContact taOfficeContact = new TaOfficeContact();
90
+        //跨域请求,*代表允许全部类型
91
+        response.setHeader("Access-Control-Allow-Origin", "*");
92
+        //允许请求方式
93
+        response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
94
+        //用来指定本次预检请求的有效期,单位为秒,在此期间不用发出另一条预检请求
95
+        response.setHeader("Access-Control-Max-Age", "3600");
96
+        //请求包含的字段内容,如有多个可用哪个逗号分隔如下
97
+        response.setHeader("Access-Control-Allow-Headers", "content-type,x-requested-with,Authorization, x-ui-request,lang");
98
+        //访问控制允许凭据,true为允许
99
+        response.setHeader("Access-Control-Allow-Credentials", "true");
90 100
         ResponseBean responseBean = new ResponseBean();
91 101
         try {
102
+            Map<String, String[]> parameterMap = request.getParameterMap();
92 103
 
93 104
             // 主键格式 20200611001  日期 + 数字,  数字 3 位, 前面补 0
94 105
             String today = DateUtils.todayCompact();
95 106
             Integer no = dbUtils.nextVal(SEQ_PREFIX + "-" + today);
96 107
             taOfficeContact.setSerialNo(StringUtils.lpad(no.toString(), "0", 3));
97
-
108
+            taOfficeContact.setCompany(request.getParameter("company"));
109
+            taOfficeContact.setCreateDate(LocalDateTime.now());
110
+            taOfficeContact.setDemand(request.getParameter("demand"));
111
+            taOfficeContact.setEmail(request.getParameter("email"));
112
+            taOfficeContact.setName(request.getParameter("name"));
113
+            taOfficeContact.setPhone(request.getParameter("phone"));
114
+            taOfficeContact.setStatus(CommConstant.STATUS_NORMAL);
98 115
             if (iTaOfficeContactService.save(taOfficeContact)){
99 116
                 responseBean.addSuccess(taOfficeContact);
100 117
             }else {
@@ -110,13 +127,21 @@ public class TaOfficeContactController extends BaseController {
110 127
 
111 128
     /**
112 129
      * 保存对象
113
-     * @param taOfficeContact 实体对象
130
+     *
114 131
      * @return
115 132
      */
116
-    @RequestMapping(value="/office/taOfficeContact",method= RequestMethod.OPTIONS)
117
-    public ResponseBean taOfficeContactOptions(@RequestBody TaOfficeContact taOfficeContact, HttpServletRequest request, HttpServletResponse response){
118
-        response.setHeader("Access-Control-Allow-Origin","*");
119
-        response.setHeader("Access-Control-Allow-Methods","*");
133
+    @RequestMapping(value="/official/taOfficeContact",method= RequestMethod.OPTIONS)
134
+    public ResponseBean taOfficeContactOptions(HttpServletRequest request, HttpServletResponse response){
135
+        //跨域请求,*代表允许全部类型
136
+        response.setHeader("Access-Control-Allow-Origin", "*");
137
+        //允许请求方式
138
+        response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
139
+        //用来指定本次预检请求的有效期,单位为秒,在此期间不用发出另一条预检请求
140
+        response.setHeader("Access-Control-Max-Age", "3600");
141
+        //请求包含的字段内容,如有多个可用哪个逗号分隔如下
142
+        response.setHeader("Access-Control-Allow-Headers", "content-type,x-requested-with,Authorization, x-ui-request,lang");
143
+        //访问控制允许凭据,true为允许
144
+        response.setHeader("Access-Control-Allow-Credentials", "true");
120 145
         response.setCharacterEncoding("utf-8");
121 146
 
122 147
         return ResponseBean.success("success");

+ 1
- 2
src/main/java/com/huiju/estateagents/job/JudglActivityTimeJob.java Просмотреть файл

@@ -9,7 +9,6 @@ import org.slf4j.LoggerFactory;
9 9
 import org.springframework.beans.factory.annotation.Autowired;
10 10
 import org.springframework.context.annotation.Configuration;
11 11
 import org.springframework.scheduling.annotation.EnableScheduling;
12
-import org.springframework.scheduling.annotation.Scheduled;
13 12
 import org.springframework.stereotype.Component;
14 13
 
15 14
 import java.time.LocalDateTime;
@@ -54,7 +53,7 @@ public class JudglActivityTimeJob extends BaseController {
54 53
     /**
55 54
      * 开启定时任务,每天12:30执行
56 55
      */
57
-    @Scheduled(cron = "* 0/5 * * * ?")
56
+//    @Scheduled(cron = "* 0/5 * * * ?")
58 57
     private void configureTasks() {
59 58
         String time = DateUtils.cutSecond(LocalDateTime.now());
60 59
 

+ 1
- 2
src/main/java/com/huiju/estateagents/job/OrgOrderTimeJob.java Просмотреть файл

@@ -11,7 +11,6 @@ import org.slf4j.LoggerFactory;
11 11
 import org.springframework.beans.factory.annotation.Autowired;
12 12
 import org.springframework.context.annotation.Configuration;
13 13
 import org.springframework.scheduling.annotation.EnableScheduling;
14
-import org.springframework.scheduling.annotation.Scheduled;
15 14
 import org.springframework.stereotype.Component;
16 15
 
17 16
 import java.time.LocalDateTime;
@@ -32,7 +31,7 @@ public class OrgOrderTimeJob extends BaseController {
32 31
     /**
33 32
      * 处理过期订单
34 33
      */
35
-    @Scheduled(cron = "0 0/5 * * * ?")
34
+//    @Scheduled(cron = "0 0/5 * * * ?")
36 35
     private void dealExpireOrder() {
37 36
         logger.info("处理过期订单 定时任务开始");
38 37