|
|
|
|
@ -19,18 +19,27 @@ package org.springblade.modules.business.service.impl; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
import org.springblade.common.cache.DictBizCache; |
|
|
|
|
import org.springblade.common.enums.DictBizEnum; |
|
|
|
|
import org.springblade.core.tool.utils.BeanUtil; |
|
|
|
|
import org.springblade.modules.business.entity.Appeal; |
|
|
|
|
import org.springblade.modules.business.entity.AppealVisitor; |
|
|
|
|
import org.springblade.modules.business.entity.DataEntity; |
|
|
|
|
import org.springblade.modules.business.excel.AppealExcel; |
|
|
|
|
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.entity.Dict; |
|
|
|
|
import org.springblade.modules.system.entity.DictBiz; |
|
|
|
|
import org.springblade.modules.system.entity.User; |
|
|
|
|
import org.springblade.modules.system.service.IDictBizService; |
|
|
|
|
import org.springblade.modules.system.service.IUserService; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
import java.text.DecimalFormat; |
|
|
|
|
import java.text.ParseException; |
|
|
|
|
@ -57,6 +66,8 @@ public class LargeScreenServiceImpl implements ILargeScreenService { |
|
|
|
|
|
|
|
|
|
private final IUserService userService; |
|
|
|
|
|
|
|
|
|
private final IDictBizService dictBizService; |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Map<String, Object> getMediateFinish() { |
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
@ -197,11 +208,14 @@ public class LargeScreenServiceImpl implements ILargeScreenService { |
|
|
|
|
Map<String, Object> hashMap = new HashMap<>(); |
|
|
|
|
DecimalFormat df = new DecimalFormat("#0.0"); |
|
|
|
|
|
|
|
|
|
// 如果类型小于5,正常计算
|
|
|
|
|
if (list.size() <= 5) { |
|
|
|
|
for (Map.Entry<String, Integer> entry : list) { |
|
|
|
|
hashMap.put(entry.getKey(), df.format((double) entry.getValue() / (double) appeals.size() * 100) + "%"); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
} |
|
|
|
|
// 如果类型大于5,前五正常计算,其余全部按照其他纠纷计算
|
|
|
|
|
else { |
|
|
|
|
for (int i = 0; i < 5; i++) { |
|
|
|
|
Map.Entry<String, Integer> entry = list.get(i); |
|
|
|
|
hashMap.put(entry.getKey(), df.format((double) entry.getValue() / (double) appeals.size() * 100) + "%"); |
|
|
|
|
@ -212,7 +226,6 @@ public class LargeScreenServiceImpl implements ILargeScreenService { |
|
|
|
|
size += entry.getValue(); |
|
|
|
|
} |
|
|
|
|
hashMap.put("其他纠纷", df.format((double) size / (double) appeals.size() * 100) + "%"); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return hashMap; |
|
|
|
|
@ -334,6 +347,96 @@ public class LargeScreenServiceImpl implements ILargeScreenService { |
|
|
|
|
return iPage; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@Transactional |
|
|
|
|
public void importAppeal(List<AppealExcel> excels) { |
|
|
|
|
if (CollectionUtils.isNotEmpty(excels)) { |
|
|
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
|
List<Appeal> appeals = new ArrayList<>(); |
|
|
|
|
List<AppealVisitor> visitors = new ArrayList<>(); |
|
|
|
|
excels.forEach(excel -> { |
|
|
|
|
if (StringUtils.isNotBlank(excel.getDisputeName())) { |
|
|
|
|
Appeal appeal = Objects.requireNonNull(BeanUtil.copy(excel, Appeal.class)); |
|
|
|
|
appeal.setId(IdWorker.getId()); |
|
|
|
|
// 所属街道字典id
|
|
|
|
|
if (StringUtils.isNotBlank(excel.getStreetId())) { |
|
|
|
|
List<DictBiz> street = dictBizService.list(new LambdaQueryWrapper<DictBiz>().eq(DictBiz::getCode, "street").like(DictBiz::getDictValue, excel.getStreetId())); |
|
|
|
|
if (CollectionUtils.isNotEmpty(street)) { |
|
|
|
|
appeal.setStreetId(street.get(0).getId()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 纠纷字典id
|
|
|
|
|
if (StringUtils.isNotBlank(appeal.getDisputeName())) { |
|
|
|
|
List<DictBiz> values = dictBizService.list(new LambdaQueryWrapper<DictBiz>().eq(DictBiz::getCode, "dispute_type").like(DictBiz::getDictValue, appeal.getDisputeName())); |
|
|
|
|
if (CollectionUtils.isNotEmpty(values)) { |
|
|
|
|
appeal.setDisputeId(values.get(0).getId()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 数据录入时, 处理部门
|
|
|
|
|
if (StringUtils.isNotBlank(excel.getHandleDept())) { |
|
|
|
|
List<User> users = userService.list(new LambdaQueryWrapper<User>().like(User::getName, excel.getHandleDept())); |
|
|
|
|
if (CollectionUtils.isNotEmpty(users)) { |
|
|
|
|
appeal.setHandleDept(users.get(0).getId()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 纠纷等级(事件等级), 0:简单, 1:一般, 2:重大, 3:疑难
|
|
|
|
|
if (StringUtils.isNotBlank(excel.getDisputeLevel())) { |
|
|
|
|
if ("简单".equals(excel.getDisputeLevel())) { |
|
|
|
|
appeal.setDisputeLevel(0); |
|
|
|
|
} else if ("一般".equals(excel.getDisputeLevel())) { |
|
|
|
|
appeal.setDisputeLevel(1); |
|
|
|
|
} else if ("重大".equals(excel.getDisputeLevel())) { |
|
|
|
|
appeal.setDisputeLevel(2); |
|
|
|
|
} else if ("疑难".equals(excel.getDisputeLevel())) { |
|
|
|
|
appeal.setDisputeLevel(3); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 首次登记时间
|
|
|
|
|
if (StringUtils.isNotBlank(excel.getFirstRegTime())) { |
|
|
|
|
try { |
|
|
|
|
appeal.setFirstRegTime(dateFormat.parse(excel.getFirstRegTime())); |
|
|
|
|
} catch (ParseException e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 诉求状态(办理状态)
|
|
|
|
|
if (StringUtils.isNotBlank(excel.getStatus())) { |
|
|
|
|
if ("正在处理".equals(excel.getStatus())) { |
|
|
|
|
appeal.setStatus(1); |
|
|
|
|
} else if ("达成协议".equals(excel.getStatus())) { |
|
|
|
|
appeal.setStatus(2); |
|
|
|
|
} else if ("调解成功".equals(excel.getStatus()) || "完成归档".equals(excel.getStatus())) { |
|
|
|
|
appeal.setStatus(3); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 是否越级上报
|
|
|
|
|
appeal.setSkipGrant(0); |
|
|
|
|
|
|
|
|
|
// 数据来源 0:系统添加, 1:数据导入
|
|
|
|
|
appeal.setSourceType(1); |
|
|
|
|
|
|
|
|
|
// 上访人员
|
|
|
|
|
if (StringUtils.isNotBlank(excel.getUsername())) { |
|
|
|
|
AppealVisitor visitor = new AppealVisitor(); |
|
|
|
|
visitor.setAppealId(appeal.getId()); |
|
|
|
|
visitor.setSort(1); |
|
|
|
|
visitor.setUsername(excel.getUsername()); |
|
|
|
|
visitors.add(visitor); |
|
|
|
|
} |
|
|
|
|
appeals.add(appeal); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
appealService.saveBatch(appeals); |
|
|
|
|
appealVisitorService.saveBatch(visitors); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Map<String, List<DataEntity>> getAppealHot() { |
|
|
|
|
Map<String, List<DataEntity>> map = new HashMap(); |
|
|
|
|
|