Commit a7412503 by wang_jiaxing

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

parent d86a9ff5
......@@ -48,9 +48,9 @@ public class AppBbgxServiceImpl extends ServiceImpl<AppBbgxMapper, AppBbgx> impl
long total = bbgxPage.getTotal();
List<AppBbgx> rows = bbgxPage.getRecords();
resultMap.put("sfksj", "1");
if (rows != null && !rows.isEmpty()){
if (rows != null && !rows.isEmpty()) {
AppBbgx bbgx = rows.get(0);
if (version != null && version.equals(bbgx.getAppVersion())){
if (version != null && version.equals(bbgx.getAppVersion())) {
resultMap.put("sfksj", "0");
}
}
......@@ -63,15 +63,18 @@ public class AppBbgxServiceImpl extends ServiceImpl<AppBbgxMapper, AppBbgx> impl
public void getXbbwj(String version, HttpServletResponse response) throws IOException {
AppBbgx bbgx = appBbgxMapper.selectById(version);
File file = new File(bbgx.getAppGxwjwz());
InputStream inputStream = new FileInputStream(file);
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("智慧警务app" + version + ".apk", "UTF-8"));
ServletOutputStream outputStream = response.getOutputStream();
IOUtils.copy(inputStream, outputStream);
InputStream inputStream = null;
ServletOutputStream outputStream;
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(outputStream);
} catch (Exception ignored) {
// IOUtils.closeQuietly(outputStream);
}
}
......@@ -95,11 +98,11 @@ public class AppBbgxServiceImpl extends ServiceImpl<AppBbgxMapper, AppBbgx> impl
int insert;
try {
insert = appBbgxMapper.insert(bbgx);
} catch (Exception e){
} catch (Exception e) {
e.printStackTrace();
insert = 0;
}
if (insert == 0){
if (insert == 0) {
return null;
}
return version;
......
......@@ -168,9 +168,9 @@ public class TbStAppRyxx extends BaseModel {
this.xbdm = qgry.getXb();
this.mzdm = qgry.getMz();
this.gjdm = "156";
this.jgXzqhdm = qgry.getJgssx();
this.hjdXzqhdm = qgry.getHkszd();
this.xzzXzqhdm = qgry.getHkszd();
this.jgXzqhdm = "469003".equals(qgry.getJgssx()) ? "460400" : qgry.getJgssx();//处理原儋州市的行政区划代码
this.hjdXzqhdm = "469003".equals(qgry.getHkszd()) ? "460400" : qgry.getHkszd();
this.xzzXzqhdm = "469003".equals(qgry.getHkszd()) ? "460400" : qgry.getHkszd();
this.xzzDzxz = qgry.getZzxz();
this.zp = "data:image/png;base64," + qgry.getXp();
}
......
......@@ -98,7 +98,7 @@ public class BjHcController {
}
@PostMapping("/getRxhcList")
@LogOper(czxxLbdm = "01", yymcJyqk = "0701", czxxJyqk = "查询人像比对任务")
// @LogOper(czxxLbdm = "01", yymcJyqk = "0701", czxxJyqk = "查询人像比对任务")
public R getRxhcList(TbStAppRxhcrw rxhcrw){
try {
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;
public class TbStAppRxhcrw extends BaseModel {
@TableId(value = "TASKID", type = IdType.INPUT)
private String taskId;
private String zpDzwjwz;
private String zpDzwjgs;
private String zpDzwjmc;
@TableField(exist = false)
private String base64Img;
@JsonIgnore
......
......@@ -11,7 +11,7 @@ import java.util.Map;
@Mapper
@Repository
public interface QsBjHcMapper {
Map<String, String> selectRyBzByZjhm(String sfzh);
Map<String, Object> selectRyBzByZjhm(String sfzh);
List<HcAjJg> selectAjBySfzh(String sfzh);
......
......@@ -10,13 +10,13 @@
<select id="getXzgzryByZjhm" parameterType="java.lang.String" resultType="java.lang.Integer">
select count(1)
from tb_zt_xzgzry
where zjhm in #{zjhm}
where zjhm = #{zjhm}
</select>
<select id="getZtryByZjhm" parameterType="java.lang.String" resultType="java.lang.Integer">
select count(1)
from TB_YW_ZTRY
where zjhm in #{zjhm} and xxsc_pdbz = '0'
where zjhm = #{zjhm} and xxsc_pdbz = '0'
</select>
</mapper>
......@@ -6,7 +6,7 @@ import java.util.List;
import java.util.Map;
public interface QsBjHcService {
Map<String, String> selectRyBzByZjhm(String sfzh);
Map<String, Object> selectRyBzByZjhm(String sfzh);
List<HcAjJg> selectAjBySfzh(String sfzh);
......
package org.springblade.founder.ydjwhc.service.impl;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang.StringUtils;
import org.springblade.founder.asj.entity.TbXszCbypQgaj;
import org.springblade.founder.asj.service.QgAsjQueryService;
import org.springblade.founder.entity.QgckryBean;
......@@ -24,6 +25,8 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.io.Reader;
import java.sql.Clob;
import java.util.*;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
......@@ -89,7 +92,7 @@ public class BjHcServiceImpl implements BjHcService {
resultMap.put("zbq", zbq);
//查询重点关注人员标签
Map<String, String> rybzMap = qsBjHcService.selectRyBzByZjhm(sfzh);
Map<String, Object> rybzMap = qsBjHcService.selectRyBzByZjhm(sfzh);
if (rybzMap != null) {
String CODE = processingBz(rybzMap.get("CODE"));
String AJLB = processingBz(rybzMap.get("AJLB"));
......@@ -196,10 +199,14 @@ public class BjHcServiceImpl implements BjHcService {
resultMap.put("qsAjCount", qsAjList.size());
List<HcAjJg> qgAjList = qgBjHcService.selectAjBySfzh(hm, qsAjList);
for (HcAjJg hcAjJg : qgAjList) {
String ajlb = qsBjHcService.getNameByCodeAndGroupid(hcAjJg.getAjlb(), "CODE_AJLB");
String fadq = qsBjHcService.getNameByCodeAndGroupid(hcAjJg.getFadq(), "CODE_XZQH");
hcAjJg.setAjlb(ajlb);
hcAjJg.setFadq(fadq);
if (StringUtils.isNotBlank(hcAjJg.getAjlb())) {
String ajlb = qsBjHcService.getNameByCodeAndGroupid(hcAjJg.getAjlb(), "CODE_AJLB");
hcAjJg.setAjlb(ajlb);
}
if (StringUtils.isNotBlank(hcAjJg.getFadq())) {
String fadq = qsBjHcService.getNameByCodeAndGroupid(hcAjJg.getFadq(), "CODE_XZQH");
hcAjJg.setFadq(fadq);
}
}
resultMap.put("qgAjList", qgAjList);
resultMap.put("qgAjCount", qgAjList.size());
......@@ -405,10 +412,35 @@ public class BjHcServiceImpl implements BjHcService {
}
//替换标签中的#号
private String processingBz(String str) {
if (str == null) {
private String processingBz(Object obj) {
if (obj == 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);
}
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 {
private QsBjHcMapper qsBjHcMapper;
@Override
public Map<String, String> selectRyBzByZjhm(String sfzh) {
public Map<String, Object> selectRyBzByZjhm(String sfzh) {
return qsBjHcMapper.selectRyBzByZjhm(sfzh);
}
......
......@@ -8,16 +8,23 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang.StringUtils;
import org.springblade.core.secure.utils.SecureUtil;
import org.springblade.founder.utils.DateUtil;
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.mapper.TbStAppRxhcrwMapper;
import org.springblade.founder.ydjwhc.service.TbStAppRxhcrwService;
import org.springblade.modules.system.entity.XzxtUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
import javax.xml.bind.DatatypeConverter;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
......@@ -29,18 +36,33 @@ public class TbStAppRxhcrwServiceImpl extends ServiceImpl<TbStAppRxhcrwMapper, T
@Autowired
private TbStAppRxhcrwMapper tbStAppRxhcrwMapper;
@Value("${rxhczpPath}")
private String rxhczpPath;
@Override
public void saveRxbdTask(TbStAppRxhcrw rxhcrw) throws IOException {
Utils.setUserDjxxAndCzxx(rxhcrw);
MultipartFile file = rxhcrw.getFile();
if (file != null){
if (file == null) {
file = base64ToMultipart(rxhcrw.getBase64Img());
}
if (file != null) {
String fileName = file.getOriginalFilename();
String extension = FilenameUtils.getExtension(fileName);
byte[] bytes = file.getBytes();
String base64Str = DatatypeConverter.printBase64Binary(bytes);
rxhcrw.setBase64Img("data:image/" + extension + ";base64," + base64Str);
File file1 = new File(rxhczpPath + File.separator);
if (!file1.exists()) {
if (!file1.mkdir()) {
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
......@@ -54,6 +76,13 @@ public class TbStAppRxhcrwServiceImpl extends ServiceImpl<TbStAppRxhcrwMapper, T
lambdaQueryWrapper.orderByDesc(TbStAppRxhcrw::getDjsj);
IPage<TbStAppRxhcrw> iPage = tbStAppRxhcrwMapper.selectPage(page, lambdaQueryWrapper);
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();
HashMap<String, Object> resultMap = new HashMap<>();
resultMap.put("rows", list);
......@@ -69,4 +98,34 @@ public class TbStAppRxhcrwServiceImpl extends ServiceImpl<TbStAppRxhcrwMapper, T
rxhcrw.setXxscPdbz("1");
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
#socketIoUrl: http://localhost:8762/sendMassage
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