Commit 084b98af by lixinming

no message

parent e850b287
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
*/ */
import moment = require("moment"); import moment = require("moment");
import { CERTIFICATETYPE, CHANGEAPPLYTYPE, CLIENTMSGLABLE, INDIVIDUALMEMBERTYPE, INFOCHANGEAPPLYTYPE, MEMBERLEVEL, MEMBERSTATE, MEMBERTYPE, STATE, UNITMEMBERTYPE } from "../../config/enum"; import { BANXUELEIXING, CERTIFICATETYPE, CHANGEAPPLYTYPE, CLIENTMSGLABLE, INDIVIDUALMEMBERTYPE, INFOCHANGEAPPLYTYPE, MEMBERLEVEL, MEMBERSTATE, MEMBERTYPE, STATE, UNITMEMBERTYPE } from "../../config/enum";
import { TABLEENUM } from "../../data/models/model"; import { TABLEENUM } from "../../data/models/model";
import { find, findCount, findOnce, findOnceToSort, findToPage, findToSortToPage } from "../../data/select"; import { find, findCount, findOnce, findOnceToSort, findToPage, findToSort, findToSortToPage } from "../../data/select";
import { extractData } from "../../util/piecemeal"; import { extractData } from "../../util/piecemeal";
import { changeEnumValue } from "../../util/verificationEnum"; import { changeEnumValue } from "../../util/verificationEnum";
import { BizError } from "../../util/bizError"; import { BizError } from "../../util/bizError";
...@@ -362,14 +362,16 @@ export async function infomationChangeList({name, changeState, pageNumber}) { ...@@ -362,14 +362,16 @@ export async function infomationChangeList({name, changeState, pageNumber}) {
if (changeState) { if (changeState) {
selectParam.infoChangeOptionType = changeState; selectParam.infoChangeOptionType = changeState;
} }
let dbList = await findToPage(TABLEENUM.用户表, selectParam, ["userId", "unitName", "infoChangeId", "uscc", "legalPerson", "unitMemberType"], pageNumber);
let dbList = await findToSortToPage(TABLEENUM.用户表, selectParam, ["userId", "memberType", "userId", "unitName", "infoChangeId", "uscc", "legalPerson", "unitMemberType", "yuanXiaoBanXueLeiXing"], {infoChangeMs:-1}, pageNumber);
let dataCount = await findCount(TABLEENUM.用户表, selectParam); let dataCount = await findCount(TABLEENUM.用户表, selectParam);
let dataList = []; let dataList = [];
for (let i = 0; i < dbList.length; i++) { for (let i = 0; i < dbList.length; i++) {
let info = dbList[i]; let info = dbList[i];
let itemFileList = ["unitName", "uscc", "legalPerson", "unitMemberType", "uusinessLicenseUrl", "applicationForm", "desc", "rejectRemarks", "infoChangeOptionType", "infoChangeId"]; let itemFileList = ["unitName","uscc", "legalPerson", "yuanXiaoBanXueLeiXing", "unitMemberType", "uusinessLicenseUrl", "applicationForm", "desc", "rejectRemarks", "infoChangeOptionType", "infoChangeId", "yuanXiaoBanXueLeiXing", "legalPersonMail", "legalPersonPhone"];
let logInfo = await findOnceToSort(TABLEENUM.资料变更审批历史表, {infoChangeId:info.infoChangeId}, {createTimeMs:-1}, itemFileList); let logInfo = await findOnceToSort(TABLEENUM.资料变更审批历史表, {infoChangeId:info.infoChangeId}, {createTimeMs:-1}, itemFileList);
let yuanXiaoBanXueLeiXing= logInfo.yuanXiaoBanXueLeiXing || info.yuanXiaoBanXueLeiXing;
let item = { let item = {
infoChangeOptionType:changeEnumValue(INFOCHANGEAPPLYTYPE, logInfo.infoChangeOptionType), infoChangeOptionType:changeEnumValue(INFOCHANGEAPPLYTYPE, logInfo.infoChangeOptionType),
infoChangeId:info.infoChangeId, infoChangeId:info.infoChangeId,
...@@ -379,16 +381,28 @@ export async function infomationChangeList({name, changeState, pageNumber}) { ...@@ -379,16 +381,28 @@ export async function infomationChangeList({name, changeState, pageNumber}) {
unitMemberType:changeEnumValue(UNITMEMBERTYPE, logInfo.unitMemberType), unitMemberType:changeEnumValue(UNITMEMBERTYPE, logInfo.unitMemberType),
uusinessLicenseUrl:logInfo.uusinessLicenseUrl, uusinessLicenseUrl:logInfo.uusinessLicenseUrl,
applicationForm:logInfo.applicationForm, applicationForm:logInfo.applicationForm,
yuanXiaoBanXueLeiXing:changeEnumValue(BANXUELEIXING, yuanXiaoBanXueLeiXing),
desc:logInfo.desc, desc:logInfo.desc,
unitNameChange:false, unitNameChange:false,
usccChange:false, usccChange:false,
unitMemberTypeChange:false, unitMemberTypeChange:false,
legalPersonChange:false, legalPersonChange:false,
yuanXiaoBanXueLeiXingChange:false,
memberType:changeEnumValue(MEMBERTYPE, info.memberType),
userId:info.userId,
legalPersonMail:logInfo.legalPersonMail || '',
legalPersonPhone:logInfo.legalPersonPhone || '',
legalPersonMailChange:false,
legalPersonPhoneChange:false,
rejectRemarks:logInfo.rejectRemarks || ""
}; };
if (logInfo.unitName != info.unitName) item.unitNameChange = true; if (logInfo.unitName != info.unitName) item.unitNameChange = true;
if (logInfo.uscc != info.uscc) item.usccChange = true; if (logInfo.uscc != info.uscc) item.usccChange = true;
if (logInfo.unitMemberType != info.unitMemberType) item.unitMemberTypeChange = true; if (logInfo.unitMemberType != info.unitMemberType) item.unitMemberTypeChange = true;
if (logInfo.legalPerson != info.legalPerson) item.legalPersonChange = true; if (logInfo.legalPerson != info.legalPerson) item.legalPersonChange = true;
if (logInfo.yuanXiaoBanXueLeiXing != info.yuanXiaoBanXueLeiXing) item.yuanXiaoBanXueLeiXingChange = true;
if (logInfo.legalPersonMail != info.legalPersonMail) item.legalPersonMailChange = true;
if (logInfo.legalPersonPhone != info.legalPersonPhone) item.legalPersonPhoneChange = true;
dataList.push(item); dataList.push(item);
} }
...@@ -398,7 +412,7 @@ export async function infomationChangeList({name, changeState, pageNumber}) { ...@@ -398,7 +412,7 @@ export async function infomationChangeList({name, changeState, pageNumber}) {
export async function infomationChangePass({infoChangeId}) { export async function infomationChangePass({infoChangeId}) {
let selectParam:any = {infoChangeId}; let selectParam:any = {infoChangeId};
let fileList = ["userId","unitName", "uscc", "legalPerson", "unitMemberType", "uusinessLicenseUrl", "applicationForm", "desc", "rejectRemarks", "infoChangeOptionType", "infoChangeId"]; let fileList = ["userId","unitName", "uscc", "legalPerson", "unitMemberType", "uusinessLicenseUrl", "applicationForm", "desc", "rejectRemarks", "infoChangeOptionType", "infoChangeId", "legalPersonPhone", "legalPersonMail", "yuanXiaoBanXueLeiXing"];
let onceData = await findOnceToSort(TABLEENUM.资料变更审批历史表, selectParam, {createTimeMs:-1},fileList); let onceData = await findOnceToSort(TABLEENUM.资料变更审批历史表, selectParam, {createTimeMs:-1},fileList);
if (!onceData || !onceData.infoChangeId) throw new BizError(ERRORENUM.目标数据不存在); if (!onceData || !onceData.infoChangeId) throw new BizError(ERRORENUM.目标数据不存在);
...@@ -420,6 +434,9 @@ export async function infomationChangePass({infoChangeId}) { ...@@ -420,6 +434,9 @@ export async function infomationChangePass({infoChangeId}) {
unitMemberType:onceData.unitMemberType, unitMemberType:onceData.unitMemberType,
uusinessLicenseUrl:onceData.uusinessLicenseUrl, uusinessLicenseUrl:onceData.uusinessLicenseUrl,
applicationForm:onceData.applicationForm, applicationForm:onceData.applicationForm,
yuanXiaoBanXueLeiXing:onceData.yuanXiaoBanXueLeiXing,
legalPersonMail:onceData.legalPersonMail || '',
legalPersonPhone:onceData.legalPersonPhone || '',
desc:onceData.desc, desc:onceData.desc,
createTimeMs:new Date().valueOf() createTimeMs:new Date().valueOf()
}; };
...@@ -432,7 +449,10 @@ export async function infomationChangePass({infoChangeId}) { ...@@ -432,7 +449,10 @@ export async function infomationChangePass({infoChangeId}) {
legalPerson:onceData.legalPerson, legalPerson:onceData.legalPerson,
unitMemberType:onceData.unitMemberType, unitMemberType:onceData.unitMemberType,
uusinessLicenseUrl:onceData.uusinessLicenseUrl, uusinessLicenseUrl:onceData.uusinessLicenseUrl,
applicationForm:onceData.applicationForm applicationForm:onceData.applicationForm,
yuanXiaoBanXueLeiXing:onceData.yuanXiaoBanXueLeiXing,
legalPersonMail:onceData.legalPersonMail,
legalPersonPhone:onceData.legalPersonPhone,
}; };
await updateOneData(TABLEENUM.用户表, {userId:onceData.userId}, updateInfo); await updateOneData(TABLEENUM.用户表, {userId:onceData.userId}, updateInfo);
...@@ -442,7 +462,7 @@ export async function infomationChangePass({infoChangeId}) { ...@@ -442,7 +462,7 @@ export async function infomationChangePass({infoChangeId}) {
export async function infomationChangeOut({infoChangeId, rejectRemarks}) { export async function infomationChangeOut({infoChangeId, rejectRemarks}) {
let selectParam:any = {infoChangeId}; let selectParam:any = {infoChangeId};
let fileList = ["userId","unitName", "uscc", "legalPerson", "unitMemberType", "uusinessLicenseUrl", "applicationForm", "desc", "rejectRemarks", "infoChangeOptionType", "infoChangeId"]; let fileList = ["userId","unitName", "uscc", "legalPerson", "unitMemberType", "uusinessLicenseUrl", "applicationForm", "desc", "rejectRemarks", "infoChangeOptionType", "infoChangeId", "legalPersonPhone", "legalPersonMail", "yuanXiaoBanXueLeiXing"];
let onceData = await findOnceToSort(TABLEENUM.资料变更审批历史表, selectParam, {createTimeMs:-1},fileList); let onceData = await findOnceToSort(TABLEENUM.资料变更审批历史表, selectParam, {createTimeMs:-1},fileList);
if (!onceData || !onceData.infoChangeId) throw new BizError(ERRORENUM.目标数据不存在); if (!onceData || !onceData.infoChangeId) throw new BizError(ERRORENUM.目标数据不存在);
...@@ -454,7 +474,7 @@ export async function infomationChangeOut({infoChangeId, rejectRemarks}) { ...@@ -454,7 +474,7 @@ export async function infomationChangeOut({infoChangeId, rejectRemarks}) {
//添加日志 //添加日志
let applyInfo:any = { let applyInfo:any = {
infoChangeId, infoChangeId,
applyId:generateSystemId(TABLEENUM.理事变更审批历史表, onceData.userId), applyId:generateSystemId(TABLEENUM.资料变更审批历史表, onceData.userId),
userId:onceData.userId, userId:onceData.userId,
unitName:onceData.unitName, unitName:onceData.unitName,
infoChangeOptionType:INFOCHANGEAPPLYTYPE.驳回修改, infoChangeOptionType:INFOCHANGEAPPLYTYPE.驳回修改,
...@@ -464,10 +484,13 @@ export async function infomationChangeOut({infoChangeId, rejectRemarks}) { ...@@ -464,10 +484,13 @@ export async function infomationChangeOut({infoChangeId, rejectRemarks}) {
uusinessLicenseUrl:onceData.uusinessLicenseUrl, uusinessLicenseUrl:onceData.uusinessLicenseUrl,
applicationForm:onceData.applicationForm, applicationForm:onceData.applicationForm,
desc:onceData.desc, desc:onceData.desc,
yuanXiaoBanXueLeiXing:onceData.yuanXiaoBanXueLeiXing,
rejectRemarks:rejectRemarks, rejectRemarks:rejectRemarks,
legalPersonMail:onceData.legalPersonMail || '',
legalPersonPhone:onceData.legalPersonPhone || '',
createTimeMs:new Date().valueOf() createTimeMs:new Date().valueOf()
}; };
await addOneData(TABLEENUM.理事变更审批历史表, applyInfo); await addOneData(TABLEENUM.资料变更审批历史表, applyInfo);
let updateInfo = { let updateInfo = {
infoChangeOptionType:INFOCHANGEAPPLYTYPE.驳回修改, infoChangeOptionType:INFOCHANGEAPPLYTYPE.驳回修改,
...@@ -478,31 +501,56 @@ export async function infomationChangeOut({infoChangeId, rejectRemarks}) { ...@@ -478,31 +501,56 @@ export async function infomationChangeOut({infoChangeId, rejectRemarks}) {
} }
export async function infomationChangeLog({infoChangeId}) { export async function infomationChangeLog({infoChangeId}) {
let userInfo = await findOnce(TABLEENUM.用户表, {infoChangeId}, ["userId"]); let userInfo = await findOnce(TABLEENUM.用户表, {infoChangeId}, ["userId", "unitName", "uscc", "unitMemberType", "legalPerson", "yuanXiaoBanXueLeiXing", "legalPersonMail", "legalPersonPhone"]);
if (!userInfo || !userInfo.userId) { if (!userInfo || !userInfo.userId) {
throw new BizError(ERRORENUM.不存在审批历史); throw new BizError(ERRORENUM.不存在审批历史);
} }
let selectParam:any = {userId:userInfo.userId}; let selectParam:any = {userId:userInfo.userId};
let fileList = ["unitName", "uscc", "legalPerson", "unitMemberType", "uusinessLicenseUrl", "applicationForm", "desc", "rejectRemarks", "infoChangeOptionType", "infoChangeId"]; let fileList = [];
let dbList = await find(TABLEENUM.资料变更审批历史表, selectParam, fileList); let dbList = await findToSort(TABLEENUM.资料变更审批历史表, selectParam, {createTimeMs:-1}, fileList);
let dataList = []; let dataList = [];
for (let i = 0; i < dbList.length; i++) { for (let i = 0; i < dbList.length; i++) {
let info = dbList[i]; let info = dbList[i];
let itemFileList = ["unitName", "uscc", "legalPerson", "unitMemberType", "uusinessLicenseUrl", "applicationForm", "desc", "rejectRemarks", "infoChangeOptionType", "infoChangeId"]; // let itemFileList = ["unitName", "uscc", "legalPerson", "unitMemberType", "uusinessLicenseUrl", "applicationForm", "desc", "rejectRemarks", "infoChangeOptionType", "infoChangeId"];
let logInfo = await findOnceToSort(TABLEENUM.资料变更审批历史表, {infoChangeId:info.infoChangeId}, {createTimeMs:-1}, itemFileList); // let logInfo = await findOnceToSort(TABLEENUM.资料变更审批历史表, {infoChangeId:info.infoChangeId}, {createTimeMs:-1}, itemFileList);
let infoChangeOptionType = changeEnumValue(INFOCHANGEAPPLYTYPE, info.infoChangeOptionType);
let desc = "";
if (INFOCHANGEAPPLYTYPE.待审批 == info.infoChangeOptionType) {
infoChangeOptionType = "用户-提交";
desc = info.desc;
} else if (INFOCHANGEAPPLYTYPE.驳回修改 == info.infoChangeOptionType) {
desc = info.rejectRemarks;
infoChangeOptionType = "审核-驳回";
} else {
desc = "通过";
infoChangeOptionType = "审核-通过";
}
let updateInfoStr = "修改了:";
if (info.unitName != userInfo.unitName) updateInfoStr += "单位名称";
if (info.uscc != userInfo.uscc) updateInfoStr += "统一信用代码";
if (info.unitMemberType != userInfo.unitMemberType) updateInfoStr += "单位类型";
if (info.legalPerson != userInfo.legalPerson) updateInfoStr += "法人代表";
if (info.yuanXiaoBanXueLeiXing != userInfo.yuanXiaoBanXueLeiXing) updateInfoStr += "办学类型";
if (info.legalPersonMail != userInfo.legalPersonMail) updateInfoStr += "法人联系邮箱";
if (info.legalPersonPhone != userInfo.legalPersonPhone) updateInfoStr += "法人联系电话";
let item = { let item = {
infoChangeOptionType:changeEnumValue(INFOCHANGEAPPLYTYPE, logInfo.infoChangeOptionType), infoChangeOptionType,
infoChangeId:info.infoChangeId, infoChangeId:info.infoChangeId,
unitName:logInfo.unitName, unitName:info.unitName,
uscc:logInfo.uscc, uscc:info.uscc,
legalPerson:logInfo.legalPerson, legalPerson:info.legalPerson,
unitMemberType:changeEnumValue(UNITMEMBERTYPE, logInfo.unitMemberType), unitMemberType:changeEnumValue(UNITMEMBERTYPE, info.unitMemberType),
uusinessLicenseUrl:logInfo.uusinessLicenseUrl, uusinessLicenseUrl:info.uusinessLicenseUrl,
applicationForm:logInfo.applicationForm, applicationForm:info.applicationForm,
desc:logInfo.desc, yuanXiaoBanXueLeiXing:info.yuanXiaoBanXueLeiXing,
time:moment(logInfo.createTimeMs).format("YYYY-MM-DD"), desc,
time:moment(info.createTimeMs).format("YYYY-MM-DD HH:mm:SS"),
updateInfoStr
}; };
dataList.push(item); dataList.push(item);
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* 收费 * 收费
*/ */
import { INVOICESTATUS, MEMBERSTATE, ORDEREXAMINE, ORDERSTATE, PAYMENTSTATUS, PAYMENTTYPE, RECEIPTCONFIRMATION, STATE, WEICHARTPAYSTATE } from "../../config/enum"; import { INVOICESTATUS, MEMBERSTATE, MEMBERTYPE, ORDEREXAMINE, ORDERSTATE, PAYMENTSTATUS, PAYMENTTYPE, RECEIPTCONFIRMATION, STATE, WEICHARTPAYSTATE } from "../../config/enum";
import { TABLEENUM } from "../../data/models/model"; import { TABLEENUM } from "../../data/models/model";
import { findCount, findOnce, findOnceToSort } from "../../data/select"; import { findCount, findOnce, findOnceToSort } from "../../data/select";
import * as path from "path"; import * as path from "path";
...@@ -122,6 +122,60 @@ export async function orderClose({id, weChartPR}) { ...@@ -122,6 +122,60 @@ export async function orderClose({id, weChartPR}) {
} }
export async function testCallback(weChartPR) {
let oldInfo = await findOnce(TABLEENUM.订单表, {weChartPR});
if (!oldInfo || !oldInfo.id) throw new BizError(ERRORENUM.目标数据不存在);
let userInfo = await findOnce(TABLEENUM.用户表, {userId:oldInfo.userId});
//更新订单状态
let updateInfo:any = {
paymentNum:"test_____test",
state:ORDERSTATE.已支付,
paymentMethod:PAYMENTTYPE.微信支付,
payTime:new Date().valueOf(),
weChartState:WEICHARTPAYSTATE.已支付,
confirmReceipt:RECEIPTCONFIRMATION.收款确认,
confirmReceiptMs:new Date().valueOf(),
invoiceStatus:INVOICESTATUS.未开发票
};
if (userInfo.memberType == MEMBERTYPE.单位会员) {
updateInfo.invoiceStatus = INVOICESTATUS.不具备开票条件;
}
//更新用户状态
let notPayCount = await findCount(TABLEENUM.订单表, {userId:oldInfo.userId, state:ORDERSTATE.未支付} );
/**只有一笔欠费时才更新用户状态 */
let updateUserInfo:any = {};
if (notPayCount < 1) {
let newOrderInfo = await findOnceToSort(TABLEENUM.订单表, {userId:oldInfo.userId}, {lifespanEndTime:-1}, ["orderCycleStart","orderCycleEnd"]);
updateUserInfo.lifespanStartTime = newOrderInfo.orderCycleStart,
updateUserInfo.lifespanEndTime = newOrderInfo.orderCycleEnd,
updateUserInfo.isGracePeriod = STATE.,
updateUserInfo.gracePeriodEndTime = 0,
updateUserInfo.memberState = MEMBERSTATE.正常,
updateUserInfo.paymentStatus = PAYMENTSTATUS.已支付
} else {//非一笔订单 要更新会员到期时间 到 用户表
updateUserInfo.lifespanStartTime = oldInfo.orderCycleStart;
updateUserInfo.lifespanEndTime = oldInfo.orderCycleEnd;
}
if (oldInfo.isFirst) {
updateUserInfo.isFirstPay = true;
}
if (Object.keys(updateUserInfo).length) await updateOneData(TABLEENUM.用户表, {userId:oldInfo.userId}, updateUserInfo);
//添加审批日志
let addLogInfo = {
orderId:oldInfo.id,
operationTime:new Date().valueOf(),
operationBehavior:ORDEREXAMINE.用户提交,
remarks:"微信付款"
};
await addOneData(TABLEENUM.订单审批历史表, addLogInfo );
await updateOneData(TABLEENUM.订单表, {weChartPR}, updateInfo);
}
/** /**
* 微信回调函数【微信用】 * 微信回调函数【微信用】
*/ */
...@@ -141,11 +195,12 @@ export async function payCallback(body) { ...@@ -141,11 +195,12 @@ export async function payCallback(body) {
paymentMethod:PAYMENTTYPE.微信支付, paymentMethod:PAYMENTTYPE.微信支付,
payTime:new Date().valueOf(), payTime:new Date().valueOf(),
weChartState:WEICHARTPAYSTATE.已支付, weChartState:WEICHARTPAYSTATE.已支付,
confirmReceipt:RECEIPTCONFIRMATION.确认, confirmReceipt:RECEIPTCONFIRMATION.收款确认,
confirmReceiptMs:new Date().valueOf(), confirmReceiptMs:new Date().valueOf(),
invoiceStatus:INVOICESTATUS.未开发票 invoiceStatus:INVOICESTATUS.未开发票
}; };
await updateOneData(TABLEENUM.订单表, {weChartPR:wechartCallbackData.out_trade_no}, updateInfo); await updateOneData(TABLEENUM.订单表, {weChartPR:wechartCallbackData.out_trade_no}, updateInfo);
//更新用户状态 //更新用户状态
......
...@@ -40,8 +40,8 @@ export async function pendingReviewList({name, memberType, documentId, phone, ma ...@@ -40,8 +40,8 @@ export async function pendingReviewList({name, memberType, documentId, phone, ma
if (!selectParam["$and"]) selectParam["$and"] = []; if (!selectParam["$and"]) selectParam["$and"] = [];
selectParam["$and"] = [ selectParam["$and"] = [
{"$or":[ {"$or":[
{unitName:{"$regex":`${name}`}, memberType:MEMBERTYPE.单位会员}, {unitName:{"$regex":`${name}`}},
{name:{"$regex":`${name}`}, memberType:MEMBERTYPE.个人会员} {name:{"$regex":`${name}`}}
]} ]}
]; ];
} }
......
...@@ -37,13 +37,24 @@ export async function paidList({name, memberType, documentId, phone, mail, joinS ...@@ -37,13 +37,24 @@ export async function paidList({name, memberType, documentId, phone, mail, joinS
let findParam:any = { let findParam:any = {
state:ORDERSTATE.已支付 state:ORDERSTATE.已支付
} };
if (payType == 1) { if (payType == 1) {
findParam.paymentMethod = PAYMENTTYPE.微信支付; findParam.paymentMethod = PAYMENTTYPE.微信支付;
} else if (payType == 2) { } else if (payType == 2) {
findParam.paymentMethod = {"$ne":PAYMENTTYPE.微信支付}; findParam.paymentMethod = {"$ne":PAYMENTTYPE.微信支付};
} }
if (examineState) {
if (examineState == 1) {
findParam.confirmReceipt = RECEIPTCONFIRMATION.待确认;
} else {
findParam.confirmReceipt = RECEIPTCONFIRMATION.收款确认;
}
} else findParam.confirmReceipt = {"$ne":RECEIPTCONFIRMATION.退回}
/**用户表查询条件 */ /**用户表查询条件 */
let checkUserIdList = []; let checkUserIdList = [];
let itemParam:any = {}; let itemParam:any = {};
...@@ -93,13 +104,7 @@ export async function paidList({name, memberType, documentId, phone, mail, joinS ...@@ -93,13 +104,7 @@ export async function paidList({name, memberType, documentId, phone, mail, joinS
} }
if (phone) findParam.phone = phone; if (phone) findParam.phone = phone;
if (examineState) {
if (examineState == 1) {
findParam.confirmReceipt = RECEIPTCONFIRMATION.待确认;
} else {
findParam.confirmReceipt = RECEIPTCONFIRMATION.收款确认;
}
} else findParam.confirmReceipt = {"$ne":RECEIPTCONFIRMATION.退回}
if (costType) findParam.isFirst = costType == COSTTYPE.首次; if (costType) findParam.isFirst = costType == COSTTYPE.首次;
let selectFile = ["id", "unitName", "userId", "orderCycleStart", "orderCycleEnd", "money", "paymentMethod", "memberCategory", "isFirst", "paymentNum", "memberState", "operationTime", "confirmReceipt", "invoiceStatus" ]; let selectFile = ["id", "unitName", "userId", "orderCycleStart", "orderCycleEnd", "money", "paymentMethod", "memberCategory", "isFirst", "paymentNum", "memberState", "operationTime", "confirmReceipt", "invoiceStatus" ];
...@@ -289,3 +294,64 @@ export async function outPutConfirmReceipt({exportColumns}) { ...@@ -289,3 +294,64 @@ export async function outPutConfirmReceipt({exportColumns}) {
return {dataList}; return {dataList};
} }
/**
* 发票管理-财务核对页-批量收款确认 success
* @param id 订单id
*/
export async function confirmReceiptManyPass({idList}) {
//限制长度
if (idList.length > 10) throw new BizError(ERRORENUM.批量操作超过个数限制);
let thisDate = new Date();
const NowMs = thisDate.valueOf();
for (let i = 0; i < idList.length; i++) {
let id = idList[i];
let orderInfo = await findOnce(TABLEENUM.订单表, {id});
if (!orderInfo || !orderInfo.id ) throw new BizError(ERRORENUM.目标数据不存在);
// if (orderInfo.isFirst && !orderInfo.firstPayExamine ) throw new BizError(ERRORENUM.重复提交, '发票管理-财务核对页-收款确认', `提交通过时订单未通过待支付页的校验`);
if (orderInfo.confirmReceipt != RECEIPTCONFIRMATION.待确认) throw new BizError(ERRORENUM.重复提交, '发票管理-财务核对页-收款确认', `提交通过时订单已经不是待确认 是${orderInfo.confirmReceipt}`);
let updateInfo:any = {confirmReceipt:RECEIPTCONFIRMATION.收款确认, confirmReceiptMs:new Date().valueOf()};
if (orderInfo.invoiceStatus != INVOICESTATUS.已开发票) updateInfo.invoiceStatus = INVOICESTATUS.未开发票;
await updateOneData(TABLEENUM.订单表, {id}, updateInfo);
let notPayCount = await findCount(TABLEENUM.订单表, {userId:orderInfo.userId, state:ORDERSTATE.未支付} );
let updateUserInfo:any = {};
/**只有一笔欠费时才更新用户状态 */
if (notPayCount < 1) {
let newOrderInfo = await findOnceToSort(TABLEENUM.订单表, {userId:orderInfo.userId}, {lifespanEndTime:-1}, ["orderCycleStart","orderCycleEnd"]);
updateUserInfo.lifespanStartTime = newOrderInfo.orderCycleStart,
updateUserInfo.lifespanEndTime = newOrderInfo.orderCycleEnd,
updateUserInfo.isGracePeriod = STATE.,
updateUserInfo.gracePeriodEndTime = 0,
updateUserInfo.memberState = MEMBERSTATE.正常,
updateUserInfo.paymentStatus = PAYMENTSTATUS.已支付
} else {//非一笔订单 要更新会员到期时间 到 用户表
updateUserInfo.lifespanStartTime = orderInfo.orderCycleStart;
updateUserInfo.lifespanEndTime = orderInfo.orderCycleEnd;
}
if (orderInfo.isFirst) {
updateUserInfo.isFirstPay = true;
}
if (Object.keys(updateUserInfo).length) await updateOneData(TABLEENUM.用户表, {userId:orderInfo.userId}, updateUserInfo);
//添加日志
let addLogInfo = {
orderId:id,
operationTime:new Date().valueOf(),
operationBehavior:ORDEREXAMINE.审核时间,
isReceiveMoney:true,
remarks:``
};
await addOneData(TABLEENUM.订单审批历史表, addLogInfo );
}
return successResult();
}
...@@ -35,18 +35,38 @@ import { successResult } from "../../../tools/system"; ...@@ -35,18 +35,38 @@ import { successResult } from "../../../tools/system";
*/ */
export async function billStateList({name, memberType, documentId, phone, mail, joinStartTime, joinEndTime, memberLevel, payState,paymentType, invoiceState, weChartPR, pageNumber}) { export async function billStateList({name, memberType, documentId, phone, mail, joinStartTime, joinEndTime, memberLevel, payState,paymentType, invoiceState, weChartPR, pageNumber}) {
if (payState != 1 && payState != 2 && payState != 3) throw new BizError(ERRORENUM.参数错误); if (payState != 1 && payState != 2 && payState != 3) throw new BizError(ERRORENUM.参数错误);
let findParam:any = {}; let findParam:any = {invoiceStatus:{"$ne":INVOICESTATUS.已开发票}};
if (invoiceState) {
if (payState == 1) {//已支付
findParam.state = ORDERSTATE.已支付;
if (invoiceState == 1) {//已申请 if (invoiceState == 1) {//已申请
findParam.invoiceStatus = INVOICESTATUS.未开发票 findParam.invoiceStatus = INVOICESTATUS.未开发票
} else {//未申请 } else if (invoiceState == 2) {//未申请
findParam["$or"] = [{invoiceStatus:INVOICESTATUS.不具备开票条件}, {invoiceStatus:INVOICESTATUS.退回}]; findParam["$or"] = [{invoiceStatus:INVOICESTATUS.不具备开票条件}, {invoiceStatus:INVOICESTATUS.退回}];
} else {//全部
// findParam.invoiceStatus = {"$ne": INVOICESTATUS.已开发票};
} }
} } else if (payState == 2){//未支付
if (payState == 1) {
findParam.state = ORDERSTATE.已支付;
} else if (payState == 2){
findParam.state = ORDERSTATE.未支付; findParam.state = ORDERSTATE.未支付;
if (!invoiceState || invoiceState == 1) {//已申请 和 全部
findParam.invoiceStatus = INVOICESTATUS.未开发票
} else {//未申请
return {dataList:[], dataCount:0};
}
} else {//全部
if (!invoiceState) {// 全部
findParam["$or"] = [
{ state : ORDERSTATE.已支付, },
{ state : ORDERSTATE.未支付, invoiceStatus:INVOICESTATUS.未开发票},
// { invoiceStatus : INVOICESTATUS.未开发票},
// {"$or":[{invoiceStatus:INVOICESTATUS.不具备开票条件}, {invoiceStatus:INVOICESTATUS.退回}]}
]
} else if ( invoiceState == 1) {//已申请
findParam.invoiceStatus = INVOICESTATUS.未开发票;
}else {//未申请
findParam = { state : ORDERSTATE.未支付, invoiceStatus:INVOICESTATUS.未开发票};
}
} }
/**用户表查询条件 */ /**用户表查询条件 */
...@@ -104,13 +124,13 @@ export async function billStateList({name, memberType, documentId, phone, mail, ...@@ -104,13 +124,13 @@ export async function billStateList({name, memberType, documentId, phone, mail,
} }
if (weChartPR) findParam.paymentNum = {"$regex":`${weChartPR}`}; if (weChartPR) findParam.paymentNum = {"$regex":`${weChartPR}`};
let selectFile = ["id", "unitName", "orderCycleStart", "orderCycleEnd", "money", "paymentMethod", "memberCategory", "state", "paymentNum", "userId", "desc", "invoiceMail", "weChartCreatePayMs"]; let selectFile = ["id", "unitName", "orderCycleStart", "orderCycleEnd", "money", "paymentMethod", "memberCategory", "state", "paymentNum", "userId", "desc", "invoiceMail", "weChartCreatePayMs", "invoiceStatus"];
let dbList = await findToPage(TABLEENUM.订单表, findParam, selectFile, pageNumber); let dbList = await findToPage(TABLEENUM.订单表, findParam, selectFile, pageNumber);
let dataCount = await findCount(TABLEENUM.订单表, findParam); let dataCount = await findCount(TABLEENUM.订单表, findParam);
let dataList = []; let dataList = [];
let itemFile = ["id", "userId", "unitName", "money", "paymentNum", "memberCategory", "state", "paymentMethod", "desc", "invoiceMail", "weChartCreatePayMs"]; let itemFile = ["id", "userId", "unitName", "money", "paymentNum", "memberCategory", "state", "paymentMethod", "desc", "invoiceMail", "weChartCreatePayMs", "invoiceStatus"];
for (let i= 0; i < dbList.length; i++) { for (let i= 0; i < dbList.length; i++) {
let info = dbList[i]; let info = dbList[i];
let itemData:any = extractData(info, itemFile); let itemData:any = extractData(info, itemFile);
...@@ -121,7 +141,6 @@ export async function billStateList({name, memberType, documentId, phone, mail, ...@@ -121,7 +141,6 @@ export async function billStateList({name, memberType, documentId, phone, mail,
itemData.paymentMethod = changeEnumValue(PAYMENTTYPE, itemData.paymentMethod); itemData.paymentMethod = changeEnumValue(PAYMENTTYPE, itemData.paymentMethod);
itemData.isPay = changeEnumValue(ORDERSTATE, itemData.state); itemData.isPay = changeEnumValue(ORDERSTATE, itemData.state);
itemData.payState = info.state == ORDERSTATE.已支付 ? "已支付" : "未支付"; itemData.payState = info.state == ORDERSTATE.已支付 ? "已支付" : "未支付";
let userInfomation = await findOnce(TABLEENUM.用户表, {userId:itemData.userId}, ["userId", "memberState", "name", "memberLevel", "individualMemberType", "unitMemberType"]); let userInfomation = await findOnce(TABLEENUM.用户表, {userId:itemData.userId}, ["userId", "memberState", "name", "memberLevel", "individualMemberType", "unitMemberType"]);
if (!userInfomation || !userInfomation.userId) continue; if (!userInfomation || !userInfomation.userId) continue;
...@@ -133,8 +152,10 @@ export async function billStateList({name, memberType, documentId, phone, mail, ...@@ -133,8 +152,10 @@ export async function billStateList({name, memberType, documentId, phone, mail,
itemData.memberType = changeEnumValue(MEMBERTYPEECCENUM, userInfomation.unitMemberType); itemData.memberType = changeEnumValue(MEMBERTYPEECCENUM, userInfomation.unitMemberType);
} }
itemData.memberLevel = changeEnumValue(MEMBERLEVEL, userInfomation.memberLevel); itemData.memberLevel = changeEnumValue(MEMBERLEVEL, userInfomation.memberLevel);
itemData.memberState = changeEnumValue(MEMBERSTATE, userInfomation.memberState); // itemData.memberState = changeEnumValue(MEMBERSTATE, userInfomation.memberState);
} }
itemData.invoiceStatus = itemData.invoiceStatus == INVOICESTATUS.未开发票 ? "已申请" : "未申请";
// itemData.cycle = `${moment(info.orderCycleStart).format("YYYY-MM-DD")}至${moment(info.orderCycleEnd).format("YYYY-MM-DD")}`; // itemData.cycle = `${moment(info.orderCycleStart).format("YYYY-MM-DD")}至${moment(info.orderCycleEnd).format("YYYY-MM-DD")}`;
itemData.cycle = `${moment(info.orderCycleStart).format("YYYY")}${moment(info.orderCycleEnd).format("YYYY")}`; itemData.cycle = `${moment(info.orderCycleStart).format("YYYY")}${moment(info.orderCycleEnd).format("YYYY")}`;
......
...@@ -250,7 +250,7 @@ export async function getSheng ({userId}) { ...@@ -250,7 +250,7 @@ export async function getSheng ({userId}) {
*/ */
export async function getCertificate({userId}) { export async function getCertificate({userId}) {
const Files = ["userId", "memberType", "userRegisterState", "paymentStatus", "individualMemberType", "unitMemberType", const Files = ["userId", "memberType", "userRegisterState", "paymentStatus", "individualMemberType", "unitMemberType",
"sheng", "documentId", "memberNum", "lifespanStartTime", "lifespanEndTime", "shi","qu","addres", "unitName", "session"]; "sheng", "documentId", "memberNum", "lifespanStartTime", "lifespanEndTime", "shi","qu","addres", "unitName", "session", "name"];
let userInfo = await findOnce(TABLEENUM.用户表, {userId}, Files); let userInfo = await findOnce(TABLEENUM.用户表, {userId}, Files);
if (!userInfo || !userInfo.userId) throw new BizError(ERRORENUM.目标数据不存在); if (!userInfo || !userInfo.userId) throw new BizError(ERRORENUM.目标数据不存在);
...@@ -266,6 +266,7 @@ export async function getSheng ({userId}) { ...@@ -266,6 +266,7 @@ export async function getSheng ({userId}) {
if (userInfo.individualMemberType == INDIVIDUALMEMBERTYPE.专家会员) certificate = true; if (userInfo.individualMemberType == INDIVIDUALMEMBERTYPE.专家会员) certificate = true;
if (certificate) { if (certificate) {
cefaInfo = { cefaInfo = {
name:userInfo.name,
area:getCityNameByCode(userInfo.sheng), area:getCityNameByCode(userInfo.sheng),
documentId:userInfo.documentId, documentId:userInfo.documentId,
memberNum:userInfo.memberNum, memberNum:userInfo.memberNum,
...@@ -608,26 +609,29 @@ export async function applyReason({applyStr, userId}) { ...@@ -608,26 +609,29 @@ export async function applyReason({applyStr, userId}) {
export async function infomationChangeUpdate({userId, unitName, uscc, legalPerson, unitMemberType, uusinessLicenseUrl, applicationForm, desc}) { export async function infomationChangeUpdate({userId, unitName, uscc, legalPerson, unitMemberType, uusinessLicenseUrl, applicationForm, desc, yuanXiaoBanXueLeiXing, legalPersonMail, legalPersonPhone}) {
let userInfo = await findOnce(TABLEENUM.用户表, {userId}, ["memberType"]); let userInfo = await findOnce(TABLEENUM.用户表, {userId}, ["memberType"]);
if (userInfo.memberType != MEMBERTYPE.单位会员) throw new BizError(ERRORENUM.非单位会员不可操作); if (userInfo.memberType != MEMBERTYPE.单位会员) throw new BizError(ERRORENUM.非单位会员不可操作);
//添加日志 //添加日志
/**添加审批历史 */ /**添加审批历史 */
let applyInfo:any = { let applyInfo:any = {
applyId:generateSystemId(TABLEENUM.理事变更审批历史表, userId), applyId:generateSystemId(TABLEENUM.资料变更审批历史表, userId),
infoChangeId:generateSystemId(TABLEENUM.理事变更审批历史表, userId), infoChangeId:generateSystemId(TABLEENUM.资料变更审批历史表, userId),
userId, userId,
unitName, unitName,
uscc, uscc,
legalPerson, legalPerson,
unitMemberType, unitMemberType,
uusinessLicenseUrl, uusinessLicenseUrl,
applicationForm, applicationForm,
yuanXiaoBanXueLeiXing,
desc, desc,
legalPersonMail,
legalPersonPhone,
infoChangeOptionType:INFOCHANGEAPPLYTYPE.待审批, infoChangeOptionType:INFOCHANGEAPPLYTYPE.待审批,
createTimeMs:new Date().valueOf() createTimeMs:new Date().valueOf()
}; };
await updateOneData(TABLEENUM.用户表, {userId}, {infoChangeId:applyInfo.infoChangeId, infoChangeOptionType:INFOCHANGEAPPLYTYPE.待审批}); await updateOneData(TABLEENUM.用户表, {userId}, {infoChangeId:applyInfo.infoChangeId, infoChangeMs:new Date().valueOf(), infoChangeOptionType:INFOCHANGEAPPLYTYPE.待审批});
await addOneData(TABLEENUM.资料变更审批历史表, applyInfo); await addOneData(TABLEENUM.资料变更审批历史表, applyInfo);
return successResult(); return successResult();
...@@ -638,6 +642,7 @@ export async function infomationChangeInfo({userId}) { ...@@ -638,6 +642,7 @@ export async function infomationChangeInfo({userId}) {
let userInfo = await findOnce(TABLEENUM.用户表, {userId}); let userInfo = await findOnce(TABLEENUM.用户表, {userId});
let dataInfo:any = {}; let dataInfo:any = {};
let isUpdate = true;
//这里的条件有点乱,因为加班到很晚了 //这里的条件有点乱,因为加班到很晚了
if (!userInfo.infoChangeId || (userInfo.infoChangeId && userInfo.infoChangeOptionType == INFOCHANGEAPPLYTYPE.通过)) { if (!userInfo.infoChangeId || (userInfo.infoChangeId && userInfo.infoChangeOptionType == INFOCHANGEAPPLYTYPE.通过)) {
let userInfo = await findOnce(TABLEENUM.用户表, {userId}); let userInfo = await findOnce(TABLEENUM.用户表, {userId});
...@@ -650,7 +655,11 @@ export async function infomationChangeInfo({userId}) { ...@@ -650,7 +655,11 @@ export async function infomationChangeInfo({userId}) {
uusinessLicenseUrl:userInfo.uusinessLicenseUrl || "",//营业执照 uusinessLicenseUrl:userInfo.uusinessLicenseUrl || "",//营业执照
applicationForm:userInfo.applicationForm || "",//盖章申请表 applicationForm:userInfo.applicationForm || "",//盖章申请表
desc:"", desc:"",
yuanXiaoBanXueLeiXing:userInfo.yuanXiaoBanXueLeiXing || "",
legalPersonMail:userInfo.legalPersonMail,
legalPersonPhone:userInfo.legalPersonPhone,
}; };
isUpdate = true;
} else { } else {
let infomationChangeHistoryInfo = await findOnceToSort(TABLEENUM.资料变更审批历史表, {userId}, {createTimeMs:-1}); let infomationChangeHistoryInfo = await findOnceToSort(TABLEENUM.资料变更审批历史表, {userId}, {createTimeMs:-1});
dataInfo = { dataInfo = {
...@@ -660,8 +669,15 @@ export async function infomationChangeInfo({userId}) { ...@@ -660,8 +669,15 @@ export async function infomationChangeInfo({userId}) {
unitMemberType:infomationChangeHistoryInfo.unitMemberType,//单位会员类型 unitMemberType:infomationChangeHistoryInfo.unitMemberType,//单位会员类型
uusinessLicenseUrl:infomationChangeHistoryInfo.uusinessLicenseUrl,//营业执照 uusinessLicenseUrl:infomationChangeHistoryInfo.uusinessLicenseUrl,//营业执照
applicationForm:infomationChangeHistoryInfo.applicationForm,//盖章申请表 applicationForm:infomationChangeHistoryInfo.applicationForm,//盖章申请表
desc:infomationChangeHistoryInfo.desc desc:infomationChangeHistoryInfo.desc,
yuanXiaoBanXueLeiXing:infomationChangeHistoryInfo.yuanXiaoBanXueLeiXing,
legalPersonMail:infomationChangeHistoryInfo.legalPersonMail,
legalPersonPhone:infomationChangeHistoryInfo.legalPersonPhone,
}; };
if (infomationChangeHistoryInfo.infoChangeOptionType == INFOCHANGEAPPLYTYPE.待审批) {
isUpdate = false;
}
else isUpdate = true;
} }
const UnitConfig = ["unitMemberType", "yuanXiaoBanXueLeiXing", "yuanXiaoZhuGuanBuMen", "yuanXiaoFuZeRen", "yuanXiaoFuZeRenZhiWu", "yuanXiaoBanGongFuZeRenZhiWu", const UnitConfig = ["unitMemberType", "yuanXiaoBanXueLeiXing", "yuanXiaoZhuGuanBuMen", "yuanXiaoFuZeRen", "yuanXiaoFuZeRenZhiWu", "yuanXiaoBanGongFuZeRenZhiWu",
"yuanXiaoFuZeRenDianHua", "yuanXiaoBanGongFuZeRen", "yuanXiaoBanGongFuZeRenDianHua", "ZhuYaoFuZeRenYouXiang", "yuanXiaoKeYanFuZeRen", "yuanXiaoKeYanFuZeRenDianHua", "yuanXiaoFuZeRenDianHua", "yuanXiaoBanGongFuZeRen", "yuanXiaoBanGongFuZeRenDianHua", "ZhuYaoFuZeRenYouXiang", "yuanXiaoKeYanFuZeRen", "yuanXiaoKeYanFuZeRenDianHua",
...@@ -672,11 +688,6 @@ export async function infomationChangeInfo({userId}) { ...@@ -672,11 +688,6 @@ export async function infomationChangeInfo({userId}) {
if (unitInfo.yuanXiaoBanXueLeiXing) unitInfo.yuanXiaoBanXueLeiXing = changeEnumValue(BANXUELEIXING, unitInfo.yuanXiaoBanXueLeiXing); if (unitInfo.yuanXiaoBanXueLeiXing) unitInfo.yuanXiaoBanXueLeiXing = changeEnumValue(BANXUELEIXING, unitInfo.yuanXiaoBanXueLeiXing);
dataInfo.unitInfo = unitInfo; dataInfo.unitInfo = unitInfo;
dataInfo.isUpdate = isUpdate;
return {dataInfo}; return {dataInfo};
} }
\ No newline at end of file
...@@ -7,7 +7,7 @@ import { generateOrderId, successResult } from "../../tools/system"; ...@@ -7,7 +7,7 @@ import { generateOrderId, successResult } from "../../tools/system";
import { changeEnumValue, eccEnumValue } from "../../util/verificationEnum"; import { changeEnumValue, eccEnumValue } from "../../util/verificationEnum";
import { addOneData } from "../../data/add"; import { addOneData } from "../../data/add";
import { TABLEENUM } from "../../data/models/model"; import { TABLEENUM } from "../../data/models/model";
import { find, findCount, findOnce, findOnceToSort, findToPage, findToSortToPage } from "../../data/select"; import { find, findCount, findOnce, findOnceToSort, findToPage, findToSort, findToSortToPage } from "../../data/select";
import { extractData } from "../../util/piecemeal"; import { extractData } from "../../util/piecemeal";
import { BizError } from "../../util/bizError"; import { BizError } from "../../util/bizError";
import { ERRORENUM } from "../../config/errorEnum"; import { ERRORENUM } from "../../config/errorEnum";
...@@ -328,7 +328,7 @@ export async function applicationInadvanceInvoiceInfo({id}) { ...@@ -328,7 +328,7 @@ export async function applicationInadvanceInvoiceInfo({id}) {
let orderInfo = await findOnce(TABLEENUM.订单表, {id}, ["id", "userId", "invoiceMail", "desc", "invoiceStatus", "state"]); let orderInfo = await findOnce(TABLEENUM.订单表, {id}, ["id", "userId", "invoiceMail", "desc", "invoiceStatus", "state"]);
if (!orderInfo || !orderInfo.id) throw new BizError(ERRORENUM.目标数据不存在); if (!orderInfo || !orderInfo.id) throw new BizError(ERRORENUM.目标数据不存在);
let userInfo = await findOnce(TABLEENUM.用户表, {userId:orderInfo.userId}, ["userId", "memberType", "mail", "unitMemberType"]); let userInfo = await findOnce(TABLEENUM.用户表, {userId:orderInfo.userId}, ["userId", "memberType", "mail", "unitMemberType", "unit", "uscc", "unitName"]);
if (userInfo.memberType != MEMBERTYPE.单位会员) { if (userInfo.memberType != MEMBERTYPE.单位会员) {
throw new BizError(ERRORENUM.发票已发送至邮请注意查看); throw new BizError(ERRORENUM.发票已发送至邮请注意查看);
}else if (orderInfo.state == ORDERSTATE.未支付 && userInfo.unitMemberType != UNITMEMBERTYPE.院校) { }else if (orderInfo.state == ORDERSTATE.未支付 && userInfo.unitMemberType != UNITMEMBERTYPE.院校) {
...@@ -336,8 +336,10 @@ export async function applicationInadvanceInvoiceInfo({id}) { ...@@ -336,8 +336,10 @@ export async function applicationInadvanceInvoiceInfo({id}) {
} }
let resultObj = { let resultObj = {
invoiceMail: orderInfo.invoiceMail || userInfo.mail || "", invoiceMail: orderInfo.invoiceMail || "",
desc:orderInfo.desc || "" desc:orderInfo.desc || "",
uscc:userInfo.uscc,
unitName:userInfo.unitName
} }
return resultObj; return resultObj;
...@@ -391,7 +393,7 @@ export async function getInvoiceStatus({id}) { ...@@ -391,7 +393,7 @@ export async function getInvoiceStatus({id}) {
if (oldInfo.invoiceStatus != INVOICESTATUS.退回) dataInfo.state = AUDITINGCLIENT.审核失败; if (oldInfo.invoiceStatus != INVOICESTATUS.退回) dataInfo.state = AUDITINGCLIENT.审核失败;
/**获取驳回理由 */ /**获取驳回理由 */
let userOldInfo = await findOnceToSort(TABLEENUM.审批历史表, {userId:oldInfo.userId, operationBehavior:OPERATIONREHAVIOR.驳回修改},{operationTime:-1}, ["userId", "remarks"]); let userOldInfo = await findOnceToSort(TABLEENUM.订单审批历史表, {userId:oldInfo.userId, operationBehavior:OPERATIONREHAVIOR.驳回修改},{operationTime:-1}, ["userId", "remarks"]);
if (userOldInfo && userOldInfo.userId) dataInfo.remark = userOldInfo.remark; if (userOldInfo && userOldInfo.userId) dataInfo.remark = userOldInfo.remark;
return {dataInfo}; return {dataInfo};
...@@ -416,7 +418,9 @@ export async function getInvoiceStatus({id}) { ...@@ -416,7 +418,9 @@ export async function getInvoiceStatus({id}) {
payTime:new Date().valueOf(), payTime:new Date().valueOf(),
confirmReceipt:RECEIPTCONFIRMATION.待确认, confirmReceipt:RECEIPTCONFIRMATION.待确认,
invoiceMail, invoiceMail,
desc desc,
invoiceStatus:INVOICESTATUS.未开发票,
advanceInvoice:true
}; };
await updateOneData(TABLEENUM.订单表, {id}, updateInfo); await updateOneData(TABLEENUM.订单表, {id}, updateInfo);
...@@ -444,21 +448,40 @@ export async function reasonInfo({id}) { ...@@ -444,21 +448,40 @@ export async function reasonInfo({id}) {
if ( orderInfo.confirmReceipt != RECEIPTCONFIRMATION.退回) throw new BizError(ERRORENUM.该订单未被退回); if ( orderInfo.confirmReceipt != RECEIPTCONFIRMATION.退回) throw new BizError(ERRORENUM.该订单未被退回);
let logInfo = await findOnceToSort(TABLEENUM.订单审批历史表, {operationBehavior:ORDEREXAMINE.用户提交}, {operationTime:-1}); let logInfoList = await findToSort(TABLEENUM.订单审批历史表, {orderId:id}, {operationTime:-1});
let dataInfo = { let dataList = [];
operationTime:moment(logInfo.operationTime).format("YYYY/MM/DD HH:mm:SS"), logInfoList.forEach(info => {
behavior:"退回", let isReceiveMoney = info.isReceiveMoney ? "已到款项" : "未到款项";
isReceiveMoney:logInfo.isReceiveMoney ? "已到款项" : "未到款项",
remarks:logInfo.remarks let remarks = info.remarks
}; if (info.operationBehavior == ORDEREXAMINE.退款申请) {
isReceiveMoney = "-";
if (info.refundName) remarks += `-${info.refundName}`;
if (info.refundBankNum) remarks += `-${info.refundBankNum}`;
if (info.refundBankName) remarks += `-${info.refundBankName}`;
} else if (info.operationBehavior == ORDEREXAMINE.用户提交) {
isReceiveMoney = "-";
}
return {dataList:[dataInfo]}; let dataInfo = {
operationTime:moment(info.operationTime).format("YYYY/MM/DD HH:mm:SS"),
behavior:changeEnumValue(ORDEREXAMINE, info.operationBehavior),
isReceiveMoney,
remarks
};
dataList.push(dataInfo);
})
let isUpdate = true;
if ( orderInfo.isReplenishReturnInfo && orderInfo.refundReject == false ) isUpdate = false;
return {dataList:dataList, isUpdate};
} }
/** /**
* 退款信息 * 退款信息更新
* @param param0 * @param param0
*/ */
export async function accountInfo({id, form}) { export async function accountInfo({id, form}) {
...@@ -473,7 +496,8 @@ export async function accountInfo({id, form}) { ...@@ -473,7 +496,8 @@ export async function accountInfo({id, form}) {
refundBankCarId : form.refundBankCarId, refundBankCarId : form.refundBankCarId,
refundBankName : form.refundBankName, refundBankName : form.refundBankName,
refundDesc : form.refundDesc, refundDesc : form.refundDesc,
isReplenishReturnInfo:true isReplenishReturnInfo:true,
refundReject:false
}; };
await updateOneData(TABLEENUM.订单表, {id}, updateInfo ); await updateOneData(TABLEENUM.订单表, {id}, updateInfo );
...@@ -483,7 +507,10 @@ export async function accountInfo({id, form}) { ...@@ -483,7 +507,10 @@ export async function accountInfo({id, form}) {
orderId:id, orderId:id,
operationTime:new Date().valueOf(), operationTime:new Date().valueOf(),
operationBehavior:ORDEREXAMINE.退款申请, operationBehavior:ORDEREXAMINE.退款申请,
remarks:`${form.refundDesc}` remarks:`${form.refundDesc}`,
refundName:form.refundName,
refundBankNum:form.refundBankCarId,
refundBankName:form.refundBankName
}; };
await addOneData(TABLEENUM.订单审批历史表, addLogInfo ); await addOneData(TABLEENUM.订单审批历史表, addLogInfo );
...@@ -497,7 +524,7 @@ export async function accountInfo({id, form}) { ...@@ -497,7 +524,7 @@ export async function accountInfo({id, form}) {
*/ */
export async function refundList({name, memberType, joinStartTime, joinEndTime, pageNumber}) { export async function refundList({name, memberType, joinStartTime, joinEndTime, pageNumber}) {
let findParam:any = { let findParam:any = {
isReceive:{"$ne":null} isReceive:{"$gt":0}
}; };
/**用户表查询条件 */ /**用户表查询条件 */
...@@ -562,7 +589,7 @@ export async function refundList({name, memberType, joinStartTime, joinEndTime, ...@@ -562,7 +589,7 @@ export async function refundList({name, memberType, joinStartTime, joinEndTime,
} }
} }
if (!info.isReplenishReturnInfo) itemData.state = "资料补充中"; if (!info.isReplenishReturnInfo || (info.refundReject== true && !info.refundSuccessful)) itemData.state = "资料补充中";
else { else {
if (info.refundSuccessful) itemData.state = "已退款"; if (info.refundSuccessful) itemData.state = "已退款";
else itemData.state = "待退款"; else itemData.state = "待退款";
...@@ -659,6 +686,33 @@ export async function refundApprove({id, refundImgUrl}) { ...@@ -659,6 +686,33 @@ export async function refundApprove({id, refundImgUrl}) {
return {dataList}; return {dataList};
} }
/**
* 退款驳回
*/
export async function refundOut({id, desc}) {
let orderInfo = await findOnce(TABLEENUM.订单表, {id});
if (!orderInfo || !orderInfo.id ) throw new BizError(ERRORENUM.目标数据不存在);
// if (orderInfo.isFirst && !orderInfo.firstPayExamine ) throw new BizError(ERRORENUM.重复提交, '发票管理-财务核对页-收款确认', `提交通过时订单未通过待支付页的校验`);
if (orderInfo.confirmReceipt != RECEIPTCONFIRMATION.退回) throw new BizError(ERRORENUM.订单非退回状态, '发票管理-退款列表页-退款确认', `退款确认时订单已经不是退款状态 是${orderInfo.confirmReceipt}`);
if (orderInfo.paymentMethod == PAYMENTTYPE.微信支付) throw new BizError(ERRORENUM.微信支付无法被退回);
if (orderInfo.isReceive != ISRECEIVE.提供账户_zkh需退款_ykh) throw new BizError(ERRORENUM.该类型退款无需确认);
let updateInfo:any = {refundSuccessful:false,isReplenishReturnInfo:false, refundReject:true};
await updateOneData(TABLEENUM.订单表, {id}, updateInfo);
//添加日志
let addLogInfo = {
orderId:id,
operationTime:new Date().valueOf(),
operationBehavior:ORDEREXAMINE.驳回,
isReceiveMoney:true,
remarks:desc,
};
await addOneData(TABLEENUM.订单审批历史表, addLogInfo );
return successResult();
}
/** /**
...@@ -674,8 +728,13 @@ export async function approveLog({id}) { ...@@ -674,8 +728,13 @@ export async function approveLog({id}) {
let desc = ""; let desc = "";
if (operationBehavior == ORDEREXAMINE.用户提交) desc = "线下付款"; if (operationBehavior == ORDEREXAMINE.用户提交) desc = "线下付款";
else { else {
desc = isReceiveMoney ? changeEnumValue(ISRECEIVE, ISRECEIVE.未收到款项_xg其他) : changeEnumValue(ISRECEIVE, ISRECEIVE.提供账户_zkh需退款_ykh) if (isReceiveMoney) {
} desc = "未收到"
} else {
desc = "已收到"
}
// desc = isReceiveMoney ? changeEnumValue(ISRECEIVE, ISRECEIVE.未收到款项_xg其他) : changeEnumValue(ISRECEIVE, ISRECEIVE.提供账户_zkh需退款_ykh)
}
let addInfo:any = { let addInfo:any = {
operationTime:moment(operationTime).format("YYYY-MM-DD HH:mm:SS"), operationTime:moment(operationTime).format("YYYY-MM-DD HH:mm:SS"),
operationBehavior:changeEnumValue(ORDEREXAMINE, operationBehavior), operationBehavior:changeEnumValue(ORDEREXAMINE, operationBehavior),
......
...@@ -86,7 +86,7 @@ enum TABLEENUM { ...@@ -86,7 +86,7 @@ enum TABLEENUM {
订单表 = 'order', 订单表 = 'order',
单位所获得科研成果表 = "scientificResearch", 单位所获得科研成果表 = "scientificResearch",
验证码表 = "code", 验证码表 = "code",
审批历史表 = "approvalHistory", 审批历史表 = "approvalHistory",//审批会员用的
权限表 = "authority", 权限表 = "authority",
订单审批历史表 = "orderApprovalHistory", 订单审批历史表 = "orderApprovalHistory",
标签表 = "lable", 标签表 = "lable",
...@@ -457,6 +457,7 @@ const ModelArray = [ ...@@ -457,6 +457,7 @@ const ModelArray = [
rejectRemarks:'String',//变更理事驳回理由 rejectRemarks:'String',//变更理事驳回理由
applyId:{ type:'String', index:true }, applyId:{ type:'String', index:true },
infoChangeId:{type:"String", index:true},//资料更新关联id infoChangeId:{type:"String", index:true},//资料更新关联id
infoChangeMs:{type:"Number"},//资料更新申请时间
infoChangeOptionType:{type:"Number"}//INFOCHANGEAPPLYTYPE infoChangeOptionType:{type:"Number"}//INFOCHANGEAPPLYTYPE
} }
}, },
...@@ -517,7 +518,9 @@ const ModelArray = [ ...@@ -517,7 +518,9 @@ const ModelArray = [
refundDesc:"String", refundDesc:"String",
isReplenishReturnInfo:{type:'Boolean', default:false},//是否补充退款信息 isReplenishReturnInfo:{type:'Boolean', default:false},//是否补充退款信息
//
refundSuccessful:{type:"Boolean", default:false},//退款确认 refundSuccessful:{type:"Boolean", default:false},//退款确认
refundReject:{type:"Boolean", default:false},//退款驳回 true = 被驳回
refundImgUrl:"String", refundImgUrl:"String",
//新加的状态 //新加的状态
isSueInvoicesInAdvance:{type:"Boolean", default:false},//提前开票 弃用 isSueInvoicesInAdvance:{type:"Boolean", default:false},//提前开票 弃用
...@@ -627,8 +630,11 @@ const ModelArray = [ ...@@ -627,8 +630,11 @@ const ModelArray = [
operationBehavior:{ type:'Number'},//操作行为 枚举 ORDEREXAMINE operationBehavior:{ type:'Number'},//操作行为 枚举 ORDEREXAMINE
isReceiveMoney:{type:'Boolean', default:false},//是否收到款项 isReceiveMoney:{type:'Boolean', default:false},//是否收到款项
remarks:{ type:'String' },//备注 remarks:{ type:'String' },//备注
refundImgUrl:"String"//退款确认发票地址 refundImgUrl:"String",//退款确认发票地址
//退款信息
refundName:"String",//退款姓名
refundBankNum:"String",//银行账号
refundBankName:"String",//银行开户行
} }
}, },
{ {
...@@ -661,6 +667,9 @@ const ModelArray = [ ...@@ -661,6 +667,9 @@ const ModelArray = [
uusinessLicenseUrl:"String",//营业执照 uusinessLicenseUrl:"String",//营业执照
applicationForm:"String",//盖章申请表 applicationForm:"String",//盖章申请表
desc:"String",//描述 desc:"String",//描述
legalPersonMail:"String",//法人邮箱
legalPersonPhone:"String",//法人电话
yuanXiaoBanXueLeiXing:'Number',//办学类型
rejectRemarks:'String',//变更驳回理由 rejectRemarks:'String',//变更驳回理由
createTimeMs:'Number',//日志时间 createTimeMs:'Number',//日志时间
} }
......
import moment = require("moment");
import { initActivity } from "./biz/member/msgActivity"; import { initActivity } from "./biz/member/msgActivity";
import { createOrder } from "./biz/member/order";
import { initAdmin } from "./biz/member/rightsMgmt";
import { t } from "./biz/provide";
import { initSaveUnsubmitted } from "./biz/register"; import { initSaveUnsubmitted } from "./biz/register";
import { initSMS } from "./biz/sms"; import { initSMS } from "./biz/sms";
import { initSystemTask } from "./biz/task"; import { initSystemTask } from "./biz/task";
import { initConfig, systemConfig} from "./config/serverConfig"; import { initConfig, systemConfig} from "./config/serverConfig";
import { initDataBaseModel } from "./data/db/db"; import { initDataBaseModel } from "./data/db/db";
import { test } from "./httpTOhttps";
import { httpServer } from "./net/http_server"; import { httpServer } from "./net/http_server";
async function lanuch() { async function lanuch() {
...@@ -32,7 +27,8 @@ async function lanuch() { ...@@ -32,7 +27,8 @@ async function lanuch() {
// await test(); // await test();
// console.log(moment(1498262400000).format("YYYY-MM-DD HH:mm:SS")) // console.log(moment(1498262400000).format("YYYY-MM-DD HH:mm:SS"))
console.log("服务初始化成功"); console.log("服务初始化成功");
// await testCallback("aeaa2492b585abd2bcfe4302a59bccb4")
} }
lanuch(); lanuch();
......
...@@ -1023,9 +1023,12 @@ export const Config = { ...@@ -1023,9 +1023,12 @@ export const Config = {
{key:"uscc", type:"String", desc:"统一信用代码"}, {key:"uscc", type:"String", desc:"统一信用代码"},
{key:"legalPerson", type:"String", desc:"法人代表"}, {key:"legalPerson", type:"String", desc:"法人代表"},
{key:"unitMemberType", type:"Number", desc:"单位会员类型"}, {key:"unitMemberType", type:"Number", desc:"单位会员类型"},
{key:"yuanXiaoBanXueLeiXing", type:"Number", desc:"帮学类型"},
{key:"uusinessLicenseUrl", type:"String", desc:"营业执照"}, {key:"uusinessLicenseUrl", type:"String", desc:"营业执照"},
{key:"applicationForm", type:"String", desc:"盖章申请表"}, {key:"applicationForm", type:"String", desc:"盖章申请表"},
{key:"desc", type:"String", desc:"描述位"} {key:"desc", type:"String", desc:"描述位"},
{key:"legalPersonMail", type:"String", desc:"法人邮件"},
{key:"legalPersonPhone", type:"String", desc:"法人电话"},
], ],
bindBiz:homePageBiz.infomationChangeUpdate bindBiz:homePageBiz.infomationChangeUpdate
}, },
......
...@@ -87,6 +87,14 @@ export const Config = { ...@@ -87,6 +87,14 @@ export const Config = {
bindBiz:costVerificationBiz.confirmReceiptPass bindBiz:costVerificationBiz.confirmReceiptPass
}, },
{ {
apiName:"财务核对-批量收款确认",
subUrl:'/order/invoice/examine/manypass',
param:[
{key:"idList", type:"[String]", desc:"订单id"}
],
bindBiz:costVerificationBiz.confirmReceiptManyPass
},
{
apiName:"财务核对-退回", apiName:"财务核对-退回",
subUrl:'/order/invoice/examine/out', subUrl:'/order/invoice/examine/out',
param:[ param:[
...@@ -226,6 +234,15 @@ export const Config = { ...@@ -226,6 +234,15 @@ export const Config = {
bindBiz:orderBiz.refundApprove bindBiz:orderBiz.refundApprove
}, },
{ {
apiName:"退款驳回",
subUrl:'/order/refundout',
param:[
{key:"id", type:"String", desc:"订单id"},
{key:"desc", type:"String", desc:"备注"},
],
bindBiz:orderBiz.refundOut
},
{
apiName:"退款列表-数据导出", apiName:"退款列表-数据导出",
subUrl:'/order/invoice/examine/outputrefund', subUrl:'/order/invoice/examine/outputrefund',
param:[ param:[
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment