| | |
| | | import com.doumee.api.BaseController; |
| | | import com.doumee.biz.system.SystemDictDataBiz; |
| | | 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.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.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | |
| | | 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.util.*; |
| | | |
| | | /** |
| | | * @author Eva.Caesar Liu |
| | |
| | | @RequestMapping("/public") |
| | | @Slf4j |
| | | public class PublicController extends BaseController { |
| | | |
| | | |
| | | @Autowired |
| | | private SystemDictDataBiz systemDictDataBiz; |
| | | @Autowired |
| | | private InsuranceApplyService insuranceApplyService; |
| | | @Autowired |
| | | public InterfaceLogService interfaceLogService = null; |
| | | |
| | | @ApiOperation("君子签签约回调通知") |
| | | @PostMapping("/signNotify") |
| | | public ApiResponse updateStatus(@RequestBody NotifyReq request) { |
| | | |
| | | InterfaceLog log=new InterfaceLog(); |
| | | log.setType(1); |
| | | log.setCreateDate(new Date()); |
| | | log.setIsdeleted(0); |
| | | log.setRequest(JSONObject.toJSONString(request)); |
| | | |
| | | 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,request.getAppkey())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"appkey不匹配"); |
| | | } |
| | | String sign = DigestUtils.sha1Hex("data"+JSONObject.toJSONString(request.getData())+"method"+request.getMethod()+"version"+request.getVersion()+"timestamp"+request.getTimestamp() |
| | | +"appKey"+appKey+"appSecret"+appSecret); |
| | | if(!StringUtils.equals(sign,request.getSign())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"验签不通过"); |
| | | } |
| | | insuranceApplyService.dealSignResult(request.getData()); |
| | | }catch (Exception e){ |
| | | log.setRepose("处理异常;"+e.getMessage()); |
| | | throw e; |
| | | }finally { |
| | | interfaceLogService.create(log); |
| | | } |
| | | |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation(value = "上传", notes = "上传", httpMethod = "POST", position = 6) |
| | | @ApiImplicitParams({ |
| | |
| | | systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode(), |
| | | systemDictDataBiz.queryByCode(Constants.OSS,Constants.ENDPOINT).getCode()); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "上传图片", notes = "上传图片", httpMethod = "POST", position = 6) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "folder", value = "文件夹", required = true, paramType = "query", dataType = "String", dataTypeClass = String.class), |
| | |
| | | systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode(), |
| | | systemDictDataBiz.queryByCode(Constants.OSS,Constants.ENDPOINT).getCode()); |
| | | } |
| | | |
| | | public void upload(HttpServletRequest request, HttpServletResponse response, String folder, String bucketName, |
| | | String access_id, String access_key, String resourcePath, String endpoint) throws Exception { |
| | | response.setCharacterEncoding("UTF-8"); |