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

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

离线支付-迈之定时任务

parent e52ecaf4
...@@ -356,8 +356,13 @@ public class GoblinRedisConst { ...@@ -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_MIX_RESERVE_UID = PREFIX.concat("mix:reserve:uid:");//$mixId:$uid 混合售用户预约保存
// 迈之
// 充值配置的需要充值金额的列表
public static final String GOBLIN_RECHARGE_WRISTBAND = PREFIX.concat("recharge:wristband"); 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_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:"); public static final String GOBLIN_BRACELET_USER = PREFIX.concat("bracelet:userId:");
......
...@@ -152,6 +152,16 @@ public class GoblinBraceletOrderVo { ...@@ -152,6 +152,16 @@ public class GoblinBraceletOrderVo {
*/ */
private Integer payStatus; private Integer payStatus;
/**
* 迈之的分订单号
*/
private String foutTradeNo;
/**
* 迈之的设备编号
*/
private String cardno;
/** /**
* 创建时间 * 创建时间
*/ */
......
...@@ -25,7 +25,7 @@ public interface IGoblinRechargeWristbandService extends IService<GoblinRecharge ...@@ -25,7 +25,7 @@ public interface IGoblinRechargeWristbandService extends IService<GoblinRecharge
GenerateDeviceCodeResponse getQrcode(String outno); GenerateDeviceCodeResponse getQrcode(String outno);
DeviceNumberResponse getDeviceNumber(Integer operationNo, String starttime, String endtime); Boolean getDeviceNumber(Integer operationNo);
DeviceBalanceResponse getDeviceBalance(String cardno); DeviceBalanceResponse getDeviceBalance(String cardno);
...@@ -33,5 +33,5 @@ public interface IGoblinRechargeWristbandService extends IService<GoblinRecharge ...@@ -33,5 +33,5 @@ public interface IGoblinRechargeWristbandService extends IService<GoblinRecharge
ChangeDeviceStatusResponse changeDeviceStatus(String cardno, int type); ChangeDeviceStatusResponse changeDeviceStatus(String cardno, int type);
ChangeDeviceStatusResponse refundRes(String cardno); Boolean refundRes();
} }
...@@ -22,4 +22,10 @@ public interface FeignGoblinTaskClient { ...@@ -22,4 +22,10 @@ public interface FeignGoblinTaskClient {
@GetMapping("rsc/nft/job/mixList") @GetMapping("rsc/nft/job/mixList")
ResponseDto<Boolean> mixList(); ResponseDto<Boolean> mixList();
@GetMapping("/rsc/maizhi/job/getDeviceNumber")
ResponseDto<Boolean> getDeviceNumber();
@GetMapping("/rsc/maizhi/job/refundRes")
ResponseDto<Boolean> refundRes();
} }
...@@ -24,7 +24,8 @@ CREATE TABLE IF NOT EXISTS goblin_recharge_amount ...@@ -24,7 +24,8 @@ CREATE TABLE IF NOT EXISTS goblin_recharge_amount
-- 手环订单表 -- 手环订单表
CREATE TABLE goblin_bracelet_order ( CREATE TABLE goblin_bracelet_order
(
`mid` int(10) unsigned NOT NULL AUTO_INCREMENT, `mid` int(10) unsigned NOT NULL AUTO_INCREMENT,
`order_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'order_id', `order_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'order_id',
`user_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '用户id', `user_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '用户id',
...@@ -41,33 +42,40 @@ CREATE TABLE goblin_bracelet_order ( ...@@ -41,33 +42,40 @@ CREATE TABLE goblin_bracelet_order (
`party_order_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '用户账单上的商户订单号', `party_order_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '用户账单上的商户订单号',
`end_time` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '支付完成时间 格式yyyyMMddHHmmss', `end_time` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '支付完成时间 格式yyyyMMddHHmmss',
`acct_date` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '入账时间 格式为yyyyMMdd', `acct_date` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '入账时间 格式为yyyyMMdd',
`price` decimal(8,2) NOT NULL DEFAULT '0.00' COMMENT '单价', `price` decimal(8, 2) NOT NULL DEFAULT '0.00' COMMENT '单价',
`price_total` decimal(8,2) NOT NULL DEFAULT '0.00' COMMENT '应付价格', `price_total` decimal(8, 2) NOT NULL DEFAULT '0.00' COMMENT '应付价格',
`price_actual` decimal(8,2) NOT NULL DEFAULT '0.00' COMMENT '实付价格', `price_actual` decimal(8, 2) NOT NULL DEFAULT '0.00' COMMENT '实付价格',
`price_refund` decimal(8,2) NOT NULL DEFAULT '0.00' COMMENT '退款价格', `price_refund` decimal(8, 2) NOT NULL DEFAULT '0.00' COMMENT '退款价格',
`refund_price_charges` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '退款扣除的手续费金额', `refund_price_charges` decimal(10, 2) NOT NULL DEFAULT '0.00' COMMENT '退款扣除的手续费金额',
`refund_number` int(11) NOT NULL DEFAULT '0' COMMENT '退款数', `refund_number` int(11) NOT NULL DEFAULT '0' COMMENT '退款数',
`time_pay` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '支付时间', `time_pay` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '支付时间',
`status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '订单状态:0待付款,1已付款,2已关闭,3正在退款,4已退款, 5待关闭 6部分退款', `status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '订单状态:0待付款,1已付款,2已关闭,3正在退款,4已退款, 5待关闭 6部分退款',
`pay_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '支付状态:0未支付 1已支付 2支付失败', `pay_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '支付状态:0未支付 1已支付 2支付失败',
`fout_trade_no` varchar(255) NOT NULL DEFAULT '' COMMENT '迈之的分订单号',
`cardno` varchar(255) NOT NULL DEFAULT '' COMMENT '迈之的设备编号',
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间', `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
`comment` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT 'comment', `comment` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT 'comment',
PRIMARY KEY (`mid`) PRIMARY KEY (`mid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='手环订单表'; ) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci COMMENT ='手环订单表';
-- 手环订单详情表 -- 手环订单详情表
CREATE TABLE `goblin_bracelet_order_entities` ( CREATE TABLE `goblin_bracelet_order_entities`
(
`mid` int(10) unsigned NOT NULL AUTO_INCREMENT, `mid` int(10) unsigned NOT NULL AUTO_INCREMENT,
`order_entities_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'order_entities_id', `order_entities_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'order_entities_id',
`order_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '订单详情关联id', `order_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '订单详情关联id',
`goods_type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '商品类型: 1:手环 2:充值面值', `goods_type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '商品类型: 1:手环 2:充值面值',
`goods_id` varchar(64) NOT NULL DEFAULT '' COMMENT '商品ID wristband_id:手环ID amount_id:充值金额ID', `goods_id` varchar(64) NOT NULL DEFAULT '' COMMENT '商品ID wristband_id:手环ID amount_id:充值金额ID',
`goods_name` varchar(255) NOT NULL DEFAULT '' COMMENT '商品名称', `goods_name` varchar(255) NOT NULL DEFAULT '' COMMENT '商品名称',
`goods_price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '商品金额', `goods_price` decimal(10, 2) NOT NULL DEFAULT '0.00' COMMENT '商品金额',
`status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '订单状态:0待付款,1已付款,2已关闭,3正在退款,4已退款, 5待关闭 6部分退款', `status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '订单状态:0待付款,1已付款,2已关闭,3正在退款,4已退款, 5待关闭 6部分退款',
`pay_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '支付状态:0未支付 1已支付 2支付失败', `pay_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '支付状态:0未支付 1已支付 2支付失败',
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间', `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`mid`) PRIMARY KEY (`mid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='手环订单详情表'; ) ENGINE = InnoDB
\ No newline at end of file DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci COMMENT ='手环订单详情表';
\ No newline at end of file
...@@ -86,17 +86,13 @@ public class GoblinRechargeAmountController { ...@@ -86,17 +86,13 @@ public class GoblinRechargeAmountController {
@ApiOperation("获取设备编号列表") @ApiOperation("获取设备编号列表")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(type = "param", required = true, name = "operationNo", value = "分订单号"), @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( public ResponseDto<Boolean> getDeviceNumber(
@NotNull(message = "参数无效") @RequestParam("operationNo") Integer operationNo, @NotNull(message = "参数无效") @RequestParam("operationNo") Integer operationNo
@NotBlank(message = "参数无效") @RequestParam("starttime") String starttime,
@NotBlank(message = "参数无效") @RequestParam("endtime") String endtime
) { ) {
DeviceNumberResponse res = iGoblinRechargeWristbandService.getDeviceNumber(operationNo, starttime, endtime); Boolean res = iGoblinRechargeWristbandService.getDeviceNumber(operationNo);
if (null != res && res.getErrcode() == 200) { if (res) {
return ResponseDto.success(res.getList()); return ResponseDto.success();
} else { } else {
return ResponseDto.failure(); return ResponseDto.failure();
} }
...@@ -154,17 +150,12 @@ public class GoblinRechargeAmountController { ...@@ -154,17 +150,12 @@ public class GoblinRechargeAmountController {
@GetMapping("order/refund/result") @GetMapping("order/refund/result")
@ApiOperation("退款结果查询") @ApiOperation("退款结果查询")
@ApiImplicitParams({ public ResponseDto<Boolean> refundRes() {
@ApiImplicitParam(type = "param", required = true, name = "cardno", value = "设备编号"), Boolean res = iGoblinRechargeWristbandService.refundRes();
}) if (res) {
public ResponseDto<ChangeDeviceStatusResponse> refundRes( return ResponseDto.success();
@NotBlank(message = "参数无效:cardno") @RequestParam("cardno") String cardno
) {
ChangeDeviceStatusResponse res = iGoblinRechargeWristbandService.refundRes(cardno);
if (null != res && res.getErrcode() == 200) {
return ResponseDto.success(res);
} else { } 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; ...@@ -15,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.time.Instant;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -111,12 +112,26 @@ public class GoblinRechargeWristbandServiceImpl extends ServiceImpl<GoblinRechar ...@@ -111,12 +112,26 @@ public class GoblinRechargeWristbandServiceImpl extends ServiceImpl<GoblinRechar
} }
@Override @Override
public DeviceNumberResponse getDeviceNumber(Integer operationNo, String starttime, String endtime) { public Boolean getDeviceNumber(Integer operationNo) {
String accessToken = this.getAccessToken(); 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) { 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 @Override
...@@ -147,12 +162,17 @@ public class GoblinRechargeWristbandServiceImpl extends ServiceImpl<GoblinRechar ...@@ -147,12 +162,17 @@ public class GoblinRechargeWristbandServiceImpl extends ServiceImpl<GoblinRechar
} }
@Override @Override
public ChangeDeviceStatusResponse refundRes(String cardno) { public Boolean refundRes() {
String accessToken = this.getAccessToken(); String accessToken = this.getAccessToken();
if (null != accessToken) { 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() { private String getAccessToken() {
......
...@@ -2957,15 +2957,30 @@ public class GoblinRedisUtils { ...@@ -2957,15 +2957,30 @@ public class GoblinRedisUtils {
redisUtil.set(key, orderVo, RedisKeyExpireConst.GOBLIN_BRACELET_USER_EXPIRE); 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); String key = GoblinRedisConst.GOBLIN_BRACELET_USER.concat(uid).concat("orderId:").concat(orderId);
Object obj = redisUtil.get(key); Object obj = redisUtil.get(key);
if (obj == null) { if (obj == null) {
// TODO 从数据库查询 // TODO 从数据库查询
return null; return null;
}else { } else {
return (GoblinBraceletOrderVo)obj; 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