From 0f63fe8e24dc050716b193e0b76a069700a4b5a8 Mon Sep 17 00:00:00 2001 From: guyuliang Date: Mon, 26 Aug 2024 17:04:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E7=94=A8=E6=88=B7=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/IndexDataController.java | 26 ++++++++++++- .../bocloud/sms/interfaces/IndexService.java | 2 + .../bocloud/sms/service/IndexServiceImpl.java | 38 +++++++++++++++---- 3 files changed, 57 insertions(+), 9 deletions(-) diff --git a/bocloud.sms.booter/src/main/java/com/bocloud/sms/booter/controller/IndexDataController.java b/bocloud.sms.booter/src/main/java/com/bocloud/sms/booter/controller/IndexDataController.java index 95997aa..bfd6680 100644 --- a/bocloud.sms.booter/src/main/java/com/bocloud/sms/booter/controller/IndexDataController.java +++ b/bocloud.sms.booter/src/main/java/com/bocloud/sms/booter/controller/IndexDataController.java @@ -28,15 +28,39 @@ public class IndexDataController { private IndexService indexService; + /** + * 待办工单列表 + * @param pager + * @param requestContext + * @return + */ @GetMapping("/doneWorkOrder") @Operation(summary = "待办工单列表") public GeneralResult doneWorkOrder(Pager pager, @Value(Common.REQ_CONTEXT) RequestContext requestContext) { return indexService.doneWorkOrder(pager, requestContext); } + /** + * 工单统计 + * @param pager + * @param requestContext + * @return + */ @GetMapping("/workOrder/stattic") - @Operation(summary = "待办工单列表") + @Operation(summary = "工单统计") public GeneralResult workOrderStatic(Pager pager, @Value(Common.REQ_CONTEXT) RequestContext requestContext) { return indexService.workOrderStatic(requestContext); } + + /** + * 当前用户首页数据展示模块的数据查询 + * @param pager + * @param requestContext + * @return + */ + @GetMapping("/userData/stattic") + @Operation(summary = "当前用户首页数据展示模块的数据查询") + public GeneralResult userStatic(Pager pager, @Value(Common.REQ_CONTEXT) RequestContext requestContext) { + return indexService.userDataStatic(requestContext); + } } diff --git a/bocloud.sms.service/src/main/java/com/bocloud/sms/interfaces/IndexService.java b/bocloud.sms.service/src/main/java/com/bocloud/sms/interfaces/IndexService.java index 6dc7302..670afe4 100644 --- a/bocloud.sms.service/src/main/java/com/bocloud/sms/interfaces/IndexService.java +++ b/bocloud.sms.service/src/main/java/com/bocloud/sms/interfaces/IndexService.java @@ -11,4 +11,6 @@ public interface IndexService { GeneralResult doneWorkOrder(Pager pager, RequestContext requestContext); GeneralResult workOrderStatic(RequestContext requestContext); + + GeneralResult userDataStatic(RequestContext requestContext); } diff --git a/bocloud.sms.service/src/main/java/com/bocloud/sms/service/IndexServiceImpl.java b/bocloud.sms.service/src/main/java/com/bocloud/sms/service/IndexServiceImpl.java index b522552..6f69b74 100644 --- a/bocloud.sms.service/src/main/java/com/bocloud/sms/service/IndexServiceImpl.java +++ b/bocloud.sms.service/src/main/java/com/bocloud/sms/service/IndexServiceImpl.java @@ -51,30 +51,52 @@ public class IndexServiceImpl implements IndexService { JSONObject param = new JSONObject(); User user = userRepository.query(requestContext.getTarget()); param.put("userId", "1111"); - param.put("page",1); + param.put("page", 1); param.put("limit", Integer.MAX_VALUE); String result = ykUtil.call(YkInfo.getTaskList, param, JSONArray.class); JSONObject jsonObject = JSONArray.parseObject(result, JSONObject.class); Integer total = jsonObject.getInteger("total"); - Map resultMap = new HashMap<>(); - resultMap.put("orderTotal",total); + Map resultMap = new HashMap<>(); + resultMap.put("orderTotal", total); List data = JSONObject.parseObject(jsonObject.getString("data"), List.class); Integer waitDoneTotal = 0; Integer doneTotal = 0; for (JSONObject obj : data) { - if("0".equals(obj.getString("approve_status"))){ + if ("0".equals(obj.getString("approve_status"))) { waitDoneTotal++; - }else { + } else { doneTotal++; } } - resultMap.put("waitDoneTotal",waitDoneTotal); - resultMap.put("doneTotal",doneTotal); + resultMap.put("waitDoneTotal", waitDoneTotal); + resultMap.put("doneTotal", doneTotal); - return new GeneralResult(true, resultMap,"查询成功"); + return new GeneralResult(true, resultMap, "查询成功"); + } catch (Exception e) { + log.info("查询失败", e); + return new GeneralResult(false, "查询失败"); + } + } + + @Override + public GeneralResult userDataStatic(RequestContext requestContext) { + try { + //查询当前用户授权应用 + JSONObject param = new JSONObject(); + param.put("userId", "1111"); + param.put("type", "user"); + String result = ykUtil.call(YkInfo.getUserAppList, param, JSONArray.class); + + //获取用户信息 + JSONObject userParam = new JSONObject(); + param.put("userParam", "1111"); + String userRolesStr = ykUtil.call(YkInfo.getUserRoles, param, JSONArray.class); + + + return new GeneralResult(true, "查询成功"); } catch (Exception e) { log.info("查询失败", e); return new GeneralResult(false, "查询失败");