diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/HandoverRecordMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/HandoverRecordMapper.java index a0620f4d9..0f2ed3bc0 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/HandoverRecordMapper.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/HandoverRecordMapper.java @@ -6,6 +6,7 @@ import com.fuint.business.order.entity.HandoverRecord; import org.apache.ibatis.annotations.Param; import org.springframework.data.domain.Pageable; import java.util.List; +import java.util.Map; /** * 交班记录表(HandoverRecord)表数据库访问层 @@ -30,7 +31,7 @@ public interface HandoverRecordMapper { * @param page 分页对象 * @return 对象列表 */ - IPage queryAllByLimit(@Param("page") Page page, HandoverRecord handoverRecord); + IPage queryAllByLimit(@Param("page") Page page, @Param("handoverRecord") HandoverRecord handoverRecord); HandoverRecord selectByTime(HandoverRecord handoverRecord); @@ -83,5 +84,16 @@ public interface HandoverRecordMapper { */ int deleteById(Integer id); +// 油品交易信息 + Map oilOrderStatistics(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("storeId") Integer storeId); +// 会员储值交易信息 + Map cardOrderStatistics(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("storeId") Integer storeId); +// 油卡交易信息 + Map fuelOrderStatistics(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("storeId") Integer storeId); +// 普通交易 + Map goodsOrderStatistics(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("storeId") Integer storeId); + + List> paymentAggregation(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("storeId") Integer storeId); + } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/HandoverRecordMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/HandoverRecordMapper.xml index 7ea961cc5..91fadc198 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/HandoverRecordMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/HandoverRecordMapper.xml @@ -13,53 +13,29 @@ + + + + - insert into handover_record(staff_id, record_data, start_time, end_time, store_id, create_time, update_time, create_by, update_by) - values (#{staffId}, #{recordData}, #{startTime}, #{endTime}, #{storeId}, #{createTime}, #{updateTime}, #{createBy}, #{updateBy}) + insert into handover_record(staff_id, record_data, start_time, end_time, store_id, create_time, update_time, create_by, update_by,status,type) + values (#{staffId}, #{recordData}, #{startTime}, #{createTime}, #{storeId}, #{createTime}, #{createTime}, #{createBy}, #{updateBy},#{status},{type}) @@ -211,5 +188,93 @@ limit 1 delete from handover_record where id = #{id} + + + + + + + + + + + + + + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/HandoverRecordService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/HandoverRecordService.java index 871812b6f..973fad66f 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/HandoverRecordService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/HandoverRecordService.java @@ -31,7 +31,7 @@ public interface HandoverRecordService { * @param page 分页对象 * @return 查询结果 */ - IPage queryByPage(@Param("page") Page page, HandoverRecord handoverRecord); + IPage queryByPage(@Param("page") Page page, @Param("handoverRecord") HandoverRecord handoverRecord); HandoverRecord selectByTime(); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/HandoverRecordServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/HandoverRecordServiceImpl.java index 0c1a9e35e..7067d1104 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/HandoverRecordServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/HandoverRecordServiceImpl.java @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.fuint.business.order.entity.HandoverRecord; import com.fuint.business.order.mapper.HandoverRecordMapper; +import com.fuint.business.order.mapper.OilOrderMapper; import com.fuint.business.order.service.HandoverRecordService; import com.fuint.business.store.entity.MtStore; import com.fuint.business.store.mapper.MtStoreMapper; @@ -17,10 +18,13 @@ import com.fuint.common.dto.AccountInfo; import javax.annotation.Resource; import javax.xml.crypto.Data; +import java.math.BigDecimal; +import java.text.SimpleDateFormat; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.HashMap; +import java.util.List; import java.util.Map; /** @@ -35,6 +39,8 @@ public class HandoverRecordServiceImpl implements HandoverRecordService { private HandoverRecordMapper handoverRecordMapper; @Resource private MtStoreMapper mtStoreMapper; + @Resource + private OilOrderMapper oilOrderMapper; /** * 通过ID查询单条数据 @@ -55,7 +61,7 @@ public class HandoverRecordServiceImpl implements HandoverRecordService { * @return 查询结果 */ @Override - public IPage queryByPage(@Param("page") Page page, HandoverRecord handoverRecord) { + public IPage queryByPage(@Param("page") Page page,@Param("handoverRecord") HandoverRecord handoverRecord) { AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); handoverRecord.setStoreId(nowAccountInfo.getStoreId()); return this.handoverRecordMapper.queryAllByLimit(page, handoverRecord); @@ -79,6 +85,8 @@ public class HandoverRecordServiceImpl implements HandoverRecordService { public HandoverRecord insert(HandoverRecord handoverRecord) { AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); handoverRecord.setStoreId(nowAccountInfo.getStoreId()); + handoverRecord.setStaffId(nowAccountInfo.getStaffId()); + this.handoverRecordMapper.insert(handoverRecord); return handoverRecord; } @@ -109,7 +117,7 @@ public class HandoverRecordServiceImpl implements HandoverRecordService { @Override public Map> handover() { AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); - MtStore mtStore = mtStoreMapper.queryStoreById(nowAccountInfo.getStoreId()); +// MtStore mtStore = mtStoreMapper.queryStoreById(nowAccountInfo.getStoreId()); // 获取当前日期 LocalDate today = LocalDate.now(); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); @@ -121,16 +129,17 @@ public class HandoverRecordServiceImpl implements HandoverRecordService { Map> handoverMap = new HashMap<>(); - String startTime = midnight.format(formatter); + String startTime = "2023-01-01 12:12:12"; HandoverRecord handoverRecord = selectByTime(); if (!ObjectUtil.isEmpty(handoverRecord) && !ObjectUtil.isEmpty(handoverRecord.getEndTime())) { - startTime = handoverRecord.getEndTime().toString(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + startTime = sdf.format(handoverRecord.getEndTime()); } // 填充 baseInfo Map baseInfo = new HashMap<>(); - baseInfo.put("storeName", mtStore.getName()); +// baseInfo.put("storeName", mtStore.getName()); baseInfo.put("realName", nowAccountInfo.getRealName()); baseInfo.put("handoverType", "门店统一交班"); baseInfo.put("startTime", startTime); @@ -138,6 +147,11 @@ public class HandoverRecordServiceImpl implements HandoverRecordService { handoverMap.put("baseInfo",baseInfo); // 获取订单汇总 Map orderSummaryMap = orderSummary(startTime, formattedEndTime); + handoverMap.put("orderSummary",orderSummaryMap); + // 支付方式汇总 + Map paymentAggregationMap = paymentAggregation(startTime, formattedEndTime); + handoverMap.put("paymentAggregation",paymentAggregationMap); + // 退款汇总 // 实收汇总 // 油品订单 @@ -152,23 +166,68 @@ public class HandoverRecordServiceImpl implements HandoverRecordService { return handoverMap; } public Map orderSummary(String startTime, String endTime) { + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + // 油品订单(订单) 油品订单(退款) 油品订单(实收) 油品优惠(实收) 油品交易(实收) + Map oilOrderStatistics = handoverRecordMapper.oilOrderStatistics(startTime, endTime, nowAccountInfo.getStoreId()); + // 会员储值(订单) 会员储值(退款) 会员储值(实收) 储值赠送(订单) 储值赠送(退款) 储值赠送(实际) + Map cardOrderStatistics = handoverRecordMapper.cardOrderStatistics(startTime, endTime, nowAccountInfo.getStoreId()); + Map fuelOrderStatistics = handoverRecordMapper.fuelOrderStatistics(startTime, endTime, nowAccountInfo.getStoreId()); + // 普通收款(订单) 普通收款(退款) 普通收款(实收) + Map goodsOrderStatistics = handoverRecordMapper.goodsOrderStatistics(startTime, endTime, nowAccountInfo.getStoreId()); - // 油品订单(订单) - // 油品订单(退款) - // 油品订单(实收) - // 油品优惠(实收) - // 油品交易(实收) + if(!ObjectUtil.isEmpty(cardOrderStatistics)) { + oilOrderStatistics.putAll(cardOrderStatistics); + } + if(!ObjectUtil.isEmpty(fuelOrderStatistics)) { + oilOrderStatistics.putAll(fuelOrderStatistics); + } + if(!ObjectUtil.isEmpty(goodsOrderStatistics)) { + oilOrderStatistics.putAll(goodsOrderStatistics); + } + return oilOrderStatistics; + } + + public Map paymentAggregation(String startTime, String endTime) { + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + List> paymentAggregation = handoverRecordMapper.paymentAggregation(startTime, endTime, nowAccountInfo.getStoreId()); + // 共有四个 转为普通map + Map allAggreMap = new HashMap<>(); + Map allRefundMap = new HashMap<>(); + Map oilMap = new HashMap<>(); + Map goodsMap = new HashMap<>(); + Map cardMap = new HashMap<>(); + if (!ObjectUtil.isEmpty(paymentAggregation)) { + for (Map stringStringMap : paymentAggregation) { + + // 计算退款汇总 +// if ( allRefundMap.containsKey("refALl"+stringStringMap.get("payType"))) { +// allRefundMap.put("refALl"+stringStringMap.get("payType"), +// (new BigDecimal( stringStringMap.get("refundAmount")).add(new BigDecimal(stringStringMap.get("refundAmount")))).toString()); +// }else { +// allAggreMap.put("refALl"+stringStringMap.get("payType"), allRefundMap.get(stringStringMap.get("refundAmount"))); +// } + + // 总汇总 +// if ( allAggreMap.containsKey("agreALL"+stringStringMap.get("payType"))) { +// allAggreMap.put("agreALL"+stringStringMap.get("payType"), +// (new BigDecimal( stringStringMap.get("paidAmount")).add(new BigDecimal(stringStringMap.get("paidAmount")))).toString()); +// }else { +// allAggreMap.put("agreALL"+stringStringMap.get("payType"), allAggreMap.get(stringStringMap.get("paidAmount"))); +// } - // 会员储值(订单) - // 会员储值(退款) - // 会员储值(实收) - // 储值赠送(订单) - // 储值赠送(退款) - // 储值赠送(实际) - // 普通收款(订单) - // 普通收款(退款) - // 普通收款(实收) + if ("oil".equals(stringStringMap.get("flag"))){ + // 油品订单汇总 + + + }else if ("card".equals(stringStringMap.get("flag"))) { + // 商品订单汇总 + }else if ("fuel".equals(stringStringMap.get("flag")) || "goods".equals(stringStringMap.get("flag")) ) { + // 会员储值汇总 + } + } + } return null; + } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/mapper/MtStoreMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/mapper/MtStoreMapper.java index cfb92383c..3e41a384e 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/mapper/MtStoreMapper.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/mapper/MtStoreMapper.java @@ -17,8 +17,7 @@ public interface MtStoreMapper extends BaseMapper { MtStore queryStoreByName(@Param("name") String name); - MtStore queryStoreById(@Param("id") Integer id); - + public MtStore queryStoreById(@Param("id") Integer id); List findStoresByIds(@Param("ids") List ids); diff --git a/fuintCashierWeb/src/api/cashier/handover.js b/fuintCashierWeb/src/api/cashier/handover.js index c4c9cc984..0528f9339 100644 --- a/fuintCashierWeb/src/api/cashier/handover.js +++ b/fuintCashierWeb/src/api/cashier/handover.js @@ -7,3 +7,19 @@ export function getHandoverApi() { // params: query }) } + +export function getHandoverListApi(query) { + return request({ + url: '/business/handoverRecord/queryByPage', + method: 'get', + params: query + }) +} + +export function addHandoverApi(data) { + return request({ + url: '/business/handoverRecord', + method: 'post', + data: data + }) +} diff --git a/fuintCashierWeb/src/router/index.js b/fuintCashierWeb/src/router/index.js index cea25d5ba..baff181f9 100644 --- a/fuintCashierWeb/src/router/index.js +++ b/fuintCashierWeb/src/router/index.js @@ -56,6 +56,12 @@ export const constantRoutes = [ name: 'Index', meta: { title: '系统首页', icon: 'dashboard', affix: true } }, + // { + // path: 'HandoverDetails', + // component: () => import('@/views/cashier/NewComponents/HandoverDetails'), + // name: 'HandoverDetails', + // meta: { title: '交班明细', icon: 'dashboard', affix: true } + // }, { path: 'cashier', component: () => import('@/views/cashier/index'), @@ -107,6 +113,11 @@ export const constantRoutes = [ name: 'details', component: () => import('@/views/details/index'), }, + { + path: '/HandoverDetails', + name: 'HandoverDetails', + component: () => import('@/views/cashier/NewComponents/HandoverDetails?id=8'), + }, ] } ] diff --git a/fuintCashierWeb/src/views/cashier/NewComponents/Handover.vue b/fuintCashierWeb/src/views/cashier/NewComponents/Handover.vue index cfa4fa48f..6bdfc6ad0 100644 --- a/fuintCashierWeb/src/views/cashier/NewComponents/Handover.vue +++ b/fuintCashierWeb/src/views/cashier/NewComponents/Handover.vue @@ -6,11 +6,12 @@
油站名称:
-
{{ handoverList.baseInfo.storeName }}
+
{{ handoverList && handoverList.baseInfo ? handoverList.baseInfo.storeName : '未知油站' }}
收银员:
-
{{ handoverList.baseInfo.realName }}
+ +
{{ handoverList && handoverList.baseInfo ? handoverList.baseInfo.realName : '未知姓名' }}
交班方式:
@@ -18,11 +19,15 @@
开始时间:
-
{{ handoverList.baseInfo.startTime }}
+ +
{{ handoverList && handoverList.baseInfo ? handoverList.baseInfo.startTime : '/--/' }}
+
结束时间:
-
{{ handoverList.baseInfo.endTime }}
+ +
{{ handoverList && handoverList.baseInfo ? handoverList.baseInfo.endTime : '/--/' }}
+
@@ -39,66 +44,93 @@
油品订单(订单)
-
¥2164.55
+
¥{{ handoverList && handoverList.orderSummary ? handoverList.orderSummary.oilOrder : '0' }}
+
油品订单(退款)
-
¥2164.55
+
¥{{ handoverList && handoverList.orderSummary ? handoverList.orderSummary.oilRefund : '0' }}
+
油品订单(实收)
-
¥2164.55
+
¥{{ handoverList && handoverList.orderSummary ? handoverList.orderSummary.oilPaid : '0' }}
+
油品优惠(实收)
-
¥2164.55
+
¥{{ handoverList && handoverList.orderSummary ? handoverList.orderSummary.oilDiacount : '0' }}
+
-
-
油品交易(实收)
-
¥2164.55
-
+
会员储值(订单)
-
¥2164.55
+
¥{{ handoverList && handoverList.orderSummary ? handoverList.orderSummary.cardOrder : '0' }}
+
会员储值(退款)
-
¥2164.55
+
¥{{ handoverList && handoverList.orderSummary ? handoverList.orderSummary.cardRefund : '0' }}
+
会员储值(实收)
-
¥2164.55
+
¥{{ handoverList && handoverList.orderSummary ? handoverList.orderSummary.cardPaid : '0' }}
+
储值赠送(订单)
-
¥2164.55
+
¥{{ handoverList && handoverList.orderSummary ? handoverList.orderSummary.cardGiftOrder : '0' }}
+
储值赠送(退款)
-
¥2164.55
+
¥{{ handoverList && handoverList.orderSummary ? handoverList.orderSummary.cardGiftRefund : '0' }}
+
储值赠送(实际)
-
¥2164.55
+
¥{{ handoverList && handoverList.orderSummary ? handoverList.orderSummary.cardGiftPaid : '0' }}
+
+ + +
+
存油储值(订单)
+
¥{{ handoverList && handoverList.orderSummary ? handoverList.orderSummary.fuelOrder : '0' }}
+ +
+
+
存油储值(退款)
+
¥{{ handoverList && handoverList.orderSummary ? handoverList.orderSummary.fuelRefund : '0' }}
+ +
+
+
存油储值(实收)
+
¥{{ handoverList && handoverList.orderSummary ? handoverList.orderSummary.fuelPaid : '0' }}
+ +
+
普通收款(订单)
-
¥2164.55
+
¥{{ handoverList && handoverList.orderSummary ? handoverList.orderSummary.goodsOrder : '0' }}
+
普通收款(退款)
-
¥2164.55
+
¥{{ handoverList && handoverList.orderSummary ? handoverList.orderSummary.goodsRefund : '0' }}
+
普通收款(实收)
-
¥2164.55
+
¥{{ handoverList && handoverList.orderSummary ? handoverList.orderSummary.goodsPaid : '0' }}
@@ -315,10 +347,10 @@
-
交班
+
交班
云打印
本地打印
-
交班记录
+
交班记录
@@ -327,13 +359,13 @@ - diff --git a/fuintCashierWeb/src/views/cashier/NewComponents/HandoverOnly.vue b/fuintCashierWeb/src/views/cashier/NewComponents/HandoverOnly.vue index 8877cf01a..e36c78ddf 100644 --- a/fuintCashierWeb/src/views/cashier/NewComponents/HandoverOnly.vue +++ b/fuintCashierWeb/src/views/cashier/NewComponents/HandoverOnly.vue @@ -2,120 +2,124 @@ @@ -345,22 +349,27 @@ import {addHandoverApi, getHandoverApi} from "@/api/cashier/handover"; export default { - name: "Handover", - data() { - return { - handoverList : '', - } - }, + name: "HandoverOnly", + props: { + recordData:'' + }, + data() { + return { + handoverList : {}, + } + }, created() { - this.getHandover(); + console.log("12312231",this.recordData) + this.handoverList = this.recordData + // this.getHandover(); }, methods: { - getHandover() { - getHandoverApi().then(res=>{ - this.handoverList = res.data; - console.log("this.handoverList",this.handoverList) - }) - }, + // getHandover() { + // getHandoverApi().then(res=>{ + // this.handoverList = res.data; + // console.log("this.handoverList",this.handoverList) + // }) + // }, // 交班记录 recording() { diff --git a/fuintCashierWeb/src/views/cashier/index.vue b/fuintCashierWeb/src/views/cashier/index.vue index 222eccab5..246904e5a 100644 --- a/fuintCashierWeb/src/views/cashier/index.vue +++ b/fuintCashierWeb/src/views/cashier/index.vue @@ -203,7 +203,7 @@ -
+