| | |
| | | package com.stylefeng.guns.modular.api; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.core.util.MD5Util; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.model.SettlementRecord; |
| | | import com.stylefeng.guns.modular.system.service.IDriverService; |
| | | import com.stylefeng.guns.modular.system.service.ISettlementRecordService; |
| | | import com.stylefeng.guns.modular.system.util.RedisUtil; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.util.Tingg.model.CallbackRequest; |
| | | import com.stylefeng.guns.modular.system.util.Tingg.model.CallbackResponse; |
| | |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | * @author zhibing.pu |
| | | * @Date 2023/8/17 9:39 |
| | | */ |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("") |
| | | public class SettlementRecordController { |
| | |
| | | |
| | | @Autowired |
| | | private IDriverService driverService; |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | String format = String.format("uid=%s&payType=%s&language=%s", uid, payType, language); |
| | | String key = MD5Util.encrypt(format); |
| | | String value = redisUtil.getValue(key); |
| | | if(ToolUtil.isNotEmpty(value) && (System.currentTimeMillis() - Long.valueOf(value)) <= 1000){ |
| | | return ResultUtil.error(language == 1 ? "请勿重复操作" : language == 2 ? "Don't repeat the operation" : "Ne répétez pas l’opération"); |
| | | } |
| | | redisUtil.setStrValue(key, System.currentTimeMillis() + "", 5); |
| | | return settlementRecordService.paymentSettlementAmount(uid, payType, bankCardId, language); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | @ResponseBody |
| | | @PostMapping("/base/settlementRecord/paymentSettlementAmountCallback") |
| | | public CallbackResponse paymentSettlementAmountCallback(@RequestBody CallbackRequest callbackRequest){ |
| | | log.info("结算支付回调结果:{}", JSON.toJSONString(callbackRequest)); |
| | | CallbackResponse callbackResponse = new CallbackResponse(); |
| | | try { |
| | | /** |
| | |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | log.info("结算支付回调结果处理结束:{}", JSON.toJSONString(callbackResponse)); |
| | | return callbackResponse; |
| | | } |
| | | } |