Showing
4 changed files
with
100 additions
and
0 deletions
| 1 | +package com.lframework.xingyun.sc.bo.customer.develop; | |
| 2 | + | |
| 3 | +import com.lframework.starter.web.core.bo.BaseBo; | |
| 4 | +import com.lframework.starter.web.core.dto.BaseDto; | |
| 5 | +import com.lframework.xingyun.sc.entity.CustomerDevelopPlan; | |
| 6 | +import io.swagger.annotations.ApiModelProperty; | |
| 7 | +import lombok.Data; | |
| 8 | + | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * <p> | |
| 12 | + * 客户开发计划统计 BO | |
| 13 | + * </p> | |
| 14 | + * | |
| 15 | + */ | |
| 16 | +@Data | |
| 17 | +public class CustomerDevelopPlanStatisticsBo extends BaseBo<CustomerDevelopPlan> implements BaseDto { | |
| 18 | + | |
| 19 | + /** | |
| 20 | + * 全部数量 | |
| 21 | + */ | |
| 22 | + @ApiModelProperty("allCount") | |
| 23 | + private Integer allCount; | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * 已办数量 | |
| 27 | + */ | |
| 28 | + @ApiModelProperty("已办数量") | |
| 29 | + private Integer completedCount; | |
| 30 | + | |
| 31 | + /** | |
| 32 | + * 待办数量 | |
| 33 | + */ | |
| 34 | + @ApiModelProperty("待办数量") | |
| 35 | + private Integer todoCount; | |
| 36 | +} | ... | ... |
| ... | ... | @@ -15,6 +15,7 @@ import com.lframework.xingyun.basedata.service.customer.CustomerService; |
| 15 | 15 | import com.lframework.xingyun.basedata.service.office.OfficeService; |
| 16 | 16 | import com.lframework.xingyun.basedata.service.product.ProductVarietyService; |
| 17 | 17 | import com.lframework.xingyun.basedata.service.workshop.WorkshopService; |
| 18 | +import com.lframework.xingyun.sc.bo.customer.develop.CustomerDevelopPlanStatisticsBo; | |
| 18 | 19 | import com.lframework.xingyun.sc.bo.customer.develop.GetCustomerDevelopPlanBo; |
| 19 | 20 | import com.lframework.xingyun.sc.enums.ExportType; |
| 20 | 21 | import com.lframework.xingyun.sc.excel.customer.CustomerDevelopExportTaskWorker; |
| ... | ... | @@ -171,6 +172,19 @@ public class CustomerDevelopPlanController extends DefaultBaseController { |
| 171 | 172 | |
| 172 | 173 | |
| 173 | 174 | /** |
| 175 | + * 待办类型数量统计 | |
| 176 | + * | |
| 177 | + */ | |
| 178 | + @ApiOperation("待办类型数量统计") | |
| 179 | + @HasPermission({"customer-dev-manage:customer-dev-plan:statistics"}) | |
| 180 | + @GetMapping("/todoTypeStatistics") | |
| 181 | + public InvokeResult<CustomerDevelopPlanStatisticsBo> todoTypeStatistics() { | |
| 182 | + CustomerDevelopPlanStatisticsBo statistics = customerDevelopPlanService.todoTypeStatistics(); | |
| 183 | + return InvokeResultBuilder.success(statistics); | |
| 184 | + } | |
| 185 | + | |
| 186 | + | |
| 187 | + /** | |
| 174 | 188 | * 封装客户开发数据 |
| 175 | 189 | * |
| 176 | 190 | * @param dataList 数据集 | ... | ... |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/customer/CustomerDevelopPlanServiceImpl.java
| 1 | 1 | package com.lframework.xingyun.sc.impl.customer; |
| 2 | 2 | |
| 3 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
| 3 | 4 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| 4 | 5 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| 5 | 6 | import com.github.pagehelper.PageInfo; |
| ... | ... | @@ -10,6 +11,7 @@ import com.lframework.starter.bpm.service.FlowInstanceWrapperService; |
| 10 | 11 | import com.lframework.starter.bpm.vo.flow.task.QueryTodoTaskListVo; |
| 11 | 12 | import com.lframework.starter.web.core.components.security.SecurityUtil; |
| 12 | 13 | import com.lframework.starter.web.core.utils.*; |
| 14 | +import com.lframework.xingyun.sc.bo.customer.develop.CustomerDevelopPlanStatisticsBo; | |
| 13 | 15 | import com.lframework.xingyun.sc.entity.CustomerDevelopPlan; |
| 14 | 16 | import com.lframework.starter.web.core.impl.BaseMpServiceImpl; |
| 15 | 17 | import com.lframework.starter.web.core.components.resp.PageResult; |
| ... | ... | @@ -262,4 +264,44 @@ public class CustomerDevelopPlanServiceImpl extends BaseMpServiceImpl<CustomerDe |
| 262 | 264 | .eq(CustomerDevelopPlan::getId, id); |
| 263 | 265 | getBaseMapper().update(updateWrapper); |
| 264 | 266 | } |
| 267 | + | |
| 268 | + | |
| 269 | + /** | |
| 270 | + * 统计待办任务类型数量 | |
| 271 | + * | |
| 272 | + * @return CustomerDevelopPlanStatisticsBo | |
| 273 | + */ | |
| 274 | + @Override | |
| 275 | + public CustomerDevelopPlanStatisticsBo todoTypeStatistics() { | |
| 276 | + // 获取所有客户开发数据 | |
| 277 | + LambdaQueryWrapper<CustomerDevelopPlan> queryWrapper = Wrappers.lambdaQuery(CustomerDevelopPlan.class); | |
| 278 | + List<CustomerDevelopPlan> customerDevelopPlans = this.getBaseMapper().selectList(queryWrapper); | |
| 279 | + if (CollectionUtils.isEmpty(customerDevelopPlans)) { | |
| 280 | + return null; | |
| 281 | + } | |
| 282 | + // 获取当前人员流程任务数据 | |
| 283 | + List<FlowTaskDto> flowTaskList = flowTaskWrapperMapper.queryTodoList(new QueryTodoTaskListVo() | |
| 284 | + , SecurityUtil.getCurrentUser().getId()); | |
| 285 | + List<String> businessIds = new ArrayList<>(); | |
| 286 | + if (CollectionUtils.isNotEmpty(flowTaskList)) { | |
| 287 | + businessIds = flowTaskList.stream().map(FlowTaskDto::getBusinessId).collect(Collectors.toList()); | |
| 288 | + } | |
| 289 | + int completedCount = 0; | |
| 290 | + int todoCount = 0; | |
| 291 | + for (CustomerDevelopPlan plan : customerDevelopPlans) { | |
| 292 | + CustomerDevelopStatus status = plan.getStatus(); | |
| 293 | + if (CustomerDevelopStatus.PASS.equals(status)) { | |
| 294 | + completedCount++; | |
| 295 | + } | |
| 296 | + if (businessIds.contains(plan.getId())) { | |
| 297 | + todoCount++; | |
| 298 | + } | |
| 299 | + } | |
| 300 | + CustomerDevelopPlanStatisticsBo statisticsBo = new CustomerDevelopPlanStatisticsBo(); | |
| 301 | + statisticsBo.setAllCount(customerDevelopPlans.size()); | |
| 302 | + statisticsBo.setCompletedCount(completedCount); | |
| 303 | + statisticsBo.setTodoCount(todoCount); | |
| 304 | + | |
| 305 | + return statisticsBo; | |
| 306 | + } | |
| 265 | 307 | } | ... | ... |
| 1 | 1 | package com.lframework.xingyun.sc.service.customer; |
| 2 | 2 | |
| 3 | +import com.lframework.xingyun.sc.bo.customer.develop.CustomerDevelopPlanStatisticsBo; | |
| 3 | 4 | import com.lframework.xingyun.sc.enums.CustomerDevelopStatus; |
| 4 | 5 | import com.lframework.xingyun.sc.vo.customer.develop.CreateCustomerDevelopPlanVo; |
| 5 | 6 | import com.lframework.xingyun.sc.vo.customer.develop.QueryCustomerDevelopPlanVo; |
| ... | ... | @@ -76,4 +77,11 @@ public interface CustomerDevelopPlanService extends BaseMpService<CustomerDevelo |
| 76 | 77 | * @param status 状态 |
| 77 | 78 | */ |
| 78 | 79 | void updateStatus(String id, CustomerDevelopStatus status); |
| 80 | + | |
| 81 | + /** | |
| 82 | + * 统计待办任务类型数量 | |
| 83 | + * | |
| 84 | + * @return CustomerDevelopPlanStatisticsBo | |
| 85 | + */ | |
| 86 | + CustomerDevelopPlanStatisticsBo todoTypeStatistics(); | |
| 79 | 87 | } | ... | ... |