Commit 80f87523 authored by suhuiguang's avatar suhuiguang

1.app 任务统计

parent eb7fd81d
......@@ -6,7 +6,7 @@ public class CalendarStatusCountRespone {
/**
* 个数
*/
private Double count;
private Long count;
/**
* 状态
*/
......@@ -16,7 +16,7 @@ public class CalendarStatusCountRespone {
public double getCount() {
return count;
}
public void setCount(double count) {
public void setCount(Long count) {
this.count = count;
}
public String getStatus() {
......
package com.yeejoin.amos.maintenance.business.controller;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.maintenance.business.service.intfc.IStatisticsService;
import com.yeejoin.amos.maintenance.business.util.CommonResponse;
import com.yeejoin.amos.maintenance.business.util.CommonResponseUtil;
import com.yeejoin.amos.maintenance.core.framework.PersonIdentify;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import java.util.HashMap;
import java.util.Map;
/**
* @author DELL
*/
@RestController
@RequestMapping(value = "/api/statistics")
@Api(tags = "统计api")
public class StatisticsController extends AbstractBaseController {
@Autowired
IStatisticsService iStatisticsService;
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PersonIdentify
@GetMapping(value = "/task")
@ApiOperation(value = "app首页任务统计")
public CommonResponse taskStatusStatistics(){
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getOrgCode(reginParams);
Map<String,Object> result = iStatisticsService.taskStatusStatistics(opIdentifyInfo(),loginOrgCode);
return CommonResponseUtil.success(result);
}
}
......@@ -179,4 +179,5 @@ public interface PlanTaskMapper extends BaseMapper {
List<Map<String, Object>> queryTimeAxis(HashMap<String, Object> params);
List<Map<String, Object>> statisticsTaskWithAuth(Map<String, Object> param);
}
package com.yeejoin.amos.maintenance.business.feign;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.*;
import java.util.LinkedHashMap;
import java.util.List;
......@@ -37,5 +34,14 @@ public interface EquipFeign {
*/
@RequestMapping(value = "${equip.fegin.prefix}"+"/area/tree", method = RequestMethod.GET ,consumes="application/json")
LinkedHashMap<String,Object> getRegionTress();
/**
* 查询维保到期设备
* @param type
* @param companyId
* @return
*/
@GetMapping(value = "${equip.fegin.prefix}+/facility")
List<Map<String,Object>> overTimeMaintenanceFacility(@RequestParam String type,String companyId);
}
package com.yeejoin.amos.maintenance.business.feign;
//@RequestLine
//@FeignClient(name = "${Remote3D.fegin.name}",configuration=FeignConfiguration.class)
//public interface Remote3D {
// @RequestMapping(value = "/patrol/check", method = RequestMethod.POST)
// @ResponseBody
// CommonResponse checkStatusPush( @RequestBody List<PointCheckInfoRespone> pointCheckInfo);
//
//
// @RequestMapping(value = "/patrol/task", method = RequestMethod.POST)
// CommonResponse errorTaskPushTo3D( @RequestBody List<TaskInfoRespone> taskInfoRespone);
//
//
// @RequestMapping(value = "/view3d/synchronous/points", method = RequestMethod.POST)
// CommonResponse pointInfoPush( @RequestBody List<PointInfoSyn3DRespone> pointInfoResponseList);
//
//
// @RequestMapping(value = "/view3d/synchronous/routes", method = RequestMethod.POST)
// CommonResponse routeInfoPush( @RequestBody List<RouteResponse> routeResponseList);
//
//
//
//
//
//
//
//}
//package com.yeejoin.amos.maintenance.business.feign;
//
//import java.util.List;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.http.HttpEntity;
//import org.springframework.http.HttpHeaders;
//import org.springframework.http.MediaType;
//import org.springframework.stereotype.Service;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;
//import org.springframework.web.bind.annotation.ResponseBody;
//import org.springframework.web.client.RestTemplate;
//
//import com.yeejoin.amos.maintenance.business.util.CommonResponse;
//import com.yeejoin.amos.maintenance.business.util.CommonResponseUtil;
//import com.yeejoin.amos.maintenance.core.common.response.PointCheckInfoRespone;
//import com.yeejoin.amos.maintenance.core.common.response.PointInfoSyn3DRespone;
//import com.yeejoin.amos.maintenance.core.common.response.RouteResponse;
//import com.yeejoin.amos.maintenance.core.common.response.TaskInfoRespone;
//
//
//
////三维远程访问
//@Service("remote3DServer")
//public class Remote3DServer {
// @Autowired
// private RestTemplate restTemplate;
//
// @Value("${Remote3D.fegin.name}")
// private String Remote3DFeginName;
//
//
// private static String checkStatusPush = "/patrol/check";
//
// private static String errorTaskPushTo3D = "/patrol/task";
//
// private static String pointInfoPush = "/view3d/synchronous/points";
//
// private static String routeInfoPush = "/view3d/synchronous/routes";
//
//
//
// public String geturls(String url){
// return "http://"+Remote3DFeginName+url;
// }
// public HttpHeaders getHeader(String toke,String product,String appKey){
// HttpHeaders headers = new HttpHeaders();
// headers.setContentType(MediaType.APPLICATION_JSON);
// headers.set("Content-Type", "application/json");
// headers.set("token", toke);
// headers.set("product",product);
// headers.set("appKey", appKey);
// return headers;
// }
//
//
// public CommonResponse checkStatusPush( String toke,String product,String appKey, List<PointCheckInfoRespone> pointCheckInfo){
// try {
// HttpEntity httpEntity = new HttpEntity<>(pointCheckInfo, getHeader( toke, product, appKey));
// CommonResponse commonResponse1 = restTemplate.postForObject(geturls(checkStatusPush),httpEntity, CommonResponse.class);
// return commonResponse1;
// } catch (Exception e) {
// e.printStackTrace();
// return CommonResponseUtil.failure("发送失败");
//
// }
// }
//
//
//
// public CommonResponse errorTaskPushTo3D( String toke,String product,String appKey, List<TaskInfoRespone> taskInfoRespone){
// try {
// HttpEntity httpEntity = new HttpEntity<>(taskInfoRespone, getHeader( toke, product, appKey));
// CommonResponse commonResponse1 = restTemplate.postForObject(geturls(errorTaskPushTo3D),httpEntity, CommonResponse.class);
// return commonResponse1;
// } catch (Exception e) {
// e.printStackTrace();
// return CommonResponseUtil.failure("发送失败");
//
// }
// }
//
//
// public CommonResponse pointInfoPush(String toke,String product,String appKey,List<PointInfoSyn3DRespone> pointInfoResponseList){
// try {
// HttpEntity httpEntity = new HttpEntity<>(pointInfoResponseList, getHeader( toke, product, appKey));
// CommonResponse commonResponse1 = restTemplate.postForObject(geturls(pointInfoPush),httpEntity, CommonResponse.class);
// return commonResponse1;
// } catch (Exception e) {
// e.printStackTrace();
// return CommonResponseUtil.failure("发送失败");
//
// }
// }
//
//
// public CommonResponse routeInfoPush( String toke,String product,String appKey, List<RouteResponse> routeResponseList){
// try {
// HttpEntity httpEntity = new HttpEntity<>(routeResponseList, getHeader( toke, product, appKey));
// CommonResponse commonResponse1 = restTemplate.postForObject(geturls(routeInfoPush),httpEntity, CommonResponse.class);
// return commonResponse1;
// } catch (Exception e) {
// e.printStackTrace();
// return CommonResponseUtil.failure("发送失败");
//
// }
// }
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//}
package com.yeejoin.amos.maintenance.business.service.impl;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.maintenance.business.dao.mapper.PlanTaskMapper;
import com.yeejoin.amos.maintenance.business.feign.EquipFeign;
import com.yeejoin.amos.maintenance.business.service.intfc.IStatisticsService;
import com.yeejoin.amos.maintenance.common.enums.PlanTaskDetailIsFinishEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.Bean;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author DELL
*/
@Service
public class StatisticsServiceImpl implements IStatisticsService {
@Autowired
PlanTaskMapper planTaskMapper;
@Autowired
EquipFeign equipFeign;
@Override
public Map<String, Object> taskStatusStatistics(ReginParams.PersonIdentity opIdentifyInfo, String orgCode) {
Map<String, Object> param = Bean.BeantoMap(opIdentifyInfo);
param.put("orgCode", orgCode);
List<Map<String, Object>> list = planTaskMapper.statisticsTaskWithAuth(param);
Map<Integer, Long> statusNumberMap = list.stream().collect(Collectors.toMap(map -> Integer.parseInt(map.get("is_finish").toString()), v -> Long.parseLong(v.get("total").toString())));
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("waitExecuteTask", statusNumberMap.get(PlanTaskDetailIsFinishEnum.UNFINISHED.getValue()) == null ? 0L : statusNumberMap.get(PlanTaskDetailIsFinishEnum.UNFINISHED.getValue()));
resultMap.put("overTimeTask", statusNumberMap.get(PlanTaskDetailIsFinishEnum.OVERTIME.getValue()) == null ? 0L : statusNumberMap.get(PlanTaskDetailIsFinishEnum.OVERTIME.getValue()));
List<Map<String, Object>> overTimeFacility = new ArrayList<>();
//overTimeFacility = equipFeign.overTimeMaintenanceFacility(opIdentifyInfo.getIdentityType(),opIdentifyInfo.getCompanyId());
resultMap.put("overTimeFacility", overTimeFacility.size());
return resultMap;
}
}
package com.yeejoin.amos.maintenance.business.service.intfc;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import java.util.Map;
/**
* @author DELL
*/
public interface IStatisticsService {
/**
* 维保任务统计
* @return Map<String, Object>
*/
Map<String, Object> taskStatusStatistics(ReginParams.PersonIdentity opIdentifyInfo, String loginOrgCode);
}
......@@ -833,4 +833,24 @@
ORDER BY
ppk.begin_time DESC LIMIT 60
</select>
<select id="statisticsTaskWithAuth" resultType="java.util.Map">
SELECT
count(1) as total,
td.is_finish
from p_plan_task_detail td ,
p_plan_task t,
p_route r
where
td.task_no = t.id
and t.route_id = r.id
<choose>
<when test="identityType==1">
and (t.org_code LIKE CONCAT( #{orgCode}, '-%' ) or t.org_code= #{orgCode} )
</when>
<when test="identityType==2">
And r.owner_id = #{companyId}
</when>
</choose>
GROUP BY td.is_finish
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment