Merge remote-tracking branch 'origin/develop' into develop

develop
bayuzhen 2024-08-26 16:53:36 +08:00
commit d938d659a4
3 changed files with 56 additions and 9 deletions

View File

@ -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);
}
}

View File

@ -9,4 +9,6 @@ import java.util.List;
public interface IndexService {
GeneralResult doneWorkOrder(Pager pager, RequestContext requestContext);
GeneralResult workOrderStatic(RequestContext requestContext);
}

View File

@ -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,51 @@ 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");
JSONArray dataArray = JSONArray.parseArray(result);
return new GeneralResult(true, dataArray,"查询成功");
JSONObject jsonObject = JSONArray.parseObject(result, JSONObject.class);
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);
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, resultMap,"查询成功");
} catch (Exception e) {
log.info("查询失败", e);
return new GeneralResult(false, "查询失败");
}
}