Commit e9580c1a302336f05df56cbfa95c2555089de4ef
1 parent
9dcd0b09
预约新增选项修复
Showing
9 changed files
with
187 additions
and
150 deletions
ant-design-vue-jeecg/src/views/reserve/reservationsubmission/ReservationSubmissionList.vue
ant-design-vue-jeecg/src/views/reserve/reservationsubmission/ReservationSubmissionListLoading.vue
ant-design-vue-jeecg/src/views/reserve/reservationsubmission/modules/ReservationSubmissionForm.vue
... | ... | @@ -4,8 +4,8 @@ |
4 | 4 | <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> |
5 | 5 | <a-row> |
6 | 6 | <a-col :span="24"> |
7 | - <a-form-model-item label="月台" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="railwayPlatform"> | |
8 | - <j-dict-select-tag type="list" v-model="model.railwayPlatform" dictCode="platform_management,name,name" placeholder="请选择月台" /> | |
7 | + <a-form-model-item label="月台组" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="railwayPlatform"> | |
8 | + <j-dict-select-tag type="list" v-model="model.railwayPlatform" dictCode="platform_management,name,name" placeholder="请选择月台组" /> | |
9 | 9 | </a-form-model-item> |
10 | 10 | </a-col> |
11 | 11 | |
... | ... | @@ -47,14 +47,13 @@ |
47 | 47 | <a-input v-model="model.phoneNumber" placeholder="请输入司机手机号" ></a-input> |
48 | 48 | </a-form-model-item> |
49 | 49 | </a-col> |
50 | + <a-input type="hidden" v-model="model.objective=2"></a-input> | |
51 | + | |
52 | + <a-input type="hidden" v-model="model.reservationMethod='WEB页面'"></a-input> | |
53 | + | |
50 | 54 | <a-col :span="24"> |
51 | - <a-form-model-item label="装车/卸车" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="objective"> | |
52 | - <j-dict-select-tag type="list" v-model="model.objective" dictCode="objective" placeholder="请选择装车/卸车" /> | |
53 | - </a-form-model-item> | |
54 | - </a-col> | |
55 | - <a-col :span="24"> | |
56 | - <a-form-model-item label="卸货种类" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="detailed"> | |
57 | - <a-input v-model="model.detailed" placeholder="请输入卸货种类" ></a-input> | |
55 | + <a-form-model-item label="卸货名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="detailed"> | |
56 | + <a-input v-model="model.detailed" placeholder="请输入卸货物品名称" ></a-input> | |
58 | 57 | </a-form-model-item> |
59 | 58 | </a-col> |
60 | 59 | <a-col :span="24"> |
... | ... | @@ -62,12 +61,6 @@ |
62 | 61 | <j-dict-select-tag type="list" v-model="model.vehicle" dictCode="vehicle_table,name,name" placeholder="请选择车型" /> |
63 | 62 | </a-form-model-item> |
64 | 63 | </a-col> |
65 | - | |
66 | - <a-col :span="24"> | |
67 | - <a-form-model-item label="月台" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="platformGroup"> | |
68 | - <a-input v-model="model.platformGroup" placeholder="月台" ></a-input> | |
69 | - </a-form-model-item> | |
70 | - </a-col> | |
71 | 64 | <a-col :span="24"> |
72 | 65 | <a-form-model-item label="客户名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="customerName"> |
73 | 66 | <a-input v-model="model.customerName" placeholder="请输入客户名称" ></a-input> |
... | ... |
ant-design-vue-jeecg/src/views/reserve/reservationsubmission/modules/ReservationSubmissionFormto.vue
... | ... | @@ -4,8 +4,32 @@ |
4 | 4 | <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> |
5 | 5 | <a-row> |
6 | 6 | <a-col :span="24"> |
7 | - <a-form-model-item label="月台" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="railwayPlatform"> | |
8 | - <j-dict-select-tag type="list" v-model="model.railwayPlatform" dictCode="platform_management,name,name" placeholder="请选择月台" /> | |
7 | + <a-form-model-item label="月台组" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="railwayPlatform"> | |
8 | + <j-dict-select-tag type="list" v-model="model.railwayPlatform" dictCode="platform_management,name,name" placeholder="请选择月台组" /> | |
9 | + </a-form-model-item> | |
10 | + </a-col> | |
11 | + | |
12 | + | |
13 | + <a-col :span="24"> | |
14 | + <a-form-model-item label="预约时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="appointmentTime"> | |
15 | + <j-dict-select-tag type="list" v-model="model.appointmentTime" v-on:change="changeEvn($event)" dictCode="time" placeholder="请选择预约时间" /> | |
16 | + </a-form-model-item> | |
17 | + </a-col> | |
18 | + | |
19 | + <a-col :span="24"> | |
20 | + <a-form-model-item label="时间段:" :labelCol="labelCol" :wrapperCol="wrapperCol" > | |
21 | + <a-select class="extTimeSelection" placeholder="请选择预约时间段" v-model="model.timeSelection" v-on:change="changeEvn2($event)" > | |
22 | + <a-select-option v-for="timeSelection in timeSelectionList" :key="timeSelection" :value="timeSelection">{{ timeSelection }}</a-select-option> | |
23 | + </a-select> | |
24 | + </a-form-model-item> | |
25 | + </a-col> | |
26 | + | |
27 | + | |
28 | + | |
29 | + | |
30 | + <a-col :span="24"> | |
31 | + <a-form-model-item label="订单号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="orderNumber"> | |
32 | + <a-input v-model="model.orderNumber" placeholder="请输入订单号" ></a-input> | |
9 | 33 | </a-form-model-item> |
10 | 34 | </a-col> |
11 | 35 | <a-col :span="24"> |
... | ... | @@ -28,15 +52,13 @@ |
28 | 52 | <j-dict-select-tag type="list" v-model="model.vehicle" dictCode="vehicle_table,name,name" placeholder="请选择车型" /> |
29 | 53 | </a-form-model-item> |
30 | 54 | </a-col> |
55 | + <a-input type="hidden" v-model="model.objective=1"></a-input> | |
56 | + | |
57 | + <a-input type="hidden" v-model="model.reservationMethod='WEB页面'"></a-input> | |
31 | 58 | |
32 | - <a-col :span="24"> | |
33 | - <a-form-model-item label="月台" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="platformGroup"> | |
34 | - <a-input v-model="model.platformGroup" placeholder="月台" ></a-input> | |
35 | - </a-form-model-item> | |
36 | - </a-col> | |
37 | 59 | <a-col :span="24"> |
38 | 60 | <a-form-model-item label="客户名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="customerName"> |
39 | - <a-input v-model="model.customerName" placeholder="请输入填表人名称" ></a-input> | |
61 | + <a-input v-model="model.customerName" placeholder="请输入客户名称" ></a-input> | |
40 | 62 | </a-form-model-item> |
41 | 63 | </a-col> |
42 | 64 | <a-col :span="24"> |
... | ... | @@ -49,12 +71,6 @@ |
49 | 71 | <a-input v-model="model.remark" placeholder="请输入备注" ></a-input> |
50 | 72 | </a-form-model-item> |
51 | 73 | </a-col> |
52 | - | |
53 | - <a-input type="hidden" v-model="model.objective=1"></a-input> | |
54 | - | |
55 | - <a-input type="hidden" v-model="model.reservationMethod='WEB端'"></a-input> | |
56 | - | |
57 | - | |
58 | 74 | </a-row> |
59 | 75 | </a-form-model> |
60 | 76 | </j-form-container> |
... | ... | @@ -65,10 +81,10 @@ |
65 | 81 | |
66 | 82 | import { httpAction, getAction } from '@/api/manage' |
67 | 83 | import { validateDuplicateValue } from '@/utils/util' |
68 | - import {getSchedulerPrint, getTime, searchTimePeriod} from "../../../../api/api"; | |
84 | + import {getSchedulerPrint, searchTimePeriod} from "../../../../api/api"; | |
69 | 85 | |
70 | 86 | export default { |
71 | - name: 'ReservationSubmissionFormto', | |
87 | + name: 'ReservationSubmissionForm', | |
72 | 88 | components: { |
73 | 89 | }, |
74 | 90 | props: { |
... | ... | @@ -83,10 +99,8 @@ |
83 | 99 | return { |
84 | 100 | timeSelection:'', |
85 | 101 | timeSelectionList:[], |
86 | - timedateList:[], | |
87 | - objective:1, | |
88 | 102 | model:{ |
89 | - }, | |
103 | + }, | |
90 | 104 | labelCol: { |
91 | 105 | xs: { span: 24 }, |
92 | 106 | sm: { span: 5 }, |
... | ... | @@ -97,23 +111,25 @@ |
97 | 111 | }, |
98 | 112 | confirmLoading: false, |
99 | 113 | validatorRules: { |
100 | - appointmentTime: [ | |
101 | - { required: true, message: '请输入预约时间!'}, | |
102 | - ], | |
103 | - | |
104 | - orderNumber: [ | |
105 | - { required: true, message: '请输入订单号!'}, | |
106 | - { pattern: /^.{6,18}$/, message: '请输入6到18位任意字符!'}, | |
107 | - ], | |
108 | - phoneNumber: [ | |
109 | - { required: true, message: '请输入司机手机号!'}, | |
110 | - { pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号码!'}, | |
111 | - ], | |
112 | - | |
113 | - submitPhone: [ | |
114 | - { required: true, message: '请输入填表人电话!'}, | |
115 | - { pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号码!'}, | |
116 | - ], | |
114 | + appointmentTime: [ | |
115 | + { required: true, message: '请输入预约时间!'}, | |
116 | + ], | |
117 | + | |
118 | + orderNumber: [ | |
119 | + { required: true, message: '请输入订单号!'}, | |
120 | + { pattern: /^.{6,18}$/, message: '请输入6到18位任意字符!'}, | |
121 | + ], | |
122 | + reservationMethod: [ | |
123 | + { required: true, message: '请输入预约形式!'}, | |
124 | + ], | |
125 | + phoneNumber: [ | |
126 | + { required: true, message: '请输入司机手机号!'}, | |
127 | + { pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号码!'}, | |
128 | + ], | |
129 | + submitPhone: [ | |
130 | + { required: true, message: '请输入填表人电话!'}, | |
131 | + { pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号码!'}, | |
132 | + ], | |
117 | 133 | }, |
118 | 134 | url: { |
119 | 135 | add: "/reservationsubmission/reservationSubmission/add", |
... | ... | @@ -127,12 +143,8 @@ |
127 | 143 | return this.disabled |
128 | 144 | }, |
129 | 145 | }, |
130 | - mounted:function() { | |
131 | - let id = this.$route.query.id; | |
132 | - this.loadForm(id) | |
133 | - }, | |
134 | 146 | created () { |
135 | - //备份model原始值 | |
147 | + //备份model原始值 | |
136 | 148 | this.modelDefault = JSON.parse(JSON.stringify(this.model)); |
137 | 149 | }, |
138 | 150 | methods: { |
... | ... | @@ -142,11 +154,7 @@ |
142 | 154 | |
143 | 155 | }); |
144 | 156 | }, |
145 | - loadForm(id){ | |
146 | - getTime(id).then((res) => { | |
147 | - this.timedateList=res; | |
148 | - }) | |
149 | - }, | |
157 | + | |
150 | 158 | |
151 | 159 | changeEvn(event){ |
152 | 160 | let tempEl= document.querySelector(".extTimeSelection .ant-select-selection-selected-value"); |
... | ... | @@ -155,7 +163,6 @@ |
155 | 163 | |
156 | 164 | this.timeSlot(event) |
157 | 165 | }, |
158 | - | |
159 | 166 | changeEvn2(event){ |
160 | 167 | |
161 | 168 | var str1=event.substring(0, event.indexOf("---")); |
... | ... | @@ -188,7 +195,7 @@ |
188 | 195 | method = 'post'; |
189 | 196 | }else{ |
190 | 197 | httpurl+=this.url.edit; |
191 | - method = 'put'; | |
198 | + method = 'put'; | |
192 | 199 | } |
193 | 200 | httpAction(httpurl,this.model,method).then((res)=>{ |
194 | 201 | if(res.success){ |
... | ... |
ant-design-vue-jeecg/src/views/reserve/submit/reservationapplication.vue
... | ... | @@ -135,6 +135,7 @@ |
135 | 135 | }, |
136 | 136 | timeSelection:'', |
137 | 137 | codez:'', |
138 | + disableSubmit:'', | |
138 | 139 | a:0, |
139 | 140 | b:0, |
140 | 141 | timeSelectionList:[], |
... | ... | @@ -197,6 +198,9 @@ |
197 | 198 | timeSlot(id){ |
198 | 199 | searchTimePeriod(id).then((res) => { |
199 | 200 | this.timeSelectionList=res; |
201 | + let els= document.querySelector(".extTimeSelection .ant-select-selection-selected-value"); | |
202 | + els.innerText=''; | |
203 | + | |
200 | 204 | }); |
201 | 205 | }, |
202 | 206 | PlatformTimeSlot(id){ |
... | ... | @@ -266,61 +270,75 @@ |
266 | 270 | |
267 | 271 | onSubmit() { |
268 | 272 | |
269 | - // const code = getUrlParam('code') // 截取路径中的code,如果没有就去微信授权,如果已经获取到了就直接传code给后台获取openId | |
270 | - // const local = window.location.href | |
271 | - // if (code == null || code === '') { | |
272 | - // window.location.href = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' + "wx3f9ef1399cfe4aed" + '&redirect_uri=' + encodeURIComponent(local) + '&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect' | |
273 | - // } else { | |
273 | + const code = getUrlParam('code') // 截取路径中的code,如果没有就去微信授权,如果已经获取到了就直接传code给后台获取openId | |
274 | + const local = window.location.href | |
275 | + if (code == null || code === '') { | |
276 | + window.location.href = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' + "wx3f9ef1399cfe4aed" + '&redirect_uri=' + encodeURIComponent(local) + '&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect' | |
277 | + } else { | |
274 | 278 | |
279 | + this.model.codez=code; | |
275 | 280 | |
276 | - if (this.model.objective==1) | |
277 | - { | |
278 | - this.model.detailed=''; | |
279 | - } | |
280 | - const that = this; | |
281 | - // 触发表单验证 | |
282 | - // this.model.phoneNumber=""; | |
283 | - // this.model.orderNumber=""; | |
284 | - // for (let i=this.a;i>=0;i--) | |
285 | - // { | |
286 | - // this.model.phoneNumber=this.model.phoneNumber+document.getElementById("number"+i).value; | |
287 | - // } | |
288 | - // for (let i=this.b;i>=0;i--) | |
289 | - // { | |
290 | - // this.model.orderNumber=this.model.orderNumber+","+document.getElementById("numbers"+i).value; | |
291 | - // } | |
292 | - this.$refs.form.validate(valid => { | |
293 | - if (valid) { | |
294 | - that.confirmLoading = true; | |
295 | - let httpurl = ''; | |
296 | - let method = ''; | |
297 | - if (!this.model.id) { | |
298 | - httpurl += this.url.add; | |
299 | - method = 'post'; | |
300 | - } else { | |
301 | - httpurl += this.url.edit; | |
302 | - method = 'put'; | |
281 | + if (this.model.objective == 1) { | |
282 | + this.model.detailed = ''; | |
283 | + } | |
284 | + const that = this; | |
285 | + // 触发表单验证 | |
286 | + this.model.phoneNumber = ""; | |
287 | + this.model.orderNumber = ""; | |
288 | + for (let i = this.a; i >= 0; i--) { | |
289 | + if (i==0) | |
290 | + { | |
291 | + this.model.phoneNumber = this.model.phoneNumber + document.getElementById("number" + i).value; | |
303 | 292 | } |
304 | - httpAction(httpurl, this.model, method).then((res) => { | |
305 | - if (res.success) { | |
306 | - that.$message.success(res.message); | |
307 | - that.$emit('ok'); | |
308 | - this.$router.push({ | |
309 | - path: "/result/Success" | |
310 | - }); | |
311 | - } else { | |
312 | - that.$message.warning(res.message); | |
313 | - this.$router.push({ | |
314 | - path: "/reserve/submit" | |
315 | - }); | |
316 | - } | |
317 | - }).finally(() => { | |
318 | - that.confirmLoading = false; | |
319 | - }) | |
293 | + else | |
294 | + { | |
295 | + this.model.phoneNumber = this.model.phoneNumber + document.getElementById("number" + i).value+ ","; | |
296 | + } | |
297 | + | |
298 | + | |
320 | 299 | } |
300 | + for (let i = this.b; i >= 0; i--) { | |
301 | + if (i==0) | |
302 | + { | |
303 | + this.model.orderNumber = this.model.orderNumber + document.getElementById("numbers" + i).value; | |
304 | + } | |
305 | + else { | |
306 | + this.model.orderNumber = this.model.orderNumber + document.getElementById("numbers" + i).value+ ","; | |
307 | + } | |
321 | 308 | |
322 | - }) | |
323 | - }, | |
309 | + } | |
310 | + this.$refs.form.validate(valid => { | |
311 | + if (valid) { | |
312 | + that.confirmLoading = true; | |
313 | + let httpurl = ''; | |
314 | + let method = ''; | |
315 | + if (!this.model.id) { | |
316 | + httpurl += this.url.add; | |
317 | + method = 'post'; | |
318 | + } else { | |
319 | + httpurl += this.url.edit; | |
320 | + method = 'put'; | |
321 | + } | |
322 | + httpAction(httpurl, this.model, method).then((res) => { | |
323 | + if (res.success) { | |
324 | + that.$message.success(res.message); | |
325 | + that.$emit('ok'); | |
326 | + this.$router.push({ | |
327 | + path: "/result/Success" | |
328 | + }); | |
329 | + } else { | |
330 | + that.$message.warning(res.message); | |
331 | + this.$router.push({ | |
332 | + path: "/reserve/submit" | |
333 | + }); | |
334 | + } | |
335 | + }).finally(() => { | |
336 | + that.confirmLoading = false; | |
337 | + }) | |
338 | + } | |
339 | + }) | |
340 | + } | |
341 | + } | |
324 | 342 | } |
325 | 343 | } |
326 | 344 | </script> |
327 | 345 | \ No newline at end of file |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/basics/weighing/controller/WeighingController.java
... | ... | @@ -188,12 +188,10 @@ public class WeighingController extends JeecgController<Weighing, IWeighingServi |
188 | 188 | throw new JSONException("重量不能为空"); |
189 | 189 | } |
190 | 190 | |
191 | - | |
192 | 191 | //查看月台是否被释放,如果被释放了表示出 没释放表示入 |
193 | 192 | |
194 | 193 | //1.根据车牌号查询月台状态 |
195 | 194 | |
196 | - | |
197 | 195 | // if (11) { |
198 | 196 | //过磅完成查看是否有预约单 没有则状态为N |
199 | 197 | iweighingService.addWeighing(weighing, 1); |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/reserve/reservationsubmission/service/impl/ReservationSubmissionServiceImpl.java
... | ... | @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; |
4 | 4 | import com.aliyun.oss.ServiceException; |
5 | 5 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
6 | 6 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
7 | +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
7 | 8 | import io.micrometer.core.instrument.util.StringUtils; |
8 | 9 | import me.chanjar.weixin.common.error.WxErrorException; |
9 | 10 | import org.jeecg.common.util.HttpUtils; |
... | ... | @@ -13,6 +14,7 @@ import org.jeecg.modules.basics.userrecord.service.IUserRecordService; |
13 | 14 | import org.jeecg.modules.reserve.reservationsubmission.entity.ReservationSubmission; |
14 | 15 | import org.jeecg.modules.reserve.reservationsubmission.mapper.ReservationSubmissionMapper; |
15 | 16 | import org.jeecg.modules.reserve.reservationsubmission.service.IReservationSubmissionService; |
17 | +import org.jeecg.modules.tool.controller.ShortMessageController; | |
16 | 18 | import org.jeecg.modules.tool.entity.WeChatResult; |
17 | 19 | import org.jeecg.modules.tool.service.ToolService; |
18 | 20 | import org.jeecg.modules.wms.shipment.shipmentHeader.domain.ShipmentHeader; |
... | ... | @@ -20,15 +22,13 @@ import org.jeecg.modules.wms.shipment.shipmentHeader.service.ShipmentHeaderServi |
20 | 22 | import org.springframework.beans.factory.annotation.Autowired; |
21 | 23 | import org.springframework.stereotype.Service; |
22 | 24 | |
23 | -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
24 | - | |
25 | 25 | import javax.annotation.Resource; |
26 | 26 | import java.util.Calendar; |
27 | 27 | |
28 | 28 | /** |
29 | 29 | * @Description: 预约表 |
30 | 30 | * @Author: jeecg-boot |
31 | - * @Date: 2022-02-21 | |
31 | + * @Date: 2022-02-21 | |
32 | 32 | * @Version: V1.0 |
33 | 33 | */ |
34 | 34 | @Service |
... | ... | @@ -73,35 +73,51 @@ public class ReservationSubmissionServiceImpl extends ServiceImpl<ReservationSub |
73 | 73 | reservationSubmission.setStare(QuantityConstant.SHIPMENT_BOOKING_SUCCESS); |
74 | 74 | reservationSubmissionService.save(reservationSubmission); |
75 | 75 | |
76 | - //配置微信请求openid的url | |
77 | - String url="https://api.weixin.qq.com/sns/oauth2/access_token?appid=wx3f9ef1399cfe4aed&secret=c19b68816cc5ef52d2c49b765ec90032&code="+reservationSubmission.getCodez()+"&grant_type=authorization_code"; | |
78 | 76 | |
79 | - //请求url获取openid | |
80 | - String result = HttpUtils.sendGet(url); | |
81 | - if(StringUtils.isEmpty(result)) { | |
82 | - throw new ServiceException("接口地址错误或返回为空"); | |
83 | - } | |
84 | - WeChatResult weChatResult = JSON.parseObject(result, WeChatResult.class); | |
85 | - | |
86 | - //存储openid到数据库(根据填表人) | |
87 | - | |
88 | - UserRecord userRecord =new UserRecord(); | |
89 | - //姓名 | |
90 | - userRecord.setName(reservationSubmission.getCustomerName()); | |
91 | - userRecord.setPhone(reservationSubmission.getSubmitPhone()); | |
92 | - userRecord.setOpenid(weChatResult.getOpenid()); | |
93 | - userRecord.setBlock("N"); | |
94 | - userRecordService.save(userRecord); | |
95 | - | |
96 | - try { | |
97 | - tool.successfulPush(reservationSubmission); | |
98 | - //发送公众号通知 | |
99 | - } catch (WxErrorException e) { | |
100 | - e.printStackTrace(); | |
77 | + //查询手机号的openid在不在 | |
78 | + LambdaQueryWrapper<UserRecord> userRecordLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
79 | + userRecordLambdaQueryWrapper.eq(UserRecord::getPhone, reservationSubmission.getSubmitPhone()); | |
80 | + UserRecord one = userRecordService.getOne(userRecordLambdaQueryWrapper); | |
81 | + | |
82 | + if (reservationSubmission.getReservationMethod().contains("H5")) { | |
83 | + //配置微信请求openid的url | |
84 | + String url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=wx3f9ef1399cfe4aed&secret=c19b68816cc5ef52d2c49b765ec90032&code=" + reservationSubmission.getCodez() + "&grant_type=authorization_code"; | |
85 | + | |
86 | + //请求url获取openid | |
87 | + String result = HttpUtils.sendGet(url); | |
88 | + if (StringUtils.isEmpty(result) == false) { | |
89 | + | |
90 | + WeChatResult weChatResult = JSON.parseObject(result, WeChatResult.class); | |
91 | + //存储openid到数据库(根据填表人) | |
92 | + UserRecord userRecord = new UserRecord(); | |
93 | + //姓名 | |
94 | + userRecord.setName(reservationSubmission.getCustomerName()); | |
95 | + userRecord.setPhone(reservationSubmission.getSubmitPhone()); | |
96 | + userRecord.setOpenid(weChatResult.getOpenid()); | |
97 | + userRecord.setBlock("N"); | |
98 | + userRecordService.save(userRecord); | |
99 | + try { | |
100 | + tool.successfulPush(reservationSubmission, weChatResult.getOpenid()); | |
101 | + //发送公众号通知 | |
102 | + } catch (WxErrorException e) { | |
103 | + e.printStackTrace(); | |
104 | + } | |
105 | + | |
106 | + } | |
107 | + } else { | |
108 | + if (one != null) { | |
109 | + try { | |
110 | + tool.successfulPush(reservationSubmission, one.getOpenid()); | |
111 | + //发送公众号通知 | |
112 | + } catch (WxErrorException e) { | |
113 | + e.printStackTrace(); | |
114 | + } | |
115 | + } | |
101 | 116 | } |
102 | 117 | |
103 | -// //发送短信通知 | |
104 | -// ShortMessageController.sendSingleSms(reservationSubmission,reservationSubmission.getSubmitPhone()); | |
118 | +// | |
119 | +//// //发送短信通知 | |
120 | +// ShortMessageController.sendSingleSms(reservationSubmission, reservationSubmission.getSubmitPhone()); | |
105 | 121 | |
106 | 122 | |
107 | 123 | return true; |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/tool/service/ToolService.java
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/tool/service/impl/ToolServiceImpl.java
... | ... | @@ -38,7 +38,7 @@ public class ToolServiceImpl implements ToolService { |
38 | 38 | private WxMpService mpService; |
39 | 39 | @ApiLogger(value = "微信预约成功通知") |
40 | 40 | @Override |
41 | - public void successfulPush(ReservationSubmission reservationSubmission) throws WxErrorException { | |
41 | + public void successfulPush(ReservationSubmission reservationSubmission,String optId) throws WxErrorException { | |
42 | 42 | |
43 | 43 | WxMpTemplateData wxMpTemplateData = new WxMpTemplateData(); |
44 | 44 | List<WxMpTemplateData> data = new ArrayList(); |
... | ... | @@ -92,13 +92,18 @@ public class ToolServiceImpl implements ToolService { |
92 | 92 | |
93 | 93 | |
94 | 94 | WxMpTemplateMessage wxMpTemplateMessage = new WxMpTemplateMessage(); |
95 | - wxMpTemplateMessage.setToUser("oyd-u6vagcOANtoA3CdBbUnsQlDQ"); | |
95 | + wxMpTemplateMessage.setToUser(optId); | |
96 | 96 | wxMpTemplateMessage.setTemplateId("wNjuIP5WxRtwhcnKicU93loVIrQRLC_8B004jhP3kWY"); |
97 | 97 | wxMpTemplateMessage.setUrl("http://www.baidu.com"); |
98 | 98 | wxMpTemplateMessage.setData(data); |
99 | 99 | WxMpTemplateMsgService wxMpTemplateMsgService = mpService.getTemplateMsgService(); |
100 | 100 | log.info("####微信消息模版正在推送####"); |
101 | - wxMpTemplateMsgService.sendTemplateMsg(wxMpTemplateMessage); | |
101 | + | |
102 | + try { | |
103 | + String s = wxMpTemplateMsgService.sendTemplateMsg(wxMpTemplateMessage); | |
104 | + } catch (WxErrorException e) { | |
105 | + log.error("【微信模版消息】发送失败, {}", e); | |
106 | + } | |
102 | 107 | |
103 | 108 | } |
104 | 109 | |
... | ... |