导出
This commit is contained in:
@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
|
|||||||
import cn.iocoder.yudao.framework.excel.core.handler.SelectSheetWriteHandler;
|
import cn.iocoder.yudao.framework.excel.core.handler.SelectSheetWriteHandler;
|
||||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.admin.customizeExcel.vo.GroupOrderVO;
|
||||||
import cn.iocoder.yudao.module.member.controller.admin.customizeExcel.vo.OrderExcelVO;
|
import cn.iocoder.yudao.module.member.controller.admin.customizeExcel.vo.OrderExcelVO;
|
||||||
import cn.iocoder.yudao.module.member.controller.admin.customizeExcel.vo.StoreOrderExcelVO;
|
import cn.iocoder.yudao.module.member.controller.admin.customizeExcel.vo.StoreOrderExcelVO;
|
||||||
import cn.iocoder.yudao.module.member.controller.admin.customizeExcel.vo.StoreSaleGoodsVO;
|
import cn.iocoder.yudao.module.member.controller.admin.customizeExcel.vo.StoreSaleGoodsVO;
|
||||||
@ -171,4 +172,16 @@ public class CustomizeExcelController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/groupOrderExcel")
|
||||||
|
@Operation(summary = "导出部门订单详情")
|
||||||
|
@OperateLog(type = EXPORT)
|
||||||
|
public void exportGroupOrderExcel(String startTime,String endTime,Long carteenId,Long groupId,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
|
||||||
|
List<GroupOrderVO> orderExcelVOS = excelService.exportGroupOrderExcel(startTime, endTime,carteenId,groupId);
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "部门订单详情统计.xlsx", "数据", GroupOrderVO.class,
|
||||||
|
orderExcelVOS);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -0,0 +1,42 @@
|
|||||||
|
package cn.iocoder.yudao.module.member.controller.admin.customizeExcel.vo;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import com.alibaba.excel.annotation.format.NumberFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class GroupOrderVO {
|
||||||
|
|
||||||
|
|
||||||
|
@ExcelProperty("昵称")
|
||||||
|
private String nickName;
|
||||||
|
|
||||||
|
@ExcelProperty("手机")
|
||||||
|
private String mobile;
|
||||||
|
|
||||||
|
@ExcelProperty("门店")
|
||||||
|
private String storeName;
|
||||||
|
|
||||||
|
@ExcelProperty("总金额(元)")
|
||||||
|
@NumberFormat("#0.00")
|
||||||
|
private BigDecimal totalMoney;
|
||||||
|
|
||||||
|
@ExcelProperty("现金(元)")
|
||||||
|
@NumberFormat("#0.00")
|
||||||
|
private BigDecimal cashAmount;
|
||||||
|
|
||||||
|
@ExcelProperty("微信(元)")
|
||||||
|
@NumberFormat("#0.00")
|
||||||
|
private BigDecimal wxAmount;
|
||||||
|
|
||||||
|
@ExcelProperty("时间")
|
||||||
|
private String createTime;
|
||||||
|
|
||||||
|
@ExcelProperty("就餐餐别")
|
||||||
|
private String timeSlot;
|
||||||
|
|
||||||
|
@ExcelProperty("状态")
|
||||||
|
private String orderStatus;
|
||||||
|
}
|
@ -1,6 +1,7 @@
|
|||||||
package cn.iocoder.yudao.module.member.dal.mysql.customizeExcel;
|
package cn.iocoder.yudao.module.member.dal.mysql.customizeExcel;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.member.controller.admin.customizeExcel.vo.GroupOrderVO;
|
||||||
import cn.iocoder.yudao.module.member.controller.admin.customizeExcel.vo.OrderExcelVO;
|
import cn.iocoder.yudao.module.member.controller.admin.customizeExcel.vo.OrderExcelVO;
|
||||||
import cn.iocoder.yudao.module.member.controller.admin.customizeExcel.vo.StoreOrderExcelVO;
|
import cn.iocoder.yudao.module.member.controller.admin.customizeExcel.vo.StoreOrderExcelVO;
|
||||||
import cn.iocoder.yudao.module.member.controller.admin.customizeExcel.vo.StoreSaleGoodsVO;
|
import cn.iocoder.yudao.module.member.controller.admin.customizeExcel.vo.StoreSaleGoodsVO;
|
||||||
@ -18,4 +19,7 @@ public interface CustomizeExcelMapper {
|
|||||||
List<StoreOrderExcelVO> selectStoreOrder(@Param("startTime")String startTime, @Param("endTime")String endTime, @Param("carteenId")Long carteenId);
|
List<StoreOrderExcelVO> selectStoreOrder(@Param("startTime")String startTime, @Param("endTime")String endTime, @Param("carteenId")Long carteenId);
|
||||||
|
|
||||||
List<StoreSaleGoodsVO> selectStoreSaleGoods(@Param("startTime")String startTime, @Param("endTime")String endTime, @Param("carteenId")Long carteenId);
|
List<StoreSaleGoodsVO> selectStoreSaleGoods(@Param("startTime")String startTime, @Param("endTime")String endTime, @Param("carteenId")Long carteenId);
|
||||||
|
|
||||||
|
List<GroupOrderVO> exportGroupOrderExcel(@Param("startTime")String startTime, @Param("endTime")String endTime, @Param("carteenId")Long carteenId, @Param("groupId")Long groupId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.member.service.customizeExcel;
|
package cn.iocoder.yudao.module.member.service.customizeExcel;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.member.controller.admin.customizeExcel.vo.GroupOrderVO;
|
||||||
import cn.iocoder.yudao.module.member.controller.admin.customizeExcel.vo.OrderExcelVO;
|
import cn.iocoder.yudao.module.member.controller.admin.customizeExcel.vo.OrderExcelVO;
|
||||||
import cn.iocoder.yudao.module.member.controller.admin.customizeExcel.vo.StoreOrderExcelVO;
|
import cn.iocoder.yudao.module.member.controller.admin.customizeExcel.vo.StoreOrderExcelVO;
|
||||||
import cn.iocoder.yudao.module.member.controller.admin.customizeExcel.vo.StoreSaleGoodsVO;
|
import cn.iocoder.yudao.module.member.controller.admin.customizeExcel.vo.StoreSaleGoodsVO;
|
||||||
@ -17,4 +18,6 @@ public interface CustomizeExcelService {
|
|||||||
List<StoreOrderExcelVO> exportStoreOrderExcel(String startTime, String endTime, Long carteenId);
|
List<StoreOrderExcelVO> exportStoreOrderExcel(String startTime, String endTime, Long carteenId);
|
||||||
|
|
||||||
List<StoreSaleGoodsVO> exportStoreSaleGoodsExcel(String startTime, String endTime, Long carteenId);
|
List<StoreSaleGoodsVO> exportStoreSaleGoodsExcel(String startTime, String endTime, Long carteenId);
|
||||||
|
|
||||||
|
List<GroupOrderVO> exportGroupOrderExcel(String startTime, String endTime, Long carteenId, Long groupId);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.member.service.customizeExcel;
|
package cn.iocoder.yudao.module.member.service.customizeExcel;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.member.controller.admin.customizeExcel.vo.GroupOrderVO;
|
||||||
import cn.iocoder.yudao.module.member.controller.admin.customizeExcel.vo.OrderExcelVO;
|
import cn.iocoder.yudao.module.member.controller.admin.customizeExcel.vo.OrderExcelVO;
|
||||||
import cn.iocoder.yudao.module.member.controller.admin.customizeExcel.vo.StoreOrderExcelVO;
|
import cn.iocoder.yudao.module.member.controller.admin.customizeExcel.vo.StoreOrderExcelVO;
|
||||||
import cn.iocoder.yudao.module.member.controller.admin.customizeExcel.vo.StoreSaleGoodsVO;
|
import cn.iocoder.yudao.module.member.controller.admin.customizeExcel.vo.StoreSaleGoodsVO;
|
||||||
@ -32,4 +33,9 @@ public class CustomizeExcelServiceImpl implements CustomizeExcelService {
|
|||||||
public List<StoreSaleGoodsVO> exportStoreSaleGoodsExcel(String startTime, String endTime, Long carteenId) {
|
public List<StoreSaleGoodsVO> exportStoreSaleGoodsExcel(String startTime, String endTime, Long carteenId) {
|
||||||
return customizeExcelMapper.selectStoreSaleGoods(startTime,endTime,carteenId);
|
return customizeExcelMapper.selectStoreSaleGoods(startTime,endTime,carteenId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<GroupOrderVO> exportGroupOrderExcel(String startTime, String endTime, Long carteenId, Long groupId) {
|
||||||
|
return customizeExcelMapper.exportGroupOrderExcel(startTime,endTime,carteenId,groupId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,4 +70,31 @@
|
|||||||
group by md.goods_name, md.custom_price
|
group by md.goods_name, md.custom_price
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="exportGroupOrderExcel" resultType="cn.iocoder.yudao.module.member.controller.admin.customizeExcel.vo.GroupOrderVO">
|
||||||
|
select u.nickname,
|
||||||
|
u.mobile,
|
||||||
|
o.store_name,
|
||||||
|
o.total_money,
|
||||||
|
o.cash_amount,
|
||||||
|
o.wx_amount,
|
||||||
|
DATE_FORMAT(o.create_time, '%Y-%m-%d %H:%i:%s') as createTime,
|
||||||
|
CASE
|
||||||
|
WHEN HOUR(o.create_time) BETWEEN 0 AND 9 THEN '早上'
|
||||||
|
WHEN HOUR(o.create_time) BETWEEN 10 AND 15 THEN '中午'
|
||||||
|
WHEN HOUR(o.create_time) BETWEEN 16 AND 23 THEN '晚上'
|
||||||
|
ELSE '未知' END AS timeSlot,
|
||||||
|
CASE
|
||||||
|
WHEN o.order_status = 0 THEN '未完成'
|
||||||
|
WHEN o.order_status = 1 THEN '已完成'
|
||||||
|
WHEN o.order_status = 2 THEN '未完全支付'
|
||||||
|
ELSE '未知' END AS orderStatus
|
||||||
|
from member_dish_order o
|
||||||
|
left join member_user u on o.user_id = u.id
|
||||||
|
where o.store_id = #{carteenId}
|
||||||
|
and o.deleted = false
|
||||||
|
and o.user_id in (select member_id from member_group_member where group_id = #{groupId})
|
||||||
|
and DATE_FORMAT(o.create_time, '%Y-%m-%d') BETWEEN #{startTime} AND #{endTime}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
@ -70,7 +70,7 @@
|
|||||||
|
|
||||||
<select id="getGroupName" resultType="string">
|
<select id="getGroupName" resultType="string">
|
||||||
SELECT name FROM member_group WHERE
|
SELECT name FROM member_group WHERE
|
||||||
id = (select group_id from member_group_member where member_id = #{userId})
|
id = (select group_id from member_group_member where member_id = #{userId} limit 1 )
|
||||||
</select>
|
</select>
|
||||||
<select id="selectAllUserGroupName" resultType="java.util.Map">
|
<select id="selectAllUserGroupName" resultType="java.util.Map">
|
||||||
select member_id,name from member_group_member mm
|
select member_id,name from member_group_member mm
|
||||||
@ -83,7 +83,6 @@
|
|||||||
<foreach item="id" collection="list" open="(" separator="," close=")">
|
<foreach item="id" collection="list" open="(" separator="," close=")">
|
||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getCarteenId" resultType="long">
|
<select id="getCarteenId" resultType="long">
|
||||||
|
Reference in New Issue
Block a user