瀏覽代碼

企业账户管理-明细接口调整

ZhangWenQiang 4 年之前
父節點
當前提交
05b003448b

+ 31 - 23
happy-boot-module-powerjob/src/main/java/org/jeecg/modules/hlgaccount/service/impl/HlgAccountDetailServiceImpl.java

@@ -738,32 +738,40 @@ public class HlgAccountDetailServiceImpl extends ServiceImpl<HlgAccountDetailMap
     @Override
     public Page<HlgAccountDetail> pageManagerListApi(Integer pageNo, Integer pageSize, HlgAccountDetail hlgAccountDetail, HttpServletRequest req) {
         Page<HlgAccountDetail> page = new Page<>(pageNo, pageSize);
-        //收支明细列表
-        String accessToken = OauthTokenUtils.getDayAccessToken();
-        String requestUrl = OauthApi.companyAccountDetailList;
-        Map<String, Object> parameters = new HashMap<>();
-        parameters.put("pageNo", pageNo);
-        parameters.put("pageSize", pageSize);
-        parameters.put("subcontractorId", hlgAccountDetail.getSubcontractorId());
-        parameters.put("cpType", hlgAccountDetail.getCpType());
-        parameters.put("companyId", hlgAccountDetail.getCompanyId());
-        //数据加密
-        String biz_content = CryptTool.encode(JSONObject.toJSONString(parameters));
-        JSONObject jsonObject = OauthTokenUtils.doRequest(requestUrl, HttpsContants.POST, biz_content, accessToken);
-        log.info("收支明细列表===={}", jsonObject);
-        if (jsonObject != null) {
-            if (jsonObject.getBoolean(HttpsContants.SUCCESS_FLAG)) {
-                log.info("收支明细列表成功===={}", jsonObject);
-                JSONObject jsonObject1 = jsonObject.getJSONObject("result");
-                List<HlgAccountDetail> list = (List<HlgAccountDetail>) jsonObject1.get("records");
-                log.info("收支明细列表数组==={}", list);
-                page.setRecords(list);
-                page.setTotal(jsonObject1.getLong("total"));
+        //获取当前登录用户
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        QueryWrapper<HlgCompany> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("sys_org_code", sysUser.getOrgCode());
+        HlgCompany hlgCompany = hlgCompanyService.getOne(queryWrapper);
+        if (hlgCompany != null) {
+            //收支明细列表
+            String accessToken = OauthTokenUtils.getDayAccessToken();
+            String requestUrl = OauthApi.companyAccountDetailList;
+            Map<String, Object> parameters = new HashMap<>();
+            parameters.put("pageNo", pageNo);
+            parameters.put("pageSize", pageSize);
+            parameters.put("subcontractorId", hlgAccountDetail.getSubcontractorId());
+            parameters.put("cpType", hlgAccountDetail.getCpType());
+            parameters.put("companyId", hlgAccountDetail.getCompanyId());
+            parameters.put("companyCode", hlgCompany.getCompanyCode());
+            //数据加密
+            String biz_content = CryptTool.encode(JSONObject.toJSONString(parameters));
+            JSONObject jsonObject = OauthTokenUtils.doRequest(requestUrl, HttpsContants.POST, biz_content, accessToken);
+            log.info("收支明细列表===={}", jsonObject);
+            if (jsonObject != null) {
+                if (jsonObject.getBoolean(HttpsContants.SUCCESS_FLAG)) {
+                    log.info("收支明细列表成功===={}", jsonObject);
+                    JSONObject jsonObject1 = jsonObject.getJSONObject("result");
+                    List<HlgAccountDetail> list = (List<HlgAccountDetail>) jsonObject1.get("records");
+                    log.info("收支明细列表数组==={}", list);
+                    page.setRecords(list);
+                    page.setTotal(jsonObject1.getLong("total"));
+                } else {
+                    throw new JeecgBootException("查询数据异常");
+                }
             } else {
                 throw new JeecgBootException("查询数据异常");
             }
-        } else {
-            throw new JeecgBootException("查询数据异常");
         }
         return page;
     }