Commit 58b0bb75 by wubh

包活干V1.7.0-接单时更新接单时间;查询结果增加照片和车辆信息

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@27466 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent c41f086f
package com.glsx.ordercenter.controller;
import javax.servlet.http.HttpServletRequest;
import javax.validation.groups.Default;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.util.StringUtil;
......@@ -15,18 +22,38 @@ import com.glsx.ordercenter.constants.BizConstants;
import com.glsx.ordercenter.constants.OrderActiveStatusEnum;
import com.glsx.ordercenter.constants.OrderTypeEnum;
import com.glsx.ordercenter.constants.ResultCodeEnum;
import com.glsx.ordercenter.dto.*;
import com.glsx.ordercenter.dto.BizAmountResp;
import com.glsx.ordercenter.dto.CreateAfterSaleRepairReq;
import com.glsx.ordercenter.dto.MechanicBusiness;
import com.glsx.ordercenter.dto.MechanicStatistics;
import com.glsx.ordercenter.dto.OrderActivateReq;
import com.glsx.ordercenter.dto.OrderDeviceReq;
import com.glsx.ordercenter.dto.OrderRepairReq;
import com.glsx.ordercenter.dto.OrderStastic;
import com.glsx.ordercenter.dto.QueryOrderReq;
import com.glsx.ordercenter.dto.ServiceItemScale;
import com.glsx.ordercenter.dto.req.SaveOrderSubsidyInfoReq;
import com.glsx.ordercenter.pojo.*;
import com.glsx.ordercenter.service.*;
import com.glsx.ordercenter.pojo.GroupA;
import com.glsx.ordercenter.pojo.SysOrder;
import com.glsx.ordercenter.pojo.SysOrderDevice;
import com.glsx.ordercenter.pojo.SysOrderDeviceSupplier;
import com.glsx.ordercenter.pojo.SysOrderExample;
import com.glsx.ordercenter.pojo.SysReserveInstallLog;
import com.glsx.ordercenter.pojo.SysServiceItemDeviceConfig;
import com.glsx.ordercenter.pojo.SysServiceItemPhotoConfig;
import com.glsx.ordercenter.service.IOrderChannelService;
import com.glsx.ordercenter.service.IOrderDeviceService;
import com.glsx.ordercenter.service.IOrderService;
import com.glsx.ordercenter.service.OraOrderService;
import com.glsx.ordercenter.service.ReserveInstallLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.validation.groups.Default;
import java.util.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* @author Zheng Xiajun
......@@ -81,7 +108,7 @@ public class OrderController extends BaseController {
@RequestMapping(value = "/getOrderListByExample", method = {RequestMethod.GET, RequestMethod.POST})
public ResultObject getOrderListByExample(HttpServletRequest request, QueryOrderReq queryOrderReq,
@RequestParam(defaultValue = "1") int pageIndex, @RequestParam(defaultValue = "10") int pageSize) {
Map<String, Object> result = new HashMap<String, Object>();
Map<String, Object> result = new HashMap<>();
// 获取当前用户信息 根据用户角色筛选订单
int userId = UserUtils.getUserId(request);
if (queryOrderReq != null) {
......@@ -185,7 +212,7 @@ public class OrderController extends BaseController {
@AuthCheck
@RequestMapping(value = "/getStatistic", method = {RequestMethod.GET, RequestMethod.POST})
public ResultObject getStatistic(HttpServletRequest request) {
// 获取当前用户
// 获取当前用户
int userId = UserUtils.getUserId(request);
OrderStastic orderStastic = orderService.getStatistic(userId);
return new ResultObject(ResultCodeEnum.SUCCESS.getCode(), ResultCodeEnum.SUCCESS.getMsg(), orderStastic);
......@@ -548,6 +575,7 @@ public class OrderController extends BaseController {
SysOrder order = new SysOrder();
order.setId(id);
order.setActiveStatus(OrderActiveStatusEnum.ORDER_ACTIVE_STATUS_MECHANIC_WITHOUT_APPOINTMENT.getActiveStatus());
order.setReceiveTime(date);
order.setUpdateTime(date);
order.setUpdateBy(userId);
orderService.confirm(order, userId);
......@@ -700,7 +728,7 @@ public class OrderController extends BaseController {
@RequestMapping(value = "/getOrderList", method = {RequestMethod.GET, RequestMethod.POST})
public ResultObject getOrderList(HttpServletRequest request, QueryOrderReq orderReq,
@RequestParam(defaultValue = "1") int pageIndex, @RequestParam(defaultValue = "10") int pageSize) {
Map<String, Object> result = new HashMap<String, Object>();
Map<String, Object> result = new HashMap<>();
if (orderReq != null) {
logger.info("订单搜索传递的参数:" + JSONObject.toJSONString(orderReq));
}
......@@ -722,7 +750,7 @@ public class OrderController extends BaseController {
@RequestMapping(value = "/getConcernOrderList", method = {RequestMethod.GET, RequestMethod.POST})
public ResultObject getConcernOrderList(HttpServletRequest request, QueryOrderReq orderReq,
@RequestParam(defaultValue = "1") int pageIndex, @RequestParam(defaultValue = "10") int pageSize) {
Map<String, Object> result = new HashMap<String, Object>();
Map<String, Object> result = new HashMap<>();
if (orderReq != null) {
logger.info("订单搜索传递的参数:" + JSONObject.toJSONString(orderReq));
}
......@@ -804,7 +832,7 @@ public class OrderController extends BaseController {
// "该订单未匹配服务商!!");
// }
// orderBy:c按单量排序,d按距离排序,t按时效排序
Map<String, Object> result = new HashMap<String, Object>();
Map<String, Object> result = new HashMap<>();
List<MechanicBusiness> list = orderService.getMechanicList(pageIndex, pageSize, id, keyWord, orderBy);
Page page = new Page(pageIndex, pageSize);
com.github.pagehelper.Page<MechanicBusiness> pages = (com.github.pagehelper.Page<MechanicBusiness>) list;
......
package com.glsx.ordercenter.utils;
import com.alibaba.druid.util.StringUtils;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.util.StringUtil;
import com.glsx.common.constants.Constants;
import com.glsx.common.feign.client.CarBrandClient;
import com.glsx.common.feign.client.UserClient;
import com.glsx.common.utils.DateUtil;
import com.glsx.common.utils.PropertiesUtil;
import com.glsx.common.utils.StringUtils;
import com.glsx.common.utils.wehcat.MiniProgram;
import com.glsx.common.utils.wehcat.TemplateData;
import com.glsx.common.utils.wehcat.WechatTemplate;
......@@ -27,14 +33,6 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* @author zhanghj
* @version 1.0.0
......@@ -83,7 +81,6 @@ public class OrderUtil {
* @Description: TODO 安装单派单给服务商或竞价单商户选中服务商报价后推送微信模板消息
*/
public void sendAppointServiceRemindMsg(SysOrder sysOrder) {
// TODO Auto-generated method stub
try {
String orderSn = sysOrder.getOrderSn();
Byte orderType = sysOrder.getOrderType();
......@@ -106,7 +103,7 @@ public class OrderUtil {
publicOpenId = data.getString("publicOpenId");
serviceName = data.getString("providerName");
}
if (StringUtil.isEmpty(publicOpenId)) {
if (StringUtils.isEmpty(publicOpenId)) {
return;
}
logger.info("安装单派单给服务商或竞价单商户选中服务商报价后实时推送,orderSn=" + orderSn);
......@@ -170,7 +167,7 @@ public class OrderUtil {
}
SysUser sysUser = JSONObject.toJavaObject(userClient.getUserById(sysOrder.getMechanicId()).getJSONObject("data"), SysUser.class);
String publicOpenId = sysUser.getPublicOpenId();
if (StringUtil.isEmpty(publicOpenId)) {
if (StringUtils.isEmpty(publicOpenId)) {
return;
}
String orderSn = sysOrder.getOrderSn();
......@@ -274,7 +271,7 @@ public class OrderUtil {
JSONObject series = carBrandClient.getSeriesById(serId);
JSONObject brand = carBrandClient.getBrandById(brandId);
if (StringUtil.isEmpty(series.getString("data"))) {
if (StringUtils.isBlank(series.getString("data"))) {
continue;
}
CarInfo carInfo = new CarInfo();
......@@ -285,19 +282,21 @@ public class OrderUtil {
order.setCarType(null);
}
// 车辆信息信息
if (!StringUtils.isEmpty(order.getCarType())) {
Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$");
String carType = order.getCarType();
if (pattern.matcher(carType).matches()) {
int typeId = Integer.parseInt(order.getCarType());
JSONObject type = carBrandClient.getCarTypeById(typeId);
if (!com.glsx.common.utils.StringUtils.isEmpty(type.getString("data"))) {
carInfo.setType(type.getString("data"));
}
if (StringUtils.isNotBlank(order.getCarType())
&& order.getCarType().matches("^[-+]?\\d*$")) {
int typeId = Integer.parseInt(order.getCarType());
JSONObject type = carBrandClient.getCarTypeById(typeId);
if (StringUtils.isNotBlank(type.getString("data"))) {
carInfo.setType(type.getString("data"));
}
}
order.setCarInfo(carInfo);
//// 拼接品牌车型
//order.setFullCarInfo(StringUtils.join(new String[] {
// order.getCarInfo().getBrand(),
// order.getCarInfo().getSeries(),
// order.getCarInfo().getType()
//}, ""));
}
}
}
......@@ -312,23 +311,23 @@ public class OrderUtil {
* @Description: 获取车辆信息
*/
public CarInfo getCarInfo(int brandId, int serId, String carType) {
CarInfo carInfo = new CarInfo();
try {
JSONObject series = carBrandClient.getSeriesById(serId);
JSONObject brand = carBrandClient.getBrandById(brandId);
if (StringUtil.isEmpty(series.getString("data"))) {
if (StringUtils.isEmpty(series.getString("data"))) {
return null;
}
carInfo.setBrand(brand.getString("data"));
carInfo.setSeries(series.getString("data"));
// 车辆信息信息
if (!StringUtils.isEmpty(carType) && StringUtils.isNumber(carType)) {
if (!StringUtils.isEmpty(carType)
&& com.alibaba.druid.util.StringUtils.isNumber(carType)) {
int typeId = Integer.parseInt(carType);
JSONObject type = carBrandClient.getCarTypeById(typeId);
if (!com.glsx.common.utils.StringUtils.isEmpty(type.getString("data"))) {
if (!StringUtils.isEmpty(type.getString("data"))) {
carInfo.setType(type.getString("data"));
}
} else {
......@@ -342,8 +341,9 @@ public class OrderUtil {
}
public boolean isPureDigital(String string) {
if (StringUtil.isEmpty(string))
if (StringUtils.isEmpty(string)) {
return false;
}
String regEx1 = "\\d+";
Pattern p;
Matcher m;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!