Commit 4a3a42f6 by zhengxj

finish 修正label为空 on 20190830

by zhengxj 

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@23734 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent 48fc1f33
...@@ -5,6 +5,24 @@ ...@@ -5,6 +5,24 @@
*/ */
package com.glsx.ordercenter.controller; package com.glsx.ordercenter.controller;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
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;
import com.alibaba.druid.util.StringUtils; import com.alibaba.druid.util.StringUtils;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.glsx.common.annotation.AuthCheck; import com.glsx.common.annotation.AuthCheck;
...@@ -20,14 +38,7 @@ import com.glsx.ordercenter.pojo.SysOrder; ...@@ -20,14 +38,7 @@ import com.glsx.ordercenter.pojo.SysOrder;
import com.glsx.ordercenter.pojo.SysOrderBiddingRecords; import com.glsx.ordercenter.pojo.SysOrderBiddingRecords;
import com.glsx.ordercenter.service.IOrderBiddingService; import com.glsx.ordercenter.service.IOrderBiddingService;
import com.glsx.ordercenter.service.IOrderService; import com.glsx.ordercenter.service.IOrderService;
import org.springframework.beans.factory.annotation.Autowired; import com.glsx.ordercenter.utils.OrderUtil;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.*;
/** /**
* @author Zheng Xiajun * @author Zheng Xiajun
...@@ -43,6 +54,8 @@ public class OrderBiddingController extends BaseController { ...@@ -43,6 +54,8 @@ public class OrderBiddingController extends BaseController {
private IOrderBiddingService orderBiddingService; private IOrderBiddingService orderBiddingService;
@Autowired @Autowired
private IOrderService orderService; private IOrderService orderService;
@Autowired
private OrderUtil orderUtil;
@SuppressWarnings("resource") @SuppressWarnings("resource")
/** /**
...@@ -148,13 +161,28 @@ public class OrderBiddingController extends BaseController { ...@@ -148,13 +161,28 @@ public class OrderBiddingController extends BaseController {
@RequestParam(defaultValue = "1") int pageIndex, @RequestParam(defaultValue = "10") int pageSize, @RequestParam(defaultValue = "1") int pageIndex, @RequestParam(defaultValue = "10") int pageSize,
@RequestParam(required = true) Integer orderId, String keyWord) { @RequestParam(required = true) Integer orderId, String keyWord) {
int isSelectByPhoneNumber = 0;
// 构建关键字搜索条件
if (StringUtils.isEmpty(keyWord)) {
keyWord = null;
}
if (!StringUtils.isEmpty(keyWord)) {
if (keyWord.length() < 2) {
return new ResultObject(ResultCodeEnum.FAIL.getCode(), "输入字符过短,请请输入正确的查询条件");
}
if (keyWord.length() >= 4 && orderUtil.isPureDigital(keyWord)) {
// 按电话号搜索
isSelectByPhoneNumber = 1;
}
}
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
if (StringUtils.isEmpty(keyWord)) { if (StringUtils.isEmpty(keyWord)) {
keyWord = null; keyWord = null;
} }
List<BiddingOrderResp> list = orderBiddingService.selectByOrderIdAndKeyWord(pageIndex, pageSize, orderId, List<BiddingOrderResp> list = orderBiddingService.selectByOrderIdAndKeyWord(pageIndex, pageSize, orderId,
keyWord); keyWord,isSelectByPhoneNumber);
Page page = new Page(pageIndex, pageSize); Page page = new Page(pageIndex, pageSize);
com.github.pagehelper.Page<BiddingOrderResp> pages = (com.github.pagehelper.Page<BiddingOrderResp>) list; com.github.pagehelper.Page<BiddingOrderResp> pages = (com.github.pagehelper.Page<BiddingOrderResp>) list;
page.setTotalCount((int) pages.getTotal()); page.setTotalCount((int) pages.getTotal());
...@@ -217,7 +245,6 @@ public class OrderBiddingController extends BaseController { ...@@ -217,7 +245,6 @@ public class OrderBiddingController extends BaseController {
@RequestParam(defaultValue = "1") int pageIndex, @RequestParam(defaultValue = "10") int pageSize) { @RequestParam(defaultValue = "1") int pageIndex, @RequestParam(defaultValue = "10") int pageSize) {
Map<String, Object> result = new HashMap<String, Object>(); Map<String, Object> result = new HashMap<String, Object>();
// 获取当前用户信息 根据用户角色筛选订单 // 获取当前用户信息 根据用户角色筛选订单
Integer serviceId = UserUtils.getUserId(request); Integer serviceId = UserUtils.getUserId(request);
Page page = new Page(pageIndex, pageSize); Page page = new Page(pageIndex, pageSize);
...@@ -302,7 +329,7 @@ public class OrderBiddingController extends BaseController { ...@@ -302,7 +329,7 @@ public class OrderBiddingController extends BaseController {
* *
*/ */
@RequestMapping(value = "/updateBiddingOrderNoBidList", method = {RequestMethod.POST}) @RequestMapping(value = "/updateBiddingOrderNoBidList", method = {RequestMethod.POST})
public ResultObject updateBiddingOrderNoBidList() { public ResultObject updateBiddingrderNoBidList() {
orderBiddingService.updateBiddingOrderNoBidList(); orderBiddingService.updateBiddingOrderNoBidList();
return new ResultObject(ResultCodeEnum.SUCCESS.getCode(), ResultCodeEnum.SUCCESS.getMsg()); return new ResultObject(ResultCodeEnum.SUCCESS.getCode(), ResultCodeEnum.SUCCESS.getMsg());
} }
......
...@@ -28,7 +28,7 @@ public interface SysOrderBiddingRecordsMapper { ...@@ -28,7 +28,7 @@ public interface SysOrderBiddingRecordsMapper {
int updateByPrimaryKey(SysOrderBiddingRecords record); int updateByPrimaryKey(SysOrderBiddingRecords record);
List<BiddingOrderResp> selectBiddingList(@Param("orderId") Integer orderId,@Param("keyWord") String keyWord); List<BiddingOrderResp> selectBiddingList(@Param("orderId") Integer orderId,@Param("keyWord") String keyWord,@Param("isSelectByPhone")int isSelectByPhone);
List<String> selectUserServiceItems(@Param("userId") Integer userId); List<String> selectUserServiceItems(@Param("userId") Integer userId);
......
...@@ -52,7 +52,7 @@ public interface IOrderBiddingService { ...@@ -52,7 +52,7 @@ public interface IOrderBiddingService {
ResultObject appointServiceProvider(SysOrderBiddingRecords record); ResultObject appointServiceProvider(SysOrderBiddingRecords record);
List<BiddingOrderResp> selectByOrderIdAndKeyWord(int pageIndex, int pageSize, Integer orderId, String keyWord); List<BiddingOrderResp> selectByOrderIdAndKeyWord(int pageIndex, int pageSize, Integer orderId, String keyWord,int isSelectByPhone);
/** /**
* *
......
...@@ -25,7 +25,6 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -25,7 +25,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import com.alibaba.druid.util.StringUtils;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
...@@ -482,9 +481,9 @@ public class OrderBiddingServiceImpl implements IOrderBiddingService { ...@@ -482,9 +481,9 @@ public class OrderBiddingServiceImpl implements IOrderBiddingService {
*/ */
@Override @Override
public List<BiddingOrderResp> selectByOrderIdAndKeyWord(int pageIndex, int pageSize, Integer orderId, public List<BiddingOrderResp> selectByOrderIdAndKeyWord(int pageIndex, int pageSize, Integer orderId,
String keyWord) { String keyWord,int isSelectByPhone) {
PageHelper.startPage(pageIndex, pageSize); PageHelper.startPage(pageIndex, pageSize);
List<BiddingOrderResp> list = sysOrderBiddingRecordsMapper.selectBiddingList(orderId, keyWord); List<BiddingOrderResp> list = sysOrderBiddingRecordsMapper.selectBiddingList(orderId, keyWord,isSelectByPhone);
if (!list.isEmpty()) { if (!list.isEmpty()) {
for (BiddingOrderResp bor : list) { for (BiddingOrderResp bor : list) {
bor.setServiceItems(sysOrderBiddingRecordsMapper.selectUserServiceItems(bor.getServiceId())); bor.setServiceItems(sysOrderBiddingRecordsMapper.selectUserServiceItems(bor.getServiceId()));
...@@ -510,10 +509,7 @@ public class OrderBiddingServiceImpl implements IOrderBiddingService { ...@@ -510,10 +509,7 @@ public class OrderBiddingServiceImpl implements IOrderBiddingService {
PageHelper.startPage(page.getPageIndex(), page.getPageSize(), true); PageHelper.startPage(page.getPageIndex(), page.getPageSize(), true);
} }
// 构建关键字搜索条件
if (StringUtils.isEmpty(keyWord)) {
keyWord = null;
}
List<SysOrder> orderList = sysOrderBiddingRecordsMapper.selectBiddingOrders(serviceId, keyWord); List<SysOrder> orderList = sysOrderBiddingRecordsMapper.selectBiddingOrders(serviceId, keyWord);
// 获取车辆信息 // 获取车辆信息
......
...@@ -5,6 +5,7 @@ import java.util.Date; ...@@ -5,6 +5,7 @@ import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -258,4 +259,21 @@ public class OrderUtil { ...@@ -258,4 +259,21 @@ public class OrderUtil {
return carInfo; return carInfo;
} }
public boolean isPureDigital(String string) {
if (StringUtil.isEmpty(string))
return false;
String regEx1 = "\\d+";
Pattern p;
Matcher m;
p = Pattern.compile(regEx1);
m = p.matcher(string);
if (m.matches())
return true;
else
return false;
}
} }
...@@ -205,10 +205,15 @@ ...@@ -205,10 +205,15 @@
<if test="orderId != null"> <if test="orderId != null">
and order_id = #{orderId,jdbcType=INTEGER} and order_id = #{orderId,jdbcType=INTEGER}
</if> </if>
<if test="isSelectByPhone=1">
AND su.phone_number LIKE CONCAT('%',#{keyWord},'%')
</if>
<if test="isSelectByPhone=0">
<if test="keyWord != null"> <if test="keyWord != null">
AND ( su.`name` LIKE CONCAT('%',#{keyWord},'%') OR su.phone_number LIKE CONCAT('%',#{keyWord},'%') OR AND ( su.`name` LIKE CONCAT('%',#{keyWord},'%') OR
sdd.data_value LIKE CONCAT('%',#{keyWord},'%')) sdd.data_value LIKE CONCAT('%',#{keyWord},'%'))
</if> </if>
</if>
</where> </where>
GROUP BY id GROUP BY id
ORDER BY create_time ASC ORDER BY create_time ASC
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!