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 { ...@@ -39,7 +39,7 @@ public interface SysOrderMapper {
*/ */
int getOrderCount(SysOrder sysOrder); 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); 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 { ...@@ -1889,7 +1889,16 @@ public class OrderServiceImpl implements IOrderService {
dateStart = setStartDate(selectType); dateStart = setStartDate(selectType);
dateEnd = DateUtil.formatDate(now); 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; Integer amount = 0;
// 计算总数 // 计算总数
for (ServiceItemInfo serviceItemInfo : serviceItemInfoList) { for (ServiceItemInfo serviceItemInfo : serviceItemInfoList) {
......
...@@ -614,89 +614,98 @@ ...@@ -614,89 +614,98 @@
LIMIT 10 LIMIT 10
</select> </select>
<select id="getOrderCount" parameterType="com.glsx.ordercenter.pojo.SysOrder" resultType="Integer"> <select id="getOrderCount" parameterType="com.glsx.ordercenter.pojo.SysOrder" resultType="Integer">
select select
count(1) count(1)
from sys_order from sys_order
<where> <where>
<if test="beginDate != null and beginDate != ''"> <if test="beginDate != null and beginDate != ''">
and DATE_FORMAT(create_time, '%Y-%m-%d') &gt;= #{beginDate} and DATE_FORMAT(create_time, '%Y-%m-%d') &gt;= #{beginDate}
</if> </if>
<if test="endDate != null and endDate != ''"> <if test="endDate != null and endDate != ''">
and DATE_FORMAT(create_time, '%Y-%m-%d') &lt;= #{endDate} and DATE_FORMAT(create_time, '%Y-%m-%d') &lt;= #{endDate}
</if> </if>
</where> </where>
</select> </select>
<select id="getServiceItemScale" resultType="com.glsx.ordercenter.dto.ServiceItemInfo"> <select id="getServiceItemScale" resultType="com.glsx.ordercenter.dto.ServiceItemInfo">
SELECT SELECT
install_device_type installDeviceType, install_device_type installDeviceType,
COUNT(install_device_type) count COUNT(install_device_type) count
FROM <choose>
sys_user_org suo <when test="userType == 1">
LEFT JOIN sys_user su ON suo.org_id = su.org_id FROM
LEFT JOIN sys_order so ON su.id = so.merchant_id sys_order so
WHERE WHERE so.merchant_id = #{userId}
so.order_type = 1 </when>
AND active_status = 8 <otherwise>
AND suo.user_id = #{userId} 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 !=''"> <if test="dateStart != null and dateEnd!=null and dateStart !='' and dateEnd !=''">
and so.complete_time between #{dateStart,jdbcType=TIMESTAMP} and #{dateEnd,jdbcType=TIMESTAMP} and so.complete_time between #{dateStart,jdbcType=TIMESTAMP} and #{dateEnd,jdbcType=TIMESTAMP}
</if> </if>
GROUP BY install_device_type GROUP BY install_device_type
</select> </select>
<select id="getMechanicBusiness" resultType="com.glsx.ordercenter.dto.MechanicBusiness"> <select id="getMechanicBusiness" resultType="com.glsx.ordercenter.dto.MechanicBusiness">
SELECT SELECT
su.id mechanicId, su.id mechanicId,
COUNT(so.mechanic_id) count COUNT(so.mechanic_id) count
FROM FROM
sys_user_org suo LEFT JOIN sys_user su ON suo.org_id = su.org_id 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 LEFT JOIN sys_order so ON su.id = so.mechanic_id
WHERE WHERE
order_type = 1 order_type = 1
AND active_status = 8 AND active_status = 8
AND suo.user_id = #{userId} AND suo.user_id = #{userId}
<if test="dateStart != null and dateEnd!=null and dateStart !='' and dateEnd !=''"> <if test="dateStart != null and dateEnd!=null and dateStart !='' and dateEnd !=''">
and so.complete_time between #{dateStart,jdbcType=TIMESTAMP} and #{dateEnd,jdbcType=TIMESTAMP} and so.complete_time between #{dateStart,jdbcType=TIMESTAMP} and #{dateEnd,jdbcType=TIMESTAMP}
</if> </if>
<if test="mechanicId != null "> <if test="mechanicId != null ">
and so.mechanic_id = #{mechanicId} and so.mechanic_id = #{mechanicId}
</if> </if>
GROUP BY GROUP BY
so.mechanic_id so.mechanic_id
ORDER BY count desc ORDER BY count desc
</select> </select>
<select id="getAfterSaleRepairList" parameterType="com.glsx.ordercenter.pojo.SysOrder" resultMap="BaseResultMap"> <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 + '%'"/> <bind name="queryContent" value="'%' + queryContent + '%'"/>
</if> </if>
select select
so.id, so.order_sn, so.active_status, so.canceled, so.order_type, 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.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.service_type, so.car_owner, so.car_owner_phone, 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.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.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,
so.vin_no_picture, so.install_location_picture, so.complete_time, so.install_remark, so.install_device_type, so.vin_no_picture, so.install_location_picture, so.complete_time, so.install_remark, so.install_device_type,
sor.after_sale_type sor.after_sale_type
from from
sys_order_repair sor sys_order_repair sor
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> <where>
sor.order_id = #{id} sor.order_id = #{id}
<if test="canceled != null"> <if test="canceled != null">
and so.canceled = #{canceled} and so.canceled = #{canceled}
</if> </if>
<if test="activeStatus != null"> <if test="activeStatus != null">
and so.active_status = #{activeStatus} and so.active_status = #{activeStatus}
</if> </if>
<if test="queryContent != null and queryContent != ''"> <if test="queryContent != null and queryContent != ''">
and (so.order_sn like #{queryContent} or so.vin_no like #{queryContent} or so.car_owner like #{queryContent}) and (so.order_sn like #{queryContent} or so.vin_no like #{queryContent} or so.car_owner like
</if> #{queryContent})
</where> </if>
</where>
</select> </select>
<select id="getAfterSaleDetail" resultMap="BaseResultMap"> <select id="getAfterSaleDetail" resultMap="BaseResultMap">
select select
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!