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
......
...@@ -47,8 +47,72 @@ public class QueryOrderReq implements Serializable{ ...@@ -47,8 +47,72 @@ public class QueryOrderReq implements Serializable{
private String dateStart; private String dateStart;
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;
} }
...@@ -97,6 +161,12 @@ public class QueryOrderReq implements Serializable{ ...@@ -97,6 +161,12 @@ public class QueryOrderReq implements Serializable{
public void setMachanicInfo(String machanicInfo) { public void setMachanicInfo(String machanicInfo) {
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;
...@@ -126,9 +127,9 @@ public interface SysOrderMapper { ...@@ -126,9 +127,9 @@ public interface SysOrderMapper {
int updateOrdersBindShop(SysOrder sysOrder); int updateOrdersBindShop(SysOrder sysOrder);
/** /**
* *
* @author zhanghj * @author zhanghj
* @Title: getUnknowOrderList * @Title: getUnknowOrderList
* @Description: TODO 获取未知订单列表 * @Description: TODO 获取未知订单列表
* @param order * @param order
* @return * @return
...@@ -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;
}
} }
...@@ -110,7 +110,7 @@ ...@@ -110,7 +110,7 @@
</if> </if>
</select> </select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from sys_order from sys_order
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
...@@ -123,34 +123,34 @@ ...@@ -123,34 +123,34 @@
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer"> <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID() SELECT LAST_INSERT_ID()
</selectKey> </selectKey>
insert into sys_order (order_sn, active_status, canceled, insert into sys_order (order_sn, active_status, canceled,
order_type, shop_id, district, order_type, shop_id, district,
address, contact, phone_number, address, contact, phone_number,
car_brand, car_series, car_type, car_brand, car_series, car_type,
vin_no, car_color, expect_install_time, vin_no, car_color, expect_install_time,
service_type, car_owner, car_owner_phone, service_type, car_owner, car_owner_phone,
cancel_time, active_status_array, merchant_id, cancel_time, active_status_array, merchant_id,
mechanic_id, repair_reason, remark, mechanic_id, repair_reason, remark,
create_time, update_time, create_by, create_time, update_time, create_by,
update_by, device_no, install_location, update_by, device_no, install_location,
overdue_reason, repair_type, car_picture, overdue_reason, repair_type, car_picture,
vin_no_picture, install_location_picture, complete_time, vin_no_picture, install_location_picture, complete_time,
install_remark, install_device_type, reserve_install_time, install_remark, install_device_type, reserve_install_time,
work_order_no, channel, merchant_name work_order_no, channel, merchant_name
) )
values (#{orderSn,jdbcType=VARCHAR}, #{activeStatus,jdbcType=TINYINT}, #{canceled,jdbcType=TINYINT}, values (#{orderSn,jdbcType=VARCHAR}, #{activeStatus,jdbcType=TINYINT}, #{canceled,jdbcType=TINYINT},
#{orderType,jdbcType=TINYINT}, #{shopId,jdbcType=INTEGER}, #{district,jdbcType=INTEGER}, #{orderType,jdbcType=TINYINT}, #{shopId,jdbcType=INTEGER}, #{district,jdbcType=INTEGER},
#{address,jdbcType=VARCHAR}, #{contact,jdbcType=VARCHAR}, #{phoneNumber,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR}, #{contact,jdbcType=VARCHAR}, #{phoneNumber,jdbcType=VARCHAR},
#{carBrand,jdbcType=INTEGER}, #{carSeries,jdbcType=INTEGER}, #{carType,jdbcType=VARCHAR}, #{carBrand,jdbcType=INTEGER}, #{carSeries,jdbcType=INTEGER}, #{carType,jdbcType=VARCHAR},
#{vinNo,jdbcType=VARCHAR}, #{carColor,jdbcType=VARCHAR}, #{expectInstallTime,jdbcType=TIMESTAMP}, #{vinNo,jdbcType=VARCHAR}, #{carColor,jdbcType=VARCHAR}, #{expectInstallTime,jdbcType=TIMESTAMP},
#{serviceType,jdbcType=VARCHAR}, #{carOwner,jdbcType=VARCHAR}, #{carOwnerPhone,jdbcType=VARCHAR}, #{serviceType,jdbcType=VARCHAR}, #{carOwner,jdbcType=VARCHAR}, #{carOwnerPhone,jdbcType=VARCHAR},
#{cancelTime,jdbcType=TIMESTAMP}, #{activeStatusArray,jdbcType=VARCHAR}, #{merchantId,jdbcType=INTEGER}, #{cancelTime,jdbcType=TIMESTAMP}, #{activeStatusArray,jdbcType=VARCHAR}, #{merchantId,jdbcType=INTEGER},
#{mechanicId,jdbcType=INTEGER}, #{repairReason,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{mechanicId,jdbcType=INTEGER}, #{repairReason,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{createBy,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{createBy,jdbcType=INTEGER},
#{updateBy,jdbcType=INTEGER}, #{deviceNo,jdbcType=VARCHAR}, #{installLocation,jdbcType=VARCHAR}, #{updateBy,jdbcType=INTEGER}, #{deviceNo,jdbcType=VARCHAR}, #{installLocation,jdbcType=VARCHAR},
#{overdueReason,jdbcType=VARCHAR}, #{repairType,jdbcType=TINYINT}, #{carPicture,jdbcType=VARCHAR}, #{overdueReason,jdbcType=VARCHAR}, #{repairType,jdbcType=TINYINT}, #{carPicture,jdbcType=VARCHAR},
#{vinNoPicture,jdbcType=VARCHAR}, #{installLocationPicture,jdbcType=VARCHAR}, #{completeTime,jdbcType=TIMESTAMP}, #{vinNoPicture,jdbcType=VARCHAR}, #{installLocationPicture,jdbcType=VARCHAR}, #{completeTime,jdbcType=TIMESTAMP},
#{installRemark,jdbcType=VARCHAR}, #{installDeviceType,jdbcType=VARCHAR}, #{reserveInstallTime,jdbcType=TIMESTAMP}, #{installRemark,jdbcType=VARCHAR}, #{installDeviceType,jdbcType=VARCHAR}, #{reserveInstallTime,jdbcType=TIMESTAMP},
#{workOrderNo,jdbcType=VARCHAR}, #{channel,jdbcType=VARCHAR}, #{merchantName,jdbcType=VARCHAR} #{workOrderNo,jdbcType=VARCHAR}, #{channel,jdbcType=VARCHAR}, #{merchantName,jdbcType=VARCHAR}
) )
</insert> </insert>
...@@ -649,7 +649,7 @@ ...@@ -649,7 +649,7 @@
LEFT JOIN LEFT JOIN
sys_merchant sm ON so.shop_id = sm.id sys_merchant sm ON so.shop_id = sm.id
<where> <where>
1=1 1=1
<if test="ids != null"> <if test="ids != null">
and shop_id in and shop_id in
<foreach item="item" collection="ids" separator="," open="(" <foreach item="item" collection="ids" separator="," open="("
...@@ -665,7 +665,7 @@ ...@@ -665,7 +665,7 @@
<if test="merchantId != null"> <if test="merchantId != null">
and so.merchant_id = #{merchantId} and so.merchant_id = #{merchantId}
</if> </if>
</where> </where>
GROUP BY shop_id GROUP BY shop_id
ORDER BY biz_amount DESC ORDER BY biz_amount DESC
...@@ -772,7 +772,7 @@ ...@@ -772,7 +772,7 @@
so.id, so.order_sn, so.active_status, so.order_type, so.id, so.order_sn, so.active_status, so.order_type,
so.shop_id, so.district, so.address , so.contact, so.phone_number, so.shop_id, so.district, so.address , so.contact, so.phone_number,
so.car_brand, so.car_series, so.car_type, so.vin_no, so.car_color, so.car_brand, so.car_series, so.car_type, so.vin_no, so.car_color,
so.expect_install_time, so.car_owner, so.car_owner_phone,so.repair_reason, so.complete_time, so.expect_install_time, so.car_owner, so.car_owner_phone,so.repair_reason, so.complete_time,
<!-- so.merchant_id, so.merchant_id, so.mechanic_id, so.repair_reason, <!-- so.merchant_id, so.merchant_id, so.mechanic_id, so.repair_reason,
so.remark, so.create_time, so.update_time, so.create_by, so.update_by, so.remark, so.create_time, so.update_time, so.create_by, so.update_by,
so.device_no, so.install_location, so.overdue_reason, so.repair_type, so.car_picture, so.device_no, so.install_location, so.overdue_reason, so.repair_type, so.car_picture,
...@@ -784,14 +784,14 @@ ...@@ -784,14 +784,14 @@
LEFT JOIN sys_order so on sor.sub_order_id = so.id LEFT JOIN sys_order so on sor.sub_order_id = so.id
where 1=1 where 1=1
<if test="orderId != null"> <if test="orderId != null">
and so.canceled = 1 and so.canceled = 1
and sor.order_id = #{orderId} and sor.order_id = #{orderId}
and so.active_status !=8 and so.active_status !=8
and so.order_type != 1 and so.order_type != 1
</if> </if>
<if test="orderSn != null"> <if test="orderSn != null">
and so.order_sn = #{orderSn} and so.order_sn = #{orderSn}
</if> </if>
</select> </select>
<select id="getOrderOnHand" resultType="com.glsx.ordercenter.pojo.OrderOnHand"> <select id="getOrderOnHand" resultType="com.glsx.ordercenter.pojo.OrderOnHand">
SELECT so.id,so.order_sn AS orderSn,so.order_type AS orderType,so.active_status AS activeStatus,so.merchant_id AS merchantId, SELECT so.id,so.order_sn AS orderSn,so.order_type AS orderType,so.active_status AS activeStatus,so.merchant_id AS merchantId,
...@@ -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!