记得上下班打卡 | git大法好,push需谨慎

Commit 8e1176be authored by 姜秀龙's avatar 姜秀龙

离线支付-迈之定时任务

parent e52ecaf4
......@@ -356,8 +356,13 @@ public class GoblinRedisConst {
public static final String GOBLIN_MIX_RESERVE_UID = PREFIX.concat("mix:reserve:uid:");//$mixId:$uid 混合售用户预约保存
// 迈之
// 充值配置的需要充值金额的列表
public static final String GOBLIN_RECHARGE_WRISTBAND = PREFIX.concat("recharge:wristband");
// 迈之的accessToken
public static final String GOBLIN_RECHARGE_MAIZHI_TOKEN = PREFIX.concat("recharge:maizhitoken");
// 获取设备编号定时任务最后一次的时间
public static final String GOBLIN_RECHARGE_DEVICE_NUMBER_ENDTIME = PREFIX.concat("recharge:deviceNumber:endtime:operationNo:");
// 手环订单
public static final String GOBLIN_BRACELET_USER = PREFIX.concat("bracelet:userId:");
......
......@@ -152,6 +152,16 @@ public class GoblinBraceletOrderVo {
*/
private Integer payStatus;
/**
* 迈之的分订单号
*/
private String foutTradeNo;
/**
* 迈之的设备编号
*/
private String cardno;
/**
* 创建时间
*/
......
......@@ -25,7 +25,7 @@ public interface IGoblinRechargeWristbandService extends IService<GoblinRecharge
GenerateDeviceCodeResponse getQrcode(String outno);
DeviceNumberResponse getDeviceNumber(Integer operationNo, String starttime, String endtime);
Boolean getDeviceNumber(Integer operationNo);
DeviceBalanceResponse getDeviceBalance(String cardno);
......@@ -33,5 +33,5 @@ public interface IGoblinRechargeWristbandService extends IService<GoblinRecharge
ChangeDeviceStatusResponse changeDeviceStatus(String cardno, int type);
ChangeDeviceStatusResponse refundRes(String cardno);
Boolean refundRes();
}
......@@ -22,4 +22,10 @@ public interface FeignGoblinTaskClient {
@GetMapping("rsc/nft/job/mixList")
ResponseDto<Boolean> mixList();
@GetMapping("/rsc/maizhi/job/getDeviceNumber")
ResponseDto<Boolean> getDeviceNumber();
@GetMapping("/rsc/maizhi/job/refundRes")
ResponseDto<Boolean> refundRes();
}
......@@ -86,17 +86,13 @@ public class GoblinRechargeAmountController {
@ApiOperation("获取设备编号列表")
@ApiImplicitParams({
@ApiImplicitParam(type = "param", required = true, name = "operationNo", value = "分订单号"),
@ApiImplicitParam(type = "param", required = true, name = "starttime", value = "分订单号"),
@ApiImplicitParam(type = "param", required = true, name = "endtime", value = "分订单号"),
})
public ResponseDto<List<DeviceNumberResponse.NumberList>> getDeviceNumber(
@NotNull(message = "参数无效") @RequestParam("operationNo") Integer operationNo,
@NotBlank(message = "参数无效") @RequestParam("starttime") String starttime,
@NotBlank(message = "参数无效") @RequestParam("endtime") String endtime
public ResponseDto<Boolean> getDeviceNumber(
@NotNull(message = "参数无效") @RequestParam("operationNo") Integer operationNo
) {
DeviceNumberResponse res = iGoblinRechargeWristbandService.getDeviceNumber(operationNo, starttime, endtime);
if (null != res && res.getErrcode() == 200) {
return ResponseDto.success(res.getList());
Boolean res = iGoblinRechargeWristbandService.getDeviceNumber(operationNo);
if (res) {
return ResponseDto.success();
} else {
return ResponseDto.failure();
}
......@@ -154,17 +150,12 @@ public class GoblinRechargeAmountController {
@GetMapping("order/refund/result")
@ApiOperation("退款结果查询")
@ApiImplicitParams({
@ApiImplicitParam(type = "param", required = true, name = "cardno", value = "设备编号"),
})
public ResponseDto<ChangeDeviceStatusResponse> refundRes(
@NotBlank(message = "参数无效:cardno") @RequestParam("cardno") String cardno
) {
ChangeDeviceStatusResponse res = iGoblinRechargeWristbandService.refundRes(cardno);
if (null != res && res.getErrcode() == 200) {
return ResponseDto.success(res);
public ResponseDto<Boolean> refundRes() {
Boolean res = iGoblinRechargeWristbandService.refundRes();
if (res) {
return ResponseDto.success();
} else {
return ResponseDto.failure(res.getMsg());
return ResponseDto.failure();
}
}
......
package com.liquidnet.service.goblin.controller.Inner;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.service.IGoblinRechargeWristbandService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Slf4j
@Api(tags = "@API:RSC")
@RestController
@Validated
@RequestMapping("/rsc/maizhi/job")
public class GoblinMaiZhiJobController {
@Autowired
private IGoblinRechargeWristbandService iGoblinRechargeWristbandService;
@GetMapping("getDeviceNumber")
@ApiOperation("获取设备编号JOB")
public ResponseDto<Boolean> getDeviceNumber() {
return ResponseDto.success(iGoblinRechargeWristbandService.getDeviceNumber(2));
}
@GetMapping("refundRes")
@ApiOperation("获取设备编号JOB")
public ResponseDto<Boolean> refundRes() {
return ResponseDto.success(iGoblinRechargeWristbandService.refundRes());
}
}
......@@ -15,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.time.Instant;
import java.util.ArrayList;
import java.util.List;
......@@ -111,12 +112,26 @@ public class GoblinRechargeWristbandServiceImpl extends ServiceImpl<GoblinRechar
}
@Override
public DeviceNumberResponse getDeviceNumber(Integer operationNo, String starttime, String endtime) {
public Boolean getDeviceNumber(Integer operationNo) {
String accessToken = this.getAccessToken();
String endtime = goblinRedisUtils.getDeviceNumberEndTime(operationNo);
if (null != endtime) {
Instant instant = Instant.EPOCH;
long timestamp = instant.toEpochMilli();
endtime = String.valueOf(timestamp);
}
long timestamp = Instant.now().toEpochMilli();
if (null != accessToken) {
return thirdMaiZhiUtils.getDeviceNumber(accessToken, operationNo, starttime, endtime);
DeviceNumberResponse res = thirdMaiZhiUtils.getDeviceNumber(accessToken, operationNo, endtime, String.valueOf(timestamp));
if (null != res && res.getErrcode() == 200) {
for (DeviceNumberResponse.NumberList info : res.getList()) {
// jxl todo 把分订单号对应的设备编号写入 redis and 数据库
}
goblinRedisUtils.setDeviceNumberEndTime(operationNo, String.valueOf(timestamp));
return true;
}
}
return null;
return false;
}
@Override
......@@ -147,12 +162,17 @@ public class GoblinRechargeWristbandServiceImpl extends ServiceImpl<GoblinRechar
}
@Override
public ChangeDeviceStatusResponse refundRes(String cardno) {
public Boolean refundRes() {
String accessToken = this.getAccessToken();
if (null != accessToken) {
return thirdMaiZhiUtils.refundRes(accessToken, cardno);
// jxl todo 查询所有退款中状态的设备编号 然后循环查询结果
String cardno = "sss";
ChangeDeviceStatusResponse res = thirdMaiZhiUtils.refundRes(accessToken, cardno);
// jxl todo 把结果写入 redis and mysql
return true;
} else {
return false;
}
return null;
}
private String getAccessToken() {
......
......@@ -2957,17 +2957,32 @@ public class GoblinRedisUtils {
redisUtil.set(key, orderVo, RedisKeyExpireConst.GOBLIN_BRACELET_USER_EXPIRE);
}
public GoblinBraceletOrderVo getBraceletOrderVo(String uid, String orderId){
public GoblinBraceletOrderVo getBraceletOrderVo(String uid, String orderId) {
String key = GoblinRedisConst.GOBLIN_BRACELET_USER.concat(uid).concat("orderId:").concat(orderId);
Object obj = redisUtil.get(key);
if (obj == null) {
// TODO 从数据库查询
return null;
}else {
return (GoblinBraceletOrderVo)obj;
} else {
return (GoblinBraceletOrderVo) obj;
}
}
public String getDeviceNumberEndTime(Integer operationNo) {
String key = GoblinRedisConst.GOBLIN_RECHARGE_DEVICE_NUMBER_ENDTIME.concat(String.valueOf(operationNo));
Object obj = redisUtil.get(key);
if (obj == null) {
return null;
} else {
return (String) obj;
}
}
public void setDeviceNumberEndTime(Integer operationNo, String endTime) {
String key = GoblinRedisConst.GOBLIN_RECHARGE_DEVICE_NUMBER_ENDTIME.concat(String.valueOf(operationNo));
redisUtil.set(key, endTime);
}
/* ---------------------------------------- ---------------------------------------- */
/* ---------------------------------------- ---------------------------------------- */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment