464 lines
19 KiB
Plaintext
464 lines
19 KiB
Plaintext
|
|
package com.nationalelectric.greenH5;
|
||
|
|
|
||
|
|
import java.text.SimpleDateFormat;
|
||
|
|
import java.util.ArrayList;
|
||
|
|
import java.util.HashMap;
|
||
|
|
import java.util.List;
|
||
|
|
import java.util.Map;
|
||
|
|
|
||
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
||
|
|
import org.springframework.stereotype.Controller;
|
||
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||
|
|
|
||
|
|
import com.nationalelectirc.Constant.Constant;
|
||
|
|
import com.nationalelectirc.utils.RestResult;
|
||
|
|
import com.nationalelectric.greenH5.bizc.BaseServiceImpl;
|
||
|
|
import com.nationalelectric.greenH5.bizc.IGreenApplyBizc;
|
||
|
|
import com.nationalelectric.greenH5.bizc.IGreenApplyDetailBizc;
|
||
|
|
import com.nationalelectric.greenH5.po.GreenApply;
|
||
|
|
import com.nationalelectric.greenH5.po.GreenUserInfo;
|
||
|
|
import com.nationalelectric.greenH5.utils.DateUtil;
|
||
|
|
import com.sgcc.uap.persistence.IHibernateDao;
|
||
|
|
|
||
|
|
@Controller
|
||
|
|
@RequestMapping("/greenApply")
|
||
|
|
public class GreenApplyController extends GreenBaseController {
|
||
|
|
|
||
|
|
@Autowired
|
||
|
|
IHibernateDao hibernateDao;
|
||
|
|
|
||
|
|
@Autowired
|
||
|
|
private BaseServiceImpl baseService;
|
||
|
|
@Autowired
|
||
|
|
private IGreenApplyBizc IGreenApplyBizc;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 获取我的理发预约记录列表
|
||
|
|
*
|
||
|
|
* @param userId
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
@RequestMapping(value = "/getMyHaircutList")
|
||
|
|
@ResponseBody
|
||
|
|
public RestResult getMyHaircutList(String userId, int pageNum, int pageSize) {
|
||
|
|
try {
|
||
|
|
|
||
|
|
GreenUserInfo userInfo = getUserInfo(userId);
|
||
|
|
if (userInfo == null) {
|
||
|
|
return new RestResult(Constant.FAILED, "非法用户");
|
||
|
|
}
|
||
|
|
int limit = ((pageNum > 0 ? pageNum : 1) - 1) * pageSize;
|
||
|
|
pageSize = pageSize*pageNum;
|
||
|
|
|
||
|
|
String sql = "select * from (select rn.*,rownum from ("
|
||
|
|
+ " SELECT ga.id as \"id\",gi.id as \"detailId\", gi.apply_person_name as \"userName\", gi.barber_name as \"barberName\",gi.barbershop_area as \"barbershop_area\",gi.barber_id as \"barber_id\", ga.comment_status as \"conmentStatus\",( gi.apply_date||' '||gi.apply_time) as \"timeQ\","
|
||
|
|
+ "gi.apply_date as \"apply_date\","
|
||
|
|
// + "gi.apply_time as \"apply_time\", "
|
||
|
|
+ "(CASE WHEN ga.status='8' THEN to_char('预约成功') WHEN ga.status='9' THEN to_char('已完成') ELSE to_char('进行中') END ) as \"status\", "
|
||
|
|
+ " ga.apply_time as \"apply_time\", "
|
||
|
|
+ " gi.int_status as \"int_status\" "
|
||
|
|
+ " FROM green_apply ga LEFT JOIN green_haircut_info gi ON gi.id = ga.detail_id "
|
||
|
|
+ " WHERE ga.apply_type = '06' AND del_flag = 0 AND gi.id IS NOT NULL and ga.user_id = ? and gi.is_deleted='N' "
|
||
|
|
+ " ORDER BY ga.apply_time DESC) rn )where rownum>? and rownum<=?";
|
||
|
|
List<Map<String, Object>> map = hibernateDao.queryForListWithSql(sql,
|
||
|
|
new Object[] { userId, limit, pageSize });
|
||
|
|
return new RestResult(Constant.SUCCESS, map);
|
||
|
|
} catch (Exception e) {
|
||
|
|
e.printStackTrace();
|
||
|
|
return new RestResult(Constant.FAILED, "查询失败");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* 获取我的理发预约记录列表
|
||
|
|
*
|
||
|
|
* @param userId
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
@RequestMapping(value = "/getAllHaircutList")
|
||
|
|
@ResponseBody
|
||
|
|
public RestResult getAllHaircutList(Map<String,Object> map) {
|
||
|
|
try {
|
||
|
|
String userId = map.get("userId").toString();
|
||
|
|
Integer pageNum = (Integer)map.get("pageNum");
|
||
|
|
Integer pageSize = (Integer)map.get("pageSize");
|
||
|
|
String startDate = map.get("startDate").toString();
|
||
|
|
String endDate = map.get("endDate").toString();
|
||
|
|
|
||
|
|
|
||
|
|
GreenUserInfo userInfo = getUserInfo(userId);
|
||
|
|
if (userInfo == null) {
|
||
|
|
return new RestResult(Constant.FAILED, "非法用户");
|
||
|
|
}
|
||
|
|
int limit = ((pageNum > 0 ? pageNum : 1) - 1) * pageSize;
|
||
|
|
pageSize = pageSize*pageNum;
|
||
|
|
|
||
|
|
String sql = " select * from (select rn.*,rownum from ("
|
||
|
|
+ " SELECT ga.id as \"id\",gi.id as \"detailId\", gi.apply_person_name as \"userName\", gi.barber_name as \"barberName\",gi.barbershop_area as \"barbershop_area\",gi.barber_id as \"barber_id\", ga.comment_status as \"conmentStatus\",( gi.apply_date||' '||gi.apply_time) as \"timeQ\","
|
||
|
|
+ "gi.apply_date as \"apply_date\","
|
||
|
|
// + "gi.apply_time as \"apply_time\", "
|
||
|
|
+ "(CASE WHEN ga.status='8' THEN to_char('预约成功') WHEN ga.status='9' THEN to_char('已完成') ELSE to_char('进行中') END ) as \"status\", "
|
||
|
|
+ " ga.apply_time as \"apply_time\", "
|
||
|
|
+ " gi.int_status as \"int_status\" "
|
||
|
|
+ " FROM green_apply ga LEFT JOIN green_haircut_info gi ON gi.id = ga.detail_id "
|
||
|
|
+ " WHERE ga.apply_type = '06' AND del_flag = 0 AND gi.id IS NOT NULL "
|
||
|
|
+ " and gi.is_deleted='N' "
|
||
|
|
+ " and gi.apply_date<=? "
|
||
|
|
+ " and gi.apply_date>=? "
|
||
|
|
+ " ORDER BY ga.apply_time DESC) rn )where rownum>? and rownum<=?";
|
||
|
|
List<Map<String, Object>> list = hibernateDao.queryForListWithSql(sql,
|
||
|
|
new Object[] { endDate,startDate, limit, pageSize });
|
||
|
|
|
||
|
|
String countSql = "select count(*) from green_apply ga LEFT JOIN green_haircut_info gi ON gi.id = ga.detail_id "
|
||
|
|
+ " WHERE ga.apply_type = '06' AND del_flag = 0 AND gi.id IS NOT NULL "
|
||
|
|
+ " and gi.is_deleted='N' "
|
||
|
|
+ " and gi.apply_date<=? "
|
||
|
|
+ " and gi.apply_date>=? ";
|
||
|
|
Integer count = hibernateDao.queryForIntWithSql(countSql,new Object[] { endDate,startDate });
|
||
|
|
Map<String,Object> rmap = new HashMap<String,Object>();
|
||
|
|
rmap.put("list", list);
|
||
|
|
rmap.put("count", count);
|
||
|
|
|
||
|
|
return new RestResult(Constant.SUCCESS, rmap);
|
||
|
|
} catch (Exception e) {
|
||
|
|
e.printStackTrace();
|
||
|
|
return new RestResult(Constant.FAILED, "查询失败");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 获取我的故障报修记录列表
|
||
|
|
*
|
||
|
|
* @param userId
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
@RequestMapping(value = "/getMyHitchList")
|
||
|
|
@ResponseBody
|
||
|
|
public RestResult getMyHitchList(String userId, int pageNum, int pageSize) {
|
||
|
|
try {
|
||
|
|
GreenUserInfo userInfo = getUserInfo(userId);
|
||
|
|
if (userInfo == null) {
|
||
|
|
return new RestResult(Constant.FAILED, "非法用户");
|
||
|
|
}
|
||
|
|
int limit = ((pageNum > 0 ? pageNum : 1) - 1) * pageSize;
|
||
|
|
pageSize = pageSize > 0 ? pageSize : 10;
|
||
|
|
String sql = " SELECT ga.id, gi.repair_person_name as userName,gi.fault_detail as faultDetail, gi.repair_addr as repairAddr, gi.repair_option as opt, ga.`status` as statusCode , ga.apply_time as applyTime,"
|
||
|
|
+ " gi.fault_pic1 as pic1, gi.fault_pic2 as pic2, gi.fault_pic3 as pic3, "
|
||
|
|
+ "CASE ga.`status` WHEN '10' THEN '待接受' WHEN '11' THEN '已接受' ELSE '' END as status, "
|
||
|
|
+ " ga.apply_time FROM green_apply AS ga LEFT JOIN green_fault_repair_info AS gi ON gi.id = ga.detail_id "
|
||
|
|
+ " WHERE ga.apply_type = '05' AND del_flag = 0 AND gi.id IS NOT NULL and ga.user_id = ? "
|
||
|
|
+ " ORDER BY ga.apply_time DESC limit ?,? ";
|
||
|
|
List<Map<String, Object>> map = hibernateDao.queryForListWithSql(sql,
|
||
|
|
new Object[] { userId, limit, pageSize });
|
||
|
|
|
||
|
|
for (Map<String, Object> mapiMap : map) {
|
||
|
|
List<String> list = new ArrayList<String>();
|
||
|
|
String pic1 = baseService.getImageBase64((String) mapiMap.get("pic1"));
|
||
|
|
if (pic1 != null && !"".equals(pic1)) {
|
||
|
|
list.add(pic1);
|
||
|
|
}
|
||
|
|
String pic2 = baseService.getImageBase64((String) mapiMap.get("pic2"));
|
||
|
|
if (pic2 != null && !"".equals(pic2)) {
|
||
|
|
list.add(pic2);
|
||
|
|
}
|
||
|
|
String pic3 = baseService.getImageBase64((String) mapiMap.get("pic3"));
|
||
|
|
if (pic3 != null && !"".equals(pic3)) {
|
||
|
|
list.add(pic3);
|
||
|
|
}
|
||
|
|
mapiMap.put("pictures", list);
|
||
|
|
}
|
||
|
|
|
||
|
|
// 清除图片地址信息
|
||
|
|
baseService.initImage();
|
||
|
|
|
||
|
|
return new RestResult(Constant.SUCCESS, map);
|
||
|
|
} catch (Exception e) {
|
||
|
|
e.printStackTrace();
|
||
|
|
return new RestResult(Constant.FAILED, "查询失败");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 获取 故障报修受理列表
|
||
|
|
*
|
||
|
|
* @param userId
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
@RequestMapping(value = "/getDoHitchList")
|
||
|
|
@ResponseBody
|
||
|
|
public RestResult getDoHitchList(String userId, int pageNum, int pageSize) {
|
||
|
|
try {
|
||
|
|
GreenUserInfo userInfo = getUserInfo(userId);
|
||
|
|
if (userInfo == null) {
|
||
|
|
return new RestResult(Constant.FAILED, "非法用户");
|
||
|
|
}
|
||
|
|
int limit = ((pageNum > 0 ? pageNum : 1) - 1) * pageSize;
|
||
|
|
pageSize = pageSize > 0 ? pageSize : 10;
|
||
|
|
String sql = " SELECT ga.id, gi.id repairId,gi.person_id,gu.real_name disposeName, gi.repair_person_name as userName,gi.fault_detail as faultDetail, gi.repair_addr as repairAddr, gi.repair_option as opt, ga.`status` as statusCode ,"
|
||
|
|
+ " gi.fault_pic1 as pic1, gi.fault_pic2 as pic2, gi.fault_pic3 as pic3, "
|
||
|
|
+ "CASE ga.`status` WHEN '10' THEN '待接受' WHEN '11' THEN '已接受' WHEN '14' THEN '已拒绝' ELSE '' END as status, "
|
||
|
|
+ " ga.apply_time FROM green_apply AS ga LEFT JOIN green_fault_repair_info AS gi ON gi.id = ga.detail_id "
|
||
|
|
+ " left join green_user_info gu on gi.person_id = gu.id "
|
||
|
|
+ " WHERE ga.apply_type = '05' AND del_flag = 0 AND gi.id IS NOT NULL "
|
||
|
|
+ " ORDER BY ga.apply_time DESC limit ?,? ";
|
||
|
|
|
||
|
|
List<Map<String, Object>> map = hibernateDao.queryForListWithSql(sql, new Object[] {limit, pageSize});
|
||
|
|
|
||
|
|
for (Map<String, Object> mapiMap : map) {
|
||
|
|
List<String> list = new ArrayList<String>();
|
||
|
|
String pic1 = baseService.getImageBase64((String) mapiMap.get("pic1"));
|
||
|
|
if (pic1 != null && !"".equals(pic1)) {
|
||
|
|
list.add(pic1);
|
||
|
|
}
|
||
|
|
String pic2 = baseService.getImageBase64((String) mapiMap.get("pic2"));
|
||
|
|
if (pic2 != null && !"".equals(pic2)) {
|
||
|
|
list.add(pic2);
|
||
|
|
}
|
||
|
|
String pic3 = baseService.getImageBase64((String) mapiMap.get("pic3"));
|
||
|
|
if (pic3 != null && !"".equals(pic3)) {
|
||
|
|
list.add(pic3);
|
||
|
|
}
|
||
|
|
mapiMap.put("pictures", list);
|
||
|
|
}
|
||
|
|
// 清除图片地址信息
|
||
|
|
baseService.initImage();
|
||
|
|
return new RestResult(Constant.SUCCESS, map);
|
||
|
|
} catch (Exception e) {
|
||
|
|
e.printStackTrace();
|
||
|
|
return new RestResult(Constant.FAILED, "查询失败");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* 获取 故障报修受理列表
|
||
|
|
*
|
||
|
|
* @param userId
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
@RequestMapping(value = "/getDisposeList")
|
||
|
|
@ResponseBody
|
||
|
|
public RestResult getDisposeList(String userId, int pageNum, int pageSize) {
|
||
|
|
try {
|
||
|
|
GreenUserInfo userInfo = getUserInfo(userId);
|
||
|
|
if (userInfo == null) {
|
||
|
|
return new RestResult(Constant.FAILED, "非法用户");
|
||
|
|
}
|
||
|
|
int limit = ((pageNum > 0 ? pageNum : 1) - 1) * pageSize;
|
||
|
|
pageSize = pageSize > 0 ? pageSize : 10;
|
||
|
|
String sql = " SELECT ga.id, gi.id repairId,gi.person_id,gu.real_name disposeName, gi.repair_person_name as userName,gi.fault_detail as faultDetail, gi.repair_addr as repairAddr, gi.repair_option as opt, ga.`status` as statusCode ,"
|
||
|
|
+ " gi.fault_pic1 as pic1, gi.fault_pic2 as pic2, gi.fault_pic3 as pic3, "
|
||
|
|
+ "CASE ga.`status` WHEN '11' THEN '待处理' WHEN '15' THEN '已处理' ELSE '' END as status, "
|
||
|
|
+ " ga.apply_time FROM green_apply AS ga LEFT JOIN green_fault_repair_info AS gi ON gi.id = ga.detail_id "
|
||
|
|
+ " left join green_user_info gu on gi.person_id = gu.id "
|
||
|
|
+ " WHERE ga.apply_type = '05' AND del_flag = 0 AND gi.id IS NOT NULL "
|
||
|
|
+" and gi.person_id=? "
|
||
|
|
+ " ORDER BY ga.apply_time DESC limit ?,? ";
|
||
|
|
|
||
|
|
List<Map<String, Object>> map = hibernateDao.queryForListWithSql(sql, new Object[] {userId, limit, pageSize});
|
||
|
|
|
||
|
|
for (Map<String, Object> mapiMap : map) {
|
||
|
|
List<String> list = new ArrayList<String>();
|
||
|
|
String pic1 = baseService.getImageBase64((String) mapiMap.get("pic1"));
|
||
|
|
if (pic1 != null && !"".equals(pic1)) {
|
||
|
|
list.add(pic1);
|
||
|
|
}
|
||
|
|
String pic2 = baseService.getImageBase64((String) mapiMap.get("pic2"));
|
||
|
|
if (pic2 != null && !"".equals(pic2)) {
|
||
|
|
list.add(pic2);
|
||
|
|
}
|
||
|
|
String pic3 = baseService.getImageBase64((String) mapiMap.get("pic3"));
|
||
|
|
if (pic3 != null && !"".equals(pic3)) {
|
||
|
|
list.add(pic3);
|
||
|
|
}
|
||
|
|
mapiMap.put("pictures", list);
|
||
|
|
}
|
||
|
|
// 清除图片地址信息
|
||
|
|
baseService.initImage();
|
||
|
|
return new RestResult(Constant.SUCCESS, map);
|
||
|
|
} catch (Exception e) {
|
||
|
|
e.printStackTrace();
|
||
|
|
return new RestResult(Constant.FAILED, "查询失败");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 受理 故障报修
|
||
|
|
*
|
||
|
|
* @param userId
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
@RequestMapping(value = "/doHitch")
|
||
|
|
@ResponseBody
|
||
|
|
public RestResult hitch(String userId, Integer type, Long id, String personId) {
|
||
|
|
try {
|
||
|
|
GreenUserInfo userInfo = getUserInfo(userId);
|
||
|
|
if (userInfo == null) {
|
||
|
|
return new RestResult(Constant.FAILED, "非法用户");
|
||
|
|
}
|
||
|
|
if (type == null || type > 2 || type < 1) {
|
||
|
|
return new RestResult(Constant.FAILED, "参数有误");
|
||
|
|
}
|
||
|
|
return IGreenApplyBizc.hitch(userId, type, id, personId);
|
||
|
|
} catch (Exception e) {
|
||
|
|
e.printStackTrace();
|
||
|
|
return new RestResult(Constant.FAILED, "操作失败");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* 处理完成 故障报修
|
||
|
|
*
|
||
|
|
* @param userId
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
@RequestMapping(value = "/dispose")
|
||
|
|
@ResponseBody
|
||
|
|
public RestResult dispose(String userId, Long id) {
|
||
|
|
try {
|
||
|
|
GreenUserInfo userInfo = getUserInfo(userId);
|
||
|
|
if (userInfo == null) {
|
||
|
|
return new RestResult(Constant.FAILED, "非法用户");
|
||
|
|
}
|
||
|
|
GreenApply apply = hibernateDao.getObject(GreenApply.class, id);
|
||
|
|
if (apply == null) {
|
||
|
|
return new RestResult(Constant.FAILED, "未查询到该记录");
|
||
|
|
}
|
||
|
|
if (!apply.getApplyType().equals(Constant.FAULT_REPAIR_APPLY)) {
|
||
|
|
return new RestResult(Constant.FAILED, "数据有误");
|
||
|
|
}
|
||
|
|
if (apply.getStatus().equals(Constant.DISPOSE)) {
|
||
|
|
return new RestResult(Constant.FAILED, "该记录已处理");
|
||
|
|
}
|
||
|
|
String status = Constant.DISPOSE;
|
||
|
|
apply.setStatus(status);
|
||
|
|
hibernateDao.updateObject(apply);
|
||
|
|
return new RestResult(Constant.SUCCESS, "操作成功");
|
||
|
|
} catch (Exception e) {
|
||
|
|
e.printStackTrace();
|
||
|
|
return new RestResult(Constant.FAILED, "操作失败");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 获取我的洗车预约记录列表
|
||
|
|
*
|
||
|
|
* @param userId
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
@RequestMapping(value = "/getMyWashCarList")
|
||
|
|
@ResponseBody
|
||
|
|
public RestResult getMyWashCarList(String userId, int pageNum, int pageSize) {
|
||
|
|
try {
|
||
|
|
|
||
|
|
GreenUserInfo userInfo = getUserInfo(userId);
|
||
|
|
if (userInfo == null) {
|
||
|
|
return new RestResult(Constant.FAILED, "非法用户");
|
||
|
|
}
|
||
|
|
int limit = ((pageNum > 0 ? pageNum : 1) - 1) * pageSize;
|
||
|
|
pageSize = pageSize*pageNum;
|
||
|
|
|
||
|
|
String sql = "select * from (select rn.*,rownum from ( "
|
||
|
|
+ "SELECT ga.id as \"id\", gi.id as \"detailId\", gi.user_name as \"userName\", gi.concat_user_name as \"concatUserName\","
|
||
|
|
+ "gi.apply_place as \"apply_place\", gi.concat_phone as \"concatPhone\", ga.comment_status as \"conmentStatus\","
|
||
|
|
+ " ( gi.apply_date||' '||gi.apply_time) as \"timeQ\",gi.apply_date as \"apply_date\","
|
||
|
|
+ "gi.apply_time as \"apply_time_interval\", "
|
||
|
|
+ " gi.int_status as \"int_status\","
|
||
|
|
+ " (CASE WHEN ga.status='8' THEN to_char('预约成功') WHEN ga.status='9' THEN to_char('已完成') ELSE to_char('进行中') END ) as \"status\", "
|
||
|
|
+ " ga.apply_time as \"apply_time\""
|
||
|
|
+ " FROM green_apply ga LEFT JOIN green_wash_car_info gi ON gi.id = ga.detail_id "
|
||
|
|
+ " WHERE ga.apply_type = '09' AND ga.del_flag = 0 AND gi.id IS NOT NULL and ga.user_id = ? "
|
||
|
|
+ " ORDER BY ga.apply_time DESC ) rn )where rownum>? and rownum<=?";
|
||
|
|
List<Map<String, Object>> map = hibernateDao.queryForListWithSql(sql,
|
||
|
|
new Object[] { userId, limit, pageSize });
|
||
|
|
return new RestResult(Constant.SUCCESS, map);
|
||
|
|
} catch (Exception e) {
|
||
|
|
e.printStackTrace();
|
||
|
|
return new RestResult(Constant.FAILED, "查询失败");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 获取我的洗车预约记录列表
|
||
|
|
*
|
||
|
|
* @param userId
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
@RequestMapping(value = "/getAllWashCarList")
|
||
|
|
@ResponseBody
|
||
|
|
public RestResult getAllWashCarList(Map<String,Object> map) {
|
||
|
|
try {
|
||
|
|
String userId = map.get("userId").toString();
|
||
|
|
Integer pageNum = (Integer)map.get("pageNum");
|
||
|
|
Integer pageSize = (Integer)map.get("pageSize");
|
||
|
|
String startDate = map.get("startDate").toString();
|
||
|
|
String endDate = map.get("endDate").toString();
|
||
|
|
|
||
|
|
GreenUserInfo userInfo = getUserInfo(userId);
|
||
|
|
if (userInfo == null) {
|
||
|
|
return new RestResult(Constant.FAILED, "非法用户");
|
||
|
|
}
|
||
|
|
int limit = ((pageNum > 0 ? pageNum : 1) - 1) * pageSize;
|
||
|
|
pageSize = pageSize*pageNum;
|
||
|
|
|
||
|
|
String sql = "select * from (select rn.*,rownum rw from ( "
|
||
|
|
+ "SELECT ga.id as \"id\", gi.id as \"detailId\", gi.user_name as \"userName\", gi.concat_user_name as \"concatUserName\","
|
||
|
|
+ "gi.apply_place as \"apply_place\", gi.concat_phone as \"concatPhone\", ga.comment_status as \"conmentStatus\","
|
||
|
|
+ " ( gi.apply_date||' '||gi.apply_time) as \"timeQ\",gi.apply_date as \"apply_date\","
|
||
|
|
+ "gi.apply_time as \"apply_time_interval\", "
|
||
|
|
+ " gi.int_status as \"int_status\","
|
||
|
|
+ " (CASE WHEN ga.status='8' THEN to_char('预约成功') WHEN ga.status='9' THEN to_char('已完成') ELSE to_char('进行中') END ) as \"status\", "
|
||
|
|
+ " ga.apply_time as \"apply_time\""
|
||
|
|
+ " FROM green_apply ga LEFT JOIN green_wash_car_info gi ON gi.id = ga.detail_id "
|
||
|
|
+ " WHERE ga.apply_type = '09' AND ga.del_flag = 0 AND gi.id IS NOT NULL"
|
||
|
|
+ " and gi.apply_date<=? "
|
||
|
|
+ " and gi.apply_date>=? "
|
||
|
|
+ " ORDER BY ga.apply_time DESC) rn )where rw>? and rw<=?";
|
||
|
|
List<Map<String, Object>> list = hibernateDao.queryForListWithSql(sql,
|
||
|
|
new Object[] { endDate,startDate, limit, pageSize });
|
||
|
|
|
||
|
|
String countSql = "select count(*) from green_apply ga LEFT JOIN green_wash_car_info gi ON gi.id = ga.detail_id "
|
||
|
|
+ " WHERE ga.apply_type = '09' AND ga.del_flag = 0 AND gi.id IS NOT NULL"
|
||
|
|
+ " and gi.apply_date<=? "
|
||
|
|
+ " and gi.apply_date>=? ";
|
||
|
|
Integer count = hibernateDao.queryForIntWithSql(countSql,new Object[] { endDate,startDate });
|
||
|
|
Map<String,Object> rmap = new HashMap<String,Object>();
|
||
|
|
rmap.put("list", list);
|
||
|
|
rmap.put("count", count);
|
||
|
|
return new RestResult(Constant.SUCCESS, rmap);
|
||
|
|
} catch (Exception e) {
|
||
|
|
e.printStackTrace();
|
||
|
|
return new RestResult(Constant.FAILED, "查询失败");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 获取 洗车预约 受理列表
|
||
|
|
*
|
||
|
|
* @param userId
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
@RequestMapping(value = "/getDoWashCarList")
|
||
|
|
@ResponseBody
|
||
|
|
public RestResult getDoWashCarList(String userId,String applyDate, int pageNum, int pageSize) {
|
||
|
|
try {
|
||
|
|
GreenUserInfo userInfo = getUserInfo(userId);
|
||
|
|
if (userInfo == null) {
|
||
|
|
return new RestResult(Constant.FAILED, "非法用户");
|
||
|
|
}
|
||
|
|
if (applyDate == null || applyDate.equals("")) {
|
||
|
|
applyDate = DateUtil.now(new SimpleDateFormat("yyyy-MM-dd"));
|
||
|
|
}
|
||
|
|
int limit = ((pageNum > 0 ? pageNum : 1) - 1) * pageSize;
|
||
|
|
pageSize = pageSize > 0 ? pageSize : 10;
|
||
|
|
String sql = " SELECT ga.id, gi.id as detailId, gi.user_name as userName, gi.concat_user_name as concatUserName, gi.concat_phone as concatPhone, ga.comment_status as conmentStatus, CONCAT( gi.apply_date,' ', gi.apply_time) as timeQ, "
|
||
|
|
+ " CASE ga.`status` WHEN '8' THEN '预约成功' WHEN '9' THEN '已完成' ELSE '进行中' END as status, "
|
||
|
|
+ " ga.apply_time FROM green_apply AS ga LEFT JOIN green_wash_car_info AS gi ON gi.id = ga.detail_id "
|
||
|
|
+ " WHERE ga.apply_type = '09' AND ga.del_flag = 0 AND gi.id IS NOT NULL and gi.apply_date = ? "
|
||
|
|
+ " ORDER BY ga.apply_time DESC limit ?,? ";
|
||
|
|
List<Map<String, Object>> map = hibernateDao.queryForListWithSql(sql, new Object[] {applyDate, limit, pageSize });
|
||
|
|
return new RestResult(Constant.SUCCESS, map);
|
||
|
|
} catch (Exception e) {
|
||
|
|
e.printStackTrace();
|
||
|
|
return new RestResult(Constant.FAILED, "查询失败");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|