package com.kingdee.eas.custom.dormitorysystem.service;

import com.kingdee.bos.BOSException;
import com.kingdee.bos.Context;
import com.kingdee.bos.bsf.service.app.IHRMsfService;
import com.kingdee.bos.metadata.entity.FilterInfo;
import com.kingdee.eas.common.EASBizException;
import com.kingdee.eas.custom.dormitorysystem.waterpower.utils.WaterPowerUtil;
import com.kingdee.shr.base.syssetting.exception.SHRWebException;
import com.kingdee.shr.base.syssetting.web.json.JSONUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Map;



/**
 * 获取房间最后一次水电表读数服务
 */
public class GetLastMWaterPowerService  implements IHRMsfService {
    private static final Logger logger = LoggerFactory.getLogger(GetLastMWaterPowerService.class);

    @Override
    public Object process(Context ctx, Map<String, Object> param) throws EASBizException, BOSException {
        if (ctx == null) {
            throw new BOSException("上下文Context不能为空");
        }
        String roomId = (String) param.get("roomId");//宿舍编码
        String years = (String) param.get("years");//年月
        if (StringUtils.isNotBlank(roomId) && StringUtils.isNotBlank(years)) {
            Map lastWaterPowerTons = WaterPowerUtil.getLastWaterPowerTons(ctx, years, roomId);
            return lastWaterPowerTons;
        }
        return null;
    }
}



