统计代办总数
parent
c53a32c1ba
commit
b3f4c0b185
|
@ -30,7 +30,13 @@ public class IndexDataController {
|
||||||
|
|
||||||
@GetMapping("/doneWorkOrder")
|
@GetMapping("/doneWorkOrder")
|
||||||
@Operation(summary = "待办工单列表")
|
@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);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,4 +9,6 @@ import java.util.List;
|
||||||
|
|
||||||
public interface IndexService {
|
public interface IndexService {
|
||||||
GeneralResult doneWorkOrder(Pager pager, RequestContext requestContext);
|
GeneralResult doneWorkOrder(Pager pager, RequestContext requestContext);
|
||||||
|
|
||||||
|
GeneralResult workOrderStatic(RequestContext requestContext);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,10 @@ import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Service("IndexService")
|
@Service("IndexService")
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class IndexServiceImpl implements IndexService {
|
public class IndexServiceImpl implements IndexService {
|
||||||
|
@ -32,8 +36,7 @@ public class IndexServiceImpl implements IndexService {
|
||||||
param.put("page", pager.getPage());
|
param.put("page", pager.getPage());
|
||||||
param.put("limit", pager.getRows());
|
param.put("limit", pager.getRows());
|
||||||
String result = ykUtil.call(YkInfo.getTaskList, param, JSONArray.class);
|
String result = ykUtil.call(YkInfo.getTaskList, param, JSONArray.class);
|
||||||
|
log.info("result:" + result);
|
||||||
log.info("result");
|
|
||||||
JSONObject jsonObject = JSONArray.parseObject(result, JSONObject.class);
|
JSONObject jsonObject = JSONArray.parseObject(result, JSONObject.class);
|
||||||
return new GeneralResult(true, jsonObject, "查询成功");
|
return new GeneralResult(true, jsonObject, "查询成功");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -41,4 +44,42 @@ public class IndexServiceImpl implements IndexService {
|
||||||
return new GeneralResult(false, "查询失败");
|
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<String,Object> resultMap = new HashMap<>();
|
||||||
|
resultMap.put("orderTotal",total);
|
||||||
|
|
||||||
|
List<JSONObject> 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, "查询失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue