|
|
@@ -18,12 +18,10 @@ import com.startup.minpay.frame.session.MINSession;
|
|
|
import com.startup.minpay.frame.target.MINAction;
|
|
|
import com.startup.minpay.frame.target.MINComponent;
|
|
|
import com.startup.minpay.frame.target.MINParam;
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* 财务管理
|
|
|
@@ -53,6 +51,56 @@ public class invCardManageAction implements IMINAction {
|
|
|
/** 销售数据2 **/
|
|
|
public final static String SELECT_ALL_SALE = "selectAllSale";
|
|
|
|
|
|
+ /** 时间轴查询销售金额、预估利润 **/
|
|
|
+ public final static String SELECT_INCOME_BYDATE = "selectIncomeBydate";
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 时间轴查询销售金额、预估利润
|
|
|
+ * @param session
|
|
|
+ * @return
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ @MINAction(value = SELECT_INCOME_BYDATE)
|
|
|
+ public MINActionResult selectIncomeBydate (
|
|
|
+ @MINParam(key = "dateFlag") String dateFlag,
|
|
|
+ MINSession session) throws Exception {
|
|
|
+ MINActionResult res = new MINActionResult();
|
|
|
+ User user = session.getUser();
|
|
|
+ //获取当前时间
|
|
|
+ Date currentTime = new Date();
|
|
|
+ String nowDate = DateUtil.format(currentTime,"yyyyMMdd");
|
|
|
+ Map<String, String> m = new HashMap<String, String>();
|
|
|
+ //昨天
|
|
|
+ String yesDate = DateUtil.getDifferentDate(-1).substring(0,8);
|
|
|
+ //本周第一天
|
|
|
+ Calendar cal=Calendar.getInstance();
|
|
|
+ cal.add(Calendar.WEEK_OF_MONTH, 0);
|
|
|
+ cal.set(Calendar.DAY_OF_WEEK, 2);
|
|
|
+ Date weekFristDate = cal.getTime();
|
|
|
+ String weekDate = DateUtil.format(weekFristDate,"yyyyMMdd");
|
|
|
+ //按时间查询
|
|
|
+ if("0".equals(dateFlag)) {
|
|
|
+ m.put("nowDate", nowDate);
|
|
|
+ }else if("1".equals(dateFlag)) {
|
|
|
+ m.put("yesDate", yesDate);
|
|
|
+ }else if("2".equals(dateFlag)) {
|
|
|
+ m.put("weekDate", weekDate);
|
|
|
+ }
|
|
|
+ //查询累计收入
|
|
|
+ String countIncome = Service.lookup(IMINDataBaseService.class)
|
|
|
+ .getMybatisMapper(OrderManageMapper.class).selectCountIncome(m);
|
|
|
+ //查询预估利润
|
|
|
+ String predictIncome = Service.lookup(IMINDataBaseService.class)
|
|
|
+ .getMybatisMapper(OrderManageMapper.class).selectPredictIncome(m);
|
|
|
+ BigDecimal ljsr=new BigDecimal(countIncome);
|
|
|
+ BigDecimal ljzf=new BigDecimal(predictIncome);
|
|
|
+ predictIncome = (ljsr.subtract(ljzf)).toString();
|
|
|
+ //返回数据
|
|
|
+ res.set("countIncome", ljsr);
|
|
|
+ res.set("predictIncome", predictIncome);
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 总销售数量
|
|
|
* @param session
|
|
|
@@ -117,26 +165,26 @@ public class invCardManageAction implements IMINAction {
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
- @MINAction(value = SELECT_ALL_INCOME)
|
|
|
- public MINActionResult selectAllIncome (
|
|
|
- MINSession session) throws Exception {
|
|
|
- MINActionResult res = new MINActionResult();
|
|
|
- User user = session.getUser();
|
|
|
- //查询订单数
|
|
|
- String orderNum = Service.lookup(IMINDataBaseService.class)
|
|
|
- .getMybatisMapper(OrderManageMapper.class).selectCountOrderNum();
|
|
|
- //查询累计收入
|
|
|
- String countIncome = Service.lookup(IMINDataBaseService.class)
|
|
|
- .getMybatisMapper(OrderManageMapper.class).selectCountIncome();
|
|
|
- //查询总机台数
|
|
|
- String countDevice = Service.lookup(IMINDataBaseService.class)
|
|
|
- .getMybatisMapper(OrderManageMapper.class).selectCountDevice();
|
|
|
- //返回数据
|
|
|
- res.set("orderNum", orderNum);
|
|
|
- res.set("countIncome", countIncome);
|
|
|
- res.set("countDevice", countDevice);
|
|
|
- return res;
|
|
|
- }
|
|
|
+// @MINAction(value = SELECT_ALL_INCOME)
|
|
|
+// public MINActionResult selectAllIncome (
|
|
|
+// MINSession session) throws Exception {
|
|
|
+// MINActionResult res = new MINActionResult();
|
|
|
+// User user = session.getUser();
|
|
|
+// //查询订单数
|
|
|
+// String orderNum = Service.lookup(IMINDataBaseService.class)
|
|
|
+// .getMybatisMapper(OrderManageMapper.class).selectCountOrderNum();
|
|
|
+// //查询累计收入
|
|
|
+// String countIncome = Service.lookup(IMINDataBaseService.class)
|
|
|
+// .getMybatisMapper(OrderManageMapper.class).selectCountIncome();
|
|
|
+// //查询总机台数
|
|
|
+// String countDevice = Service.lookup(IMINDataBaseService.class)
|
|
|
+// .getMybatisMapper(OrderManageMapper.class).selectCountDevice();
|
|
|
+// //返回数据
|
|
|
+// res.set("orderNum", orderNum);
|
|
|
+// res.set("countIncome", countIncome);
|
|
|
+// res.set("countDevice", countDevice);
|
|
|
+// return res;
|
|
|
+// }
|
|
|
|
|
|
/**
|
|
|
* 收入统计
|