TTInfoDetailController.java 1.76 KB
package com.bsth.controller.schedule;

import com.bsth.common.ResponseCode;
import com.bsth.controller.BaseController;
import com.bsth.entity.schedule.TTInfoDetail;
import com.bsth.service.schedule.TTInfoDetailServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by xu on 16/7/2.
 */
@RestController
@RequestMapping("tidc")
public class TTInfoDetailController extends BaseController<TTInfoDetail, Long> {
    @Autowired
    private TTInfoDetailServiceImpl ttInfoDetailService;

    @RequestMapping(value = "/dataImportExtend", method = RequestMethod.POST)
    public Map<String, Object> uploadDataAndImport(
            MultipartFile file, String xlmc, String ttinfoname, String tccname) throws Exception {
        Map<String, Object> resultMap = new HashMap<>();

        try {
            ttInfoDetailService.fileDataImport(file, xlmc, ttinfoname, tccname);
            resultMap.put("status", ResponseCode.SUCCESS);
            resultMap.put("msg", "导入成功");
        } catch (Exception exp) {
            exp.printStackTrace();
            throw exp;
        }

        return resultMap;
    }

    @RequestMapping(value = "/edit/{ttid}", method = RequestMethod.GET)
    public Object getEditInfo(@PathVariable("ttid") Long ttid) throws Exception {
        // TODO:返回类型需要修正
        return ttInfoDetailService.getEditInfo(ttid);
    }
}