|
|
@@ -0,0 +1,123 @@
|
|
|
+package org.jeecg.modules.autoMonitor;
|
|
|
+
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+
|
|
|
+import org.jeecg.common.api.vo.Result;
|
|
|
+import org.jeecg.common.exception.JeecgBootException;
|
|
|
+import org.jeecg.common.utils.CryptTool;
|
|
|
+import org.jeecg.common.utils.HttpsContants;
|
|
|
+import org.jeecg.common.utils.OauthApi;
|
|
|
+import org.jeecg.common.utils.OauthTokenUtils;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+
|
|
|
+/**
|
|
|
+* @Description: autoMonitor
|
|
|
+* @Author: jeecg-boot
|
|
|
+* @Date: 2020-02-17
|
|
|
+* @Version: V1.0
|
|
|
+*/
|
|
|
+@RestController
|
|
|
+@RequestMapping("/oauth/autoMonitor")
|
|
|
+@Slf4j
|
|
|
+public class AuthMonitorController {
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 用户合同监测
|
|
|
+ * @param pageNo
|
|
|
+ * @param pageSize
|
|
|
+ * @param req
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/userContract")
|
|
|
+ public Result<IPage<Object>> userContract(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
|
+ @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
|
|
+ HttpServletRequest req) {
|
|
|
+ Result<IPage<Object>> result = new Result<IPage<Object>>();
|
|
|
+ String accessToken = OauthTokenUtils.getDayAccessToken();
|
|
|
+ String requestUrl = OauthApi.userContract;
|
|
|
+ Map<String, Object> parameters = new HashMap<>();
|
|
|
+ parameters.put("pageNo", pageNo);
|
|
|
+ parameters.put("pageSize", pageSize);
|
|
|
+ log.info("param============{}", JSONObject.toJSONString(parameters));
|
|
|
+ //数据加密
|
|
|
+ String biz_content = CryptTool.encode(JSONObject.toJSONString(parameters));
|
|
|
+ JSONObject jsonObject = OauthTokenUtils.doRequest(requestUrl, HttpsContants.POST, biz_content, accessToken);
|
|
|
+ log.info("jsonObject===={}", jsonObject);
|
|
|
+ if (jsonObject != null) {
|
|
|
+ if (jsonObject.getBoolean("success")) {
|
|
|
+ log.info("用户合同自动监测信息===={}", jsonObject);
|
|
|
+ JSONObject jsonObject1=jsonObject.getJSONObject("result");
|
|
|
+ List<Object> list= (List<Object>) jsonObject1.get("records");
|
|
|
+ Page<Object> pageList=new Page<Object>();
|
|
|
+ pageList.setRecords(list);
|
|
|
+ pageList.setTotal(jsonObject1.getInteger("total"));
|
|
|
+ pageList.setCurrent(jsonObject1.getInteger("current"));
|
|
|
+ pageList.setSize(jsonObject1.getInteger("size"));
|
|
|
+ result.setSuccess(true);
|
|
|
+ result.setResult(pageList);
|
|
|
+ return result;
|
|
|
+ } else {
|
|
|
+ //抛出异常
|
|
|
+ throw new JeecgBootException("未查询到数据");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ throw new JeecgBootException("操作失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 企业合同监测
|
|
|
+ * @param pageNo
|
|
|
+ * @param pageSize
|
|
|
+ * @param req
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/companyContract")
|
|
|
+ public Result<IPage<Object>> companyContract(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
|
+ @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
|
|
+ HttpServletRequest req) {
|
|
|
+ Result<IPage<Object>> result = new Result<IPage<Object>>();
|
|
|
+ String accessToken = OauthTokenUtils.getDayAccessToken();
|
|
|
+ String requestUrl = OauthApi.companyContract;
|
|
|
+ Map<String, Object> parameters = new HashMap<>();
|
|
|
+ parameters.put("pageNo", pageNo);
|
|
|
+ parameters.put("pageSize", pageSize);
|
|
|
+ log.info("param============{}", JSONObject.toJSONString(parameters));
|
|
|
+ //数据加密
|
|
|
+ String biz_content = CryptTool.encode(JSONObject.toJSONString(parameters));
|
|
|
+ JSONObject jsonObject = OauthTokenUtils.doRequest(requestUrl, HttpsContants.POST, biz_content, accessToken);
|
|
|
+ log.info("jsonObject===={}", jsonObject);
|
|
|
+ if (jsonObject != null) {
|
|
|
+ if (jsonObject.getBoolean("success")) {
|
|
|
+ log.info("企业合同自动监测信息===={}", jsonObject);
|
|
|
+ JSONObject jsonObject1=jsonObject.getJSONObject("result");
|
|
|
+ List<Object> list= (List<Object>) jsonObject1.get("records");
|
|
|
+ Page<Object> pageList=new Page<Object>();
|
|
|
+ pageList.setRecords(list);
|
|
|
+ pageList.setTotal(jsonObject1.getInteger("total"));
|
|
|
+ pageList.setCurrent(jsonObject1.getInteger("current"));
|
|
|
+ pageList.setSize(jsonObject1.getInteger("size"));
|
|
|
+ result.setSuccess(true);
|
|
|
+ result.setResult(pageList);
|
|
|
+ return result;
|
|
|
+ } else {
|
|
|
+ //抛出异常
|
|
|
+ throw new JeecgBootException("未查询到数据");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ throw new JeecgBootException("操作失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|