生成运营商日报接口

This commit is contained in:
Guoqs
2025-02-20 16:50:30 +08:00
parent c2644b8c3a
commit 75dc4a20ca
3 changed files with 51 additions and 2 deletions

View File

@@ -14,6 +14,7 @@ import com.jsowell.common.util.DateUtils;
import com.jsowell.pile.domain.AdapayMemberAccount;
import com.jsowell.pile.domain.MemberPlateNumberRelation;
import com.jsowell.pile.domain.OrderBasicInfo;
import com.jsowell.pile.domain.PileMerchantInfo;
import com.jsowell.pile.domain.ykcCommond.EBikeStartChargingCommand;
import com.jsowell.pile.domain.ykcCommond.ReservationChargingCommand;
import com.jsowell.pile.domain.ykcCommond.StopChargingCommand;
@@ -34,6 +35,7 @@ import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 用于临时接口
@@ -371,6 +373,48 @@ public class TempController extends BaseController {
return response;
}
/**
* 生成运营商日报
* http://localhost:8080/temp/generateMerchantBill
* @param dto
* @return
*/
@PostMapping("/generateMerchantBill")
public RestApiResponse<?> generateMerchantBill(@RequestBody QueryOrderDTO dto) {
logger.info("手动接口执行订单分账逻辑-param:{}", JSON.toJSONString(dto));
RestApiResponse<?> response = null;
try {
// 查询运营商列表
List<String> merchantIdList = dto.getMerchantIdList();
if (CollectionUtils.isEmpty(merchantIdList)) {
List<PileMerchantInfo> pileMerchantInfos = pileMerchantInfoService.selectPileMerchantInfoList(null);
merchantIdList = pileMerchantInfos.stream().map(x -> x.getId() + "").collect(Collectors.toList());
}
String startTime = dto.getStartTime();
String endTime = dto.getEndTime();
// 获取日期区间内所有日期
List<String> dateList = DateUtils.getAllDatesInTheDateRange(startTime, endTime);
for (String tradeDate : dateList) {
merchantIdList.parallelStream().forEach(merchantId -> {
try {
orderBasicInfoService.generateMerchantBill(merchantId, tradeDate);
} catch (Exception e) {
logger.error("生成运营商日报异常, merchantId:{}", merchantId, e);
}
});
}
response = new RestApiResponse<>();
} catch (BusinessException e) {
logger.error("手动生成运营商日报-warn", e);
response = new RestApiResponse<>(e.getCode(), e.getMessage());
} catch (Exception e) {
logger.error("手动生成运营商日报-error", e);
response = new RestApiResponse<>("00200005", "生成运营商日报失败");
}
logger.info("手动生成运营商日报-result:{}", JSON.toJSONString(response));
return response;
}
/**
* 测试余额支付接口
* http://localhost:8080/temp/testCreateBalancePayment

View File

@@ -53,6 +53,11 @@ public class QueryOrderDTO extends BaseEntity {
*/
private String stationId;
/**
* 运营商id列表
*/
private List<String> merchantIdList;
/**
* 站点Id列表
*/

View File

@@ -192,7 +192,7 @@ public class JsowellTask {
}
/**
* 定时任务,处理订单分账
* 定时任务, 生成运营商日报方法
* jsowellTask.processOrderSplitting()
*/
public void processOrderSplitting() {
@@ -213,7 +213,7 @@ public class JsowellTask {
return;
}
// 调分账方法
// 调生成运营商日报方法
pileMerchantInfos.parallelStream().forEach(merchant -> {
try {
// orderBasicInfoService.orderSplittingOperations(merchant.getId() + "", yesterday.toString());