Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
2a75f136af
26 files changed
+394
-180
No files matched your search
@@ -39,7 +39,7 @@ CREATE TABLE `third_zy_id_dict`
|
||||
`id` bigint NOT NULL COMMENT '主键',
|
||||
`self_id` varchar(64) NOT NULL COMMENT '自己这边的id映射',
|
||||
`zy_id` varchar(64) NOT NULL COMMENT '正元id映射',
|
||||
`biz_type` tinytext(16) NOT NULL COMMENT '同步类型',
|
||||
`biz_type` tinytext NOT NULL COMMENT '同步类型',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`create_by` varchar(32) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
|
||||
|
||||
+6
@@ -48,6 +48,12 @@ public class HardDeptTotalVo {
|
||||
@Schema(description = "退款次数")
|
||||
private Long orderRefundCont = 0L;
|
||||
|
||||
@Schema(description = "盈利金额")
|
||||
private Long orderProfitPrice = 0L;
|
||||
|
||||
@Schema(description = "盈利次数")
|
||||
private Long orderProfitCont = 0L;
|
||||
|
||||
/**
|
||||
* 导出相关
|
||||
*/
|
||||
|
||||
+12
@@ -39,6 +39,18 @@ public class HardOrderCsVo implements BaseMchInterface, BaseHardInterface {
|
||||
@Schema(description = "总消费次数")
|
||||
private BigDecimal totalPayCount;
|
||||
|
||||
@Schema(description = "总退款金额(元)")
|
||||
private BigDecimal totalRefundPrice;
|
||||
|
||||
@Schema(description = "总退款次数")
|
||||
private BigDecimal totalRefundCount;
|
||||
|
||||
@Schema(description = "总盈利金额(元)")
|
||||
private BigDecimal totalProfitPrice;
|
||||
|
||||
@Schema(description = "总盈利次数")
|
||||
private BigDecimal totalProfitCount;
|
||||
|
||||
/**
|
||||
* 导出相关
|
||||
*/
|
||||
|
||||
+13
-1
@@ -38,7 +38,19 @@ public class HardOrderSbVo implements BaseMchInterface, BaseHardInterface {
|
||||
|
||||
@Schema(description = "总消费次数")
|
||||
private BigDecimal totalPayCount;
|
||||
|
||||
|
||||
@Schema(description = "总退款金额(元)")
|
||||
private BigDecimal totalRefundPrice;
|
||||
|
||||
@Schema(description = "总退款次数")
|
||||
private BigDecimal totalRefundCount;
|
||||
|
||||
@Schema(description = "总盈利金额(元)")
|
||||
private BigDecimal totalProfitPrice;
|
||||
|
||||
@Schema(description = "总盈利次数")
|
||||
private BigDecimal totalProfitCount;
|
||||
|
||||
/**
|
||||
* 导出相关
|
||||
*/
|
||||
|
||||
+4
-1
@@ -78,8 +78,11 @@ public class HardCarController {
|
||||
@GetMapping("/order-id")
|
||||
@Operation(summary = "根据订单id查询购物车")
|
||||
public R<Page<HardCarVo>> orderId(@ParameterObject Page page, @RequestParam Long orderId) {
|
||||
if (ObjectUtil.isEmpty(orderId)) {
|
||||
R.ok(null);
|
||||
}
|
||||
HardOrderEntity order = hardOrderService.getById(orderId);
|
||||
if (ObjectUtil.isEmpty(order)) return null;
|
||||
if (ObjectUtil.isEmpty(order) || ObjectUtil.isEmpty(order.getParentCarId())) return null;
|
||||
HardCarDto dto = new HardCarDto();
|
||||
dto.setParentCarId(order.getParentCarId());
|
||||
return R.ok(hardCarService.pageJoin(page, dto));
|
||||
|
||||
+94
-21
@@ -8,25 +8,21 @@ import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.ExcelWriter;
|
||||
import com.alibaba.excel.write.metadata.WriteSheet;
|
||||
import com.alibaba.excel.write.metadata.fill.FillConfig;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.hard.api.constant.HardTypeEnum;
|
||||
import com.bsd.pjcloud.hard.api.constant.order.HardOrderStatusEnum;
|
||||
import com.bsd.pjcloud.hard.api.constant.order.HardOrderTypeEnum;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardDeptTotalDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.vo.order.HardDeptTotalVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.order.HardOrderCsVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.order.HardOrderSbVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.order.HardZyCardSyncVo;
|
||||
import com.bsd.pjcloud.hard.service.HardOrderTotalService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -53,16 +49,15 @@ public class HardOrderTotalController {
|
||||
|
||||
@PostMapping("/page-list-sb")
|
||||
@Operation(summary = "设备交易记录")
|
||||
public R<Page<HardOrderSbVo>> pageListSb(@ParameterObject Page page, @RequestBody HardOrderDto dto) {
|
||||
dto.setOrderStatusCodes(HardOrderStatusEnum.getPaySuccessCodes());
|
||||
return R.ok(HardOrderTotalService.pageListSb(page, dto));
|
||||
public R<List<HardOrderSbVo>> pageListSb(@RequestBody HardOrderDto dto) {
|
||||
return R.ok(HardOrderTotalService.listSb(dto));
|
||||
}
|
||||
|
||||
@PostMapping("/page-list-cs")
|
||||
@Operation(summary = "商户交易记录")
|
||||
public R<Page<HardOrderCsVo>> pageListCs(@ParameterObject Page page, @RequestBody HardOrderDto dto) {
|
||||
public R<List<HardOrderCsVo>> pageListCs(@RequestBody HardOrderDto dto) {
|
||||
dto.setOrderStatusCodes(HardOrderStatusEnum.getPaySuccessCodes());
|
||||
return R.ok(HardOrderTotalService.pageListCs(page, dto));
|
||||
return R.ok(HardOrderTotalService.listCs(dto));
|
||||
}
|
||||
|
||||
@PostMapping("/page-list-dept")
|
||||
@@ -88,8 +83,15 @@ public class HardOrderTotalController {
|
||||
map.put("endTime", LocalDateTimeUtil.format(dto.getPayTimeList()[1], DatePattern.NORM_DATETIME_PATTERN));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(list)) {
|
||||
BigDecimal priceTotal = BigDecimal.ZERO;
|
||||
BigDecimal countTotal = BigDecimal.ZERO;
|
||||
// 总消费
|
||||
BigDecimal totalPayPrice = BigDecimal.ZERO;
|
||||
BigDecimal totalPayCount = BigDecimal.ZERO;
|
||||
// 总退款
|
||||
BigDecimal totalRefundPrice = BigDecimal.ZERO;
|
||||
BigDecimal totalRefundCount = BigDecimal.ZERO;
|
||||
// 总盈利
|
||||
BigDecimal totalProfitPrice = BigDecimal.ZERO;
|
||||
BigDecimal totalProfitCount = BigDecimal.ZERO;
|
||||
Long lineNumber = 1L;
|
||||
for (HardOrderSbVo v : list) {
|
||||
v.setLineNumber(lineNumber);
|
||||
@@ -97,16 +99,40 @@ public class HardOrderTotalController {
|
||||
if (ObjectUtil.isNotEmpty(v.getHardType())) {
|
||||
v.setHardType(HardTypeEnum.valueOfByType(v.getHardType()).getDescription());
|
||||
}
|
||||
// 总消费
|
||||
if (ObjectUtil.isNotEmpty(v.getTotalPayPrice())) {
|
||||
priceTotal = priceTotal.add(v.getTotalPayPrice());
|
||||
totalPayPrice = totalPayPrice.add(v.getTotalPayPrice());
|
||||
v.setTotalPayPrice(v.getTotalPayPrice().divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(v.getTotalPayCount())) {
|
||||
countTotal = countTotal.add(v.getTotalPayCount());
|
||||
totalPayCount = totalPayCount.add(v.getTotalPayCount());
|
||||
}
|
||||
// 总退款
|
||||
if (ObjectUtil.isNotEmpty(v.getTotalRefundPrice())) {
|
||||
totalRefundPrice = totalRefundPrice.add(v.getTotalRefundPrice());
|
||||
v.setTotalRefundPrice(v.getTotalRefundPrice().divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(v.getTotalRefundCount())) {
|
||||
totalRefundCount = totalRefundCount.add(v.getTotalRefundCount());
|
||||
}
|
||||
// 总盈利
|
||||
if (ObjectUtil.isNotEmpty(v.getTotalProfitPrice())) {
|
||||
totalProfitPrice = totalProfitPrice.add(v.getTotalProfitPrice());
|
||||
v.setTotalProfitPrice(v.getTotalProfitPrice().divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(v.getTotalProfitCount())) {
|
||||
totalProfitCount = totalProfitCount.add(v.getTotalProfitCount());
|
||||
}
|
||||
}
|
||||
map.put("computeTotalPayPrice", priceTotal.divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString());
|
||||
map.put("computeTotalPayCount", countTotal.toString());
|
||||
// 总消费
|
||||
map.put("computeTotalPayPrice", totalPayPrice.divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString());
|
||||
map.put("computeTotalPayCount", totalPayCount.toString());
|
||||
// 总退款
|
||||
map.put("computeTotalRefundPrice", totalRefundPrice.divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString());
|
||||
map.put("computeTotalRefundCount", totalRefundCount.toString());
|
||||
// 总盈利
|
||||
map.put("computeTotalProfitPrice", totalProfitPrice.divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString());
|
||||
map.put("computeTotalProfitCount", totalProfitCount.toString());
|
||||
}
|
||||
excelWriter.fill(map, writeSheet);
|
||||
excelWriter.fill(list, fillConfig, writeSheet);
|
||||
@@ -131,8 +157,15 @@ public class HardOrderTotalController {
|
||||
map.put("endTime", LocalDateTimeUtil.format(dto.getPayTimeList()[1], DatePattern.NORM_DATETIME_PATTERN));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(list)) {
|
||||
BigDecimal priceTotal = BigDecimal.ZERO;
|
||||
BigDecimal countTotal = BigDecimal.ZERO;
|
||||
// 总消费
|
||||
BigDecimal totalPayPrice = BigDecimal.ZERO;
|
||||
BigDecimal totalPayCount = BigDecimal.ZERO;
|
||||
// 总退款
|
||||
BigDecimal totalRefundPrice = BigDecimal.ZERO;
|
||||
BigDecimal totalRefundCount = BigDecimal.ZERO;
|
||||
// 总盈利
|
||||
BigDecimal totalProfitPrice = BigDecimal.ZERO;
|
||||
BigDecimal totalProfitCount = BigDecimal.ZERO;
|
||||
Long lineNumber = 1L;
|
||||
for (HardOrderCsVo v : list) {
|
||||
v.setLineNumber(lineNumber);
|
||||
@@ -140,16 +173,40 @@ public class HardOrderTotalController {
|
||||
if (ObjectUtil.isNotEmpty(v.getHardType())) {
|
||||
v.setHardType(HardTypeEnum.valueOfByType(v.getHardType()).getDescription());
|
||||
}
|
||||
// 总消费
|
||||
if (ObjectUtil.isNotEmpty(v.getTotalPayPrice())) {
|
||||
priceTotal = priceTotal.add(v.getTotalPayPrice());
|
||||
totalPayPrice = totalPayPrice.add(v.getTotalPayPrice());
|
||||
v.setTotalPayPrice(v.getTotalPayPrice().divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(v.getTotalPayCount())) {
|
||||
countTotal = countTotal.add(v.getTotalPayCount());
|
||||
totalPayCount = totalPayCount.add(v.getTotalPayCount());
|
||||
}
|
||||
// 总退款
|
||||
if (ObjectUtil.isNotEmpty(v.getTotalRefundPrice())) {
|
||||
totalRefundPrice = totalRefundPrice.add(v.getTotalRefundPrice());
|
||||
v.setTotalRefundPrice(v.getTotalRefundPrice().divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(v.getTotalRefundCount())) {
|
||||
totalRefundCount = totalRefundCount.add(v.getTotalRefundCount());
|
||||
}
|
||||
// 总盈利
|
||||
if (ObjectUtil.isNotEmpty(v.getTotalProfitPrice())) {
|
||||
totalProfitPrice = totalProfitPrice.add(v.getTotalProfitPrice());
|
||||
v.setTotalProfitPrice(v.getTotalProfitPrice().divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(v.getTotalProfitCount())) {
|
||||
totalProfitCount = totalProfitCount.add(v.getTotalProfitCount());
|
||||
}
|
||||
}
|
||||
map.put("computeTotalPayPrice", priceTotal.divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString());
|
||||
map.put("computeTotalPayCount", countTotal.toString());
|
||||
// 总消费
|
||||
map.put("computeTotalPayPrice", totalPayPrice.divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString());
|
||||
map.put("computeTotalPayCount", totalPayCount.toString());
|
||||
// 总退款
|
||||
map.put("computeTotalRefundPrice", totalRefundPrice.divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString());
|
||||
map.put("computeTotalRefundCount", totalRefundCount.toString());
|
||||
// 总盈利
|
||||
map.put("computeTotalProfitPrice", totalProfitPrice.divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString());
|
||||
map.put("computeTotalProfitCount", totalProfitCount.toString());
|
||||
}
|
||||
excelWriter.fill(map, writeSheet);
|
||||
excelWriter.fill(list, fillConfig, writeSheet);
|
||||
@@ -187,8 +244,12 @@ public class HardOrderTotalController {
|
||||
|
||||
BigDecimal orderPayPriceSum = BigDecimal.ZERO;
|
||||
BigDecimal orderPayCountSum = BigDecimal.ZERO;
|
||||
|
||||
BigDecimal orderRefundPriceSum = BigDecimal.ZERO;
|
||||
BigDecimal orderRefundContSum = BigDecimal.ZERO;
|
||||
// 盈利
|
||||
BigDecimal orderProfitPriceSum = BigDecimal.ZERO;
|
||||
BigDecimal orderProfitContSum = BigDecimal.ZERO;
|
||||
|
||||
Long lineNumber = 1L;
|
||||
for (HardDeptTotalVo v : list) {
|
||||
@@ -246,6 +307,14 @@ public class HardOrderTotalController {
|
||||
orderRefundContSum = orderRefundContSum.add(BigDecimal.valueOf(v.getOrderRefundCont()));
|
||||
v.setOrderRefundCont(BigDecimal.valueOf(v.getOrderRefundCont()).divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).longValue());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(v.getOrderProfitPrice())) {
|
||||
orderProfitPriceSum = orderProfitPriceSum.add(BigDecimal.valueOf(v.getOrderProfitPrice()));
|
||||
v.setOrderProfitPrice(BigDecimal.valueOf(v.getOrderProfitPrice()).divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).longValue());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(v.getOrderProfitCont())) {
|
||||
orderProfitContSum = orderProfitContSum.add(BigDecimal.valueOf(v.getOrderProfitCont()));
|
||||
v.setOrderProfitCont(BigDecimal.valueOf(v.getOrderProfitCont()).divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).longValue());
|
||||
}
|
||||
// 批量充值
|
||||
map.put("walletPriceSum", walletPriceSum.divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString());
|
||||
map.put("walletCountSum", walletCountSum.toString());
|
||||
@@ -261,8 +330,12 @@ public class HardOrderTotalController {
|
||||
|
||||
map.put("orderPayPriceSum", orderPayPriceSum.divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString());
|
||||
map.put("orderPayCountSum", orderPayCountSum.toString());
|
||||
|
||||
map.put("orderRefundPriceSum", orderRefundPriceSum.divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString());
|
||||
map.put("orderRefundContSum", orderRefundContSum.toString());
|
||||
|
||||
map.put("orderProfitPriceSum", orderProfitPriceSum.divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString());
|
||||
map.put("orderProfitContSum", orderProfitContSum.toString());
|
||||
}
|
||||
}
|
||||
excelWriter.fill(map, writeSheet);
|
||||
|
||||
+1
-2
@@ -9,7 +9,6 @@ import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardOrderSumAndCountDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardManagerEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.order.HardAfterSaleEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.order.HardOrderEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.order.*;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
@@ -86,7 +85,7 @@ public interface HardOrderMapper extends PjcloudBaseMapper<HardOrderEntity> {
|
||||
return selectListByScope(commonWrapper(dto), DataScope.of());
|
||||
}
|
||||
|
||||
Page<HardOrderSbVo> pageListSb(Page page, @Param("dto") HardOrderDto dto);
|
||||
Page<HardOrderSbVo> listSb(Page page, @Param("dto") HardOrderDto dto);
|
||||
|
||||
List<HardOrderSbVo> listSb(@Param("dto") HardOrderDto dto);
|
||||
|
||||
|
||||
-4
@@ -12,12 +12,8 @@ import java.util.List;
|
||||
|
||||
public interface HardOrderTotalService {
|
||||
|
||||
Page<HardOrderSbVo> pageListSb(Page page, HardOrderDto dto);
|
||||
|
||||
List<HardOrderSbVo> listSb(HardOrderDto dto);
|
||||
|
||||
Page<HardOrderCsVo> pageListCs(Page page, HardOrderDto dto);
|
||||
|
||||
List<HardOrderCsVo> listCs(HardOrderDto dto);
|
||||
|
||||
List<HardDeptTotalVo> pageListDept(HardDeptTotalDto dto);
|
||||
|
||||
-3
@@ -119,9 +119,6 @@ public class HardThirdSelfZyServiceImpl implements HardThirdSelfZyService {
|
||||
try {
|
||||
// 校验订单是否可以退款
|
||||
HardOrderVo order = hardAfterSaleService.validateOrderCanRefund(dto.getOrderId());
|
||||
if (!ObjectUtil.equals(dto.getSerialNum(), order.getOrderNo())) {
|
||||
throw new RuntimeException("正元订单号不匹配");
|
||||
}
|
||||
// 用户
|
||||
UserInfo user = remoteUserService.getByUserId(order.getUserId()).getData();
|
||||
if (ObjectUtil.isEmpty(user)) throw new RuntimeException("用户不存在");
|
||||
|
||||
+113
-57
@@ -1,6 +1,7 @@
|
||||
package com.bsd.pjcloud.hard.service.impl.order;
|
||||
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.admin.api.dto.DeptAllListDto;
|
||||
@@ -8,7 +9,6 @@ import com.bsd.pjcloud.admin.api.entity.SysDept;
|
||||
import com.bsd.pjcloud.admin.api.feign.RemoteDeptService;
|
||||
import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
||||
import com.bsd.pjcloud.hard.api.constant.order.HardOrderStatusEnum;
|
||||
import com.bsd.pjcloud.hard.api.constant.order.HardOrderTypeEnum;
|
||||
import com.bsd.pjcloud.hard.api.dto.HardManagerDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardDeptTotalDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardOrderDto;
|
||||
@@ -33,7 +33,6 @@ import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Validated
|
||||
@Slf4j
|
||||
@@ -48,88 +47,124 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
|
||||
private final RemoteWalletTransactionService remoteWalletTransactionService;
|
||||
private final RemoteDeptService remoteDeptService;
|
||||
|
||||
@Override
|
||||
public Page<HardOrderSbVo> pageListSb(Page page, HardOrderDto dto) {
|
||||
Page<HardOrderSbVo> list = hardOrderMapper.pageListSb(page, dto);
|
||||
if (ObjectUtil.isNotEmpty(list)) {
|
||||
// 商户
|
||||
List<Long> mchIds = list.getRecords().stream().map(HardOrderSbVo::getMerchantId).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(mchIds)) {
|
||||
List<MchManageVo> mchList = remoteMchService.getByIds(mchIds).getData();
|
||||
if (ObjectUtil.isNotEmpty(mchList)) {
|
||||
WalletDataUtil.convertMchList(list.getRecords(), CollectionUtils.convertMap(mchList, MchManageVo::getId));
|
||||
}
|
||||
}
|
||||
// 设备
|
||||
List<Long> hardIds = list.getRecords().stream().map(HardOrderSbVo::getHardId).filter(ObjectUtil::isNotEmpty).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(mchIds)) {
|
||||
HardManagerDto hardManagerDto = new HardManagerDto();
|
||||
hardManagerDto.setIds(hardIds);
|
||||
List<HardManagerEntity> hardList = hardManagerMapper.list(hardManagerDto);
|
||||
if (ObjectUtil.isNotEmpty(hardList)) {
|
||||
HardUtil.convertHardList(list.getRecords(), CollectionUtils.convertMap(hardList, HardManagerEntity::getId));
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HardOrderSbVo> listSb(HardOrderDto dto) {
|
||||
List<HardOrderSbVo> list = hardOrderMapper.listSb(dto);
|
||||
if (ObjectUtil.isNotEmpty(list)) {
|
||||
// 查询总流水
|
||||
CompletableFuture<List<HardOrderSbVo>> totalListFuture = CompletableFuture.supplyAsync(() -> {
|
||||
HardOrderDto totalDto = BeanUtil.toBean(dto, HardOrderDto.class);
|
||||
totalDto.setOrderStatusCodes(HardOrderStatusEnum.getPayPrice());
|
||||
return hardOrderMapper.listSb(totalDto);
|
||||
});
|
||||
// 扣款总流水
|
||||
CompletableFuture<List<HardOrderSbVo>> refundListFuture = CompletableFuture.supplyAsync(() -> {
|
||||
HardOrderDto refundDto = BeanUtil.toBean(dto, HardOrderDto.class);
|
||||
refundDto.setOrderStatusCodes(HardOrderStatusEnum.getPayErrorCodes());
|
||||
return hardOrderMapper.listSb(refundDto);
|
||||
});
|
||||
// 盈利
|
||||
CompletableFuture<List<HardOrderSbVo>> profitListFuture = CompletableFuture.supplyAsync(() -> {
|
||||
HardOrderDto profitDto = BeanUtil.toBean(dto, HardOrderDto.class);
|
||||
profitDto.setOrderStatusCodes(HardOrderStatusEnum.getPaySuccessCodes());
|
||||
return hardOrderMapper.listSb(profitDto);
|
||||
});
|
||||
CompletableFuture<Void> allFutures = CompletableFuture.allOf(totalListFuture, refundListFuture, profitListFuture);
|
||||
allFutures.join();
|
||||
List<HardOrderSbVo> totalList = totalListFuture.join();
|
||||
List<HardOrderSbVo> refundList = refundListFuture.join();
|
||||
List<HardOrderSbVo> profitList = profitListFuture.join();
|
||||
// 聚合一下数据
|
||||
for (HardOrderSbVo v : totalList) {
|
||||
// 退款
|
||||
if (ObjectUtil.isNotEmpty(refundList)) {
|
||||
refundList.stream().filter(i -> ObjectUtil.equals(i.getHardId(), v.getHardId())).findFirst().ifPresent(i -> {
|
||||
v.setTotalRefundPrice(i.getTotalPayPrice());
|
||||
v.setTotalRefundCount(i.getTotalPayCount());
|
||||
});
|
||||
}
|
||||
// 盈利
|
||||
if (ObjectUtil.isNotEmpty(profitList)) {
|
||||
profitList.stream().filter(i -> ObjectUtil.equals(i.getHardId(), v.getHardId())).findFirst().ifPresent(i -> {
|
||||
v.setTotalProfitPrice(i.getTotalPayPrice());
|
||||
v.setTotalProfitCount(i.getTotalPayCount());
|
||||
});
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(totalList)) {
|
||||
// 商户
|
||||
List<Long> mchIds = list.stream().map(HardOrderSbVo::getMerchantId).distinct().toList();
|
||||
List<Long> mchIds = totalList.stream().map(HardOrderSbVo::getMerchantId).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(mchIds)) {
|
||||
List<MchManageVo> mchList = remoteMchService.getByIds(mchIds).getData();
|
||||
if (ObjectUtil.isNotEmpty(mchList)) {
|
||||
WalletDataUtil.convertMchList(list, CollectionUtils.convertMap(mchList, MchManageVo::getId));
|
||||
WalletDataUtil.convertMchList(totalList, CollectionUtils.convertMap(mchList, MchManageVo::getId));
|
||||
}
|
||||
}
|
||||
// 设备
|
||||
List<Long> hardIds = list.stream().map(HardOrderSbVo::getHardId).filter(ObjectUtil::isNotEmpty).distinct().toList();
|
||||
List<Long> hardIds = totalList.stream().map(HardOrderSbVo::getHardId).filter(ObjectUtil::isNotEmpty).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(mchIds)) {
|
||||
HardManagerDto hardManagerDto = new HardManagerDto();
|
||||
hardManagerDto.setIds(hardIds);
|
||||
List<HardManagerEntity> hardList = hardManagerMapper.list(hardManagerDto);
|
||||
if (ObjectUtil.isNotEmpty(hardList)) {
|
||||
HardUtil.convertHardList(list, CollectionUtils.convertMap(hardList, HardManagerEntity::getId));
|
||||
HardUtil.convertHardList(totalList, CollectionUtils.convertMap(hardList, HardManagerEntity::getId));
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<HardOrderCsVo> pageListCs(Page page, HardOrderDto dto) {
|
||||
Page<HardOrderCsVo> list = hardOrderMapper.pageListCs(page, dto);
|
||||
if (ObjectUtil.isNotEmpty(list)) {
|
||||
// 商户
|
||||
List<Long> mchIds = list.getRecords().stream().map(HardOrderCsVo::getMerchantId).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(mchIds)) {
|
||||
List<MchManageVo> mchList = remoteMchService.getByIds(mchIds).getData();
|
||||
if (ObjectUtil.isNotEmpty(mchList)) {
|
||||
WalletDataUtil.convertMchList(list.getRecords(), CollectionUtils.convertMap(mchList, MchManageVo::getId));
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
return totalList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HardOrderCsVo> listCs(HardOrderDto dto) {
|
||||
List<HardOrderCsVo> list = hardOrderMapper.listCs(dto);
|
||||
if (ObjectUtil.isNotEmpty(list)) {
|
||||
// 查询总流水
|
||||
CompletableFuture<List<HardOrderCsVo>> totalListFuture = CompletableFuture.supplyAsync(() -> {
|
||||
HardOrderDto totalDto = BeanUtil.toBean(dto, HardOrderDto.class);
|
||||
totalDto.setOrderStatusCodes(HardOrderStatusEnum.getPayPrice());
|
||||
return hardOrderMapper.listCs(totalDto);
|
||||
});
|
||||
// 扣款总流水
|
||||
CompletableFuture<List<HardOrderCsVo>> refundListFuture = CompletableFuture.supplyAsync(() -> {
|
||||
HardOrderDto refundDto = BeanUtil.toBean(dto, HardOrderDto.class);
|
||||
refundDto.setOrderStatusCodes(HardOrderStatusEnum.getPayErrorCodes());
|
||||
return hardOrderMapper.listCs(refundDto);
|
||||
});
|
||||
// 盈利
|
||||
CompletableFuture<List<HardOrderCsVo>> profitListFuture = CompletableFuture.supplyAsync(() -> {
|
||||
HardOrderDto profitDto = BeanUtil.toBean(dto, HardOrderDto.class);
|
||||
profitDto.setOrderStatusCodes(HardOrderStatusEnum.getPaySuccessCodes());
|
||||
return hardOrderMapper.listCs(profitDto);
|
||||
});
|
||||
CompletableFuture<Void> allFutures = CompletableFuture.allOf(totalListFuture, refundListFuture, profitListFuture);
|
||||
allFutures.join();
|
||||
List<HardOrderCsVo> totalList = totalListFuture.join();
|
||||
List<HardOrderCsVo> refundList = refundListFuture.join();
|
||||
List<HardOrderCsVo> profitList = profitListFuture.join();
|
||||
for (HardOrderCsVo v : totalList) {
|
||||
// 退款
|
||||
if (ObjectUtil.isNotEmpty(refundList)) {
|
||||
refundList.stream().filter(i -> ObjectUtil.equals(i.getMerchantId(), v.getMerchantId())).findFirst().ifPresent(i -> {
|
||||
v.setTotalRefundPrice(i.getTotalPayPrice());
|
||||
v.setTotalRefundCount(i.getTotalPayCount());
|
||||
});
|
||||
}
|
||||
// 盈利
|
||||
if (ObjectUtil.isNotEmpty(profitList)) {
|
||||
profitList.stream().filter(i -> ObjectUtil.equals(i.getMerchantId(), v.getMerchantId())).findFirst().ifPresent(i -> {
|
||||
v.setTotalProfitPrice(i.getTotalPayPrice());
|
||||
v.setTotalProfitCount(i.getTotalPayCount());
|
||||
});
|
||||
}
|
||||
}
|
||||
// 聚合一下数据
|
||||
if (ObjectUtil.isNotEmpty(totalList)) {
|
||||
// 商户
|
||||
List<Long> mchIds = list.stream().map(HardOrderCsVo::getMerchantId).distinct().toList();
|
||||
List<Long> mchIds = totalList.stream().map(HardOrderCsVo::getMerchantId).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(mchIds)) {
|
||||
List<MchManageVo> mchList = remoteMchService.getByIds(mchIds).getData();
|
||||
if (ObjectUtil.isNotEmpty(mchList)) {
|
||||
WalletDataUtil.convertMchList(list, CollectionUtils.convertMap(mchList, MchManageVo::getId));
|
||||
WalletDataUtil.convertMchList(totalList, CollectionUtils.convertMap(mchList, MchManageVo::getId));
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
return totalList;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -238,7 +273,20 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
|
||||
}
|
||||
return hardOrderMapper.sumAndCount(refundDto);
|
||||
});
|
||||
CompletableFuture<Void> allFutures = CompletableFuture.allOf(walletBatchFuture, walletReduceFuture, payFuture, refundFuture, walletOnceBatchFuture, walletOnceReduceFuture);
|
||||
// 查看盈利流水
|
||||
CompletableFuture<List<HardOrderSumAndCountVo>> profitFuture = CompletableFuture.supplyAsync(() -> {
|
||||
HardOrderSumAndCountDto refundDto = new HardOrderSumAndCountDto();
|
||||
refundDto.setDeptIds(deptIds);
|
||||
refundDto.setOrderStatusCodes(HardOrderStatusEnum.getPaySuccessCodes());
|
||||
if (ObjectUtil.isNotEmpty(dto.getCreateTimeList())) {
|
||||
refundDto.setCreateTimeList(dto.getCreateTimeList());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(dto.getWalletTypeId())) {
|
||||
refundDto.setWalletTypeId(dto.getWalletTypeId());
|
||||
}
|
||||
return hardOrderMapper.sumAndCount(refundDto);
|
||||
});
|
||||
CompletableFuture<Void> allFutures = CompletableFuture.allOf(walletBatchFuture, walletReduceFuture, payFuture, refundFuture, walletOnceBatchFuture, walletOnceReduceFuture, profitFuture);
|
||||
allFutures.join();
|
||||
List<WalletTransactionSumAndCountVo> walletBatchList = walletBatchFuture.join();
|
||||
List<WalletTransactionSumAndCountVo> walletReduceList = walletReduceFuture.join();
|
||||
@@ -246,6 +294,7 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
|
||||
List<WalletTransactionSumAndCountVo> walletOnceReduceList = walletOnceReduceFuture.join();
|
||||
List<HardOrderSumAndCountVo> payList = payFuture.join();
|
||||
List<HardOrderSumAndCountVo> refundList = refundFuture.join();
|
||||
List<HardOrderSumAndCountVo> profitList = profitFuture.join();
|
||||
// 聚合一下数据
|
||||
for (HardDeptTotalVo v : resultList) {
|
||||
if (ObjectUtil.isNotEmpty(walletBatchList)) {
|
||||
@@ -284,6 +333,13 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
|
||||
v.setOrderRefundCont(i.getCount());
|
||||
});
|
||||
}
|
||||
// 查看盈利流水
|
||||
if (ObjectUtil.isNotEmpty(profitList)) {
|
||||
profitList.stream().filter(i -> ObjectUtil.equals(i.getDeptId(), v.getDeptId())).findFirst().ifPresent(i -> {
|
||||
v.setOrderProfitPrice(i.getSum());
|
||||
v.setOrderProfitCont(i.getCount());
|
||||
});
|
||||
}
|
||||
}
|
||||
return resultList;
|
||||
});
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1
-1
@@ -112,7 +112,7 @@
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="pageListSb" resultType="com.bsd.pjcloud.hard.api.vo.order.HardOrderSbVo">
|
||||
<select id="listSb" resultType="com.bsd.pjcloud.hard.api.vo.order.HardOrderSbVo">
|
||||
select
|
||||
a.hard_id,
|
||||
a.merchant_id,
|
||||
|
||||
+2
-2
@@ -13,7 +13,7 @@ import lombok.NoArgsConstructor;
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ZySelfPayVo extends ZyBaseVo {
|
||||
public class ZySelfPayVo {
|
||||
|
||||
/**
|
||||
* 帐号
|
||||
@@ -31,7 +31,7 @@ public class ZySelfPayVo extends ZyBaseVo {
|
||||
private String perCode;
|
||||
|
||||
/**
|
||||
* 订单流水号,全局唯一,第三方流水号
|
||||
* 订单流水号,全局唯一,第三方流水号
|
||||
*/
|
||||
private String platformSerialNum;
|
||||
|
||||
|
||||
+2
-2
@@ -27,7 +27,7 @@ public class ThirdZySelfController {
|
||||
@Inner(value = false)
|
||||
@GetMapping("/checkSystemStatus")
|
||||
@Operation(summary = "第三方url健康探测", description = "第三方url健康探测")
|
||||
@Idempotent(expireTime = 3, info = "请勿重复调用")
|
||||
// @Idempotent(expireTime = 3, info = "请勿重复调用")
|
||||
public Map<String, Object> checkSystemStatus() {
|
||||
return zySelfService.checkSystemStatus();
|
||||
}
|
||||
@@ -35,7 +35,7 @@ public class ThirdZySelfController {
|
||||
@Inner(value = false)
|
||||
@GetMapping("/getToken")
|
||||
@Operation(summary = "第三方提供获取token", description = "第三方提供获取token")
|
||||
@Idempotent(expireTime = 3, info = "请勿重复调用")
|
||||
// @Idempotent(expireTime = 3, info = "请勿重复调用")
|
||||
public ZySelfGetTokenVo getToken(ZySelfGetTokenDto params) {
|
||||
return zySelfService.getToken(params);
|
||||
}
|
||||
|
||||
+8
-4
@@ -155,7 +155,7 @@ public class ThirdZyMerServiceImpl implements ThirdZyMerService {
|
||||
Map<String, String> userIdDict = zyApiTool.generateZyId(bizType, userList);
|
||||
// 转换身份编号
|
||||
List<String> roleList = dto.stream().map(ZyMerSyncAccountInfoDto::getAccClassID).distinct().toList();
|
||||
Map<String, String> roleIdDict = zyApiTool.generateZyId(bizType, roleList);
|
||||
Map<String, String> roleIdDict = zyApiTool.generateZyId(ThirdZyBizEnumType.SYNC_ACC_CLASS_INFO, roleList);
|
||||
for (ZyMerSyncAccountInfoDto v : dto) {
|
||||
v.setEPID(deptIdDict.get(v.getEPID()));
|
||||
v.setPerCode(userIdDict.get(v.getPerCode()));
|
||||
@@ -215,10 +215,14 @@ public class ThirdZyMerServiceImpl implements ThirdZyMerService {
|
||||
String url = zyConfig.getBaseUrl() + ZyApi.Mer.SYNC_ACC_CLASS_INFO;
|
||||
try {
|
||||
// 转换zyId
|
||||
List<String> roleList = dto.stream().map(ZyMerSyncAccClassInfoDto::getEPID).distinct().toList();
|
||||
Map<String, String> roleIdDict = zyApiTool.generateZyId(bizType, roleList);
|
||||
List<String> deptList = dto.stream().map(ZyMerSyncAccClassInfoDto::getEPID).distinct().toList();
|
||||
Map<String, String> deptIdDict = zyApiTool.generateZyId(ThirdZyBizEnumType.SYNC_ENTERPRISE_INFO, deptList);
|
||||
// 转换身份id
|
||||
List<String> roleList = dto.stream().map(ZyMerSyncAccClassInfoDto::getAccClassID).distinct().toList();
|
||||
Map<String, String> roleIdDict = zyApiTool.generateZyId(ThirdZyBizEnumType.SYNC_ACC_CLASS_INFO, roleList);
|
||||
for (ZyMerSyncAccClassInfoDto v : dto) {
|
||||
v.setEPID(roleIdDict.get(v.getEPID()));
|
||||
v.setEPID(deptIdDict.get(v.getEPID()));
|
||||
v.setAccClassID(roleIdDict.get(v.getAccClassID()));
|
||||
}
|
||||
url = String.format(url, zyApiTool.getToken());
|
||||
Map<String, Object> encryptionBody = new HashMap<>();
|
||||
|
||||
+55
-39
@@ -103,8 +103,9 @@ public class ThirdZySelfServiceImpl implements ThirdZySelfService {
|
||||
ThirdZyLogEntity entity = new ThirdZyLogEntity();
|
||||
entity.setBizType(bizType.getType());
|
||||
entity.setApiUrl(ZyApi.Self.CORRECT);
|
||||
entity.setEncipherReq(JSONUtil.toJsonStr(params));
|
||||
long startTime = System.currentTimeMillis();
|
||||
ZySelfCorrectVo result = new ZySelfCorrectVo();
|
||||
ZyBaseVo result = new ZyBaseVo();
|
||||
try {
|
||||
result.setCode(ZyBaseVo.errorCode);
|
||||
boolean isToken = checkIsToken(accessToken);
|
||||
@@ -126,7 +127,7 @@ public class ThirdZySelfServiceImpl implements ThirdZySelfService {
|
||||
result.setCode(ZyBaseVo.errorCode);
|
||||
result.setMsg(ZyBaseVo.defaultErrorMsg);
|
||||
ZySelfCorrectDto dto = JSONUtil.toBean(jsonRes, ZySelfCorrectDto.class);
|
||||
entity.setEncipherReq(JSONUtil.toJsonStr(dto));
|
||||
entity.setOrgReq(JSONUtil.toJsonStr(dto));
|
||||
// 获取参数
|
||||
String correctSerialNum = dto.getCorrectSerialNum();
|
||||
Long orderId = Long.parseLong(correctSerialNum);
|
||||
@@ -140,18 +141,25 @@ public class ThirdZySelfServiceImpl implements ThirdZySelfService {
|
||||
case SUCCESS -> {
|
||||
ThirdZyIdDictEntity userIdDict = thirdZyIdDictMapper.getBySelfId(ThirdZyBizEnumType.SYNC_ACCOUNT_INFO, String.valueOf(refundRes.getUserId()));
|
||||
String userZyId = userIdDict.getZyId();
|
||||
result.setAccNum(userZyId);
|
||||
result.setAccName(refundRes.getUsername());
|
||||
result.setPerCode(userZyId);
|
||||
result.setPlatformSerialNum(String.valueOf(refundRes.getRefundId()));
|
||||
result.setSerialNum(refundRes.getOrderNo());
|
||||
result.setRecDate(LocalDateTimeUtil.format(refundRes.getRefundTime(), DatePattern.NORM_DATETIME_PATTERN));
|
||||
result.setAmount(dto.getAmount());
|
||||
ZySelfPayVo success = new ZySelfPayVo();
|
||||
success.setAccNum(userZyId);
|
||||
success.setAccName(refundRes.getUsername());
|
||||
success.setPerCode(userZyId);
|
||||
success.setPlatformSerialNum(String.valueOf(refundRes.getRefundId()));
|
||||
success.setSerialNum(refundRes.getOrderNo());
|
||||
success.setRecDate(LocalDateTimeUtil.format(refundRes.getRefundTime(), DatePattern.NORM_DATETIME_PATTERN));
|
||||
success.setAmount(dto.getAmount());
|
||||
result.setMsg(ZyBaseVo.selfSuccessMsg);
|
||||
entity.setOrgReq(JSONUtil.toJsonStr(result));
|
||||
Map<String, Object> encryptionRes = zyApiTool.getSelfEncryptionMap(BeanUtil.beanToMap(result));
|
||||
entity.setEncipherReq(JSONUtil.toJsonStr(encryptionRes));
|
||||
return encryptionRes;
|
||||
Map<String, Object> resMap = BeanUtil.beanToMap(result);
|
||||
Map<String, Object> dataMap = BeanUtil.beanToMap(success);
|
||||
dataMap.put("sign", zyApiTool.generateSign(dataMap, false));
|
||||
resMap.put("data", Base64.encode(JSONUtil.toJsonStr(dataMap)));
|
||||
entity.setOrgRes(JSONUtil.toJsonStr(success));
|
||||
entity.setEncipherRes(JSONUtil.toJsonStr(resMap));
|
||||
long elapsedTime = System.currentTimeMillis() - startTime;
|
||||
entity.setTimeConsuming(Long.toString(elapsedTime));
|
||||
thirdZyLogService.save(entity);
|
||||
return resMap;
|
||||
}
|
||||
default -> throw new RuntimeException();
|
||||
}
|
||||
@@ -159,11 +167,10 @@ public class ThirdZySelfServiceImpl implements ThirdZySelfService {
|
||||
String error = String.format("|%s||correct|意外的错误error|%s|stack|%s|", TAG, e.getMessage(), Arrays.toString(e.getStackTrace()));
|
||||
log.error(error);
|
||||
entity.setError(error);
|
||||
return result.getErrorMap();
|
||||
} finally {
|
||||
long elapsedTime = System.currentTimeMillis() - startTime;
|
||||
entity.setTimeConsuming(Long.toString(elapsedTime));
|
||||
thirdZyLogService.save(entity);
|
||||
return result.getErrorMap();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,7 +185,7 @@ public class ThirdZySelfServiceImpl implements ThirdZySelfService {
|
||||
entity.setBizType(bizType.getType());
|
||||
entity.setEncipherReq(JSONUtil.toJsonStr(params));
|
||||
long startTime = System.currentTimeMillis();
|
||||
ZySelfPayVo result = new ZySelfPayVo();
|
||||
ZyBaseVo result = new ZyBaseVo();
|
||||
try {
|
||||
result.setCode(ZyBaseVo.errorCode);
|
||||
// 判断token
|
||||
@@ -200,7 +207,7 @@ public class ThirdZySelfServiceImpl implements ThirdZySelfService {
|
||||
result.setCode(ZyBaseVo.errorCode);
|
||||
result.setMsg(ZyBaseVo.defaultErrorMsg);
|
||||
ZySelfPayDto dto = JSONUtil.toBean(jsonRes, ZySelfPayDto.class);
|
||||
entity.setEncipherReq(JSONUtil.toJsonStr(dto));
|
||||
entity.setOrgReq(JSONUtil.toJsonStr(dto));
|
||||
// 获取参数
|
||||
String accNum = dto.getAccNum();
|
||||
ThirdZyIdDictEntity userIdDict = thirdZyIdDictMapper.getByZyIds(ThirdZyBizEnumType.SYNC_ACCOUNT_INFO, accNum);
|
||||
@@ -224,18 +231,25 @@ public class ThirdZySelfServiceImpl implements ThirdZySelfService {
|
||||
result.setCode(payRes.getCode().getType());
|
||||
switch (payRes.getCode()) {
|
||||
case SUCCESS -> {
|
||||
result.setAccNum(payRes.getUserId().toString());
|
||||
result.setAccName(payRes.getUsername());
|
||||
result.setPerCode(payRes.getUserId().toString());
|
||||
result.setPlatformSerialNum(dto.getSerialNum());
|
||||
result.setSerialNum(dto.getSerialNum());
|
||||
result.setAmount(amount);
|
||||
result.setRecDate(LocalDateTimeUtil.format(payRes.getPayTime(), DatePattern.NORM_DATETIME_PATTERN));
|
||||
ZySelfPayVo success = new ZySelfPayVo();
|
||||
success.setAccNum(payRes.getUserId().toString());
|
||||
success.setAccName(payRes.getUsername());
|
||||
success.setPerCode(payRes.getUserId().toString());
|
||||
success.setPlatformSerialNum(payRes.getOrderId().toString());
|
||||
success.setSerialNum(dto.getSerialNum());
|
||||
success.setAmount(amount);
|
||||
success.setRecDate(LocalDateTimeUtil.format(payRes.getPayTime(), DatePattern.NORM_DATETIME_PATTERN));
|
||||
result.setMsg(ZyBaseVo.selfSuccessMsg);
|
||||
entity.setOrgReq(JSONUtil.toJsonStr(result));
|
||||
Map<String, Object> encryptionRes = zyApiTool.getSelfEncryptionMap(BeanUtil.beanToMap(result));
|
||||
entity.setEncipherReq(JSONUtil.toJsonStr(encryptionRes));
|
||||
return encryptionRes;
|
||||
Map<String, Object> resMap = BeanUtil.beanToMap(result);
|
||||
Map<String, Object> dataMap = BeanUtil.beanToMap(success);
|
||||
dataMap.put("sign", zyApiTool.generateSign(dataMap, false));
|
||||
resMap.put("data", Base64.encode(JSONUtil.toJsonStr(dataMap)));
|
||||
entity.setOrgRes(JSONUtil.toJsonStr(success));
|
||||
entity.setEncipherRes(JSONUtil.toJsonStr(resMap));
|
||||
long elapsedTime = System.currentTimeMillis() - startTime;
|
||||
entity.setTimeConsuming(Long.toString(elapsedTime));
|
||||
thirdZyLogService.save(entity);
|
||||
return resMap;
|
||||
}
|
||||
default -> throw new RuntimeException();
|
||||
}
|
||||
@@ -243,11 +257,10 @@ public class ThirdZySelfServiceImpl implements ThirdZySelfService {
|
||||
String error = String.format("|%s||pay|意外的错误error|%s|stack|%s|", TAG, e.getMessage(), Arrays.toString(e.getStackTrace()));
|
||||
log.error(error);
|
||||
entity.setError(error);
|
||||
return result.getErrorMap();
|
||||
} finally {
|
||||
long elapsedTime = System.currentTimeMillis() - startTime;
|
||||
entity.setTimeConsuming(Long.toString(elapsedTime));
|
||||
thirdZyLogService.save(entity);
|
||||
return result.getErrorMap();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,11 +287,11 @@ public class ThirdZySelfServiceImpl implements ThirdZySelfService {
|
||||
result.setMsg(msg);
|
||||
throw new RuntimeException(msg);
|
||||
}
|
||||
String redisKey = CacheConstants.THIRDPARTY_ZY_SELF_TOKEN + "*";
|
||||
Set<String> keys = redisTemplate.keys(redisKey);
|
||||
if (ObjectUtil.isNotEmpty(keys)) {
|
||||
redisTemplate.delete(keys);
|
||||
}
|
||||
// String redisKey = CacheConstants.THIRDPARTY_ZY_SELF_TOKEN + "*";
|
||||
// Set<String> keys = redisTemplate.keys(redisKey);
|
||||
// if (ObjectUtil.isNotEmpty(keys)) {
|
||||
// redisTemplate.delete(keys);
|
||||
// }
|
||||
try {
|
||||
// 生成token
|
||||
String token = generateToken(params);
|
||||
@@ -345,14 +358,17 @@ public class ThirdZySelfServiceImpl implements ThirdZySelfService {
|
||||
}
|
||||
for (Map.Entry<String, Object> entry : paramsMap.entrySet()) {
|
||||
Object value = entry.getValue();
|
||||
if (ObjectUtil.isEmpty(value)) continue;
|
||||
if (value instanceof String) {
|
||||
entry.setValue(Base64.decodeStr((String) value));
|
||||
String str = Base64.decodeStr((String) value);
|
||||
entry.setValue(URLUtil.decode(str));
|
||||
} else {
|
||||
entry.setValue(Base64.decodeStr(value.toString()));
|
||||
String str = Base64.decodeStr((String) value);
|
||||
entry.setValue(URLUtil.decode(str));
|
||||
}
|
||||
}
|
||||
String string = zyApiTool.generateSign(paramsMap, false);
|
||||
if (ObjectUtil.equals(sign, string)) {
|
||||
if (ObjectUtil.equals(sign.toLowerCase(), string)) {
|
||||
for (Map.Entry<String, Object> entry : paramsMap.entrySet()) {
|
||||
Object value = entry.getValue();
|
||||
if (value instanceof String) {
|
||||
@@ -393,6 +409,6 @@ public class ThirdZySelfServiceImpl implements ThirdZySelfService {
|
||||
dto.setLoginTime(System.currentTimeMillis());
|
||||
dto.setExpireTime(dto.getLoginTime() + zyConfig.getSelfExpiresIn() + 100);
|
||||
String redisKey = CacheConstants.THIRDPARTY_ZY_SELF_TOKEN + dto.getToken();
|
||||
redisTemplate.opsForValue().set(redisKey, JSONUtil.toJsonStr(dto), zyConfig.getSelfExpiresIn(), TimeUnit.MINUTES);
|
||||
redisTemplate.opsForValue().set(redisKey, JSONUtil.toJsonStr(dto), zyConfig.getSelfExpiresIn(), TimeUnit.SECONDS);
|
||||
}
|
||||
}
|
||||
+16
-7
@@ -98,6 +98,10 @@ public class ZyApiTool {
|
||||
list.clear();
|
||||
result.clear();
|
||||
for (String v : selfIds) {
|
||||
if (v.length() <= 16) {
|
||||
result.put(v, v);
|
||||
continue;
|
||||
}
|
||||
Optional<ThirdZyIdDictEntity> first = bySelfIdList.stream().filter(i -> ObjectUtil.equals(v, i.getSelfId()) && ObjectUtil.equals(type.getType(), i.getBizType())).findFirst();
|
||||
if (first.isPresent()) {
|
||||
result.put(v, first.get().getZyId());
|
||||
@@ -112,16 +116,19 @@ public class ZyApiTool {
|
||||
item.setZyId(zyId);
|
||||
list.add(item);
|
||||
result.put(v, zyId);
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
} catch (Exception e) {
|
||||
log.error("{}generateZyId休眠失败", TAG, e);
|
||||
}
|
||||
}
|
||||
List<String> zyIds = list.stream().map(ThirdZyIdDictEntity::getZyId).toList();
|
||||
if (zyIds.isEmpty()) {
|
||||
hasDuplicate = true;
|
||||
break;
|
||||
}
|
||||
List<ThirdZyIdDictEntity> repetitionList = thirdZyIdDictMapper.getByZyIds(type, zyIds);
|
||||
if (ObjectUtil.isNotEmpty(repetitionList)) {
|
||||
hasDuplicate = true;
|
||||
break;
|
||||
}
|
||||
} while (hasDuplicate);
|
||||
if (ObjectUtil.isNotEmpty(list)) {
|
||||
@@ -170,7 +177,7 @@ public class ZyApiTool {
|
||||
return body;
|
||||
}
|
||||
|
||||
private void prePost(Map<String, Object> params, boolean isZy) {
|
||||
public void prePost(Map<String, Object> params, boolean isZy) {
|
||||
for (Map.Entry<String, Object> entry : params.entrySet()) {
|
||||
Object value = entry.getValue();
|
||||
if (value instanceof String) {
|
||||
@@ -183,10 +190,12 @@ public class ZyApiTool {
|
||||
String sign = generateSign(params, isZy);
|
||||
for (Map.Entry<String, Object> entry : params.entrySet()) {
|
||||
Object value = entry.getValue();
|
||||
if (value instanceof String) {
|
||||
entry.setValue(Base64.encode((String) value));
|
||||
} else {
|
||||
entry.setValue(Base64.encode(value.toString()));
|
||||
if (ObjectUtil.isNotEmpty(value)) {
|
||||
if (value instanceof String) {
|
||||
entry.setValue(Base64.encode((String) value));
|
||||
} else {
|
||||
entry.setValue(Base64.encode(value.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
params.put("sign", sign);
|
||||
|
||||
+14
-3
@@ -44,9 +44,20 @@ oauth2:
|
||||
# 正元智慧
|
||||
# https://gwyc.zj.gov.cn/API/%E7%9C%81%E5%B9%B3%E5%8F%B0API%E5%AF%B9%E6%8E%A5%E6%8E%A5%E5%8F%A3.html
|
||||
zy:
|
||||
base-url: http://60.191.37.212:18079
|
||||
app-id: 689C8D6F5059A6F85B8BE45A49001ACB
|
||||
app-secret: BD21DA0DEB8F0FC43246B0BD2FCAE6FF
|
||||
# base-url: http://60.191.37.212:18079
|
||||
# 测试1
|
||||
# app-id: 689C8D6F5059A6F85B8BE45A49001ACB
|
||||
# app-secret: BD21DA0DEB8F0FC43246B0BD2FCAE6FF
|
||||
|
||||
# 测试2
|
||||
# app-id: FC455B0A788E334AC08FB3E1D8385C75
|
||||
# app-secret: E9131D0BCC9054808675DA1E2E199023
|
||||
|
||||
# 正式
|
||||
base-url: https://gwycport.zj.gov.cn
|
||||
app-id: 0BBF0D9A7F1B4BD5280E59197E259AC6
|
||||
app-secret: 434752786ACBB37214F6617CC37AD0E9
|
||||
|
||||
|
||||
self-base-url: http://60.191.37.212:18079
|
||||
self-app-id: xA5jF2vX4zO5mQ8tR9yE7rC7iI0fK0kI
|
||||
|
||||
+17
-6
@@ -80,15 +80,26 @@ public class ZyTest {
|
||||
ZySelfGetTokenVo token = zySelfService.getToken(tokenParams);
|
||||
String accessToken = token.getAccess_token();
|
||||
|
||||
// ZySelfPayDto params = ZySelfPayDto
|
||||
// .builder()
|
||||
// .accNum(dzcUserDict.getZyId())
|
||||
// .cardAccNum(dzcWalletId)
|
||||
// .amount("10")
|
||||
// .serialNum("01234567890123456789")
|
||||
// .dealTime(date)
|
||||
// .opId("0123456789")
|
||||
// .build();
|
||||
|
||||
ZySelfPayDto params = ZySelfPayDto
|
||||
.builder()
|
||||
.accNum(dzcUserDict.getZyId())
|
||||
.cardAccNum(dzcWalletId)
|
||||
.amount("10")
|
||||
.serialNum("01234567890123456789")
|
||||
.dealTime(date)
|
||||
.opId("0123456789")
|
||||
.accNum("1741232987425846")
|
||||
.cardAccNum("1877309001545244673")
|
||||
.amount("0.01")
|
||||
.serialNum("763")
|
||||
.dealTime("2025-03-06 17:34:11")
|
||||
.opId("")
|
||||
.build();
|
||||
String testJson = "{\"accNum\":\"MTc0MTIzMjk4NzQyNTg0Ng==\",\"amount\":\"MC4wMQ==\",\"cardAccNum\":\"MTg3NzMwOTAwMTU0NTI0NDY3Mw==\",\"dealTime\":\"MjAyNS0wMy0wNiAxNjo0NTowMA==\",\"opId\":\"\",\"serialNum\":\"NzYx\",\"sign\":\"3EFD38EA76BDC32165841852F0EEFD5E\"}";
|
||||
Map<String, Object> paramsMap = BeanUtil.beanToMap(params);
|
||||
Map<String, Object> body = zyApiTool.getSelfEncryptionMap(paramsMap, "accNum", "cardAccNum", "amount", "serialNum", "dealTime", "opId");
|
||||
ZySelfPayDto bodyObj = JSONUtil.toBean(JSONUtil.toJsonStr(body), ZySelfPayDto.class);
|
||||
|
||||
+3
-1
@@ -36,7 +36,9 @@ public interface WalletManageMapper extends PjcloudBaseMapper<WalletManageEntity
|
||||
ObjectUtil.isNotEmpty(dto.getCreateTimeList()) ? dto.getCreateTimeList()[0] : null,
|
||||
ObjectUtil.isNotEmpty(dto.getCreateTimeList()) ? dto.getCreateTimeList()[1] : null
|
||||
)
|
||||
.orderByDesc(WalletManageEntity::getCreateTime);
|
||||
.orderByDesc(WalletManageEntity::getCreateTime)
|
||||
.orderByDesc(WalletManageEntity::getUserId)
|
||||
.orderByDesc(WalletManageEntity::getWalletTypeId);
|
||||
if (ObjectUtil.isNotEmpty(dto.getIsInclude())) {
|
||||
if (dto.getIsInclude()) {
|
||||
wrapper.in(ObjectUtil.isNotEmpty(dto.getDeptIds()), WalletManageEntity::getDeptId, dto.getDeptIds());
|
||||
|
||||
+1
-1
@@ -283,7 +283,7 @@ public class WalletManageServiceImpl extends ServiceImpl<WalletManageMapper, Wal
|
||||
List<WalletManageBalanceVo> itemList = baseMapper.selectBalance(dto);
|
||||
if (ObjectUtil.isEmpty(itemList)) continue;
|
||||
for (WalletManageBalanceVo j : itemList) {
|
||||
j.setWalletTypeName(i.getName());
|
||||
// j.setWalletTypeName(i.getName());
|
||||
walletPage.getRecords().stream().filter(v -> ObjectUtil.equals(v.getUserId(), j.getUserId())).findFirst().ifPresent(v -> {
|
||||
if (ObjectUtil.isNotEmpty(j.getBalance())) {
|
||||
v.setBalance(j.getBalance());
|
||||
|
||||
+30
-23
@@ -157,14 +157,14 @@ public class WalletThirdZyServiceImpl implements WalletThirdZyService {
|
||||
log.info("|{}| syncAllRole 错误 List为空", TAG);
|
||||
return;
|
||||
}
|
||||
// 查询商户信息
|
||||
List<MchManageVo> mchList = mchManageService.list(new MchManageDto());
|
||||
if (ObjectUtil.isEmpty(mchList)) {
|
||||
log.info("|{}| syncAllRole 错误 mchList为空", TAG);
|
||||
// 查询部门信息
|
||||
List<SysDept> deptList = remoteDeptService.getAllDept(null).getData();
|
||||
if (ObjectUtil.isEmpty(deptList)) {
|
||||
log.info("|{}| syncAllRole 错误 deptList为空", TAG);
|
||||
return;
|
||||
}
|
||||
for (MchManageVo i : mchList) {
|
||||
List<ZyMerSyncAccClassInfoDto> syncList = new ArrayList<>();
|
||||
List<ZyMerSyncAccClassInfoDto> syncList = new ArrayList<>();
|
||||
for (SysDept i : deptList) {
|
||||
String syncAllMchVersion = getSyncAllMchVersion();
|
||||
for (SysRole j : roleList) {
|
||||
ZyMerSyncAccClassInfoDto entity = new ZyMerSyncAccClassInfoDto();
|
||||
@@ -174,14 +174,14 @@ public class WalletThirdZyServiceImpl implements WalletThirdZyService {
|
||||
entity.setFixId(syncAllMchVersion);
|
||||
syncList.add(entity);
|
||||
}
|
||||
try {
|
||||
if (ObjectUtil.isNotEmpty(syncList)) {
|
||||
ZyMerSyncAccClassInfoVo res = thirdZyService.syncAccClassInfoApi(syncList).getData();
|
||||
if (ObjectUtil.isEmpty(res)) return;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("|{}syncAllRole 调用第三方接口错误|", TAG);
|
||||
}
|
||||
try {
|
||||
if (ObjectUtil.isNotEmpty(syncList)) {
|
||||
ZyMerSyncAccClassInfoVo res = thirdZyService.syncAccClassInfoApi(syncList).getData();
|
||||
if (ObjectUtil.isEmpty(res)) return;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("|{}syncAllRole 调用第三方接口错误|", TAG);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,22 +208,27 @@ public class WalletThirdZyServiceImpl implements WalletThirdZyService {
|
||||
log.error("|{}|syncAllUser 同步到正元全部身份信息错误walletType为空", TAG);
|
||||
return;
|
||||
}
|
||||
int total = 0;
|
||||
while (true) {
|
||||
boolean isNotEmpty = syncAllUserGroup(page, userId, defaultUserRole.get().getRoleId(), walletType.getId());
|
||||
if (!isNotEmpty) break;
|
||||
int syncCount = syncAllUserGroup(page, userId, defaultUserRole.get().getRoleId(), walletType.getId());
|
||||
if (syncCount > 0) {
|
||||
total += syncCount;
|
||||
}
|
||||
if (syncCount <= 0) break;
|
||||
page.setCurrent(page.getCurrent() + 1);
|
||||
}
|
||||
log.info("|{}|总共同步|{}|条数据", TAG, total);
|
||||
}
|
||||
|
||||
|
||||
private boolean syncAllUserGroup(Page page, Long userId, Long roleId, Long walletTypeId) {
|
||||
private int syncAllUserGroup(Page page, Long userId, Long roleId, Long walletTypeId) {
|
||||
WalletManageDto query = new WalletManageDto();
|
||||
query.setWalletTypeId(walletTypeId);
|
||||
if (ObjectUtil.isNotEmpty(userId)) query.setUserId(userId);
|
||||
DataScope dataScope = DataScope.of();
|
||||
dataScope.func(DataScopeFuncEnum.ALL);
|
||||
Page<WalletManageVo> userPage = walletManageService.scopePageList(page, query, dataScope);
|
||||
if (ObjectUtil.isEmpty(userPage.getRecords())) return false;
|
||||
if (ObjectUtil.isEmpty(userPage.getRecords())) return 0;
|
||||
List<ZyMerSyncAccountInfoDto> syncList = new ArrayList<>();
|
||||
String syncAllMchVersion = getSyncAllMchVersion();
|
||||
for (WalletManageVo v : userPage.getRecords()) {
|
||||
@@ -241,8 +246,10 @@ public class WalletThirdZyServiceImpl implements WalletThirdZyService {
|
||||
if (ObjectUtil.isEmpty(v.getCardNumber())) {
|
||||
walletManageService.createWallet(v.getUserId());
|
||||
WalletManageEntity wallet = walletManageService.getWallet(v.getId());
|
||||
if (ObjectUtil.isNotEmpty(wallet)) {
|
||||
if (ObjectUtil.isNotEmpty(wallet) && ObjectUtil.isNotEmpty(wallet.getCardNumber())) {
|
||||
v.setCardNumber(wallet.getCardNumber());
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
ZyMerSyncAccountInfoDto item = new ZyMerSyncAccountInfoDto();
|
||||
@@ -261,13 +268,13 @@ public class WalletThirdZyServiceImpl implements WalletThirdZyService {
|
||||
try {
|
||||
if (ObjectUtil.isNotEmpty(syncList)) {
|
||||
ZyMerSyncAccountInfoVo.DataVo res = thirdZyService.syncAccountInfoApi(syncList).getData();
|
||||
if (ObjectUtil.isEmpty(res)) return false;
|
||||
if (ObjectUtil.isEmpty(res)) return 0;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("|{}syncAllUserGroup 调用第三方接口错误|", TAG);
|
||||
return false;
|
||||
return 0;
|
||||
}
|
||||
return userPage.getTotal() > 0;
|
||||
return syncList.size();
|
||||
}
|
||||
|
||||
|
||||
@@ -291,8 +298,8 @@ public class WalletThirdZyServiceImpl implements WalletThirdZyService {
|
||||
try {
|
||||
WalleCardStatusEnum walleCardStatusEnum = WalleCardStatusEnum.valueOfByType(cardStatus);
|
||||
return switch (walleCardStatusEnum) {
|
||||
case NONE_ACTIVE, LOCK -> 5;
|
||||
case ACTIVE -> 1;
|
||||
case LOCK -> 5;
|
||||
case ACTIVE, NONE_ACTIVE -> 1;
|
||||
case REPORT -> 2;
|
||||
case FREEZE -> 3;
|
||||
case CANCEL -> 0;
|
||||
|
||||
Binary file not shown.
@@ -59,7 +59,7 @@
|
||||
a.del_flag = 0
|
||||
<if test="dto.walletRecordMonth != null">
|
||||
AND a.create_time = (SELECT MAX(sub.create_time) FROM wallet_transaction sub WHERE sub.user_id = a.user_id AND
|
||||
DATE_FORMAT(sub.create_time, '%Y-%m') = #{dto.walletRecordMonth})
|
||||
DATE_FORMAT(sub.create_time, '%Y-%m') <= #{dto.walletRecordMonth})
|
||||
</if>
|
||||
<if test="dto.userId != null">
|
||||
AND a.user_id = #{dto.userId}
|
||||
|
||||
Reference in new issue
Block a user