Commit 9115d9b4 by duanhq

服务类占比 by duanht 2019/3/21

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@18755 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent be05a108
......@@ -39,7 +39,7 @@ public interface SysOrderMapper {
*/
int getOrderCount(SysOrder sysOrder);
List<ServiceItemInfo> getServiceItemScale(@Param("userId")int userId, @Param("dateStart")String dateStart, @Param("dateEnd")String dateEnd);
List<ServiceItemInfo> getServiceItemScale(@Param("userType")Byte userType,@Param("userId")int userId, @Param("dateStart")String dateStart, @Param("dateEnd")String dateEnd);
List<MechanicBusiness> getMechanicBusiness(@Param("userId")int userId, @Param("dateStart")String dateStart, @Param("dateEnd")String dateEnd,@Param("mechanicId")Integer mechanicId);
......
......@@ -1889,7 +1889,16 @@ public class OrderServiceImpl implements IOrderService {
dateStart = setStartDate(selectType);
dateEnd = DateUtil.formatDate(now);
}
List<ServiceItemInfo> serviceItemInfoList = orderDao.getServiceItemScale(userId, dateStart, dateEnd);
//服务商不需要通过组织权限查询,直接关联订单表即可
Byte userType = null;
JSONObject obj = userClient.getUserById(userId);
if (obj != null && obj.getIntValue("code") == ResultCodeEnum.SUCCESS.getCode()) {
JSONObject data = obj.getJSONObject("data");
userType = data.getByte("userType");
}
List<ServiceItemInfo> serviceItemInfoList = orderDao.getServiceItemScale(userType,userId, dateStart, dateEnd);
Integer amount = 0;
// 计算总数
for (ServiceItemInfo serviceItemInfo : serviceItemInfoList) {
......
......@@ -614,89 +614,98 @@
LIMIT 10
</select>
<select id="getOrderCount" parameterType="com.glsx.ordercenter.pojo.SysOrder" resultType="Integer">
select
count(1)
from sys_order
<where>
<if test="beginDate != null and beginDate != ''">
and DATE_FORMAT(create_time, '%Y-%m-%d') &gt;= #{beginDate}
</if>
<if test="endDate != null and endDate != ''">
and DATE_FORMAT(create_time, '%Y-%m-%d') &lt;= #{endDate}
</if>
</where>
</select>
<select id="getOrderCount" parameterType="com.glsx.ordercenter.pojo.SysOrder" resultType="Integer">
select
count(1)
from sys_order
<where>
<if test="beginDate != null and beginDate != ''">
and DATE_FORMAT(create_time, '%Y-%m-%d') &gt;= #{beginDate}
</if>
<if test="endDate != null and endDate != ''">
and DATE_FORMAT(create_time, '%Y-%m-%d') &lt;= #{endDate}
</if>
</where>
</select>
<select id="getServiceItemScale" resultType="com.glsx.ordercenter.dto.ServiceItemInfo">
SELECT
install_device_type installDeviceType,
COUNT(install_device_type) count
FROM
sys_user_org suo
LEFT JOIN sys_user su ON suo.org_id = su.org_id
LEFT JOIN sys_order so ON su.id = so.merchant_id
WHERE
so.order_type = 1
AND active_status = 8
AND suo.user_id = #{userId}
<select id="getServiceItemScale" resultType="com.glsx.ordercenter.dto.ServiceItemInfo">
SELECT
install_device_type installDeviceType,
COUNT(install_device_type) count
<choose>
<when test="userType == 1">
FROM
sys_order so
WHERE so.merchant_id = #{userId}
</when>
<otherwise>
FROM
sys_user_org suo
LEFT JOIN sys_user su ON suo.org_id = su.org_id
LEFT JOIN sys_order so ON su.id = so.merchant_id
WHERE suo.user_id = #{userId}
</otherwise>
</choose>
AND so.order_type = 1
AND active_status = 8
<if test="dateStart != null and dateEnd!=null and dateStart !='' and dateEnd !=''">
and so.complete_time between #{dateStart,jdbcType=TIMESTAMP} and #{dateEnd,jdbcType=TIMESTAMP}
</if>
GROUP BY install_device_type
</select>
<select id="getMechanicBusiness" resultType="com.glsx.ordercenter.dto.MechanicBusiness">
SELECT
su.id mechanicId,
COUNT(so.mechanic_id) count
FROM
sys_user_org suo LEFT JOIN sys_user su ON suo.org_id = su.org_id
LEFT JOIN sys_order so ON su.id = so.mechanic_id
WHERE
order_type = 1
AND active_status = 8
AND suo.user_id = #{userId}
<if test="dateStart != null and dateEnd!=null and dateStart !='' and dateEnd !=''">
and so.complete_time between #{dateStart,jdbcType=TIMESTAMP} and #{dateEnd,jdbcType=TIMESTAMP}
</if>
<select id="getMechanicBusiness" resultType="com.glsx.ordercenter.dto.MechanicBusiness">
SELECT
su.id mechanicId,
COUNT(so.mechanic_id) count
FROM
sys_user_org suo LEFT JOIN sys_user su ON suo.org_id = su.org_id
LEFT JOIN sys_order so ON su.id = so.mechanic_id
WHERE
order_type = 1
AND active_status = 8
AND suo.user_id = #{userId}
<if test="dateStart != null and dateEnd!=null and dateStart !='' and dateEnd !=''">
and so.complete_time between #{dateStart,jdbcType=TIMESTAMP} and #{dateEnd,jdbcType=TIMESTAMP}
</if>
<if test="mechanicId != null ">
and so.mechanic_id = #{mechanicId}
and so.mechanic_id = #{mechanicId}
</if>
GROUP BY
so.mechanic_id
ORDER BY count desc
</select>
</select>
<select id="getAfterSaleRepairList" parameterType="com.glsx.ordercenter.pojo.SysOrder" resultMap="BaseResultMap">
<if test="queryContent != null and queryContent != ''">
<if test="queryContent != null and queryContent != ''">
<bind name="queryContent" value="'%' + queryContent + '%'"/>
</if>
select
so.id, so.order_sn, so.active_status, so.canceled, so.order_type,
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.expect_install_time, so.service_type, so.car_owner, so.car_owner_phone,
so.cancel_time, so.active_status_array, so.merchant_id, so.mechanic_id, so.repair_reason,
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.vin_no_picture, so.install_location_picture, so.complete_time, so.install_remark, so.install_device_type,
sor.after_sale_type
from
sys_order_repair sor
LEFT JOIN sys_order so on sor.sub_order_id = so.id
<where>
sor.order_id = #{id}
<if test="canceled != null">
and so.canceled = #{canceled}
</if>
<if test="activeStatus != null">
and so.active_status = #{activeStatus}
</if>
<if test="queryContent != null and queryContent != ''">
and (so.order_sn like #{queryContent} or so.vin_no like #{queryContent} or so.car_owner like #{queryContent})
</if>
</where>
</if>
select
so.id, so.order_sn, so.active_status, so.canceled, so.order_type,
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.expect_install_time, so.service_type, so.car_owner, so.car_owner_phone,
so.cancel_time, so.active_status_array, so.merchant_id, so.mechanic_id, so.repair_reason,
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.vin_no_picture, so.install_location_picture, so.complete_time, so.install_remark, so.install_device_type,
sor.after_sale_type
from
sys_order_repair sor
LEFT JOIN sys_order so on sor.sub_order_id = so.id
<where>
sor.order_id = #{id}
<if test="canceled != null">
and so.canceled = #{canceled}
</if>
<if test="activeStatus != null">
and so.active_status = #{activeStatus}
</if>
<if test="queryContent != null and queryContent != ''">
and (so.order_sn like #{queryContent} or so.vin_no like #{queryContent} or so.car_owner like
#{queryContent})
</if>
</where>
</select>
<select id="getAfterSaleDetail" resultMap="BaseResultMap">
select
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!