更新10.16

This commit is contained in:
许允枞 2024-10-16 15:09:44 +08:00
parent 4bcc6fbe02
commit cf5d8d46f7
6 changed files with 121 additions and 61 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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

View File

@ -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));
}
// 储值卡销售额

View File

@ -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();

View File

@ -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;
}