Merge remote-tracking branch 'origin/master'

This commit is contained in:
张松
2025-02-28 13:58:45 +08:00
8 changed files with 276 additions and 208 deletions

View File

@@ -11,7 +11,7 @@ import com.czg.account.service.HandoverRecordService;
import com.czg.account.vo.HandoverCategoryListVo;
import com.czg.account.vo.HandoverProductListVo;
import com.czg.account.vo.HandoverTotalVo;
import com.czg.order.service.OrderInfoService;
import com.czg.order.service.OrderInfoRpcService;
import com.czg.sa.StpKit;
import com.czg.service.account.mapper.HandoverRecordMapper;
import com.czg.utils.PageUtil;
@@ -35,7 +35,7 @@ import java.util.List;
public class HandoverRecordServiceImpl extends ServiceImpl<HandoverRecordMapper, HandoverRecord> implements HandoverRecordService {
@DubboReference
private OrderInfoService orderInfoService;
private OrderInfoRpcService orderInfoRpcService;
private QueryWrapper buildQueryWrapper(HandoverRecordDTO param) {
QueryWrapper queryWrapper = PageUtil.buildSortQueryWrapper();
@@ -95,13 +95,13 @@ public class HandoverRecordServiceImpl extends ServiceImpl<HandoverRecordMapper,
String loginTimeStr = LocalDateTimeUtil.formatNormal(loginTime);
String handoverTimeStr = LocalDateTimeUtil.formatNormal(handoverTime);
HandoverRecord entity = BeanUtil.copyProperties(data, HandoverRecord.class);
entity.setWechatAmount(orderInfoService.getHandoverWechatAmount(shopId, loginTimeStr, handoverTimeStr));
entity.setAlipayAmount(orderInfoService.getHandoverAlipayAmount(shopId, loginTimeStr, handoverTimeStr));
entity.setVipPay(orderInfoService.getHandoverVipPayAmount(shopId, loginTimeStr, handoverTimeStr));
entity.setVipRecharge(orderInfoService.getHandoverVipChargeAmount(shopId, loginTimeStr, handoverTimeStr));
entity.setQuickInAmount(orderInfoService.getHandoverQuickPayAmount(shopId, loginTimeStr, handoverTimeStr));
entity.setCreditAmount(orderInfoService.getHandoverCreditAmount(shopId, loginTimeStr, handoverTimeStr));
List<HandoverCategoryListVo> categoryData = orderInfoService.getHandoverCategoryList(shopId, loginTimeStr, handoverTimeStr);
entity.setWechatAmount(orderInfoRpcService.getHandoverWechatAmount(shopId, loginTimeStr, handoverTimeStr));
entity.setAlipayAmount(orderInfoRpcService.getHandoverAlipayAmount(shopId, loginTimeStr, handoverTimeStr));
entity.setVipPay(orderInfoRpcService.getHandoverVipPayAmount(shopId, loginTimeStr, handoverTimeStr));
entity.setVipRecharge(orderInfoRpcService.getHandoverVipChargeAmount(shopId, loginTimeStr, handoverTimeStr));
entity.setQuickInAmount(orderInfoRpcService.getHandoverQuickPayAmount(shopId, loginTimeStr, handoverTimeStr));
entity.setCreditAmount(orderInfoRpcService.getHandoverCreditAmount(shopId, loginTimeStr, handoverTimeStr));
List<HandoverCategoryListVo> categoryData = orderInfoRpcService.getHandoverCategoryList(shopId, loginTimeStr, handoverTimeStr);
entity.setCategoryData(JSON.toJSONString(categoryData, JSONWriter.Feature.WriteMapNullValue));
List<HandoverProductListVo> productData = data.getDetailList();
entity.setProductData(JSON.toJSONString(productData, JSONWriter.Feature.WriteMapNullValue));
@@ -110,22 +110,22 @@ public class HandoverRecordServiceImpl extends ServiceImpl<HandoverRecordMapper,
}
private BigDecimal sumCashAmount(Long shopId, String loginTime, String handoverTime) {
return orderInfoService.getHandoverCashAmount(shopId, loginTime, handoverTime);
return orderInfoRpcService.getHandoverCashAmount(shopId, loginTime, handoverTime);
}
private BigDecimal sumRefundAmount(Long shopId, String loginTime, String handoverTime) {
return orderInfoService.getHandoverRefundAmount(shopId, loginTime, handoverTime);
return orderInfoRpcService.getHandoverRefundAmount(shopId, loginTime, handoverTime);
}
private BigDecimal sumHandAmount(Long shopId, String loginTime, String handoverTime) {
return orderInfoService.getHandoverTotalAmount(shopId, loginTime, handoverTime);
return orderInfoRpcService.getHandoverTotalAmount(shopId, loginTime, handoverTime);
}
private int countOrderNum(Long shopId, String loginTime, String handoverTime) {
return orderInfoService.getHandoverOrderNum(shopId, loginTime, handoverTime);
return orderInfoRpcService.getHandoverOrderNum(shopId, loginTime, handoverTime);
}
private List<HandoverProductListVo> getDetailList(Long shopId, String loginTime, String handoverTime) {
return orderInfoService.getHandoverDetailList(shopId, loginTime, handoverTime);
return orderInfoRpcService.getHandoverDetailList(shopId, loginTime, handoverTime);
}
}

