AdminResController.java
39.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
package com.softwarebr.nunu.web.admin;
import com.alibaba.fastjson.JSON;
import com.brframework.common.utils.ConvertObjectUtil;
import com.brframework.commoncms.annatotion.AdminMenu;
import com.brframework.commoncms.annatotion.layout.EditAlertLayout;
import com.brframework.commoncms.annatotion.layout.EditLayout;
import com.brframework.commoncms.annatotion.layout.PageLayout;
import com.brframework.commoncms.annatotion.option.CmsOption;
import com.brframework.commoncms.core.Icons;
import com.brframework.commonweb.json.JSONResult;
import com.brframework.commonweb.json.Page;
import com.brframework.commonweb.json.PageParam;
import com.brframework.commonwebadmin.aop.annotation.AOLog;
import com.softwarebr.nunu.domain.InviteJob;
import com.softwarebr.nunu.domain.VerifyPageTotal;
import com.softwarebr.nunu.dto.res.InviteParamDTO;
import com.softwarebr.nunu.dto.res.ProjectParamDTO;
import com.softwarebr.nunu.dto.res.PropertyParamDTO;
import com.softwarebr.nunu.dto.res.TalentParamDTO;
import com.softwarebr.nunu.entity.res.*;
import com.softwarebr.nunu.globals.SystemConst;
import com.softwarebr.nunu.json.admin.res.*;
import com.softwarebr.nunu.service.oper.AreaService;
import com.softwarebr.nunu.service.res.*;
import com.softwarebr.nunu.service.user.MemberService;
import com.softwarebr.nunu.util.AmountConversionUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.Map;
import static com.brframework.commondb.core.ControllerPageHandle.convertTo;
import static com.brframework.commondb.core.ControllerPageHandle.jpaPageConvertToPage;
/**
* @author lilin
* @date 2020-02-21 11:49:00
*/
@RestController
@Api(tags = "创新资源交易区管理")
@AdminMenu(menuName = "创新资源交易区管理", icon = Icons.TABLE)
@RequestMapping("/admin/access")
public class AdminResController {
@Autowired
private PropertyService propertyService;
@Autowired
private ProjectService projectService;
@Autowired
private InviteService inviteService;
@Autowired
private TalentService talentService;
@Autowired
private MemberService memberService;
@Autowired
private PropertyApplyService propertyApplyService;
@Autowired
private AreaService areaService;
@ApiOperation(value = "创新资源交易区状态数据统计", notes = "创新资源交易区状态数据统计", produces = "text/plain")
@PreAuthorize("hasRole('res-project-query')")
@GetMapping("/v1/res/count")
public JSONResult<VerifyPageTotal> getResCount(ProjectQueryParam param1, PropertyQueryParam param2, InviteQueryParam param3) {
VerifyPageTotal verifyPageResult = new VerifyPageTotal();
projectQueryHandle(param1);
verifyPageResult.setProjectCount(projectService.count(param1));
propertyQueryHandle(param2);
verifyPageResult.setPropertyCount(propertyService.count(param2));
inviteQueryHandle(param3);
verifyPageResult.setInviteCount(inviteService.count(param3));
return JSONResult.ok(verifyPageResult);
}
private void projectQueryHandle(ProjectQueryParam param) {
if (null != param.getAccount()) {
param.setPublisher(memberService.findMemberIdByPhone(param.getAccount()));
}
if (null != param.getApplyStatus()) {
param.setId(propertyApplyService.getAwaitVerifyResourceIds(PropertyApply.RESOURCE_TYPE_PROJECT));
}
param.setVerify(SystemConst.VERIFY_ADOPT);
param.setMarker(SystemConst.MARKER_STATUS_NO);
}
private void propertyQueryHandle(PropertyQueryParam param) {
if (null != param.getAccount()) {
param.setPublisher(memberService.findMemberIdByPhone(param.getAccount()));
}
if (null != param.getApplyStatus()) {
param.setId(propertyApplyService.getAwaitVerifyResourceIds(PropertyApply.RESOURCE_TYPE_PROPERTY));
}
param.setVerify(SystemConst.VERIFY_ADOPT);
param.setMarker(SystemConst.MARKER_STATUS_NO);
}
private void inviteQueryHandle(InviteQueryParam param) {
if (null != param.getAccount()) {
param.setPublisher(memberService.findMemberIdByPhone(param.getAccount()));
}
if (null != param.getApplyStatus()) {
param.setId(propertyApplyService.getAwaitVerifyResourceIds(PropertyApply.RESOURCE_TYPE_INVITE));
}
param.setVerify(SystemConst.VERIFY_ADOPT);
param.setMarker(SystemConst.MARKER_STATUS_NO);
}
private void talentQueryHandle(TalentQueryParam param) {
// if (null != param.getAccount()) {
// param.setPublisher(memberService.findMemberIdByPhone(param.getAccount()));
// }
// if (null != param.getApplyStatus()) {
// param.setId(propertyApplyService.getAwaitVerifyResourceIds(PropertyApply.RESOURCE_TYPE_INVITE));
// }
param.setVerify(SystemConst.VERIFY_ADOPT);
param.setMarker(SystemConst.MARKER_STATUS_NO);
}
@ApiOperation(value = "项目需求资源列表", notes = "项目需求资源列表", produces = "text/plain")
@GetMapping("/v1/project/page")
@AdminMenu(menuName = "创新资源交易区管理", order = 1, url = "TransactionReview")
@PreAuthorize("hasRole('res-project-query')")
@PageLayout(
options = {
@CmsOption(name = "添加", uriMappingMethod = "projectCreateV1")
},
columnOptions = {
@CmsOption(name = "查看", uriMappingMethod = "getProject"),
@CmsOption(name = "上架", uriMappingMethod = "resUpperV1"),
@CmsOption(name = "下架", uriMappingMethod = "resLowerV1"),
@CmsOption(name = "首页推荐", uriMappingMethod = "resIndexYesV1"),
@CmsOption(name = "取消推荐", uriMappingMethod = "resIndexNoV1"),
@CmsOption(name = "修改", uriMappingMethod = "projectEditV1"),
@CmsOption(name = "公开申请列表", uriMappingMethod = "resApplyListV1"),
@CmsOption(name = "公开", uriMappingMethod = "resApplyOpenV1"),
@CmsOption(name = "删除", uriMappingMethod = "projectRemoveV1", alert = "确定删除该记录吗?")
}
)
public JSONResult<Page<ProjectResult>> projectListV1(PageParam pageParam, ProjectQueryParam param) {
projectQueryHandle(param);
Page<ProjectResult> page = jpaPageConvertToPage(projectService.page(pageParam, param), pageParam, ProjectResult.class);
Map<Integer, String> statusMap = projectService.statusMap();
Map<Integer, String> typeMap = projectService.typeMap();
for (ProjectResult projectResult : page.getList()) {
if (projectResult.getPublisher() > 0) {
projectResult.setAccount(memberService.accessObject(projectResult.getPublisher()).getPhone());
} else {
projectResult.setAccount("平台");
}
projectResult.setPrice(AmountConversionUtil.out(projectResult.getPrice()));
projectResult.setPriceStr(projectResult.getPrice().longValue() > 0 ? projectResult.getPrice().toString() : "免费");
projectResult.setVerifyTitle(SystemConst.verifyHandle(projectResult.getVerify()));
projectResult.setUpperTitle(SystemConst.statusUpperHandle(projectResult.getUpperStatus()));
projectResult.setPublicityTitle(SystemConst.publicityHandle(projectResult.getPublicity()));
projectResult.setStatusTitle(statusMap.get(projectResult.getStatus()));
projectResult.setTypeTitle(typeMap.get(projectResult.getType()));
projectResult.setHandleTotal(projectResult.getPublicity().equals(SystemConst.PUBLICITY_PUBLIC) ? 0 :
propertyApplyService.countByVerifyStatus(PropertyApply.RESOURCE_TYPE_PROJECT, projectResult.getId()).intValue());
}
return JSONResult.ok(page);
}
@ApiOperation(value = "修改资源信息", notes = "修改资源信息", produces = "text/plain")
@PostMapping("/v1/project/{id}")
@PreAuthorize("hasRole('res-project-edit-v1')")
@AOLog
@EditAlertLayout(
paddingMappingMethod = "getProject"
)
public JSONResult projectEditV1(@PathVariable Long id, @Valid @RequestBody ProjectParam param) {
projectService.updateProject(id, convertTo(param, ProjectParamDTO.class));
return JSONResult.ok();
}
@ApiOperation(value = "添加资源信息", notes = "添加资源信息", produces = "text/plain")
@PutMapping("/v1/project/add")
@PreAuthorize("hasRole('res-project-create-v1')")
@AOLog
@EditLayout
public JSONResult projectCreateV1(@Valid @RequestBody ProjectParam param) {
projectService.saveProject(-1L, convertTo(param, ProjectParamDTO.class));
return JSONResult.ok();
}
@ApiOperation(value = "删除资源信息", notes = "删除资源信息", produces = "text/plain")
@DeleteMapping("/v1/project/{id}")
@PreAuthorize("hasRole('res-project-del-v1')")
@AOLog
public JSONResult projectRemoveV1(@PathVariable Long id) {
projectService.removeProjectById(id);
return JSONResult.ok();
}
@ApiOperation(value = "查看资源信息", notes = "查看资源信息", produces = "text/plain")
@PreAuthorize("hasRole('res-project-query')")
@GetMapping("/v1/project/{id}")
public JSONResult<Project> getProject(@PathVariable Long id) {
Project project = projectService.accessObject(id);
project.setPrice(AmountConversionUtil.out(project.getPrice()));
return JSONResult.ok(project);
}
@ApiOperation(value = "招聘资源列表", notes = "招聘资源列表", produces = "text/plain")
@GetMapping("/v1/invite/page")
@PreAuthorize("hasRole('res-project-query')")
@PageLayout(
options = {
@CmsOption(name = "添加", uriMappingMethod = "inviteCreateV1")
},
columnOptions = {
@CmsOption(name = "查看", uriMappingMethod = "getInvite"),
@CmsOption(name = "上架", uriMappingMethod = "resUpperV1"),
@CmsOption(name = "下架", uriMappingMethod = "resLowerV1"),
@CmsOption(name = "首页推荐", uriMappingMethod = "resIndexYesV1"),
@CmsOption(name = "取消推荐", uriMappingMethod = "resIndexNoV1"),
@CmsOption(name = "修改", uriMappingMethod = "inviteEditV1"),
@CmsOption(name = "公开申请列表", uriMappingMethod = "resApplyListV1"),
@CmsOption(name = "公开", uriMappingMethod = "resApplyOpenV1"),
@CmsOption(name = "删除", uriMappingMethod = "inviteDelV1", alert = "确定删除该记录吗?")
}
)
public JSONResult<Page<InviteResult>> inviteListV1(PageParam pageParam, InviteQueryParam param) {
inviteQueryHandle(param);
Page<InviteResult> page = jpaPageConvertToPage(inviteService.page(pageParam, param), pageParam, InviteResult.class);
for (InviteResult inviteResult : page.getList()) {
if (inviteResult.getPublisher() > 0) {
inviteResult.setAccount(memberService.accessObject(inviteResult.getPublisher()).getPhone());
} else {
inviteResult.setAccount("平台");
}
inviteResult.setAddress(areaService.addressSplicing(inviteResult.getProvinceId(), inviteResult.getCityId(), inviteResult.getAreaId()));
inviteResult.setVerifyTitle(SystemConst.verifyHandle(inviteResult.getVerify()));
inviteResult.setUpperTitle(SystemConst.statusUpperHandle(inviteResult.getUpperStatus()));
inviteResult.setPublicityTitle(SystemConst.publicityHandle(inviteResult.getPublicity()));
inviteResult.setStartEndDate(String.format("%s - %s", inviteResult.getStartDate(), inviteResult.getEndDate()));
inviteResult.setHandleTotal(inviteResult.getPublicity().equals(SystemConst.PUBLICITY_PUBLIC) ? 0 :
propertyApplyService.countByVerifyStatus(PropertyApply.RESOURCE_TYPE_INVITE, inviteResult.getId()).intValue());
}
return JSONResult.ok(page);
}
@ApiOperation(value = "修改招聘资源信息", notes = "修改招聘资源信息", produces = "text/plain")
@PostMapping("/v1/invite/{id}")
@PreAuthorize("hasRole('res-project-edit-v1')")
@AOLog
@EditAlertLayout(
paddingMappingMethod = "getInvite"
)
public JSONResult inviteEditV1(@PathVariable Long id, @Valid @RequestBody InviteParam param) {
InviteParamDTO inviteParamDTO = convertTo(param, InviteParamDTO.class);
inviteParamDTO.setJobJson(JSON.toJSONString(param.getJob()));
inviteService.updateInvite(id, inviteParamDTO);
return JSONResult.ok();
}
@ApiOperation(value = "添加招聘资源信息", notes = "添加招聘资源信息", produces = "text/plain")
@PutMapping("/v1/invite/add")
@PreAuthorize("hasRole('res-project-create-v1')")
@AOLog
@EditLayout
public JSONResult inviteCreateV1(@Valid @RequestBody InviteParam param) {
InviteParamDTO inviteParamDTO = convertTo(param, InviteParamDTO.class);
inviteParamDTO.setJobJson(JSON.toJSONString(param.getJob()));
inviteService.saveInvite(-1L, inviteParamDTO);
return JSONResult.ok();
}
@ApiOperation(value = "删除招聘资源信息", notes = "删除招聘资源信息", produces = "text/plain")
@DeleteMapping("/v1/invite/{id}")
@PreAuthorize("hasRole('res-project-del-v1')")
@AOLog
public JSONResult inviteDelV1(@PathVariable Long id) {
inviteService.removeInviteById(id);
return JSONResult.ok();
}
@ApiOperation(value = "查看招聘资源信息", notes = "查看招聘资源信息", produces = "text/plain")
@PreAuthorize("hasRole('res-project-query')")
@GetMapping("/v1/invite/{id}")
public JSONResult<InviteDetailsResult> getInvite(@PathVariable Long id) {
Invite invite = inviteService.accessObject(id);
InviteDetailsResult inviteResult = convertTo(invite, InviteDetailsResult.class);
inviteResult.setArea(areaService.accessObject(invite.getAreaId()).getCityName());
inviteResult.setCity(areaService.accessObject(invite.getCityId()).getCityName());
inviteResult.setProvince(areaService.accessObject(invite.getProvinceId()).getCityName());
if (null != invite.getJob()) {
inviteResult.setJobs(JSON.parseArray(invite.getJob(), InviteJob.class));
}
return JSONResult.ok(inviteResult);
}
@ApiOperation(value = "载体资源列表", notes = "载体资源列表", produces = "text/plain")
@GetMapping("/v1/property/page")
@PreAuthorize("hasRole('res-project-query')")
@PageLayout(
options = {
@CmsOption(name = "添加", uriMappingMethod = "propertyCreateV1")
},
columnOptions = {
@CmsOption(name = "查看", uriMappingMethod = "getProperty"),
@CmsOption(name = "上架", uriMappingMethod = "resUpperV1"),
@CmsOption(name = "下架", uriMappingMethod = "resLowerV1"),
@CmsOption(name = "首页推荐", uriMappingMethod = "resIndexYesV1"),
@CmsOption(name = "取消推荐", uriMappingMethod = "resIndexNoV1"),
@CmsOption(name = "修改", uriMappingMethod = "propertyEditV1"),
@CmsOption(name = "公开申请列表", uriMappingMethod = "resApplyListV1"),
@CmsOption(name = "公开", uriMappingMethod = "resApplyOpenV1"),
@CmsOption(name = "删除", uriMappingMethod = "propertyDelV1", alert = "确定删除该记录吗?")
}
)
public JSONResult<Page<PropertyResult>> propertyListV1(PageParam pageParam, PropertyQueryParam param) {
propertyQueryHandle(param);
Page<PropertyResult> page = jpaPageConvertToPage(propertyService.page(pageParam, param), pageParam, PropertyResult.class);
for (PropertyResult propertyResult : page.getList()) {
if (propertyResult.getPublisher() > 0) {
propertyResult.setAccount(memberService.accessObject(propertyResult.getPublisher()).getPhone());
} else {
propertyResult.setAccount("平台");
}
propertyResult.setAddress(areaService.addressSplicing(propertyResult.getProvinceId(), propertyResult.getCityId(), propertyResult.getAreaId(), propertyResult.getStreetId()));
propertyResult.setPrice(AmountConversionUtil.out(propertyResult.getPrice()));
propertyResult.setPriceStr(propertyResult.getPrice().longValue() > 0 ? propertyResult.getPrice().toString() : "免费");
propertyResult.setCapacity(String.format("%s - %s", propertyResult.getMinCapacity(), propertyResult.getMaxCapacity()));
propertyResult.setVerifyTitle(SystemConst.verifyHandle(propertyResult.getVerify()));
propertyResult.setUpperTitle(SystemConst.statusUpperHandle(propertyResult.getUpperStatus()));
propertyResult.setPublicityTitle(SystemConst.publicityHandle(propertyResult.getPublicity()));
propertyResult.setStartEndDate(String.format("%s - %s", propertyResult.getStartDate(), propertyResult.getEndDate()));
propertyResult.setHandleTotal(propertyResult.getPublicity().equals(SystemConst.PUBLICITY_PUBLIC) ? 0 :
propertyApplyService.countByVerifyStatus(PropertyApply.RESOURCE_TYPE_PROPERTY, propertyResult.getId()).intValue());
}
return JSONResult.ok(page);
}
@ApiOperation(value = "修改载体资源信息", notes = "修改载体资源信息", produces = "text/plain")
@PostMapping("/v1/property/{id}")
@PreAuthorize("hasRole('res-project-edit-v1')")
@AOLog
@EditAlertLayout(
paddingMappingMethod = "getProperty"
)
public JSONResult propertyEditV1(@PathVariable Long id, @Valid @RequestBody PropertyParam param) {
propertyService.updateProperty(id, convertTo(param, PropertyParamDTO.class));
return JSONResult.ok();
}
@ApiOperation(value = "添加载体资源信息", notes = "添加载体资源信息", produces = "text/plain")
@PutMapping("/v1/property/add")
@PreAuthorize("hasRole('res-project-create-v1')")
@AOLog
@EditLayout
public JSONResult propertyCreateV1(@Valid @RequestBody PropertyParam param) {
propertyService.saveProperty(-1L, convertTo(param, PropertyParamDTO.class));
return JSONResult.ok();
}
@ApiOperation(value = "删除载体资源信息", notes = "删除载体资源信息", produces = "text/plain")
@DeleteMapping("/v1/property/{id}")
@PreAuthorize("hasRole('res-project-del-v1')")
@AOLog
public JSONResult propertyDelV1(@PathVariable Long id) {
propertyService.removePropertyById(id);
return JSONResult.ok();
}
@ApiOperation(value = "查看载体资源信息", notes = "查看载体资源信息", produces = "text/plain")
@PreAuthorize("hasRole('res-project-query')")
@GetMapping("/v1/property/{id}")
public JSONResult<PropertyDetailsResult> getProperty(@PathVariable Long id) {
PropertyDetailsResult property = convertTo(propertyService.accessObject(id), PropertyDetailsResult.class);
property.setArea(areaService.accessObject(property.getAreaId()).getCityName());
property.setCity(areaService.accessObject(property.getCityId()).getCityName());
property.setProvince(areaService.accessObject(property.getProvinceId()).getCityName());
property.setStreet(areaService.accessObject(property.getStreetId()).getCityName());
property.setPrice(AmountConversionUtil.out(property.getPrice()));
return JSONResult.ok(property);
}
@ApiOperation(value = "交易资源上架", notes = "交易资源上架", produces = "text/plain")
@PreAuthorize("hasRole('res-project-upper-edit-v1')")
@PostMapping("/v1/res/upper/{id}/{type}")
@AOLog
public JSONResult resUpperV1(@PathVariable Long id,
@ApiParam("类型 1.项目资源2.招聘资源3.载体资源4.人才库简历") @PathVariable int type) {
switch (type) {
case 1:
projectService.projectUpperShelf(id);
break;
case 2:
inviteService.inviteUpperShelf(id);
break;
case 3:
propertyService.propertyUpperShelf(id);
break;
case 4:
talentService.talentUpperShelf(id);
break;
}
return JSONResult.ok();
}
@ApiOperation(value = "交易资源下架", notes = "交易资源下架", produces = "text/plain")
@PreAuthorize("hasRole('res-project-lower-edit-v1')")
@PostMapping("/v1/res/lower/{id}/{type}")
@AOLog
public JSONResult resLowerV1(@PathVariable Long id,
@ApiParam("类型 1.项目资源2.招聘资源3.载体资源4.人才库简历") @PathVariable int type) {
switch (type) {
case 1:
projectService.projectLowerShelf(id);
break;
case 2:
inviteService.inviteLowerShelf(id);
break;
case 3:
propertyService.propertyLowerShelf(id);
break;
case 4:
talentService.talentLowerShelf(id);
break;
}
return JSONResult.ok();
}
@ApiOperation(value = "交易资源首页推荐", notes = "交易资源首页推荐", produces = "text/plain")
@PreAuthorize("hasRole('res-project-index-edit-v1')")
@PostMapping("/v1/res/index/yes/{id}/{type}")
@AOLog
public JSONResult resIndexYesV1(@PathVariable Long id,
@ApiParam("类型 1.项目资源2.招聘资源3.载体资源4.人才库简历") @PathVariable int type) {
switch (type) {
case 1:
projectService.projectIndexYes(id);
break;
case 2:
inviteService.inviteIndexYes(id);
break;
case 3:
propertyService.propertyIndexYes(id);
break;
case 4:
talentService.talentIndexYes(id);
break;
}
return JSONResult.ok();
}
@ApiOperation(value = "交易资源取消推荐", notes = "交易资源取消推荐", produces = "text/plain")
@PreAuthorize("hasRole('res-project-index-cancel-edit-v1')")
@PostMapping("/v1/res/index/no/{id}/{type}")
@AOLog
public JSONResult resIndexNoV1(@PathVariable Long id,
@ApiParam("类型 1.项目资源2.招聘资源3.载体资源4.人才库简历") @PathVariable int type) {
switch (type) {
case 1:
projectService.projectIndexNo(id);
break;
case 2:
inviteService.inviteIndexNo(id);
break;
case 3:
propertyService.propertyIndexNo(id);
break;
case 4:
talentService.talentIndexNo(id);
break;
}
return JSONResult.ok();
}
@ApiOperation(value = "资源公开申请列表", notes = "资源公开申请列表", produces = "text/plain")
@GetMapping("/v1/res/apply/page")
@PreAuthorize("hasRole('res-apply-query')")
@PageLayout()
public JSONResult<Page<PropertyApplyResult>> resApplyListV1(PageParam pageParam, PropertyApplyQueryParam param) {
if (null != param.getAccount()) {
param.setProposer(memberService.findMemberIdByPhone(param.getAccount()));
}
param.setVerify(SystemConst.VERIFY_AWAIT);
Page<PropertyApplyResult> page = jpaPageConvertToPage(propertyApplyService.page(pageParam, param), pageParam, PropertyApplyResult.class);
for (PropertyApplyResult result : page.getList()) {
result.setAccount(memberService.accessObject(result.getProposer()).getPhone());
}
return JSONResult.ok(page);
}
@ApiOperation(value = "交易资源公开", notes = "交易资源公开", produces = "text/plain")
@PreAuthorize("hasRole('res-apply-open-edit-v1')")
@PostMapping("/v1/res/apply/open")
@AOLog
public JSONResult resApplyOpenV1(@Valid @RequestBody PropertyApplyParam param) {
propertyApplyService.openPropertyApply(Arrays.asList(param.getId()));
return JSONResult.ok();
}
@ApiOperation(value = "交易资源审核", notes = "交易资源审核", produces = "text/plain")
@PreAuthorize("hasRole('res-verify-edit-v1')")
@PostMapping("/v1/res/verify")
@AOLog
public JSONResult resVerifyV1(@Valid @RequestBody VerifyParam param) {
switch (param.getType()) {
case 1:
projectService.projectVerify(param.getId(), param.getVerify(), param.getVerifyRemark());
break;
case 2:
inviteService.inviteVerify(param.getId(), param.getVerify(), param.getVerifyRemark());
break;
case 3:
propertyService.propertyVerify(param.getId(), param.getVerify(), param.getVerifyRemark());
break;
case 4:
talentService.talentVerify(param.getId(), param.getVerify(), param.getVerifyRemark());
break;
}
return JSONResult.ok();
}
@ApiOperation(value = "项目需求资源审核列表", notes = "项目需求资源审核列表", produces = "text/plain")
@GetMapping("/v1/project/verify/page")
@AdminMenu(menuName = "创新资源交易区审核管理", order = 1, url = "ResourceAudit")
@PreAuthorize("hasRole('res-project-verify-query')")
@PageLayout(
columnOptions = {
@CmsOption(name = "查看", uriMappingMethod = "getProject"),
@CmsOption(name = "审核", uriMappingMethod = "resVerifyV1")
}
)
public JSONResult<Page<ProjectResult>> projectVerifyListV1(PageParam pageParam, ProjectQueryParam param) {
if (null != param.getAccount()) {
param.setPublisher(memberService.findMemberIdByPhone(param.getAccount()));
} else {
param.setPublisher(0L);
}
param.setMarker(SystemConst.MARKER_STATUS_NO);
Page<ProjectResult> page = jpaPageConvertToPage(projectService.page(pageParam, param), pageParam, ProjectResult.class);
for (ProjectResult projectResult : page.getList()) {
if (projectResult.getPublisher() > 0) {
projectResult.setAccount(memberService.accessObject(projectResult.getPublisher()).getPhone());
}
projectResult.setPrice(AmountConversionUtil.out(projectResult.getPrice()));
}
return JSONResult.ok(page);
}
@ApiOperation(value = "项目需求资源审核状态数据统计", notes = "项目需求资源审核状态数据统计", produces = "text/plain")
@PreAuthorize("hasRole('res-project-verify-query')")
@GetMapping("/v1/project/verify/count")
public JSONResult<VerifyPageTotal> getProjectVerifyCount(ProjectQueryParam param) {
VerifyPageTotal verifyPageResult = new VerifyPageTotal();
if (null != param.getAccount()) {
param.setPublisher(memberService.findMemberIdByPhone(param.getAccount()));
} else {
param.setPublisher(0L);
}
param.setMarker(SystemConst.MARKER_STATUS_NO);
verifyPageResult.setTotalCount(projectService.count(param));
param.setVerify(SystemConst.VERIFY_AWAIT);
verifyPageResult.setVerifyAwaitCount(projectService.count(param));
param.setVerify(SystemConst.VERIFY_ADOPT);
verifyPageResult.setVerifyAdoptCount(projectService.count(param));
param.setVerify(SystemConst.VERIFY_REJECT);
verifyPageResult.setVerifyRejectCount(projectService.count(param));
return JSONResult.ok(verifyPageResult);
}
@ApiOperation(value = "载体资源审核列表", notes = "载体资源审核列表", produces = "text/plain")
@GetMapping("/v1/property/verify/page")
@PreAuthorize("hasRole('res-project-verify-query')")
@PageLayout(
columnOptions = {
@CmsOption(name = "查看", uriMappingMethod = "getProperty"),
@CmsOption(name = "审核", uriMappingMethod = "resVerifyV1")
}
)
public JSONResult<Page<PropertyResult>> propertyVerifyListV1(PageParam pageParam, PropertyQueryParam param) {
if (null != param.getAccount()) {
param.setPublisher(memberService.findMemberIdByPhone(param.getAccount()));
} else {
param.setPublisher(0L);
}
param.setMarker(SystemConst.MARKER_STATUS_NO);
Page<PropertyResult> page = jpaPageConvertToPage(propertyService.page(pageParam, param), pageParam, PropertyResult.class);
for (PropertyResult propertyResult : page.getList()) {
if (propertyResult.getPublisher() > 0) {
propertyResult.setAccount(memberService.accessObject(propertyResult.getPublisher()).getPhone());
}
propertyResult.setPrice(AmountConversionUtil.out(propertyResult.getPrice()));
propertyResult.setAddress(areaService.addressSplicing(propertyResult.getProvinceId(), propertyResult.getCityId(), propertyResult.getAreaId()));
}
return JSONResult.ok(page);
}
@ApiOperation(value = "载体资源审核状态数据统计", notes = "载体资源审核状态数据统计", produces = "text/plain")
@PreAuthorize("hasRole('res-project-verify-query')")
@GetMapping("/v1/property/verify/count")
public JSONResult<VerifyPageTotal> getPropertyVerifyCount(PropertyQueryParam param) {
VerifyPageTotal verifyPageResult = new VerifyPageTotal();
if (null != param.getAccount()) {
param.setPublisher(memberService.findMemberIdByPhone(param.getAccount()));
} else {
param.setPublisher(0L);
}
param.setMarker(SystemConst.MARKER_STATUS_NO);
verifyPageResult.setTotalCount(propertyService.count(param));
param.setVerify(SystemConst.VERIFY_AWAIT);
verifyPageResult.setVerifyAwaitCount(propertyService.count(param));
param.setVerify(SystemConst.VERIFY_ADOPT);
verifyPageResult.setVerifyAdoptCount(propertyService.count(param));
param.setVerify(SystemConst.VERIFY_REJECT);
verifyPageResult.setVerifyRejectCount(propertyService.count(param));
return JSONResult.ok(verifyPageResult);
}
@ApiOperation(value = "招聘资源审核列表", notes = "招聘资源审核列表", produces = "text/plain")
@GetMapping("/v1/invite/verify/page")
@PreAuthorize("hasRole('res-project-verify-query')")
@PageLayout(
columnOptions = {
@CmsOption(name = "查看", uriMappingMethod = "getInvite"),
@CmsOption(name = "审核", uriMappingMethod = "resVerifyV1")
}
)
public JSONResult<Page<InviteResult>> inviteVerifyListV1(PageParam pageParam, InviteQueryParam param) {
if (null != param.getAccount()) {
param.setPublisher(memberService.findMemberIdByPhone(param.getAccount()));
} else {
param.setPublisher(0L);
}
param.setMarker(SystemConst.MARKER_STATUS_NO);
Page<InviteResult> page = jpaPageConvertToPage(inviteService.page(pageParam, param), pageParam, InviteResult.class);
for (InviteResult inviteResult : page.getList()) {
if (inviteResult.getPublisher() > 0) {
inviteResult.setAccount(memberService.accessObject(inviteResult.getPublisher()).getPhone());
}
inviteResult.setAddress(areaService.addressSplicing(inviteResult.getProvinceId(), inviteResult.getCityId(), inviteResult.getAreaId()));
}
return JSONResult.ok(page);
}
@ApiOperation(value = "招聘资源审核状态数据统计", notes = "招聘资源审核状态数据统计", produces = "text/plain")
@PreAuthorize("hasRole('res-project-verify-query')")
@GetMapping("/v1/invite/verify/count")
public JSONResult<VerifyPageTotal> getInviteVerifyCount(InviteQueryParam param) {
VerifyPageTotal verifyPageResult = new VerifyPageTotal();
if (null != param.getAccount()) {
param.setPublisher(memberService.findMemberIdByPhone(param.getAccount()));
} else {
param.setPublisher(0L);
}
param.setMarker(SystemConst.MARKER_STATUS_NO);
verifyPageResult.setTotalCount(inviteService.count(param));
param.setVerify(SystemConst.VERIFY_AWAIT);
verifyPageResult.setVerifyAwaitCount(inviteService.count(param));
param.setVerify(SystemConst.VERIFY_ADOPT);
verifyPageResult.setVerifyAdoptCount(inviteService.count(param));
param.setVerify(SystemConst.VERIFY_REJECT);
verifyPageResult.setVerifyRejectCount(inviteService.count(param));
return JSONResult.ok(verifyPageResult);
}
@ApiOperation(value = "人才库简历审核列表", notes = "人才库简历审核列表", produces = "text/plain")
@GetMapping("/v1/talent/verify/page")
@PreAuthorize("hasRole('res-project-verify-query')")
@PageLayout(
columnOptions = {
@CmsOption(name = "查看", uriMappingMethod = "getTalent"),
@CmsOption(name = "审核", uriMappingMethod = "resVerifyV1")
}
)
public JSONResult<Page<TalentResult>> talentVerifyListV1(PageParam pageParam, TalentQueryParam param) {
Page<TalentResult> page = jpaPageConvertToPage(talentService.page(pageParam, param), pageParam, TalentResult.class);
for (TalentResult inviteResult : page.getList()) {
if (inviteResult.getPublisher() > 0) {
inviteResult.setAccount(memberService.accessObject(inviteResult.getPublisher()).getPhone());
}
if (inviteResult.getPublisher() > 0) {
inviteResult.setAccount(memberService.accessObject(inviteResult.getPublisher()).getPhone());
} else {
inviteResult.setAccount("平台");
}
inviteResult.setVerifyTitle(SystemConst.verifyHandle(inviteResult.getVerify()));
}
return JSONResult.ok(page);
}
@ApiOperation(value = "人才库简历审核状态数据统计", notes = "人才库简历审核状态数据统计", produces = "text/plain")
@PreAuthorize("hasRole('res-project-verify-query')")
@GetMapping("/v1/talent/verify/count")
public JSONResult<VerifyPageTotal> geTalentVerifyCount(TalentQueryParam param) {
VerifyPageTotal verifyPageResult = new VerifyPageTotal();
verifyPageResult.setTotalCount(talentService.count(param));
param.setVerify(SystemConst.VERIFY_AWAIT);
verifyPageResult.setVerifyAwaitCount(talentService.count(param));
param.setVerify(SystemConst.VERIFY_ADOPT);
verifyPageResult.setVerifyAdoptCount(talentService.count(param));
param.setVerify(SystemConst.VERIFY_REJECT);
verifyPageResult.setVerifyRejectCount(talentService.count(param));
return JSONResult.ok(verifyPageResult);
}
@ApiOperation(value = "人才库列表", notes = "人才库列表", produces = "text/plain")
@GetMapping("/v1/talent/page")
@PreAuthorize("hasRole('res-project-query')")
@PageLayout(
options = {
@CmsOption(name = "发布简历", uriMappingMethod = "talentCreateV1")
},
columnOptions = {
@CmsOption(name = "查看", uriMappingMethod = "getTalent"),
@CmsOption(name = "上架", uriMappingMethod = "resUpperV1"),
@CmsOption(name = "下架", uriMappingMethod = "resLowerV1"),
@CmsOption(name = "首页推荐", uriMappingMethod = "resIndexYesV1"),
@CmsOption(name = "取消推荐", uriMappingMethod = "resIndexNoV1"),
@CmsOption(name = "修改", uriMappingMethod = "talentEditV1"),
@CmsOption(name = "删除", uriMappingMethod = "talentDelV1", alert = "确定删除该记录吗?")
}
)
public JSONResult<Page<TalentResult>> talentListV1(PageParam pageParam, TalentQueryParam param) {
talentQueryHandle(param);
Page<TalentResult> page = jpaPageConvertToPage(talentService.page(pageParam, param), pageParam, TalentResult.class);
for (TalentResult talentResult : page.getList()) {
if (talentResult.getPublisher() > 0) {
talentResult.setAccount(memberService.accessObject(talentResult.getPublisher()).getPhone());
} else {
talentResult.setAccount("平台");
}
talentResult.setVerifyTitle(SystemConst.verifyHandle(talentResult.getVerify()));
talentResult.setUpperTitle(SystemConst.statusUpperHandle(talentResult.getUpperStatus()));
talentResult.setPublicityTitle(SystemConst.publicityHandle(talentResult.getPublicity()));
}
return JSONResult.ok(page);
}
@ApiOperation(value = "修改简历信息", notes = "修改简历信息", produces = "text/plain")
@PostMapping("/v1/talent/{id}")
@PreAuthorize("hasRole('res-project-edit-v1')")
@AOLog
@EditAlertLayout(
paddingMappingMethod = "getTalent"
)
public JSONResult talentEditV1(@PathVariable Long id, @Valid @RequestBody TalentParam param) {
TalentParamDTO talentParamDTO = convertTo(param, TalentParamDTO.class);
talentService.updateTalent(id, talentParamDTO);
return JSONResult.ok();
}
@ApiOperation(value = "添加简历信息", notes = "添加简历信息", produces = "text/plain")
@PutMapping("/v1/talent/add")
@PreAuthorize("hasRole('res-project-create-v1')")
@AOLog
public JSONResult talentCreateV1(@RequestBody TalentParam param) {
TalentParamDTO talentParamDTO = convertTo(param, TalentParamDTO.class);
talentService.saveTalent(-1L, talentParamDTO);
return JSONResult.ok();
}
@ApiOperation(value = "删除简历信息", notes = "删除简历信息", produces = "text/plain")
@DeleteMapping("/v1/talent/{id}")
@PreAuthorize("hasRole('res-project-del-v1')")
@AOLog
public JSONResult talentDelV1(@PathVariable Long id) {
talentService.removeById(id);
return JSONResult.ok();
}
@ApiOperation(value = "查看简历信息", notes = "查看简历信息", produces = "text/plain")
@PreAuthorize("hasRole('res-project-query')")
@GetMapping("/v1/talent/{id}")
public JSONResult<TalentDetailsResult> getTalent(@PathVariable Long id) {
Talent talent = talentService.accessObject(id);
TalentDetailsResult talentDetailsResult = convertTo(talent, TalentDetailsResult.class);
talentDetailsResult.setArea(areaService.accessObject(talent.getAreaId()).getCityName());
talentDetailsResult.setCity(areaService.accessObject(talent.getCityId()).getCityName());
talentDetailsResult.setProvince(areaService.accessObject(talent.getProvinceId()).getCityName());
return JSONResult.ok(talentDetailsResult);
}
}