2163 lines
98 KiB
Java
2163 lines
98 KiB
Java
package com.zzc.web.htoal.controller;
|
||
|
||
import java.net.URLEncoder;
|
||
import java.security.spec.ECPrivateKeySpec;
|
||
import java.text.DecimalFormat;
|
||
import java.text.SimpleDateFormat;
|
||
import java.util.ArrayList;
|
||
import java.util.Calendar;
|
||
import java.util.Date;
|
||
import java.util.HashMap;
|
||
import java.util.List;
|
||
import java.util.Map;
|
||
|
||
import javax.servlet.http.HttpServletRequest;
|
||
import javax.servlet.http.HttpServletResponse;
|
||
|
||
import org.apache.log4j.Logger;
|
||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||
import org.hibernate.criterion.Restrictions;
|
||
import org.springframework.beans.factory.annotation.Autowired;
|
||
import org.springframework.context.annotation.Scope;
|
||
import org.springframework.stereotype.Controller;
|
||
import org.springframework.ui.ModelMap;
|
||
import org.springframework.web.bind.annotation.RequestBody;
|
||
import org.springframework.web.bind.annotation.RequestMapping;
|
||
import org.springframework.web.bind.annotation.ResponseBody;
|
||
import org.springframework.web.servlet.ModelAndView;
|
||
|
||
import com.zzc.core.common.controller.BaseController;
|
||
import com.zzc.core.common.hibernate.qbc.CriteriaQuery;
|
||
import com.zzc.core.common.model.json.AjaxJson;
|
||
import com.zzc.core.common.model.json.DataGrid;
|
||
import com.zzc.core.constant.Globals;
|
||
import com.zzc.core.util.ResourceUtil;
|
||
import com.zzc.core.util.StringUtil;
|
||
import com.zzc.poi.excel.entity.ExportParams;
|
||
import com.zzc.poi.excel.entity.vo.NormalExcelConstants;
|
||
import com.zzc.tag.core.easyui.TagUtil;
|
||
import com.zzc.web.export.ExportService;
|
||
import com.zzc.web.export.POIUtils;
|
||
import com.zzc.web.htoal.entity.HotelMonthly;
|
||
import com.zzc.web.htoal.entity.Hotelmanage;
|
||
import com.zzc.web.htoal.entity.HotelmanageSta;
|
||
import com.zzc.web.htoal.service.HotelProvinceService;
|
||
import com.zzc.web.htoal.service.Hotelservice;
|
||
import com.zzc.web.sylyUtils.ExplorerHelper;
|
||
import com.zzc.web.sylyUtils.HotelGrade;
|
||
import com.zzc.web.sylyUtils.ReportTimeCheck;
|
||
import com.zzc.web.sylyUtils.Status;
|
||
import com.zzc.web.sylyUtils.TimeUtils;
|
||
import com.zzc.web.sylyUtils.UserScoreUtils;
|
||
import com.zzc.web.system.pojo.base.TSUser;
|
||
import com.zzc.web.system.service.SystemService;
|
||
|
||
/**
|
||
*
|
||
*
|
||
* @date: 2016年11月29日
|
||
* @Author: 龙亚辉
|
||
* @Email: 502230926@qq.com
|
||
* @FileName: HotelMonthly.java
|
||
* @Version: 1.0
|
||
* @About: 酒店住宿情况月报
|
||
* @
|
||
*/
|
||
@Scope("prototype")
|
||
@Controller
|
||
@RequestMapping("/hotelMonthlyController")
|
||
public class HotelMonthlyController extends BaseController {
|
||
@SuppressWarnings("unused")
|
||
private static final Logger logger = Logger
|
||
.getLogger(HotelMonthlyController.class);
|
||
private String message = null;
|
||
private SystemService systemService;
|
||
// private String hid=null;
|
||
// 调用时间工具
|
||
TimeUtils timeUtils = new TimeUtils();
|
||
|
||
@Autowired
|
||
public void setSystemService(SystemService systemService) {
|
||
this.systemService = systemService;
|
||
}
|
||
|
||
private Hotelservice hotelservice;
|
||
|
||
@Autowired
|
||
public void setHotelservice(Hotelservice hotelservice) {
|
||
this.hotelservice = hotelservice;
|
||
}
|
||
|
||
private HotelProvinceService hotelProvinceService;
|
||
@Autowired
|
||
public void setHotelProvinceService(HotelProvinceService hotelProvinceService) {
|
||
this.hotelProvinceService = hotelProvinceService;
|
||
}
|
||
|
||
// 跳转到save页面
|
||
@RequestMapping(params = "addorupdate")
|
||
public ModelAndView hotelInfo(HttpServletRequest req) {
|
||
String hotelId = ResourceUtil.getSessionUserName().getId();
|
||
Hotelmanage hm = this.systemService.getEntity(Hotelmanage.class,
|
||
hotelId);
|
||
req.setAttribute("hotelmanage", hm);
|
||
|
||
Calendar calendar = Calendar.getInstance();
|
||
String year = "";
|
||
String month = "";
|
||
// 上个月是12月的情况
|
||
if (calendar.get(Calendar.MONTH) == 0) {
|
||
month = "12";
|
||
year = String.valueOf(calendar.get(Calendar.YEAR) - 1);
|
||
} else {
|
||
month = String.valueOf(calendar.get(Calendar.MONTH));
|
||
year = String.valueOf(calendar.get(Calendar.YEAR));
|
||
}
|
||
HotelMonthly hotelMonthly = new HotelMonthly();
|
||
hotelMonthly.setYear(year);
|
||
hotelMonthly.setMonth(month);
|
||
hotelMonthly.setFiller(hm.getManager());
|
||
hotelMonthly.setFillerTel(hm.getTelephone());
|
||
|
||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||
hotelMonthly.setReportDate(sdf.format(new Date()));
|
||
|
||
req.setAttribute("hotelMonthly", hotelMonthly);
|
||
if (hotelMonthly.getActualRentNum() != null && hotelMonthly.getRoomIncome() != null) {
|
||
double actualRentNum = Double.valueOf(hotelMonthly.getActualRentNum());
|
||
double roomIncome = Double.valueOf(hotelMonthly.getRoomIncome());
|
||
DecimalFormat df = new DecimalFormat("0.000");
|
||
if(roomIncome > 0 && actualRentNum > 0) {
|
||
double value = roomIncome/actualRentNum;
|
||
req.setAttribute("ratio", df.format(value));
|
||
}
|
||
}
|
||
return new ModelAndView("system/hotel/saveHotelMonthly");
|
||
}
|
||
|
||
// 月报跳转页面
|
||
@RequestMapping(params = "hotelMonth")
|
||
public ModelAndView role(HttpServletRequest request) {
|
||
String year = "";
|
||
String month = "";
|
||
Calendar calendar = Calendar.getInstance();
|
||
// 上个月是12月的情况
|
||
if (calendar.get(Calendar.MONTH) == 0) {
|
||
month = "12";
|
||
year = String.valueOf(calendar.get(Calendar.YEAR) - 1);
|
||
} else {
|
||
month = String.valueOf(calendar.get(Calendar.MONTH));
|
||
year = String.valueOf(calendar.get(Calendar.YEAR));
|
||
}
|
||
request.setAttribute("year", year);
|
||
request.setAttribute("month", month);
|
||
return new ModelAndView("system/hotel/hotelMonthList");
|
||
}
|
||
|
||
// 跳转到月报审核列表
|
||
@RequestMapping(params = "hotelMonthCheck")
|
||
public ModelAndView hotelMonthCheck() {
|
||
return new ModelAndView("system/hotel/hotelMonthCheckList");
|
||
}
|
||
|
||
@RequestMapping(params = "save")
|
||
@ResponseBody
|
||
public AjaxJson add(HotelMonthly hotelMonthly, HttpServletRequest request) {
|
||
AjaxJson j = new AjaxJson();
|
||
String tip = "添加成功!";
|
||
try {
|
||
// 新建判断
|
||
if (hotelMonthly.getId() == null
|
||
|| hotelMonthly.getId().length() == 0) {
|
||
hotelMonthly.setId(null);
|
||
if (this.isFilled()) {
|
||
j.setMsg("上月已填报月报!");
|
||
return j;
|
||
}
|
||
}
|
||
// 与酒店的id进行关联
|
||
TSUser user = ResourceUtil.getSessionUserName();
|
||
Hotelmanage hotelmanage = this.systemService.getEntity(
|
||
Hotelmanage.class, user.getId());
|
||
hotelMonthly.setHotelId(hotelmanage.getId());
|
||
// 设置审核状态
|
||
if (this.isDistrictManager()) {
|
||
hotelMonthly.setStatus(Status.noAudit);
|
||
hotelMonthly.setDistrictStatus(Status.passAudit);
|
||
hotelMonthly.setProvinceState(Status.noSumbit);
|
||
} else {
|
||
hotelMonthly.setStatus(Status.noAudit);
|
||
hotelMonthly.setDistrictStatus(Status.noAudit);
|
||
hotelMonthly.setProvinceState(Status.noSumbit);
|
||
}
|
||
|
||
hotelMonthly.setHotelmanage(hotelmanage);
|
||
// 新建判断
|
||
if (hotelMonthly.getId() == null
|
||
|| hotelMonthly.getId().length() == 0) {
|
||
// 加分
|
||
int year = Integer.parseInt(hotelMonthly.getYear());
|
||
int month = Integer.parseInt(hotelMonthly.getMonth());
|
||
boolean rs = ReportTimeCheck.monthTimeCheck(year, month, 3);
|
||
if (rs) {
|
||
hotelMonthly.setScore(5);
|
||
UserScoreUtils.scoreChange(5);
|
||
} else {
|
||
hotelMonthly.setScore(2);
|
||
UserScoreUtils.scoreChange(2);
|
||
}
|
||
}
|
||
|
||
// 计算年初至本月
|
||
|
||
Calendar calendar = Calendar.getInstance();
|
||
int year = calendar.get(Calendar.YEAR);
|
||
int month = calendar.get(Calendar.MONTH);
|
||
|
||
// 计算年初至本月的数据
|
||
hotelMonthly = this.calcTotal(hotelMonthly, user.getId());
|
||
|
||
systemService.saveOrUpdate(hotelMonthly);
|
||
systemService.addLog("填报酒店月报成功:"+hotelMonthly.getId(), Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
|
||
|
||
} catch (Exception e) {
|
||
e.printStackTrace();
|
||
j.setSuccess(false);
|
||
j.setMsg("填报失败:" + e.getMessage());
|
||
systemService.addLog("填报酒店月报失败:" + e.getMessage(), Globals.Log_Type_INSERT, Globals.Log_Leavel_ERROR);
|
||
return j;
|
||
}
|
||
j.setMsg(tip);
|
||
return j;
|
||
}
|
||
|
||
@RequestMapping(params = "editByUser")
|
||
public ModelAndView editByUser(HttpServletRequest request) {
|
||
|
||
String monthId = request.getParameter("monthId");
|
||
|
||
String hotelId = ResourceUtil.getSessionUserName().getId();
|
||
Hotelmanage hm = this.systemService.getEntity(Hotelmanage.class,
|
||
hotelId);
|
||
request.setAttribute("hotelmanage", hm);
|
||
|
||
HotelMonthly hotelMonthly = systemService.get(HotelMonthly.class,
|
||
monthId);
|
||
|
||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||
hotelMonthly.setReportDate(sdf.format(new Date()));
|
||
|
||
request.setAttribute("hotelMonthly", hotelMonthly);
|
||
if (hotelMonthly.getActualRentNum() != null && hotelMonthly.getRoomIncome() != null) {
|
||
double actualRentNum = Double.valueOf(hotelMonthly.getActualRentNum());
|
||
double roomIncome = Double.valueOf(hotelMonthly.getRoomIncome());
|
||
DecimalFormat df = new DecimalFormat("0.000");
|
||
if(roomIncome > 0 && actualRentNum > 0) {
|
||
double value = roomIncome/actualRentNum;
|
||
request.setAttribute("ratio", df.format(value));
|
||
}
|
||
}
|
||
return new ModelAndView("system/hotel/saveHotelMonthly");
|
||
}
|
||
|
||
// ******************代填报*********************************//
|
||
@RequestMapping(params = "saveDai")
|
||
@ResponseBody
|
||
public AjaxJson addDai(HotelMonthly hotelMonthly, HttpServletRequest request) {
|
||
AjaxJson j = new AjaxJson();
|
||
String tip = "添加成功!";
|
||
|
||
String isTemp = request.getParameter("isTemp");
|
||
|
||
// 重复校验
|
||
Calendar calendar = Calendar.getInstance();
|
||
String year = String.valueOf(calendar.get(Calendar.YEAR));
|
||
String month = String.valueOf(calendar.get(Calendar.MONTH));
|
||
if ("0".equals(month)) {
|
||
month = "12";
|
||
year = String.valueOf(calendar.get(Calendar.YEAR) - 1);
|
||
}
|
||
String sql = "select id from t_hotelmonthly t where t.`month`='"+ month + "' and t.`year`='" + year + "' and t.hotel_id = '"
|
||
+ hotelMonthly.getHotelId() + "'";
|
||
List<Map<String, Object>> list = systemService.findForJdbc(sql);
|
||
if(list.size() != 0) hotelMonthly.setId(list.get(0).get("id").toString());
|
||
|
||
try {
|
||
// 新建判断
|
||
if (hotelMonthly.getId() == null
|
||
|| hotelMonthly.getId().length() == 0)
|
||
hotelMonthly.setId(null);
|
||
Hotelmanage hotelmanage = this.systemService.getEntity(
|
||
Hotelmanage.class, hotelMonthly.getHotelId());
|
||
hotelMonthly.setHotelId(hotelmanage.getId());
|
||
|
||
// 设置审核状态
|
||
if(isTemp == null || isTemp.length() == 0){
|
||
// 判断是否区级审核
|
||
if (this.isDistrictManager()) {
|
||
hotelMonthly.setDistrictStatus(Status.passAudit);
|
||
hotelMonthly.setStatus(Status.noAudit);
|
||
hotelMonthly.setProvinceState(Status.noSumbit);
|
||
} else {
|
||
hotelMonthly.setStatus(Status.passAudit);
|
||
hotelMonthly.setDistrictStatus(Status.noAudit);
|
||
hotelMonthly.setProvinceState(Status.noSumbit);
|
||
}
|
||
}else{
|
||
hotelMonthly.setStatus(Status.noSumbit);
|
||
hotelMonthly.setDistrictStatus(Status.noSumbit);
|
||
hotelMonthly.setProvinceState(Status.noSumbit);
|
||
}
|
||
|
||
TSUser user = ResourceUtil.getSessionUserName();
|
||
hotelMonthly.setHotelmanage(hotelmanage);
|
||
|
||
// 计算年初至本月的数据
|
||
hotelMonthly = this.calcTotal(hotelMonthly, hotelMonthly.getHotelId());
|
||
|
||
systemService.saveOrUpdate(hotelMonthly);
|
||
systemService.addLog("代填报酒店月报成功:"+hotelMonthly.getId(), Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
|
||
|
||
} catch (Exception e) {
|
||
e.printStackTrace();
|
||
j.setSuccess(false);
|
||
j.setMsg("代填报失败:" + e.getMessage());
|
||
systemService.addLog("代填报酒店月报失败:" + e.getMessage(), Globals.Log_Type_INSERT, Globals.Log_Leavel_ERROR);
|
||
return j;
|
||
}
|
||
j.setMsg(tip);
|
||
return j;
|
||
}
|
||
|
||
@RequestMapping(params = "datagrid")
|
||
public void roleGrid(HotelMonthly hotelMonthly, HttpServletRequest request,
|
||
HttpServletResponse response, DataGrid dataGrid) {
|
||
CriteriaQuery cq = new CriteriaQuery(HotelMonthly.class, dataGrid);
|
||
// 获取当前登录用户ID
|
||
String userId = ResourceUtil.getSessionUserName().getId();
|
||
Map<String, Object> userMap = systemService
|
||
.findOneForJdbc(
|
||
"select rolename from t_s_role where id=(select roleid from t_s_role_user where userid=?)",
|
||
userId);
|
||
// 区级管理员做判断
|
||
if (userMap.get("rolename") != null
|
||
&& userMap.get("rolename").toString().contains("区级")) {
|
||
List<Map<String, Object>> list = systemService.findForJdbc(
|
||
"select id from t_hotelmanage where w_county=?",
|
||
ResourceUtil.getSessionUserName().getArea());
|
||
if (list.size() != 0) {
|
||
String[] parmas = new String[list.size()];
|
||
for (int i = 0; i < list.size(); i++) {
|
||
String id = list.get(i).get("id").toString();
|
||
parmas[i] = id;
|
||
}
|
||
cq.add(Restrictions.in("hotelId", parmas));
|
||
} else {
|
||
cq.add(Restrictions.in("hotelId", new Object[] { "" }));
|
||
}
|
||
}
|
||
// cq.add(Restrictions.eq("status",
|
||
// "4"),Restrictions.eq("districtStatus", "4"));
|
||
// cq.add(Restrictions.or(Restrictions.eq("status", "4"),
|
||
// Restrictions.eq("districtStatus", "4")));
|
||
// 默认显示为上月的报表
|
||
String year = request.getParameter("year");
|
||
String month = request.getParameter("month");
|
||
Calendar calendar = Calendar.getInstance();
|
||
// 上个月是12月的情况
|
||
if (year == null && month == null) {
|
||
if (calendar.get(Calendar.MONTH) == 0) {
|
||
month = "12";
|
||
year = String.valueOf(calendar.get(Calendar.YEAR) - 1);
|
||
} else {
|
||
month = String.valueOf(calendar.get(Calendar.MONTH));
|
||
year = String.valueOf(calendar.get(Calendar.YEAR));
|
||
}
|
||
}
|
||
|
||
cq.add(Restrictions.eq("year", year));
|
||
cq.add(Restrictions.eq("month", month));
|
||
// 查询条件
|
||
String hotelName = hotelMonthly.getHotelmanage() == null ? ""
|
||
: hotelMonthly.getHotelmanage().getUnitname();
|
||
/*
|
||
* String hotelType = hotelMonthly.getHotelmanage() == null ? "" :
|
||
* hotelMonthly.getHotelmanage().getHousegrade();
|
||
*/
|
||
String beginStar = request.getParameter("hotelmanage.housegrade_begin");
|
||
String endStar = request.getParameter("hotelmanage.housegrade_end");
|
||
String country = request.getParameter("hotelmanage.county");
|
||
String bay = request.getParameter("hotelmanage.bay");
|
||
String status = request.getParameter("status");
|
||
String provinceState = request.getParameter("provinceState");
|
||
if (hotelName != null && hotelName.length() != 0) {
|
||
cq.add(Restrictions
|
||
.sqlRestriction(" 1=1 and exists(select * from t_hotelmanage t where t.unitname like '%"
|
||
+ hotelName + "%' and t.id=hotel_id)"));
|
||
}
|
||
if (country != null && country.length() != 0) {
|
||
cq.add(Restrictions
|
||
.sqlRestriction(" 1=1 and exists(select * from t_hotelmanage t where t.w_county ="
|
||
+ country + " and t.id=hotel_id)"));
|
||
}
|
||
if (bay != null && bay.length() != 0) {
|
||
cq.add(Restrictions
|
||
.sqlRestriction(" 1=1 and exists(select * from t_hotelmanage t where t.bay_type ="
|
||
+ bay + " and t.id=hotel_id)"));
|
||
}
|
||
/*
|
||
* if(hotelType != null && hotelType.length() != 0){
|
||
* cq.add(Restrictions.sqlRestriction(
|
||
* " 1=1 and exists(select * from t_hotelmanage t where t.housegrade = '"
|
||
* +hotelType+"' and t.id=hotel_id)")); }
|
||
*/
|
||
if(beginStar!=null && beginStar.length()!=0){
|
||
cq.add(Restrictions
|
||
.sqlRestriction(" 1=1 and exists(select * from t_hotelmanage t where t.housegrade >= '"
|
||
+ beginStar
|
||
+ "' and t.id=hotel_id)"));
|
||
}
|
||
if(endStar!=null && endStar.length()!=0){
|
||
cq.add(Restrictions
|
||
.sqlRestriction(" 1=1 and exists(select * from t_hotelmanage t where t.housegrade <= '"
|
||
+ endStar
|
||
+ "' and t.id=hotel_id)"));
|
||
}
|
||
/*if (beginStar != null && beginStar.length() != 0 && endStar != null
|
||
&& endStar.length() != 0) {
|
||
cq.add(Restrictions
|
||
.sqlRestriction(" 1=1 and exists(select * from t_hotelmanage t where t.housegrade between '"
|
||
+ beginStar
|
||
+ "' and '"
|
||
+ endStar
|
||
+ "' and t.id=hotel_id)"));
|
||
}*/
|
||
if (status != null && status.length() != 0) {
|
||
cq.add(Restrictions.sqlRestriction("this_ .status =" + status));
|
||
}
|
||
if (provinceState != null && provinceState.length() != 0) {
|
||
cq.add(Restrictions.sqlRestriction("this_ .province_state ="
|
||
+ provinceState));
|
||
}
|
||
com.zzc.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq,
|
||
new HotelMonthly());
|
||
cq.add();
|
||
this.systemService.getDataGridReturn(cq, true);
|
||
TagUtil.datagrid(response, dataGrid);
|
||
}
|
||
|
||
// 删除月报
|
||
@RequestMapping(params = "del")
|
||
@ResponseBody
|
||
public AjaxJson del(HotelMonthly hotelMonthly, HttpServletRequest req) {
|
||
String id = req.getParameter("id");
|
||
AjaxJson j = new AjaxJson();
|
||
try {
|
||
hotelMonthly = hotelservice.getEntity(HotelMonthly.class, id);
|
||
hotelservice.delete(hotelMonthly);
|
||
message = "月报删除成功";
|
||
} catch (Exception e) {
|
||
message = "月报删除失败";
|
||
}
|
||
|
||
j.setMsg(message);
|
||
return j;
|
||
}
|
||
|
||
// 月报审核列表
|
||
// 酒店基本信息+月报信息,这个月审核上个月的信息
|
||
@RequestMapping(params = "monthdatagrid")
|
||
public void monthDatagrid(HotelMonthly hotelMonthly,
|
||
Hotelmanage hotelManage, HttpServletRequest request,
|
||
HttpServletResponse response, DataGrid dataGrid) {
|
||
// 根据datagrid查询酒店信息
|
||
CriteriaQuery cq = new CriteriaQuery(Hotelmanage.class, dataGrid);
|
||
|
||
/*cq.getDataGrid().setField(null);
|
||
cq.getDataGrid().setOrder(null);*/
|
||
|
||
// 获取上月神机箭
|
||
Calendar calendar = Calendar.getInstance();
|
||
String year = "";
|
||
String month = "";
|
||
String lastmonth = String.valueOf(calendar.get(Calendar.MONTH)-1);
|
||
// 上个月是12月的情况
|
||
if (calendar.get(Calendar.MONTH) == 0) {
|
||
month = "12";
|
||
year = String.valueOf(calendar.get(Calendar.YEAR) - 1);
|
||
} else {
|
||
month = String.valueOf(calendar.get(Calendar.MONTH));
|
||
year = String.valueOf(calendar.get(Calendar.YEAR));
|
||
}
|
||
// 获取当前登录用户ID
|
||
String userId = ResourceUtil.getSessionUserName().getId();
|
||
Map<String, Object> userMap = systemService
|
||
.findOneForJdbc(
|
||
"select rolename from t_s_role where id=(select roleid from t_s_role_user where userid=?)",
|
||
userId);
|
||
// 区级管理员做判断
|
||
if (userMap.get("rolename") != null
|
||
&& userMap.get("rolename").toString().contains("区级")) {
|
||
String countynum = ResourceUtil.getSessionUserName().getArea();
|
||
if (countynum.equals("460201"))
|
||
countynum = "0";
|
||
else if (countynum.equals("460205"))
|
||
countynum = "1";
|
||
else if (countynum.equals("460202"))
|
||
countynum = "2";
|
||
else if (countynum.equals("460204"))
|
||
countynum = "3";
|
||
else if (countynum.equals("460203"))
|
||
countynum = "4";
|
||
cq.add(Restrictions.eq("county", countynum));
|
||
}
|
||
if (hotelManage.getUnitname() != null
|
||
&& hotelManage.getUnitname().length() != 0) {
|
||
cq.add(Restrictions.like("unitname",
|
||
"%" + hotelManage.getUnitname() + "%"));
|
||
}
|
||
cq.add(Restrictions.in("sourceType", new Object[]{"1","3"}));
|
||
String beginStar = request.getParameter("housegrade_begin");
|
||
String endStar = request.getParameter("housegrade_end");
|
||
String country = request.getParameter("county");
|
||
String bay = request.getParameter("bay");
|
||
String status = request.getParameter("hotelmonth.status");
|
||
String provinceState = request.getParameter("hotelmonth.provinceState");
|
||
String districtStatus = request
|
||
.getParameter("hotelmonth.districtStatus");
|
||
/*
|
||
* if(hotelManage.getHousegrade() != null &&
|
||
* hotelManage.getHousegrade().length() != 0){
|
||
* cq.add(Restrictions.eq("housegrade", hotelManage.getHousegrade())); }
|
||
*/
|
||
if (beginStar != null && beginStar.length() != 0) {
|
||
cq.add(Restrictions.sqlRestriction(" this_ .housegrade >= '"
|
||
+ beginStar + "'"));
|
||
}
|
||
if (endStar != null && endStar.length() != 0) {
|
||
cq.add(Restrictions.sqlRestriction(" this_ .housegrade <= '"
|
||
+ endStar + "'"));
|
||
}
|
||
if (country != null && country.length() != 0) {
|
||
cq.add(Restrictions.sqlRestriction(" this_ .w_county =" + country));
|
||
}
|
||
if (bay != null && bay.length() != 0) {
|
||
cq.add(Restrictions.sqlRestriction(" this_ .bay_type =" + bay));
|
||
}
|
||
if (provinceState != null && provinceState.length() != 0) {
|
||
if (provinceState.equals("1")) {
|
||
cq.add(Restrictions
|
||
.sqlRestriction(" 1=1 and (not exists(select * from t_hotelmonthly t where t.hotel_id = this_.id "
|
||
+" and t.month="
|
||
+ month
|
||
+ " and t.year=" + year + ") or exists(select * from t_hotelmonthly t where t.hotel_id = this_.id and t.province_state ='"
|
||
+ provinceState
|
||
+ "' and t.month="
|
||
+ month
|
||
+ " and t.year=" + year + "))"));
|
||
} else {
|
||
cq.add(Restrictions
|
||
.sqlRestriction(" 1=1 and exists(select * from t_hotelmonthly t where t.hotel_id = this_.id and t.province_state ='"
|
||
+ provinceState
|
||
+ "' and t.month="
|
||
+ month
|
||
+ " and t.year=" + year + ")"));
|
||
}
|
||
}
|
||
if (districtStatus != null && districtStatus.length() != 0) {
|
||
if (districtStatus.equals("1")) {
|
||
cq.add(Restrictions
|
||
.sqlRestriction(" 1=1 and (not exists(select * from t_hotelmonthly t where t.hotel_id = this_.id and t.month="
|
||
+ month + " and t.year=" + year + ") or exists(select * from t_hotelmonthly t where t.hotel_id = this_.id and t.district_status ='"
|
||
+ districtStatus
|
||
+ "' and t.month="
|
||
+ month
|
||
+ " and t.year=" + year + "))"));
|
||
} else {
|
||
cq.add(Restrictions
|
||
.sqlRestriction(" 1=1 and exists(select * from t_hotelmonthly t where t.hotel_id = this_.id and t.district_status ='"
|
||
+ districtStatus
|
||
+ "' and t.month="
|
||
+ month
|
||
+ " and t.year=" + year + ")"));
|
||
}
|
||
}
|
||
if (status != null && status.length() != 0) {
|
||
if (status.equals("1")) {
|
||
cq.add(Restrictions
|
||
.sqlRestriction(" 1=1 and (not exists(select * from t_hotelmonthly t where t.hotel_id = this_.id and t.month="
|
||
+ month + " and t.year=" + year + ") or exists(select * from t_hotelmonthly t where t.hotel_id = this_.id and t.status ='"
|
||
+ status
|
||
+ "' and t.month="
|
||
+ month
|
||
+ " and t.year=" + year + "))"));
|
||
} else {
|
||
cq.add(Restrictions
|
||
.sqlRestriction(" 1=1 and exists(select * from t_hotelmonthly t where t.hotel_id = this_.id and t.status ='"
|
||
+ status
|
||
+ "' and t.month="
|
||
+ month
|
||
+ " and t.year=" + year + ")"));
|
||
}
|
||
}
|
||
/*
|
||
* if(hotelManage.getHotelmonth() != null &&
|
||
* hotelManage.getHotelmonth().getStatus() != null &&
|
||
* hotelManage.getHotelmonth().getStatus().length() != 0){
|
||
* cq.add(Restrictions.sqlRestriction(
|
||
* " 1=1 and exists(select * from t_hotelmonthly t where t.hotel_id = this_.id and t.status='"
|
||
* +hotelManage.getHotelmonth().getStatus()+"' )")); }
|
||
* if(hotelManage.getHotelmonth() != null &&
|
||
* hotelManage.getHotelmonth().getProvinceState() != null &&
|
||
* hotelManage.getHotelmonth().getProvinceState().length() != 0){
|
||
* cq.add(Restrictions.sqlRestriction(
|
||
* " 1=1 and exists(select * from t_hotelmonthly t where t.hotel_id = this_.id and t.provice_status='"
|
||
* +hotelManage.getHotelmonth().getProvinceState()+"' )")); }
|
||
*/
|
||
com.zzc.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq,
|
||
new Hotelmanage());
|
||
//cq.add(Restrictions.sqlRestriction("1=1 order by str_to_date((select report_date from t_hotelmonthly where month='"+ lastmonth+ "' and year='"+year+"' and hotel_id=this_.ID),'%Y-%m-%d') desc"));
|
||
// 获取easyUI的datagrid模型
|
||
this.hotelservice.getDataGridReturn(cq, true);
|
||
|
||
// 获取上月时间
|
||
|
||
// 对原型进行遍历list集合
|
||
for (Object o : dataGrid.getResults()) {
|
||
// 对集合元素进行操作
|
||
Hotelmanage hd = (Hotelmanage) o;
|
||
|
||
//查找帐号
|
||
hd.setUsername(systemService.get(TSUser.class, hd.getId()).getUserName());
|
||
|
||
List<HotelMonthly> list = hd.getHotelMonthly();
|
||
if (hd.getHotelMonthly() != null && list != null
|
||
&& list.size() != 0) {
|
||
for (HotelMonthly mothdata : list) {
|
||
// 对月报进行遍历
|
||
if (mothdata.getMonth() == null
|
||
|| mothdata.getYear() == null) {
|
||
break;
|
||
}
|
||
if (year.equals(mothdata.getYear())
|
||
&& month.equals(mothdata.getMonth())) {
|
||
// 将当前月报 加到酒店信息中 在审核表中提现
|
||
hd.setHotelmonth(mothdata);
|
||
break;
|
||
}
|
||
}
|
||
if (hd.getHotelmonth() == null) {
|
||
HotelMonthly hl = new HotelMonthly();
|
||
hl.setYear(year);
|
||
hl.setMonth(month);
|
||
hl.setStatus(Status.noSumbit);
|
||
hl.setDistrictStatus(Status.noSumbit);
|
||
hl.setProvinceState(Status.noSumbit);
|
||
hd.setHotelmonth(hl);
|
||
}
|
||
} else {
|
||
HotelMonthly hl = new HotelMonthly();
|
||
hl.setYear(year);
|
||
hl.setMonth(month);
|
||
hl.setStatus(Status.noSumbit);
|
||
hl.setDistrictStatus(Status.noSumbit);
|
||
hl.setProvinceState(Status.noSumbit);
|
||
hd.setHotelmonth(hl);
|
||
}
|
||
}
|
||
if (this.isDistrictManager()) {
|
||
request.setAttribute("isDistrictManager", "1");
|
||
}
|
||
|
||
// 将datagrid返回给前端页面
|
||
TagUtil.datagrid(response, dataGrid);
|
||
}
|
||
|
||
// 月报详情展示
|
||
@RequestMapping(params = "detail")
|
||
public ModelAndView detial(HttpServletRequest request,
|
||
HotelMonthly hotelMonthly, Hotelmanage hotelmanage,
|
||
DataGrid dataGrid) {
|
||
String hotelmanageId = request.getParameter("hotelmanageId");
|
||
// 月报id
|
||
String monthId = request.getParameter("monthId");
|
||
// 存到请求域中
|
||
Hotelmanage hm = this.systemService.get(Hotelmanage.class,
|
||
hotelmanageId);
|
||
hotelMonthly = this.systemService.get(HotelMonthly.class, monthId);
|
||
request.setAttribute("hotelMonthly", hotelMonthly);
|
||
request.setAttribute("hotelmanage", hm);
|
||
if (hotelMonthly.getActualRentNum() != null && hotelMonthly.getRoomIncome() != null) {
|
||
double actualRentNum = Double.valueOf(hotelMonthly.getActualRentNum());
|
||
double roomIncome = Double.valueOf(hotelMonthly.getRoomIncome());
|
||
DecimalFormat df = new DecimalFormat("0.000");
|
||
if(roomIncome > 0 && actualRentNum > 0) {
|
||
double value = roomIncome/actualRentNum;
|
||
request.setAttribute("ratio", df.format(value));
|
||
}
|
||
}
|
||
ModelAndView view = new ModelAndView("system/hotel/showMonthDetail");
|
||
view.addObject(hotelMonthly);
|
||
view.addObject(hm);
|
||
return view;
|
||
}
|
||
|
||
// 月报审核管理员操作
|
||
@RequestMapping(params = "addstatus")
|
||
@ResponseBody
|
||
public AjaxJson saveStatus(HttpServletRequest request,
|
||
HotelMonthly hotelMonthly, Hotelmanage otelmanage, String statusid) {
|
||
AjaxJson j = new AjaxJson();
|
||
|
||
String monthId = request.getParameter("monthId");
|
||
request.setAttribute("monthId", monthId);
|
||
try {
|
||
if (StringUtil.isNotEmpty(monthId)) {
|
||
HotelMonthly hotelMonth = systemService.getEntity(
|
||
HotelMonthly.class, monthId);
|
||
|
||
// 判断是否区级审核
|
||
if (this.isDistrictManager()) {
|
||
// 表示管理员审核通过
|
||
hotelMonth.setDistrictStatus(Status.passAudit);
|
||
// hotelMonthly.setStatus(Status.noAudit);
|
||
// hotelMonthly.setProvinceState(Status.noSumbit);
|
||
systemService.saveOrUpdate(hotelMonth);
|
||
} else {
|
||
// 表示管理员审核通过
|
||
hotelMonth.setStatus(Status.passAudit);
|
||
systemService.saveOrUpdate(hotelMonth);
|
||
}
|
||
j.setMsg("管理员审核成功");
|
||
systemService.addLog("审核通过酒店月报成功:"+monthId, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
|
||
|
||
}
|
||
} catch (Exception e) {
|
||
// TODO: handle exception
|
||
e.printStackTrace();
|
||
systemService.addLog("审核通过酒店月报失败:"+monthId, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
|
||
|
||
}
|
||
|
||
return j;
|
||
}
|
||
|
||
// 审核结果不通过
|
||
@RequestMapping(params = "nocheck")
|
||
@ResponseBody
|
||
public AjaxJson saveNotStatus(HttpServletRequest request) {
|
||
AjaxJson j = new AjaxJson();
|
||
j.setMsg("操作成功");
|
||
// System.out.println("+++++++++++++++++++++++++++++");
|
||
String monthId = request.getParameter("monthId");
|
||
request.setAttribute("monthId", monthId);
|
||
if (StringUtil.isNotEmpty(monthId)) {
|
||
HotelMonthly hotelMonth = this.systemService.getEntity(
|
||
HotelMonthly.class, monthId);
|
||
// 判断是否区级审核
|
||
if (this.isDistrictManager()) {
|
||
hotelMonth.setDistrictStatus(Status.notAudit);// 管理员审核未通过
|
||
} else {
|
||
hotelMonth.setStatus(Status.notAudit);// 管理员审核未通过
|
||
}
|
||
|
||
try {
|
||
// 减分
|
||
Integer score = hotelMonth.getScore() == null ? 0 : hotelMonth
|
||
.getScore();
|
||
if (score >= 2) {
|
||
score = score - 2;
|
||
UserScoreUtils.scoreChange(-2, hotelMonth.getHotelId());
|
||
} else {
|
||
UserScoreUtils.scoreChange((0 - score),
|
||
hotelMonth.getHotelId());
|
||
score = 0;
|
||
}
|
||
hotelMonth.setScore(score);
|
||
systemService.addLog("审核退回酒店月报成功:"+monthId, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
|
||
|
||
} catch (Exception e) {
|
||
e.printStackTrace();
|
||
systemService.addLog("审核退回酒店月报失败:"+monthId, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
|
||
|
||
}
|
||
systemService.saveOrUpdate(hotelMonth);
|
||
}
|
||
|
||
return j;
|
||
}
|
||
|
||
/**
|
||
*
|
||
* @date: 2016年12月9日
|
||
* @Author: 龙亚辉
|
||
* @Email: 502230926@qq.com
|
||
* @param:
|
||
* @return: 审核页面
|
||
*
|
||
*/
|
||
@RequestMapping(params = "audit")
|
||
public ModelAndView audit(HttpServletRequest request,
|
||
HotelMonthly hotelMonthly, Hotelmanage hotelmanage,
|
||
DataGrid dataGrid) {
|
||
String hotelmanageId = request.getParameter("hotelmanageId");
|
||
String monthid = request.getParameter("monthId");
|
||
request.setAttribute("hotelmanageId", hotelmanageId);
|
||
Hotelmanage h = this.systemService
|
||
.get(Hotelmanage.class, hotelmanageId);
|
||
HotelMonthly m = this.systemService.get(HotelMonthly.class, monthid);
|
||
ModelAndView view = new ModelAndView("system/hotel/auditmonth");
|
||
view.addObject("hotelmanage", h);
|
||
view.addObject("hotelMonthly", m);
|
||
if (m.getActualRentNum() != null && m.getRoomIncome() != null) {
|
||
double actualRentNum = Double.valueOf(m.getActualRentNum());
|
||
double roomIncome = Double.valueOf(m.getRoomIncome());
|
||
DecimalFormat df = new DecimalFormat("0.000");
|
||
if(roomIncome > 0 && actualRentNum > 0) {
|
||
double value = roomIncome/actualRentNum;
|
||
request.setAttribute("ratio", df.format(value));
|
||
}
|
||
}
|
||
return view;
|
||
}
|
||
|
||
/**
|
||
*
|
||
* @date: 2016年12月9日
|
||
* @Author: 龙亚辉
|
||
* @Email: 502230926@qq.com
|
||
* @param:
|
||
* @return: 暂存功能
|
||
*/
|
||
@RequestMapping(params = "zancuncheck")
|
||
@ResponseBody
|
||
public AjaxJson saveZanStatus(HttpServletRequest request,
|
||
HotelMonthly hotelMonthly) {
|
||
AjaxJson j = new AjaxJson();
|
||
String hotelId = hotelMonthly.getHotelId();
|
||
String tip = "暂存成功!";
|
||
try {
|
||
// 新建判断
|
||
if (hotelMonthly.getId() == null
|
||
|| hotelMonthly.getId().length() == 0)
|
||
hotelMonthly.setId(null);
|
||
// 获取酒店信息
|
||
Hotelmanage hotelmanage = this.systemService.getEntity(
|
||
Hotelmanage.class, hotelId);
|
||
hotelMonthly.setHotelId(hotelmanage.getId());
|
||
// 设置审核状态
|
||
hotelMonthly.setStatus(Status.noSumbit);
|
||
hotelMonthly.setDistrictStatus(Status.noSumbit);
|
||
hotelMonthly.setProvinceState(Status.noSumbit);
|
||
hotelMonthly.setHotelmanage(hotelmanage);
|
||
systemService.saveOrUpdate(hotelMonthly);
|
||
systemService.addLog("暂存酒店月报成功:"+hotelMonthly.getId(), Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
|
||
|
||
} catch (Exception e) {
|
||
e.printStackTrace();
|
||
tip = "暂存失败!";
|
||
systemService.addLog("暂存酒店月报失败", Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
|
||
|
||
}
|
||
j.setMsg(tip);
|
||
return j;
|
||
}
|
||
|
||
//编辑酒店月报
|
||
@RequestMapping(params = "addsign")
|
||
public ModelAndView addsign(HttpServletRequest request,
|
||
HotelMonthly hotelMonthly, Hotelmanage hotelmanage) {
|
||
String hotelmanageId = request.getParameter("hotelmanageId");
|
||
String monthId = request.getParameter("monthId");
|
||
// 根据基本信息id获取基本信息
|
||
hotelmanage = this.systemService.get(Hotelmanage.class, hotelmanageId);
|
||
// 判断是否存在历史数据
|
||
hotelMonthly = this.systemService.get(HotelMonthly.class, monthId);
|
||
if (hotelMonthly == null)
|
||
hotelMonthly = new HotelMonthly();
|
||
|
||
Calendar calendar = Calendar.getInstance();
|
||
String year = "";
|
||
String month = "";
|
||
// 上个月是12月的情况
|
||
if (calendar.get(Calendar.MONTH) == 0) {
|
||
month = "12";
|
||
year = String.valueOf(calendar.get(Calendar.YEAR) - 1);
|
||
} else {
|
||
month = String.valueOf(calendar.get(Calendar.MONTH));
|
||
year = String.valueOf(calendar.get(Calendar.YEAR));
|
||
}
|
||
String lmonth=String.valueOf((Integer.valueOf(month)-1));
|
||
|
||
// 获取上月的天数
|
||
calendar.set(Calendar.YEAR, Integer.valueOf(year));
|
||
calendar.set(Calendar.MONTH, Integer.valueOf(month) - 1);
|
||
int days = calendar.getActualMaximum(Calendar.DATE);
|
||
int housenum = hotelmanage.getHousenum() == null ? 0 : hotelmanage
|
||
.getHousenum();
|
||
int maxRooms = days * housenum;
|
||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||
hotelMonthly.setReportDate(sdf.format(new Date()));
|
||
String sql="SELECT t.* from t_hotelmonthly t LEFT JOIN t_hotelmanage h ON t.hotel_aid=h.ID WHERE t.month= "+lmonth +" and t.year= "+year +" AND t.hotel_id='"+hotelmanageId+"'";
|
||
System.out.println(sql+"打印月报的sql");
|
||
Map map=systemService.findOneForJdbc(sql);
|
||
if(map!=null){
|
||
hotelMonthly.setTotalMonthYearTime(map.get("total_monthyeartime").toString());
|
||
hotelMonthly.setInlandMonthYearTime(map.get("inland_monthyeartime").toString());
|
||
hotelMonthly.setEntryMonthYearTime(map.get("entry_monthyeartime").toString());
|
||
hotelMonthly.setHongkongMonthYearTime(map.get("hongkong_monthyeartime").toString());
|
||
hotelMonthly.setMacauMonthYearTime(map.get("macau_monthyeartime").toString());
|
||
hotelMonthly.setTaiwanMonthYearTime(map.get("taiwan_monthyeartime").toString());
|
||
hotelMonthly.setForeignMonthYearTime(map.get("foreign_monthyeartime").toString());
|
||
hotelMonthly.setAsianMonthYear(map.get("asian_monthyear").toString());
|
||
hotelMonthly.setJapanMonthYear(map.get("japan_monthyear").toString());
|
||
hotelMonthly.setKoreaMonthYear(map.get("korea_monthyear").toString());
|
||
hotelMonthly.setMongoliaMonthYear(map.get("mongolia_monthyear").toString());
|
||
hotelMonthly.setIndonesiaMonthYear(map.get("indonesia_monthyear").toString());
|
||
hotelMonthly.setMalaysiaMonthYear(map.get("malaysia_monthyear").toString());
|
||
hotelMonthly.setPhilippinesMonthYear(map.get("philippines_monthyear").toString());
|
||
hotelMonthly.setSingaporeMonthYear(map.get("singapore_monthyear").toString());
|
||
hotelMonthly.setThailandMonthYear(map.get("thailand_monthyear").toString());
|
||
hotelMonthly.setIndiaMonthYear(map.get("india_monthyear").toString());
|
||
hotelMonthly.setVietnamMonthYear(map.get("vietnam_monthyear").toString());
|
||
hotelMonthly.setBurmaMonthYear(map.get("burma_monthyear").toString());
|
||
hotelMonthly.setNorthkoreaMonthYear(map.get("northkorea_monthyear").toString());
|
||
hotelMonthly.setPakistanMonthYear(map.get("pakistan_monthyear").toString());
|
||
hotelMonthly.setLaosMonthYear(map.get("laos_monthyear").toString());
|
||
hotelMonthly.setCambodiaMonthYear(map.get("cambodia_monthyear").toString());
|
||
hotelMonthly.setNepalMonthYear(map.get("nepal_monthyear").toString());
|
||
hotelMonthly.setSrilankaMonthYear(map.get("srilanka_monthyear").toString());
|
||
hotelMonthly.setKzMonthYear(map.get("kz_monthyear").toString());
|
||
hotelMonthly.setKyrghyzstanMonthYear(map.get("kyrghyzstan_monthyear").toString());
|
||
hotelMonthly.setUzMonthYear(map.get("uz_monthyear").toString());
|
||
if(map.get("tuae_monthyear") == null) {
|
||
hotelMonthly.setTuaeMonthyear("0");
|
||
} else {
|
||
hotelMonthly.setTuaeMonthyear(map.get("tuae_monthyear").toString());
|
||
}
|
||
hotelMonthly.setTajikistanMonthYear(map.get("tajikistan_monthyear").toString());
|
||
hotelMonthly.setAsianOtherMonthYear(map.get("asianother_monthyear").toString());
|
||
hotelMonthly.setEuropeMonthYear(map.get("europe_monthyear").toString());
|
||
hotelMonthly.setEnglandMonthYear(map.get("england_monthyear").toString());
|
||
hotelMonthly.setFranceMonthYear(map.get("france_monthyear").toString());
|
||
hotelMonthly.setGermanyMonthYear(map.get("germany_monthyear").toString());
|
||
hotelMonthly.setItalyMonthYear(map.get("italy_monthyear").toString());
|
||
hotelMonthly.setSwitzerlandMonthYear(map.get("switzerland_monthyear").toString());
|
||
hotelMonthly.setSwedenMonthYear(map.get("sweden_monthyear").toString());
|
||
hotelMonthly.setRussiaMonthYear(map.get("russia_monthyear").toString());
|
||
hotelMonthly.setSpainMonthYear(map.get("spain_monthyear").toString());
|
||
hotelMonthly.setIrelandMonthYear(map.get("ireland_monthyear").toString());
|
||
hotelMonthly.setUkraineMonthYear(map.get("ukraine_monthyear").toString());
|
||
hotelMonthly.setBelgiumMonthYear(map.get("belgium_monthyear").toString());
|
||
hotelMonthly.setCzMonthYear(map.get("cz_monthyear").toString());
|
||
hotelMonthly.setAustriaMonthYear(map.get("austria_monthyear").toString());
|
||
hotelMonthly.setPortugalMonthYear(map.get("portugal_monthyear").toString());
|
||
hotelMonthly.setHollandMonthYear(map.get("holland_monthyear").toString());
|
||
hotelMonthly.setEuropeOtherMonthYear(map.get("europeother_monthyear").toString());
|
||
hotelMonthly.setAmericaMonthYear(map.get("america_monthyear").toString());
|
||
hotelMonthly.setUsaMonthYear(map.get("usa_monthyear").toString());
|
||
hotelMonthly.setCanadaMonthYear(map.get("canada_monthyear").toString());
|
||
hotelMonthly.setMexicoMonthYear(map.get("mexico_monthyear").toString());
|
||
hotelMonthly.setBrazilMonthYear(map.get("brazil_monthyear").toString());
|
||
hotelMonthly.setArgentinaMonthYear(map.get("argentina_monthyear").toString());
|
||
hotelMonthly.setChileMonthYear(map.get("chile_monthyear").toString());
|
||
hotelMonthly.setPeruMonthYear(map.get("peru_monthyear").toString());
|
||
hotelMonthly.setAmericaOtherMonthYear(map.get("americaother_monthyear").toString());
|
||
hotelMonthly.setOceaniaMonthYear(map.get("oceania_monthyear").toString());
|
||
hotelMonthly.setAustraliaMonthYear(map.get("australia_monthyear").toString());
|
||
hotelMonthly.setNzMonthYear(map.get("nz_monthyear").toString());
|
||
hotelMonthly.setOceaniaOtherMonthYear(map.get("oceaniaother_monthyear").toString());
|
||
hotelMonthly.setAfricaMonthYear(map.get("africa_monthyear").toString());
|
||
hotelMonthly.setOtherMonthYear(map.get("other_monthyear").toString());
|
||
hotelMonthly.setTotalMonthYearDay(map.get("total_monthyearday").toString());
|
||
hotelMonthly.setInlandMonthYearDay(map.get("inland_monthyearday").toString());
|
||
hotelMonthly.setEntryMonthYearDay(map.get("entry_monthyearday").toString());
|
||
hotelMonthly.setHongkongMonthYearDay(map.get("hongkong_monthyearday").toString());
|
||
hotelMonthly.setMacauMonthYearDay(map.get("macau_monthyearday").toString());
|
||
hotelMonthly.setTaiwanMonthYearDay(map.get("taiwan_monthyearday").toString());
|
||
hotelMonthly.setForeignMonthYearDay(map.get("foreign_monthyearday").toString());
|
||
}
|
||
hotelMonthly.setYear(year);
|
||
hotelMonthly.setMonth(month);
|
||
ModelAndView view = new ModelAndView("system/hotel/daitianbaoMonth");
|
||
view.addObject("hotelmanage", hotelmanage);
|
||
view.addObject("hotelMonthly", hotelMonthly);
|
||
if (hotelMonthly.getActualRentNum() != null && hotelMonthly.getRoomIncome() != null) {
|
||
double actualRentNum = Double.valueOf(hotelMonthly.getActualRentNum());
|
||
double roomIncome = Double.valueOf(hotelMonthly.getRoomIncome());
|
||
DecimalFormat df = new DecimalFormat("0.000");
|
||
if(roomIncome > 0 && actualRentNum > 0) {
|
||
double value = roomIncome/actualRentNum;
|
||
request.setAttribute("ratio", df.format(value));
|
||
}
|
||
}
|
||
return view;
|
||
}
|
||
|
||
|
||
//编辑酒店月报
|
||
@RequestMapping(params = "addsign2")
|
||
public ModelAndView addsign2(HttpServletRequest request,
|
||
HotelMonthly hotelMonthly, Hotelmanage hotelmanage) {
|
||
String hotelmanageId = request.getParameter("hotelmanageId");
|
||
String monthId = request.getParameter("monthId");
|
||
// 根据基本信息id获取基本信息
|
||
hotelmanage = this.systemService.get(Hotelmanage.class, hotelmanageId);
|
||
// 判断是否存在历史数据
|
||
hotelMonthly = this.systemService.get(HotelMonthly.class, monthId);
|
||
if (hotelMonthly == null)
|
||
hotelMonthly = new HotelMonthly();
|
||
|
||
Calendar calendar = Calendar.getInstance();
|
||
String year = "";
|
||
String month = "";
|
||
// 上个月是12月的情况
|
||
if (calendar.get(Calendar.MONTH) == 0) {
|
||
month = "12";
|
||
year = String.valueOf(calendar.get(Calendar.YEAR) - 1);
|
||
} else {
|
||
month = String.valueOf(calendar.get(Calendar.MONTH));
|
||
year = String.valueOf(calendar.get(Calendar.YEAR));
|
||
}
|
||
String lmonth=String.valueOf((Integer.valueOf(month)-1));
|
||
|
||
// 获取上月的天数
|
||
calendar.set(Calendar.YEAR, Integer.valueOf(year));
|
||
calendar.set(Calendar.MONTH, Integer.valueOf(month) - 1);
|
||
int days = calendar.getActualMaximum(Calendar.DATE);
|
||
int housenum = hotelmanage.getHousenum() == null ? 0 : hotelmanage
|
||
.getHousenum();
|
||
int maxRooms = days * housenum;
|
||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||
hotelMonthly.setReportDate(sdf.format(new Date()));
|
||
String sql="SELECT t.* from t_hotelmonthly t LEFT JOIN t_hotelmanage h ON t.hotel_aid=h.ID WHERE t.month= "+lmonth +" and t.year= "+year +" AND t.hotel_id='"+hotelmanageId+"'";
|
||
System.out.println(sql+"打印月报的sql");
|
||
Map map=systemService.findOneForJdbc(sql);
|
||
if(map!=null){
|
||
hotelMonthly.setTotalMonthYearTime(map.get("total_monthyeartime").toString());
|
||
hotelMonthly.setInlandMonthYearTime(map.get("inland_monthyeartime").toString());
|
||
hotelMonthly.setEntryMonthYearTime(map.get("entry_monthyeartime").toString());
|
||
hotelMonthly.setHongkongMonthYearTime(map.get("hongkong_monthyeartime").toString());
|
||
hotelMonthly.setMacauMonthYearTime(map.get("macau_monthyeartime").toString());
|
||
hotelMonthly.setTaiwanMonthYearTime(map.get("taiwan_monthyeartime").toString());
|
||
hotelMonthly.setForeignMonthYearTime(map.get("foreign_monthyeartime").toString());
|
||
hotelMonthly.setAsianMonthYear(map.get("asian_monthyear").toString());
|
||
hotelMonthly.setJapanMonthYear(map.get("japan_monthyear").toString());
|
||
hotelMonthly.setKoreaMonthYear(map.get("korea_monthyear").toString());
|
||
hotelMonthly.setMongoliaMonthYear(map.get("mongolia_monthyear").toString());
|
||
hotelMonthly.setIndonesiaMonthYear(map.get("indonesia_monthyear").toString());
|
||
hotelMonthly.setMalaysiaMonthYear(map.get("malaysia_monthyear").toString());
|
||
hotelMonthly.setPhilippinesMonthYear(map.get("philippines_monthyear").toString());
|
||
hotelMonthly.setSingaporeMonthYear(map.get("singapore_monthyear").toString());
|
||
hotelMonthly.setThailandMonthYear(map.get("thailand_monthyear").toString());
|
||
hotelMonthly.setIndiaMonthYear(map.get("india_monthyear").toString());
|
||
hotelMonthly.setVietnamMonthYear(map.get("vietnam_monthyear").toString());
|
||
hotelMonthly.setBurmaMonthYear(map.get("burma_monthyear").toString());
|
||
hotelMonthly.setNorthkoreaMonthYear(map.get("northkorea_monthyear").toString());
|
||
hotelMonthly.setPakistanMonthYear(map.get("pakistan_monthyear").toString());
|
||
hotelMonthly.setLaosMonthYear(map.get("laos_monthyear").toString());
|
||
hotelMonthly.setCambodiaMonthYear(map.get("cambodia_monthyear").toString());
|
||
hotelMonthly.setNepalMonthYear(map.get("nepal_monthyear").toString());
|
||
hotelMonthly.setSrilankaMonthYear(map.get("srilanka_monthyear").toString());
|
||
hotelMonthly.setKzMonthYear(map.get("kz_monthyear").toString());
|
||
hotelMonthly.setKyrghyzstanMonthYear(map.get("kyrghyzstan_monthyear").toString());
|
||
hotelMonthly.setUzMonthYear(map.get("uz_monthyear").toString());
|
||
if(map.get("tuae_monthyear") == null) {
|
||
hotelMonthly.setTuaeMonthyear("0");
|
||
} else {
|
||
hotelMonthly.setTuaeMonthyear(map.get("tuae_monthyear").toString());
|
||
}
|
||
hotelMonthly.setTajikistanMonthYear(map.get("tajikistan_monthyear").toString());
|
||
hotelMonthly.setAsianOtherMonthYear(map.get("asianother_monthyear").toString());
|
||
hotelMonthly.setEuropeMonthYear(map.get("europe_monthyear").toString());
|
||
hotelMonthly.setEnglandMonthYear(map.get("england_monthyear").toString());
|
||
hotelMonthly.setFranceMonthYear(map.get("france_monthyear").toString());
|
||
hotelMonthly.setGermanyMonthYear(map.get("germany_monthyear").toString());
|
||
hotelMonthly.setItalyMonthYear(map.get("italy_monthyear").toString());
|
||
hotelMonthly.setSwitzerlandMonthYear(map.get("switzerland_monthyear").toString());
|
||
hotelMonthly.setSwedenMonthYear(map.get("sweden_monthyear").toString());
|
||
hotelMonthly.setRussiaMonthYear(map.get("russia_monthyear").toString());
|
||
hotelMonthly.setSpainMonthYear(map.get("spain_monthyear").toString());
|
||
hotelMonthly.setIrelandMonthYear(map.get("ireland_monthyear").toString());
|
||
hotelMonthly.setUkraineMonthYear(map.get("ukraine_monthyear").toString());
|
||
hotelMonthly.setBelgiumMonthYear(map.get("belgium_monthyear").toString());
|
||
hotelMonthly.setCzMonthYear(map.get("cz_monthyear").toString());
|
||
hotelMonthly.setAustriaMonthYear(map.get("austria_monthyear").toString());
|
||
hotelMonthly.setPortugalMonthYear(map.get("portugal_monthyear").toString());
|
||
hotelMonthly.setHollandMonthYear(map.get("holland_monthyear").toString());
|
||
hotelMonthly.setEuropeOtherMonthYear(map.get("europeother_monthyear").toString());
|
||
hotelMonthly.setAmericaMonthYear(map.get("america_monthyear").toString());
|
||
hotelMonthly.setUsaMonthYear(map.get("usa_monthyear").toString());
|
||
hotelMonthly.setCanadaMonthYear(map.get("canada_monthyear").toString());
|
||
hotelMonthly.setMexicoMonthYear(map.get("mexico_monthyear").toString());
|
||
hotelMonthly.setBrazilMonthYear(map.get("brazil_monthyear").toString());
|
||
hotelMonthly.setArgentinaMonthYear(map.get("argentina_monthyear").toString());
|
||
hotelMonthly.setChileMonthYear(map.get("chile_monthyear").toString());
|
||
hotelMonthly.setPeruMonthYear(map.get("peru_monthyear").toString());
|
||
hotelMonthly.setAmericaOtherMonthYear(map.get("americaother_monthyear").toString());
|
||
hotelMonthly.setOceaniaMonthYear(map.get("oceania_monthyear").toString());
|
||
hotelMonthly.setAustraliaMonthYear(map.get("australia_monthyear").toString());
|
||
hotelMonthly.setNzMonthYear(map.get("nz_monthyear").toString());
|
||
hotelMonthly.setOceaniaOtherMonthYear(map.get("oceaniaother_monthyear").toString());
|
||
hotelMonthly.setAfricaMonthYear(map.get("africa_monthyear").toString());
|
||
hotelMonthly.setOtherMonthYear(map.get("other_monthyear").toString());
|
||
hotelMonthly.setTotalMonthYearDay(map.get("total_monthyearday").toString());
|
||
hotelMonthly.setInlandMonthYearDay(map.get("inland_monthyearday").toString());
|
||
hotelMonthly.setEntryMonthYearDay(map.get("entry_monthyearday").toString());
|
||
hotelMonthly.setHongkongMonthYearDay(map.get("hongkong_monthyearday").toString());
|
||
hotelMonthly.setMacauMonthYearDay(map.get("macau_monthyearday").toString());
|
||
hotelMonthly.setTaiwanMonthYearDay(map.get("taiwan_monthyearday").toString());
|
||
hotelMonthly.setForeignMonthYearDay(map.get("foreign_monthyearday").toString());
|
||
}
|
||
hotelMonthly.setYear(year);
|
||
hotelMonthly.setMonth(month);
|
||
ModelAndView view = new ModelAndView("system/hotel/daitianbaoMonth2");
|
||
view.addObject("hotelmanage", hotelmanage);
|
||
view.addObject("hotelMonthly", hotelMonthly);
|
||
if (hotelMonthly.getActualRentNum() != null && hotelMonthly.getRoomIncome() != null) {
|
||
double actualRentNum = Double.valueOf(hotelMonthly.getActualRentNum());
|
||
double roomIncome = Double.valueOf(hotelMonthly.getRoomIncome());
|
||
DecimalFormat df = new DecimalFormat("0.000");
|
||
if(roomIncome > 0 && actualRentNum > 0) {
|
||
double value = roomIncome/actualRentNum;
|
||
request.setAttribute("ratio", df.format(value));
|
||
}
|
||
}
|
||
return view;
|
||
}
|
||
/**
|
||
*
|
||
* @date: 2016年12月12日
|
||
* @Author: 龙亚辉
|
||
* @Email: 502230926@qq.com
|
||
* @param:
|
||
* @return:
|
||
*/
|
||
@RequestMapping(params = "exportsxls")
|
||
public String exportXls(HotelMonthly hotelMonthly,
|
||
HttpServletRequest request, HttpServletResponse response,
|
||
DataGrid dataGrid, ModelMap map) {
|
||
|
||
CriteriaQuery cq = new CriteriaQuery(HotelMonthly.class, dataGrid);
|
||
com.zzc.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq,
|
||
hotelMonthly, request.getParameterMap());
|
||
// List<CourseEntity> courses =
|
||
// this.courseService.getListByCriteriaQuery(cq,false);
|
||
List<HotelMonthly> hotelMonthlys = this.systemService
|
||
.getList(HotelMonthly.class);
|
||
map.put(NormalExcelConstants.FILE_NAME, "酒店月报信息");
|
||
map.put(NormalExcelConstants.CLASS, HotelMonthly.class);
|
||
map.put(NormalExcelConstants.PARAMS, new ExportParams("酒店月报列表",
|
||
"导出人:酒店管理员", "导出信息"));
|
||
map.put(NormalExcelConstants.DATA_LIST, hotelMonthlys);
|
||
return NormalExcelConstants.JEECG_EXCEL_VIEW;
|
||
|
||
}
|
||
|
||
// *********************星级酒店客户端的月报****************************
|
||
@RequestMapping(params = "ckhotel")
|
||
public String user(HttpServletRequest request) {
|
||
// 给部门查询条件中的下拉框准备数据
|
||
// List<TSDepart> departList = systemService.getList(TSDepart.class);
|
||
// request.setAttribute("departsReplace",
|
||
// RoletoJson.listToReplaceStr(departList, "departname", "id"));
|
||
return "system/hotelClient/ckHotelMonthList";
|
||
}
|
||
|
||
@ResponseBody
|
||
@RequestMapping(params = "ckDatagrid")
|
||
public void monthGrid(HotelMonthly hotelMonthly,
|
||
HttpServletRequest request, HttpServletResponse response,
|
||
DataGrid dataGrid) {
|
||
String hotelId = ResourceUtil.getSessionUserName().getId();
|
||
hotelMonthly.setHotelId(hotelId);
|
||
CriteriaQuery cq = new CriteriaQuery(HotelMonthly.class, dataGrid);
|
||
Map<String, Object> map = new HashMap<String, Object>();
|
||
com.zzc.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq,
|
||
hotelMonthly);
|
||
cq.add(Restrictions.sqlRestriction("1=1 order by str_to_date(report_date,'%Y-%m-%d') desc"));
|
||
cq.add();
|
||
this.systemService.getDataGridReturn(cq, true);
|
||
TagUtil.datagrid(response, dataGrid);
|
||
}
|
||
|
||
@RequestMapping(params = "exportsxlss")
|
||
public String exportXlss(HotelMonthly hotelMonthly,
|
||
HttpServletRequest request, HttpServletResponse response,
|
||
DataGrid dataGrid, ModelMap map) {
|
||
|
||
CriteriaQuery cq = new CriteriaQuery(HotelMonthly.class, dataGrid);
|
||
com.zzc.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq,
|
||
hotelMonthly, request.getParameterMap());
|
||
// List<CourseEntity> courses =
|
||
// this.courseService.getListByCriteriaQuery(cq,false);
|
||
String hotelId = ResourceUtil.getSessionUserName().getId();
|
||
List<HotelMonthly> hotelMonthlys = this.hotelservice
|
||
.findHql(
|
||
" from com.zzc.web.htoal.entity.HotelMonthly th where th.hid=? ",
|
||
hotelId);
|
||
map.put(NormalExcelConstants.FILE_NAME, "酒店月报信息");
|
||
map.put(NormalExcelConstants.CLASS, HotelMonthly.class);
|
||
map.put(NormalExcelConstants.PARAMS, new ExportParams("酒店月报列表",
|
||
"导出人:酒店用户", "导出信息"));
|
||
map.put(NormalExcelConstants.DATA_LIST, hotelMonthlys);
|
||
return NormalExcelConstants.JEECG_EXCEL_VIEW;
|
||
|
||
}
|
||
|
||
// ***************************非星级酒店客户端月报******************************************************8
|
||
@RequestMapping(params = "ckhotelf")
|
||
public String users(HttpServletRequest request) {
|
||
return "system/hotelClient/fckHotelMonthList";
|
||
}
|
||
|
||
/**
|
||
*
|
||
* @date: 2016年12月19日
|
||
* @Author: 龙亚辉
|
||
* @Email: 502230926@qq.com
|
||
* @param:
|
||
* @return:
|
||
*/
|
||
@ResponseBody
|
||
@RequestMapping(params = "fckDatagrid")
|
||
public void monthGrids(HotelMonthly hotelMonthly,
|
||
HttpServletRequest request, HttpServletResponse response,
|
||
DataGrid dataGrid) {
|
||
String hotelId = ResourceUtil.getSessionUserName().getId();
|
||
hotelMonthly.setHotelId(hotelId);
|
||
CriteriaQuery cq = new CriteriaQuery(HotelMonthly.class, dataGrid);
|
||
com.zzc.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq,
|
||
hotelMonthly);
|
||
cq.add(Restrictions.sqlRestriction("1=1 order by str_to_date(report_date,'%Y-%m-%d') desc"));
|
||
cq.add();
|
||
this.systemService.getDataGridReturn(cq, true);
|
||
|
||
TagUtil.datagrid(response, dataGrid);
|
||
|
||
}
|
||
|
||
@RequestMapping(params = "exportsxlsss")
|
||
public String exportXlsss(HotelMonthly hotelMonthly,
|
||
HttpServletRequest request, HttpServletResponse response,
|
||
DataGrid dataGrid, ModelMap map) {
|
||
|
||
CriteriaQuery cq = new CriteriaQuery(HotelMonthly.class, dataGrid);
|
||
com.zzc.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq,
|
||
hotelMonthly, request.getParameterMap());
|
||
// List<CourseEntity> courses =
|
||
// this.courseService.getListByCriteriaQuery(cq,false);
|
||
String hotelId = ResourceUtil.getSessionUserName().getId();
|
||
List<HotelMonthly> hotelMonthlys = this.hotelservice
|
||
.findHql(
|
||
" from com.zzc.web.htoal.entity.HotelMonthly th where th.hid=? and th.housegrade=? ",
|
||
hotelId, HotelGrade.grade);
|
||
map.put(NormalExcelConstants.FILE_NAME, "非星级酒店月报信息");
|
||
map.put(NormalExcelConstants.CLASS, HotelMonthly.class);
|
||
map.put(NormalExcelConstants.PARAMS, new ExportParams("非星级酒店月报列表",
|
||
"导出人:酒店用户", "导出信息"));
|
||
map.put(NormalExcelConstants.DATA_LIST, hotelMonthlys);
|
||
return NormalExcelConstants.JEECG_EXCEL_VIEW;
|
||
|
||
}
|
||
|
||
/**
|
||
* 导出月报
|
||
*
|
||
* @param request
|
||
* @param response
|
||
* @throws Exception
|
||
*/
|
||
@RequestMapping(params = "exportMonthly")
|
||
public void exportMonthly(HttpServletRequest request,
|
||
HttpServletResponse response) throws Exception {
|
||
|
||
request.setCharacterEncoding("UTF-8");
|
||
response.setCharacterEncoding("UTF-8");
|
||
response.setContentType("text/html;charset=UTF-8");
|
||
// 获取上月
|
||
Calendar calendar = Calendar.getInstance();
|
||
String year1 = "";
|
||
String month1 = "";
|
||
// 上个月是12月的情况
|
||
if (calendar.get(Calendar.MONTH) == 0) {
|
||
month1 = "12";
|
||
year1 = String.valueOf(calendar.get(Calendar.YEAR) - 1);
|
||
} else {
|
||
month1 = String.valueOf(calendar.get(Calendar.MONTH));
|
||
year1 = String.valueOf(calendar.get(Calendar.YEAR));
|
||
}
|
||
// 获取参数
|
||
/* String licensenum = request.getParameter("licensenum"); */
|
||
String name = new String(request.getParameter("name").getBytes(), "utf-8");
|
||
/* String type = request.getParameter("type"); */
|
||
String beginStar = request.getParameter("beginStar");
|
||
String endStar = request.getParameter("endStar");
|
||
String country = request.getParameter("country");
|
||
String bay = request.getParameter("bay");
|
||
String status = request.getParameter("status");
|
||
String provinceState = request.getParameter("provinceState");
|
||
String year = request.getParameter("year");
|
||
String month = request.getParameter("month");
|
||
if (year == null || year.length() == 0) {
|
||
year = year1;
|
||
}
|
||
if (month == null || month.length() == 0) {
|
||
month = month1;
|
||
}
|
||
String excelName = "酒店月报.xls";
|
||
String modelPath = "/com/zzc/web/export/model/hotel/" + excelName;
|
||
StringBuffer sql = new StringBuffer();
|
||
sql.append(" select hotelmanage.organizationNum,hotelmanage.unitname,IF (hotelmanage.housegrade = '0','其他',IF (hotelmanage.housegrade = '1','舒适',IF ( hotelmanage.housegrade = '2','高档',IF ( hotelmanage.housegrade = '3','豪华',IF ( hotelmanage.housegrade = '4','一星',IF ( hotelmanage.housegrade = '5','二星',IF ( hotelmanage.housegrade = '6','三星',IF ( hotelmanage.housegrade = '7','四星',IF ( hotelmanage.housegrade = '8','五星','' ) ) ) ) ) ) ) ) ), IF ( hotelmanage.w_county = '0', '市辖区',IF ( hotelmanage.w_county = '1','吉阳区',IF ( hotelmanage.w_county = '2','崖州区',IF ( hotelmanage.w_county = '3','天涯区',IF ( hotelmanage.w_county = '4','海棠区','' ) ) ) ) ) ,IF ( hotelmanage.bay_type = '0','市区',IF ( hotelmanage.bay_type = '1','亚龙湾',IF ( hotelmanage.bay_type = '2','大东海',IF ( hotelmanage.bay_type = '3','三亚湾',IF ( hotelmanage.bay_type = '4','海棠湾','' ) ) ) ) ) ,t.report_date,t.filler,t.filler_tel,t.actual_rentnum,t.rent_num,t.`year`,t.`month`, cast(TRUNCATE(t.total_income,3) as char),cast(TRUNCATE( t.room_income,3) as char),cast(TRUNCATE(t.catering_income,3) as char),cast(TRUNCATE(t.other_income,3) as char),");
|
||
sql.append(" t.total_monthtime,t.total_monthyeartime, ");
|
||
sql.append(" t.total_monthday,t.total_monthyearday, ");
|
||
sql.append(" t.inland_monthtime,t.inland_monthyeartime, ");
|
||
sql.append(" t.inland_monthday,inland_monthyearday, ");
|
||
sql.append(" t.entry_monthtime,t.entry_monthyeartime, ");
|
||
sql.append(" t.entry_monthday,t.entry_monthyearday, ");
|
||
sql.append(" t.hongkong_monthtime,t.hongkong_monthyeartime, ");
|
||
sql.append(" t.hongkong_monthday,t.hongkong_monthyearday, ");
|
||
sql.append(" t.macau_monthtime,t.macau_monthyeartime, ");
|
||
sql.append(" t.macau_monthday,t.macau_monthyearday, ");
|
||
sql.append(" t.taiwan_monthtime,t.taiwan_monthyeartime, ");
|
||
sql.append(" t.taiwan_monthday,t.taiwan_monthyearday, ");
|
||
sql.append(" t.foreign_monthtime,t.foreign_monthyeartime, ");
|
||
sql.append(" t.foreign_monthday,t.foreign_monthyearday, ");
|
||
sql.append(" t.asian_month,t.asian_monthyear, ");
|
||
sql.append(" t.japan_month,t.japan_monthyear, ");
|
||
sql.append(" t.korea_month,t.korea_monthyear, ");
|
||
sql.append(" t.mongolia_month,t.mongolia_monthyear, ");
|
||
sql.append(" t.indonesia_month,t.indonesia_monthyear, ");
|
||
sql.append(" t.malaysia_month,t.malaysia_monthyear, ");
|
||
sql.append(" t.philippines_month,t.philippines_monthyear, ");
|
||
sql.append(" t.singapore_month,t.singapore_monthyear, ");
|
||
sql.append(" t.thailand_month,t.thailand_monthyear, ");
|
||
sql.append(" t.india_month,t.india_monthyear, ");
|
||
sql.append(" t.vietnam_month,t.vietnam_monthyear, ");
|
||
sql.append(" t.burma_month,t.burma_monthyear, ");
|
||
sql.append(" t.northkorea_month,t.northkorea_monthyear, ");
|
||
sql.append(" t.pakistan_month,t.pakistan_monthyear, ");
|
||
sql.append(" t.asianother_month,t.asianother_monthyear, ");
|
||
sql.append(" t.europe_month,t.europe_monthyear, ");
|
||
sql.append(" t.england_month,t.england_monthyear, ");
|
||
sql.append(" t.france_month,t.france_monthyear, ");
|
||
sql.append(" t.germany_month,t.germany_monthyear, ");
|
||
sql.append(" t.italy_month,t.italy_monthyear, ");
|
||
sql.append(" t.switzerland_month,t.switzerland_monthyear, ");
|
||
sql.append(" t.sweden_month,t.sweden_monthyear, ");
|
||
sql.append(" t.russia_month,t.russia_monthyear, ");
|
||
sql.append(" t.spain_month,t.spain_monthyear, ");
|
||
sql.append(" t.europeother_month,t.europeother_monthyear, ");
|
||
sql.append(" t.america_month,t.america_monthyear, ");
|
||
sql.append(" t.usa_month,t.usa_monthyear, ");
|
||
sql.append(" t.canada_month,t.canada_monthyear, ");
|
||
sql.append(" t.americaother_month,t.americaother_monthyear, ");
|
||
sql.append(" t.oceania_month,t.oceania_monthyear, ");
|
||
sql.append(" t.australia_month,t.australia_monthyear, ");
|
||
sql.append(" t.nz_month,t.nz_monthyear, ");
|
||
sql.append(" t.oceaniaother_month,t.oceaniaother_monthyear, ");
|
||
sql.append(" t.africa_month,t.africa_monthyear, ");
|
||
sql.append(" t.other_month,t.other_monthyear ");
|
||
sql.append(" from t_hotelmonthly t left join t_hotelmanage hotelmanage on t.hotel_id=hotelmanage.id where 1=1 ");
|
||
String area = ResourceUtil.getSessionUserName().getArea();
|
||
if(StringUtil.isNotEmpty(area) && !"0".equals(area)){
|
||
sql.append(" and hotelmanage.w_county = " + area);
|
||
}
|
||
//sql.append(" and t.status = '4' ");
|
||
// 组装查询条件
|
||
if (status != null && status.length() != 0) {
|
||
sql.append(" and t.status=" + status);
|
||
}
|
||
if (provinceState != null && provinceState.length() != 0) {
|
||
sql.append(" and t.province_state=" + provinceState);
|
||
}
|
||
if (year != null && year.length() != 0 && month != null
|
||
&& month.length() != 0) {
|
||
sql.append(" and t.month=" + month + " and t.year=" + year);
|
||
}
|
||
if (name != null && name.length() != 0) {
|
||
sql.append(" and exists(select hm.id from t_hotelmanage hm where hm.id = t.hotel_id and hm.unitname like '%"
|
||
+ name + "%') ");
|
||
}
|
||
if (country != null && country.length() != 0) {
|
||
sql.append(" and exists(select hm.id from t_hotelmanage hm where hm.id = t.hotel_id and hm.w_county ="
|
||
+ country + ")");
|
||
}
|
||
if (bay != null && bay.length() != 0) {
|
||
sql.append(" and exists(select hm.id from t_hotelmanage hm where hm.id = t.hotel_id and hm.bay_type ="
|
||
+ bay + ")");
|
||
}
|
||
if(beginStar!=null && beginStar.length()!=0){
|
||
sql.append(" and exists(select hm.id from t_hotelmanage hm where hm.id = t.hotel_id and hm.housegrade >= '"
|
||
+ beginStar + "' )");
|
||
}
|
||
if(endStar!=null && endStar.length()!=0){
|
||
sql.append(" and exists(select hm.id from t_hotelmanage hm where hm.id = t.hotel_id and hm.housegrade <= '"
|
||
+ endStar + "' )");
|
||
}
|
||
/*if (beginStar != null && beginStar.length() != 0 && endStar != null
|
||
&& endStar.length() != 0) {
|
||
sql.append(" and exists(select hm.id from t_hotelmanage hm where hm.id = t.hotel_id and hm.housegrade between '"
|
||
+ beginStar + "' and '" + endStar + "')");
|
||
}*/
|
||
|
||
ExportService emds = new ExportService(114);
|
||
|
||
HSSFWorkbook workbook = null;
|
||
System.out.println(sql.toString());
|
||
try {
|
||
workbook = emds.getNewModelInfos(modelPath, sql.toString());
|
||
} catch (Exception e) {
|
||
e.printStackTrace();
|
||
}
|
||
|
||
response.reset();
|
||
response.setContentType("text/html;charset=UTF-8");
|
||
|
||
if (workbook != null) {
|
||
// 针对Firefox做处理
|
||
if ("FF".equals(ExplorerHelper.getBrowser(request))) {
|
||
response.addHeader("Content-Disposition", "attachment;filename="
|
||
+ new String(excelName.getBytes("UTF-8"),"iso-8859-1"));
|
||
}else{
|
||
response.addHeader("Content-Disposition", "attachment;filename="
|
||
+ URLEncoder.encode(excelName, "UTF-8"));
|
||
}
|
||
POIUtils.writeWorkbook(workbook, response.getOutputStream());
|
||
} else {
|
||
response.addHeader("Content-Disposition", "attachment;filename="
|
||
+ URLEncoder.encode("Errors.xls", "UTF-8"));
|
||
response.getOutputStream().print(
|
||
"You have already downloaded the error excel!");
|
||
}
|
||
|
||
}
|
||
|
||
@RequestMapping(params = "isdistrict")
|
||
@ResponseBody
|
||
public String isdistrict(HttpServletRequest request) {
|
||
if (this.isDistrictManager())
|
||
return "1";
|
||
else
|
||
return "0";
|
||
}
|
||
|
||
/**
|
||
* 判断当前用户是否为区级管理员
|
||
*
|
||
* @return boolean
|
||
*/
|
||
public boolean isDistrictManager() {
|
||
// 获取当前登录用户ID
|
||
String userId = ResourceUtil.getSessionUserName().getId();
|
||
Map<String, Object> userMap = systemService
|
||
.findOneForJdbc(
|
||
"select rolename from t_s_role where id=(select roleid from t_s_role_user where userid=?)",
|
||
userId);
|
||
// 区级管理员做判断
|
||
if (userMap.get("rolename") != null
|
||
&& userMap.get("rolename").toString().contains("区级")) {
|
||
return true;
|
||
} else {
|
||
return false;
|
||
}
|
||
}
|
||
|
||
/**
|
||
*
|
||
* 检查上月报是否填报
|
||
*
|
||
* @return
|
||
*/
|
||
public boolean isFilled() {
|
||
boolean tip = false;
|
||
// 获取当前登录用户ID=酒店ID
|
||
String userId = ResourceUtil.getSessionUserName().getId();
|
||
// 获取上个月报表的年份和月
|
||
Calendar calendar = Calendar.getInstance();
|
||
String year = String.valueOf(calendar.get(Calendar.YEAR));
|
||
String month = String.valueOf(calendar.get(Calendar.MONTH));
|
||
if ("0".equals(month)) {
|
||
month = "12";
|
||
year = String.valueOf(calendar.get(Calendar.YEAR) - 1);
|
||
}
|
||
String sql = "select id from t_hotelmonthly t where t.`month`='"
|
||
+ month + "' and t.`year`='" + year + "' and t.hotel_id = '"
|
||
+ userId + "'";
|
||
List<Map<String, Object>> list = systemService.findForJdbc(sql);
|
||
if (list.size() != 0)
|
||
tip = true;
|
||
return tip;
|
||
}
|
||
|
||
/**
|
||
*
|
||
* 撤回酒店月报
|
||
*
|
||
* @return 成功标志
|
||
*/
|
||
@RequestMapping(params = "revocation")
|
||
@ResponseBody
|
||
public String revocationHotelInfo(HttpServletRequest request,
|
||
HttpServletResponse response) {
|
||
String tip = "success";
|
||
|
||
String id = request.getParameter("id");
|
||
|
||
try {
|
||
// 获取月报对象
|
||
HotelMonthly hotelMonthly = systemService.get(HotelMonthly.class,
|
||
id);
|
||
hotelMonthly.setProvinceState(Status.noSumbit);
|
||
hotelMonthly.setRevocated("1");
|
||
|
||
systemService.saveOrUpdate(hotelMonthly);
|
||
systemService.addLog("撤回酒店月报成功:"+hotelMonthly.getId(), Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
|
||
|
||
} catch (Exception e) {
|
||
e.printStackTrace();
|
||
tip = "failed";
|
||
systemService.addLog("撤回酒店月报失败:"+id, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
|
||
|
||
}
|
||
return tip;
|
||
}
|
||
|
||
/**
|
||
* 计算年初至本月的数据
|
||
* @param hotelMonthly
|
||
* @return
|
||
*/
|
||
private HotelMonthly calcTotal(HotelMonthly hotelMonthly, String userId){
|
||
|
||
/*Calendar calendar = Calendar.getInstance();
|
||
int year = calendar.get(Calendar.YEAR);
|
||
int month = calendar.get(Calendar.MONTH);*/
|
||
//跨年处理
|
||
|
||
Calendar calendar = Calendar.getInstance();
|
||
/**
|
||
* 2022-7-5 update: calendar获取的月份从0开始,会比实际月份少1,所以之前这里的代码加了1
|
||
* 但是数据库存储的是正常的月份,所以应该在下面查询的时候减去1,不然会把当月正在添加的月报算进来
|
||
* 导致重复计算了1次,比如正在填写的应该是6月的月报,但这里month取了7,等于会把6月的也算进总数,重复计算
|
||
* 既然已经传了月报的实体类进来,直接用月报的年月即可
|
||
* */
|
||
// int year =calendar.get(Calendar.YEAR);
|
||
// int month =calendar.get(Calendar.MONTH)+1;
|
||
|
||
int year = Integer.parseInt(hotelMonthly.getYear());
|
||
int month = Integer.parseInt(hotelMonthly.getMonth());
|
||
/**
|
||
* 2023-2-1 update: 跨年不需要计算
|
||
* */
|
||
// if(month == 1){
|
||
// year=year-1;
|
||
// month=12;
|
||
// }
|
||
|
||
|
||
StringBuffer sql = new StringBuffer();
|
||
sql.append(" SELECT ");
|
||
sql.append(" sum(CAST(t.total_monthtime AS SIGNED)) total_monthtime, ");
|
||
sql.append(" sum(CAST(t.total_monthday AS SIGNED)) total_monthday, ");
|
||
sql.append(" sum(CAST(t.inland_monthtime AS SIGNED)) inland_monthtime, ");
|
||
sql.append(" sum(CAST(t.inland_monthday AS SIGNED)) inland_monthday, ");
|
||
sql.append(" sum(CAST(t.entry_monthtime AS SIGNED)) entry_monthtime, ");
|
||
sql.append(" sum(CAST(t.entry_monthday AS SIGNED)) entry_monthday, ");
|
||
sql.append(" sum(CAST(t.hongkong_monthtime AS SIGNED)) hongkong_monthtime, ");
|
||
sql.append(" sum(CAST(t.hongkong_monthday AS SIGNED)) hongkong_monthday, ");
|
||
sql.append(" sum(CAST(t.macau_monthtime AS SIGNED)) macau_monthtime, ");
|
||
sql.append(" sum(CAST(t.macau_monthday AS SIGNED)) macau_monthday, ");
|
||
sql.append(" sum(CAST(t.taiwan_monthtime AS SIGNED)) taiwan_monthtime, ");
|
||
sql.append(" sum(CAST(t.taiwan_monthday AS SIGNED)) taiwan_monthday, ");
|
||
sql.append(" sum(CAST(t.foreign_monthtime AS SIGNED)) foreign_monthtime, ");
|
||
sql.append(" sum(CAST(t.foreign_monthday AS SIGNED)) foreign_monthday, ");
|
||
sql.append(" sum(CAST(t.asian_month AS SIGNED)) asian_month, ");
|
||
sql.append(" sum(CAST(t.japan_month AS SIGNED)) japan_month, ");
|
||
sql.append(" sum(CAST(t.korea_month AS SIGNED)) korea_month, ");
|
||
sql.append(" sum(CAST(t.mongolia_month AS SIGNED)) mongolia_month, ");
|
||
sql.append(" sum(CAST(t.indonesia_month AS SIGNED)) indonesia_month, ");
|
||
sql.append(" sum(CAST(t.malaysia_month AS SIGNED)) malaysia_month, ");
|
||
sql.append(" sum(CAST(t.philippines_month AS SIGNED)) philippines_month, ");
|
||
sql.append(" sum(CAST(t.singapore_month AS SIGNED)) singapore_month, ");
|
||
sql.append(" sum(CAST(t.thailand_month AS SIGNED)) thailand_month, ");
|
||
sql.append(" sum(CAST(t.india_month AS SIGNED)) india_month, ");
|
||
sql.append(" sum(CAST(t.vietnam_month AS SIGNED)) vietnam_month, ");
|
||
sql.append(" sum(CAST(t.burma_month AS SIGNED)) burma_month, ");
|
||
sql.append(" sum(CAST(t.northkorea_month AS SIGNED)) northkorea_month, ");
|
||
sql.append(" sum(CAST(t.pakistan_month AS SIGNED)) pakistan_month, ");
|
||
sql.append(" sum(CAST(t.laos_month AS SIGNED)) laos_month, ");
|
||
sql.append(" sum(CAST(t.cambodia_month AS SIGNED)) cambodia_month, ");
|
||
sql.append(" sum(CAST(t.nepal_month AS SIGNED)) nepal_month, ");
|
||
sql.append(" sum(CAST(t.srilanka_month AS SIGNED)) srilanka_month, ");
|
||
sql.append(" sum(CAST(t.kz_month AS SIGNED)) kz_month, ");
|
||
sql.append(" sum(CAST(t.kyrghyzstan_month AS SIGNED)) kyrghyzstan_month, ");
|
||
sql.append(" sum(CAST(t.uz_month AS SIGNED)) uz_month, ");
|
||
sql.append(" sum(CAST(t.tuae_month AS SIGNED)) tuae_month, ");
|
||
sql.append(" sum(CAST(t.tajikistan_month AS SIGNED)) tajikistan_month, ");
|
||
sql.append(" sum(CAST(t.asianother_month AS SIGNED)) asianother_month, ");
|
||
sql.append(" sum(CAST(t.europe_month AS SIGNED)) europe_month, ");
|
||
sql.append(" sum(CAST(t.england_month AS SIGNED)) england_month, ");
|
||
sql.append(" sum(CAST(t.france_month AS SIGNED)) france_month, ");
|
||
sql.append(" sum(CAST(t.germany_month AS SIGNED)) germany_month, ");
|
||
sql.append(" sum(CAST(t.italy_month AS SIGNED)) italy_month, ");
|
||
sql.append(" sum(CAST(t.switzerland_month AS SIGNED)) switzerland_month, ");
|
||
sql.append(" sum(CAST(t.sweden_month AS SIGNED)) sweden_month, ");
|
||
sql.append(" sum(CAST(t.russia_month AS SIGNED)) russia_month, ");
|
||
sql.append(" sum(CAST(t.spain_month AS SIGNED)) spain_month, ");
|
||
sql.append(" sum(CAST(t.ireland_month AS SIGNED)) ireland_month, ");
|
||
sql.append(" sum(CAST(t.ukraine_month AS SIGNED)) ukraine_month, ");
|
||
sql.append(" sum(CAST(t.belgium_month AS SIGNED)) belgium_month, ");
|
||
sql.append(" sum(CAST(t.cz_month AS SIGNED)) cz_month, ");
|
||
sql.append(" sum(CAST(t.austria_month AS SIGNED)) austria_month, ");
|
||
sql.append(" sum(CAST(t.portugal_month AS SIGNED)) portugal_month, ");
|
||
sql.append(" sum(CAST(t.holland_month AS SIGNED)) holland_month, ");
|
||
sql.append(" sum(CAST(t.europeother_month AS SIGNED)) europeother_month, ");
|
||
sql.append(" sum(CAST(t.america_month AS SIGNED)) america_month, ");
|
||
sql.append(" sum(CAST(t.usa_month AS SIGNED)) usa_month, ");
|
||
sql.append(" sum(CAST(t.canada_month AS SIGNED)) canada_month, ");
|
||
sql.append(" sum(CAST(t.mexico_month AS SIGNED)) mexico_month, ");
|
||
sql.append(" sum(CAST(t.brazil_month AS SIGNED)) brazil_month, ");
|
||
sql.append(" sum(CAST(t.argentina_month AS SIGNED)) argentina_month, ");
|
||
sql.append(" sum(CAST(t.chile_month AS SIGNED)) chile_month, ");
|
||
sql.append(" sum(CAST(t.peru_month AS SIGNED)) peru_month, ");
|
||
sql.append(" sum(CAST(t.americaother_month AS SIGNED)) americaother_month, ");
|
||
sql.append(" sum(CAST(t.oceania_month AS SIGNED)) oceania_month, ");
|
||
sql.append(" sum(CAST(t.australia_month AS SIGNED)) australia_month, ");
|
||
sql.append(" sum(CAST(t.nz_month AS SIGNED)) nz_month, ");
|
||
sql.append(" sum(CAST(t.oceaniaother_month AS SIGNED)) oceaniaother_month, ");
|
||
sql.append(" sum(CAST(t.africa_month AS SIGNED)) africa_month, ");
|
||
sql.append(" sum(CAST(t.other_month AS SIGNED)) other_month ");
|
||
sql.append(" FROM ");
|
||
sql.append(" t_hotelmonthly t where ");
|
||
sql.append(" t.`year` = '" + year + "' and CAST(t.`month` as SIGNED) <" + month+" and t.hotel_id = '"+userId+"' " + " and t.status = 4");
|
||
|
||
Map<String, Object> map = systemService.findOneForJdbc(
|
||
sql.toString(), null);
|
||
// sum(t.total_monthtime) total_monthtime,
|
||
String total_monthtime = map.get("total_monthtime") == null
|
||
|| map.get("total_monthtime").toString().length() == 0 ? "0"
|
||
: map.get("total_monthtime").toString();
|
||
hotelMonthly.setTotalMonthYearTime(String.valueOf(safeInt(hotelMonthly.getTotalMonthTime())
|
||
+ safeInt(total_monthtime)));
|
||
// sum(t.total_monthday) total_monthday,
|
||
String total_monthday = map.get("total_monthday") == null
|
||
|| map.get("total_monthday").toString().length() == 0 ? "0"
|
||
: map.get("total_monthday").toString();
|
||
hotelMonthly.setTotalMonthYearDay(String.valueOf(safeInt(hotelMonthly.getTotalMonthDay()) + safeInt(total_monthday)));
|
||
// sum(t.inland_monthtime) inland_monthtime,
|
||
String inland_monthtime = map.get("inland_monthtime") == null
|
||
|| map.get("inland_monthtime").toString().length() == 0 ? "0"
|
||
: map.get("inland_monthtime").toString();
|
||
hotelMonthly.setInlandMonthYearTime(String.valueOf(safeInt(hotelMonthly.getInlandMonthTime()) + safeInt(inland_monthtime)));
|
||
// sum(t.inland_monthday) inland_monthday,
|
||
String inland_monthday = map.get("inland_monthday") == null
|
||
|| map.get("inland_monthday").toString().length() == 0 ? "0"
|
||
: map.get("inland_monthday").toString();
|
||
hotelMonthly.setInlandMonthYearDay(String.valueOf(safeInt(hotelMonthly.getInlandMonthDay()) + safeInt(inland_monthday)));
|
||
// sum(t.entry_monthtime) entry_monthtime,
|
||
String entry_monthtime = map.get("entry_monthtime") == null
|
||
|| map.get("entry_monthtime").toString().length() == 0 ? "0"
|
||
: map.get("entry_monthtime").toString();
|
||
hotelMonthly.setEntryMonthYearTime(String.valueOf(safeInt(hotelMonthly.getEntryMonthTime()) + safeInt(entry_monthtime)));
|
||
// sum(t.entry_monthday) entry_monthday,
|
||
String entry_monthday = map.get("entry_monthday") == null
|
||
|| map.get("entry_monthday").toString().length() == 0 ? "0"
|
||
: map.get("entry_monthday").toString();
|
||
hotelMonthly.setEntryMonthYearDay(String.valueOf(safeInt(hotelMonthly.getEntryMonthDay()) + safeInt(entry_monthday)));
|
||
// sum(t.hongkong_monthtime) hongkong_monthtime,
|
||
String hongkong_monthtime = map.get("hongkong_monthtime") == null
|
||
|| map.get("hongkong_monthtime").toString().length() == 0 ? "0"
|
||
: map.get("hongkong_monthtime").toString();
|
||
hotelMonthly.setHongkongMonthYearTime(String.valueOf(safeInt(hotelMonthly.getHongkongMonthTime()) + safeInt(hongkong_monthtime)));
|
||
// sum(t.hongkong_monthday) hongkong_monthday,
|
||
String hongkong_monthday = map.get("hongkong_monthday") == null
|
||
|| map.get("hongkong_monthday").toString().length() == 0 ? "0"
|
||
: map.get("hongkong_monthday").toString();
|
||
hotelMonthly.setHongkongMonthYearDay(String.valueOf(safeInt(hotelMonthly.getHongkongMonthDay()) + safeInt(hongkong_monthday)));
|
||
// sum(t.macau_monthtime) macau_monthtime,
|
||
String macau_monthtime = map.get("macau_monthtime") == null
|
||
|| map.get("macau_monthtime").toString().length() == 0 ? "0"
|
||
: map.get("macau_monthtime").toString();
|
||
hotelMonthly.setMacauMonthYearTime(String.valueOf(safeInt(hotelMonthly.getMacauMonthTime()) + safeInt(macau_monthtime)));
|
||
// sum(t.macau_monthday) macau_monthday,
|
||
String macau_monthday = map.get("macau_monthday") == null
|
||
|| map.get("macau_monthday").toString().length() == 0 ? "0"
|
||
: map.get("macau_monthday").toString();
|
||
hotelMonthly.setMacauMonthYearDay(String.valueOf(safeInt(hotelMonthly.getMacauMonthDay()) + safeInt(macau_monthday)));
|
||
// sum(t.taiwan_monthtime) taiwan_monthtime,
|
||
String taiwan_monthtime = map.get("taiwan_monthtime") == null
|
||
|| map.get("taiwan_monthtime").toString().length() == 0 ? "0"
|
||
: map.get("taiwan_monthtime").toString();
|
||
hotelMonthly.setTaiwanMonthYearTime(String.valueOf(safeInt(hotelMonthly.getTaiwanMonthTime()) + safeInt(taiwan_monthtime)));
|
||
// sum(t.taiwan_monthday) taiwan_monthday,
|
||
String taiwan_monthday = map.get("taiwan_monthday") == null
|
||
|| map.get("taiwan_monthday").toString().length() == 0 ? "0"
|
||
: map.get("taiwan_monthday").toString();
|
||
hotelMonthly.setTaiwanMonthYearDay(String.valueOf(safeInt(hotelMonthly.getTaiwanMonthDay()) + safeInt(taiwan_monthday)));
|
||
// sum(t.foreign_monthtime) foreign_monthtime,
|
||
String foreign_monthtime = map.get("foreign_monthtime") == null
|
||
|| map.get("foreign_monthtime").toString().length() == 0 ? "0"
|
||
: map.get("foreign_monthtime").toString();
|
||
hotelMonthly.setForeignMonthYearTime(String.valueOf(safeInt(hotelMonthly.getForeignMonthTime()) + safeInt(foreign_monthtime)));
|
||
// sum(t.foreign_monthday) foreign_monthday,
|
||
String foreign_monthday = map.get("foreign_monthday") == null
|
||
|| map.get("foreign_monthday").toString().length() == 0 ? "0"
|
||
: map.get("foreign_monthday").toString();
|
||
hotelMonthly.setForeignMonthYearDay(String.valueOf(safeInt(hotelMonthly.getForeignMonthDay()) + safeInt(foreign_monthday)));
|
||
// sum(t.asian_month) asian_month,
|
||
String asian_month = map.get("asian_month") == null
|
||
|| map.get("asian_month").toString().length() == 0 ? "0"
|
||
: map.get("asian_month").toString();
|
||
hotelMonthly.setAsianMonthYear(String.valueOf(safeInt(hotelMonthly.getAsianMonth()) + safeInt(asian_month)));
|
||
// sum(t.japan_month) japan_month,
|
||
String japan_month = map.get("japan_month") == null
|
||
|| map.get("japan_month").toString().length() == 0 ? "0"
|
||
: map.get("japan_month").toString();
|
||
hotelMonthly.setJapanMonthYear(String.valueOf(safeInt(hotelMonthly.getJapanMonth()) + safeInt(japan_month)));
|
||
// sum(t.korea_month) korea_month,
|
||
String korea_month = map.get("korea_month") == null
|
||
|| map.get("korea_month").toString().length() == 0 ? "0"
|
||
: map.get("korea_month").toString();
|
||
hotelMonthly.setKoreaMonthYear(String.valueOf(safeInt(hotelMonthly.getKoreaMonth()) + safeInt(korea_month)));
|
||
// sum(t.mongolia_month) mongolia_month,
|
||
String mongolia_month = map.get("mongolia_month") == null
|
||
|| map.get("mongolia_month").toString().length() == 0 ? "0"
|
||
: map.get("mongolia_month").toString();
|
||
hotelMonthly.setMongoliaMonthYear(String.valueOf(safeInt(hotelMonthly.getMongoliaMonth()) + safeInt(mongolia_month)));
|
||
// sum(t.indonesia_month) indonesia_month,
|
||
String indonesia_month = map.get("indonesia_month") == null
|
||
|| map.get("indonesia_month").toString().length() == 0 ? "0"
|
||
: map.get("indonesia_month").toString();
|
||
hotelMonthly.setIndonesiaMonthYear(String.valueOf(safeInt(hotelMonthly.getIndonesiaMonth()) + safeInt(indonesia_month)));
|
||
// sum(t.malaysia_month) malaysia_month,
|
||
String malaysia_month = map.get("malaysia_month") == null
|
||
|| map.get("malaysia_month").toString().length() == 0 ? "0"
|
||
: map.get("malaysia_month").toString();
|
||
hotelMonthly.setMalaysiaMonthYear(String.valueOf(safeInt(hotelMonthly.getMalaysiaMonth()) + safeInt(malaysia_month)));
|
||
// sum(t.philippines_month) philippines_month,
|
||
String philippines_month = map.get("philippines_month") == null
|
||
|| map.get("philippines_month").toString().length() == 0 ? "0"
|
||
: map.get("philippines_month").toString();
|
||
hotelMonthly.setPhilippinesMonthYear(String.valueOf(safeInt(hotelMonthly.getPhilippinesMonth()) + safeInt(philippines_month)));
|
||
// sum(t.singapore_month) singapore_month,
|
||
String singapore_month = map.get("singapore_month") == null
|
||
|| map.get("singapore_month").toString().length() == 0 ? "0"
|
||
: map.get("singapore_month").toString();
|
||
hotelMonthly.setSingaporeMonthYear(String.valueOf(safeInt(hotelMonthly.getSingaporeMonth()) + safeInt(singapore_month)));
|
||
// sum(t.thailand_month) thailand_month,
|
||
String thailand_month = map.get("thailand_month") == null
|
||
|| map.get("thailand_month").toString().length() == 0 ? "0"
|
||
: map.get("thailand_month").toString();
|
||
hotelMonthly.setThailandMonthYear(String.valueOf(safeInt(hotelMonthly.getThailandMonth()) + safeInt(thailand_month)));
|
||
// sum(t.india_month) india_month,
|
||
String india_month = map.get("india_month") == null
|
||
|| map.get("india_month").toString().length() == 0 ? "0"
|
||
: map.get("india_month").toString();
|
||
hotelMonthly.setIndiaMonthYear(String.valueOf(safeInt(hotelMonthly.getIndiaMonth()) + safeInt(india_month)));
|
||
// sum(t.vietnam_month) vietnam_month,
|
||
String vietnam_month = map.get("vietnam_month") == null
|
||
|| map.get("vietnam_month").toString().length() == 0 ? "0"
|
||
: map.get("vietnam_month").toString();
|
||
hotelMonthly.setVietnamMonthYear(String.valueOf(safeInt(hotelMonthly.getVietnamMonth()) + safeInt(vietnam_month)));
|
||
// sum(t.burma_month) burma_month,
|
||
String burma_month = map.get("burma_month") == null
|
||
|| map.get("burma_month").toString().length() == 0 ? "0"
|
||
: map.get("burma_month").toString();
|
||
hotelMonthly.setBurmaMonthYear(String.valueOf(safeInt(hotelMonthly.getBurmaMonth()) + safeInt(burma_month)));
|
||
// sum(t.northkorea_month) northkorea_month,
|
||
String northkorea_month = map.get("northkorea_month") == null
|
||
|| map.get("northkorea_month").toString().length() == 0 ? "0"
|
||
: map.get("northkorea_month").toString();
|
||
hotelMonthly.setNorthkoreaMonthYear(String.valueOf(safeInt(hotelMonthly.getNorthkoreaMonth()) + safeInt(northkorea_month)));
|
||
// sum(t.pakistan_month) pakistan_month,
|
||
String pakistan_month = map.get("pakistan_month") == null
|
||
|| map.get("pakistan_month").toString().length() == 0 ? "0"
|
||
: map.get("pakistan_month").toString();
|
||
hotelMonthly.setPakistanMonthYear(String.valueOf(safeInt(hotelMonthly.getPakistanMonth()) + safeInt(northkorea_month)));
|
||
// sum(t.laos_month) laos_month,
|
||
String laos_month = map.get("laos_month") == null
|
||
|| map.get("laos_month").toString().length() == 0 ? "0"
|
||
: map.get("laos_month").toString();
|
||
hotelMonthly.setLaosMonthYear(String.valueOf(safeInt(hotelMonthly.getLaosMonth()) + safeInt(laos_month)));;
|
||
// sum(t.cambodia_month) cambodia_month,
|
||
String cambodia_month = map.get("cambodia_month") == null
|
||
|| map.get("cambodia_month").toString().length() == 0 ? "0"
|
||
: map.get("cambodia_month").toString();
|
||
hotelMonthly.setCambodiaMonthYear(String.valueOf(safeInt(hotelMonthly.getCambodiaMonth()) + safeInt(cambodia_month)));
|
||
// sum(t.nepal_month) nepal_month,
|
||
String nepal_month = map.get("nepal_month") == null
|
||
|| map.get("nepal_month").toString().length() == 0 ? "0"
|
||
: map.get("nepal_month").toString();
|
||
hotelMonthly.setNepalMonthYear(String.valueOf(safeInt(hotelMonthly.getNepalMonth()) + safeInt(nepal_month)));
|
||
// sum(t.srilanka_month) srilanka_month,
|
||
String srilanka_month = map.get("srilanka_month") == null
|
||
|| map.get("srilanka_month").toString().length() == 0 ? "0"
|
||
: map.get("srilanka_month").toString();
|
||
hotelMonthly.setSrilankaMonthYear(String.valueOf(safeInt(hotelMonthly.getSrilankaMonth()) + safeInt(srilanka_month)));
|
||
// sum(t.kz_month) kz_month,
|
||
String kz_month = map.get("kz_month") == null
|
||
|| map.get("kz_month").toString().length() == 0 ? "0" : map
|
||
.get("kz_month").toString();
|
||
hotelMonthly.setKzMonthYear(String.valueOf(safeInt(hotelMonthly.getKzMonth()) + safeInt(kz_month)));
|
||
// sum(t.kyrghyzstan_month) kyrghyzstan_month,
|
||
String kyrghyzstan_month = map.get("kyrghyzstan_month") == null
|
||
|| map.get("kyrghyzstan_month").toString().length() == 0 ? "0"
|
||
: map.get("kyrghyzstan_month").toString();
|
||
hotelMonthly.setKyrghyzstanMonthYear(String.valueOf(safeInt(hotelMonthly.getKyrghyzstanMonth()) + safeInt(kyrghyzstan_month)));
|
||
// sum(t.uz_month) uz_month,
|
||
String uz_month = map.get("uz_month") == null
|
||
|| map.get("uz_month").toString().length() == 0 ? "0" : map
|
||
.get("uz_month").toString();
|
||
hotelMonthly.setUzMonthYear(String.valueOf(safeInt(hotelMonthly.getUzMonth()) + safeInt(uz_month)));
|
||
|
||
String tuae_month = map.get("tuae_month") == null
|
||
|| map.get("tuae_month").toString().length() == 0 ? "0" : map
|
||
.get("tuae_month").toString();
|
||
hotelMonthly.setTuaeMonthyear(String.valueOf(safeInt(hotelMonthly.getTuaeMonth()) + safeInt(tuae_month)));
|
||
// sum(t.tajikistan_month) tajikistan_month,
|
||
String tajikistan_month = map.get("tajikistan_month") == null
|
||
|| map.get("tajikistan_month").toString().length() == 0 ? "0"
|
||
: map.get("tajikistan_month").toString();
|
||
hotelMonthly.setTajikistanMonthYear(String.valueOf(safeInt(hotelMonthly.getTajikistanMonth()) + safeInt(tajikistan_month)));
|
||
// sum(t.asianother_month) asianother_month,
|
||
String asianother_month = map.get("asianother_month") == null
|
||
|| map.get("asianother_month").toString().length() == 0 ? "0"
|
||
: map.get("asianother_month").toString();
|
||
hotelMonthly.setAsianOtherMonthYear(String.valueOf(safeInt(hotelMonthly.getAsianOtherMonth()) + safeInt(asianother_month)));
|
||
// sum(t.europe_month) europe_month,
|
||
String europe_month = map.get("europe_month") == null
|
||
|| map.get("europe_month").toString().length() == 0 ? "0"
|
||
: map.get("europe_month").toString();
|
||
hotelMonthly.setEuropeMonthYear(String.valueOf(safeInt(hotelMonthly.getEuropeMonth()) + safeInt(europe_month)));
|
||
// sum(t.england_month) england_month,
|
||
String england_month = map.get("england_month") == null
|
||
|| map.get("england_month").toString().length() == 0 ? "0"
|
||
: map.get("england_month").toString();
|
||
hotelMonthly.setEnglandMonthYear(String.valueOf(safeInt(hotelMonthly.getEnglandMonth()) + safeInt(england_month)));
|
||
// sum(t.france_month) france_month,
|
||
String france_month = map.get("france_month") == null
|
||
|| map.get("france_month").toString().length() == 0 ? "0"
|
||
: map.get("france_month").toString();
|
||
hotelMonthly.setFranceMonthYear(String.valueOf(safeInt(hotelMonthly.getFranceMonth()) + safeInt(france_month)));
|
||
// sum(t.germany_month) germany_month,
|
||
String germany_month = map.get("germany_month") == null
|
||
|| map.get("germany_month").toString().length() == 0 ? "0"
|
||
: map.get("germany_month").toString();
|
||
hotelMonthly.setGermanyMonthYear(String.valueOf(safeInt(hotelMonthly.getGermanyMonth()) + safeInt(germany_month)));
|
||
// sum(t.italy_month) italy_month,
|
||
String italy_month = map.get("italy_month") == null
|
||
|| map.get("italy_month").toString().length() == 0 ? "0"
|
||
: map.get("italy_month").toString();
|
||
hotelMonthly.setItalyMonthYear(String.valueOf(safeInt(hotelMonthly.getItalyMonth()) + safeInt(italy_month)));
|
||
// sum(t.switzerland_month) switzerland_month,
|
||
String switzerland_month = map.get("switzerland_month") == null
|
||
|| map.get("switzerland_month").toString().length() == 0 ? "0"
|
||
: map.get("switzerland_month").toString();
|
||
hotelMonthly.setSwitzerlandMonthYear(String.valueOf(safeInt(hotelMonthly.getSwitzerlandMonth()) + safeInt(switzerland_month)));
|
||
// sum(t.sweden_month) sweden_month,
|
||
String sweden_month = map.get("sweden_month") == null
|
||
|| map.get("sweden_month").toString().length() == 0 ? "0"
|
||
: map.get("sweden_month").toString();
|
||
hotelMonthly.setSwedenMonthYear(String.valueOf(safeInt(hotelMonthly.getSwedenMonth()) + safeInt(sweden_month)));
|
||
// sum(t.russia_month) russia_month,
|
||
String russia_month = map.get("russia_month") == null
|
||
|| map.get("russia_month").toString().length() == 0 ? "0"
|
||
: map.get("russia_month").toString();
|
||
hotelMonthly.setRussiaMonthYear(String.valueOf(safeInt(hotelMonthly.getRussiaMonth()) + safeInt(russia_month)));
|
||
// sum(t.spain_month) spain_month,
|
||
String spain_month = map.get("spain_month") == null
|
||
|| map.get("spain_month").toString().length() == 0 ? "0"
|
||
: map.get("spain_month").toString();
|
||
hotelMonthly.setSpainMonthYear(String.valueOf(safeInt(hotelMonthly.getSpainMonth()) + safeInt(spain_month)));
|
||
// sum(t.ireland_month) ireland_month,
|
||
String ireland_month = map.get("ireland_month") == null
|
||
|| map.get("ireland_month").toString().length() == 0 ? "0"
|
||
: map.get("ireland_month").toString();
|
||
hotelMonthly.setIrelandMonthYear(String.valueOf(safeInt(hotelMonthly.getIrelandMonth()) + safeInt(ireland_month)));
|
||
// sum(t.ukraine_month) ukraine_month,
|
||
String ukraine_month = map.get("ukraine_month") == null
|
||
|| map.get("ukraine_month").toString().length() == 0 ? "0"
|
||
: map.get("ukraine_month").toString();
|
||
hotelMonthly.setUkraineMonthYear(String.valueOf(safeInt(hotelMonthly.getUkraineMonth()) + safeInt(ukraine_month)));
|
||
// sum(t.belgium_month) belgium_month,
|
||
String belgium_month = map.get("belgium_month") == null
|
||
|| map.get("belgium_month").toString().length() == 0 ? "0"
|
||
: map.get("belgium_month").toString();
|
||
hotelMonthly.setBelgiumMonthYear(String.valueOf(safeInt(hotelMonthly.getBelgiumMonth()) + safeInt(belgium_month)));
|
||
// sum(t.cz_month) cz_month,
|
||
String cz_month = map.get("cz_month") == null
|
||
|| map.get("cz_month").toString().length() == 0 ? "0" : map
|
||
.get("cz_month").toString();
|
||
hotelMonthly.setCzMonthYear(String.valueOf(safeInt(hotelMonthly.getCzMonth()) + safeInt(cz_month)));
|
||
// sum(t.austria_month) austria_month,
|
||
String austria_month = map.get("austria_month") == null
|
||
|| map.get("austria_month").toString().length() == 0 ? "0"
|
||
: map.get("austria_month").toString();
|
||
hotelMonthly.setAustriaMonthYear(String.valueOf(safeInt(hotelMonthly.getAustriaMonth()) + safeInt(austria_month)));
|
||
// sum(t.portugal_month) portugal_month,
|
||
String portugal_month = map.get("portugal_month") == null
|
||
|| map.get("portugal_month").toString().length() == 0 ? "0"
|
||
: map.get("portugal_month").toString();
|
||
hotelMonthly.setPortugalMonthYear(String.valueOf(safeInt(hotelMonthly.getPortugalMonth()) + safeInt(portugal_month)));
|
||
// sum(t.holland_month) holland_month,
|
||
String holland_month = map.get("holland_month") == null
|
||
|| map.get("holland_month").toString().length() == 0 ? "0"
|
||
: map.get("holland_month").toString();
|
||
hotelMonthly.setHollandMonthYear(String.valueOf(safeInt(hotelMonthly.getHollandMonth()) + safeInt(holland_month)));
|
||
// sum(t.europeother_month) europeother_month,
|
||
String europeother_month = map.get("europeother_month") == null
|
||
|| map.get("europeother_month").toString().length() == 0 ? "0"
|
||
: map.get("europeother_month").toString();
|
||
hotelMonthly.setEuropeOtherMonthYear(String.valueOf(safeInt(hotelMonthly.getEuropeOtherMonth()) + safeInt(europeother_month)));
|
||
// sum(t.america_month) america_month,
|
||
String america_month = map.get("america_month") == null
|
||
|| map.get("america_month").toString().length() == 0 ? "0"
|
||
: map.get("america_month").toString();
|
||
hotelMonthly.setAmericaMonthYear(String.valueOf(safeInt(hotelMonthly.getAmericaMonth()) + safeInt(america_month)));
|
||
// sum(t.usa_month) usa_month,
|
||
String usa_month = map.get("usa_month") == null
|
||
|| map.get("usa_month").toString().length() == 0 ? "0"
|
||
: map.get("usa_month").toString();
|
||
hotelMonthly.setUsaMonthYear(String.valueOf(safeInt(hotelMonthly.getUsaMonth().trim()) + safeInt(usa_month)));
|
||
// sum(t.canada_month) canada_month,
|
||
String canada_month = map.get("canada_month") == null
|
||
|| map.get("canada_month").toString().length() == 0 ? "0"
|
||
: map.get("canada_month").toString();
|
||
hotelMonthly.setCanadaMonthYear(String.valueOf(safeInt(hotelMonthly.getCanadaMonth()) + safeInt(canada_month)));
|
||
// sum(t.mexico_month) mexico_month,
|
||
String mexico_month = map.get("mexico_month") == null
|
||
|| map.get("mexico_month").toString().length() == 0 ? "0"
|
||
: map.get("mexico_month").toString();
|
||
hotelMonthly.setMexicoMonthYear(String.valueOf(safeInt(hotelMonthly.getMexicoMonth()) + safeInt(mexico_month)));
|
||
// sum(t.brazil_month) brazil_month,
|
||
String brazil_month = map.get("brazil_month") == null
|
||
|| map.get("brazil_month").toString().length() == 0 ? "0"
|
||
: map.get("brazil_month").toString();
|
||
hotelMonthly.setBrazilMonthYear(String.valueOf(safeInt(hotelMonthly.getBrazilMonth()) + safeInt(brazil_month)));
|
||
// sum(t.argentina_month) argentina_month,
|
||
String argentina_month = map.get("argentina_month") == null
|
||
|| map.get("argentina_month").toString().length() == 0 ? "0"
|
||
: map.get("argentina_month").toString();
|
||
hotelMonthly.setArgentinaMonthYear(String.valueOf(safeInt(hotelMonthly.getArgentinaMonth()) + safeInt(argentina_month)));
|
||
// sum(t.chile_month) chile_month,
|
||
String chile_month = map.get("chile_month") == null
|
||
|| map.get("chile_month").toString().length() == 0 ? "0"
|
||
: map.get("chile_month").toString();
|
||
hotelMonthly.setChileMonthYear(String.valueOf(safeInt(hotelMonthly.getChileMonth()) + safeInt(chile_month)));
|
||
// sum(t.peru_month) peru_month,
|
||
String peru_month = map.get("peru_month") == null
|
||
|| map.get("peru_month").toString().length() == 0 ? "0"
|
||
: map.get("peru_month").toString();
|
||
hotelMonthly.setPeruMonthYear(String.valueOf(safeInt(hotelMonthly.getPeruMonth()) + safeInt(peru_month)));
|
||
// sum(t.americaother_month) americaother_month,
|
||
String americaother_month = map.get("americaother_month") == null
|
||
|| map.get("americaother_month").toString().length() == 0 ? "0"
|
||
: map.get("americaother_month").toString();
|
||
hotelMonthly.setAmericaOtherMonthYear(String.valueOf(safeInt(hotelMonthly.getAmericaOtherMonth()) + safeInt(americaother_month)));
|
||
// sum(t.oceania_month) oceania_month,
|
||
String oceania_month = map.get("oceania_month") == null
|
||
|| map.get("oceania_month").toString().length() == 0 ? "0"
|
||
: map.get("oceania_month").toString();
|
||
hotelMonthly.setOceaniaMonthYear(String.valueOf(safeInt(hotelMonthly.getOceaniaMonth()) + safeInt(oceania_month)));
|
||
// sum(t.australia_month) australia_month,
|
||
String australia_month = map.get("australia_month") == null
|
||
|| map.get("australia_month").toString().length() == 0 ? "0"
|
||
: map.get("australia_month").toString();
|
||
hotelMonthly.setAustraliaMonthYear(String.valueOf(safeInt(hotelMonthly.getAustraliaMonth()) + safeInt(australia_month)));
|
||
// sum(t.nz_month) nz_month,
|
||
String nz_month = map.get("nz_month") == null
|
||
|| map.get("nz_month").toString().length() == 0 ? "0" : map
|
||
.get("nz_month").toString();
|
||
hotelMonthly.setNzMonthYear(String.valueOf(safeInt(hotelMonthly.getNzMonth()) + safeInt(nz_month)));
|
||
// sum(t.oceaniaother_month) oceaniaother_month,
|
||
String oceaniaother_month = map.get("oceaniaother_month") == null
|
||
|| map.get("oceaniaother_month").toString().length() == 0 ? "0"
|
||
: map.get("oceaniaother_month").toString();
|
||
hotelMonthly.setOceaniaOtherMonthYear(String.valueOf(safeInt(hotelMonthly.getOceaniaOtherMonth()) + safeInt(oceaniaother_month)));
|
||
// sum(t.africa_month) africa_month,
|
||
String africa_month = map.get("africa_month") == null
|
||
|| map.get("africa_month").toString().length() == 0 ? "0"
|
||
: map.get("africa_month").toString();
|
||
hotelMonthly.setAfricaMonthYear(String.valueOf(safeInt(hotelMonthly.getAfricaMonth()) + safeInt(africa_month)));
|
||
// sum(t.other_month) other_month
|
||
String other_month = map.get("other_month") == null
|
||
|| map.get("other_month").toString().length() == 0 ? "0"
|
||
: map.get("other_month").toString();
|
||
hotelMonthly.setOtherMonthYear(String.valueOf(safeInt(hotelMonthly.getOtherMonth()) + safeInt(other_month)));
|
||
|
||
return hotelMonthly;
|
||
|
||
}
|
||
|
||
/**
|
||
* 安全解析字符串为整数,null、空串或非法值返回0
|
||
*/
|
||
private int safeInt(String s) {
|
||
if (s == null || s.trim().length() == 0) {
|
||
return 0;
|
||
}
|
||
try {
|
||
return Integer.parseInt(s.trim());
|
||
} catch (NumberFormatException e) {
|
||
return 0;
|
||
}
|
||
}
|
||
|
||
/**
|
||
* 安全解析字符串为Double,null或非法值返回0.0
|
||
*/
|
||
private double safeDouble(String s) {
|
||
if (s == null || s.trim().length() == 0) {
|
||
return 0.0;
|
||
}
|
||
try {
|
||
return Double.parseDouble(s.trim());
|
||
} catch (NumberFormatException e) {
|
||
return 0.0;
|
||
}
|
||
}
|
||
|
||
/**
|
||
* 上传数据,省系统
|
||
*
|
||
* @param request
|
||
* @return
|
||
*/
|
||
@RequestMapping(params = "shangbaoList")
|
||
@ResponseBody
|
||
public AjaxJson shangbaoList(HttpServletRequest request) {
|
||
// // 获取所有月报
|
||
// List<HotelMonthly> list = systemService.getList(HotelMonthly.class);
|
||
//
|
||
// // 待提交的月报
|
||
// final List<HotelMonthly> sendList = new ArrayList<>();
|
||
//
|
||
// for (int i = 0; i < list.size(); i++) {
|
||
// HotelMonthly hotelMonthly = list.get(i);
|
||
// // 过滤未通过审核的月报
|
||
// if(!"4".equals(hotelMonthly.getStatus())) continue;
|
||
// // 过滤出已通过审核的月报
|
||
// if(!"1".equals(hotelMonthly.getProvinceState())) continue;
|
||
// // 过滤国家系统酒店的月报
|
||
// Hotelmanage hotelManage = systemService.get(Hotelmanage.class, hotelMonthly.getHotelId());
|
||
// if("1".equals(hotelManage.getSourceType()) || "3".equals(hotelManage.getSourceType())){
|
||
// sendList.add(hotelMonthly);
|
||
// }
|
||
// }
|
||
//
|
||
// Thread t = new Thread(new Runnable(){
|
||
// public void run(){
|
||
// hotelProvinceService.addProvinceHotelMonthly(sendList);
|
||
// }});
|
||
// t.start();
|
||
// return "success";
|
||
|
||
String year = request.getParameter("year");
|
||
String month = request.getParameter("month");
|
||
CriteriaQuery criteriaQuery = new CriteriaQuery(HotelMonthly.class);
|
||
criteriaQuery.eq("year", year);
|
||
criteriaQuery.eq("month", month);
|
||
criteriaQuery.eq("status", "4");
|
||
criteriaQuery.eq("provinceState", "1");
|
||
criteriaQuery.add();
|
||
|
||
List<HotelMonthly> hotelMonthly = this.hotelservice.getListByCriteriaQuery(criteriaQuery, false);
|
||
|
||
hotelProvinceService.addProvinceHotelMonthly(hotelMonthly);
|
||
|
||
AjaxJson json = new AjaxJson();
|
||
json.setSuccess(true);
|
||
json.setMsg("推送成功");
|
||
|
||
return json;
|
||
|
||
}
|
||
|
||
/**
|
||
* 上传数据,省系统
|
||
*
|
||
* @param request
|
||
* @return
|
||
*/
|
||
@RequestMapping(params = "shangbao")
|
||
@ResponseBody
|
||
public AjaxJson shangbao(HttpServletRequest request) {
|
||
// // 获取所有月报
|
||
// List<HotelMonthly> list = systemService.getList(HotelMonthly.class);
|
||
//
|
||
// // 待提交的月报
|
||
// final List<HotelMonthly> sendList = new ArrayList<>();
|
||
//
|
||
// for (int i = 0; i < list.size(); i++) {
|
||
// HotelMonthly hotelMonthly = list.get(i);
|
||
// // 过滤未通过审核的月报
|
||
// if(!"4".equals(hotelMonthly.getStatus())) continue;
|
||
// // 过滤出已通过审核的月报
|
||
// if(!"1".equals(hotelMonthly.getProvinceState())) continue;
|
||
// // 过滤国家系统酒店的月报
|
||
// Hotelmanage hotelManage = systemService.get(Hotelmanage.class, hotelMonthly.getHotelId());
|
||
// if("1".equals(hotelManage.getSourceType()) || "3".equals(hotelManage.getSourceType())){
|
||
// sendList.add(hotelMonthly);
|
||
// }
|
||
// }
|
||
//
|
||
// Thread t = new Thread(new Runnable(){
|
||
// public void run(){
|
||
// hotelProvinceService.addProvinceHotelMonthly(sendList);
|
||
// }});
|
||
// t.start();
|
||
// return "success";
|
||
|
||
String id = request.getParameter("id");
|
||
|
||
|
||
HotelMonthly hotelMonthly = this.systemService.get(HotelMonthly.class, id);
|
||
List<HotelMonthly> list = new ArrayList<>();
|
||
list.add(hotelMonthly);
|
||
hotelProvinceService.addProvinceHotelMonthly(list);
|
||
|
||
AjaxJson json = new AjaxJson();
|
||
json.setSuccess(true);
|
||
json.setMsg("推送成功");
|
||
|
||
return json;
|
||
|
||
}
|
||
|
||
/**
|
||
* 上传汇总数据,省系统
|
||
*
|
||
* @param request
|
||
* @return
|
||
*/
|
||
@RequestMapping(params = "shangbaoTotal")
|
||
@ResponseBody
|
||
public AjaxJson shangbaoTotal(HttpServletRequest request) {
|
||
String year = request.getParameter("year");
|
||
String month = request.getParameter("month");
|
||
CriteriaQuery criteriaQuery = new CriteriaQuery(HotelMonthly.class);
|
||
criteriaQuery.eq("year", year);
|
||
criteriaQuery.eq("month", month);
|
||
criteriaQuery.eq("status", "4");
|
||
criteriaQuery.eq("provinceState", "2");
|
||
criteriaQuery.add();
|
||
|
||
List<HotelMonthly> hotelMonthly = this.hotelservice.getListByCriteriaQuery(criteriaQuery, false);
|
||
|
||
boolean result = hotelProvinceService.addProvinceHotelTotal(hotelMonthly, year, month);
|
||
|
||
AjaxJson json = new AjaxJson();
|
||
if(result){
|
||
json.setSuccess(true);
|
||
json.setMsg("推送成功");
|
||
} else {
|
||
json.setSuccess(false);
|
||
json.setMsg("推送失败");
|
||
}
|
||
|
||
return json;
|
||
|
||
}
|
||
}
|