Compare commits

...

2 Commits

Author SHA1 Message Date
guyuliang 5c720b68b7 Merge remote-tracking branch 'origin/develop' into develop 2024-08-26 17:05:06 +08:00
guyuliang 0f63fe8e24 查询用户相关信息 2024-08-26 17:04:37 +08:00
3 changed files with 57 additions and 9 deletions

View File

@ -28,15 +28,39 @@ public class IndexDataController {
private IndexService indexService; private IndexService indexService;
/**
*
* @param pager
* @param requestContext
* @return
*/
@GetMapping("/doneWorkOrder") @GetMapping("/doneWorkOrder")
@Operation(summary = "待办工单列表") @Operation(summary = "待办工单列表")
public GeneralResult doneWorkOrder(Pager pager, @Value(Common.REQ_CONTEXT) RequestContext requestContext) { public GeneralResult doneWorkOrder(Pager pager, @Value(Common.REQ_CONTEXT) RequestContext requestContext) {
return indexService.doneWorkOrder(pager, requestContext); return indexService.doneWorkOrder(pager, requestContext);
} }
/**
*
* @param pager
* @param requestContext
* @return
*/
@GetMapping("/workOrder/stattic") @GetMapping("/workOrder/stattic")
@Operation(summary = "待办工单列表") @Operation(summary = "工单统计")
public GeneralResult workOrderStatic(Pager pager, @Value(Common.REQ_CONTEXT) RequestContext requestContext) { public GeneralResult workOrderStatic(Pager pager, @Value(Common.REQ_CONTEXT) RequestContext requestContext) {
return indexService.workOrderStatic(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);
}
} }

View File

@ -11,4 +11,6 @@ public interface IndexService {
GeneralResult doneWorkOrder(Pager pager, RequestContext requestContext); GeneralResult doneWorkOrder(Pager pager, RequestContext requestContext);
GeneralResult workOrderStatic(RequestContext requestContext); GeneralResult workOrderStatic(RequestContext requestContext);
GeneralResult userDataStatic(RequestContext requestContext);
} }

View File

@ -51,30 +51,52 @@ public class IndexServiceImpl implements IndexService {
JSONObject param = new JSONObject(); JSONObject param = new JSONObject();
User user = userRepository.query(requestContext.getTarget()); User user = userRepository.query(requestContext.getTarget());
param.put("userId", "1111"); param.put("userId", "1111");
param.put("page",1); param.put("page", 1);
param.put("limit", Integer.MAX_VALUE); param.put("limit", Integer.MAX_VALUE);
String result = ykUtil.call(YkInfo.getTaskList, param, JSONArray.class); String result = ykUtil.call(YkInfo.getTaskList, param, JSONArray.class);
JSONObject jsonObject = JSONArray.parseObject(result, JSONObject.class); JSONObject jsonObject = JSONArray.parseObject(result, JSONObject.class);
Integer total = jsonObject.getInteger("total"); Integer total = jsonObject.getInteger("total");
Map<String,Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
resultMap.put("orderTotal",total); resultMap.put("orderTotal", total);
List<JSONObject> data = JSONObject.parseObject(jsonObject.getString("data"), List.class); List<JSONObject> data = JSONObject.parseObject(jsonObject.getString("data"), List.class);
Integer waitDoneTotal = 0; Integer waitDoneTotal = 0;
Integer doneTotal = 0; Integer doneTotal = 0;
for (JSONObject obj : data) { for (JSONObject obj : data) {
if("0".equals(obj.getString("approve_status"))){ if ("0".equals(obj.getString("approve_status"))) {
waitDoneTotal++; waitDoneTotal++;
}else { } else {
doneTotal++; doneTotal++;
} }
} }
resultMap.put("waitDoneTotal",waitDoneTotal); resultMap.put("waitDoneTotal", waitDoneTotal);
resultMap.put("doneTotal",doneTotal); 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) { } catch (Exception e) {
log.info("查询失败", e); log.info("查询失败", e);
return new GeneralResult(false, "查询失败"); return new GeneralResult(false, "查询失败");