package com.palmnest.webapp.controller.backstage;

import com.alibaba.fastjson.JSON;
import com.palmnest.application.AppConstants;
import com.palmnest.application.CodeConstants;
import com.palmnest.application.bean.AppResultDto;
import com.palmnest.application.bean.Page;
import com.palmnest.application.core.util.AppResultUtil;
import com.palmnest.application.core.util.LogExceptionStackUtil;
import com.palmnest.application.dto.ConditionerAddTimeOrderFeeVO;
import com.palmnest.application.dto.OrgDto;
import com.palmnest.application.dto.WebPageResultDto;
import com.palmnest.application.dto.input.AirConditionerAddTimeInputDto;
import com.palmnest.application.dto.input.ConditionerAddTimeOrderUpdateParam;
import com.palmnest.application.dto.output.AirConditionerAddTimeOutDto;
import com.palmnest.application.dto.output.AirConditionerAddTimeOutWebVO;
import com.palmnest.model.AppUserFloorRelation;
import com.palmnest.model.RoomInfo;
import com.palmnest.model.User;
import com.palmnest.model.property.VirtualArchitecture;
import com.palmnest.service.AppUserService;
import com.palmnest.service.UserManager;
import com.palmnest.service.estateserve.FloorInfoManager;
import com.palmnest.service.estateserve.VirtualArchManager;
import com.palmnest.service.estateserve.airconditioner.ConditionerAddTimeService;
import com.palmnest.service.estateserve.airconditioner.ProjectConfigService;
import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSONObject;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ExtendedModelMap;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


//PC端
@Slf4j
@Controller
@RequestMapping(value = "/air")
public class AirConditionerAddTimeController {


	@Autowired
	private ConditionerAddTimeService conditionerAddTimeService;

	@Autowired
	private ProjectConfigService projectConfigService;

	@Autowired
	private UserManager userManager;


	@Autowired
	private FloorInfoManager floorInfoManager;

	@Autowired
	private AppUserService appUserService;
	
	@Autowired
	private VirtualArchManager          virtualArchManager;

