javaweb-plus/javaweb-cms/src/main/java/com/javaweb/geo/controller/TubLogController.java
@@ -136,4 +136,15 @@ String message = tubLogService.importTubLog(projectId,file,updateSupport); return AjaxResult.success(message); } /** * 统计 */ @GetMapping("/countTubLogDate") @ResponseBody public AjaxResult countTubLogDate() { return tubLogService.countTubLogDate(); } } javaweb-plus/javaweb-cms/src/main/java/com/javaweb/geo/domain/TubLog.java
@@ -62,6 +62,10 @@ @Excel(name = "时间", width = 30, dateFormat = "yyyy-MM-dd") private Date createDate; /** 出入库数量统计 */ private Double outboundNumber; private Double inboundNumber; public void setId(Integer id) { this.id = id; @@ -171,6 +175,22 @@ return createDate; } public Double getOutboundNumber() { return outboundNumber; } public void setOutboundNumber(Double outboundNumber) { this.outboundNumber = outboundNumber; } public Double getInboundNumber() { return inboundNumber; } public void setInboundNumber(Double inboundNumber) { this.inboundNumber = inboundNumber; } @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) javaweb-plus/javaweb-cms/src/main/java/com/javaweb/geo/mapper/TubLogMapper.java
@@ -66,4 +66,9 @@ * @return */ Integer selectMaxTubLogId(@Param("projectId") String projectId); /** * 统计 */ List<TubLog> countTubLogDate(); } javaweb-plus/javaweb-cms/src/main/java/com/javaweb/geo/service/ITubLogService.java
@@ -1,5 +1,6 @@ package com.javaweb.geo.service; import com.javaweb.common.core.domain.AjaxResult; import com.javaweb.geo.domain.TubLog; import org.springframework.web.multipart.MultipartFile; @@ -71,4 +72,9 @@ * 导入管材出入库记录 */ String importTubLog(String projectId, MultipartFile file, boolean updateSupport); /** * 统计 */ AjaxResult countTubLogDate(); } javaweb-plus/javaweb-cms/src/main/java/com/javaweb/geo/service/impl/TubLogServiceImpl.java
@@ -6,6 +6,7 @@ import cn.hutool.poi.excel.ExcelReader; import cn.hutool.poi.excel.ExcelUtil; import com.javaweb.common.config.Global; import com.javaweb.common.core.domain.AjaxResult; import com.javaweb.common.utils.DateUtils; import com.javaweb.geo.domain.TubLog; import org.springframework.beans.factory.annotation.Autowired; @@ -107,6 +108,15 @@ } /** * 统计 */ @Override public AjaxResult countTubLogDate() { List<TubLog> list = tubLogMapper.countTubLogDate(); return AjaxResult.success("查询成功!",list); } /** * 导入管材出入库记录 */ @Override javaweb-plus/javaweb-cms/src/main/resources/mapper/geo/TubLogMapper.xml
@@ -18,6 +18,8 @@ <result property="unit" column="unit" /> <result property="createDate" column="create_date" /> <result property="remark" column="remark" /> <result property="outboundNumber" column="outbound_number" /> <result property="inboundNumber" column="inbound_number" /> </resultMap> <sql id="selectTubLogVo"> @@ -50,6 +52,17 @@ SELECT MAX(id) FROM js_tub_log where project_id = #{projectId} </select> <select id="countTubLogDate" resultMap="TubLogResult"> SELECT a.tub_name, b.inbound_number, a.outbound_number, a.unit FROM ( SELECT tub_name, SUM( number ) AS outbound_number, unit FROM js_tub_log WHERE outbound_date IS NOT NULL GROUP BY tub_name ) a LEFT JOIN ( SELECT tub_name, SUM( number ) AS inbound_number, unit FROM js_tub_log WHERE inbound_date IS NOT NULL GROUP BY tub_name ) b ON a.tub_name = b.tub_name </select> <insert id="insertTubLog" parameterType="TubLog" useGeneratedKeys="true" keyProperty="id"> insert into js_tub_log <trim prefix="(" suffix=")" suffixOverrides=","> javaweb-plus/javaweb-cms/src/main/resources/templates/geo/TubLog/add.html
@@ -19,21 +19,12 @@ <input name="tubName" class="form-control" type="text" placeholder="请填写材料名称" required> </div> </div> <!-- <div class="form-group"> --> <!-- <label class="col-sm-3 control-label">类型:</label>--> <!-- <div class="col-sm-8">--> <!-- <select name="type" class="form-control m-b">--> <!-- <option value="">所有</option>--> <!-- </select>--> <!-- <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>--> <!-- </div>--> <!-- </div>--> <div class="form-group"> <div class="form-group"> <label class="col-sm-3 control-label">出库时间:</label> <div class="col-sm-8"> <div class="input-group date"> <span class="input-group-addon"><i class="fa fa-calendar"></i></span> <input name="outboundDate" class="form-control" placeholder="yyyy-MM-dd" type="text"> <input id="outboundDateId" name="outboundDate" class="form-control" placeholder="yyyy-MM-dd" type="text"> </div> </div> </div> @@ -42,7 +33,7 @@ <div class="col-sm-8"> <div class="input-group date"> <span class="input-group-addon"><i class="fa fa-calendar"></i></span> <input name="inboundDate" class="form-control" placeholder="yyyy-MM-dd" type="text"> <input id="inboundDateId" name="inboundDate" class="form-control" placeholder="yyyy-MM-dd" type="text"> </div> </div> </div> @@ -85,12 +76,22 @@ var projectId = [[${projectId}]]; var code = [[${code}]]; $("#form-TubLog-add").validate({ focusCleanup: true }); function submitHandler() { let inboundDateValue = $("#inboundDateId").val(); let outboundDateValue = $("#outboundDateId").val(); if ($.common.isEmpty(inboundDateValue) && $.common.isEmpty(outboundDateValue)) { $.modal.alertWarning("出入库时间,请选择一条记录"); return; } if (!$.common.isEmpty(inboundDateValue) && !$.common.isEmpty(outboundDateValue)) { $.modal.alertWarning("出入库时间,请选择一条记录"); return; } if ($.validate.form()) { let formData = $('#form-TubLog-add').serialize(); let data = formData + "&projectId=" + projectId + "&code=" + code; @@ -109,6 +110,13 @@ minView: "month", autoclose: true }); </script> </body> </html> javaweb-plus/javaweb-cms/src/main/resources/templates/geo/TubLog/edit.html
@@ -34,7 +34,7 @@ <div class="col-sm-8"> <div class="input-group date"> <span class="input-group-addon"><i class="fa fa-calendar"></i></span> <input name="outboundDate" th:value="${#dates.format(tubLog.outboundDate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text"> <input id="outboundDateId" name="outboundDate" th:value="${#dates.format(tubLog.outboundDate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text"> </div> </div> </div> @@ -43,7 +43,7 @@ <div class="col-sm-8"> <div class="input-group date"> <span class="input-group-addon"><i class="fa fa-calendar"></i></span> <input name="inboundDate" th:value="${#dates.format(tubLog.inboundDate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text"> <input id="inboundDateId" name="inboundDate" th:value="${#dates.format(tubLog.inboundDate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text"> </div> </div> </div> @@ -90,7 +90,12 @@ }); function submitHandler() { let inboundDateValue = $("#inboundDateId").val(); let outboundDateValue = $("#outboundDateId").val(); if ($.common.isEmpty(inboundDateValue) && $.common.isEmpty(outboundDateValue)) { $.modal.alertWarning("出入库时间,请选择一条记录"); return; } if ($.validate.form()) { $.operate.save(prefix + "/edit", $('#form-TubLog-edit').serialize()); } javaweb-plus/javaweb-cms/src/main/resources/templates/geo/project/navigate.html
@@ -31,7 +31,7 @@ </div> <div class="box-header "> <div class="box-title"> <i class="glyphicon glyphicon-map-marker"></i> <a class="afont" th:href="@{/geo/holeLog(id=${project.ids})}" target="mainFrame" onclick="selected(this)">钻孔进度日志</a> <i class="glyphicon glyphicon-list-alt"></i> <a class="afont" th:href="@{/geo/holeLog(id=${project.ids})}" target="mainFrame" onclick="selected(this)">钻孔进度日志</a> </div> </div> <div class="box-header "> @@ -46,7 +46,7 @@ </div> <div class="box-header "> <div class="box-title"> <i class="glyphicon glyphicon-retweet"></i> <a class="afont" th:href="@{/geo/TubLog(id=${project.ids})}" target="mainFrame" onclick="selected(this)">材料管理</a> <i class="glyphicon glyphicon-random"></i> <a class="afont" th:href="@{/geo/TubLog(id=${project.ids})}" target="mainFrame" onclick="selected(this)">材料管理</a> </div> </div> <div class="box-header ">