|
@@ -325,7 +325,9 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
|
*/
|
|
|
@Override
|
|
|
public Result getKuaiShouOperateInfo(Integer pageNum, int pageSize, String startTime, String endTime, String userId) {
|
|
|
- try {
|
|
|
+ DecimalFormat decimalFormat = new DecimalFormat("0.00%");
|
|
|
+
|
|
|
+ try {
|
|
|
//查询当前人员所有下级
|
|
|
Set<String> operatorUserIds = getAffiliateId(userId);
|
|
|
//2022-02-15 ==>> 20220215
|
|
@@ -344,11 +346,11 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
|
add(operate.getUserId());
|
|
|
}};
|
|
|
List<KuaiShouOperateVo> userOperate = materialStareMapper.getKuaiShouOperateInfo(lastTimeStart,lastTimeEnd,userSet);
|
|
|
- Double rate = new Double(0);
|
|
|
+ String rate = null;
|
|
|
if (!Check.isNull(userOperate)){
|
|
|
//环比
|
|
|
- rate = (operate.getTotalCost() - userOperate.get(0).getTotalCost()) / userOperate.get(0).getTotalCost() * 100;
|
|
|
- rate = Double.valueOf(String.format("%.3f", rate));
|
|
|
+ Double rateDoulbe = (operate.getTotalCost() - userOperate.get(0).getTotalCost()) / userOperate.get(0).getTotalCost();
|
|
|
+ rate = decimalFormat.format(rateDoulbe);
|
|
|
}
|
|
|
operate.setRate(rate);
|
|
|
}
|
|
@@ -362,7 +364,8 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
|
|
|
|
@Override
|
|
|
public Result exportKuaiShouOperateInfo(String startTime, String endTime, String userId, HttpServletResponse response) {
|
|
|
- try {
|
|
|
+ DecimalFormat decimalFormat = new DecimalFormat("0.00%");
|
|
|
+ try {
|
|
|
//查询当前人员所有下级
|
|
|
Set<String> operatorUserIds = getAffiliateId(userId);
|
|
|
//2022-02-15 ==>> 20220215
|
|
@@ -380,11 +383,11 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
|
add(operate.getUserId());
|
|
|
}};
|
|
|
List<KuaiShouOperateVo> userOperate = materialStareMapper.getKuaiShouOperateInfo(lastTimeStart,lastTimeEnd,userSet);
|
|
|
- Double rate = new Double(0);
|
|
|
+ String rate = null;
|
|
|
if (!Check.isNull(userOperate)){
|
|
|
//环比 = (当前 - 上阶段 ) / 上阶段
|
|
|
- rate = (operate.getTotalCost() - userOperate.get(0).getTotalCost() ) / userOperate.get(0).getTotalCost() * 100;
|
|
|
- rate = Double.valueOf(String.format("%.3f", rate));
|
|
|
+ Double rateDouble = (operate.getTotalCost() - userOperate.get(0).getTotalCost() ) / userOperate.get(0).getTotalCost();
|
|
|
+ rate = decimalFormat.format(rateDouble);
|
|
|
}
|
|
|
operate.setRate(rate);
|
|
|
}
|
|
@@ -416,6 +419,7 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
|
*/
|
|
|
@Override
|
|
|
public Result getKuaiShouOperateProjectInfo(Integer pageNum, int pageSize, String startTime, String endTime, String userId) {
|
|
|
+ DecimalFormat decimalFormat = new DecimalFormat("0.00%");
|
|
|
try {
|
|
|
//查询当前人员所有下级
|
|
|
Set<String> operatorUserIds = getAffiliateId(userId);
|
|
@@ -444,20 +448,20 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
|
String projectId = projectInfo.getProjectId();
|
|
|
List<KuaiShouOperateProjectVo> projectYearOnYearInfo = materialStareMapper.getKuaiShouOperateProjectInfo(lastTimeStart,lastTimeEnd,projectId,operatorUserIds);
|
|
|
//环比 = (当前 - 上阶段 ) / 上阶段
|
|
|
- Double yearOnYear = new Double(0);
|
|
|
+ String yearOnYear = null;
|
|
|
if (!Check.isNull(projectYearOnYearInfo)){
|
|
|
- yearOnYear = (projectInfo.getTotalCost() - projectYearOnYearInfo.get(0).getTotalCost()) / projectYearOnYearInfo.get(0).getTotalCost() * 100;
|
|
|
- yearOnYear = Double.valueOf(String.format("%.2f", yearOnYear));
|
|
|
+ Double yearOnYearD = (projectInfo.getTotalCost() - projectYearOnYearInfo.get(0).getTotalCost()) / projectYearOnYearInfo.get(0).getTotalCost();
|
|
|
+ yearOnYear = decimalFormat.format(yearOnYearD);
|
|
|
}
|
|
|
projectInfo.setYearOnYear(yearOnYear);
|
|
|
|
|
|
//同比 日期超过 7 天 则不显示
|
|
|
- Double equallyRate = new Double(0);
|
|
|
+ String equallyRate = null;
|
|
|
if (daysBetween <= 7){
|
|
|
List<KuaiShouOperateProjectVo> projectEquallyInfo = materialStareMapper.getKuaiShouOperateProjectInfo(startEqually,endEqually,projectId,operatorUserIds);
|
|
|
if (!Check.isNull(projectEquallyInfo)){
|
|
|
- equallyRate = (projectInfo.getTotalCost() - projectEquallyInfo.get(0).getTotalCost()) / projectEquallyInfo.get(0).getTotalCost() * 100;
|
|
|
- equallyRate = Double.valueOf(String.format("%.2f", equallyRate));
|
|
|
+ Double equallyRateD = (projectInfo.getTotalCost() - projectEquallyInfo.get(0).getTotalCost()) / projectEquallyInfo.get(0).getTotalCost();
|
|
|
+ equallyRate = decimalFormat.format(equallyRateD);
|
|
|
}
|
|
|
}
|
|
|
projectInfo.setEquallyRate(equallyRate);
|
|
@@ -489,6 +493,7 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
|
*/
|
|
|
@Override
|
|
|
public Result getKuaiShouOperateAccountInfo(Integer pageNum, int pageSize, String startTime, String endTime,String projectId, String userId) {
|
|
|
+ DecimalFormat decimalFormat = new DecimalFormat("0.00%");
|
|
|
try {
|
|
|
//查询当前人员所有下级
|
|
|
Set<String> operatorUserIds = getAffiliateId(userId);
|
|
@@ -517,20 +522,20 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
|
long accountId = accountInfo.getAccountId();
|
|
|
List<KuaiShouOperateAccountVo> accountYearOnYearInfo = materialStareMapper.getKuaiShouOperateAccountInfo(lastTimeStart,lastTimeEnd,projectId,accountId,operatorUserIds);
|
|
|
//环比 = (当前 - 上阶段 ) / 上阶段
|
|
|
- Double yearOnYear = new Double(0);
|
|
|
+ String yearOnYear = null;
|
|
|
if (!Check.isNull(accountYearOnYearInfo)){
|
|
|
- yearOnYear = (accountInfo.getTotalCost() - accountYearOnYearInfo.get(0).getTotalCost()) / accountYearOnYearInfo.get(0).getTotalCost() * 100;
|
|
|
- yearOnYear = Double.valueOf(String.format("%.2f", yearOnYear));
|
|
|
+ Double yearOnYearD = (accountInfo.getTotalCost() - accountYearOnYearInfo.get(0).getTotalCost()) / accountYearOnYearInfo.get(0).getTotalCost();
|
|
|
+ yearOnYear = decimalFormat.format(yearOnYearD);
|
|
|
}
|
|
|
accountInfo.setYearOnYear(yearOnYear);
|
|
|
|
|
|
//同比 日期超过 7 天 则不显示
|
|
|
- Double equallyRate = new Double(0);
|
|
|
+ String equallyRate = null;
|
|
|
if (daysBetween <= 7){
|
|
|
List<KuaiShouOperateAccountVo> accountEquallyInfo = materialStareMapper.getKuaiShouOperateAccountInfo(startEqually,endEqually,projectId,accountId,operatorUserIds);
|
|
|
if (!Check.isNull(accountEquallyInfo)){
|
|
|
- equallyRate = (accountInfo.getTotalCost() - accountEquallyInfo.get(0).getTotalCost()) / accountEquallyInfo.get(0).getTotalCost() * 100;
|
|
|
- equallyRate = Double.valueOf(String.format("%.2f", equallyRate));
|
|
|
+ Double equallyRateD = (accountInfo.getTotalCost() - accountEquallyInfo.get(0).getTotalCost()) / accountEquallyInfo.get(0).getTotalCost();
|
|
|
+ equallyRate = decimalFormat.format(equallyRateD);
|
|
|
}
|
|
|
}
|
|
|
accountInfo.setEquallyRate(equallyRate);
|