	/**
	 * @param request
	 * @return 空调加时列表
	 */
	@RequestMapping(value = "/list")
	@ResponseBody
	public WebPageResultDto list(HttpServletRequest request) {

		log.info("WxAirConditionerAddTimeController list======");

		try {

			User user = (User) request.getSession().getAttribute("UserCache");
			String              orgId  = request.getParameter("orgId");

			User userAir21 = userManager.findByFunctionAndUser(CodeConstants.CSP21_PERMISSION, user.getId());
			User userAir22 = userManager.findByFunctionAndUser(CodeConstants.CSP22_PERMISSION, user.getId());
			User userAir23 = userManager.findByFunctionAndUser(CodeConstants.CSP23_PERMISSION, user.getId());

			//空调加时审批权限
			String airAuditPermission = "0";//当前角色待审批的数据
			String airAuditRoleId     = "0";
			/*if (userAir21 != null) {
				airAuditPermission = GoodsCodeConstants.AIR_AUDITKE.toString();
				Role role = userManager.findRoleByFunctionAndUser(CodeConstants.CSP21_PERMISSION, user.getId());
				airAuditRoleId = role.getId().toString();
			}
			if (userAir22 != null) {
				//airAuditPermission=airAuditPermission+";"+GoodsCodeConstants.AIR_AUDITKEL.toString();
				airAuditPermission = GoodsCodeConstants.AIR_AUDITKEL.toString();

				Role role = userManager.findRoleByFunctionAndUser(CodeConstants.CSP22_PERMISSION, user.getId());
				airAuditRoleId = role.getId().toString();
			}
			if (userAir23 != null) {
				//airAuditPermission=airAuditPermission+";"+GoodsCodeConstants.AIR_AUDITGZL.toString();
				airAuditPermission = GoodsCodeConstants.AIR_AUDITGZL.toString();

				Role role = userManager.findRoleByFunctionAndUser(CodeConstants.CSP23_PERMISSION, user.getId());
				airAuditRoleId = role.getId().toString();
			}*/

			String                     roleToFloorIds = "";//角色对应楼层
			List<AppUserFloorRelation> userFloorList  = userManager.getAppUserFloorByUserId(Integer.parseInt(user.getId().toString()), Integer.parseInt(airAuditRoleId));
			if (userFloorList != null && userFloorList.size() > 0) {
				for (int i = 0; i < userFloorList.size(); i++) {
					AppUserFloorRelation userFloor = userFloorList.get(i);
					if (null != userFloor.getFloor_id()) {
						roleToFloorIds += userFloor.getFloor_id().toString() + ",";
					}
				}
			}
			if (StringUtils.isNotEmpty(roleToFloorIds)) {
				roleToFloorIds = roleToFloorIds.replaceAll("[,]$", "");
			}


			int                 pageSize = Integer.parseInt(request.getParameter("pageSize"));
			int                 pageNo   = Integer.parseInt(request.getParameter("pageNo"));
			Map<String, Object> params   = new HashMap<String, Object>();
			//String openId = request.getParameter("openId");
			String status      = request.getParameter("status");
			String code        = request.getParameter("code");
			String companyName = request.getParameter("companyName");
			//String virtualId=request.getParameter("virtualId");//企业Id
			List<OrgDto> organizationList = appUserService.getUserOrgs(user.getId());
			String       organizationId   = "";

/*			if(org.apache.commons.lang3.StringUtils.isEmpty(orgId)){
				if (organizationList.size() >= 1) {
					organizationId = organizationList.get(0).getId().toString();
				}
			}else{
				organizationId = orgId;
			}*/
			if(StringUtils.isNotEmpty(orgId)){
				organizationId = orgId;
			}

			params.put("status", status);
			params.put("code", code);
			params.put("companyName", companyName);
			params.put("organizationId", organizationId);
			params.put("startTime", request.getParameter("startTime"));
			params.put("endTime", request.getParameter("endTime"));
			
			
			params.put("useStartTime", request.getParameter("useStartTime"));
			params.put("useEndTime", request.getParameter("useEndTime"));
			
			params.put("airAuditPermission", airAuditPermission);
			params.put("roleToFloorIds", roleToFloorIds);
			params.put("billFrom", CodeConstants.PC);

			Page             page = conditionerAddTimeService.findPageBy(params, pageSize, pageNo);
			WebPageResultDto dto  = new WebPageResultDto(AppConstants.SUCCESS_CODE, "成功", page.getItems());
			dto.setCount(page.getTotalCount());
			return dto;
		} catch (Exception e) {
			e.printStackTrace();
			return new WebPageResultDto(AppConstants.REPAIR_BILL_LIST_ERROR, "查询列表失败", LogExceptionStackUtil.LogExceptionStack(e));
		}
	}

	/**
	 * @return 查找维修单详情
	 */
	@RequestMapping(value = "/getRuleByOrgId")
	@ResponseBody
	public AppResultDto getRuleByOrgId(HttpServletRequest request,@RequestParam("orgId") Long orgId) {

		log.info("AirConditionerAddTimeController getRuleByOrgId======");

		User         user             = (User) request.getSession().getAttribute("UserCache");
		List<OrgDto> organizationList = appUserService.getUserOrgs(user.getId());
		if (organizationList.size() >= 1) {
			orgId = Long.valueOf(organizationList.get(0).getId().toString());
		}	
		
		return AppResultUtil.createSuccesDto(conditionerAddTimeService.getRuleByOrgId(orgId));
	}

	/**
	 * @param request
	 * @return 空调加时列表
	 */
	@RequestMapping(value = "/reportList")
	@ResponseBody
	public WebPageResultDto reportList(HttpServletRequest request) {

		log.info("WxAirConditionerAddTimeController list======");

		try {

			int                 pageSize    = Integer.parseInt(request.getParameter("pageSize"));
			int                 pageNo      = Integer.parseInt(request.getParameter("pageNo"));
			Map<String, Object> params      = new HashMap<String, Object>();
			String              reportTime  = request.getParameter("reportTime");
			String              companyName = request.getParameter("companyName");
			String              orgId = request.getParameter("orgId");

			User         user             = (User) request.getSession().getAttribute("UserCache");
			List<OrgDto> organizationList = appUserService.getUserOrgs(user.getId());
			String       organizationId   = "";
			//if (organizationList.size() >= 1) {
			//	organizationId = organizationList.get(0).getId().toString();
			//}
			if(StringUtils.isNotEmpty(orgId)){
				organizationId = orgId;
			}

			params.put("reportTime", reportTime);
			params.put("companyName", companyName);
			params.put("organizationId", organizationId);

			Page             page = conditionerAddTimeService.reportFindPageBy(params, pageSize, pageNo);
			WebPageResultDto dto  = new WebPageResultDto(AppConstants.SUCCESS_CODE, "成功", page.getItems());
			dto.setCount(page.getTotalCount());
			return dto;
		} catch (Exception e) {
			log.error("WxAirConditionerAddTimeController reportList error======", e);
			return new WebPageResultDto(AppConstants.REPAIR_BILL_LIST_ERROR, "查询列表失败", LogExceptionStackUtil.LogExceptionStack(e));
		}
	}

