Commit b4979fa7 by duanhq

v 1.1.2 工单列表修改

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@21397 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent 8f4f9f6a
...@@ -110,6 +110,35 @@ public class OrderController extends BaseController { ...@@ -110,6 +110,35 @@ public class OrderController extends BaseController {
return new ResultObject(ResultCodeEnum.SUCCESS.getCode(), ResultCodeEnum.SUCCESS.getMsg(), result); return new ResultObject(ResultCodeEnum.SUCCESS.getCode(), ResultCodeEnum.SUCCESS.getMsg(), result);
} }
@AuthCheck
@SuppressWarnings("resource")
@RequestMapping(value = "/getOrderListByExample", method = { RequestMethod.GET, RequestMethod.POST })
public ResultObject getOrderList(HttpServletRequest request, QueryOrderReq oueryOrderReq,
@RequestParam(defaultValue = "1") int pageIndex, @RequestParam(defaultValue = "10") int pageSize) {
Map<String, Object> result = new HashMap<String, Object>();
// TODO 获取当前用户信息 根据用户角色筛选订单
// int userId = UserUtils.getUserId(request);
if(oueryOrderReq!=null){
logger.info("订单搜索传递的参数:"+JSONObject.toJSONString(oueryOrderReq));
}
// SysUser sysUser =orderService.getUser(UserUtils.getUserId(request));
SysOrderExample example = new SysOrderExample();
// sysUser.setUserType(userType);
oueryOrderReq.setUserId( UserUtils.getUserId(request));
List<SysOrder> list = orderService.getOrderListByExample(pageIndex, pageSize, oueryOrderReq);
Page page = new Page(pageIndex, pageSize);
com.github.pagehelper.Page<SysOrder> pages = (com.github.pagehelper.Page<SysOrder>) list;
page.setTotalCount((int) pages.getTotal());
result.put("page", page);
result.put("items", list);
return new ResultObject(ResultCodeEnum.SUCCESS.getCode(), ResultCodeEnum.SUCCESS.getMsg(), result);
}
/** /**
* @param request * @param request
* @param sysOrder * @param sysOrder
......
...@@ -48,6 +48,70 @@ public class QueryOrderReq implements Serializable{ ...@@ -48,6 +48,70 @@ public class QueryOrderReq implements Serializable{
private String dateEnd; private String dateEnd;
private String machanicInfo; private String machanicInfo;
private Boolean detail; private Boolean detail;
private Integer userType;
private Integer userId;
private String vinNo;
private String carOwner;
private String shopName;
private String province;
private String city;
private String workOrderNo;
public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getShopName() {
return shopName;
}
public void setShopName(String shopName) {
this.shopName = shopName;
}
public String getCarOwner() {
return carOwner;
}
public void setCarOwner(String carOwner) {
this.carOwner = carOwner;
}
public String getVinNo() {
return vinNo;
}
public void setVinNo(String vinNo) {
this.vinNo = vinNo;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public Integer getUserType() {
return userType;
}
public void setUserType(Integer userType) {
this.userType = userType;
}
public Boolean getDetail() { public Boolean getDetail() {
return detail; return detail;
...@@ -98,5 +162,11 @@ public class QueryOrderReq implements Serializable{ ...@@ -98,5 +162,11 @@ public class QueryOrderReq implements Serializable{
this.machanicInfo = machanicInfo; this.machanicInfo = machanicInfo;
} }
public String getWorkOrderNo() {
return workOrderNo;
}
public void setWorkOrderNo(String workOrderNo) {
this.workOrderNo = workOrderNo;
}
} }
...@@ -3,6 +3,7 @@ package com.glsx.ordercenter.mapper; ...@@ -3,6 +3,7 @@ package com.glsx.ordercenter.mapper;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.glsx.ordercenter.dto.QueryOrderReq;
import com.glsx.ordercenter.pojo.OrderOnHand; import com.glsx.ordercenter.pojo.OrderOnHand;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -136,4 +137,16 @@ public interface SysOrderMapper { ...@@ -136,4 +137,16 @@ public interface SysOrderMapper {
* *
*/ */
List<SysOrder> getUnknowOrderList(SysOrder order); List<SysOrder> getUnknowOrderList(SysOrder order);
/**
*
* @author duanht
* @Title: getOrderListByExample
* @Description: TODO 获取订单列表
* @param oueryOrderReq
* @return
* List<SysOrder>
*
*/
List<SysOrder> getOrderListByExample(QueryOrderReq oueryOrderReq);
} }
\ No newline at end of file \ No newline at end of file
...@@ -179,4 +179,6 @@ public interface IOrderService { ...@@ -179,4 +179,6 @@ public interface IOrderService {
void confirm(SysOrder order,Integer userId); void confirm(SysOrder order,Integer userId);
ResultObject orderBindService(SysOrder sysOrder); ResultObject orderBindService(SysOrder sysOrder);
List<SysOrder> getOrderListByExample(int page, int pageSize, QueryOrderReq oueryOrderReq);
} }
...@@ -2961,4 +2961,47 @@ public class OrderServiceImpl implements IOrderService { ...@@ -2961,4 +2961,47 @@ public class OrderServiceImpl implements IOrderService {
return new ResultObject(ResultCodeEnum.SUCCESS.getCode(),ResultCodeEnum.SUCCESS.getMsg(),result); return new ResultObject(ResultCodeEnum.SUCCESS.getCode(),ResultCodeEnum.SUCCESS.getMsg(),result);
} }
@Override
public List<SysOrder> getOrderListByExample(int page, int pageSize, QueryOrderReq oueryOrderReq) {
List<SysOrder> orderList = new ArrayList<>();
JSONObject user = getUserInfo(oueryOrderReq.getUserId());
int userType = user.getIntValue("userType");
oueryOrderReq.setUserType(userType);
// 订单结束日
if (com.glsx.common.utils.StringUtils.isNotEmpty(oueryOrderReq.getDateEnd())) {
Date endDate = DateUtil.parseDateYmd(oueryOrderReq.getDateEnd());
endDate.setHours(23);
endDate.setMinutes(59);
endDate.setSeconds(59);
oueryOrderReq.setDateEnd(DateUtil.formatDate(endDate));
}
PageHelper.startPage(page, pageSize, true);
orderList = orderDao.getOrderListByExample(oueryOrderReq);
for (SysOrder order : orderList) {
// 渠道名称
if (oueryOrderReq.getOrderChannel() != null) {
order.setOrderChannel(orderChannelDao.selectByPrimaryKey(oueryOrderReq.getOrderChannel()).getName());
} else {
if (order.getShopId() != null) {
SysUser sysuser = sysUserDao.selectByPrimaryKey(order.getShopId());
order.setOrderChannel(orderChannelDao.selectByPrimaryKey(sysuser.getGroupId()).getName());
}
}
// 技工信息
if (order.getMechanicId() != null) {
MachanicInfo machanicInfo = new MachanicInfo();
SysUser sysUser = sysUserDao.selectByPrimaryKey(order.getMechanicId());
machanicInfo.setId(order.getMechanicId());
// 有可能是username
machanicInfo.setName(sysUser.getName());
machanicInfo.setPhone(sysUser.getPhoneNumber());
order.setMachanicInfo(machanicInfo);
}
}
return orderList;
}
} }
...@@ -1081,4 +1081,203 @@ ...@@ -1081,4 +1081,203 @@
</where> </where>
ORDER BY o.create_time DESC, id DESC ORDER BY o.create_time DESC, id DESC
</select> </select>
<select id="getOrderListByExample" resultType="com.glsx.ordercenter.pojo.SysOrder">
select
DISTINCT
so.id id,
so.order_sn orderSn,
so.active_status activeStatus,
so.canceled canceled,
so.order_type orderType,
so.shop_id shopId,
so.address address,
so.create_time createTime,
so.mechanic_id mechanicId,
so.install_device_type installDeviceType,
so.service_type serviceType,
p.area_name province,
c.area_name city,
so.work_order_no workOrderNo,
so.vin_no vinNo,
so.car_owner carOwner,
ssm.shop_name merchantName
FROM
<choose>
<when test="userId == 0">
sys_order so
LEFT JOIN sys_user sp ON so.shop_id = sp.id
LEFT JOIN sys_user sm ON so.mechanic_id = sm.id
LEFT JOIN sys_merchant ssm ON so.shop_id = ssm.user_id
LEFT JOIN sys_area d ON d.id = so.district
LEFT JOIN sys_area c ON d.parent_id = c.id
LEFT JOIN sys_area p ON c.parent_id = p.id
WHERE so.active_status &lt;&gt; 9
</when>
<otherwise>
<choose>
<when test="userType == 1">
sys_order so
LEFT JOIN sys_user sp ON so.shop_id = sp.id
LEFT JOIN sys_user sm ON so.mechanic_id = sm.id
LEFT JOIN sys_merchant ssm ON so.shop_id = ssm.user_id
LEFT JOIN sys_area d ON d.id = so.district
LEFT JOIN sys_area c ON d.parent_id = c.id
LEFT JOIN sys_area p ON c.parent_id = p.id
WHERE so.merchant_id = #{userId}
and so.active_status &lt;&gt; 9
</when>
<otherwise>
sys_user_org suo
LEFT JOIN sys_user u ON suo.org_id = u.org_id
LEFT JOIN sys_order so ON so.shop_id = u.id
AND u.user_type = 2
LEFT JOIN sys_user sp ON so.shop_id = sp.id
LEFT JOIN sys_user sm ON so.mechanic_id = sm.id
LEFT JOIN sys_merchant ssm ON so.shop_id = ssm.user_id
LEFT JOIN sys_area d ON d.id = so.district
LEFT JOIN sys_area c ON d.parent_id = c.id
LEFT JOIN sys_area p ON c.parent_id = p.id
WHERE suo.user_id = #{userId}
and so.active_status &lt;&gt; 9
</otherwise>
</choose>
</otherwise>
</choose>
and (
so.work_order_no = ''
OR ISNULL(so.work_order_no)
OR (
so.work_order_no != ''
AND (so.merchant_id) IS NOT NULL
AND (so.shop_id) IS NOT NULL
)
)
<if test="orderSn != null and orderSn!=''">
and so.order_sn like "%"#{orderSn}"%"
</if>
<if test="serviceType != null and serviceType!=''">
and so.install_device_type = #{serviceType,jdbcType=VARCHAR}
</if>
<if test="dateStart != null and dateEnd!=null and dateStart !='' and dateEnd !=''">
and so.create_time between #{dateStart,jdbcType=TIMESTAMP} and #{dateEnd,jdbcType=TIMESTAMP}
</if>
<if test="orderChannel != null and orderChannel!=''">
and sp.group_id = #{orderChannel}
</if>
<if test="vinNo != null and vinNo!=''">
and so.vin_no like "%"#{vinNo}"%"
</if>
<if test="carOwner != null and carOwner!=''">
and so.car_owner like "%"#{carOwner}"%"
</if>
<if test="shopName != null and shopName!=''">
and ssm.shop_name like "%"#{shopName}"%"
</if>
<if test="province != null and province!=''">
and p.area_name like "%"#{province}"%"
</if>
<if test="city != null and city!=''">
and c.area_name like "%"#{city}"%"
</if>
<if test="workOrderNo != null and workOrderNo!=''">
and so.work_order_no like "%"#{workOrderNo}"%"
</if>
<choose>
<when test="userType == 2">
and so.shop_id = #{userId}
<if test="orderStatus != null and orderStatus!=''">
<choose>
<when test="orderStatus == 0">
and so.active_status in (1,2,3,4,5)
</when>
<when test="orderStatus == 1">
and so.active_status in (8)
</when>
<when test="orderStatus == 2">
and so.active_status in (1,2,3,4,5,6,7)
</when>
<otherwise>
and so.active_status in #{orderStatus}
</otherwise>
</choose>
</if>
</when>
<when test="userType == 3">
and so.mechanic_id = #{userId}
<if test="orderStatus != null and orderStatus!=''">
<choose>
<when test="orderStatus == 0">
and so.active_status in (4)
</when>
<when test="orderStatus == 1">
and so.active_status in (8)
</when>
<when test="orderStatus == 2">
and so.active_status in (6,7)
</when>
</choose>
</if>
</when>
<when test="userType == 1">
<if test="orderStatus != null and orderStatus!=''">
<choose>
<when test="orderStatus == 0">
and so.active_status in (1,2,5)
</when>
<when test="orderStatus == 1">
and so.active_status in (8)
</when>
<when test="orderStatus == 2">
and so.active_status in (4,6,7)
</when>
</choose>
</if>
</when>
<otherwise>
<choose>
<when test="orderStatus != null and orderStatus==0">
and so.canceled = #{orderStatus}
</when>
<when test="orderStatus != null and orderStatus>0">
and so.active_status = #{orderStatus}
and so.canceled = 1
</when>
</choose>
</otherwise>
</choose>
<if test="machanicInfo != null and machanicInfo!=''">
and (u.name like "%"#{machanicInfo}"%" or u.phone_number like "%"#{machanicInfo}"%" )
and sm.user_type = 3
</if>
order by so.create_time desc
</select>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!