提交 06a9e71e authored 作者: 吕本才's avatar 吕本才

1、全国经销商的达成率

上级 8aa034b3
......@@ -94,7 +94,7 @@ public class DealerBigScreenController extends BaseController {
@GetMapping("/result/quanguoResult")
public AjaxResult quanguoResult() {
DealerBigScreenTotalResultRes res = resultService.totalResult();
DealerBigScreenTotalResultRes res = resultService.quanguoResult();
return success(res);
}
......
package com.ruoyi.common.constant;
import java.util.Locale;
import io.jsonwebtoken.Claims;
import java.util.Locale;
/**
* 通用常量信息
*
......@@ -172,4 +173,6 @@ public class Constants
"org.springframework", "org.apache", "com.ruoyi.common.utils.file", "com.ruoyi.common.config", "com.ruoyi.generator" };
public static final String DEALER_ROUND = "dealer.round";
public static final String DEALER_ROUND_OVER = "dealer.round.over";
public static final String TOTAL_WEIDAO = "total.weidao";
public static final String TOTAL_QUANGUO_GOAL = "total.goal";
}
......@@ -49,7 +49,7 @@ public class DealerResult {
*/
// @Excel(name = "经销商分组")
// private String groupName;
@Excel(name = "经销商目标")
@Excel(name = "经销商目标",scale = 4)
private Integer goalTtlAct;
/**
* 预付款达成的百分比
......
......@@ -28,4 +28,6 @@ public interface IDealerRoundResultService extends IService<DealerRoundResult> {
void downloadExcel(HttpServletResponse response, String group);
List<DealerBigScreenRewardResultRes> getRewardList(String groupType, Integer ranking, String groupName);
DealerBigScreenTotalResultRes quanguoResult();
}
......@@ -10,7 +10,6 @@ import com.ruoyi.dealer.domain.DealerBaseInfo;
import com.ruoyi.dealer.domain.DealerRoundResult;
import com.ruoyi.dealer.domain.dto.WechatDealerRoundInfoRes;
import com.ruoyi.dealer.mapper.DealerBaseInfoMapper;
import com.ruoyi.dealer.service.DealerRoundInfoService;
import com.ruoyi.dealer.service.IDealerBaseInfoService;
import com.ruoyi.dealer.service.IDealerRoundResultService;
import com.ruoyi.system.service.ISysConfigService;
......@@ -29,10 +28,10 @@ import java.util.List;
*/
@Service
public class DealerBaseInfoImpl extends ServiceImpl<DealerBaseInfoMapper, DealerBaseInfo> implements IDealerBaseInfoService {
@Autowired
private DealerBaseInfoMapper dealerBaseInfoMapper;
@Autowired
private DealerRoundInfoService dealerRoundInfoService;
// @Autowired
// private DealerBaseInfoMapper dealerBaseInfoMapper;
// @Autowired
// private DealerRoundInfoService dealerRoundInfoService;
@Autowired
private IDealerRoundResultService resultService;
@Autowired
......
......@@ -7,6 +7,7 @@ import cn.hutool.core.util.ZipUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.dealer.domain.DealerBaseInfo;
import com.ruoyi.dealer.domain.DealerResult;
......@@ -18,6 +19,7 @@ import com.ruoyi.dealer.service.DealerRoundInfoService;
import com.ruoyi.dealer.service.IDealerBaseInfoService;
import com.ruoyi.dealer.service.IDealerResultService;
import com.ruoyi.dealer.service.IDealerRoundResultService;
import com.ruoyi.system.service.ISysConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -45,6 +47,8 @@ public class DealerRoundResultServiceImpl extends ServiceImpl<DealerRoundResultM
private IDealerResultService resultService;
@Autowired
private DealerRoundInfoService roundInfoService;
@Autowired
private ISysConfigService configService;
/**
* 大屏 个人分组查询
......@@ -341,6 +345,42 @@ public class DealerRoundResultServiceImpl extends ServiceImpl<DealerRoundResultM
}
}
@Override
public DealerBigScreenTotalResultRes quanguoResult() {
DealerBigScreenTotalResultRes res = null;
DealerResult total = resultService.getOne(new LambdaQueryWrapper<DealerResult>()
.eq(DealerResult::getSalesRegionGroupName, "total")
);
if (ObjectUtil.isNotEmpty(total)) {
res = new DealerBigScreenTotalResultRes();
res.setPaymentTtl(total.getPaymentTtl());
res.setGoalTtlAct(total.getGoalTtlAct());
res.setPaymentPercentage(new BigDecimal(res.getPaymentTtl())
.multiply(new BigDecimal(100))
.divide(new BigDecimal(res.getGoalTtlAct()), 2, RoundingMode.HALF_UP)
.toPlainString() + "%");
} else {
List<DealerBigScreenTotalResultRes> roundResults = this.baseMapper.getTotalResult();
res = roundResults.get(0);
res.setPaymentPercentage(new BigDecimal(res.getPaymentTtl())
.multiply(new BigDecimal(100))
.divide(new BigDecimal(res.getGoalTtlAct()), 2, RoundingMode.HALF_UP)
.toPlainString() + "%");
}
String totalWeidao = configService.selectConfigByKeyFromDb(Constants.TOTAL_WEIDAO);
Integer totalWeidaoInt = Integer.parseInt(totalWeidao);
String totalQuanguoGoal = configService.selectConfigByKeyFromDb(Constants.TOTAL_QUANGUO_GOAL);
Integer totalQuanguoGoalInt = Integer.parseInt(totalQuanguoGoal);
res.setPaymentTtl(res.getPaymentTtl()+totalWeidaoInt);
res.setGoalTtlAct(totalQuanguoGoalInt);
res.setPaymentPercentage(getPercentage(res.getPaymentTtl(), res.getGoalTtlAct(), 2)+"%");
return res;
}
private String getPercentage(Integer paymentTtl, Integer goalTtlAct, Integer scale) {
if (null == paymentTtl || null == goalTtlAct) {
return "0";
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论