|
@@ -9,12 +9,12 @@ function rewardPayrollLine(row, month) {
|
|
|
reviewTaskId: row.taskId, plannedDate: row.plannedDate, coachId: Number(row.coachId), coachName: row.coachName,
|
|
reviewTaskId: row.taskId, plannedDate: row.plannedDate, coachId: Number(row.coachId), coachName: row.coachName,
|
|
|
storeId: Number(row.storeId), storeName: row.storeName, studentName: row.studentName, courseName: row.courseName,
|
|
storeId: Number(row.storeId), storeName: row.storeName, studentName: row.studentName, courseName: row.courseName,
|
|
|
legacyGeneralId: 0, lessonId: '', lessonAt: iso, originalMonth: row.incomeMonth, settlementMonth: month,
|
|
legacyGeneralId: 0, lessonId: '', lessonAt: iso, originalMonth: row.incomeMonth, settlementMonth: month,
|
|
|
- classType: 0, classTypeLabel: '复习奖励', courseCategoryName: '复习奖励', courseCategoryKey: '',
|
|
|
|
|
|
|
+ classType: 0, classTypeLabel: '抗遗忘工资', courseCategoryName: '抗遗忘工资', courseCategoryKey: '',
|
|
|
durationMinutes: 0, durationHours: 0, deliveryMode: '', deliveryLabel: '', rateAmount: Number(row.amount),
|
|
durationMinutes: 0, durationHours: 0, deliveryMode: '', deliveryLabel: '', rateAmount: Number(row.amount),
|
|
|
amount: Number(row.amount), score: 0, exception: '', description: '计划复习首次完成 · ' + row.plannedDate };
|
|
amount: Number(row.amount), score: 0, exception: '', description: '计划复习首次完成 · ' + row.plannedDate };
|
|
|
}
|
|
}
|
|
|
async function reviewRewardPayrollLines(companyId, month, includeUsed) {
|
|
async function reviewRewardPayrollLines(companyId, month, includeUsed) {
|
|
|
- if (!companyId) throw new Error('复习奖励必须指定帐套');
|
|
|
|
|
|
|
+ if (!companyId) throw new Error('抗遗忘工资必须指定帐套');
|
|
|
if (!/^\d{4}-(0[1-9]|1[0-2])$/.test(month)) throw new Error('月份格式无效');
|
|
if (!/^\d{4}-(0[1-9]|1[0-2])$/.test(month)) throw new Error('月份格式无效');
|
|
|
const rows = await Psql.query('SELECT r.* FROM "ReviewReward" r WHERE r."company"=$1 AND r."status"=\'earned\' AND ' +
|
|
const rows = await Psql.query('SELECT r.* FROM "ReviewReward" r WHERE r."company"=$1 AND r."status"=\'earned\' AND ' +
|
|
|
(includeUsed ? 'r."incomeMonth"=$2' : 'r."incomeMonth"<=$2 AND NOT EXISTS (SELECT 1 FROM "PayrollLine" l WHERE l."company"=r."company" AND l."reviewRewardId"=r."objectId" AND l."kind"=\'review_reward\' AND COALESCE(l."excluded",false)=false)') +
|
|
(includeUsed ? 'r."incomeMonth"=$2' : 'r."incomeMonth"<=$2 AND NOT EXISTS (SELECT 1 FROM "PayrollLine" l WHERE l."company"=r."company" AND l."reviewRewardId"=r."objectId" AND l."kind"=\'review_reward\' AND COALESCE(l."excluded",false)=false)') +
|
|
@@ -22,7 +22,7 @@ async function reviewRewardPayrollLines(companyId, month, includeUsed) {
|
|
|
return rows.map((row) => rewardPayrollLine(row, month));
|
|
return rows.map((row) => rewardPayrollLine(row, month));
|
|
|
}
|
|
}
|
|
|
async function reviewRewardPage(companyId, input) {
|
|
async function reviewRewardPage(companyId, input) {
|
|
|
- if (!companyId) throw new Error('复习奖励必须指定帐套');
|
|
|
|
|
|
|
+ if (!companyId) throw new Error('抗遗忘工资必须指定帐套');
|
|
|
const page = Math.max(1, Math.floor(Number(input.page) || 1)), pageSize = Math.min(100, Math.max(1, Math.floor(Number(input.pageSize) || 20)));
|
|
const page = Math.max(1, Math.floor(Number(input.page) || 1)), pageSize = Math.min(100, Math.max(1, Math.floor(Number(input.pageSize) || 20)));
|
|
|
const values = [companyId], clauses = ['r."company"=$1'];
|
|
const values = [companyId], clauses = ['r."company"=$1'];
|
|
|
const add = (condition, value) => { values.push(value); clauses.push(condition.replaceAll('?', '$' + values.length)); };
|
|
const add = (condition, value) => { values.push(value); clauses.push(condition.replaceAll('?', '$' + values.length)); };
|