|
|
|
@ -8,18 +8,27 @@ import org.apache.commons.lang.StringUtils; |
|
|
|
import org.jeecg.common.api.vo.Result; |
|
|
|
import org.jeecg.modules.api.bean.PageBean; |
|
|
|
import org.jeecg.modules.api.service.ConfigService; |
|
|
|
import org.jeecg.modules.api.utils.CommonUtils; |
|
|
|
import org.jeecg.modules.assessmentBanner.entity.AssessmentBanner; |
|
|
|
import org.jeecg.modules.assessmentBanner.service.IAssessmentBannerService; |
|
|
|
import org.jeecg.modules.assessmentCode.entity.AssessmentCode; |
|
|
|
import org.jeecg.modules.assessmentCode.service.IAssessmentCodeService; |
|
|
|
import org.jeecg.modules.assessmentConfig.entity.AssessmentConfig; |
|
|
|
import org.jeecg.modules.assessmentConfig.service.IAssessmentConfigService; |
|
|
|
import org.jeecg.modules.assessmentPayLog.entity.AssessmentPayLog; |
|
|
|
import org.jeecg.modules.assessmentPayLog.service.IAssessmentPayLogService; |
|
|
|
import org.jeecg.modules.assessmentReportUser.service.IAssessmentReportUserService; |
|
|
|
import org.jeecg.modules.hanHaiMember.entity.HanHaiMember; |
|
|
|
import org.jeecg.modules.hanHaiMember.service.IHanHaiMemberService; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.math.RoundingMode; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
@Service |
|
|
|
@Slf4j |
|
|
|
@ -35,6 +44,15 @@ public class ConfigServiceImpl implements ConfigService { |
|
|
|
//兑换码信息 |
|
|
|
@Resource |
|
|
|
private IAssessmentCodeService assessmentCodeService; |
|
|
|
//用户信息 |
|
|
|
@Resource |
|
|
|
private IHanHaiMemberService hanHaiMemberService; |
|
|
|
//测评报告信息 |
|
|
|
@Resource |
|
|
|
private IAssessmentReportUserService assessmentReportUserService; |
|
|
|
//支付记录信息 |
|
|
|
@Resource |
|
|
|
private IAssessmentPayLogService assessmentPayLogService; |
|
|
|
/******************************************************************************************************************/ |
|
|
|
|
|
|
|
//首页-查询banner图列表 |
|
|
|
@ -179,4 +197,107 @@ public class ConfigServiceImpl implements ConfigService { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public Result<?> queryCount() { |
|
|
|
log.info("开始查询统计信息"); |
|
|
|
//返回信息 |
|
|
|
String massege = ""; |
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
|
|
|
|
//https://1x.antdv.com/components/icon-cn/#components-icon-demo-basic 图标库地址 |
|
|
|
|
|
|
|
try{ |
|
|
|
|
|
|
|
//总用户数 |
|
|
|
long userNum = hanHaiMemberService.count(); |
|
|
|
//今日新增用户数 |
|
|
|
String today = CommonUtils.getTime("yyyy-MM-dd"); |
|
|
|
long todayNum = hanHaiMemberService.lambdaQuery().like(HanHaiMember::getCreateTime, today).count(); |
|
|
|
//本月新增用户数 |
|
|
|
String month = CommonUtils.getTime("yyyy-MM"); |
|
|
|
long monthNum = hanHaiMemberService.lambdaQuery().like(HanHaiMember::getCreateTime, month).count(); |
|
|
|
//获取报告总次数 |
|
|
|
long reportNum = assessmentReportUserService.count(); |
|
|
|
//总流水金额 |
|
|
|
List<AssessmentPayLog> amount = assessmentPayLogService.list(); |
|
|
|
BigDecimal amountSum = BigDecimal.ZERO; |
|
|
|
for (AssessmentPayLog assessmentPayLog : amount) { |
|
|
|
amountSum = amountSum.add(assessmentPayLog.getPayAmount()); |
|
|
|
} |
|
|
|
amountSum.setScale(2, RoundingMode.DOWN);//保留两位小数,向0方向舍入(截断) |
|
|
|
|
|
|
|
// 第一行:基础数据统计 |
|
|
|
List<Map<String, Object>> dataItems = new ArrayList<>(); |
|
|
|
Map<String, Object> item1 = new HashMap<>(); |
|
|
|
item1.put("title", "用户数"); |
|
|
|
item1.put("value", userNum); |
|
|
|
item1.put("icon", "user"); |
|
|
|
item1.put("cardClass", "primary-card"); |
|
|
|
item1.put("description", "总用户数"); |
|
|
|
dataItems.add(item1); |
|
|
|
|
|
|
|
Map<String, Object> item2 = new HashMap<>(); |
|
|
|
item2.put("title", "今日新增"); |
|
|
|
item2.put("value", todayNum); |
|
|
|
item2.put("icon", "user-add"); |
|
|
|
item2.put("cardClass", "warning-card"); |
|
|
|
item2.put("description", "今日新增注册用户数"); |
|
|
|
dataItems.add(item2); |
|
|
|
|
|
|
|
Map<String, Object> item3 = new HashMap<>(); |
|
|
|
item3.put("title", "本月新增"); |
|
|
|
item3.put("value", monthNum); |
|
|
|
item3.put("icon", "usergroup-add"); |
|
|
|
item3.put("cardClass", "danger-card"); |
|
|
|
item3.put("description", "本月新增注册用户数"); |
|
|
|
dataItems.add(item3); |
|
|
|
|
|
|
|
// 第二行:统计率数据 |
|
|
|
List<Map<String, Object>> rateItems = new ArrayList<>(); |
|
|
|
// //完好率 |
|
|
|
// double undamaged = showpieceNum > 0 ? (showpieceNum - repairingNum) * 1.0 / showpieceNum : 0; |
|
|
|
// double undamagedRate = undamaged * 100; |
|
|
|
// |
|
|
|
// Map<String, Object> rate1 = new HashMap<>(); |
|
|
|
// rate1.put("title", "完好率"); |
|
|
|
// rate1.put("value", Double.parseDouble(String.format("%.1f", undamagedRate))); |
|
|
|
// rate1.put("icon", "check-circle"); |
|
|
|
// rate1.put("cardClass", "success-rate"); |
|
|
|
// // rate1.put("trend", "up"); |
|
|
|
// // rate1.put("trendValue", 2.3); |
|
|
|
// rateItems.add(rate1); |
|
|
|
|
|
|
|
|
|
|
|
// 第三行:维修保养统计 |
|
|
|
List<Map<String, Object>> maintenanceItems = new ArrayList<>(); |
|
|
|
Map<String, Object> maintenance1 = new HashMap<>(); |
|
|
|
maintenance1.put("title", "获取报告次数"); |
|
|
|
maintenance1.put("value", reportNum); |
|
|
|
maintenance1.put("icon", "file-text"); |
|
|
|
maintenance1.put("description", "总获取报告次数"); |
|
|
|
maintenanceItems.add(maintenance1); |
|
|
|
|
|
|
|
Map<String, Object> maintenance2 = new HashMap<>(); |
|
|
|
maintenance2.put("title", "总流水"); |
|
|
|
maintenance2.put("value", amountSum); |
|
|
|
maintenance2.put("icon", "transaction"); |
|
|
|
maintenance2.put("description", "总流水金额"); |
|
|
|
maintenanceItems.add(maintenance2); |
|
|
|
|
|
|
|
|
|
|
|
result.put("dataItems", dataItems); |
|
|
|
result.put("rateItems", rateItems); |
|
|
|
result.put("maintenanceItems", maintenanceItems); |
|
|
|
|
|
|
|
log.info("统计信息查询结束"); |
|
|
|
return Result.OK("统计信息", result); |
|
|
|
}catch (Exception e){ |
|
|
|
log.error("统计信息查询失败"); |
|
|
|
e.printStackTrace(); |
|
|
|
return Result.error("统计信息查询失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |