Commit 4e7286aa by 蒋勇

d

parent 78d5d964
......@@ -12,17 +12,19 @@ class SettleBillCtl extends CtlBase {
async advice(p,q,req){
let sid= p.advice.settleId
let msg=p.advice.memo
let rtn=await this.service.advice(sid,msg)
let userid=p.userid
let userName=p.username
let rtn=await this.service.advice(sid,msg,userid,userName)
return system.getResult(rtn)
}
async auditPass(p,q,req){
let sid= p.pass.settleId
let rtn=await this.service.auditPass(sid)
let rtn=await this.service.auditPass(sid,p.userid,p.username)
return system.getResult(rtn)
}
async pay(p,q,req){
let sid= p.pay.settleId
let rtn=await this.service.pay(sid)
let rtn=await this.service.pay(sid,p.userid,p.username)
return system.getResult(rtn)
}
}
......
......@@ -10,7 +10,7 @@ module.exports = (db, DataTypes) => {
allowNull: true,
type: DataTypes.STRING
},
audited: {// 审核状态
auditedStatus: {// 审核状态
type:DataTypes.BOOLEAN,
defaultValue: false
},
......@@ -18,7 +18,7 @@ module.exports = (db, DataTypes) => {
allowNull: true,
type: DataTypes.INTEGER
},
isPayed:{
isPayedStatus:{
type:DataTypes.BOOLEAN,
defaultValue: false
},
......@@ -26,13 +26,29 @@ module.exports = (db, DataTypes) => {
allowNull: true,
type:DataTypes.STRING,
},
creator_id:{
creator_id:{//申请人
allowNull: true,
type: DataTypes.INTEGER
},
creator:{
allowNull: true,
type: DataTypes.STRING,
},
auditor_id:{//审核人
allowNull: true,
type: DataTypes.INTEGER
},
auditor:{//审核人
allowNull: true,
type: DataTypes.STRING,
},
payer_id:{//付款人
allowNull: true,
type: DataTypes.INTEGER
},
payer:{
allowNull: true,
type: DataTypes.STRING,
}
}, {
paranoid: true,//真的删除
......
......@@ -7,32 +7,38 @@ class SettleBillService extends ServiceBase {
super("bizchance", ServiceBase.getDaoName(SettleBillService));
this.deliverbillDao=system.getObject("db.bizchance.deliverybillDao")
}
async advice(id,msg){
async advice(id,msg,userId,userName){
var self=this
return this.db.transaction(async function (t){
//先按照ids查询出交付单的合计服务成本
let st=await self.dao.findById(id,{transaction:t})
st.auditor_id=userId
st.auditor=userName
st.memo=msg
await st.save({transaction:t})
return st
});
}
async auditPass(settleId){
async auditPass(settleId,userId,userName){
var self=this
return this.db.transaction(async function (t){
//先按照ids查询出交付单的合计服务成本
let st=await self.dao.findById(settleId,{transaction:t})
st.audited=true
st.auditedStatus=true
st.auditor_id=userId
st.auditor=userName
await st.save({transaction:t})
return st
});
}
async pay(settleId){
async pay(settleId,userId,userName){
var self=this
return this.db.transaction(async function (t){
//先按照ids查询出交付单的合计服务成本
let st=await self.dao.findById(settleId,{transaction:t})
st.isPayed=true
st.isPayedStatus=true
st.payer_id=userId
st.payer=userName
await st.save({transaction:t})
//改变所有交付单的结算settle_status settled ,
await self.deliverbillDao.updateByWhere({settle_status:'settled'}, { settlebill_id: st.id }, t);
......
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