|
@@ -36,10 +36,10 @@ public class TurnoverServiceImpl implements TurnoverService {
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public List<Turnover> findSubstitute() {
|
|
public List<Turnover> findSubstitute() {
|
|
|
- String sql = "select date_format(deo_entrydate,'%Y%m') x,deo_currency y,round(sum(dei_totalprice)/10000 ,2) z from purc$deputyorderitems\n" +
|
|
|
|
|
- " left join purc$deputyorders on dei_deoid=deo_id where date_format(deo_entrydate,'%Y')=date_format(last_day(now()), '%Y') \n" +
|
|
|
|
|
- " and deo_downloadstatus = '已下载' and deo_entrystatus='已提交' group by date_format(deo_entrydate,'%Y%m'),\n" +
|
|
|
|
|
- " deo_currency order by date_format(deo_entrydate,'%Y%m'),deo_currency";
|
|
|
|
|
|
|
+ String sql = "select date_format(deo_date,'%Y%m') x,deo_currency y,round(sum(dei_totalprice)/10000 ,2) z from purc$deputyorderitems\n" +
|
|
|
|
|
+ " left join purc$deputyorders on dei_deoid=deo_id where date_format(deo_date,'%Y')=date_format(last_day(now()), '%Y') \n" +
|
|
|
|
|
+ " and deo_downloadstatus = '已下载' and deo_entrystatus='已提交' group by date_format(deo_date,'%Y%m'),\n" +
|
|
|
|
|
+ " deo_currency order by date_format(deo_date,'%Y%m'),deo_currency";
|
|
|
return commonDao.query(sql, Turnover.class);
|
|
return commonDao.query(sql, Turnover.class);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -53,7 +53,7 @@ public class TurnoverServiceImpl implements TurnoverService {
|
|
|
String sql = " select round(sum(dei_totalprice*case when deo_currency='USD' then " + USD_RATE + " when deo_currency='HKD' then " + HKD_RATE + " \n" +
|
|
String sql = " select round(sum(dei_totalprice*case when deo_currency='USD' then " + USD_RATE + " when deo_currency='HKD' then " + HKD_RATE + " \n" +
|
|
|
" when deo_currency='RMB' then 1 end)/10000 ,2) SUM \n" +
|
|
" when deo_currency='RMB' then 1 end)/10000 ,2) SUM \n" +
|
|
|
" from purc$deputyorderitems left join purc$deputyorders on dei_deoid=deo_id \n" +
|
|
" from purc$deputyorderitems left join purc$deputyorders on dei_deoid=deo_id \n" +
|
|
|
- " where date_format(deo_entrydate,'%Y')=date_format(last_day(now()), '%Y') and deo_downloadstatus = '已下载'\n" +
|
|
|
|
|
|
|
+ " where date_format(deo_date,'%Y')=date_format(now(), '%Y') and deo_downloadstatus = '已下载'\n" +
|
|
|
" and deo_entrystatus='已提交'";
|
|
" and deo_entrystatus='已提交'";
|
|
|
return commonDao.query(sql, Turnover.class);
|
|
return commonDao.query(sql, Turnover.class);
|
|
|
}
|
|
}
|
|
@@ -65,15 +65,26 @@ public class TurnoverServiceImpl implements TurnoverService {
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public List<Turnover> findRMBOrderAmount() {
|
|
public List<Turnover> findRMBOrderAmount() {
|
|
|
- String sql = "select round(sum(YFIELD*(case when a.xfield='USD' then " + USD_RATE + " when a.xfield='HKD' then " + HKD_RATE + " when a.xfield='RMB' then 1 end )),2) SUM from \n" +
|
|
|
|
|
- "(select pu_currency xField, round(sum(pd_qty * pd_price)/10000 ,2) yField \n" +
|
|
|
|
|
- "from purc$orderitems left join purc$orders on pd_puid=pu_id where \n" +
|
|
|
|
|
- "date_format(pu_date,'%Y')=date_format(last_day(now()), '%Y') group by pu_currency\n" +
|
|
|
|
|
- "UNION\n" +
|
|
|
|
|
- "select deo_currency xField, round(sum(dei_totalprice)/10000 ,2) yField \n" +
|
|
|
|
|
- "from purc$deputyorderitems left join purc$deputyorders on dei_deoid=deo_id where \n" +
|
|
|
|
|
- "date_format(deo_entrydate,'%Y')=date_format(last_day(now()), '%Y') and deo_downloadstatus = '已下载' and deo_entrystatus='已提交' \n" +
|
|
|
|
|
- "group by deo_currency) a";
|
|
|
|
|
|
|
+ String sql = "select round((sum(a.orderAmount)/10000), 2) SUM from (" +
|
|
|
|
|
+ "select sum(case o.pu_currency " +
|
|
|
|
|
+ "when 'USD' then o.orderAmount * 6.4 " +
|
|
|
|
|
+ "when 'HKD' then o.orderAmount * 0.811 " +
|
|
|
|
|
+ "else o.orderAmount end) as orderAmount " +
|
|
|
|
|
+ "from (select pu_currency,sum(pd_qty * pd_price) orderAmount from purc$orders " +
|
|
|
|
|
+ "left join purc$orderitems on pu_id = pd_puid " +
|
|
|
|
|
+ " where DATE_FORMAT(pu_date, '%Y') = DATE_FORMAT(now(), '%Y') " +
|
|
|
|
|
+ " group by pu_currency) o " +
|
|
|
|
|
+ "UNION " +
|
|
|
|
|
+ "select sum(case o.deo_currency " +
|
|
|
|
|
+ "when 'USD' then o.orderAmount * 6.4 " +
|
|
|
|
|
+ "when 'HKD' then o.orderAmount * 0.811 " +
|
|
|
|
|
+ "else o.orderAmount end) as orderAmount " +
|
|
|
|
|
+ "from (" +
|
|
|
|
|
+ "select deo_currency, sum(dei_totalprice) orderAmount " +
|
|
|
|
|
+ "from purc$deputyorderitems left join purc$deputyorders on dei_deoid=deo_id " +
|
|
|
|
|
+ "where deo_entrystatus='已提交' and deo_downloadstatus = '已下载' " +
|
|
|
|
|
+ "and DATE_FORMAT(deo_date, '%Y') = DATE_FORMAT(now(), '%Y') " +
|
|
|
|
|
+ "group by deo_currency) o) a";
|
|
|
return commonDao.query(sql, Turnover.class);
|
|
return commonDao.query(sql, Turnover.class);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -87,11 +98,11 @@ public class TurnoverServiceImpl implements TurnoverService {
|
|
|
String sql = "select a.xField,ROUND(SUM(a.yField)) yField from(\n" +
|
|
String sql = "select a.xField,ROUND(SUM(a.yField)) yField from(\n" +
|
|
|
"select pu_currency xField, round(sum(pd_qty * pd_price)/10000 ,2) yField \n" +
|
|
"select pu_currency xField, round(sum(pd_qty * pd_price)/10000 ,2) yField \n" +
|
|
|
"from purc$orderitems left join purc$orders on pd_puid=pu_id where \n" +
|
|
"from purc$orderitems left join purc$orders on pd_puid=pu_id where \n" +
|
|
|
- "date_format(pu_date,'%Y')=date_format(last_day(now()), '%Y') group by pu_currency\n" +
|
|
|
|
|
|
|
+ "date_format(pu_date,'%Y')=date_format(now(), '%Y') group by pu_currency\n" +
|
|
|
"UNION\n" +
|
|
"UNION\n" +
|
|
|
"select deo_currency xField, round(sum(dei_totalprice)/10000 ,2) yField \n" +
|
|
"select deo_currency xField, round(sum(dei_totalprice)/10000 ,2) yField \n" +
|
|
|
"from purc$deputyorderitems left join purc$deputyorders on dei_deoid=deo_id where \n" +
|
|
"from purc$deputyorderitems left join purc$deputyorders on dei_deoid=deo_id where \n" +
|
|
|
- "date_format(deo_entrydate,'%Y')=date_format(last_day(now()), '%Y') and deo_entrystatus='已提交' and deo_downloadstatus = '已下载' \n" +
|
|
|
|
|
|
|
+ "date_format(deo_date,'%Y')=date_format(last_day(now()), '%Y') and deo_entrystatus='已提交' and deo_downloadstatus = '已下载' \n" +
|
|
|
"group by deo_currency) a GROUP BY xField";
|
|
"group by deo_currency) a GROUP BY xField";
|
|
|
return commonDao.query(sql, Turnover.class);
|
|
return commonDao.query(sql, Turnover.class);
|
|
|
}
|
|
}
|
|
@@ -110,7 +121,7 @@ public class TurnoverServiceImpl implements TurnoverService {
|
|
|
"and pu_currency is not null group by pu_currency\n" +
|
|
"and pu_currency is not null group by pu_currency\n" +
|
|
|
"union\n" +
|
|
"union\n" +
|
|
|
"select deo_currency xField, round(sum(deo_orderamount)/10000 ,2) yField from purc$deputyorders\n" +
|
|
"select deo_currency xField, round(sum(deo_orderamount)/10000 ,2) yField from purc$deputyorders\n" +
|
|
|
- "where date_format(deo_entrydate,'%Y-%m') = date_format(DATE_ADD(now(), INTERVAL -1 MONTH), '%Y-%m')\n" +
|
|
|
|
|
|
|
+ "where date_format(deo_date,'%Y-%m') = date_format(DATE_ADD(now(), INTERVAL -1 MONTH), '%Y-%m')\n" +
|
|
|
"and deo_downloadstatus = '已下载' and deo_entrystatus='已提交' group by deo_currency) a\n" +
|
|
"and deo_downloadstatus = '已下载' and deo_entrystatus='已提交' group by deo_currency) a\n" +
|
|
|
"group by xField";
|
|
"group by xField";
|
|
|
return commonDao.query(sql, Turnover.class);
|
|
return commonDao.query(sql, Turnover.class);
|
|
@@ -142,7 +153,7 @@ public class TurnoverServiceImpl implements TurnoverService {
|
|
|
"and pu_currency is not null group by pu_currency\n" +
|
|
"and pu_currency is not null group by pu_currency\n" +
|
|
|
"union\n" +
|
|
"union\n" +
|
|
|
"select deo_currency xField, round(sum(deo_orderamount)/10000 ,2) yField from purc$deputyorders\n" +
|
|
"select deo_currency xField, round(sum(deo_orderamount)/10000 ,2) yField from purc$deputyorders\n" +
|
|
|
- "where date_format(deo_entrydate,'%Y-%m') = date_format(now(), '%Y-%m')\n" +
|
|
|
|
|
|
|
+ "where date_format(deo_date,'%Y-%m') = date_format(now(), '%Y-%m')\n" +
|
|
|
"and deo_downloadstatus = '已下载' and deo_entrystatus='已提交' group by deo_currency) a\n" +
|
|
"and deo_downloadstatus = '已下载' and deo_entrystatus='已提交' group by deo_currency) a\n" +
|
|
|
"group by xField";
|
|
"group by xField";
|
|
|
return commonDao.query(sql, Turnover.class);
|
|
return commonDao.query(sql, Turnover.class);
|