Browse Source

#app首页统计

zhongwei
yang_shj 4 weeks ago
parent
commit
2e9157810a
  1. 3
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/accessTicket/dto/request/AccessTicketPageReqDTO.java
  2. 22
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/accessTicket/dto/request/AccessTicketTaskCountReqDTO.java
  3. 10
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/accessTicket/feign/AccessTicketClientFallback.java
  4. 13
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/accessTicket/feign/IAccessTicketClient.java
  5. 17
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/accessTicket/vo/AccessTicketTaskCountVo.java
  6. 7
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/HydropowerController.java
  7. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/HydropowerService.java
  8. 97
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java
  9. 38
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/vo/AppTaskVo.java
  10. 37
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/accessTicket/controller/AccessTicketController.java
  11. 15
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/accessTicket/feign/AccessTicketClient.java
  12. 3
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/accessTicket/mapper/AccessTicketMapper.xml
  13. 4
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/accessTicket/service/AccessTicketService.java
  14. 26
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/accessTicket/service/impl/AccessTicketServiceImpl.java

3
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/accessTicket/dto/request/AccessTicketPageReqDTO.java

@ -16,4 +16,7 @@ public class AccessTicketPageReqDTO implements Serializable {
@ApiModelProperty("结束时间 : YYYY-MM-DD HH:MM:SS")
private String endTime;
@ApiModelProperty("过滤未完成任务:false-全部任务 true-过滤未完成任务")
private Boolean isComplete;
}

22
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/accessTicket/dto/request/AccessTicketTaskCountReqDTO.java

@ -0,0 +1,22 @@
package com.hnac.hzims.ticket.accessTicket.dto.request;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author ysj
*/
@Data
public class AccessTicketTaskCountReqDTO {
@ApiModelProperty("开始时间 : YYYY-MM-DD HH:MM:SS")
private String startTime;
@ApiModelProperty("结束时间 : YYYY-MM-DD HH:MM:SS")
private String endTime;
@ApiModelProperty("过滤未完成任务:false-全部任务 true-过滤未完成任务")
private List<Long> depts;
}

10
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/accessTicket/feign/AccessTicketClientFallback.java

@ -1,8 +1,13 @@
package com.hnac.hzims.ticket.accessTicket.feign;
import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.ticket.accessTicket.dto.request.AccessTicketTaskCountReqDTO;
import com.hnac.hzims.ticket.accessTicket.vo.AccessTicketTaskCountVo;
import org.springblade.core.tool.api.R;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
/**
* @author ysj
@ -14,4 +19,9 @@ public class AccessTicketClientFallback implements IAccessTicketClient {
public R<Boolean> listener(ProcessWorkFlowResponse processWorkFlowResponse) {
return R.fail("执行失败!");
}
@Override
public R<AccessTicketTaskCountVo> taskCount(AccessTicketTaskCountReqDTO param) {
return R.data(new AccessTicketTaskCountVo());
}
}

13
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/accessTicket/feign/IAccessTicketClient.java

@ -1,12 +1,19 @@
package com.hnac.hzims.ticket.accessTicket.feign;
import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.ticket.accessTicket.dto.request.AccessTicketTaskCountReqDTO;
import com.hnac.hzims.ticket.accessTicket.vo.AccessTicketTaskCountVo;
import com.hnac.hzims.ticket.allTicket.fegin.TicketInfoAllClientFallback;
import com.hnac.hzims.ticket.constants.TicketConstants;
import org.apache.ibatis.annotations.Param;
import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
* @author ysj
@ -21,6 +28,12 @@ public interface IAccessTicketClient {
String ACCESS_TICKET_PROCESS_LISTENER = API_PREFIX + "/listener";
String ACCESS_TICKET_TASK_COUNT = API_PREFIX + "/taskCount";
@PostMapping(ACCESS_TICKET_PROCESS_LISTENER)
R<Boolean> listener(@RequestBody ProcessWorkFlowResponse processWorkFlowResponse);
@PostMapping(ACCESS_TICKET_TASK_COUNT)
R<AccessTicketTaskCountVo> taskCount(@RequestBody AccessTicketTaskCountReqDTO param);
}

17
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/accessTicket/vo/AccessTicketTaskCountVo.java

@ -0,0 +1,17 @@
package com.hnac.hzims.ticket.accessTicket.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
*/
@Data
public class AccessTicketTaskCountVo {
@ApiModelProperty("任务总数")
private Integer taskTotal;
@ApiModelProperty("未完成任务数")
private Integer taskIncomplete;
}

7
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/HydropowerController.java

