package com.huigou.topsun.proofing.controller;

import com.huigou.topsun.product.application.ProductApplication;
import com.huigou.topsun.proofing.domain.model.ProofingApply;
import com.huigou.topsun.proofing.domain.model.WorkInstrcutionApply;
import com.huigou.topsun.proofing.service.WorkInstrcutionApplyService;
import com.huigou.topsun.resource.vo.ResourceTypeVo;
import com.huigou.uasp.annotation.ControllerMapping;
import com.huigou.uasp.client.CommonController;
import com.huigou.util.SDO;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.UUID;


@Controller
@ControllerMapping("/workInstrcutionApply")
public class WorkInstrcutionApplyController extends CommonController {

    protected String getPagePath() {
        return "/biz/topsun/proofing/";
    }

    @Autowired
    ProductApplication productApplication;
    @Autowired
    WorkInstrcutionApplyService workInstrcutionApplyService;


    public String forwardWorkInstrcutionApply(){
        String proofingMakeNo = UUID.randomUUID().toString().replace("-", "");
        this.putAttribute("proofingMakeNo", proofingMakeNo);
        return forward("workInstrcutionApply");
    }

    public String queryWorkInstrcutionApply() {
        SDO sdo = this.getSDO();
        String productId = sdo.getString("productId");
        return toResult(null);
    }

    /**
     * 添加指导申请书
     */
    public String saveWorkInstrcutionApply(){
        SDO sdo = this.getSDO();
        WorkInstrcutionApply workInstrcutionApply = sdo.toObject(WorkInstrcutionApply.class);
        workInstrcutionApplyService.saveWorkInstrcutionApply(workInstrcutionApply);
        return toResult(workInstrcutionApply);
    }

}

