档案目录展示——识别记录数(添加字段sbCount),图片记录删除同时删本地图片文件

master
hansha 1 year ago
parent 93d7e95727
commit c685e4dbc2

@ -29,7 +29,7 @@
## 在线体验
- admin/admin123 sysAdmin/123456
- admin/huawei12#$/Huawei12#$ sysAdmin/123456
#影源扫描仪 授权码V4tMKPYgFtW8vQr4C0s4/g==
测试临时码D+1WT4eWDqLseG5433yq9w==
@ -37,3 +37,6 @@
webScan默认地址http://localhost:18989/WebScan/ 访问不到localhost换成本机ip可以访问扫描仪每次调用扫描先获取ip替换一下
#清理后的sql文件dangan.sql 已上传项目
#后端打包 先修改配置文件 profile: /ceshi/uploadPath soloLogin: false ocr: ip替换为服务器的20.206.150.166
#前端打包 task/index.vue 搜索axios.post('http://20.206.150.166:22443/get_file_count',

@ -9,9 +9,8 @@ spring:
url: jdbc:mysql://localhost:3307/dangan?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
#url: jdbc:mysql://localhost:3306/dangan?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
#username: dangan
password: hs123456
#password: dangan
#password: ruanfa
# 从库数据源
slave:
# 从数据源开关/默认关闭

@ -51,6 +51,18 @@ public class DaCatalog extends BaseEntity
/** 子目录 */
private List<DaCatalog> children = new ArrayList<DaCatalog>();
/** 当前目录及子目录识别数量 */
private Long sbCount;
public Long getSbCount() {
return sbCount;
}
public void setSbCount(Long sbCount) {
this.sbCount = sbCount;
}
public void setId(Long id)
{
this.id = id;

@ -61,4 +61,6 @@ public interface DaBirthDjMapper
public int deleteDaBirthDjByIds(Long[] ids);
List<DaBirthDj> searchDaBirthDjList(DaBirthDj daBirthDj);
Long selectCountByMuIds(List<Long> ids);
}

@ -66,4 +66,6 @@ public interface DaCatalogMapper
List<DaCatalog> selectDaCatalogListByUserId(DaCatalog daCatalog);
List<Long> selectCatalogIdsByUserId(Long userId);
List<Long> selectContainIdsById(String id);
}

@ -61,4 +61,6 @@ public interface DaCzrkdjMapper
public int deleteDaCzrkdjByIds(Long[] ids);
List<DaCzrkdj> searchDaCzrkdjList(DaCzrkdj daCzrkdj);
Long selectCountByMuIds(List<Long> muIds);
}

@ -61,4 +61,6 @@ public interface DaQyzMapper
public int deleteDaQyzByIds(Long[] ids);
List<DaQyz> searchDaQyzList(DaQyz daQyz);
Long selectCountByMuIds(List<Long> ids);
}

@ -61,4 +61,6 @@ public interface DaYtzmMapper
public int deleteDaYtzmByIds(Long[] ids);
List<DaYtzm> searchYtzmList(DaYtzm daYtzm);
Long selectCountByMuIds(List<Long> ids);
}

@ -61,4 +61,6 @@ public interface DaZfnyhkcgMapper
public int deleteDaZfnyhkcgByIds(Long[] ids);
List<DaZfnyhkcg> searchDaZfnyhkcgList(DaZfnyhkcg daZfnyhkcg);
Long selectCountByMuIds(List<Long> ids);
}

@ -61,4 +61,6 @@ public interface DaZqzMapper
public int deleteDaZqzByIds(Long[] ids);
List<DaZqz> searchDaZqzList(DaZqz daZqz);
Long selectCountByMuIds(List<Long> ids);
}