	/**
	 * 空调加时报表excel导出
	 *
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/exportReportList")
	@ResponseBody
	public AppResultDto exportReportList(HttpServletRequest request) {
		Map<String, Object> params      = new HashMap<String, Object>();
		String              reportTime  = request.getParameter("reportTime");
		String              companyName = request.getParameter("companyName");

		User         user             = (User) request.getSession().getAttribute("UserCache");
		List<OrgDto> organizationList = appUserService.getUserOrgs(user.getId());
		String       organizationId   = "#";
		if (organizationList.size() >= 1) {
			organizationId = organizationList.get(0).getId().toString();
		}

		params.put("reportTime", reportTime);
		params.put("companyName", companyName);
		params.put("organizationId", organizationId);
		return conditionerAddTimeService.exportReportList(params);
	}
	
	
	

	/**
	 * @param request
	 * @return 空调加时列表
	 */
	@RequestMapping(value = "/reportDetailList")
	@ResponseBody
	public WebPageResultDto reportDetailList(HttpServletRequest request) {

		log.info("WxAirConditionerAddTimeController list======");

		try {

			int                 pageSize   = Integer.parseInt(request.getParameter("pageSize"));
			int                 pageNo     = Integer.parseInt(request.getParameter("pageNo"));
			Map<String, Object> params     = new HashMap<String, Object>();
			String              reportTime = request.getParameter("reportTime");
			String              virtualId  = request.getParameter("virtualId");

			params.put("reportTime", reportTime);
			params.put("virtualId", virtualId);

			User         user             = (User) request.getSession().getAttribute("UserCache");
			List<OrgDto> organizationList = appUserService.getUserOrgs(user.getId());
			String       organizationId   = "#";
			if (organizationList.size() >= 1) {
				organizationId = organizationList.get(0).getId().toString();
			}
			params.put("organizationId", organizationId);

			Page             page = conditionerAddTimeService.reportDetailFindPageBy(params, pageSize, pageNo);
			WebPageResultDto dto  = new WebPageResultDto(AppConstants.SUCCESS_CODE, "成功", page.getItems());
			dto.setCount(page.getTotalCount());
			return dto;
		} catch (Exception e) {
			e.printStackTrace();
			return new WebPageResultDto(AppConstants.REPAIR_BILL_LIST_ERROR, "查询列表失败", LogExceptionStackUtil.LogExceptionStack(e));
		}
	}
	
	
	/**
	 * 导出申请管理
	 *
	 * @param orgId
	 * @param dateType
	 * @param date
	 * @param endDate
	 * @return
	 */
	@RequestMapping(value = "exportDetailList")
	@ResponseBody
	public AppResultDto exportApplyManage(HttpServletRequest request) {

		int                 pageSize   = Integer.parseInt(request.getParameter("pageSize"));
		int                 pageNo     = Integer.parseInt(request.getParameter("pageNo"));
		Map<String, Object> params     = new HashMap<String, Object>();
		String              reportTime = request.getParameter("reportTime");
		String              virtualId  = request.getParameter("virtualId");

		params.put("reportTime", reportTime);
		params.put("virtualId", virtualId);

		User         user             = (User) request.getSession().getAttribute("UserCache");
		List<OrgDto> organizationList = appUserService.getUserOrgs(user.getId());
		String       organizationId   = "#";
		if (organizationList.size() >= 1) {
			organizationId = organizationList.get(0).getId().toString();
		}
		params.put("organizationId", organizationId);
		

		return conditionerAddTimeService.exportDetailList(params);
	}
	
	
	/**
	 * 获得空调加时费用明细汇总数据
	 *
	 * @param orgId
	 * @param dateType
	 * @param date
	 * @param endDate
	 * @return
	 */
	@RequestMapping(value = "getDetailListData")
	@ResponseBody
	public AppResultDto getDetailListData(HttpServletRequest request) {

		int                 pageSize   = Integer.parseInt(request.getParameter("pageSize"));
		int                 pageNo     = Integer.parseInt(request.getParameter("pageNo"));
		Map<String, Object> params     = new HashMap<String, Object>();
		String              reportTime = request.getParameter("reportTime");
		String              virtualId  = request.getParameter("virtualId");

		params.put("reportTime", reportTime);
		params.put("virtualId", virtualId);

		User         user             = (User) request.getSession().getAttribute("UserCache");
		List<OrgDto> organizationList = appUserService.getUserOrgs(user.getId());
		String       organizationId   = "#";
		if (organizationList.size() >= 1) {
			organizationId = organizationList.get(0).getId().toString();
		}
		params.put("organizationId", organizationId);
		
		
		Page             page = conditionerAddTimeService.reportDetailFindPageBy(params, 10000, 1);
		List<Map<String, Object>> list  = page.getItems();
		
		
		BigDecimal freeTotal = BigDecimal.ZERO;
		for (Map<String, Object> map : list) {
			System.out.println("===>"+ map.get("freeTotal"));
			BigDecimal temp_freeTotal = (BigDecimal)map.get("freeTotal");
			freeTotal =  freeTotal.add(temp_freeTotal);
		}
		
		
		
		JSONObject ob = new JSONObject();
		ob.put("virName", "");
		ob.put("roomNo", "");
		VirtualArchitecture virInfo = virtualArchManager.get(Integer.valueOf(virtualId));
		if(null != virInfo){
			ob.put("virName", virInfo.getName());
			ob.put("roomNo", virInfo.getRoomNames());
		}
		
		ob.put("queryDate", reportTime);
		ob.put("billNum",page.getTotalCount());
		ob.put("totalFree", freeTotal.setScale(2,4));
		

		return AppResultUtil.createSuccesDto(ob);
	}

