交班记录代码提交

This commit is contained in:
Tankaikai
2025-02-28 15:36:41 +08:00
parent 7eae3c6f68
commit 7cdce51c58
8 changed files with 147 additions and 4 deletions

View File

@@ -3,6 +3,7 @@ package com.czg.service.account.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONWriter;
import com.czg.account.dto.HandoverRecordDTO;
@@ -15,6 +16,7 @@ import com.czg.order.service.OrderInfoRpcService;
import com.czg.sa.StpKit;
import com.czg.service.account.mapper.HandoverRecordMapper;
import com.czg.utils.PageUtil;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import org.apache.dubbo.config.annotation.DubboReference;
@@ -39,16 +41,43 @@ public class HandoverRecordServiceImpl extends ServiceImpl<HandoverRecordMapper,
private QueryWrapper buildQueryWrapper(HandoverRecordDTO param) {
QueryWrapper queryWrapper = PageUtil.buildSortQueryWrapper();
/*if (StrUtil.isNotEmpty(param.getName())) {
queryWrapper.like(HandoverRecord::getName, param.getName());
}*/
if (StrUtil.isNotEmpty(param.getBeginDate())) {
queryWrapper.ge(HandoverRecord::getHandoverTime, param.getBeginDate() + " 00:00:00");
}
if (StrUtil.isNotEmpty(param.getEndDate())) {
queryWrapper.le(HandoverRecord::getHandoverTime, param.getEndDate() + " 23:59:59");
}
Long shopId = StpKit.USER.getShopId(0L);
queryWrapper.eq(HandoverRecord::getShopId, shopId);
queryWrapper.isNotNull(HandoverRecord::getHandoverTime);
queryWrapper.orderBy(HandoverRecord::getId, false);
return queryWrapper;
}
@Override
public Page<HandoverRecordDTO> getHandoverRecordPage(String beginDate, String endDate) {
HandoverRecordDTO param = new HandoverRecordDTO();
param.setBeginDate(beginDate);
param.setEndDate(endDate);
QueryWrapper queryWrapper = buildQueryWrapper(param);
return super.pageAs(PageUtil.buildPage(), queryWrapper, HandoverRecordDTO.class);
}
@Override
public List<HandoverProductListVo> getHandoverProductListById(Long id) {
Long shopId = StpKit.USER.getShopId(0L);
HandoverRecord data = super.getOne(query().eq(HandoverRecord::getId, id).eq(HandoverRecord::getShopId, shopId));
if (data == null) {
return List.of();
}
String productData = data.getProductData();
if (StrUtil.isBlank(productData)) {
return List.of();
}
return JSON.parseArray(productData, HandoverProductListVo.class);
}
@Override
public HandoverTotalVo totalHandoverData() {
Long shopId = StpKit.USER.getShopId(0L);