@ -93,4 +93,11 @@ public class HydropowerController extends BladeController {
public R<AppAreaDutyVo> areaDuty(@ApiParam(value = "站点机构ID") Long deptId) {
return R.data(service.areaDuty(deptId));
}
@ApiOperation("app当月日常维护、巡检、检修报单")
@GetMapping("/app/task")
@ApiOperationSupport(order = 8)
public R<AppTaskVo> task(@ApiParam(value = "站点机构ID") Long deptId) {
return R.data(service.task(deptId));
}
}

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/HydropowerService.java

@ -24,4 +24,6 @@ public interface HydropowerService {
List<AppHydropowerStationVo> area(Long deptId);
AppAreaDutyVo areaDuty(Long deptId);
AppTaskVo task(Long deptId);
}

97
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java

@ -28,6 +28,9 @@ import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity;
import com.hnac.hzims.operational.maintenance.service.IOperMaintenanceTaskService;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IStationService;
import com.hnac.hzims.ticket.accessTicket.dto.request.AccessTicketTaskCountReqDTO;
import com.hnac.hzims.ticket.accessTicket.feign.IAccessTicketClient;
import com.hnac.hzims.ticket.accessTicket.vo.AccessTicketTaskCountVo;
import com.hnac.hzims.ticket.workTicket.feign.ITicketInfoClient;
import com.hnac.hzims.ticket.workTicket.vo.TicketMonthVO;
import com.hnac.hzinfo.datasearch.soe.ISoeClient;
@ -98,6 +101,8 @@ public class HydropowerServiceImpl implements HydropowerService {
private final ITicketInfoClient ticketInfoClient;
private final IAccessTicketClient accessTicketClient;
private final IPlanGenertionClient planGenertionClient;
private final IInspectTaskReportClient inspectTaskReportClient;
@ -1684,4 +1689,96 @@ public class HydropowerServiceImpl implements HydropowerService {
}
return builder.substring(0,builder.toString().length() - 1);
}
/**
* app当月日常维护巡检检修报单
* @param deptId
* @return
*/
@Override
public AppTaskVo task(Long deptId) {
// 参数
if(ObjectUtil.isEmpty(deptId)){
deptId = Long.valueOf(AuthUtil.getDeptId());
}
Calendar calendar = Calendar.getInstance();
String endTime = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
calendar.add(Calendar.MONTH,-calendar.get(Calendar.MONTH));
calendar.add(Calendar.DAY_OF_MONTH,-calendar.get(Calendar.DAY_OF_MONTH));
calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY));
calendar.add(Calendar.MINUTE,-calendar.get(Calendar.MINUTE));
calendar.add(Calendar.SECOND,-calendar.get(Calendar.SECOND));
String startTime = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
List<Long> depts = Collections.singletonList(deptId);
// 查询数据
AppTaskVo task = new AppTaskVo();
ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat("month-task-pool-%d").build();
ExecutorService pool = new ThreadPoolExecutor(3, 3, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(256), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy());
CountDownLatch countDownLatch = new CountDownLatch(3);
// 巡检
pool.execute(()-> {
// 查询当班巡检任务
task.setInspectionTaskCount(0);
task.setNotInspectionTaskCount(0);
Map<String, Object> params = new HashMap<>();
params.put("startDate",startTime);
params.put("endDate",endTime);
params.put("deptList",depts);
R<DutyInspectTaskVO> response = inspectTaskReportClient.getDutyInspectTask(params);
if(!response.isSuccess() || ObjectUtil.isEmpty(response.getData())){
countDownLatch.countDown();
return;
}
// 赋值
task.setInspectionTaskCount(response.getData().getInspectTaskSum());
task.setInspectionTaskCount(response.getData().getNotExecuteTaskCount());
countDownLatch.countDown();
});
// 维护
pool.execute(()-> {
task.setMaintenanceTaskCount(0);
task.setNotMaintenanceTaskCount(0);
// 查询当班日常维护任务
List<OperMaintenanceTaskEntity> list = operMaintenanceTaskService.getMaintenanceTask(startTime, endTime, depts);
if(CollectionUtil.isEmpty(list)){
countDownLatch.countDown();
return;
}
// 总数
task.setMaintenanceTaskCount(list.size());
// 完成数
int notMaintenanceTaskCount = (int) list.stream().filter(o-> !"结束".equals(o.getFlowTaskName())).count();
task.setNotMaintenanceTaskCount(notMaintenanceTaskCount);
countDownLatch.countDown();
});
// 检修报单
pool.execute(()-> {
task.setAccessTaskCount(0);
task.setNotAccessTaskCount(0);
AccessTicketTaskCountReqDTO param = new AccessTicketTaskCountReqDTO();
param.setStartTime(startTime);
param.setEndTime(endTime);
param.setDepts(depts);
R<AccessTicketTaskCountVo> access = accessTicketClient.taskCount(param);
if(!access.isSuccess() || ObjectUtil.isEmpty(access.getData())){
countDownLatch.countDown();
return;
}
task.setAccessTaskCount(access.getData().getTaskTotal());
task.setNotAccessTaskCount(access.getData().getTaskIncomplete());
countDownLatch.countDown();
});
// 等待所有线程执行完成
try {
countDownLatch.await();
} catch (InterruptedException e) {
e.printStackTrace();
Thread.currentThread().interrupt();
}
pool.shutdown();
return task;
}
}

