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

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

迁移老推送大麦到 plarform

parent 46a09ccb
......@@ -10,10 +10,8 @@ import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestParam;
@Component
@FeignClient(name = "liquidnet-service-platform",
contextId = "FeignPlatformTaskClient", path = "",
url = "${liquidnet.service.platform.url}",
// url = "",
@FeignClient(name = "liquidnet-service-platform", contextId = "FeignPlatformTaskClient", path = "", url = "${liquidnet.service.platform.url}",
// url = "",
fallback = FallbackFactory.Default.class)
public interface FeignPlatformTaskClient {
......@@ -34,6 +32,7 @@ public interface FeignPlatformTaskClient {
/**
* 定时开票提醒
*
* @author zjp
* @return: com.liquidnet.service.base.ResponseDto<java.lang.Boolean>
* @date 2024/3/21 18:03
......@@ -43,11 +42,18 @@ public interface FeignPlatformTaskClient {
/*
* @description: 自动处理退款失败
*
* @author: zjp
*
* @date: 2025/4/27 14:28
*
* @param: []
*
* @return: com.liquidnet.service.base.ResponseDto<java.lang.Boolean>
**/
@GetMapping("platform/refund/failRefund")
ResponseDto<Boolean> failRefund();
@PostMapping("platform/damai/sync")
ResponseDto<Boolean> syncDamai(@RequestParam("performancesId") String performancesId);
}
......@@ -11,8 +11,10 @@ import org.springframework.stereotype.Component;
* XxlJob开发示例(Bean模式)
* <p>
* 开发步骤:
* 1、在Spring Bean实例中,开发Job方法,方式格式要求为 "public ReturnT<String> execute(String param)"
* 2、为Job方法添加注解 "@XxlJob(value="自定义jobhandler名称", init = "JobHandler初始化方法", destroy = "JobHandler销毁方法")",注解value值对应的是调度中心新建任务的JobHandler属性的值。
* 1、在Spring Bean实例中,开发Job方法,方式格式要求为 "public ReturnT<String> execute(String
* param)"
* 2、为Job方法添加注解 "@XxlJob(value="自定义jobhandler名称", init = "JobHandler初始化方法",
* destroy = "JobHandler销毁方法")",注解value值对应的是调度中心新建任务的JobHandler属性的值。
* 3、执行日志:需要通过 "XxlJobLogger.log" 打印执行日志;
*/
@Component
......@@ -56,7 +58,8 @@ public class KylinTaskHandler {
@XxlJob(value = "sev-platform:checkTransferOrderHandler")
public void checkTransferOrderHandler() {
try {
XxlJobHelper.handleSuccess("结果:" + feignPlatformTaskClient.checkTransferOrder(Integer.parseInt(XxlJobHelper.getJobParam())).getData());
XxlJobHelper.handleSuccess("结果:" + feignPlatformTaskClient
.checkTransferOrder(Integer.parseInt(XxlJobHelper.getJobParam())).getData());
} catch (Exception e) {
XxlJobHelper.log(e);
XxlJobHelper.handleFail();
......@@ -85,6 +88,7 @@ public class KylinTaskHandler {
/**
* 开票提醒定时推送
*
* @author zjp
* @param null
* @return: null
......@@ -102,6 +106,7 @@ public class KylinTaskHandler {
/**
* 退款失败自动处理
*
* @author zjp
* @param null
* @return: null
......@@ -116,4 +121,19 @@ public class KylinTaskHandler {
XxlJobHelper.handleFail();
}
}
@XxlJob(value = "sev-platform:syncDamai")
public void syncDamaiHandler() {
try {
String param = XxlJobHelper.getJobParam();
if (param == null || param.isEmpty()) {
XxlJobHelper.handleFail("performancesId is required");
return;
}
XxlJobHelper.handleSuccess("结果:" + feignPlatformTaskClient.syncDamai(param).getData());
} catch (Exception e) {
XxlJobHelper.log(e);
XxlJobHelper.handleFail();
}
}
}
......@@ -139,6 +139,20 @@
<artifactId>liquident-common-erp</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.liquidnet</groupId>
<artifactId>liquidnet-service-kylin-do</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>taobao-sdk-id</groupId>
<artifactId>taobao-sdk</artifactId>
<version>1.0.0</version>
<type>jar</type>
<scope>system</scope>
<systemPath>${project.basedir}/lib/taobao-sdk-java-auto_1600401599540-20210607.jar</systemPath>
</dependency>
</dependencies>
<build>
......
package com.liquidnet.service.platform.controller;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.kylin.service.other.DamaiService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/platform/damai")
public class PlatformDamaiController {
@Autowired
private DamaiService damaiService;
@ApiOperation("同步大麦")
@PostMapping(value = "/sync")
public ResponseDto<Boolean> syncDamai(@RequestParam("performancesId") String performancesId) {
boolean result = damaiService.sycPerformance(performancesId);
return ResponseDto.success(result);
}
}
package com.liquidnet.service.platform.utils;
import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.service.kylin.dto.vo.middle.KylinTicketTimesVo;
import com.liquidnet.service.kylin.dto.vo.middle.KylinTicketVo;
import com.liquidnet.service.kylin.dto.vo.mongo.KylinOrderTicketEntitiesVo;
import com.liquidnet.service.kylin.dto.vo.mongo.KylinOrderTicketVo;
import com.liquidnet.service.kylin.dto.vo.mongo.KylinPerformanceVo;
import com.taobao.api.DefaultTaobaoClient;
import com.taobao.api.TaobaoClient;
import com.taobao.api.request.AlibabaDamaiMevOpenWithdrawticketRequest;
import com.taobao.api.response.AlibabaDamaiMevOpenWithdrawticketResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
@Slf4j
public class TaobaoTicketUtils {
private String URL = "http://gw.api.taobao.com/router/rest";
private String APPKEY = "27542597";
private String SECRET = "900025efc616fd2446344bb8fa21d039";
private String SUPPLIER_SECRET = "444d0752439f921a75eaf5951a8bc03c";
private Long SYSTEM_ID = 15669L;
// private String url = "http://gw.api.tbsandbox.com/router/rest";
// private String appkey = "4272";
// private String secret = "0ebbcccfee18d7ad1aebc5b135ffa906";
private TaobaoClient client = null;
public TaobaoClient initTaobaoClient() {
if (client == null) {
client = new DefaultTaobaoClient(URL, APPKEY, SECRET);
}
return client;
}
public String getSupplierSecret() {
return SUPPLIER_SECRET;
}
public Long getSystemId() {
return SYSTEM_ID;
}
/**
* @param timesId 场次的id
* @param orderEntitiesId 入场人的id
* @return
*/
public boolean withdrawDamaiOrder(long timesId, long orderEntitiesId) {
try {
TaobaoClient client = initTaobaoClient();
AlibabaDamaiMevOpenWithdrawticketRequest req = new AlibabaDamaiMevOpenWithdrawticketRequest();
AlibabaDamaiMevOpenWithdrawticketRequest.TicketIdOpenParam obj1 = new AlibabaDamaiMevOpenWithdrawticketRequest.TicketIdOpenParam();
obj1.setPerformId(timesId);// 场次id
obj1.setVoucherId(orderEntitiesId);// 票单号 入场人id
obj1.setSupplierSecret(SUPPLIER_SECRET);
obj1.setSystemId(SYSTEM_ID);
req.setTicketIdOpenParam(obj1);
AlibabaDamaiMevOpenWithdrawticketResponse rsp = client.execute(req);
return rsp.getResult().getSuccess();
} catch (Exception e) {
return false;
}
}
public boolean refundDamaiOrder(KylinOrderTicketVo orderData, KylinPerformanceVo vo) {
try {
int isSysDamai = 0;
for (int x = 0; x < vo.getTicketTimeList().size(); x++) {
KylinTicketTimesVo timeItem = vo.getTicketTimeList().get(x);
for (int y = 0; y < timeItem.getTicketList().size(); y++) {
KylinTicketVo ticketItem = timeItem.getTicketList().get(y);
if (ticketItem.getTicketsId().equals(orderData.getTicketId())) {
isSysDamai = ticketItem.getSysDamai();
break;
}
}
}
if (isSysDamai == 1) {
List<KylinOrderTicketEntitiesVo> listData = orderData.getEntitiesVoList();
for (int i = 0; i < listData.size(); i++) {
KylinOrderTicketEntitiesVo item = listData.get(i);
long ticketTimesKey;
if (item.getTicketId().length() > 13) {
ticketTimesKey = Long.valueOf(IDGenerator.getDamaiCode(item.getTimeId()));
} else {
ticketTimesKey = Long.parseLong(item.getTimeId());
}
long orderTicketEntitiesKey;
// if (item.getOrderTicketEntitiesId().length() > 13) {
// orderTicketEntitiesKey =
// Long.valueOf(IDGenerator.getDamaiCode(item.getOrderTicketEntitiesId()));
// } else {
// orderTicketEntitiesKey = Long.valueOf(item.getOrderTicketEntitiesId());//票单号
// 入场人id
// }
if (orderData.getIsMember() == 1) {
orderTicketEntitiesKey = Long.valueOf(
IDGenerator.getDamaiCode(item.getOrderTicketEntitiesId()).toString().concat("010"));
} else {
orderTicketEntitiesKey = Long.valueOf(
IDGenerator.getDamaiCode(item.getOrderTicketEntitiesId()).toString().concat("020"));
}
if (item.getIsPayment() == 2) {
withdrawDamaiOrder(ticketTimesKey, orderTicketEntitiesKey);
}
}
return true;
}
return true;
} catch (Exception e) {
log.info("REFUND DAMAI ERROR = {}", e);
return false;
}
}
}
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