View File

@@ -35,7 +35,9 @@ public class PictureClassifyServiceImpl extends ServiceImpl<PictureClassifyMappe
Long shopId = StpKit.USER.getShopId(0L);
queryWrapper.and(q -> {
q.eq(PictureClassify::getShopId, shopId).or(q1 -> {
q1.eq(PictureClassify::getShopId, 0).eq(PictureClassify::getIsSystem, YesNoEnum.YES.value());
q1.eq(PictureClassify::getShopId, 1L);
}).or(q2 -> {
q2.eq(PictureClassify::getIsSystem, YesNoEnum.YES.value());
});
});
queryWrapper.eq(PictureClassify::getIsDel, DeleteEnum.NORMAL.value());
@@ -56,7 +58,9 @@ public class PictureClassifyServiceImpl extends ServiceImpl<PictureClassifyMappe
boolean exists = super.exists(query().eq(PictureClassify::getName, dto.getName())
.and(q -> {
q.eq(PictureClassify::getShopId, shopId).or(q1 -> {
q1.eq(PictureClassify::getShopId, 0).eq(PictureClassify::getIsSystem, YesNoEnum.YES.value());
q1.eq(PictureClassify::getShopId, 1L);
}).or(q2 -> {
q2.eq(PictureClassify::getIsSystem, YesNoEnum.YES.value());
});
})
);
@@ -78,7 +82,9 @@ public class PictureClassifyServiceImpl extends ServiceImpl<PictureClassifyMappe
.ne(PictureClassify::getId, dto.getId())
.and(q -> {
q.eq(PictureClassify::getShopId, shopId).or(q1 -> {
q1.eq(PictureClassify::getShopId, 0).eq(PictureClassify::getIsSystem, YesNoEnum.YES.value());
q1.eq(PictureClassify::getShopId, 1L);
}).or(q2 -> {
q2.eq(PictureClassify::getIsSystem, YesNoEnum.YES.value());
});
})
);
@@ -102,6 +108,7 @@ public class PictureClassifyServiceImpl extends ServiceImpl<PictureClassifyMappe
}
private void checkPictureClassify(Long id) {
Long shopId = StpKit.USER.getShopId(0L);
PictureClassify entity = super.getById(id);
if (entity == null) {
throw new CzgException("图片分类不存在");
@@ -109,6 +116,9 @@ public class PictureClassifyServiceImpl extends ServiceImpl<PictureClassifyMappe
if (entity.getIsSystem() == YesNoEnum.YES.value()) {
throw new CzgException("系统预设分类不可操作");
}
if (!shopId.equals(entity.getShopId())) {
throw new CzgException("公共分类不可操作");
}
}
}

View File

@@ -7,6 +7,7 @@ import com.czg.account.entity.PictureGallery;
import com.czg.account.param.PictureGalleryParam;
import com.czg.account.service.PictureGalleryService;
import com.czg.enums.DeleteEnum;
import com.czg.exception.CzgException;
import com.czg.sa.StpKit;
import com.czg.service.account.mapper.PictureGalleryMapper;
import com.czg.utils.PageUtil;
@@ -33,8 +34,13 @@ public class PictureGalleryServiceImpl extends ServiceImpl<PictureGalleryMapper,
if (ObjUtil.isNotNull(param.getPictureClassifyId())) {
queryWrapper.eq(PictureGallery::getPictureClassifyId, param.getPictureClassifyId());
}
Long shopId = StpKit.USER.getShopId(0L);
queryWrapper.eq(PictureGallery::getShopId, shopId);
queryWrapper.and(q -> {
q.eq(PictureGallery::getShopId, shopId).or(q1 -> {
q1.eq(PictureGallery::getShopId, 1L);
});
});
queryWrapper.eq(PictureGallery::getIsDel, DeleteEnum.NORMAL.value());
queryWrapper.orderBy(PictureGallery::getId, false);
return queryWrapper;
@@ -61,7 +67,11 @@ public class PictureGalleryServiceImpl extends ServiceImpl<PictureGalleryMapper,
@Override
public void deletePictureGallery(Long id) {
PictureGallery entity = super.getById(id);
Long shopId = StpKit.USER.getShopId(0L);
if (!shopId.equals(entity.getShopId())) {
throw new CzgException("公共图片不可操作");
}
UpdateChain.of(PictureGallery.class)
.set(PictureGallery::getIsDel, DeleteEnum.DELETED.value())
.eq(PictureGallery::getShopId, shopId)