package com.jwipc.spe.controller;

import com.jwipc.spe.dto.QmNoticeOrderDTO;
import com.jwipc.spe.entity.QmNoticeOrder;
import com.jwipc.spe.logic.QmNoticeOrderLogic;
import lombok.RequiredArgsConstructor;
import org.apache.calcite.avatica.proto.Common;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

import static com.jwipc.spe.constant.ModuleConst.MODULE_ROOT;

/**
 * @author Al
 * @create 2024-03-14 11:46
 */
@Controller
@RequestMapping(MODULE_ROOT + "/qualityManage/examineQualityManage")
@RequiredArgsConstructor
public class ExamineQualityManagePageController {
    private final QmNoticeOrderLogic qmNoticeOrderLogic;
    /**
     * 质量整改视图
     */
    @RequestMapping("/index")
    public String listUI() {
        return MODULE_ROOT + "/qualityManage/examineQualityManage/list";
    }

    /**
     * 质量整改初审视图
     */
    @RequestMapping("detail")
    public String examinationUI(Model model, Long id) {
        QmNoticeOrder noticeOrder = new QmNoticeOrder();
        noticeOrder.setId(id);
        QmNoticeOrderDTO qmNoticeOrderFormMapDTO = qmNoticeOrderLogic.getById(id);
        model.addAttribute("qmNoticeOrderFormMap",qmNoticeOrderFormMapDTO);
        //noticeOrderFormMap.put("data_type",1);
        qmNoticeOrderFormMapDTO.setId(id);
        //附件信息
//        model.addAttribute("fjlist",noticeOrderAttachmentService.getAttachment(noticeOrderFormMap));
//        noticeOrderFormMap.put("data_type",2);
//        noticeOrderFormMap.put("id",id);
//        Supplier supplier = supplierDataService.findBySupplierCode(noticeOrderFormMap.getStr("supplier_code"));
//        //是否外包
//        model.addAttribute("isexternal", supplier.getIsexternal());
//        //附件信息
//        List<String> idList = noticeOrderService.findAllId(id);
//        noticeOrderFormMap.put("idList",idList);
//        model.addAttribute("rmafjlist",noticeOrderAttachmentService.getAttachmentByIdList(noticeOrderFormMap));
        return MODULE_ROOT + "/qualityManage/examineQualityManage/detail";
    }
}