	/**
	 * @param request
	 * @return 查找维修单详情
	 */
	@RequestMapping(value = "/getDetail")
	@ResponseBody
	public AppResultDto getDetail(@RequestParam("id") Long id) {
		log.info("ApiContractInformationController getDetail======");
		AirConditionerAddTimeOutDto dto = conditionerAddTimeService.findById(id);
		AirConditionerAddTimeOutWebVO vo = conditionerAddTimeService.assembleOrderHistory(dto);
		return AppResultUtil.createSuccesDto(vo);
	}

	/**
	 * 同意放行
	 */
	@RequestMapping(value = "/audit")
	@ResponseBody
	public AppResultDto audit(@ModelAttribute("airConditionerAddTimeInputDto") AirConditionerAddTimeInputDto dto, HttpServletRequest request) {
		log.info("ApiGoodsReleaseController agree======");

		dto.setBillFrom(CodeConstants.PC);
		return conditionerAddTimeService.audit(dto, request);
	}

	/**
	 * 同意放行
	 */
	@RequestMapping(value = "/cancel")
	@ResponseBody
	public AppResultDto cancel(@ModelAttribute("airConditionerAddTimeInputDto") AirConditionerAddTimeInputDto dto, HttpServletRequest request) {
		log.info("ApiGoodsReleaseController agree======");

		dto.setBillFrom(CodeConstants.PC);
		return conditionerAddTimeService.cancel(dto, request);
	}

