备份携程按月获取结算代码

This commit is contained in:
lulz1 2024-04-01 17:16:32 +08:00
parent fa0cc239d1
commit bc11e0a9c9
4 changed files with 27 additions and 3 deletions

View File

@ -0,0 +1,8 @@
package com.chint.application.dtos;
import lombok.Data;
@Data
public class CTripRecordMonthSaveDTO {
private String date;
}

View File

@ -1,6 +1,7 @@
package com.chint.application.in; package com.chint.application.in;
import com.chint.application.dtos.CTripRecordMonthSaveDTO;
import com.chint.domain.factoriy.order_record.LyStatementOrder; import com.chint.domain.factoriy.order_record.LyStatementOrder;
import com.chint.infrastructure.echo_framework.command.Command; import com.chint.infrastructure.echo_framework.command.Command;
import com.chint.application.commands.OrderRecordGenerateCommand; import com.chint.application.commands.OrderRecordGenerateCommand;
@ -12,6 +13,7 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.chint.application.commands.OrderRecordGenerateCommand; import com.chint.application.commands.OrderRecordGenerateCommand;
@ -45,6 +47,16 @@ public class AutoWorkController {
return Result.Success(SUCCESS); return Result.Success(SUCCESS);
} }
@Transactional
@ApiOperation("拉取按月份的携程流水")
@PostMapping("/cTrip/record/save/month")
public Result<String> autoSaveCTripRecordByMonth(@RequestBody CTripRecordMonthSaveDTO cTripRecordMonthSaveDTO) {
cTripOrderRecordAutoSave.saveAll();
//将昨天的结算数据生成为财务共享需要的数据
Command.of(OrderRecordGenerateCommand.class).sendToQueue();
return Result.Success(SUCCESS);
}
@Transactional @Transactional
@ApiOperation("自动拉取同程上个月的流水号") @ApiOperation("自动拉取同程上个月的流水号")
@PostMapping("/ly/record/save") @PostMapping("/ly/record/save")

View File

@ -65,8 +65,10 @@ public class CTripOrderDetailRequest {
return getFlightOrder(formatter.format(localDateTime), formatter.format(localDateTime)); return getFlightOrder(formatter.format(localDateTime), formatter.format(localDateTime));
} }
public OrderFlightResponse getFlightOrder(String dateFrom,String dateTo){
public OrderFlightResponse getFlightOrder(String dateFrom,String dateTo){
String substring = dateFrom.substring(0, 6); String substring = dateFrom.substring(0, 6);
String dateFromNew = substring + "01"; String dateFromNew = substring + "01";
@ -77,13 +79,11 @@ public class CTripOrderDetailRequest {
dateTo, dateTo,
batchNo batchNo
); );
orderFlightParam.auth(Authentification.midOf(C_TRIP_APP_KEY, ticketRequest.loadTicket())); orderFlightParam.auth(Authentification.midOf(C_TRIP_APP_KEY, ticketRequest.loadTicket()));
orderFlightParam.setAppKey(C_TRIP_APP_KEY); orderFlightParam.setAppKey(C_TRIP_APP_KEY);
orderFlightParam.setTicket(ticketRequest.loadTicket()); orderFlightParam.setTicket(ticketRequest.loadTicket());
OrderFlightResponse orderFlightResponse = postRequest.post(flightOrderUrl, orderFlightParam, OrderFlightResponse orderFlightResponse = postRequest.post(flightOrderUrl, orderFlightParam,
OrderFlightResponse.class); OrderFlightResponse.class);
return orderFlightResponse; return orderFlightResponse;
} }

View File

@ -32,6 +32,10 @@ public class CTripOrderRecordAutoSave {
this.cTripCarRecordAutoSave(); this.cTripCarRecordAutoSave();
} }
public void saveByDate(){
}
public void cTripFlightRecordAutoSave() { public void cTripFlightRecordAutoSave() {
OrderFlightResponse flightOrder = cTripOrderDetailRequest.getFlightOrder(); OrderFlightResponse flightOrder = cTripOrderDetailRequest.getFlightOrder();
List<OrderFlightResponse.FlightOrderAccountSettlementInfo> flightOrderAccountSettlementList = flightOrder List<OrderFlightResponse.FlightOrderAccountSettlementInfo> flightOrderAccountSettlementList = flightOrder