PersonController.java 1.68 KB
package com.bsth.controller.basic;

import com.bsth.entity.Person;
import com.bsth.service.basic.PersonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * Created by panzhao on 2017/8/1.
 */
@RestController
@RequestMapping("person")
public class PersonController {

    @Autowired
    PersonService personService;

    @RequestMapping("list")
    public Map<String, Object> list(@RequestParam Map<String, Object> map,
                                    @RequestParam(defaultValue = "0") int page,
                                    @RequestParam(defaultValue = "10") int size){

        return personService.list(map, page, size);
    }

    @RequestMapping("{jobCode}")
    public Map<String, Object> findOne(@PathVariable("jobCode") String jobCode){
        return personService.findOne(jobCode);
    }

    @RequestMapping("parseFile")
    public Map<String, Object> parseFile(@RequestParam String base64,@RequestParam String fileName){
        return personService.parseFile(base64, fileName);
    }

    /**
     * 人卡数据批量save
     * @param jsonStr
     * @return
     */
    @RequestMapping(value = "multiSave" ,method = RequestMethod.POST)
    public Map<String, Object> multiSave(@RequestParam String jsonStr){
        return personService.multiSave(jsonStr);
    }

    @RequestMapping(value = "save" ,method = RequestMethod.POST)
    public Map<String, Object> save(Person p){
        return personService.save(p);
    }

    /**
     * 刷新人员数据
     */
    @RequestMapping(value = "refresh", method = RequestMethod.POST)
    public void refresh(){
        personService.refresh();
    }
}