var system = require("../../../system");
const CtlBase = require("../../ctl.base");

/**
 *  @module agriculture
 *  @class servicelistCtl
 *  服务单ctl
 */

class servicebillCtl extends CtlBase {
    constructor() {
        super("agriculture", CtlBase.getServiceName(servicebillCtl));
    }

    async create(obj) {
        const res = await this.service.findOne({ bizId: obj.bizId });
        if (res != null) {
            return system.getResult({ massage: "该服务单已创建" });
        }
        const cre_res = await this.service.create(obj);
        return system.getResult(cre_res);
    }

    async updateStatus(obj) {
        const rs = await this.service.updateStatus(obj);
        return system.getResult(rs);
    }

    async updateAndPush(obj) {
        const rs = await this.service.updateAndPush(obj);
        return system.getResult(rs);
    }

    async updateAndFeedback(obj) {
        const rs = await this.service.updateAndFeedback(obj);
        return system.getResult(rs);
    }
}
module.exports = servicebillCtl;