|
|
|
|
@ -18,14 +18,17 @@ package org.springblade.modules.business.service.impl; |
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import io.swagger.models.auth.In; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
import org.springblade.common.cache.DictBizCache; |
|
|
|
|
import org.springblade.modules.business.entity.Appeal; |
|
|
|
|
import org.springblade.modules.business.entity.AppealVisitor; |
|
|
|
|
import org.springblade.modules.business.service.IAppealService; |
|
|
|
|
import org.springblade.modules.business.service.IAppealVisitorService; |
|
|
|
|
import org.springblade.modules.business.service.ILargeScreenService; |
|
|
|
|
import org.springblade.modules.business.utils.LocalDateTimeUtils; |
|
|
|
|
import org.springblade.modules.system.service.IUserService; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
import java.text.DecimalFormat; |
|
|
|
|
@ -49,6 +52,10 @@ public class LargeScreenServiceImpl implements ILargeScreenService { |
|
|
|
|
|
|
|
|
|
private final IAppealService appealService; |
|
|
|
|
|
|
|
|
|
private final IAppealVisitorService appealVisitorService; |
|
|
|
|
|
|
|
|
|
private final IUserService userService; |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Map<String, Object> getMediateFinish() { |
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
@ -310,12 +317,60 @@ public class LargeScreenServiceImpl implements ILargeScreenService { |
|
|
|
|
wrapper.eq(Appeal::getSkipGrant, 1); |
|
|
|
|
IPage<Appeal> iPage = appealService.page(page, wrapper); |
|
|
|
|
|
|
|
|
|
// 给每条数据赋值来访人姓名
|
|
|
|
|
List<Appeal> records = iPage.getRecords(); |
|
|
|
|
if (CollectionUtils.isNotEmpty(records)) { |
|
|
|
|
for (Appeal record : records) { |
|
|
|
|
// 获取sort=1的来访人
|
|
|
|
|
AppealVisitor visitor = appealVisitorService.getOne(new LambdaQueryWrapper<AppealVisitor>().eq(AppealVisitor::getAppealId, record.getId()).eq(AppealVisitor::getSort, 1)); |
|
|
|
|
if (visitor != null) { |
|
|
|
|
record.setUsername(visitor.getUsername()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
iPage.setRecords(records); |
|
|
|
|
} |
|
|
|
|
return iPage; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Map<String, Object> getAppealHot() { |
|
|
|
|
return null; |
|
|
|
|
public Map<String, Map<String, Object>> getAppealHot() { |
|
|
|
|
Map<String, Map<String, Object>> map = new HashMap(); |
|
|
|
|
// 化解成功状态数组
|
|
|
|
|
List<Integer> state = new ArrayList<>(); |
|
|
|
|
state.add(2); |
|
|
|
|
state.add(3); |
|
|
|
|
|
|
|
|
|
LambdaQueryWrapper<Appeal> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
wrapper.in(Appeal::getStatus, state); |
|
|
|
|
List<Appeal> appeals = appealService.list(wrapper); |
|
|
|
|
appeals.forEach(appeal -> { |
|
|
|
|
appeal.setStreet(DictBizCache.getById(appeal.getStreetId()).getDictValue()); |
|
|
|
|
appeal.setName(userService.getById(appeal.getHandleDept()).getName()); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
// 根据街道分组
|
|
|
|
|
Map<String, List<Appeal>> street = appeals.stream().collect(Collectors.groupingBy(Appeal::getStreet)); |
|
|
|
|
Set<String> names = street.keySet(); |
|
|
|
|
|
|
|
|
|
// 街道对应的数量
|
|
|
|
|
Map<String, Object> streetMap = new HashMap<>(); |
|
|
|
|
for (String name : names) { |
|
|
|
|
streetMap.put(name, street.get(name).size()); |
|
|
|
|
} |
|
|
|
|
map.put("street", streetMap); |
|
|
|
|
|
|
|
|
|
// 根据部门分组
|
|
|
|
|
Map<String, List<Appeal>> town = appeals.stream().collect(Collectors.groupingBy(Appeal::getName)); |
|
|
|
|
Set<String> depts = town.keySet(); |
|
|
|
|
|
|
|
|
|
// 部门对应的数量
|
|
|
|
|
Map<String, Object> townMap = new HashMap<>(); |
|
|
|
|
for (String name : depts) { |
|
|
|
|
townMap.put(name, town.get(name).size()); |
|
|
|
|
} |
|
|
|
|
map.put("town", townMap); |
|
|
|
|
|
|
|
|
|
return map; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private Map<String, List<Object>> getStartAndEndTime(Map<String, List<Object>> map, List<Integer> state, Integer month) { |
|
|
|
|
|