jiazx0107@163.com
2023-10-22 dfd793f14e51c48c3322f1b36f543179043bd45d
更新仓内抓拍
已修改8个文件
已添加4个文件
386 ■■■■ 文件已修改
igds-basic/src/main/java/com/ld/igds/basic/controller/FileController.java 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-basic/src/main/java/com/ld/igds/basic/manager/FileManager.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-core/src/main/java/com/ld/igds/file/CoreFileService.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-core/src/main/java/com/ld/igds/file/impl/CoreFileServiceImpl.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-inout/src/main/java/com/ld/igds/inout/service/HInoutReportService.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-security/src/main/java/com/ld/igds/models/SecSnapDepot.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-security/src/main/java/com/ld/igds/sec/service/SecSnapDepotService.java 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-security/src/main/java/com/ld/igds/sec/view/SecSnapDepot.view.xml 145 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-security/src/main/java/com/ld/igds/sec/view/SecSnapDepotPR.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-web/src/main/resources/d7/css/common.css 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-web/src/main/resources/static/images/img-fail.jpg 补丁 | 查看 | 原始文档 | blame | 历史
igds-web/src/main/resources/static/img/aerial-5000_001.png 补丁 | 查看 | 原始文档 | blame | 历史
igds-basic/src/main/java/com/ld/igds/basic/controller/FileController.java
@@ -2,16 +2,20 @@
import com.ld.igds.basic.manager.FileManager;
import com.ld.igds.data.PageResponse;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.URLEncoder;
@@ -46,7 +50,6 @@
        return fileManager.upLoadInoutImg(file, plateNum);
    }
    /**
     * ä¸‹è½½ä»Žä¸´æ—¶ç›®å½•下载,需要项目名称和当前组织
     *
@@ -58,7 +61,8 @@
    public int downloadTemp(
            @RequestParam(value = "fileName", required = false) String fileName,
            @RequestParam(value = "companyId", required = false) String companyId,
            HttpServletRequest request, HttpServletResponse response) throws IOException {
            HttpServletRequest request, HttpServletResponse response)
            throws IOException {
        if (StringUtils.isEmpty(fileName) || StringUtils.isEmpty(companyId)) {
            response.sendError(404, "缺少下载参数条件,无法执行下载。");
@@ -71,11 +75,11 @@
            return 404;
        }
        response.setContentType("application/octet-stream");
        response.setHeader("content-type", "application/octet-stream");
        response.setHeader("Content-Length", String.valueOf(file.length()));
        response.setHeader("Content-Disposition", "attachment;fileName=" + URLEncoder.encode(fileName, "utf8"));
        response.setHeader("Content-Disposition", "attachment;fileName="
                + URLEncoder.encode(fileName, "utf8"));
        byte[] buffer = new byte[1024];
        OutputStream os;
@@ -102,4 +106,68 @@
        return 200;
    }
    /**
     * æ–‡ä»¶æµèŽ·å–å›¾ç‰‡æ˜¾ç¤ºåˆ°é¡µé¢--针对仓内抓拍
     *
     * @param fileName
     * @param timeStr
     *            æŠ“拍的年月日时分秒 yyyyMMddHHmmss
     * @param response
     * @return
     * @throws IOException
     */
    @RequestMapping(value = "/view-snap-depot", method = RequestMethod.GET, produces = { "application/vnd.ms-excel;charset=UTF-8" })
    public String getDepotSnap(String fileName, String timeStr,
            HttpServletResponse response) throws IOException {
        // è®¾ç½®è¿”回内容格式
        response.setContentType("image/jpeg/jpg/png/gif/bmp/tiff/svg");
        String filePath;
        // åˆ›å»ºä¸€ä¸ªè¾“入流
        InputStream in = null;
        // åˆ›å»ºè¾“出流
        OutputStream os = null;
        try {
            if (null == fileName || null == timeStr) {
                filePath = fileManager.getFailImg();
            }else{
                filePath = fileManager.getSnapFilePath(fileName, timeStr);
                File file = new File(filePath);
                if(file.exists()){
                    log.debug("----抓拍图片地址-------{}", filePath);
                }else{
                    filePath = fileManager.getFailImg();
                    log.debug("----未获取到图纸,默认地址-------{}", filePath);
                }
            }
            // ç”¨è¯¥æ–‡ä»¶åˆ›å»ºä¸€ä¸ªè¾“入流
            in = new FileInputStream(filePath);
            // åˆ›å»ºè¾“出流
            os = response.getOutputStream();
            byte[] b = new byte[1024];
            while (in.read(b) != -1) {
                os.write(b);
            }
            in.close();
            os.close();
            return null;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (null != in) {
                in.close();
            }
            if (null != os) {
                os.close();
            }
        }
    }
}
igds-basic/src/main/java/com/ld/igds/basic/manager/FileManager.java
@@ -5,13 +5,17 @@
import com.ld.igds.file.CoreFileService;
import com.ld.igds.util.ContextUtil;
import com.ld.igds.util.FilesUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
@@ -160,4 +164,17 @@
        String path = filesUtil.getTempPath(companyId) + "/" + fileName;
        return new File(path);
    }
    public String getSnapFilePath(String fileName, String dateStr) {
       return  fileService.getSnapFilePath(dateStr) + "/" + fileName;
    }
    public String getFailImg() throws IOException {
        String failImg = "static/images/img-fail.jpg";
        ClassPathResource readFile = new ClassPathResource(failImg);
        return readFile.getFile().getAbsolutePath();
    }
}
igds-core/src/main/java/com/ld/igds/file/CoreFileService.java
@@ -48,6 +48,15 @@
     * @return
     */
    public String getSnapFilePath(Date date);
    /**
     * æ ¹æ®æ—¶é—´èŽ·å–ç³»ç»Ÿé…ç½®çš„ä»“å†…è§†é¢‘æŠ“æ‹è·¯å¾„
     * ç³»ç»Ÿé™„件路径以yyyyMM为目录进行划分
     *
     * @param date
     * @return
     */
    public String getSnapFilePath(String date);
    /**
     * æ ¹æ®æ—¶é—´èŽ·å–ç³»ç»Ÿé…ç½®çš„é™„ä»¶è·¯å¾„åœ°å€
igds-core/src/main/java/com/ld/igds/file/impl/CoreFileServiceImpl.java
@@ -48,6 +48,20 @@
        }
        return basePath;
    }
    @Override
    public String getSnapFilePath(String dateStr) {
        if (null == dateStr) return null;
        if(dateStr.length()>6) dateStr = dateStr.substring(0, 6);
        String basePath = configData.getFilePath() + "SNAP/" + dateStr+ "/";
        File file = new File(basePath);
        if (!file.exists()) {
            file.mkdirs();
        }
        return basePath;
    }
    @Override
    public String getCommonFilePath(Date date) {
igds-inout/src/main/java/com/ld/igds/inout/service/HInoutReportService.java
@@ -18,7 +18,7 @@
        String hql = " from " + InoutRecord.class.getName()
                + " where companyId=:companyId ";
        Map<String, Object> args = new HashMap<String, Object>();
        Map<String, Object> args = new HashMap<>();
        args.put("companyId", ContextUtil.getCompanyId());
        if (null != param) {
@@ -38,14 +38,8 @@
            if (StringUtils.isNotEmpty(str)) {
                hql += " and type=:type ";
                args.put("type", str);
            }
            str = (String) param.get("type");
            if (StringUtils.isEmpty(str)) {
                hql += " and type <> 'LOSS' and type <> 'OVER'";
            } else {
                hql += " and type=:type ";
                args.put("type", str);
                hql += " and type <> 'LOSS' and type <> 'OVER'";
            }
            str = (String) param.get("customerId");
igds-security/src/main/java/com/ld/igds/models/SecSnapDepot.java
@@ -44,11 +44,11 @@
    private String result="SUCCESS";
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @Column(name = "UPDATE_TIME_", length = 1)
    @Column(name = "UPDATE_TIME_")
    @PropertyDef(label = "抓拍时间")
    private Date updateTime;
    @Column(name = "FILE_SUFFIX_", length = 6)
    @Column(name = "FILE_SUFFIX_", length = 4)
    @PropertyDef(label = "图像文件后缀名")
    private String fileSuffix = "jpg";
igds-security/src/main/java/com/ld/igds/sec/service/SecSnapDepotService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,51 @@
package com.ld.igds.sec.service;
import com.bstek.bdf2.core.orm.hibernate.HibernateDao;
import com.bstek.dorado.data.provider.Page;
import com.ld.igds.models.SecSnapDepot;
import com.ld.igds.util.DateUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Repository;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@Repository
public class SecSnapDepotService extends HibernateDao {
    public void pageSnapDepot(Page<SecSnapDepot> page, Map<String, Object> param) throws Exception {
        String hql = " from " + SecSnapDepot.class.getName()
                + " where companyId=:companyId and deptId=:deptId";
        Map<String, Object> args = new HashMap<>();
        args.put("companyId", param.get("companyId"));
        args.put("deptId", param.get("deptId"));
        String str = (String) param.get("depotId");
        if (StringUtils.isNotEmpty(str)) {
            hql += " and depotId =:depotId";
            args.put("depotId", str);
        }
        Date date = (Date) param.get("start");
        if (null != date) {
            hql += " and updateTime >=:start";
            args.put("start", DateUtil.getCurZero(date));
        }
        date = (Date) param.get("end");
        if (null != date) {
            hql += " and updateTime <:end";
            args.put("end", DateUtil.getNextZero(date));
        }
        String countHql = "select count(1) " + hql;
        hql += " order by updateTime desc";
        this.pagingQuery(page, hql, countHql, args);
    }
}
igds-security/src/main/java/com/ld/igds/sec/view/SecSnapDepot.view.xml
@@ -73,55 +73,124 @@
        <Property name="label">更新时间</Property>
      </PropertyDef>
    </DataType>
    <DataType name="dtQuery">
      <PropertyDef name="depotId">
        <Property/>
        <Property name="label">所属仓库</Property>
      </PropertyDef>
      <PropertyDef name="start">
        <Property name="label">起始日期</Property>
        <Property name="dataType">Date</Property>
      </PropertyDef>
      <PropertyDef name="end">
        <Property name="label">截止日期</Property>
        <Property name="dataType">Date</Property>
      </PropertyDef>
    </DataType>
  </Model>
  <View layout="padding:5;regionPadding:5">
    <Property name="packages">font-awesome,css-common</Property>
    <DataSet id="dsMain">
      <Property name="loadMode">lazy</Property>
      <Property name="dataType">[dtMain]</Property>
      <Property name="dataProvider">secSnapDepotPR#pageSnapDepot</Property>
      <Property name="pageSize">12</Property>
    </DataSet>
    <DataSet id="dsConf">
      <Property name="dataType">[dtConf]</Property>
    </DataSet>
    <ToolBar>
      <ToolBarLabel>
        <Property name="text">菜单栏:</Property>
      </ToolBarLabel>
      <Fill/>
      <ToolBarButton>
        <ClientEvent name="onClick">view.get(&quot;#dialogConf&quot;).show();&#xD;
</ClientEvent>
        <Property name="caption">抓拍配置</Property>
      </ToolBarButton>
    </ToolBar>
    <Container layout="regionPadding:10" layoutConstraint="center">
    <DataSet id="dsQuery">
      <ClientEvent name="onReady">self.insert({});</ClientEvent>
      <Property name="dataType">dtQuery</Property>
    </DataSet>
    <Panel layout="regionPadding:10">
      <Property name="caption">视频图像信息管理</Property>
      <Property name="iconClass">fa fa-bars</Property>
      <Buttons/>
      <Children>
        <Container>
          <Property name="contentOverflow">hidden</Property>
      <Property name="exClassName">bg-color</Property>
      <DataGrid layoutConstraint="center padding:5px">
        <Property name="dataSet">dsMain</Property>
        <Property name="readOnly">true</Property>
        <RowNumColumn>
          <Property name="width">50</Property>
        </RowNumColumn>
        <DataColumn name="depotId">
          <AutoForm>
            <Property name="cols">80,*,*,*,*</Property>
            <Property name="dataSet">dsQuery</Property>
            <Label>
              <Property name="text">查询条件:</Property>
            </Label>
            <AutoFormElement>
              <Property name="name">depotId</Property>
          <Property name="property">depotId</Property>
        </DataColumn>
        <DataColumn name="updateTime">
          <Property name="property">updateTime</Property>
        </DataColumn>
        <DataColumn name="zpsj">
          <Property name="property">zpsj</Property>
        </DataColumn>
        <DataColumn name="txwjhzm">
          <Property name="property">txwjhzm</Property>
        </DataColumn>
        <DataColumn name="wjmc">
          <Property name="property">wjmc</Property>
        </DataColumn>
        <DataColumn name="yzwbh">
          <Property name="property">yzwbh</Property>
        </DataColumn>
      </DataGrid>
              <Editor/>
            </AutoFormElement>
            <AutoFormElement>
              <Property name="name">start</Property>
              <Property name="property">start</Property>
              <Editor/>
            </AutoFormElement>
            <AutoFormElement>
              <Property name="name">end</Property>
              <Property name="property">end</Property>
              <Editor/>
            </AutoFormElement>
            <Container layout="regionPadding:10">
              <Button layoutConstraint="left">
                <ClientEvent name="onClick">var entity = view.get(&quot;#dsQuery.data:#&quot;);&#xD;
view.get(&quot;#dsMain&quot;).set(&quot;parameter&quot;,entity).flushAsync(function(){&#xD;
    $notify(&quot;查询成功!&quot;);&#xD;
});</ClientEvent>
                <Property name="caption">查询</Property>
                <Property name="exClassName">btn-normal</Property>
                <Property name="iconClass">fa fa-search</Property>
              </Button>
              <Button layoutConstraint="left">
                <ClientEvent name="onClick">view.get(&quot;#dsQuery&quot;).setData({});</ClientEvent>
                <Property name="caption">重置</Property>
                <Property name="exClassName">btn-warn</Property>
                <Property name="iconClass">fa fa-refresh</Property>
              </Button>
              <Button layoutConstraint="left">
                <ClientEvent name="onClick">view.get(&quot;#dialogConf&quot;).show();</ClientEvent>
                <Property name="caption">抓拍配置</Property>
                <Property name="exClassName">btn-default</Property>
                <Property name="iconClass">fa fa-cogs</Property>
              </Button>
    </Container>
          </AutoForm>
        </Container>
        <Container layoutConstraint="center">
          <Property name="exClassName">bg-color</Property>
          <DataBlockView>
            <ClientEvent name="onRenderBlock">&#xD;
var time = arg.data.get(&quot;zpsj&quot;).formatDate(&quot;Y-m-d H:i&quot;);&#xD;
var hwdm = arg.data.getText(&quot;hwdm&quot;);&#xD;
var cfdm = arg.data.getText(&quot;cfdm&quot;);&#xD;
var kqdm = arg.data.getText(&quot;kqdm&quot;);&#xD;
var imgSrc = &quot;../../grain/file/get-depot-snap?filePath=&quot;+arg.data.get(&quot;wjdz&quot;);&#xD;
var htm = &quot;&lt;div>&lt;img src='&quot;+imgSrc+&quot;' style='height:250px; width:100%;'>&lt;div>&lt;span style='padding-left:10px;'>库区:&quot;+kqdm+&quot;&lt;/span>&lt;span style='float:right;padding-right:10px;'>仓房:&quot;+cfdm+&quot;&lt;/span>&lt;/div>&lt;div>&lt;span style='padding-left:10px;'>货位:&quot;+hwdm+&quot;&lt;/span>&lt;span style='float:right;padding-right:10px;'>时间:&quot;+time+&quot;&lt;/span>&lt;/div>&lt;/div>&quot;;&#xD;
&#xD;
arg.dom.innerHTML = htm;&#xD;
arg.progressDefault=false;</ClientEvent>
            <Property name="dataSet">dsMain</Property>
            <Property name="blockHeight">300</Property>
            <Property name="blockWidth">390</Property>
            <Property name="blockLayout">vertical</Property>
            <Property name="horiPadding">15</Property>
            <Property name="horiSpacing">15</Property>
            <Property name="vertPadding">15</Property>
            <Property name="vertSpacing">15</Property>
            <Property name="lineSize">4</Property>
          </DataBlockView>
        </Container>
        <ToolBar layoutConstraint="bottom">
          <Fill/>
          <DataPilot layoutConstraint="right">
            <Property name="dataSet">dsMain</Property>
            <Property name="itemCodes">pageSize,pages</Property>
          </DataPilot>
        </ToolBar>
      </Children>
      <Tools/>
    </Panel>
    <Dialog id="dialogConf">
      <Buttons/>
      <Children>
@@ -145,5 +214,9 @@
      </Children>
      <Tools/>
    </Dialog>
    <AjaxAction id="ajaxDel">
      <Property name="service">videoImgPR#delData</Property>
      <Property name="confirmMessage">当前数据删除后无法恢复,请确认要删除么?</Property>
    </AjaxAction>
  </View>
</ViewConfig>
igds-security/src/main/java/com/ld/igds/sec/view/SecSnapDepotPR.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,44 @@
package com.ld.igds.sec.view;
import com.bstek.dorado.annotation.DataProvider;
import com.bstek.dorado.data.provider.Page;
import com.ld.igds.models.SecSnapDepot;
import com.ld.igds.sec.service.SecSnapDepotService;
import com.ld.igds.util.ContextUtil;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
/**
 * @author: andy.jia
 * @description: ä»“内抓拍信息获取管理
 * @version:
 */
@Component
public class SecSnapDepotPR {
    @Resource
    private SecSnapDepotService snapDepotService;
    /**
     * secSnapDepotPR#pageSnapDepot
     *
     * @param param
     * @throws Exception
     */
    @DataProvider
    public void pageSnapDepot(Page<SecSnapDepot> page, Map<String, Object> param)
            throws Exception {
        if(null == param) param = new HashMap<>();
        param.put("companyId", ContextUtil.getCompanyId());
        param.put("deptId", ContextUtil.subDeptId(null));
        snapDepotService.pageSnapDepot(page,param);
    }
}
igds-web/src/main/resources/d7/css/common.css
@@ -2,6 +2,22 @@
/** é‡å†™D7的配置**/
/** block **/
/** æ³¨æ„å¼ºåˆ¶ä¸º4列 **/
.block{
    width:24.2% !important;
}
.d-block-view .block{
    border: 1px solid #39aef5;
}
.d-block-view .block-current{
    border: 1px solid #39aef5;
}
/** dataGrid的表头 **/
.d-grid .header-table .header .caption {
    margin-left: 4px;
igds-web/src/main/resources/static/images/img-fail.jpg
igds-web/src/main/resources/static/img/aerial-5000_001.png