交班相关代码
This commit is contained in:
@@ -1,10 +1,14 @@
|
||||
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 com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONWriter;
|
||||
import com.czg.account.dto.HandoverRecordDTO;
|
||||
import com.czg.account.entity.HandoverRecord;
|
||||
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;
|
||||
@@ -15,6 +19,7 @@ import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
@@ -46,7 +51,6 @@ public class HandoverRecordServiceImpl extends ServiceImpl<HandoverRecordMapper,
|
||||
|
||||
@Override
|
||||
public HandoverTotalVo totalHandoverData() {
|
||||
orderInfoService.historyOrder(0L, "11");
|
||||
Long shopId = StpKit.USER.getShopId(0L);
|
||||
LocalDateTime handoverTime = LocalDateTime.now();
|
||||
HandoverRecord record = super.getOne(query().eq(HandoverRecord::getShopId, shopId).isNull(HandoverRecord::getHandoverTime));
|
||||
@@ -81,6 +85,30 @@ public class HandoverRecordServiceImpl extends ServiceImpl<HandoverRecordMapper,
|
||||
super.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long handover() {
|
||||
Long shopId = StpKit.USER.getShopId(0L);
|
||||
HandoverTotalVo data = totalHandoverData();
|
||||
LocalDateTime loginTime = data.getLoginTime();
|
||||
LocalDateTime handoverTime = data.getHandoverTime();
|
||||
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.setCategoryData(JSON.toJSONString(categoryData, JSONWriter.Feature.WriteMapNullValue));
|
||||
List<HandoverProductListVo> productData = data.getDetailList();
|
||||
entity.setProductData(JSON.toJSONString(productData, JSONWriter.Feature.WriteMapNullValue));
|
||||
super.updateById(entity);
|
||||
return entity.getId();
|
||||
}
|
||||
|
||||
private BigDecimal sumCashAmount(Long shopId, String loginTime, String handoverTime) {
|
||||
return orderInfoService.getHandoverCashAmount(shopId, loginTime, handoverTime);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user