diff --git a/src/main/java/com/zhgd/xmgl/modules/ammeter/service/impl/AmmeterRecordDetailServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/ammeter/service/impl/AmmeterRecordDetailServiceImpl.java index 720deb799..cfe8e3061 100644 --- a/src/main/java/com/zhgd/xmgl/modules/ammeter/service/impl/AmmeterRecordDetailServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/ammeter/service/impl/AmmeterRecordDetailServiceImpl.java @@ -90,6 +90,8 @@ public class AmmeterRecordDetailServiceImpl extends ServiceImpl map) { + String projectSn = MapUtils.getString(map, "projectSn"); + String ammeterNo = MapUtils.getString(map, "ammeterNo"); CountAmmeterRecordDetailVo vo = new CountAmmeterRecordDetailVo(); String today1 = DateUtil.today(); map.put("startTime", today1); @@ -108,6 +110,8 @@ public class AmmeterRecordDetailServiceImpl extends ServiceImpl().eq(AmmeterRecordDetail::getAmmeterNo, ammeterNo).orderByDesc(AmmeterRecordDetail::getId).last("limit 1")); + vo.setDegree(ard != null ? ard.getDegree().doubleValue() : 0.0); return vo; } diff --git a/src/main/java/com/zhgd/xmgl/modules/taskprogress/controller/TaskProgressContentController.java b/src/main/java/com/zhgd/xmgl/modules/taskprogress/controller/TaskProgressContentController.java index 00c8d7b11..42fff507a 100644 --- a/src/main/java/com/zhgd/xmgl/modules/taskprogress/controller/TaskProgressContentController.java +++ b/src/main/java/com/zhgd/xmgl/modules/taskprogress/controller/TaskProgressContentController.java @@ -1,39 +1,35 @@ package com.zhgd.xmgl.modules.taskprogress.controller; +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.zhgd.jeecg.common.api.vo.Result; +import com.zhgd.jeecg.common.system.query.QueryGenerator; +import com.zhgd.jeecg.common.util.oConvertUtils; +import com.zhgd.xmgl.modules.taskprogress.entity.TaskProgressContent; +import com.zhgd.xmgl.modules.taskprogress.service.ITaskProgressContentService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; - -import java.util.HashMap; -import java.util.List; -import java.io.UnsupportedEncodingException; -import java.net.URLDecoder; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.zhgd.jeecg.common.api.vo.Result; -import com.zhgd.jeecg.common.system.query.QueryGenerator; -import com.zhgd.jeecg.common.util.oConvertUtils; -import org.apache.commons.collections.MapUtils; -import com.zhgd.xmgl.modules.taskprogress.entity.TaskProgressContent; -import com.zhgd.xmgl.modules.taskprogress.service.ITaskProgressContentService; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import lombok.extern.slf4j.Slf4j; - +import org.apache.commons.collections.MapUtils; import org.jeecgframework.poi.excel.def.NormalExcelConstants; import org.jeecgframework.poi.excel.entity.ExportParams; import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; - import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; -import com.alibaba.fastjson.JSON; import springfox.documentation.annotations.ApiIgnore; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import java.util.HashMap; +import java.util.List; + /** * @Title: Controller @@ -47,154 +43,163 @@ import springfox.documentation.annotations.ApiIgnore; @Slf4j @Api(tags = "任务进度甘特图-内容相关Api") public class TaskProgressContentController { - @Autowired - private ITaskProgressContentService taskProgressContentService; + @Autowired + private ITaskProgressContentService taskProgressContentService; - /** - * 分页列表查询 - * - * @param taskProgressContent - * @param pageNo - * @param pageSize - * @param req - * @return - */ - @ApiOperation(value = "分页列表查询任务进度甘特图-内容信息", notes = "分页列表查询任务进度甘特图-内容信息", httpMethod = "GET") - @GetMapping(value = "/page") - public Result> queryPageList(TaskProgressContent taskProgressContent, - @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, - @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, - HttpServletRequest req) { - Result> result = new Result>(); - QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(taskProgressContent, req.getParameterMap()); - Page page = new Page(pageNo, pageSize); - IPage pageList = taskProgressContentService.page(page, queryWrapper); - result.setSuccess(true); - result.setResult(pageList); - return result; - } + /** + * 分页列表查询 + * + * @param taskProgressContent + * @param pageNo + * @param pageSize + * @param req + * @return + */ + @ApiOperation(value = "分页列表查询任务进度甘特图-内容信息", notes = "分页列表查询任务进度甘特图-内容信息", httpMethod = "GET") + @GetMapping(value = "/page") + public Result> queryPageList(TaskProgressContent taskProgressContent, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { + Result> result = new Result>(); + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(taskProgressContent, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage pageList = taskProgressContentService.page(page, queryWrapper); + result.setSuccess(true); + result.setResult(pageList); + return result; + } - /** - * 列表查询 - * - * @param taskProgressContent - * @param req - * @return - */ - @ApiOperation(value = "列表查询任务进度甘特图-内容信息", notes = "列表查询任务进度甘特图-内容信息", httpMethod = "GET") - @ApiImplicitParams({ - @ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "query", required = true, dataType = "String"), + /** + * 列表查询 + * + * @param taskProgressContent + * @param req + * @return + */ + @ApiOperation(value = "列表查询任务进度甘特图-内容信息", notes = "列表查询任务进度甘特图-内容信息", httpMethod = "GET") + @ApiImplicitParams({ @ApiImplicitParam(name = "taskProgressId", value = "任务进度甘特图id", paramType = "query", required = true, dataType = "String"), }) - @GetMapping(value = "/list") - public Result> queryList(TaskProgressContent taskProgressContent, - HttpServletRequest req) { - return Result.success(taskProgressContentService.queryList(taskProgressContent, req)); - } + @GetMapping(value = "/list") + public Result> queryList(TaskProgressContent taskProgressContent, + HttpServletRequest req) { + return Result.success(taskProgressContentService.queryList(taskProgressContent, req)); + } - /** - * 添加 - * - * @param taskProgressContent - * @return - */ - @ApiOperation(value = "添加任务进度甘特图-内容信息", notes = "添加任务进度甘特图-内容信息", httpMethod = "POST") - @PostMapping(value = "/add") - public Result add(@RequestBody TaskProgressContent taskProgressContent) { - taskProgressContentService.add(taskProgressContent); - return Result.ok(); - } + @ApiOperation(value = "查询最新任务进度甘特图-内容信息", notes = "查询最新任务进度甘特图-内容信息", httpMethod = "GET") + @ApiImplicitParams({ + @ApiImplicitParam(name = "taskProgressId", value = "任务进度甘特图id", paramType = "query", required = true, dataType = "String"), + }) + @GetMapping(value = "/queryNewestOne") + public Result queryNewestOne(TaskProgressContent taskProgressContent, + HttpServletRequest req) { + return Result.success(taskProgressContentService.queryNewestOne(taskProgressContent, req)); + } - /** - * 编辑 - * - * @param taskProgressContent - * @return - */ - @ApiOperation(value = "编辑任务进度甘特图-内容信息", notes = "编辑任务进度甘特图-内容信息", httpMethod = "POST") - @PostMapping(value = "/edit") - public Result edit(@RequestBody TaskProgressContent taskProgressContent) { - taskProgressContentService.updateById(taskProgressContent); - return Result.ok(); - } + /** + * 添加 + * + * @param taskProgressContent + * @return + */ + @ApiOperation(value = "添加任务进度甘特图-内容信息", notes = "添加任务进度甘特图-内容信息", httpMethod = "POST") + @PostMapping(value = "/add") + public Result add(@RequestBody TaskProgressContent taskProgressContent) { + taskProgressContentService.add(taskProgressContent); + return Result.ok(); + } - /** - * 通过id删除 - * - * @param id - * @return - */ - @ApiOperation(value = "删除任务进度甘特图-内容信息", notes = "删除任务进度甘特图-内容信息", httpMethod = "POST") - @ApiImplicitParam(name = "id", value = "任务进度甘特图-内容ID", paramType = "body", required = true, dataType = "String", example = "{\"id\":\"1\"}") - @PostMapping(value = "/delete") - public Result delete(@ApiIgnore @RequestBody HashMap map) { - String id = MapUtils.getString(map, "id"); - Result result = new Result(); - TaskProgressContent taskProgressContent = taskProgressContentService.getById(id); - if (taskProgressContent == null) { - result.error500("未找到对应实体"); - } else { - boolean ok = taskProgressContentService.removeById(id); - if (ok) { - result.success("删除成功!"); - } - } + /** + * 编辑 + * + * @param taskProgressContent + * @return + */ + @ApiOperation(value = "编辑任务进度甘特图-内容信息", notes = "编辑任务进度甘特图-内容信息", httpMethod = "POST") + @PostMapping(value = "/edit") + public Result edit(@RequestBody TaskProgressContent taskProgressContent) { + taskProgressContentService.updateById(taskProgressContent); + return Result.ok(); + } - return result; - } + /** + * 通过id删除 + * + * @param id + * @return + */ + @ApiOperation(value = "删除任务进度甘特图-内容信息", notes = "删除任务进度甘特图-内容信息", httpMethod = "POST") + @ApiImplicitParam(name = "id", value = "任务进度甘特图-内容ID", paramType = "body", required = true, dataType = "String", example = "{\"id\":\"1\"}") + @PostMapping(value = "/delete") + public Result delete(@ApiIgnore @RequestBody HashMap map) { + String id = MapUtils.getString(map, "id"); + Result result = new Result(); + TaskProgressContent taskProgressContent = taskProgressContentService.getById(id); + if (taskProgressContent == null) { + result.error500("未找到对应实体"); + } else { + boolean ok = taskProgressContentService.removeById(id); + if (ok) { + result.success("删除成功!"); + } + } - /** - * 通过id查询 - * - * @param id - * @return - */ - @ApiOperation(value = "通过id查询任务进度甘特图-内容信息", notes = "通过id查询任务进度甘特图-内容信息", httpMethod = "GET") - @ApiImplicitParam(name = "id", value = "任务进度甘特图-内容ID", paramType = "query", required = true, dataType = "Integer") - @GetMapping(value = "/queryById") - public Result queryById(@RequestParam(name = "id", required = true) String id) { - Result result = new Result(); - TaskProgressContent taskProgressContent = taskProgressContentService.getById(id); - if (taskProgressContent == null) { - result.error500("未找到对应实体"); - } else { - result.setResult(taskProgressContent); - result.setSuccess(true); - } - return result; - } + return result; + } - /** - * 导出excel - * - * @param request - * @param response - */ - @ApiOperation(value = "导出excel任务进度甘特图-内容信息", notes = "导出excel任务进度甘特图-内容信息", httpMethod = "POST") - @RequestMapping(value = "/exportXls") - public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) { - // Step.1 组装查询条件 - QueryWrapper queryWrapper = null; - try { - String paramsStr = request.getParameter("paramsStr"); - if (oConvertUtils.isNotEmpty(paramsStr)) { - String deString = URLDecoder.decode(paramsStr, "UTF-8"); - TaskProgressContent taskProgressContent = JSON.parseObject(deString, TaskProgressContent.class); - queryWrapper = QueryGenerator.initQueryWrapper(taskProgressContent, request.getParameterMap()); - } - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); - } + /** + * 通过id查询 + * + * @param id + * @return + */ + @ApiOperation(value = "通过id查询任务进度甘特图-内容信息", notes = "通过id查询任务进度甘特图-内容信息", httpMethod = "GET") + @ApiImplicitParam(name = "id", value = "任务进度甘特图-内容ID", paramType = "query", required = true, dataType = "Integer") + @GetMapping(value = "/queryById") + public Result queryById(@RequestParam(name = "id", required = true) String id) { + Result result = new Result(); + TaskProgressContent taskProgressContent = taskProgressContentService.getById(id); + if (taskProgressContent == null) { + result.error500("未找到对应实体"); + } else { + result.setResult(taskProgressContent); + result.setSuccess(true); + } + return result; + } - //Step.2 AutoPoi 导出Excel - ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); - List pageList = taskProgressContentService.list(queryWrapper); - //导出文件名称 - mv.addObject(NormalExcelConstants.FILE_NAME, "任务进度甘特图-内容列表"); - mv.addObject(NormalExcelConstants.CLASS, TaskProgressContent.class); - mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("任务进度甘特图-内容列表数据", "导出人:Jeecg", "导出信息")); - mv.addObject(NormalExcelConstants.DATA_LIST, pageList); - return mv; - } + /** + * 导出excel + * + * @param request + * @param response + */ + @ApiOperation(value = "导出excel任务进度甘特图-内容信息", notes = "导出excel任务进度甘特图-内容信息", httpMethod = "POST") + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) { + // Step.1 组装查询条件 + QueryWrapper queryWrapper = null; + try { + String paramsStr = request.getParameter("paramsStr"); + if (oConvertUtils.isNotEmpty(paramsStr)) { + String deString = URLDecoder.decode(paramsStr, "UTF-8"); + TaskProgressContent taskProgressContent = JSON.parseObject(deString, TaskProgressContent.class); + queryWrapper = QueryGenerator.initQueryWrapper(taskProgressContent, request.getParameterMap()); + } + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + + //Step.2 AutoPoi 导出Excel + ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); + List pageList = taskProgressContentService.list(queryWrapper); + //导出文件名称 + mv.addObject(NormalExcelConstants.FILE_NAME, "任务进度甘特图-内容列表"); + mv.addObject(NormalExcelConstants.CLASS, TaskProgressContent.class); + mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("任务进度甘特图-内容列表数据", "导出人:Jeecg", "导出信息")); + mv.addObject(NormalExcelConstants.DATA_LIST, pageList); + return mv; + } } diff --git a/src/main/java/com/zhgd/xmgl/modules/taskprogress/entity/TaskProgress.java b/src/main/java/com/zhgd/xmgl/modules/taskprogress/entity/TaskProgress.java index c2ca2c398..9255fd837 100644 --- a/src/main/java/com/zhgd/xmgl/modules/taskprogress/entity/TaskProgress.java +++ b/src/main/java/com/zhgd/xmgl/modules/taskprogress/entity/TaskProgress.java @@ -140,6 +140,19 @@ public class TaskProgress implements Serializable { @TableField(value = "create_user_id") private Long createUserId; + /** + * 开始预警:1提前2正常3逾期 + */ + @Excel(name = "开始预警", width = 15, replace = {"提前_1", "正常_2", "逾期_3"}) + @ApiModelProperty(value = "开始预警:1提前2正常3逾期") + private java.lang.Integer beginWarning; + /** + * 结束预警:1提前2正常3逾期 + */ + @Excel(name = "结束预警", width = 15, replace = {"提前_1", "正常_2", "逾期_3"}) + @ApiModelProperty(value = "结束预警:1提前2正常3逾期") + private java.lang.Integer endWarning; + /** * 负责人名称 */ @@ -155,19 +168,4 @@ public class TaskProgress implements Serializable { @TableField(exist = false) @ApiModelProperty(value = "任务进度甘特图-材料类型数量") private List relList; - - /** - * 开始预警:1提前2正常3逾期 - */ - @Excel(name = "开始预警", width = 15, replace = {"提前_1", "正常_2", "逾期_3"}) - @TableField(exist = false) - @ApiModelProperty(value = "开始预警:1提前2正常3逾期") - private java.lang.Integer beginWarning; - /** - * 结束预警:1提前2正常3逾期 - */ - @Excel(name = "结束预警", width = 15, replace = {"提前_1", "正常_2", "逾期_3"}) - @TableField(exist = false) - @ApiModelProperty(value = "结束预警:1提前2正常3逾期") - private java.lang.Integer endWarning; } diff --git a/src/main/java/com/zhgd/xmgl/modules/taskprogress/entity/TaskProgressContent.java b/src/main/java/com/zhgd/xmgl/modules/taskprogress/entity/TaskProgressContent.java index 320cf7806..5b0ffd67b 100644 --- a/src/main/java/com/zhgd/xmgl/modules/taskprogress/entity/TaskProgressContent.java +++ b/src/main/java/com/zhgd/xmgl/modules/taskprogress/entity/TaskProgressContent.java @@ -88,6 +88,13 @@ public class TaskProgressContent implements Serializable { @ApiModelProperty(value = "所属项目SN") private java.lang.String projectSn; + @ApiModelProperty(value = "上报人id") + private java.lang.Long uploadUserId; + + @ApiModelProperty(value = "上报人名称") + private java.lang.String uploadUserName; + + @TableField(exist = false) @ApiModelProperty("上报进度的材料信息列表,如:{\"taskProgressMaterialTypeId\":100,\"actualUsage\":20.01},其中id是任务进度甘特图-材料类型的id") private List typeDataList; diff --git a/src/main/java/com/zhgd/xmgl/modules/taskprogress/entity/TaskProgressMaterialRel.java b/src/main/java/com/zhgd/xmgl/modules/taskprogress/entity/TaskProgressMaterialRel.java index dc52809c8..904e5f39b 100644 --- a/src/main/java/com/zhgd/xmgl/modules/taskprogress/entity/TaskProgressMaterialRel.java +++ b/src/main/java/com/zhgd/xmgl/modules/taskprogress/entity/TaskProgressMaterialRel.java @@ -88,4 +88,7 @@ public class TaskProgressMaterialRel implements Serializable { @TableField(exist = false) @ApiModelProperty(value = "类型:1工种2材料3设备") private java.lang.Integer type; + @TableField(exist = false) + @ApiModelProperty(value = "单位") + private java.lang.String unit; } diff --git a/src/main/java/com/zhgd/xmgl/modules/taskprogress/mapper/xml/TaskProgressMaterialRelMapper.xml b/src/main/java/com/zhgd/xmgl/modules/taskprogress/mapper/xml/TaskProgressMaterialRelMapper.xml index f8038d266..2638b70a5 100644 --- a/src/main/java/com/zhgd/xmgl/modules/taskprogress/mapper/xml/TaskProgressMaterialRelMapper.xml +++ b/src/main/java/com/zhgd/xmgl/modules/taskprogress/mapper/xml/TaskProgressMaterialRelMapper.xml @@ -3,7 +3,7 @@