	/**
	 * 空调开关人员
	 *
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/getAirSwitchUser")
	@ResponseBody
	public AppResultDto getAirSwitchUser(HttpServletRequest request) {


		User         userPc           = (User) request.getSession().getAttribute("UserCache");
		List<OrgDto> organizationList = appUserService.getUserOrgs(userPc.getId());
		Integer      organizationId   = 0;
		if (organizationList.size() >= 1) {
			organizationId = organizationList.get(0).getId();
		}

		//空调开关人员
		List<User> users = userManager.findByFunctionGeneral(organizationId, CodeConstants.AIRSWITCH_PERMISSION);

		List<JSONObject> usersList = new ArrayList<JSONObject>();
		for (User user : users) {
			JSONObject usrsMap = new JSONObject();
			usrsMap.put("switchUserId", user.getId().toString());
			usrsMap.put("name", user.getFullName());
			usrsMap.put("telephone", user.getTelephone());
			usersList.add(usrsMap);
		}

		return AppResultUtil.createSuccesDto(usersList);
	}


	/**
	 * 使用规则设置
	 *
	 * @return
	 */
	@RequestMapping(value = "/usingSetting")
	public ModelAndView usingSetting(HttpServletRequest request,
			HttpServletResponse response) {
		//报修方式 区域 类型 小类型
		Model model = new ExtendedModelMap();
		/*List<Element> repairWayGroup = elementGroupManager.getElementsByGroupName("repairWayGroup");
		List<Element> repairAreaGroup = elementGroupManager.getElementsByGroupName("repairAreaGroup");
		List<Element> repairTypeGroup = elementGroupManager.getElementsByGroupName("repairTypeGroup");
		model.addAttribute("repairWayGroup", elementGroupManager.convert(repairWayGroup));
		model.addAttribute("repairAreaGroup", elementGroupManager.convert(repairAreaGroup));
		model.addAttribute("repairTypeGroup", elementGroupManager.convert(repairTypeGroup));

		if(repairTypeGroup.size()>0) {
			List<Element> repairTypeaDetailGroup = elementGroupManager.getElementsByGroupName(repairTypeGroup.get(0).getItemcode());
			model.addAttribute("repairTypeaDetailGroup", elementGroupManager.convert(repairTypeaDetailGroup));
		}*/

		//申请类型
		//List<Element> releaseTypeGroup = elementGroupManager.getElementsByGroupName("releaseTypeGroup");
		//model.addAttribute("releaseTypeGroup", releaseTypeGroup);

		User  user  = (User) request.getSession().getAttribute("UserCache");//----------联调时需放开注释
		//页面项目列表
		List<OrgDto> dtos = appUserService.getUserOrgs(user.getId());

		//构建项目id字符串
		String orgStr = "";
		if (!user.isAdmin()) {
			//如果当前登录用户不为admin或者系统管理员,则需要按项目查询
			if (dtos != null && dtos.size() > 0) {
				for (OrgDto org : dtos) {
					orgStr += "," + org.getId();
				}
				orgStr = orgStr.substring(1);
			}
		}
		model.addAttribute("orgs", dtos);

		if(null != user){
			model.addAttribute("userType", user.getUserType());
		}
		return new ModelAndView("/admin/airConditionalManage/usingSetting", model.asMap());
	}

	/**
	 * 空调加时管理
	 *
	 * @return
	 */
	@RequestMapping(value = "/overtimeManage")
	public ModelAndView overtimeManage(HttpServletRequest request) {
		//报修方式 区域 类型 小类型
		Model model = new ExtendedModelMap();
		/*List<Element> repairWayGroup = elementGroupManager.getElementsByGroupName("repairWayGroup");
		List<Element> repairAreaGroup = elementGroupManager.getElementsByGroupName("repairAreaGroup");
		List<Element> repairTypeGroup = elementGroupManager.getElementsByGroupName("repairTypeGroup");
		model.addAttribute("repairWayGroup", elementGroupManager.convert(repairWayGroup));
		model.addAttribute("repairAreaGroup", elementGroupManager.convert(repairAreaGroup));
		model.addAttribute("repairTypeGroup", elementGroupManager.convert(repairTypeGroup));
		
		if(repairTypeGroup.size()>0) {
			List<Element> repairTypeaDetailGroup = elementGroupManager.getElementsByGroupName(repairTypeGroup.get(0).getItemcode());
			model.addAttribute("repairTypeaDetailGroup", elementGroupManager.convert(repairTypeaDetailGroup));
		}*/

		//申请类型
		//List<Element> releaseTypeGroup = elementGroupManager.getElementsByGroupName("releaseTypeGroup");
		//model.addAttribute("releaseTypeGroup", releaseTypeGroup);

		User  user  = (User) request.getSession().getAttribute("UserCache");//----------联调时需放开注释
		//页面项目列表
		List<OrgDto> dtos = appUserService.getUserOrgs(user.getId());

		//构建项目id字符串
		String orgStr = "";
		if (!user.isAdmin()) {
			//如果当前登录用户不为admin或者系统管理员,则需要按项目查询
			if (dtos != null && dtos.size() > 0) {
				for (OrgDto org : dtos) {
					orgStr += "," + org.getId();
				}
				orgStr = orgStr.substring(1);
			}
		}
		model.addAttribute("orgs", dtos);

		if(null != user) {
			model.addAttribute("userType", user.getUserType());

		}

		return new ModelAndView("/admin/airConditionalManage/overtimeManage", model.asMap());
	}

