Commit 38ad1eed by 杨林龙

开发试驾数据

1 parent 1c47c72b
......@@ -62,7 +62,7 @@ public class TrialDriveReportController {
data.put("totalElements", total);
return R.ok().data(data);
}
return R.error();
return R.ok().data("没有查询到任何数据");
}
@GetMapping(value = "/export")
......
......@@ -5,15 +5,16 @@ import lombok.Data;
import lombok.experimental.Accessors;
import java.util.List;
import java.util.Set;
@Data
@Accessors(chain = true)
public class TrialDriveReportSearch extends Page {
/**
* 勾选的id
* 组织下用户的Id
*/
private List<String> idList;
private Set<Long> userIdList;
/**
* 限制展示的车辆
......@@ -21,11 +22,6 @@ public class TrialDriveReportSearch extends Page {
private List<String> splitList;
/**
* 广本分组ID
*/
private Integer guangBenClassId;
/**
* sn 号
*/
private String sn;
......@@ -49,5 +45,4 @@ public class TrialDriveReportSearch extends Page {
* 特约店名称
*/
private String shopName;
}
......@@ -11,7 +11,6 @@ import com.glsx.plat.context.utils.PropertiesUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.stereotype.Service;
import java.util.*;
......@@ -30,22 +29,16 @@ public class TrialDriveReportService {
public List<TrialDriveReportExport> search(TrialDriveReportSearch search) {
String needToShowVehicleTypeList = PropertiesUtils.getProperty("glsx.effectivetestdrive.needtoshow");
Integer guangBenClassId = Integer.parseInt(PropertiesUtils.getProperty("glsx.effectivetestdrive.guangBenClassId"));
String[] splitArr = needToShowVehicleTypeList.split(",");
List<String> splitList = Arrays.asList(splitArr);
search.setSplitList(splitList);
search.setGuangBenClassId(guangBenClassId);
Integer rolePermissionType = ShieldContextHolder.getRolePermissionType();
//非管理员 并且 数据权限不是全部 的需要加上用户权限涉及的全部用户id
if (!ShieldContextHolder.isSuperAdmin() && !UserConstants.RolePermitCastType.all.getCode().equals(rolePermissionType)) {
boolean superAdminFlag = ShieldContextHolder.isSuperAdmin();
if (!superAdminFlag && !UserConstants.RolePermitCastType.all.getCode().equals(rolePermissionType)) {
Set<Long> userIdList = ShieldContextHolder.getVisibleCreatorIds();
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(userIdList)) {
//ShieldContextHolder.getVisibleCreatorIds()
} else {
}
search.setUserIdList(userIdList);
}
return trialDriveReportMapper.getTestDrivePageList(search);
......
......@@ -29,32 +29,35 @@
parameterType="cn.com.glsx.admin.modules.model.param.TrialDriveReportSearch"
resultMap="PageBaseMap">
SELECT
tu.username shopCode,
tu.userRemark shopName,
tu.account shopCode,
tu.username shopName,
tefs.sn,
tefs.standno,
tvts.vehicle_type_name vehicleTypeName
tefs.vin,
tv.model_name vehicleTypeName
from t_electric_fence_sns tefs
inner join t_electric_fence tef on tef.id = tefs.fenceId
left join t_user tu on tu.d_LoginUserId = tef.loginUserId
left join t_vehicle tv on tv.standno = tefs.standno
left join t_vehicle_type_standno tvts on tvts.standno = tv.standno
left join t_class tc on tv.classId = tc.classid
where tefs.fenceId = tef.id
and tef.bizFenceType = 1
inner join t_electric_fence tef on tef.id = tefs.fence_id
left join t_user tu on tu.id = tef.created_by
left join t_vehicle tv on tv.vin = tefs.vin
where tefs.fence_id = tef.id
and tef.biz_fence_type = 1
<if test="shopCode!=null and shopCode!=''">
and tu.username like '%${shopCode}%'
and tu.account like '%${shopCode}%'
</if>
<if test="shopName!=null and shopName!=''">
and tu.userRemark like '%${shopName}%'
and tu.username like '%${shopName}%'
</if>
<if test="guangBenClassId != null and guangBenClassId != '' ">
and tc.vehicleGroupId = #{guangBenClassId,jdbcType=INTEGER}
<if test="userIdList != null">
and tc.id IN
<foreach collection="userIdList" item="userId" index="index" open="(" close=")" separator=",">
#{userId}
</foreach>
</if>
<if test="splitList != null">
and tv.model_name IN
<foreach collection="splitList" item="vehicleTypeName" index="index" open="(" close=")" separator=",">
#{vehicleTypeName}
</foreach>
</if>
and tvts.vehicle_type_name IN
<foreach collection="splitList" item="vehicleTypeName" index="index" open="(" close=")" separator=",">
#{vehicleTypeName}
</foreach>
order by tef.id
</select>
......@@ -63,18 +66,16 @@
resultMap="BaseResultMap">
SELECT tall.shopCode, tall.shopName, tall.vehicleTypeName, tall.sn, tall.standno, left(tall.statDate,7)
statDate, tall.cnt, day(tall.statDate) dayCount , sum(cnt) cnttotal FROM
(select tu.username shopCode, tu.userRemark shopName, tvts.vehicle_type_name vehicleTypeName,
tefdd.sn,
tv.standno, DATE_FORMAT(tefdd.journey_time,'%Y-%m-%d') statDate, sum(case when tefdd.percent >= 80 then 1 else 0
(select tu.account shopCode, tu.username shopName, tv.model_name vehicleTypeName,
tefdd.sn, tv.standno, DATE_FORMAT(tefdd.journey_time,'%Y-%m-%d') statDate, sum(case when tefdd.percent >= 80
then 1 else 0
end) cnt
from t_electric_fence_drive defdd
left join t_electric_fence def on tef.id = tefdd.fence_id
left join t_track_info dti on tti.sn = tefdd.sn
left join t_vehicle dv on tv.vehicleId = tti.vehicleId
left join t_vehicle_type_standno tvts on tvts.standno = tv.standno
left join t_user du on tu.d_LoginUserId = tef.loginUserId
from t_electric_fence_drive tefdd
left join t_electric_fence tef on tef.id = tefdd.fence_id
left join t_vehicle_device tvv on tvv.sn = tefdd.sn
left join t_vehicle tv on tv.id = tvv.vehicle_id
left join t_user tu on tu.id = tef.created_by
<where>
<choose>
<when test="year != null and year != '' and month != null and month != '' ">
left(tefdd.journey_time,7) = CONCAT(#{year,jdbcType=VARCHAR},'-',#{month,jdbcType=VARCHAR})
......@@ -90,20 +91,22 @@
</choose>
<if test="shopCode !=null and shopCode != ''">
and tu.username like '%${shopCode}%'
and tu.account like '%${shopCode}%'
</if>
<if test="shopName !=null and shopName != ''">
and tu.userRemark like '%${shopName}%'
and tu.username like '%${shopName}%'
</if>
<if test="sn !=null and sn != ''">
and tefdd.sn = #{sn,jdbcType=VARCHAR}
</if>
and tvts.vehicle_type_name IN
<foreach collection="splitList" item="vehicleTypeName" index="index" open="(" close=")" separator=",">
#{vehicleTypeName}
</foreach>
<if test="splitList != null">
and tv.model_name IN
<foreach collection="splitList" item="vehicleTypeName" index="index" open="(" close=")" separator=",">
#{vehicleTypeName}
</foreach>
</if>
</where>
GROUP BY tefdd.sn,tefdd.fence_id,statDate order by tu.username) tall GROUP BY tall.shopCode, tall.sn,
GROUP BY tefdd.sn,tefdd.fence_id,statDate order by tu.account) tall GROUP BY tall.shopCode, tall.sn,
tall.statDate ORDER BY tall.shopCode
</select>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!