检索条件修改

master
hansha 2 years ago
parent 91a434131f
commit 3f5ab02862

@ -1,18 +1,22 @@
package com.da.dangan.controller;
import cn.hutool.json.JSONObject;
import com.alibaba.fastjson2.JSONArray;
import com.da.common.config.RuoYiConfig;
import com.da.common.core.controller.BaseController;
import com.da.common.core.domain.AjaxResult;
import com.da.common.utils.file.FileUploadUtils;
import com.da.common.utils.file.FileUtils;
import com.da.dangan.domain.DaCzrkdj;
import com.da.dangan.domain.DaPicturesRecard;
import com.da.dangan.domain.vo.CzrkDatas;
import com.da.dangan.domain.vo.PicParams;
import com.da.dangan.service.IDaBirthDjService;
import com.da.dangan.service.IDaCzrkdjService;
import com.da.dangan.service.IDaPicturesRecardService;
import com.da.dangan.util.CallThirdInterface;
import com.da.framework.config.ServerConfig;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
@ -111,11 +115,15 @@ public class DangAnCollectController extends BaseController {
*/
@PostMapping("/recongnize")
public AjaxResult recognize(@RequestBody List<DaPicturesRecard> picRecards) {
String code;
String msg;
int success;
int total;
try {
//取所有id的集合
List<Long> ids = picRecards.stream().map(DaPicturesRecard::getId).collect(Collectors.toList());
String ywType = picRecards.get(0).getYwType();
String singleOrDouble = picRecards.get(0).getSingelOrDouble();
// String singleOrDouble = picRecards.get(0).getSingelOrDouble();
//获取所有的文件
List<File> files = new ArrayList<>();
for (DaPicturesRecard picRecard : picRecards) {
@ -143,15 +151,19 @@ public class DangAnCollectController extends BaseController {
String result = CallThirdInterface.callThirdInterface(url, files, ywType, ids);
long end = System.currentTimeMillis();
logger.info("CompletableFuture耗时--——————————————————》" + (end - start) + "ms");
//如果result中的code=0代表结果错误
// 解析JSON字符串
//! 获取键对应的值
//! 解析JSON字符串,获取键对应的值
JSONObject jsonobject = new JSONObject(result);
String code = jsonobject.getStr("code");
String msg = jsonobject.getStr("msg");
int success = jsonobject.getInt("success");
int total = jsonobject.getInt("total");
Long[] failPicids = (Long[])jsonobject.getJSONArray("failPicid").toArray();
code = jsonobject.getStr("code");
msg = jsonobject.getStr("msg");
success = jsonobject.getInt("success");
total = jsonobject.getInt("total");
//如果code=0 识别失败,直接返回
if (code.equals("0")) {
return AjaxResult.error(msg + ", 成功:" + success + " , 总共:" + total);
} else {
//识别接口方说:多张识别,要么全识别成功,要么一张也识别不成功 ,所以---------failPicids暂时不用 失败则全失败
// String failPicid=jsonobject.getStr("msg");
String datas = jsonobject.getStr("datas");
// TODO 数据解析 根据业务类型存储识别后的信息
@ -167,11 +179,39 @@ public class DangAnCollectController extends BaseController {
switch (ywType) {
case "option1":
break;
//break;
case "option2":
break;
// break;
case "option3":
//break;
case "option9":
//获取常住人口信息集合
List<CzrkDatas> czrkDatas = JSONArray.parseArray(datas, CzrkDatas.class);
for (CzrkDatas czrkData : czrkDatas) {
List<Long> picid = czrkData.getPicid();
// 将Long类型映射为String类型, 并将Stream转换为数组
String[] spicId = picid.stream().map(Object::toString).toArray(String[]::new);
String picIds = StringUtils.join(spicId, ",");//分号分割
//存储图片url
List<String> picUrls = picRecards.stream().map(DaPicturesRecard::getPicUrl).collect(Collectors.toList());
String[] pics = picUrls.stream().map(Object::toString).toArray(String[]::new);
String pictures = StringUtils.join(pics, ",");//分号分割
List<DaCzrkdj> info = czrkData.getInfo();
if(info!=null&&info.size()>0) {
for (DaCzrkdj daCzrkdj : info) {
daCzrkdj.setAllPicIds(picIds);
daCzrkdj.setAllPics(pictures);
daCzrkdj.setPicIds(picIds);
daCzrkdj.setPictures(pictures);
daCzrkdjService.insertDaCzrkdj(daCzrkdj);
}
}
}
/*DaCzrkdj daCzrkdj = new DaCzrkdj();
daCzrkdj.setAllPicIds(picIds);
daCzrkdj.setAllPics();
@ -195,21 +235,19 @@ public class DangAnCollectController extends BaseController {
break;
case "option8":
break;
case "option9" :
break;
}
//识别成功的图片 ,修改图片信息记录表为已识别 可以用多线程
for (DaPicturesRecard picRecard : picRecards) {
picRecard.setRecognize("1");
daPicturesRecardService.updateDaPicturesRecard(picRecard);
}
}
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.error(e.getMessage());
}
// return AjaxResult.success("成功:"+success+" , 总共:"+total);
return AjaxResult.success();
}
@ -331,8 +369,23 @@ public class DangAnCollectController extends BaseController {
* test
*/
@PostMapping("/test3")
public String test(@RequestParam ("files")MultipartFile[] files,@RequestParam ("datas")Long[] datas){
return datas.toString();
public String test() {
String result = "{\"code\": 0, \"datas\": [{\"Picid\": [\"21\"], \"info\": [{\"name\":\"333\"},{\"name\":\"111\"}]}, {\"Picid\": [\"22\"], \"info\":[]]}]}";
JSONObject jsonobject = new JSONObject(result);
String code = jsonobject.getStr("code");
String msg = jsonobject.getStr("msg");
Integer success = jsonobject.getInt("success");
Integer total = jsonobject.getInt("total");
//识别接口方说:多张识别,要么全识别成功,要么一张也识别不成功 ,所以---------failPicids暂时不用 失败则全失败
// String failPicid=jsonobject.getStr("msg");
String datas = jsonobject.getStr("datas");
//获取常住人口信息集合
List<CzrkDatas> czrkDatas = JSONArray.parseArray(datas, CzrkDatas.class);
System.out.println(czrkDatas.get(1).getInfo()==null);
System.out.println(czrkDatas.get(1).getInfo().size());
System.out.println(czrkDatas.get(0).getInfo().get(0).getName());
return "datas.toString()";
}
/**

@ -0,0 +1,26 @@
package com.da.dangan.domain.vo;
import com.da.dangan.domain.DaBirthDj;
import java.util.List;
public class CszmDatas {
private List<Long> Picid;
private List<DaBirthDj> info;
public List<Long> getPicid() {
return Picid;
}
public void setPicid(List<Long> picid) {
Picid = picid;
}
public List<DaBirthDj> getInfo() {
return info;
}
public void setInfo(List<DaBirthDj> info) {
this.info = info;
}
}

@ -0,0 +1,26 @@
package com.da.dangan.domain.vo;
import com.da.dangan.domain.DaCzrkdj;
import java.util.List;
public class CzrkDatas {
private List<Long> Picid;
private List<DaCzrkdj> info;
public List<Long> getPicid() {
return Picid;
}
public void setPicid(List<Long> picid) {
Picid = picid;
}
public List<DaCzrkdj> getInfo() {
return info;
}
public void setInfo(List<DaCzrkdj> info) {
this.info = info;
}
}

@ -0,0 +1,26 @@
package com.da.dangan.domain.vo;
import com.da.dangan.domain.DaQyz;
import java.util.List;
public class QyzDatas {
private List<Long> Picid;
private List<DaQyz> info;
public List<Long> getPicid() {
return Picid;
}
public void setPicid(List<Long> picid) {
Picid = picid;
}
public List<DaQyz> getInfo() {
return info;
}
public void setInfo(List<DaQyz> info) {
this.info = info;
}
}

@ -0,0 +1,26 @@
package com.da.dangan.domain.vo;
import com.da.dangan.domain.DaYtzm;
import java.util.List;
public class YtzmDatas {
private List<Long> Picid;
private List<DaYtzm> info;
public List<Long> getPicid() {
return Picid;
}
public void setPicid(List<Long> picid) {
Picid = picid;
}
public List<DaYtzm> getInfo() {
return info;
}
public void setInfo(List<DaYtzm> info) {
this.info = info;
}
}

@ -0,0 +1,26 @@
package com.da.dangan.domain.vo;
import com.da.dangan.domain.DaZfnyhkcg;
import java.util.List;
public class ZfnyDatas {
private List<Long> Picid;
private List<DaZfnyhkcg> info;
public List<Long> getPicid() {
return Picid;
}
public void setPicid(List<Long> picid) {
Picid = picid;
}
public List<DaZfnyhkcg> getInfo() {
return info;
}
public void setInfo(List<DaZfnyhkcg> info) {
this.info = info;
}
}

@ -0,0 +1,26 @@
package com.da.dangan.domain.vo;
import com.da.dangan.domain.DaZqz;
import java.util.List;
public class ZqzDatas {
private List<Long> Picid;
private List<DaZqz> info;
public List<Long> getPicid() {
return Picid;
}
public void setPicid(List<Long> picid) {
Picid = picid;
}
public List<DaZqz> getInfo() {
return info;
}
public void setInfo(List<DaZqz> info) {
this.info = info;
}
}

@ -3,7 +3,6 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.da.dangan.mapper.DaBirthDjMapper">
<resultMap type="DaBirthDj" id="DaBirthDjResult">
<result property="id" column="id" />
<result property="ywType" column="yw_type" />
@ -54,7 +53,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="ywType != null and ywType != ''"> and yw_type = #{ywType}</if>
<if test="muId != null "> and mu_id = #{muId}</if>
<if test="birthNum != null and birthNum != ''"> and birth_num = #{birthNum}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="name != null and name != ''">
and (name like concat('%', #{name}, '%')
or m_name like concat('%', #{name}, '%')
or f_name like concat('%', #{name}, '%')
)
</if>
<if test="birthday != null "> and birthday = #{birthday}</if>
<if test="sex != null and sex != ''"> and sex = #{sex}</if>
<if test="bornAddress != null and bornAddress != ''"> and born_address = #{bornAddress}</if>

@ -3,7 +3,6 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.da.dangan.mapper.DaCzrkdjMapper">
<resultMap type="DaCzrkdj" id="DaCzrkdjResult">
<result property="id" column="id" />
<result property="ywType" column="yw_type" />
@ -68,7 +67,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="ywType != null and ywType != ''"> and yw_type = #{ywType}</if>
<if test="muId != null "> and mu_id = #{muId}</if>
<if test="relation != null and relation != ''"> and relation = #{relation}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="name != null and name != ''">
and ( name like concat('%', #{name}, '%')
or hz_name like concat('%', #{name}, '%')
or other_name like concat('%', #{name}, '%')
)
</if>
<if test="otherName != null and otherName != ''"> and other_name like concat('%', #{otherName}, '%')</if>
<if test="sex != null and sex != ''"> and sex = #{sex}</if>
<if test="birthday != null "> and birthday = #{birthday}</if>
@ -120,8 +124,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="muId != null "> and mu_id = #{muId}</if>
<if test="name != null and name != ''">
and ( name like concat('%', #{name}, '%')
or hz_name like concat('%', #{name}, '%'))
or other_name like concat('%', #{name}, '%'))
or hz_name like concat('%', #{name}, '%')
or other_name like concat('%', #{name}, '%')
)
</if>
<if test="otherName != null and otherName != ''"> and other_name like concat('%', #{otherName}, '%')</if>
<if test="sex != null and sex != ''"> and sex = #{sex}</if>

@ -55,7 +55,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="muId != null "> and mu_id = #{muId}</if>
<if test="fwUnit != null and fwUnit != ''"> and fw_unit = #{fwUnit}</if>
<if test="wjXh != null and wjXh != ''"> and wj_xh = #{wjXh}</if>
<if test="name1 != null and name1 != ''"> and name1 = #{name1}</if>
<if test="name1 != null and name1 != ''">
and ( name1 like concat('%', #{name1}, '%')
or name2 like concat('%', #{name1}, '%')
or name3 like concat('%', #{name1}, '%')
or name4 like concat('%', #{name1}, '%')
)
</if>
<if test="sex1 != null and sex1 != ''"> and sex1 = #{sex1}</if>
<if test="cardId1 != null and cardId1 != ''"> and card_id1 = #{cardId1}</if>
<if test="name2 != null and name2 != ''"> and name2 = #{name2}</if>

@ -51,7 +51,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="muId != null "> and mu_id = #{muId}</if>
<if test="year != null and year != ''"> and year = #{year}</if>
<if test="xh != null and xh != ''"> and xh = #{xh}</if>
<if test="wName != null and wName != ''"> and w_name like concat('%', #{wName}, '%')</if>
<if test="wName != null and wName != ''">
and ( w_name like concat('%', #{wName}, '%')
or m_name like concat('%', #{wName}, '%')
)
</if>
<if test="wUnit != null and wUnit != ''"> and w_unit = #{wUnit}</if>
<if test="wCardId != null and wCardId != ''"> and w_card_id = #{wCardId}</if>
<if test="mName != null and mName != ''"> and m_name like concat('%', #{mName}, '%')</if>

@ -56,7 +56,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="ywType != null and ywType != ''"> and yw_type = #{ywType}</if>
<if test="muId != null "> and mu_id = #{muId}</if>
<if test="num != null and num != ''"> and num = #{num}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="name != null and name != ''">
and ( name like concat('%', #{name}, '%')
or name1 like concat('%', #{name}, '%')
or name2 like concat('%', #{name}, '%')
or name3 like concat('%', #{name}, '%')
or name4 like concat('%', #{name}, '%')
or name5 like concat('%', #{name}, '%')
)
</if>
<if test="address != null and address != ''"> and address = #{address}</if>
<if test="relation1 != null and relation1 != ''"> and relation1 = #{relation1}</if>
<if test="name1 != null and name1 != ''"> and name1 = #{name1}</if>

@ -61,7 +61,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="ywType != null and ywType != ''"> and yw_type = #{ywType}</if>
<if test="muId != null "> and mu_id = #{muId}</if>
<if test="num != null and num != ''"> and num = #{num}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="name != null and name != ''">
and ( name like concat('%', #{name}, '%')
or name1 like concat('%', #{name}, '%')
or name2 like concat('%', #{name}, '%')
or name3 like concat('%', #{name}, '%')
or name4 like concat('%', #{name}, '%')
)
</if>
<if test="cardId != null and cardId != ''"> and card_id = #{cardId}</if>
<if test="address != null and address != ''"> and address = #{address}</if>
<if test="djJg != null and djJg != ''"> and dj_jg = #{djJg}</if>

@ -17,7 +17,7 @@ const service = axios.create({
// axios中请求配置有baseURL选项表示请求URL公共部分
baseURL: process.env.VUE_APP_BASE_API,
// 超时
timeout: 10000
timeout: 100000
})
// request拦截器

Loading…
Cancel
Save