|
|
@@ -2,6 +2,7 @@ package com.uas.platform.b2b.openapi.service.impl;
|
|
|
|
|
|
import com.uas.platform.b2b.dao.CommonDao;
|
|
|
import com.uas.platform.b2b.openapi.model.CustTrading;
|
|
|
+import com.uas.platform.b2b.openapi.model.RecentOfMonth;
|
|
|
import com.uas.platform.b2b.openapi.model.RecentOfYear;
|
|
|
import com.uas.platform.b2b.openapi.service.TradingDataService;
|
|
|
import com.uas.platform.b2b.openapi.support.NumFormat;
|
|
|
@@ -14,6 +15,7 @@ import org.springframework.ui.ModelMap;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
import java.sql.Date;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
@@ -63,7 +65,11 @@ public class TradingDataServiceImpl implements TradingDataService{
|
|
|
Double acceptSum = getAcceptSum(enUU, custTrading.getCustUU());
|
|
|
Double returnSum = getReturnSum(enUU, custTrading.getCustUU());
|
|
|
custTrading.setRealAccept(NumFormat.getTwo(acceptSum - returnSum));
|
|
|
- custTrading.setAcceptPercent(NumFormat.getPercent((acceptSum - returnSum) / acceptSum));
|
|
|
+ if (StringUtils.isEmpty(acceptSum) || acceptSum == 0.0) {
|
|
|
+ custTrading.setAcceptPercent("0.00%");
|
|
|
+ } else {
|
|
|
+ custTrading.setAcceptPercent(NumFormat.getPercent((acceptSum - returnSum) / acceptSum));
|
|
|
+ }
|
|
|
Integer acceptNum = getAcceptNum(enUU, custTrading.getCustUU());
|
|
|
Integer realNum = acceptNum - getReturnNum(enUU, custTrading.getCustUU());
|
|
|
custTrading.setRealNum(realNum);
|
|
|
@@ -73,51 +79,245 @@ public class TradingDataServiceImpl implements TradingDataService{
|
|
|
custTrading.setTimeSum(NumFormat.getOne(getTimeSum(enUU, custTrading.getCustUU())));
|
|
|
}
|
|
|
}
|
|
|
- map.put("date", datas);
|
|
|
+ map.put("data", datas);
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public ModelMap getRecentOfYear(Long enUU) {
|
|
|
ModelMap map = new ModelMap();
|
|
|
+ List<RecentOfYear> years = new ArrayList<>();
|
|
|
// 有交易额客户数量
|
|
|
- RecentOfYear ofYear = new RecentOfYear("有交易额客户数量");
|
|
|
- // ofYear.setTwoYear(getAcceptCust(enUU, );
|
|
|
-
|
|
|
+ RecentOfYear ofYear1 = new RecentOfYear("有交易额客户数量");
|
|
|
+ ofYear1.setTwoYear((double)getAcceptCust(enUU, NumFormat.getTwoYear(), NumFormat.getOneYear()));
|
|
|
+ ofYear1.setOneYear((double)getAcceptCust(enUU, NumFormat.getOneYear(), NumFormat.getThisYear()));
|
|
|
+ ofYear1.setThisYear((double)getAcceptCust(enUU, NumFormat.getThisYear(), NumFormat.getNow()));
|
|
|
+ ofYear1.setOneYearNum(NumFormat.getIncrease(ofYear1.getTwoYear(), ofYear1.getOneYear()));
|
|
|
+ ofYear1.setThisYearNum(NumFormat.getIncrease(ofYear1.getOneYear(), ofYear1.getThisYear()));
|
|
|
+ years.add(ofYear1);
|
|
|
// 验收金额
|
|
|
-
|
|
|
+ RecentOfYear ofYear2 = new RecentOfYear("验收金额");
|
|
|
+ ofYear2.setTwoYear(getAcceptSumTime(enUU, NumFormat.getTwoYear(), NumFormat.getOneYear()));
|
|
|
+ ofYear2.setOneYear(getAcceptSumTime(enUU, NumFormat.getOneYear(), NumFormat.getThisYear()));
|
|
|
+ ofYear2.setThisYear(getAcceptSumTime(enUU, NumFormat.getThisYear(), NumFormat.getNow()));
|
|
|
+ ofYear2.setOneYearNum(NumFormat.getIncrease(ofYear2.getTwoYear(), ofYear2.getOneYear()));
|
|
|
+ ofYear2.setThisYearNum(NumFormat.getIncrease(ofYear2.getOneYear(), ofYear2.getThisYear()));
|
|
|
+ years.add(ofYear2);
|
|
|
// 验收笔数
|
|
|
-
|
|
|
+ RecentOfYear ofYear3 = new RecentOfYear("验收笔数");
|
|
|
+ ofYear3.setTwoYear((double)getAcceptNumTime(enUU, NumFormat.getTwoYear(), NumFormat.getOneYear()));
|
|
|
+ ofYear3.setOneYear((double)getAcceptNumTime(enUU, NumFormat.getOneYear(), NumFormat.getThisYear()));
|
|
|
+ ofYear3.setThisYear((double)getAcceptNumTime(enUU, NumFormat.getThisYear(), NumFormat.getNow()));
|
|
|
+ ofYear3.setOneYearNum(NumFormat.getIncrease(ofYear3.getTwoYear(), ofYear3.getOneYear()));
|
|
|
+ ofYear3.setThisYearNum(NumFormat.getIncrease(ofYear3.getOneYear(), ofYear3.getThisYear()));
|
|
|
+ years.add(ofYear3);
|
|
|
// 验退金额
|
|
|
-
|
|
|
+ RecentOfYear ofYear4 = new RecentOfYear("验退金额");
|
|
|
+ ofYear4.setTwoYear(getReturnSumTime(enUU, NumFormat.getTwoYear(), NumFormat.getOneYear()));
|
|
|
+ ofYear4.setOneYear(getReturnSumTime(enUU, NumFormat.getOneYear(), NumFormat.getThisYear()));
|
|
|
+ ofYear4.setThisYear(getReturnSumTime(enUU, NumFormat.getThisYear(), NumFormat.getNow()));
|
|
|
+ ofYear4.setOneYearNum(NumFormat.getIncrease(ofYear4.getTwoYear(), ofYear4.getOneYear()));
|
|
|
+ ofYear4.setThisYearNum(NumFormat.getIncrease(ofYear4.getOneYear(), ofYear4.getThisYear()));
|
|
|
+ years.add(ofYear4);
|
|
|
// 验退笔数
|
|
|
-
|
|
|
+ RecentOfYear ofYear5 = new RecentOfYear("验退笔数");
|
|
|
+ ofYear5.setTwoYear((double)getReturnNumTime(enUU, NumFormat.getTwoYear(), NumFormat.getOneYear()));
|
|
|
+ ofYear5.setOneYear((double)getReturnNumTime(enUU, NumFormat.getOneYear(), NumFormat.getThisYear()));
|
|
|
+ ofYear5.setThisYear((double)getReturnNumTime(enUU, NumFormat.getThisYear(), NumFormat.getNow()));
|
|
|
+ ofYear5.setOneYearNum(NumFormat.getIncrease(ofYear5.getTwoYear(), ofYear5.getOneYear()));
|
|
|
+ ofYear5.setThisYearNum(NumFormat.getIncrease(ofYear5.getOneYear(), ofYear5.getThisYear()));
|
|
|
+ years.add(ofYear5);
|
|
|
// 实收金额
|
|
|
-
|
|
|
+ RecentOfYear ofYear6 = new RecentOfYear("实收金额");
|
|
|
+ ofYear6.setTwoYear(ofYear2.getTwoYear() - ofYear4.getTwoYear());
|
|
|
+ ofYear6.setOneYear(ofYear2.getOneYear() - ofYear4.getOneYear());
|
|
|
+ ofYear6.setThisYear(ofYear2.getThisYear() - ofYear2.getThisYear());
|
|
|
+ ofYear6.setOneYearNum(NumFormat.getIncrease(ofYear6.getTwoYear(), ofYear6.getOneYear()));
|
|
|
+ ofYear6.setThisYearNum(NumFormat.getIncrease(ofYear6.getOneYear(), ofYear6.getThisYear()));
|
|
|
+ years.add(ofYear6);
|
|
|
// 实收笔数
|
|
|
-
|
|
|
+ RecentOfYear ofYear7 = new RecentOfYear("实收笔数");
|
|
|
+ ofYear7.setTwoYear(ofYear3.getTwoYear() - ofYear3.getTwoYear());
|
|
|
+ ofYear7.setOneYear(ofYear3.getOneYear() - ofYear3.getOneYear());
|
|
|
+ ofYear7.setThisYear(ofYear3.getThisYear() - ofYear3.getThisYear());
|
|
|
+ ofYear7.setOneYearNum(NumFormat.getIncrease(ofYear7.getTwoYear(), ofYear7.getOneYear()));
|
|
|
+ ofYear7.setThisYearNum(NumFormat.getIncrease(ofYear7.getOneYear(), ofYear7.getThisYear()));
|
|
|
+ years.add(ofYear7);
|
|
|
// 对账金额
|
|
|
-
|
|
|
+ RecentOfYear ofYear8 = new RecentOfYear("对账金额");
|
|
|
+ ofYear8.setTwoYear(getApCheckSumTime(enUU, NumFormat.getTwoYear(), NumFormat.getOneYear()));
|
|
|
+ ofYear8.setOneYear(getApCheckSumTime(enUU, NumFormat.getOneYear(), NumFormat.getThisYear()));
|
|
|
+ ofYear8.setThisYear(getApCheckSumTime(enUU, NumFormat.getThisYear(), NumFormat.getNow()));
|
|
|
+ ofYear8.setOneYearNum(NumFormat.getIncrease(ofYear8.getTwoYear(), ofYear8.getOneYear()));
|
|
|
+ ofYear8.setThisYearNum(NumFormat.getIncrease(ofYear8.getOneYear(), ofYear8.getThisYear()));
|
|
|
+ years.add(ofYear8);
|
|
|
// 对账笔数
|
|
|
+ RecentOfYear ofYear9 = new RecentOfYear("对账笔数");
|
|
|
+ ofYear9.setTwoYear(getApCheckNumTime(enUU, NumFormat.getTwoYear(), NumFormat.getOneYear()));
|
|
|
+ ofYear9.setOneYear(getApCheckNumTime(enUU, NumFormat.getOneYear(), NumFormat.getThisYear()));
|
|
|
+ ofYear9.setThisYear(getApCheckNumTime(enUU, NumFormat.getThisYear(), NumFormat.getNow()));
|
|
|
+ ofYear9.setOneYearNum(NumFormat.getIncrease(ofYear9.getTwoYear(), ofYear9.getOneYear()));
|
|
|
+ ofYear9.setThisYearNum(NumFormat.getIncrease(ofYear9.getOneYear(), ofYear9.getThisYear()));
|
|
|
+ years.add(ofYear9);
|
|
|
+ // 开票笔数
|
|
|
+ RecentOfYear ofYear10 = new RecentOfYear("开票笔数");
|
|
|
+ ofYear10.setTwoYear(getApBillSumTime(enUU, NumFormat.getTwoYear(), NumFormat.getOneYear()));
|
|
|
+ ofYear10.setOneYear(getApBillSumTime(enUU, NumFormat.getOneYear(), NumFormat.getThisYear()));
|
|
|
+ ofYear10.setThisYear(getApBillSumTime(enUU, NumFormat.getThisYear(), NumFormat.getNow()));
|
|
|
+ ofYear10.setOneYearNum(NumFormat.getIncrease(ofYear10.getTwoYear(), ofYear10.getOneYear()));
|
|
|
+ ofYear10.setThisYearNum(NumFormat.getIncrease(ofYear10.getOneYear(), ofYear10.getThisYear()));
|
|
|
+ years.add(ofYear10);
|
|
|
+ // 开票笔数
|
|
|
+ RecentOfYear ofYear11 = new RecentOfYear("开票笔数");
|
|
|
+ ofYear11.setTwoYear(getApBillNumTime(enUU, NumFormat.getTwoYear(), NumFormat.getOneYear()));
|
|
|
+ ofYear11.setOneYear(getApBillNumTime(enUU, NumFormat.getOneYear(), NumFormat.getThisYear()));
|
|
|
+ ofYear11.setThisYear(getApBillNumTime(enUU, NumFormat.getThisYear(), NumFormat.getNow()));
|
|
|
+ ofYear11.setOneYearNum(NumFormat.getIncrease(ofYear11.getTwoYear(), ofYear11.getOneYear()));
|
|
|
+ ofYear11.setThisYearNum(NumFormat.getIncrease(ofYear11.getOneYear(), ofYear11.getThisYear()));
|
|
|
+ years.add(ofYear11);
|
|
|
+ map.put("data", years);
|
|
|
+ return map;
|
|
|
+ }
|
|
|
|
|
|
+ @Override
|
|
|
+ public ModelMap getRecentOfMonth(Long enUU) {
|
|
|
+ ModelMap map = new ModelMap();
|
|
|
+ Date four = NumFormat.getThreeM();
|
|
|
+ Date three = NumFormat.getTwoM();
|
|
|
+ Date two = NumFormat.getOneM();
|
|
|
+ Date one = NumFormat.getThisM();
|
|
|
+ Date now = NumFormat.getNowM();
|
|
|
+ List<RecentOfMonth> months = new ArrayList<>();
|
|
|
+ // 有交易额客户数量
|
|
|
+ RecentOfMonth ofMonth1 = new RecentOfMonth("有交易额客户数量");
|
|
|
+ ofMonth1.setFourMonth((double)getAcceptCust(enUU, four, three));
|
|
|
+ ofMonth1.setThreeMonth((double)getAcceptCust(enUU, three, two));
|
|
|
+ ofMonth1.setTwoMonth((double)getAcceptCust(enUU, two, one));
|
|
|
+ ofMonth1.setOneMonth((double)getAcceptCust(enUU, one, now));
|
|
|
+ ofMonth1.setThreeMonthNum(NumFormat.getIncrease(ofMonth1.getFourMonth(), ofMonth1.getThreeMonth()));
|
|
|
+ ofMonth1.setTwoMonthNum(NumFormat.getIncrease(ofMonth1.getThreeMonth(), ofMonth1.getTwoMonth()));
|
|
|
+ ofMonth1.setOneMonthNum(NumFormat.getIncrease(ofMonth1.getTwoMonth(),ofMonth1.getOneMonth()));
|
|
|
+ months.add(ofMonth1);
|
|
|
+ // 验收金额
|
|
|
+ RecentOfMonth ofMonth2 = new RecentOfMonth("验收金额");
|
|
|
+ ofMonth2.setFourMonth(getAcceptSumTime(enUU, four, three));
|
|
|
+ ofMonth2.setThreeMonth(getAcceptSumTime(enUU, three, two));
|
|
|
+ ofMonth2.setTwoMonth(getAcceptSumTime(enUU, two, one));
|
|
|
+ ofMonth2.setOneMonth(getAcceptSumTime(enUU, one, now));
|
|
|
+ ofMonth2.setThreeMonthNum(NumFormat.getIncrease(ofMonth2.getFourMonth(), ofMonth2.getThreeMonth()));
|
|
|
+ ofMonth2.setTwoMonthNum(NumFormat.getIncrease(ofMonth2.getThreeMonth(), ofMonth2.getTwoMonth()));
|
|
|
+ ofMonth2.setOneMonthNum(NumFormat.getIncrease(ofMonth2.getTwoMonth(),ofMonth2.getOneMonth()));
|
|
|
+ months.add(ofMonth2);
|
|
|
+ // 验收笔数
|
|
|
+ RecentOfMonth ofMonth3 = new RecentOfMonth("验收笔数");
|
|
|
+ ofMonth3.setFourMonth((double)getAcceptNumTime(enUU, four, three));
|
|
|
+ ofMonth3.setThreeMonth((double)getAcceptNumTime(enUU, three, two));
|
|
|
+ ofMonth3.setTwoMonth((double)getAcceptNumTime(enUU, two, one));
|
|
|
+ ofMonth3.setOneMonth((double)getAcceptNumTime(enUU, one, now));
|
|
|
+ ofMonth3.setThreeMonthNum(NumFormat.getIncrease(ofMonth3.getFourMonth(), ofMonth3.getThreeMonth()));
|
|
|
+ ofMonth3.setTwoMonthNum(NumFormat.getIncrease(ofMonth3.getThreeMonth(), ofMonth3.getTwoMonth()));
|
|
|
+ ofMonth3.setOneMonthNum(NumFormat.getIncrease(ofMonth3.getTwoMonth(),ofMonth3.getOneMonth()));
|
|
|
+ months.add(ofMonth3);
|
|
|
+ // 验退金额
|
|
|
+ RecentOfMonth ofMonth4 = new RecentOfMonth("验退金额");
|
|
|
+ ofMonth4.setFourMonth(getReturnSumTime(enUU, four, three));
|
|
|
+ ofMonth4.setThreeMonth(getReturnSumTime(enUU, three, two));
|
|
|
+ ofMonth4.setTwoMonth(getReturnSumTime(enUU, two, one));
|
|
|
+ ofMonth4.setOneMonth(getReturnSumTime(enUU, one, now));
|
|
|
+ ofMonth4.setThreeMonthNum(NumFormat.getIncrease(ofMonth4.getFourMonth(), ofMonth4.getThreeMonth()));
|
|
|
+ ofMonth4.setTwoMonthNum(NumFormat.getIncrease(ofMonth4.getThreeMonth(), ofMonth4.getTwoMonth()));
|
|
|
+ ofMonth4.setOneMonthNum(NumFormat.getIncrease(ofMonth4.getTwoMonth(),ofMonth4.getOneMonth()));
|
|
|
+ months.add(ofMonth4);
|
|
|
+ // 验退笔数
|
|
|
+ RecentOfMonth ofMonth5 = new RecentOfMonth("验退笔数");
|
|
|
+ ofMonth5.setFourMonth((double)getReturnNumTime(enUU, four, three));
|
|
|
+ ofMonth5.setThreeMonth((double)getReturnNumTime(enUU, three, two));
|
|
|
+ ofMonth5.setTwoMonth((double)getReturnNumTime(enUU, two, one));
|
|
|
+ ofMonth5.setOneMonth((double)getReturnNumTime(enUU, one, now));
|
|
|
+ ofMonth5.setThreeMonthNum(NumFormat.getIncrease(ofMonth5.getFourMonth(), ofMonth5.getThreeMonth()));
|
|
|
+ ofMonth5.setTwoMonthNum(NumFormat.getIncrease(ofMonth5.getThreeMonth(), ofMonth5.getTwoMonth()));
|
|
|
+ ofMonth5.setOneMonthNum(NumFormat.getIncrease(ofMonth5.getTwoMonth(),ofMonth5.getOneMonth()));
|
|
|
+ months.add(ofMonth5);
|
|
|
+ // 实收金额
|
|
|
+ RecentOfMonth ofMonth6 = new RecentOfMonth("实收金额");
|
|
|
+ ofMonth6.setFourMonth(ofMonth2.getFourMonth() - ofMonth4.getFourMonth());
|
|
|
+ ofMonth6.setThreeMonth(ofMonth2.getThreeMonth() - ofMonth4.getThreeMonth());
|
|
|
+ ofMonth6.setTwoMonth(ofMonth2.getTwoMonth() - ofMonth4.getTwoMonth());
|
|
|
+ ofMonth6.setOneMonth(ofMonth2.getOneMonth() - ofMonth4.getOneMonth());
|
|
|
+ ofMonth6.setThreeMonthNum(NumFormat.getIncrease(ofMonth6.getFourMonth(), ofMonth6.getThreeMonth()));
|
|
|
+ ofMonth6.setTwoMonthNum(NumFormat.getIncrease(ofMonth6.getThreeMonth(), ofMonth6.getTwoMonth()));
|
|
|
+ ofMonth6.setOneMonthNum(NumFormat.getIncrease(ofMonth6.getTwoMonth(),ofMonth6.getOneMonth()));
|
|
|
+ months.add(ofMonth6);
|
|
|
+ // 实收笔数
|
|
|
+ RecentOfMonth ofMonth7 = new RecentOfMonth("实收笔数");
|
|
|
+ ofMonth7.setFourMonth(ofMonth3.getFourMonth() - ofMonth5.getFourMonth());
|
|
|
+ ofMonth7.setThreeMonth(ofMonth3.getThreeMonth() - ofMonth5.getThreeMonth());
|
|
|
+ ofMonth7.setTwoMonth(ofMonth3.getTwoMonth() - ofMonth5.getTwoMonth());
|
|
|
+ ofMonth7.setOneMonth(ofMonth3.getOneMonth() - ofMonth5.getOneMonth());
|
|
|
+ ofMonth7.setThreeMonthNum(NumFormat.getIncrease(ofMonth7.getFourMonth(), ofMonth7.getThreeMonth()));
|
|
|
+ ofMonth7.setTwoMonthNum(NumFormat.getIncrease(ofMonth7.getThreeMonth(), ofMonth7.getTwoMonth()));
|
|
|
+ ofMonth7.setOneMonthNum(NumFormat.getIncrease(ofMonth7.getTwoMonth(),ofMonth7.getOneMonth()));
|
|
|
+ months.add(ofMonth7);
|
|
|
+ // 对账金额
|
|
|
+ RecentOfMonth ofMonth8 = new RecentOfMonth("对账金额");
|
|
|
+ ofMonth8.setFourMonth(getApCheckSumTime(enUU, four, three));
|
|
|
+ ofMonth8.setThreeMonth(getApCheckSumTime(enUU, three, two));
|
|
|
+ ofMonth8.setTwoMonth(getApCheckSumTime(enUU, two, one));
|
|
|
+ ofMonth8.setOneMonth(getApCheckSumTime(enUU, one, now));
|
|
|
+ ofMonth8.setThreeMonthNum(NumFormat.getIncrease(ofMonth8.getFourMonth(), ofMonth8.getThreeMonth()));
|
|
|
+ ofMonth8.setTwoMonthNum(NumFormat.getIncrease(ofMonth8.getThreeMonth(), ofMonth8.getTwoMonth()));
|
|
|
+ ofMonth8.setOneMonthNum(NumFormat.getIncrease(ofMonth8.getTwoMonth(),ofMonth8.getOneMonth()));
|
|
|
+ months.add(ofMonth8);
|
|
|
+ // 对账笔数
|
|
|
+ RecentOfMonth ofMonth9 = new RecentOfMonth("对账笔数");
|
|
|
+ ofMonth9.setFourMonth(getApCheckNumTime(enUU, four, three));
|
|
|
+ ofMonth9.setThreeMonth(getApCheckNumTime(enUU, three, two));
|
|
|
+ ofMonth9.setTwoMonth(getApCheckNumTime(enUU, two, one));
|
|
|
+ ofMonth9.setOneMonth(getApCheckNumTime(enUU, one, now));
|
|
|
+ ofMonth9.setThreeMonthNum(NumFormat.getIncrease(ofMonth9.getFourMonth(), ofMonth9.getThreeMonth()));
|
|
|
+ ofMonth9.setTwoMonthNum(NumFormat.getIncrease(ofMonth9.getThreeMonth(), ofMonth9.getTwoMonth()));
|
|
|
+ ofMonth9.setOneMonthNum(NumFormat.getIncrease(ofMonth9.getTwoMonth(),ofMonth9.getOneMonth()));
|
|
|
+ months.add(ofMonth9);
|
|
|
// 开票金额
|
|
|
-
|
|
|
+ RecentOfMonth ofMonth10 = new RecentOfMonth("开票金额");
|
|
|
+ ofMonth10.setFourMonth(getApBillSumTime(enUU, four, three));
|
|
|
+ ofMonth10.setThreeMonth(getApBillSumTime(enUU, three, two));
|
|
|
+ ofMonth10.setTwoMonth(getApBillSumTime(enUU, two, one));
|
|
|
+ ofMonth10.setOneMonth(getApBillSumTime(enUU, one, now));
|
|
|
+ ofMonth10.setThreeMonthNum(NumFormat.getIncrease(ofMonth10.getFourMonth(), ofMonth10.getThreeMonth()));
|
|
|
+ ofMonth10.setTwoMonthNum(NumFormat.getIncrease(ofMonth10.getThreeMonth(), ofMonth10.getTwoMonth()));
|
|
|
+ ofMonth10.setOneMonthNum(NumFormat.getIncrease(ofMonth10.getTwoMonth(),ofMonth10.getOneMonth()));
|
|
|
+ months.add(ofMonth10);
|
|
|
// 开票笔数
|
|
|
+ RecentOfMonth ofMonth11 = new RecentOfMonth("开票笔数");
|
|
|
+ ofMonth11.setFourMonth(getApBillNumTime(enUU, four, three));
|
|
|
+ ofMonth11.setThreeMonth(getApBillNumTime(enUU, three, two));
|
|
|
+ ofMonth11.setTwoMonth(getApBillNumTime(enUU, two, one));
|
|
|
+ ofMonth11.setOneMonth(getApBillNumTime(enUU, one, now));
|
|
|
+ ofMonth11.setThreeMonthNum(NumFormat.getIncrease(ofMonth11.getFourMonth(), ofMonth11.getThreeMonth()));
|
|
|
+ ofMonth11.setTwoMonthNum(NumFormat.getIncrease(ofMonth11.getThreeMonth(), ofMonth11.getTwoMonth()));
|
|
|
+ ofMonth11.setOneMonthNum(NumFormat.getIncrease(ofMonth11.getTwoMonth(),ofMonth11.getOneMonth()));
|
|
|
+ months.add(ofMonth11);
|
|
|
+ map.put("data", months);
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
private Double getTimeSum(Long enUU, Long custUU){
|
|
|
- StringBuffer last = new StringBuffer("SELECT pu_date from purc$orders " +
|
|
|
- "WHERE pu_venduu = " + enUU + " pu_date is not null ");
|
|
|
+ StringBuffer last = new StringBuffer("SELECT ifnull((SELECT pu_date from purc$orders " +
|
|
|
+ "WHERE pu_venduu = " + enUU + " and pu_date is not null ");
|
|
|
if (!StringUtils.isEmpty(custUU)) {
|
|
|
last.append("and pu_enuu = " + custUU + "");
|
|
|
}
|
|
|
- StringBuffer first = last.append(" ORDER BY pu_date asc limit 1");
|
|
|
- last.append(" ORDER BY pu_date desc limit 1");
|
|
|
+ last.append(" ORDER BY pu_date desc limit 1),now()) pu_date");
|
|
|
+ StringBuffer first = new StringBuffer("SELECT ifnull((SELECT pu_date from purc$orders " +
|
|
|
+ "WHERE pu_venduu = " + enUU + " and pu_date is not null ");
|
|
|
+ if (!StringUtils.isEmpty(custUU)) {
|
|
|
+ first.append("and pu_enuu = " + custUU + "");
|
|
|
+ }
|
|
|
+ first.append(" ORDER BY pu_date asc limit 1),now()) pu_date");
|
|
|
Date lastTime = commonDao.queryForObject(last.toString(), Date.class);
|
|
|
Date firstTime = commonDao.queryForObject(first.toString(), Date.class);
|
|
|
- StringBuffer result = new StringBuffer("SELECT TIMESTAMPDIFF(MONTH," + firstTime + "," + lastTime +")");
|
|
|
+ StringBuffer result = new StringBuffer("SELECT TIMESTAMPDIFF(MONTH,'" + firstTime + "','" + lastTime +"')");
|
|
|
Double resultTime = commonDao.queryForObject(result.toString(), Double.class) / TimeStauts.TYEAR.value();
|
|
|
return NumFormat.getOne(resultTime);
|
|
|
}
|
|
|
@@ -128,7 +328,7 @@ public class TradingDataServiceImpl implements TradingDataService{
|
|
|
"FROM (SELECT SUM(pai_qty*pai_orderprice) amount,pa_currency currency FROM purc$accept LEFT JOIN purc$acceptitem " +
|
|
|
"on pai_paid=pa_id WHERE pa_venduu= " + enUU);
|
|
|
if (!StringUtils.isEmpty(custUU)) {
|
|
|
- sql.append(" and pu_enuu = " + custUU + " ");
|
|
|
+ sql.append(" and pa_enuu = " + custUU + " ");
|
|
|
}
|
|
|
sql.append(" GROUP BY pa_currency) a");
|
|
|
Double result = commonDao.queryForObject(sql.toString(), Double.class);
|
|
|
@@ -178,26 +378,96 @@ public class TradingDataServiceImpl implements TradingDataService{
|
|
|
private List<CustTrading> getCust(Long enUU) {
|
|
|
StringBuffer sql = new StringBuffer("SELECT en_uu custUU,en_name custName FROM sec$enterprises WHERE en_uu in " +
|
|
|
"(SELECT ve_myenuu FROM purc$vendors WHERE ve_vendenuu= " + enUU + " ) ORDER BY en_name");
|
|
|
- return commonDao.queryForList(sql.toString(), CustTrading.class);
|
|
|
+ List<CustTrading> custTradings = new ArrayList<>();
|
|
|
+ return commonDao.query(sql.toString(), CustTrading.class);
|
|
|
}
|
|
|
|
|
|
private Integer getAcceptNum(Long enUU, Long custUU) {
|
|
|
StringBuffer sql = new StringBuffer("SELECT COUNT(1) FROM purc$accept WHERE pa_venduu= " + enUU +
|
|
|
- " AND pa_enuu=" + custUU + "");
|
|
|
+ " AND pa_enuu=" + custUU);
|
|
|
Integer result = commonDao.queryForObject(sql.toString(), Integer.class);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
private Integer getReturnNum(Long enUU, Long custUU) {
|
|
|
StringBuffer sql = new StringBuffer("SELECT COUNT(1) FROM purc$return WHERE pr_venduu= " + enUU +
|
|
|
- " and pr_enuu= " + custUU + "");
|
|
|
+ " and pr_enuu= " + custUU);
|
|
|
Integer result = commonDao.queryForObject(sql.toString(), Integer.class);
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
private Integer getAcceptCust(Long enUU, Date startTime, Date endTime) {
|
|
|
StringBuffer sql = new StringBuffer("SELECT COUNT(1) from purc$orders WHERE pu_venduu= " + enUU +
|
|
|
- " AND pu_date >= '" + startTime + "' and pu_date >= " + endTime + " GROUP BY pu_enuu");
|
|
|
+ " AND pu_date >= '" + startTime + "' and pu_date < " + endTime);
|
|
|
+ Integer result = commonDao.queryForObject(sql.toString(), Integer.class);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ private Double getAcceptSumTime(Long enUU, Date startTime, Date endTime) {
|
|
|
+ StringBuffer sql = new StringBuffer("SELECT sum(case currency when 'RMB' then a.amount when 'USD' " +
|
|
|
+ "then a.amount * " + ErpRate.USD_RATE+ " when 'HKD' then a.amount * " + ErpRate.HKD_RATE + " end) result " +
|
|
|
+ "FROM (SELECT SUM(pai_qty*pai_orderprice) amount,pa_currency currency FROM purc$accept LEFT JOIN purc$acceptitem " +
|
|
|
+ "on pai_paid=pa_id WHERE pa_venduu= " + enUU + " and pa_date >= " + startTime + " and pa_date < " + endTime +
|
|
|
+ " GROUP BY pa_currency) a");
|
|
|
+ Double result = commonDao.queryForObject(sql.toString(), Double.class);
|
|
|
+ return NumFormat.getTwo(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ private Double getReturnSumTime(Long enUU, Date startTime, Date endTime) {
|
|
|
+ StringBuffer sql = new StringBuffer("SELECT sum(case currency when 'RMB' then a.amount when 'USD' " +
|
|
|
+ "then a.amount * " + ErpRate.USD_RATE+ " when 'HKD' then a.amount * " + ErpRate.HKD_RATE + " end) result " +
|
|
|
+ "FROM (SELECT SUM(pri_qty*pri_orderprice) amount,pr_currency currency FROM purc$return LEFT JOIN purc$returnitem " +
|
|
|
+ "on pri_prid=pr_id WHERE pr_venduu= " + enUU +" and pr_date >= " + startTime + " and pr_date < " + endTime +
|
|
|
+ " GROUP BY pr_currency) a");
|
|
|
+ Double result = commonDao.queryForObject(sql.toString(), Double.class);
|
|
|
+ return NumFormat.getTwo(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ private Integer getAcceptNumTime(Long enUU, Date startTime, Date endTime) {
|
|
|
+ StringBuffer sql = new StringBuffer("SELECT COUNT(1) FROM purc$accept WHERE pa_venduu= " + enUU +
|
|
|
+ " and pa_date >= " + startTime + " and pa_date < " + endTime);
|
|
|
Integer result = commonDao.queryForObject(sql.toString(), Integer.class);
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
+ private Integer getReturnNumTime(Long enUU, Date startTime, Date endTime) {
|
|
|
+ StringBuffer sql = new StringBuffer("SELECT COUNT(1) FROM purc$return WHERE pr_venduu= " + enUU +
|
|
|
+ " and pr_date >= " + startTime + " and pr_date < " + endTime);
|
|
|
+ Integer result = commonDao.queryForObject(sql.toString(), Integer.class);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ private Double getApCheckSumTime(Long enUU, Date startTime, Date endTime) {
|
|
|
+ StringBuffer sql = new StringBuffer("SELECT sum(case currency when 'RMB' then a.amount when 'USD' " +
|
|
|
+ "then a.amount * " + ErpRate.USD_RATE+ " when 'HKD' then a.amount * " + ErpRate.HKD_RATE + " end) result " +
|
|
|
+ "FROM (select sum(pa_checkamount) amount,pa_currency currency from purc$apcheck where pa_enuu = " + enUU +
|
|
|
+ " and pa_checkstatus = '已确认' and pa_recorddate >= " + startTime + " and pa_recorddate < " + endTime +
|
|
|
+ " GROUP BY pa_currency) a");
|
|
|
+ Double result = commonDao.queryForObject(sql.toString(), Double.class);
|
|
|
+ return NumFormat.getTwo(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ private Double getApCheckNumTime(Long enUU, Date startTime, Date endTime) {
|
|
|
+ StringBuffer sql = new StringBuffer("SELECT COUNT(1) from purc$apcheck where pa_enuu = " + enUU +
|
|
|
+ " and pa_checkstatus = '已确认' and pa_recorddate >= " + startTime + " and pa_recorddate < " + endTime);
|
|
|
+ Double result = commonDao.queryForObject(sql.toString(), Double.class);
|
|
|
+ return NumFormat.getTwo(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ private Double getApBillSumTime(Long enUU, Date startTime, Date endTime) {
|
|
|
+ StringBuffer sql = new StringBuffer("SELECT sum(case currency when 'RMB' then a.amount when 'USD' " +
|
|
|
+ "then a.amount * " + ErpRate.USD_RATE+ " when 'HKD' then a.amount * " + ErpRate.HKD_RATE + " end) result " +
|
|
|
+ "FROM (SELECT SUM(pab_paymount) amount,pab_currency currency FROM purc$apbill WHERE pad_venduu=" + enUU +
|
|
|
+ " and pab_date >= " + startTime + " and pab_date < " + endTime +
|
|
|
+ " GROUP BY pab_currency) a");
|
|
|
+ Double result = commonDao.queryForObject(sql.toString(), Double.class);
|
|
|
+ return NumFormat.getTwo(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ private Double getApBillNumTime(Long enUU, Date startTime, Date endTime) {
|
|
|
+ StringBuffer sql = new StringBuffer("SELECT COUNT(1) from purc$apbill WHERE pad_venduu=" + enUU +
|
|
|
+ " and pab_date >= " + startTime + " and pab_date < " + endTime );
|
|
|
+ Double result = commonDao.queryForObject(sql.toString(), Double.class);
|
|
|
+ return NumFormat.getTwo(result);
|
|
|
+ }
|
|
|
}
|