Browse Source

1、统计模块

master
Aug 1 month ago
parent
commit
83a1769ebe
3 changed files with 79 additions and 1 deletions
  1. +7
    -0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/exhibitController/ConfigController.java
  2. +3
    -0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/ConfigService.java
  3. +69
    -1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/impl/ConfigServiceImpl.java

+ 7
- 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/exhibitController/ConfigController.java View File

@ -66,4 +66,11 @@ public class ConfigController {
return configService.queryMalfunctionDescList(pageBean);
}
//数量统计接口
@ApiOperation(value="配置-数量统计", notes="配置-数量统计")
@RequestMapping(value = "/queryCount", method = {RequestMethod.GET})
public Result<?> queryCount(){
return configService.queryCount();
}
}

+ 3
- 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/ConfigService.java View File

@ -27,4 +27,7 @@ public interface ConfigService {
//配置-查看常见故障情况
public Result<?> queryMalfunctionDescList(PageBean pageBean);
//数量统计接口
public Result<?> queryCount();
}

+ 69
- 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/impl/ConfigServiceImpl.java View File

@ -1,5 +1,6 @@
package org.jeecg.modules.api.service.impl;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
@ -16,11 +17,19 @@ import org.jeecg.modules.exhibitConfig.entity.ExhibitConfig;
import org.jeecg.modules.exhibitConfig.service.IExhibitConfigService;
import org.jeecg.modules.exhibitDepartment.entity.ExhibitDepartment;
import org.jeecg.modules.exhibitDepartment.service.IExhibitDepartmentService;
import org.jeecg.modules.exhibitMaintenance.service.IExhibitMaintenanceService;
import org.jeecg.modules.exhibitMalfunction.entity.ExhibitMalfunction;
import org.jeecg.modules.exhibitMalfunction.service.IExhibitMalfunctionService;
import org.jeecg.modules.exhibitMalfunctionDesc.entity.ExhibitMalfunctionDesc;
import org.jeecg.modules.exhibitMalfunctionDesc.service.IExhibitMalfunctionDescService;
import org.jeecg.modules.exhibitRepair.service.IExhibitRepairService;
import org.jeecg.modules.exhibitShowpiece.service.IExhibitShowpieceService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
@Slf4j
@ -39,9 +48,21 @@ public class ConfigServiceImpl implements ConfigService {
//展品分类列表
@Resource
private IExhibitCategoryService exhibitCategoryService;
//展品分类列表
//展品信息
@Resource
private IExhibitShowpieceService exhibitShowpieceService;
//常见故障列表
@Resource
private IExhibitMalfunctionDescService exhibitMalfunctionDescService;
//报修单信息
@Resource
private IExhibitMalfunctionService exhibitMalfunctionService;
//维修单信息
@Resource
private IExhibitRepairService exhibitRepairService;
//保养单信息
@Resource
private IExhibitMaintenanceService exhibitMaintenanceService;
/******************************************************************************************************************/
//配置-查看轮播图列表
@ -252,4 +273,51 @@ public class ConfigServiceImpl implements ConfigService {
}
}
@Override
public Result<?> queryCount() {
log.info("开始查询统计信息");
//返回信息
String massege = "";
Map<String, Object> map = new HashMap<>();
try{
//展品数量
long showpieceNum = exhibitShowpieceService.count();
map.put("showpieceNum", showpieceNum);
//维护中的数量
long repairingNum = exhibitMalfunctionService.lambdaQuery().notIn(ExhibitMalfunction::getStatus, "2").count();
map.put("repairingNum", repairingNum);
//无法使用数量
long cannotUseNum = exhibitMalfunctionService.lambdaQuery().notIn(ExhibitMalfunction::getStatus, "2").eq(ExhibitMalfunction::getIsAffectUse, "1").count();
map.put("cannotUseNum", cannotUseNum);
//完好率
double undamaged = (showpieceNum - repairingNum) * 1.0 / showpieceNum;
String undamagedRate = String.format("%.2f", undamaged * 100) + "%";
map.put("undamagedRate", undamagedRate);
//维修率(暂不处理)
//维修次数
long repairedNum = exhibitMalfunctionService.count();
map.put("repairedNum", repairedNum);
//保养次数
long maintenancedNum = exhibitMaintenanceService.count();
map.put("maintenancedNum", maintenancedNum);
//维修次数最多的展品
log.info("统计信息查询结束");
return Result.OK("统计信息", map);
}catch (Exception e){
log.error("统计信息查询失败");
e.printStackTrace();
return Result.error("统计信息查询失败");
}
}
}

Loading…
Cancel
Save