Commit a7412503 by wang_jiaxing

修改案件查询的bug,修改版本更新文件下载和上传方法,修改保存人像核查任务接口,修改人员基本信息查询时将已注销的儋州市代码替换成现有代码

parent d86a9ff5
...@@ -48,9 +48,9 @@ public class AppBbgxServiceImpl extends ServiceImpl<AppBbgxMapper, AppBbgx> impl ...@@ -48,9 +48,9 @@ public class AppBbgxServiceImpl extends ServiceImpl<AppBbgxMapper, AppBbgx> impl
long total = bbgxPage.getTotal(); long total = bbgxPage.getTotal();
List<AppBbgx> rows = bbgxPage.getRecords(); List<AppBbgx> rows = bbgxPage.getRecords();
resultMap.put("sfksj", "1"); resultMap.put("sfksj", "1");
if (rows != null && !rows.isEmpty()){ if (rows != null && !rows.isEmpty()) {
AppBbgx bbgx = rows.get(0); AppBbgx bbgx = rows.get(0);
if (version != null && version.equals(bbgx.getAppVersion())){ if (version != null && version.equals(bbgx.getAppVersion())) {
resultMap.put("sfksj", "0"); resultMap.put("sfksj", "0");
} }
} }
...@@ -63,15 +63,18 @@ public class AppBbgxServiceImpl extends ServiceImpl<AppBbgxMapper, AppBbgx> impl ...@@ -63,15 +63,18 @@ public class AppBbgxServiceImpl extends ServiceImpl<AppBbgxMapper, AppBbgx> impl
public void getXbbwj(String version, HttpServletResponse response) throws IOException { public void getXbbwj(String version, HttpServletResponse response) throws IOException {
AppBbgx bbgx = appBbgxMapper.selectById(version); AppBbgx bbgx = appBbgxMapper.selectById(version);
File file = new File(bbgx.getAppGxwjwz()); File file = new File(bbgx.getAppGxwjwz());
InputStream inputStream = new FileInputStream(file); InputStream inputStream = null;
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("智慧警务app" + version + ".apk", "UTF-8")); ServletOutputStream outputStream;
ServletOutputStream outputStream = response.getOutputStream();
IOUtils.copy(inputStream, outputStream);
try { try {
inputStream = new FileInputStream(file);
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("海南刑侦" + version + ".apk", "UTF-8"));
outputStream = response.getOutputStream();
IOUtils.copy(inputStream, outputStream);
} catch (Exception e) {
e.printStackTrace();
} finally {
IOUtils.closeQuietly(inputStream); IOUtils.closeQuietly(inputStream);
IOUtils.closeQuietly(outputStream); // IOUtils.closeQuietly(outputStream);
} catch (Exception ignored) {
} }
} }
...@@ -95,11 +98,11 @@ public class AppBbgxServiceImpl extends ServiceImpl<AppBbgxMapper, AppBbgx> impl ...@@ -95,11 +98,11 @@ public class AppBbgxServiceImpl extends ServiceImpl<AppBbgxMapper, AppBbgx> impl
int insert; int insert;
try { try {
insert = appBbgxMapper.insert(bbgx); insert = appBbgxMapper.insert(bbgx);
} catch (Exception e){ } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
insert = 0; insert = 0;
} }
if (insert == 0){ if (insert == 0) {
return null; return null;
} }
return version; return version;
......
...@@ -168,9 +168,9 @@ public class TbStAppRyxx extends BaseModel { ...@@ -168,9 +168,9 @@ public class TbStAppRyxx extends BaseModel {
this.xbdm = qgry.getXb(); this.xbdm = qgry.getXb();
this.mzdm = qgry.getMz(); this.mzdm = qgry.getMz();
this.gjdm = "156"; this.gjdm = "156";
this.jgXzqhdm = qgry.getJgssx(); this.jgXzqhdm = "469003".equals(qgry.getJgssx()) ? "460400" : qgry.getJgssx();//处理原儋州市的行政区划代码
this.hjdXzqhdm = qgry.getHkszd(); this.hjdXzqhdm = "469003".equals(qgry.getHkszd()) ? "460400" : qgry.getHkszd();
this.xzzXzqhdm = qgry.getHkszd(); this.xzzXzqhdm = "469003".equals(qgry.getHkszd()) ? "460400" : qgry.getHkszd();
this.xzzDzxz = qgry.getZzxz(); this.xzzDzxz = qgry.getZzxz();
this.zp = "data:image/png;base64," + qgry.getXp(); this.zp = "data:image/png;base64," + qgry.getXp();
} }
......
...@@ -98,7 +98,7 @@ public class BjHcController { ...@@ -98,7 +98,7 @@ public class BjHcController {
} }
@PostMapping("/getRxhcList") @PostMapping("/getRxhcList")
@LogOper(czxxLbdm = "01", yymcJyqk = "0701", czxxJyqk = "查询人像比对任务") // @LogOper(czxxLbdm = "01", yymcJyqk = "0701", czxxJyqk = "查询人像比对任务")
public R getRxhcList(TbStAppRxhcrw rxhcrw){ public R getRxhcList(TbStAppRxhcrw rxhcrw){
try { try {
Map<String, Object> resultMap = tbStAppRxhcrwService.getRxhcList(rxhcrw); Map<String, Object> resultMap = tbStAppRxhcrwService.getRxhcList(rxhcrw);
......
package org.springblade.founder.ydjwhc.entity;
import org.springframework.web.multipart.MultipartFile;
import sun.misc.BASE64Decoder;
import java.io.*;
public class Base64DecodeMultipartFile implements MultipartFile {
private final byte[] imgContent;
private final String header;
public Base64DecodeMultipartFile(byte[] imgContent, String header) {
this.imgContent = imgContent;
this.header = header.split(";")[0];
}
@Override
public String getName() {
return System.currentTimeMillis() + Math.random() + "." + header.split("/")[1];
}
@Override
public String getOriginalFilename() {
return System.currentTimeMillis() + (int)Math.random() * 10000 + "." + header.split("/")[1];
}
@Override
public String getContentType() {
return header.split(":")[1];
}
@Override
public boolean isEmpty() {
return imgContent == null || imgContent.length == 0;
}
@Override
public long getSize() {
return imgContent.length;
}
@Override
public byte[] getBytes() throws IOException {
return imgContent;
}
@Override
public InputStream getInputStream() throws IOException {
return new ByteArrayInputStream(imgContent);
}
@Override
public void transferTo(File dest) throws IOException, IllegalStateException {
new FileOutputStream(dest).write(imgContent);
}
public static MultipartFile createFileItem(String imgStr) {
if (imgStr == null) // 图像数据为空
return null;
String[] baseStrs = imgStr.split(",");
BASE64Decoder decoder = new BASE64Decoder();
try { // Base64解码
byte[] bytes = decoder.decodeBuffer(imgStr);
for (int i = 0; i < bytes.length; ++i) {
if (bytes[i] < 0) {// 调整异常数据
bytes[i] += 256;
}
}
return new Base64DecodeMultipartFile(bytes, baseStrs[0]);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}
...@@ -16,6 +16,10 @@ import org.springframework.web.multipart.MultipartFile; ...@@ -16,6 +16,10 @@ import org.springframework.web.multipart.MultipartFile;
public class TbStAppRxhcrw extends BaseModel { public class TbStAppRxhcrw extends BaseModel {
@TableId(value = "TASKID", type = IdType.INPUT) @TableId(value = "TASKID", type = IdType.INPUT)
private String taskId; private String taskId;
private String zpDzwjwz;
private String zpDzwjgs;
private String zpDzwjmc;
@TableField(exist = false)
private String base64Img; private String base64Img;
@JsonIgnore @JsonIgnore
......
...@@ -11,7 +11,7 @@ import java.util.Map; ...@@ -11,7 +11,7 @@ import java.util.Map;
@Mapper @Mapper
@Repository @Repository
public interface QsBjHcMapper { public interface QsBjHcMapper {
Map<String, String> selectRyBzByZjhm(String sfzh); Map<String, Object> selectRyBzByZjhm(String sfzh);
List<HcAjJg> selectAjBySfzh(String sfzh); List<HcAjJg> selectAjBySfzh(String sfzh);
......
...@@ -10,13 +10,13 @@ ...@@ -10,13 +10,13 @@
<select id="getXzgzryByZjhm" parameterType="java.lang.String" resultType="java.lang.Integer"> <select id="getXzgzryByZjhm" parameterType="java.lang.String" resultType="java.lang.Integer">
select count(1) select count(1)
from tb_zt_xzgzry from tb_zt_xzgzry
where zjhm in #{zjhm} where zjhm = #{zjhm}
</select> </select>
<select id="getZtryByZjhm" parameterType="java.lang.String" resultType="java.lang.Integer"> <select id="getZtryByZjhm" parameterType="java.lang.String" resultType="java.lang.Integer">
select count(1) select count(1)
from TB_YW_ZTRY from TB_YW_ZTRY
where zjhm in #{zjhm} and xxsc_pdbz = '0' where zjhm = #{zjhm} and xxsc_pdbz = '0'
</select> </select>
</mapper> </mapper>
...@@ -6,7 +6,7 @@ import java.util.List; ...@@ -6,7 +6,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
public interface QsBjHcService { public interface QsBjHcService {
Map<String, String> selectRyBzByZjhm(String sfzh); Map<String, Object> selectRyBzByZjhm(String sfzh);
List<HcAjJg> selectAjBySfzh(String sfzh); List<HcAjJg> selectAjBySfzh(String sfzh);
......
package org.springblade.founder.ydjwhc.service.impl; package org.springblade.founder.ydjwhc.service.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang.StringUtils;
import org.springblade.founder.asj.entity.TbXszCbypQgaj; import org.springblade.founder.asj.entity.TbXszCbypQgaj;
import org.springblade.founder.asj.service.QgAsjQueryService; import org.springblade.founder.asj.service.QgAsjQueryService;
import org.springblade.founder.entity.QgckryBean; import org.springblade.founder.entity.QgckryBean;
...@@ -24,6 +25,8 @@ import org.springframework.beans.factory.annotation.Value; ...@@ -24,6 +25,8 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.Reader;
import java.sql.Clob;
import java.util.*; import java.util.*;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
...@@ -89,7 +92,7 @@ public class BjHcServiceImpl implements BjHcService { ...@@ -89,7 +92,7 @@ public class BjHcServiceImpl implements BjHcService {
resultMap.put("zbq", zbq); resultMap.put("zbq", zbq);
//查询重点关注人员标签 //查询重点关注人员标签
Map<String, String> rybzMap = qsBjHcService.selectRyBzByZjhm(sfzh); Map<String, Object> rybzMap = qsBjHcService.selectRyBzByZjhm(sfzh);
if (rybzMap != null) { if (rybzMap != null) {
String CODE = processingBz(rybzMap.get("CODE")); String CODE = processingBz(rybzMap.get("CODE"));
String AJLB = processingBz(rybzMap.get("AJLB")); String AJLB = processingBz(rybzMap.get("AJLB"));
...@@ -196,10 +199,14 @@ public class BjHcServiceImpl implements BjHcService { ...@@ -196,10 +199,14 @@ public class BjHcServiceImpl implements BjHcService {
resultMap.put("qsAjCount", qsAjList.size()); resultMap.put("qsAjCount", qsAjList.size());
List<HcAjJg> qgAjList = qgBjHcService.selectAjBySfzh(hm, qsAjList); List<HcAjJg> qgAjList = qgBjHcService.selectAjBySfzh(hm, qsAjList);
for (HcAjJg hcAjJg : qgAjList) { for (HcAjJg hcAjJg : qgAjList) {
String ajlb = qsBjHcService.getNameByCodeAndGroupid(hcAjJg.getAjlb(), "CODE_AJLB"); if (StringUtils.isNotBlank(hcAjJg.getAjlb())) {
String fadq = qsBjHcService.getNameByCodeAndGroupid(hcAjJg.getFadq(), "CODE_XZQH"); String ajlb = qsBjHcService.getNameByCodeAndGroupid(hcAjJg.getAjlb(), "CODE_AJLB");
hcAjJg.setAjlb(ajlb); hcAjJg.setAjlb(ajlb);
hcAjJg.setFadq(fadq); }
if (StringUtils.isNotBlank(hcAjJg.getFadq())) {
String fadq = qsBjHcService.getNameByCodeAndGroupid(hcAjJg.getFadq(), "CODE_XZQH");
hcAjJg.setFadq(fadq);
}
} }
resultMap.put("qgAjList", qgAjList); resultMap.put("qgAjList", qgAjList);
resultMap.put("qgAjCount", qgAjList.size()); resultMap.put("qgAjCount", qgAjList.size());
...@@ -405,10 +412,35 @@ public class BjHcServiceImpl implements BjHcService { ...@@ -405,10 +412,35 @@ public class BjHcServiceImpl implements BjHcService {
} }
//替换标签中的#号 //替换标签中的#号
private String processingBz(String str) { private String processingBz(Object obj) {
if (str == null) { if (obj == null) {
return null; return null;
} }
String str;
if (obj instanceof Clob){
Clob clob = (Clob) obj;
str = clobToStr(clob);
} else {
str = obj.toString();
}
return str.replace("#", ",").substring(1); return str.replace("#", ",").substring(1);
} }
public static String clobToStr(Clob clob) {
if(clob == null) {
return "";
}
StringBuilder strClob = new StringBuilder();
String str = "";
try (Reader read = clob.getCharacterStream()){
char[] buffer = new char[1024];
int length = 0;
while ((length = read.read(buffer, 0, 1024)) != -1) {
strClob.append(buffer, 0, length);
}
} catch (Exception e) {
e.printStackTrace();
}
str = strClob.toString();
return str;
}
} }
...@@ -18,7 +18,7 @@ public class QsBjHcServiceImpl implements QsBjHcService { ...@@ -18,7 +18,7 @@ public class QsBjHcServiceImpl implements QsBjHcService {
private QsBjHcMapper qsBjHcMapper; private QsBjHcMapper qsBjHcMapper;
@Override @Override
public Map<String, String> selectRyBzByZjhm(String sfzh) { public Map<String, Object> selectRyBzByZjhm(String sfzh) {
return qsBjHcMapper.selectRyBzByZjhm(sfzh); return qsBjHcMapper.selectRyBzByZjhm(sfzh);
} }
......
...@@ -8,16 +8,23 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -8,16 +8,23 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springblade.core.secure.utils.SecureUtil; import org.springblade.core.secure.utils.SecureUtil;
import org.springblade.founder.utils.DateUtil;
import org.springblade.founder.utils.Utils; import org.springblade.founder.utils.Utils;
import org.springblade.founder.ydjwhc.entity.Base64DecodeMultipartFile;
import org.springblade.founder.ydjwhc.entity.TbStAppRxhcrw; import org.springblade.founder.ydjwhc.entity.TbStAppRxhcrw;
import org.springblade.founder.ydjwhc.mapper.TbStAppRxhcrwMapper; import org.springblade.founder.ydjwhc.mapper.TbStAppRxhcrwMapper;
import org.springblade.founder.ydjwhc.service.TbStAppRxhcrwService; import org.springblade.founder.ydjwhc.service.TbStAppRxhcrwService;
import org.springblade.modules.system.entity.XzxtUser; import org.springblade.modules.system.entity.XzxtUser;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
import javax.xml.bind.DatatypeConverter; import javax.xml.bind.DatatypeConverter;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -29,18 +36,33 @@ public class TbStAppRxhcrwServiceImpl extends ServiceImpl<TbStAppRxhcrwMapper, T ...@@ -29,18 +36,33 @@ public class TbStAppRxhcrwServiceImpl extends ServiceImpl<TbStAppRxhcrwMapper, T
@Autowired @Autowired
private TbStAppRxhcrwMapper tbStAppRxhcrwMapper; private TbStAppRxhcrwMapper tbStAppRxhcrwMapper;
@Value("${rxhczpPath}")
private String rxhczpPath;
@Override @Override
public void saveRxbdTask(TbStAppRxhcrw rxhcrw) throws IOException { public void saveRxbdTask(TbStAppRxhcrw rxhcrw) throws IOException {
Utils.setUserDjxxAndCzxx(rxhcrw); Utils.setUserDjxxAndCzxx(rxhcrw);
MultipartFile file = rxhcrw.getFile(); MultipartFile file = rxhcrw.getFile();
if (file != null){ if (file == null) {
file = base64ToMultipart(rxhcrw.getBase64Img());
}
if (file != null) {
String fileName = file.getOriginalFilename(); String fileName = file.getOriginalFilename();
String extension = FilenameUtils.getExtension(fileName); File file1 = new File(rxhczpPath + File.separator);
byte[] bytes = file.getBytes(); if (!file1.exists()) {
String base64Str = DatatypeConverter.printBase64Binary(bytes); if (!file1.mkdir()) {
rxhcrw.setBase64Img("data:image/" + extension + ";base64," + base64Str); return;
}
}
String suffix = "." + FilenameUtils.getExtension(fileName);
String dzwjmc = DateUtil.getSysDateStr() + "_" + fileName;
String dzwjwz = rxhczpPath + File.separator + dzwjmc;
file.transferTo(new File(rxhczpPath + File.separator, dzwjmc));
rxhcrw.setZpDzwjwz(dzwjwz);
rxhcrw.setZpDzwjmc(fileName);
rxhcrw.setZpDzwjgs(suffix);
this.saveOrUpdate(rxhcrw);
} }
this.saveOrUpdate(rxhcrw);
} }
@Override @Override
...@@ -54,6 +76,13 @@ public class TbStAppRxhcrwServiceImpl extends ServiceImpl<TbStAppRxhcrwMapper, T ...@@ -54,6 +76,13 @@ public class TbStAppRxhcrwServiceImpl extends ServiceImpl<TbStAppRxhcrwMapper, T
lambdaQueryWrapper.orderByDesc(TbStAppRxhcrw::getDjsj); lambdaQueryWrapper.orderByDesc(TbStAppRxhcrw::getDjsj);
IPage<TbStAppRxhcrw> iPage = tbStAppRxhcrwMapper.selectPage(page, lambdaQueryWrapper); IPage<TbStAppRxhcrw> iPage = tbStAppRxhcrwMapper.selectPage(page, lambdaQueryWrapper);
List<TbStAppRxhcrw> list = iPage.getRecords(); List<TbStAppRxhcrw> list = iPage.getRecords();
for (TbStAppRxhcrw appRxhcrw : list) {
try {
appRxhcrw.setBase64Img("data:image/" + appRxhcrw.getZpDzwjgs().substring(1) +";base64," + encodeBase64File(appRxhcrw.getZpDzwjwz()));
} catch (Exception e) {
e.printStackTrace();
}
}
long total = iPage.getTotal(); long total = iPage.getTotal();
HashMap<String, Object> resultMap = new HashMap<>(); HashMap<String, Object> resultMap = new HashMap<>();
resultMap.put("rows", list); resultMap.put("rows", list);
...@@ -69,4 +98,34 @@ public class TbStAppRxhcrwServiceImpl extends ServiceImpl<TbStAppRxhcrwMapper, T ...@@ -69,4 +98,34 @@ public class TbStAppRxhcrwServiceImpl extends ServiceImpl<TbStAppRxhcrwMapper, T
rxhcrw.setXxscPdbz("1"); rxhcrw.setXxscPdbz("1");
tbStAppRxhcrwMapper.updateById(rxhcrw); tbStAppRxhcrwMapper.updateById(rxhcrw);
} }
public static MultipartFile base64ToMultipart(String base64) {
try {
String[] baseStrs = base64.split(",");
BASE64Decoder decoder = new BASE64Decoder();
byte[] b;
b = decoder.decodeBuffer(baseStrs[1]);
for (int i = 0; i < b.length; ++i) {
if (b[i] < 0) {
b[i] += 256;
}
}
return new Base64DecodeMultipartFile(b, baseStrs[0]);
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
public static String encodeBase64File(String path) throws Exception {
if (path == null){
return null;
}
File file = new File(path);
FileInputStream inputFile = new FileInputStream(file);
byte[] buffer = new byte[(int)file.length()];
inputFile.read(buffer);
inputFile.close();
return new BASE64Encoder().encode(buffer);
}
} }
...@@ -117,3 +117,4 @@ socketIoUrl: http://74.6.54.153:9022/sendMassage ...@@ -117,3 +117,4 @@ socketIoUrl: http://74.6.54.153:9022/sendMassage
#socketIoUrl: http://localhost:8762/sendMassage #socketIoUrl: http://localhost:8762/sendMassage
bbgxfjPath: /Users/lystar/Software/fileupload/fileupload bbgxfjPath: /Users/lystar/Software/fileupload/fileupload
rxhczpPath: /Users/lystar/Software/fileupload/rxhczp
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment