package com.engine.htsc.lhccsq.web;

import com.alibaba.fastjson.JSONObject;
import com.engine.common.util.ServiceUtil;
import com.engine.htsc.lhccsq.service.ComputerSubsidyService;
import com.engine.htsc.lhccsq.service.impl.ComputerSubsidyServiceImpl;

import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.Map;

public class ComputeTravelSubsidy {

    private ComputerSubsidyService getService(){
        return ServiceUtil.getService(ComputerSubsidyServiceImpl.class);
    }

    /**
     * 所有出差申请（2021-09-01至今，所有无自付费用带报销的联合出差申请），出差补贴重新计算，计算结果放入新字段（cb_bak）中
     * @param request
     * @return
     */
    @GET
    @Path("/computeExsitSubsidy")
    @Produces({MediaType.APPLICATION_JSON})
    public String computeExsitSubsidy(@Context HttpServletRequest request){
        Map<String,Object> result = getService().computeExsitSubsidy();
        return JSONObject.toJSONString(result);
    }
}
