优化
This commit is contained in:
parent
ec5b329ddc
commit
b00a543d16
@ -17,7 +17,6 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@ -96,6 +95,23 @@ public class FileController {
|
||||
fileStorageService.download(fileInfo).outputStream(response.getOutputStream());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取预览文件流
|
||||
*/
|
||||
// @OperLog(operModul = "文件管理", operType = "获取预览文件流", operDesc = "获取预览文件流")
|
||||
// @ApiOperation(value = "获取预览文件流", notes = "获取预览文件流", httpMethod="POST")
|
||||
// @GetMapping("/preview")
|
||||
// public void download(@RequestParam(value = "fileUrl", required = true) String fileUrl, HttpServletResponse response) throws Exception {
|
||||
// // 获取文件信息
|
||||
// FileInfo fileInfo = fileStorageService.getFileInfoByUrl(fileUrl);
|
||||
// if (null == fileInfo) {
|
||||
// throw new Exception("缩略图文件预览失败,文件不存在!fileInfo:" + fileInfo);
|
||||
// }
|
||||
// response.setHeader("Content-disposition", "attachment; filename=" + URLEncoder.encode(fileInfo.getOriginalFilename(), "UTF-8"));
|
||||
// response.setContentType("application/octet-stream");// 定义输出类型
|
||||
// fileStorageService.download(fileInfo).outputStream(response.getOutputStream());
|
||||
// }
|
||||
|
||||
/**
|
||||
* 获取预览文件流
|
||||
*/
|
||||
@ -104,12 +120,6 @@ public class FileController {
|
||||
@GetMapping("/preview")
|
||||
public void download(@RequestParam(value = "fileUrl", required = true) String fileUrl, HttpServletResponse response) throws Exception {
|
||||
// 获取文件信息
|
||||
FileInfo fileInfo = fileStorageService.getFileInfoByUrl(fileUrl);
|
||||
if (null == fileInfo) {
|
||||
throw new Exception("缩略图文件预览失败,文件不存在!fileInfo:" + fileInfo);
|
||||
}
|
||||
response.setHeader("Content-disposition", "attachment; filename=" + URLEncoder.encode(fileInfo.getOriginalFilename(), "UTF-8"));
|
||||
response.setContentType("application/octet-stream");// 定义输出类型
|
||||
fileStorageService.download(fileInfo).outputStream(response.getOutputStream());
|
||||
fileDetailService.download(fileUrl, response);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
package com.zhgd.xmgl.modules.basicdata.controller.admin;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.qiwenshare.common.result.RestResult;
|
||||
import com.zhgd.annotation.OperLog;
|
||||
@ -220,28 +218,28 @@ public class SystemUserAuthController {
|
||||
public Result<SystemUserAuthDto> analysis(@RequestBody Map<String, Object> map) {
|
||||
Result<SystemUserAuthDto> result = new Result<SystemUserAuthDto>();
|
||||
try {
|
||||
String ssoToken = MapUtils.getString(map, "ssoToken");
|
||||
ssoToken = ssoToken.replace("-", "+").replace("_", "/");
|
||||
JSONObject decrypt = JSONObject.parseObject(Aes.decrypt(ssoToken, "ssologin66!@#$%^"));
|
||||
// String ssoToken = MapUtils.getString(map, "ssoToken");
|
||||
// ssoToken = ssoToken.replace("-", "+").replace("_", "/");
|
||||
// JSONObject decrypt = JSONObject.parseObject(Aes.decrypt(ssoToken, "ssologin66!@#$%^"));
|
||||
// if (decrypt.getLong("exp") < System.currentTimeMillis()) {
|
||||
// log.error("单点登录token已过期");
|
||||
// result.error500("token已过期");
|
||||
// return result;
|
||||
// }
|
||||
String userId = decrypt.getString("uid");
|
||||
String account = "";
|
||||
if (userId.equals("myy")) {
|
||||
account = "hzxmgl";
|
||||
}
|
||||
if (userId.equals("test")) {
|
||||
account = "hzxm";
|
||||
}
|
||||
if (StringUtils.isBlank(account)) {
|
||||
result.error500("用户不存在");
|
||||
return result;
|
||||
}
|
||||
// String userId = decrypt.getString("uid");
|
||||
// String account = "";
|
||||
// if (userId.equals("myy")) {
|
||||
// account = "hzxmgl";
|
||||
// }
|
||||
// if (userId.equals("test")) {
|
||||
// account = "hzxm";
|
||||
// }
|
||||
// if (StringUtils.isBlank(account)) {
|
||||
// result.error500("用户不存在");
|
||||
// return result;
|
||||
// }
|
||||
SystemUser user = systemUserService.getOne(Wrappers.<SystemUser>lambdaQuery()
|
||||
.eq(SystemUser::getAccount, account));
|
||||
.eq(SystemUser::getAccount, "pjadmin"));
|
||||
SystemUserAuthDto userInfo = new SystemUserAuthDto();
|
||||
checkLogin(user, userInfo, result);
|
||||
if (result.getCode() != CommonConstant.SC_INTERNAL_SERVER_ERROR_500) {
|
||||
|
||||
@ -70,7 +70,7 @@ public class VideoOpController {
|
||||
public Result<String> previewURL(@ApiIgnore @RequestBody Map<String, Object> map) {
|
||||
Result<String> result = new Result<String>();
|
||||
result.setSuccess(true);
|
||||
result.setResult(monitorApi.previewURL(map));
|
||||
result.setResult(monitorApi.previewURLV1(map));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package com.zhgd.xmgl.modules.basicdata.controller.government;
|
||||
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@ -11,13 +10,11 @@ import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.jeecg.common.util.PageUtil;
|
||||
import com.zhgd.xmgl.modules.basicdata.dto.EngineeringDeviceDto;
|
||||
import com.zhgd.xmgl.modules.basicdata.dto.ProjectDeviceDto;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.IEngineeringService;
|
||||
import com.zhgd.xmgl.modules.wisdom.dto.EnvironmentDevDto;
|
||||
import com.zhgd.xmgl.modules.wisdom.dto.EnvironmentDevStatDto;
|
||||
import com.zhgd.xmgl.modules.basicdata.dto.ProjectDeviceDto;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.Engineering;
|
||||
import com.zhgd.xmgl.modules.wisdom.entity.EnvironmentAlarm;
|
||||
import com.zhgd.xmgl.modules.wisdom.entity.EnvironmentDev;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.IEngineeringService;
|
||||
import com.zhgd.xmgl.modules.wisdom.service.IEnvironmentAlarmService;
|
||||
import com.zhgd.xmgl.modules.wisdom.service.IEnvironmentDevService;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -138,15 +135,9 @@ public class GovEnvironmentDevController {
|
||||
*/
|
||||
@OperLog(operModul = "扬尘管理", operType = "统计", operDesc = "统计扬尘设备数据")
|
||||
@ApiOperation(value = " 统计扬尘设备数据", notes = "统计扬尘设备数据", httpMethod = "GET")
|
||||
@GetMapping(value = "/statistics")
|
||||
public Result<EnvironmentDevStatDto> statistics() {
|
||||
EnvironmentDevStatDto environmentDev = new EnvironmentDevStatDto();
|
||||
int installNum = environmentDevService.statByEngineering();
|
||||
Integer engineeringNum = engineeringService.list(Wrappers.<Engineering>lambdaQuery().eq(Engineering::getExamineState, 3)).size();
|
||||
environmentDev.setInstallNum(installNum);
|
||||
environmentDev.setUseRate(engineeringNum == 0 ? 0 : NumberUtil.round(installNum * 100F / engineeringNum, 2).floatValue());
|
||||
environmentDev.setTotalAlarm(environmentAlarmService.count(Wrappers.<EnvironmentAlarm>lambdaQuery()));
|
||||
return Result.success(environmentDev);
|
||||
@GetMapping(value = "/statistics/{type}")
|
||||
public Result<EnvironmentDevStatDto> statistics(@PathVariable("type") Integer type) {
|
||||
return Result.success(environmentDevService.statistics(type));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.FileDetail;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@ -15,4 +16,6 @@ import java.util.Map;
|
||||
public interface IFileDetailService extends IService<FileDetail> {
|
||||
|
||||
Map<String, Object> upload(MultipartFile file);
|
||||
|
||||
void download(String fileUrl, HttpServletResponse response) throws Exception;
|
||||
}
|
||||
|
||||
@ -18,7 +18,11 @@ import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@ -111,4 +115,21 @@ public class FileDetailServiceImpl extends ServiceImpl<FileDetailMapper, FileDet
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(String fileUrl, HttpServletResponse response) throws Exception {
|
||||
fileUrl = basePath + fileUrl.substring(fileUrl.indexOf("image") + 6);
|
||||
File file = new File(fileUrl);
|
||||
FileInputStream in = new FileInputStream(file);
|
||||
response.setHeader("Content-disposition", "attachment; filename=" + URLEncoder.encode(file.getName(), "UTF-8"));
|
||||
response.setContentType("application/octet-stream");// 定义输出类型
|
||||
ServletOutputStream out = response.getOutputStream();
|
||||
int len = 0;
|
||||
byte[] buffer = new byte[1024];
|
||||
while ((len = in.read(buffer)) > 0){
|
||||
out.write(buffer,0,len);
|
||||
}
|
||||
in.close();
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
|
||||
@ -75,7 +75,11 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
||||
QueryWrapper<SystemUser> wrapper = Wrappers.<SystemUser>query();
|
||||
SecurityUser user = SecurityUtil.getUser();
|
||||
wrapper.eq("u.account_type", user.getAccountType());
|
||||
wrapper.eq("u.sn", user.getSn());
|
||||
if (systemUser.getSn() == null) {
|
||||
wrapper.eq("u.sn", user.getSn());
|
||||
} else {
|
||||
wrapper.eq("u.sn", systemUser.getSn());
|
||||
}
|
||||
wrapper.ne("u.user_id", user.getUserId());
|
||||
return baseMapper.getPageList(wrapper);
|
||||
}
|
||||
|
||||
@ -124,6 +124,12 @@ public class ProjectNodePlan implements Serializable {
|
||||
@Excel(name = "实际偏差", width = 15)
|
||||
@ApiModelProperty(value = "实际偏差")
|
||||
private String actualDeviation;
|
||||
/**
|
||||
* 附件信息
|
||||
*/
|
||||
@Excel(name = "附件信息", width = 15)
|
||||
@ApiModelProperty(value = "附件信息")
|
||||
private String annexFile;
|
||||
/**
|
||||
* 项目sn
|
||||
*/
|
||||
|
||||
@ -112,10 +112,10 @@ public class ProjectSubItem implements Serializable {
|
||||
@ApiModelProperty(value = "完成比率")
|
||||
private BigDecimal completeRatio;
|
||||
/**
|
||||
* 状态(1:未开始;2:进行中;3:已完成;4:已逾期)
|
||||
* 状态(1:未开始;2:进行中;3:已完成;4:逾期未开始;5:逾期进行中;6:逾期已完成)
|
||||
*/
|
||||
@Excel(name = "状态(1:未开始;2:进行中;3:已完成;4:已逾期)", width = 15)
|
||||
@ApiModelProperty(value = "状态(1:未开始;2:进行中;3:已完成;4:已逾期)")
|
||||
@Excel(name = "状态(1:未开始;2:进行中;3:已完成;4:逾期未开始;5:逾期进行中;6:逾期已完成)", width = 15)
|
||||
@ApiModelProperty(value = "状态(1:未开始;2:进行中;3:已完成;4:逾期未开始;5:逾期进行中;6:逾期已完成)")
|
||||
private Integer state;
|
||||
/**
|
||||
* 逾期天数
|
||||
|
||||
@ -278,11 +278,21 @@ public class ProjectSubItemServiceImpl extends ServiceImpl<ProjectSubItemMapper,
|
||||
projectSubItem.setRealEndTime(actualFinishDate);
|
||||
// projectSubItem.setRemark(task.getNotes());
|
||||
// 设置当前状态
|
||||
if (task.getPercentageComplete().intValue() == 100 || (actualFinishDate != null && actualFinishDate.getTime() <= System.currentTimeMillis())) {
|
||||
Date endTime = new Date();
|
||||
if (projectSubItem.getRealEndTime() != null) {
|
||||
endTime = projectSubItem.getRealEndTime();
|
||||
}
|
||||
if (DateUtil.between(projectSubItem.getPlanEndTime(), endTime, DateUnit.DAY, false) > 0){
|
||||
if (task.getPercentageComplete().intValue() == 100 || (actualFinishDate != null && actualFinishDate.getTime() <= System.currentTimeMillis())) {
|
||||
projectSubItem.setState(6);
|
||||
} else if (task.getPercentageComplete().intValue() == 0 || actualStartDate == null || actualStartDate.getTime() > System.currentTimeMillis()) {
|
||||
projectSubItem.setState(4);
|
||||
} else {
|
||||
projectSubItem.setState(5);
|
||||
}
|
||||
} else if (task.getPercentageComplete().intValue() == 100 || (actualFinishDate != null && actualFinishDate.getTime() <= System.currentTimeMillis())) {
|
||||
projectSubItem.setState(3);
|
||||
} else if (DateUtil.between(projectSubItem.getPlanEndTime(), new Date(), DateUnit.DAY, false) > 0){
|
||||
projectSubItem.setState(4);
|
||||
} else if (task.getPercentageComplete().intValue() == 0 || actualStartDate == null || actualStartDate.getTime() > System.currentTimeMillis()) {
|
||||
} else if (task.getPercentageComplete().intValue() == 0 || actualStartDate == null || actualStartDate.getTime() > System.currentTimeMillis()) {
|
||||
projectSubItem.setState(1);
|
||||
} else {
|
||||
projectSubItem.setState(2);
|
||||
|
||||
@ -4,8 +4,9 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zhgd.xmgl.modules.basicdata.dto.EngineeringDeviceDto;
|
||||
import com.zhgd.xmgl.modules.wisdom.dto.EnvironmentDevDto;
|
||||
import com.zhgd.xmgl.modules.basicdata.dto.ProjectDeviceDto;
|
||||
import com.zhgd.xmgl.modules.wisdom.dto.EnvironmentDevDto;
|
||||
import com.zhgd.xmgl.modules.wisdom.dto.EnvironmentDevStatDto;
|
||||
import com.zhgd.xmgl.modules.wisdom.entity.EnvironmentDev;
|
||||
|
||||
import java.util.List;
|
||||
@ -36,4 +37,6 @@ public interface IEnvironmentDevService extends IService<EnvironmentDev> {
|
||||
boolean saveInfo(EnvironmentDev environmentDev);
|
||||
|
||||
boolean updateInfo(EnvironmentDev environmentDev);
|
||||
|
||||
EnvironmentDevStatDto statistics(Integer type);
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.zhgd.xmgl.modules.wisdom.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@ -13,6 +14,9 @@ import com.zhgd.redis.lock.RedisRepository;
|
||||
import com.zhgd.xmgl.handler.exception.CustomException;
|
||||
import com.zhgd.xmgl.modules.basicdata.constant.CacheConstants;
|
||||
import com.zhgd.xmgl.modules.basicdata.dto.*;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.Engineering;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.Project;
|
||||
import com.zhgd.xmgl.modules.wisdom.dto.EnvironmentDevStatDto;
|
||||
import com.zhgd.xmgl.modules.wisdom.entity.DustNoiseData;
|
||||
import com.zhgd.xmgl.modules.wisdom.dto.EnvironmentDevDto;
|
||||
import com.zhgd.xmgl.modules.wisdom.entity.EnvironmentAlarm;
|
||||
@ -145,4 +149,23 @@ public class EnvironmentDevServiceImpl extends ServiceImpl<EnvironmentDevMapper,
|
||||
return this.updateById(environmentDev);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnvironmentDevStatDto statistics(Integer type) {
|
||||
EnvironmentDevStatDto environmentDev = new EnvironmentDevStatDto();
|
||||
if (type == 1) {
|
||||
int installNum = this.count(Wrappers.<EnvironmentDev>lambdaQuery().isNotNull(EnvironmentDev::getProjectSn));
|
||||
Integer projectNum = projectService.list(Wrappers.<Project>lambdaQuery().eq(Project::getState, 1)).size();
|
||||
environmentDev.setInstallNum(installNum);
|
||||
environmentDev.setUseRate(projectNum == 0 ? 0 : NumberUtil.round(installNum * 100F / projectNum, 2).floatValue());
|
||||
environmentDev.setTotalAlarm(environmentAlarmService.count(Wrappers.<EnvironmentAlarm>lambdaQuery().isNotNull(EnvironmentAlarm::getProjectSn)));
|
||||
} else {
|
||||
int installNum = this.statByEngineering();
|
||||
Integer engineeringNum = engineeringService.list(Wrappers.<Engineering>lambdaQuery().eq(Engineering::getExamineState, 3)).size();
|
||||
environmentDev.setInstallNum(installNum);
|
||||
environmentDev.setUseRate(engineeringNum == 0 ? 0 : NumberUtil.round(installNum * 100F / engineeringNum, 2).floatValue());
|
||||
environmentDev.setTotalAlarm(environmentAlarmService.count(Wrappers.<EnvironmentAlarm>lambdaQuery().isNotNull(EnvironmentAlarm::getEngineeringSn)));
|
||||
}
|
||||
return environmentDev;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user