更新10.16
This commit is contained in:
parent
4bcc6fbe02
commit
cf5d8d46f7
@ -266,9 +266,9 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
amountList:[
|
||||
"今日" ,
|
||||
"昨日" ,
|
||||
"本周" ,
|
||||
// "今日" ,
|
||||
// "昨日" ,
|
||||
"近一周" ,
|
||||
"本月" ,
|
||||
"本季度" ,
|
||||
"本年"
|
||||
@ -348,7 +348,7 @@ export default {
|
||||
start.setMinutes(0)
|
||||
start.setSeconds(0)
|
||||
start.setMilliseconds(0)
|
||||
this.value2 = [start, new Date()];
|
||||
this.value2 = [parseTime(oneWeekAgo), parseTime(nowDate)]
|
||||
this.getStoreList()
|
||||
this.getHardwareList()
|
||||
this.getNoticeList()
|
||||
@ -379,25 +379,19 @@ export default {
|
||||
let nowDate = new Date();
|
||||
let oneWeekAgo = new Date(nowDate.getTime() - 1 * 24 * 60 * 60 * 1000)
|
||||
this.value1 = [parseTime(oneWeekAgo),parseTime(oneWeekAgo)]
|
||||
} else if (command=='本周'){
|
||||
} else if (command=='近一周'){
|
||||
let nowDate = new Date();
|
||||
let oneWeekAgo = new Date(nowDate.getTime() - 6 * 24 * 60 * 60 * 1000)
|
||||
this.value1 = [parseTime(oneWeekAgo),parseTime(nowDate)]
|
||||
} else if (command=='本月'){
|
||||
let nowDate = new Date();
|
||||
let oneWeekAgo = new Date(nowDate.getTime() - 30 * 24 * 60 * 60 * 1000)
|
||||
this.value1 = [parseTime(oneWeekAgo),parseTime(nowDate)]
|
||||
const [startTime, endTime] = this.getMonthStartAndToday();
|
||||
this.value1 = [parseTime(startTime),parseTime(endTime)]
|
||||
}else if (command=='本季度'){
|
||||
let nowDate = new Date();
|
||||
let quarterStartMonth = Math.floor((nowDate.getMonth() + 1) / 3) * 3 - 2;
|
||||
let quarterEndMonth = quarterStartMonth + 2;
|
||||
let startDate = new Date(nowDate.getFullYear(), quarterStartMonth, 1);
|
||||
let endDate = new Date(nowDate.getFullYear(), quarterEndMonth + 1, 0);
|
||||
this.value1 = [parseTime(startDate), parseTime(endDate)];
|
||||
const [startTime, endTime] = this.getQuarterStartAndEnd();
|
||||
this.value1 = [parseTime(startTime), parseTime(endTime)];
|
||||
} else if (command=='本年'){
|
||||
let nowDate = new Date();
|
||||
let oneWeekAgo = new Date(nowDate.getFullYear() - 1, nowDate.getMonth(), nowDate.getDate())
|
||||
this.value1 = [parseTime(oneWeekAgo),parseTime(nowDate)]
|
||||
const [startTime, endTime] = this.getYearStartAndEnd();
|
||||
this.value1 = [parseTime(startTime),parseTime(endTime)]
|
||||
}else if (command=='自定义'){
|
||||
this.disabled = false
|
||||
}
|
||||
@ -422,25 +416,21 @@ export default {
|
||||
let nowDate = new Date();
|
||||
let oneWeekAgo = new Date(nowDate.getTime() - 1 * 24 * 60 * 60 * 1000)
|
||||
this.showValue = [parseTime(oneWeekAgo),parseTime(oneWeekAgo)]
|
||||
} else if (command=='本周'){
|
||||
} else if (command=='近一周'){
|
||||
let nowDate = new Date();
|
||||
let oneWeekAgo = new Date(nowDate.getTime() - 6 * 24 * 60 * 60 * 1000)
|
||||
this.showValue = [parseTime(oneWeekAgo),parseTime(nowDate)]
|
||||
} else if (command=='本月'){
|
||||
let nowDate = new Date();
|
||||
let oneWeekAgo = new Date(nowDate.getTime() - 30 * 24 * 60 * 60 * 1000)
|
||||
this.showValue = [parseTime(oneWeekAgo),parseTime(nowDate)]
|
||||
const [startTime, endTime] = this.getMonthStartAndToday();
|
||||
this.showValue = [parseTime(startTime),parseTime(endTime)]
|
||||
}else if (command=='本季度'){
|
||||
let nowDate = new Date();
|
||||
let quarterStartMonth = Math.floor((nowDate.getMonth() + 1) / 3) * 3 - 2;
|
||||
let quarterEndMonth = quarterStartMonth + 2;
|
||||
let startDate = new Date(nowDate.getFullYear(), quarterStartMonth, 1);
|
||||
let endDate = new Date(nowDate.getFullYear(), quarterEndMonth + 1, 0);
|
||||
this.showValue = [parseTime(startDate), parseTime(endDate)];
|
||||
const [startTime, endTime] = this.getQuarterStartAndEnd();
|
||||
this.showValue = [parseTime(startTime), parseTime(endTime)];
|
||||
} else if (command=='本年'){
|
||||
let nowDate = new Date();
|
||||
let oneWeekAgo = new Date(nowDate.getFullYear() - 1, nowDate.getMonth(), nowDate.getDate())
|
||||
this.showValue = [parseTime(oneWeekAgo),parseTime(nowDate)]
|
||||
const [startTime, endTime] = this.getYearStartAndEnd();
|
||||
this.showValue = [parseTime(startTime),parseTime(endTime)]
|
||||
}else if (command=='自定义'){
|
||||
this.disabled = false
|
||||
}
|
||||
@ -463,25 +453,21 @@ export default {
|
||||
let nowDate = new Date();
|
||||
let oneWeekAgo = new Date(nowDate.getTime() - 1 * 24 * 60 * 60 * 1000)
|
||||
this.countValue = [parseTime(oneWeekAgo),parseTime(oneWeekAgo)]
|
||||
} else if (command=='本周'){
|
||||
} else if (command=='近一周'){
|
||||
let nowDate = new Date();
|
||||
let oneWeekAgo = new Date(nowDate.getTime() - 6 * 24 * 60 * 60 * 1000)
|
||||
this.countValue = [parseTime(oneWeekAgo),parseTime(nowDate)]
|
||||
} else if (command=='本月'){
|
||||
let nowDate = new Date();
|
||||
let oneWeekAgo = new Date(nowDate.getTime() - 30 * 24 * 60 * 60 * 1000)
|
||||
this.countValue = [parseTime(oneWeekAgo),parseTime(nowDate)]
|
||||
const [startTime, endTime] = this.getMonthStartAndToday();
|
||||
this.countValue = [parseTime(startTime),parseTime(endTime)]
|
||||
}else if (command=='本季度'){
|
||||
let nowDate = new Date();
|
||||
let quarterStartMonth = Math.floor((nowDate.getMonth() + 1) / 3) * 3 - 2;
|
||||
let quarterEndMonth = quarterStartMonth + 2;
|
||||
let startDate = new Date(nowDate.getFullYear(), quarterStartMonth, 1);
|
||||
let endDate = new Date(nowDate.getFullYear(), quarterEndMonth + 1, 0);
|
||||
this.countValue = [parseTime(startDate), parseTime(endDate)];
|
||||
const [startTime, endTime] = this.getQuarterStartAndEnd();
|
||||
this.countValue = [parseTime(startTime), parseTime(endTime)];
|
||||
} else if (command=='本年'){
|
||||
let nowDate = new Date();
|
||||
let oneWeekAgo = new Date(nowDate.getFullYear() - 1, nowDate.getMonth(), nowDate.getDate())
|
||||
this.countValue = [parseTime(oneWeekAgo),parseTime(nowDate)]
|
||||
const [startTime, endTime] = this.getYearStartAndEnd();
|
||||
this.countValue = [parseTime(startTime),parseTime(endTime)]
|
||||
}else if (command=='自定义'){
|
||||
this.disabled = false
|
||||
}
|
||||
@ -497,34 +483,108 @@ export default {
|
||||
start.setSeconds(0)
|
||||
start.setMilliseconds(0)
|
||||
this.value2 = [start,new Date()]
|
||||
} else if (command=='本周'){
|
||||
} else if (command=='近一周'){
|
||||
let nowDate = new Date();
|
||||
let oneWeekAgo = new Date(nowDate.getTime() - 6 * 24 * 60 * 60 * 1000)
|
||||
this.value2 = [parseTime(oneWeekAgo),parseTime(nowDate)]
|
||||
} else if (command=='本月'){
|
||||
let nowDate = new Date();
|
||||
let oneWeekAgo = new Date(nowDate.getTime() - 30 * 24 * 60 * 60 * 1000)
|
||||
this.value2 = [parseTime(oneWeekAgo),parseTime(nowDate)]
|
||||
const [startTime, endTime] = this.getMonthStartAndToday();
|
||||
this.value2 = [parseTime(startTime),parseTime(endTime)]
|
||||
}else if (command=='本季度'){
|
||||
let nowDate = new Date();
|
||||
let quarterStartMonth = Math.floor((nowDate.getMonth() + 1) / 3) * 3 - 2;
|
||||
let quarterEndMonth = quarterStartMonth + 2;
|
||||
let startDate = new Date(nowDate.getFullYear(), quarterStartMonth, 1);
|
||||
let endDate = new Date(nowDate.getFullYear(), quarterEndMonth + 1, 0);
|
||||
this.value2 = [parseTime(startDate), parseTime(endDate)];
|
||||
const [startTime, endTime] = this.getQuarterStartAndEnd();
|
||||
this.value2 = [parseTime(startTime), parseTime(endTime)];
|
||||
} else if (command=='本年'){
|
||||
let nowDate = new Date();
|
||||
let oneWeekAgo = new Date(nowDate.getFullYear() - 1, nowDate.getMonth(), nowDate.getDate())
|
||||
this.value2 = [parseTime(oneWeekAgo),parseTime(nowDate)]
|
||||
const [startTime, endTime] = this.getYearStartAndEnd();
|
||||
this.value2 = [parseTime(startTime),parseTime(endTime)]
|
||||
}else if (command=='自定义'){
|
||||
this.disabled = false
|
||||
}
|
||||
this.getStoreList()
|
||||
this.getEmployeList()
|
||||
},
|
||||
getMonthStartAndToday() {
|
||||
const now = new Date();
|
||||
const year = now.getFullYear();
|
||||
const month = now.getMonth();
|
||||
|
||||
// 获取当前月的第一天
|
||||
const monthStart = new Date(year, month, 1);
|
||||
|
||||
// 获取当前月的最后一天
|
||||
const monthEnd = new Date(year, month + 1, 0);
|
||||
|
||||
// 格式化输出
|
||||
const format = (date) => {
|
||||
const year = date.getFullYear();
|
||||
const month = ('0' + (date.getMonth() + 1)).slice(-2);
|
||||
const day = ('0' + date.getDate()).slice(-2);
|
||||
return `${year}-${month}-${day}`;
|
||||
};
|
||||
|
||||
const startTime = format(monthStart);
|
||||
const endTime = format(monthEnd);
|
||||
|
||||
return [startTime, endTime];
|
||||
},
|
||||
getQuarterStartAndEnd() {
|
||||
const now = new Date();
|
||||
const year = now.getFullYear();
|
||||
const month = now.getMonth();
|
||||
|
||||
// 计算当前季度的起始月份
|
||||
const quarterStartMonth = Math.floor(month / 3) * 3;
|
||||
|
||||
// 获取当前季度的第一天
|
||||
const quarterStart = new Date(year, quarterStartMonth, 1);
|
||||
|
||||
// 获取当前季度的最后一天
|
||||
const quarterEnd = new Date(year, quarterStartMonth + 3, 0);
|
||||
|
||||
// 格式化输出
|
||||
const format = (date) => {
|
||||
const year = date.getFullYear();
|
||||
const month = ('0' + (date.getMonth() + 1)).slice(-2);
|
||||
const day = ('0' + date.getDate()).slice(-2);
|
||||
return `${year}-${month}-${day}`;
|
||||
};
|
||||
|
||||
const startTime = format(quarterStart);
|
||||
const endTime = format(quarterEnd);
|
||||
|
||||
return [startTime, endTime];
|
||||
},
|
||||
getYearStartAndEnd() {
|
||||
const now = new Date();
|
||||
const year = now.getFullYear();
|
||||
|
||||
// 获取当前年的第一天
|
||||
const yearStart = new Date(year, 0, 1);
|
||||
|
||||
// 获取当前年的最后一天
|
||||
const yearEnd = new Date(year, 11, 31);
|
||||
|
||||
// 格式化输出
|
||||
const format = (date) => {
|
||||
const year = date.getFullYear();
|
||||
const month = ('0' + (date.getMonth() + 1)).slice(-2);
|
||||
const day = ('0' + date.getDate()).slice(-2);
|
||||
return `${year}-${month}-${day}`;
|
||||
};
|
||||
|
||||
const startTime = format(yearStart);
|
||||
const endTime = format(yearEnd);
|
||||
|
||||
return [startTime, endTime];
|
||||
},
|
||||
// 获取员工排行信息
|
||||
getEmployeList() {
|
||||
this.employeLoading = true
|
||||
employeeSalesApi().then(res => {
|
||||
let data = {
|
||||
startTime: this.value2[0],
|
||||
endTime: this.value2[1]
|
||||
}
|
||||
employeeSalesApi(data).then(res => {
|
||||
if (res.code == 200) {
|
||||
if (res.data.length >= 10) {
|
||||
this.employeList = res.data.slice(0, 10);
|
||||
|
@ -38,7 +38,7 @@ public interface LJStaffMapper extends BaseMapper<LJStaff> {
|
||||
*/
|
||||
int auditPrem(@Param("id")Integer id,@Param("auditPrem") String auditPrem);
|
||||
|
||||
List<Map<String,String>> employeeSales(@Param("storeId") Integer storeId);
|
||||
List<Map<String,String>> employeeSales(@Param("storeId") Integer storeId,@Param("startTime") String startTime, @Param("endTime") String endTime);
|
||||
List<Map<String,String>> employeeSalesMongth(@Param("storeId") Integer storeId);
|
||||
|
||||
LJStaff selectStaffById(@Param("id") Integer id);
|
||||
|
@ -61,7 +61,7 @@
|
||||
LEFT JOIN (
|
||||
SELECT staff_id, COALESCE(SUM(pay_amount), 0) AS pay_amount
|
||||
FROM oil_order
|
||||
WHERE order_status = 'paid'
|
||||
WHERE order_status = 'paid' and create_time between #{startTime} and #{endTime}
|
||||
GROUP BY staff_id
|
||||
) oo ON ms.id = oo.staff_id
|
||||
LEFT JOIN (
|
||||
@ -69,13 +69,13 @@
|
||||
COALESCE(SUM(CASE WHEN payment_type = 'CASH' THEN amount ELSE 0 END), 0) as recharge_balance
|
||||
|
||||
FROM card_value_record
|
||||
WHERE pay_status = 'paid'
|
||||
WHERE pay_status = 'paid' and create_time between #{startTime} and #{endTime}
|
||||
GROUP BY mt_staff_id
|
||||
) cvr ON ms.id = cvr.mt_staff_id
|
||||
LEFT JOIN (
|
||||
SELECT mt_staff_id, COALESCE(SUM(recharge_balance), 0) as recharge_balance
|
||||
FROM card_fuel_record
|
||||
WHERE pay_status = 'paid'
|
||||
WHERE pay_status = 'paid' and create_time between #{startTime} and #{endTime}
|
||||
GROUP BY mt_staff_id
|
||||
) cfr ON ms.id = cfr.mt_staff_id
|
||||
WHERE
|
||||
|
@ -253,8 +253,8 @@ public class OilOrderController extends BaseController {
|
||||
}
|
||||
// 员工销售
|
||||
@GetMapping("employeeSales")
|
||||
public ResponseObject employeeSales() {
|
||||
return getSuccessResult(orderService.employeeSales());
|
||||
public ResponseObject employeeSales(String startTime, String endTime) {
|
||||
return getSuccessResult(orderService.employeeSales(startTime, endTime));
|
||||
|
||||
}
|
||||
// 储值卡销售额
|
||||
|
@ -158,7 +158,7 @@ public interface OilOrderService extends IService<OilOrder> {
|
||||
|
||||
// 流水统计
|
||||
Map<String, Double> turnoverStatistics();
|
||||
List<Map<String, String>> employeeSales();
|
||||
List<Map<String, String>> employeeSales(String startTime, String endTime);
|
||||
List<Map<String, String>> prepaidCardSales();
|
||||
List<Map<String, String>> tunFuelCardSales();
|
||||
List<Map<String, String>> merchandiseSales();
|
||||
|
@ -1931,11 +1931,11 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
|
||||
|
||||
// 员工统计
|
||||
@Override
|
||||
public List<Map<String, String>> employeeSales() {
|
||||
public List<Map<String, String>> employeeSales(String startTime, String endTime) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
Integer storeId = nowAccountInfo.getStoreId();
|
||||
// 员工统计油品
|
||||
List<Map<String, String>> maps = ljStaffMapper.employeeSales(storeId);
|
||||
List<Map<String, String>> maps = ljStaffMapper.employeeSales(storeId, startTime, endTime);
|
||||
return maps;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user