38
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/vo/AppTaskVo.java

@ -0,0 +1,38 @@
package com.hnac.hzims.operational.main.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* APP首页-当班数据
* @author ysj
*/
@Data
public class AppTaskVo {
@ApiModelProperty("巡检任务总数")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer inspectionTaskCount;
@ApiModelProperty("巡检未完成数")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer notInspectionTaskCount;
@ApiModelProperty("日常维护任务总数")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer maintenanceTaskCount;
@ApiModelProperty("日常维护任务未完成数")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer notMaintenanceTaskCount;
@ApiModelProperty("检修报单任务总数")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer accessTaskCount;
@ApiModelProperty("检修报单未完成数")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer notAccessTaskCount;
}

37
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/accessTicket/controller/AccessTicketController.java

@ -33,13 +33,32 @@ public class AccessTicketController extends BladeController {
private final AccessTicketService accessTicketService;
@GetMapping("/externalStartProcess")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "外部发起检修工作票流程")
public R<Boolean> externalStartProcess(@RequestParam("isExternal")Integer isExternal,
@RequestParam("isEmergency")Integer isEmergency,
@RequestParam("deviceCode")String deviceCode,
@RequestParam("faultDescribe")String faultDescribe,
@RequestParam(value = "imgs",required = false)List<String> imgs,
@RequestParam(value = "videos",required = false)List<String> videos) {
AccessTicketStartProcessReqDTO param = new AccessTicketStartProcessReqDTO();
param.setIsExternal(isExternal);
param.setIsEmergency(isEmergency);
param.setDeviceCode(deviceCode);
param.setFaultDescribe(faultDescribe);
param.setImgs(imgs);
param.setVideos(videos);
return R.status(accessTicketService.startProcess(param));
}
@PostMapping("/startProcess")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "检修工作票流程开启")
public R<Boolean> startProcess(@RequestBody AccessTicketStartProcessReqDTO param) {
return R.status(accessTicketService.startProcess(param));
}
@GetMapping("/page")
@ApiOperationSupport(order = 2)
@ -48,29 +67,37 @@ public class AccessTicketController extends BladeController {
return R.data(accessTicketService.pageCondition(param,query));
}
@PostMapping("/detail")
@GetMapping("/list")
@ApiOperationSupport(order = 3)
@ApiOperation(value = "app端任务列表")
public R<IPage<AccessTicketPageRspDTO>> list(AccessTicketPageReqDTO param,Query query) {
param.setIsComplete(true);
return R.data(accessTicketService.pageCondition(param,query));
}
@PostMapping("/detail")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "检修工作票详情信息")
public R<AccessTicketDetailRspDTO> pageCondition(@RequestBody AccessTicketDetailReqDTO param) {
return R.data(accessTicketService.detail(param));
}
@GetMapping(value = "/preview")
@ApiOperationSupport(order = 4)
@ApiOperationSupport(order = 5)
@ApiOperation(value = "检修工作票预览")
public void preview(@RequestParam("id") Long id ) {
accessTicketService.preview(id);
}
@GetMapping("/revoke")
@ApiOperationSupport(order = 5)
@ApiOperationSupport(order = 6)
@ApiOperation(value = "撤销报修")
public R<Boolean> revoke(@RequestParam("ticketId") Long ticketId) {
return R.status(accessTicketService.revoke(ticketId));
}
@GetMapping("/roleQueryUser")
@ApiOperationSupport(order = 5)
@ApiOperationSupport(order = 7)
@ApiOperation(value = "撤销报修")
public R<List<User>> roleQueryUser(@RequestParam("roleAlias") String roleAlias) {
return R.data(accessTicketService.roleQueryUser(roleAlias));

15
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/accessTicket/feign/AccessTicketClient.java

@ -1,13 +1,16 @@
package com.hnac.hzims.ticket.accessTicket.feign;
import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.ticket.accessTicket.dto.request.AccessTicketTaskCountReqDTO;
import com.hnac.hzims.ticket.accessTicket.service.AccessTicketService;
import com.hnac.hzims.ticket.accessTicket.vo.AccessTicketTaskCountVo;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author ysj
@ -24,4 +27,10 @@ public class AccessTicketClient implements IAccessTicketClient {
public R<Boolean> listener(@RequestBody ProcessWorkFlowResponse processWorkFlowResponse) {
return R.status(accessTicketService.listener(processWorkFlowResponse));
}
@Override
@PostMapping(ACCESS_TICKET_TASK_COUNT)
public R<AccessTicketTaskCountVo> taskCount(@RequestBody AccessTicketTaskCountReqDTO param) {
return R.data(accessTicketService.taskCount(param));
}
}

3
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/accessTicket/mapper/AccessTicketMapper.xml

@ -12,6 +12,9 @@
<if test="param.endTime != null and para.endTime != ''">
AND CREATE_TIME &lt;= #{param.endTime}
</if>
<if test="param.isComplete != null and param.isComplete == true">
AND TASK_NAME = '流程结束'
</if>
</where>
ORDER BY CREATE_TIME DESC
</select>

4
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/accessTicket/service/AccessTicketService.java

@ -6,9 +6,11 @@ import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.ticket.accessTicket.dto.request.AccessTicketDetailReqDTO;
import com.hnac.hzims.ticket.accessTicket.dto.request.AccessTicketPageReqDTO;
import com.hnac.hzims.ticket.accessTicket.dto.request.AccessTicketStartProcessReqDTO;
import com.hnac.hzims.ticket.accessTicket.dto.request.AccessTicketTaskCountReqDTO;
import com.hnac.hzims.ticket.accessTicket.dto.response.AccessTicketDetailRspDTO;
import com.hnac.hzims.ticket.accessTicket.dto.response.AccessTicketPageRspDTO;
import com.hnac.hzims.ticket.accessTicket.entity.AccessTicketEntity;
import com.hnac.hzims.ticket.accessTicket.vo.AccessTicketTaskCountVo;
import org.springblade.core.mp.support.Query;
import org.springblade.system.user.entity.User;
@ -33,4 +35,6 @@ public interface AccessTicketService extends IService<AccessTicketEntity> {
void preview(Long id);
List<User> roleQueryUser(String roleAlias);
AccessTicketTaskCountVo taskCount(AccessTicketTaskCountReqDTO param);
}

26
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/accessTicket/service/impl/AccessTicketServiceImpl.java

@ -14,6 +14,7 @@ import com.hnac.hzims.ticket.accessTicket.constants.AccessTicketConstants;
import com.hnac.hzims.ticket.accessTicket.dto.request.AccessTicketDetailReqDTO;
import com.hnac.hzims.ticket.accessTicket.dto.request.AccessTicketPageReqDTO;
import com.hnac.hzims.ticket.accessTicket.dto.request.AccessTicketStartProcessReqDTO;
import com.hnac.hzims.ticket.accessTicket.dto.request.AccessTicketTaskCountReqDTO;
import com.hnac.hzims.ticket.accessTicket.dto.response.AccessTicketDetailRspDTO;
import com.hnac.hzims.ticket.accessTicket.dto.response.AccessTicketPageRspDTO;
import com.hnac.hzims.ticket.accessTicket.entity.AccessTicketEntity;
@ -21,6 +22,7 @@ import com.hnac.hzims.ticket.accessTicket.mapper.AccessTicketMapper;
import com.hnac.hzims.ticket.accessTicket.service.AccessTicketService;
import com.hnac.hzims.ticket.accessTicket.vo.AccessTicketMeasureVo;
import com.hnac.hzims.ticket.accessTicket.vo.AccessTicketPreviewVo;
import com.hnac.hzims.ticket.accessTicket.vo.AccessTicketTaskCountVo;
import com.hnac.hzims.ticket.utils.AsposeUtil;
import com.hnac.hzims.ticket.utils.PdfUtils;
import com.hnac.hzims.ticket.utils.WordUtils;
@ -485,4 +487,28 @@ public class AccessTicketServiceImpl extends ServiceImpl<AccessTicketMapper, Acc
}
return users.getData();
}
/**
* 任务数量统计
* @param param
* @return
*/
@Override
public AccessTicketTaskCountVo taskCount(AccessTicketTaskCountReqDTO param) {
AccessTicketTaskCountVo task = new AccessTicketTaskCountVo();
task.setTaskTotal(0);
task.setTaskIncomplete(0);
List<AccessTicketEntity> entitys = this.list(Wrappers.<AccessTicketEntity>lambdaQuery()
.ge(AccessTicketEntity::getCreateTime,param.getStartTime())
.le(AccessTicketEntity::getCreateTime,param.getEndTime())
.in(AccessTicketEntity::getCreateDept,param.getDepts())
);
log.info("task_count: {}",entitys);
if(CollectionUtil.isEmpty(entitys)){
return task;
}
task.setTaskTotal(entitys.size());
task.setTaskIncomplete((int) entitys.stream().filter(o->!"流程结束".equals(o.getTaskName())).count());
return task;
}
}
Loading…
Cancel
Save