Commit d6fc2a0b authored by 赵啸非's avatar 赵啸非

添加接口附件解密地址

parent fbb8ce10
package com.mortals.xhx.module.matter.web;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
......@@ -16,10 +19,7 @@ import com.mortals.xhx.module.matter.service.MatterDatumFileService;
import com.mortals.xhx.module.matter.service.MatterDatumService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
......@@ -98,13 +98,14 @@ public class MatterDatumController extends BaseCRUDJsonBodyMappingController<Mat
List<MatterDatumEntity> matterDatumEntities = (List<MatterDatumEntity>) model.get(KEY_RESULT_DATA);
//去重复
List<MatterDatumEntity> collect = matterDatumEntities.stream().distinct().collect(Collectors.toList());
model.put(KEY_RESULT_DATA,collect);
model.put(KEY_RESULT_DATA, collect);
return super.doListAfter(query, model, context);
}
/**
* 查询的材料 名称去重 并且
*
* @param query
* @return
*/
......@@ -134,4 +135,33 @@ public class MatterDatumController extends BaseCRUDJsonBodyMappingController<Mat
return ret;
}
/**
* 解密下载地址
*
* @param encryptId 文件加密id
* @return
*/
@GetMapping(value = "decodeDownloadUrl")
@UnAuth
public Rest<String> decodeDownloadUrl(@RequestParam(name = "encryptId") String encryptId) {
Map<String, Object> model = new HashMap<>();
String busiDesc = "查询材料" + this.getModuleDesc();
try {
String encryUrl = "http://www.sczwfw.gov.cn/jiq/interface/item/annex/encryptUrl?id=" + encryptId;
String resp = HttpUtil.get(encryUrl);
JSONObject obj = JSON.parseObject(resp);
String code = obj.getString("code");
String data = obj.getString("data");
if ("0".equals(code)) {
return Rest.ok(data);
} else {
return Rest.fail("获取链接失败");
}
} catch (Exception e) {
this.doException(request, busiDesc, model, e);
return Rest.fail(e.getMessage());
}
}
}
\ No newline at end of file
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