ReCalcDataController.java 1.52 KB
package com.bsth.controller.realcontrol.calc;

import com.bsth.common.ResponseCode;
import com.bsth.util.HttpClientUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

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

/**
 * 重新统计(数据汇总)
 * Created by panzhao on 2018/1/25.
 */
@RestController
@RequestMapping("/sch/reCalc")
public class ReCalcDataController {

//    private static String reCalcUrl = "http://10.10.150.24:30571/reCalc/scheduleDetail";
    private static String reCalcUrl = "http://127.0.0.1:30571/reCalc/scheduleDetail";

    Logger logger = LoggerFactory.getLogger(this.getClass());

    /**
     * 重新统计班次明细
     * @param date
     * @param line
     * @return
     */
    @RequestMapping(value = "/scheduleDetail", method = RequestMethod.POST)
    public Map<String, Object> reCalcScheduleDetail(@RequestParam String date, @RequestParam String line){
        Map<String, Object> rs = new HashMap();
        try{
            HttpClientUtils.post(reCalcUrl + "?rq=" + date + "&lineCode=" + line, "");
        }catch (Exception e){
            logger.error("", e);
            rs.put("status", ResponseCode.ERROR);
            rs.put("msg", e.getMessage());
        }
        return rs;
    }
}