diff --git a/base-manager/src/main/java/com/mortals/xhx/module/matter/web/MatterDatumController.java b/base-manager/src/main/java/com/mortals/xhx/module/matter/web/MatterDatumController.java index 665411d8d9fcf177b1752a39fbdaf21f603ba0b5..d1b7d0fab5b60d06968c0025bda596d6194d99ce 100644 --- a/base-manager/src/main/java/com/mortals/xhx/module/matter/web/MatterDatumController.java +++ b/base-manager/src/main/java/com/mortals/xhx/module/matter/web/MatterDatumController.java @@ -1,5 +1,8 @@ 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; } + + /** + * 瑙e瘑涓嬭浇鍦板潃 + * + * @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