Browse Source

订单统计

xubh 4 years ago
parent
commit
e8480369d0

+ 65 - 0
src/main/java/com/minpay/db/table/own/mapper/OrderManageMapper.java

@@ -0,0 +1,65 @@
+package com.minpay.db.table.own.mapper;
+
+import com.startup.minpay.frame.jdbc.IMINMybatisEntityMapper;
+import com.startup.minpay.frame.jdbc.MINRowBounds;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 订单
+ */
+public interface OrderManageMapper extends IMINMybatisEntityMapper {
+	
+	/**
+	 * 查询订单详情
+	 */
+	List<Map<String, String>> selectOrderDetail(Map<String, String> m, MINRowBounds row);
+
+	/**
+	 * 查询取货记录
+	 */
+	List<Map<String, String>> selectPickupRecord(Map<String, String> m, MINRowBounds row);
+
+	/**
+	 * 查询收入统计
+	 */
+	List<Map<String, String>> selectIncomeDetail(MINRowBounds row, Map<String, String> m);
+
+	/**
+	 * 查询订单数
+	 */
+	String selectCountOrderNum();
+
+	/**
+	 * 查询累计收入
+	 */
+	String selectCountIncome(Map<String, String> m);
+	/**
+	 * 查询总机台数
+	 */
+	String selectCountDevice();
+
+	/**
+	 * 销售数据
+	 */
+	List<Map<String, String>> selectProductInfo(MINRowBounds row, Map<String, String> m);
+	/**
+	 * 总实际金额
+	 */
+	String selectAllSale();
+	/**
+	 * 总商品成本
+	 */
+	String selectAllCost();
+	/**
+	 * 预估利润
+	 */
+	String selectPredictIncome(Map<String, String> m);
+	/**
+	 * 查询累计收入 只查询微信支付宝
+	 */
+	List<Map<String, String>>  selectCountIncomeb(Map<String, String> m);
+
+	Map<String, String> selectOrderNumber(Map<String, String> m);
+}

+ 390 - 0
src/main/java/com/minpay/shouhuo/orderaction/InvCardManageAction.java

@@ -0,0 +1,390 @@
+package com.minpay.shouhuo.orderaction;
+
+import com.minpay.common.bean.User;
+import com.minpay.common.constant.Constant;
+import com.minpay.common.format.IFormatService;
+import com.minpay.common.service.ILogService;
+import com.minpay.common.service.IPropertiesService;
+import com.minpay.common.util.CommonUtil;
+import com.minpay.common.util.DateUtil;
+import com.minpay.common.util.HttpPostUtil;
+import com.minpay.db.table.mapper.VmDeliveryInfMapper;
+import com.minpay.db.table.mapper.VmOrderDetailsMapper;
+import com.minpay.db.table.model.VmDeliveryInf;
+import com.minpay.db.table.model.VmOrderDetails;
+import com.minpay.db.table.own.mapper.OrderManageMapper;
+import com.startup.minpay.frame.business.IMINAction;
+import com.startup.minpay.frame.business.res.MINActionResult;
+import com.startup.minpay.frame.constant.IMINBusinessConstant;
+import com.startup.minpay.frame.data.format.MINCopyFormat;
+import com.startup.minpay.frame.exception.MINBusinessException;
+import com.startup.minpay.frame.jdbc.MINRowBounds;
+import com.startup.minpay.frame.service.base.IMINDataBaseService;
+import com.startup.minpay.frame.service.base.Service;
+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 net.sf.json.JSONObject;
+
+import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+/**
+ * 财务管理
+ *
+ * @author Xbh
+ */
+@MINComponent
+public class InvCardManageAction implements IMINAction {
+
+	/**查询订单详情**/
+	public final static String SELECT_ORDER_DETAIL = "selectOrderDetail";
+
+	/**查询取货记录**/
+	public final static String SELECT_PICKUP_RECORD = "selectPickupRecord";
+
+	/**  收入统计 **/
+	public final static String SELECT_INCOME_STATISTICS = "selectIncomeStatistics";
+
+	/**  收入统计 **/
+	public final static String SELECT_ALL_INCOME = "selectAllIncome";
+
+	/**  销售数据 **/
+	public final static String SELECT_SALES_DATA = "selectSalesData";
+	/**  销售数据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");
+		//按时间查询
+		String time = null;
+		if("0".equals(dateFlag)) {
+			m.put("nowDate", nowDate);
+			Date  parse = new SimpleDateFormat("yyyyMMdd").parse(nowDate);
+			String  dateString = new SimpleDateFormat("yyyy-MM-dd").format(parse);
+			time = dateString;
+		}else if("1".equals(dateFlag)) {
+			m.put("yesDate", yesDate);
+			Date  parse = new SimpleDateFormat("yyyyMMdd").parse(yesDate);
+			String  dateString = new SimpleDateFormat("yyyy-MM-dd").format(parse);
+			time = dateString;
+		}else if("2".equals(dateFlag)) {
+			//七天前
+			String dateString = DateUtil.getDifferentDate(-7).substring(0,8);
+			Date  parse = new SimpleDateFormat("yyyyMMdd").parse(dateString);
+			String  dateStringc = new SimpleDateFormat("yyyy-MM-dd").format(parse);
+
+			//当天时间
+			String dateStringb = DateUtil.getCurrentDateString();
+			Date  parseb = new SimpleDateFormat("yyyyMMdd").parse(dateStringb);
+			String  dateStringd = new SimpleDateFormat("yyyy-MM-dd").format(parseb);
+
+			 time = dateStringc.concat(" 至 ").concat(dateStringd);
+			m.put("weekDate", dateString);
+		}
+		if(!Constant.ADMINISTRATION_SYSTEM_NUMBER.equals(user.getBranchId())){
+			m.put("branchId",user.getBranchId());
+		}
+		//查询累计收入
+		String countIncome = Service.lookup(IMINDataBaseService.class)
+				.getMybatisMapper(OrderManageMapper.class).selectCountIncome(m);
+		//查询总成本价
+		String predictIncome = Service.lookup(IMINDataBaseService.class)
+				.getMybatisMapper(OrderManageMapper.class).selectPredictIncome(m);
+		//查询累计收入
+		List<Map<String, String>> mapList = Service.lookup(IMINDataBaseService.class)
+														.getMybatisMapper(OrderManageMapper.class).selectCountIncomeb(m);
+
+		//查询订单
+		Map<String, String> orderNumberMap = Service.lookup(IMINDataBaseService.class)
+				.getMybatisMapper(OrderManageMapper.class).selectOrderNumber(m);
+
+		String  wxzfbAmout = "0";
+		String  czAmout = "0";
+		for (int i = 0; i < mapList.size(); i++) {
+			Map<String, String> map = mapList.get(i);
+			String transType = map.get("transType");
+			if(transType.equals("00")){ //充值金额
+				 czAmout =  String.valueOf(map.get("amout"));
+			}
+			if(transType.equals("10")){ //支付金额
+				wxzfbAmout =   String.valueOf(map.get("amout"));
+			}
+		}
+
+		String lrAmout = CommonUtil.subtract(countIncome,predictIncome);
+		String zsrAmout = CommonUtil.add(czAmout,wxzfbAmout);
+		Map<String, String> incomeMap = new HashMap<>();
+
+		//返回数据
+		incomeMap.put("countIncome", countIncome);	//总销售价格
+		incomeMap.put("lrAmout", lrAmout);	//利润
+		incomeMap.put("predictIncome", predictIncome); //成本
+		incomeMap.put("czAmout", czAmout);			//充值金额
+		incomeMap.put("zsrAmout", zsrAmout);		//实际收入
+		incomeMap.put("time", time);				//时间
+		incomeMap.put("orderNumber",orderNumberMap.get("number"));//订单总数
+		res.set("incomeMap", incomeMap);
+
+		return res;
+	}
+
+	/**
+	 * 总销售数量
+	 * @param session
+	 * @return
+	 * @throws Exception
+	 */
+	@MINAction(value = SELECT_ALL_SALE)
+	public MINActionResult selectAllSale (
+			MINSession session) throws Exception {
+		MINActionResult res = new MINActionResult();
+		User user = session.getUser();
+		//总实际金额
+		String allSale = Service.lookup(IMINDataBaseService.class)
+				.getMybatisMapper(OrderManageMapper.class).selectAllSale();
+		//总商品成本
+		String allCost = Service.lookup(IMINDataBaseService.class)
+				.getMybatisMapper(OrderManageMapper.class).selectAllCost();
+		BigDecimal num1 = new BigDecimal(allSale);
+		BigDecimal num2 = new BigDecimal(allCost);
+		BigDecimal  allProfit = num1.subtract(num2);
+		//返回数据
+		res.set("allSale", allSale);
+		res.set("allCost", allCost);
+		res.set("allProfit", allProfit);
+
+		return res;
+	}
+	/**
+	 * 销售数据
+	 * @param page
+	 * @param limit
+	 * @param session
+	 * @return
+	 * @throws Exception
+	 */
+	@MINAction(value = SELECT_SALES_DATA)
+	public MINActionResult selectSalesData (
+			@MINParam(key = "page", defaultValue = "1") int page,
+			@MINParam(key = "limit", defaultValue = "7") int limit,
+			@MINParam(key = "proName") String proName,
+			MINSession session) throws Exception {
+		MINActionResult res = new MINActionResult();
+		User user = session.getUser();
+		Map<String, String> m = new HashMap<String, String>();
+		m.put("proName", proName);
+		if(!Constant.ADMINISTRATION_SYSTEM_NUMBER.equals(user.getBranchId())){
+			m.put("branchId", user.getBranchId());
+		}
+
+		MINRowBounds rows = new MINRowBounds(page, limit);
+		List<Map<String, String>> detailList = Service.lookup(IMINDataBaseService.class)
+				.getMybatisMapper(OrderManageMapper.class).selectProductInfo(rows, m);
+
+		detailList = Service.lookup(IFormatService.class).formatCurrency(detailList, "amount", "proNums");
+
+		//返回数据
+		res.set(IMINBusinessConstant.F_PAGING_LAY, detailList);
+		res.set(IMINBusinessConstant.F_PAGING_COUNT, rows.getCount());
+		return res;
+	}
+
+	/**
+	 * 总收入统计
+	 * @param session
+	 * @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;
+//	}
+
+	/**
+	 * 收入统计
+	 * @param page
+	 * @param limit
+	 * @param session
+	 * @return
+	 * @throws Exception
+	 */
+	@MINAction(value = SELECT_INCOME_STATISTICS)
+	public MINActionResult selectIncomeStatistics (
+			@MINParam(key = "page", defaultValue = "1") int page,
+			@MINParam(key = "limit", defaultValue = "10") int limit,
+			@MINParam(key = "equNum") String equNum,
+			@MINParam(key = "datesTime") String datesTime,
+
+			MINSession session) throws Exception {
+		MINActionResult res = new MINActionResult();
+		User user = session.getUser();
+		String branchId = user.getBranchId();
+		MINRowBounds rows = new MINRowBounds(page, limit);
+		//获取当前时间
+ 		Date currentTime = new Date();
+		String nowDate = DateUtil.format(currentTime,"yyyyMMdd");
+		Map<String, String> m = new HashMap<String, String>();
+		m.put("equNum", equNum);
+		m.put("datesTime", datesTime);
+		m.put("nowDate", nowDate);
+		if(!"88888888".equals(branchId)) {
+			m.put("branchId", branchId);
+		}
+		List<Map<String, String>> detailList = Service.lookup(IMINDataBaseService.class)
+				.getMybatisMapper(OrderManageMapper.class).selectIncomeDetail(rows, m);
+
+		detailList = Service.lookup(IFormatService.class).formatDate(detailList, "sellTime");
+		detailList = Service.lookup(IFormatService.class).formatCurrency(detailList, "sellWxSum", "sellZfSum", "" +
+				"sellMfSum", "allSell");
+		//返回数据
+		res.set(IMINBusinessConstant.F_PAGING_LAY, detailList);
+		res.set(IMINBusinessConstant.F_PAGING_COUNT, rows.getCount());
+		return res;
+	}
+
+	/**
+	 * 取货记录
+	 * @param machineNo
+	 * @param orderNo
+	 * @param pickUpDates
+	 * @param page
+	 * @param limit
+	 * @param session
+	 * @return
+	 * @throws Exception
+	 */
+	@MINAction(value = SELECT_PICKUP_RECORD)
+	public MINActionResult selectPickupRecord (
+			@MINParam(key = "machineNo") String machineNo,
+			@MINParam(key = "orderNo") String orderNo,
+			@MINParam(key = "pickUpDates") String pickUpDates,
+			@MINParam(key = "equrelId") String equrelId,
+			@MINParam(key = "vciId") String vciId,
+			@MINParam(key = "pickupNo") String pickupNo,
+			@MINParam(key = "page", defaultValue = "1") int page,
+			@MINParam(key = "limit", defaultValue = "3") int limit,
+			MINSession session) throws Exception {
+		MINActionResult res = new MINActionResult();
+		User user = session.getUser();
+		String branchId = user.getBranchId();
+		Map<String, String> m = new HashMap<String, String>();
+		m.put("machineNo", machineNo);
+		m.put("orderNo", orderNo);
+		m.put("pickUpDates", pickUpDates);
+		m.put("equrelId", equrelId);
+		m.put("vciId", vciId);
+		m.put("pickupNo", pickupNo);
+		if(!"88888888".equals(branchId)) {
+			m.put("branchId", branchId);
+		}
+		MINRowBounds rows = new MINRowBounds(page, limit);
+		List<Map<String, String>> detailList = Service.lookup(IMINDataBaseService.class)
+				.getMybatisMapper(OrderManageMapper.class).selectPickupRecord(m,rows);
+		detailList = new MINCopyFormat("{stt:'sttDesc'}").format(detailList);
+		detailList = Service.lookup(IFormatService.class).formatEnum(detailList,"{sttDesc:'PICKUP_STT'}");
+		detailList = Service.lookup(IFormatService.class).formatDateTime(detailList, "pickUpTime");
+		//返回数据
+		res.set(IMINBusinessConstant.F_PAGING_LAY, detailList);
+		res.set(IMINBusinessConstant.F_PAGING_COUNT, rows.getCount());
+		return res;
+	}
+
+	/**
+	 * 查询订单详情
+	 * @param machineNo
+	 * @param pickUpCode
+	 * @param creatdDtes
+	 * @param pickUpDates
+	 * @param pickUpState
+	 * @param page
+	 * @param limit
+	 * @param session
+	 * @return
+	 * @throws Exception
+	 */
+	@MINAction(value = SELECT_ORDER_DETAIL)
+	public MINActionResult selectOrderDetail (
+			@MINParam(key = "machineNo") String machineNo,
+			@MINParam(key = "pickUpCode") String pickUpCode,
+			@MINParam(key = "equrelId") String equrelId,
+			@MINParam(key = "creatdDtes") String creatdDtes,
+			@MINParam(key = "pickUpDates") String pickUpDates,
+			@MINParam(key = "pickUpState") String pickUpState,
+			@MINParam(key = "page", defaultValue = "1") int page,
+			@MINParam(key = "limit", defaultValue = "3") int limit,
+			MINSession session) throws Exception {
+		MINActionResult res = new MINActionResult();
+		User user = session.getUser();
+		String branchId = user.getBranchId();
+		Map<String, String> m = new HashMap<String, String>();
+		m.put("machineNo", machineNo);
+		m.put("pickUpCode", pickUpCode);
+		m.put("equrelId", equrelId);
+		m.put("creatdDtes", creatdDtes);
+		m.put("pickUpDates", pickUpDates);
+		m.put("pickUpState", pickUpState);
+		if(!"88888888".equals(branchId)) {
+			m.put("branchId", branchId);
+		}
+		MINRowBounds rows = new MINRowBounds(page, limit);
+		List<Map<String, String>> detailList = Service.lookup(IMINDataBaseService.class)
+				.getMybatisMapper(OrderManageMapper.class).selectOrderDetail(m,rows);
+		// 格式化数据
+		detailList = Service.lookup(IFormatService.class).formatDateTime(detailList, "pickUpTime");
+		detailList = Service.lookup(IFormatService.class).formatDateTime(detailList, "createTime");
+		detailList = new MINCopyFormat("{stt:'sttDesc'}").format(detailList);
+		detailList = Service.lookup(IFormatService.class).formatEnum(detailList,"{sttDesc:'ORDER_PICKUP_STT'}");
+		//返回数据
+		res.set(IMINBusinessConstant.F_PAGING_LAY, detailList);
+		res.set(IMINBusinessConstant.F_PAGING_COUNT, rows.getMaxRows());
+		return res;
+	}
+
+
+
+
+}

+ 330 - 0
src/main/resources/com/minpay/db/table/own/mapper/OrderManageMapper.xml

@@ -0,0 +1,330 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.minpay.db.table.own.mapper.OrderManageMapper">
+
+	<select id="selectOrderDetail" resultType="hashmap" parameterType="java.util.Map">
+		SELECT
+		d.VOI_ID				"orderNo",
+		o.VOD_PRODUCT_ID 		"productId",
+		o.VOD_PRO_NAME 			"productName",
+		p.VCI_NAME 				"userName",
+		o.VOD_PRO_EQU_REL_ID 		"equrelId",
+		r.VCI_EQUIPMENT_ID 		"machineNo",
+		o.VOD_AMOUNT 		"orderAmt",
+		o.VOD_CREATE_TIME 		"createTime",
+		o.VOD_DELIVERY_ID 		"pickupNo",
+		o.VOD_PICKUP_TIME 		"pickUpTime",
+		o.VOD_IS_DELIVERY 		"stt",
+		r.VCI_SALL_PRICE 		"sallPrice",
+		r.VCI_GAME_PRICE 		"gamePrice",
+		r.VCI_COST_PRICE 		"costPrice",
+		e.VEQ_IMEI_ADDR 		"imeiAddr",
+		r.VCI_AISLE 			"aisle",
+		o.VOD_DETAILS_ID 		"detailsId"
+		FROM vm_order_details o,vm_order_inf d, vm_pro_equ_rel r, vm_person_inf p,vm_equipment_inf e
+		where o.VOD_PRO_EQU_REL_ID = r.VCI_ID
+		and d.VOI_PERSON_ID = p.VCI_ID
+		and o.VOD_ORDER_ID = d.VOI_ID
+		and r.VCI_EQUIPMENT_ID = e.VEQ_ID
+		<if test="branchId != null and branchId != ''">
+			and VOI_BRANCHID = #{branchId,jdbcType=VARCHAR}
+		</if>
+		<if test="pickUpCode != null and pickUpCode != ''">
+			AND	 o.VOD_DELIVERY_ID  = #{pickUpCode,jdbcType=VARCHAR}
+		</if>
+		<if test="pickUpState != null and pickUpState != ''">
+			AND	 o.VOD_IS_DELIVERY  = #{pickUpState,jdbcType=VARCHAR}
+		</if>
+		<if test="machineNo != null and machineNo != ''">
+			AND	 e.VEQ_IMEI_ADDR  = #{machineNo,jdbcType=VARCHAR}
+		</if>
+		<if test="equrelId != null and equrelId != ''">
+			AND	 r.VCI_AISLE  = #{equrelId,jdbcType=VARCHAR}
+		</if>
+		<if test="creatdDtes != null and creatdDtes != ''">
+			and substr(VOD_CREATE_TIME,1,8) between substr((#{creatdDtes, jdbcType=VARCHAR}),1,8)
+			and substr((#{creatdDtes, jdbcType=VARCHAR}),12,19)
+		</if>
+		<if test="pickUpDates != null and pickUpDates != ''">
+			and substr(VOD_PICKUP_TIME,1,8) between substr((#{pickUpDates, jdbcType=VARCHAR}),1,8)
+			and substr((#{pickUpDates, jdbcType=VARCHAR}),12,19)
+		</if>
+		and VCI_EXEIT_STATE = "00"
+		and VOI_STATE = "00"
+		and VCI_STATUS = "00"
+		order by d.VOI_CREATE_TIME desc
+	</select>
+	<select id="selectPickupRecord" resultType="hashmap" parameterType="java.util.Map">
+		SELECT
+		oi.VOI_EQUIPMENT_ID 	"machineNo",
+		oi.VOI_ID 				"orderNo",
+		di.VDI_STATUS 			"stt",
+		od.VOD_PICKUP_TIME 		"pickUpTime",
+		od.VOD_PRO_NAME 		"productName",
+		od.VOD_PRO_EQU_REL_ID 	"equrelId",
+		od.VOD_DELIVERY_ID 		"pickupNo",
+		p.VCI_ID				"vciId",
+		p.VCI_NAME 				"userName",
+		r.VCI_SALL_PRICE 		"sallPrice",
+		r.VCI_GAME_PRICE 		"gamePrice",
+		r.VCI_COST_PRICE 		"costPrice",
+		e.VEQ_IMEI_ADDR 		"imeiAddr",
+		r.VCI_AISLE 			"aisle",
+		od.VOD_DETAILS_ID 		"detailsId"
+		from vm_delivery_inf di, vm_order_details od, vm_order_inf oi, vm_person_inf p, vm_pro_equ_rel r,vm_equipment_inf e
+		where di.VDI_ORD_DET_ID = od.VOD_DETAILS_ID
+		and VOD_ORDER_ID = oi.VOI_ID
+		and oi.VOI_PERSON_ID = p.VCI_ID
+		and od.VOD_PRO_EQU_REL_ID = r.VCI_ID
+		and r.VCI_EQUIPMENT_ID = e.VEQ_ID
+		<if test="branchId != null and branchId != ''">
+			and VOI_BRANCHID = #{branchId,jdbcType=VARCHAR}
+		</if>
+		<if test="machineNo != null and machineNo != ''">
+			AND	e.VEQ_IMEI_ADDR  = #{machineNo,jdbcType=VARCHAR}
+		</if>
+		<if test="orderNo != null and orderNo != ''">
+			AND	od.VOD_DETAILS_ID  = #{orderNo,jdbcType=VARCHAR}
+		</if>
+		<if test="equrelId != null and equrelId != ''">
+			AND	r.VCI_AISLE   = #{equrelId,jdbcType=VARCHAR}
+		</if>
+		<if test="vciId != null and vciId != ''">
+			AND	p.VCI_ID  = #{vciId,jdbcType=VARCHAR}
+		</if>
+		<if test="pickupNo != null and pickupNo != ''">
+			AND	di.VDI_DELIVERY_ID  = #{pickupNo,jdbcType=VARCHAR}
+		</if>
+		<if test="pickUpDates != null and pickUpDates != ''">
+			and substr(VOD_PICKUP_TIME,1,8) between substr((#{pickUpDates, jdbcType=VARCHAR}),1,8)
+			and substr((#{pickUpDates, jdbcType=VARCHAR}),12,19)
+		</if>
+		order by oi.VOI_MODIFY_TIME desc
+	</select>
+
+	<select id="selectIncomeDetail" resultType="hashmap" parameterType="java.util.Map">
+		SELECT succTime sellTime,
+		ROUND(SUM(allCount),2) newCount,
+		ROUND(SUM(wxSum),2) sellWxSum,
+		ROUND(SUM(zfSum),2) sellZfSum,
+		ROUND(SUM(yeSum),2) sellYESum,
+		ROUND(SUM(mfSum),2)  sellMfSum,
+		ROUND(IFNULL(SUM(wxSum), 0.00) + IFNULL(SUM(zfSum), 0.00) +  IFNULL(SUM(yeSum), 0.00),2)  allSell,
+		VEQ_MACHINE_NO vciId
+		FROM (
+		SELECT SUBSTR(PIF_SUCCTIME, 1, 8) AS succTime,VEQ_MACHINE_NO,
+		COUNT(1) allCount,
+		SUM(VOI_ORDER_AMT) wxSum,
+		'0' zfSum,
+		'0' yeSum,
+		'0' mfSum
+		FROM vm_payment_inf, vm_order_inf,vm_equipment_inf
+		WHERE PIF_STATUS = '1'
+		AND VOI_ID = PIF_TRANFLOWNO
+		AND VOI_EQUIPMENT_ID = VEQ_ID
+		AND PIF_PAYTYPE IN ('91')
+		AND VOI_ORDER_AMT != '0.00'
+		<if test="branchId != null and branchId != ''">
+			AND	VEQ_BRANCHID  = #{branchId,jdbcType=VARCHAR}
+		</if>
+		GROUP BY SUBSTR(PIF_SUCCTIME, 1, 8), VEQ_MACHINE_NO
+		UNION ALL
+		SELECT SUBSTR(PIF_SUCCTIME, 1, 8) AS succTime,VEQ_MACHINE_NO,
+		COUNT(1) allCount,
+		'0' wxSum,
+		SUM(VOI_ORDER_AMT) zfSum,
+		'0' yeSum,
+		'0' mfSum
+		FROM vm_payment_inf, vm_order_inf,vm_equipment_inf
+		WHERE PIF_STATUS = '1'
+		AND VOI_ID = PIF_TRANFLOWNO
+		AND VOI_EQUIPMENT_ID = VEQ_ID
+		AND PIF_PAYTYPE IN ('92')
+		AND VOI_ORDER_AMT != '0.00'
+		<if test="branchId != null and branchId != ''">
+			AND	VEQ_BRANCHID  = #{branchId,jdbcType=VARCHAR}
+		</if>
+		GROUP BY SUBSTR(PIF_SUCCTIME, 1, 8), VEQ_MACHINE_NO
+		UNION ALL
+
+		SELECT SUBSTR(PIF_SUCCTIME, 1, 8) AS succTime,VEQ_MACHINE_NO,
+		COUNT(1) allCount,
+		'0' wxSum,
+		'0' zfSum,
+		SUM(VOI_ORDER_AMT) yeSum,
+		'0' mfSum
+		FROM vm_payment_inf, vm_order_inf,vm_equipment_inf
+		WHERE PIF_STATUS = '1'
+		AND VOI_ID = PIF_TRANFLOWNO
+		AND VOI_EQUIPMENT_ID = VEQ_ID
+		AND PIF_PAYTYPE IN ('93')
+		<if test="branchId != null and branchId != ''">
+			AND	VEQ_BRANCHID  = #{branchId,jdbcType=VARCHAR}
+		</if>
+		AND VOI_ORDER_AMT != '0.00'
+		GROUP BY SUBSTR(PIF_SUCCTIME, 1, 8), VEQ_MACHINE_NO
+
+		UNION ALL
+		SELECT SUBSTR(PIF_SUCCTIME, 1, 8) AS succTime,VEQ_MACHINE_NO,
+		COUNT(1) allCount,
+		'0' wxSum,
+		'0' zfSum,
+		'0' yeSum,
+		SUM(PIF_ORDERAMOUT) mfSum
+		FROM vm_payment_inf, vm_order_inf,vm_equipment_inf
+		WHERE PIF_STATUS = '1'
+		AND VOI_ID = PIF_TRANFLOWNO
+		AND VOI_EQUIPMENT_ID = VEQ_ID
+		AND PIF_PAYTYPE IN ('91', '92','93')
+		AND VOI_ORDER_AMT = '0.00'
+		<if test="branchId != null and branchId != ''">
+			AND	VEQ_BRANCHID  = #{branchId,jdbcType=VARCHAR}
+		</if>
+		GROUP BY SUBSTR(PIF_SUCCTIME, 1, 8), VEQ_MACHINE_NO
+		) b
+		where 1=1
+		<if test="equNum != null and equNum != ''">
+			AND	VEQ_MACHINE_NO  = #{equNum,jdbcType=VARCHAR}
+		</if>
+		<if test="datesTime != null and datesTime != ''">
+			and succTime between substr((#{datesTime, jdbcType=VARCHAR}),1,8)
+			and substr((#{datesTime, jdbcType=VARCHAR}),12,19)
+		</if>
+		<if test="(datesTime == null or datesTime == '') and (equNum == null or equNum == '')">
+			and succTime  = #{nowDate,jdbcType=VARCHAR}
+		</if>
+		GROUP BY succTime, vciId
+		ORDER BY succTime DESC, vciId DESC
+	</select>
+	<!--	总订单数-->
+	<select id="selectCountOrderNum" resultType="java.lang.String" parameterType="java.util.Map">
+		SELECT COUNT(1)
+		FROM vm_order_inf
+		WHERE VOI_STATE = '00'
+	</select>
+	<!--	累计收入-->
+	<select id="selectCountIncome" resultType="java.lang.String" parameterType="java.util.Map">
+		select IFNULL(CAST(SUM(PIF_ORDERAMOUT) AS DECIMAL(15,2)), 0.00)
+		from vm_payment_inf
+		where PIF_STATUS = '1'
+		<if test="nowDate != null and nowDate != ''">
+			and substr(PIF_SUCCTIME,1,8) = #{nowDate,jdbcType=VARCHAR}
+		</if>
+		<if test="yesDate != null and yesDate != ''">
+			and substr(PIF_SUCCTIME,1,8) = #{yesDate,jdbcType=VARCHAR}
+		</if>
+		<if test="weekDate != null and weekDate != ''">
+			and substr(PIF_SUCCTIME,1,8) >= #{weekDate,jdbcType=VARCHAR}
+		</if>
+		<if test="branchId != null and branchId != ''">
+			AND	PIF_RCVCSTNO  = #{branchId,jdbcType=VARCHAR}
+		</if>
+	</select>
+	<!--	预估利润-->
+	<select id="selectPredictIncome" resultType="java.lang.String" parameterType="java.util.Map">
+		SELECT IFNULL(CAST(SUM(VCI_COST_PRICE) AS DECIMAL(15,2)), 0.00)
+		FROM vm_order_details a left join  vm_payment_inf b  on PIF_TRANFLOWNO = VOD_ORDER_ID
+		left join vm_pro_equ_rel c on c.VCI_ID = a.VOD_PRO_EQU_REL_ID
+		WHERE VOD_IS_WINNING in ('01','02')
+		AND PIF_STATUS = '1'
+		<if test="nowDate != null and nowDate != ''">
+			and substr(PIF_SUCCTIME,1,8) = #{nowDate,jdbcType=VARCHAR}
+		</if>
+		<if test="yesDate != null and yesDate != ''">
+			and substr(PIF_SUCCTIME,1,8) = #{yesDate,jdbcType=VARCHAR}
+		</if>
+		<if test="weekDate != null and weekDate != ''">
+			and substr(PIF_SUCCTIME,1,8) >= #{weekDate,jdbcType=VARCHAR}
+		</if>
+		<if test="branchId != null and branchId != ''">
+			AND	b.PIF_RCVCSTNO  = #{branchId,jdbcType=VARCHAR}
+		</if>
+	</select>
+	<!--	总机台数-->
+	<select id="selectCountDevice" resultType="java.lang.String" parameterType="java.util.Map">
+		SELECT IFNULL(COUNT(VEQ_ID), 0.00)
+		FROM vm_equipment_inf
+		WHERE VEQ_STATE = '00'
+	</select>
+	<!--	销售统计-->
+	<select id="selectProductInfo" resultType="hashmap" parameterType="java.util.Map">
+		SELECT aa.PRT_FMPIC 	mainUrl,
+		aa.PRT_NAME 				proName,
+		cc.VCI_NAME 				vciName,
+		COUNT(bb.VOD_DETAILS_ID) 	countNo,
+		SUM(bb.VOD_AMOUNT) 			amount,
+		SUM(bb.VOD_PRO_NUMS) 		proNums,
+		aa.PRT_PRO_COST 			proCost
+		FROM vm_product_inf aa, vm_category_inf cc, vm_order_details bb, vm_order_inf dd
+		WHERE aa.PRT_CATEGORY_ID = cc.VCI_ID
+		AND aa.PRT_ID = bb.VOD_PRODUCT_ID
+		AND bb.VOD_ORDER_ID = dd.VOI_ID
+		AND dd.VOI_STATE IN ('80', '00')
+		<if test="proName != null and proName != ''">
+			AND	aa.PRT_NAME  like  concat('%' , #{proName,jdbcType=VARCHAR},'%')
+		</if>
+		<if test="branchId != null and branchId != ''">
+			AND	dd.VOI_BRANCHID  = #{branchId,jdbcType=VARCHAR}
+		</if>
+		GROUP BY aa.PRT_ID
+		ORDER BY aa.PRT_MODIFY_TIME DESC
+	</select>
+	<!--	总实际金额-->
+	<select id="selectAllSale" resultType="java.lang.String" parameterType="java.util.Map">
+		SELECT IFNULL(SUM(VOI_ORDER_AMT), 0.00)
+		FROM vm_order_inf
+		WHERE VOI_PRO_TYPE = '00'
+		AND VOI_STATE IN ('80', '00')
+	</select>
+	<!--	总商品成本-->
+	<select id="selectAllCost" resultType="java.lang.String" parameterType="java.util.Map">
+		SELECT IFNULL(SUM(proSum), 0.00) FROM (
+			SELECT aa.PRT_PRO_COST * SUM(bb.VOD_PRO_NUMS) AS proSum
+			FROM vm_product_inf aa, vm_order_details bb
+			WHERE aa.PRT_ID = bb.VOD_PRODUCT_ID
+			AND VOD_IS_WINNING = '01'
+			GROUP BY aa.PRT_ID
+		) cc
+	</select>
+	<select id="selectCountIncomeb" resultType="hashmap" parameterType="java.util.Map">
+		select PIF_TRANSTYPE transType, IFNULL(CAST(SUM(PIF_ORDERAMOUT) AS DECIMAL(15,2)), 0.00) amout
+		from vm_payment_inf
+		where PIF_STATUS = '1' and PIF_PAYTYPE in ('91','92') and PIF_TRANSTYPE in ('00','10')
+		<if test="nowDate != null and nowDate != ''">
+			and substr(PIF_SUCCTIME,1,8) = #{nowDate,jdbcType=VARCHAR}
+		</if>
+		<if test="yesDate != null and yesDate != ''">
+			and substr(PIF_SUCCTIME,1,8) = #{yesDate,jdbcType=VARCHAR}
+		</if>
+		<if test="weekDate != null and weekDate != ''">
+			and substr(PIF_SUCCTIME,1,8) >= #{weekDate,jdbcType=VARCHAR}
+		</if>
+		<if test="branchId != null and branchId != ''">
+			AND	PIF_RCVCSTNO  = #{branchId,jdbcType=VARCHAR}
+		</if>
+
+		group  by PIF_TRANSTYPE
+	</select>
+
+	<!--	查询订单统计-->
+	<select id="selectOrderNumber" resultType="hashmap" parameterType="java.util.Map">
+		SELECT
+			COUNT(1)  number,
+			IFNULL(ROUND(SUM(d.VOD_AMOUNT),2) , 0) sumAmt
+			FROM vm_order_details d  LEFT JOIN   vm_order_inf a  ON d.VOD_ORDER_ID = a.VOI_ID
+		WHERE 1=1
+		AND a.VOI_STATE = 00
+		<if test="nowDate != null and nowDate != ''">
+			and substr(VOD_CREATE_TIME,1,8) = #{nowDate,jdbcType=VARCHAR}
+		</if>
+		<if test="yesDate != null and yesDate != ''">
+			and substr(VOD_CREATE_TIME,1,8) = #{yesDate,jdbcType=VARCHAR}
+		</if>
+		<if test="weekDate != null and weekDate != ''">
+			and substr(VOD_CREATE_TIME,1,8) >= #{weekDate,jdbcType=VARCHAR}
+		</if>
+		<if test="branchId != null and branchId != ''">
+		AND	a.VOI_BRANCHID  = #{branchId,jdbcType=VARCHAR}
+		</if>
+	</select>
+</mapper>