master
liuqingkun 3 years ago
parent a9ff7eed94
commit 966b2063e6
  1. 70
      src/main/java/org/springblade/common/utils/FileUploadUtil.java
  2. 55
      src/main/java/org/springblade/modules/business/controller/ReportController.java
  3. 25
      src/main/java/org/springblade/modules/business/mapper/AppealMapper.xml
  4. 21
      src/main/java/org/springblade/modules/business/mapper/AppealRegMapper.xml
  5. 1
      src/main/java/org/springblade/modules/business/service/impl/AppealMediationServiceImpl.java
  6. 2
      src/main/java/org/springblade/modules/business/service/impl/AppealRegServiceImpl.java
  7. 31
      src/main/java/org/springblade/modules/business/service/impl/LargeScreenServiceImpl.java
  8. 1
      src/main/java/org/springblade/modules/business/vo/AppealMediationVO.java
  9. 17
      src/main/java/org/springblade/modules/resource/endpoint/OssEndpoint.java
  10. 11
      src/main/resources/application-dev.yml

@ -0,0 +1,70 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package org.springblade.common.utils;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
import java.time.LocalDate;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import java.util.function.Predicate;
/**
* 通用工具类
*
* @author Chill
*/
public class FileUploadUtil {
static final String FILE_SAVE_PATH = "/root/docker-nginx/html/mpimg";
/**
* 上传文件
*
* @param file
* @return
*/
public static String UploadFile(MultipartFile file) {
String dirPath = "/" + LocalDate.now().getYear() + "-" + LocalDate.now().getMonthValue();
//判断该路径是否存在
File dir = new File(FILE_SAVE_PATH + dirPath);
if (!dir.exists()) {
//如果这个文件夹不存在的话,就创建这个文件
dir.mkdirs();
}
//获取文件名
String fileName = file.getOriginalFilename();
//获取文件后缀名
String suffixName = fileName.substring(fileName.lastIndexOf("."));
//重新生成文件名
fileName = UUID.randomUUID() + suffixName;
//完成文件上传
try {
file.transferTo(new File(FILE_SAVE_PATH + dirPath + "/" + fileName));
} catch (IOException e) {
e.printStackTrace();
}
return dirPath + "/" + fileName;
}
}

@ -19,6 +19,8 @@ package org.springblade.modules.business.controller;
import com.github.xiaoymin.knife4j.annotations.ApiSort; import com.github.xiaoymin.knife4j.annotations.ApiSort;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.common.cache.DictBizCache;
import org.springblade.common.constant.BusinessConstant;
import org.springblade.common.constant.CommonConstant; import org.springblade.common.constant.CommonConstant;
import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
@ -26,11 +28,16 @@ import org.springblade.core.mp.support.Query;
import org.springblade.core.tenant.annotation.TenantDS; import org.springblade.core.tenant.annotation.TenantDS;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.modules.business.service.ILargeScreenService; import org.springblade.modules.business.service.ILargeScreenService;
import org.springblade.modules.system.entity.DictBiz;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.text.ParseException; import java.text.ParseException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* 控制器 * 控制器
@ -92,7 +99,8 @@ public class ReportController extends BladeController {
*/ */
@GetMapping("/getAppealSubmitCountByLoc") @GetMapping("/getAppealSubmitCountByLoc")
public R getAppealSubmitCountByLoc(Integer timeFrame, String startTime, String endTime) throws ParseException { public R getAppealSubmitCountByLoc(Integer timeFrame, String startTime, String endTime) throws ParseException {
return R.data(largeScreenService.getAppealSubmitCountByLoc(timeFrame, startTime, endTime)); Map<String, Object> dataList = largeScreenService.getAppealSubmitCountByLoc(timeFrame, startTime, endTime);
return R.data(getSortAndData(dataList));
} }
/** /**
@ -100,7 +108,8 @@ public class ReportController extends BladeController {
*/ */
@GetMapping("/getAppealFinishCountByLoc") @GetMapping("/getAppealFinishCountByLoc")
public R getAppealFinishCountByLoc(Integer timeFrame, String startTime, String endTime) throws ParseException { public R getAppealFinishCountByLoc(Integer timeFrame, String startTime, String endTime) throws ParseException {
return R.data(largeScreenService.getAppealFinishCountByLoc(timeFrame, startTime, endTime)); Map<String, Object> dataList = largeScreenService.getAppealFinishCountByLoc(timeFrame, startTime, endTime);
return R.data(getSortAndData(dataList));
} }
/** /**
@ -108,7 +117,8 @@ public class ReportController extends BladeController {
*/ */
@GetMapping("/getImmediateCountByLoc") @GetMapping("/getImmediateCountByLoc")
public R getImmediateCountByLoc(Integer timeFrame, String startTime, String endTime) throws ParseException { public R getImmediateCountByLoc(Integer timeFrame, String startTime, String endTime) throws ParseException {
return R.data(largeScreenService.getImmediateCountByLoc(timeFrame, startTime, endTime)); Map<String, Object> dataList = largeScreenService.getImmediateCountByLoc(timeFrame, startTime, endTime);
return R.data(getSortAndData(dataList));
} }
/** /**
@ -127,4 +137,43 @@ public class ReportController extends BladeController {
return R.data(largeScreenService.getAppealHot()); return R.data(largeScreenService.getAppealHot());
} }
private Map<String, Map<String, Object>> getSortAndData(Map<String, Object> dataList) {
// 获取全部街道
List<DictBiz> streetDictList = DictBizCache.getList(BusinessConstant.DICT_KEY_STREET);
// 先将数据根据value做个排名
List<Map.Entry<String, Object>> list = new ArrayList<>(dataList.entrySet());
list.sort((o1, o2) -> (int) o2.getValue() - (int) o1.getValue());
// 构建返回数据
Map<String, Object> levelMap = new HashMap<>();
Map<String, Object> dataMap = new HashMap<>();
for (int idx = 0; idx < list.size(); idx++) {
String streetName = list.get(idx).getKey();
Object streetValue = list.get(idx).getValue();
if (idx < 4) {
levelMap.put(streetName, 3);
} else if (idx < 8) {
levelMap.put(streetName, 2);
} else {
levelMap.put(streetName, 1);
}
dataMap.put(streetName, streetValue);
}
// 遍历全部街道列表, 将未添加的街道数据添加上
streetDictList.forEach(street -> {
String streetName = street.getDictValue();
if (!levelMap.containsKey(streetName)) {
levelMap.put(streetName, 1);
dataMap.put(streetName, 0);
}
});
Map<String, Map<String, Object>> resultMap = new HashMap<>();
resultMap.put("levelList", levelMap);
resultMap.put("dataList", dataMap);
return resultMap;
}
} }

@ -3,21 +3,20 @@
<mapper namespace="org.springblade.modules.business.mapper.AppealMapper"> <mapper namespace="org.springblade.modules.business.mapper.AppealMapper">
<select id="exportAppeal" resultType="org.springblade.modules.business.excel.AppealExcel"> <select id="exportAppeal" resultType="org.springblade.modules.business.excel.AppealExcel">
SELECT SELECT if(a.dispute_id IS NULL, a.dispute_name, biz.dict_value) AS disputeName, vistor.username, a.first_reg_time AS firstRegTime,
if(a.dispute_id is null, a.dispute_name, biz.dict_value) as disputeName, CASE a.dispute_level WHEN 0 THEN '简单' WHEN 1 THEN '一般' WHEN 2 THEN '重大' WHEN 3 THEN '疑难' ELSE '' END disputeLevel,
b.username, if(a.street_id IS NULL, '', biz.dict_value) AS streetId, a.problem_desc AS problemDesc,
a.first_reg_time as firstRegTime, CASE a.status WHEN 0 THEN '待处理' WHEN 1 THEN '正在处理' WHEN 2 THEN '达成协议' WHEN 3 THEN '调解成功' ELSE '' END `status`,
CASE a.dispute_level when 0 then '简单' when 1 then '一般' when 2 then '重大' when 3 then '疑难' else '' end if(a.handle_dept IS NULL, '', u.name) AS handleDept
disputeLevel,
if(a.street_id is null, '', biz.dict_value) as streetId,
a.problem_desc as problemDesc,
CASE a.status when 0 then '待处理' when 1 then '正在处理' when 2 then '达成协议' when 3 then '调解成功' else '' end status,
if(a.handle_dept is null, '', u.name) as handleDept
FROM mp_appeal a FROM mp_appeal a
LEFT JOIN mp_appeal_visitor b ON a.id = b.appeal_id LEFT JOIN (
SELECT appeal_id, GROUP_CONCAT(username) username
FROM (SELECT DISTINCT vistor.appeal_id, vistor.username FROM mp_appeal_visitor vistor) t
GROUP BY appeal_id
) vistor ON a.id = vistor.appeal_id
LEFT JOIN blade_dict_biz biz ON a.dispute_id = biz.id LEFT JOIN blade_dict_biz biz ON a.dispute_id = biz.id
LEFT JOIN blade_user u ON a.handle_dept = u.id LEFT JOIN blade_user u ON a.handle_dept = u.id
WHERE a.source_type = 0 and b.sort = 1 WHERE a.source_type = 0
<if test="appealStatus != null and appealStatus != ''"> <if test="appealStatus != null and appealStatus != ''">
and a.status = #{appealStatus} and a.status = #{appealStatus}
</if> </if>
@ -34,7 +33,7 @@
and a.handle_dept = #{windowId} and a.handle_dept = #{windowId}
</if> </if>
<if test="username != null and username != ''"> <if test="username != null and username != ''">
and b.username like concat(concat('%', #{username}), '%') and vistor.username like concat(concat('%', #{username}), '%')
</if> </if>
ORDER BY a.first_reg_time DESC ORDER BY a.first_reg_time DESC
</select> </select>

@ -3,29 +3,16 @@
<mapper namespace="org.springblade.modules.business.mapper.AppealRegMapper"> <mapper namespace="org.springblade.modules.business.mapper.AppealRegMapper">
<select id="getList" resultType="org.springblade.modules.business.vo.AppealListVO"> <select id="getList" resultType="org.springblade.modules.business.vo.AppealListVO">
SELECT a.id, b.username, b.cardno, if(a.dispute_id is null, a.dispute_name, biz.dict_value) as disputeName, SELECT a.id, b.username, b.cardno, if(a.dispute_id is NULL OR a.dispute_id = -1, a.dispute_name, biz.dict_value) as disputeName,
a.first_reg_time as firstRegTime, a.finish_time as finishTime, a.problem_desc as problemDesc, a.`status` a.first_reg_time as firstRegTime, a.finish_time as finishTime, a.problem_desc as problemDesc, a.`status`
FROM mp_appeal a FROM mp_appeal a
LEFT JOIN ( LEFT JOIN (
/* 先找出每个诉求的最后一次登记的第一个人 */ /* 先找出每个诉求的最后一次登记的第一个人 */
SELECT t3.* SELECT t3.*
FROM (
/* 找出每个诉求的最后一次登记记录 */ /* 找出每个诉求的最后一次登记记录 */
SELECT t.* FROM (SELECT t.* FROM (SELECT *, ROW_NUMBER() OVER(PARTITION BY appeal_id ORDER BY create_time DESC) AS row_index FROM mp_appeal_reg reg) t WHERE t.row_index = 1) t2
FROM (
SELECT *, ROW_NUMBER() OVER(PARTITION BY appeal_id
ORDER BY create_time DESC) AS row_index
FROM mp_appeal_reg reg
WHERE 1 = 1
) t
WHERE t.row_index = 1
) t2
LEFT JOIN (
/* 找出每次登记的第一张用户 */ /* 找出每次登记的第一张用户 */
SELECT * LEFT JOIN (SELECT t.* FROM (SELECT *, ROW_NUMBER() OVER(PARTITION BY appeal_reg_id ORDER BY sort ASC) AS row_index FROM mp_appeal_visitor vis) t WHERE t.row_index = 1) t3 ON t2.id = t3.appeal_reg_id
FROM mp_appeal_visitor vis
WHERE vis.sort = 1
)t3 ON t2.id = t3.appeal_reg_id
) b ON a.id = b.appeal_id ) b ON a.id = b.appeal_id
LEFT JOIN blade_dict_biz biz ON a.dispute_id = biz.id LEFT JOIN blade_dict_biz biz ON a.dispute_id = biz.id
WHERE a.source_type = 0 WHERE a.source_type = 0
@ -51,7 +38,7 @@
</select> </select>
<select id="getPage" resultType="org.springblade.modules.business.vo.AppealListVO"> <select id="getPage" resultType="org.springblade.modules.business.vo.AppealListVO">
SELECT a.id, b.username, b.cardno, if(a.dispute_id is null, a.dispute_name, biz.dict_value) as disputeName, SELECT a.id, b.username, b.cardno, if(a.dispute_id is NULL OR a.dispute_id = -1, a.dispute_name, biz.dict_value) as disputeName,
a.first_reg_time as firstRegTime, a.finish_time as finishTime, a.problem_desc as problemDesc, a.`status` a.first_reg_time as firstRegTime, a.finish_time as finishTime, a.problem_desc as problemDesc, a.`status`
FROM mp_appeal a FROM mp_appeal a
LEFT JOIN ( LEFT JOIN (

@ -137,6 +137,7 @@ public class AppealMediationServiceImpl extends BaseServiceImpl<AppealMediationM
// 4. 组织返回对象数据 // 4. 组织返回对象数据
vo.setAppealId(Long.valueOf(appealId)); vo.setAppealId(Long.valueOf(appealId));
vo.setAppealRegId(appealReg.getId()); vo.setAppealRegId(appealReg.getId());
vo.setMediationId(mediationId);
vo.setVisitors(visitorList); vo.setVisitors(visitorList);
vo.setSkipGrant(appeal.getSkipGrant()); vo.setSkipGrant(appeal.getSkipGrant());
vo.setPersonNum(visitorList.size()); vo.setPersonNum(visitorList.size());

@ -240,6 +240,8 @@ public class AppealRegServiceImpl extends BaseServiceImpl<AppealRegMapper, Appea
} }
} }
// 先将状态设置默认值: 正在处理
appeal.setStatus(BusinessConstant.APPEAL_STATUS_HANDING);
// 诉求状态(办理状态) // 诉求状态(办理状态)
if (StringUtils.isNotBlank(excel.getStatus())) { if (StringUtils.isNotBlank(excel.getStatus())) {
if ("正在处理".equals(excel.getStatus())) { if ("正在处理".equals(excel.getStatus())) {

@ -234,17 +234,11 @@ public class LargeScreenServiceImpl implements ILargeScreenService {
result.add(hashMap); result.add(hashMap);
} }
} else { } else {
// 如果类型大于5,前五正常计算,其余全部按照其他纠纷计算 // 取最大的前5个
int idx = 0; int idx = 0;
int subNum = 0; int subNum = 0;
while (subNum < 4) { while (subNum < 5) {
Map.Entry<String, Integer> entry = list.get(idx); Map.Entry<String, Integer> entry = list.get(idx);
if (entry.getKey().contains("其他")) {
idx++;
continue;
}
hashMap = new HashMap<>(); hashMap = new HashMap<>();
hashMap.put("name", entry.getKey()); hashMap.put("name", entry.getKey());
hashMap.put("value", entry.getValue()); hashMap.put("value", entry.getValue());
@ -254,16 +248,16 @@ public class LargeScreenServiceImpl implements ILargeScreenService {
subNum++; subNum++;
} }
int size = 0; // int size = 0;
for (; idx < list.size(); idx++) { // for (; idx < list.size(); idx++) {
Map.Entry<String, Integer> entry = list.get(idx); // Map.Entry<String, Integer> entry = list.get(idx);
size += entry.getValue(); // size += entry.getValue();
} // }
//
hashMap = new HashMap<>(); // hashMap = new HashMap<>();
hashMap.put("name", "其他纠纷"); // hashMap.put("name", "其他纠纷");
hashMap.put("value", size + otherDisputeNum); // hashMap.put("value", size + otherDisputeNum);
result.add(hashMap); // result.add(hashMap);
} }
return result; return result;
@ -393,7 +387,6 @@ public class LargeScreenServiceImpl implements ILargeScreenService {
return iPage; return iPage;
} }
@Override @Override
public Map<String, List<DataEntity>> getAppealHot() { public Map<String, List<DataEntity>> getAppealHot() {
Map<String, List<DataEntity>> map = new HashMap(); Map<String, List<DataEntity>> map = new HashMap();

@ -37,6 +37,7 @@ public class AppealMediationVO implements Serializable {
private Long appealId; private Long appealId;
private Long appealRegId; private Long appealRegId;
private String mediationId;
/** /**
* 来访人列表 * 来访人列表

@ -20,6 +20,7 @@ import io.swagger.annotations.Api;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springblade.common.utils.FileUploadUtil;
import org.springblade.core.launch.constant.AppConstant; import org.springblade.core.launch.constant.AppConstant;
import org.springblade.core.oss.model.BladeFile; import org.springblade.core.oss.model.BladeFile;
import org.springblade.core.oss.model.OssFile; import org.springblade.core.oss.model.OssFile;
@ -32,9 +33,13 @@ import org.springblade.core.tool.utils.Func;
import org.springblade.modules.resource.builder.oss.OssBuilder; import org.springblade.modules.resource.builder.oss.OssBuilder;
import org.springblade.modules.resource.entity.Attach; import org.springblade.modules.resource.entity.Attach;
import org.springblade.modules.resource.service.IAttachService; import org.springblade.modules.resource.service.IAttachService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.util.UUID;
/** /**
* 对象存储端点 * 对象存储端点
* *
@ -152,7 +157,17 @@ public class OssEndpoint {
return R.fail("上传失败, 文件格式错误!"); return R.fail("上传失败, 文件格式错误!");
} }
BladeFile bladeFile = ossBuilder.template().putFile(file.getOriginalFilename(), file.getInputStream()); // BladeFile bladeFile = ossBuilder.template().putFile(file.getOriginalFilename(), file.getInputStream());
//获取访问相对路径
String savePath = FileUploadUtil.UploadFile(file);
// 组织文件访问地址, 即要访问服务器的域名
String host = "http://tmpshop.cas-air.cn/minio";
BladeFile bladeFile = new BladeFile();
bladeFile.setOriginalName(savePath);
bladeFile.setLink(host + savePath);
return R.data(bladeFile); return R.data(bladeFile);
} }

@ -20,12 +20,13 @@ spring:
#spring: #spring:
# redis: # redis:
# ##redis 单机环境配置 # ##redis 单机环境配置
# host: 223.80.105.200 # host: 127.0.0.1
# port: 41307 # port: 6379
# password: asdf.1234 # password:
# database: 0 # database: 0
# ssl: false # ssl: false
# datasource: # datasource:
# url: jdbc:mysql://223.80.105.200:41306/mediation_platform?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true # # MySql
# url: jdbc:mysql://localhost:3306/mediation_platform?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
# username: root # username: root
# password: asdf.1234 # password: 123456

Loading…
Cancel
Save