From 2e1ac74716f62ca5712d0187cb7d7d25ee13efe5 Mon Sep 17 00:00:00 2001 From: jiangping <jp@doumee.com> Date: 星期二, 05 三月 2024 14:34:23 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- server/platform/src/main/java/com/doumee/api/common/PublicController.java | 77 +++++++++++++++++++++++++++++++++++--- 1 files changed, 70 insertions(+), 7 deletions(-) diff --git a/server/platform/src/main/java/com/doumee/api/common/PublicController.java b/server/platform/src/main/java/com/doumee/api/common/PublicController.java index aabb39a..93a4120 100644 --- a/server/platform/src/main/java/com/doumee/api/common/PublicController.java +++ b/server/platform/src/main/java/com/doumee/api/common/PublicController.java @@ -1,22 +1,35 @@ package com.doumee.api.common; import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.TypeReference; import com.doumee.api.BaseController; import com.doumee.biz.system.SystemDictDataBiz; +import com.doumee.core.annotation.excel.ExcelToPdfTool; import com.doumee.core.annotation.trace.Trace; +import com.doumee.core.constants.ResponseStatus; +import com.doumee.core.exception.BusinessException; +import com.doumee.core.model.ApiResponse; import com.doumee.core.utils.Constants; import com.doumee.core.utils.DateUtil; import com.doumee.core.utils.aliyun.ALiYunUtil; +import com.doumee.dao.business.model.InsuranceApply; +import com.doumee.dao.business.model.InterfaceLog; +import com.doumee.dao.business.model.Solutions; +import com.doumee.service.business.InsuranceApplyService; +import com.doumee.service.business.InterfaceLogService; +import com.doumee.service.business.third.SignService; +import com.jzq.common.bean.sign.NotifyDataReq; +import com.jzq.common.bean.sign.NotifyReq; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.lang3.StringUtils; +import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartHttpServletRequest; import org.springframework.web.multipart.commons.CommonsMultipartResolver; @@ -26,10 +39,8 @@ import java.io.File; import java.io.IOException; import java.io.PrintWriter; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.UUID; +import java.lang.reflect.Field; +import java.util.*; /** * @author Eva.Caesar Liu @@ -43,6 +54,46 @@ public class PublicController extends BaseController { @Autowired private SystemDictDataBiz systemDictDataBiz; + @Autowired + private InsuranceApplyService insuranceApplyService; + @Autowired + public InterfaceLogService interfaceLogService = null; + @ApiOperation("鍚涘瓙绛剧绾﹀洖璋冮�氱煡") + @PostMapping("/signNotify") + public void updateStatus(@RequestParam Map<String,String> req, HttpServletResponse response) { + Map<String, Object> context = new HashMap<>(); + context.put("success",true); + InterfaceLog log=new InterfaceLog(); + log.setType(1); + log.setCreateDate(new Date()); + log.setIsdeleted(0); + log.setRequest(JSONObject.toJSONString(req)); + log.setName("鍚涘瓙绛剧绾﹀洖璋冮�氱煡"); + log.setUrl(systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.SIGN_DONE_NOTIFY_URL).getCode()); + try { + String appKey = systemDictDataBiz.queryByCode(Constants.SIGN,Constants.SIGN_APPKEY).getCode(); + String appSecret = systemDictDataBiz.queryByCode(Constants.SIGN,Constants.SIGN_APPSECRET).getCode(); + if(!StringUtils.equals(appKey,req.get("appkey"))){ + throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"appkey涓嶅尮閰�"); + } + String sign = DigestUtils.sha1Hex("data"+ req.get("data")+"method"+req.get("method")+"version"+req.get("version")+"timestamp"+req.get("timestamp") + +"appKey"+appKey+"appSecret"+appSecret); + if(!StringUtils.equals(sign,req.get("sign"))){ + throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"楠岀涓嶉�氳繃"); + } + NotifyDataReq data = JSONObject.parseObject(req.get("data"), NotifyDataReq.class); + insuranceApplyService.dealSignResult(data); + }catch (Exception e){ + log.setRepose("澶勭悊寮傚父锛�"+e.getMessage()); + context.put("success",false); + context.put("msg","澶勭悊鍙戠敓寮傚父"); + throw e; + }finally { + interfaceLogService.create(log); + } + writerJson(response, context); + } + @ApiOperation(value = "涓婁紶", notes = "涓婁紶", httpMethod = "POST", position = 6) @ApiImplicitParams({ @ApiImplicitParam(name = "folder", value = "鏂囦欢澶�", required = true, paramType = "query", dataType = "String", dataTypeClass = String.class), @@ -121,6 +172,17 @@ String tempFileName = nowDate + "/" + fileName; String key = folder + tempFileName;// 鏂囦欢鍚� ALiYunUtil obs = new ALiYunUtil(endpoint,access_id, access_key); + int type = 2; + if(StringUtils.endsWith(key,".mp4")){ + type =1; + }else if(StringUtils.endsWith(key,".jpg") + || StringUtils.endsWith(key,".JPG") + || StringUtils.endsWith(key,".png") + || StringUtils.endsWith(key,".PNG") + || StringUtils.endsWith(key,".jpeg") + || StringUtils.endsWith(key,".JPEG")){ + type =0; + } if (obs.uploadOnlineObject(file.getInputStream(),bucketName, key,null)) { // 绉诲姩鎴愬姛,杩斿洖鏂囦欢鍚� // sendSuccessMessage(response, resourcePath+key); @@ -130,6 +192,7 @@ JSONObject fileJSON = new JSONObject(); fileJSON.put("url", resourcePath + key); fileJSON.put("imgaddr", tempFileName); + fileJSON.put("type", type); fileJSON.put("imgname", fileName); fileJSON.put("originname", originname); context.put("data",fileJSON); -- Gitblit v1.9.3