Commit 3b88fe25 by 刘宇峰

特约店、围栏bug修复

1 parent 3cbb784b
...@@ -10,5 +10,6 @@ public class TrialDriveShopSearch extends Page { ...@@ -10,5 +10,6 @@ public class TrialDriveShopSearch extends Page {
private Long area; private Long area;
private Long province; private Long province;
private Long city; private Long city;
private String userIds;
} }
...@@ -36,7 +36,6 @@ import org.springframework.beans.factory.annotation.Value; ...@@ -36,7 +36,6 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope; import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -46,7 +45,7 @@ import java.util.stream.Collectors; ...@@ -46,7 +45,7 @@ import java.util.stream.Collectors;
@RefreshScope @RefreshScope
public class TrialDriveShopService { public class TrialDriveShopService {
@Value("${specialshop.user.level:4}") @Value("${specialshop.user.level:5}")
private Integer shopUserLevel; private Integer shopUserLevel;
@Autowired @Autowired
...@@ -69,12 +68,28 @@ public class TrialDriveShopService { ...@@ -69,12 +68,28 @@ public class TrialDriveShopService {
public PageInfo<TrialDriveShopDTO> search(TrialDriveShopSearch search) { public PageInfo<TrialDriveShopDTO> search(TrialDriveShopSearch search) {
Page page = PageHelper.startPage(search.getPageNumber(), search.getPageSize()); Page page = PageHelper.startPage(search.getPageNumber(), search.getPageSize());
if (search.getCity() != null) {
R<List<User>> byOrg = userService.findByOrg(new FindUserRequest().setOrgIds(Lists.newArrayList(search.getCity())));
List<User> userList = byOrg.getDataList(new TypeToken<List<User>>() {
}.getType());
search.setUserIds(StringUtils.join(userList.stream().map(User::getId).toArray(), ","));
}
List<TrialDriveShopDTO> list = trialDriveShopMapper.search(search); List<TrialDriveShopDTO> list = trialDriveShopMapper.search(search);
organizaService.drawOrganization(list); organizaService.drawOrganization(list);
return new PageInfo<>(list); return new PageInfo<>(list);
} }
public List<TrialDriveShopExport> export(TrialDriveShopSearch search) { public List<TrialDriveShopExport> export(TrialDriveShopSearch search) {
if (search.getCity() != null) {
R<List<User>> byOrg = userService.findByOrg(new FindUserRequest().setOrgIds(Lists.newArrayList(search.getCity())));
List<User> userList = byOrg.getDataList(new TypeToken<List<User>>() {
}.getType());
search.setUserIds(StringUtils.join(userList.stream().map(User::getId).toArray(), ","));
}
List<TrialDriveShopExport> list = trialDriveShopMapper.export(search); List<TrialDriveShopExport> list = trialDriveShopMapper.export(search);
organizaService.drawOrganization(list); organizaService.drawOrganization(list);
return list; return list;
......
...@@ -93,7 +93,7 @@ ...@@ -93,7 +93,7 @@
left join t_trial_drive_shop ttds on ttds.created_by = tu.id left join t_trial_drive_shop ttds on ttds.created_by = tu.id
left join t_electric_fence_copy tefc on tefc.fence_id = tef.id left join t_electric_fence_copy tefc on tefc.fence_id = tef.id
left join (select * from t_approval where id in (select MAX(id) from t_approval group by biz_id,biz_type)) ta on ta.biz_id = tefc.id and ta.biz_type = 1 left join (select * from t_approval where id in (select MAX(id) from t_approval group by biz_id,biz_type)) ta on ta.biz_id = tefc.id and ta.biz_type = 1
where tef.del_flag = 0 where tef.del_flag = 0 and ttds.del_flag = 0
and tef.biz_fence_type = 12 and tef.biz_fence_type = 12
<if test="term != null and term !=''"> <if test="term != null and term !=''">
and ( and (
...@@ -123,7 +123,7 @@ ...@@ -123,7 +123,7 @@
left join t_trial_drive_shop ttds on ttds.created_by = tu.id left join t_trial_drive_shop ttds on ttds.created_by = tu.id
left join t_electric_fence_copy tefc on tefc.fence_id = tef.id left join t_electric_fence_copy tefc on tefc.fence_id = tef.id
left join (select * from t_approval where id in (select MAX(id) from t_approval group by biz_id,biz_type)) ta on ta.biz_id = tefc.id and ta.biz_type = 1 left join (select * from t_approval where id in (select MAX(id) from t_approval group by biz_id,biz_type)) ta on ta.biz_id = tefc.id and ta.biz_type = 1
where tef.del_flag = 0 where tef.del_flag = 0 and ttds.del_flag = 0
and tef.biz_fence_type = 12 and tef.biz_fence_type = 12
<if test="term != null and term !=''"> <if test="term != null and term !=''">
and ( and (
......
...@@ -51,14 +51,8 @@ ...@@ -51,14 +51,8 @@
tu.account like CONCAT('%',#{term},'%') tu.account like CONCAT('%',#{term},'%')
) )
</if> </if>
<if test="area != null and area !=''"> <if test="userIds != null and userIds !=''">
and ttds.created_by in (select tu.id from t_user tu where tu.department_id = #{area}) and find_in_set(ttds.created_by,#{userIds})
</if>
<if test="province != null and province !=''">
and ttds.created_by in (select tu.id from t_user tu where tu.department_id = #{province})
</if>
<if test="city != null and city !=''">
and ttds.created_by in (select tu.id from t_user tu where tu.department_id = #{city})
</if> </if>
order by ttds.id desc order by ttds.id desc
</select> </select>
...@@ -88,14 +82,8 @@ ...@@ -88,14 +82,8 @@
tu.account like CONCAT('%',#{term},'%') tu.account like CONCAT('%',#{term},'%')
) )
</if> </if>
<if test="area != null and area !=''"> <if test="userIds != null and userIds !=''">
and ttds.created_by in (select tu.id from t_user tu where tu.department_id = #{area}) and find_in_set(ttds.created_by,#{userIds})
</if>
<if test="province != null and province !=''">
and ttds.created_by in (select tu.id from t_user tu where tu.department_id = #{province})
</if>
<if test="city != null and city !=''">
and ttds.created_by in (select tu.id from t_user tu where tu.department_id = #{city})
</if> </if>
order by ttds.id desc order by ttds.id desc
</select> </select>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!