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 a3ce543..95997aa 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 @@ -30,7 +30,13 @@ public class IndexDataController { @GetMapping("/doneWorkOrder") @Operation(summary = "待办工单列表") - public GeneralResult list(Pager pager, @Value(Common.REQ_CONTEXT) RequestContext requestContext) { + public GeneralResult doneWorkOrder(Pager pager, @Value(Common.REQ_CONTEXT) RequestContext requestContext) { return indexService.doneWorkOrder(pager, requestContext); } + + @GetMapping("/workOrder/stattic") + @Operation(summary = "待办工单列表") + public GeneralResult workOrderStatic(Pager pager, @Value(Common.REQ_CONTEXT) RequestContext requestContext) { + return indexService.workOrderStatic(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 a767c98..6dc7302 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 @@ -9,4 +9,6 @@ import java.util.List; public interface IndexService { GeneralResult doneWorkOrder(Pager pager, RequestContext requestContext); + + GeneralResult workOrderStatic(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 2558b30..6fb7bc7 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 @@ -14,6 +14,10 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + @Service("IndexService") @Slf4j public class IndexServiceImpl implements IndexService { @@ -28,16 +32,53 @@ public class IndexServiceImpl implements IndexService { try { JSONObject param = new JSONObject(); User user = userRepository.query(requestContext.getTarget()); - param.put("userId","1111"); - param.put("page",pager.getPage()); - param.put("limit",pager.getRows()); + param.put("userId", "1111"); + param.put("page", pager.getPage()); + param.put("limit", pager.getRows()); String result = ykUtil.call(YkInfo.getTaskList, param, JSONArray.class); - - log.info("result"); + log.info("result:" + result); JSONObject jsonObject = JSONArray.parseObject(result, JSONObject.class); - return new GeneralResult(true, jsonObject,"查询成功"); + return new GeneralResult(true, jsonObject, "查询成功"); } catch (Exception e) { - log.info("查询失败",e); + log.info("查询失败", e); + return new GeneralResult(false, "查询失败"); + } + } + + @Override + public GeneralResult workOrderStatic(RequestContext requestContext) { + try { + + JSONObject param = new JSONObject(); + User user = userRepository.query(requestContext.getTarget()); + param.put("userId", "1111"); + param.put("page",1); + param.put("limit", Integer.MAX_VALUE); + String result = ykUtil.call(YkInfo.getTaskList, param, JSONArray.class); + log.info("result:" + result); + JSONObject jsonObject = JSONArray.parseObject(result, JSONObject.class); + Integer total = jsonObject.getInteger("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"))){ + waitDoneTotal++; + }else { + doneTotal++; + } + } + + resultMap.put("waitDoneTotal",waitDoneTotal); + resultMap.put("doneTotal",doneTotal); + + return new GeneralResult(true, "查询成功"); + } catch (Exception e) { + log.info("查询失败", e); return new GeneralResult(false, "查询失败"); } }