Merge remote-tracking branch 'origin/master'

This commit is contained in:
zjf committed 2025-06-10 13:50:24 +08:00
commit cfc2982081
5 files changed
+65 -5

No files matched your search

@@ -23,4 +23,9 @@ public class HardOrderSumAndCountDto {
private List<Long> mchIds;
/**
* 退款成功
*/
private Boolean isRefundSuccess;
}
@@ -122,7 +122,10 @@ public interface HardOrderMapper extends PjcloudBaseMapper<HardOrderEntity> {
List<HardOrderSumAndCountVo> sumAndCount(@Param("dto") HardOrderSumAndCountDto dto);
List<HardOrderSumAndCountVo> refundSumAndCount(@Param("dto") HardOrderSumAndCountDto refundDto);
List<HardOrderSumAndCountVo> sumAndCountTotalByHourType(@Param("dto") HardOrderSumAndCountDto dto);
HardZyCardSyncVo totalYearMonthDay(@Param("dto") HardOrderDto hardOrderDto);
}
@@ -4,6 +4,8 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.extra.spring.SpringUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.bsd.pjcloud.admin.api.dto.UserInfo;
import com.bsd.pjcloud.admin.api.feign.RemoteUserService;
import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.hard.api.constant.HardTypeEnum;
@@ -57,6 +59,7 @@ public class HardOrderSyncServiceImpl implements HardOrderSyncService {
private final RemoteMchService remoteMchService;
private final RemoteWalletSettingService walletSettingService;
private final RemoteWalletService walletService;
private final RemoteUserService userService;
@Override
@Transactional(rollbackFor = Exception.class)
@@ -84,7 +87,13 @@ public class HardOrderSyncServiceImpl implements HardOrderSyncService {
createIdList.add(findOrder.getAndroidOrderCode());
continue;
}
HardOrderEntity order = parseOrder(i, body.getHardwareId(), body.getMerchantId(), merchant.getDeptId());
// 查询用户
UserInfo userInfo = userService.getByUserId(i.getUserCode()).getData();
if (ObjectUtil.isEmpty(userInfo)) {
log.error("|{}|同步安卓机离线订单,用户不存在:{}", TAG, JSON.toJSONString(i));
continue;
}
HardOrderEntity order = parseOrder(i, body.getHardwareId(), merchant, merchant.getDeptId(), userInfo);
HardParentCarEntity parentCar = parseParentCar(i, body.getMerchantId());
List<HardCarEntity> carList = i.getCarList().stream().map(this::parseCar).toList();
@@ -168,12 +177,15 @@ public class HardOrderSyncServiceImpl implements HardOrderSyncService {
return false;
}
public HardOrderEntity parseOrder(OfflineOrder order, Long hardwareId, Long merchantId, Long merchantDeptId) {
public HardOrderEntity parseOrder(OfflineOrder order, Long hardwareId, MchManageVo mchDetail, Long merchantDeptId, UserInfo userInfo) {
HardOrderEntity res = new HardOrderEntity();
res.setAndroidOrderCode(order.getUniqueCode());
res.setUserId(order.getUserCode());
res.setUserDeptId(userInfo.getSysUser().getDeptId());
res.setHardId(hardwareId);
res.setMerchantId(merchantId);
res.setMerchantId(mchDetail.getId());
res.setMerchantDeptId(mchDetail.getDeptId());
res.setMerchantType(mchDetail.getTypes());
res.setDeptId(merchantDeptId);
res.setSysType(order.getSysType().getType());
res.setWalletId(order.getWalletId());
@@ -402,13 +402,16 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
if (ObjectUtil.isNotEmpty(dto.getWalletTypeId())) {
refundDto.setWalletTypeId(dto.getWalletTypeId());
}
return hardOrderMapper.sumAndCount(refundDto);
return hardOrderMapper.refundSumAndCount(refundDto);
});
// 消费净次数
CompletableFuture<List<HardOrderSumAndCountVo>> profitFuture = CompletableFuture.supplyAsync(() -> {
HardOrderSumAndCountDto refundDto = new HardOrderSumAndCountDto();
refundDto.setUserDeptIds(deptIds);
refundDto.setOrderStatusCodes(HardOrderStatusEnum.getPaySuccessCodes());
refundDto.setIsRefundSuccess(true);
List<String> paySuccessCodes = new ArrayList<>(HardOrderStatusEnum.getPaySuccessCodes());
paySuccessCodes.add(HardOrderStatusEnum.REFUND.getType());
refundDto.setOrderStatusCodes(paySuccessCodes);
if (ObjectUtil.isNotEmpty(dto.getCreateTimeList())) {
refundDto.setCreateTimeList(dto.getCreateTimeList());
}
@@ -312,6 +312,43 @@
sum(a.pay_price) as sum,
count(0) as count
from hard_order a
<where>
a.del_flag = 0
<if test="dto.isRefundSuccess != null and dto.isRefundSuccess == true ">
and (a.refund_status is null or a.refund_status not in ('20'))
</if>
<if test="dto.orderStatusCodes != null and dto.orderStatusCodes.size() != 0">
and a.order_status in
<foreach collection="dto.orderStatusCodes" item="v" open="(" close=")" separator=",">
#{v}
</foreach>
</if>
<if test="dto.getUserDeptIds != null and dto.getUserDeptIds.size() != 0">
and a.user_dept_id in
<foreach collection="dto.getUserDeptIds" item="v" open="(" close=")" separator=",">
#{v}
</foreach>
</if>
<if test="dto.createTimeList != null and dto.createTimeList.length == 2">
and a.create_time between #{dto.createTimeList[0]} and #{dto.createTimeList[1]}
</if>
<if test="dto.mchIds != null and dto.mchIds.size() != 0">
and a.merchant_id in
<foreach collection="dto.mchIds" item="v" open="(" close=")" separator=",">
#{v}
</foreach>
</if>
</where>
group by a.user_dept_id
</select>
<select id="refundSumAndCount" resultType="com.bsd.pjcloud.hard.api.vo.order.HardOrderSumAndCountVo">
select
a.user_dept_id as deptId,
sum(a.pay_price) as sum,
count(0) as count
from hard_order a
inner join hard_after_sale r on r.order_id = a.id and r.del_flag = '0' and r.status = '50'
<where>
a.del_flag = 0
<if test="dto.walletTypeId != null">