	/**
	 * 空调加时报表
	 *
	 * @return
	 */
	@RequestMapping(value = "/overtimeReport")
	public ModelAndView overtimeReport(HttpServletRequest request) {
		//报修方式 区域 类型 小类型
		Model model = new ExtendedModelMap();
		/*List<Element> repairWayGroup = elementGroupManager.getElementsByGroupName("repairWayGroup");
		List<Element> repairAreaGroup = elementGroupManager.getElementsByGroupName("repairAreaGroup");
		List<Element> repairTypeGroup = elementGroupManager.getElementsByGroupName("repairTypeGroup");
		model.addAttribute("repairWayGroup", elementGroupManager.convert(repairWayGroup));
		model.addAttribute("repairAreaGroup", elementGroupManager.convert(repairAreaGroup));
		model.addAttribute("repairTypeGroup", elementGroupManager.convert(repairTypeGroup));
		
		if(repairTypeGroup.size()>0) {
			List<Element> repairTypeaDetailGroup = elementGroupManager.getElementsByGroupName(repairTypeGroup.get(0).getItemcode());
			model.addAttribute("repairTypeaDetailGroup", elementGroupManager.convert(repairTypeaDetailGroup));
		}*/

		//申请类型
		//List<Element> releaseTypeGroup = elementGroupManager.getElementsByGroupName("releaseTypeGroup");
		//model.addAttribute("releaseTypeGroup", releaseTypeGroup);

			User  user  = (User) request.getSession().getAttribute("UserCache");//----------联调时需放开注释
			//页面项目列表
			List<OrgDto> dtos = appUserService.getUserOrgs(user.getId());

			//构建项目id字符串
			String orgStr = "";
			if (!user.isAdmin()) {
				//如果当前登录用户不为admin或者系统管理员,则需要按项目查询
				if (dtos != null && dtos.size() > 0) {
					for (OrgDto org : dtos) {
						orgStr += "," + org.getId();
					}
					orgStr = orgStr.substring(1);
				}
			}
			model.addAttribute("orgs", dtos);

			if(null != user) {
				model.addAttribute("userType", user.getUserType());
			}

		return new ModelAndView("/admin/airConditionalManage/overtimeReport", model.asMap());
	}

	/**
	 * 获取空调加时订单下单时 所有可用的房间信息
	 * @param orderNo 空调加时订单编号
	 * @return 房间信息列表
	 */
	@RequestMapping(value = "/addTimeOrderHistoryRooms", method = RequestMethod.GET)
	@ResponseBody
	public AppResultDto getAddTimeOrderHistoryRooms(@RequestParam("orderNo") String orderNo, HttpServletRequest request) {
		User  user  = (User) request.getSession().getAttribute("UserCache");
		log.info("获取空调加时订单下单时 所有可用的房间信息, user: {}, orderNo:{}", user.getFullName(), orderNo);
		List<RoomInfo> list = conditionerAddTimeService.getAddTimeOrderHistoryRooms(orderNo);
		return AppResultUtil.createSuccesDto(list);
	}

	/**
	 * 修改空调加时订单时 计算费用
	 * @param order 修改的订单信息
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/calcAddTimeOrderFee")
	@ResponseBody
	public AppResultDto calcAddTimeOrderFee(@ModelAttribute ConditionerAddTimeOrderUpdateParam order, HttpServletRequest request) {
		User  user  = (User) request.getSession().getAttribute("UserCache");
		log.info("更新空调加时订单前计算费用, user: {}, order:{}", user.getFullName(), JSON.toJSONString(order));
		ConditionerAddTimeOrderFeeVO vo = conditionerAddTimeService.calcAddTimeOrderFee(order);
		return AppResultUtil.createSuccesDto(vo);
	}

	/**
	 * 更新空调加时订单
	 * @param order
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "updateAddTimeOrder")
	@ResponseBody
	public AppResultDto updateAddTimeOrder(@ModelAttribute ConditionerAddTimeOrderUpdateParam order, HttpServletRequest request) {
		User  user  = (User) request.getSession().getAttribute("UserCache");
		log.info("更新空调加时订单, user: {}, order:{}", user.getFullName(), JSON.toJSONString(order));
		conditionerAddTimeService.updateAddTimeOrder(order, user);
		return AppResultUtil.createSuccesDto();
	}
}
