WebMediumController.java
4.01 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
package com.lhcredit.project.webbusiness.controller;
import com.alibaba.fastjson.JSONObject;
import com.lhcredit.framework.aspectj.lang.annotation.CheckToken;
import com.lhcredit.framework.web.domain.AjaxResult;
import com.lhcredit.framework.web.page.TableDataInfo;
import com.lhcredit.project.business.BasicInformation.service.BasicInformationService;
import com.lhcredit.project.business.Medium.service.MediumService;
import com.lhcredit.project.business.TianYC.entity.param.RequestParams;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import jdk.nashorn.api.scripting.AbstractJSObject;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import static com.lhcredit.framework.web.domain.AjaxResult.success;
@Api(tags = "媒体信息")
@Controller
@RequestMapping("/api-V2.0/medium")
@RequiredArgsConstructor
public class WebMediumController {
private final MediumService mediumService;
private final BasicInformationService basicInformationService;
@ResponseBody
@ApiOperation(value = "招聘信息", notes = "招聘信息")
@PostMapping("/employments")
@CheckToken
public AjaxResult employments(@Validated @RequestBody RequestParams requestParams) {
JSONObject jsonObject1 = basicInformationService.baseinfo2(requestParams);
if (jsonObject1!=null&&"2000".equals(jsonObject1.getString("code"))){
JSONObject data = jsonObject1.getJSONObject("data");
requestParams.setName(data.getString("name"));
}
JSONObject jsonObject = mediumService.employments(requestParams);
System.err.println(jsonObject);
if ("2000".equals(jsonObject.getString("code"))){
TableDataInfo rspData = new TableDataInfo();
rspData.setRows( jsonObject.getJSONArray("data"));
rspData.setTotal(jsonObject.getLong("total"));
return success(rspData);
}else{
return new AjaxResult(AjaxResult.Type.NODATA,"暂无数据");
}
}
@ResponseBody
@ApiOperation(value = "新闻信息", notes = "新闻信息")
@PostMapping("/news")
@CheckToken
public AjaxResult news(@Validated @RequestBody RequestParams requestParams) {
JSONObject jsonObject = mediumService.news(requestParams);
System.err.println(jsonObject);
if ("2000".equals(jsonObject.getString("code"))){
TableDataInfo rspData = new TableDataInfo();
rspData.setRows( jsonObject.getJSONArray("data"));
rspData.setTotal(jsonObject.getLong("total"));
return success(rspData);
}else{
return new AjaxResult(AjaxResult.Type.NODATA,"暂无数据");
}
}
@ResponseBody
@ApiOperation(value = "微信公众号", notes = "微信公众号")
@PostMapping("/publicWeChat")
@CheckToken
public AjaxResult publicWeChat(@Validated @RequestBody RequestParams requestParams) {
JSONObject jsonObject1 = basicInformationService.baseinfo2(requestParams);
if (jsonObject1!=null&&"2000".equals(jsonObject1.getString("code"))){
JSONObject data = jsonObject1.getJSONObject("data");
requestParams.setName(data.getString("name"));
}
JSONObject jsonObject = mediumService.publicWeChat(requestParams);
System.err.println(jsonObject);
if ("2000".equals(jsonObject.getString("code"))){
TableDataInfo rspData = new TableDataInfo();
rspData.setRows(jsonObject.getJSONObject("data").getJSONArray("items"));
rspData.setTotal(jsonObject.getJSONObject("data").getLong("total"));
return success(rspData);
}else{
return new AjaxResult(AjaxResult.Type.NODATA,"暂无数据");
}
}
}