|
|
@@ -1,6 +1,7 @@
|
|
|
package org.jeecg.modules.hlguser.controller;
|
|
|
|
|
|
import java.util.Arrays;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
|
@@ -9,10 +10,19 @@ import java.io.UnsupportedEncodingException;
|
|
|
import java.net.URLDecoder;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
+import org.jeecg.common.exception.JeecgBootException;
|
|
|
import org.jeecg.common.system.query.QueryGenerator;
|
|
|
import org.jeecg.common.util.oConvertUtils;
|
|
|
+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.jeecg.modules.hlguser.entity.HlgUser;
|
|
|
import org.jeecg.modules.hlguser.entity.HlgUserSubcontract;
|
|
|
+import org.jeecg.modules.hlguser.service.IHlgUserService;
|
|
|
import org.jeecg.modules.hlguser.service.IHlgUserSubcontractService;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
@@ -45,6 +55,8 @@ import com.alibaba.fastjson.JSON;
|
|
|
public class HlgUserSubcontractController {
|
|
|
@Autowired
|
|
|
private IHlgUserSubcontractService hlgUserSubcontractService;
|
|
|
+ @Autowired
|
|
|
+ private IHlgUserService hlgUserService;
|
|
|
|
|
|
/**
|
|
|
* 分页列表查询
|
|
|
@@ -67,7 +79,58 @@ public class HlgUserSubcontractController {
|
|
|
result.setResult(pageList);
|
|
|
return result;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 分页列表查询用户合同列表
|
|
|
+ * @param
|
|
|
+ * @param pageNo
|
|
|
+ * @param pageSize
|
|
|
+ * @param req
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/userSubcontractorContractList")
|
|
|
+ public Result<IPage<Object>> userSubcontractorContractList(HlgUserSubcontract hlgUserSubcontract,
|
|
|
+ @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.subcontractorContractList;
|
|
|
+ Map<String, Object> parameters = new HashMap<>();
|
|
|
+ HlgUser hlgUser=hlgUserService.getById(hlgUserSubcontract.getUserId());
|
|
|
+ parameters.put("pageNo", pageNo);
|
|
|
+ parameters.put("pageSize", pageSize);
|
|
|
+ parameters.put("userCode",hlgUser.getUserCode() );
|
|
|
+ parameters.put("subcontractorId",hlgUserSubcontract.getSubcontractorId() );
|
|
|
+ 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);
|
|
|
+ result.setResult(pageList);
|
|
|
+ pageList.setTotal(jsonObject1.getInteger("total"));
|
|
|
+ pageList.setCurrent(jsonObject1.getInteger("current"));
|
|
|
+ pageList.setSize(jsonObject1.getInteger("size"));
|
|
|
+ result.setSuccess(true);
|
|
|
+ return result;
|
|
|
+ } else {
|
|
|
+ //抛出异常
|
|
|
+ throw new JeecgBootException("查询失败");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ throw new JeecgBootException("查询失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 添加
|
|
|
* @param hlgUserSubcontract
|