parent
c07a4b655e
commit
cc43865bd9
File diff suppressed because one or more lines are too long
@ -0,0 +1,103 @@ |
||||
package com.web.controller.notify; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.hai.common.utils.AESTool; |
||||
import com.hai.common.utils.MD5Util; |
||||
import com.hai.config.ChongQingCNPCService; |
||||
import com.hai.config.CommonSysConst; |
||||
import com.hai.dao.HighGasOrderPushMapper; |
||||
import com.hai.entity.HighGasOrderPush; |
||||
import com.hai.enum_type.OrderPushType; |
||||
import com.hai.service.HighCouponCodeOtherService; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import org.apache.commons.lang3.StringUtils; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
import org.springframework.stereotype.Controller; |
||||
import org.springframework.web.bind.annotation.RequestBody; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RequestMethod; |
||||
import org.springframework.web.bind.annotation.ResponseBody; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.Date; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
@Controller |
||||
@RequestMapping(value = "/scNotify") |
||||
@Api(value = "四川业务通知") |
||||
public class ScNotifyController { |
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ScNotifyController.class); |
||||
|
||||
@Resource |
||||
private HighCouponCodeOtherService couponCodeOtherService; |
||||
|
||||
@Resource |
||||
private HighGasOrderPushMapper highGasOrderPushMapper; |
||||
|
||||
@RequestMapping(value = "/scPetroNotify", method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "重庆中石油通知") |
||||
public Object scPetroNotify(@RequestBody String paramsStr) { |
||||
System.out.println(paramsStr); |
||||
log.info("重庆中石油核销通知"); |
||||
log.info("通知参数:" + paramsStr); |
||||
try { |
||||
if (StringUtils.isNotBlank(paramsStr)) { |
||||
|
||||
JSONObject sendMessage = JSONObject.parseObject(paramsStr).getJSONObject("sendMessage"); |
||||
JSONObject body = ChongQingCNPCService.decryptBody(sendMessage.getString("body")); |
||||
HighGasOrderPush highGasOrderPush = new HighGasOrderPush(); |
||||
highGasOrderPush.setType(OrderPushType.type10.getType()); |
||||
highGasOrderPush.setOrderNo(body.getString("tradeId")); |
||||
highGasOrderPush.setCreateTime(new Date()); |
||||
highGasOrderPush.setRequestContent("核销回调"); |
||||
highGasOrderPush.setReturnContent(paramsStr); |
||||
highGasOrderPushMapper.insert(highGasOrderPush); |
||||
|
||||
couponCodeOtherService.cqCnpcUseNotify(body); |
||||
Map<String, Object> param = new HashMap<>(); |
||||
param.put("status", 1); |
||||
param.put("msg", "成功"); |
||||
String verifyCode = AESTool.Encrypt(JSONObject.toJSONString(param), CommonSysConst.getSysConfig().getChongQingCnpcMerKey()); |
||||
|
||||
Map<String, Object> returnContent = new HashMap<>(); |
||||
Map<String, Object> returnPostMessage = new HashMap<>(); |
||||
|
||||
Map<String, Object> returnHead = new HashMap<>(); |
||||
returnHead.put("verifyCode", MD5Util.encode((verifyCode + CommonSysConst.getSysConfig().getChongQingCnpcMerKey()).getBytes()).toLowerCase()); |
||||
returnHead.put("requestType", "couponNotice"); |
||||
returnPostMessage.put("head", returnHead); |
||||
|
||||
returnPostMessage.put("body", verifyCode); |
||||
returnContent.put("postMessage", returnPostMessage); |
||||
return returnContent; |
||||
} else { |
||||
Map<String, Object> param = new HashMap<>(); |
||||
param.put("status", 0); |
||||
param.put("msg", "解析参数错误"); |
||||
String verifyCode = AESTool.Encrypt(JSONObject.toJSONString(param), CommonSysConst.getSysConfig().getChongQingCnpcMerKey()); |
||||
|
||||
Map<String, Object> returnContent = new HashMap<>(); |
||||
Map<String, Object> returnPostMessage = new HashMap<>(); |
||||
|
||||
Map<String, Object> returnHead = new HashMap<>(); |
||||
returnHead.put("verifyCode", MD5Util.encode((verifyCode + CommonSysConst.getSysConfig().getChongQingCnpcMerKey()).getBytes()).toLowerCase()); |
||||
returnHead.put("requestType", "couponNotice"); |
||||
returnPostMessage.put("head", returnHead); |
||||
|
||||
returnPostMessage.put("body", verifyCode); |
||||
returnContent.put("postMessage", returnPostMessage); |
||||
return returnContent; |
||||
} |
||||
} catch (Exception e) { |
||||
log.info("重庆中石油核销通知业务出现异常", e); |
||||
return null; |
||||
// return ResponseMsgUtil.exception(e);
|
||||
} |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue