package com.fzzy.inte.sh2023.controller;
|
|
import com.alibaba.fastjson.JSONObject;
|
import com.fzzy.api.entity.Api9109;
|
import com.fzzy.api.utils.RSAUtils;
|
import com.fzzy.inte.sh2023.constant.ApiRespCode;
|
import com.fzzy.inte.sh2023.dto.ApiResp;
|
import com.fzzy.inte.sh2023.dto.SHDN2023ReqDto;
|
import com.fzzy.inte.sh2023.service.SHDNService;
|
import com.fzzy.push.sh2023.SH2023Constant;
|
import lombok.extern.slf4j.Slf4j;
|
import org.apache.commons.lang.StringUtils;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Controller;
|
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
import javax.servlet.http.HttpServletRequest;
|
import java.util.List;
|
|
/**
|
* 上海对农接口
|
*/
|
@Slf4j
|
@Controller
|
@RequestMapping("/dnjgsj/v1")
|
public class ControllerSh2023 {
|
@Autowired
|
private SHDNService shdnService;
|
|
private static final String PRIVATE_KEY = "MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAJGxqYyI/k6nYkm2nf4ggkAMViEvbnplbQqw6Qweu4neFXCC+iKY8cq5RZEj8JLfrm/gHBTPN8FF1sQIwWwsDV7UUc88DS5KwAi5JXBHMdcbh2tftkINr0YVn6rIgUBTbmPZ7Y8L2iW8psYsF9nxwvUUtcbFJXIMJfi39Qxl0NQvAgMBAAECgYBKWLHfoCy9sFbMrN7UxnwQ+PqetpiW5tkNApf58ljbErQ4FO5V51xDieXBGejy2igmuOM7jz6xZtUgdiNV8uji/RtiNRqsBekVBPMeYAnPwA4GQ0HNwyHJ3ebJNQqT9bwrk8QpRUuCnrx/U1l7P1QNR5o52H1HpEKPlS0ga0fuQQJBAMdiSFYKt8/PwsYclvU/GqXrPy4cxMBhtE/ZssH9KourxnJcyfRz7EPgfSZykxlGHn8j/r8C2XxtAIYW6mRckqECQQC7EIZCZ3eV8abSIB33oKmw2jZlPQrHXMt8DWz8FYbNIA/9bvk9e9O42iQwMUtHfOMcNMWbcvKR/J+83bcE08TPAkA1ErdYl+/H1HDvVUrlq0+HnPArcSL6ZsedfcB0nNRHa4kehg6IEJdylf4aTuNTFfQmOcmkxLhpw4YhK1ZnMrEhAkEAuiMLNXA3MmCumk+TAiBAOdYoYjyHSTEw2VOSqpPQ+rN4tbmDEIbyefG2KK4kNhIy+pIYP0H11QYG/KuxvX/rSQJBALs0TqUgcGOp9+IkOq4jCXiVkP5/r7JWinQ4d6bYhJ4wspQYloYFCHljKKXtst1m8I3PC+vJY8R6va/3xtQKT8U=";
|
private static final String SIGN = "JD-DNSGSJ";
|
private static final String DEPT_ID = "5303_003";
|
|
@RequestMapping("/{interfaceId}")
|
public @ResponseBody
|
ApiResp dnjgsj(HttpServletRequest request, @PathVariable("interfaceId") String interfaceId, @RequestBody String dataStr) {
|
|
//解密报文
|
dataStr = RSAUtils.decrypt(dataStr, PRIVATE_KEY);
|
|
if(StringUtils.isBlank(interfaceId) || StringUtils.isBlank(dataStr)){
|
return new ApiResp(ApiRespCode.R_500.getCode(),ApiRespCode.R_500.getMsg());
|
}
|
|
SHDN2023ReqDto shdn2023ReqDto = JSONObject.parseObject(dataStr, SHDN2023ReqDto.class);
|
|
if(!shdn2023ReqDto.getSign().equals(SIGN) || !shdn2023ReqDto.getDeptId().equals(DEPT_ID)) {
|
return new ApiResp(ApiRespCode.R_500.getCode(),ApiRespCode.R_500.getMsg());
|
}
|
|
//异步保存
|
shdnService.syncData(interfaceId, shdn2023ReqDto.getData());
|
|
return new ApiResp();
|
}
|
}
|