|
@@ -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");
|