@ -10,10 +10,8 @@ import com.da.common.exception.ServiceException;
import com.da.common.utils.DateUtils;
import com.da.common.utils.StringUtils;
import com.da.dangan.domain.DaPicturesRecard;
import com.da.dangan.mapper.DaCatalogMapper;
import com.da.dangan.mapper.*;
import com.da.dangan.service.IDaCatalogService;
import com.da.dangan.service.IDaPicturesRecardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -33,8 +31,20 @@ public class DaCatalogServiceImpl implements IDaCatalogService
{
@Resource
private DaCatalogMapper daCatalogMapper;
@Autowired
private IDaPicturesRecardService daPicturesRecardService;
@Resource
private DaPicturesRecardMapper daPicturesRecardMapper;
@Resource
private DaCzrkdjMapper daCzrkdjMapper;
@Resource
private DaBirthDjMapper daBirthDjMapper;
@Resource
private DaQyzMapper daQyzMapper;
@Resource
private DaYtzmMapper daYtzmMapper;
@Resource
private DaZfnyhkcgMapper daZfnyhkcgMapper;
@Resource
private DaZqzMapper daZqzMapper;
/**
*
*
@ -111,12 +121,58 @@ public class DaCatalogServiceImpl implements IDaCatalogService
loginUser.getUser().getRoles().stream().anyMatch(sysRole -> sysRole.getRoleKey().equals("sysAdmin")))
{
catalogList = daCatalogMapper.selectDaCatalogList(daCatalog);
}
else
} else
{ //根据用户权限显示目录信息
daCatalog.getParams().put("userId", loginUser.getUserId());
catalogList = daCatalogMapper.selectDaCatalogListByUserId(daCatalog);
}
//按照目录的类型和id 查询对应目录及下级的档案识别的数据量
for(DaCatalog catalog:catalogList){
String ywType = catalog.getYwType();
//查询子目录的所有id集合
List<Long> ids = daCatalogMapper.selectContainIdsById(catalog.getId().toString());
ids.add(catalog.getId());
//默认count=0
Long count=0L;
switch (ywType) {
case "option1": //常住人口登记表1
//break;
case "option2": //常住卡
// break;
case "option3": //常住人口登记表2
//break;
case "option9": //常住人口登记表3
count = daCzrkdjMapper.selectCountByMuIds(ids);
catalog.setSbCount(count);
break;
case "option4":
//出生医学证明
count = daBirthDjMapper.selectCountByMuIds(ids);
catalog.setSbCount(count);
break;
case "option5":
//迁移证
count = daQyzMapper.selectCountByMuIds(ids);
catalog.setSbCount(count);
break;
case "option6":
//一胎证明
count = daYtzmMapper.selectCountByMuIds(ids);
catalog.setSbCount(count);
break;
case "option7":
//转非农业人口批复存根
count = daZfnyhkcgMapper.selectCountByMuIds(ids);
catalog.setSbCount(count);
break;
case "option8":
//准迁证
count = daZqzMapper.selectCountByMuIds(ids);
catalog.setSbCount(count);
break;
}
}
return catalogList;
}
@ -177,7 +233,7 @@ public class DaCatalogServiceImpl implements IDaCatalogService
//目录下已有上传图片的 不能删除
DaPicturesRecard picturesRecard = new DaPicturesRecard();
picturesRecard.setMuId(id);
List<DaPicturesRecard> daPicturesRecards = daPicturesRecardService.selectDaPicturesRecardList(picturesRecard);
List<DaPicturesRecard> daPicturesRecards = daPicturesRecardMapper.selectDaPicturesRecardList(picturesRecard);
if(daPicturesRecards!=null&&daPicturesRecards.size()>0){
return AjaxResult.error("目录下有已上传的图片,不能删除");
}

@ -1,14 +1,17 @@
package com.da.dangan.service.impl;
import com.da.common.config.RuoYiConfig;
import com.da.common.core.domain.AjaxResult;
import com.da.common.utils.DateUtils;
import com.da.dangan.domain.DaPicturesRecard;
import com.da.dangan.mapper.DaPicturesRecardMapper;
import com.da.dangan.service.IDaPicturesRecardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.io.File;
import java.util.List;
import java.util.stream.Collectors;
/**
* Service
@ -19,7 +22,7 @@ import java.util.List;
@Service
public class DaPicturesRecardServiceImpl implements IDaPicturesRecardService
{
@Autowired
@Resource
private DaPicturesRecardMapper daPicturesRecardMapper;
/**
@ -81,15 +84,24 @@ public class DaPicturesRecardServiceImpl implements IDaPicturesRecardService
@Override
public AjaxResult deleteDaPicturesRecardByIds(Long[] ids)
{
//判断图片是否已经被识别
for(Long id:ids){
//判断图片是否已经被识别————前端控制只有未识别有删除按钮
/*for(Long id:ids){
DaPicturesRecard picturesRecard = daPicturesRecardMapper.selectDaPicturesRecardById(id);
if (picturesRecard!=null&&!picturesRecard.getRecognize().equals("0")){
return AjaxResult.error("只能删除未识别图片");
}
}
}*/
//通过id获取所有图片信息
List<DaPicturesRecard> picturesRecards = daPicturesRecardMapper.selectDaPicturesRecardByIds(ids);
List<String> picurls = picturesRecards.stream().map(DaPicturesRecard::getPicUrl).collect(Collectors.toList());
//删除图片记录 s
int i = daPicturesRecardMapper.deleteDaPicturesRecardByIds(ids);
if(i>0){
//图片记录删除成功,去本地对应位置删除该图片文件
for(String picUrl:picurls){
boolean deleResult = deleteFile(getPath(picUrl));
}
return AjaxResult.success();
}
return AjaxResult.error("系统错误!");
@ -99,4 +111,36 @@ public class DaPicturesRecardServiceImpl implements IDaPicturesRecardService
public List<DaPicturesRecard> selectDaPicturesRecardByIds(Long[] ids) {
return daPicturesRecardMapper.selectDaPicturesRecardByIds(ids);
}
/**
*
* @param fileName
* @return
*/
public boolean deleteFile(String fileName){
File file = new File(fileName);
//判断文件存不存在
if(!file.exists()){
System.out.println("删除文件失败:"+fileName+"不存在!");
return false;
}else{
//判断这是不是一个文件ps有可能是文件夹
if(file.isFile()){
return file.delete();
}
}
return false;
}
/**
*
* @param path
* @return
*/
public String getPath(String path) {
String profile = RuoYiConfig.getUploadPath();
int i = path.indexOf("upload");
String filePath = profile + path.substring(i + 6);
return filePath;
}
}

