Przeglądaj źródła

Merge remote-tracking branch 'origin/master'

zhangchen 3 miesięcy temu
rodzic
commit
c3d66f3cd4

+ 5 - 6
alien-store/src/main/java/shop/alien/store/service/impl/StoreCashOutRecordServiceImpl.java

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.RequiredArgsConstructor;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 import shop.alien.entity.store.StoreCashOutRecord;
@@ -19,8 +20,6 @@ import shop.alien.util.common.ListToPage;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.time.ZoneId;
-import java.util.ArrayList;
-import java.util.Date;
 import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
@@ -47,15 +46,15 @@ public class StoreCashOutRecordServiceImpl extends ServiceImpl<StoreCashOutRecor
     public StoreCashOutRecordVo getCashOutRecordList(Integer storeId, String cashOutStartTime, String cashOutEndTime, Integer page, Integer size, String paymentStatus) {
         LambdaQueryWrapper<StoreCashOutRecord> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(StoreCashOutRecord::getStoreId, storeId);
-        wrapper.eq(null != paymentStatus, StoreCashOutRecord::getPaymentStatus, paymentStatus);
-        wrapper.le(null != cashOutEndTime, StoreCashOutRecord::getCreatedTime, cashOutEndTime + " 23:59:59");
-        wrapper.ge(null != cashOutStartTime, StoreCashOutRecord::getCreatedTime, cashOutStartTime + " 00:00:00" );
+        wrapper.eq(StringUtils.isNotBlank(paymentStatus), StoreCashOutRecord::getPaymentStatus, paymentStatus);
+        wrapper.le(StringUtils.isNotBlank(cashOutEndTime) , StoreCashOutRecord::getCreatedTime, cashOutEndTime + " 23:59:59");
+        wrapper.ge(StringUtils.isNotBlank(cashOutStartTime), StoreCashOutRecord::getCreatedTime, cashOutStartTime + " 00:00:00" );
         wrapper.orderByDesc(StoreCashOutRecord::getCreatedTime);
         List<StoreCashOutRecord> recordList = storeCashOutRecordMapper.selectList(wrapper);
         IPage<StoreCashOutRecord> storeCashOutRecordIPage = ListToPage.setPage(recordList, page, size);
         StoreCashOutRecordVo vo = new StoreCashOutRecordVo();
         vo.setCashOutRecordList( storeCashOutRecordIPage.getRecords());
-        vo.setCashOutAllMoney(new BigDecimal(recordList.stream().mapToInt(StoreCashOutRecord::getMoney).sum()).divide(new BigDecimal(100), 0, RoundingMode.HALF_UP));
+        vo.setCashOutAllMoney(new BigDecimal(recordList.stream().mapToInt(StoreCashOutRecord::getMoney).sum()).divide(new BigDecimal(100), 2, RoundingMode.DOWN));
         vo.setCashOutNum(recordList.size());
         return vo;
     }