|
@@ -0,0 +1,85 @@
|
|
|
+package com.miaxis.app.controller.fulu;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.miaxis.common.constant.Constants;
|
|
|
+import com.miaxis.common.core.controller.BaseController;
|
|
|
+import com.miaxis.common.core.domain.Response;
|
|
|
+import com.miaxis.common.exception.CustomException;
|
|
|
+import com.miaxis.common.sms.MD5Utils;
|
|
|
+import com.miaxis.feign.dto.FilmDTO;
|
|
|
+import com.miaxis.feign.dto.fulu.FuluCommonApiDTO;
|
|
|
+import com.miaxis.feign.dto.fulu.FuluDTO;
|
|
|
+import com.miaxis.feign.service.IFuluService;
|
|
|
+import com.miaxis.wx.service.IWxOrderService;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
+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 java.io.IOException;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.Date;
|
|
|
+
|
|
|
+import static com.miaxis.common.constant.Constants.FILM_BLACK_LIST;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 【小程序-客户信息】Controller
|
|
|
+ *
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequiredArgsConstructor
|
|
|
+@RequestMapping(Constants.STUDENT_PREFIX+"/fulu")
|
|
|
+@Api(tags = {"【小程序-福禄】"})
|
|
|
+@Slf4j
|
|
|
+public class FuluController extends BaseController {
|
|
|
+
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IFuluService fuluService;
|
|
|
+
|
|
|
+ @Value("${fulu.appKey}")
|
|
|
+ private String appKey;
|
|
|
+ @Value("${fulu.appSecret}")
|
|
|
+ private String appSecret;
|
|
|
+
|
|
|
+ @PostMapping(value = "/fuluCommonApi")
|
|
|
+ @ApiOperation("福禄通用接口")
|
|
|
+ public Response<JSONObject> httpPostWithForm(@RequestBody FuluCommonApiDTO fuluCommonApiDTO) {
|
|
|
+
|
|
|
+
|
|
|
+ FuluDTO fuluDTO = new FuluDTO();
|
|
|
+ init(fuluDTO,fuluCommonApiDTO);
|
|
|
+
|
|
|
+ // 用于接收返回的结果
|
|
|
+ String resultData = fuluService.fuluCommonApi(fuluDTO);
|
|
|
+ return Response.success(JSONObject.parseObject(resultData));
|
|
|
+ }
|
|
|
+
|
|
|
+ private void init(FuluDTO fuluDTO, FuluCommonApiDTO fuluCommonApiDTO) {
|
|
|
+ fuluDTO.setApp_key(appKey);
|
|
|
+ fuluDTO.setMethod(fuluCommonApiDTO.getMethod());
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ fuluDTO.setTimestamp(simpleDateFormat.format(new Date()));
|
|
|
+ fuluDTO.setVersion("2.0");
|
|
|
+ fuluDTO.setFormat("json");
|
|
|
+ fuluDTO.setCharset("utf-8");
|
|
|
+ fuluDTO.setSign_type("md5");
|
|
|
+ fuluDTO.setApp_auth_token("");
|
|
|
+ fuluDTO.setBiz_content(fuluCommonApiDTO.getBiz_content());
|
|
|
+ String str = JSONObject.toJSONString(fuluDTO);
|
|
|
+ char[] s = str.toCharArray();
|
|
|
+ Arrays.sort(s);
|
|
|
+ String outputSignOriginalStr = new String(s) + appSecret;
|
|
|
+ String sign = MD5Utils.MD5Encode(outputSignOriginalStr);
|
|
|
+ fuluDTO.setSign(sign);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|