@ -83,7 +83,7 @@ public class TimeTask {
logger.info("--------开启任务:" + datask.getId() + "结果查询");
//调用第三方接口查看识别任务状态 已结束直接取结果,处理中跳过
result = CallThirdInterface.callThirdInterfaceGetByTaskId(url2, datask.getId());
datask.setResultStr(result);
//datask.setResultStr(result); //---------------------为节省mysql空间不保存返回结果数据
//! 解析JSON字符串,获取键对应的值
JSONObject jsonobject = null;
String status = null;
@ -94,7 +94,7 @@ public class TimeTask {
Date date = new Date();
//todo 处理json异常 之前测试多次出现返回结果Internal Server Error
datask.setStatus("4"); //任务异常
datask.setRemark(result);
datask.setRemark("JSONException");
datask.setSbEnd(date);//识别结束时间
datask.setProcessDuration(date.getTime()-datask.getSbStart().getTime());
daTaskService.updateDaTask(datask);
@ -450,10 +450,10 @@ public class TimeTask {
}
} catch (Exception e) {
e.printStackTrace();
scTask.setStatus("0");
/*scTask.setStatus("0");
scTask.setRemark(e.getMessage()+",result:"+result);
daTaskService.updateDaTask(scTask);
System.out.println("upload_api接口:" + result);
daTaskService.updateDaTask(scTask);*/
System.out.println("---------------------------------------调用upload_api上传接口异常:" + result);
}
}
@ -466,6 +466,11 @@ public class TimeTask {
logger.info("clearByTaskId------------------------------------" + taskId + " ---" + code + "---" + msg);
}
/**
*
* @param path
* @return
*/
public String getPath(String path) {
String profile = RuoYiConfig.getUploadPath();
int i = path.indexOf("upload");

@ -153,6 +153,13 @@
<include refid="selectDaBirthDjVo"/>
where id = #{id}
</select>
<!--查询该目录及子目录下有多少条数据-->
<select id="selectCountByMuIds" parameterType="Long" resultType="Long">
select count(1) from da_birth_dj where mu_id in
<foreach item="muId" collection="list" open="(" separator="," close=")">
#{muId}
</foreach>
</select>
<insert id="insertDaBirthDj" parameterType="DaBirthDj" useGeneratedKeys="true" keyProperty="id">
insert into da_birth_dj

@ -69,6 +69,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where uc.user_id = #{userId}
order by c.pid, c.order_num
</select>
<!--查用所有子目录ids-->
<select id="selectContainIdsById" resultType="Long">
select id from da_catalog where ancestors like concat('%', #{id}, '%')
</select>
<insert id="insertDaCatalog" parameterType="DaCatalog" useGeneratedKeys="true" keyProperty="id">
insert into da_catalog

@ -218,6 +218,13 @@
<include refid="selectDaCzrkdjVo"/>
where id = #{id}
</select>
<!--查询该目录及子目录下有多少条数据-->
<select id="selectCountByMuIds" parameterType="Long" resultType="Long">
select count(1) from da_czrkdj where mu_id in
<foreach item="muId" collection="list" open="(" separator="," close=")">
#{muId}
</foreach>
</select>
<insert id="insertDaCzrkdj" parameterType="DaCzrkdj" useGeneratedKeys="true" keyProperty="id">
insert into da_czrkdj

@ -161,6 +161,13 @@
<include refid="selectDaQyzVo"/>
where id = #{id}
</select>
<!--查询该目录及子目录下有多少条数据-->
<select id="selectCountByMuIds" parameterType="Long" resultType="Long">
select count(1) from da_qyz where mu_id in
<foreach item="muId" collection="list" open="(" separator="," close=")">
#{muId}
</foreach>
</select>
<insert id="insertDaQyz" parameterType="DaQyz" useGeneratedKeys="true" keyProperty="id">
insert into da_qyz

@ -133,6 +133,13 @@
<include refid="selectDaYtzmVo"/>
where id = #{id}
</select>
<!--查询该目录及子目录下有多少条数据-->
<select id="selectCountByMuIds" parameterType="Long" resultType="Long">
select count(1) from da_ytzm where mu_id in
<foreach item="muId" collection="list" open="(" separator="," close=")">
#{muId}
</foreach>
</select>
<insert id="insertDaYtzm" parameterType="DaYtzm" useGeneratedKeys="true" keyProperty="id">
insert into da_ytzm

@ -165,7 +165,13 @@
<include refid="selectDaZfnyhkcgVo"/>
where id = #{id}
</select>
<!--查询该目录及子目录下有多少条数据-->
<select id="selectCountByMuIds" parameterType="Long" resultType="Long">
select count(1) from da_zfnyhkcg where mu_id in
<foreach item="muId" collection="list" open="(" separator="," close=")">
#{muId}
</foreach>
</select>
<insert id="insertDaZfnyhkcg" parameterType="DaZfnyhkcg" useGeneratedKeys="true" keyProperty="id">
insert into da_zfnyhkcg
<trim prefix="(" suffix=")" suffixOverrides=",">

@ -206,6 +206,13 @@
<include refid="selectDaZqzVo"/>
where id = #{id}
</select>
<!--查询该目录及子目录下有多少条数据-->
<select id="selectCountByMuIds" parameterType="Long" resultType="Long">
select count(1) from da_zqz where mu_id in
<foreach item="muId" collection="list" open="(" separator="," close=")">
#{muId}
</foreach>
</select>
<insert id="insertDaZqz" parameterType="DaZqz" useGeneratedKeys="true" keyProperty="id">
insert into da_zqz

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save